2022-06-29 09:46:00 +00:00
|
|
|
#include "mainwindow.h"
|
|
|
|
|
|
|
|
#include <QApplication>
|
2022-07-01 05:57:27 +00:00
|
|
|
#include <QScreen>
|
2022-06-30 08:42:46 +00:00
|
|
|
#include "HGUpgrade.h"
|
2022-06-29 09:46:00 +00:00
|
|
|
|
|
|
|
int main(int argc, char *argv[])
|
|
|
|
{
|
2022-06-30 08:42:46 +00:00
|
|
|
int type = 0;
|
|
|
|
std::string desc;
|
|
|
|
std::string pkgPath;
|
|
|
|
|
|
|
|
for (int i = 1; i < argc; i++)
|
|
|
|
{
|
|
|
|
char* z = argv[i];
|
|
|
|
|
|
|
|
if (0 == strcmp(z, "-type=postinstallinfo"))
|
|
|
|
type = 1;
|
|
|
|
else if (0 == strcmp(z, "-type=postuninstallinfo"))
|
|
|
|
type = 2;
|
|
|
|
else if (0 == strcmp(z, "-type=upgrade"))
|
|
|
|
type = 3;
|
|
|
|
else if (z == strstr(z, "-pkgpath="))
|
|
|
|
pkgPath = z + strlen("-pkgpath=");
|
|
|
|
else if (z == strstr(z, "-desc="))
|
|
|
|
desc = z + strlen("-desc=");
|
|
|
|
}
|
|
|
|
|
|
|
|
if (1 == type)
|
2022-07-01 03:02:41 +00:00
|
|
|
PostInstallInfo(desc);
|
2022-06-30 08:42:46 +00:00
|
|
|
else if (2 == type)
|
2022-07-01 03:02:41 +00:00
|
|
|
PostUninstallInfo(desc);
|
2022-06-30 08:42:46 +00:00
|
|
|
else if (3 == type && !pkgPath.empty())
|
|
|
|
{
|
|
|
|
QApplication a(argc, argv);
|
2022-07-01 05:57:27 +00:00
|
|
|
|
2022-07-01 03:02:41 +00:00
|
|
|
MainWindow w(pkgPath, desc);
|
2022-07-01 05:57:27 +00:00
|
|
|
QScreen *screen = QGuiApplication::primaryScreen();
|
|
|
|
w.move((screen->size().width() - w.width()) / 2, (screen->size().height() - w.height()) / 2);
|
2022-06-30 08:42:46 +00:00
|
|
|
w.show();
|
|
|
|
a.exec();
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
2022-06-29 09:46:00 +00:00
|
|
|
}
|