PylonRecorder/main.cpp
2023-11-24 15:29:05 +01:00

49 lines
1.7 KiB
C++

#include "pylonrecorder.h"
#include <QSettings>
#include <QPoint>
#include <QApplication>
#include <QCommandLineParser>
#include <pylon/PylonIncludes.h>
#include "mylogger.h"
int main(int argc, char *argv[])
{
Logger::init();
qInfo() << "PylonRecorder start";
QApplication app(argc, argv);
QGuiApplication::setApplicationDisplayName(PylonRecorder::tr("Pylon Recorder"));
QGuiApplication::setOrganizationName("Bendalab");
QGuiApplication::setOrganizationDomain("neuroetho.uni-tuebingen.de");
QGuiApplication::setApplicationName("PylonRecorder");
QGuiApplication::setApplicationVersion("0.1.0");
QCommandLineParser commandLineParser;
commandLineParser.addHelpOption();
commandLineParser.addPositionalArgument(PylonRecorder::tr("[file]"), PylonRecorder::tr("Image file to open."));
commandLineParser.process(QCoreApplication::arguments());
QSettings settings;
int width = settings.value("app/width", 1024).toInt();
int height = settings.value("app/height", 768).toInt();
int x = settings.value("app/pos_x", 100).toInt();
int y = settings.value("app/pos_y", 100).toInt();
PylonRecorder recorder;
if (!commandLineParser.positionalArguments().isEmpty()
&& !recorder.loadFile(commandLineParser.positionalArguments().front())) {
return -1;
}
recorder.resize(width, height);
recorder.move(x, y);
recorder.show();
int ret = app.exec();
QPoint pos = recorder.pos();
settings.setValue("app/width", recorder.width());
settings.setValue("app/height", recorder.height());
settings.setValue("app/pos_x", pos.x());
settings.setValue("app/pos_y", pos.y());
qInfo() << "PylonRecorder stop";
//Logger::clean();
return ret;
}