summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTobias Markmann <tm@ayena.de>2016-04-04 14:41:44 (GMT)
committerTobias Markmann <tm@ayena.de>2016-04-04 14:41:44 (GMT)
commit3c560e31b0f168da917e8d566db01fd1cd997d86 (patch)
treea6d1c5c276d3571c6303a31af9f3cefd34b13d52 /Swift/QtUI/UserSearch
parent4f3821a090931499b9c68b3b3ad785a98ea9d742 (diff)
downloadswift-3c560e31b0f168da917e8d566db01fd1cd997d86.zip
swift-3c560e31b0f168da917e8d566db01fd1cd997d86.tar.bz2
Modernize code to use range based for loops using clang-tidy
Run 'clang-tidy -fix -checks=modernize-loop-convert' on all source code files on OS X. This does not modernize platform specific code on Linux and Windows Test-Information: Code builds and unit tests pass on OS X 10.11.4. Change-Id: I65b99e0978cfab8ca6de2a3e5342e7a81416c12c
Diffstat (limited to 'Swift/QtUI/UserSearch')
-rw-r--r--Swift/QtUI/UserSearch/QtContactListWidget.cpp6
-rw-r--r--Swift/QtUI/UserSearch/QtUserSearchWindow.cpp6
2 files changed, 6 insertions, 6 deletions
diff --git a/Swift/QtUI/UserSearch/QtContactListWidget.cpp b/Swift/QtUI/UserSearch/QtContactListWidget.cpp
index 99bd791..1dbfc1f 100644
--- a/Swift/QtUI/UserSearch/QtContactListWidget.cpp
+++ b/Swift/QtUI/UserSearch/QtContactListWidget.cpp
@@ -86,9 +86,9 @@ bool QtContactListWidget::isFull() const {
void QtContactListWidget::updateContacts(const std::vector<Contact::ref>& contactUpdates) {
std::vector<Contact::ref> contacts = contactListModel_->getList();
foreach(const Contact::ref& contactUpdate, contactUpdates) {
- for(size_t n = 0; n < contacts.size(); n++) {
- if (contactUpdate->jid == contacts[n]->jid) {
- contacts[n] = contactUpdate;
+ for(auto& contact : contacts) {
+ if (contactUpdate->jid == contact->jid) {
+ contact = contactUpdate;
break;
}
}
diff --git a/Swift/QtUI/UserSearch/QtUserSearchWindow.cpp b/Swift/QtUI/UserSearch/QtUserSearchWindow.cpp
index 83b8df6..6b56811 100644
--- a/Swift/QtUI/UserSearch/QtUserSearchWindow.cpp
+++ b/Swift/QtUI/UserSearch/QtUserSearchWindow.cpp
@@ -557,9 +557,9 @@ void QtUserSearchWindow::clearForm() {
fieldsPage_->fetchingThrobber_->movie()->start();
fieldsPage_->fetchingLabel_->show();
QWidget* legacySearchWidgets[8] = {fieldsPage_->nickInputLabel_, fieldsPage_->nickInput_, fieldsPage_->firstInputLabel_, fieldsPage_->firstInput_, fieldsPage_->lastInputLabel_, fieldsPage_->lastInput_, fieldsPage_->emailInputLabel_, fieldsPage_->emailInput_};
- for (int i = 0; i < 8; i++) {
- legacySearchWidgets[i]->hide();
- if (QLineEdit* edit = qobject_cast<QLineEdit*>(legacySearchWidgets[i])) {
+ for (auto& legacySearchWidget : legacySearchWidgets) {
+ legacySearchWidget->hide();
+ if (QLineEdit* edit = qobject_cast<QLineEdit*>(legacySearchWidget)) {
edit->clear();
}
}