-
Notifications
You must be signed in to change notification settings - Fork 11
/
main.cpp
51 lines (39 loc) · 1.12 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
#include <cmath>
#include "Python.h"
#include "UI/mainview.h"
#include <QApplication>
#include <QDebug>
//snippet storage is static cause
//it it should be only created once
static Snippets *snip;
//main view is static so it can be shared
//and only created once
static MainView *mainView;
int main(int argc, char *argv[]) {
//need to set program details
QCoreApplication::setOrganizationName("Bhathiya Perera");
QCoreApplication::setOrganizationDomain("simpll.info");
QCoreApplication::setApplicationName("expressPython");
//non modified arguments must be passed
QApplication app(argc, argv);
if (argc > 1) {
QMessageBox msgBox;
QString text = "";
for(int i = 0; i < argc; i++) {
text.append(argv[i]);
text.append(" ");
}
msgBox.setText(text);
msgBox.exec();
}
wchar_t name[] = L"expressPython";
Py_SetProgramName(name);
snip = new Snippets();
mainView = new MainView();
mainView->SetSnippets(snip);
mainView->show();
int result = app.exec();
delete snip;
delete mainView;
return result;
}