Skip to content

Commit

Permalink
Merge pull request #26 from PACGlobalOfficial/governance-tab
Browse files Browse the repository at this point in the history
Add governance tab with voting functions
  • Loading branch information
barrystyle authored Nov 4, 2019
2 parents 68cfd08 + bfa3c76 commit bfed33b
Show file tree
Hide file tree
Showing 15 changed files with 1,040 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/Makefile.qt.include
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ QT_FORMS_UI = \
qt/forms/askpassphrasedialog.ui \
qt/forms/coincontroldialog.ui \
qt/forms/editaddressdialog.ui \
qt/forms/governancelist.ui \
qt/forms/governancedialog.ui \
qt/forms/helpmessagedialog.ui \
qt/forms/intro.ui \
qt/forms/modaloverlay.ui \
Expand Down Expand Up @@ -66,6 +68,8 @@ QT_MOC_CPP = \
qt/moc_coincontroltreewidget.cpp \
qt/moc_csvmodelwriter.cpp \
qt/moc_editaddressdialog.cpp \
qt/moc_governancelist.cpp \
qt/moc_governancedialog.cpp \
qt/moc_guiutil.cpp \
qt/moc_intro.cpp \
qt/moc_macdockiconhandler.cpp \
Expand Down Expand Up @@ -136,6 +140,8 @@ BITCOIN_QT_H = \
qt/coincontroltreewidget.h \
qt/csvmodelwriter.h \
qt/editaddressdialog.h \
qt/governancelist.h \
qt/governancedialog.h \
qt/guiconstants.h \
qt/guiutil.h \
qt/intro.h \
Expand Down Expand Up @@ -277,6 +283,8 @@ BITCOIN_QT_WALLET_CPP = \
qt/coincontroldialog.cpp \
qt/coincontroltreewidget.cpp \
qt/editaddressdialog.cpp \
qt/governancelist.cpp \
qt/governancedialog.cpp \
qt/masternodelist.cpp \
qt/openuridialog.cpp \
qt/overviewpage.cpp \
Expand Down
22 changes: 22 additions & 0 deletions src/qt/bitcoingui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ BitcoinGUI::BitcoinGUI(const PlatformStyle *_platformStyle, const NetworkStyle *
overviewAction(0),
historyAction(0),
masternodeAction(0),
governanceAction(0),
quitAction(0),
sendCoinsAction(0),
sendCoinsMenuAction(0),
Expand Down Expand Up @@ -370,6 +371,19 @@ void BitcoinGUI::createActions()
#endif
tabGroup->addAction(masternodeAction);

governanceAction = new QAction(QIcon(":/icons/governance"), tr("&Governance"), this);
governanceAction->setStatusTip(tr("Show governance items"));
governanceAction->setToolTip(governanceAction->statusTip());
governanceAction->setCheckable(true);
#ifdef Q_OS_MAC
governanceAction->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_5));
#else
governanceAction->setShortcut(QKeySequence(Qt::ALT + Qt::Key_5));
#endif
tabGroup->addAction(governanceAction);
connect(governanceAction, SIGNAL(triggered()), this, SLOT(showNormalIfMinimized()));
connect(governanceAction, SIGNAL(triggered()), this, SLOT(gotoGovernancePage()));

// 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 Down Expand Up @@ -592,6 +606,7 @@ void BitcoinGUI::createToolBars()
toolbar->addAction(receiveCoinsAction);
toolbar->addAction(historyAction);
toolbar->addAction(masternodeAction);
toolbar->addAction(governanceAction);
QSettings settings;
toolbar->setMovable(false);
overviewAction->setChecked(true);
Expand Down Expand Up @@ -746,6 +761,7 @@ void BitcoinGUI::setWalletActionsEnabled(bool enabled)
receiveCoinsMenuAction->setEnabled(enabled);
historyAction->setEnabled(enabled);
masternodeAction->setEnabled(enabled);
governanceAction->setEnabled(enabled);
encryptWalletAction->setEnabled(enabled);
backupWalletAction->setEnabled(enabled);
changePassphraseAction->setEnabled(enabled);
Expand Down Expand Up @@ -912,6 +928,12 @@ void BitcoinGUI::gotoMasternodePage()
if (walletFrame) walletFrame->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
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ class BitcoinGUI : public QMainWindow
QAction *overviewAction;
QAction *historyAction;
QAction *masternodeAction;
QAction *governanceAction;
QAction *quitAction;
QAction *sendCoinsAction;
QAction *sendCoinsMenuAction;
Expand Down Expand Up @@ -239,6 +240,8 @@ private Q_SLOTS:
void gotoHistoryPage();
/** Switch to masternode page */
void gotoMasternodePage();
/** Switch to governance page */
void gotoGovernancePage();
/** Switch to receive coins page */
void gotoReceiveCoinsPage();
/** Switch to send coins page */
Expand Down
1 change: 1 addition & 0 deletions src/qt/dash.qrc
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
<file alias="edit">res/icons/edit.png</file>
<file alias="history">res/icons/history.png</file>
<file alias="masternodes">res/icons/masternodes.png</file>
<file alias="governance">res/icons/governance.png</file>
<file alias="overview">res/icons/overview.png</file>
<file alias="export">res/icons/export.png</file>
<file alias="synced">res/icons/synced.png</file>
Expand Down
112 changes: 112 additions & 0 deletions src/qt/forms/governancedialog.ui
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>GovernanceDialog</class>
<widget class="QDialog" name="GovernanceDialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>670</width>
<height>698</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<widget class="QLabel" name="labelQRCodeTitle">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Governance Object</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item>
<widget class="QTextEdit" name="outUri">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>50</height>
</size>
</property>
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Plain</enum>
</property>
<property name="tabChangesFocus">
<bool>true</bool>
</property>
<property name="textInteractionFlags">
<set>Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set>
</property>
</widget>
</item>
<item>
<layout class="QVBoxLayout" name="verticalLayout"/>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2"/>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="standardButtons">
<set>QDialogButtonBox::Close</set>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
<resources/>
<connections>
<connection>
<sender>buttonBox</sender>
<signal>rejected()</signal>
<receiver>GovernanceDialog</receiver>
<slot>reject()</slot>
<hints>
<hint type="sourcelabel">
<x>452</x>
<y>573</y>
</hint>
<hint type="destinationlabel">
<x>243</x>
<y>298</y>
</hint>
</hints>
</connection>
<connection>
<sender>buttonBox</sender>
<signal>accepted()</signal>
<receiver>GovernanceDialog</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel">
<x>452</x>
<y>573</y>
</hint>
<hint type="destinationlabel">
<x>243</x>
<y>298</y>
</hint>
</hints>
</connection>
</connections>
</ui>
Loading

0 comments on commit bfed33b

Please sign in to comment.