Skip to content

Commit

Permalink
GUI Update + EasySplit Feature
Browse files Browse the repository at this point in the history
  • Loading branch information
Oliver Ziegler authored and Oliver Ziegler committed Oct 26, 2018
1 parent 3f5b5bb commit 1e44472
Show file tree
Hide file tree
Showing 19 changed files with 4,159 additions and 26 deletions.
4 changes: 4 additions & 0 deletions contrib/bitcoin-qt.pro
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ FORMS += \
../src/qt/forms/sendcoinsentry.ui \
../src/qt/forms/signverifymessagedialog.ui \
../src/qt/forms/transactiondescdialog.ui \
../src/qt/forms/sendcoinsdialog_kopie.ui \
../src/qt/forms/sendcoinsentry_kopie.ui \
../src/qt/forms/easysplitdialog.ui \
../src/qt/forms/easysplitentry.ui

RESOURCES += \
../src/qt/bitcoin.qrc
8 changes: 8 additions & 0 deletions src/Makefile.qt.include
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,8 @@ QT_FORMS_UI = \
qt/forms/debugwindow.ui \
qt/forms/sendcoinsdialog.ui \
qt/forms/sendcoinsentry.ui \
qt/forms/easysplitdialog.ui \
qt/forms/easysplitentry.ui \
qt/forms/signverifymessagedialog.ui \
qt/forms/transactiondescdialog.ui

Expand Down Expand Up @@ -145,6 +147,8 @@ QT_MOC_CPP = \
qt/moc_rpcconsole.cpp \
qt/moc_sendcoinsdialog.cpp \
qt/moc_sendcoinsentry.cpp \
qt/moc_easysplitentry.cpp \
qt/moc_easysplitdialog.cpp \
qt/moc_signverifymessagedialog.cpp \
qt/moc_splashscreen.cpp \
qt/moc_trafficgraphwidget.cpp \
Expand Down Expand Up @@ -215,6 +219,8 @@ BITCOIN_QT_H = \
qt/rpcconsole.h \
qt/sendcoinsdialog.h \
qt/sendcoinsentry.h \
qt/easysplitdialog.h \
qt/easysplitentry.h \
qt/signverifymessagedialog.h \
qt/splashscreen.h \
qt/trafficgraphwidget.h \
Expand Down Expand Up @@ -326,6 +332,8 @@ BITCOIN_QT_WALLET_CPP = \
qt/recentrequeststablemodel.cpp \
qt/sendcoinsdialog.cpp \
qt/sendcoinsentry.cpp \
qt/easysplitdialog.cpp \
qt/easysplitentry.cpp \
qt/signverifymessagedialog.cpp \
qt/transactiondesc.cpp \
qt/transactiondescdialog.cpp \
Expand Down
26 changes: 26 additions & 0 deletions src/qt/addressbookpage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,9 @@ AddressBookPage::AddressBookPage(const PlatformStyle *platformStyle, Mode mode,
{
case SendingTab: setWindowTitle(tr("Choose the address to send coins to")); break;
case ReceivingTab: setWindowTitle(tr("Choose the address to receive coins with")); break;
case EasySplitTab: setWindowTitle(tr("Choose the addresses you would like to send coins to"));
ui->tableView->setSelectionMode(QAbstractItemView::MultiSelection);
break;
}
connect(ui->tableView, SIGNAL(doubleClicked(QModelIndex)), this, SLOT(accept()));
ui->tableView->setEditTriggers(QAbstractItemView::NoEditTriggers);
Expand All @@ -61,6 +64,7 @@ AddressBookPage::AddressBookPage(const PlatformStyle *platformStyle, Mode mode,
{
case SendingTab: setWindowTitle(tr("Sending addresses")); break;
case ReceivingTab: setWindowTitle(tr("Receiving addresses")); break;
case EasySplitTab: setWindowTitle(tr("EasySplit Addresses")); break;
}
break;
}
Expand All @@ -74,6 +78,10 @@ AddressBookPage::AddressBookPage(const PlatformStyle *platformStyle, Mode mode,
ui->labelExplanation->setText(tr("These are your Trezarcoin addresses for receiving payments. It is recommended to use a new receiving address for each transaction."));
ui->deleteAddress->setVisible(false);
break;
case EasySplitTab:
ui->labelExplanation->setText(tr("These are your Trezarcoin addresses for EasySplit"));
ui->deleteAddress->setVisible(false);
break;
}

// Context menu actions
Expand Down Expand Up @@ -125,6 +133,11 @@ void AddressBookPage::setModel(AddressTableModel *model)
proxyModel->setFilterRole(AddressTableModel::TypeRole);
proxyModel->setFilterFixedString(AddressTableModel::Receive);
break;
case EasySplitTab:
// EasySplit filter
proxyModel->setFilterRole(AddressTableModel::TypeRole);
proxyModel->setFilterFixedString(AddressTableModel::Receive);
break;
case SendingTab:
// Send filter
proxyModel->setFilterRole(AddressTableModel::TypeRole);
Expand Down Expand Up @@ -235,6 +248,12 @@ void AddressBookPage::selectionChanged()
ui->deleteAddress->setVisible(false);
deleteAction->setEnabled(false);
break;
case EasySplitTab:
// Deleting receiving addresses, however, is not allowed
ui->deleteAddress->setEnabled(false);
ui->deleteAddress->setVisible(false);
deleteAction->setEnabled(false);
break;
}
ui->copyAddress->setEnabled(true);
}
Expand All @@ -259,6 +278,13 @@ void AddressBookPage::done(int retval)
returnValue = address.toString();
}

