Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| f1b5ec81c0 | |||
| 8b8759facb | |||
| 468862ad35 |
@@ -337,7 +337,7 @@ void BatchProcessing::newMessageCli(const QString &message, bool error)
|
|||||||
if(error)
|
if(error)
|
||||||
qWarning() << message;
|
qWarning() << message;
|
||||||
else
|
else
|
||||||
qDebug() << message;
|
qInfo() << message;
|
||||||
}
|
}
|
||||||
|
|
||||||
QJSValue BatchProcessing::getString(const QString &label, const QString &text)
|
QJSValue BatchProcessing::getString(const QString &label, const QString &text)
|
||||||
|
|||||||
@@ -447,7 +447,7 @@ DatabaseTreeView::DatabaseTreeView(Database *database, QWidget *parent) : QWidge
|
|||||||
,_database(database)
|
,_database(database)
|
||||||
{
|
{
|
||||||
QVBoxLayout *vlayout = new QVBoxLayout(this);
|
QVBoxLayout *vlayout = new QVBoxLayout(this);
|
||||||
QHBoxLayout *hlayout = new QHBoxLayout(this);
|
QHBoxLayout *hlayout = new QHBoxLayout;
|
||||||
|
|
||||||
_model = new DatabaseTree(database, this);
|
_model = new DatabaseTree(database, this);
|
||||||
_treeView = new QTreeView(this);
|
_treeView = new QTreeView(this);
|
||||||
@@ -473,7 +473,7 @@ DatabaseTreeView::DatabaseTreeView(Database *database, QWidget *parent) : QWidge
|
|||||||
connect(_filters, &QComboBox::currentIndexChanged, this, &DatabaseTreeView::filterChanged);
|
connect(_filters, &QComboBox::currentIndexChanged, this, &DatabaseTreeView::filterChanged);
|
||||||
filterChanged(_filters->currentIndex());
|
filterChanged(_filters->currentIndex());
|
||||||
|
|
||||||
QStackedWidget *stackedWidget = new QStackedWidget;
|
QStackedWidget *stackedWidget = new QStackedWidget(this);
|
||||||
stackedWidget->addWidget(_treeView);
|
stackedWidget->addWidget(_treeView);
|
||||||
stackedWidget->addWidget(_tableView);
|
stackedWidget->addWidget(_tableView);
|
||||||
|
|
||||||
|
|||||||
+22
-18
@@ -1,19 +1,20 @@
|
|||||||
#include "databaseview.h"
|
|
||||||
#include <QVBoxLayout>
|
|
||||||
#include <QPushButton>
|
|
||||||
#include <QSettings>
|
|
||||||
#include <QDialogButtonBox>
|
|
||||||
#include <QHeaderView>
|
|
||||||
#include <QSqlError>
|
|
||||||
#include <QDebug>
|
|
||||||
#include <QMenu>
|
|
||||||
#include <QContextMenuEvent>
|
|
||||||
#include <QRegularExpression>
|
|
||||||
#include <QGuiApplication>
|
|
||||||
#include <QClipboard>
|
|
||||||
#include <QMimeData>
|
|
||||||
#include <iostream>
|
|
||||||
#include "batchprocessing.h"
|
#include "batchprocessing.h"
|
||||||
|
#include "databaseview.h"
|
||||||
|
#include <QClipboard>
|
||||||
|
#include <QContextMenuEvent>
|
||||||
|
#include <QDebug>
|
||||||
|
#include <QDialogButtonBox>
|
||||||
|
#include <QGuiApplication>
|
||||||
|
#include <QHeaderView>
|
||||||
|
#include <QMenu>
|
||||||
|
#include <QMimeData>
|
||||||
|
#include <QPushButton>
|
||||||
|
#include <QRegularExpression>
|
||||||
|
#include <QSettings>
|
||||||
|
#include <QSqlError>
|
||||||
|
#include <QTimer>
|
||||||
|
#include <QVBoxLayout>
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
const QStringList DEFAULT_COLUMNS = {"EXPTIME", "OBJECT", "RA", "DEC"};
|
const QStringList DEFAULT_COLUMNS = {"EXPTIME", "OBJECT", "RA", "DEC"};
|
||||||
|
|
||||||
@@ -248,7 +249,7 @@ void FITSFileModel::prepareQuery()
|
|||||||
{
|
{
|
||||||
setHeaderData(i++, Qt::Horizontal, column);
|
setHeaderData(i++, Qt::Horizontal, column);
|
||||||
}
|
}
|
||||||
std::cout << sql.toStdString() << std::endl;
|
qDebug() << "DB SQL" << sql;
|
||||||
if(lastError().type() != QSqlError::NoError)
|
if(lastError().type() != QSqlError::NoError)
|
||||||
qDebug() << "Database error" << lastError();
|
qDebug() << "Database error" << lastError();
|
||||||
|
|
||||||
@@ -318,9 +319,12 @@ DataBaseView::DataBaseView(Database *database, QWidget *parent) : QWidget(parent
|
|||||||
m_model = new FITSFileModel(m_database, this);
|
m_model = new FITSFileModel(m_database, this);
|
||||||
|
|
||||||
QSettings settings;
|
QSettings settings;
|
||||||
m_tableView->setModel(m_model);
|
|
||||||
m_model->setColumns(settings.value("databaseview/selectedColumns", DEFAULT_COLUMNS).toStringList());
|
m_model->setColumns(settings.value("databaseview/selectedColumns", DEFAULT_COLUMNS).toStringList());
|
||||||
m_tableView->horizontalHeader()->restoreState(settings.value("databaseview/header").toByteArray());
|
m_tableView->setModel(m_model);
|
||||||
|
QTimer::singleShot(200, [this](){
|
||||||
|
QSettings settings;
|
||||||
|
m_tableView->horizontalHeader()->restoreState(settings.value("databaseview/header").toByteArray());
|
||||||
|
});
|
||||||
|
|
||||||
QHBoxLayout *hlayout = new QHBoxLayout();
|
QHBoxLayout *hlayout = new QHBoxLayout();
|
||||||
layout->addLayout(hlayout);
|
layout->addLayout(hlayout);
|
||||||
|
|||||||
+49
-5
@@ -100,6 +100,28 @@ bool loadFITS(const QString path, ImageInfoData &info, std::shared_ptr<RawImage>
|
|||||||
};
|
};
|
||||||
|
|
||||||
fits_open_diskfile(&file, path.toLocal8Bit().data(), READONLY, &status);
|
fits_open_diskfile(&file, path.toLocal8Bit().data(), READONLY, &status);
|
||||||
|
|
||||||
|
QByteArray buffer;
|
||||||
|
size_t bufferSize = 0;
|
||||||
|
void *bufferPtr = nullptr;
|
||||||
|
if(status == FILE_NOT_OPENED)
|
||||||
|
{
|
||||||
|
qWarning() << "Could not open file directly tring memfile workaround" << path;
|
||||||
|
QFile fr(path);
|
||||||
|
if(fr.open(QIODevice::ReadOnly))
|
||||||
|
{
|
||||||
|
buffer = fr.readAll();
|
||||||
|
bufferSize = buffer.size();
|
||||||
|
bufferPtr = buffer.data();
|
||||||
|
status = 0;
|
||||||
|
fits_open_memfile(&file, "memfile", READONLY, &bufferPtr, &bufferSize, 0, NULL, &status);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
qWarning() << "QFile failed to open file" << path;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
if(status)return checkError();
|
if(status)return checkError();
|
||||||
fits_get_num_hdus(file, &num, &status);
|
fits_get_num_hdus(file, &num, &status);
|
||||||
if(status)return checkError();
|
if(status)return checkError();
|
||||||
@@ -344,15 +366,37 @@ bool loadXISF(const QString &path, ImageInfoData &info, std::shared_ptr<RawImage
|
|||||||
|
|
||||||
bool readFITSHeader(const QString &path, ImageInfoData &info)
|
bool readFITSHeader(const QString &path, ImageInfoData &info)
|
||||||
{
|
{
|
||||||
fitsfile *fr;
|
fitsfile *file;
|
||||||
int status = 0;
|
int status = 0;
|
||||||
QString path2 = makeUNCPath(path);
|
QString path2 = makeUNCPath(path);
|
||||||
fits_open_diskfile(&fr, path2.toLocal8Bit().data(), READONLY, &status);
|
fits_open_diskfile(&file, path2.toLocal8Bit().data(), READONLY, &status);
|
||||||
|
|
||||||
if(fr && status == 0)
|
QByteArray buffer;
|
||||||
|
size_t bufferSize = 0;
|
||||||
|
void *bufferPtr = nullptr;
|
||||||
|
if(status == FILE_NOT_OPENED)
|
||||||
{
|
{
|
||||||
status = loadFITSHeader(fr, info);
|
qWarning() << "Could not open file directly tring memfile workaround" << path;
|
||||||
fits_close_file(fr, &status);
|
QFile fr(path);
|
||||||
|
if(fr.open(QIODevice::ReadOnly))
|
||||||
|
{
|
||||||
|
buffer = fr.readAll();
|
||||||
|
bufferSize = buffer.size();
|
||||||
|
bufferPtr = buffer.data();
|
||||||
|
status = 0;
|
||||||
|
fits_open_memfile(&file, "memfile", READONLY, &bufferPtr, &bufferSize, 0, NULL, &status);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
qWarning() << "QFile failed to open file" << path;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(file && status == 0)
|
||||||
|
{
|
||||||
|
status = loadFITSHeader(file, info);
|
||||||
|
fits_close_file(file, &status);
|
||||||
}
|
}
|
||||||
return status == 0;
|
return status == 0;
|
||||||
}
|
}
|
||||||
|
|||||||
+20
-2
@@ -1,15 +1,28 @@
|
|||||||
#include "mainwindow.h"
|
#include "mainwindow.h"
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
#include <QSurfaceFormat>
|
|
||||||
#include <QTranslator>
|
|
||||||
#include <QCommandLineParser>
|
#include <QCommandLineParser>
|
||||||
#include <QSettings>
|
#include <QSettings>
|
||||||
|
#include <QSurfaceFormat>
|
||||||
|
#include <QTranslator>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include "../thumbnailer/genthumbnail.h"
|
#include "../thumbnailer/genthumbnail.h"
|
||||||
#ifdef Q_OS_WIN64
|
#ifdef Q_OS_WIN64
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
bool DEBUG_LOG = false;
|
||||||
|
|
||||||
|
QtMessageHandler defaultHandler = nullptr;
|
||||||
|
|
||||||
|
void messageHandler(QtMsgType type, const QMessageLogContext &ctx, const QString &message)
|
||||||
|
{
|
||||||
|
if(defaultHandler)
|
||||||
|
{
|
||||||
|
if(DEBUG_LOG || type != QtMsgType::QtDebugMsg)
|
||||||
|
defaultHandler(type, ctx, message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
#ifdef __linux__
|
#ifdef __linux__
|
||||||
@@ -29,6 +42,7 @@ int main(int argc, char *argv[])
|
|||||||
freopen("CONOUT$", "w", stderr);
|
freopen("CONOUT$", "w", stderr);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
defaultHandler = qInstallMessageHandler(messageHandler);
|
||||||
|
|
||||||
QCommandLineParser cmd;
|
QCommandLineParser cmd;
|
||||||
cmd.addOption({"gl", "Use desktop OpenGL. This is default on x86 and MacOS platform."});
|
cmd.addOption({"gl", "Use desktop OpenGL. This is default on x86 and MacOS platform."});
|
||||||
@@ -40,6 +54,7 @@ int main(int argc, char *argv[])
|
|||||||
cmd.addOption({"scriptarg", "String that will be passed to script as variable \"scriparg\"", "arg"});
|
cmd.addOption({"scriptarg", "String that will be passed to script as variable \"scriparg\"", "arg"});
|
||||||
cmd.addOption({"outdir", "Output dir for script (default: CWD)", "dir", "."});
|
cmd.addOption({"outdir", "Output dir for script (default: CWD)", "dir", "."});
|
||||||
cmd.addOption({"noexit", "Do not exit application when script finish"});
|
cmd.addOption({"noexit", "Do not exit application when script finish"});
|
||||||
|
cmd.addOption({"debug", "Print debug info"});
|
||||||
cmd.addHelpOption();
|
cmd.addHelpOption();
|
||||||
QStringList cmdArgs;
|
QStringList cmdArgs;
|
||||||
for(int i = 0; i < argc; i++)
|
for(int i = 0; i < argc; i++)
|
||||||
@@ -51,6 +66,9 @@ int main(int argc, char *argv[])
|
|||||||
if(cmd.isSet("gles"))
|
if(cmd.isSet("gles"))
|
||||||
useGLES = true;
|
useGLES = true;
|
||||||
|
|
||||||
|
if(cmd.isSet("debug"))
|
||||||
|
DEBUG_LOG = true;
|
||||||
|
|
||||||
if(cmd.isSet("thumb"))
|
if(cmd.isSet("thumb"))
|
||||||
{
|
{
|
||||||
QCoreApplication app(argc, argv);
|
QCoreApplication app(argc, argv);
|
||||||
|
|||||||
+42
-34
@@ -1,37 +1,38 @@
|
|||||||
|
#include "about.h"
|
||||||
|
#include "batchprocessing.h"
|
||||||
|
#include "filemanager.h"
|
||||||
|
#include "histogram.h"
|
||||||
|
#include "loadrunable.h"
|
||||||
#include "mainwindow.h"
|
#include "mainwindow.h"
|
||||||
#include <QScrollArea>
|
#include "markedfiles.h"
|
||||||
|
#include "settingsdialog.h"
|
||||||
|
#include "statusbar.h"
|
||||||
|
#include <QActionGroup>
|
||||||
|
#include <QDebug>
|
||||||
|
#include <QDesktopServices>
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
|
#include <QDockWidget>
|
||||||
|
#include <QFileDialog>
|
||||||
|
#include <QGuiApplication>
|
||||||
|
#include <QImageReader>
|
||||||
|
#include <QImageWriter>
|
||||||
|
#include <QJsonDocument>
|
||||||
#include <QKeyEvent>
|
#include <QKeyEvent>
|
||||||
#include <QMenu>
|
#include <QMenu>
|
||||||
#include <QMenuBar>
|
#include <QMenuBar>
|
||||||
#include <QFileDialog>
|
|
||||||
#include <QStandardPaths>
|
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
|
#include <QMimeDatabase>
|
||||||
|
#include <QNetworkReply>
|
||||||
#include <QProgressDialog>
|
#include <QProgressDialog>
|
||||||
#include <QDebug>
|
#include <QScrollArea>
|
||||||
#include <QDockWidget>
|
#include <QSettings>
|
||||||
#include <QActionGroup>
|
#include <QStandardPaths>
|
||||||
|
#include <QStatusBar>
|
||||||
|
#include <QThreadPool>
|
||||||
|
#include <QSessionManager>
|
||||||
|
#include <QTimer>
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <QSettings>
|
|
||||||
#include <QGuiApplication>
|
|
||||||
#include <QThreadPool>
|
|
||||||
#include <QStatusBar>
|
|
||||||
#include <QImageReader>
|
|
||||||
#include <QImageWriter>
|
|
||||||
#include <QMimeDatabase>
|
|
||||||
#include <QDesktopServices>
|
|
||||||
#include <QJsonDocument>
|
|
||||||
#include <QNetworkReply>
|
|
||||||
#include <QTimer>
|
|
||||||
#include "loadrunable.h"
|
|
||||||
#include "markedfiles.h"
|
|
||||||
#include "about.h"
|
|
||||||
#include "statusbar.h"
|
|
||||||
#include "settingsdialog.h"
|
|
||||||
#include "histogram.h"
|
|
||||||
#include "batchprocessing.h"
|
|
||||||
#include "filemanager.h"
|
|
||||||
|
|
||||||
#ifdef __linux__
|
#ifdef __linux__
|
||||||
#include <sys/ioctl.h>
|
#include <sys/ioctl.h>
|
||||||
@@ -576,16 +577,23 @@ void MainWindow::loadFile(const QString &path)
|
|||||||
if(!path.isEmpty())
|
if(!path.isEmpty())
|
||||||
{
|
{
|
||||||
QFileInfo info(path);
|
QFileInfo info(path);
|
||||||
m_ringList->setFile(info.canonicalFilePath());
|
if(info.exists() && info.isReadable())
|
||||||
updateWindowTitle();
|
{
|
||||||
if(info.isDir())
|
m_ringList->setFile(info.canonicalFilePath());
|
||||||
_lastDir = info.absolutePath();
|
updateWindowTitle();
|
||||||
|
if(info.isDir())
|
||||||
|
_lastDir = info.absolutePath();
|
||||||
|
else
|
||||||
|
_lastDir = info.canonicalPath();
|
||||||
|
QSettings settings;
|
||||||
|
settings.setValue("mainwindow/lastdir", _lastDir);
|
||||||
|
if(settings.value("settings/bestfit", false).toBool())
|
||||||
|
m_image->bestFit();
|
||||||
|
}
|
||||||
else
|
else
|
||||||
_lastDir = info.canonicalPath();
|
{
|
||||||
QSettings settings;
|
qWarning() << "File doesn't exist or is not readable";
|
||||||
settings.setValue("mainwindow/lastdir", _lastDir);
|
}
|
||||||
if(settings.value("settings/bestfit", false).toBool())
|
|
||||||
m_image->bestFit();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -676,6 +676,27 @@ bool File::modifyFITSRecords(const FITSRecordModify *modify)
|
|||||||
int status = 0;
|
int status = 0;
|
||||||
QString path = makeUNCPath(_path);
|
QString path = makeUNCPath(_path);
|
||||||
fits_open_diskfile(&file, path.toLocal8Bit().data(), READWRITE, &status);
|
fits_open_diskfile(&file, path.toLocal8Bit().data(), READWRITE, &status);
|
||||||
|
QByteArray buffer;
|
||||||
|
size_t bufferSize = 0;
|
||||||
|
void *bufferPtr = nullptr;
|
||||||
|
if(status == FILE_NOT_OPENED)
|
||||||
|
{
|
||||||
|
qWarning() << "Could not open file directly tring memfile workaround" << path;
|
||||||
|
QFile fr(path);
|
||||||
|
if(fr.open(QIODevice::ReadOnly))
|
||||||
|
{
|
||||||
|
buffer = fr.readAll();
|
||||||
|
bufferSize = buffer.size();
|
||||||
|
bufferPtr = buffer.data();
|
||||||
|
status = 0;
|
||||||
|
fits_open_memfile(&file, "memfile", READONLY, &bufferPtr, &bufferSize, 0, NULL, &status);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
qWarning() << "QFile failed to open file" << path;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
int num = 0;
|
int num = 0;
|
||||||
fits_get_num_hdus(file, &num, &status);
|
fits_get_num_hdus(file, &num, &status);
|
||||||
if(status)
|
if(status)
|
||||||
|
|||||||
Reference in New Issue
Block a user