code_app/app/upgrade/main.cpp

45 lines
1.0 KiB
C++
Raw Normal View History

2022-06-29 09:46:00 +00:00
#include "mainwindow.h"
#include <QApplication>
#include "HGUpgrade.h"
2022-06-29 09:46:00 +00:00
int main(int argc, char *argv[])
{
int type = 0;
std::string src;
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, "-src="))
src = z + strlen("-src=");
else if (z == strstr(z, "-desc="))
desc = z + strlen("-desc=");
}
if (1 == type)
PostInstallInfo(src, desc);
else if (2 == type)
PostUninstallInfo(src, desc);
else if (3 == type && !pkgPath.empty())
{
QApplication a(argc, argv);
MainWindow w(pkgPath, src, desc);
w.show();
a.exec();
}
return 0;
2022-06-29 09:46:00 +00:00
}