diff options
author | Wladimir J. van der Laan <laanwj@gmail.com> | 2011-06-18 11:53:25 +0200 |
---|---|---|
committer | Wladimir J. van der Laan <laanwj@gmail.com> | 2011-06-18 11:53:25 +0200 |
commit | 0f3981bea94cea957f0de4b128f7feffbfc2d9c6 (patch) | |
tree | 28b8fa9cf6dfdbf9b2f1358c35327264adfe200d | |
parent | aa5297266093eccd984a2d8fb20499617ef96c81 (diff) |
remove commented code, use // for one-line comments and comments inside functions
-rw-r--r-- | src/qt/addressbookdialog.cpp | 17 | ||||
-rw-r--r-- | src/qt/addresstablemodel.cpp | 21 | ||||
-rw-r--r-- | src/qt/bitcoin.cpp | 5 | ||||
-rw-r--r-- | src/qt/bitcoinaddressvalidator.cpp | 6 | ||||
-rw-r--r-- | src/qt/bitcoingui.cpp | 4 | ||||
-rw-r--r-- | src/qt/clientmodel.cpp | 10 | ||||
-rw-r--r-- | src/qt/monitoreddatamapper.cpp | 5 | ||||
-rw-r--r-- | src/qt/optionsdialog.cpp | 4 | ||||
-rw-r--r-- | src/qt/optionsmodel.cpp | 4 | ||||
-rw-r--r-- | src/qt/sendcoinsdialog.cpp | 4 | ||||
-rw-r--r-- | src/qt/transactiondesc.cpp | 7 | ||||
-rw-r--r-- | src/qt/transactionrecord.cpp | 3 | ||||
-rw-r--r-- | src/qt/transactiontablemodel.cpp | 50 |
13 files changed, 66 insertions, 74 deletions
diff --git a/src/qt/addressbookdialog.cpp b/src/qt/addressbookdialog.cpp index c716cd3eea..9126a645e1 100644 --- a/src/qt/addressbookdialog.cpp +++ b/src/qt/addressbookdialog.cpp @@ -36,10 +36,10 @@ AddressBookDialog::~AddressBookDialog() void AddressBookDialog::setModel(AddressTableModel *model) { this->model = model; - /* Refresh list from core */ + // Refresh list from core model->updateList(); - /* Receive filter */ + // Receive filter QSortFilterProxyModel *receive_model = new QSortFilterProxyModel(this); receive_model->setSourceModel(model); receive_model->setDynamicSortFilter(true); @@ -47,7 +47,7 @@ void AddressBookDialog::setModel(AddressTableModel *model) receive_model->setFilterFixedString(AddressTableModel::Receive); ui->receiveTableView->setModel(receive_model); - /* Send filter */ + // Send filter QSortFilterProxyModel *send_model = new QSortFilterProxyModel(this); send_model->setSourceModel(model); send_model->setDynamicSortFilter(true); @@ -55,7 +55,7 @@ void AddressBookDialog::setModel(AddressTableModel *model) send_model->setFilterFixedString(AddressTableModel::Send); ui->sendTableView->setModel(send_model); - /* Set column widths */ + // Set column widths ui->receiveTableView->horizontalHeader()->resizeSection( AddressTableModel::Address, 320); ui->receiveTableView->horizontalHeader()->setResizeMode( @@ -86,9 +86,8 @@ QTableView *AddressBookDialog::getCurrentTable() void AddressBookDialog::on_copyToClipboard_clicked() { - /* Copy currently selected address to clipboard - (or nothing, if nothing selected) - */ + // Copy currently selected address to clipboard + // (or nothing, if nothing selected) QTableView *table = getCurrentTable(); QModelIndexList indexes = table->selectionModel()->selectedRows(AddressTableModel::Address); @@ -106,11 +105,11 @@ void AddressBookDialog::on_editButton_clicked() { 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()); QModelIndex selected = proxy_model->mapToSource(indexes.at(0)); - /* Double click also triggers edit button */ + // Double click also triggers edit button EditAddressDialog dlg( ui->tabWidget->currentIndex() == SendingTab ? EditAddressDialog::EditSendingAddress : diff --git a/src/qt/addresstablemodel.cpp b/src/qt/addresstablemodel.cpp index 91b87fb7f1..2d69df3da0 100644 --- a/src/qt/addresstablemodel.cpp +++ b/src/qt/addresstablemodel.cpp @@ -23,7 +23,7 @@ struct AddressTableEntry type(type), label(label), address(address) {} }; -/* Private implementation */ +// Private implementation struct AddressTablePriv { QList<AddressTableEntry> cachedAddressTable; @@ -144,12 +144,12 @@ bool AddressTableModel::setData(const QModelIndex & index, const QVariant & valu rec->label = value.toString(); break; 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) { - /* Remove old entry */ + // Remove old entry CWalletDB().EraseName(rec->address.toStdString()); - /* Add new entry with new address */ + // Add new entry with new address SetAddressBookName(value.toString().toStdString(), rec->label.toStdString()); rec->address = value.toString(); @@ -191,7 +191,7 @@ QModelIndex AddressTableModel::index(int row, int column, const QModelIndex & pa void AddressTableModel::updateList() { - /* Update internal model from Bitcoin core */ + // Update internal model from Bitcoin core beginResetModel(); priv->refreshAddressTable(); endResetModel(); @@ -204,7 +204,7 @@ QString AddressTableModel::addRow(const QString &type, const QString &label, con if(type == Send) { - /* Check for duplicate */ + // Check for duplicate CRITICAL_BLOCK(cs_mapAddressBook) { if(mapAddressBook.count(strAddress)) @@ -215,14 +215,14 @@ QString AddressTableModel::addRow(const QString &type, const QString &label, con } 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()); } else { return QString(); } - /* Add entry and update list */ + // Add entry and update list SetAddressBookName(strAddress, strLabel); updateList(); return QString::fromStdString(strAddress); @@ -234,9 +234,8 @@ bool AddressTableModel::removeRows(int row, int count, const QModelIndex & paren AddressTableEntry *rec = priv->index(row); if(count != 1 || !rec || rec->type == AddressTableEntry::Receiving) { - /* Can only remove one row at a time, and cannot remove rows not in model. - Also refuse to remove receiving addresses. - */ + // Can only remove one row at a time, and cannot remove rows not in model. + // Also refuse to remove receiving addresses. return false; } CWalletDB().EraseName(rec->address.toStdString()); diff --git a/src/qt/bitcoin.cpp b/src/qt/bitcoin.cpp index a71c348254..cb24c1901d 100644 --- a/src/qt/bitcoin.cpp +++ b/src/qt/bitcoin.cpp @@ -57,9 +57,8 @@ bool ThreadSafeAskFee(int64 nFeeRequired, const std::string& strCaption, wxWindo return true; bool payFee = false; - /* Call slot on GUI thread. - If called from another thread, use a blocking QueuedConnection. - */ + // Call slot on GUI thread. + // If called from another thread, use a blocking QueuedConnection. Qt::ConnectionType connectionType = Qt::DirectConnection; if(QThread::currentThread() != QCoreApplication::instance()->thread()) { diff --git a/src/qt/bitcoinaddressvalidator.cpp b/src/qt/bitcoinaddressvalidator.cpp index 761a266933..92d7daeb88 100644 --- a/src/qt/bitcoinaddressvalidator.cpp +++ b/src/qt/bitcoinaddressvalidator.cpp @@ -22,7 +22,7 @@ BitcoinAddressValidator::BitcoinAddressValidator(QObject *parent) : QValidator::State BitcoinAddressValidator::validate(QString &input, int &pos) const { - /* Correction */ + // Correction for(int idx=0; idx<input.size(); ++idx) { 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; 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 != 'l' && ch != 'I' && ch != '0' && ch != 'O') { - /* Alphanumeric and not a 'forbidden' character */ + // Alphanumeric and not a 'forbidden' character } else { diff --git a/src/qt/bitcoingui.cpp b/src/qt/bitcoingui.cpp index 4e9a021351..4d3efe26db 100644 --- a/src/qt/bitcoingui.cpp +++ b/src/qt/bitcoingui.cpp @@ -429,7 +429,7 @@ void BitcoinGUI::askFee(qint64 nFeeRequired, bool *payFee) void BitcoinGUI::transactionDetails(const QModelIndex& idx) { - /* A transaction is doubleclicked */ + // A transaction is doubleclicked TransactionDescDialog dlg(idx); dlg.exec(); } @@ -443,7 +443,7 @@ void BitcoinGUI::incomingTransaction(const QModelIndex & parent, int start, int .data(Qt::EditRole).toULongLong(); 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) .data().toString(); QString description = ttm->index(start, TransactionTableModel::Description, parent) diff --git a/src/qt/clientmodel.cpp b/src/qt/clientmodel.cpp index 97391e0938..10cafaf1af 100644 --- a/src/qt/clientmodel.cpp +++ b/src/qt/clientmodel.cpp @@ -11,9 +11,8 @@ ClientModel::ClientModel(QObject *parent) : QObject(parent), optionsModel(0), addressTableModel(0), transactionTableModel(0) { - /* Until signal notifications is built into the bitcoin core, - simply update everything after polling using a timer. - */ + // Until signal notifications is built into the bitcoin core, + // simply update everything after polling using a timer. QTimer *timer = new QTimer(this); connect(timer, SIGNAL(timeout()), this, SLOT(update())); timer->start(MODEL_UPDATE_DELAY); @@ -63,9 +62,8 @@ int ClientModel::getNumTransactions() void ClientModel::update() { - /* Plainly emit all signals for now. To be precise this should check - wether the values actually changed first. - */ + // Plainly emit all signals for now. To be more efficient this should check + // whether the values actually changed first. emit balanceChanged(getBalance()); emit addressChanged(getAddress()); emit numConnectionsChanged(getNumConnections()); diff --git a/src/qt/monitoreddatamapper.cpp b/src/qt/monitoreddatamapper.cpp index e70aa7ebf6..7bf4fa6c8f 100644 --- a/src/qt/monitoreddatamapper.cpp +++ b/src/qt/monitoreddatamapper.cpp @@ -26,9 +26,8 @@ void MonitoredDataMapper::addMapping(QWidget *widget, int section, const QByteAr void MonitoredDataMapper::addChangeMonitor(QWidget *widget) { - /* Watch user property of widget for changes, and connect - the signal to our viewModified signal. - */ + // Watch user property of widget for changes, and connect + // the signal to our viewModified signal. QMetaProperty prop = widget->metaObject()->userProperty(); int signal = prop.notifySignalIndex(); int method = this->metaObject()->indexOfMethod("viewModified()"); diff --git a/src/qt/optionsdialog.cpp b/src/qt/optionsdialog.cpp index d46b48fb29..1bf123b285 100644 --- a/src/qt/optionsdialog.cpp +++ b/src/qt/optionsdialog.cpp @@ -207,7 +207,7 @@ MainOptionsPage::MainOptionsPage(QWidget *parent): layout->addLayout(fee_hbox); - layout->addStretch(1); /* Extra space at bottom */ + layout->addStretch(1); // Extra space at bottom setLayout(layout); @@ -221,7 +221,7 @@ MainOptionsPage::MainOptionsPage(QWidget *parent): void MainOptionsPage::setMapper(MonitoredDataMapper *mapper) { - /* Map model to widgets */ + // Map model to widgets mapper->addMapping(bitcoin_at_startup, OptionsModel::StartAtStartup); mapper->addMapping(minimize_to_tray, OptionsModel::MinimizeToTray); mapper->addMapping(map_port_upnp, OptionsModel::MapPortUPnP); diff --git a/src/qt/optionsmodel.cpp b/src/qt/optionsmodel.cpp index 1528fdf697..3788f9fd7c 100644 --- a/src/qt/optionsmodel.cpp +++ b/src/qt/optionsmodel.cpp @@ -75,7 +75,7 @@ bool OptionsModel::setData(const QModelIndex & index, const QVariant & value, in break; case ProxyIP: { - /* Use CAddress to parse IP */ + // Use CAddress to parse and check IP CAddress addr(value.toString().toStdString() + ":1"); if (addr.ip != INADDR_NONE) { @@ -111,7 +111,7 @@ bool OptionsModel::setData(const QModelIndex & index, const QVariant & value, in } else { - successful = false; /* parse error */ + successful = false; // Parse error } } break; diff --git a/src/qt/sendcoinsdialog.cpp b/src/qt/sendcoinsdialog.cpp index 1c11944e2c..01072c42e1 100644 --- a/src/qt/sendcoinsdialog.cpp +++ b/src/qt/sendcoinsdialog.cpp @@ -25,7 +25,7 @@ SendCoinsDialog::SendCoinsDialog(QWidget *parent, const QString &address) : GUIUtil::setupAddressWidget(ui->payTo, this); GUIUtil::setupAmountWidget(ui->payAmount, this); - /* Set initial address if provided */ + // Set initial send-to address if provided if(!address.isEmpty()) { ui->payTo->setText(address); @@ -94,7 +94,7 @@ void SendCoinsDialog::on_sendButton_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()); } diff --git a/src/qt/transactiondesc.cpp b/src/qt/transactiondesc.cpp index a9e55d5a6a..9120f19c7a 100644 --- a/src/qt/transactiondesc.cpp +++ b/src/qt/transactiondesc.cpp @@ -6,9 +6,10 @@ #include <QString> -/* Taken straight from ui.cpp - TODO: Convert to use QStrings, Qt::Escape and tr() - */ +// Taken straight from ui.cpp +// 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; diff --git a/src/qt/transactionrecord.cpp b/src/qt/transactionrecord.cpp index 6c1f3a5e58..34f30d53d5 100644 --- a/src/qt/transactionrecord.cpp +++ b/src/qt/transactionrecord.cpp @@ -26,7 +26,8 @@ bool TransactionRecord::showTransaction(const CWalletTx &wtx) return true; } -/* Decompose CWallet transaction to model transaction records. +/* + * Decompose CWallet transaction to model transaction records. */ QList<TransactionRecord> TransactionRecord::decomposeTransaction(const CWalletTx &wtx) { diff --git a/src/qt/transactiontablemodel.cpp b/src/qt/transactiontablemodel.cpp index d2cdd4a623..bed08d7802 100644 --- a/src/qt/transactiontablemodel.cpp +++ b/src/qt/transactiontablemodel.cpp @@ -17,7 +17,7 @@ const QString TransactionTableModel::Sent = "s"; const QString TransactionTableModel::Received = "r"; 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 { bool operator()(const TransactionRecord &a, const TransactionRecord &b) const @@ -34,7 +34,7 @@ struct TxLessThan } }; -/* Private implementation */ +// Private implementation struct TransactionTablePriv { TransactionTablePriv(TransactionTableModel *parent): @@ -50,13 +50,13 @@ struct TransactionTablePriv */ QList<TransactionRecord> cachedWallet; + /* Query entire wallet anew from core. + */ void refreshWallet() { #ifdef WALLET_UPDATE_DEBUG qDebug() << "refreshWallet"; #endif - /* Query entire wallet from core. - */ cachedWallet.clear(); 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. */ 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 qDebug() << "updateWallet"; #endif - /* 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 - the indices of latter ones). - */ + // 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 + // the indices of latter ones). QList<uint256> updated_sorted = updated; qSort(updated_sorted); @@ -113,7 +113,7 @@ struct TransactionTablePriv if(inWallet && !inModel) { - /* Added -- insert at the right position */ + // Added -- insert at the right position QList<TransactionRecord> toInsert = TransactionRecord::decomposeTransaction(mi->second); if(!toInsert.isEmpty()) /* only if something to insert */ @@ -130,14 +130,14 @@ struct TransactionTablePriv } else if(!inWallet && inModel) { - /* Removed -- remove entire transaction from table */ + // Removed -- remove entire transaction from table parent->beginRemoveRows(QModelIndex(), lowerIndex, upperIndex-1); cachedWallet.erase(lower, upper); parent->endRemoveRows(); } 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]; - /* If a status update is needed (blocks came in since last check), - update the status of this transaction from the wallet. Otherwise, - simply re-use the cached status. - */ + // If a status update is needed (blocks came in since last check), + // update the status of this transaction from the wallet. Otherwise, + // simply re-use the cached status. if(rec->statusUpdateNeeded()) { 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[] = { Qt::AlignLeft|Qt::AlignVCenter, Qt::AlignLeft|Qt::AlignVCenter, @@ -225,7 +224,7 @@ void TransactionTableModel::update() { QList<uint256> updated; - /* Check if there are changes to wallet map */ + // Check if there are changes to wallet map TRY_CRITICAL_BLOCK(cs_mapWallet) { if(!vWalletUpdated.empty()) @@ -242,9 +241,8 @@ void TransactionTableModel::update() { priv->updateWallet(updated); - /* Status (number of confirmations) and (possibly) description - columns changed for all rows. - */ + // Status (number of confirmations) and (possibly) description + // columns changed for all rows. emit dataChanged(index(0, Status), index(priv->size()-1, Status)); 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) { - /* Delegate to specific column handlers */ + // Delegate to specific column handlers switch(index.column()) { - //case Status: - // return formatTxStatus(rec); case Date: return formatTxDate(rec); case Description: @@ -459,7 +455,7 @@ QVariant TransactionTableModel::data(const QModelIndex &index, int role) const } 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()) { case Status: |