summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTobias Markmann <tm@ayena.de>2016-10-05 14:29:42 (GMT)
committerKevin Smith <kevin.smith@isode.com>2016-10-05 15:07:17 (GMT)
commit51a21158cef39a384c5869c0a0d0b476977bc7a7 (patch)
treec2606ae173865af50c6f330a74911071fc1e28a8 /Swift/QtUI/QtMainWindow.cpp
parentd29c0ee50a606bf1f4510ea427aef257870c17c0 (diff)
downloadswift-51a21158cef39a384c5869c0a0d0b476977bc7a7.zip
swift-51a21158cef39a384c5869c0a0d0b476977bc7a7.tar.bz2
Add missing sensible asserts to testing and QtMainWindow
Test-Information: Unit tests pass in ASAN-enabled build on macOS 10.12. Change-Id: I7a8dae7d06e5e1d3dc9391f9c9a342df384d90fc
Diffstat (limited to 'Swift/QtUI/QtMainWindow.cpp')
-rw-r--r--Swift/QtUI/QtMainWindow.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/Swift/QtUI/QtMainWindow.cpp b/Swift/QtUI/QtMainWindow.cpp
index 611fc80..0c1dd97 100644
--- a/Swift/QtUI/QtMainWindow.cpp
+++ b/Swift/QtUI/QtMainWindow.cpp
@@ -6,9 +6,10 @@
#include <Swift/QtUI/QtMainWindow.h>
+#include <memory>
+
#include <boost/bind.hpp>
#include <boost/optional.hpp>
-#include <memory>
#include <QAction>
#include <QBoxLayout>
@@ -357,7 +358,7 @@ void QtMainWindow::setMyStatusType(StatusShow::Type type) {
const bool online = (type != StatusShow::None);
treeWidget_->setOnline(online);
chatListWindow_->setOnline(online);
- foreach (QAction *action, onlineOnlyActions_) {
+ for (auto action : onlineOnlyActions_) {
action->setEnabled(online);
}
serverAdHocMenu_->setEnabled(online);
@@ -392,18 +393,19 @@ void QtMainWindow::openCertificateDialog(const std::vector<Certificate::ref>& ch
void QtMainWindow::handleAdHocActionTriggered(bool /*checked*/) {
QAction* action = qobject_cast<QAction*>(sender());
assert(action);
+ assert(serverAdHocCommandActions_.indexOf(action) >= 0);
DiscoItems::Item command = serverAdHocCommands_[serverAdHocCommandActions_.indexOf(action)];
uiEventStream_->send(std::make_shared<RequestAdHocUIEvent>(command));
}
void QtMainWindow::setAvailableAdHocCommands(const std::vector<DiscoItems::Item>& commands) {
serverAdHocCommands_ = commands;
- foreach (QAction* action, serverAdHocCommandActions_) {
+ for (auto action : serverAdHocCommandActions_) {
delete action;
}
serverAdHocMenu_->clear();
serverAdHocCommandActions_.clear();
- foreach (DiscoItems::Item command, commands) {
+ for (const auto& command : commands) {
QAction* action = new QAction(P2QSTRING(command.getName()), this);
connect(action, SIGNAL(triggered(bool)), this, SLOT(handleAdHocActionTriggered(bool)));
serverAdHocMenu_->addAction(action);