dogecoin/src/qt/optionsmodel.cpp

400 lines
13 KiB
C++
Raw Normal View History

// Copyright (c) 2011-2013 The Bitcoin developers
// Distributed under the MIT/X11 software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#if defined(HAVE_CONFIG_H)
#include "bitcoin-config.h"
#endif
#include "optionsmodel.h"
#include "bitcoinunits.h"
#include "guiutil.h"
#include "init.h"
#include "main.h"
#include "net.h"
#ifdef ENABLE_WALLET
#include "wallet.h"
#include "walletdb.h"
#endif
#include <QSettings>
[Qt] massive options/settings rework (no core changes) - add new options for database cache and script verification threads - add label which displays options that are overridden by command-line parameters - proxy settings are not applied on-the-fly anymore and require a client restart (ApplyProxySettings() was removed and was not working very well anyway) - re-work options reset and require a client shutdown (as it is much easier to do it this way without having to mess with what can be changed on-the-fly and what needs a restart anyway) - options reset now writes default values for every single option - when changing an option which requires a client restart display a 10 second warning message in statusLabel (via a QTimer) - when applying the changes via ok change that to a persistent message, which is displayed even after closing optionsdialog and re-open it, when no client restart was made - remove dialog boxes used when changing language or proxy settings - add setRestartRequired() and isRestartRequired() to OptionsModel and use the set function when updating options to signal OptionsDialog when a restart is needed - resize optionsdialog a little and add some min sizes for certain GUI elements - remove apply button from optionsdialog - save and restore optionsdialog window position - update nTransactionFee in QSettings with a set -paytxfee value when opening optionsdialog (I'm not sure about this yet, perhaps revert to not updating QSettings and just display current -paytxfee value in optionsdialog.)
2013-12-03 09:10:10 +01:00
#include <QStringList>
2012-02-17 03:09:41 +01:00
OptionsModel::OptionsModel(QObject *parent) :
QAbstractListModel(parent)
{
2012-02-17 03:09:41 +01:00
Init();
}
[Qt] massive options/settings rework (no core changes) - add new options for database cache and script verification threads - add label which displays options that are overridden by command-line parameters - proxy settings are not applied on-the-fly anymore and require a client restart (ApplyProxySettings() was removed and was not working very well anyway) - re-work options reset and require a client shutdown (as it is much easier to do it this way without having to mess with what can be changed on-the-fly and what needs a restart anyway) - options reset now writes default values for every single option - when changing an option which requires a client restart display a 10 second warning message in statusLabel (via a QTimer) - when applying the changes via ok change that to a persistent message, which is displayed even after closing optionsdialog and re-open it, when no client restart was made - remove dialog boxes used when changing language or proxy settings - add setRestartRequired() and isRestartRequired() to OptionsModel and use the set function when updating options to signal OptionsDialog when a restart is needed - resize optionsdialog a little and add some min sizes for certain GUI elements - remove apply button from optionsdialog - save and restore optionsdialog window position - update nTransactionFee in QSettings with a set -paytxfee value when opening optionsdialog (I'm not sure about this yet, perhaps revert to not updating QSettings and just display current -paytxfee value in optionsdialog.)
2013-12-03 09:10:10 +01:00
// Writes all missing QSettings with their default values
2012-02-17 03:09:41 +01:00
void OptionsModel::Init()
{
QSettings settings;
[Qt] massive options/settings rework (no core changes) - add new options for database cache and script verification threads - add label which displays options that are overridden by command-line parameters - proxy settings are not applied on-the-fly anymore and require a client restart (ApplyProxySettings() was removed and was not working very well anyway) - re-work options reset and require a client shutdown (as it is much easier to do it this way without having to mess with what can be changed on-the-fly and what needs a restart anyway) - options reset now writes default values for every single option - when changing an option which requires a client restart display a 10 second warning message in statusLabel (via a QTimer) - when applying the changes via ok change that to a persistent message, which is displayed even after closing optionsdialog and re-open it, when no client restart was made - remove dialog boxes used when changing language or proxy settings - add setRestartRequired() and isRestartRequired() to OptionsModel and use the set function when updating options to signal OptionsDialog when a restart is needed - resize optionsdialog a little and add some min sizes for certain GUI elements - remove apply button from optionsdialog - save and restore optionsdialog window position - update nTransactionFee in QSettings with a set -paytxfee value when opening optionsdialog (I'm not sure about this yet, perhaps revert to not updating QSettings and just display current -paytxfee value in optionsdialog.)
2013-12-03 09:10:10 +01:00
// Ensure restart flag is unset on client startup
setRestartRequired(false);
2012-07-07 16:35:29 +02:00
// These are Qt-only settings:
[Qt] massive options/settings rework (no core changes) - add new options for database cache and script verification threads - add label which displays options that are overridden by command-line parameters - proxy settings are not applied on-the-fly anymore and require a client restart (ApplyProxySettings() was removed and was not working very well anyway) - re-work options reset and require a client shutdown (as it is much easier to do it this way without having to mess with what can be changed on-the-fly and what needs a restart anyway) - options reset now writes default values for every single option - when changing an option which requires a client restart display a 10 second warning message in statusLabel (via a QTimer) - when applying the changes via ok change that to a persistent message, which is displayed even after closing optionsdialog and re-open it, when no client restart was made - remove dialog boxes used when changing language or proxy settings - add setRestartRequired() and isRestartRequired() to OptionsModel and use the set function when updating options to signal OptionsDialog when a restart is needed - resize optionsdialog a little and add some min sizes for certain GUI elements - remove apply button from optionsdialog - save and restore optionsdialog window position - update nTransactionFee in QSettings with a set -paytxfee value when opening optionsdialog (I'm not sure about this yet, perhaps revert to not updating QSettings and just display current -paytxfee value in optionsdialog.)
2013-12-03 09:10:10 +01:00
// Window
if (!settings.contains("fMinimizeToTray"))
settings.setValue("fMinimizeToTray", false);
fMinimizeToTray = settings.value("fMinimizeToTray").toBool();
if (!settings.contains("fMinimizeOnClose"))
settings.setValue("fMinimizeOnClose", false);
fMinimizeOnClose = settings.value("fMinimizeOnClose").toBool();
// Display
if (!settings.contains("nDisplayUnit"))
settings.setValue("nDisplayUnit", BitcoinUnits::BTC);
nDisplayUnit = settings.value("nDisplayUnit").toInt();
if (!settings.contains("bDisplayAddresses"))
settings.setValue("bDisplayAddresses", false);
2012-02-17 03:09:41 +01:00
bDisplayAddresses = settings.value("bDisplayAddresses", false).toBool();
[Qt] massive options/settings rework (no core changes) - add new options for database cache and script verification threads - add label which displays options that are overridden by command-line parameters - proxy settings are not applied on-the-fly anymore and require a client restart (ApplyProxySettings() was removed and was not working very well anyway) - re-work options reset and require a client shutdown (as it is much easier to do it this way without having to mess with what can be changed on-the-fly and what needs a restart anyway) - options reset now writes default values for every single option - when changing an option which requires a client restart display a 10 second warning message in statusLabel (via a QTimer) - when applying the changes via ok change that to a persistent message, which is displayed even after closing optionsdialog and re-open it, when no client restart was made - remove dialog boxes used when changing language or proxy settings - add setRestartRequired() and isRestartRequired() to OptionsModel and use the set function when updating options to signal OptionsDialog when a restart is needed - resize optionsdialog a little and add some min sizes for certain GUI elements - remove apply button from optionsdialog - save and restore optionsdialog window position - update nTransactionFee in QSettings with a set -paytxfee value when opening optionsdialog (I'm not sure about this yet, perhaps revert to not updating QSettings and just display current -paytxfee value in optionsdialog.)
2013-12-03 09:10:10 +01:00
if (!settings.contains("fCoinControlFeatures"))
settings.setValue("fCoinControlFeatures", false);
2013-08-12 17:03:03 +02:00
fCoinControlFeatures = settings.value("fCoinControlFeatures", false).toBool();
2012-02-17 03:09:41 +01:00
[Qt] massive options/settings rework (no core changes) - add new options for database cache and script verification threads - add label which displays options that are overridden by command-line parameters - proxy settings are not applied on-the-fly anymore and require a client restart (ApplyProxySettings() was removed and was not working very well anyway) - re-work options reset and require a client shutdown (as it is much easier to do it this way without having to mess with what can be changed on-the-fly and what needs a restart anyway) - options reset now writes default values for every single option - when changing an option which requires a client restart display a 10 second warning message in statusLabel (via a QTimer) - when applying the changes via ok change that to a persistent message, which is displayed even after closing optionsdialog and re-open it, when no client restart was made - remove dialog boxes used when changing language or proxy settings - add setRestartRequired() and isRestartRequired() to OptionsModel and use the set function when updating options to signal OptionsDialog when a restart is needed - resize optionsdialog a little and add some min sizes for certain GUI elements - remove apply button from optionsdialog - save and restore optionsdialog window position - update nTransactionFee in QSettings with a set -paytxfee value when opening optionsdialog (I'm not sure about this yet, perhaps revert to not updating QSettings and just display current -paytxfee value in optionsdialog.)
2013-12-03 09:10:10 +01:00
// These are shared with the core or have a command-line parameter
// and we want command-line parameters to overwrite the GUI settings.
//
// If setting doesn't exist create it with defaults.
//
// If SoftSetArg() or SoftSetBoolArg() return false we were overridden
// by command-line and show this in the UI.
// Main
#ifdef ENABLE_WALLET
[Qt] massive options/settings rework (no core changes) - add new options for database cache and script verification threads - add label which displays options that are overridden by command-line parameters - proxy settings are not applied on-the-fly anymore and require a client restart (ApplyProxySettings() was removed and was not working very well anyway) - re-work options reset and require a client shutdown (as it is much easier to do it this way without having to mess with what can be changed on-the-fly and what needs a restart anyway) - options reset now writes default values for every single option - when changing an option which requires a client restart display a 10 second warning message in statusLabel (via a QTimer) - when applying the changes via ok change that to a persistent message, which is displayed even after closing optionsdialog and re-open it, when no client restart was made - remove dialog boxes used when changing language or proxy settings - add setRestartRequired() and isRestartRequired() to OptionsModel and use the set function when updating options to signal OptionsDialog when a restart is needed - resize optionsdialog a little and add some min sizes for certain GUI elements - remove apply button from optionsdialog - save and restore optionsdialog window position - update nTransactionFee in QSettings with a set -paytxfee value when opening optionsdialog (I'm not sure about this yet, perhaps revert to not updating QSettings and just display current -paytxfee value in optionsdialog.)
2013-12-03 09:10:10 +01:00
if (!settings.contains("nTransactionFee"))
settings.setValue("nTransactionFee", 0);
#endif
[Qt] massive options/settings rework (no core changes) - add new options for database cache and script verification threads - add label which displays options that are overridden by command-line parameters - proxy settings are not applied on-the-fly anymore and require a client restart (ApplyProxySettings() was removed and was not working very well anyway) - re-work options reset and require a client shutdown (as it is much easier to do it this way without having to mess with what can be changed on-the-fly and what needs a restart anyway) - options reset now writes default values for every single option - when changing an option which requires a client restart display a 10 second warning message in statusLabel (via a QTimer) - when applying the changes via ok change that to a persistent message, which is displayed even after closing optionsdialog and re-open it, when no client restart was made - remove dialog boxes used when changing language or proxy settings - add setRestartRequired() and isRestartRequired() to OptionsModel and use the set function when updating options to signal OptionsDialog when a restart is needed - resize optionsdialog a little and add some min sizes for certain GUI elements - remove apply button from optionsdialog - save and restore optionsdialog window position - update nTransactionFee in QSettings with a set -paytxfee value when opening optionsdialog (I'm not sure about this yet, perhaps revert to not updating QSettings and just display current -paytxfee value in optionsdialog.)
2013-12-03 09:10:10 +01:00
if (!settings.contains("nDatabaseCache"))
settings.setValue("nDatabaseCache", 25);
if (!SoftSetArg("-dbcache", settings.value("nDatabaseCache").toString().toStdString()))
strOverriddenByCommandLine += "-dbcache ";
if (!settings.contains("nThreadsScriptVerif"))
settings.setValue("nThreadsScriptVerif", 0);
if (!SoftSetArg("-par", settings.value("nThreadsScriptVerif").toString().toStdString()))
strOverriddenByCommandLine += "-par ";
// Network
if (!settings.contains("fUseUPnP"))
#ifdef USE_UPNP
settings.setValue("fUseUPnP", true);
#else
settings.setValue("fUseUPnP", false);
#endif
if (!SoftSetBoolArg("-upnp", settings.value("fUseUPnP").toBool()))
strOverriddenByCommandLine += "-upnp ";
if (!settings.contains("fUseProxy"))
settings.setValue("fUseProxy", false);
if (!settings.contains("addrProxy"))
settings.setValue("addrProxy", "127.0.0.1:9050");
// Only try to set -proxy, if user has enabled fUseProxy
if (settings.value("fUseProxy").toBool() && !SoftSetArg("-proxy", settings.value("addrProxy").toString().toStdString()))
strOverriddenByCommandLine += "-proxy ";
if (!settings.contains("nSocksVersion"))
settings.setValue("nSocksVersion", 5);
// Only try to set -socks, if user has enabled fUseProxy
if (settings.value("fUseProxy").toBool() && !SoftSetArg("-socks", settings.value("nSocksVersion").toString().toStdString()))
strOverriddenByCommandLine += "-socks ";
// Display
if (!settings.contains("language"))
settings.setValue("language", "");
if (!SoftSetArg("-lang", settings.value("language").toString().toStdString()))
strOverriddenByCommandLine += "-lang";
language = settings.value("language").toString();
2012-02-17 03:09:41 +01:00
}
void OptionsModel::Reset()
{
QSettings settings;
[Qt] massive options/settings rework (no core changes) - add new options for database cache and script verification threads - add label which displays options that are overridden by command-line parameters - proxy settings are not applied on-the-fly anymore and require a client restart (ApplyProxySettings() was removed and was not working very well anyway) - re-work options reset and require a client shutdown (as it is much easier to do it this way without having to mess with what can be changed on-the-fly and what needs a restart anyway) - options reset now writes default values for every single option - when changing an option which requires a client restart display a 10 second warning message in statusLabel (via a QTimer) - when applying the changes via ok change that to a persistent message, which is displayed even after closing optionsdialog and re-open it, when no client restart was made - remove dialog boxes used when changing language or proxy settings - add setRestartRequired() and isRestartRequired() to OptionsModel and use the set function when updating options to signal OptionsDialog when a restart is needed - resize optionsdialog a little and add some min sizes for certain GUI elements - remove apply button from optionsdialog - save and restore optionsdialog window position - update nTransactionFee in QSettings with a set -paytxfee value when opening optionsdialog (I'm not sure about this yet, perhaps revert to not updating QSettings and just display current -paytxfee value in optionsdialog.)
2013-12-03 09:10:10 +01:00
// Remove all entries from our QSettings object
settings.clear();
// default setting for OptionsModel::StartAtStartup - disabled
if (GUIUtil::GetStartOnSystemStartup())
GUIUtil::SetStartOnSystemStartup(false);
// Ensure Upgrade() is not running again by setting the bImportFinished flag
settings.setValue("bImportFinished", true);
}
[Qt] massive options/settings rework (no core changes) - add new options for database cache and script verification threads - add label which displays options that are overridden by command-line parameters - proxy settings are not applied on-the-fly anymore and require a client restart (ApplyProxySettings() was removed and was not working very well anyway) - re-work options reset and require a client shutdown (as it is much easier to do it this way without having to mess with what can be changed on-the-fly and what needs a restart anyway) - options reset now writes default values for every single option - when changing an option which requires a client restart display a 10 second warning message in statusLabel (via a QTimer) - when applying the changes via ok change that to a persistent message, which is displayed even after closing optionsdialog and re-open it, when no client restart was made - remove dialog boxes used when changing language or proxy settings - add setRestartRequired() and isRestartRequired() to OptionsModel and use the set function when updating options to signal OptionsDialog when a restart is needed - resize optionsdialog a little and add some min sizes for certain GUI elements - remove apply button from optionsdialog - save and restore optionsdialog window position - update nTransactionFee in QSettings with a set -paytxfee value when opening optionsdialog (I'm not sure about this yet, perhaps revert to not updating QSettings and just display current -paytxfee value in optionsdialog.)
2013-12-03 09:10:10 +01:00
void OptionsModel::Upgrade()
2012-02-17 03:09:41 +01:00
{
QSettings settings;
[Qt] massive options/settings rework (no core changes) - add new options for database cache and script verification threads - add label which displays options that are overridden by command-line parameters - proxy settings are not applied on-the-fly anymore and require a client restart (ApplyProxySettings() was removed and was not working very well anyway) - re-work options reset and require a client shutdown (as it is much easier to do it this way without having to mess with what can be changed on-the-fly and what needs a restart anyway) - options reset now writes default values for every single option - when changing an option which requires a client restart display a 10 second warning message in statusLabel (via a QTimer) - when applying the changes via ok change that to a persistent message, which is displayed even after closing optionsdialog and re-open it, when no client restart was made - remove dialog boxes used when changing language or proxy settings - add setRestartRequired() and isRestartRequired() to OptionsModel and use the set function when updating options to signal OptionsDialog when a restart is needed - resize optionsdialog a little and add some min sizes for certain GUI elements - remove apply button from optionsdialog - save and restore optionsdialog window position - update nTransactionFee in QSettings with a set -paytxfee value when opening optionsdialog (I'm not sure about this yet, perhaps revert to not updating QSettings and just display current -paytxfee value in optionsdialog.)
2013-12-03 09:10:10 +01:00
// Already upgraded
2012-02-17 03:09:41 +01:00
if (settings.contains("bImportFinished"))
[Qt] massive options/settings rework (no core changes) - add new options for database cache and script verification threads - add label which displays options that are overridden by command-line parameters - proxy settings are not applied on-the-fly anymore and require a client restart (ApplyProxySettings() was removed and was not working very well anyway) - re-work options reset and require a client shutdown (as it is much easier to do it this way without having to mess with what can be changed on-the-fly and what needs a restart anyway) - options reset now writes default values for every single option - when changing an option which requires a client restart display a 10 second warning message in statusLabel (via a QTimer) - when applying the changes via ok change that to a persistent message, which is displayed even after closing optionsdialog and re-open it, when no client restart was made - remove dialog boxes used when changing language or proxy settings - add setRestartRequired() and isRestartRequired() to OptionsModel and use the set function when updating options to signal OptionsDialog when a restart is needed - resize optionsdialog a little and add some min sizes for certain GUI elements - remove apply button from optionsdialog - save and restore optionsdialog window position - update nTransactionFee in QSettings with a set -paytxfee value when opening optionsdialog (I'm not sure about this yet, perhaps revert to not updating QSettings and just display current -paytxfee value in optionsdialog.)
2013-12-03 09:10:10 +01:00
return;
2012-02-17 03:09:41 +01:00
settings.setValue("bImportFinished", true);
#ifdef ENABLE_WALLET
2012-02-17 03:09:41 +01:00
// Move settings from old wallet.dat (if any):
CWalletDB walletdb(strWalletFile);
2012-02-17 03:09:41 +01:00
QList<QString> intOptions;
intOptions << "nDisplayUnit" << "nTransactionFee";
foreach(QString key, intOptions)
{
int value = 0;
if (walletdb.ReadSetting(key.toStdString(), value))
{
settings.setValue(key, value);
walletdb.EraseSetting(key.toStdString());
}
}
QList<QString> boolOptions;
boolOptions << "bDisplayAddresses" << "fMinimizeToTray" << "fMinimizeOnClose" << "fUseProxy" << "fUseUPnP";
foreach(QString key, boolOptions)
{
bool value = false;
if (walletdb.ReadSetting(key.toStdString(), value))
{
settings.setValue(key, value);
walletdb.EraseSetting(key.toStdString());
}
}
try
{
CAddress addrProxyAddress;
if (walletdb.ReadSetting("addrProxy", addrProxyAddress))
{
2012-05-24 19:02:21 +02:00
settings.setValue("addrProxy", addrProxyAddress.ToStringIPPort().c_str());
2012-02-17 03:09:41 +01:00
walletdb.EraseSetting("addrProxy");
}
}
catch (std::ios_base::failure &e)
{
// 0.6.0rc1 saved this as a CService, which causes failure when parsing as a CAddress
2012-05-24 19:02:21 +02:00
CService addrProxy;
2012-02-17 03:09:41 +01:00
if (walletdb.ReadSetting("addrProxy", addrProxy))
{
2012-02-26 23:39:32 +01:00
settings.setValue("addrProxy", addrProxy.ToStringIPPort().c_str());
2012-02-17 03:09:41 +01:00
walletdb.EraseSetting("addrProxy");
}
}
#endif
2012-02-17 03:09:41 +01:00
[Qt] massive options/settings rework (no core changes) - add new options for database cache and script verification threads - add label which displays options that are overridden by command-line parameters - proxy settings are not applied on-the-fly anymore and require a client restart (ApplyProxySettings() was removed and was not working very well anyway) - re-work options reset and require a client shutdown (as it is much easier to do it this way without having to mess with what can be changed on-the-fly and what needs a restart anyway) - options reset now writes default values for every single option - when changing an option which requires a client restart display a 10 second warning message in statusLabel (via a QTimer) - when applying the changes via ok change that to a persistent message, which is displayed even after closing optionsdialog and re-open it, when no client restart was made - remove dialog boxes used when changing language or proxy settings - add setRestartRequired() and isRestartRequired() to OptionsModel and use the set function when updating options to signal OptionsDialog when a restart is needed - resize optionsdialog a little and add some min sizes for certain GUI elements - remove apply button from optionsdialog - save and restore optionsdialog window position - update nTransactionFee in QSettings with a set -paytxfee value when opening optionsdialog (I'm not sure about this yet, perhaps revert to not updating QSettings and just display current -paytxfee value in optionsdialog.)
2013-12-03 09:10:10 +01:00
Init();
2012-02-17 03:09:41 +01:00
}
int OptionsModel::rowCount(const QModelIndex & parent) const
{
return OptionIDRowCount;
}
[Qt] massive options/settings rework (no core changes) - add new options for database cache and script verification threads - add label which displays options that are overridden by command-line parameters - proxy settings are not applied on-the-fly anymore and require a client restart (ApplyProxySettings() was removed and was not working very well anyway) - re-work options reset and require a client shutdown (as it is much easier to do it this way without having to mess with what can be changed on-the-fly and what needs a restart anyway) - options reset now writes default values for every single option - when changing an option which requires a client restart display a 10 second warning message in statusLabel (via a QTimer) - when applying the changes via ok change that to a persistent message, which is displayed even after closing optionsdialog and re-open it, when no client restart was made - remove dialog boxes used when changing language or proxy settings - add setRestartRequired() and isRestartRequired() to OptionsModel and use the set function when updating options to signal OptionsDialog when a restart is needed - resize optionsdialog a little and add some min sizes for certain GUI elements - remove apply button from optionsdialog - save and restore optionsdialog window position - update nTransactionFee in QSettings with a set -paytxfee value when opening optionsdialog (I'm not sure about this yet, perhaps revert to not updating QSettings and just display current -paytxfee value in optionsdialog.)
2013-12-03 09:10:10 +01:00
// read QSettings values and return them
QVariant OptionsModel::data(const QModelIndex & index, int role) const
{
if(role == Qt::EditRole)
{
2012-02-17 03:09:41 +01:00
QSettings settings;
switch(index.row())
{
case StartAtStartup:
[Qt] massive options/settings rework (no core changes) - add new options for database cache and script verification threads - add label which displays options that are overridden by command-line parameters - proxy settings are not applied on-the-fly anymore and require a client restart (ApplyProxySettings() was removed and was not working very well anyway) - re-work options reset and require a client shutdown (as it is much easier to do it this way without having to mess with what can be changed on-the-fly and what needs a restart anyway) - options reset now writes default values for every single option - when changing an option which requires a client restart display a 10 second warning message in statusLabel (via a QTimer) - when applying the changes via ok change that to a persistent message, which is displayed even after closing optionsdialog and re-open it, when no client restart was made - remove dialog boxes used when changing language or proxy settings - add setRestartRequired() and isRestartRequired() to OptionsModel and use the set function when updating options to signal OptionsDialog when a restart is needed - resize optionsdialog a little and add some min sizes for certain GUI elements - remove apply button from optionsdialog - save and restore optionsdialog window position - update nTransactionFee in QSettings with a set -paytxfee value when opening optionsdialog (I'm not sure about this yet, perhaps revert to not updating QSettings and just display current -paytxfee value in optionsdialog.)
2013-12-03 09:10:10 +01:00
return GUIUtil::GetStartOnSystemStartup();
case MinimizeToTray:
[Qt] massive options/settings rework (no core changes) - add new options for database cache and script verification threads - add label which displays options that are overridden by command-line parameters - proxy settings are not applied on-the-fly anymore and require a client restart (ApplyProxySettings() was removed and was not working very well anyway) - re-work options reset and require a client shutdown (as it is much easier to do it this way without having to mess with what can be changed on-the-fly and what needs a restart anyway) - options reset now writes default values for every single option - when changing an option which requires a client restart display a 10 second warning message in statusLabel (via a QTimer) - when applying the changes via ok change that to a persistent message, which is displayed even after closing optionsdialog and re-open it, when no client restart was made - remove dialog boxes used when changing language or proxy settings - add setRestartRequired() and isRestartRequired() to OptionsModel and use the set function when updating options to signal OptionsDialog when a restart is needed - resize optionsdialog a little and add some min sizes for certain GUI elements - remove apply button from optionsdialog - save and restore optionsdialog window position - update nTransactionFee in QSettings with a set -paytxfee value when opening optionsdialog (I'm not sure about this yet, perhaps revert to not updating QSettings and just display current -paytxfee value in optionsdialog.)
2013-12-03 09:10:10 +01:00
return fMinimizeToTray;
case MapPortUPnP:
#ifdef USE_UPNP
[Qt] massive options/settings rework (no core changes) - add new options for database cache and script verification threads - add label which displays options that are overridden by command-line parameters - proxy settings are not applied on-the-fly anymore and require a client restart (ApplyProxySettings() was removed and was not working very well anyway) - re-work options reset and require a client shutdown (as it is much easier to do it this way without having to mess with what can be changed on-the-fly and what needs a restart anyway) - options reset now writes default values for every single option - when changing an option which requires a client restart display a 10 second warning message in statusLabel (via a QTimer) - when applying the changes via ok change that to a persistent message, which is displayed even after closing optionsdialog and re-open it, when no client restart was made - remove dialog boxes used when changing language or proxy settings - add setRestartRequired() and isRestartRequired() to OptionsModel and use the set function when updating options to signal OptionsDialog when a restart is needed - resize optionsdialog a little and add some min sizes for certain GUI elements - remove apply button from optionsdialog - save and restore optionsdialog window position - update nTransactionFee in QSettings with a set -paytxfee value when opening optionsdialog (I'm not sure about this yet, perhaps revert to not updating QSettings and just display current -paytxfee value in optionsdialog.)
2013-12-03 09:10:10 +01:00
return settings.value("fUseUPnP");
#else
[Qt] massive options/settings rework (no core changes) - add new options for database cache and script verification threads - add label which displays options that are overridden by command-line parameters - proxy settings are not applied on-the-fly anymore and require a client restart (ApplyProxySettings() was removed and was not working very well anyway) - re-work options reset and require a client shutdown (as it is much easier to do it this way without having to mess with what can be changed on-the-fly and what needs a restart anyway) - options reset now writes default values for every single option - when changing an option which requires a client restart display a 10 second warning message in statusLabel (via a QTimer) - when applying the changes via ok change that to a persistent message, which is displayed even after closing optionsdialog and re-open it, when no client restart was made - remove dialog boxes used when changing language or proxy settings - add setRestartRequired() and isRestartRequired() to OptionsModel and use the set function when updating options to signal OptionsDialog when a restart is needed - resize optionsdialog a little and add some min sizes for certain GUI elements - remove apply button from optionsdialog - save and restore optionsdialog window position - update nTransactionFee in QSettings with a set -paytxfee value when opening optionsdialog (I'm not sure about this yet, perhaps revert to not updating QSettings and just display current -paytxfee value in optionsdialog.)
2013-12-03 09:10:10 +01:00
return false;
#endif
case MinimizeOnClose:
[Qt] massive options/settings rework (no core changes) - add new options for database cache and script verification threads - add label which displays options that are overridden by command-line parameters - proxy settings are not applied on-the-fly anymore and require a client restart (ApplyProxySettings() was removed and was not working very well anyway) - re-work options reset and require a client shutdown (as it is much easier to do it this way without having to mess with what can be changed on-the-fly and what needs a restart anyway) - options reset now writes default values for every single option - when changing an option which requires a client restart display a 10 second warning message in statusLabel (via a QTimer) - when applying the changes via ok change that to a persistent message, which is displayed even after closing optionsdialog and re-open it, when no client restart was made - remove dialog boxes used when changing language or proxy settings - add setRestartRequired() and isRestartRequired() to OptionsModel and use the set function when updating options to signal OptionsDialog when a restart is needed - resize optionsdialog a little and add some min sizes for certain GUI elements - remove apply button from optionsdialog - save and restore optionsdialog window position - update nTransactionFee in QSettings with a set -paytxfee value when opening optionsdialog (I'm not sure about this yet, perhaps revert to not updating QSettings and just display current -paytxfee value in optionsdialog.)
2013-12-03 09:10:10 +01:00
return fMinimizeOnClose;
// default proxy
case ProxyUse:
return settings.value("fUseProxy", false);
2012-05-24 19:02:21 +02:00
case ProxyIP: {
[Qt] massive options/settings rework (no core changes) - add new options for database cache and script verification threads - add label which displays options that are overridden by command-line parameters - proxy settings are not applied on-the-fly anymore and require a client restart (ApplyProxySettings() was removed and was not working very well anyway) - re-work options reset and require a client shutdown (as it is much easier to do it this way without having to mess with what can be changed on-the-fly and what needs a restart anyway) - options reset now writes default values for every single option - when changing an option which requires a client restart display a 10 second warning message in statusLabel (via a QTimer) - when applying the changes via ok change that to a persistent message, which is displayed even after closing optionsdialog and re-open it, when no client restart was made - remove dialog boxes used when changing language or proxy settings - add setRestartRequired() and isRestartRequired() to OptionsModel and use the set function when updating options to signal OptionsDialog when a restart is needed - resize optionsdialog a little and add some min sizes for certain GUI elements - remove apply button from optionsdialog - save and restore optionsdialog window position - update nTransactionFee in QSettings with a set -paytxfee value when opening optionsdialog (I'm not sure about this yet, perhaps revert to not updating QSettings and just display current -paytxfee value in optionsdialog.)
2013-12-03 09:10:10 +01:00
// contains IP at index 0 and port at index 1
QStringList strlIpPort = settings.value("addrProxy").toString().split(":", QString::SkipEmptyParts);
return strlIpPort.at(0);
2012-05-24 19:02:21 +02:00
}
case ProxyPort: {
[Qt] massive options/settings rework (no core changes) - add new options for database cache and script verification threads - add label which displays options that are overridden by command-line parameters - proxy settings are not applied on-the-fly anymore and require a client restart (ApplyProxySettings() was removed and was not working very well anyway) - re-work options reset and require a client shutdown (as it is much easier to do it this way without having to mess with what can be changed on-the-fly and what needs a restart anyway) - options reset now writes default values for every single option - when changing an option which requires a client restart display a 10 second warning message in statusLabel (via a QTimer) - when applying the changes via ok change that to a persistent message, which is displayed even after closing optionsdialog and re-open it, when no client restart was made - remove dialog boxes used when changing language or proxy settings - add setRestartRequired() and isRestartRequired() to OptionsModel and use the set function when updating options to signal OptionsDialog when a restart is needed - resize optionsdialog a little and add some min sizes for certain GUI elements - remove apply button from optionsdialog - save and restore optionsdialog window position - update nTransactionFee in QSettings with a set -paytxfee value when opening optionsdialog (I'm not sure about this yet, perhaps revert to not updating QSettings and just display current -paytxfee value in optionsdialog.)
2013-12-03 09:10:10 +01:00
// contains IP at index 0 and port at index 1
QStringList strlIpPort = settings.value("addrProxy").toString().split(":", QString::SkipEmptyParts);
return strlIpPort.at(1);
}
[Qt] massive options/settings rework (no core changes) - add new options for database cache and script verification threads - add label which displays options that are overridden by command-line parameters - proxy settings are not applied on-the-fly anymore and require a client restart (ApplyProxySettings() was removed and was not working very well anyway) - re-work options reset and require a client shutdown (as it is much easier to do it this way without having to mess with what can be changed on-the-fly and what needs a restart anyway) - options reset now writes default values for every single option - when changing an option which requires a client restart display a 10 second warning message in statusLabel (via a QTimer) - when applying the changes via ok change that to a persistent message, which is displayed even after closing optionsdialog and re-open it, when no client restart was made - remove dialog boxes used when changing language or proxy settings - add setRestartRequired() and isRestartRequired() to OptionsModel and use the set function when updating options to signal OptionsDialog when a restart is needed - resize optionsdialog a little and add some min sizes for certain GUI elements - remove apply button from optionsdialog - save and restore optionsdialog window position - update nTransactionFee in QSettings with a set -paytxfee value when opening optionsdialog (I'm not sure about this yet, perhaps revert to not updating QSettings and just display current -paytxfee value in optionsdialog.)
2013-12-03 09:10:10 +01:00
case ProxySocksVersion:
return settings.value("nSocksVersion", 5);
#ifdef ENABLE_WALLET
case Fee:
[Qt] massive options/settings rework (no core changes) - add new options for database cache and script verification threads - add label which displays options that are overridden by command-line parameters - proxy settings are not applied on-the-fly anymore and require a client restart (ApplyProxySettings() was removed and was not working very well anyway) - re-work options reset and require a client shutdown (as it is much easier to do it this way without having to mess with what can be changed on-the-fly and what needs a restart anyway) - options reset now writes default values for every single option - when changing an option which requires a client restart display a 10 second warning message in statusLabel (via a QTimer) - when applying the changes via ok change that to a persistent message, which is displayed even after closing optionsdialog and re-open it, when no client restart was made - remove dialog boxes used when changing language or proxy settings - add setRestartRequired() and isRestartRequired() to OptionsModel and use the set function when updating options to signal OptionsDialog when a restart is needed - resize optionsdialog a little and add some min sizes for certain GUI elements - remove apply button from optionsdialog - save and restore optionsdialog window position - update nTransactionFee in QSettings with a set -paytxfee value when opening optionsdialog (I'm not sure about this yet, perhaps revert to not updating QSettings and just display current -paytxfee value in optionsdialog.)
2013-12-03 09:10:10 +01:00
// Attention: Init() is called before nTransactionFee is set in AppInit2()!
// To ensure we can change the fee on-the-fly update our QSetting when
// opening OptionsDialog, which queries Fee via the mapper.
if (nTransactionFee != settings.value("nTransactionFee").toLongLong())
settings.setValue("nTransactionFee", (qint64)nTransactionFee);
// Todo: Consider to revert back to use just nTransactionFee here, if we don't want
// -paytxfee to update our QSettings!
return settings.value("nTransactionFee");
#endif
case DisplayUnit:
[Qt] massive options/settings rework (no core changes) - add new options for database cache and script verification threads - add label which displays options that are overridden by command-line parameters - proxy settings are not applied on-the-fly anymore and require a client restart (ApplyProxySettings() was removed and was not working very well anyway) - re-work options reset and require a client shutdown (as it is much easier to do it this way without having to mess with what can be changed on-the-fly and what needs a restart anyway) - options reset now writes default values for every single option - when changing an option which requires a client restart display a 10 second warning message in statusLabel (via a QTimer) - when applying the changes via ok change that to a persistent message, which is displayed even after closing optionsdialog and re-open it, when no client restart was made - remove dialog boxes used when changing language or proxy settings - add setRestartRequired() and isRestartRequired() to OptionsModel and use the set function when updating options to signal OptionsDialog when a restart is needed - resize optionsdialog a little and add some min sizes for certain GUI elements - remove apply button from optionsdialog - save and restore optionsdialog window position - update nTransactionFee in QSettings with a set -paytxfee value when opening optionsdialog (I'm not sure about this yet, perhaps revert to not updating QSettings and just display current -paytxfee value in optionsdialog.)
2013-12-03 09:10:10 +01:00
return nDisplayUnit;
case DisplayAddresses:
[Qt] massive options/settings rework (no core changes) - add new options for database cache and script verification threads - add label which displays options that are overridden by command-line parameters - proxy settings are not applied on-the-fly anymore and require a client restart (ApplyProxySettings() was removed and was not working very well anyway) - re-work options reset and require a client shutdown (as it is much easier to do it this way without having to mess with what can be changed on-the-fly and what needs a restart anyway) - options reset now writes default values for every single option - when changing an option which requires a client restart display a 10 second warning message in statusLabel (via a QTimer) - when applying the changes via ok change that to a persistent message, which is displayed even after closing optionsdialog and re-open it, when no client restart was made - remove dialog boxes used when changing language or proxy settings - add setRestartRequired() and isRestartRequired() to OptionsModel and use the set function when updating options to signal OptionsDialog when a restart is needed - resize optionsdialog a little and add some min sizes for certain GUI elements - remove apply button from optionsdialog - save and restore optionsdialog window position - update nTransactionFee in QSettings with a set -paytxfee value when opening optionsdialog (I'm not sure about this yet, perhaps revert to not updating QSettings and just display current -paytxfee value in optionsdialog.)
2013-12-03 09:10:10 +01:00
return bDisplayAddresses;
case Language:
[Qt] massive options/settings rework (no core changes) - add new options for database cache and script verification threads - add label which displays options that are overridden by command-line parameters - proxy settings are not applied on-the-fly anymore and require a client restart (ApplyProxySettings() was removed and was not working very well anyway) - re-work options reset and require a client shutdown (as it is much easier to do it this way without having to mess with what can be changed on-the-fly and what needs a restart anyway) - options reset now writes default values for every single option - when changing an option which requires a client restart display a 10 second warning message in statusLabel (via a QTimer) - when applying the changes via ok change that to a persistent message, which is displayed even after closing optionsdialog and re-open it, when no client restart was made - remove dialog boxes used when changing language or proxy settings - add setRestartRequired() and isRestartRequired() to OptionsModel and use the set function when updating options to signal OptionsDialog when a restart is needed - resize optionsdialog a little and add some min sizes for certain GUI elements - remove apply button from optionsdialog - save and restore optionsdialog window position - update nTransactionFee in QSettings with a set -paytxfee value when opening optionsdialog (I'm not sure about this yet, perhaps revert to not updating QSettings and just display current -paytxfee value in optionsdialog.)
2013-12-03 09:10:10 +01:00
return settings.value("language");
2013-08-12 17:03:03 +02:00
case CoinControlFeatures:
[Qt] massive options/settings rework (no core changes) - add new options for database cache and script verification threads - add label which displays options that are overridden by command-line parameters - proxy settings are not applied on-the-fly anymore and require a client restart (ApplyProxySettings() was removed and was not working very well anyway) - re-work options reset and require a client shutdown (as it is much easier to do it this way without having to mess with what can be changed on-the-fly and what needs a restart anyway) - options reset now writes default values for every single option - when changing an option which requires a client restart display a 10 second warning message in statusLabel (via a QTimer) - when applying the changes via ok change that to a persistent message, which is displayed even after closing optionsdialog and re-open it, when no client restart was made - remove dialog boxes used when changing language or proxy settings - add setRestartRequired() and isRestartRequired() to OptionsModel and use the set function when updating options to signal OptionsDialog when a restart is needed - resize optionsdialog a little and add some min sizes for certain GUI elements - remove apply button from optionsdialog - save and restore optionsdialog window position - update nTransactionFee in QSettings with a set -paytxfee value when opening optionsdialog (I'm not sure about this yet, perhaps revert to not updating QSettings and just display current -paytxfee value in optionsdialog.)
2013-12-03 09:10:10 +01:00
return fCoinControlFeatures;
case DatabaseCache:
return settings.value("nDatabaseCache");
case ThreadsScriptVerif:
return settings.value("nThreadsScriptVerif");
default:
return QVariant();
}
}
return QVariant();
}
[Qt] massive options/settings rework (no core changes) - add new options for database cache and script verification threads - add label which displays options that are overridden by command-line parameters - proxy settings are not applied on-the-fly anymore and require a client restart (ApplyProxySettings() was removed and was not working very well anyway) - re-work options reset and require a client shutdown (as it is much easier to do it this way without having to mess with what can be changed on-the-fly and what needs a restart anyway) - options reset now writes default values for every single option - when changing an option which requires a client restart display a 10 second warning message in statusLabel (via a QTimer) - when applying the changes via ok change that to a persistent message, which is displayed even after closing optionsdialog and re-open it, when no client restart was made - remove dialog boxes used when changing language or proxy settings - add setRestartRequired() and isRestartRequired() to OptionsModel and use the set function when updating options to signal OptionsDialog when a restart is needed - resize optionsdialog a little and add some min sizes for certain GUI elements - remove apply button from optionsdialog - save and restore optionsdialog window position - update nTransactionFee in QSettings with a set -paytxfee value when opening optionsdialog (I'm not sure about this yet, perhaps revert to not updating QSettings and just display current -paytxfee value in optionsdialog.)
2013-12-03 09:10:10 +01:00
// write QSettings values
bool OptionsModel::setData(const QModelIndex & index, const QVariant & value, int role)
{
bool successful = true; /* set to false on parse error */
if(role == Qt::EditRole)
{
2012-02-17 03:09:41 +01:00
QSettings settings;
switch(index.row())
{
case StartAtStartup:
successful = GUIUtil::SetStartOnSystemStartup(value.toBool());
break;
case MinimizeToTray:
fMinimizeToTray = value.toBool();
2012-02-17 03:09:41 +01:00
settings.setValue("fMinimizeToTray", fMinimizeToTray);
break;
[Qt] massive options/settings rework (no core changes) - add new options for database cache and script verification threads - add label which displays options that are overridden by command-line parameters - proxy settings are not applied on-the-fly anymore and require a client restart (ApplyProxySettings() was removed and was not working very well anyway) - re-work options reset and require a client shutdown (as it is much easier to do it this way without having to mess with what can be changed on-the-fly and what needs a restart anyway) - options reset now writes default values for every single option - when changing an option which requires a client restart display a 10 second warning message in statusLabel (via a QTimer) - when applying the changes via ok change that to a persistent message, which is displayed even after closing optionsdialog and re-open it, when no client restart was made - remove dialog boxes used when changing language or proxy settings - add setRestartRequired() and isRestartRequired() to OptionsModel and use the set function when updating options to signal OptionsDialog when a restart is needed - resize optionsdialog a little and add some min sizes for certain GUI elements - remove apply button from optionsdialog - save and restore optionsdialog window position - update nTransactionFee in QSettings with a set -paytxfee value when opening optionsdialog (I'm not sure about this yet, perhaps revert to not updating QSettings and just display current -paytxfee value in optionsdialog.)
2013-12-03 09:10:10 +01:00
case MapPortUPnP: // core option - can be changed on-the-fly
settings.setValue("fUseUPnP", value.toBool());
MapPort(value.toBool());
break;
case MinimizeOnClose:
fMinimizeOnClose = value.toBool();
2012-02-17 03:09:41 +01:00
settings.setValue("fMinimizeOnClose", fMinimizeOnClose);
break;
[Qt] massive options/settings rework (no core changes) - add new options for database cache and script verification threads - add label which displays options that are overridden by command-line parameters - proxy settings are not applied on-the-fly anymore and require a client restart (ApplyProxySettings() was removed and was not working very well anyway) - re-work options reset and require a client shutdown (as it is much easier to do it this way without having to mess with what can be changed on-the-fly and what needs a restart anyway) - options reset now writes default values for every single option - when changing an option which requires a client restart display a 10 second warning message in statusLabel (via a QTimer) - when applying the changes via ok change that to a persistent message, which is displayed even after closing optionsdialog and re-open it, when no client restart was made - remove dialog boxes used when changing language or proxy settings - add setRestartRequired() and isRestartRequired() to OptionsModel and use the set function when updating options to signal OptionsDialog when a restart is needed - resize optionsdialog a little and add some min sizes for certain GUI elements - remove apply button from optionsdialog - save and restore optionsdialog window position - update nTransactionFee in QSettings with a set -paytxfee value when opening optionsdialog (I'm not sure about this yet, perhaps revert to not updating QSettings and just display current -paytxfee value in optionsdialog.)
2013-12-03 09:10:10 +01:00
// default proxy
2012-05-24 19:02:21 +02:00
case ProxyUse:
[Qt] massive options/settings rework (no core changes) - add new options for database cache and script verification threads - add label which displays options that are overridden by command-line parameters - proxy settings are not applied on-the-fly anymore and require a client restart (ApplyProxySettings() was removed and was not working very well anyway) - re-work options reset and require a client shutdown (as it is much easier to do it this way without having to mess with what can be changed on-the-fly and what needs a restart anyway) - options reset now writes default values for every single option - when changing an option which requires a client restart display a 10 second warning message in statusLabel (via a QTimer) - when applying the changes via ok change that to a persistent message, which is displayed even after closing optionsdialog and re-open it, when no client restart was made - remove dialog boxes used when changing language or proxy settings - add setRestartRequired() and isRestartRequired() to OptionsModel and use the set function when updating options to signal OptionsDialog when a restart is needed - resize optionsdialog a little and add some min sizes for certain GUI elements - remove apply button from optionsdialog - save and restore optionsdialog window position - update nTransactionFee in QSettings with a set -paytxfee value when opening optionsdialog (I'm not sure about this yet, perhaps revert to not updating QSettings and just display current -paytxfee value in optionsdialog.)
2013-12-03 09:10:10 +01:00
if (settings.value("fUseProxy") != value) {
settings.setValue("fUseProxy", value.toBool());
setRestartRequired(true);
}
break;
case ProxyIP: {
[Qt] massive options/settings rework (no core changes) - add new options for database cache and script verification threads - add label which displays options that are overridden by command-line parameters - proxy settings are not applied on-the-fly anymore and require a client restart (ApplyProxySettings() was removed and was not working very well anyway) - re-work options reset and require a client shutdown (as it is much easier to do it this way without having to mess with what can be changed on-the-fly and what needs a restart anyway) - options reset now writes default values for every single option - when changing an option which requires a client restart display a 10 second warning message in statusLabel (via a QTimer) - when applying the changes via ok change that to a persistent message, which is displayed even after closing optionsdialog and re-open it, when no client restart was made - remove dialog boxes used when changing language or proxy settings - add setRestartRequired() and isRestartRequired() to OptionsModel and use the set function when updating options to signal OptionsDialog when a restart is needed - resize optionsdialog a little and add some min sizes for certain GUI elements - remove apply button from optionsdialog - save and restore optionsdialog window position - update nTransactionFee in QSettings with a set -paytxfee value when opening optionsdialog (I'm not sure about this yet, perhaps revert to not updating QSettings and just display current -paytxfee value in optionsdialog.)
2013-12-03 09:10:10 +01:00
// contains current IP at index 0 and current port at index 1
QStringList strlIpPort = settings.value("addrProxy").toString().split(":", QString::SkipEmptyParts);
// if that key doesn't exist or has a changed IP
if (!settings.contains("addrProxy") || strlIpPort.at(0) != value.toString()) {
// construct new value from new IP and current port
QString strNewValue = value.toString() + ":" + strlIpPort.at(1);
settings.setValue("addrProxy", strNewValue);
setRestartRequired(true);
}
}
break;
case ProxyPort: {
[Qt] massive options/settings rework (no core changes) - add new options for database cache and script verification threads - add label which displays options that are overridden by command-line parameters - proxy settings are not applied on-the-fly anymore and require a client restart (ApplyProxySettings() was removed and was not working very well anyway) - re-work options reset and require a client shutdown (as it is much easier to do it this way without having to mess with what can be changed on-the-fly and what needs a restart anyway) - options reset now writes default values for every single option - when changing an option which requires a client restart display a 10 second warning message in statusLabel (via a QTimer) - when applying the changes via ok change that to a persistent message, which is displayed even after closing optionsdialog and re-open it, when no client restart was made - remove dialog boxes used when changing language or proxy settings - add setRestartRequired() and isRestartRequired() to OptionsModel and use the set function when updating options to signal OptionsDialog when a restart is needed - resize optionsdialog a little and add some min sizes for certain GUI elements - remove apply button from optionsdialog - save and restore optionsdialog window position - update nTransactionFee in QSettings with a set -paytxfee value when opening optionsdialog (I'm not sure about this yet, perhaps revert to not updating QSettings and just display current -paytxfee value in optionsdialog.)
2013-12-03 09:10:10 +01:00
// contains current IP at index 0 and current port at index 1
QStringList strlIpPort = settings.value("addrProxy").toString().split(":", QString::SkipEmptyParts);
// if that key doesn't exist or has a changed port
if (!settings.contains("addrProxy") || strlIpPort.at(1) != value.toString()) {
// construct new value from current IP and new port
QString strNewValue = strlIpPort.at(0) + ":" + value.toString();
settings.setValue("addrProxy", strNewValue);
setRestartRequired(true);
}
}
break;
case ProxySocksVersion: {
[Qt] massive options/settings rework (no core changes) - add new options for database cache and script verification threads - add label which displays options that are overridden by command-line parameters - proxy settings are not applied on-the-fly anymore and require a client restart (ApplyProxySettings() was removed and was not working very well anyway) - re-work options reset and require a client shutdown (as it is much easier to do it this way without having to mess with what can be changed on-the-fly and what needs a restart anyway) - options reset now writes default values for every single option - when changing an option which requires a client restart display a 10 second warning message in statusLabel (via a QTimer) - when applying the changes via ok change that to a persistent message, which is displayed even after closing optionsdialog and re-open it, when no client restart was made - remove dialog boxes used when changing language or proxy settings - add setRestartRequired() and isRestartRequired() to OptionsModel and use the set function when updating options to signal OptionsDialog when a restart is needed - resize optionsdialog a little and add some min sizes for certain GUI elements - remove apply button from optionsdialog - save and restore optionsdialog window position - update nTransactionFee in QSettings with a set -paytxfee value when opening optionsdialog (I'm not sure about this yet, perhaps revert to not updating QSettings and just display current -paytxfee value in optionsdialog.)
2013-12-03 09:10:10 +01:00
if (settings.value("nSocksVersion") != value) {
settings.setValue("nSocksVersion", value.toInt());
setRestartRequired(true);
}
}
break;
#ifdef ENABLE_WALLET
[Qt] massive options/settings rework (no core changes) - add new options for database cache and script verification threads - add label which displays options that are overridden by command-line parameters - proxy settings are not applied on-the-fly anymore and require a client restart (ApplyProxySettings() was removed and was not working very well anyway) - re-work options reset and require a client shutdown (as it is much easier to do it this way without having to mess with what can be changed on-the-fly and what needs a restart anyway) - options reset now writes default values for every single option - when changing an option which requires a client restart display a 10 second warning message in statusLabel (via a QTimer) - when applying the changes via ok change that to a persistent message, which is displayed even after closing optionsdialog and re-open it, when no client restart was made - remove dialog boxes used when changing language or proxy settings - add setRestartRequired() and isRestartRequired() to OptionsModel and use the set function when updating options to signal OptionsDialog when a restart is needed - resize optionsdialog a little and add some min sizes for certain GUI elements - remove apply button from optionsdialog - save and restore optionsdialog window position - update nTransactionFee in QSettings with a set -paytxfee value when opening optionsdialog (I'm not sure about this yet, perhaps revert to not updating QSettings and just display current -paytxfee value in optionsdialog.)
2013-12-03 09:10:10 +01:00
case Fee: // core option - can be changed on-the-fly
// Todo: Add is valid check and warn via message, if not
nTransactionFee = value.toLongLong();
[Qt] massive options/settings rework (no core changes) - add new options for database cache and script verification threads - add label which displays options that are overridden by command-line parameters - proxy settings are not applied on-the-fly anymore and require a client restart (ApplyProxySettings() was removed and was not working very well anyway) - re-work options reset and require a client shutdown (as it is much easier to do it this way without having to mess with what can be changed on-the-fly and what needs a restart anyway) - options reset now writes default values for every single option - when changing an option which requires a client restart display a 10 second warning message in statusLabel (via a QTimer) - when applying the changes via ok change that to a persistent message, which is displayed even after closing optionsdialog and re-open it, when no client restart was made - remove dialog boxes used when changing language or proxy settings - add setRestartRequired() and isRestartRequired() to OptionsModel and use the set function when updating options to signal OptionsDialog when a restart is needed - resize optionsdialog a little and add some min sizes for certain GUI elements - remove apply button from optionsdialog - save and restore optionsdialog window position - update nTransactionFee in QSettings with a set -paytxfee value when opening optionsdialog (I'm not sure about this yet, perhaps revert to not updating QSettings and just display current -paytxfee value in optionsdialog.)
2013-12-03 09:10:10 +01:00
settings.setValue("nTransactionFee", (qint64)nTransactionFee);
2013-08-12 17:03:03 +02:00
emit transactionFeeChanged(nTransactionFee);
break;
#endif
case DisplayUnit:
nDisplayUnit = value.toInt();
2012-02-17 03:09:41 +01:00
settings.setValue("nDisplayUnit", nDisplayUnit);
emit displayUnitChanged(nDisplayUnit);
break;
case DisplayAddresses:
bDisplayAddresses = value.toBool();
2012-02-17 03:09:41 +01:00
settings.setValue("bDisplayAddresses", bDisplayAddresses);
break;
case Language:
[Qt] massive options/settings rework (no core changes) - add new options for database cache and script verification threads - add label which displays options that are overridden by command-line parameters - proxy settings are not applied on-the-fly anymore and require a client restart (ApplyProxySettings() was removed and was not working very well anyway) - re-work options reset and require a client shutdown (as it is much easier to do it this way without having to mess with what can be changed on-the-fly and what needs a restart anyway) - options reset now writes default values for every single option - when changing an option which requires a client restart display a 10 second warning message in statusLabel (via a QTimer) - when applying the changes via ok change that to a persistent message, which is displayed even after closing optionsdialog and re-open it, when no client restart was made - remove dialog boxes used when changing language or proxy settings - add setRestartRequired() and isRestartRequired() to OptionsModel and use the set function when updating options to signal OptionsDialog when a restart is needed - resize optionsdialog a little and add some min sizes for certain GUI elements - remove apply button from optionsdialog - save and restore optionsdialog window position - update nTransactionFee in QSettings with a set -paytxfee value when opening optionsdialog (I'm not sure about this yet, perhaps revert to not updating QSettings and just display current -paytxfee value in optionsdialog.)
2013-12-03 09:10:10 +01:00
if (settings.value("language") != value) {
settings.setValue("language", value);
setRestartRequired(true);
}
break;
case CoinControlFeatures:
2013-08-12 17:03:03 +02:00
fCoinControlFeatures = value.toBool();
settings.setValue("fCoinControlFeatures", fCoinControlFeatures);
emit coinControlFeaturesChanged(fCoinControlFeatures);
break;
[Qt] massive options/settings rework (no core changes) - add new options for database cache and script verification threads - add label which displays options that are overridden by command-line parameters - proxy settings are not applied on-the-fly anymore and require a client restart (ApplyProxySettings() was removed and was not working very well anyway) - re-work options reset and require a client shutdown (as it is much easier to do it this way without having to mess with what can be changed on-the-fly and what needs a restart anyway) - options reset now writes default values for every single option - when changing an option which requires a client restart display a 10 second warning message in statusLabel (via a QTimer) - when applying the changes via ok change that to a persistent message, which is displayed even after closing optionsdialog and re-open it, when no client restart was made - remove dialog boxes used when changing language or proxy settings - add setRestartRequired() and isRestartRequired() to OptionsModel and use the set function when updating options to signal OptionsDialog when a restart is needed - resize optionsdialog a little and add some min sizes for certain GUI elements - remove apply button from optionsdialog - save and restore optionsdialog window position - update nTransactionFee in QSettings with a set -paytxfee value when opening optionsdialog (I'm not sure about this yet, perhaps revert to not updating QSettings and just display current -paytxfee value in optionsdialog.)
2013-12-03 09:10:10 +01:00
case DatabaseCache:
if (settings.value("nDatabaseCache") != value) {
settings.setValue("nDatabaseCache", value);
setRestartRequired(true);
}
break;
case ThreadsScriptVerif:
if (settings.value("nThreadsScriptVerif") != value) {
settings.setValue("nThreadsScriptVerif", value);
setRestartRequired(true);
}
break;
default:
break;
}
}
emit dataChanged(index, index);
return successful;
}
2011-06-01 09:34:12 +02:00
bool OptionsModel::getProxySettings(QString& proxyIP, quint16 &proxyPort) const
{
std::string proxy = GetArg("-proxy", "");
if (proxy.empty()) return false;
CService addrProxy(proxy);
proxyIP = QString(addrProxy.ToStringIP().c_str());
proxyPort = addrProxy.GetPort();
return true;
}
[Qt] massive options/settings rework (no core changes) - add new options for database cache and script verification threads - add label which displays options that are overridden by command-line parameters - proxy settings are not applied on-the-fly anymore and require a client restart (ApplyProxySettings() was removed and was not working very well anyway) - re-work options reset and require a client shutdown (as it is much easier to do it this way without having to mess with what can be changed on-the-fly and what needs a restart anyway) - options reset now writes default values for every single option - when changing an option which requires a client restart display a 10 second warning message in statusLabel (via a QTimer) - when applying the changes via ok change that to a persistent message, which is displayed even after closing optionsdialog and re-open it, when no client restart was made - remove dialog boxes used when changing language or proxy settings - add setRestartRequired() and isRestartRequired() to OptionsModel and use the set function when updating options to signal OptionsDialog when a restart is needed - resize optionsdialog a little and add some min sizes for certain GUI elements - remove apply button from optionsdialog - save and restore optionsdialog window position - update nTransactionFee in QSettings with a set -paytxfee value when opening optionsdialog (I'm not sure about this yet, perhaps revert to not updating QSettings and just display current -paytxfee value in optionsdialog.)
2013-12-03 09:10:10 +01:00
void OptionsModel::setRestartRequired(bool fRequired)
{
QSettings settings;
return settings.setValue("fRestartRequired", fRequired);
}
bool OptionsModel::isRestartRequired()
{
QSettings settings;
return settings.value("fRestartRequired", false).toBool();
}