Skip to content

Commit

Permalink
Bottle Caps 2.2
Browse files Browse the repository at this point in the history
Add Block Browser, AutoSavings to GUI and new Splash screen
  • Loading branch information
Tranz5 committed Sep 6, 2014
1 parent 3cd7486 commit e1d17f0
Show file tree
Hide file tree
Showing 30 changed files with 1,493 additions and 42 deletions.
2 changes: 2 additions & 0 deletions src/bitcoinrpc.cpp
Expand Up @@ -1234,6 +1234,8 @@ Array RPCConvertValues(const std::string &strMethod, const std::vector<std::stri
if (strMethod == "sendalert" && n > 5) ConvertTo<boost::int64_t>(params[5]);
if (strMethod == "sendalert" && n > 6) ConvertTo<boost::int64_t>(params[6]);
if (strMethod == "autosavings" && n > 1) ConvertTo<int>(params[1]);
if (strMethod == "autosavings" && n > 2) ConvertTo<double>(params[2]);
if (strMethod == "autosavings" && n > 3) ConvertTo<double>(params[3]);

return params;
}
Expand Down
4 changes: 2 additions & 2 deletions src/bitcoinrpc.h
Expand Up @@ -127,8 +127,8 @@ extern int64 nWalletUnlockTime;
extern int64 AmountFromValue(const json_spirit::Value& value);
extern json_spirit::Value ValueFromAmount(int64 amount);
extern double GetDifficulty(const CBlockIndex* blockindex = NULL);
extern double GetPoWMHashPS();
extern double GetPoSKernelPS();
extern double GetPoWMHashPS(const CBlockIndex* blockindex = NULL);
extern double GetPoSKernelPS(const CBlockIndex* blockindex = NULL);
extern std::string HexBits(unsigned int nBits);
extern std::string HelpRequiringPassphrase();
extern void EnsureWalletIsUnlocked();
Expand Down
29 changes: 28 additions & 1 deletion src/qt/addressbookpage.cpp
Expand Up @@ -54,10 +54,12 @@ AddressBookPage::AddressBookPage(Mode mode, Tabs tab, QWidget *parent) :
ui->labelExplanation->setVisible(false);
ui->deleteButton->setVisible(true);
ui->signMessage->setVisible(false);
ui->autoSavingsPushButton->setVisible(true);
break;
case ReceivingTab:
ui->deleteButton->setVisible(false);
ui->signMessage->setVisible(true);
ui->autoSavingsPushButton->setVisible(false);
break;
}

Expand All @@ -68,6 +70,7 @@ AddressBookPage::AddressBookPage(Mode mode, Tabs tab, QWidget *parent) :
QAction *showQRCodeAction = new QAction(ui->showQRCode->text(), this);
QAction *signMessageAction = new QAction(ui->signMessage->text(), this);
QAction *verifyMessageAction = new QAction(ui->verifyMessage->text(), this);
QAction *autoSavingsAction = new QAction(ui->autoSavingsPushButton->text(), this);
deleteAction = new QAction(ui->deleteButton->text(), this);

// Build context menu
Expand All @@ -81,8 +84,10 @@ AddressBookPage::AddressBookPage(Mode mode, Tabs tab, QWidget *parent) :
contextMenu->addAction(showQRCodeAction);
if(tab == ReceivingTab)
contextMenu->addAction(signMessageAction);
else if(tab == SendingTab)
else if(tab == SendingTab) {
contextMenu->addAction(verifyMessageAction);
contextMenu->addAction(autoSavingsAction);
}

// Connect signals for context menu actions
connect(copyAddressAction, SIGNAL(triggered()), this, SLOT(on_copyToClipboard_clicked()));
Expand All @@ -92,6 +97,7 @@ AddressBookPage::AddressBookPage(Mode mode, Tabs tab, QWidget *parent) :
connect(showQRCodeAction, SIGNAL(triggered()), this, SLOT(on_showQRCode_clicked()));
connect(signMessageAction, SIGNAL(triggered()), this, SLOT(on_signMessage_clicked()));
connect(verifyMessageAction, SIGNAL(triggered()), this, SLOT(on_verifyMessage_clicked()));
connect(autoSavingsAction, SIGNAL(triggered()), this, SLOT(on_autoSavingsPushButton_clicked()));

connect(ui->tableView, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(contextualMenu(QPoint)));

Expand Down Expand Up @@ -215,6 +221,22 @@ void AddressBookPage::on_verifyMessage_clicked()
emit verifyMessage(addr);
}

