add all (unpopulated) dialogs
authorWladimir J. van der Laan <laanwj@gmail.com>
Sun, 8 May 2011 20:23:31 +0000 (22:23 +0200)
committerWladimir J. van der Laan <laanwj@gmail.com>
Sun, 8 May 2011 20:23:31 +0000 (22:23 +0200)
17 files changed:
.gitignore
AboutDialog.cpp [new file with mode: 0644]
AboutDialog.h [new file with mode: 0644]
AddressBookDialog.cpp [new file with mode: 0644]
AddressBookDialog.h [new file with mode: 0644]
BitcoinGUI.cpp
BitcoinGUI.h
SendCoinsDialog.cpp [new file with mode: 0644]
SendCoinsDialog.h [new file with mode: 0644]
SettingsDialog.cpp [new file with mode: 0644]
SettingsDialog.h [new file with mode: 0644]
TODO
TransactionTableModel.cpp
TransactionTableModel.h
bitcoin.pro
bitcoin.pro.user [deleted file]
moc_BitcoinGUI.cpp [deleted file]

index d6ff91a..a261fd9 100644 (file)
@@ -1,2 +1,4 @@
 *~
 *.o
+moc_*.cpp
+*.pro.user
diff --git a/AboutDialog.cpp b/AboutDialog.cpp
new file mode 100644 (file)
index 0000000..dd2ec9f
--- /dev/null
@@ -0,0 +1,6 @@
+#include "AboutDialog.h"
+
+AboutDialog::AboutDialog(QWidget *parent) :
+    QDialog(parent)
+{
+}
diff --git a/AboutDialog.h b/AboutDialog.h
new file mode 100644 (file)
index 0000000..1372121
--- /dev/null
@@ -0,0 +1,18 @@
+#ifndef ABOUTDIALOG_H
+#define ABOUTDIALOG_H
+
+#include <QDialog>
+
+class AboutDialog : public QDialog
+{
+    Q_OBJECT
+public:
+    explicit AboutDialog(QWidget *parent = 0);
+
+signals:
+
+public slots:
+
+};
+
+#endif // ABOUTDIALOG_H
diff --git a/AddressBookDialog.cpp b/AddressBookDialog.cpp
new file mode 100644 (file)
index 0000000..7e853ed
--- /dev/null
@@ -0,0 +1,7 @@
+#include "AddressBookDialog.h"
+
+AddressBookDialog::AddressBookDialog(QWidget *parent) :
+    QDialog(parent)
+{
+}
+
diff --git a/AddressBookDialog.h b/AddressBookDialog.h
new file mode 100644 (file)
index 0000000..3a27aa6
--- /dev/null
@@ -0,0 +1,18 @@
+#ifndef ADDRESSBOOKDIALOG_H
+#define ADDRESSBOOKDIALOG_H
+
+#include <QDialog>
+
+class AddressBookDialog : public QDialog
+{
+    Q_OBJECT
+public:
+    explicit AddressBookDialog(QWidget *parent = 0);
+
+signals:
+
+public slots:
+
+};
+
+#endif // ADDRESSBOOKDIALOG_H
index 0b81f72..f07b828 100644 (file)
@@ -18,6 +18,7 @@
 #include <QTableView>
 #include <QLineEdit>
 #include <QPushButton>
+#include <QHeaderView>
 
 #include <iostream>
 
@@ -86,9 +87,24 @@ BitcoinGUI::BitcoinGUI(QWidget *parent):
      * QAbstractItemView::ExtendedSelection
      */
     QTableView *transaction_table = new QTableView(this);
+
     TransactionTableModel *transaction_model = new TransactionTableModel(this);
     transaction_table->setModel(transaction_model);
-    
+    transaction_table->setSelectionBehavior(QAbstractItemView::SelectRows);
+    transaction_table->setSelectionMode(QAbstractItemView::ExtendedSelection);
+
+    transaction_table->horizontalHeader()->resizeSection(
+            TransactionTableModel::Status, 112);
+    transaction_table->horizontalHeader()->resizeSection(
+            TransactionTableModel::Date, 112);
+    transaction_table->horizontalHeader()->setResizeMode(
+            TransactionTableModel::Description, QHeaderView::Stretch);
+    transaction_table->horizontalHeader()->resizeSection(
+            TransactionTableModel::Debit, 79);
+    transaction_table->horizontalHeader()->resizeSection(
+            TransactionTableModel::Credit, 79);
+    /* TODO: alignment; debit/credit columns must align right */
+
     QTabBar *tabs = new QTabBar(this);
     tabs->addTab("All transactions");
     tabs->addTab("Sent/Received");
index e4ff2fe..590bb3e 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef H_BITCOINGUI
-#define H_BITCOINGUI
+#ifndef BITCOINGUI_H
+#define BITCOINGUI_H
 
 #include <QMainWindow>
 
