mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-02-10 10:52:31 -05:00
remove commented code, use // for one-line comments and comments inside functions
This commit is contained in:
parent
aa52972660
commit
0f3981bea9
13 changed files with 66 additions and 74 deletions
|
@ -36,10 +36,10 @@ AddressBookDialog::~AddressBookDialog()
|
||||||
void AddressBookDialog::setModel(AddressTableModel *model)
|
void AddressBookDialog::setModel(AddressTableModel *model)
|
||||||
{
|
{
|
||||||
this->model = model;
|
this->model = model;
|
||||||
/* Refresh list from core */
|
// Refresh list from core
|
||||||
model->updateList();
|
model->updateList();
|
||||||
|
|
||||||
/* Receive filter */
|
// Receive filter
|
||||||
QSortFilterProxyModel *receive_model = new QSortFilterProxyModel(this);
|
QSortFilterProxyModel *receive_model = new QSortFilterProxyModel(this);
|
||||||
receive_model->setSourceModel(model);
|
receive_model->setSourceModel(model);
|
||||||
receive_model->setDynamicSortFilter(true);
|
receive_model->setDynamicSortFilter(true);
|
||||||
|
@ -47,7 +47,7 @@ void AddressBookDialog::setModel(AddressTableModel *model)
|
||||||
receive_model->setFilterFixedString(AddressTableModel::Receive);
|
receive_model->setFilterFixedString(AddressTableModel::Receive);
|
||||||
ui->receiveTableView->setModel(receive_model);
|
ui->receiveTableView->setModel(receive_model);
|
||||||
|
|
||||||
/* Send filter */
|
// Send filter
|
||||||
QSortFilterProxyModel *send_model = new QSortFilterProxyModel(this);
|
QSortFilterProxyModel *send_model = new QSortFilterProxyModel(this);
|
||||||
send_model->setSourceModel(model);
|
send_model->setSourceModel(model);
|
||||||
send_model->setDynamicSortFilter(true);
|
send_model->setDynamicSortFilter(true);
|
||||||
|
@ -55,7 +55,7 @@ void AddressBookDialog::setModel(AddressTableModel *model)
|
||||||
send_model->setFilterFixedString(AddressTableModel::Send);
|
send_model->setFilterFixedString(AddressTableModel::Send);
|
||||||
ui->sendTableView->setModel(send_model);
|
ui->sendTableView->setModel(send_model);
|
||||||
|
|
||||||
/* Set column widths */
|
// Set column widths
|
||||||
ui->receiveTableView->horizontalHeader()->resizeSection(
|
ui->receiveTableView->horizontalHeader()->resizeSection(
|
||||||
AddressTableModel::Address, 320);
|
AddressTableModel::Address, 320);
|
||||||
ui->receiveTableView->horizontalHeader()->setResizeMode(
|
ui->receiveTableView->horizontalHeader()->setResizeMode(
|
||||||
|
@ -86,9 +86,8 @@ QTableView *AddressBookDialog::getCurrentTable()
|
||||||
|
|
||||||
void AddressBookDialog::on_copyToClipboard_clicked()
|
void AddressBookDialog::on_copyToClipboard_clicked()
|
||||||
{
|
{
|
||||||
/* Copy currently selected address to clipboard
|
// Copy currently selected address to clipboard
|
||||||
(or nothing, if nothing selected)
|
// (or nothing, if nothing selected)
|
||||||
*/
|
|
||||||
QTableView *table = getCurrentTable();
|
QTableView *table = getCurrentTable();
|
||||||
QModelIndexList indexes = table->selectionModel()->selectedRows(AddressTableModel::Address);
|
QModelIndexList indexes = table->selectionModel()->selectedRows(AddressTableModel::Address);
|
||||||
|
|
||||||
|
@ -106,11 +105,11 @@ void AddressBookDialog::on_editButton_clicked()
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
/* Map selected index to source address book model */
|
// Map selected index to source address book model
|
||||||
QAbstractProxyModel *proxy_model = static_cast<QAbstractProxyModel*>(getCurrentTable()->model());
|
QAbstractProxyModel *proxy_model = static_cast<QAbstractProxyModel*>(getCurrentTable()->model());
|
||||||
QModelIndex selected = proxy_model->mapToSource(indexes.at(0));
|
QModelIndex selected = proxy_model->mapToSource(indexes.at(0));
|
||||||
|
|
||||||
/* Double click also triggers edit button */
|
// Double click also triggers edit button
|
||||||
EditAddressDialog dlg(
|
EditAddressDialog dlg(
|
||||||
ui->tabWidget->currentIndex() == SendingTab ?
|
ui->tabWidget->currentIndex() == SendingTab ?
|
||||||
EditAddressDialog::EditSendingAddress :
|
EditAddressDialog::EditSendingAddress :
|
||||||
|
|
|
@ -23,7 +23,7 @@ struct AddressTableEntry
|
||||||
type(type), label(label), address(address) {}
|
type(type), label(label), address(address) {}
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Private implementation */
|
// Private implementation
|
||||||
struct AddressTablePriv
|
struct AddressTablePriv
|
||||||
{
|
{
|
||||||
QList<AddressTableEntry> cachedAddressTable;
|
QList<AddressTableEntry> cachedAddressTable;
|
||||||
|
@ -144,12 +144,12 @@ bool AddressTableModel::setData(const QModelIndex & index, const QVariant & valu
|
||||||
rec->label = value.toString();
|
rec->label = value.toString();
|
||||||
break;
|
break;
|
||||||
case Address:
|
case Address:
|
||||||
/* Double-check that we're not overwriting receiving address */
|
// Double-check that we're not overwriting receiving address
|
||||||
if(rec->type == AddressTableEntry::Sending)
|
if(rec->type == AddressTableEntry::Sending)
|
||||||
{
|
{
|
||||||
/* Remove old entry */
|
// Remove old entry
|
||||||
CWalletDB().EraseName(rec->address.toStdString());
|
CWalletDB().EraseName(rec->address.toStdString());
|
||||||
/* Add new entry with new address */
|
// Add new entry with new address
|
||||||
SetAddressBookName(value.toString().toStdString(), rec->label.toStdString());
|
SetAddressBookName(value.toString().toStdString(), rec->label.toStdString());
|
||||||
|
|
||||||
rec->address = value.toString();
|
rec->address = value.toString();
|
||||||
|
@ -191,7 +191,7 @@ QModelIndex AddressTableModel::index(int row, int column, const QModelIndex & pa
|
||||||
|
|
||||||
void AddressTableModel::updateList()
|
void AddressTableModel::updateList()
|
||||||
{
|
{
|
||||||
/* Update internal model from Bitcoin core */
|
// Update internal model from Bitcoin core
|
||||||
beginResetModel();
|
beginResetModel();
|
||||||
priv->refreshAddressTable();
|
priv->refreshAddressTable();
|
||||||
endResetModel();
|
endResetModel();
|
||||||
|
@ -204,7 +204,7 @@ QString AddressTableModel::addRow(const QString &type, const QString &label, con
|
||||||
|
|
||||||
if(type == Send)
|
if(type == Send)
|
||||||
{
|
{
|
||||||
/* Check for duplicate */
|
// Check for duplicate
|
||||||
CRITICAL_BLOCK(cs_mapAddressBook)
|
CRITICAL_BLOCK(cs_mapAddressBook)
|
||||||
{
|
{
|
||||||
if(mapAddressBook.count(strAddress))
|
if(mapAddressBook.count(strAddress))
|
||||||
|
@ -215,14 +215,14 @@ QString AddressTableModel::addRow(const QString &type, const QString &label, con
|
||||||
}
|
}
|
||||||
else if(type == Receive)
|
else if(type == Receive)
|
||||||
{
|
{
|
||||||
/* Generate a new address to associate with given label */
|
// Generate a new address to associate with given label
|
||||||
strAddress = PubKeyToAddress(GetKeyFromKeyPool());
|
strAddress = PubKeyToAddress(GetKeyFromKeyPool());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return QString();
|
return QString();
|
||||||
}
|
}
|
||||||
/* Add entry and update list */
|
// Add entry and update list
|
||||||
SetAddressBookName(strAddress, strLabel);
|
SetAddressBookName(strAddress, strLabel);
|
||||||
updateList();
|
updateList();
|
||||||
return QString::fromStdString(strAddress);
|
return QString::fromStdString(strAddress);
|
||||||
|
@ -234,9 +234,8 @@ bool AddressTableModel::removeRows(int row, int count, const QModelIndex & paren
|
||||||
AddressTableEntry *rec = priv->index(row);
|
AddressTableEntry *rec = priv->index(row);
|
||||||
if(count != 1 || !rec || rec->type == AddressTableEntry::Receiving)
|
if(count != 1 || !rec || rec->type == AddressTableEntry::Receiving)
|
||||||
{
|
{
|
||||||
/* Can only remove one row at a time, and cannot remove rows not in model.
|
// Can only remove one row at a time, and cannot remove rows not in model.
|
||||||
Also refuse to remove receiving addresses.
|
// Also refuse to remove receiving addresses.
|
||||||
*/
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
CWalletDB().EraseName(rec->address.toStdString());
|
CWalletDB().EraseName(rec->address.toStdString());
|
||||||
|
|
|
@ -57,9 +57,8 @@ bool ThreadSafeAskFee(int64 nFeeRequired, const std::string& strCaption, wxWindo
|
||||||
return true;
|
return true;
|
||||||
bool payFee = false;
|
bool payFee = false;
|
||||||
|
|
||||||
/* Call slot on GUI thread.
|
// Call slot on GUI thread.
|
||||||
If called from another thread, use a blocking QueuedConnection.
|
// If called from another thread, use a blocking QueuedConnection.
|
||||||
*/
|
|
||||||
Qt::ConnectionType connectionType = Qt::DirectConnection;
|
Qt::ConnectionType connectionType = Qt::DirectConnection;
|
||||||
if(QThread::currentThread() != QCoreApplication::instance()->thread())
|
if(QThread::currentThread() != QCoreApplication::instance()->thread())
|
||||||
{
|
{
|
||||||
|
|
|
@ -22,7 +22,7 @@ BitcoinAddressValidator::BitcoinAddressValidator(QObject *parent) :
|
||||||
|
|
||||||
QValidator::State BitcoinAddressValidator::validate(QString &input, int &pos) const
|
QValidator::State BitcoinAddressValidator::validate(QString &input, int &pos) const
|
||||||
{
|
{
|
||||||
/* Correction */
|
// Correction
|
||||||
for(int idx=0; idx<input.size(); ++idx)
|
for(int idx=0; idx<input.size(); ++idx)
|
||||||
{
|
{
|
||||||
switch(input.at(idx).unicode())
|
switch(input.at(idx).unicode())
|
||||||
|
@ -40,7 +40,7 @@ QValidator::State BitcoinAddressValidator::validate(QString &input, int &pos) co
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Validation */
|
// Validation
|
||||||
QValidator::State state = QValidator::Acceptable;
|
QValidator::State state = QValidator::Acceptable;
|
||||||
for(int idx=0; idx<input.size(); ++idx)
|
for(int idx=0; idx<input.size(); ++idx)
|
||||||
{
|
{
|
||||||
|
@ -51,7 +51,7 @@ QValidator::State BitcoinAddressValidator::validate(QString &input, int &pos) co
|
||||||
(ch >= 'A' && ch<='Z')) &&
|
(ch >= 'A' && ch<='Z')) &&
|
||||||
ch != 'l' && ch != 'I' && ch != '0' && ch != 'O')
|
ch != 'l' && ch != 'I' && ch != '0' && ch != 'O')
|
||||||
{
|
{
|
||||||
/* Alphanumeric and not a 'forbidden' character */
|
// Alphanumeric and not a 'forbidden' character
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -429,7 +429,7 @@ void BitcoinGUI::askFee(qint64 nFeeRequired, bool *payFee)
|
||||||
|
|
||||||
void BitcoinGUI::transactionDetails(const QModelIndex& idx)
|
void BitcoinGUI::transactionDetails(const QModelIndex& idx)
|
||||||
{
|
{
|
||||||
/* A transaction is doubleclicked */
|
// A transaction is doubleclicked
|
||||||
TransactionDescDialog dlg(idx);
|
TransactionDescDialog dlg(idx);
|
||||||
dlg.exec();
|
dlg.exec();
|
||||||
}
|
}
|
||||||
|
@ -443,7 +443,7 @@ void BitcoinGUI::incomingTransaction(const QModelIndex & parent, int start, int
|
||||||
.data(Qt::EditRole).toULongLong();
|
.data(Qt::EditRole).toULongLong();
|
||||||
if((credit+debit)>0)
|
if((credit+debit)>0)
|
||||||
{
|
{
|
||||||
/* On incoming transaction, make an info balloon */
|
// On incoming transaction, make an info balloon
|
||||||
QString date = ttm->index(start, TransactionTableModel::Date, parent)
|
QString date = ttm->index(start, TransactionTableModel::Date, parent)
|
||||||
.data().toString();
|
.data().toString();
|
||||||
QString description = ttm->index(start, TransactionTableModel::Description, parent)
|
QString description = ttm->index(start, TransactionTableModel::Description, parent)
|
||||||
|
|
|
@ -11,9 +11,8 @@ ClientModel::ClientModel(QObject *parent) :
|
||||||
QObject(parent), optionsModel(0), addressTableModel(0),
|
QObject(parent), optionsModel(0), addressTableModel(0),
|
||||||
transactionTableModel(0)
|
transactionTableModel(0)
|
||||||
{
|
{
|
||||||
/* Until signal notifications is built into the bitcoin core,
|
// Until signal notifications is built into the bitcoin core,
|
||||||
simply update everything after polling using a timer.
|
// simply update everything after polling using a timer.
|
||||||
*/
|
|
||||||
QTimer *timer = new QTimer(this);
|
QTimer *timer = new QTimer(this);
|
||||||
connect(timer, SIGNAL(timeout()), this, SLOT(update()));
|
connect(timer, SIGNAL(timeout()), this, SLOT(update()));
|
||||||
timer->start(MODEL_UPDATE_DELAY);
|
timer->start(MODEL_UPDATE_DELAY);
|
||||||
|
@ -63,9 +62,8 @@ int ClientModel::getNumTransactions()
|
||||||
|
|
||||||
void ClientModel::update()
|
void ClientModel::update()
|
||||||
{
|
{
|
||||||
/* Plainly emit all signals for now. To be precise this should check
|
// Plainly emit all signals for now. To be more efficient this should check
|
||||||
wether the values actually changed first.
|
// whether the values actually changed first.
|
||||||
*/
|
|
||||||
emit balanceChanged(getBalance());
|
emit balanceChanged(getBalance());
|
||||||
emit addressChanged(getAddress());
|
emit addressChanged(getAddress());
|
||||||
emit numConnectionsChanged(getNumConnections());
|
emit numConnectionsChanged(getNumConnections());
|
||||||
|
|
|
@ -26,9 +26,8 @@ void MonitoredDataMapper::addMapping(QWidget *widget, int section, const QByteAr
|
||||||
|
|
||||||
void MonitoredDataMapper::addChangeMonitor(QWidget *widget)
|
void MonitoredDataMapper::addChangeMonitor(QWidget *widget)
|
||||||
{
|
{
|
||||||
/* Watch user property of widget for changes, and connect
|
// Watch user property of widget for changes, and connect
|
||||||
the signal to our viewModified signal.
|
// the signal to our viewModified signal.
|
||||||
*/
|
|
||||||
QMetaProperty prop = widget->metaObject()->userProperty();
|
QMetaProperty prop = widget->metaObject()->userProperty();
|
||||||
int signal = prop.notifySignalIndex();
|
int signal = prop.notifySignalIndex();
|
||||||
int method = this->metaObject()->indexOfMethod("viewModified()");
|
int method = this->metaObject()->indexOfMethod("viewModified()");
|
||||||
|
|
|
@ -207,7 +207,7 @@ MainOptionsPage::MainOptionsPage(QWidget *parent):
|
||||||
|
|
||||||
layout->addLayout(fee_hbox);
|
layout->addLayout(fee_hbox);
|
||||||
|
|
||||||
layout->addStretch(1); /* Extra space at bottom */
|
layout->addStretch(1); // Extra space at bottom
|
||||||
|
|
||||||
setLayout(layout);
|
setLayout(layout);
|
||||||
|
|
||||||
|
@ -221,7 +221,7 @@ MainOptionsPage::MainOptionsPage(QWidget *parent):
|
||||||
|
|
||||||
void MainOptionsPage::setMapper(MonitoredDataMapper *mapper)
|
void MainOptionsPage::setMapper(MonitoredDataMapper *mapper)
|
||||||
{
|
{
|
||||||
/* Map model to widgets */
|
// Map model to widgets
|
||||||
mapper->addMapping(bitcoin_at_startup, OptionsModel::StartAtStartup);
|
mapper->addMapping(bitcoin_at_startup, OptionsModel::StartAtStartup);
|
||||||
mapper->addMapping(minimize_to_tray, OptionsModel::MinimizeToTray);
|
mapper->addMapping(minimize_to_tray, OptionsModel::MinimizeToTray);
|
||||||
mapper->addMapping(map_port_upnp, OptionsModel::MapPortUPnP);
|
mapper->addMapping(map_port_upnp, OptionsModel::MapPortUPnP);
|
||||||
|
|
|
@ -75,7 +75,7 @@ bool OptionsModel::setData(const QModelIndex & index, const QVariant & value, in
|
||||||
break;
|
break;
|
||||||
case ProxyIP:
|
case ProxyIP:
|
||||||
{
|
{
|
||||||
/* Use CAddress to parse IP */
|
// Use CAddress to parse and check IP
|
||||||
CAddress addr(value.toString().toStdString() + ":1");
|
CAddress addr(value.toString().toStdString() + ":1");
|
||||||
if (addr.ip != INADDR_NONE)
|
if (addr.ip != INADDR_NONE)
|
||||||
{
|
{
|
||||||
|
@ -111,7 +111,7 @@ bool OptionsModel::setData(const QModelIndex & index, const QVariant & value, in
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
successful = false; /* parse error */
|
successful = false; // Parse error
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -25,7 +25,7 @@ SendCoinsDialog::SendCoinsDialog(QWidget *parent, const QString &address) :
|
||||||
GUIUtil::setupAddressWidget(ui->payTo, this);
|
GUIUtil::setupAddressWidget(ui->payTo, this);
|
||||||
GUIUtil::setupAmountWidget(ui->payAmount, this);
|
GUIUtil::setupAmountWidget(ui->payAmount, this);
|
||||||
|
|
||||||
/* Set initial address if provided */
|
// Set initial send-to address if provided
|
||||||
if(!address.isEmpty())
|
if(!address.isEmpty())
|
||||||
{
|
{
|
||||||
ui->payTo->setText(address);
|
ui->payTo->setText(address);
|
||||||
|
@ -94,7 +94,7 @@ void SendCoinsDialog::on_sendButton_clicked()
|
||||||
|
|
||||||
void SendCoinsDialog::on_pasteButton_clicked()
|
void SendCoinsDialog::on_pasteButton_clicked()
|
||||||
{
|
{
|
||||||
/* Paste text from clipboard into recipient field */
|
// Paste text from clipboard into recipient field
|
||||||
ui->payTo->setText(QApplication::clipboard()->text());
|
ui->payTo->setText(QApplication::clipboard()->text());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -6,9 +6,10 @@
|
||||||
|
|
||||||
#include <QString>
|
#include <QString>
|
||||||
|
|
||||||
/* Taken straight from ui.cpp
|
// Taken straight from ui.cpp
|
||||||
TODO: Convert to use QStrings, Qt::Escape and tr()
|
// TODO: Convert to use QStrings, Qt::Escape and tr()
|
||||||
*/
|
// or: refactor and put describeAsHTML() into bitcoin core but that is unneccesary with better
|
||||||
|
// UI<->core API, no need to put display logic in core.
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
|
|
|
@ -26,7 +26,8 @@ bool TransactionRecord::showTransaction(const CWalletTx &wtx)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Decompose CWallet transaction to model transaction records.
|
/*
|
||||||
|
* Decompose CWallet transaction to model transaction records.
|
||||||
*/
|
*/
|
||||||
QList<TransactionRecord> TransactionRecord::decomposeTransaction(const CWalletTx &wtx)
|
QList<TransactionRecord> TransactionRecord::decomposeTransaction(const CWalletTx &wtx)
|
||||||
{
|
{
|
||||||
|
|
|
@ -17,7 +17,7 @@ const QString TransactionTableModel::Sent = "s";
|
||||||
const QString TransactionTableModel::Received = "r";
|
const QString TransactionTableModel::Received = "r";
|
||||||
const QString TransactionTableModel::Other = "o";
|
const QString TransactionTableModel::Other = "o";
|
||||||
|
|
||||||
/* Comparison operator for sort/binary search of model tx list */
|
// Comparison operator for sort/binary search of model tx list
|
||||||
struct TxLessThan
|
struct TxLessThan
|
||||||
{
|
{
|
||||||
bool operator()(const TransactionRecord &a, const TransactionRecord &b) const
|
bool operator()(const TransactionRecord &a, const TransactionRecord &b) const
|
||||||
|
@ -34,7 +34,7 @@ struct TxLessThan
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Private implementation */
|
// Private implementation
|
||||||
struct TransactionTablePriv
|
struct TransactionTablePriv
|
||||||
{
|
{
|
||||||
TransactionTablePriv(TransactionTableModel *parent):
|
TransactionTablePriv(TransactionTableModel *parent):
|
||||||
|
@ -50,13 +50,13 @@ struct TransactionTablePriv
|
||||||
*/
|
*/
|
||||||
QList<TransactionRecord> cachedWallet;
|
QList<TransactionRecord> cachedWallet;
|
||||||
|
|
||||||
|
/* Query entire wallet anew from core.
|
||||||
|
*/
|
||||||
void refreshWallet()
|
void refreshWallet()
|
||||||
{
|
{
|
||||||
#ifdef WALLET_UPDATE_DEBUG
|
#ifdef WALLET_UPDATE_DEBUG
|
||||||
qDebug() << "refreshWallet";
|
qDebug() << "refreshWallet";
|
||||||
#endif
|
#endif
|
||||||
/* Query entire wallet from core.
|
|
||||||
*/
|
|
||||||
cachedWallet.clear();
|
cachedWallet.clear();
|
||||||
CRITICAL_BLOCK(cs_mapWallet)
|
CRITICAL_BLOCK(cs_mapWallet)
|
||||||
{
|
{
|
||||||
|
@ -67,20 +67,20 @@ struct TransactionTablePriv
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Update our model of the wallet incrementally.
|
/* Update our model of the wallet incrementally, to synchronize our model of the wallet
|
||||||
|
with that of the core.
|
||||||
|
|
||||||
Call with list of hashes of transactions that were added, removed or changed.
|
Call with list of hashes of transactions that were added, removed or changed.
|
||||||
*/
|
*/
|
||||||
void updateWallet(const QList<uint256> &updated)
|
void updateWallet(const QList<uint256> &updated)
|
||||||
{
|
{
|
||||||
/* Walk through updated transactions, update model as needed.
|
// Walk through updated transactions, update model as needed.
|
||||||
*/
|
|
||||||
#ifdef WALLET_UPDATE_DEBUG
|
#ifdef WALLET_UPDATE_DEBUG
|
||||||
qDebug() << "updateWallet";
|
qDebug() << "updateWallet";
|
||||||
#endif
|
#endif
|
||||||
/* Sort update list, and iterate through it in reverse, so that model updates
|
// Sort update list, and iterate through it in reverse, so that model updates
|
||||||
can be emitted from end to beginning (so that earlier updates will not influence
|
// can be emitted from end to beginning (so that earlier updates will not influence
|
||||||
the indices of latter ones).
|
// the indices of latter ones).
|
||||||
*/
|
|
||||||
QList<uint256> updated_sorted = updated;
|
QList<uint256> updated_sorted = updated;
|
||||||
qSort(updated_sorted);
|
qSort(updated_sorted);
|
||||||
|
|
||||||
|
@ -113,7 +113,7 @@ struct TransactionTablePriv
|
||||||
|
|
||||||
if(inWallet && !inModel)
|
if(inWallet && !inModel)
|
||||||
{
|
{
|
||||||
/* Added -- insert at the right position */
|
// Added -- insert at the right position
|
||||||
QList<TransactionRecord> toInsert =
|
QList<TransactionRecord> toInsert =
|
||||||
TransactionRecord::decomposeTransaction(mi->second);
|
TransactionRecord::decomposeTransaction(mi->second);
|
||||||
if(!toInsert.isEmpty()) /* only if something to insert */
|
if(!toInsert.isEmpty()) /* only if something to insert */
|
||||||
|
@ -130,14 +130,14 @@ struct TransactionTablePriv
|
||||||
}
|
}
|
||||||
else if(!inWallet && inModel)
|
else if(!inWallet && inModel)
|
||||||
{
|
{
|
||||||
/* Removed -- remove entire transaction from table */
|
// Removed -- remove entire transaction from table
|
||||||
parent->beginRemoveRows(QModelIndex(), lowerIndex, upperIndex-1);
|
parent->beginRemoveRows(QModelIndex(), lowerIndex, upperIndex-1);
|
||||||
cachedWallet.erase(lower, upper);
|
cachedWallet.erase(lower, upper);
|
||||||
parent->endRemoveRows();
|
parent->endRemoveRows();
|
||||||
}
|
}
|
||||||
else if(inWallet && inModel)
|
else if(inWallet && inModel)
|
||||||
{
|
{
|
||||||
/* Updated -- nothing to do, status update will take care of this */
|
// Updated -- nothing to do, status update will take care of this
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -154,10 +154,9 @@ struct TransactionTablePriv
|
||||||
{
|
{
|
||||||
TransactionRecord *rec = &cachedWallet[idx];
|
TransactionRecord *rec = &cachedWallet[idx];
|
||||||
|
|
||||||
/* If a status update is needed (blocks came in since last check),
|
// If a status update is needed (blocks came in since last check),
|
||||||
update the status of this transaction from the wallet. Otherwise,
|
// update the status of this transaction from the wallet. Otherwise,
|
||||||
simply re-use the cached status.
|
// simply re-use the cached status.
|
||||||
*/
|
|
||||||
if(rec->statusUpdateNeeded())
|
if(rec->statusUpdateNeeded())
|
||||||
{
|
{
|
||||||
CRITICAL_BLOCK(cs_mapWallet)
|
CRITICAL_BLOCK(cs_mapWallet)
|
||||||
|
@ -193,7 +192,7 @@ struct TransactionTablePriv
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Credit and Debit columns are right-aligned as they contain numbers */
|
// Credit and Debit columns are right-aligned as they contain numbers
|
||||||
static int column_alignments[] = {
|
static int column_alignments[] = {
|
||||||
Qt::AlignLeft|Qt::AlignVCenter,
|
Qt::AlignLeft|Qt::AlignVCenter,
|
||||||
Qt::AlignLeft|Qt::AlignVCenter,
|
Qt::AlignLeft|Qt::AlignVCenter,
|
||||||
|
@ -225,7 +224,7 @@ void TransactionTableModel::update()
|
||||||
{
|
{
|
||||||
QList<uint256> updated;
|
QList<uint256> updated;
|
||||||
|
|
||||||
/* Check if there are changes to wallet map */
|
// Check if there are changes to wallet map
|
||||||
TRY_CRITICAL_BLOCK(cs_mapWallet)
|
TRY_CRITICAL_BLOCK(cs_mapWallet)
|
||||||
{
|
{
|
||||||
if(!vWalletUpdated.empty())
|
if(!vWalletUpdated.empty())
|
||||||
|
@ -242,9 +241,8 @@ void TransactionTableModel::update()
|
||||||
{
|
{
|
||||||
priv->updateWallet(updated);
|
priv->updateWallet(updated);
|
||||||
|
|
||||||
/* Status (number of confirmations) and (possibly) description
|
// Status (number of confirmations) and (possibly) description
|
||||||
columns changed for all rows.
|
// columns changed for all rows.
|
||||||
*/
|
|
||||||
emit dataChanged(index(0, Status), index(priv->size()-1, Status));
|
emit dataChanged(index(0, Status), index(priv->size()-1, Status));
|
||||||
emit dataChanged(index(0, Description), index(priv->size()-1, Description));
|
emit dataChanged(index(0, Description), index(priv->size()-1, Description));
|
||||||
}
|
}
|
||||||
|
@ -442,11 +440,9 @@ QVariant TransactionTableModel::data(const QModelIndex &index, int role) const
|
||||||
}
|
}
|
||||||
else if(role == Qt::DisplayRole)
|
else if(role == Qt::DisplayRole)
|
||||||
{
|
{
|
||||||
/* Delegate to specific column handlers */
|
// Delegate to specific column handlers
|
||||||
switch(index.column())
|
switch(index.column())
|
||||||
{
|
{
|
||||||
//case Status:
|
|
||||||
// return formatTxStatus(rec);
|
|
||||||
case Date:
|
case Date:
|
||||||
return formatTxDate(rec);
|
return formatTxDate(rec);
|
||||||
case Description:
|
case Description:
|
||||||
|
@ -459,7 +455,7 @@ QVariant TransactionTableModel::data(const QModelIndex &index, int role) const
|
||||||
}
|
}
|
||||||
else if(role == Qt::EditRole)
|
else if(role == Qt::EditRole)
|
||||||
{
|
{
|
||||||
/* Edit role is used for sorting so return the real values */
|
// Edit role is used for sorting so return the real values
|
||||||
switch(index.column())
|
switch(index.column())
|
||||||
{
|
{
|
||||||
case Status:
|
case Status:
|
||||||
|
|
Loading…
Add table
Reference in a new issue