From 7ef8d11baeaf1847ba7f1df5d858f8cffea9300d Mon Sep 17 00:00:00 2001 From: trialuser02 Date: Wed, 12 Aug 2020 21:03:34 +0000 Subject: coding style fixes git-svn-id: http://svn.code.sf.net/p/qmmp-dev/code/trunk/qmmp@9470 90c681e8-e032-0410-971d-27865f9a5e38 --- src/plugins/General/hotkey/settingsdialog.cpp | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) (limited to 'src/plugins/General/hotkey/settingsdialog.cpp') diff --git a/src/plugins/General/hotkey/settingsdialog.cpp b/src/plugins/General/hotkey/settingsdialog.cpp index 1255790e2..89ec737e8 100644 --- a/src/plugins/General/hotkey/settingsdialog.cpp +++ b/src/plugins/General/hotkey/settingsdialog.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2009-2015 by Ilya Kotov * + * Copyright (C) 2009-2020 by Ilya Kotov * * forkotov02@ya.ru * * * * This program is free software; you can redistribute it and/or modify * @@ -22,6 +22,7 @@ #include #include #include +#include #include "hotkeydialog.h" #include "settingsdialog.h" @@ -63,7 +64,6 @@ SettingsDialog::SettingsDialog(QWidget *parent) settings.endGroup(); } - SettingsDialog::~SettingsDialog() { while (!m_hotkeys.isEmpty()) @@ -86,18 +86,11 @@ void SettingsDialog::accept() void SettingsDialog::on_tableWidget_itemDoubleClicked (QTableWidgetItem *item) { - Hotkey *key = nullptr; - for(Hotkey *k : m_hotkeys) - { - if (k->action == item->type()) - { - key = k; - break; - } - } - if (!key) + auto it = std::find_if(m_hotkeys.cbegin(), m_hotkeys.cend(), [item](Hotkey *k) { return k->action == item->type(); }); + if(it == m_hotkeys.cend()) return; + Hotkey *key = *it; HotkeyDialog *dialog = new HotkeyDialog(key->key, key->mod, this); if (item->type() >= QTableWidgetItem::UserType && dialog->exec() == QDialog::Accepted) -- cgit v1.2.3-13-gbd6f