Skip to content

Commit

Permalink
[Qt] Add basic GUI voting tab to the wallet
Browse files Browse the repository at this point in the history
  • Loading branch information
Fuzzbawls authored and Warrows committed Dec 26, 2018
1 parent 88a93bd commit 39eb903
Show file tree
Hide file tree
Showing 16 changed files with 679 additions and 3 deletions.
8 changes: 7 additions & 1 deletion src/Makefile.qt.include
Expand Up @@ -48,6 +48,7 @@ QT_FORMS_UI = \
qt/forms/blockexplorer.ui \
qt/forms/obfuscationconfig.ui \
qt/forms/editaddressdialog.ui \
qt/forms/governancepage.ui \
qt/forms/helpmessagedialog.ui \
qt/forms/intro.ui \
qt/forms/masternodelist.ui \
Expand Down Expand Up @@ -83,6 +84,7 @@ QT_MOC_CPP = \
qt/moc_csvmodelwriter.cpp \
qt/moc_obfuscationconfig.cpp \
qt/moc_editaddressdialog.cpp \
qt/moc_governancepage.cpp \
qt/moc_guiutil.cpp \
qt/moc_intro.cpp \
qt/moc_macdockiconhandler.cpp \
Expand Down Expand Up @@ -157,6 +159,7 @@ BITCOIN_QT_H = \
qt/csvmodelwriter.h \
qt/obfuscationconfig.h \
qt/editaddressdialog.h \
qt/governancepage.h \
qt/guiconstants.h \
qt/guiutil.h \
qt/intro.h \
Expand Down Expand Up @@ -263,7 +266,9 @@ RES_ICONS = \
qt/res/icons/unit_upivx.png \
qt/res/icons/unit_tpivx.png \
qt/res/icons/unit_tmpivx.png \
qt/res/icons/unit_tupivx.png
qt/res/icons/unit_tupivx.png \
qt/res/icons/yesvote.png \
qt/res/icons/novote.png

BITCOIN_QT_BASE_CPP = \
qt/bantablemodel.cpp \
Expand Down Expand Up @@ -302,6 +307,7 @@ BITCOIN_QT_WALLET_CPP = \
qt/coincontroltreewidget.cpp \
qt/obfuscationconfig.cpp \
qt/editaddressdialog.cpp \
qt/governancepage.cpp \
qt/masternodelist.cpp \
qt/multisenddialog.cpp \
qt/multisigdialog.cpp\
Expand Down
2 changes: 1 addition & 1 deletion src/qt/askpassphrasedialog.cpp
Expand Up @@ -75,7 +75,7 @@ AskPassphraseDialog::AskPassphraseDialog(Mode mode, QWidget* parent, WalletModel
}

// Set checkbox "For anonymization, automint, and staking only" depending on from where we were called
if (context == Context::Unlock_Menu || context == Context::Mint_zPIV || context == Context::BIP_38) {
if (context == Context::Unlock_Menu || context == Context::Mint_zPIV || context == Context::BIP_38 || context == Context::UI_Vote) {
ui->anonymizationCheckBox->setChecked(true);
}
else {
Expand Down
3 changes: 2 additions & 1 deletion src/qt/askpassphrasedialog.h
Expand Up @@ -43,7 +43,8 @@ class AskPassphraseDialog : public QDialog
Mint_zPIV, /** Mint zPIV */
BIP_38, /** BIP38 menu */
Multi_Sig, /** Multi-Signature dialog */
Sign_Message /** Sign/verify message dialog */
Sign_Message, /** Sign/verify message dialog */
UI_Vote, /** Governance Tab UI Voting */
};

explicit AskPassphraseDialog(Mode mode, QWidget* parent, WalletModel* model, Context context);
Expand Down
20 changes: 20 additions & 0 deletions src/qt/bitcoingui.cpp
Expand Up @@ -87,6 +87,7 @@ BitcoinGUI::BitcoinGUI(const NetworkStyle* networkStyle, QWidget* parent) : QMai
multisigSignAction(0),
aboutAction(0),
receiveCoinsAction(0),
governanceAction(0),
privacyAction(0),
optionsAction(0),
toggleHideAction(0),
Expand Down Expand Up @@ -367,6 +368,17 @@ void BitcoinGUI::createActions(const NetworkStyle* networkStyle)
connect(masternodeAction, SIGNAL(triggered()), this, SLOT(showNormalIfMinimized()));
connect(masternodeAction, SIGNAL(triggered()), this, SLOT(gotoMasternodePage()));
}

governanceAction = new QAction(QIcon(":/icons/masternodes"), tr("&Governance"), this);
governanceAction->setStatusTip(tr("Show Proposals"));
governanceAction->setToolTip(governanceAction->statusTip());
governanceAction->setCheckable(true);
#ifdef Q_OS_MAC
governanceAction->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_7));
#else
governanceAction->setShortcut(QKeySequence(Qt::ALT + Qt::Key_7));
#endif
tabGroup->addAction(governanceAction);

// These showNormalIfMinimized are needed because Send Coins and Receive Coins
// can be triggered from the tray menu, and need to show the GUI to be useful.
Expand All @@ -380,6 +392,7 @@ void BitcoinGUI::createActions(const NetworkStyle* networkStyle)
connect(privacyAction, SIGNAL(triggered()), this, SLOT(gotoPrivacyPage()));
connect(historyAction, SIGNAL(triggered()), this, SLOT(showNormalIfMinimized()));
connect(historyAction, SIGNAL(triggered()), this, SLOT(gotoHistoryPage()));
connect(governanceAction, SIGNAL(triggered()), this, SLOT(gotoGovernancePage()));
#endif // ENABLE_WALLET

quitAction = new QAction(QIcon(":/icons/quit"), tr("E&xit"), this);
Expand Down Expand Up @@ -565,6 +578,7 @@ void BitcoinGUI::createToolBars()
if (settings.value("fShowMasternodesTab").toBool()) {
toolbar->addAction(masternodeAction);
}
toolbar->addAction(governanceAction);
toolbar->setMovable(false); // remove unused icon in upper left corner
toolbar->setOrientation(Qt::Vertical);
toolbar->setIconSize(QSize(40,40));
Expand Down Expand Up @@ -810,6 +824,12 @@ void BitcoinGUI::gotoMasternodePage()
}
}

void BitcoinGUI::gotoGovernancePage()
{
governanceAction->setChecked(true);
if (walletFrame) walletFrame->gotoGovernancePage();
}

void BitcoinGUI::gotoReceiveCoinsPage()
{
receiveCoinsAction->setChecked(true);
Expand Down
3 changes: 3 additions & 0 deletions src/qt/bitcoingui.h
Expand Up @@ -109,6 +109,7 @@ class BitcoinGUI : public QMainWindow
QAction* multisigSignAction;
QAction* aboutAction;
QAction* receiveCoinsAction;
QAction* governanceAction;
QAction* privacyAction;
QAction* optionsAction;
QAction* toggleHideAction;
Expand Down Expand Up @@ -209,6 +210,8 @@ private slots:
void gotoOverviewPage();
/** Switch to history (transactions) page */
void gotoHistoryPage();
/** Switch to Governance Page */
void gotoGovernancePage();
/** Switch to Explorer Page */
void gotoBlockExplorerPage();
/** Switch to masternode page */
Expand Down

0 comments on commit 39eb903

Please sign in to comment.