| 11 | |
| 12 | |
| 13 | MainWindow::MainWindow(QWidget *parent) : |
| 14 | QMainWindow(parent), |
| 15 | ui(new Ui::MainWindow) |
| 16 | { |
| 17 | ui->setupUi(this); |
| 18 | |
| 19 | // 1) 启动时先做一次检查 |
| 20 | if (!initialCheck()) { |
| 21 | //if(!isTempActivate()){ |
| 22 | // 如果未通过验证,直接退出程序 |
| 23 | std::exit(0); |
| 24 | return; |
| 25 | //} |
| 26 | } |
| 27 | |
| 28 | |
| 29 | ui->generalPanel->setActivateStartTime(licStartTime); |
| 30 | ui->generalPanel->setExpirationTime(licStartTime.addMSecs(MAX_MSECS)); |
| 31 | ui->generalPanel->setCurrentTime(toolCurrentTime); |
| 32 | |
| 33 | //InternetTimeFetcher fetcher; |
| 34 | //fetcher.fetchInternetTime(toolCurrentTime); |
| 35 | softElapsedTime.start(); |
| 36 | |
| 37 | // 2) 每分钟 更新 QDateTime toolCurrentTime; QTimer softElapsedTime; |
| 38 | connect(&checkLicTimer, &QTimer::timeout, this, &MainWindow::onCheckLic); |
| 39 | checkLicTimer.start(60 * 1000); // 1分钟 |
| 40 | |
| 41 | // 每秒更新UI |
| 42 | connect(&updateCurrentDtTimer, &QTimer::timeout, this, &MainWindow::onUpdateTimeOnUI); |
| 43 | updateCurrentDtTimer.start(1000); |
| 44 | |
| 45 | |
| 46 | // 注册自定义类型 |
| 47 | registerType(); |
| 48 | |
| 49 | // 固定窗口标题不变 |
| 50 | this->setWindowTitle("鸣潮工具解放肝脏永久免费"); |
| 51 | |
| 52 | // 绑定日志 |
| 53 | // debug 重定向 |
| 54 | DebugMessageHandler::instance().setPlainTextEdit(ui->logPlainText); |
| 55 | qInstallMessageHandler(DebugMessageHandler::messageHandler); |
| 56 | DebugMessageHandler::instance().setLogLevel(QtMsgType::QtInfoMsg); |
| 57 | connect(ui->logPlainText, &QPlainTextEdit::textChanged, [this]() { |
| 58 | QScrollBar *scrollBar = ui->logPlainText->verticalScrollBar(); |
| 59 | scrollBar->setValue(scrollBar->maximum()); |
| 60 | }); |
| 61 | |
| 62 | // 为logLevelBox设置本文代理格式 |
| 63 | CustomDelegate *delegate = new CustomDelegate(ui->logLevelBox); |
| 64 | ui->logLevelBox->setItemDelegate(delegate); |
| 65 | |
| 66 | // 为锁定声骸填充默认参数 |
| 67 | genDefaultLockEchoSetting(); |
| 68 | |
| 69 | // 为普通boss填充默认参数 |
| 70 | genDefaultNormalBossSetting(); |
nothing calls this directly
no test coverage detected