-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
52 lines (42 loc) · 1.59 KB
/
Copy pathmain.cpp
File metadata and controls
52 lines (42 loc) · 1.59 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
#include "core/AppMetadata.h"
#include "core/SettingsManager.h"
#include "logging/CrashLogger.h"
#include "platform/WinEnginePaths.h"
#include "ui/MainWindow.h"
#include <QApplication>
#include <QCoreApplication>
#include <QString>
int main(int argc, char *argv[])
{
if (!WinEnginePaths::setupDllSearchPath())
return 1;
// Register the deployed plugin directory before QApplication is created,
// so Qt can locate the "windows" platform plugin regardless of how the
// runtime prefix is auto-detected. The path is derived from the running
// executable, so it stays portable after the archive is extracted.
const QString pluginsDirectory = WinEnginePaths::pluginsDirectory();
if (!pluginsDirectory.isEmpty())
QCoreApplication::addLibraryPath(pluginsDirectory);
CrashLogger::instance().install(AppMetadata::applicationVersion());
Q_INIT_RESOURCE(embedded_license);
Q_INIT_RESOURCE(embedded_app_icons);
QApplication app(argc, argv);
QApplication::setQuitOnLastWindowClosed(false);
QCoreApplication::setApplicationName(QStringLiteral("ShiShiga Workspace"));
SettingsManager &settings = SettingsManager::instance();
settings.load();
MainWindow window(settings);
window.show();
QObject::connect(&app, &QApplication::aboutToQuit, [&settings]() {
settings.save();
});
try {
return app.exec();
} catch (const std::exception &exception) {
CrashLogger::instance().logException(exception);
return 1;
} catch (...) {
CrashLogger::instance().logUnknownException();
return 1;
}
}