Merge branch 'master' into v0.12.0.x_merge_btc010_master (fix spaces)

This commit is contained in:
UdjinM6 2015-05-16 02:34:25 +03:00
commit 18c60f9ecb
9 changed files with 66 additions and 5 deletions

View File

@ -5,7 +5,7 @@ suites:
- "precise"
architectures:
- "amd64"
packages:
packages:
- "g++-multilib"
- "git-core"
- "pkg-config"

View File

@ -1,6 +1,6 @@
package=native_ccache
$(package)_version=3.1.9
$(package)_download_path=http://samba.org/ftp/ccache
$(package)_download_path=http://www.samba.org/ftp/ccache
$(package)_file_name=ccache-$($(package)_version).tar.bz2
$(package)_sha256_hash=04d3e2e438ac8d4cc4b110b68cdd61bd59226c6588739a4a386869467f5ced7c

View File

@ -581,6 +581,10 @@ QWidget#AddressBookPage QTableView { /* Address Listing */
font-size:12px;
}
QWidget#AddressBookPage QHeaderView::section { /* Min width for Windows fix */
min-width:260px;
}
/* SETTINGS MENU */
/* Encrypt Wallet and Change Passphrase Dialog */

View File

@ -21,7 +21,7 @@ TransactionFilterProxy::TransactionFilterProxy(QObject *parent) :
dateFrom(MIN_DATE),
dateTo(MAX_DATE),
addrPrefix(),
typeFilter(ALL_TYPES),
typeFilter(COMMON_TYPES),
watchOnlyFilter(WatchOnlyFilter_All),
minAmount(0),
limitRows(-1),

View File

@ -24,6 +24,8 @@ public:
static const QDateTime MAX_DATE;
/** Type filter bit field (all types) */
static const quint32 ALL_TYPES = 0xFFFFFFFF;
/** Type filter bit field (all types but Darksend-SPAM) */
static const quint32 COMMON_TYPES = 4223;
static quint32 TYPE(int type) { return 1<<type; }

View File

@ -80,6 +80,7 @@ TransactionView::TransactionView(QWidget *parent) :
typeWidget->setFixedWidth(TYPE_COLUMN_WIDTH);
#endif
typeWidget->addItem(tr("Most Common"), TransactionFilterProxy::COMMON_TYPES);
typeWidget->addItem(tr("All"), TransactionFilterProxy::ALL_TYPES);
typeWidget->addItem(tr("Received with"), TransactionFilterProxy::TYPE(TransactionRecord::RecvWithAddress) |
TransactionFilterProxy::TYPE(TransactionRecord::RecvFromOther));
@ -167,6 +168,7 @@ TransactionView::TransactionView(QWidget *parent) :
connect(amountWidget, SIGNAL(textChanged(QString)), this, SLOT(changedAmount(QString)));
connect(view, SIGNAL(doubleClicked(QModelIndex)), this, SIGNAL(doubleClicked(QModelIndex)));
connect(view, SIGNAL(clicked(QModelIndex)), this, SLOT(computeSum()));
connect(view, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(contextualMenu(QPoint)));
connect(copyAddressAction, SIGNAL(triggered()), this, SLOT(copyAddress()));
@ -205,6 +207,9 @@ void TransactionView::setModel(WalletModel *model)
transactionView->setColumnWidth(TransactionTableModel::Type, TYPE_COLUMN_WIDTH);
transactionView->setColumnWidth(TransactionTableModel::Amount, AMOUNT_MINIMUM_COLUMN_WIDTH);
// Note: it's a good idea to connect this signal AFTER the model is set
connect(transactionView->selectionModel(), SIGNAL(selectionChanged(QItemSelection, QItemSelection)), this, SLOT(computeSum()));
columnResizingFixer = new GUIUtil::TableViewLastColumnResizingFixer(transactionView, AMOUNT_MINIMUM_COLUMN_WIDTH, MINIMUM_COLUMN_WIDTH);
if (model->getOptionsModel())
@ -441,6 +446,25 @@ void TransactionView::showDetails()
}
}
/** Compute sum of all selected transactions */
void TransactionView::computeSum()
{
QString amountText;
qint64 amount = 0;
int nDisplayUnit = model->getOptionsModel()->getDisplayUnit();
if(!transactionView->selectionModel())
return;
QModelIndexList selection = transactionView->selectionModel()->selectedRows();
if(!selection.isEmpty()){
foreach (QModelIndex index, selection){
amount += index.data(TransactionTableModel::AmountRole).toLongLong();
}
QString strAmount(BitcoinUnits::formatWithUnit(nDisplayUnit, amount, true));
emit trxAmount(strAmount);
}
}
void TransactionView::openThirdPartyTxUrl(QString url)
{
if(!transactionView || !transactionView->selectionModel())
@ -500,6 +524,8 @@ void TransactionView::focusTransaction(const QModelIndex &idx)
if(!transactionProxyModel)
return;
QModelIndex targetIdx = transactionProxyModel->mapFromSource(idx);
transactionView->selectRow(targetIdx.row());
computeSum();
transactionView->scrollTo(targetIdx);
transactionView->setCurrentIndex(targetIdx);
transactionView->setFocus();

7
src/qt/transactionview.h Executable file → Normal file
View File

@ -17,6 +17,7 @@ QT_BEGIN_NAMESPACE
class QComboBox;
class QDateTimeEdit;
class QFrame;
class QItemSelectionModel;
class QLineEdit;
class QMenu;
class QModelIndex;
@ -61,7 +62,6 @@ private:
WalletModel *model;
TransactionFilterProxy *transactionProxyModel;
QTableView *transactionView;
QComboBox *dateWidget;
QComboBox *typeWidget;
QComboBox *watchOnlyWidget;
@ -101,6 +101,9 @@ signals:
/** Fired when a message should be reported to the user */
void message(const QString &title, const QString &message, unsigned int style);
/** Send computed sum back to wallet-view */
void trxAmount(QString amount);
public slots:
void chooseDate(int idx);
void chooseType(int idx);
@ -109,7 +112,7 @@ public slots:
void changedAmount(const QString &amount);
void exportClicked();
void focusTransaction(const QModelIndex&);
void computeSum();
};
#endif // BITCOIN_QT_TRANSACTIONVIEW_H

