forked from collin80/SavvyCAN
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.cpp
59 lines (45 loc) · 1.61 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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#include "mainwindow.h"
#include <QApplication>
class SavvyCANApplication : public QApplication
{
public:
MainWindow *mainWindow;
SavvyCANApplication(int &argc, char **argv) : QApplication(argc, argv)
{
}
bool event(QEvent *event) override
{
if (event->type() == QEvent::FileOpen)
{
QFileOpenEvent *openEvent = static_cast<QFileOpenEvent *>(event);
mainWindow->handleDroppedFile(openEvent->file());
}
return QApplication::event(event);
}
};
int main(int argc, char *argv[])
{
#ifdef QT_DEBUG
//uncomment for verbose debug data in application output
//qputenv("QT_FATAL_WARNINGS", "1");
//qSetMessagePattern("Type: %{type}\nProduct Name: %{appname}\nFile: %{file}\nLine: %{line}\nMethod: %{function}\nThreadID: %{threadid}\nThreadPtr: %{qthreadptr}\nMessage: %{message}");
#endif
SavvyCANApplication a(argc, argv);
//Add a local path for Qt extensions, to allow for per-application extensions.
a.addLibraryPath("plugins");
//These things are used by QSettings to set up setting storage
a.setOrganizationName("EVTV");
a.setApplicationName("SavvyCAN");
a.setOrganizationDomain("evtv.me");
QSettings::setDefaultFormat(QSettings::IniFormat);
a.mainWindow = new MainWindow();
QSettings settings;
int fontSize = settings.value("Main/FontSize", 9).toUInt();
QFont sysFont = QFont(); //get default font
sysFont.setPointSize(fontSize);
a.setFont(sysFont);
a.mainWindow->show();
int retCode = a.exec();
delete a.mainWindow; a.mainWindow = NULL;
return retCode;
}