diff --git a/cslol-tools/src/main_diag.cpp b/cslol-tools/src/main_diag.cpp index 2ffbe54..036260f 100644 --- a/cslol-tools/src/main_diag.cpp +++ b/cslol-tools/src/main_diag.cpp @@ -120,7 +120,7 @@ static void check_basic_info() { static void check_patcher_signature(bool interactive) { auto const dll = basedir(exe_path()) + L"//cslol-dll.dll"; if (GetFileAttributesW(dll.c_str()) == INVALID_FILE_ATTRIBUTES) { - wprintf(L"Patcher dll: missing [%hs]", dll.c_str(), REP_SUS); + wprintf(L"Patcher dll: missing [%hs]\n", REP_SUS); return; } auto file = WINTRUST_FILE_INFO{ diff --git a/src/CSLOLTools.cpp b/src/CSLOLTools.cpp index 9249fab..12d1809 100644 --- a/src/CSLOLTools.cpp +++ b/src/CSLOLTools.cpp @@ -47,7 +47,6 @@ CSLOLTools::CSLOLTools(QObject *parent) : QObject(parent) { connect(this, &CSLOLTools::addModWad, worker_, &CSLOLToolsImpl::addModWad); connect(this, &CSLOLTools::removeModWads, worker_, &CSLOLToolsImpl::removeModWads); connect(this, &CSLOLTools::refreshMods, worker_, &CSLOLToolsImpl::refreshMods); - connect(this, &CSLOLTools::doUpdate, worker_, &CSLOLToolsImpl::doUpdate); connect(this, &CSLOLTools::runDiag, worker_, &CSLOLToolsImpl::runDiag); connect(this, &CSLOLTools::destroyed, worker_, &CSLOLToolsImpl::deleteLater); diff --git a/src/CSLOLTools.h b/src/CSLOLTools.h index 2d23fc6..a56f4ef 100644 --- a/src/CSLOLTools.h +++ b/src/CSLOLTools.h @@ -64,7 +64,6 @@ class CSLOLTools : public QObject { void addModWad(QString modFileName, QString wad, bool removeUnknownNames); void removeModWads(QString modFileName, QJsonArray wads); void refreshMods(); - void doUpdate(QString urls); void runDiag(); public slots: diff --git a/src/CSLOLToolsImpl.cpp b/src/CSLOLToolsImpl.cpp index 0af6b45..2e0c43a 100644 --- a/src/CSLOLToolsImpl.cpp +++ b/src/CSLOLToolsImpl.cpp @@ -436,85 +436,6 @@ void CSLOLToolsImpl::refreshMods() { } } -void CSLOLToolsImpl::doUpdate(QString urls) { - if (!networkManager_) { - this->networkManager_ = new QNetworkAccessManager(this); - this->networkManager_->setTransferTimeout(30000); - connect(this->networkManager_, &QNetworkAccessManager::finished, this, [this](QNetworkReply* reply) { - if (reply->error()) { - auto error = reply->errorString(); - setStatus("[WRN] Failed to fetch update index: " + error); - this->networkResults_.push_back(QJsonDocument::fromJson("[]")); - } else { - auto result = reply->readAll(); - this->networkResults_.push_back(QJsonDocument::fromJson(result)); - } - - if (this->networkResults_.size() < this->networkRequests_.size()) { - return; - } - - auto lookup = QMap{}; - for (auto name : modList()) { - auto info = modInfoRead(name); - auto key = info["Name"].toString().toLower(); - auto version = QVersionNumber::fromString(info["Version"].toString()); - lookup[key] = version; - } - - auto mods = QJsonArray{}; - for (auto const& result : this->networkResults_) { - if (!result.isArray()) { - continue; - } - for (auto const& value : result.array()) { - auto info = modInfoFixup("", value.toObject()); - if (info["Download"].toString().isEmpty() || !info["Download"].isString()) { - info["Download"] = info["Home"]; - } - auto key = info["Name"].toString().toLower(); - if (lookup.contains(key)) { - auto const& old_version = lookup[key]; - auto new_version = QVersionNumber::fromString(info["Version"].toString()); - if (old_version < new_version) { - mods.append(info); - } - } - } - } - - emit updatedMods(mods); - - setState(CSLOLState::StateIdle); - }); - } - - if (state_ == CSLOLState::StateIdle) { - setState(CSLOLState::StateBusy); - setStatus("Updating mods"); - - this->networkResults_.clear(); - this->networkRequests_.clear(); - for (auto url : urls.split('\n')) { - url = url.trimmed(); - if (url.isEmpty() || url.startsWith("#")) { - continue; - } - this->networkRequests_.emplace_back(QUrl(url)); - } - - if (this->networkRequests_.empty()) { - doReportError("Update mods", "Make sure to set update urls in settings!", ""); - setState(CSLOLState::StateIdle); - return; - } - - for (auto& req : this->networkRequests_) { - this->networkManager_->get(req); - } - } -} - void CSLOLToolsImpl::runDiag() { if (state_ == CSLOLState::StateIdle) { setState(CSLOLState::StateBusy); diff --git a/src/CSLOLToolsImpl.h b/src/CSLOLToolsImpl.h index 8ef99b6..c0ac091 100644 --- a/src/CSLOLToolsImpl.h +++ b/src/CSLOLToolsImpl.h @@ -66,7 +66,6 @@ public slots: void stopProfile(); void makeMod(QString fileName, QJsonObject infoData, QString image); void refreshMods(); - void doUpdate(QString urls); void runDiag(); void startEditMod(QString fileName); diff --git a/src/qml/CSLOLDialogSettings.qml b/src/qml/CSLOLDialogSettings.qml index 6f01829..ed0833e 100644 --- a/src/qml/CSLOLDialogSettings.qml +++ b/src/qml/CSLOLDialogSettings.qml @@ -29,7 +29,6 @@ Dialog { property alias suppressInstallConflicts: suppressInstallConflictsCheck.checked property alias enableSystray: enableSystrayCheck.checked property alias enableAutoRun: enableAutoRunCheck.checked - property alias updateUrls: updateUrlsTextArea.text property alias debugPatcher: debugPatcherCheck.checked property var colors_LIST: [ @@ -126,24 +125,6 @@ Dialog { onClicked: Qt.openUrlExternally(CSLOLUtils.toFile("./log.txt")) Layout.fillWidth: true } - Button { - text: qsTr("Updates") - onClicked: Qt.openUrlExternally(cslolDialogUpdate.update_url) - Layout.fillWidth: true - } - ScrollView { - Layout.fillHeight: true - Layout.fillWidth: true - ScrollBar.horizontal.policy: ScrollBar.AsNeeded - ScrollBar.vertical.policy: ScrollBar.AlwaysOn - padding: ScrollBar.vertical.width - clip: true - TextArea { - id: updateUrlsTextArea - placeholderText: qsTr("Update urls") - textFormat: TextEdit.PlainText - } - } CheckBox { id: enableUpdatesCheck text: qsTr("Enable updates") diff --git a/src/qml/CSLOLDialogUpdateMods.qml b/src/qml/CSLOLDialogUpdateMods.qml deleted file mode 100644 index cc9117c..0000000 --- a/src/qml/CSLOLDialogUpdateMods.qml +++ /dev/null @@ -1,135 +0,0 @@ -import QtQuick 2.15 -import QtQuick.Layouts 1.12 -import QtQuick.Controls 2.15 -import QtQuick.Controls.Material 2.15 - -Dialog { - id: cslolDialogUpdateMods - width: parent.width * 0.9 - height: parent.height * 0.9 - x: (parent.width - width) / 2 - y: (parent.height - height) / 2 - standardButtons: Dialog.Ok - closePolicy: Popup.CloseOnEscape - modal: true - title: qsTr("Mod updates and fixes:") - Overlay.modal: Rectangle { - color: "#aa333333" - } - onOpened: window.show() - - property int columnCount: 1 - property real rowHeight: 0 - property alias updatedMods: cslolUpdateModsView.model - - updatedMods: [] - - ScrollView { - id: cslolUpdateModsScrollView - width: parent.width - height: parent.height - ScrollBar.horizontal.policy: ScrollBar.AlwaysOff - ScrollBar.vertical.policy: ScrollBar.AlwaysOn - padding: ScrollBar.vertical.width - spacing: 5 - - GridView { - id: cslolUpdateModsView - cellWidth: cslolUpdateModsView.width / cslolDialogUpdateMods.columnCount - cellHeight: 75 - delegate: Pane { - property var model: modelData - width: cslolUpdateModsView.width / cslolDialogUpdateMods.columnCount - cslolUpdateModsScrollView.spacing - Component.onCompleted: { - let newCellHeight = height + cslolUpdateModsScrollView.spacing - if (cslolUpdateModsView.cellHeight < newCellHeight) { - cslolUpdateModsView.cellHeight = newCellHeight; - } - } - Material.elevation: 3 - Row { - width: parent.width - Row { - id: modUpdateButtons - width: parent.width * 0.3 - - ToolButton { - anchors.verticalCenter: parent.verticalCenter - text: "\uf0ed " - font.family: "FontAwesome" - onClicked: { - let url = model.Download - if (window.validUrl.test(url)) { - Qt.openUrlExternally(url) - } - } - CSLOLToolTip { - text: qsTr("Download") - visible: parent.hovered - } - } - Label { - anchors.verticalCenter: parent.verticalCenter - horizontalAlignment: Text.AlignHCenter - text: model.Name - elide: Text.ElideRight - Layout.fillWidth: true - } - } - Column { - width: parent.width * 0.39 - anchors.verticalCenter: parent.verticalCenter - Label { - horizontalAlignment: Text.AlignHCenter - text: "V" + model.Version + " by " + model.Author - elide: Text.ElideRight - width: parent.width - } - Label { - horizontalAlignment: Text.AlignHCenter - text: model.Description ? model.Description : "" - wrapMode: Text.Wrap - elide: Text.ElideRight - maximumLineCount: 2 - width: parent.width - } - } - Row { - id: modUpdateButtons2 - width: parent.width * 0.3 - anchors.verticalCenter: parent.verticalCenter - layoutDirection: Qt.RightToLeft - ToolButton { - text: "\uf059" - font.family: "FontAwesome" - onClicked: { - let url = model.Home - if (window.validUrl.test(url)) { - Qt.openUrlExternally(url) - } - } - CSLOLToolTip { - text: qsTr("Mod updates") - visible: parent.hovered - } - } - ToolButton { - text: "\uf004" - font.family: "FontAwesome" - onClicked: { - let url = model.Heart - if (window.validUrl.test(url)) { - Qt.openUrlExternally(url) - } - } - CSLOLToolTip { - text: qsTr("Support this author") - visible: parent.hovered - } - } - } - } - } - } - } -} diff --git a/src/qml/CSLOLModsView.qml b/src/qml/CSLOLModsView.qml index 88129d2..98621a2 100644 --- a/src/qml/CSLOLModsView.qml +++ b/src/qml/CSLOLModsView.qml @@ -33,8 +33,6 @@ ColumnLayout { signal tryRefresh() - signal getUpdates() - function addMod(fileName, info, enabled) { let infoData = { "FileName": fileName, @@ -467,17 +465,6 @@ ColumnLayout { visible: parent.hovered } } - RoundButton { - enabled: !isBussy - text: "\uf0ad" - font.family: "FontAwesome" - onClicked: cslolModsView.getUpdates() - Material.background: Material.primaryColor - CSLOLToolTip { - text: qsTr("Mod updates and fixes") - visible: parent.hovered - } - } RoundButton { enabled: !isBussy text: "\uf067" diff --git a/src/qml/main.qml b/src/qml/main.qml index c3ceb8a..8250332 100644 --- a/src/qml/main.qml +++ b/src/qml/main.qml @@ -24,7 +24,6 @@ ApplicationWindow { property alias blacklist: cslolDialogSettings.blacklist property alias ignorebad: cslolDialogSettings.ignorebad property alias suppressInstallConflicts: cslolDialogSettings.suppressInstallConflicts - property alias updateUrls: cslolDialogSettings.updateUrls property alias enableUpdates: cslolDialogSettings.enableUpdates property alias enableAutoRun: cslolDialogSettings.enableAutoRun property alias enableSystray: cslolDialogSettings.enableSystray @@ -223,7 +222,6 @@ ApplicationWindow { } } onTryRefresh: cslolTools.refreshMods() - onGetUpdates: cslolTools.doUpdate(settings.updateUrls) } footer: CSLOLStatusBar { @@ -315,12 +313,6 @@ ApplicationWindow { enableUpdates: settings.enableUpdates } - CSLOLDialogUpdateMods { - id: cslolDialogUpdateMods - rowHeight: cslolToolBar.height - columnCount: Math.max(1, Math.floor(window.width / window.minimumWidth)) - } - CSLOLTools { id: cslolTools onInitialized: function(mods, profiles, profileName, profileMods) { diff --git a/src/qml/qml.qrc b/src/qml/qml.qrc index 11fa2ce..505892e 100644 --- a/src/qml/qml.qrc +++ b/src/qml/qml.qrc @@ -23,6 +23,5 @@ CSLOLModInfoEdit.qml CSLOLDialogGame.qml CSLOLToolTip.qml - CSLOLDialogUpdateMods.qml