From 13740b7ed168780657f986ed2c3c90240315df9f Mon Sep 17 00:00:00 2001 From: "Wladimir J. van der Laan" Date: Mon, 9 May 2011 20:44:46 +0200 Subject: [PATCH] Use resource system --- AddressTableModel.cpp | 6 ++++++ AddressTableModel.h | 18 ++++++++++++++++++ BitcoinGUI.cpp | 24 +++++++++++++----------- bitcoin.pro | 9 +++++++-- bitcoin.qrc | 8 ++++++++ 5 files changed, 52 insertions(+), 13 deletions(-) create mode 100644 AddressTableModel.cpp create mode 100644 AddressTableModel.h create mode 100644 bitcoin.qrc diff --git a/AddressTableModel.cpp b/AddressTableModel.cpp new file mode 100644 index 0000000000..b25ee3e9ee --- /dev/null +++ b/AddressTableModel.cpp @@ -0,0 +1,6 @@ +#include "AddressTableModel.h" + +AddressTableModel::AddressTableModel(QObject *parent) : + QAbstractTableModel(parent) +{ +} diff --git a/AddressTableModel.h b/AddressTableModel.h new file mode 100644 index 0000000000..490452e11e --- /dev/null +++ b/AddressTableModel.h @@ -0,0 +1,18 @@ +#ifndef ADDRESSTABLEMODEL_H +#define ADDRESSTABLEMODEL_H + +#include + +class AddressTableModel : public QAbstractTableModel +{ + Q_OBJECT +public: + explicit AddressTableModel(QObject *parent = 0); + +signals: + +public slots: + +}; + +#endif // ADDRESSTABLEMODEL_H diff --git a/BitcoinGUI.cpp b/BitcoinGUI.cpp index f07b828098..3ee74a1e57 100644 --- a/BitcoinGUI.cpp +++ b/BitcoinGUI.cpp @@ -19,6 +19,7 @@ #include #include #include +#include #include @@ -27,12 +28,12 @@ BitcoinGUI::BitcoinGUI(QWidget *parent): { resize(850, 550); setWindowTitle("Bitcoin"); - setWindowIcon(QIcon("bitcoin.png")); + setWindowIcon(QIcon(":icons/bitcoin")); - QAction *quit = new QAction(QIcon("quit.png"), "&Quit", this); - QAction *sendcoins = new QAction(QIcon("send.png"), "&Send coins", this); - QAction *addressbook = new QAction(QIcon("address-book.png"), "&Address book", this); - QAction *about = new QAction(QIcon("bitcoin.png"), "&About", this); + QAction *quit = new QAction(QIcon(":/icons/quit"), "&Quit", this); + QAction *sendcoins = new QAction(QIcon(":/icons/send"), "&Send coins", this); + QAction *addressbook = new QAction(QIcon(":/icons/address-book"), "&Address book", this); + QAction *about = new QAction(QIcon(":/icons/bitcoin"), "&About", this); /* Menus */ QMenu *file = menuBar()->addMenu("&File"); @@ -66,9 +67,10 @@ BitcoinGUI::BitcoinGUI(QWidget *parent): /* Balance: */ QHBoxLayout *hbox_balance = new QHBoxLayout(); - hbox_balance->addWidget(new QLabel("Balance:")); + hbox_balance->addWidget(new QLabel(tr("Balance:"))); hbox_balance->addSpacing(5);/* Add some spacing between the label and the text */ - QLabel *label_balance = new QLabel("1,234.54"); + + QLabel *label_balance = new QLabel(QLocale::system().toString(1345.54)); /* TODO: use locale to format amount */ label_balance->setFont(QFont("Teletype")); hbox_balance->addWidget(label_balance); hbox_balance->addStretch(1); @@ -106,10 +108,10 @@ BitcoinGUI::BitcoinGUI(QWidget *parent): /* TODO: alignment; debit/credit columns must align right */ QTabBar *tabs = new QTabBar(this); - tabs->addTab("All transactions"); - tabs->addTab("Sent/Received"); - tabs->addTab("Sent"); - tabs->addTab("Received"); + tabs->addTab(tr("All transactions")); + tabs->addTab(tr("Sent/Received")); + tabs->addTab(tr("Sent")); + tabs->addTab(tr("Received")); vbox->addWidget(tabs); vbox->addWidget(transaction_table); diff --git a/bitcoin.pro b/bitcoin.pro index 4f794ac693..b28b45f448 100644 --- a/bitcoin.pro +++ b/bitcoin.pro @@ -13,10 +13,15 @@ HEADERS += BitcoinGUI.h \ SendCoinsDialog.h \ SettingsDialog.h \ AddressBookDialog.h \ - AboutDialog.h + AboutDialog.h \ + AddressTableModel.h SOURCES += bitcoin.cpp BitcoinGUI.cpp \ TransactionTableModel.cpp \ SendCoinsDialog.cpp \ SettingsDialog.cpp \ AddressBookDialog.cpp \ - AboutDialog.cpp + AboutDialog.cpp \ + AddressTableModel.cpp + +RESOURCES += \ + bitcoin.qrc diff --git a/bitcoin.qrc b/bitcoin.qrc new file mode 100644 index 0000000000..ebce276c8d --- /dev/null +++ b/bitcoin.qrc @@ -0,0 +1,8 @@ + + + res/icons/address-book.png + res/icons/bitcoin.png + res/icons/quit.png + res/icons/send.png + +