begin integration with bitcoin upstream

This commit is contained in:
Wladimir J. van der Laan
2011-05-14 10:31:46 +02:00
parent 4d1bb15e31
commit 1f2e0df865
38 changed files with 3489 additions and 35 deletions

25
gui/include/aboutdialog.h Normal file
View File

@@ -0,0 +1,25 @@
#ifndef ABOUTDIALOG_H
#define ABOUTDIALOG_H
#include <QDialog>
namespace Ui {
class AboutDialog;
}
class AboutDialog : public QDialog
{
Q_OBJECT
public:
explicit AboutDialog(QWidget *parent = 0);
~AboutDialog();
private:
Ui::AboutDialog *ui;
private slots:
void on_buttonBox_accepted();
};
#endif // ABOUTDIALOG_H

View File

@@ -0,0 +1,47 @@
#ifndef ADDRESSBOOKDIALOG_H
#define ADDRESSBOOKDIALOG_H
#include <QDialog>
namespace Ui {
class AddressBookDialog;
}
class AddressTableModel;
QT_BEGIN_NAMESPACE
class QTableView;
QT_END_NAMESPACE
class AddressBookDialog : public QDialog
{
Q_OBJECT
public:
explicit AddressBookDialog(QWidget *parent = 0);
~AddressBookDialog();
enum {
SendingTab = 0,
ReceivingTab = 1
} Tabs;
void setModel(AddressTableModel *model);
void setTab(int tab);
const QString &getReturnValue() const { return returnValue; }
private:
Ui::AddressBookDialog *ui;
AddressTableModel *model;
QString returnValue;
QTableView *getCurrentTable();
private slots:
void on_buttonBox_accepted();
void on_deleteButton_clicked();
void on_tabWidget_currentChanged(int index);
void on_newAddressButton_clicked();
void on_editButton_clicked();
void on_copyToClipboard_clicked();
};
#endif // ADDRESSBOOKDIALOG_H

View File

@@ -0,0 +1,32 @@
#ifndef ADDRESSTABLEMODEL_H
#define ADDRESSTABLEMODEL_H
#include <QAbstractTableModel>
class AddressTableModel : public QAbstractTableModel
{
Q_OBJECT
public:
explicit AddressTableModel(QObject *parent = 0);
enum {
Label = 0, /* User specified label */
Address = 1, /* Bitcoin address */
Type = 2 /* Send/Receive, used for filter */
} ColumnIndex;
static const QString Send; /* Send addres */
static const QString Receive; /* Receive address */
int rowCount(const QModelIndex &parent) const;
int columnCount(const QModelIndex &parent) const;
QVariant data(const QModelIndex &index, int role) const;
QVariant headerData(int section, Qt::Orientation orientation, int role) const;
Qt::ItemFlags flags(const QModelIndex &index) const;
signals:
public slots:
};
#endif // ADDRESSTABLEMODEL_H

View File

@@ -0,0 +1,21 @@
#ifndef BITCOINADDRESSVALIDATOR_H
#define BITCOINADDRESSVALIDATOR_H
#include <QRegExpValidator>
#include <base58.h>
class BitcoinAddressValidator : public QRegExpValidator
{
Q_OBJECT
public:
explicit BitcoinAddressValidator(QObject *parent = 0);
static const QString valid_chars;
signals:
public slots:
};
#endif // BITCOINADDRESSVALIDATOR_H

69
gui/include/bitcoingui.h Normal file
View File

