-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
42 lines (36 loc) · 1.14 KB
/
Copy pathmain.cpp
File metadata and controls
42 lines (36 loc) · 1.14 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
//Main.cpp
#include "messageHandler.h"
#include "mainwindow.h"
#include <QApplication>
#include <QMessagebox>
#include "initManager.h"
int main(int argc, char *argv[])
{
// Install the handler before creating the QApplication
qInstallMessageHandler(messageHandler);
//Create application object
QApplication a(argc, argv);
//Set up database
CInitManager initManager;
bool resourcePathsOk = initManager.resolvePaths();
if (!resourcePathsOk)
{
qCritical() << "FATAL: Resource directories not found.";
QMessageBox::critical(nullptr, "Initialization Error",
"AtMap could not resolve resource paths.");
return -1;
}
QString dbFilename;
bool ok = initManager.copyDatabaseToAppLocal(dbFilename);
if (!ok)
{
// Critical failure: log it and tell the user
qCritical() << "FATAL: Unable to move database to appdata/local/AtMap.";
QMessageBox::critical(nullptr, "Initialization Error",
"AtMap could not set up its data folder in appdata/local.");
return -1;
}
MainWindow w(dbFilename);
w.show();
return a.exec();
}