Hide and disable update checker on custom builds
This commit is contained in:
@@ -59,7 +59,7 @@ VMManagerAddMachine(QWidget *parent) : QWizard(parent)
|
||||
|
||||
// Wizard wants to resize based on image. This keeps the size
|
||||
setMinimumSize(size());
|
||||
setOption(HaveHelpButton, true);
|
||||
setOption(HaveHelpButton, false);
|
||||
// setPixmap(LogoPixmap, QPixmap(":/settings/qt/icons/86Box-gray.ico"));
|
||||
|
||||
connect(this, &QWizard::helpRequested, this, &VMManagerAddMachine::showHelp);
|
||||
|
||||
@@ -131,12 +131,14 @@ VMManagerMain::VMManagerMain(QWidget *parent) :
|
||||
emit updateStatusRight(totalCountString());
|
||||
});
|
||||
|
||||
#if EMU_BUILD_NUM != 0
|
||||
// Start update check after a slight delay
|
||||
QTimer::singleShot(1000, this, [this] {
|
||||
if(updateCheck) {
|
||||
backgroundUpdateCheckStart();
|
||||
}
|
||||
});
|
||||
#endif
|
||||
}
|
||||
|
||||
VMManagerMain::~VMManagerMain() {
|
||||
@@ -276,7 +278,9 @@ VMManagerMain::loadSettings()
|
||||
{
|
||||
const auto config = new VMManagerConfig(VMManagerConfig::ConfigType::General);
|
||||
const auto lastSelection = config->getStringValue("last_selection");
|
||||
#if EMU_BUILD_NUM != 0
|
||||
updateCheck = config->getStringValue("update_check").toInt();
|
||||
#endif
|
||||
regexSearch = config->getStringValue("regex_search").toInt();
|
||||
|
||||
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
|
||||
VMManagerMain::backgroundUpdateCheckStart() const
|
||||
{
|
||||
#if EMU_BUILD_NUM != 0
|
||||
auto updateChannel = UpdateCheck::UpdateChannel::CI;
|
||||
#ifdef RELEASE_BUILD
|
||||
updateChannel = UpdateCheck::UpdateChannel::Stable;
|
||||
@@ -465,7 +469,6 @@ VMManagerMain::backgroundUpdateCheckStart() const
|
||||
connect(updateCheck, &UpdateCheck::updateCheckComplete, this, &VMManagerMain::backgroundUpdateCheckComplete);
|
||||
connect(updateCheck, &UpdateCheck::updateCheckError, this, &VMManagerMain::backgroundUpdateCheckError);
|
||||
updateCheck->checkForUpdates();
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
@@ -483,6 +486,7 @@ VMManagerMain::backgroundUpdateCheckError(const QString &errorMsg)
|
||||
qDebug() << "Update check failed with the following error:" << errorMsg;
|
||||
// TODO: Update the status bar
|
||||
}
|
||||
#endif
|
||||
|
||||
void
|
||||
VMManagerMain::showTextFileContents(const QString &title, const QString &path)
|
||||
|
||||
@@ -85,7 +85,9 @@ private:
|
||||
VMManagerSystem *selected_sysconfig;
|
||||
// VMManagerConfig *config;
|
||||
QSortFilterProxyModel *proxy_model;
|
||||
#if EMU_BUILD_NUM != 0
|
||||
bool updateCheck = false;
|
||||
#endif
|
||||
bool regexSearch = false;
|
||||
|
||||
// void updateSelection(const QItemSelection &selected,
|
||||
@@ -97,11 +99,15 @@ private:
|
||||
void loadSettings();
|
||||
[[nodiscard]] bool currentSelectionIsValid() const;
|
||||
[[nodiscard]] QString totalCountString() const;
|
||||
#if EMU_BUILD_NUM != 0
|
||||
void backgroundUpdateCheckStart() const;
|
||||
#endif
|
||||
void showTextFileContents(const QString &title, const QString &path);
|
||||
private slots:
|
||||
#if EMU_BUILD_NUM != 0
|
||||
void backgroundUpdateCheckComplete(const UpdateCheck::UpdateResult &result);
|
||||
void backgroundUpdateCheckError(const QString &errorMsg);
|
||||
#endif
|
||||
};
|
||||
|
||||
#include <QDialog>
|
||||
|
||||
@@ -44,8 +44,12 @@ VMManagerPreferences(QWidget *parent) : ui(new Ui::VMManagerPreferences)
|
||||
}
|
||||
|
||||
// TODO: Defaults
|
||||
#if EMU_BUILD_NUM != 0
|
||||
const auto configUpdateCheck = config->getStringValue("update_check").toInt();
|
||||
ui->updateCheckBox->setChecked(configUpdateCheck);
|
||||
#else
|
||||
ui->updateCheckBox->setVisible(false);
|
||||
#endif
|
||||
const auto useRegexSearch = config->getStringValue("regex_search").toInt();
|
||||
ui->regexSearchCheckBox->setChecked(useRegexSearch);
|
||||
|
||||
@@ -70,7 +74,9 @@ VMManagerPreferences::accept()
|
||||
{
|
||||
const auto config = new VMManagerConfig(VMManagerConfig::ConfigType::General);
|
||||
config->setStringValue("system_directory", ui->systemDirectory->text());
|
||||
#if EMU_BUILD_NUM != 0
|
||||
config->setStringValue("update_check", ui->updateCheckBox->isChecked() ? "1" : "0");
|
||||
#endif
|
||||
config->setStringValue("regex_search", ui->regexSearchCheckBox->isChecked() ? "1" : "0");
|
||||
QDialog::accept();
|
||||
}
|
||||
@@ -79,4 +85,4 @@ void
|
||||
VMManagerPreferences::reject()
|
||||
{
|
||||
QDialog::reject();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user