-
Notifications
You must be signed in to change notification settings - Fork 14
Expand file tree
/
Copy pathMain.cpp
More file actions
30 lines (23 loc) · 719 Bytes
/
Main.cpp
File metadata and controls
30 lines (23 loc) · 719 Bytes
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
#include "StopwatchViewer.h"
#include <iostream>
#include <string>
#include <QApplication>
#include <QtGui>
QCoreApplication* createApplication(int& argc, char* argv[]) {
for (int i = 1; i < argc; ++i) {
if (!qstrcmp(argv[i], "-c")) {
return new QCoreApplication(argc, argv);
}
}
return new QApplication(argc, argv);
}
int main(int argc, char* argv[]) {
std::unique_ptr<StopwatchViewer> stopwatchViewer;
QScopedPointer<QCoreApplication> app(createApplication(argc, argv));
if (qobject_cast<QApplication*>(app.data())) {
stopwatchViewer = std::make_unique<StopwatchViewer>(false);
} else {
stopwatchViewer = std::make_unique<StopwatchViewer>(true);
}
return app->exec();
}