summaryrefslogtreecommitdiffstats
path: root/kxkb/kxkbconfig.h
diff options
context:
space:
mode:
authortoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
committertoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
commit4aed2c8219774f5d797760606b8489a92ddc5163 (patch)
tree3f8c130f7d269626bf6a9447407ef6c35954426a /kxkb/kxkbconfig.h
downloadtdebase-4aed2c8219774f5d797760606b8489a92ddc5163.tar.gz
tdebase-4aed2c8219774f5d797760606b8489a92ddc5163.zip
Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features.
BUG:215923 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdebase@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kxkb/kxkbconfig.h')
-rw-r--r--kxkb/kxkbconfig.h122
1 files changed, 122 insertions, 0 deletions
diff --git a/kxkb/kxkbconfig.h b/kxkb/kxkbconfig.h
new file mode 100644
index 000000000..df32b026c
--- /dev/null
+++ b/kxkb/kxkbconfig.h
@@ -0,0 +1,122 @@
+//
+// C++ Interface: kxkbconfig
+//
+// Description:
+//
+//
+// Author: Andriy Rysin <rysin@kde.org>, (C) 2006
+//
+// Copyright: See COPYING file that comes with this distribution
+//
+//
+#ifndef KXKBCONFIG_H
+#define KXKBCONFIG_H
+
+#include <qstring.h>
+#include <qstringlist.h>
+#include <qptrqueue.h>
+#include <qmap.h>
+
+
+/* Utility classes for per-window/per-application layout implementation
+*/
+enum SwitchingPolicy {
+ SWITCH_POLICY_GLOBAL = 0,
+ SWITCH_POLICY_WIN_CLASS = 1,
+ SWITCH_POLICY_WINDOW = 2,
+ SWITCH_POLICY_COUNT = 3
+};
+
+
+
+inline QString createPair(QString key, QString value)
+{
+ if( value.isEmpty() )
+ return key;
+ return QString("%1(%2)").arg(key, value);
+}
+
+struct LayoutUnit {
+ QString layout;
+ QString variant;
+ QString includeGroup;
+ QString displayName;
+ int defaultGroup;
+
+ LayoutUnit() {}
+
+ LayoutUnit(QString layout_, QString variant_):
+ layout(layout_),
+ variant(variant_)
+ {}
+
+ LayoutUnit(QString pair) {
+ setFromPair( pair );
+ }
+
+ void setFromPair(const QString& pair) {
+ layout = parseLayout(pair);
+ variant = parseVariant(pair);
+ }
+
+ QString toPair() const {
+ return createPair(layout, variant);
+ }
+
+ bool operator<(const LayoutUnit& lu) const {
+ return layout<lu.layout ||
+ (layout==lu.layout && variant<lu.variant);
+ }
+
+ bool operator!=(const LayoutUnit& lu) const {
+ return layout!=lu.layout || variant!=lu.variant;
+ }
+
+ bool operator==(const LayoutUnit& lu) const {
+// kdDebug() << layout << "==" << lu.layout << "&&" << variant << "==" << lu.variant << endl;
+ return layout==lu.layout && variant==lu.variant;
+ }
+
+//private:
+ static const QString parseLayout(const QString &layvar);
+ static const QString parseVariant(const QString &layvar);
+};
+
+extern const LayoutUnit DEFAULT_LAYOUT_UNIT;
+extern const char* DEFAULT_MODEL;
+
+
+class KxkbConfig
+{
+public:
+ enum { LOAD_INIT_OPTIONS, LOAD_ACTIVE_OPTIONS, LOAD_ALL };
+
+ bool m_useKxkb;
+ bool m_showSingle;
+ bool m_showFlag;
+ bool m_enableXkbOptions;
+ bool m_resetOldOptions;
+ SwitchingPolicy m_switchingPolicy;
+ bool m_stickySwitching;
+ int m_stickySwitchingDepth;
+
+ QString m_model;
+ QString m_options;
+ QValueList<LayoutUnit> m_layouts;
+
+ LayoutUnit getDefaultLayout();
+
+ bool load(int loadMode);
+ void save();
+ void setDefaults();
+
+ QStringList getLayoutStringList(/*bool compact*/);
+ static QString getDefaultDisplayName(const QString& code_);
+ static QString getDefaultDisplayName(const LayoutUnit& layoutUnit, bool single=false);
+
+private:
+ static const QMap<QString, QString> parseIncludesMap(const QStringList& pairList);
+};
+
+
+#endif