int DownloadManager::getOnlineDBVersion() { setCheckingVersion(true); uint newVersion = 0; QNetworkRequest request(QUrl(QStringLiteral("https://www.buschmann23.de/chennzeihhan-data/database.json"))); reply = manager.get(request); QEventLoop dlLoop; connect(reply, &QNetworkReply::finished, &dlLoop, &QEventLoop::quit); dlLoop.exec(); if (reply->error() == QNetworkReply::NoError) { QJsonObject result = QJsonDocument::fromJson(reply->readAll()).object(); #ifdef QT_DEBUG qDebug() << "JSON-Result: " << result; #endif newVersion = result.value(QStringLiteral("version")).toInt(); dbUrl = result.value(QStringLiteral("url")).toString(); setAvailableVersion(newVersion); setChangelog(result.value(QStringLiteral("changelog")).toString()); setDownloadSize(result.value(QStringLiteral("cSize")).toString()); setInstalledSize(result.value(QStringLiteral("uSize")).toString()); } reply->deleteLater(); setCheckingVersion(false); return newVersion; }
void UpdateModel::integrateChangelog(const QString &changelog) { auto app = qobject_cast<AbstractResource*>(sender()); Q_ASSERT(app); auto item = itemFromResource(app); if (!item) return; item->setChangelog(changelog); const QModelIndex idx = indexFromItem(item); Q_ASSERT(idx.isValid()); emit dataChanged(idx, idx, { ChangelogRole }); }
void Ui::Init(HWND hWnd) { // Background HWND bg = CreateWindowEx(0, TEXT("static"), TEXT("ST_U"), (WS_CHILD | WS_VISIBLE | WS_TABSTOP), 0, 0, 700, 400, hWnd, NULL, m_inst, NULL); SetWindowText(bg, 0); // Progress m_progress = CreateWindowEx(0, PROGRESS_CLASS, NULL, WS_CHILD | WS_VISIBLE, 15, 320, 560, 20, hWnd, NULL, m_inst, NULL); SendMessage(m_progress, PBM_SETRANGE, 0, MAKELPARAM(0, 100)); // Label m_label = CreateWindowEx(0, TEXT("static"), TEXT("ST_U"), WS_CHILD | WS_VISIBLE | WS_TABSTOP, 15, 345, 260, 40, hWnd, NULL, m_inst, NULL); setText("Initializing..."); // Button m_btn = CreateWindowEx(NULL, TEXT("BUTTON"), TEXT("Cancel"), WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON, 585, 320, 95, 20, hWnd, (HMENU)IDB_CANCEL, NULL, NULL); // EditBox m_edit_box = CreateWindowEx(NULL, TEXT("EDIT"), TEXT(""), WS_CHILD|WS_VISIBLE|ES_MULTILINE|WS_VSCROLL|ES_READONLY | WS_BORDER, 15, 15, 665, 295, hWnd, NULL, m_inst, NULL); HDC hdc = GetDC(NULL); long lfHeight = -MulDiv(10, GetDeviceCaps(hdc, LOGPIXELSY), 72); ReleaseDC(NULL, hdc); HFONT hf = CreateFontA(lfHeight, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "Courier New"); if(hf) SendMessage(m_edit_box, WM_SETFONT, (WPARAM)hf, TRUE); setChangelog("Downloading changelog..."); }