View File

@ -24,6 +24,7 @@
#include <QActionGroup>
#include <QFileDialog>
#include <QHBoxLayout>
#include <QLabel>
#include <QProgressDialog>
#include <QPushButton>
#include <QVBoxLayout>
@ -47,6 +48,17 @@ WalletView::WalletView(QWidget *parent):
exportButton->setIcon(QIcon(":/icons/export"));
#endif
hbox_buttons->addStretch();
// Sum of selected transactions
QLabel *transactionSumLabel = new QLabel(); // Label
transactionSumLabel->setText("Selected amount: ");
hbox_buttons->addWidget(transactionSumLabel);
transactionSum = new QLabel(); // Amount
transactionSum->setMinimumSize(200, 8);
transactionSum->setTextInteractionFlags(Qt::TextSelectableByMouse);
hbox_buttons->addWidget(transactionSum);
hbox_buttons->addWidget(exportButton);
vbox->addLayout(hbox_buttons);
transactionsPage->setLayout(vbox);
@ -65,6 +77,9 @@ WalletView::WalletView(QWidget *parent):
// Double-clicking on a transaction on the transaction history page shows details
connect(transactionView, SIGNAL(doubleClicked(QModelIndex)), transactionView, SLOT(showDetails()));
// Update wallet with sum of selected transactions
connect(transactionView, SIGNAL(trxAmount(QString)), this, SLOT(trxAmount(QString)));
// Clicking on "Export" allows to export the transaction list
connect(exportButton, SIGNAL(clicked()), transactionView, SLOT(exportClicked()));
@ -316,3 +331,9 @@ void WalletView::showProgress(const QString &title, int nProgress)
else if (progressDialog)
progressDialog->setValue(nProgress);
}
/** Update wallet with the sum of the selected transactions */
void WalletView::trxAmount(QString amount)
{
transactionSum->setText(amount);
}

View File

@ -19,6 +19,7 @@ class TransactionView;
class WalletModel;
QT_BEGIN_NAMESPACE
class QLabel;
class QModelIndex;
class QProgressDialog;
QT_END_NAMESPACE
@ -64,6 +65,7 @@ private:
TransactionView *transactionView;
QProgressDialog *progressDialog;
QLabel *transactionSum;
public slots:
/** Switch to overview (home) page */
@ -107,6 +109,9 @@ public slots:
/** Show progress dialog e.g. for rescan */
void showProgress(const QString &title, int nProgress);
/** Update selected DASH amount from transactionview */
void trxAmount(QString amount);
signals:
/** Signal that we want to show the main window */
void showNormalIfMinimized();