123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172 |
- #include <QApplication>
- #include <QTranslator>
- #include <QDesktopWidget>
- #include <QScreen>
- #include <QTextCodec>
- #include <locale>
- #include "../../helper/GenerateMiniDump.h"
- #include "EXLoginWidget.h"
- #include "MainWindow.h"
- #include "FileUtil.h"
- #include "importDataUtil.h"
- #include "EXConfig.h"
- int main(int argc, char *argv[])
- {
- DUMP_FILE_HOOK_HANLE;
- QTextCodec::setCodecForLocale(QTextCodec::codecForName("UTF-8"));
- std::locale::global(std::locale(""));
- #ifndef QT_NO_OPENGL
- QCoreApplication::setAttribute(Qt::AA_ShareOpenGLContexts, true);
- #endif
- QCoreApplication::setAttribute(Qt::AA_DontCreateNativeWidgetSiblings, true);
- QCoreApplication::setAttribute(Qt::AA_DisableShaderDiskCache, true);
- // Set application attributes
- #if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
- QCoreApplication::setAttribute(Qt::AA_UseHighDpiPixmaps, true);
- QApplication::setAttribute(Qt::AA_EnableHighDpiScaling, true);
- #endif
- QCoreApplication::setAttribute(Qt::AA_CompressHighFrequencyEvents, true);
- QApplication a(argc, argv);
- a.setApplicationVersion("2.0");
- a.setApplicationName("ExpertClient");
- a.setApplicationDisplayName("伪装防护评估系统软件");
- QFont font;
- font.setPointSize(14);
- a.setFont(font);
- Q_INIT_RESOURCE(qfluentwidgets);
- QTranslator *translator = new QTranslator();
- translator->load(QLocale::system(), ":/resource/i18n/qfluentwidgets_zh.qm");
- QCoreApplication::installTranslator(translator);
- QIcon icon = QIcon(":/resource/logo.png");
- a.setWindowIcon(icon);
- int roleType = EXConfig::roleType();
- if (roleType != QFUser::SuperAdmin) {
- bool result = FileUtil().importEngineerFile();
- if (result) {
- ImportDataUtil().importSystemData();
- EXLoginWidget w;
- // 居中显示窗体
- w.move((QApplication::primaryScreen()->availableGeometry().width() - w.width()) / 2,
- (QApplication::primaryScreen()->availableGeometry().height() - w.height()) / 2);
- w.show();
- return a.exec();
- } else {
- qApp->exit();
- }
- }
- return 0;
- }
|