mirror of
https://github.com/dashpay/dash.git
synced 2024-12-27 04:52:59 +01:00
Remove direct bitcoin calls from qt/optionsmodel.cpp
This commit is contained in:
parent
e709f5a45e
commit
f45e095566
@ -7,6 +7,9 @@
|
|||||||
#include <chainparams.h>
|
#include <chainparams.h>
|
||||||
#include <init.h>
|
#include <init.h>
|
||||||
#include <interface/handler.h>
|
#include <interface/handler.h>
|
||||||
|
#include <net.h>
|
||||||
|
#include <netaddress.h>
|
||||||
|
#include <netbase.h>
|
||||||
#include <scheduler.h>
|
#include <scheduler.h>
|
||||||
#include <ui_interface.h>
|
#include <ui_interface.h>
|
||||||
#include <util.h>
|
#include <util.h>
|
||||||
@ -24,6 +27,8 @@ class NodeImpl : public Node
|
|||||||
gArgs.ParseParameters(argc, argv);
|
gArgs.ParseParameters(argc, argv);
|
||||||
}
|
}
|
||||||
void readConfigFile(const std::string& conf_path) override { gArgs.ReadConfigFile(conf_path); }
|
void readConfigFile(const std::string& conf_path) override { gArgs.ReadConfigFile(conf_path); }
|
||||||
|
bool softSetArg(const std::string& arg, const std::string& value) override { return gArgs.SoftSetArg(arg, value); }
|
||||||
|
bool softSetBoolArg(const std::string& arg, bool value) override { return gArgs.SoftSetBoolArg(arg, value); }
|
||||||
void selectParams(const std::string& network) override { SelectParams(network); }
|
void selectParams(const std::string& network) override { SelectParams(network); }
|
||||||
void initLogging() override { InitLogging(); }
|
void initLogging() override { InitLogging(); }
|
||||||
void initParameterInteraction() override { InitParameterInteraction(); }
|
void initParameterInteraction() override { InitParameterInteraction(); }
|
||||||
@ -40,6 +45,16 @@ class NodeImpl : public Node
|
|||||||
Shutdown();
|
Shutdown();
|
||||||
}
|
}
|
||||||
void startShutdown() override { StartShutdown(); }
|
void startShutdown() override { StartShutdown(); }
|
||||||
|
void mapPort(bool use_upnp) override
|
||||||
|
{
|
||||||
|
if (use_upnp) {
|
||||||
|
StartMapPort();
|
||||||
|
} else {
|
||||||
|
InterruptMapPort();
|
||||||
|
StopMapPort();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
bool getProxy(Network net, proxyType& proxy_info) override { return GetProxy(net, proxy_info); }
|
||||||
std::unique_ptr<Handler> handleInitMessage(InitMessageFn fn) override
|
std::unique_ptr<Handler> handleInitMessage(InitMessageFn fn) override
|
||||||
{
|
{
|
||||||
return MakeHandler(::uiInterface.InitMessage.connect(fn));
|
return MakeHandler(::uiInterface.InitMessage.connect(fn));
|
||||||
|
@ -5,10 +5,14 @@
|
|||||||
#ifndef BITCOIN_INTERFACE_NODE_H
|
#ifndef BITCOIN_INTERFACE_NODE_H
|
||||||
#define BITCOIN_INTERFACE_NODE_H
|
#define BITCOIN_INTERFACE_NODE_H
|
||||||
|
|
||||||
|
#include <netaddress.h> // For Network
|
||||||
|
|
||||||
#include <functional>
|
#include <functional>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
|
class proxyType;
|
||||||
|
|
||||||
namespace interface {
|
namespace interface {
|
||||||
|
|
||||||
class Handler;
|
class Handler;
|
||||||
@ -22,6 +26,12 @@ public:
|
|||||||
//! Set command line arguments.
|
//! Set command line arguments.
|
||||||
virtual void parseParameters(int argc, const char* const argv[]) = 0;
|
virtual void parseParameters(int argc, const char* const argv[]) = 0;
|
||||||
|
|
||||||
|
//! Set a command line argument if it doesn't already have a value
|
||||||
|
virtual bool softSetArg(const std::string& arg, const std::string& value) = 0;
|
||||||
|
|
||||||
|
//! Set a command line boolean argument if it doesn't already have a value
|
||||||
|
virtual bool softSetBoolArg(const std::string& arg, bool value) = 0;
|
||||||
|
|
||||||
//! Load settings from configuration file.
|
//! Load settings from configuration file.
|
||||||
virtual void readConfigFile(const std::string& conf_path) = 0;
|
virtual void readConfigFile(const std::string& conf_path) = 0;
|
||||||
|
|
||||||
@ -49,6 +59,12 @@ public:
|
|||||||
//! Start shutdown.
|
//! Start shutdown.
|
||||||
virtual void startShutdown() = 0;
|
virtual void startShutdown() = 0;
|
||||||
|
|
||||||
|
//! Map port.
|
||||||
|
virtual void mapPort(bool use_upnp) = 0;
|
||||||
|
|
||||||
|
//! Get proxy.
|
||||||
|
virtual bool getProxy(Network net, proxyType& proxy_info) = 0;
|
||||||
|
|
||||||
//! Register handler for init messages.
|
//! Register handler for init messages.
|
||||||
using InitMessageFn = std::function<void(const std::string& message)>;
|
using InitMessageFn = std::function<void(const std::string& message)>;
|
||||||
virtual std::unique_ptr<Handler> handleInitMessage(InitMessageFn fn) = 0;
|
virtual std::unique_ptr<Handler> handleInitMessage(InitMessageFn fn) = 0;
|
||||||
|
@ -241,9 +241,7 @@ void AddressBookPage::on_showAddressQRCode_clicked()
|
|||||||
|
|
||||||
QString strAddress = entries.at(0).data(Qt::EditRole).toString();
|
QString strAddress = entries.at(0).data(Qt::EditRole).toString();
|
||||||
QRDialog* dialog = new QRDialog(this);
|
QRDialog* dialog = new QRDialog(this);
|
||||||
OptionsModel *model = new OptionsModel(nullptr, false);
|
|
||||||
|
|
||||||
dialog->setModel(model);
|
|
||||||
dialog->setAttribute(Qt::WA_DeleteOnClose);
|
dialog->setAttribute(Qt::WA_DeleteOnClose);
|
||||||
dialog->setInfo(tr("QR code"), "dash:"+strAddress, "", strAddress);
|
dialog->setInfo(tr("QR code"), "dash:"+strAddress, "", strAddress);
|
||||||
dialog->show();
|
dialog->show();
|
||||||
|
@ -353,7 +353,7 @@ void BitcoinApplication::createPaymentServer()
|
|||||||
|
|
||||||
void BitcoinApplication::createOptionsModel(bool resetSettings)
|
void BitcoinApplication::createOptionsModel(bool resetSettings)
|
||||||
{
|
{
|
||||||
optionsModel = new OptionsModel(nullptr, resetSettings);
|
optionsModel = new OptionsModel(m_node, nullptr, resetSettings);
|
||||||
}
|
}
|
||||||
|
|
||||||
void BitcoinApplication::createWindow(const NetworkStyle *networkStyle)
|
void BitcoinApplication::createWindow(const NetworkStyle *networkStyle)
|
||||||
|
@ -12,16 +12,13 @@
|
|||||||
#include <qt/bitcoinunits.h>
|
#include <qt/bitcoinunits.h>
|
||||||
#include <qt/guiutil.h>
|
#include <qt/guiutil.h>
|
||||||
|
|
||||||
#include <init.h>
|
#include <interface/node.h>
|
||||||
#include <validation.h> // For DEFAULT_SCRIPTCHECK_THREADS
|
#include <validation.h> // For DEFAULT_SCRIPTCHECK_THREADS
|
||||||
#include <net.h>
|
#include <net.h>
|
||||||
#include <netbase.h>
|
#include <netbase.h>
|
||||||
#include <txdb.h> // for -dbcache defaults
|
#include <txdb.h> // for -dbcache defaults
|
||||||
|
|
||||||
#ifdef ENABLE_WALLET
|
#ifdef ENABLE_WALLET
|
||||||
#include <wallet/wallet.h>
|
|
||||||
#include <wallet/walletdb.h>
|
|
||||||
|
|
||||||
#include <privatesend/privatesend-client.h>
|
#include <privatesend/privatesend-client.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -33,8 +30,8 @@ const char *DEFAULT_GUI_PROXY_HOST = "127.0.0.1";
|
|||||||
|
|
||||||
static const QString GetDefaultProxyAddress();
|
static const QString GetDefaultProxyAddress();
|
||||||
|
|
||||||
OptionsModel::OptionsModel(QObject *parent, bool resetSettings) :
|
OptionsModel::OptionsModel(interface::Node& node, QObject *parent, bool resetSettings) :
|
||||||
QAbstractListModel(parent)
|
QAbstractListModel(parent), m_node(node)
|
||||||
{
|
{
|
||||||
Init(resetSettings);
|
Init(resetSettings);
|
||||||
}
|
}
|
||||||
@ -91,17 +88,17 @@ void OptionsModel::Init(bool resetSettings)
|
|||||||
|
|
||||||
if (!settings.contains("fontScale"))
|
if (!settings.contains("fontScale"))
|
||||||
settings.setValue("fontScale", GUIUtil::getFontScaleDefault());
|
settings.setValue("fontScale", GUIUtil::getFontScaleDefault());
|
||||||
if (!gArgs.SoftSetArg("-font-scale", settings.value("fontScale").toString().toStdString()))
|
if (!m_node.softSetArg("-font-scale", settings.value("fontScale").toString().toStdString()))
|
||||||
addOverriddenOption("-font-scale");
|
addOverriddenOption("-font-scale");
|
||||||
|
|
||||||
if (!settings.contains("fontWeightNormal"))
|
if (!settings.contains("fontWeightNormal"))
|
||||||
settings.setValue("fontWeightNormal", GUIUtil::weightToArg(GUIUtil::getFontWeightNormalDefault()));
|
settings.setValue("fontWeightNormal", GUIUtil::weightToArg(GUIUtil::getFontWeightNormalDefault()));
|
||||||
if (!gArgs.SoftSetArg("-font-weight-normal", settings.value("fontWeightNormal").toString().toStdString()))
|
if (!m_node.softSetArg("-font-weight-normal", settings.value("fontWeightNormal").toString().toStdString()))
|
||||||
addOverriddenOption("-font-weight-normal");
|
addOverriddenOption("-font-weight-normal");
|
||||||
|
|
||||||
if (!settings.contains("fontWeightBold"))
|
if (!settings.contains("fontWeightBold"))
|
||||||
settings.setValue("fontWeightBold", GUIUtil::weightToArg(GUIUtil::getFontWeightBoldDefault()));
|
settings.setValue("fontWeightBold", GUIUtil::weightToArg(GUIUtil::getFontWeightBoldDefault()));
|
||||||
if (!gArgs.SoftSetArg("-font-weight-bold", settings.value("fontWeightBold").toString().toStdString()))
|
if (!m_node.softSetArg("-font-weight-bold", settings.value("fontWeightBold").toString().toStdString()))
|
||||||
addOverriddenOption("-font-weight-bold");
|
addOverriddenOption("-font-weight-bold");
|
||||||
|
|
||||||
#ifdef ENABLE_WALLET
|
#ifdef ENABLE_WALLET
|
||||||
@ -136,31 +133,31 @@ void OptionsModel::Init(bool resetSettings)
|
|||||||
//
|
//
|
||||||
// If setting doesn't exist create it with defaults.
|
// If setting doesn't exist create it with defaults.
|
||||||
//
|
//
|
||||||
// If gArgs.SoftSetArg() or gArgs.SoftSetBoolArg() return false we were overridden
|
// If m_node.softSetArg() or m_node.softSetBoolArg() return false we were overridden
|
||||||
// by command-line and show this in the UI.
|
// by command-line and show this in the UI.
|
||||||
|
|
||||||
// Main
|
// Main
|
||||||
if (!settings.contains("nDatabaseCache"))
|
if (!settings.contains("nDatabaseCache"))
|
||||||
settings.setValue("nDatabaseCache", (qint64)nDefaultDbCache);
|
settings.setValue("nDatabaseCache", (qint64)nDefaultDbCache);
|
||||||
if (!gArgs.SoftSetArg("-dbcache", settings.value("nDatabaseCache").toString().toStdString()))
|
if (!m_node.softSetArg("-dbcache", settings.value("nDatabaseCache").toString().toStdString()))
|
||||||
addOverriddenOption("-dbcache");
|
addOverriddenOption("-dbcache");
|
||||||
|
|
||||||
if (!settings.contains("nThreadsScriptVerif"))
|
if (!settings.contains("nThreadsScriptVerif"))
|
||||||
settings.setValue("nThreadsScriptVerif", DEFAULT_SCRIPTCHECK_THREADS);
|
settings.setValue("nThreadsScriptVerif", DEFAULT_SCRIPTCHECK_THREADS);
|
||||||
if (!gArgs.SoftSetArg("-par", settings.value("nThreadsScriptVerif").toString().toStdString()))
|
if (!m_node.softSetArg("-par", settings.value("nThreadsScriptVerif").toString().toStdString()))
|
||||||
addOverriddenOption("-par");
|
addOverriddenOption("-par");
|
||||||
|
|
||||||
// Wallet
|
// Wallet
|
||||||
#ifdef ENABLE_WALLET
|
#ifdef ENABLE_WALLET
|
||||||
if (!settings.contains("bSpendZeroConfChange"))
|
if (!settings.contains("bSpendZeroConfChange"))
|
||||||
settings.setValue("bSpendZeroConfChange", true);
|
settings.setValue("bSpendZeroConfChange", true);
|
||||||
if (!gArgs.SoftSetBoolArg("-spendzeroconfchange", settings.value("bSpendZeroConfChange").toBool()))
|
if (!m_node.softSetBoolArg("-spendzeroconfchange", settings.value("bSpendZeroConfChange").toBool()))
|
||||||
addOverriddenOption("-spendzeroconfchange");
|
addOverriddenOption("-spendzeroconfchange");
|
||||||
|
|
||||||
// PrivateSend
|
// PrivateSend
|
||||||
if (!settings.contains("nPrivateSendRounds"))
|
if (!settings.contains("nPrivateSendRounds"))
|
||||||
settings.setValue("nPrivateSendRounds", DEFAULT_PRIVATESEND_ROUNDS);
|
settings.setValue("nPrivateSendRounds", DEFAULT_PRIVATESEND_ROUNDS);
|
||||||
if (!gArgs.SoftSetArg("-privatesendrounds", settings.value("nPrivateSendRounds").toString().toStdString()))
|
if (!m_node.softSetArg("-privatesendrounds", settings.value("nPrivateSendRounds").toString().toStdString()))
|
||||||
addOverriddenOption("-privatesendrounds");
|
addOverriddenOption("-privatesendrounds");
|
||||||
CPrivateSendClientOptions::SetRounds(settings.value("nPrivateSendRounds").toInt());
|
CPrivateSendClientOptions::SetRounds(settings.value("nPrivateSendRounds").toInt());
|
||||||
|
|
||||||
@ -171,13 +168,13 @@ void OptionsModel::Init(bool resetSettings)
|
|||||||
else
|
else
|
||||||
settings.setValue("nPrivateSendAmount", settings.value("nAnonymizeDashAmount").toInt());
|
settings.setValue("nPrivateSendAmount", settings.value("nAnonymizeDashAmount").toInt());
|
||||||
}
|
}
|
||||||
if (!gArgs.SoftSetArg("-privatesendamount", settings.value("nPrivateSendAmount").toString().toStdString()))
|
if (!m_node.softSetArg("-privatesendamount", settings.value("nPrivateSendAmount").toString().toStdString()))
|
||||||
addOverriddenOption("-privatesendamount");
|
addOverriddenOption("-privatesendamount");
|
||||||
CPrivateSendClientOptions::SetAmount(settings.value("nPrivateSendAmount").toInt());
|
CPrivateSendClientOptions::SetAmount(settings.value("nPrivateSendAmount").toInt());
|
||||||
|
|
||||||
if (!settings.contains("fPrivateSendMultiSession"))
|
if (!settings.contains("fPrivateSendMultiSession"))
|
||||||
settings.setValue("fPrivateSendMultiSession", DEFAULT_PRIVATESEND_MULTISESSION);
|
settings.setValue("fPrivateSendMultiSession", DEFAULT_PRIVATESEND_MULTISESSION);
|
||||||
if (!gArgs.SoftSetBoolArg("-privatesendmultisession", settings.value("fPrivateSendMultiSession").toBool()))
|
if (!m_node.softSetBoolArg("-privatesendmultisession", settings.value("fPrivateSendMultiSession").toBool()))
|
||||||
addOverriddenOption("-privatesendmultisession");
|
addOverriddenOption("-privatesendmultisession");
|
||||||
CPrivateSendClientOptions::SetMultiSessionEnabled(settings.value("fPrivateSendMultiSession").toBool());
|
CPrivateSendClientOptions::SetMultiSessionEnabled(settings.value("fPrivateSendMultiSession").toBool());
|
||||||
#endif
|
#endif
|
||||||
@ -185,12 +182,12 @@ void OptionsModel::Init(bool resetSettings)
|
|||||||
// Network
|
// Network
|
||||||
if (!settings.contains("fUseUPnP"))
|
if (!settings.contains("fUseUPnP"))
|
||||||
settings.setValue("fUseUPnP", DEFAULT_UPNP);
|
settings.setValue("fUseUPnP", DEFAULT_UPNP);
|
||||||
if (!gArgs.SoftSetBoolArg("-upnp", settings.value("fUseUPnP").toBool()))
|
if (!m_node.softSetBoolArg("-upnp", settings.value("fUseUPnP").toBool()))
|
||||||
addOverriddenOption("-upnp");
|
addOverriddenOption("-upnp");
|
||||||
|
|
||||||
if (!settings.contains("fListen"))
|
if (!settings.contains("fListen"))
|
||||||
settings.setValue("fListen", DEFAULT_LISTEN);
|
settings.setValue("fListen", DEFAULT_LISTEN);
|
||||||
if (!gArgs.SoftSetBoolArg("-listen", settings.value("fListen").toBool()))
|
if (!m_node.softSetBoolArg("-listen", settings.value("fListen").toBool()))
|
||||||
addOverriddenOption("-listen");
|
addOverriddenOption("-listen");
|
||||||
|
|
||||||
if (!settings.contains("fUseProxy"))
|
if (!settings.contains("fUseProxy"))
|
||||||
@ -198,7 +195,7 @@ void OptionsModel::Init(bool resetSettings)
|
|||||||
if (!settings.contains("addrProxy"))
|
if (!settings.contains("addrProxy"))
|
||||||
settings.setValue("addrProxy", GetDefaultProxyAddress());
|
settings.setValue("addrProxy", GetDefaultProxyAddress());
|
||||||
// Only try to set -proxy, if user has enabled fUseProxy
|
// Only try to set -proxy, if user has enabled fUseProxy
|
||||||
if (settings.value("fUseProxy").toBool() && !gArgs.SoftSetArg("-proxy", settings.value("addrProxy").toString().toStdString()))
|
if (settings.value("fUseProxy").toBool() && !m_node.softSetArg("-proxy", settings.value("addrProxy").toString().toStdString()))
|
||||||
addOverriddenOption("-proxy");
|
addOverriddenOption("-proxy");
|
||||||
else if(!settings.value("fUseProxy").toBool() && !gArgs.GetArg("-proxy", "").empty())
|
else if(!settings.value("fUseProxy").toBool() && !gArgs.GetArg("-proxy", "").empty())
|
||||||
addOverriddenOption("-proxy");
|
addOverriddenOption("-proxy");
|
||||||
@ -208,7 +205,7 @@ void OptionsModel::Init(bool resetSettings)
|
|||||||
if (!settings.contains("addrSeparateProxyTor"))
|
if (!settings.contains("addrSeparateProxyTor"))
|
||||||
settings.setValue("addrSeparateProxyTor", GetDefaultProxyAddress());
|
settings.setValue("addrSeparateProxyTor", GetDefaultProxyAddress());
|
||||||
// Only try to set -onion, if user has enabled fUseSeparateProxyTor
|
// Only try to set -onion, if user has enabled fUseSeparateProxyTor
|
||||||
if (settings.value("fUseSeparateProxyTor").toBool() && !gArgs.SoftSetArg("-onion", settings.value("addrSeparateProxyTor").toString().toStdString()))
|
if (settings.value("fUseSeparateProxyTor").toBool() && !m_node.softSetArg("-onion", settings.value("addrSeparateProxyTor").toString().toStdString()))
|
||||||
addOverriddenOption("-onion");
|
addOverriddenOption("-onion");
|
||||||
else if(!settings.value("fUseSeparateProxyTor").toBool() && !gArgs.GetArg("-onion", "").empty())
|
else if(!settings.value("fUseSeparateProxyTor").toBool() && !gArgs.GetArg("-onion", "").empty())
|
||||||
addOverriddenOption("-onion");
|
addOverriddenOption("-onion");
|
||||||
@ -216,7 +213,7 @@ void OptionsModel::Init(bool resetSettings)
|
|||||||
// Display
|
// Display
|
||||||
if (!settings.contains("language"))
|
if (!settings.contains("language"))
|
||||||
settings.setValue("language", "");
|
settings.setValue("language", "");
|
||||||
if (!gArgs.SoftSetArg("-lang", settings.value("language").toString().toStdString()))
|
if (!m_node.softSetArg("-lang", settings.value("language").toString().toStdString()))
|
||||||
addOverriddenOption("-lang");
|
addOverriddenOption("-lang");
|
||||||
|
|
||||||
language = settings.value("language").toString();
|
language = settings.value("language").toString();
|
||||||
@ -418,12 +415,7 @@ bool OptionsModel::setData(const QModelIndex & index, const QVariant & value, in
|
|||||||
break;
|
break;
|
||||||
case MapPortUPnP: // core option - can be changed on-the-fly
|
case MapPortUPnP: // core option - can be changed on-the-fly
|
||||||
settings.setValue("fUseUPnP", value.toBool());
|
settings.setValue("fUseUPnP", value.toBool());
|
||||||
if (value.toBool()) {
|
m_node.mapPort(value.toBool());
|
||||||
StartMapPort();
|
|
||||||
} else {
|
|
||||||
InterruptMapPort();
|
|
||||||
StopMapPort();
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case MinimizeOnClose:
|
case MinimizeOnClose:
|
||||||
fMinimizeOnClose = value.toBool();
|
fMinimizeOnClose = value.toBool();
|
||||||
@ -642,7 +634,7 @@ bool OptionsModel::getProxySettings(QNetworkProxy& proxy) const
|
|||||||
// Directly query current base proxy, because
|
// Directly query current base proxy, because
|
||||||
// GUI settings can be overridden with -proxy.
|
// GUI settings can be overridden with -proxy.
|
||||||
proxyType curProxy;
|
proxyType curProxy;
|
||||||
if (GetProxy(NET_IPV4, curProxy)) {
|
if (m_node.getProxy(NET_IPV4, curProxy)) {
|
||||||
proxy.setType(QNetworkProxy::Socks5Proxy);
|
proxy.setType(QNetworkProxy::Socks5Proxy);
|
||||||
proxy.setHostName(QString::fromStdString(curProxy.proxy.ToStringIP()));
|
proxy.setHostName(QString::fromStdString(curProxy.proxy.ToStringIP()));
|
||||||
proxy.setPort(curProxy.proxy.GetPort());
|
proxy.setPort(curProxy.proxy.GetPort());
|
||||||
|
@ -9,6 +9,10 @@
|
|||||||
|
|
||||||
#include <QAbstractListModel>
|
#include <QAbstractListModel>
|
||||||
|
|
||||||
|
namespace interface {
|
||||||
|
class Node;
|
||||||
|
}
|
||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
class QNetworkProxy;
|
class QNetworkProxy;
|
||||||
QT_END_NAMESPACE
|
QT_END_NAMESPACE
|
||||||
@ -27,7 +31,7 @@ class OptionsModel : public QAbstractListModel
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit OptionsModel(QObject *parent = 0, bool resetSettings = false);
|
explicit OptionsModel(interface::Node& node, QObject *parent = 0, bool resetSettings = false);
|
||||||
|
|
||||||
enum OptionID {
|
enum OptionID {
|
||||||
StartAtStartup, // bool
|
StartAtStartup, // bool
|
||||||
@ -93,6 +97,7 @@ public:
|
|||||||
bool resetSettingsOnShutdown{false};
|
bool resetSettingsOnShutdown{false};
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
interface::Node& m_node;
|
||||||
/* Qt-only settings */
|
/* Qt-only settings */
|
||||||
bool fHideTrayIcon;
|
bool fHideTrayIcon;
|
||||||
bool fMinimizeToTray;
|
bool fMinimizeToTray;
|
||||||
|
@ -8,7 +8,6 @@
|
|||||||
#include <qt/bitcoinunits.h>
|
#include <qt/bitcoinunits.h>
|
||||||
#include <qt/guiconstants.h>
|
#include <qt/guiconstants.h>
|
||||||
#include <qt/guiutil.h>
|
#include <qt/guiutil.h>
|
||||||
#include <qt/optionsmodel.h>
|
|
||||||
|
|
||||||
#include <QClipboard>
|
#include <QClipboard>
|
||||||
#include <QDrag>
|
#include <QDrag>
|
||||||
@ -91,8 +90,7 @@ void QRGeneralImageWidget::contextMenuEvent(QContextMenuEvent *event)
|
|||||||
|
|
||||||
QRDialog::QRDialog(QWidget *parent) :
|
QRDialog::QRDialog(QWidget *parent) :
|
||||||
QDialog(parent),
|
QDialog(parent),
|
||||||
ui(new Ui::QRDialog),
|
ui(new Ui::QRDialog)
|
||||||
model(0)
|
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
|
|
||||||
@ -113,17 +111,6 @@ QRDialog::~QRDialog()
|
|||||||
delete ui;
|
delete ui;
|
||||||
}
|
}
|
||||||
|
|
||||||
void QRDialog::setModel(OptionsModel *model)
|
|
||||||
{
|
|
||||||
this->model = model;
|
|
||||||
|
|
||||||
if (model)
|
|
||||||
connect(model, SIGNAL(displayUnitChanged(int)), this, SLOT(update()));
|
|
||||||
|
|
||||||
// update the display unit if necessary
|
|
||||||
update();
|
|
||||||
}
|
|
||||||
|
|
||||||
void QRDialog::setInfo(QString strWindowtitle, QString strQRCode, QString strTextInfo, QString strQRCodeTitle)
|
void QRDialog::setInfo(QString strWindowtitle, QString strQRCode, QString strTextInfo, QString strQRCodeTitle)
|
||||||
{
|
{
|
||||||
this->strWindowtitle = strWindowtitle;
|
this->strWindowtitle = strWindowtitle;
|
||||||
@ -135,9 +122,6 @@ void QRDialog::setInfo(QString strWindowtitle, QString strQRCode, QString strTex
|
|||||||
|
|
||||||
void QRDialog::update()
|
void QRDialog::update()
|
||||||
{
|
{
|
||||||
if(!model)
|
|
||||||
return;
|
|
||||||
|
|
||||||
setWindowTitle(strWindowtitle);
|
setWindowTitle(strWindowtitle);
|
||||||
ui->button_saveImage->setEnabled(false);
|
ui->button_saveImage->setEnabled(false);
|
||||||
if (strTextInfo.isEmpty()) {
|
if (strTextInfo.isEmpty()) {
|
||||||
@ -183,4 +167,4 @@ void QRDialog::update()
|
|||||||
ui->button_saveImage->setEnabled(true);
|
ui->button_saveImage->setEnabled(true);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -11,8 +11,6 @@
|
|||||||
#include <QImage>
|
#include <QImage>
|
||||||
#include <QLabel>
|
#include <QLabel>
|
||||||
|
|
||||||
class OptionsModel;
|
|
||||||
|
|
||||||
namespace Ui {
|
namespace Ui {
|
||||||
class QRDialog;
|
class QRDialog;
|
||||||
}
|
}
|
||||||
@ -52,7 +50,6 @@ public:
|
|||||||
explicit QRDialog(QWidget *parent = 0);
|
explicit QRDialog(QWidget *parent = 0);
|
||||||
~QRDialog();
|
~QRDialog();
|
||||||
|
|
||||||
void setModel(OptionsModel *model);
|
|
||||||
void setInfo(QString strWindowtitle, QString strQRCode, QString strTextInfo, QString strQRCodeTitle);
|
void setInfo(QString strWindowtitle, QString strQRCode, QString strTextInfo, QString strQRCodeTitle);
|
||||||
|
|
||||||
private Q_SLOTS:
|
private Q_SLOTS:
|
||||||
@ -60,7 +57,6 @@ private Q_SLOTS:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::QRDialog *ui;
|
Ui::QRDialog *ui;
|
||||||
OptionsModel *model;
|
|
||||||
QString strWindowtitle;
|
QString strWindowtitle;
|
||||||
QString strQRCode;
|
QString strQRCode;
|
||||||
QString strTextInfo;
|
QString strTextInfo;
|
||||||
|
@ -8,6 +8,7 @@
|
|||||||
#include <qt/test/paymentrequestdata.h>
|
#include <qt/test/paymentrequestdata.h>
|
||||||
|
|
||||||
#include <amount.h>
|
#include <amount.h>
|
||||||
|
#include <interface/node.h>
|
||||||
#include <random.h>
|
#include <random.h>
|
||||||
#include <script/script.h>
|
#include <script/script.h>
|
||||||
#include <script/standard.h>
|
#include <script/standard.h>
|
||||||
@ -65,7 +66,8 @@ static SendCoinsRecipient handleRequest(PaymentServer* server, std::vector<unsig
|
|||||||
void PaymentServerTests::paymentServerTests()
|
void PaymentServerTests::paymentServerTests()
|
||||||
{
|
{
|
||||||
SelectParams(CBaseChainParams::MAIN);
|
SelectParams(CBaseChainParams::MAIN);
|
||||||
OptionsModel optionsModel;
|
auto node = interface::MakeNode();
|
||||||
|
OptionsModel optionsModel(*node);
|
||||||
PaymentServer* server = new PaymentServer(nullptr, false);
|
PaymentServer* server = new PaymentServer(nullptr, false);
|
||||||
X509_STORE* caStore = X509_STORE_new();
|
X509_STORE* caStore = X509_STORE_new();
|
||||||
X509_STORE_add_cert(caStore, parse_b64der_cert(caCert1_BASE64));
|
X509_STORE_add_cert(caStore, parse_b64der_cert(caCert1_BASE64));
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
#include <qt/test/wallettests.h>
|
#include <qt/test/wallettests.h>
|
||||||
|
|
||||||
|
#include <interface/node.h>
|
||||||
#include <qt/bitcoinamountfield.h>
|
#include <qt/bitcoinamountfield.h>
|
||||||
#include <qt/callback.h>
|
#include <qt/callback.h>
|
||||||
#include <qt/optionsmodel.h>
|
#include <qt/optionsmodel.h>
|
||||||
@ -134,7 +135,8 @@ void TestGUI()
|
|||||||
// Create widgets for sending coins and listing transactions.
|
// Create widgets for sending coins and listing transactions.
|
||||||
SendCoinsDialog sendCoinsDialog;
|
SendCoinsDialog sendCoinsDialog;
|
||||||
TransactionView transactionView;
|
TransactionView transactionView;
|
||||||
OptionsModel optionsModel;
|
auto node = interface::MakeNode();
|
||||||
|
OptionsModel optionsModel(*node);
|
||||||
WalletModel walletModel(&wallet, &optionsModel);
|
WalletModel walletModel(&wallet, &optionsModel);
|
||||||
sendCoinsDialog.setModel(&walletModel);
|
sendCoinsDialog.setModel(&walletModel);
|
||||||
transactionView.setModel(&walletModel);
|
transactionView.setModel(&walletModel);
|
||||||
|
@ -540,9 +540,7 @@ void TransactionView::showAddressQRCode()
|
|||||||
|
|
||||||
QString strAddress = entries.at(0).data(TransactionTableModel::AddressRole).toString();
|
QString strAddress = entries.at(0).data(TransactionTableModel::AddressRole).toString();
|
||||||
QRDialog* dialog = new QRDialog(this);
|
QRDialog* dialog = new QRDialog(this);
|
||||||
OptionsModel *model = new OptionsModel(nullptr, false);
|
|
||||||
|
|
||||||
dialog->setModel(model);
|
|
||||||
dialog->setAttribute(Qt::WA_DeleteOnClose);
|
dialog->setAttribute(Qt::WA_DeleteOnClose);
|
||||||
dialog->setInfo(tr("QR code"), "dash:"+strAddress, "", strAddress);
|
dialog->setInfo(tr("QR code"), "dash:"+strAddress, "", strAddress);
|
||||||
dialog->show();
|
dialog->show();
|
||||||
|
Loading…
Reference in New Issue
Block a user