-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
54 lines (49 loc) · 1.86 KB
/
Copy pathmain.cpp
File metadata and controls
54 lines (49 loc) · 1.86 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
// This file is part of AAIMS.
// You WON'T be guaranteed to be permitted with this file unless you're under BSD-3 License.
// See https://spdx.org/licenses/BSD-3-Clause.html
#include <QApplication>
#include <QCommandLineParser>
#include "dialogs/AccountLoginDialog.h"
#include "dialogs/oobeDialog.h"
#include "managements/AccountManager.h"
#include "managements/ClassManager.h"
#include "managements/CourseManager.h"
#include "MainWindow.h"
#include "managements/RatingManager.h"
int main(int argc, char *argv[]) {
const QApplication a(argc, argv);
QApplication::setApplicationName("AAIMS");
QApplication::setApplicationVersion("1.0");
qInfo() << "Loading courses...";
aaims::manager::course::init();
qInfo() << "Loading departments & classes...";
aaims::manager::classes::init();
qInfo() << "Loading accounts...";
aaims::manager::account::init();
qInfo() << "Loading ratings...";
aaims::manager::rating::init();
while (aaims::manager::account::isLoading()) {
QCoreApplication::processEvents();
}
if (aaims::manager::account::isEmpty()) {
qInfo() << "No account exists!";
if (oobeDialog startDialog; startDialog.exec() == QDialog::Rejected) {
qCritical() << "No account exists and user denied to register!";
exit(0);
}
}
while (aaims::restart) {
if (aaims::manager::account::logged == nullptr) {
if (AccountLoginDialog loginDlg; loginDlg.exec() == QDialog::Rejected) {
QThreadPool::globalInstance()->waitForDone();
exit(0);
}
qInfo() << "Logged in as" << aaims::manager::account::logged->name;
}
MainWindow main_window;
main_window.show();
qInfo() << "Exited with code" << QApplication::exec();
}
QThreadPool::globalInstance()->waitForDone();
return 0;
}