Q_FOREACH (const QModelIndex& index, indexes)
{
QVariant easySplitAddress = table->model()->data(index);
easySplitAddressList.append(easySplitAddress.toString());
easySplitCounter++;
}

if(returnValue.isEmpty())
{
// If no address entry selected, return rejected
Expand Down
12 changes: 11 additions & 1 deletion src/qt/addressbookpage.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
#define BITCOIN_QT_ADDRESSBOOKPAGE_H

#include <QDialog>
#include <QStringList>
#include <QAbstractListModel>

class AddressTableModel;
class OptionsModel;
Expand All @@ -21,6 +23,7 @@ class QMenu;
class QModelIndex;
class QSortFilterProxyModel;
class QTableView;
class QStringList;
QT_END_NAMESPACE

/** Widget that shows a list of sending or receiving addresses.
Expand All @@ -32,20 +35,27 @@ class AddressBookPage : public QDialog
public:
enum Tabs {
SendingTab = 0,
ReceivingTab = 1
ReceivingTab = 1,
EasySplitTab = 2
};

enum Mode {
ForSelection, /**< Open address book to pick address */
ForEditing /**< Open address book for editing */
};

int easySplitCounter;
QStringList easySplitAddressList;

explicit AddressBookPage(const PlatformStyle *platformStyle, Mode mode, Tabs tab, QWidget *parent);
~AddressBookPage();

void setModel(AddressTableModel *model);
const QString &getReturnValue() const { return returnValue; }

const QStringList &getEasySplitList() const { return easySplitAddressList; }
const int &getEasySplitCounter() const { return easySplitCounter; }

public Q_SLOTS:
void done(int retval);

