tab reorg phase 1: split main gui into "overview" and "history"
This commit is contained in:
parent
825aa7d8d8
commit
64c8b69948
10 changed files with 186 additions and 21 deletions
|
@ -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
|
||||
|
|
|
@ -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#
|
||||
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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 */
|
||||
overviewPage = new OverviewPage();
|
||||
|
||||
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);
|
||||
|
||||
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);
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
63
src/qt/forms/overviewpage.ui
Normal file
63
src/qt/forms/overviewpage.ui
Normal file
|
@ -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>
|
32
src/qt/overviewpage.cpp
Normal file
32
src/qt/overviewpage.cpp
Normal file
|
@ -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"));
|
||||
}
|
26
src/qt/overviewpage.h
Normal file
26
src/qt/overviewpage.h
Normal file
|
@ -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
|
BIN
src/qt/res/icons/history.png
Normal file
BIN
src/qt/res/icons/history.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 746 B |
BIN
src/qt/res/icons/overview.png
Normal file
BIN
src/qt/res/icons/overview.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 6.9 KiB |
Loading…
Reference in a new issue