Hide and disable update checker on custom builds

This commit is contained in:
Cacodemon345
2025-07-11 15:36:09 +06:00
parent f4f6bbc465
commit 4c72a0f721
4 changed files with 20 additions and 4 deletions

View File

@@ -59,7 +59,7 @@ VMManagerAddMachine(QWidget *parent) : QWizard(parent)
// Wizard wants to resize based on image. This keeps the size // Wizard wants to resize based on image. This keeps the size
setMinimumSize(size()); setMinimumSize(size());
setOption(HaveHelpButton, true); setOption(HaveHelpButton, false);
// setPixmap(LogoPixmap, QPixmap(":/settings/qt/icons/86Box-gray.ico")); // setPixmap(LogoPixmap, QPixmap(":/settings/qt/icons/86Box-gray.ico"));
connect(this, &QWizard::helpRequested, this, &VMManagerAddMachine::showHelp); connect(this, &QWizard::helpRequested, this, &VMManagerAddMachine::showHelp);

View File

@@ -131,12 +131,14 @@ VMManagerMain::VMManagerMain(QWidget *parent) :
emit updateStatusRight(totalCountString()); emit updateStatusRight(totalCountString());
}); });
#if EMU_BUILD_NUM != 0
// Start update check after a slight delay // Start update check after a slight delay
QTimer::singleShot(1000, this, [this] { QTimer::singleShot(1000, this, [this] {
if(updateCheck) { if(updateCheck) {
backgroundUpdateCheckStart(); backgroundUpdateCheckStart();
} }
}); });
#endif
} }
VMManagerMain::~VMManagerMain() { VMManagerMain::~VMManagerMain() {
@@ -276,7 +278,9 @@ VMManagerMain::loadSettings()
{ {
const auto config = new VMManagerConfig(VMManagerConfig::ConfigType::General); const auto config = new VMManagerConfig(VMManagerConfig::ConfigType::General);
const auto lastSelection = config->getStringValue("last_selection"); const auto lastSelection = config->getStringValue("last_selection");
#if EMU_BUILD_NUM != 0
updateCheck = config->getStringValue("update_check").toInt(); updateCheck = config->getStringValue("update_check").toInt();
#endif
regexSearch = config->getStringValue("regex_search").toInt(); regexSearch = config->getStringValue("regex_search").toInt();
const auto matches = ui->listView->model()->match(vm_model->index(0, 0), VMManagerModel::Roles::ConfigName, QVariant::fromValue(lastSelection)); const auto matches = ui->listView->model()->match(vm_model->index(0, 0), VMManagerModel::Roles::ConfigName, QVariant::fromValue(lastSelection));
@@ -453,10 +457,10 @@ VMManagerMain::onPreferencesUpdated()
} }
} }
#if EMU_BUILD_NUM != 0
void void
VMManagerMain::backgroundUpdateCheckStart() const VMManagerMain::backgroundUpdateCheckStart() const
{ {
#if EMU_BUILD_NUM != 0
auto updateChannel = UpdateCheck::UpdateChannel::CI; auto updateChannel = UpdateCheck::UpdateChannel::CI;
#ifdef RELEASE_BUILD #ifdef RELEASE_BUILD
updateChannel = UpdateCheck::UpdateChannel::Stable; updateChannel = UpdateCheck::UpdateChannel::Stable;
@@ -465,7 +469,6 @@ VMManagerMain::backgroundUpdateCheckStart() const
connect(updateCheck, &UpdateCheck::updateCheckComplete, this, &VMManagerMain::backgroundUpdateCheckComplete); connect(updateCheck, &UpdateCheck::updateCheckComplete, this, &VMManagerMain::backgroundUpdateCheckComplete);
connect(updateCheck, &UpdateCheck::updateCheckError, this, &VMManagerMain::backgroundUpdateCheckError); connect(updateCheck, &UpdateCheck::updateCheckError, this, &VMManagerMain::backgroundUpdateCheckError);
updateCheck->checkForUpdates(); updateCheck->checkForUpdates();
#endif
} }
void void
@@ -483,6 +486,7 @@ VMManagerMain::backgroundUpdateCheckError(const QString &errorMsg)
qDebug() << "Update check failed with the following error:" << errorMsg; qDebug() << "Update check failed with the following error:" << errorMsg;
// TODO: Update the status bar // TODO: Update the status bar
} }
#endif
void void
VMManagerMain::showTextFileContents(const QString &title, const QString &path) VMManagerMain::showTextFileContents(const QString &title, const QString &path)

