Browse Source

Merge pull request #6378

5e058e7 [Qt] constify foreach uses where possible (Philip Kaufmann)
0.13
Wladimir J. van der Laan 10 years ago
parent
commit
aa565327ec
No known key found for this signature in database
GPG Key ID: 74810B012346C9A6
  1. 3
      src/qt/addressbookpage.cpp
  2. 6
      src/qt/clientmodel.cpp
  3. 9
      src/qt/coincontroldialog.cpp
  4. 3
      src/qt/receivecoinsdialog.cpp

3
src/qt/addressbookpage.cpp

@ -254,8 +254,7 @@ void AddressBookPage::done(int retval)
// Figure out which address was selected, and return it // Figure out which address was selected, and return it
QModelIndexList indexes = table->selectionModel()->selectedRows(AddressTableModel::Address); QModelIndexList indexes = table->selectionModel()->selectedRows(AddressTableModel::Address);
foreach (QModelIndex index, indexes) foreach (const QModelIndex& index, indexes) {
{
QVariant address = table->model()->data(index); QVariant address = table->model()->data(index);
returnValue = address.toString(); returnValue = address.toString();
} }

6
src/qt/clientmodel.cpp

@ -53,9 +53,9 @@ int ClientModel::getNumConnections(unsigned int flags) const
return vNodes.size(); return vNodes.size();
int nNum = 0; int nNum = 0;
BOOST_FOREACH(CNode* pnode, vNodes) BOOST_FOREACH(const CNode* pnode, vNodes)
if (flags & (pnode->fInbound ? CONNECTIONS_IN : CONNECTIONS_OUT)) if (flags & (pnode->fInbound ? CONNECTIONS_IN : CONNECTIONS_OUT))
nNum++; nNum++;
return nNum; return nNum;
} }

9
src/qt/coincontroldialog.cpp

@ -492,8 +492,7 @@ void CoinControlDialog::updateLabels(WalletModel *model, QDialog* dialog)
coinControl->ListSelected(vCoinControl); coinControl->ListSelected(vCoinControl);
model->getOutputs(vCoinControl, vOutputs); model->getOutputs(vCoinControl, vOutputs);
BOOST_FOREACH(const COutput& out, vOutputs) BOOST_FOREACH(const COutput& out, vOutputs) {
{
// unselect already spent, very unlikely scenario, this could happen // unselect already spent, very unlikely scenario, this could happen
// when selected are spent elsewhere, like rpc or another computer // when selected are spent elsewhere, like rpc or another computer
uint256 txhash = out.tx->GetHash(); uint256 txhash = out.tx->GetHash();
@ -691,8 +690,7 @@ void CoinControlDialog::updateView()
map<QString, vector<COutput> > mapCoins; map<QString, vector<COutput> > mapCoins;
model->listCoins(mapCoins); model->listCoins(mapCoins);
BOOST_FOREACH(PAIRTYPE(QString, vector<COutput>) coins, mapCoins) BOOST_FOREACH(const PAIRTYPE(QString, vector<COutput>)& coins, mapCoins) {
{
QTreeWidgetItem *itemWalletAddress = new QTreeWidgetItem(); QTreeWidgetItem *itemWalletAddress = new QTreeWidgetItem();
itemWalletAddress->setCheckState(COLUMN_CHECKBOX, Qt::Unchecked); itemWalletAddress->setCheckState(COLUMN_CHECKBOX, Qt::Unchecked);
QString sWalletAddress = coins.first; QString sWalletAddress = coins.first;
@ -719,8 +717,7 @@ void CoinControlDialog::updateView()
double dPrioritySum = 0; double dPrioritySum = 0;
int nChildren = 0; int nChildren = 0;
int nInputSum = 0; int nInputSum = 0;
BOOST_FOREACH(const COutput& out, coins.second) BOOST_FOREACH(const COutput& out, coins.second) {
{
int nInputSize = 0; int nInputSize = 0;
nSum += out.tx->vout[out.i].nValue; nSum += out.tx->vout[out.i].nValue;
nChildren++; nChildren++;

3
src/qt/receivecoinsdialog.cpp

@ -185,8 +185,7 @@ void ReceiveCoinsDialog::on_showRequestButton_clicked()
return; return;
QModelIndexList selection = ui->recentRequestsView->selectionModel()->selectedRows(); QModelIndexList selection = ui->recentRequestsView->selectionModel()->selectedRows();
foreach (QModelIndex index, selection) foreach (const QModelIndex& index, selection) {
{
on_recentRequestsView_doubleClicked(index); on_recentRequestsView_doubleClicked(index);
} }
} }

Loading…
Cancel
Save