aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore2
-rw-r--r--BitcoinGUI.cpp133
-rw-r--r--BitcoinGUI.h23
-rw-r--r--TODO50
-rw-r--r--address-book.pngbin0 -> 656 bytes
-rw-r--r--bitcoin.cpp17
-rw-r--r--bitcoin.pngbin0 -> 1086 bytes
-rw-r--r--bitcoin.pro12
-rw-r--r--moc_BitcoinGUI.cpp79
-rw-r--r--quit.pngbin0 -> 876 bytes
-rw-r--r--send.pngbin0 -> 946 bytes
11 files changed, 316 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000000..d6ff91a9ea
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,2 @@
+*~
+*.o
diff --git a/BitcoinGUI.cpp b/BitcoinGUI.cpp
new file mode 100644
index 0000000000..b18a18b88d
--- /dev/null
+++ b/BitcoinGUI.cpp
@@ -0,0 +1,133 @@
+/*
+ * W.J. van der Laan 2011
+ */
+#include "BitcoinGUI.h"
+
+#include <QApplication>
+#include <QMainWindow>
+#include <QMenuBar>
+#include <QMenu>
+#include <QIcon>
+#include <QTabBar>
+#include <QVBoxLayout>
+#include <QWidget>
+#include <QToolBar>
+#include <QStatusBar>
+#include <QLabel>
+#include <QTableView>
+#include <QLineEdit>
+#include <QPushButton>
+
+#include <iostream>
+
+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: <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: <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 0000000000..e4ff2fe61a
--- /dev/null
+++ b/BitcoinGUI.h
@@ -0,0 +1,23 @@
+#ifndef H_BITCOINGUI
+#define H_BITCOINGUI
+
+#include <QMainWindow>
+
+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 0000000000..934b231b7f
--- /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 0000000000..621ca40245
--- /dev/null
+++ b/address-book.png
Binary files differ
diff --git a/bitcoin.cpp b/bitcoin.cpp
new file mode 100644
index 0000000000..d43befd41d
--- /dev/null
+++ b/bitcoin.cpp
@@ -0,0 +1,17 @@
+/*
+ * W.J. van der Laan 2011
+ */
+#include "BitcoinGUI.h"
+
+#include <QApplication>
+
+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 0000000000..09520aca23
--- /dev/null
+++ b/bitcoin.png
Binary files differ
diff --git a/bitcoin.pro b/bitcoin.pro
new file mode 100644
index 0000000000..ab440fab85
--- /dev/null
+++ b/bitcoin.pro
@@ -0,0 +1,12 @@
+######################################################################
+# Automatically generated by qmake (2.01a) Sat May 7 20:45:42 2011
+######################################################################
+
+TEMPLATE = app
+TARGET =
+DEPENDPATH += .
+INCLUDEPATH += .
+
+# Input
+HEADERS += BitcoinGUI.h
+SOURCES += bitcoin.cpp BitcoinGUI.cpp
diff --git a/moc_BitcoinGUI.cpp b/moc_BitcoinGUI.cpp
new file mode 100644
index 0000000000..3c024d3178
--- /dev/null
+++ b/moc_BitcoinGUI.cpp
@@ -0,0 +1,79 @@
+/****************************************************************************
+** Meta object code from reading C++ file 'BitcoinGUI.h'
+**
+** Created: Sat May 7 20:43:39 2011
+** by: The Qt Meta Object Compiler version 62 (Qt 4.7.0)
+**
+** WARNING! All changes made in this file will be lost!
+*****************************************************************************/
+
+#include "BitcoinGUI.h"
+#if !defined(Q_MOC_OUTPUT_REVISION)
+#error "The header file 'BitcoinGUI.h' doesn't include <QObject>."
+#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<void*>(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 0000000000..fb510fbea6
--- /dev/null
+++ b/quit.png
Binary files differ
diff --git a/send.png b/send.png
new file mode 100644
index 0000000000..52b939e8e6
--- /dev/null
+++ b/send.png
Binary files differ