Browse Source

Merge #8710: [0.13.1] qt Backports

a37cec5 Persist the datadir after option reset (Andrew Chow)
d9f0d4e Fix minimize and close bugs (adlawren)
41fd852 fix op order to append first alert (rodasmith)
0.13
Wladimir J. van der Laan 8 years ago
parent
commit
4731623777
No known key found for this signature in database
GPG Key ID: 74810B012346C9A6
  1. 4
      src/main.cpp
  2. 11
      src/qt/bitcoingui.cpp
  3. 3
      src/qt/intro.cpp
  4. 14
      src/qt/optionsmodel.cpp

4
src/main.cpp

@ -4675,12 +4675,12 @@ std::string GetWarnings(const std::string& strFor)
if (fLargeWorkForkFound) if (fLargeWorkForkFound)
{ {
strStatusBar = strRPC = "Warning: The network does not appear to fully agree! Some miners appear to be experiencing issues."; strStatusBar = strRPC = "Warning: The network does not appear to fully agree! Some miners appear to be experiencing issues.";
strGUI += strGUI.empty() ? "" : uiAlertSeperator + _("Warning: The network does not appear to fully agree! Some miners appear to be experiencing issues."); strGUI += (strGUI.empty() ? "" : uiAlertSeperator) + _("Warning: The network does not appear to fully agree! Some miners appear to be experiencing issues.");
} }
else if (fLargeWorkInvalidChainFound) else if (fLargeWorkInvalidChainFound)
{ {
strStatusBar = strRPC = "Warning: We do not appear to fully agree with our peers! You may need to upgrade, or other nodes may need to upgrade."; strStatusBar = strRPC = "Warning: We do not appear to fully agree with our peers! You may need to upgrade, or other nodes may need to upgrade.";
strGUI += strGUI.empty() ? "" : uiAlertSeperator + _("Warning: We do not appear to fully agree with our peers! You may need to upgrade, or other nodes may need to upgrade."); strGUI += (strGUI.empty() ? "" : uiAlertSeperator) + _("Warning: We do not appear to fully agree with our peers! You may need to upgrade, or other nodes may need to upgrade.");
} }
if (strFor == "gui") if (strFor == "gui")

11
src/qt/bitcoingui.cpp

@ -902,17 +902,22 @@ void BitcoinGUI::closeEvent(QCloseEvent *event)
#ifndef Q_OS_MAC // Ignored on Mac #ifndef Q_OS_MAC // Ignored on Mac
if(clientModel && clientModel->getOptionsModel()) if(clientModel && clientModel->getOptionsModel())
{ {
if(!clientModel->getOptionsModel()->getMinimizeToTray() && if(!clientModel->getOptionsModel()->getMinimizeOnClose())
!clientModel->getOptionsModel()->getMinimizeOnClose())
{ {
// close rpcConsole in case it was open to make some space for the shutdown window // close rpcConsole in case it was open to make some space for the shutdown window
rpcConsole->close(); rpcConsole->close();
QApplication::quit(); QApplication::quit();
} }
else
{
QMainWindow::showMinimized();
event->ignore();
} }
#endif }
#else
QMainWindow::closeEvent(event); QMainWindow::closeEvent(event);
#endif
} }
void BitcoinGUI::showEvent(QShowEvent *event) void BitcoinGUI::showEvent(QShowEvent *event)

3
src/qt/intro.cpp

@ -178,7 +178,7 @@ bool Intro::pickDataDirectory()
/* 2) Allow QSettings to override default dir */ /* 2) Allow QSettings to override default dir */
dataDir = settings.value("strDataDir", dataDir).toString(); dataDir = settings.value("strDataDir", dataDir).toString();
if(!fs::exists(GUIUtil::qstringToBoostPath(dataDir)) || GetBoolArg("-choosedatadir", DEFAULT_CHOOSE_DATADIR)) if(!fs::exists(GUIUtil::qstringToBoostPath(dataDir)) || GetBoolArg("-choosedatadir", DEFAULT_CHOOSE_DATADIR) || settings.value("fReset", false).toBool() || GetBoolArg("-resetguisettings", false))
{ {
/* If current default data directory does not exist, let the user choose one */ /* If current default data directory does not exist, let the user choose one */
Intro intro; Intro intro;
@ -204,6 +204,7 @@ bool Intro::pickDataDirectory()
} }
settings.setValue("strDataDir", dataDir); settings.setValue("strDataDir", dataDir);
settings.setValue("fReset", false);
} }
/* Only override -datadir if different from the default, to make it possible to /* Only override -datadir if different from the default, to make it possible to
* override -datadir in the bitcoin.conf file in the default data directory * override -datadir in the bitcoin.conf file in the default data directory

14
src/qt/optionsmodel.cpp

@ -16,6 +16,7 @@
#include "main.h" // For DEFAULT_SCRIPTCHECK_THREADS #include "main.h" // For DEFAULT_SCRIPTCHECK_THREADS
#include "net.h" #include "net.h"
#include "txdb.h" // for -dbcache defaults #include "txdb.h" // for -dbcache defaults
#include "intro.h"
#ifdef ENABLE_WALLET #ifdef ENABLE_WALLET
#include "wallet/wallet.h" #include "wallet/wallet.h"
@ -98,6 +99,9 @@ void OptionsModel::Init(bool resetSettings)
if (!SoftSetArg("-par", settings.value("nThreadsScriptVerif").toString().toStdString())) if (!SoftSetArg("-par", settings.value("nThreadsScriptVerif").toString().toStdString()))
addOverriddenOption("-par"); addOverriddenOption("-par");
if (!settings.contains("strDataDir"))
settings.setValue("strDataDir", Intro::getDefaultDataDirectory());
// Wallet // Wallet
#ifdef ENABLE_WALLET #ifdef ENABLE_WALLET
if (!settings.contains("bSpendZeroConfChange")) if (!settings.contains("bSpendZeroConfChange"))
@ -150,9 +154,19 @@ void OptionsModel::Reset()
{ {
QSettings settings; QSettings settings;
// Save the strDataDir setting
QString dataDir = Intro::getDefaultDataDirectory();
dataDir = settings.value("strDataDir", dataDir).toString();
// Remove all entries from our QSettings object // Remove all entries from our QSettings object
settings.clear(); settings.clear();
// Set strDataDir
settings.setValue("strDataDir", dataDir);
// Set that this was reset
settings.setValue("fReset", true);
// default setting for OptionsModel::StartAtStartup - disabled // default setting for OptionsModel::StartAtStartup - disabled
if (GUIUtil::GetStartOnSystemStartup()) if (GUIUtil::GetStartOnSystemStartup())
GUIUtil::SetStartOnSystemStartup(false); GUIUtil::SetStartOnSystemStartup(false);

Loading…
Cancel
Save