File indexing completed on 2024-10-06 10:52:02
0001 #ifndef SETTINGS_READER_V2_H 0002 #define SETTINGS_READER_V2_H 0003 /** 0004 * SPDX-FileCopyrightText: 1999-2001 Lubos Lunak <l.lunak@kde.org> 0005 * SPDX-FileCopyrightText: 2009 Michael Jansen <kde@michael-jansen.biz> 0006 * 0007 * SPDX-License-Identifier: LGPL-2.0-or-later 0008 **/ 0009 0010 #include "action_data/action_data_visitor.h" 0011 #include "actions/actions.h" 0012 #include "settings.h" 0013 #include "triggers/triggers.h" 0014 0015 class KConfigBase; 0016 class KConfigGroup; 0017 0018 namespace KHotKeys 0019 { 0020 class Settings; 0021 class Trigger_list; 0022 template<typename T, typename A> class SimpleActionDataHelper; 0023 } 0024 0025 /** 0026 * @author Michael Jansen <kde@michael-jansen.biz> 0027 */ 0028 class SettingsReaderV2 : public KHotKeys::ActionDataVisitor, 0029 0030 public KHotKeys::ActionVisitor, 0031 public KHotKeys::ActivateWindowActionVisitor, 0032 public KHotKeys::CommandUrlActionVisitor, 0033 public KHotKeys::DBusActionVisitor, 0034 public KHotKeys::KeyboardInputActionVisitor, 0035 public KHotKeys::MenuEntryActionVisitor, 0036 0037 public KHotKeys::TriggerVisitor, 0038 public KHotKeys::WindowTriggerVisitor, 0039 public KHotKeys::ShortcutTriggerVisitor, 0040 public KHotKeys::GestureTriggerVisitor 0041 { 0042 public: 0043 SettingsReaderV2(KHotKeys::Settings *settings, 0044 bool loadAll = true, 0045 KHotKeys::ActionState _stateStrategy = KHotKeys::Disabled, 0046 const QString &importId = QString()); 0047 0048 ~SettingsReaderV2() override; 0049 0050 void read(const KConfigBase &config, KHotKeys::ActionDataGroup *parent); 0051 0052 KHotKeys::ActionDataGroup *readGroup(const KConfigGroup &config, KHotKeys::ActionDataGroup *parent); 0053 0054 KHotKeys::ActionDataBase *readActionData(const KConfigGroup &config, KHotKeys::ActionDataGroup *parent); 0055 0056 KHotKeys::Trigger_list *readTriggerList(const KConfigGroup &config, KHotKeys::ActionData *parent); 0057 0058 KHotKeys::ActionList *readActionList(const KConfigGroup &config, KHotKeys::ActionData *parent); 0059 0060 void visitActionDataBase(KHotKeys::ActionDataBase *base) override; 0061 0062 void visitActionData(KHotKeys::ActionData *group) override; 0063 0064 void visitActionDataGroup(KHotKeys::ActionDataGroup *group) override; 0065 0066 void visitGenericActionData(KHotKeys::Generic_action_data *data) override; 0067 0068 void visitMenuentryShortcutActionData(KHotKeys::MenuEntryShortcutActionData *data) override; 0069 0070 void visitSimpleActionData(KHotKeys::SimpleActionData *data) override; 0071 0072 void visit(KHotKeys::ActivateWindowAction &) override; 0073 void visit(KHotKeys::CommandUrlAction &) override; 0074 void visit(KHotKeys::DBusAction &) override; 0075 void visit(KHotKeys::KeyboardInputAction &) override; 0076 void visit(KHotKeys::MenuEntryAction &) override; 0077 0078 void visit(KHotKeys::GestureTrigger &) override; 0079 void visit(KHotKeys::ShortcutTrigger &) override; 0080 void visit(KHotKeys::WindowTrigger &) override; 0081 0082 private: 0083 const KConfigGroup *_config; 0084 0085 KHotKeys::Settings *_settings; 0086 0087 bool _loadAll; 0088 0089 KHotKeys::ActionState _stateStrategy; 0090 0091 QString _importId; 0092 0093 }; // SettingsReaderV2 0094 0095 #endif /* SETTINGS_READER_V2_H */