diff options
Diffstat (limited to 'src/qt')
-rw-r--r-- | src/qt/README.md | 10 | ||||
-rw-r--r-- | src/qt/optionsmodel.cpp | 23 | ||||
-rw-r--r-- | src/qt/paymentrequestplus.cpp | 1 | ||||
-rw-r--r-- | src/qt/test/wallettests.cpp | 2 |
4 files changed, 27 insertions, 9 deletions
diff --git a/src/qt/README.md b/src/qt/README.md index 7ffea98170..7c23ccadcc 100644 --- a/src/qt/README.md +++ b/src/qt/README.md @@ -1,6 +1,6 @@ -This directory contains the BitcoinQT graphical user interface (GUI). It uses the cross platform framework [QT](https://www1.qt.io/developers/). +This directory contains the BitcoinQT graphical user interface (GUI). It uses the cross-platform framework [Qt](https://www1.qt.io/developers/). -The current precise version for QT 5 is specified in [qt.mk](/depends/packages/qt.mk). QT 4 is also supported (see [#8263](https://github.com/bitcoin/bitcoin/issues/8263)). +The current precise version for Qt 5 is specified in [qt.mk](/depends/packages/qt.mk). Qt 4 is also supported (see [#8263](https://github.com/bitcoin/bitcoin/issues/8263)). ## Compile and run @@ -36,7 +36,7 @@ Represents the main window of the Bitcoin UI. ### \*model.(h/cpp) -The model. When it has a corresponding controller, it generally inherits from [QAbstractTableModel](http://doc.qt.io/qt-5/qabstracttablemodel.html). Models that are used by controllers as helpers inherit from other QT classes like [QValidator](http://doc.qt.io/qt-5/qvalidator.html). +The model. When it has a corresponding controller, it generally inherits from [QAbstractTableModel](http://doc.qt.io/qt-5/qabstracttablemodel.html). Models that are used by controllers as helpers inherit from other Qt classes like [QValidator](http://doc.qt.io/qt-5/qvalidator.html). ClientModel is used by the main application `bitcoingui` and several models like `peertablemodel`. @@ -69,7 +69,7 @@ Represents the view to a single wallet. ## Contribute -See [CONTRIBUTING.md](/CONTRIBUTING.md) for general guidelines. Specifically for QT: +See [CONTRIBUTING.md](/CONTRIBUTING.md) for general guidelines. Specifically for Qt: * don't change `local/bitcoin_en.ts`; this happens [automatically](/doc/translation_process.md#writing-code-with-translations) @@ -83,7 +83,7 @@ Uncheck everything except Qt Creator during the installation process. Instructions for OSX: -1. Make sure you installed everything through Homebrew mentioned in the [OSX build instructions](/docs/build-osx.md) +1. Make sure you installed everything through Homebrew mentioned in the [OSX build instructions](/doc/build-osx.md) 2. Use `./configure` with the `--enable-debug` flag 3. In Qt Creator do "New Project" -> Import Project -> Import Existing Project 4. Enter "bitcoin-qt" as project name, enter src/qt as location diff --git a/src/qt/optionsmodel.cpp b/src/qt/optionsmodel.cpp index 30c8124c58..cae9dace4c 100644 --- a/src/qt/optionsmodel.cpp +++ b/src/qt/optionsmodel.cpp @@ -24,6 +24,8 @@ const char *DEFAULT_GUI_PROXY_HOST = "127.0.0.1"; +static const QString GetDefaultProxyAddress(); + OptionsModel::OptionsModel(interfaces::Node& node, QObject *parent, bool resetSettings) : QAbstractListModel(parent), m_node(node) { @@ -121,7 +123,7 @@ void OptionsModel::Init(bool resetSettings) if (!settings.contains("fUseProxy")) settings.setValue("fUseProxy", false); if (!settings.contains("addrProxy")) - settings.setValue("addrProxy", QString("%1:%2").arg(DEFAULT_GUI_PROXY_HOST, DEFAULT_GUI_PROXY_PORT)); + settings.setValue("addrProxy", GetDefaultProxyAddress()); // Only try to set -proxy, if user has enabled fUseProxy if (settings.value("fUseProxy").toBool() && !m_node.softSetArg("-proxy", settings.value("addrProxy").toString().toStdString())) addOverriddenOption("-proxy"); @@ -131,7 +133,7 @@ void OptionsModel::Init(bool resetSettings) if (!settings.contains("fUseSeparateProxyTor")) settings.setValue("fUseSeparateProxyTor", false); if (!settings.contains("addrSeparateProxyTor")) - settings.setValue("addrSeparateProxyTor", QString("%1:%2").arg(DEFAULT_GUI_PROXY_HOST, DEFAULT_GUI_PROXY_PORT)); + settings.setValue("addrSeparateProxyTor", GetDefaultProxyAddress()); // Only try to set -onion, if user has enabled fUseSeparateProxyTor if (settings.value("fUseSeparateProxyTor").toBool() && !m_node.softSetArg("-onion", settings.value("addrSeparateProxyTor").toString().toStdString())) addOverriddenOption("-onion"); @@ -223,6 +225,11 @@ static void SetProxySetting(QSettings &settings, const QString &name, const Prox settings.setValue(name, ip_port.ip + ":" + ip_port.port); } +static const QString GetDefaultProxyAddress() +{ + return QString("%1:%2").arg(DEFAULT_GUI_PROXY_HOST).arg(DEFAULT_GUI_PROXY_PORT); +} + // read QSettings values and return them QVariant OptionsModel::data(const QModelIndex & index, int role) const { @@ -485,4 +492,16 @@ void OptionsModel::checkAndMigrate() settings.setValue(strSettingsVersionKey, CLIENT_VERSION); } + + // Overwrite the 'addrProxy' setting in case it has been set to an illegal + // default value (see issue #12623; PR #12650). + if (settings.contains("addrProxy") && settings.value("addrProxy").toString().endsWith("%2")) { + settings.setValue("addrProxy", GetDefaultProxyAddress()); + } + + // Overwrite the 'addrSeparateProxyTor' setting in case it has been set to an illegal + // default value (see issue #12623; PR #12650). + if (settings.contains("addrSeparateProxyTor") && settings.value("addrSeparateProxyTor").toString().endsWith("%2")) { + settings.setValue("addrSeparateProxyTor", GetDefaultProxyAddress()); + } } diff --git a/src/qt/paymentrequestplus.cpp b/src/qt/paymentrequestplus.cpp index 357e98a53c..b0ef475b35 100644 --- a/src/qt/paymentrequestplus.cpp +++ b/src/qt/paymentrequestplus.cpp @@ -9,7 +9,6 @@ #include <qt/paymentrequestplus.h> -#include <script/script.h> #include <util.h> #include <stdexcept> diff --git a/src/qt/test/wallettests.cpp b/src/qt/test/wallettests.cpp index fb86cf5ec9..dcc834c352 100644 --- a/src/qt/test/wallettests.cpp +++ b/src/qt/test/wallettests.cpp @@ -158,7 +158,7 @@ void TestGUI() for (int i = 0; i < 5; ++i) { test.CreateAndProcessBlock({}, GetScriptForRawPubKey(test.coinbaseKey.GetPubKey())); } - CWallet wallet("mock", CWalletDBWrapper::CreateMock()); + CWallet wallet("mock", WalletDatabase::CreateMock()); bool firstRun; wallet.LoadWallet(firstRun); { |