Browse Source

tab reorg phase 1: split main gui into "overview" and "history"

miguelfreitas
Wladimir J. van der Laan 14 years ago
parent
commit
64c8b69948
  1. 9
      bitcoin-qt.pro
  2. 8
      doc/assets-attribution.txt
  3. 2
      src/qt/bitcoin.qrc
  4. 55
      src/qt/bitcoingui.cpp
  5. 12
      src/qt/bitcoingui.h
  6. 63
      src/qt/forms/overviewpage.ui
  7. 32
      src/qt/overviewpage.cpp
  8. 26
      src/qt/overviewpage.h
  9. BIN
      src/qt/res/icons/history.png
  10. BIN
      src/qt/res/icons/overview.png

9
bitcoin-qt.pro

@ -76,7 +76,8 @@ HEADERS += src/qt/bitcoingui.h \
src/qt/transactionfilterproxy.h \ src/qt/transactionfilterproxy.h \
src/qt/transactionview.h \ src/qt/transactionview.h \
src/qt/walletmodel.h \ src/qt/walletmodel.h \
src/bitcoinrpc.h src/bitcoinrpc.h \
src/qt/overviewpage.h
SOURCES += src/qt/bitcoin.cpp src/qt/bitcoingui.cpp \ SOURCES += src/qt/bitcoin.cpp src/qt/bitcoingui.cpp \
src/qt/transactiontablemodel.cpp \ src/qt/transactiontablemodel.cpp \
src/qt/addresstablemodel.cpp \ src/qt/addresstablemodel.cpp \
@ -112,7 +113,8 @@ SOURCES += src/qt/bitcoin.cpp src/qt/bitcoingui.cpp \
src/qt/transactionfilterproxy.cpp \ src/qt/transactionfilterproxy.cpp \
src/qt/transactionview.cpp \ src/qt/transactionview.cpp \
src/qt/walletmodel.cpp \ src/qt/walletmodel.cpp \
src/bitcoinrpc.cpp src/bitcoinrpc.cpp \
src/qt/overviewpage.cpp
RESOURCES += \ RESOURCES += \
src/qt/bitcoin.qrc src/qt/bitcoin.qrc
@ -122,7 +124,8 @@ FORMS += \
src/qt/forms/addressbookdialog.ui \ src/qt/forms/addressbookdialog.ui \
src/qt/forms/aboutdialog.ui \ src/qt/forms/aboutdialog.ui \
src/qt/forms/editaddressdialog.ui \ src/qt/forms/editaddressdialog.ui \
src/qt/forms/transactiondescdialog.ui src/qt/forms/transactiondescdialog.ui \
src/qt/forms/overviewpage.ui
CODECFORTR = UTF-8 CODECFORTR = UTF-8
TRANSLATIONS = src/qt/locale/bitcoin_nl.ts TRANSLATIONS = src/qt/locale/bitcoin_nl.ts

8
doc/assets-attribution.txt

@ -34,7 +34,7 @@ Designer: http://www.everaldo.com
Icon Pack: Crystal SVG Icon Pack: Crystal SVG
License: LGPL 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 Designer: Oxygen team
Icon Pack: Oxygen Icon Pack: Oxygen
License: Creative Common Attribution-ShareAlike 3.0 License or LGPL 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 License: Public Domain
Site: http://forum.bitcoin.org/?topic=1756.0 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#

2
src/qt/bitcoin.qrc

@ -26,6 +26,8 @@
<file alias="toolbar_testnet">res/icons/toolbar_testnet.png</file> <file alias="toolbar_testnet">res/icons/toolbar_testnet.png</file>
<file alias="edit">res/icons/edit.png</file> <file alias="edit">res/icons/edit.png</file>
<file alias="editdelete">res/icons/editdelete.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>
<qresource prefix="/images"> <qresource prefix="/images">
<file alias="about">res/images/about.png</file> <file alias="about">res/images/about.png</file>

55
src/qt/bitcoingui.cpp

