Changeset View
Changeset View
Standalone View
Standalone View
kcms/touchpadx/src/kcm/xlib/touchpadparametersbase.h
- This file was added.
1 | /* | ||||
---|---|---|---|---|---|
2 | * Copyright (C) 2013 Alexander Mezin <mezin.alexander@gmail.com> | ||||
3 | * | ||||
4 | * This program is free software; you can redistribute it and/or modify | ||||
5 | * it under the terms of the GNU General Public License as published by | ||||
6 | * the Free Software Foundation; either version 2 of the License, or | ||||
7 | * (at your option) any later version. | ||||
8 | * | ||||
9 | * This program is distributed in the hope that it will be useful, | ||||
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||||
12 | * GNU General Public License for more details. | ||||
13 | * | ||||
14 | * You should have received a copy of the GNU General Public License | ||||
15 | * along with this program; if not, write to the Free Software | ||||
16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | ||||
17 | */ | ||||
18 | | ||||
19 | #ifndef TOUCHPADPARAMETERSBASE_H | ||||
20 | #define TOUCHPADPARAMETERSBASE_H | ||||
21 | | ||||
22 | #include <QVariantHash> | ||||
23 | | ||||
24 | #include <KConfigSkeleton> | ||||
25 | | ||||
26 | class TouchpadParametersBase : public KCoreConfigSkeleton | ||||
27 | { | ||||
28 | public: | ||||
29 | explicit TouchpadParametersBase(const QString &configname = QString(), | ||||
30 | QObject *parent = 0); | ||||
31 | | ||||
32 | QVariantHash values() const; | ||||
33 | void setValues(const QVariantHash &); | ||||
34 | | ||||
35 | static void setSystemDefaults(); | ||||
36 | static QVariant systemDefault(const QString &name, | ||||
37 | const QVariant &hardcoded = QVariant()); | ||||
38 | template<typename T> | ||||
39 | static T systemDefault(const QString &name, const T &hardcoded = T()) | ||||
40 | { | ||||
41 | return qvariant_cast<T>(systemDefault(name, QVariant(hardcoded))); | ||||
42 | } | ||||
43 | | ||||
44 | template<typename T> | ||||
45 | static T systemDefaultEnum(const QString &name, const T &hardcoded = T()) | ||||
46 | { | ||||
47 | return static_cast<T>(systemDefault(name, static_cast<int>(hardcoded))); | ||||
48 | } | ||||
49 | }; | ||||
50 | | ||||
51 | #endif // TOUCHPADPARAMETERSBASE_H |