-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.cpp
49 lines (41 loc) · 1.28 KB
/
main.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#include <QApplication>
#include <QStyle>
#include <QDesktopWidget>
#include <QCommandLineParser>
#include "form.h"
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
a.setApplicationName("Screenshotter");
a.setApplicationVersion(VERSION_STRING);
QCommandLineParser parser;
parser.setApplicationDescription("Screenshotter app");
parser.addHelpOption();//Windows only :(
parser.addVersionOption();
QCommandLineOption workingMode (QStringList() << "m" << "mode",
QCoreApplication::translate("main", "Working mode."),
"screenshot");
parser.addOption(workingMode);
parser.process(a);
QString mode = parser.value(workingMode);
Form w;
w.setGeometry(
QStyle::alignedRect(
Qt::LeftToRight,
Qt::AlignCenter,
w.size(),
qApp->desktop()->availableGeometry()
)
);
qDebug() << "mode:" << mode;
if (mode == "screenshot"){
QTextStream(stdout) << "Started mode: " << mode << endl;
w.show();
}
else {
QTextStream(stdout) << "Unsupported mode: " << mode << endl;
return 1;
}
a.exec();
return 0;
}