Repository navigation
Expand file tree
/
Copy pathmain.cpp
More file actions
68 lines (52 loc) · 1.45 KB
/
Copy pathmain.cpp
File metadata and controls
68 lines (52 loc) · 1.45 KB
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
57
58
59
60
61
62
63
64
65
66
67
68
#include <QApplication>
#include <QProcess>
#include "mainwindow.h"
#include "welcomescreen.h"
void restartApplication() {
QString program = QCoreApplication::applicationFilePath();
QProcess::startDetached(program, QStringList()); // Relaunch app
QApplication::quit(); // Close current instance
}
int main(int argc, char *argv[]) {
QApplication a(argc, argv);
a.setWindowIcon(QIcon(":/images/codenheimer_icon.png"));
int ret = MainWindow::firstTimeInit();
if (ret == -1) {
return -1; // Exit if first-time setup fails
}
if (ret == 1) {
// Launch onboarding flow
welcomeScreen wel;
wel.show();
int exitCode = a.exec(); // Run onboarding
if (exitCode == 123) { // Use a special code for restart
restartApplication();
}
return exitCode;
}
MainWindow w;
w.show();
return a.exec();
}
// #include "mainwindow.h"
// #include "welcomescreen.h"
// #include <QApplication>
// int main(int argc, char *argv[])
// {
// QApplication a(argc, argv);
// //exampleUsage();
// a.setWindowIcon(QIcon(":/images/codenheimer_icon3.png"));
// int ret=MainWindow::firstTimeInit();
// if(ret==-1){
// return -1;
// }
// if(ret==1){
// //launch onboarding flow
// welcomeScreen wel;
// wel.show();
// return a.exec();
// }
// MainWindow w;
// w.show();
// return a.exec();
// }