Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
66 changes: 36 additions & 30 deletions src/qt/bitcoingui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -376,23 +376,13 @@ void BitcoinGUI::createActions()
overviewAction->setStatusTip(tr("Show general overview of wallet"));
overviewAction->setToolTip(overviewAction->statusTip());
overviewAction->setCheckable(true);
#ifdef Q_OS_MAC
overviewAction->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_1));
#else
overviewAction->setShortcut(QKeySequence(Qt::ALT + Qt::Key_1));
#endif
tabGroup->addButton(overviewAction);

sendCoinsAction = new QToolButton(this);
sendCoinsAction->setText(tr("&Send"));
sendCoinsAction->setStatusTip(tr("Send coins to a Dash address"));
sendCoinsAction->setToolTip(sendCoinsAction->statusTip());
sendCoinsAction->setCheckable(true);
#ifdef Q_OS_MAC
sendCoinsAction->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_2));
#else
sendCoinsAction->setShortcut(QKeySequence(Qt::ALT + Qt::Key_2));
#endif
tabGroup->addButton(sendCoinsAction);

sendCoinsMenuAction = new QAction(sendCoinsAction->text(), this);
Expand All @@ -404,11 +394,6 @@ void BitcoinGUI::createActions()
privateSendCoinsAction->setStatusTip(tr("PrivateSend coins to a Dash address"));
privateSendCoinsAction->setToolTip(privateSendCoinsAction->statusTip());
privateSendCoinsAction->setCheckable(true);
#ifdef Q_OS_MAC
privateSendCoinsAction->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_3));
#else
privateSendCoinsAction->setShortcut(QKeySequence(Qt::ALT + Qt::Key_3));
#endif
tabGroup->addButton(privateSendCoinsAction);

privateSendCoinsMenuAction = new QAction(privateSendCoinsAction->text(), this);
Expand All @@ -420,11 +405,6 @@ void BitcoinGUI::createActions()
receiveCoinsAction->setStatusTip(tr("Request payments (generates QR codes and dash: URIs)"));
receiveCoinsAction->setToolTip(receiveCoinsAction->statusTip());
receiveCoinsAction->setCheckable(true);
#ifdef Q_OS_MAC
receiveCoinsAction->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_4));
#else
receiveCoinsAction->setShortcut(QKeySequence(Qt::ALT + Qt::Key_4));
#endif
tabGroup->addButton(receiveCoinsAction);

receiveCoinsMenuAction = new QAction(receiveCoinsAction->text(), this);
Expand All @@ -436,11 +416,6 @@ void BitcoinGUI::createActions()
historyAction->setStatusTip(tr("Browse transaction history"));
historyAction->setToolTip(historyAction->statusTip());
historyAction->setCheckable(true);
#ifdef Q_OS_MAC
historyAction->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_5));
#else
historyAction->setShortcut(QKeySequence(Qt::ALT + Qt::Key_5));
#endif
tabGroup->addButton(historyAction);

#ifdef ENABLE_WALLET
Expand All @@ -451,11 +426,6 @@ void BitcoinGUI::createActions()
masternodeAction->setStatusTip(tr("Browse masternodes"));
masternodeAction->setToolTip(masternodeAction->statusTip());
masternodeAction->setCheckable(true);
#ifdef Q_OS_MAC
masternodeAction->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_6));
#else
masternodeAction->setShortcut(QKeySequence(Qt::ALT + Qt::Key_6));
#endif
tabGroup->addButton(masternodeAction);
connect(masternodeAction, SIGNAL(clicked()), this, SLOT(showNormalIfMinimized()));
connect(masternodeAction, SIGNAL(clicked()), this, SLOT(gotoMasternodePage()));
Expand Down Expand Up @@ -817,6 +787,8 @@ void BitcoinGUI::setClientModel(ClientModel *_clientModel)
}
#endif
}

updatePrivateSendVisibility();
}

#ifdef ENABLE_WALLET
Expand Down Expand Up @@ -951,6 +923,8 @@ void BitcoinGUI::optionsClicked()
OptionsDialog dlg(this, enableWallet);
dlg.setModel(clientModel->getOptionsModel());
dlg.exec();

updatePrivateSendVisibility();
}

void BitcoinGUI::aboutClicked()
Expand Down Expand Up @@ -1182,6 +1156,38 @@ void BitcoinGUI::updateProgressBarVisibility()
progressBar->setVisible(fShowProgressBar);
}

void BitcoinGUI::updatePrivateSendVisibility()
{
#ifdef ENABLE_WALLET
bool fEnabled = CPrivateSendClientOptions::IsEnabled();
#else
bool fEnabled = false;
#endif
// PrivateSend button is the third QToolButton, show/hide the underlying QAction
// Hiding the QToolButton itself doesn't work.
appToolBar->actions()[2]->setVisible(fEnabled);
privateSendCoinsMenuAction->setVisible(fEnabled);
showPrivateSendHelpAction->setVisible(fEnabled);
updateToolBarShortcuts();
}

void BitcoinGUI::updateToolBarShortcuts()
{
#ifdef Q_OS_MAC
auto modifier = Qt::CTRL;
#else
auto modifier = Qt::ALT;
#endif
int nKey = 0;
for (int i = 0; i < tabGroup->buttons().size(); ++i) {
if (appToolBar->actions()[i]->isVisible()) {
tabGroup->buttons()[i]->setShortcut(QKeySequence(modifier + Qt::Key_1 + nKey++));
} else {
tabGroup->buttons()[i]->setShortcut(QKeySequence());
}
}
}

