File indexing completed on 2024-05-12 17:07:16
0001 /* 0002 SPDX-FileCopyrightText: 2010 Andriy Rysin <rysin@kde.org> 0003 0004 SPDX-License-Identifier: GPL-2.0-or-later 0005 */ 0006 0007 #pragma once 0008 0009 #include <QMap> 0010 #include <QString> 0011 #include <QWidgetList> //For WId 0012 0013 #include "keyboard_config.h" 0014 #include "x11_helper.h" 0015 0016 class LayoutMemoryPersister; 0017 0018 class LayoutMemory : public QObject 0019 { 0020 Q_OBJECT 0021 0022 // if there's some transient windows coming up we'll need to either ignore it 0023 // or in case of layout switcher popup menu to apply new layout to previous key 0024 QString previousLayoutMapKey; 0025 QList<LayoutUnit> prevLayoutList; 0026 const KeyboardConfig &keyboardConfig; 0027 0028 void registerListeners(); 0029 void unregisterListeners(); 0030 QString getCurrentMapKey(); 0031 void setCurrentLayoutFromMap(); 0032 0033 public Q_SLOTS: 0034 void layoutMapChanged(); 0035 void layoutChanged(); 0036 void windowChanged(WId wId); 0037 void desktopChanged(int desktop); 0038 0039 public: 0040 LayoutMemory(const KeyboardConfig &keyboardConfig); 0041 ~LayoutMemory() override; 0042 0043 void configChanged(); 0044 0045 protected: 0046 // QVariant does not support long for WId so we'll use QString for key instead 0047 QMap<QString, LayoutSet> layoutMap; 0048 0049 friend class LayoutMemoryPersister; 0050 };