mirror of
https://github.com/dashpay/dash.git
synced 2024-12-26 20:42:59 +01:00
qt: Add PrivateSend tab in OptionsDialog, allow to show/hide PS UI (#3717)
* qt: Add PrivateSend tab in OptionsDialog, allow to show/hide PS UI * qt: Decrease height of OptionsDialog * Apply suggestions from code review Co-authored-by: UdjinM6 <UdjinM6@users.noreply.github.com> * qt: Remove obsolete visibility adjustments Not longer needed since the page is just not reachable if the button is hidden. * qt: Make sure PrivateSend related parts are always initialized properly Not only if its enabled on startup.. * qt: Make updatePrivateSendVisibility a slot to fix the signal connection * qt: Fix UI updates on OverviewPage if PrivateSend enabled gets toggled Other way of connecting the slot with true as parameter didn't work.. * qt: Only update and emit the signal for advanced PS UI if required * qt: Update fPrivateSendEnabled in OptionsModel instead of OptionsDialog * qt: Recover the PrivateSend enabled state if OptionsDialog gets rejected * qt: Enable PrivateSend UI by default * qt: Add some brackets * qt: Add a comment * qt: Add a linebreak to the "Enable PrivateSend features" tooltip * qt: Remove obsolete comment Co-authored-by: PastaPastaPasta <6443210+PastaPastaPasta@users.noreply.github.com> * qt: Move comment * qt: Properly reset the previous PS state if OptionsDialog gets rejected Handle all reject reasons not only the cancle button. Co-authored-by: UdjinM6 <UdjinM6@users.noreply.github.com> Co-authored-by: PastaPastaPasta <6443210+PastaPastaPasta@users.noreply.github.com>
This commit is contained in:
parent
578fe89bfc
commit
9a9e21c910
@ -760,6 +760,8 @@ void BitcoinGUI::setClientModel(ClientModel *_clientModel)
|
|||||||
|
|
||||||
// initialize the disable state of the tray icon with the current value in the model.
|
// initialize the disable state of the tray icon with the current value in the model.
|
||||||
setTrayIconVisible(optionsModel->getHideTrayIcon());
|
setTrayIconVisible(optionsModel->getHideTrayIcon());
|
||||||
|
|
||||||
|
connect(optionsModel, SIGNAL(privateSendEnabledChanged()), this, SLOT(updatePrivateSendVisibility()));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// Disable possibility to show main window via action
|
// Disable possibility to show main window via action
|
||||||
|
@ -198,8 +198,6 @@ private:
|
|||||||
|
|
||||||
void updateProgressBarVisibility();
|
void updateProgressBarVisibility();
|
||||||
|
|
||||||
void updatePrivateSendVisibility();
|
|
||||||
|
|
||||||
void updateToolBarShortcuts();
|
void updateToolBarShortcuts();
|
||||||
|
|
||||||
Q_SIGNALS:
|
Q_SIGNALS:
|
||||||
@ -331,6 +329,8 @@ private Q_SLOTS:
|
|||||||
void toggleNetworkActive();
|
void toggleNetworkActive();
|
||||||
|
|
||||||
void showModalOverlay();
|
void showModalOverlay();
|
||||||
|
|
||||||
|
void updatePrivateSendVisibility();
|
||||||
};
|
};
|
||||||
|
|
||||||
class UnitDisplayStatusBarControl : public QLabel
|
class UnitDisplayStatusBarControl : public QLabel
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>583</width>
|
<width>583</width>
|
||||||
<height>537</height>
|
<height>420</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
@ -51,6 +51,16 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="btnPrivateSend">
|
||||||
|
<property name="text">
|
||||||
|
<string>PrivateSend</string>
|
||||||
|
</property>
|
||||||
|
<property name="checkable">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QPushButton" name="btnNetwork">
|
<widget class="QPushButton" name="btnNetwork">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
@ -233,6 +243,8 @@
|
|||||||
</widget>
|
</widget>
|
||||||
<widget class="QWidget" name="pageWallet">
|
<widget class="QWidget" name="pageWallet">
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_Wallet">
|
<layout class="QVBoxLayout" name="verticalLayout_Wallet">
|
||||||
|
<item>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QCheckBox" name="coinControlFeatures">
|
<widget class="QCheckBox" name="coinControlFeatures">
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
@ -253,6 +265,45 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QCheckBox" name="spendZeroConfChange">
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>If you disable the spending of unconfirmed change, the change from a transaction<br/>cannot be used until that transaction has at least one confirmation.<br/>This also affects how your balance is computed.</string>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>&Spend unconfirmed change</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QCheckBox" name="privateSendEnabled">
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>Show mixing interface on Overview screen and reveal PrivateSend screen which allows to spend fully mixed coins only.<br/>A new tab with more settings will also appear in this dialog, please make sure to check them before mixing your coins.</string>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Enable PrivateSend features</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<spacer name="verticalSpacer_Wallet">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Vertical</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>20</width>
|
||||||
|
<height>40</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
<widget class="QWidget" name="pagePrivateSend">
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout_4">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QCheckBox" name="showAdvancedPSUI">
|
<widget class="QCheckBox" name="showAdvancedPSUI">
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
@ -264,12 +315,12 @@
|
|||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QCheckBox" name="spendZeroConfChange">
|
<widget class="QCheckBox" name="showPrivateSendPopups">
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
<string>If you disable the spending of unconfirmed change, the change from a transaction<br/>cannot be used until that transaction has at least one confirmation.<br/>This also affects how your balance is computed.</string>
|
<string>Show system popups for PrivateSend mixing transactions<br/>just like for all other transaction types.</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>&Spend unconfirmed change</string>
|
<string>Show popups for PrivateSend transactions</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
@ -293,16 +344,6 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
|
||||||
<widget class="QCheckBox" name="showPrivateSendPopups">
|
|
||||||
<property name="toolTip">
|
|
||||||
<string>Show system popups for PrivateSend mixing transactions<br/>just like for all other transaction types.</string>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>Show popups for PrivateSend transactions</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
<item>
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_4_Wallet">
|
<layout class="QHBoxLayout" name="horizontalLayout_4_Wallet">
|
||||||
<item>
|
<item>
|
||||||
@ -373,7 +414,7 @@
|
|||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<spacer name="verticalSpacer_Wallet">
|
<spacer name="verticalSpacerPS">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
<enum>Qt::Vertical</enum>
|
<enum>Qt::Vertical</enum>
|
||||||
</property>
|
</property>
|
||||||
|
@ -79,12 +79,15 @@ OptionsDialog::OptionsDialog(QWidget *parent, bool enableWallet) :
|
|||||||
connect(ui->connectSocksTor, SIGNAL(toggled(bool)), this, SLOT(updateProxyValidationState()));
|
connect(ui->connectSocksTor, SIGNAL(toggled(bool)), this, SLOT(updateProxyValidationState()));
|
||||||
|
|
||||||
pageButtons.addButton(ui->btnMain, pageButtons.buttons().size());
|
pageButtons.addButton(ui->btnMain, pageButtons.buttons().size());
|
||||||
/* remove Wallet tab in case of -disablewallet */
|
/* Remove Wallet/PrivateSend tabs in case of -disablewallet */
|
||||||
if (!enableWallet) {
|
if (!enableWallet) {
|
||||||
ui->stackedWidgetOptions->removeWidget(ui->pageWallet);
|
ui->stackedWidgetOptions->removeWidget(ui->pageWallet);
|
||||||
ui->btnWallet->hide();
|
ui->btnWallet->hide();
|
||||||
|
ui->stackedWidgetOptions->removeWidget(ui->pagePrivateSend);
|
||||||
|
ui->btnPrivateSend->hide();
|
||||||
} else {
|
} else {
|
||||||
pageButtons.addButton(ui->btnWallet, pageButtons.buttons().size());
|
pageButtons.addButton(ui->btnWallet, pageButtons.buttons().size());
|
||||||
|
pageButtons.addButton(ui->btnPrivateSend, pageButtons.buttons().size());
|
||||||
}
|
}
|
||||||
pageButtons.addButton(ui->btnNetwork, pageButtons.buttons().size());
|
pageButtons.addButton(ui->btnNetwork, pageButtons.buttons().size());
|
||||||
pageButtons.addButton(ui->btnDisplay, pageButtons.buttons().size());
|
pageButtons.addButton(ui->btnDisplay, pageButtons.buttons().size());
|
||||||
@ -155,6 +158,16 @@ OptionsDialog::OptionsDialog(QWidget *parent, bool enableWallet) :
|
|||||||
ui->widgetAppearance->setLayout(appearanceLayout);
|
ui->widgetAppearance->setLayout(appearanceLayout);
|
||||||
|
|
||||||
updatePrivateSendVisibility();
|
updatePrivateSendVisibility();
|
||||||
|
|
||||||
|
// Store the current PrivateSend enabled state to recover it if it gets changed but the dialog gets not accepted but declined.
|
||||||
|
#ifdef ENABLE_WALLET
|
||||||
|
fPrivateSendEnabledPrev = CPrivateSendClientOptions::IsEnabled();
|
||||||
|
connect(this, &OptionsDialog::rejected, [=]() {
|
||||||
|
if (fPrivateSendEnabledPrev != CPrivateSendClientOptions::IsEnabled()) {
|
||||||
|
ui->privateSendEnabled->click();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
OptionsDialog::~OptionsDialog()
|
OptionsDialog::~OptionsDialog()
|
||||||
@ -179,6 +192,17 @@ void OptionsDialog::setModel(OptionsModel *_model)
|
|||||||
ui->overriddenByCommandLineLabel->setText(strLabel);
|
ui->overriddenByCommandLineLabel->setText(strLabel);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef ENABLE_WALLET
|
||||||
|
// If -enableprivatesend was passed in on the command line, set the checkbox
|
||||||
|
// to the value given via commandline and disable it (make it unclickable).
|
||||||
|
if (strLabel.contains("-enableprivatesend")) {
|
||||||
|
bool fEnabled = CPrivateSendClientOptions::IsEnabled();
|
||||||
|
ui->privateSendEnabled->setChecked(fEnabled);
|
||||||
|
ui->privateSendEnabled->setEnabled(false);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
mapper->setModel(_model);
|
mapper->setModel(_model);
|
||||||
setMapper();
|
setMapper();
|
||||||
mapper->toFirst();
|
mapper->toFirst();
|
||||||
@ -204,6 +228,16 @@ void OptionsDialog::setModel(OptionsModel *_model)
|
|||||||
connect(ui->digits, SIGNAL(valueChanged()), this, SLOT(showRestartWarning()));
|
connect(ui->digits, SIGNAL(valueChanged()), this, SLOT(showRestartWarning()));
|
||||||
connect(ui->lang, SIGNAL(valueChanged()), this, SLOT(showRestartWarning()));
|
connect(ui->lang, SIGNAL(valueChanged()), this, SLOT(showRestartWarning()));
|
||||||
connect(ui->thirdPartyTxUrls, SIGNAL(textChanged(const QString &)), this, SLOT(showRestartWarning()));
|
connect(ui->thirdPartyTxUrls, SIGNAL(textChanged(const QString &)), this, SLOT(showRestartWarning()));
|
||||||
|
|
||||||
|
connect(ui->privateSendEnabled, &QCheckBox::clicked, [=](bool fChecked) {
|
||||||
|
#ifdef ENABLE_WALLET
|
||||||
|
CPrivateSendClientOptions::SetEnabled(fChecked);
|
||||||
|
#endif
|
||||||
|
updatePrivateSendVisibility();
|
||||||
|
if (_model != nullptr) {
|
||||||
|
_model->emitPrivateSendEnabledChanged();
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void OptionsDialog::setMapper()
|
void OptionsDialog::setMapper()
|
||||||
@ -217,6 +251,7 @@ void OptionsDialog::setMapper()
|
|||||||
#endif
|
#endif
|
||||||
mapper->addMapping(ui->threadsScriptVerif, OptionsModel::ThreadsScriptVerif);
|
mapper->addMapping(ui->threadsScriptVerif, OptionsModel::ThreadsScriptVerif);
|
||||||
mapper->addMapping(ui->databaseCache, OptionsModel::DatabaseCache);
|
mapper->addMapping(ui->databaseCache, OptionsModel::DatabaseCache);
|
||||||
|
mapper->addMapping(ui->privateSendEnabled, OptionsModel::PrivateSendEnabled);
|
||||||
|
|
||||||
/* Wallet */
|
/* Wallet */
|
||||||
mapper->addMapping(ui->coinControlFeatures, OptionsModel::CoinControlFeatures);
|
mapper->addMapping(ui->coinControlFeatures, OptionsModel::CoinControlFeatures);
|
||||||
@ -396,19 +431,7 @@ void OptionsDialog::updatePrivateSendVisibility()
|
|||||||
#else
|
#else
|
||||||
bool fEnabled = false;
|
bool fEnabled = false;
|
||||||
#endif
|
#endif
|
||||||
std::vector<QWidget*> vecWidgets{
|
ui->btnPrivateSend->setVisible(fEnabled);
|
||||||
ui->showAdvancedPSUI,
|
|
||||||
ui->showPrivateSendPopups,
|
|
||||||
ui->lowKeysWarning,
|
|
||||||
ui->privateSendMultiSession,
|
|
||||||
ui->privateSendAmount,
|
|
||||||
ui->lblPrivateSendAmountText,
|
|
||||||
ui->lblPrivateSendRoundsText,
|
|
||||||
ui->privateSendRounds,
|
|
||||||
};
|
|
||||||
for (auto w : vecWidgets) {
|
|
||||||
w->setVisible(fEnabled);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ProxyAddressValidator::ProxyAddressValidator(QObject *parent) :
|
ProxyAddressValidator::ProxyAddressValidator(QObject *parent) :
|
||||||
|
@ -74,6 +74,7 @@ private:
|
|||||||
QButtonGroup pageButtons;
|
QButtonGroup pageButtons;
|
||||||
QString previousTheme;
|
QString previousTheme;
|
||||||
AppearanceWidget* appearance;
|
AppearanceWidget* appearance;
|
||||||
|
bool fPrivateSendEnabledPrev{false};
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // BITCOIN_QT_OPTIONSDIALOG_H
|
#endif // BITCOIN_QT_OPTIONSDIALOG_H
|
||||||
|
@ -113,6 +113,13 @@ void OptionsModel::Init(bool resetSettings)
|
|||||||
settings.setValue("digits", "2");
|
settings.setValue("digits", "2");
|
||||||
|
|
||||||
// PrivateSend
|
// PrivateSend
|
||||||
|
if (!settings.contains("fPrivateSendEnabled")) {
|
||||||
|
settings.setValue("fPrivateSendEnabled", true);
|
||||||
|
}
|
||||||
|
if (!gArgs.SoftSetBoolArg("-enableprivatesend", settings.value("fPrivateSendEnabled").toBool())) {
|
||||||
|
addOverriddenOption("-enableprivatesend");
|
||||||
|
}
|
||||||
|
|
||||||
if (!settings.contains("fShowAdvancedPSUI"))
|
if (!settings.contains("fShowAdvancedPSUI"))
|
||||||
settings.setValue("fShowAdvancedPSUI", false);
|
settings.setValue("fShowAdvancedPSUI", false);
|
||||||
fShowAdvancedPSUI = settings.value("fShowAdvancedPSUI", false).toBool();
|
fShowAdvancedPSUI = settings.value("fShowAdvancedPSUI", false).toBool();
|
||||||
@ -330,6 +337,8 @@ QVariant OptionsModel::data(const QModelIndex & index, int role) const
|
|||||||
return settings.value("bSpendZeroConfChange");
|
return settings.value("bSpendZeroConfChange");
|
||||||
case ShowMasternodesTab:
|
case ShowMasternodesTab:
|
||||||
return settings.value("fShowMasternodesTab");
|
return settings.value("fShowMasternodesTab");
|
||||||
|
case PrivateSendEnabled:
|
||||||
|
return settings.value("fPrivateSendEnabled");
|
||||||
case ShowAdvancedPSUI:
|
case ShowAdvancedPSUI:
|
||||||
return fShowAdvancedPSUI;
|
return fShowAdvancedPSUI;
|
||||||
case ShowPrivateSendPopups:
|
case ShowPrivateSendPopups:
|
||||||
@ -486,10 +495,18 @@ bool OptionsModel::setData(const QModelIndex & index, const QVariant & value, in
|
|||||||
setRestartRequired(true);
|
setRestartRequired(true);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case PrivateSendEnabled:
|
||||||
|
if (settings.value("fPrivateSendEnabled") != value) {
|
||||||
|
settings.setValue("fPrivateSendEnabled", value.toBool());
|
||||||
|
Q_EMIT privateSendEnabledChanged();
|
||||||
|
}
|
||||||
|
break;
|
||||||
case ShowAdvancedPSUI:
|
case ShowAdvancedPSUI:
|
||||||
|
if (settings.value("fShowAdvancedPSUI") != value) {
|
||||||
fShowAdvancedPSUI = value.toBool();
|
fShowAdvancedPSUI = value.toBool();
|
||||||
settings.setValue("fShowAdvancedPSUI", fShowAdvancedPSUI);
|
settings.setValue("fShowAdvancedPSUI", fShowAdvancedPSUI);
|
||||||
Q_EMIT advancedPSUIChanged(fShowAdvancedPSUI);
|
Q_EMIT advancedPSUIChanged(fShowAdvancedPSUI);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case ShowPrivateSendPopups:
|
case ShowPrivateSendPopups:
|
||||||
settings.setValue("fShowPrivateSendPopups", value);
|
settings.setValue("fShowPrivateSendPopups", value);
|
||||||
@ -638,6 +655,11 @@ bool OptionsModel::getProxySettings(QNetworkProxy& proxy) const
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void OptionsModel::emitPrivateSendEnabledChanged()
|
||||||
|
{
|
||||||
|
Q_EMIT privateSendEnabledChanged();
|
||||||
|
}
|
||||||
|
|
||||||
void OptionsModel::setRestartRequired(bool fRequired)
|
void OptionsModel::setRestartRequired(bool fRequired)
|
||||||
{
|
{
|
||||||
QSettings settings;
|
QSettings settings;
|
||||||
|
@ -55,6 +55,7 @@ public:
|
|||||||
DatabaseCache, // int
|
DatabaseCache, // int
|
||||||
SpendZeroConfChange, // bool
|
SpendZeroConfChange, // bool
|
||||||
ShowMasternodesTab, // bool
|
ShowMasternodesTab, // bool
|
||||||
|
PrivateSendEnabled, // bool
|
||||||
ShowAdvancedPSUI, // bool
|
ShowAdvancedPSUI, // bool
|
||||||
ShowPrivateSendPopups, // bool
|
ShowPrivateSendPopups, // bool
|
||||||
LowKeysWarning, // bool
|
LowKeysWarning, // bool
|
||||||
@ -84,6 +85,7 @@ public:
|
|||||||
bool getCoinControlFeatures() const { return fCoinControlFeatures; }
|
bool getCoinControlFeatures() const { return fCoinControlFeatures; }
|
||||||
bool getShowAdvancedPSUI() { return fShowAdvancedPSUI; }
|
bool getShowAdvancedPSUI() { return fShowAdvancedPSUI; }
|
||||||
const QString& getOverriddenByCommandLine() { return strOverriddenByCommandLine; }
|
const QString& getOverriddenByCommandLine() { return strOverriddenByCommandLine; }
|
||||||
|
void emitPrivateSendEnabledChanged();
|
||||||
|
|
||||||
/* Restart flag helper */
|
/* Restart flag helper */
|
||||||
void setRestartRequired(bool fRequired);
|
void setRestartRequired(bool fRequired);
|
||||||
@ -110,6 +112,7 @@ private:
|
|||||||
void checkAndMigrate();
|
void checkAndMigrate();
|
||||||
Q_SIGNALS:
|
Q_SIGNALS:
|
||||||
void displayUnitChanged(int unit);
|
void displayUnitChanged(int unit);
|
||||||
|
void privateSendEnabledChanged();
|
||||||
void privateSendRoundsChanged();
|
void privateSendRoundsChanged();
|
||||||
void privateSentAmountChanged();
|
void privateSentAmountChanged();
|
||||||
void advancedPSUIChanged(bool);
|
void advancedPSUIChanged(bool);
|
||||||
|
@ -163,30 +163,14 @@ OverviewPage::OverviewPage(QWidget* parent) :
|
|||||||
// start with displaying the "out of sync" warnings
|
// start with displaying the "out of sync" warnings
|
||||||
showOutOfSyncWarning(true);
|
showOutOfSyncWarning(true);
|
||||||
|
|
||||||
if (!CPrivateSendClientOptions::IsEnabled()) return;
|
|
||||||
|
|
||||||
// Disable any PS UI for masternode or when autobackup is disabled or failed for whatever reason
|
|
||||||
if(fMasternodeMode || nWalletBackups <= 0){
|
|
||||||
DisablePrivateSendCompletely();
|
|
||||||
if (nWalletBackups <= 0) {
|
|
||||||
ui->labelPrivateSendEnabled->setToolTip(tr("Automatic backups are disabled, no mixing available!"));
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
// Disable privateSendClient builtin support for automatic backups while we are in GUI,
|
// Disable privateSendClient builtin support for automatic backups while we are in GUI,
|
||||||
// we'll handle automatic backups and user warnings in privateSendStatus()
|
// we'll handle automatic backups and user warnings in privateSendStatus()
|
||||||
for (auto& pair : privateSendClientManagers) {
|
for (auto& pair : privateSendClientManagers) {
|
||||||
if (!pair.second->IsMixing()) {
|
|
||||||
ui->togglePrivateSend->setText(tr("Start Mixing"));
|
|
||||||
} else {
|
|
||||||
ui->togglePrivateSend->setText(tr("Stop Mixing"));
|
|
||||||
}
|
|
||||||
pair.second->fCreateAutoBackups = false;
|
pair.second->fCreateAutoBackups = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
timer = new QTimer(this);
|
timer = new QTimer(this);
|
||||||
connect(timer, SIGNAL(timeout()), this, SLOT(privateSendStatus()));
|
connect(timer, SIGNAL(timeout()), this, SLOT(privateSendStatus()));
|
||||||
timer->start(1000);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void OverviewPage::handleTransactionClicked(const QModelIndex &index)
|
void OverviewPage::handleTransactionClicked(const QModelIndex &index)
|
||||||
@ -298,11 +282,12 @@ void OverviewPage::setWalletModel(WalletModel *model)
|
|||||||
// explicitly update PS frame and transaction list to reflect actual settings
|
// explicitly update PS frame and transaction list to reflect actual settings
|
||||||
updateAdvancedPSUI(model->getOptionsModel()->getShowAdvancedPSUI());
|
updateAdvancedPSUI(model->getOptionsModel()->getShowAdvancedPSUI());
|
||||||
|
|
||||||
if (!CPrivateSendClientOptions::IsEnabled()) return;
|
|
||||||
|
|
||||||
connect(model->getOptionsModel(), SIGNAL(privateSendRoundsChanged()), this, SLOT(updatePrivateSendProgress()));
|
connect(model->getOptionsModel(), SIGNAL(privateSendRoundsChanged()), this, SLOT(updatePrivateSendProgress()));
|
||||||
connect(model->getOptionsModel(), SIGNAL(privateSentAmountChanged()), this, SLOT(updatePrivateSendProgress()));
|
connect(model->getOptionsModel(), SIGNAL(privateSentAmountChanged()), this, SLOT(updatePrivateSendProgress()));
|
||||||
connect(model->getOptionsModel(), SIGNAL(advancedPSUIChanged(bool)), this, SLOT(updateAdvancedPSUI(bool)));
|
connect(model->getOptionsModel(), SIGNAL(advancedPSUIChanged(bool)), this, SLOT(updateAdvancedPSUI(bool)));
|
||||||
|
connect(model->getOptionsModel(), &OptionsModel::privateSendEnabledChanged, [=]() {
|
||||||
|
privateSendStatus(true);
|
||||||
|
});
|
||||||
|
|
||||||
connect(ui->togglePrivateSend, SIGNAL(clicked()), this, SLOT(togglePrivateSend()));
|
connect(ui->togglePrivateSend, SIGNAL(clicked()), this, SLOT(togglePrivateSend()));
|
||||||
|
|
||||||
@ -459,13 +444,29 @@ void OverviewPage::privateSendStatus(bool fForce)
|
|||||||
|
|
||||||
if(!walletModel) return;
|
if(!walletModel) return;
|
||||||
|
|
||||||
|
// Disable any PS UI for masternode or when autobackup is disabled or failed for whatever reason
|
||||||
|
if (fMasternodeMode || nWalletBackups <= 0) {
|
||||||
|
DisablePrivateSendCompletely();
|
||||||
|
if (nWalletBackups <= 0) {
|
||||||
|
ui->labelPrivateSendEnabled->setToolTip(tr("Automatic backups are disabled, no mixing available!"));
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
bool fIsEnabled = CPrivateSendClientOptions::IsEnabled();
|
bool fIsEnabled = CPrivateSendClientOptions::IsEnabled();
|
||||||
ui->framePrivateSend->setVisible(fIsEnabled);
|
ui->framePrivateSend->setVisible(fIsEnabled);
|
||||||
if (!fIsEnabled) {
|
if (!fIsEnabled) {
|
||||||
SetupTransactionList(NUM_ITEMS_DISABLED);
|
SetupTransactionList(NUM_ITEMS_DISABLED);
|
||||||
|
if (timer != nullptr) {
|
||||||
|
timer->stop();
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (timer != nullptr && !timer->isActive()) {
|
||||||
|
timer->start(1000);
|
||||||
|
}
|
||||||
|
|
||||||
// Wrap all privatesend related widgets we want to show/hide state based.
|
// Wrap all privatesend related widgets we want to show/hide state based.
|
||||||
// Value of the map contains a flag if this widget belongs to the advanced
|
// Value of the map contains a flag if this widget belongs to the advanced
|
||||||
// PrivateSend UI option or not. True if it does, false if not.
|
// PrivateSend UI option or not. True if it does, false if not.
|
||||||
|
@ -477,6 +477,7 @@ QPushButton - Special case, tabbar replacement buttons
|
|||||||
/* Options dialog buttons */
|
/* Options dialog buttons */
|
||||||
#btnMain,
|
#btnMain,
|
||||||
#btnWallet,
|
#btnWallet,
|
||||||
|
#btnPrivateSend,
|
||||||
#btnNetwork,
|
#btnNetwork,
|
||||||
#btnDisplay,
|
#btnDisplay,
|
||||||
#btnAppearance,
|
#btnAppearance,
|
||||||
@ -496,6 +497,7 @@ QPushButton - Special case, tabbar replacement buttons
|
|||||||
/* Options dialog buttons */
|
/* Options dialog buttons */
|
||||||
#btnMain:hover:checked,
|
#btnMain:hover:checked,
|
||||||
#btnWallet:hover:checked,
|
#btnWallet:hover:checked,
|
||||||
|
#btnPrivateSend:hover:checked,
|
||||||
#btnNetwork:hover:checked,
|
#btnNetwork:hover:checked,
|
||||||
#btnDisplay:hover:checked,
|
#btnDisplay:hover:checked,
|
||||||
#btnAppearance:hover:checked,
|
#btnAppearance:hover:checked,
|
||||||
@ -515,6 +517,7 @@ QPushButton - Special case, tabbar replacement buttons
|
|||||||
/* Options dialog buttons */
|
/* Options dialog buttons */
|
||||||
#btnMain:hover:!checked,
|
#btnMain:hover:!checked,
|
||||||
#btnWallet:hover:!checked,
|
#btnWallet:hover:!checked,
|
||||||
|
#btnPrivateSend:hover:!checked,
|
||||||
#btnNetwork:hover:!checked,
|
#btnNetwork:hover:!checked,
|
||||||
#btnDisplay:hover:!checked,
|
#btnDisplay:hover:!checked,
|
||||||
#btnAppearance:hover:!checked,
|
#btnAppearance:hover:!checked,
|
||||||
@ -534,6 +537,7 @@ QPushButton - Special case, tabbar replacement buttons
|
|||||||
/* Options dialog buttons */
|
/* Options dialog buttons */
|
||||||
#btnMain:checked,
|
#btnMain:checked,
|
||||||
#btnWallet:checked,
|
#btnWallet:checked,
|
||||||
|
#btnPrivateSend:checked,
|
||||||
#btnNetwork:checked,
|
#btnNetwork:checked,
|
||||||
#btnDisplay:checked,
|
#btnDisplay:checked,
|
||||||
#btnAppearance:checked,
|
#btnAppearance:checked,
|
||||||
|
@ -621,6 +621,7 @@ QPushButton - Special case, tabbar replacement buttons
|
|||||||
/* Options dialog buttons */
|
/* Options dialog buttons */
|
||||||
#btnMain,
|
#btnMain,
|
||||||
#btnWallet,
|
#btnWallet,
|
||||||
|
#btnPrivateSend,
|
||||||
#btnNetwork,
|
#btnNetwork,
|
||||||
#btnDisplay,
|
#btnDisplay,
|
||||||
#btnAppearance,
|
#btnAppearance,
|
||||||
@ -643,6 +644,7 @@ QPushButton - Special case, tabbar replacement buttons
|
|||||||
/* Options dialog buttons */
|
/* Options dialog buttons */
|
||||||
#btnMain:hover:checked,
|
#btnMain:hover:checked,
|
||||||
#btnWallet:hover:checked,
|
#btnWallet:hover:checked,
|
||||||
|
#btnPrivateSend:hover:checked,
|
||||||
#btnNetwork:hover:checked,
|
#btnNetwork:hover:checked,
|
||||||
#btnDisplay:hover:checked,
|
#btnDisplay:hover:checked,
|
||||||
#btnAppearance:hover:checked,
|
#btnAppearance:hover:checked,
|
||||||
@ -665,6 +667,7 @@ QPushButton - Special case, tabbar replacement buttons
|
|||||||
/* Options dialog buttons */
|
/* Options dialog buttons */
|
||||||
#btnMain:hover:!checked,
|
#btnMain:hover:!checked,
|
||||||
#btnWallet:hover:!checked,
|
#btnWallet:hover:!checked,
|
||||||
|
#btnPrivateSend:hover:!checked,
|
||||||
#btnNetwork:hover:!checked,
|
#btnNetwork:hover:!checked,
|
||||||
#btnDisplay:hover:!checked,
|
#btnDisplay:hover:!checked,
|
||||||
#btnAppearance:hover:!checked,
|
#btnAppearance:hover:!checked,
|
||||||
@ -687,6 +690,7 @@ QPushButton - Special case, tabbar replacement buttons
|
|||||||
/* Options dialog buttons */
|
/* Options dialog buttons */
|
||||||
#btnMain:checked,
|
#btnMain:checked,
|
||||||
#btnWallet:checked,
|
#btnWallet:checked,
|
||||||
|
#btnPrivateSend:checked,
|
||||||
#btnNetwork:checked,
|
#btnNetwork:checked,
|
||||||
#btnDisplay:checked,
|
#btnDisplay:checked,
|
||||||
#btnAppearance:checked,
|
#btnAppearance:checked,
|
||||||
@ -708,6 +712,7 @@ QPushButton - Special case, tabbar replacement buttons
|
|||||||
/* Options dialog buttons */
|
/* Options dialog buttons */
|
||||||
#btnMain:hover:pressed,
|
#btnMain:hover:pressed,
|
||||||
#btnWallet:hover:pressed,
|
#btnWallet:hover:pressed,
|
||||||
|
#btnPrivateSend:hover:pressed,
|
||||||
#btnNetwork:hover:pressed,
|
#btnNetwork:hover:pressed,
|
||||||
#btnDisplay:hover:pressed,
|
#btnDisplay:hover:pressed,
|
||||||
#btnAppearance:hover:pressed,
|
#btnAppearance:hover:pressed,
|
||||||
|
@ -459,6 +459,7 @@ QPushButton - Special case, tabbar replacement buttons
|
|||||||
/* Options dialog buttons */
|
/* Options dialog buttons */
|
||||||
#btnMain,
|
#btnMain,
|
||||||
#btnWallet,
|
#btnWallet,
|
||||||
|
#btnPrivateSend,
|
||||||
#btnNetwork,
|
#btnNetwork,
|
||||||
#btnDisplay,
|
#btnDisplay,
|
||||||
#btnAppearance,
|
#btnAppearance,
|
||||||
@ -478,6 +479,7 @@ QPushButton - Special case, tabbar replacement buttons
|
|||||||
/* Options dialog buttons */
|
/* Options dialog buttons */
|
||||||
#btnMain:hover:checked,
|
#btnMain:hover:checked,
|
||||||
#btnWallet:hover:checked,
|
#btnWallet:hover:checked,
|
||||||
|
#btnPrivateSend:hover:checked,
|
||||||
#btnNetwork:hover:checked,
|
#btnNetwork:hover:checked,
|
||||||
#btnDisplay:hover:checked,
|
#btnDisplay:hover:checked,
|
||||||
#btnAppearance:hover:checked,
|
#btnAppearance:hover:checked,
|
||||||
@ -497,6 +499,7 @@ QPushButton - Special case, tabbar replacement buttons
|
|||||||
/* Options dialog buttons */
|
/* Options dialog buttons */
|
||||||
#btnMain:hover:!checked,
|
#btnMain:hover:!checked,
|
||||||
#btnWallet:hover:!checked,
|
#btnWallet:hover:!checked,
|
||||||
|
#btnPrivateSend:hover:!checked,
|
||||||
#btnNetwork:hover:!checked,
|
#btnNetwork:hover:!checked,
|
||||||
#btnDisplay:hover:!checked,
|
#btnDisplay:hover:!checked,
|
||||||
#btnAppearance:hover:!checked,
|
#btnAppearance:hover:!checked,
|
||||||
@ -516,6 +519,7 @@ QPushButton - Special case, tabbar replacement buttons
|
|||||||
/* Options dialog buttons */
|
/* Options dialog buttons */
|
||||||
#btnMain:checked,
|
#btnMain:checked,
|
||||||
#btnWallet:checked,
|
#btnWallet:checked,
|
||||||
|
#btnPrivateSend:checked,
|
||||||
#btnNetwork:checked,
|
#btnNetwork:checked,
|
||||||
#btnDisplay:checked,
|
#btnDisplay:checked,
|
||||||
#btnAppearance:checked,
|
#btnAppearance:checked,
|
||||||
|
@ -54,6 +54,7 @@ QPushButton - Special case, tabbar replacement buttons
|
|||||||
/* Options dialog buttons */
|
/* Options dialog buttons */
|
||||||
#btnMain,
|
#btnMain,
|
||||||
#btnWallet,
|
#btnWallet,
|
||||||
|
#btnPrivateSend,
|
||||||
#btnNetwork,
|
#btnNetwork,
|
||||||
#btnDisplay,
|
#btnDisplay,
|
||||||
#btnAppearance,
|
#btnAppearance,
|
||||||
@ -77,6 +78,7 @@ QPushButton - Special case, tabbar replacement buttons
|
|||||||
/* Options dialog buttons */
|
/* Options dialog buttons */
|
||||||
#btnMain:hover:checked,
|
#btnMain:hover:checked,
|
||||||
#btnWallet:hover:checked,
|
#btnWallet:hover:checked,
|
||||||
|
#btnPrivateSend:hover:checked,
|
||||||
#btnNetwork:hover:checked,
|
#btnNetwork:hover:checked,
|
||||||
#btnDisplay:hover:checked,
|
#btnDisplay:hover:checked,
|
||||||
#btnAppearance:hover:checked,
|
#btnAppearance:hover:checked,
|
||||||
@ -99,6 +101,7 @@ QPushButton - Special case, tabbar replacement buttons
|
|||||||
/* Options dialog buttons */
|
/* Options dialog buttons */
|
||||||
#btnMain:hover:!checked,
|
#btnMain:hover:!checked,
|
||||||
#btnWallet:hover:!checked,
|
#btnWallet:hover:!checked,
|
||||||
|
#btnPrivateSend:hover:!checked,
|
||||||
#btnNetwork:hover:!checked,
|
#btnNetwork:hover:!checked,
|
||||||
#btnDisplay:hover:!checked,
|
#btnDisplay:hover:!checked,
|
||||||
#btnAppearance:hover:!checked,
|
#btnAppearance:hover:!checked,
|
||||||
@ -121,6 +124,7 @@ QPushButton - Special case, tabbar replacement buttons
|
|||||||
/* Options dialog buttons */
|
/* Options dialog buttons */
|
||||||
#btnMain:checked,
|
#btnMain:checked,
|
||||||
#btnWallet:checked,
|
#btnWallet:checked,
|
||||||
|
#btnPrivateSend:checked,
|
||||||
#btnNetwork:checked,
|
#btnNetwork:checked,
|
||||||
#btnDisplay:checked,
|
#btnDisplay:checked,
|
||||||
#btnAppearance:checked,
|
#btnAppearance:checked,
|
||||||
|
@ -250,6 +250,8 @@ void TransactionView::setModel(WalletModel *_model)
|
|||||||
mapperThirdPartyTxUrls->setMapping(thirdPartyTxUrlAction, listUrls[i].trimmed());
|
mapperThirdPartyTxUrls->setMapping(thirdPartyTxUrlAction, listUrls[i].trimmed());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
connect(_model->getOptionsModel(), SIGNAL(privateSendEnabledChanged()), this, SLOT(updatePrivateSendVisibility()));
|
||||||
}
|
}
|
||||||
|
|
||||||
// show/hide column Watch-only
|
// show/hide column Watch-only
|
||||||
|
Loading…
Reference in New Issue
Block a user