Skip to content

Commit

Permalink
PortUI-0.0.10 - bitcoingui code
Browse files Browse the repository at this point in the history
  • Loading branch information
zathras-crypto committed Mar 26, 2015
1 parent a2b5d39 commit 1089c95
Show file tree
Hide file tree
Showing 2 changed files with 77 additions and 8 deletions.
74 changes: 66 additions & 8 deletions src/qt/bitcoingui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,9 @@
#include <QDesktopWidget>
#include <QDragEnterEvent>
#include <QIcon>
#include <QLabel>
#include <QListWidget>
#include <QMenu>
#include <QMenuBar>
#include <QMessageBox>
#include <QMimeData>
Expand Down Expand Up @@ -98,9 +100,9 @@ BitcoinGUI::BitcoinGUI(const NetworkStyle *networkStyle, QWidget *parent) :
prevBlocks(0),
spinnerFrame(0)
{
GUIUtil::restoreWindowGeometry("nWindow", QSize(850, 550), this);
GUIUtil::restoreWindowGeometry("nWindow", QSize(850, 650), this);

QString windowTitle = tr("Bitcoin Core") + " - ";
QString windowTitle = tr("Omni Core") + " - ";
#ifdef ENABLE_WALLET
/* if compiled with wallet support, -disablewallet can still disable the wallet */
enableWallet = !GetBoolArg("-disablewallet", false);
Expand Down Expand Up @@ -232,7 +234,7 @@ BitcoinGUI::~BitcoinGUI()
trayIcon->hide();
#ifdef Q_OS_MAC
delete appMenuBar;
MacDockIconHandler::cleanup();
MacDockIconHandler::instance()->setMainWindow(NULL);
#endif
}

Expand All @@ -247,38 +249,65 @@ void BitcoinGUI::createActions(const NetworkStyle *networkStyle)
overviewAction->setShortcut(QKeySequence(Qt::ALT + Qt::Key_1));
tabGroup->addAction(overviewAction);

balancesAction = new QAction(QIcon(":/icons/balances"), tr("&Balances"), this);
balancesAction->setStatusTip(tr("Show Omni Layer balances"));
balancesAction->setToolTip(balancesAction->statusTip());
balancesAction->setCheckable(true);
balancesAction->setShortcut(QKeySequence(Qt::ALT + Qt::Key_2));
tabGroup->addAction(balancesAction);

sendCoinsAction = new QAction(QIcon(":/icons/send"), tr("&Send"), this);
sendCoinsAction->setStatusTip(tr("Send coins to a Bitcoin address"));
sendCoinsAction->setStatusTip(tr("Send Omni Layer and Bitcoin transactions"));
sendCoinsAction->setToolTip(sendCoinsAction->statusTip());
sendCoinsAction->setCheckable(true);
sendCoinsAction->setShortcut(QKeySequence(Qt::ALT + Qt::Key_2));
sendCoinsAction->setShortcut(QKeySequence(Qt::ALT + Qt::Key_3));
tabGroup->addAction(sendCoinsAction);

receiveCoinsAction = new QAction(QIcon(":/icons/receiving_addresses"), tr("&Receive"), this);
receiveCoinsAction->setStatusTip(tr("Request payments (generates QR codes and bitcoin: URIs)"));
receiveCoinsAction->setToolTip(receiveCoinsAction->statusTip());
receiveCoinsAction->setCheckable(true);
receiveCoinsAction->setShortcut(QKeySequence(Qt::ALT + Qt::Key_3));
receiveCoinsAction->setShortcut(QKeySequence(Qt::ALT + Qt::Key_4));
tabGroup->addAction(receiveCoinsAction);

exchangeAction = new QAction(QIcon(":/icons/exchange"), tr("&Exchange"), this);
exchangeAction->setStatusTip(tr("Trade properties on the distributed exchange"));
exchangeAction->setToolTip(exchangeAction->statusTip());
exchangeAction->setCheckable(true);
exchangeAction->setShortcut(QKeySequence(Qt::ALT + Qt::Key_5));
tabGroup->addAction(exchangeAction);

historyAction = new QAction(QIcon(":/icons/history"), tr("&Transactions"), this);
historyAction->setStatusTip(tr("Browse transaction history"));
historyAction->setToolTip(historyAction->statusTip());
historyAction->setCheckable(true);
historyAction->setShortcut(QKeySequence(Qt::ALT + Qt::Key_4));
historyAction->setShortcut(QKeySequence(Qt::ALT + Qt::Key_6));
tabGroup->addAction(historyAction);

toolboxAction = new QAction(QIcon(":/icons/toolbox"), tr("&Toolbox"), this);
toolboxAction->setStatusTip(tr("Tools to obtain varions Omni Layer information and transaction information"));
toolboxAction->setToolTip(toolboxAction->statusTip());
toolboxAction->setCheckable(true);
toolboxAction->setShortcut(QKeySequence(Qt::ALT + Qt::Key_7));
tabGroup->addAction(toolboxAction);

