-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.cpp
34 lines (30 loc) · 1.1 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
#include "sideloader.h"
#include <QApplication>
#include <QLocale>
#include <QTranslator>
#include <QMessageBox>
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
QTranslator translator;
const QStringList uiLanguages = QLocale::system().uiLanguages();
for (const QString &locale : uiLanguages) {
const QString baseName = "Sideloader_" + QLocale(locale).name();
if (translator.load(":/i18n/" + baseName)) {
a.installTranslator(&translator);
break;
}
}
Sideloader w;
w.show();
std::string check="whereis snapd"; //snapd not installed
std::string result=w.pipeTheCommand(check);
if (result.compare("snapd:\n")==0){
QMessageBox::information(nullptr,"Package manager not installed","Are you sure snapd is installed? You can't use this program without it!");
w.whoopsie();
}
check="snap";
int intresult = system(check.c_str());
if(intresult==127 ||intresult==32512 || intresult==126 ||intresult==1) w.whoopsie(); //command not found or not executable or some other error
return a.exec();
}