scripted-diff: Remove Q_FOREACH

-BEGIN VERIFY SCRIPT-
sed -i 's/Q_FOREACH *(\(.*\),/for (\1 :/' ./src/*.h ./src/*.cpp ./src/*/*.h ./src/*/*.cpp ./src/*/*/*.h ./src/*/*/*.cpp ;
-END VERIFY SCRIPT-
This commit is contained in:
Jorge Timón 2017-06-02 03:25:02 +02:00
parent 7c00c26726
commit 18dc3c3962
No known key found for this signature in database
GPG key ID: 8866C18EA1C944A2
17 changed files with 29 additions and 29 deletions

View file

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

View file

@ -1006,7 +1006,7 @@ void BitcoinGUI::dropEvent(QDropEvent *event)
{
if(event->mimeData()->hasUrls())
{
Q_FOREACH(const QUrl &uri, event->mimeData()->urls())
for (const QUrl &uri : event->mimeData()->urls())
{
Q_EMIT receivedURI(uri.toString());
}
@ -1202,7 +1202,7 @@ UnitDisplayStatusBarControl::UnitDisplayStatusBarControl(const PlatformStyle *pl
QList<BitcoinUnits::Unit> units = BitcoinUnits::availableUnits();
int max_width = 0;
const QFontMetrics fm(font());
Q_FOREACH (const BitcoinUnits::Unit unit, units)
for (const BitcoinUnits::Unit unit : units)
{
max_width = qMax(max_width, fm.width(BitcoinUnits::name(unit)));
}
@ -1221,7 +1221,7 @@ void UnitDisplayStatusBarControl::mousePressEvent(QMouseEvent *event)
void UnitDisplayStatusBarControl::createContextMenu()
{
menu = new QMenu(this);
Q_FOREACH(BitcoinUnits::Unit u, BitcoinUnits::availableUnits())
for (BitcoinUnits::Unit u : BitcoinUnits::availableUnits())
{
QAction *menuAction = new QAction(QString(BitcoinUnits::name(u)), this);
menuAction->setData(QVariant(u));

View file

@ -426,7 +426,7 @@ void CoinControlDialog::updateLabels(WalletModel *model, QDialog* dialog)
CAmount nPayAmount = 0;
bool fDust = false;
CMutableTransaction txDummy;
Q_FOREACH(const CAmount &amount, CoinControlDialog::payAmounts)
for (const CAmount &amount : CoinControlDialog::payAmounts)
{
nPayAmount += amount;

View file

@ -84,7 +84,7 @@ OptionsDialog::OptionsDialog(QWidget *parent, bool enableWallet) :
ui->lang->setToolTip(ui->lang->toolTip().arg(tr(PACKAGE_NAME)));
ui->lang->addItem(QString("(") + tr("default") + QString(")"), QVariant(""));
Q_FOREACH(const QString &langStr, translations.entryList())
for (const QString &langStr : translations.entryList())
{
QLocale locale(langStr);

View file

@ -144,7 +144,7 @@ void PaymentServer::LoadRootCAs(X509_STORE* _store)
int nRootCerts = 0;
const QDateTime currentTime = QDateTime::currentDateTime();
Q_FOREACH (const QSslCertificate& cert, certList) {
for (const QSslCertificate& cert : certList) {
// Don't log NULL certificates
if (cert.isNull())
continue;
@ -267,7 +267,7 @@ void PaymentServer::ipcParseCommandLine(int argc, char* argv[])
bool PaymentServer::ipcSendCommandLine()
{
bool fResult = false;
Q_FOREACH (const QString& r, savedPaymentRequests)
for (const QString& r : savedPaymentRequests)
{
QLocalSocket* socket = new QLocalSocket();
socket->connectToServer(ipcServerName(), QIODevice::WriteOnly);
@ -392,7 +392,7 @@ void PaymentServer::uiReady()
initNetManager();
saveURIs = false;
Q_FOREACH (const QString& s, savedPaymentRequests)
for (const QString& s : savedPaymentRequests)
{
handleURIOrFile(s);
}
@ -555,7 +555,7 @@ bool PaymentServer::processPaymentRequest(const PaymentRequestPlus& request, Sen
QList<std::pair<CScript, CAmount> > sendingTos = request.getPayTo();
QStringList addresses;
Q_FOREACH(const PAIRTYPE(CScript, CAmount)& sendingTo, sendingTos) {
for (const PAIRTYPE(CScript, CAmount)& sendingTo : sendingTos) {
// Extract and check destination addresses
CTxDestination dest;
if (ExtractDestination(sendingTo.first, dest)) {
@ -742,7 +742,7 @@ void PaymentServer::reportSslErrors(QNetworkReply* reply, const QList<QSslError>
Q_UNUSED(reply);
QString errString;
Q_FOREACH (const QSslError& err, errs) {
for (const QSslError& err : errs) {
qWarning() << "PaymentServer::reportSslErrors: " << err;
errString += err.errorString() + "\n";
}

View file

@ -62,7 +62,7 @@ public:
#if QT_VERSION >= 0x040700
cachedNodeStats.reserve(vstats.size());
#endif
Q_FOREACH (const CNodeStats& nodestats, vstats)
for (const CNodeStats& nodestats : vstats)
{
CNodeCombinedStats stats;
stats.nodeStateStats.nMisbehavior = 0;
@ -91,7 +91,7 @@ public:
// build index map
mapNodeRows.clear();
int row = 0;
Q_FOREACH (const CNodeCombinedStats& stats, cachedNodeStats)
for (const CNodeCombinedStats& stats : cachedNodeStats)
mapNodeRows.insert(std::pair<NodeId, int>(stats.nodeStats.nodeid, row++));
}

View file

@ -48,7 +48,7 @@ void MakeSingleColorImage(QImage& img, const QColor& colorbase)
QIcon ColorizeIcon(const QIcon& ico, const QColor& colorbase)
{
QIcon new_ico;
Q_FOREACH(const QSize sz, ico.availableSizes())
for (const QSize sz : ico.availableSizes())
{
QImage img(ico.pixmap(sz).toImage());
MakeSingleColorImage(img, colorbase);

View file

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

View file

@ -265,7 +265,7 @@ void SendCoinsDialog::on_sendButton_clicked()
// Format confirmation message
QStringList formatted;
Q_FOREACH(const SendCoinsRecipient &rcp, currentTransaction.getRecipients())
for (const SendCoinsRecipient &rcp : currentTransaction.getRecipients())
{
// generate bold amount string
QString amount = "<b>" + BitcoinUnits::formatHtmlWithUnit(model->getOptionsModel()->getDisplayUnit(), rcp.amount);
@ -319,7 +319,7 @@ void SendCoinsDialog::on_sendButton_clicked()
questionString.append("<hr />");
CAmount totalAmount = currentTransaction.getTotalTransactionAmount() + txFee;
QStringList alternativeUnits;
Q_FOREACH(BitcoinUnits::Unit u, BitcoinUnits::availableUnits())
for (BitcoinUnits::Unit u : BitcoinUnits::availableUnits())
{
if(u != model->getOptionsModel()->getDisplayUnit())
alternativeUnits.append(BitcoinUnits::formatHtmlWithUnit(u, totalAmount));

View file

@ -188,7 +188,7 @@ void SplashScreen::unsubscribeFromCoreSignals()
uiInterface.InitMessage.disconnect(boost::bind(InitMessage, this, _1));
uiInterface.ShowProgress.disconnect(boost::bind(ShowProgress, this, _1, _2));
#ifdef ENABLE_WALLET
Q_FOREACH(CWallet* const & pwallet, connectedWallets) {
for (CWallet* const & pwallet : connectedWallets) {
pwallet->ShowProgress.disconnect(boost::bind(ShowProgress, this, _1, _2));
}
#endif

View file

@ -196,7 +196,7 @@ void PaymentServerTests::paymentServerTests()
QVERIFY(r.paymentRequest.IsInitialized());
// Extract address and amount from the request
QList<std::pair<CScript, CAmount> > sendingTos = r.paymentRequest.getPayTo();
Q_FOREACH (const PAIRTYPE(CScript, CAmount)& sendingTo, sendingTos) {
for (const PAIRTYPE(CScript, CAmount)& sendingTo : sendingTos) {
CTxDestination dest;
if (ExtractDestination(sendingTo.first, dest))
QCOMPARE(PaymentServer::verifyAmount(sendingTo.second), false);

View file

@ -139,10 +139,10 @@ void TrafficGraphWidget::updateRates()
}
float tmax = 0.0f;
Q_FOREACH(float f, vSamplesIn) {
for (float f : vSamplesIn) {
if(f > tmax) tmax = f;
}
Q_FOREACH(float f, vSamplesOut) {
for (float f : vSamplesOut) {
if(f > tmax) tmax = f;
}
fMax = tmax;

View file

@ -245,14 +245,14 @@ QString TransactionDesc::toHTML(CWallet *wallet, CWalletTx &wtx, TransactionReco
strHTML += "<b>" + tr("Output index") + ":</b> " + QString::number(rec->getOutputIndex()) + "<br>";
// Message from normal bitcoin:URI (bitcoin:123...?message=example)
Q_FOREACH (const PAIRTYPE(std::string, std::string)& r, wtx.vOrderForm)
for (const PAIRTYPE(std::string, std::string)& r : wtx.vOrderForm)
if (r.first == "Message")
strHTML += "<br><b>" + tr("Message") + ":</b><br>" + GUIUtil::HtmlEscape(r.second, true) + "<br>";
//
// PaymentRequest info:
//
Q_FOREACH (const PAIRTYPE(std::string, std::string)& r, wtx.vOrderForm)
for (const PAIRTYPE(std::string, std::string)& r : wtx.vOrderForm)
{
if (r.first == "PaymentRequest")
{

View file

@ -145,7 +145,7 @@ public:
{
parent->beginInsertRows(QModelIndex(), lowerIndex, lowerIndex+toInsert.size()-1);
int insert_idx = lowerIndex;
Q_FOREACH(const TransactionRecord &rec, toInsert)
for (const TransactionRecord &rec : toInsert)
{
cachedWallet.insert(insert_idx, rec);
insert_idx += 1;

View file

@ -106,7 +106,7 @@ HelpMessageDialog::HelpMessageDialog(QWidget *parent, bool about) :
QTextCharFormat bold;
bold.setFontWeight(QFont::Bold);
Q_FOREACH (const QString &line, coreOptions.split("\n")) {
for (const QString &line : coreOptions.split("\n")) {
if (line.startsWith(" -"))
{
cursor.currentTable()->appendRows(1);

View file

@ -207,7 +207,7 @@ WalletModel::SendCoinsReturn WalletModel::prepareTransaction(WalletModelTransact
int nAddresses = 0;
// Pre-check input data for validity
Q_FOREACH(const SendCoinsRecipient &rcp, recipients)
for (const SendCoinsRecipient &rcp : recipients)
{
if (rcp.fSubtractFeeFromAmount)
fSubtractFeeFromAmount = true;
@ -310,7 +310,7 @@ WalletModel::SendCoinsReturn WalletModel::sendCoins(WalletModelTransaction &tran
LOCK2(cs_main, wallet->cs_wallet);
CWalletTx *newTx = transaction.getTransaction();
Q_FOREACH(const SendCoinsRecipient &rcp, transaction.getRecipients())
for (const SendCoinsRecipient &rcp : transaction.getRecipients())
{
if (rcp.paymentRequest.IsInitialized())
{
@ -341,7 +341,7 @@ WalletModel::SendCoinsReturn WalletModel::sendCoins(WalletModelTransaction &tran
// Add addresses / update labels that we've sent to to the address book,
// and emit coinsSent signal for each recipient
Q_FOREACH(const SendCoinsRecipient &rcp, transaction.getRecipients())
for (const SendCoinsRecipient &rcp : transaction.getRecipients())
{
// Don't touch the address book when we have a payment request
if (!rcp.paymentRequest.IsInitialized())

View file

@ -82,7 +82,7 @@ void WalletModelTransaction::reassignAmounts(int nChangePosRet)
CAmount WalletModelTransaction::getTotalTransactionAmount()
{
CAmount totalTransactionAmount = 0;
Q_FOREACH(const SendCoinsRecipient &rcp, recipients)
for (const SendCoinsRecipient &rcp : recipients)
{
totalTransactionAmount += rcp.amount;
}