From 3533e0d4cce3e7af2df8e6c42f462315da8c9df8 Mon Sep 17 00:00:00 2001 From: Aqua-sama Date: Sat, 2 Jun 2018 11:02:42 +0200 Subject: Clazy fixes --- src/browser.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'src/browser.cpp') diff --git a/src/browser.cpp b/src/browser.cpp index 3442d66..4f3f3d7 100644 --- a/src/browser.cpp +++ b/src/browser.cpp @@ -117,14 +117,14 @@ void Browser::setup(const QString &defaultProfile) m_plugins.append(loadPlugins(QString::fromStdString(m_config->value("plugins.path").value()))); // register commands - for(Plugin p : m_plugins) { + for(const Plugin &p : qAsConst(m_plugins)) { if(p.instance->inherits("ProfileInterface")) { auto *profileEditor = qobject_cast(p.instance.get()); Q_ASSERT_X(profileEditor != nullptr, "Browser::setup", "profile interface cast failed"); - for(const QString &name : m_profiles.keys()) { - profileEditor->addProfile(name, qobject_cast(m_profiles.value(name))); + for(auto i = m_profiles.constBegin(); i != m_profiles.constEnd(); ++i) { + profileEditor->addProfile(i.key(), qobject_cast(i.value())); } } @@ -228,11 +228,11 @@ MainWindow *Browser::createWindow() }); window->addAction(MainWindow::ToolsMenu, downloadsAction); - for(Plugin p : m_plugins) { - auto *profileEditor = qobject_cast(p.instance.get()); - if(profileEditor) { + for(const Plugin &p : qAsConst(m_plugins)) { + if(p.instance->inherits("ProfileInterface")) { + auto *profileEditor = qobject_cast(p.instance.get()); auto *profileAction = new QAction(tr("Profile"), window); - connect(profileAction, &QAction::triggered, window, [this, profileEditor]() { + connect(profileAction, &QAction::triggered, window, [profileEditor]() { profileEditor->createWidget(nullptr)->show(); }); window->addAction(MainWindow::ToolsMenu, profileAction); -- cgit v1.2.1