aboutsummaryrefslogtreecommitdiff
path: root/launcher
diff options
context:
space:
mode:
authorflow <flowlnlnln@gmail.com>2022-12-18 17:03:39 -0300
committerflow <flowlnlnln@gmail.com>2023-01-13 16:23:07 -0300
commitc8eca4fb8508a22b9d4819d57627dd684f8d98c5 (patch)
tree5a9acd5ef1fbd929e97b8214de37db42ddb23132 /launcher
parent0e207aba6c4eb67dccef12750c080a64deba6764 (diff)
downloadPrismLauncher-c8eca4fb8508a22b9d4819d57627dd684f8d98c5.tar.gz
PrismLauncher-c8eca4fb8508a22b9d4819d57627dd684f8d98c5.tar.bz2
PrismLauncher-c8eca4fb8508a22b9d4819d57627dd684f8d98c5.zip
fix: build with qt5.12 on Linux and pedantic flag
Signed-off-by: flow <flowlnlnln@gmail.com>
Diffstat (limited to 'launcher')
-rw-r--r--launcher/modplatform/ResourceAPI.h1
-rw-r--r--launcher/ui/dialogs/ResourceDownloadDialog.h1
-rw-r--r--launcher/ui/pages/modplatform/ResourceModel.h15
-rw-r--r--launcher/ui/pages/modplatform/ResourcePage.cpp4
-rw-r--r--launcher/ui/pages/modplatform/ResourcePage.h4
-rw-r--r--launcher/ui/pages/modplatform/flame/FlameResourcePages.h2
-rw-r--r--launcher/ui/pages/modplatform/modrinth/ModrinthResourceModels.cpp2
-rw-r--r--launcher/ui/pages/modplatform/modrinth/ModrinthResourcePages.h2
8 files changed, 19 insertions, 12 deletions
diff --git a/launcher/modplatform/ResourceAPI.h b/launcher/modplatform/ResourceAPI.h
index 49aac712..78441c34 100644
--- a/launcher/modplatform/ResourceAPI.h
+++ b/launcher/modplatform/ResourceAPI.h
@@ -39,6 +39,7 @@
#include <QString>
#include <list>
+#include <optional>
#include "../Version.h"
diff --git a/launcher/ui/dialogs/ResourceDownloadDialog.h b/launcher/ui/dialogs/ResourceDownloadDialog.h
index 95a5e628..34120350 100644
--- a/launcher/ui/dialogs/ResourceDownloadDialog.h
+++ b/launcher/ui/dialogs/ResourceDownloadDialog.h
@@ -21,6 +21,7 @@
#include <QDialog>
#include <QDialogButtonBox>
+#include <QHash>
#include <QLayout>
#include "QObjectPtr.h"
diff --git a/launcher/ui/pages/modplatform/ResourceModel.h b/launcher/ui/pages/modplatform/ResourceModel.h
index 45af33a2..d0b9234b 100644
--- a/launcher/ui/pages/modplatform/ResourceModel.h
+++ b/launcher/ui/pages/modplatform/ResourceModel.h
@@ -35,19 +35,16 @@ class ResourceModel : public QAbstractListModel {
[[nodiscard]] virtual auto metaEntryBase() const -> QString = 0;
[[nodiscard]] inline int rowCount(const QModelIndex& parent) const override { return parent.isValid() ? 0 : m_packs.size(); }
- [[nodiscard]] inline int columnCount(const QModelIndex& parent) const override { return parent.isValid() ? 0 : 1; };
- [[nodiscard]] inline auto flags(const QModelIndex& index) const -> Qt::ItemFlags override { return QAbstractListModel::flags(index); };
+ [[nodiscard]] inline int columnCount(const QModelIndex& parent) const override { return parent.isValid() ? 0 : 1; }
+ [[nodiscard]] inline auto flags(const QModelIndex& index) const -> Qt::ItemFlags override { return QAbstractListModel::flags(index); }
inline void addActiveJob(Task::Ptr ptr) { m_current_job.addTask(ptr); if (!m_current_job.isRunning()) m_current_job.start(); }
inline Task const& activeJob() { return m_current_job; }
- signals:
- void versionListUpdated();
- void projectInfoUpdated();
-
public slots:
void fetchMore(const QModelIndex& parent) override;
- [[nodiscard]] inline bool canFetchMore(const QModelIndex& parent) const override
+ // NOTE: Can't use [[nodiscard]] here because of https://bugreports.qt.io/browse/QTBUG-58628 on Qt 5.12
+ inline bool canFetchMore(const QModelIndex& parent) const override
{
return parent.isValid() ? false : m_search_state == SearchState::CanFetchMore;
}
@@ -105,6 +102,10 @@ class ResourceModel : public QAbstractListModel {
/* Default search request callbacks */
void searchRequestFailed(QString reason, int network_error_code);
void searchRequestAborted();
+
+ signals:
+ void versionListUpdated();
+ void projectInfoUpdated();
};
} // namespace ResourceDownload
diff --git a/launcher/ui/pages/modplatform/ResourcePage.cpp b/launcher/ui/pages/modplatform/ResourcePage.cpp
index e04278af..6e6868c5 100644
--- a/launcher/ui/pages/modplatform/ResourcePage.cpp
+++ b/launcher/ui/pages/modplatform/ResourcePage.cpp
@@ -302,7 +302,9 @@ void ResourcePage::openUrl(const QUrl& url)
QRegularExpressionMatch match;
QString page;
- for (auto&& [regex, candidate] : urlHandlers().asKeyValueRange()) {
+ auto handlers = urlHandlers();
+ for (auto it = handlers.constKeyValueBegin(); it != handlers.constKeyValueEnd(); it++) {
+ auto&& [regex, candidate] = *it;
if (match = QRegularExpression(regex).match(address); match.hasMatch()) {
page = candidate;
break;
diff --git a/launcher/ui/pages/modplatform/ResourcePage.h b/launcher/ui/pages/modplatform/ResourcePage.h
index b51c7ccb..b95c5a40 100644
--- a/launcher/ui/pages/modplatform/ResourcePage.h
+++ b/launcher/ui/pages/modplatform/ResourcePage.h
@@ -75,8 +75,10 @@ class ResourcePage : public QWidget, public BasePage {
void onVersionSelectionChanged(QString data);
void onResourceSelected();
+ // NOTE: Can't use [[nodiscard]] here because of https://bugreports.qt.io/browse/QTBUG-58628 on Qt 5.12
+
/** Associates regex expressions to pages in the order they're given in the map. */
- [[nodiscard]] virtual QMap<QString, QString> urlHandlers() const = 0;
+ virtual QMap<QString, QString> urlHandlers() const = 0;
virtual void openUrl(const QUrl&);
/** Whether the version is opted out or not. Currently only makes sense in CF. */
diff --git a/launcher/ui/pages/modplatform/flame/FlameResourcePages.h b/launcher/ui/pages/modplatform/flame/FlameResourcePages.h
index 6c7d0247..12b51aa9 100644
--- a/launcher/ui/pages/modplatform/flame/FlameResourcePages.h
+++ b/launcher/ui/pages/modplatform/flame/FlameResourcePages.h
@@ -49,7 +49,7 @@ static inline QString displayName() { return "CurseForge"; }
static inline QIcon icon() { return APPLICATION->getThemedIcon("flame"); }
static inline QString id() { return "curseforge"; }
static inline QString debugName() { return "Flame"; }
-static inline QString metaEntryBase() { return "FlameMods"; };
+static inline QString metaEntryBase() { return "FlameMods"; }
}
class FlameModPage : public ModPage {
diff --git a/launcher/ui/pages/modplatform/modrinth/ModrinthResourceModels.cpp b/launcher/ui/pages/modplatform/modrinth/ModrinthResourceModels.cpp
index 9d26ae05..895e23fd 100644
--- a/launcher/ui/pages/modplatform/modrinth/ModrinthResourceModels.cpp
+++ b/launcher/ui/pages/modplatform/modrinth/ModrinthResourceModels.cpp
@@ -26,7 +26,7 @@ namespace ResourceDownload {
// NOLINTNEXTLINE(modernize-avoid-c-arrays)
const char* ModrinthModModel::sorts[5]{ "relevance", "downloads", "follows", "updated", "newest" };
-ModrinthModModel::ModrinthModModel(BaseInstance const& base) : ModModel(base, new ModrinthAPI){};
+ModrinthModModel::ModrinthModModel(BaseInstance const& base) : ModModel(base, new ModrinthAPI) {}
void ModrinthModModel::loadIndexedPack(ModPlatform::IndexedPack& m, QJsonObject& obj)
{
diff --git a/launcher/ui/pages/modplatform/modrinth/ModrinthResourcePages.h b/launcher/ui/pages/modplatform/modrinth/ModrinthResourcePages.h
index 07b32c0c..a263bd44 100644
--- a/launcher/ui/pages/modplatform/modrinth/ModrinthResourcePages.h
+++ b/launcher/ui/pages/modplatform/modrinth/ModrinthResourcePages.h
@@ -48,7 +48,7 @@ static inline QString displayName() { return "Modrinth"; }
static inline QIcon icon() { return APPLICATION->getThemedIcon("modrinth"); }
static inline QString id() { return "modrinth"; }
static inline QString debugName() { return "Modrinth"; }
-static inline QString metaEntryBase() { return "ModrinthPacks"; };
+static inline QString metaEntryBase() { return "ModrinthPacks"; }
}
class ModrinthModPage : public ModPage {