void AddressBookPage::on_autoSavingsPushButton_clicked()
{
QTableView *table = ui->tableView;
QModelIndexList indexes = table->selectionModel()->selectedRows(AddressTableModel::Address);
QString addr;

foreach (QModelIndex index, indexes)
{
QVariant address = index.data();
addr = address.toString();
}

emit autoSavingsSignal(addr);
}


void AddressBookPage::on_newAddressButton_clicked()
{
if(!model)
Expand Down Expand Up @@ -262,6 +284,8 @@ void AddressBookPage::selectionChanged()
ui->signMessage->setVisible(false);
ui->verifyMessage->setEnabled(true);
ui->verifyMessage->setVisible(true);
ui->autoSavingsPushButton->setEnabled(true);
ui->autoSavingsPushButton->setVisible(true);
break;
case ReceivingTab:
// Deleting receiving addresses, however, is not allowed
Expand All @@ -272,6 +296,8 @@ void AddressBookPage::selectionChanged()
ui->signMessage->setVisible(true);
ui->verifyMessage->setEnabled(false);
ui->verifyMessage->setVisible(false);
ui->autoSavingsPushButton->setEnabled(false);
ui->autoSavingsPushButton->setVisible(false );
break;
}
ui->copyToClipboard->setEnabled(true);
Expand All @@ -284,6 +310,7 @@ void AddressBookPage::selectionChanged()
ui->copyToClipboard->setEnabled(false);
ui->signMessage->setEnabled(false);
ui->verifyMessage->setEnabled(false);
ui->autoSavingsPushButton->setEnabled(false);
}
}

Expand Down
2 changes: 2 additions & 0 deletions src/qt/addressbookpage.h
Expand Up @@ -64,6 +64,7 @@ private slots:
void on_copyToClipboard_clicked();
void on_signMessage_clicked();
void on_verifyMessage_clicked();
void on_autoSavingsPushButton_clicked();
void selectionChanged();
void on_showQRCode_clicked();
/** Spawn contextual menu (right mouse menu) for address book entry */
Expand All @@ -80,6 +81,7 @@ private slots:
signals:
void signMessage(QString addr);
void verifyMessage(QString addr);
void autoSavingsSignal(QString addr);
};

#endif // ADDRESSBOOKDIALOG_H
2 changes: 1 addition & 1 deletion src/qt/bitcoin.cpp
Expand Up @@ -85,7 +85,7 @@ static void InitMessage(const std::string &message)
{
if(splashref)
{
splashref->showMessage(QString::fromStdString(message+'\n'+'\n') + QString::fromStdString(FormatFullVersion().c_str()), Qt::AlignBottom|Qt::AlignHCenter, QColor(0,0,0));
splashref->showMessage(QString::fromStdString(message+'\n'+'\n') + QString::fromStdString(FormatFullVersion().c_str()), Qt::AlignBottom|Qt::AlignHCenter, QColor(255,255,200));
QApplication::instance()->processEvents();
}
}
Expand Down
2 changes: 2 additions & 0 deletions src/qt/bitcoin.qrc
Expand Up @@ -47,6 +47,8 @@
<file alias="staking_off">res/icons/staking_off.png</file>
<file alias="staking_on">res/icons/staking_on.png</file>
<file alias="transaction_conflicted">res/icons/transaction_conflicted.png</file>
<file alias="blexp">res/icons/blexp.png</file>
<file alias="info">res/icons/info.png</file>
</qresource>
<qresource prefix="/images">
<file alias="about">res/images/about.png</file>
Expand Down
72 changes: 71 additions & 1 deletion src/qt/bitcoingui.cpp
Expand Up @@ -27,6 +27,8 @@
#include "rpcconsole.h"
#include "ui_interface.h"
#include "net.h"
#include "savingsdialog.h"
#include "blockbrowser.h"

#ifdef Q_OS_MAC
#include "macdockiconhandler.h"
Expand Down Expand Up @@ -119,13 +121,17 @@ BitcoinGUI::BitcoinGUI(QWidget *parent):
sendCoinsPage = new SendCoinsDialog(this);

signVerifyMessageDialog = new SignVerifyMessageDialog(this);
autoSavingsDialog = new AutoSavingsDialog(this);

blockBrowser = new BlockBrowser((this));

centralWidget = new QStackedWidget(this);
centralWidget->addWidget(overviewPage);
centralWidget->addWidget(transactionsPage);
centralWidget->addWidget(addressBookPage);
centralWidget->addWidget(receiveCoinsPage);
centralWidget->addWidget(sendCoinsPage);
centralWidget->addWidget(autoSavingsDialog);
setCentralWidget(centralWidget);

