summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'Swift/QtUI')
-rw-r--r--Swift/QtUI/QtChatTabs.cpp4
-rw-r--r--Swift/QtUI/QtChatTabsShortcutOnlySubstitute.cpp6
-rw-r--r--Swift/QtUI/QtLoginWindow.cpp4
-rw-r--r--Swift/QtUI/QtTextEdit.cpp16
-rw-r--r--Swift/QtUI/QtVCardWidget/QtVCardPhotoAndNameFields.cpp4
-rw-r--r--Swift/QtUI/QtWebView.cpp7
-rw-r--r--Swift/QtUI/UserSearch/QtContactListWidget.cpp6
-rw-r--r--Swift/QtUI/UserSearch/QtUserSearchWindow.cpp6
8 files changed, 26 insertions, 27 deletions
diff --git a/Swift/QtUI/QtChatTabs.cpp b/Swift/QtUI/QtChatTabs.cpp
index 3609cc9..650d807 100644
--- a/Swift/QtUI/QtChatTabs.cpp
+++ b/Swift/QtUI/QtChatTabs.cpp
@@ -228,7 +228,7 @@ void QtChatTabs::handleRequestedNextTab() {
void QtChatTabs::handleRequestedActiveTab() {
QtTabbable::AlertType types[] = {QtTabbable::WaitingActivity, QtTabbable::ImpendingActivity};
bool finished = false;
- for (int j = 0; j < 2; j++) {
+ for (auto& type : types) {
bool looped = false;
for (int i = dynamicGrid_->currentIndex() + 1; !finished && i != dynamicGrid_->currentIndex(); i++) {
if (i >= dynamicGrid_->count()) {
@@ -238,7 +238,7 @@ void QtChatTabs::handleRequestedActiveTab() {
looped = true;
i = 0;
}
- if (qobject_cast<QtTabbable*>(dynamicGrid_->widget(i))->getWidgetAlertState() == types[j]) {
+ if (qobject_cast<QtTabbable*>(dynamicGrid_->widget(i))->getWidgetAlertState() == type) {
dynamicGrid_->setCurrentIndex(i);
finished = true;
break;
diff --git a/Swift/QtUI/QtChatTabsShortcutOnlySubstitute.cpp b/Swift/QtUI/QtChatTabsShortcutOnlySubstitute.cpp
index 2c064f8..fb41446 100644
--- a/Swift/QtUI/QtChatTabsShortcutOnlySubstitute.cpp
+++ b/Swift/QtUI/QtChatTabsShortcutOnlySubstitute.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015 Isode Limited.
+ * Copyright (c) 2015-2016 Isode Limited.
* All rights reserved.
* See the COPYING file for more information.
*/
@@ -64,14 +64,14 @@ void QtChatTabsShortcutOnlySubstitute::handleRequestedActiveTab() {
QList<QtTabbable*> tabs = tabbableWindows();
- for (int j = 0; j < 2; j++) {
+ for (auto& type : types) {
int startIndex = tabs.indexOf(senderTab);
int currentIndex = startIndex;
do {
currentIndex = (currentIndex + 1) % tabs.size();
QtTabbable* currentTab = tabs.at(currentIndex);
- if (currentTab->getWidgetAlertState() == types[j]) {
+ if (currentTab->getWidgetAlertState() == type) {
currentTab->activateWindow();
return;
}
diff --git a/Swift/QtUI/QtLoginWindow.cpp b/Swift/QtUI/QtLoginWindow.cpp
index b2778a1..bc859e9 100644
--- a/Swift/QtUI/QtLoginWindow.cpp
+++ b/Swift/QtUI/QtLoginWindow.cpp
@@ -372,8 +372,8 @@ void QtLoginWindow::setIsLoggingIn(bool loggingIn) {
/* Change the for loop as well if you add to this.*/
QWidget* widgets[5] = {username_, password_, remember_, loginAutomatically_, certificateButton_};
loginButton_->setText(loggingIn ? tr("Cancel") : tr("Connect"));
- for (int i = 0; i < 5; i++) {
- widgets[i]->setEnabled(!loggingIn);
+ for (auto& widget : widgets) {
+ widget->setEnabled(!loggingIn);
}
bool eagle = settings_->getSetting(SettingConstants::FORGET_PASSWORDS);
remember_->setEnabled(!eagle);
diff --git a/Swift/QtUI/QtTextEdit.cpp b/Swift/QtUI/QtTextEdit.cpp
index e0ca619..846dcbc 100644
--- a/Swift/QtUI/QtTextEdit.cpp
+++ b/Swift/QtUI/QtTextEdit.cpp
@@ -107,9 +107,9 @@ void QtTextEdit::replaceMisspelledWord(const QString& word, int cursorPosition)
PositionPair QtTextEdit::getWordFromCursor(int cursorPosition) {
PositionPairList misspelledPositions = highlighter_->getMisspelledPositions();
- for (PositionPairList::iterator it = misspelledPositions.begin(); it != misspelledPositions.end(); ++it) {
- if (cursorPosition >= boost::get<0>(*it) && cursorPosition <= boost::get<1>(*it)) {
- return *it;
+ for (auto& misspelledPosition : misspelledPositions) {
+ if (cursorPosition >= boost::get<0>(misspelledPosition) && cursorPosition <= boost::get<1>(misspelledPosition)) {
+ return misspelledPosition;
}
}
return boost::make_tuple(-1,-1);
@@ -134,9 +134,9 @@ void QtTextEdit::contextMenuEvent(QContextMenuEvent* event) {
if (result == settingsAction) {
spellCheckerSettingsWindow();
}
- for (std::vector<QAction*>::iterator it = replaceWordActions_.begin(); it != replaceWordActions_.end(); ++it) {
- if (*it == result) {
- replaceMisspelledWord((*it)->text(), cursor.position());
+ for (auto& replaceWordAction : replaceWordActions_) {
+ if (replaceWordAction == result) {
+ replaceMisspelledWord(replaceWordAction->text(), cursor.position());
}
}
#else
@@ -167,8 +167,8 @@ void QtTextEdit::addSuggestions(QMenu* menu, QContextMenuEvent* event)
menu->insertAction(insertPoint, noSuggestions);
}
else {
- for (std::vector<std::string>::iterator it = wordList.begin(); it != wordList.end(); ++it) {
- QAction* wordAction = new QAction(it->c_str(), menu);
+ for (auto& word : wordList) {
+ QAction* wordAction = new QAction(word.c_str(), menu);
menu->insertAction(insertPoint, wordAction);
replaceWordActions_.push_back(wordAction);
}
diff --git a/Swift/QtUI/QtVCardWidget/QtVCardPhotoAndNameFields.cpp b/Swift/QtUI/QtVCardWidget/QtVCardPhotoAndNameFields.cpp
index 90d6e5e..eef6728 100644
--- a/Swift/QtUI/QtVCardWidget/QtVCardPhotoAndNameFields.cpp
+++ b/Swift/QtUI/QtVCardWidget/QtVCardPhotoAndNameFields.cpp
@@ -73,8 +73,8 @@ void QtVCardPhotoAndNameFields::setEditable(bool editable) {
QStringList fullname;
fullname << ui->lineEditPREFIX->text() << ui->lineEditGIVEN->text() << ui->lineEditMIDDLE->text();
fullname << ui->lineEditFAMILY->text() << ui->lineEditSUFFIX->text();
- for (QStringList::iterator i = fullname.begin(); i != fullname.end(); i++) {
- *i = i->trimmed();
+ for (auto& i : fullname) {
+ i = i.trimmed();
}
ui->labelFULLNAME->setText((fullname.filter(QRegExp(".+"))).join(" "));
}
diff --git a/Swift/QtUI/QtWebView.cpp b/Swift/QtUI/QtWebView.cpp
index 717310b..b8eb7a5 100644
--- a/Swift/QtUI/QtWebView.cpp
+++ b/Swift/QtUI/QtWebView.cpp
@@ -55,11 +55,10 @@ void QtWebView::contextMenuEvent(QContextMenuEvent* ev) {
QMenu* menu = page()->createStandardContextMenu();
QList<QAction*> actions(menu->actions());
- for (int i = 0; i < actions.size(); ++i) {
- QAction* action = actions.at(i);
+ for (auto action : actions) {
bool removeAction = true;
- for(size_t j = 0; j < filteredActions.size(); ++j) {
- if (action == pageAction(filteredActions[j])) {
+ for(auto& filteredAction : filteredActions) {
+ if (action == pageAction(filteredAction)) {
removeAction = false;
break;
}
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();
}
}