[main] store position and size of window
This commit is contained in:
parent
f1bbf54244
commit
b1f49966c4
16
main.cpp
16
main.cpp
@ -1,4 +1,6 @@
|
||||
#include "pylonrecorder.h"
|
||||
#include <QSettings>
|
||||
#include <QPoint>
|
||||
#include <QApplication>
|
||||
#include <QCommandLineParser>
|
||||
#include <pylon/PylonIncludes.h>
|
||||
@ -15,12 +17,26 @@ int main(int argc, char *argv[])
|
||||
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());
|
||||
return ret;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user