// Create status bar
Expand Down Expand Up @@ -198,6 +204,12 @@ BitcoinGUI::BitcoinGUI(QWidget *parent):
// Clicking on "Sign Message" in the receive coins page sends you to the sign message tab
connect(receiveCoinsPage, SIGNAL(signMessage(QString)), this, SLOT(gotoSignMessageTab(QString)));

// Clicking on "Auto Savings" in the address book sends you to the auto savings page
connect(addressBookPage, SIGNAL(autoSavingsSignal(QString)), this, SLOT(savingsClicked(QString)));

// Clicking on "Block Browser" in the transaction page sends you to the blockbrowser
connect(transactionView, SIGNAL(blockBrowserSignal(QString)), this, SLOT(gotoBlockBrowser(QString)));

// Install event filter to be able to catch status tip events (QEvent::StatusTip)
this->installEventFilter(this);

Expand Down Expand Up @@ -252,6 +264,29 @@ void BitcoinGUI::createActions()
addressBookAction->setShortcut(QKeySequence(Qt::ALT + Qt::Key_5));
tabGroup->addAction(addressBookAction);

savingsAction = new QAction(QIcon(":/icons/send"), tr("Auto &Savings"), this);
savingsAction->setStatusTip(tr("Enable Auto Savings"));
savingsAction->setToolTip(savingsAction->statusTip());
savingsAction->setShortcut(QKeySequence(Qt::ALT + Qt::Key_7));
savingsAction->setCheckable(true);
tabGroup->addAction(savingsAction);

blockAction = new QAction(QIcon(":/icons/blexp"), tr("Block Bro&wser"), this);
blockAction->setStatusTip(tr("Explore the BlockChain"));
blockAction->setToolTip(blockAction->statusTip());

blocksIconAction = new QAction(QIcon(":/icons/info"), tr("Current &Block Info"), this);
blocksIconAction->setStatusTip(tr("Get Current Block Information"));
blocksIconAction->setToolTip(blocksIconAction->statusTip());

stakingIconAction = new QAction(QIcon(":/icons/info"), tr("Current &PoS Block Info"), this);
stakingIconAction->setStatusTip(tr("Get Current PoS Block Information"));
stakingIconAction->setToolTip(stakingIconAction->statusTip());

connectionIconAction = new QAction(QIcon(":/icons/info"), tr("Current &Node Info"), this);
connectionIconAction->setStatusTip(tr("Get Current Peer Information"));
connectionIconAction->setToolTip(connectionIconAction->statusTip());

connect(overviewAction, SIGNAL(triggered()), this, SLOT(showNormalIfMinimized()));
connect(overviewAction, SIGNAL(triggered()), this, SLOT(gotoOverviewPage()));

Expand All @@ -267,6 +302,9 @@ void BitcoinGUI::createActions()
connect(addressBookAction, SIGNAL(triggered()), this, SLOT(showNormalIfMinimized()));
connect(addressBookAction, SIGNAL(triggered()), this, SLOT(gotoAddressBookPage()));

connect(savingsAction, SIGNAL(triggered()), this, SLOT(showNormalIfMinimized()));
connect(savingsAction, SIGNAL(triggered()), this, SLOT(savingsClicked()));

quitAction = new QAction(QIcon(":/icons/quit"), tr("E&xit"), this);
quitAction->setStatusTip(tr("Quit application"));
quitAction->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_Q));
Expand Down Expand Up @@ -346,7 +384,10 @@ void BitcoinGUI::createActions()
connect(verifyMessageAction, SIGNAL(triggered()), this, SLOT(gotoVerifyMessageTab()));
connect(unlockWalletAction, SIGNAL(triggered()), this, SLOT(unlockWalletForMint()));
connect(lockWalletAction, SIGNAL(triggered()), this, SLOT(lockWallet()));

connect(blockAction, SIGNAL(triggered()), this, SLOT(gotoBlockBrowser()));
connect(blocksIconAction, SIGNAL(triggered()), this, SLOT(blocksIconClicked()));
connect(connectionIconAction, SIGNAL(triggered()), this, SLOT(connectionIconClicked()));
connect(stakingIconAction, SIGNAL(triggered()), this, SLOT(stakingIconClicked()));
}

void BitcoinGUI::createMenuBar()
Expand Down Expand Up @@ -385,6 +426,13 @@ void BitcoinGUI::createMenuBar()
wallet->addAction(signMessageAction);
wallet->addAction(verifyMessageAction);

