Refactor HelpMessageDialog to reuse it for PS help info, add PS info to help menu (#1144)

This commit is contained in:
UdjinM6 2016-11-20 10:54:33 +04:00 committed by GitHub
parent c2ec99ba8e
commit 9162c56419
6 changed files with 70 additions and 42 deletions

View File

@ -108,6 +108,7 @@ BitcoinGUI::BitcoinGUI(const PlatformStyle *platformStyle, const NetworkStyle *n
openRPCConsoleAction(0),
openAction(0),
showHelpMessageAction(0),
showPrivateSendHelpAction(0),
trayIcon(0),
trayIconMenu(0),
dockIconMenu(0),
@ -154,7 +155,7 @@ BitcoinGUI::BitcoinGUI(const PlatformStyle *platformStyle, const NetworkStyle *n
#endif
rpcConsole = new RPCConsole(platformStyle, 0);
helpMessageDialog = new HelpMessageDialog(this, false);
helpMessageDialog = new HelpMessageDialog(this, HelpMessageDialog::cmdline);
#ifdef ENABLE_WALLET
if(enableWallet)
{
@ -425,12 +426,17 @@ void BitcoinGUI::createActions()
showHelpMessageAction->setMenuRole(QAction::NoRole);
showHelpMessageAction->setStatusTip(tr("Show the Dash Core help message to get a list with possible Dash Core command-line options"));
showPrivateSendHelpAction = new QAction(QApplication::style()->standardIcon(QStyle::SP_MessageBoxInformation), tr("&PrivateSend information"), this);
showPrivateSendHelpAction->setMenuRole(QAction::NoRole);
showPrivateSendHelpAction->setStatusTip(tr("Show the PrivateSend basic information"));
connect(quitAction, SIGNAL(triggered()), qApp, SLOT(quit()));
connect(aboutAction, SIGNAL(triggered()), this, SLOT(aboutClicked()));
connect(aboutQtAction, SIGNAL(triggered()), qApp, SLOT(aboutQt()));
connect(optionsAction, SIGNAL(triggered()), this, SLOT(optionsClicked()));
connect(toggleHideAction, SIGNAL(triggered()), this, SLOT(toggleHidden()));
connect(showHelpMessageAction, SIGNAL(triggered()), this, SLOT(showHelpMessageClicked()));
connect(showPrivateSendHelpAction, SIGNAL(triggered()), this, SLOT(showPrivateSendHelpClicked()));
// Jump directly to tabs in RPC-console
connect(openInfoAction, SIGNAL(triggered()), this, SLOT(showInfo()));
@ -525,6 +531,7 @@ void BitcoinGUI::createMenuBar()
QMenu *help = appMenuBar->addMenu(tr("&Help"));
help->addAction(showHelpMessageAction);
help->addAction(showPrivateSendHelpAction);
help->addSeparator();
help->addAction(aboutAction);
help->addAction(aboutQtAction);
@ -740,7 +747,7 @@ void BitcoinGUI::aboutClicked()
if(!clientModel)
return;
HelpMessageDialog dlg(this, true);
HelpMessageDialog dlg(this, HelpMessageDialog::about);
dlg.exec();
}
@ -802,6 +809,15 @@ void BitcoinGUI::showHelpMessageClicked()
helpMessageDialog->show();
}
void BitcoinGUI::showPrivateSendHelpClicked()
{
if(!clientModel)
return;
HelpMessageDialog dlg(this, HelpMessageDialog::pshelp);
dlg.exec();
}
#ifdef ENABLE_WALLET
void BitcoinGUI::openClicked()
{

View File

@ -123,6 +123,7 @@ private:
QAction *showBackupsAction;
QAction *openAction;
QAction *showHelpMessageAction;
QAction *showPrivateSendHelpAction;
QSystemTrayIcon *trayIcon;
QMenu *trayIconMenu;
@ -238,6 +239,8 @@ private Q_SLOTS:
/** Show help message dialog */
void showHelpMessageClicked();
/** Show PrivateSend help message dialog */
void showPrivateSendHelpClicked();
#ifndef Q_OS_MAC
/** Handle tray icon clicked */
void trayIconActivated(QSystemTrayIcon::ActivationReason reason);

View File

@ -609,7 +609,7 @@ int main(int argc, char *argv[])
// but before showing splash screen.
if (mapArgs.count("-?") || mapArgs.count("-h") || mapArgs.count("-help") || mapArgs.count("-version"))
{
HelpMessageDialog help(NULL, mapArgs.count("-version"));
HelpMessageDialog help(NULL, mapArgs.count("-version") ? HelpMessageDialog::about : HelpMessageDialog::cmdline);
help.showOrPrint();
return EXIT_SUCCESS;
}

View File

@ -16,6 +16,7 @@
#include "platformstyle.h"
#include "transactionfilterproxy.h"
#include "transactiontablemodel.h"
#include "utilitydialog.h"
#include "walletmodel.h"
#include "init.h"
#include "masternode-sync.h"
@ -579,41 +580,8 @@ void OverviewPage::privateSendReset(){
}
void OverviewPage::privateSendInfo(){
// Artificial long boxtitle to ensure minimum width without overwriting the global CSS styles
QString placeHolder = " ";
QString infoBoxTitle = tr("PrivateSend") + placeHolder;
QMessageBox::information(this, infoBoxTitle,
tr("\
<h3>PrivateSend Basics</h3> \
PrivateSend gives you true financial privacy by obscuring the origins of your funds. \
All the Dash in your wallet is comprised of different \"inputs\" which you can think of as separate, discrete coins.<br> \
PrivateSend uses an innovative process to mix your inputs with the inputs of two other people, without having your coins ever leave your wallet. \
You retain control of your money at all times..<hr> \
<b>The PrivateSend process works like this:</b>\
<ol type=\"1\"> \
<li>PrivateSend begins by breaking your transaction inputs down into standard denominations. \
These denominations are 0.1 DASH, 1 DASH, 10 DASH, and 100 DASH--sort of like the paper money you use every day.</li> \
<li>Your wallet then sends requests to specially configured software nodes on the network, called \"masternodes.\" \
These masternodes are informed then that you are interested in mixing a certain denomination. \
No identifiable information is sent to the masternodes, so they never know \"who\" you are.</li> \
<li>When two other people send similar messages, indicating that they wish to mix the same denomination, a mixing session begins. \
The masternode mixes up the inputs and instructs all three users' wallets to pay the now-transformed input back to themselves. \
Your wallet pays that denomination directly to itself, but in a different address (called a change address).</li> \
<li>In order to fully obscure your funds, your wallet must repeat this process a number of times with each denomination. \
Each time the process is completed, it's called a \"round.\" Each round of PrivateSend makes it exponentially more difficult to determine where your funds originated.</li> \
<li>This mixing process happens in the background without any intervention on your part. When you wish to make a transaction, \
your funds will already be anonymized. No additional waiting is required.</li> \
</ol> <hr>\
<b>IMPORTANT:</b> Your wallet only contains 1000 of these \"change addresses.\" Every time a mixing event happens, up to 9 of your addresses are used up. \
This means those 1000 addresses last for about 100 mixing events. When 900 of them are used, your wallet must create more addresses. \
It can only do this, however, if you have automatic backups enabled.<br> \
Consequently, users who have backups disabled will also have PrivateSend disabled. <hr>\
For more info see <a href=\"https://dashpay.atlassian.net/wiki/display/DOC/PrivateSend\">https://dashpay.atlassian.net/wiki/display/DOC/PrivateSend</a> \
"),
QMessageBox::Ok, QMessageBox::Ok);
HelpMessageDialog dlg(this, HelpMessageDialog::pshelp);
dlg.exec();
}
void OverviewPage::togglePrivateSend(){

View File

@ -28,7 +28,7 @@
#include <QVBoxLayout>
/** "Help message" or "About" dialog box */
HelpMessageDialog::HelpMessageDialog(QWidget *parent, bool about) :
HelpMessageDialog::HelpMessageDialog(QWidget *parent, HelpMode helpMode) :
QDialog(parent),
ui(new Ui::HelpMessageDialog)
{
@ -44,7 +44,7 @@ HelpMessageDialog::HelpMessageDialog(QWidget *parent, bool about) :
version += " " + tr("(%1-bit)").arg(32);
#endif
if (about)
if (helpMode == about)
{
setWindowTitle(tr("About Dash Core"));
@ -65,7 +65,7 @@ HelpMessageDialog::HelpMessageDialog(QWidget *parent, bool about) :
ui->aboutMessage->setText(version + "<br><br>" + licenseInfoHTML);
ui->aboutMessage->setWordWrap(true);
ui->helpMessage->setVisible(false);
} else {
} else if (helpMode == cmdline) {
setWindowTitle(tr("Command-line options"));
QString header = tr("Usage:") + "\n" +
" dash-qt [" + tr("command-line options") + "] " + "\n";
@ -127,6 +127,41 @@ HelpMessageDialog::HelpMessageDialog(QWidget *parent, bool about) :
ui->helpMessage->moveCursor(QTextCursor::Start);
ui->scrollArea->setVisible(false);
ui->aboutLogo->setVisible(false);
} else if (helpMode == pshelp) {
setWindowTitle(tr("PrivateSend information"));
ui->aboutMessage->setTextFormat(Qt::RichText);
ui->scrollArea->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded);
ui->aboutMessage->setText(tr("\
<h3>PrivateSend Basics</h3> \
PrivateSend gives you true financial privacy by obscuring the origins of your funds. \
All the Dash in your wallet is comprised of different \"inputs\" which you can think of as separate, discrete coins.<br> \
PrivateSend uses an innovative process to mix your inputs with the inputs of two other people, without having your coins ever leave your wallet. \
You retain control of your money at all times..<hr> \
<b>The PrivateSend process works like this:</b>\
<ol type=\"1\"> \
<li>PrivateSend begins by breaking your transaction inputs down into standard denominations. \
These denominations are 0.1 DASH, 1 DASH, 10 DASH, and 100 DASH--sort of like the paper money you use every day.</li> \
<li>Your wallet then sends requests to specially configured software nodes on the network, called \"masternodes.\" \
These masternodes are informed then that you are interested in mixing a certain denomination. \
No identifiable information is sent to the masternodes, so they never know \"who\" you are.</li> \
<li>When two other people send similar messages, indicating that they wish to mix the same denomination, a mixing session begins. \
The masternode mixes up the inputs and instructs all three users' wallets to pay the now-transformed input back to themselves. \
Your wallet pays that denomination directly to itself, but in a different address (called a change address).</li> \
<li>In order to fully obscure your funds, your wallet must repeat this process a number of times with each denomination. \
Each time the process is completed, it's called a \"round.\" Each round of PrivateSend makes it exponentially more difficult to determine where your funds originated.</li> \
<li>This mixing process happens in the background without any intervention on your part. When you wish to make a transaction, \
your funds will already be anonymized. No additional waiting is required.</li> \
</ol> <hr>\
<b>IMPORTANT:</b> Your wallet only contains 1000 of these \"change addresses.\" Every time a mixing event happens, up to 9 of your addresses are used up. \
This means those 1000 addresses last for about 100 mixing events. When 900 of them are used, your wallet must create more addresses. \
It can only do this, however, if you have automatic backups enabled.<br> \
Consequently, users who have backups disabled will also have PrivateSend disabled. <hr>\
For more info see <a href=\"https://dashpay.atlassian.net/wiki/display/DOC/PrivateSend\">https://dashpay.atlassian.net/wiki/display/DOC/PrivateSend</a> \
"));
ui->aboutMessage->setWordWrap(true);
ui->helpMessage->setVisible(false);
ui->aboutLogo->setVisible(false);
}
// Theme dependent Gfx in About popup
QString helpMessageGfx = ":/images/" + GUIUtil::getThemeName() + "/about";

View File

@ -21,7 +21,13 @@ class HelpMessageDialog : public QDialog
Q_OBJECT
public:
explicit HelpMessageDialog(QWidget *parent, bool about);
enum HelpMode {
about,
cmdline,
pshelp
};
explicit HelpMessageDialog(QWidget *parent, HelpMode helpMode);
~HelpMessageDialog();
void printToConsole();