@@ -7,14 +7,14 @@ class BitcoinGUI : public QMainWindow
 {
     Q_OBJECT
 public:
-    BitcoinGUI(QWidget *parent = 0);
+    explicit BitcoinGUI(QWidget *parent = 0);
     
     /* Transaction table tab indices */
     enum {
-        ALL_TRANSACTIONS = 0,
-        SENT_RECEIVED = 1,
-        SENT = 2,
-        RECEIVED = 3
+        AllTransactions = 0,
+        SentReceived = 1,
+        Sent = 2,
+        Received = 3
     } TabIndex;
 private slots:
     void currentChanged(int tab);
diff --git a/SendCoinsDialog.cpp b/SendCoinsDialog.cpp
new file mode 100644 (file)
index 0000000..a89a58d
--- /dev/null
@@ -0,0 +1,6 @@
+#include "SendCoinsDialog.h"
+
+SendCoinsDialog::SendCoinsDialog(QWidget *parent) :
+    QDialog(parent)
+{
+}
diff --git a/SendCoinsDialog.h b/SendCoinsDialog.h
new file mode 100644 (file)
index 0000000..f2720c3
--- /dev/null
@@ -0,0 +1,18 @@
+#ifndef SENDCOINSDIALOG_H
+#define SENDCOINSDIALOG_H
+
+#include <QDialog>
+
+class SendCoinsDialog : public QDialog
+{
+    Q_OBJECT
+public:
+    explicit SendCoinsDialog(QWidget *parent = 0);
+
+signals:
+
+public slots:
+
+};
+
+#endif // SENDCOINSDIALOG_H
diff --git a/SettingsDialog.cpp b/SettingsDialog.cpp
new file mode 100644 (file)
index 0000000..d2ce01e
--- /dev/null
@@ -0,0 +1,7 @@
+#include "SettingsDialog.h"
+
+SettingsDialog::SettingsDialog(QWidget *parent) :
+    QDialog(parent)
+{
+}
+
diff --git a/SettingsDialog.h b/SettingsDialog.h
new file mode 100644 (file)
index 0000000..7bbfb1f
--- /dev/null
@@ -0,0 +1,18 @@
+#ifndef SETTINGSDIALOG_H
+#define SETTINGSDIALOG_H
+
+#include <QDialog>
+
+class SettingsDialog : public QDialog
+{
+    Q_OBJECT
+public:
+    explicit SettingsDialog(QWidget *parent = 0);
+
+signals:
+
+public slots:
+
+};
+
+#endif // SETTINGSDIALOG_H
diff --git a/TODO b/TODO
index 934b231..4729921 100644 (file)
--- a/TODO
+++ b/TODO
@@ -23,6 +23,9 @@ Table [columns]:
     Credit
 
     ** Table should be the same in all tabs. Do we really need different widgets?
+       -> yes, to have different proxy views
+
+    ** Table rows are much too high?
 
 Status bar:
   Permanent status indicators:
@@ -46,5 +49,5 @@ AboutDialog
 
   - Address Book icon
 
-
 - Translation
+
index 0f35296..e5cf258 100644 (file)
@@ -1,5 +1,14 @@
 #include "TransactionTableModel.h"
 
+/* Credit and Debit columns are right-aligned as they contain numbers */
+static Qt::AlignmentFlag column_alignments[] = {
+        Qt::AlignLeft,
+        Qt::AlignLeft,
+        Qt::AlignLeft,
+        Qt::AlignRight,
+        Qt::AlignRight
+    };
+
 TransactionTableModel::TransactionTableModel(QObject *parent):
         QAbstractTableModel(parent)
 {
@@ -28,18 +37,24 @@ QVariant TransactionTableModel::data(const QModelIndex &index, int role) const
         /* index.row(), index.column() */
         /* Return QString */
         return QString("test");
+    } else if (role == Qt::TextAlignmentRole)
+    {
+        return column_alignments[index.column()];
     }
     return QVariant();
 }
 
 QVariant TransactionTableModel::headerData(int section, Qt::Orientation orientation, int role) const
 {
-    if(role != Qt::DisplayRole)
-        return QVariant();
-
-    if(orientation == Qt::Horizontal)
+    if(role == Qt::DisplayRole)
+    {
+        if(orientation == Qt::Horizontal)
+        {
+            return columns[section];
+        }
+    } else if (role == Qt::TextAlignmentRole)
     {
-        return columns[section];
+        return column_alignments[section];
     }
     return QVariant();
 }
index 9071ed6..8913f1d 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef H_TRANSACTIONTABLEMODEL
-#define H_TRANSACTIONTABLEMODEL
+#ifndef TRANSACTIONTABLEMODEL_H
+#define TRANSACTIONTABLEMODEL_H
 
 #include <QAbstractTableModel>
 #include <QStringList>
@@ -8,7 +8,15 @@ class TransactionTableModel : public QAbstractTableModel
 {
     Q_OBJECT
 public:
-    TransactionTableModel(QObject *parent = 0);
+    explicit TransactionTableModel(QObject *parent = 0);
+
+    enum {
+        Status = 0,
+        Date = 1,
+        Description = 2,
+        Debit = 3,
+        Credit = 4
+    } ColumnIndex;
 
     int rowCount(const QModelIndex &parent) const;
     int columnCount(const QModelIndex &parent) const;
index 26a3216..4f794ac 100644 (file)
@@ -9,6 +9,14 @@ INCLUDEPATH += .
 
 # Input
 HEADERS += BitcoinGUI.h \
-    TransactionTableModel.h
+    TransactionTableModel.h \
+    SendCoinsDialog.h \
+    SettingsDialog.h \
+    AddressBookDialog.h \
+    AboutDialog.h
 SOURCES += bitcoin.cpp BitcoinGUI.cpp \
-    TransactionTableModel.cpp
+    TransactionTableModel.cpp \
+    SendCoinsDialog.cpp \
+    SettingsDialog.cpp \
+    AddressBookDialog.cpp \
+    AboutDialog.cpp
diff --git a/bitcoin.pro.user b/bitcoin.pro.user
deleted file mode 100644 (file)
index 4802238..0000000
+++ /dev/null
@@ -1,113 +0,0 @@
-<!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>
diff --git a/moc_BitcoinGUI.cpp b/moc_BitcoinGUI.cpp
deleted file mode 100644 (file)
index 3c024d3..0000000
+++ /dev/null
@@ -1,79 +0,0 @@
-/****************************************************************************
-** 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