diff options
author | Tobias Markmann <tm@ayena.de> | 2016-11-23 07:09:39 (GMT) |
---|---|---|
committer | Tobias Markmann <tm@ayena.de> | 2016-11-23 11:30:02 (GMT) |
commit | e405ff3561be3d3c0bd79d7d5173923a8828cf02 (patch) | |
tree | 9118ef838ebfaec1df90ec24761944b5d833774c /Swift/QtUI/QtAdHocCommandWindow.cpp | |
parent | 8a71b91be885652f37c5aab5e1ecf25af4599fbc (diff) | |
download | swift-e405ff3561be3d3c0bd79d7d5173923a8828cf02.zip swift-e405ff3561be3d3c0bd79d7d5173923a8828cf02.tar.bz2 |
Migrate remaining Swiften/Base/foreach.h use to range-based for loop
Test-Information:
Build on macOS 10.12.1 and all tests pass.
Change-Id: Iedaa3fa7e7672c77909fd0568bf30e9393cb87e0
Diffstat (limited to 'Swift/QtUI/QtAdHocCommandWindow.cpp')
-rw-r--r-- | Swift/QtUI/QtAdHocCommandWindow.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/Swift/QtUI/QtAdHocCommandWindow.cpp b/Swift/QtUI/QtAdHocCommandWindow.cpp index 6b982b1..65dac91 100644 --- a/Swift/QtUI/QtAdHocCommandWindow.cpp +++ b/Swift/QtUI/QtAdHocCommandWindow.cpp @@ -77,98 +77,98 @@ void QtAdHocCommandWindow::setOnline(bool online) { nextButton_->setEnabled(false); backButton_->setEnabled(false); completeButton_->setEnabled(false); errorLabel_->setVisible(true); } } void QtAdHocCommandWindow::closeEvent(QCloseEvent*) { onClosing(); } void QtAdHocCommandWindow::handleCancelClicked() { command_->cancel(); close(); } void QtAdHocCommandWindow::handlePrevClicked() { command_->goBack(); } void QtAdHocCommandWindow::handleNextClicked() { command_->goNext(formWidget_ ? formWidget_->getCompletedForm() : Form::ref()); } void QtAdHocCommandWindow::handleCompleteClicked() { command_->complete(formWidget_ ? formWidget_->getCompletedForm() : Form::ref()); } void QtAdHocCommandWindow::handleNextStageReceived(Command::ref command) { QString notes; - foreach (Command::Note note, command->getNotes()) { + for (const auto& note : command->getNotes()) { if (!notes.isEmpty()) { notes += "\n"; } QString qNote(P2QSTRING(note.note)); switch (note.type) { case Command::Note::Error: notes += tr("Error: %1").arg(qNote); break; case Command::Note::Warn: notes += tr("Warning: %1").arg(qNote); break; case Command::Note::Info: notes += qNote; break; } } label_->setText(notes); if (command->getForm()) { setForm(command->getForm()); } else { setNoForm(notes.isEmpty()); } setAvailableActions(command); } void QtAdHocCommandWindow::handleError(ErrorPayload::ref /*error*/) { nextButton_->setEnabled(false); backButton_->setEnabled(false); completeButton_->setEnabled(false); label_->setText(tr("Error executing command")); } void QtAdHocCommandWindow::setForm(Form::ref form) { form_ = form; delete formWidget_; formWidget_ = new QtFormWidget(form, this); layout_->insertWidget(FormLayoutIndex, formWidget_); show(); } void QtAdHocCommandWindow::setNoForm(bool andHide) { form_.reset(); delete formWidget_; formWidget_ = nullptr; resize(minimumSize()); setVisible(!andHide); } typedef std::pair<Command::Action, QPushButton*> ActionButton; void QtAdHocCommandWindow::setAvailableActions(Command::ref /*commandResult*/) { okButton_->show(); okButton_->setEnabled(true); - foreach (ActionButton pair, actions_) { + for (auto&& pair : actions_) { OutgoingAdHocCommandSession::ActionState state = command_->getActionState(pair.first); if (state & OutgoingAdHocCommandSession::Present) { okButton_->hide(); okButton_->setEnabled(false); pair.second->show(); } else { pair.second->hide(); } if (state & OutgoingAdHocCommandSession::Enabled) { pair.second->setEnabled(true); } else { pair.second->setEnabled(false); } } } } |