Browse Source

initial commit

0.8
Wladimir J. van der Laan 14 years ago
commit
aaa1c3c400
  1. 2
      .gitignore
  2. 133
      BitcoinGUI.cpp
  3. 23
      BitcoinGUI.h
  4. 50
      TODO
  5. BIN
      address-book.png
  6. 17
      bitcoin.cpp
  7. BIN
      bitcoin.png
  8. 12
      bitcoin.pro
  9. 79
      moc_BitcoinGUI.cpp
  10. BIN
      quit.png
  11. BIN
      send.png

2
.gitignore vendored

@ -0,0 +1,2 @@ @@ -0,0 +1,2 @@
*~
*.o

133
BitcoinGUI.cpp

@ -0,0 +1,133 @@ @@ -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;
}

23
BitcoinGUI.h

@ -0,0 +1,23 @@ @@ -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

50
TODO

@ -0,0 +1,50 @@ @@ -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

BIN
address-book.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 656 B

17
bitcoin.cpp

@ -0,0 +1,17 @@ @@ -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();
}

BIN
bitcoin.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

12
bitcoin.pro

@ -0,0 +1,12 @@ @@ -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

79
moc_BitcoinGUI.cpp

@ -0,0 +1,79 @@ @@ -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

BIN
quit.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 876 B

BIN
send.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 946 B

Loading…
Cancel
Save