-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.cpp
56 lines (47 loc) · 1.61 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
50
51
52
53
54
55
56
//#include "ImageWindow.h"
#include "MainDialog.h"
#include <QApplication>
#include <omp.h>
#include <QCommandLineParser>
#include "definitions.h"
#include <iostream>
#ifdef _MSC_VER
#define _CRT_SECURE_NO_DEPRECATE
#endif
#include <stdio.h>
using namespace std;
void redirectOutput(char const * const filename) {
freopen(filename, "w", stdout);
freopen(filename, "w", stderr);
printf("printf works\n");
cout << "cout works\n";
}
int main(int argc, char *argv[])
{
// redirectOutput("output.txt");
#ifdef _DEBUG
omp_set_num_threads(1);
#else
omp_set_num_threads(8);
#endif
QApplication app(argc, argv);
app.setApplicationName("pxlpeep");
app.setOrganizationName("shaperilio");
app.setOrganizationDomain("https://github.com/shaperilio");
app.setApplicationVersion(VERSION_STRING);
QCommandLineParser parser;
parser.setApplicationDescription("pxlpeep image viewer");
parser.addHelpOption();
parser.addVersionOption();
parser.addPositionalArgument("image(s)", "the image(s) file to open");
parser.addOption(QCommandLineOption("f", "fill the screen with the images to open"));
parser.addOption(QCommandLineOption("s", "sync open windows"));
parser.process(app);
for (QString const &image : parser.positionalArguments())
cout << "Will attempt to open " << image.toStdString() << " at startup." << endl;
MainDialog dlg;
dlg.filesToOpenAtStartup = parser.positionalArguments();
dlg.fillScreenAtStartup = parser.optionNames().contains("f");
dlg.syncOpenWindowsAtStartup = parser.optionNames().contains("s");
return dlg.exec();
}