@@ -0,0 +1,69 @@
#ifndef BITCOINGUI_H
#define BITCOINGUI_H
#include <QMainWindow>
#include <QSystemTrayIcon>
/* Forward declarations */
class TransactionTableModel;
QT_BEGIN_NAMESPACE
class QLabel;
class QLineEdit;
QT_END_NAMESPACE
class BitcoinGUI : public QMainWindow
{
Q_OBJECT
public:
explicit BitcoinGUI(QWidget *parent = 0);
/* Transaction table tab indices */
enum {
AllTransactions = 0,
SentReceived = 1,
Sent = 2,
Received = 3
} TabIndex;
private:
TransactionTableModel *transaction_model;
QLineEdit *address;
QLabel *labelBalance;
QLabel *labelConnections;
QLabel *labelBlocks;
QLabel *labelTransactions;
QAction *quit;
QAction *sendcoins;
QAction *addressbook;
QAction *about;
QAction *receiving_addresses;
QAction *options;
QAction *openBitCoin;
QSystemTrayIcon *trayIcon;
void createActions();
QWidget *createTabs();
void createTrayIcon();
public slots:
void setBalance(double balance);
void setAddress(const QString &address);
void setNumConnections(int count);
void setNumBlocks(int count);
void setNumTransactions(int count);
private slots:
void sendcoinsClicked();
void addressbookClicked();
void optionsClicked();
void receivingAddressesClicked();
void aboutClicked();
void newAddressClicked();
void copyClipboardClicked();
};
#endif

View File

@@ -0,0 +1,22 @@
#ifndef EDITADDRESSDIALOG_H
#define EDITADDRESSDIALOG_H
#include <QDialog>
namespace Ui {
class EditAddressDialog;
}
class EditAddressDialog : public QDialog
{
Q_OBJECT
public:
explicit EditAddressDialog(QWidget *parent = 0);
~EditAddressDialog();
private:
Ui::EditAddressDialog *ui;
};
#endif // EDITADDRESSDIALOG_H

View File

@@ -0,0 +1,18 @@
#ifndef MAINOPTIONSPAGE_H
#define MAINOPTIONSPAGE_H
#include <QWidget>
class MainOptionsPage : public QWidget
{
Q_OBJECT
public:
explicit MainOptionsPage(QWidget *parent = 0);
signals:
public slots:
};
#endif // MAINOPTIONSPAGE_H

View File

@@ -0,0 +1,29 @@
#ifndef OPTIONSDIALOG_H
#define OPTIONSDIALOG_H
#include <QDialog>
QT_BEGIN_NAMESPACE
class QStackedWidget;
class QListWidget;
class QListWidgetItem;
QT_END_NAMESPACE
class OptionsDialog : public QDialog
{
Q_OBJECT
public:
explicit OptionsDialog(QWidget *parent = 0);
signals:
public slots:
void changePage(QListWidgetItem *current, QListWidgetItem *previous);
private:
QListWidget *contents_widget;
QStackedWidget *pages_widget;
void setupMainPage();
};
#endif // OPTIONSDIALOG_H

View File

@@ -0,0 +1,28 @@
#ifndef SENDCOINSDIALOG_H
#define SENDCOINSDIALOG_H
#include <QDialog>
namespace Ui {
class SendCoinsDialog;
}
class SendCoinsDialog : public QDialog
{
Q_OBJECT
public:
explicit SendCoinsDialog(QWidget *parent = 0);
~SendCoinsDialog();
private:
Ui::SendCoinsDialog *ui;
private slots:
void on_buttonBox_rejected();
void on_addressBookButton_clicked();
void on_pasteButton_clicked();
void on_sendButton_clicked();
};
#endif // SENDCOINSDIALOG_H

View File

@@ -0,0 +1,37 @@
#ifndef TRANSACTIONTABLEMODEL_H
#define TRANSACTIONTABLEMODEL_H
#include <QAbstractTableModel>
#include <QStringList>
class TransactionTableModel : public QAbstractTableModel
{
Q_OBJECT
public:
explicit TransactionTableModel(QObject *parent = 0);
enum {
Status = 0,
Date = 1,
Description = 2,
Debit = 3,
Credit = 4,
Type = 5
} ColumnIndex;
/* Transaction type */
static const QString Sent;
static const QString Received;
static const QString Generated;
int rowCount(const QModelIndex &parent) const;
int columnCount(const QModelIndex &parent) const;
QVariant data(const QModelIndex &index, int role) const;
QVariant headerData(int section, Qt::Orientation orientation, int role) const;
Qt::ItemFlags flags(const QModelIndex &index) const;
private:
QStringList columns;
};
#endif