This commit is contained in:
Wladimir J. van der Laan 2011-05-08 16:30:10 +02:00
parent f79405b5e1
commit 4d27c96033
5 changed files with 199 additions and 6 deletions

View File

@ -2,6 +2,7 @@
* W.J. van der Laan 2011
*/
#include "BitcoinGUI.h"
#include "TransactionTableModel.h"
#include <QApplication>
#include <QMainWindow>
@ -27,7 +28,6 @@ BitcoinGUI::BitcoinGUI(QWidget *parent):
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);
@ -53,13 +53,13 @@ BitcoinGUI::BitcoinGUI(QWidget *parent):
/* Address: <address>: New... : Paste to clipboard */
QHBoxLayout *hbox_address = new QHBoxLayout();
hbox_address->addWidget(new QLabel("Your Bitcoin Address:"));
hbox_address->addWidget(new QLabel(tr("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");
QPushButton *button_clipboard = new QPushButton(tr("&Copy to clipboard"));
hbox_address->addWidget(button_new);
hbox_address->addWidget(button_clipboard);
@ -80,12 +80,14 @@ BitcoinGUI::BitcoinGUI(QWidget *parent):
/* Transaction table:
* TransactionView
* TransactionModel
* Selection behaviour
* Selection behavior
* selection mode
* QAbstractItemView::SelectItems
* QAbstractItemView::ExtendedSelection
*/
QTableView *transaction_table = new QTableView(this);
TransactionTableModel *transaction_model = new TransactionTableModel(this);
transaction_table->setModel(transaction_model);
QTabBar *tabs = new QTabBar(this);
tabs->addTab("All transactions");

53
TransactionTableModel.cpp Normal file
View File

@ -0,0 +1,53 @@
#include "TransactionTableModel.h"
TransactionTableModel::TransactionTableModel(QObject *parent):
QAbstractTableModel(parent)
{
columns << "Status" << "Date" << "Description" << "Debit" << "Credit";
}
int TransactionTableModel::rowCount(const QModelIndex &parent) const
{
Q_UNUSED(parent);
return 5;
}
int TransactionTableModel::columnCount(const QModelIndex &parent) const
{
Q_UNUSED(parent);
return columns.length();
}
QVariant TransactionTableModel::data(const QModelIndex &index, int role) const
{
if(!index.isValid())
return QVariant();
if(role == Qt::DisplayRole)
{
/* index.row(), index.column() */
/* Return QString */
return QString("test");
}
return QVariant();
}
QVariant TransactionTableModel::headerData(int section, Qt::Orientation orientation, int role) const
{
if(role != Qt::DisplayRole)
return QVariant();
if(orientation == Qt::Horizontal)
{
return columns[section];
}
return QVariant();
}
Qt::ItemFlags TransactionTableModel::flags(const QModelIndex &index) const
{
if (!index.isValid())
return Qt::ItemIsEnabled;
return QAbstractTableModel::flags(index);
}

23
TransactionTableModel.h Normal file
View File

@ -0,0 +1,23 @@
#ifndef H_TRANSACTIONTABLEMODEL
#define H_TRANSACTIONTABLEMODEL
#include <QAbstractTableModel>
#include <QStringList>
class TransactionTableModel : public QAbstractTableModel
{
Q_OBJECT
public:
TransactionTableModel(QObject *parent = 0);
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

View File

@ -8,5 +8,7 @@ DEPENDPATH += .
INCLUDEPATH += .
# Input
HEADERS += BitcoinGUI.h
SOURCES += bitcoin.cpp BitcoinGUI.cpp
HEADERS += BitcoinGUI.h \
TransactionTableModel.h
SOURCES += bitcoin.cpp BitcoinGUI.cpp \
TransactionTableModel.cpp

113
bitcoin.pro.user Normal file
View File

@ -0,0 +1,113 @@
<!DOCTYPE QtCreatorProject>
<qtcreator>
<data>
<variable>ProjectExplorer.Project.ActiveTarget</variable>
<value type="int">0</value>
</data>
<data>
<variable>ProjectExplorer.Project.EditorSettings</variable>
<valuemap type="QVariantMap">
<value key="EditorConfiguration.Codec" type="QByteArray">System</value>
</valuemap>
</data>
<data>
<variable>ProjectExplorer.Project.Target.0</variable>
<valuemap type="QVariantMap">
<value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString">Desktop</value>
<value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">Qt4ProjectManager.Target.DesktopTarget</value>
<value key="ProjectExplorer.Target.ActiveBuildConfiguration" type="int">0</value>
<value key="ProjectExplorer.Target.ActiveRunConfiguration" type="int">0</value>
<valuemap key="ProjectExplorer.Target.BuildConfiguration.0" type="QVariantMap">
<valuemap key="ProjectExplorer.BuildConfiguration.BuildStep.0" type="QVariantMap">
<value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString">qmake</value>
<value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">QtProjectManager.QMakeBuildStep</value>
<valuelist key="QtProjectManager.QMakeBuildStep.QMakeArguments" type="QVariantList"/>
</valuemap>
<valuemap key="ProjectExplorer.BuildConfiguration.BuildStep.1" type="QVariantMap">
<value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString">Make</value>
<value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">Qt4ProjectManager.MakeStep</value>
<value key="Qt4ProjectManager.MakeStep.Clean" type="bool">false</value>
<valuelist key="Qt4ProjectManager.MakeStep.MakeArguments" type="QVariantList"/>
<value key="Qt4ProjectManager.MakeStep.MakeCommand" type="QString"></value>
</valuemap>
<value key="ProjectExplorer.BuildConfiguration.BuildStepsCount" type="int">2</value>
<valuemap key="ProjectExplorer.BuildConfiguration.CleanStep.0" type="QVariantMap">
<value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString">Make</value>
<value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">Qt4ProjectManager.MakeStep</value>
<value key="Qt4ProjectManager.MakeStep.Clean" type="bool">true</value>
<valuelist key="Qt4ProjectManager.MakeStep.MakeArguments" type="QVariantList">
<value type="QString">clean</value>
</valuelist>
<value key="Qt4ProjectManager.MakeStep.MakeCommand" type="QString"></value>
</valuemap>
<value key="ProjectExplorer.BuildConfiguration.CleanStepsCount" type="int">1</value>
<value key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment" type="bool">false</value>
<valuelist key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges" type="QVariantList"/>
<value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString">Debug</value>
<value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">Qt4ProjectManager.Qt4BuildConfiguration</value>
<value key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration" type="int">2</value>
<value key="Qt4ProjectManager.Qt4BuildConfiguration.BuildDirectory" type="QString">/store/orion/projects/bitcoin/bitcoin-qt</value>
<value key="Qt4ProjectManager.Qt4BuildConfiguration.QtVersionId" type="int">4</value>
<value key="Qt4ProjectManager.Qt4BuildConfiguration.ToolChain" type="int">0</value>
<value key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild" type="bool">false</value>
</valuemap>
<valuemap key="ProjectExplorer.Target.BuildConfiguration.1" type="QVariantMap">
<valuemap key="ProjectExplorer.BuildConfiguration.BuildStep.0" type="QVariantMap">
<value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString">qmake</value>
<value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">QtProjectManager.QMakeBuildStep</value>
<valuelist key="QtProjectManager.QMakeBuildStep.QMakeArguments" type="QVariantList"/>
</valuemap>
<valuemap key="ProjectExplorer.BuildConfiguration.BuildStep.1" type="QVariantMap">
<value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString">Make</value>
<value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">Qt4ProjectManager.MakeStep</value>
<value key="Qt4ProjectManager.MakeStep.Clean" type="bool">false</value>
<valuelist key="Qt4ProjectManager.MakeStep.MakeArguments" type="QVariantList"/>
<value key="Qt4ProjectManager.MakeStep.MakeCommand" type="QString"></value>
</valuemap>
<value key="ProjectExplorer.BuildConfiguration.BuildStepsCount" type="int">2</value>
<valuemap key="ProjectExplorer.BuildConfiguration.CleanStep.0" type="QVariantMap">
<value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString">Make</value>
<value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">Qt4ProjectManager.MakeStep</value>
<value key="Qt4ProjectManager.MakeStep.Clean" type="bool">true</value>
<valuelist key="Qt4ProjectManager.MakeStep.MakeArguments" type="QVariantList">
<value type="QString">clean</value>
</valuelist>
<value key="Qt4ProjectManager.MakeStep.MakeCommand" type="QString"></value>
</valuemap>
<value key="ProjectExplorer.BuildConfiguration.CleanStepsCount" type="int">1</value>
<value key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment" type="bool">false</value>
<valuelist key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges" type="QVariantList"/>
<value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString">Release</value>
<value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">Qt4ProjectManager.Qt4BuildConfiguration</value>
<value key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration" type="int">0</value>
<value key="Qt4ProjectManager.Qt4BuildConfiguration.BuildDirectory" type="QString">/store/orion/projects/bitcoin/bitcoin-qt</value>
<value key="Qt4ProjectManager.Qt4BuildConfiguration.QtVersionId" type="int">4</value>
<value key="Qt4ProjectManager.Qt4BuildConfiguration.ToolChain" type="int">0</value>
<value key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild" type="bool">false</value>
</valuemap>
<value key="ProjectExplorer.Target.BuildConfigurationCount" type="int">2</value>
<valuemap key="ProjectExplorer.Target.RunConfiguration.0" type="QVariantMap">
<value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString">bitcoin</value>
<value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">Qt4ProjectManager.Qt4RunConfiguration</value>
<value key="Qt4ProjectManager.Qt4RunConfiguration.BaseEnvironmentBase" type="int">2</value>
<valuelist key="Qt4ProjectManager.Qt4RunConfiguration.CommandLineArguments" type="QVariantList"/>
<value key="Qt4ProjectManager.Qt4RunConfiguration.ProFile" type="QString">bitcoin.pro</value>
<value key="Qt4ProjectManager.Qt4RunConfiguration.UseDyldImageSuffix" type="bool">false</value>
<value key="Qt4ProjectManager.Qt4RunConfiguration.UseTerminal" type="bool">false</value>
<valuelist key="Qt4ProjectManager.Qt4RunConfiguration.UserEnvironmentChanges" type="QVariantList"/>
<value key="Qt4ProjectManager.Qt4RunConfiguration.UserSetName" type="bool">false</value>
<value key="Qt4ProjectManager.Qt4RunConfiguration.UserSetWorkingDirectory" type="bool">false</value>
<value key="Qt4ProjectManager.Qt4RunConfiguration.UserWorkingDirectory" type="QString"></value>
</valuemap>
<value key="ProjectExplorer.Target.RunConfigurationCount" type="int">1</value>
</valuemap>
</data>
<data>
<variable>ProjectExplorer.Project.TargetCount</variable>
<value type="int">1</value>
</data>
<data>
<variable>ProjectExplorer.Project.Updater.FileVersion</variable>
<value type="int">4</value>
</data>
</qtcreator>