diff options
-rw-r--r-- | bitcoin-qt.pro | 9 | ||||
-rw-r--r-- | doc/assets-attribution.txt | 8 | ||||
-rw-r--r-- | src/qt/bitcoin.qrc | 2 | ||||
-rw-r--r-- | src/qt/bitcoingui.cpp | 57 | ||||
-rw-r--r-- | src/qt/bitcoingui.h | 12 | ||||
-rw-r--r-- | src/qt/forms/overviewpage.ui | 63 | ||||
-rw-r--r-- | src/qt/overviewpage.cpp | 32 | ||||
-rw-r--r-- | src/qt/overviewpage.h | 26 | ||||
-rw-r--r-- | src/qt/res/icons/history.png | bin | 0 -> 746 bytes | |||
-rw-r--r-- | src/qt/res/icons/overview.png | bin | 0 -> 7015 bytes |
10 files changed, 187 insertions, 22 deletions
diff --git a/bitcoin-qt.pro b/bitcoin-qt.pro index 40c0ded6ce..a8705c369f 100644 --- a/bitcoin-qt.pro +++ b/bitcoin-qt.pro @@ -76,7 +76,8 @@ HEADERS += src/qt/bitcoingui.h \ src/qt/transactionfilterproxy.h \ src/qt/transactionview.h \ src/qt/walletmodel.h \ - src/bitcoinrpc.h + src/bitcoinrpc.h \ + src/qt/overviewpage.h SOURCES += src/qt/bitcoin.cpp src/qt/bitcoingui.cpp \ src/qt/transactiontablemodel.cpp \ src/qt/addresstablemodel.cpp \ @@ -112,7 +113,8 @@ SOURCES += src/qt/bitcoin.cpp src/qt/bitcoingui.cpp \ src/qt/transactionfilterproxy.cpp \ src/qt/transactionview.cpp \ src/qt/walletmodel.cpp \ - src/bitcoinrpc.cpp + src/bitcoinrpc.cpp \ + src/qt/overviewpage.cpp RESOURCES += \ src/qt/bitcoin.qrc @@ -122,7 +124,8 @@ FORMS += \ src/qt/forms/addressbookdialog.ui \ src/qt/forms/aboutdialog.ui \ src/qt/forms/editaddressdialog.ui \ - src/qt/forms/transactiondescdialog.ui + src/qt/forms/transactiondescdialog.ui \ + src/qt/forms/overviewpage.ui CODECFORTR = UTF-8 TRANSLATIONS = src/qt/locale/bitcoin_nl.ts diff --git a/doc/assets-attribution.txt b/doc/assets-attribution.txt index f34c2c91b1..d4eb848820 100644 --- a/doc/assets-attribution.txt +++ b/doc/assets-attribution.txt @@ -34,7 +34,7 @@ Designer: http://www.everaldo.com Icon Pack: Crystal SVG License: LGPL -Icon: src/qt/res/icons/receive.png +Icon: src/qt/res/icons/receive.png, src/qt/res/icons/history.png Designer: Oxygen team Icon Pack: Oxygen License: Creative Common Attribution-ShareAlike 3.0 License or LGPL @@ -45,3 +45,9 @@ Designer: Bitboy (optimized for 16x16 by Wladimir van der Laan) License: Public Domain Site: http://forum.bitcoin.org/?topic=1756.0 +Icon: src/qt/res/icons/overview.png +Icon Pack: Primo +Designer: Jack Cai +License: Creative Commons Attribution No Derivatives (by-nd) +Site: http://findicons.com/icon/175944/home?id=176221# + diff --git a/src/qt/bitcoin.qrc b/src/qt/bitcoin.qrc index 2dfc7dd987..20ecd9f302 100644 --- a/src/qt/bitcoin.qrc +++ b/src/qt/bitcoin.qrc @@ -26,6 +26,8 @@ <file alias="toolbar_testnet">res/icons/toolbar_testnet.png</file> <file alias="edit">res/icons/edit.png</file> <file alias="editdelete">res/icons/editdelete.png</file> + <file alias="history">res/icons/history.png</file> + <file alias="overview">res/icons/overview.png</file> </qresource> <qresource prefix="/images"> <file alias="about">res/images/about.png</file> diff --git a/src/qt/bitcoingui.cpp b/src/qt/bitcoingui.cpp index cd9291ac60..bf4aa320f4 100644 --- a/src/qt/bitcoingui.cpp +++ b/src/qt/bitcoingui.cpp @@ -17,6 +17,7 @@ #include "transactiondescdialog.h" #include "addresstablemodel.h" #include "transactionview.h" +#include "overviewpage.h" #include <QApplication> #include <QMainWindow> @@ -33,6 +34,7 @@ #include <QLocale> #include <QMessageBox> #include <QProgressBar> +#include <QStackedWidget> #include <QDebug> @@ -66,32 +68,28 @@ BitcoinGUI::BitcoinGUI(QWidget *parent): // Toolbar QToolBar *toolbar = addToolBar("Main toolbar"); toolbar->setToolButtonStyle(Qt::ToolButtonTextBesideIcon); + toolbar->addAction(overviewAction); + toolbar->addAction(historyAction); + toolbar->addSeparator(); toolbar->addAction(sendCoins); toolbar->addAction(receiveCoins); toolbar->addAction(addressbook); - // Balance: <balance> - QHBoxLayout *hbox_balance = new QHBoxLayout(); - hbox_balance->addWidget(new QLabel(tr("Balance:"))); - hbox_balance->addSpacing(5);/* Add some spacing between the label and the text */ - - labelBalance = new QLabel(); - labelBalance->setFont(QFont("Monospace", -1, QFont::Bold)); - labelBalance->setToolTip(tr("Your current balance")); - labelBalance->setTextInteractionFlags(Qt::TextSelectableByMouse|Qt::TextSelectableByKeyboard); - hbox_balance->addWidget(labelBalance); - hbox_balance->addStretch(1); - + overviewPage = new OverviewPage(); + QVBoxLayout *vbox = new QVBoxLayout(); - vbox->addLayout(hbox_balance); transactionView = new TransactionView(this); connect(transactionView, SIGNAL(doubleClicked(const QModelIndex&)), this, SLOT(transactionDetails(const QModelIndex&))); vbox->addWidget(transactionView); - QWidget *centralwidget = new QWidget(this); - centralwidget->setLayout(vbox); - setCentralWidget(centralwidget); + transactionsPage = new QWidget(this); + transactionsPage->setLayout(vbox); + + centralWidget = new QStackedWidget(this); + centralWidget->addWidget(overviewPage); + centralWidget->addWidget(transactionsPage); + setCentralWidget(centralWidget); // Create status bar statusBar(); @@ -125,10 +123,23 @@ BitcoinGUI::BitcoinGUI(QWidget *parent): statusBar()->addPermanentWidget(labelTransactions); createTrayIcon(); + + gotoOverviewTab(); } void BitcoinGUI::createActions() { + QActionGroup *tabGroup = new QActionGroup(this); + overviewAction = new QAction(QIcon(":/icons/overview"), tr("&Overview"), this); + overviewAction->setCheckable(true); + tabGroup->addAction(overviewAction); + historyAction = new QAction(QIcon(":/icons/history"), tr("&History"), this); + historyAction->setCheckable(true); + tabGroup->addAction(historyAction); + + connect(overviewAction, SIGNAL(triggered()), this, SLOT(gotoOverviewTab())); + connect(historyAction, SIGNAL(triggered()), this, SLOT(gotoHistoryTab())); + quit = new QAction(QIcon(":/icons/quit"), tr("&Exit"), this); quit->setToolTip(tr("Quit application")); sendCoins = new QAction(QIcon(":/icons/send"), tr("&Send coins"), this); @@ -267,7 +278,7 @@ void BitcoinGUI::aboutClicked() void BitcoinGUI::setBalance(qint64 balance) { - labelBalance->setText(GUIUtil::formatMoney(balance) + QString(" BTC")); + overviewPage->setBalance(balance); } void BitcoinGUI::setNumConnections(int count) @@ -399,3 +410,15 @@ void BitcoinGUI::incomingTransaction(const QModelIndex & parent, int start, int QSystemTrayIcon::Information); } } + +void BitcoinGUI::gotoOverviewTab() +{ + overviewAction->setChecked(true); + centralWidget->setCurrentWidget(overviewPage); +} + +void BitcoinGUI::gotoHistoryTab() +{ + historyAction->setChecked(true); + centralWidget->setCurrentWidget(transactionsPage); +} diff --git a/src/qt/bitcoingui.h b/src/qt/bitcoingui.h index 046186c562..432a9e3b04 100644 --- a/src/qt/bitcoingui.h +++ b/src/qt/bitcoingui.h @@ -8,6 +8,7 @@ class TransactionTableModel; class ClientModel; class WalletModel; class TransactionView; +class OverviewPage; QT_BEGIN_NAMESPACE class QLabel; @@ -16,6 +17,7 @@ class QTableView; class QAbstractItemModel; class QModelIndex; class QProgressBar; +class QStackedWidget; QT_END_NAMESPACE class BitcoinGUI : public QMainWindow @@ -42,7 +44,10 @@ private: ClientModel *clientModel; WalletModel *walletModel; - QLabel *labelBalance; + QStackedWidget *centralWidget; + OverviewPage *overviewPage; + QWidget *transactionsPage; + QLabel *labelConnections; QLabel *labelConnectionsIcon; QLabel *labelBlocks; @@ -50,6 +55,8 @@ private: QLabel *progressBarLabel; QProgressBar *progressBar; + QAction *overviewAction; + QAction *historyAction; QAction *quit; QAction *sendCoins; QAction *addressbook; @@ -86,6 +93,9 @@ private slots: void trayIconActivated(QSystemTrayIcon::ActivationReason reason); void transactionDetails(const QModelIndex& idx); void incomingTransaction(const QModelIndex & parent, int start, int end); + + void gotoOverviewTab(); + void gotoHistoryTab(); }; #endif diff --git a/src/qt/forms/overviewpage.ui b/src/qt/forms/overviewpage.ui new file mode 100644 index 0000000000..ef9c07306f --- /dev/null +++ b/src/qt/forms/overviewpage.ui @@ -0,0 +1,63 @@ +<?xml version="1.0" encoding="UTF-8"?> +<ui version="4.0"> + <class>OverviewPage</class> + <widget class="QWidget" name="OverviewPage"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>552</width> + <height>342</height> + </rect> + </property> + <property name="windowTitle"> + <string>Form</string> + </property> + <layout class="QVBoxLayout" name="verticalLayout_2"> + <item> + <widget class="QFrame" name="frame"> + <property name="frameShape"> + <enum>QFrame::StyledPanel</enum> + </property> + <property name="frameShadow"> + <enum>QFrame::Raised</enum> + </property> + <layout class="QFormLayout" name="formLayout_2"> + <property name="fieldGrowthPolicy"> + <enum>QFormLayout::AllNonFixedFieldsGrow</enum> + </property> + <item row="0" column="0"> + <widget class="QLabel" name="label"> + <property name="text"> + <string>Balance</string> + </property> + </widget> + </item> + <item row="0" column="1"> + <widget class="QLabel" name="labelBalance"> + <property name="text"> + <string>123.456 BTC</string> + </property> + </widget> + </item> + </layout> + </widget> + </item> + <item> + <spacer name="verticalSpacer"> + <property name="orientation"> + <enum>Qt::Vertical</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>20</width> + <height>40</height> + </size> + </property> + </spacer> + </item> + </layout> + </widget> + <resources/> + <connections/> +</ui> diff --git a/src/qt/overviewpage.cpp b/src/qt/overviewpage.cpp new file mode 100644 index 0000000000..faed29866a --- /dev/null +++ b/src/qt/overviewpage.cpp @@ -0,0 +1,32 @@ +#include "overviewpage.h" +#include "ui_overviewpage.h" + +#include "guiutil.h" + +OverviewPage::OverviewPage(QWidget *parent) : + QWidget(parent), + ui(new Ui::OverviewPage) +{ + ui->setupUi(this); + + // Balance: <balance> + ui->labelBalance->setFont(QFont("Monospace", -1, QFont::Bold)); + ui->labelBalance->setToolTip(tr("Your current balance")); + ui->labelBalance->setTextInteractionFlags(Qt::TextSelectableByMouse|Qt::TextSelectableByKeyboard); + + // Overview page should show: + // Balance + // Unconfirmed balance + // Last received transaction(s) + // Last sent transaction(s) +} + +OverviewPage::~OverviewPage() +{ + delete ui; +} + +void OverviewPage::setBalance(qint64 balance) +{ + ui->labelBalance->setText(GUIUtil::formatMoney(balance) + QString(" BTC")); +} diff --git a/src/qt/overviewpage.h b/src/qt/overviewpage.h new file mode 100644 index 0000000000..85b927b83f --- /dev/null +++ b/src/qt/overviewpage.h @@ -0,0 +1,26 @@ +#ifndef OVERVIEWPAGE_H +#define OVERVIEWPAGE_H + +#include <QWidget> + +namespace Ui { + class OverviewPage; +} + +class OverviewPage : public QWidget +{ + Q_OBJECT + +public: + explicit OverviewPage(QWidget *parent = 0); + ~OverviewPage(); + +public slots: + void setBalance(qint64 balance); + +private: + Ui::OverviewPage *ui; + +}; + +#endif // OVERVIEWPAGE_H diff --git a/src/qt/res/icons/history.png b/src/qt/res/icons/history.png Binary files differnew file mode 100644 index 0000000000..60f1351783 --- /dev/null +++ b/src/qt/res/icons/history.png diff --git a/src/qt/res/icons/overview.png b/src/qt/res/icons/overview.png Binary files differnew file mode 100644 index 0000000000..6b94b43a2c --- /dev/null +++ b/src/qt/res/icons/overview.png |