mirror of
https://github.com/feather-wallet/feather.git
synced 2025-01-08 20:09:43 +00:00
Move startupWarning to WindowManager
This commit is contained in:
parent
364f503a6b
commit
faea53d617
4 changed files with 37 additions and 24 deletions
|
@ -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) {
|
||||
|
|
|
@ -58,6 +58,8 @@ private:
|
|||
void initSkins();
|
||||
QString loadStylesheet(const QString &resource);
|
||||
void buildTrayMenu();
|
||||
void startupWarning();
|
||||
void showWarningMessageBox(const QString &title, const QString &message);
|
||||
|
||||
void quitAfterLastWindow();
|
||||
|
||||
|
|
|
@ -50,7 +50,6 @@ MainWindow::MainWindow(WindowManager *windowManager, Wallet *wallet, QWidget *pa
|
|||
m_splashDialog = new SplashDialog(this);
|
||||
|
||||
this->restoreGeo();
|
||||
this->startupWarning();
|
||||
|
||||
this->initStatusBar();
|
||||
this->initWidgets();
|
||||
|
@ -370,28 +369,6 @@ void MainWindow::initWalletContext() {
|
|||
connect(m_ctx->wallet.get(), &Wallet::currentSubaddressAccountChanged, this, &MainWindow::updateTitle);
|
||||
}
|
||||
|
||||
void MainWindow::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()) {
|
||||
QMessageBox::warning(this, "Warning", worthlessWarning.arg("stagenet"));
|
||||
config()->set(Config::warnOnStagenet, false);
|
||||
}
|
||||
else if (constants::networkType == NetworkType::TESTNET && config()->get(Config::warnOnTestnet).toBool()){
|
||||
QMessageBox::warning(this, "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.";
|
||||
QMessageBox::warning(this, "Beta Warning", warning);
|
||||
config()->set(Config::warnOnAlpha, false);
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::menuToggleTabVisible(const QString &key){
|
||||
const auto toggleTab = m_tabShowHideMapper[key];
|
||||
bool show = config()->get(toggleTab->configKey).toBool();
|
||||
|
|
|
@ -183,7 +183,6 @@ private:
|
|||
void initMenu();
|
||||
void initHome();
|
||||
void initWalletContext();
|
||||
void startupWarning();
|
||||
|
||||
void closeEvent(QCloseEvent *event) override;
|
||||
|
||||
|
|
Loading…
Reference in a new issue