Move startupWarning to WindowManager

This commit is contained in:
tobtoht
2021-05-27 01:20:37 +02:00
parent 364f503a6b
commit faea53d617
4 changed files with 37 additions and 24 deletions
+35
View File
@@ -35,6 +35,8 @@ WindowManager::WindowManager() {
this->onInitialNetworkConfigured();
}
this->startupWarning();
if (!this->autoOpenWallet()) {
this->initWizard();
}
@@ -72,6 +74,39 @@ void WindowManager::restartApplication(const QString &binaryFilename) {
this->close();
}
void WindowManager::startupWarning() {
// Stagenet / Testnet
auto worthlessWarning = QString("Feather wallet is currently running in %1 mode. This is meant "
"for developers only. Your coins are WORTHLESS.");
if (constants::networkType == NetworkType::STAGENET && config()->get(Config::warnOnStagenet).toBool()) {
this->showWarningMessageBox("Warning", worthlessWarning.arg("stagenet"));
config()->set(Config::warnOnStagenet, false);
}
else if (constants::networkType == NetworkType::TESTNET && config()->get(Config::warnOnTestnet).toBool()){
this->showWarningMessageBox("Warning", worthlessWarning.arg("testnet"));
config()->set(Config::warnOnTestnet, false);
}
// Beta
if (config()->get(Config::warnOnAlpha).toBool()) {
QString warning = "Feather Wallet is currently in beta.\n\nPlease report any bugs "
"you encounter on our Git repository, IRC or on /r/FeatherWallet.";
this->showWarningMessageBox("Beta warning", warning);
config()->set(Config::warnOnAlpha, false);
}
}
void WindowManager::showWarningMessageBox(const QString &title, const QString &message) {
QMessageBox msgBox;
msgBox.setWindowIcon(icons()->icon("appicons/64x64.png"));
msgBox.setIcon(QMessageBox::Warning);
msgBox.setText(message);
msgBox.setWindowTitle(title);
msgBox.setStandardButtons(QMessageBox::Ok);
msgBox.setDefaultButton(QMessageBox::Ok);
msgBox.exec();
}
// ######################## WALLET OPEN ########################
void WindowManager::tryOpenWallet(const QString &path, const QString &password) {