View File

@@ -85,7 +85,9 @@ private:
VMManagerSystem *selected_sysconfig; VMManagerSystem *selected_sysconfig;
// VMManagerConfig *config; // VMManagerConfig *config;
QSortFilterProxyModel *proxy_model; QSortFilterProxyModel *proxy_model;
#if EMU_BUILD_NUM != 0
bool updateCheck = false; bool updateCheck = false;
#endif
bool regexSearch = false; bool regexSearch = false;
// void updateSelection(const QItemSelection &selected, // void updateSelection(const QItemSelection &selected,
@@ -97,11 +99,15 @@ private:
void loadSettings(); void loadSettings();
[[nodiscard]] bool currentSelectionIsValid() const; [[nodiscard]] bool currentSelectionIsValid() const;
[[nodiscard]] QString totalCountString() const; [[nodiscard]] QString totalCountString() const;
#if EMU_BUILD_NUM != 0
void backgroundUpdateCheckStart() const; void backgroundUpdateCheckStart() const;
#endif
void showTextFileContents(const QString &title, const QString &path); void showTextFileContents(const QString &title, const QString &path);
private slots: private slots:
#if EMU_BUILD_NUM != 0
void backgroundUpdateCheckComplete(const UpdateCheck::UpdateResult &result); void backgroundUpdateCheckComplete(const UpdateCheck::UpdateResult &result);
void backgroundUpdateCheckError(const QString &errorMsg); void backgroundUpdateCheckError(const QString &errorMsg);
#endif
}; };
#include <QDialog> #include <QDialog>

View File

@@ -44,8 +44,12 @@ VMManagerPreferences(QWidget *parent) : ui(new Ui::VMManagerPreferences)
} }
// TODO: Defaults // TODO: Defaults
#if EMU_BUILD_NUM != 0
const auto configUpdateCheck = config->getStringValue("update_check").toInt(); const auto configUpdateCheck = config->getStringValue("update_check").toInt();
ui->updateCheckBox->setChecked(configUpdateCheck); ui->updateCheckBox->setChecked(configUpdateCheck);
#else
ui->updateCheckBox->setVisible(false);
#endif
const auto useRegexSearch = config->getStringValue("regex_search").toInt(); const auto useRegexSearch = config->getStringValue("regex_search").toInt();
ui->regexSearchCheckBox->setChecked(useRegexSearch); ui->regexSearchCheckBox->setChecked(useRegexSearch);
@@ -70,7 +74,9 @@ VMManagerPreferences::accept()
{ {
const auto config = new VMManagerConfig(VMManagerConfig::ConfigType::General); const auto config = new VMManagerConfig(VMManagerConfig::ConfigType::General);
config->setStringValue("system_directory", ui->systemDirectory->text()); config->setStringValue("system_directory", ui->systemDirectory->text());
#if EMU_BUILD_NUM != 0
config->setStringValue("update_check", ui->updateCheckBox->isChecked() ? "1" : "0"); config->setStringValue("update_check", ui->updateCheckBox->isChecked() ? "1" : "0");
#endif
config->setStringValue("regex_search", ui->regexSearchCheckBox->isChecked() ? "1" : "0"); config->setStringValue("regex_search", ui->regexSearchCheckBox->isChecked() ? "1" : "0");
QDialog::accept(); QDialog::accept();
} }