QMenu *network = appMenuBar->addMenu(tr("&Network"));
network->addAction(blockAction);
network->addSeparator();
network->addAction(blocksIconAction);
network->addAction(stakingIconAction);
network->addAction(connectionIconAction);


QMenu *help = appMenuBar->addMenu(tr("&Help"));
help->addAction(openRPCConsoleAction);
Expand All @@ -402,6 +450,7 @@ void BitcoinGUI::createToolBars()
toolbar->addAction(receiveCoinsAction);
toolbar->addAction(historyAction);
toolbar->addAction(addressBookAction);
toolbar->addAction(savingsAction);

QToolBar *toolbar2 = addToolBar(tr("Actions toolbar"));
toolbar2->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
Expand Down Expand Up @@ -472,6 +521,7 @@ void BitcoinGUI::setWalletModel(WalletModel *walletModel)
receiveCoinsPage->setModel(walletModel->getAddressTableModel());
sendCoinsPage->setModel(walletModel);
signVerifyMessageDialog->setModel(walletModel);
autoSavingsDialog->setModel(walletModel);

setEncryptionStatus(walletModel->getEncryptionStatus());
connect(walletModel, SIGNAL(encryptionStatusChanged(int)), this, SLOT(setEncryptionStatus(int)));
Expand Down Expand Up @@ -941,6 +991,14 @@ void BitcoinGUI::gotoAddressBookPage()
connect(exportAction, SIGNAL(triggered()), addressBookPage, SLOT(exportClicked()));
}

void BitcoinGUI::gotoBlockBrowser(QString transactionId)
{
if(!transactionId.isEmpty())
blockBrowser->setTransactionId(transactionId);

blockBrowser->show();
}

void BitcoinGUI::gotoReceiveCoinsPage()
{
receiveCoinsAction->setChecked(true);
Expand All @@ -960,6 +1018,18 @@ void BitcoinGUI::gotoSendCoinsPage()
disconnect(exportAction, SIGNAL(triggered()), 0, 0);
}

void BitcoinGUI::savingsClicked(QString addr)
{
savingsAction->setChecked(true);
centralWidget->setCurrentWidget(autoSavingsDialog);

if(!addr.isEmpty())
autoSavingsDialog->setAddress(addr);

exportAction->setEnabled(false);
disconnect(exportAction, SIGNAL(triggered()), 0, 0);
}

void BitcoinGUI::gotoSignMessageTab(QString addr)
{
// call show() in showTab_SM()
Expand Down
12 changes: 12 additions & 0 deletions src/qt/bitcoingui.h
Expand Up @@ -14,6 +14,8 @@ class SendCoinsDialog;
class SignVerifyMessageDialog;
class Notificator;
class RPCConsole;
class AutoSavingsDialog;
class BlockBrowser;

QT_BEGIN_NAMESPACE
class QLabel;
Expand Down Expand Up @@ -66,6 +68,8 @@ class BitcoinGUI : public QMainWindow
AddressBookPage *receiveCoinsPage;
SendCoinsDialog *sendCoinsPage;
SignVerifyMessageDialog *signVerifyMessageDialog;
AutoSavingsDialog *autoSavingsDialog;
BlockBrowser *blockBrowser;

QLabel *labelEncryptionIcon;
QLabel *labelStakingIcon;
Expand Down Expand Up @@ -98,6 +102,11 @@ class BitcoinGUI : public QMainWindow
QAction *changePassphraseAction;
QAction *aboutQtAction;
QAction *openRPCConsoleAction;
QAction *savingsAction;
QAction *blockAction;
QAction *blocksIconAction;
QAction *connectionIconAction;
QAction *stakingIconAction;

QSystemTrayIcon *trayIcon;
Notificator *notificator;
Expand Down Expand Up @@ -159,6 +168,8 @@ private slots:
void gotoReceiveCoinsPage();
/** Switch to send coins page */
void gotoSendCoinsPage();
/** Switch to block browser page */
void gotoBlockBrowser(QString transactionId = "");

/** Show Sign/Verify Message dialog and switch to sign message tab */
void gotoSignMessageTab(QString addr = "");
Expand Down Expand Up @@ -208,6 +219,7 @@ private slots:
void lockWallet();
/** Give user information about staking */
void updateStakingIcon();
void savingsClicked(QString addr = "");

/** Show window if hidden, unminimize when minimized, rise when obscured or show if hidden and fToggleHidden is true */
void showNormalIfMinimized(bool fToggleHidden = false);
Expand Down

0 comments on commit e1d17f0

Please sign in to comment.