From aaa1c3c4001d4931299d674ef4146d8201dae634 Mon Sep 17 00:00:00 2001 From: "Wladimir J. van der Laan" Date: Sat, 7 May 2011 22:13:39 +0200 Subject: [PATCH] initial commit --- .gitignore | 2 + BitcoinGUI.cpp | 133 +++++++++++++++++++++++++++++++++++++++++++++ BitcoinGUI.h | 23 ++++++++ TODO | 50 +++++++++++++++++ address-book.png | Bin 0 -> 656 bytes bitcoin.cpp | 17 ++++++ bitcoin.png | Bin 0 -> 1086 bytes bitcoin.pro | 12 ++++ moc_BitcoinGUI.cpp | 79 +++++++++++++++++++++++++++ quit.png | Bin 0 -> 876 bytes send.png | Bin 0 -> 946 bytes 11 files changed, 316 insertions(+) create mode 100644 .gitignore create mode 100644 BitcoinGUI.cpp create mode 100644 BitcoinGUI.h create mode 100644 TODO create mode 100644 address-book.png create mode 100644 bitcoin.cpp create mode 100644 bitcoin.png create mode 100644 bitcoin.pro create mode 100644 moc_BitcoinGUI.cpp create mode 100644 quit.png create mode 100644 send.png diff --git a/.gitignore b/.gitignore new file mode 100644 index 000000000..d6ff91a9e --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +*~ +*.o diff --git a/BitcoinGUI.cpp b/BitcoinGUI.cpp new file mode 100644 index 000000000..b18a18b88 --- /dev/null +++ b/BitcoinGUI.cpp @@ -0,0 +1,133 @@ +/* + * W.J. van der Laan 2011 + */ +#include "BitcoinGUI.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +BitcoinGUI::BitcoinGUI(QWidget *parent): + QMainWindow(parent) +{ + resize(850, 550); + setWindowTitle("Bitcoin"); + setWindowIcon(QIcon("bitcoin.png")); + + + 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); + + /* Menus */ + QMenu *file = menuBar()->addMenu("&File"); + file->addAction(sendcoins); + file->addSeparator(); + file->addAction(quit); + + QMenu *settings = menuBar()->addMenu("&Settings"); + settings->addAction(addressbook); + + QMenu *help = menuBar()->addMenu("&Help"); + help->addAction(about); + + /* Toolbar */ + QToolBar *toolbar = addToolBar("Main toolbar"); + toolbar->setToolButtonStyle(Qt::ToolButtonTextBesideIcon); + toolbar->addAction(sendcoins); + toolbar->addAction(addressbook); + + /* Address:
: New... : Paste to clipboard */ + QHBoxLayout *hbox_address = new QHBoxLayout(); + hbox_address->addWidget(new QLabel("Your Bitcoin Address:")); + QLineEdit *edit_address = new QLineEdit(); + edit_address->setReadOnly(true); + hbox_address->addWidget(edit_address); + + QPushButton *button_new = new QPushButton(trUtf8("&New\u2026")); + QPushButton *button_clipboard = new QPushButton("&Copy to clipboard"); + hbox_address->addWidget(button_new); + hbox_address->addWidget(button_clipboard); + + /* Balance: */ + QHBoxLayout *hbox_balance = new QHBoxLayout(); + hbox_balance->addWidget(new QLabel("Balance:")); + hbox_balance->addSpacing(5);/* Add some spacing between the label and the text */ + QLabel *label_balance = new QLabel("1,234.54"); + label_balance->setFont(QFont("Teletype")); + hbox_balance->addWidget(label_balance); + hbox_balance->addStretch(1); + + /* Tab widget */ + QVBoxLayout *vbox = new QVBoxLayout(); + vbox->addLayout(hbox_address); + vbox->addLayout(hbox_balance); + + /* Transaction table: + * TransactionView + * TransactionModel + * Selection behaviour + * selection mode + * QAbstractItemView::SelectItems + * QAbstractItemView::ExtendedSelection + */ + QTableView *transaction_table = new QTableView(this); + + QTabBar *tabs = new QTabBar(this); + tabs->addTab("All transactions"); + tabs->addTab("Sent/Received"); + tabs->addTab("Sent"); + tabs->addTab("Received"); + + vbox->addWidget(tabs); + vbox->addWidget(transaction_table); + + QWidget *centralwidget = new QWidget(this); + centralwidget->setLayout(vbox); + setCentralWidget(centralwidget); + + /* Status bar */ + statusBar(); + + QLabel *label_connections = new QLabel("6 connections", this); + label_connections->setFrameStyle(QFrame::Panel | QFrame::Sunken); + label_connections->setMinimumWidth(100); + + QLabel *label_blocks = new QLabel("6 blocks", this); + label_blocks->setFrameStyle(QFrame::Panel | QFrame::Sunken); + label_blocks->setMinimumWidth(100); + + QLabel *label_transactions = new QLabel("6 transactions", this); + label_transactions->setFrameStyle(QFrame::Panel | QFrame::Sunken); + label_transactions->setMinimumWidth(100); + + + statusBar()->addPermanentWidget(label_connections); + statusBar()->addPermanentWidget(label_blocks); + statusBar()->addPermanentWidget(label_transactions); + + + /* Action bindings */ + + connect(quit, SIGNAL(triggered()), qApp, SLOT(quit())); + connect(tabs, SIGNAL(currentChanged(int)), this, SLOT(currentChanged(int))); +} + +void BitcoinGUI::currentChanged(int tab) +{ + std::cout << "Switched to tab: " << tab << std::endl; +} diff --git a/BitcoinGUI.h b/BitcoinGUI.h new file mode 100644 index 000000000..e4ff2fe61 --- /dev/null +++ b/BitcoinGUI.h @@ -0,0 +1,23 @@ +#ifndef H_BITCOINGUI +#define H_BITCOINGUI + +#include + +class BitcoinGUI : public QMainWindow +{ + Q_OBJECT +public: + BitcoinGUI(QWidget *parent = 0); + + /* Transaction table tab indices */ + enum { + ALL_TRANSACTIONS = 0, + SENT_RECEIVED = 1, + SENT = 2, + RECEIVED = 3 + } TabIndex; +private slots: + void currentChanged(int tab); +}; + +#endif diff --git a/TODO b/TODO new file mode 100644 index 000000000..934b231b7 --- /dev/null +++ b/TODO @@ -0,0 +1,50 @@ +Toolbar: + Send coins + Address book + +- "Your bitcoin address" label +- address field +- "New..." +- Copy to Clipboard + +Balance: XXX + +Tabs: + All transactions + Sent/Received + Sent + Received + +Table [columns]: + Status + Date + Description + Debit + Credit + + ** Table should be the same in all tabs. Do we really need different widgets? + +Status bar: + Permanent status indicators: + < actions_crystal_project: connect_established.png / connect_no.png > + N connections + M blocks + O transactions + +SendCoinDialog +AddressesDialog (Address book) + Receiving/Sending + +OptionsDialog + Tabs at the left +AboutDialog + + +- Move resources to res/ + + - Send icon + + - Address Book icon + + +- Translation diff --git a/address-book.png b/address-book.png new file mode 100644 index 0000000000000000000000000000000000000000..621ca40245be8863d582ae83d25bffb95b476fc6 GIT binary patch literal 656 zcmV;B0&o3^P)1RCwBylTT<9K@`T{Y&Y9vP11%& zstq<(Db$ckda58rp+vlhhqhNQA|CWm^lB;Cn}RtBr6=(sf*w2xrjbGqtx69|C4wlL zLsE+kyKHTm?9A@?X1Xi>iO@dy_RY?I{N}ygw`6K|_7VUbMNw1(WuvN`^RNCoP6!#m zoDyrXcdfDTl5>Cy_iLcKuG{x~Zf<^YZ4J(3GF#tmd#hZjd|oz;<&Tw0aj?HXKbFgl zWzy-B$#^{Zwp>o~rwauH-9kx#$bct8r=}%)&@`IK3=JJWaqf2EfpvXy>Q1*FiG~yf z!m28LuE%rWhvG6u0zeRAtq_RboS2vosU6Y3pSdoFRWIuUTz6w;I{)x@QxJ@?fA)lL zm1oOuVED2Gj5x-Nk(QD5Ja1nB;k#QX-oR%m2{_#}fHF?nRX{0iTY-dADqB|>^L~-{ z0|YyaTl`IX*7nqk9$5gI6HojI&*HYCYRSY7GYVwgWrc6uvYW qw?#Vy{vX{a-T%d{b_N0XDZl{2Ogn_%%oR8Q0000 + +int main(int argc, char *argv[]) +{ + QApplication app(argc, argv); + + BitcoinGUI window; + + window.show(); + + return app.exec(); +} diff --git a/bitcoin.png b/bitcoin.png new file mode 100644 index 0000000000000000000000000000000000000000..09520aca23dd88af90ea8516d0e2daa09562544f GIT binary patch literal 1086 zcmV-E1i|}>P)5QBzZlJ&>jrn;NG=2-?OJjLHDDAgDlx&c^Kfyyu}2tN;1?zssLr;D7o2 z&7OTWi};kcp>emO2u)SpNUg^b(`%u~sgkZ7d-2Fj;(A`#D8Ak2v?;|;w(shHxT&=R zK@>5Jf1yM?$`51T#V;*{-*Rs1`QVw?P8l15PhY=9YxLU2_TKwIuc9biS(qkQ5QweJ z;PQ20Q$@V3n^DXbCeM%a^~kv)U+2K!^M}6CMF5v3f4KL)1HIKsiSr{v{CZ&wTSG75 zl!)fo3)L*mY({Xm}xsy8vwm%2A7-nS z#f@FK-bih+ImacQPk4!>|yyJ)irPdB%93bExSRFeg#r-`<$yKuSP zSZg$L=_t3|^*G_YM!AwFwLFj6Vx{NSZKgzY`8mXZR;Y2= zHF1V|IftN2lnZ(6j#>na4$-JqtJn6@kre@lX2oK;Cb&E^MeyP%p_L^D?tYYL(x6x< zA;>biuA>`Fx! zXk|H&&t-bm+6LlFVPd+*jlDep?7Zh7W{U+`R++vyj?-Mi)6{_^$y^Es(G77z6wQqv z&;9aKS=Btqwpy~0c>=>95n2uLec&|fu@s{xjv&RRaM#tN`PvAtT_HIAn_+j=rWg_B<%Cpfz_tGSyV8l8;i zH_r6c(Su@QZTjVwR{yIvZ|kmcxjl%Yh=D*hlV*M{$k?|5BJtu`uYdF4OYi*{`Oh2w z$%*$5c%rK_Pnyl@gQB2s&1N&Ud_ljO$(1fBX6@J;M}I$aJ^wemeO({_YrJCs001R) zMObuXVRU6WV{&C-bY%cCFflPLFf}bOH&ih-IxsalGB_(RGCD9Y6X;fO0000bbVXQn zWMOn=I&E)cX=Zr." +#elif Q_MOC_OUTPUT_REVISION != 62 +#error "This file was generated using the moc from 4.7.0. It" +#error "cannot be used with the include files from this version of Qt." +#error "(The moc has changed too much.)" +#endif + +QT_BEGIN_MOC_NAMESPACE +static const uint qt_meta_data_BitcoinGUI[] = { + + // content: + 5, // revision + 0, // classname + 0, 0, // classinfo + 1, 14, // methods + 0, 0, // properties + 0, 0, // enums/sets + 0, 0, // constructors + 0, // flags + 0, // signalCount + + // slots: signature, parameters, type, tag, flags + 16, 12, 11, 11, 0x08, + + 0 // eod +}; + +static const char qt_meta_stringdata_BitcoinGUI[] = { + "BitcoinGUI\0\0tab\0currentChanged(int)\0" +}; + +const QMetaObject BitcoinGUI::staticMetaObject = { + { &QMainWindow::staticMetaObject, qt_meta_stringdata_BitcoinGUI, + qt_meta_data_BitcoinGUI, 0 } +}; + +#ifdef Q_NO_DATA_RELOCATION +const QMetaObject &BitcoinGUI::getStaticMetaObject() { return staticMetaObject; } +#endif //Q_NO_DATA_RELOCATION + +const QMetaObject *BitcoinGUI::metaObject() const +{ + return QObject::d_ptr->metaObject ? QObject::d_ptr->metaObject : &staticMetaObject; +} + +void *BitcoinGUI::qt_metacast(const char *_clname) +{ + if (!_clname) return 0; + if (!strcmp(_clname, qt_meta_stringdata_BitcoinGUI)) + return static_cast(const_cast< BitcoinGUI*>(this)); + return QMainWindow::qt_metacast(_clname); +} + +int BitcoinGUI::qt_metacall(QMetaObject::Call _c, int _id, void **_a) +{ + _id = QMainWindow::qt_metacall(_c, _id, _a); + if (_id < 0) + return _id; + if (_c == QMetaObject::InvokeMetaMethod) { + switch (_id) { + case 0: currentChanged((*reinterpret_cast< int(*)>(_a[1]))); break; + default: ; + } + _id -= 1; + } + return _id; +} +QT_END_MOC_NAMESPACE diff --git a/quit.png b/quit.png new file mode 100644 index 0000000000000000000000000000000000000000..fb510fbea6c96133e9effa439775cc0cbcbb008b GIT binary patch literal 876 zcmV-y1C#uTP)A=D;nOFk$cj$e%(t{zyx0xos(>#|OgVh~LXO58wGtzLWEr zM1;+FN^5z#)@OMk;Mo!c6XAJds()sscPiICvYBi8uRxi4yz;}HsZU>hvFeCt@AG#2 ze!v6|Bh2>=q`Iz;{P4vC>nF3hZ^t)gl#OPGrFmcXvtzeE*rlHIY%8{7Er2376qSNz z$L%h*zrR~Q@m=*_zwIy|-T#DuM?D$*+%s^kLXCTq3;)36B+Si1xfeWMcocz&Nm6q$ zyeyTsyZf(|sV9Pu1x`7}&iQ4bEV2+Mnn)lGO`zK#kpRPhK!~-PUCc#hnEpGCpG8k= z!N_L-ieEjxz0N$@yqL_8h{e#~dIwW;3oG#@$fO~YW>o~W?F?G$X_AXEV#X@_w27Df zN=p@udQ*Oc zf72mD)!U`V=aRclRo?dO=@bz(fR2LQXY2FvgEf}r3dO2pzWLL-;p*qs>+m4vpRZ%r zbySLc zz(L>4CQU+6n#Zmc_(t-Lh7yqaJ&1LS};$Yz*HW)to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