1
by Lior Kaplan
Import upstream version 1.4.3 |
1 |
/***************************************************************************
|
2 |
kbconfig.h - description
|
|
3 |
-------------------
|
|
4 |
begin : Sun Jul 8 2001
|
|
5 |
copyright : (C) 2001 by Leonid Zeitlin
|
|
6 |
email : lz@europe.com
|
|
7 |
***************************************************************************/
|
|
8 |
||
9 |
/***************************************************************************
|
|
10 |
* *
|
|
11 |
* This program is free software; you can redistribute it and/or modify *
|
|
12 |
* it under the terms of the GNU General Public License as published by *
|
|
13 |
* the Free Software Foundation; either version 2 of the License, or *
|
|
14 |
* (at your option) any later version. *
|
|
15 |
* *
|
|
16 |
***************************************************************************/
|
|
17 |
||
18 |
#ifndef KBCONFIG_H
|
|
19 |
#define KBCONFIG_H
|
|
20 |
||
21 |
#include "kbgroup.h" |
|
22 |
||
23 |
#include <qptrvector.h> |
|
24 |
#include <qvaluevector.h> |
|
25 |
#include <kconfig.h> |
|
26 |
||
27 |
#define ICONS_SECTION "Icons"
|
|
28 |
#define OPTIONS_SECTION "Options"
|
|
29 |
||
30 |
#define FLAG_ICON_WIDTH 21
|
|
31 |
#define FLAG_ICON_HEIGHT 14
|
|
32 |
||
33 |
class KGlobalAccel; |
|
34 |
||
35 |
typedef QPtrVector<KBGroup> KBGroupVector; |
|
36 |
||
37 |
/**The class that stores configuration information of KBSwitch
|
|
38 |
*@author Leonid Zeitlin
|
|
39 |
*/
|
|
40 |
||
41 |
class KBConfig { |
|
42 |
public: |
|
43 |
enum IconStyle { ICON_FLAG, ICON_CODE, ICON_CODE_AND_FLAG }; |
|
44 |
enum GroupScope { SCOPE_GLOBAL, SCOPE_CLASS, SCOPE_WINDOW }; |
|
45 |
private: |
|
46 |
KBGroupVector m_groups; |
|
47 |
bool m_toggle_mode; |
|
48 |
int m_default_groupno; |
|
49 |
//bool m_perwindow_group;
|
|
50 |
GroupScope m_group_scope; |
|
51 |
bool m_autostart; |
|
52 |
bool m_use_shortcuts; |
|
53 |
IconStyle m_icon_style; |
|
54 |
KGlobalAccel *m_keys; |
|
55 |
public: |
|
56 |
KBConfig(); |
|
57 |
~KBConfig(); |
|
58 |
int groupCount() { return m_groups.count(); }; |
|
59 |
KBGroup *getGroup(int groupno) { return m_groups[groupno]; }; |
|
60 |
bool toggle_mode() {return m_toggle_mode; }; |
|
61 |
/** No descriptions */
|
|
62 |
void set_toggle_mode(bool value) {m_toggle_mode = value; }; |
|
63 |
int default_groupno() { return m_default_groupno; }; |
|
64 |
void set_default_groupno(int value) { m_default_groupno = value; }; |
|
65 |
/*bool perwindow_group() { return m_perwindow_group; };
|
|
66 |
void set_perwindow_group(int value) { m_perwindow_group = value; };*/
|
|
67 |
GroupScope group_scope() { return m_group_scope; } |
|
68 |
void set_group_scope(GroupScope value) { m_group_scope = value; } |
|
69 |
bool autostart() { return m_autostart; } |
|
70 |
void set_autostart(bool value) { m_autostart = value; } |
|
71 |
IconStyle icon_style() { return m_icon_style; } |
|
72 |
void set_icon_style(IconStyle value) { m_icon_style = value; } |
|
73 |
bool use_shortcuts() { return m_use_shortcuts; } |
|
74 |
void set_use_shortcuts(bool value) { m_use_shortcuts = value; } |
|
75 |
KGlobalAccel *keys() { return m_keys; } |
|
76 |
/** Load the KBSwitch configration from the application KConfig object */
|
|
77 |
void load(KConfig *config); |
|
78 |
/** Save the KBSwitch configration to the application KConfig object */
|
|
79 |
void save(KConfig *config); |
|
80 |
/** No descriptions */
|
|
81 |
/*void notifyChanged();*/
|
|
82 |
/*static QString entryForGroup(int i) {
|
|
83 |
return QString("Group%1").arg(i+1);
|
|
84 |
}*/
|
|
85 |
void drawIcons(IconStyle icon_style, QValueVector<QPixmap> *icons, |
|
86 |
QStringList *iconpaths); |
|
87 |
void checkKeysEnabled(); |
|
88 |
int getNextGroup(int groupno) { |
|
89 |
return groupno >= groupCount() - 1 ? 0 : groupno + 1; |
|
90 |
}
|
|
91 |
private: // Private methods |
|
92 |
/** No descriptions */
|
|
93 |
//void guessGroupPixmaps();
|
|
94 |
/** No descriptions */
|
|
95 |
//void drawDefaultPixmaps();
|
|
96 |
/** No descriptions */
|
|
97 |
//void loadConfiguredPixmaps(KConfig *config);
|
|
98 |
void drawFlagPixmap(QPixmap &pix, QString &path, const QString &code, |
|
99 |
int group, KConfig *config); |
|
100 |
void drawCodePixmap(QPixmap &pix, const QString &code); |
|
101 |
void drawCodeAndFlagPixmap(QPixmap &pix, QString &path, |
|
102 |
const QString &countryCode, const QString &langCode, int group, |
|
103 |
KConfig *config); |
|
104 |
void drawDefaultPixmap(QPixmap &pix, int group); |
|
105 |
bool getGroupImage(QImage &img, QString &path, const QString &code, int group, |
|
106 |
KConfig *config); |
|
107 |
void getXkbLayouts(QStringList &layouts); |
|
108 |
};
|
|
109 |
||
110 |
#endif
|