#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.
connect(overviewAction, SIGNAL(triggered()), this, SLOT(showNormalIfMinimized()));
connect(overviewAction, SIGNAL(triggered()), this, SLOT(gotoOverviewPage()));
connect(balancesAction, SIGNAL(triggered()), this, SLOT(showNormalIfMinimized()));
connect(balancesAction, SIGNAL(triggered()), this, SLOT(gotoBalancesPage()));
connect(sendCoinsAction, SIGNAL(triggered()), this, SLOT(showNormalIfMinimized()));
connect(sendCoinsAction, SIGNAL(triggered()), this, SLOT(gotoSendCoinsPage()));
connect(receiveCoinsAction, SIGNAL(triggered()), this, SLOT(showNormalIfMinimized()));
connect(receiveCoinsAction, SIGNAL(triggered()), this, SLOT(gotoReceiveCoinsPage()));
connect(historyAction, SIGNAL(triggered()), this, SLOT(showNormalIfMinimized()));
connect(historyAction, SIGNAL(triggered()), this, SLOT(gotoHistoryPage()));
connect(exchangeAction, SIGNAL(triggered()), this, SLOT(showNormalIfMinimized()));
connect(exchangeAction, SIGNAL(triggered()), this, SLOT(gotoExchangePage()));
connect(toolboxAction, SIGNAL(triggered()), this, SLOT(showNormalIfMinimized()));
connect(toolboxAction, SIGNAL(triggered()), this, SLOT(gotoToolboxPage()));
#endif // ENABLE_WALLET

quitAction = new QAction(QIcon(":/icons/quit"), tr("E&xit"), this);
Expand Down Expand Up @@ -325,7 +354,6 @@ void BitcoinGUI::createActions(const NetworkStyle *networkStyle)
openAction->setStatusTip(tr("Open a bitcoin: URI or payment request"));

showHelpMessageAction = new QAction(QApplication::style()->standardIcon(QStyle::SP_MessageBoxInformation), tr("&Command-line options"), this);
showHelpMessageAction->setMenuRole(QAction::NoRole);
showHelpMessageAction->setStatusTip(tr("Show the Bitcoin Core help message to get a list with possible Bitcoin command-line options"));

connect(quitAction, SIGNAL(triggered()), qApp, SLOT(quit()));
Expand Down Expand Up @@ -401,9 +429,12 @@ void BitcoinGUI::createToolBars()
QToolBar *toolbar = addToolBar(tr("Tabs toolbar"));
toolbar->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
toolbar->addAction(overviewAction);
toolbar->addAction(balancesAction);
toolbar->addAction(sendCoinsAction);
toolbar->addAction(receiveCoinsAction);
toolbar->addAction(exchangeAction);
toolbar->addAction(historyAction);
toolbar->addAction(toolboxAction);
overviewAction->setChecked(true);
}
}
Expand Down Expand Up @@ -477,9 +508,12 @@ void BitcoinGUI::removeAllWallets()
void BitcoinGUI::setWalletActionsEnabled(bool enabled)
{
overviewAction->setEnabled(enabled);
balancesAction->setEnabled(enabled);
sendCoinsAction->setEnabled(enabled);
receiveCoinsAction->setEnabled(enabled);
exchangeAction->setEnabled(enabled);
historyAction->setEnabled(enabled);
toolboxAction->setEnabled(enabled);
encryptWalletAction->setEnabled(enabled);
backupWalletAction->setEnabled(enabled);
changePassphraseAction->setEnabled(enabled);
Expand Down Expand Up @@ -592,12 +626,30 @@ void BitcoinGUI::gotoOverviewPage()
if (walletFrame) walletFrame->gotoOverviewPage();
}

void BitcoinGUI::gotoBalancesPage()
{
balancesAction->setChecked(true);
if (walletFrame) walletFrame->gotoBalancesPage();
}

void BitcoinGUI::gotoHistoryPage()
{
historyAction->setChecked(true);
if (walletFrame) walletFrame->gotoHistoryPage();
}

void BitcoinGUI::gotoBitcoinHistoryTab()
{
historyAction->setChecked(true);
if (walletFrame) walletFrame->gotoBitcoinHistoryTab();
}

void BitcoinGUI::gotoToolboxPage()
{
toolboxAction->setChecked(true);
if (walletFrame) walletFrame->gotoToolboxPage();
}

void BitcoinGUI::gotoReceiveCoinsPage()
{
receiveCoinsAction->setChecked(true);
Expand All @@ -610,6 +662,12 @@ void BitcoinGUI::gotoSendCoinsPage(QString addr)
if (walletFrame) walletFrame->gotoSendCoinsPage(addr);
}

void BitcoinGUI::gotoExchangePage()
{
exchangeAction->setChecked(true);
// if (walletFrame) walletFrame->gotoExchangePage();
}

void BitcoinGUI::gotoSignMessageTab(QString addr)
{
if (walletFrame) walletFrame->gotoSignMessageTab(addr);
Expand Down
11 changes: 11 additions & 0 deletions src/qt/bitcoingui.h
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,11 @@ class BitcoinGUI : public QMainWindow

QMenuBar *appMenuBar;
QAction *overviewAction;
QAction *balancesAction;
QAction *historyAction;
QAction *quitAction;
QAction *toolboxAction;
QAction *exchangeAction;
QAction *sendCoinsAction;
QAction *usedSendingAddressesAction;
QAction *usedReceivingAddressesAction;
Expand Down Expand Up @@ -170,8 +173,16 @@ private slots:
#ifdef ENABLE_WALLET
/** Switch to overview (home) page */
void gotoOverviewPage();
/** Switch to balances page */
void gotoBalancesPage();
/** Switch to history (transactions) page */
void gotoHistoryPage();
/** Switch directly to bitcoin history tab */
void gotoBitcoinHistoryTab();
/** Switch to utility page */
void gotoToolboxPage();
/** Switch to exchange page */
void gotoExchangePage();
/** Switch to receive coins page */
void gotoReceiveCoinsPage();
/** Switch to send coins page */
Expand Down

0 comments on commit 1089c95

Please sign in to comment.