@ -17,6 +17,7 @@
#include "transactiondescdialog.h" #include "transactiondescdialog.h"
#include "addresstablemodel.h" #include "addresstablemodel.h"
#include "transactionview.h" #include "transactionview.h"
#include "overviewpage.h"
#include <QApplication> #include <QApplication>
#include <QMainWindow> #include <QMainWindow>
@ -33,6 +34,7 @@
#include <QLocale> #include <QLocale>
#include <QMessageBox> #include <QMessageBox>
#include <QProgressBar> #include <QProgressBar>
#include <QStackedWidget>
#include <QDebug> #include <QDebug>
@ -66,32 +68,28 @@ BitcoinGUI::BitcoinGUI(QWidget *parent):
// Toolbar // Toolbar
QToolBar *toolbar = addToolBar("Main toolbar"); QToolBar *toolbar = addToolBar("Main toolbar");
toolbar->setToolButtonStyle(Qt::ToolButtonTextBesideIcon); toolbar->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
toolbar->addAction(overviewAction);
toolbar->addAction(historyAction);
toolbar->addSeparator();
toolbar->addAction(sendCoins); toolbar->addAction(sendCoins);
toolbar->addAction(receiveCoins); toolbar->addAction(receiveCoins);
toolbar->addAction(addressbook); toolbar->addAction(addressbook);
// Balance: <balance> overviewPage = new OverviewPage();
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);
QVBoxLayout *vbox = new QVBoxLayout(); QVBoxLayout *vbox = new QVBoxLayout();
vbox->addLayout(hbox_balance);
transactionView = new TransactionView(this); transactionView = new TransactionView(this);
connect(transactionView, SIGNAL(doubleClicked(const QModelIndex&)), this, SLOT(transactionDetails(const QModelIndex&))); connect(transactionView, SIGNAL(doubleClicked(const QModelIndex&)), this, SLOT(transactionDetails(const QModelIndex&)));
vbox->addWidget(transactionView); vbox->addWidget(transactionView);
QWidget *centralwidget = new QWidget(this); transactionsPage = new QWidget(this);
centralwidget->setLayout(vbox); transactionsPage->setLayout(vbox);
setCentralWidget(centralwidget);
centralWidget = new QStackedWidget(this);
centralWidget->addWidget(overviewPage);
centralWidget->addWidget(transactionsPage);
setCentralWidget(centralWidget);
// Create status bar // Create status bar
statusBar(); statusBar();
@ -125,10 +123,23 @@ BitcoinGUI::BitcoinGUI(QWidget *parent):
statusBar()->addPermanentWidget(labelTransactions); statusBar()->addPermanentWidget(labelTransactions);
createTrayIcon(); createTrayIcon();
gotoOverviewTab();
} }
void BitcoinGUI::createActions() 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 = new QAction(QIcon(":/icons/quit"), tr("&Exit"), this);
quit->setToolTip(tr("Quit application")); quit->setToolTip(tr("Quit application"));
sendCoins = new QAction(QIcon(":/icons/send"), tr("&Send coins"), this); sendCoins = new QAction(QIcon(":/icons/send"), tr("&Send coins"), this);
@ -267,7 +278,7 @@ void BitcoinGUI::aboutClicked()
void BitcoinGUI::setBalance(qint64 balance) void BitcoinGUI::setBalance(qint64 balance)
{ {
labelBalance->setText(GUIUtil::formatMoney(balance) + QString(" BTC")); overviewPage->setBalance(balance);
} }
void BitcoinGUI::setNumConnections(int count) void BitcoinGUI::setNumConnections(int count)
@ -399,3 +410,15 @@ void BitcoinGUI::incomingTransaction(const QModelIndex & parent, int start, int
QSystemTrayIcon::Information); QSystemTrayIcon::Information);
} }
} }
void BitcoinGUI::gotoOverviewTab()
{
overviewAction->setChecked(true);
centralWidget->setCurrentWidget(overviewPage);
}
void BitcoinGUI::gotoHistoryTab()
{
historyAction->setChecked(true);
centralWidget->setCurrentWidget(transactionsPage);
}

12
src/qt/bitcoingui.h

@ -8,6 +8,7 @@ class TransactionTableModel;
class ClientModel; class ClientModel;
class WalletModel; class WalletModel;
class TransactionView; class TransactionView;
class OverviewPage;
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
class QLabel; class QLabel;
@ -16,6 +17,7 @@ class QTableView;
class QAbstractItemModel; class QAbstractItemModel;
class QModelIndex; class QModelIndex;
class QProgressBar; class QProgressBar;
class QStackedWidget;
QT_END_NAMESPACE QT_END_NAMESPACE
class BitcoinGUI : public QMainWindow class BitcoinGUI : public QMainWindow
@ -42,7 +44,10 @@ private:
ClientModel *clientModel; ClientModel *clientModel;
WalletModel *walletModel; WalletModel *walletModel;
QLabel *labelBalance; QStackedWidget *centralWidget;
OverviewPage *overviewPage;
QWidget *transactionsPage;
QLabel *labelConnections; QLabel *labelConnections;
QLabel *labelConnectionsIcon; QLabel *labelConnectionsIcon;
QLabel *labelBlocks; QLabel *labelBlocks;
@ -50,6 +55,8 @@ private:
QLabel *progressBarLabel; QLabel *progressBarLabel;
QProgressBar *progressBar; QProgressBar *progressBar;
QAction *overviewAction;
QAction *historyAction;
QAction *quit; QAction *quit;
QAction *sendCoins; QAction *sendCoins;
QAction *addressbook; QAction *addressbook;
@ -86,6 +93,9 @@ private slots:
void trayIconActivated(QSystemTrayIcon::ActivationReason reason); void trayIconActivated(QSystemTrayIcon::ActivationReason reason);
void transactionDetails(const QModelIndex& idx); void transactionDetails(const QModelIndex& idx);
void incomingTransaction(const QModelIndex & parent, int start, int end); void incomingTransaction(const QModelIndex & parent, int start, int end);
void gotoOverviewTab();
void gotoHistoryTab();
}; };
#endif #endif

63
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>

32
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"));
}

26
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

BIN
src/qt/res/icons/history.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 746 B

BIN
src/qt/res/icons/overview.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.9 KiB

Loading…
Cancel
Save