-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
31 lines (25 loc) · 784 Bytes
/
main.cpp
File metadata and controls
31 lines (25 loc) · 784 Bytes
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
#include "window.h"
#include <QApplication>
#include <QTranslator>
#include "unistd.h"
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
QTranslator qtTran;
qtTran.load(QString("qt_") + QLocale::system().name());
a.installTranslator(&qtTran);
QTranslator appTran;
appTran.load(QString("software-alternatives_") + QLocale::system().name(), "/usr/share/software-alternatives/locale");
a.installTranslator(&appTran);
if (getuid() == 0) {
Window w;
w.show();
return a.exec();
} else {
#ifdef QT_DEBUG
system("su-to-root -X -c " + QCoreApplication::applicationFilePath().toUtf8() + "");
#else
system("su-to-root -X -c " + QCoreApplication::applicationFilePath().toUtf8() + "&");
#endif
}
}