Expand Down
31 changes: 28 additions & 3 deletions src/qt/bitcoingui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
#include "optionsmodel.h"
#include "platformstyle.h"
#include "rpcconsole.h"
#include "rpc/server.h"
#include "utilitydialog.h"
#include "walletmodel.h"
#include "wallet/rpcwallet.h"
Expand Down Expand Up @@ -144,6 +145,7 @@ BitcoinGUI::BitcoinGUI(const PlatformStyle *platformStyle, const NetworkStyle *n
unlockWalletAction(0),
lockWalletAction(0),
toggleStakingAction(0),
easysplitAction(0),
platformStyle(platformStyle)
{
GUIUtil::restoreWindowGeometry("nWindow", QSize(840, 600), this);
Expand Down Expand Up @@ -341,7 +343,7 @@ void BitcoinGUI::createActions()
receiveCoinsMenuAction->setStatusTip(receiveCoinsAction->statusTip());
receiveCoinsMenuAction->setToolTip(receiveCoinsMenuAction->statusTip());

toggleStakingAction = new QAction(tr("Toggle &Staking"), this);
toggleStakingAction = new QAction(platformStyle->SingleColorIcon(":/icons/staking_off"),tr("Toggle &Staking"), this);
toggleStakingAction->setStatusTip(tr("Toggle Staking"));

historyAction = new QAction(platformStyle->SingleColorIcon(":/icons/history"), tr("&Transactions"), this);
Expand All @@ -351,6 +353,12 @@ void BitcoinGUI::createActions()
historyAction->setShortcut(QKeySequence(Qt::ALT + Qt::Key_4));
tabGroup->addAction(historyAction);

easysplitAction = new QAction(platformStyle->SingleColorIcon(":/icons/send"), tr("&EasySplit"), this);
easysplitAction->setStatusTip(tr("Split your Coins easily"));
easysplitAction->setToolTip(easysplitAction->statusTip());
easysplitAction->setCheckable(true);
tabGroup->addAction(easysplitAction);

#ifdef ENABLE_WALLET
// 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 @@ -367,6 +375,8 @@ void BitcoinGUI::createActions()
connect(historyAction, SIGNAL(triggered()), this, SLOT(showNormalIfMinimized()));
connect(historyAction, SIGNAL(triggered()), this, SLOT(gotoHistoryPage()));
connect(toggleStakingAction, SIGNAL(triggered()), this, SLOT(toggleStaking()));
connect(easysplitAction, SIGNAL(triggered()), this, SLOT(showNormalIfMinimized()));
connect(easysplitAction, SIGNAL(triggered()), this, SLOT(gotoEasySplitPage()));
#endif // ENABLE_WALLET

quitAction = new QAction(platformStyle->TextColorIcon(":/icons/quit"), tr("E&xit"), this);
Expand Down Expand Up @@ -478,11 +488,16 @@ void BitcoinGUI::createMenuBar()
settings->addAction(unlockWalletAction);
settings->addAction(changePassphraseAction);
settings->addSeparator();
settings->addAction(toggleStakingAction);
settings->addSeparator();
}
settings->addAction(optionsAction);

QMenu *pos = appMenuBar->addMenu(tr("&PoS"));
if (walletFrame)
{
pos->addAction(toggleStakingAction);
pos->addAction(easysplitAction);
}

QMenu *help = appMenuBar->addMenu(tr("&Help"));
if(walletFrame)
{
Expand All @@ -492,6 +507,7 @@ void BitcoinGUI::createMenuBar()
help->addSeparator();
help->addAction(aboutAction);
help->addAction(aboutQtAction);

}

void BitcoinGUI::createToolBars()
Expand Down Expand Up @@ -602,6 +618,7 @@ void BitcoinGUI::setWalletActionsEnabled(bool enabled)
receiveCoinsAction->setEnabled(enabled);
receiveCoinsMenuAction->setEnabled(enabled);
historyAction->setEnabled(enabled);
easysplitAction->setEnabled(enabled);
encryptWalletAction->setEnabled(enabled);
backupWalletAction->setEnabled(enabled);
changePassphraseAction->setEnabled(enabled);
Expand Down Expand Up @@ -792,6 +809,11 @@ void BitcoinGUI::gotoHistoryPage()
if (walletFrame) walletFrame->gotoHistoryPage();
}

void BitcoinGUI::gotoEasySplitPage()
{
if (walletFrame) walletFrame->gotoEasySplitPage();
}

void BitcoinGUI::gotoReceiveCoinsPage()
{
receiveCoinsAction->setChecked(true);
Expand Down Expand Up @@ -879,6 +901,9 @@ void BitcoinGUI::setNumBlocks(int count, const QDateTime& blockDate, double nVer
tooltip = tr("Up to date") + QString(".<br>") + tooltip;
labelBlocksIcon->setPixmap(platformStyle->SingleColorIcon(":/icons/synced").pixmap(STATUSBAR_ICONSIZE, STATUSBAR_ICONSIZE));

tooltip += QString("<br>") + tr("The current PoW difficulty is %1").arg(GetDifficulty());
tooltip += QString("<br>") + tr("The current PoS difficulty is %1").arg(GetDifficulty(GetLastBlockIndex(chainActive.Tip(), true)));

#ifdef ENABLE_WALLET
if(walletFrame)
walletFrame->showOutOfSyncWarning(false);
Expand Down
3 changes: 3 additions & 0 deletions src/qt/bitcoingui.h
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ class BitcoinGUI : public QMainWindow
QAction *unlockWalletAction;
QAction *lockWalletAction;
QAction *toggleStakingAction;
QAction *easysplitAction;

QSystemTrayIcon *trayIcon;
QMenu *trayIconMenu;
Expand Down Expand Up @@ -212,6 +213,8 @@ private Q_SLOTS:
void openClicked();
/** Update Staking status **/
void updateStakingStatus();
/** Switch to receive coins page */
void gotoEasySplitPage();

#endif // ENABLE_WALLET
void toggleStaking();
Expand Down
Loading

0 comments on commit 1e44472

Please sign in to comment.