-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.cpp
42 lines (38 loc) · 1.48 KB
/
main.cpp
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
#include "mainwindow.h"
#include <QApplication>
#include <QDir>
#include <QFileOpenEvent>
#include <QFontDatabase>
#include <QWindow>
#include "darkdetect.h"
#include <QStyleHints>
#ifdef Q_OS_WIN
#include "Shlobj.h"
#endif
int main(int argc, char *argv[]) {
QApplication a(argc, argv);
QCoreApplication::setOrganizationName("Custom Street");
QCoreApplication::setOrganizationDomain("fortunestreetmodding.github.io");
QCoreApplication::setApplicationName("FortuneAvenue");
QFontDatabase::addApplicationFont(":/fonts/Lato-Regular.ttf");
initWindowPaletteSettings(a.styleHints()->colorScheme()); // pass through the OS light/dark theme setting
#ifdef Q_OS_WIN
QSettings s("HKEY_CURRENT_USER\\SOFTWARE\\CLASSES", QSettings::NativeFormat);
QString path = QDir::toNativeSeparators(qApp->applicationFilePath());
//qDebug() << path;
s.setValue("customstreet.fortuneavenue/DefaultIcon/.", path);
s.setValue(".frb/.","customstreet.fortuneavenue");
s.setValue("customstreet.fortuneavenue/shell/open/command/.", QStringLiteral("\"%1\"").arg(path) + " \"%1\"");
SHChangeNotify(SHCNE_ASSOCCHANGED, SHCNF_IDLIST, nullptr, nullptr);
#endif
MainWindow w(a);
#ifdef Q_OS_LINUX
auto iconPath = QDir(QApplication::applicationDirPath()).filePath("../../AppIcon.png");
if (QFile::exists(iconPath)) {
w.setWindowIcon(QIcon(iconPath));
}
#endif
w.setWindowTitle(QString("Fortune Avenue %1").arg(FORTUNE_AVENUE_VERSION));
w.show();
return a.exec();
}