diff --git a/libcockatrice_deck_list/libcockatrice/deck_list/deck_list.cpp b/libcockatrice_deck_list/libcockatrice/deck_list/deck_list.cpp index 30b7ba314..cea759428 100644 --- a/libcockatrice_deck_list/libcockatrice/deck_list/deck_list.cpp +++ b/libcockatrice_deck_list/libcockatrice/deck_list/deck_list.cpp @@ -166,7 +166,7 @@ bool DeckList::readElement(QXmlStreamReader *xml) return true; } -static void writeMetadata(QXmlStreamWriter *xml, const DeckList::Metadata &metadata) +void writeMetadata(QXmlStreamWriter *xml, const DeckList::Metadata &metadata) { xml->writeTextElement("lastLoadedTimestamp", metadata.lastLoadedTimestamp); xml->writeTextElement("deckname", metadata.name); diff --git a/libcockatrice_network/libcockatrice/network/server/remote/server_player_reference.h b/libcockatrice_network/libcockatrice/network/server/remote/server_player_reference.h index b478a4244..07b2d3d2b 100644 --- a/libcockatrice_network/libcockatrice/network/server/remote/server_player_reference.h +++ b/libcockatrice_network/libcockatrice/network/server/remote/server_player_reference.h @@ -24,7 +24,7 @@ public: { return playerId; } - bool operator==(const PlayerReference &other) const + bool operator==(const PlayerReference &other) { return ((roomId == other.roomId) && (gameId == other.gameId) && (playerId == other.playerId)); } diff --git a/libcockatrice_utility/libcockatrice/utility/system_memory_querier.cpp b/libcockatrice_utility/libcockatrice/utility/system_memory_querier.cpp index b4553f8d2..46c24f69c 100644 --- a/libcockatrice_utility/libcockatrice/utility/system_memory_querier.cpp +++ b/libcockatrice_utility/libcockatrice/utility/system_memory_querier.cpp @@ -84,11 +84,7 @@ qulonglong SystemMemoryQuerier::availableMemoryBytes() while (!in.atEnd()) { QString line = in.readLine(); if (line.startsWith("MemAvailable:")) { -#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) - QStringList parts = line.split(QRegExp("\\s+"), QString::SkipEmptyParts); -#else - QStringList parts = line.split(QRegularExpression("\\s+"), Qt::SkipEmptyParts); -#endif + QStringList parts = line.split(QRegExp("\\s+"), Qt::SkipEmptyParts); if (parts.size() >= 2) return parts[1].toULongLong() * 1024; } diff --git a/libcockatrice_utility/libcockatrice/utility/system_memory_querier.h b/libcockatrice_utility/libcockatrice/utility/system_memory_querier.h index 8a15fecdd..44fd9f6f9 100644 --- a/libcockatrice_utility/libcockatrice/utility/system_memory_querier.h +++ b/libcockatrice_utility/libcockatrice/utility/system_memory_querier.h @@ -11,14 +11,8 @@ public: static bool hasAtLeastGiB(int gib) { - const qulonglong total = totalMemoryBytes(); - // 0 means the amount could not be determined (unsupported platform or failed query). - // Treat it as unknown and skip the check instead of misreading it as low memory. - if (total == 0) { - return true; - } const qulonglong GiB = 1024ull * 1024ull * 1024ull; - return total >= (qulonglong)gib * GiB; + return totalMemoryBytes() >= (qulonglong)gib * GiB; } }; diff --git a/oracle/src/pages.cpp b/oracle/src/pages.cpp index 0b500a29a..6110fb58b 100644 --- a/oracle/src/pages.cpp +++ b/oracle/src/pages.cpp @@ -188,30 +188,21 @@ void LoadSetsPage::initializePage() urlLineEdit->setText(wizard()->settings->value("allsetsurl", ALLSETS_URL).toString()); // Memory check because Oracle parsing fails on systems with less than 4GiB for MTGJsons allPrintings.json - // The fallback URL is xz-compressed, so only offer it in builds that can read it. - // During background (automatic) updates there is no user to answer, so switch silently. -#ifdef HAS_LZMA if (!SystemMemoryQuerier::hasAtLeastGiB(4) && urlLineEdit->text() == ALLSETS_URL) { - if (wizard()->backgroundMode) { + // Ask user whether to switch URL + QMessageBox msgBox( + QMessageBox::Question, tr("Low Memory Detected"), + tr("Your system has less than 4 GiB of memory.\n" + "Using the default AllPrintings URL may cause high memory usage and is known to fail as a result.\n\n" + "Would you like to switch to the direct-download pre-parsed URL instead? (Updated daily)"), + QMessageBox::Yes | QMessageBox::No, this); + + msgBox.setDefaultButton(QMessageBox::Yes); + + if (msgBox.exec() == QMessageBox::Yes) { urlLineEdit->setText(MTGXML_URL); - } else { - // Ask user whether to switch URL - QMessageBox msgBox( - QMessageBox::Question, tr("Low Memory Detected"), - tr("Your system has less than 4 GiB of memory.\n" - "Using the default AllPrintings URL may cause high memory usage and is known to fail as a " - "result.\n\n" - "Would you like to switch to the direct-download pre-parsed URL instead? (Updated daily)"), - QMessageBox::Yes | QMessageBox::No, this); - - msgBox.setDefaultButton(QMessageBox::Yes); - - if (msgBox.exec() == QMessageBox::Yes) { - urlLineEdit->setText(MTGXML_URL); - } } } -#endif progressLabel->hide(); progressBar->hide();