Skip to content

Commit

Permalink
Merge bitcoin#792: [UI] Add a budget monitoring and voting tab
Browse files Browse the repository at this point in the history
4008865 [Travis] Fix trailing whitespaces (warrows)
87b9809 [UI] Rework proposal frames (warrows)
8b8a712 [UI] Add global budget information to governance tab (warrows)
f7674fb [UI] Clean proposal list when updating (warrows)
bbf3274 [UI] Use only one column for Proposal list (warrows)
d6c68c6 [UI] remove unused textlabel from governance page (warrows)
39eb903 [Qt] Add basic GUI voting tab to the wallet (Fuzzbawls)

Tree-SHA512: 438afbb8ed1dbe0892164b6f6b3d0ac3b825b2e7855115f1137bf5bcf454533e375774cd835c19ea529bb1ff0a4f886a3e71e809e9893a102ae841a1a4be8f9a
  • Loading branch information
Mrs-X committed Feb 20, 2019
2 parents ed0dd2a + 4008865 commit c126974
Show file tree
Hide file tree
Showing 23 changed files with 1,079 additions and 15 deletions.
14 changes: 13 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 All @@ -101,6 +103,7 @@ QT_MOC_CPP = \
qt/moc_qvaluecombobox.cpp \
qt/moc_receivecoinsdialog.cpp \
qt/moc_privacydialog.cpp \
qt/moc_proposalframe.cpp \
qt/moc_receiverequestdialog.cpp \
qt/moc_recentrequeststablemodel.cpp \
qt/moc_rpcconsole.cpp \
Expand Down Expand Up @@ -157,6 +160,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 All @@ -175,6 +179,7 @@ BITCOIN_QT_H = \
qt/paymentserver.h \
qt/peertablemodel.h \
qt/platformstyle.h \
qt/proposalframe.h \
qt/qvalidatedlineedit.h \
qt/qvaluecombobox.h \
qt/receivecoinsdialog.h \
Expand Down Expand Up @@ -247,6 +252,8 @@ RES_ICONS = \
qt/res/icons/remove.png \
qt/res/icons/send.png \
qt/res/icons/send_dark.png \
qt/res/icons/governance.png \
qt/res/icons/governance_dark.png \
qt/res/icons/staking_active.png \
qt/res/icons/staking_inactive.png \
qt/res/icons/synced.png \
Expand All @@ -263,7 +270,10 @@ 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 \
qt/res/icons/abstainvote.png

BITCOIN_QT_BASE_CPP = \
qt/bantablemodel.cpp \
Expand Down Expand Up @@ -302,6 +312,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 All @@ -311,6 +322,7 @@ BITCOIN_QT_WALLET_CPP = \
qt/paymentserver.cpp \
qt/receivecoinsdialog.cpp \
qt/privacydialog.cpp \
qt/proposalframe.cpp \
qt/receiverequestdialog.cpp \
qt/recentrequeststablemodel.cpp \
qt/sendcoinsdialog.cpp \
Expand Down
12 changes: 6 additions & 6 deletions src/masternode-budget.cpp
Expand Up @@ -1623,11 +1623,11 @@ double CBudgetProposal::GetRatio()
return ((double)(yeas) / (double)(yeas + nays));
}

int CBudgetProposal::GetYeas()
int CBudgetProposal::GetYeas() const
{
int ret = 0;

std::map<uint256, CBudgetVote>::iterator it = mapVotes.begin();
std::map<uint256, CBudgetVote>::const_iterator it = mapVotes.begin();
while (it != mapVotes.end()) {
if ((*it).second.nVote == VOTE_YES && (*it).second.fValid) ret++;
++it;
Expand All @@ -1636,11 +1636,11 @@ int CBudgetProposal::GetYeas()
return ret;
}

int CBudgetProposal::GetNays()
int CBudgetProposal::GetNays() const
{
int ret = 0;

std::map<uint256, CBudgetVote>::iterator it = mapVotes.begin();
std::map<uint256, CBudgetVote>::const_iterator it = mapVotes.begin();
while (it != mapVotes.end()) {
if ((*it).second.nVote == VOTE_NO && (*it).second.fValid) ret++;
++it;
Expand All @@ -1649,11 +1649,11 @@ int CBudgetProposal::GetNays()
return ret;
}

int CBudgetProposal::GetAbstains()
int CBudgetProposal::GetAbstains() const
{
int ret = 0;

std::map<uint256, CBudgetVote>::iterator it = mapVotes.begin();
std::map<uint256, CBudgetVote>::const_iterator it = mapVotes.begin();
while (it != mapVotes.end()) {
if ((*it).second.nVote == VOTE_ABSTAIN && (*it).second.fValid) ret++;
++it;
Expand Down
6 changes: 3 additions & 3 deletions src/masternode-budget.h
Expand Up @@ -515,9 +515,9 @@ class CBudgetProposal
int GetBlockCurrentCycle();
int GetBlockEndCycle();
double GetRatio();
int GetYeas();
int GetNays();
int GetAbstains();
int GetYeas() const;
int GetNays() const;
int GetAbstains() const;
CAmount GetAmount() { return nAmount; }
void SetAllotted(CAmount nAllotedIn) { nAlloted = nAllotedIn; }
CAmount GetAllotted() { return nAlloted; }
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 @@ -368,6 +369,17 @@ void BitcoinGUI::createActions(const NetworkStyle* networkStyle)
connect(masternodeAction, SIGNAL(triggered()), this, SLOT(gotoMasternodePage()));
}

governanceAction = new QAction(QIcon(":/icons/governance"), 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.
connect(overviewAction, SIGNAL(triggered()), this, SLOT(showNormalIfMinimized()));
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 @@ -811,6 +825,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 c126974

Please sign in to comment.