aboutsummaryrefslogtreecommitdiff
path: root/src/qt/bitcoingui.cpp
diff options
context:
space:
mode:
authorWladimir J. van der Laan <laanwj@gmail.com>2011-06-28 21:41:56 +0200
committerWladimir J. van der Laan <laanwj@gmail.com>2011-06-29 23:09:55 +0200
commitceb6d4e11d8dab8a6778e20c433f6ed989c16221 (patch)
tree9c38a4254968ef15db820a6fac0bb8ff270957a0 /src/qt/bitcoingui.cpp
parent19a5975d5a024de37851524d72993f98dbdaff0c (diff)
Implement filter row instead of tabs, allows for more expressive filters
Diffstat (limited to 'src/qt/bitcoingui.cpp')
-rw-r--r--src/qt/bitcoingui.cpp77
1 files changed, 9 insertions, 68 deletions
diff --git a/src/qt/bitcoingui.cpp b/src/qt/bitcoingui.cpp
index 5bf79ee6d1..44f77460e3 100644
--- a/src/qt/bitcoingui.cpp
+++ b/src/qt/bitcoingui.cpp
@@ -15,6 +15,7 @@
#include "optionsmodel.h"
#include "transactiondescdialog.h"
#include "addresstablemodel.h"
+#include "transactionview.h"
#include "headers.h"
@@ -29,12 +30,9 @@
#include <QToolBar>
#include <QStatusBar>
#include <QLabel>
-#include <QTableView>
#include <QLineEdit>
#include <QPushButton>
-#include <QHeaderView>
#include <QLocale>
-#include <QSortFilterProxyModel>
#include <QClipboard>
#include <QMessageBox>
#include <QProgressBar>
@@ -104,7 +102,9 @@ BitcoinGUI::BitcoinGUI(QWidget *parent):
vbox->addLayout(hbox_address);
vbox->addLayout(hbox_balance);
- vbox->addWidget(createTabs());
+ transactionView = new TransactionView(this);
+ connect(transactionView, SIGNAL(doubleClicked(const QModelIndex&)), this, SLOT(transactionDetails(const QModelIndex&)));
+ vbox->addWidget(transactionView);
QWidget *centralwidget = new QWidget(this);
centralwidget->setLayout(vbox);
@@ -198,7 +198,11 @@ void BitcoinGUI::setModel(ClientModel *model)
connect(model, SIGNAL(error(QString,QString)), this, SLOT(error(QString,QString)));
// Put transaction list in tabs
- setTabsModel(model->getTransactionTableModel());
+ transactionView->setModel(model->getTransactionTableModel());
+
+ // Balloon popup for new transaction
+ connect(model->getTransactionTableModel(), SIGNAL(rowsInserted(const QModelIndex &, int, int)),
+ this, SLOT(incomingTransaction(const QModelIndex &, int, int)));
}
void BitcoinGUI::createTrayIcon()
@@ -227,69 +231,6 @@ void BitcoinGUI::trayIconActivated(QSystemTrayIcon::ActivationReason reason)
}
}
-QWidget *BitcoinGUI::createTabs()
-{
- QStringList tab_labels;
- tab_labels << tr("All transactions")
- << tr("Sent/Received")
- << tr("Sent")
- << tr("Received");
-
- QTabWidget *tabs = new QTabWidget(this);
- for(int i = 0; i < tab_labels.size(); ++i)
- {
- QTableView *view = new QTableView(this);
- tabs->addTab(view, tab_labels.at(i));
-
- connect(view, SIGNAL(doubleClicked(const QModelIndex&)), this, SLOT(transactionDetails(const QModelIndex&)));
- transactionViews.append(view);
- }
-
- return tabs;
-}
-
-void BitcoinGUI::setTabsModel(QAbstractItemModel *transaction_model)
-{
- QStringList tab_filters;
- tab_filters << "^."
- << "^["+TransactionTableModel::Sent+TransactionTableModel::Received+"]"
- << "^["+TransactionTableModel::Sent+"]"
- << "^["+TransactionTableModel::Received+"]";
-
- for(int i = 0; i < transactionViews.size(); ++i)
- {
- QSortFilterProxyModel *proxy_model = new QSortFilterProxyModel(this);
- proxy_model->setSourceModel(transaction_model);
- proxy_model->setDynamicSortFilter(true);
- proxy_model->setFilterRole(TransactionTableModel::TypeRole);
- proxy_model->setFilterRegExp(QRegExp(tab_filters.at(i)));
- proxy_model->setSortRole(Qt::EditRole);
-
- QTableView *transaction_table = transactionViews.at(i);
- transaction_table->setModel(proxy_model);
- transaction_table->setAlternatingRowColors(true);
- transaction_table->setSelectionBehavior(QAbstractItemView::SelectRows);
- transaction_table->setSelectionMode(QAbstractItemView::ExtendedSelection);
- transaction_table->setSortingEnabled(true);
- transaction_table->sortByColumn(TransactionTableModel::Status, Qt::DescendingOrder);
- transaction_table->verticalHeader()->hide();
-
- transaction_table->horizontalHeader()->resizeSection(
- TransactionTableModel::Status, 23);
- transaction_table->horizontalHeader()->resizeSection(
- TransactionTableModel::Date, 120);
- transaction_table->horizontalHeader()->resizeSection(
- TransactionTableModel::Type, 120);
- transaction_table->horizontalHeader()->setResizeMode(
- TransactionTableModel::ToAddress, QHeaderView::Stretch);
- transaction_table->horizontalHeader()->resizeSection(
- TransactionTableModel::Amount, 79);
- }
-
- connect(transaction_model, SIGNAL(rowsInserted(const QModelIndex &, int, int)),
- this, SLOT(incomingTransaction(const QModelIndex &, int, int)));
-}
-
void BitcoinGUI::sendcoinsClicked()
{
SendCoinsDialog dlg;