void BitcoinGUI::setNumBlocks(int count, const QDateTime& blockDate, const QString& blockHash, double nVerificationProgress, bool header)
{
#ifdef Q_OS_MAC
Expand Down
4 changes: 4 additions & 0 deletions src/qt/bitcoingui.h
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,10 @@ class BitcoinGUI : public QMainWindow

void updateProgressBarVisibility();

void updatePrivateSendVisibility();

void updateToolBarShortcuts();

Q_SIGNALS:
/** Signal raised when a URI was entered or dragged to the GUI */
void receivedURI(const QString &uri);
Expand Down
4 changes: 2 additions & 2 deletions src/qt/forms/optionsdialog.ui
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@
<item>
<layout class="QHBoxLayout" name="horizontalLayout_4_Wallet">
<item>
<widget class="QLabel" name="label">
<widget class="QLabel" name="lblPrivateSendRoundsText">
<property name="toolTip">
<string>This setting determines the amount of individual masternodes that an input will be mixed through.&lt;br/&gt;More rounds of mixing gives a higher degree of privacy, but also costs more in fees.</string>
</property>
Expand All @@ -322,7 +322,7 @@
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QLabel" name="label_2">
<widget class="QLabel" name="lblPrivateSendAmountText">
<property name="toolTip">
<string>This amount acts as a threshold to turn off PrivateSend once it's reached.</string>
</property>
Expand Down
24 changes: 24 additions & 0 deletions src/qt/optionsdialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,8 @@ OptionsDialog::OptionsDialog(QWidget *parent, bool enableWallet) :
appearance = new AppearanceWidget(ui->widgetAppearance);
appearanceLayout->addWidget(appearance);
ui->widgetAppearance->setLayout(appearanceLayout);

updatePrivateSendVisibility();
}

OptionsDialog::~OptionsDialog()
Expand Down Expand Up @@ -389,6 +391,28 @@ void OptionsDialog::updateDefaultProxyNets()
(strProxy == strDefaultProxyGUI.toStdString()) ? ui->proxyReachTor->setChecked(true) : ui->proxyReachTor->setChecked(false);
}

void OptionsDialog::updatePrivateSendVisibility()
{
#ifdef ENABLE_WALLET
bool fEnabled = CPrivateSendClientOptions::IsEnabled();
#else
bool fEnabled = false;
#endif
std::vector<QWidget*> vecWidgets{
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) :
QValidator(parent)
{
Expand Down
2 changes: 2 additions & 0 deletions src/qt/optionsdialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ private Q_SLOTS:
/* query the networks, for which the default proxy is used */
void updateDefaultProxyNets();

void updatePrivateSendVisibility();

Q_SIGNALS:
void proxyIpChecks(QValidatedLineEdit *pUiProxyIp, int nProxyPort);

Expand Down
17 changes: 17 additions & 0 deletions src/qt/transactionview.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#include <qt/transactiontablemodel.h>
#include <qt/walletmodel.h>

#include <privatesend/privatesend-client.h>
#include <ui_interface.h>

#include <QCalendarWidget>
Expand All @@ -27,6 +28,7 @@
#include <QHeaderView>
#include <QLabel>
#include <QLineEdit>
#include <QListView>
#include <QMenu>
#include <QPoint>
#include <QScrollBar>
Expand Down Expand Up @@ -202,6 +204,8 @@ TransactionView::TransactionView(QWidget* parent) :
connect(editLabelAction, SIGNAL(triggered()), this, SLOT(editLabel()));
connect(showDetailsAction, SIGNAL(triggered()), this, SLOT(showDetails()));
connect(showAddressQRCodeAction, SIGNAL(triggered()), this, SLOT(showAddressQRCode()));

updatePrivateSendVisibility();
}

void TransactionView::setModel(WalletModel *_model)
Expand Down Expand Up @@ -742,3 +746,16 @@ void TransactionView::updateWatchOnlyColumn(bool fHaveWatchOnly)
watchOnlyWidget->setVisible(fHaveWatchOnly);
transactionView->setColumnHidden(TransactionTableModel::Watchonly, !fHaveWatchOnly);
}

void TransactionView::updatePrivateSendVisibility()
{
bool fEnabled = CPrivateSendClientOptions::IsEnabled();
// If PrivateSend gets enabled use "All" else "Most common"
typeWidget->setCurrentIndex(fEnabled ? 0 : 1);
// Hide all PrivateSend related filters
QListView* typeList = qobject_cast<QListView*>(typeWidget->view());
std::vector<int> vecRows{4, 5, 6, 7, 8};
for (auto nRow : vecRows) {
typeList->setRowHidden(nRow, !fEnabled);
}
}
1 change: 1 addition & 0 deletions src/qt/transactionview.h
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ private Q_SLOTS:
void copyTxPlainText();
void openThirdPartyTxUrl(QString url);
void updateWatchOnlyColumn(bool fHaveWatchOnly);
void updatePrivateSendVisibility();
void abandonTx();

Q_SIGNALS:
Expand Down