-
Notifications
You must be signed in to change notification settings - Fork 63
/
Copy pathmain.cpp
56 lines (46 loc) · 1.4 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
#include "gui/qdialogslots.h"
#include <QApplication>
#include <QTranslator>
#include <QInputDialog>
#include <QDebug>
#include "util/roottools.h"
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
QDialogSlots q;
//languages can only be set after set QApplication
if(QLocale::system().name().toStdString() == "zh_CN"){
q.trans_.load(":/lang/zh_CN.qm");
QApplication::installTranslator(&(q.trans_));
q.ui->retranslateUi(&q);
}else{
q.trans_.load(":/lang/en_US.qm");
QApplication::installTranslator(&(q.trans_));
q.ui->retranslateUi(&q);
}
q.refresh_main();
#if (defined USE_MOBILE)
q.showFullScreen();
#else
q.showNormal();
#endif
#ifdef ROOTTOOL_NEED
#if (defined PASSWORD_NEED)
QInputDialog passbox;
bool isok;
QString passwd = passbox.getText(NULL, QApplication::translate("Util", "Password"),
QApplication::translate("Util", "Please input your root password,defalut alpine."),
QLineEdit::Normal,
"alpine",
&isok);
if(!isok)
exit(0);
//ios need password for su
RootTools::Configure(passwd, true);
#endif
RootTools::Instance();
#endif
//Check if current session have root privileges
q.check_writable();
return a.exec();
}