1 /* 2 * <one line to give the library's name and an idea of what it does.> 3 * Copyright (C) 2014 <copyright holder> <email> 4 * 5 * This library is free software; you can redistribute it and/or 6 * modify it under the terms of the GNU Lesser General Public 7 * License as published by the Free Software Foundation; either 8 * version 2.1 of the License, or (at your option) any later version. 9 * 10 * This library is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 * Lesser General Public License for more details. 14 * 15 * You should have received a copy of the GNU Lesser General Public 16 * License along with this library; if not, write to the Free Software 17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 18 * 19 */ 20 21 #ifndef KEYBOARDLAYOUTCONFIG_H 22 #define KEYBOARDLAYOUTCONFIG_H 23 24 #include <QtCore/QtGlobal> 25 #ifdef Q_OS_LINUX 26 #define XKBD_BASELIST_PATH "/usr/share/X11/xkb/rules/base.lst" 27 #elif defined(Q_OS_FREEBSD) 28 #define XKBD_BASELIST_PATH "/usr/local/share/X11/xkb/rules/base.lst" 29 #elif defined(Q_OS_OPENBSD) 30 #define XKBD_BASELIST_PATH "/usr/X11R6/share/X11/xkb/rules/base.lst" 31 #else 32 #define XKBD_BASELIST_PATH "/usr/local/share/X11/xkb/rules/base.lst" 33 #endif 34 35 #include <QWidget> 36 #include "keyboardlayoutinfo.h" 37 #include <QMap> 38 #include "ui_keyboardlayoutconfig.h" 39 40 namespace LXQt { 41 class Settings; 42 } 43 44 class KeyboardLayoutConfig : public QWidget { 45 Q_OBJECT 46 public: 47 KeyboardLayoutConfig(LXQt::Settings* _settings, QWidget* parent = nullptr); 48 virtual ~KeyboardLayoutConfig(); 49 50 void applyConfig(); 51 52 public Q_SLOTS: 53 void reset(); 54 void onAddLayout(); 55 void onRemoveLayout(); 56 void onMoveUp(); 57 void onMoveDown(); 58 59 Q_SIGNALS: 60 void settingsChanged(); 61 62 private: 63 void loadSettings(); 64 void loadLists(); 65 void initControls(); 66 void addLayout(QString name, QString variant); 67 68 private: 69 Ui::KeyboardLayoutConfig ui; 70 QString keyboardModel_; 71 QString switchKey_; 72 QStringList currentOptions_; 73 QList<QPair<QString, QString> > currentLayouts_; 74 QMap<QString, KeyboardLayoutInfo> knownLayouts_; 75 LXQt::Settings* settings; 76 bool applyConfig_; 77 }; 78 79 #endif // KEYBOARDLAYOUTCONFIG_H 80