1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
|
#ifndef ODP_KEY_CONFIG_WIDGET_H
#define ODP_KEY_CONFIG_WIDGET_H
#include <opie2/oconfig.h>
#include <qstring.h>
#include <qpixmap.h>
#include <qbytearray.h>
#include <qhbox.h>
#include <qvaluelist.h>
class QKeyEvent;
namespace Opie {
namespace Ui {
class OKeyConfigItem {
friend class OKeyConfigManager;
public:
typedef QValueList<OKeyConfigItem> OKeyConfigItemList;
OKeyConfigItem( const QString& text = QString::null , const QCString& config_key = QCString(),
const QPixmap& symbol = QPixmap(),
int key = 0, int mod = 0,
int default_key = 0, int default_modified = 0 );
~OKeyConfigItem();
QString text()const;
QPixmap pixmap()const;
int key()const;
int modifier()const;
int defaultKey()const;
int defaultModifier()const;
void setText( const QString& text );
void setPixmap( const QPixmap& );
void setKey( int );
void setModied( int );
void setDefaultKey( int );
void setDefaultModifier( int );
bool isConfigured()const;
bool isEmpty()const;
private:
QString m_text;
QCString m_config;
QPixmap m_pix;
int m_key;
int m_mod;
int m_defKey;
int m_defMod;
class Private;
Private *d;
};
class OKeyConfig : public QObject {
Q_OBJECT
public:
OKeyConfig(Opie::Core::OConfig *conf = 0, bool grabkeyboard);
~OKeyConfig();
void load();
void save();
OKeyConfigItem handleKeyEvent( QKeyEvent* );
QString handleKeyEventString( QKeyEvent* );
void addKeyConfig( const OKeyConfigItem& );
void removeKeyConfig( const OKeyConfigItem& );
void handleWidget( QWidget* );
signals:
void keyConfigChanged( OKeyConfig* );
void actionActivated( QWidget*, QKeyEvent*, const OKeyConfigItem& );
private:
OKeyConfigItemList m_keys;
QValueList<QWidget*> m_widgets;
class Private;
Private *d;
};
class OKeyConfigWidget : public QHBox {
Q_OBJECT
public:
enum ChangeMode { Imediate, Queu };
OKeyConfigWidget( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 );
OKeyConfigWidget( OKeyConfig *, QWidget* parent = 0, const char* = 0, WFlags = 0 );
~OKeyConfigWidget();
void setChangeMode( enum ChangeMode );
ChangeMode changeMode()const;
void reload();
private:
class Private;
Private *d;
};
}
}
#endif
|