author | zecke <zecke> | 2004-04-13 14:53:58 (UTC) |
---|---|---|
committer | zecke <zecke> | 2004-04-13 14:53:58 (UTC) |
commit | b51d88d7b0b517b71ae3b59d8228335f38ca9fc7 (patch) (unidiff) | |
tree | 302377973a897934c944c7a126e5e0a510694979 /libopie2/examples/opieui/okeyconfigwidget | |
parent | c4c842558e1457f64d43b237f24f6ea1a4f9d76b (diff) | |
download | opie-b51d88d7b0b517b71ae3b59d8228335f38ca9fc7.zip opie-b51d88d7b0b517b71ae3b59d8228335f38ca9fc7.tar.gz opie-b51d88d7b0b517b71ae3b59d8228335f38ca9fc7.tar.bz2 |
Split the KeyConfig Manager and Widget into Ui and Core parts
Adjust the only user...
Don't add a 2nd example to core but mention the one for the classes
in opieui/okeyconfigwidget
Diffstat (limited to 'libopie2/examples/opieui/okeyconfigwidget') (more/less context) (show whitespace changes)
-rw-r--r-- | libopie2/examples/opieui/okeyconfigwidget/testwidget.cpp | 30 | ||||
-rw-r--r-- | libopie2/examples/opieui/okeyconfigwidget/testwidget.h | 10 |
2 files changed, 20 insertions, 20 deletions
diff --git a/libopie2/examples/opieui/okeyconfigwidget/testwidget.cpp b/libopie2/examples/opieui/okeyconfigwidget/testwidget.cpp index 10b52f9..5c7bac2 100644 --- a/libopie2/examples/opieui/okeyconfigwidget/testwidget.cpp +++ b/libopie2/examples/opieui/okeyconfigwidget/testwidget.cpp | |||
@@ -26,13 +26,13 @@ public: | |||
26 | } | 26 | } |
27 | MainWindow( QWidget*, const char*, WFlags fl ); | 27 | MainWindow( QWidget*, const char*, WFlags fl ); |
28 | ~MainWindow() {} | 28 | ~MainWindow() {} |
29 | private slots: | 29 | private slots: |
30 | void slotClicked(); | 30 | void slotClicked(); |
31 | private: | 31 | private: |
32 | Opie::Ui::OKeyConfigManager *m_manager; | 32 | Opie::Core::OKeyConfigManager *m_manager; |
33 | }; | 33 | }; |
34 | 34 | ||
35 | 35 | ||
36 | OPIE_EXPORT_APP( Opie::Core::OApplicationFactory<MainWindow> ) | 36 | OPIE_EXPORT_APP( Opie::Core::OApplicationFactory<MainWindow> ) |
37 | 37 | ||
38 | 38 | ||
@@ -73,40 +73,40 @@ TestMainWindow::TestMainWindow( QWidget* parent, const char* slot, WFlags fl ) | |||
73 | addColumn( tr( "A Doo" ) ); | 73 | addColumn( tr( "A Doo" ) ); |
74 | addColumn( tr( "B Doo" ) ); | 74 | addColumn( tr( "B Doo" ) ); |
75 | 75 | ||
76 | m_config = new Opie::Core::OConfig( "test_config_foo" ); | 76 | m_config = new Opie::Core::OConfig( "test_config_foo" ); |
77 | 77 | ||
78 | /* generate the black list */ | 78 | /* generate the black list */ |
79 | Opie::Ui::OKeyPair::List blackList; | 79 | Opie::Core::OKeyPair::List blackList; |
80 | blackList.append( Opie::Ui::OKeyPair::leftArrowKey() ); | 80 | blackList.append( Opie::Core::OKeyPair::leftArrowKey() ); |
81 | blackList.append( Opie::Ui::OKeyPair::rightArrowKey() ); | 81 | blackList.append( Opie::Core::OKeyPair::rightArrowKey() ); |
82 | blackList.append( Opie::Ui::OKeyPair::downArrowKey() ); | 82 | blackList.append( Opie::Core::OKeyPair::downArrowKey() ); |
83 | blackList.append( Opie::Ui::OKeyPair::upArrowKey() ); | 83 | blackList.append( Opie::Core::OKeyPair::upArrowKey() ); |
84 | 84 | ||
85 | m_manager = new Opie::Ui::OKeyConfigManager( m_config, "Key Group", | 85 | m_manager = new Opie::Core::OKeyConfigManager( m_config, "Key Group", |
86 | blackList, false, this, "Key Manager" ); | 86 | blackList, false, this, "Key Manager" ); |
87 | 87 | ||
88 | m_manager->addKeyConfig( Opie::Ui::OKeyConfigItem( tr( "Delete Action" ), "delete_key", QPixmap(), | 88 | m_manager->addKeyConfig( Opie::Core::OKeyConfigItem( tr( "Delete Action" ), "delete_key", QPixmap(), |
89 | 10, Opie::Ui::OKeyPair( Qt::Key_D, Qt::ShiftButton ), this, | 89 | 10, Opie::Core::OKeyPair( Qt::Key_D, Qt::ShiftButton ), this, |
90 | SLOT(slotDelete(QWidget*,QKeyEvent*)) ) ); | 90 | SLOT(slotDelete(QWidget*,QKeyEvent*)) ) ); |
91 | m_manager->addKeyConfig( Opie::Ui::OKeyConfigItem( tr( "Show Action" ), "show_key", QPixmap(), | 91 | m_manager->addKeyConfig( Opie::Core::OKeyConfigItem( tr( "Show Action" ), "show_key", QPixmap(), |
92 | 11, Opie::Ui::OKeyPair( Qt::Key_S, Qt::AltButton ) ) ); | 92 | 11, Opie::Core::OKeyPair( Qt::Key_S, Qt::AltButton ) ) ); |
93 | 93 | ||
94 | connect(m_manager, SIGNAL(actionActivated(QWidget*,QKeyEvent*,const Opie::Ui::OKeyConfigItem&)), | 94 | connect(m_manager, SIGNAL(actionActivated(QWidget*,QKeyEvent*,const Opie::Core::OKeyConfigItem&)), |
95 | this, SLOT(slotAction(QWidget*, QKeyEvent*, const Opie::Ui::OKeyConfigItem&)) ); | 95 | this, SLOT(slotAction(QWidget*, QKeyEvent*, const Opie::Core::OKeyConfigItem&)) ); |
96 | // when commenting the line below out the keyPressEvent will work | 96 | // when commenting the line below out the keyPressEvent will work |
97 | m_manager->handleWidget( this ); | 97 | m_manager->handleWidget( this ); |
98 | m_manager->load(); | 98 | m_manager->load(); |
99 | } | 99 | } |
100 | 100 | ||
101 | TestMainWindow::~TestMainWindow() { | 101 | TestMainWindow::~TestMainWindow() { |
102 | m_manager->save(); | 102 | m_manager->save(); |
103 | delete m_config; | 103 | delete m_config; |
104 | } | 104 | } |
105 | 105 | ||
106 | Opie::Ui::OKeyConfigManager* TestMainWindow::manager() { | 106 | Opie::Core::OKeyConfigManager* TestMainWindow::manager() { |
107 | return m_manager; | 107 | return m_manager; |
108 | } | 108 | } |
109 | 109 | ||
110 | /* | 110 | /* |
111 | * This only works if we do not handle the even with m_manager->handleWidget( this ) | 111 | * This only works if we do not handle the even with m_manager->handleWidget( this ) |
112 | * So this is only for demo purposes | 112 | * So this is only for demo purposes |
@@ -118,11 +118,11 @@ void TestMainWindow::keyPressEvent( QKeyEvent* ev ) { | |||
118 | } | 118 | } |
119 | 119 | ||
120 | void TestMainWindow::slotDelete( QWidget* wid, QKeyEvent* ev ) { | 120 | void TestMainWindow::slotDelete( QWidget* wid, QKeyEvent* ev ) { |
121 | qWarning( "Slot Delete %d %d %d", wid, ev->key(), ev->state() ); | 121 | qWarning( "Slot Delete %d %d %d", wid, ev->key(), ev->state() ); |
122 | } | 122 | } |
123 | 123 | ||
124 | void TestMainWindow::slotAction( QWidget* wid, QKeyEvent* ev, const Opie::Ui::OKeyConfigItem& item) { | 124 | void TestMainWindow::slotAction( QWidget* wid, QKeyEvent* ev, const Opie::Core::OKeyConfigItem& item) { |
125 | qWarning( "Slot Action %d %d %d %s %d", wid, ev->key(), ev->state(), item.text().latin1(), item.id() ); | 125 | qWarning( "Slot Action %d %d %d %s %d", wid, ev->key(), ev->state(), item.text().latin1(), item.id() ); |
126 | } | 126 | } |
127 | 127 | ||
128 | #include "testwidget.moc" | 128 | #include "testwidget.moc" |
diff --git a/libopie2/examples/opieui/okeyconfigwidget/testwidget.h b/libopie2/examples/opieui/okeyconfigwidget/testwidget.h index b95c225..6ecb346 100644 --- a/libopie2/examples/opieui/okeyconfigwidget/testwidget.h +++ b/libopie2/examples/opieui/okeyconfigwidget/testwidget.h | |||
@@ -5,36 +5,36 @@ | |||
5 | 5 | ||
6 | #include <opie2/olistview.h> | 6 | #include <opie2/olistview.h> |
7 | 7 | ||
8 | namespace Opie{ | 8 | namespace Opie{ |
9 | namespace Ui{ | 9 | namespace Ui{ |
10 | class OTabWidget; | 10 | class OTabWidget; |
11 | class OKeyConfigManager; | ||
12 | class OListView; | 11 | class OListView; |
13 | class OKeyConfigItem; | ||
14 | } | 12 | } |
15 | namespace Core { | 13 | namespace Core { |
16 | class OConfig; | 14 | class OConfig; |
15 | class OKeyConfigManager; | ||
16 | class OKeyConfigItem; | ||
17 | } | 17 | } |
18 | } | 18 | } |
19 | class QKeyEvent; | 19 | class QKeyEvent; |
20 | 20 | ||
21 | 21 | ||
22 | class TestMainWindow : public Opie::Ui::OListView { | 22 | class TestMainWindow : public Opie::Ui::OListView { |
23 | Q_OBJECT | 23 | Q_OBJECT |
24 | public: | 24 | public: |
25 | 25 | ||
26 | TestMainWindow(QWidget* parent, const char*, WFlags fl ); | 26 | TestMainWindow(QWidget* parent, const char*, WFlags fl ); |
27 | ~TestMainWindow(); | 27 | ~TestMainWindow(); |
28 | 28 | ||
29 | Opie::Ui::OKeyConfigManager *manager(); | 29 | Opie::Core::OKeyConfigManager *manager(); |
30 | protected: | 30 | protected: |
31 | void keyPressEvent( QKeyEvent* ); | 31 | void keyPressEvent( QKeyEvent* ); |
32 | private slots: | 32 | private slots: |
33 | void slotDelete( QWidget*, QKeyEvent* ); | 33 | void slotDelete( QWidget*, QKeyEvent* ); |
34 | void slotAction( QWidget*, QKeyEvent*, const Opie::Ui::OKeyConfigItem& ); | 34 | void slotAction( QWidget*, QKeyEvent*, const Opie::Core::OKeyConfigItem& ); |
35 | private: | 35 | private: |
36 | Opie::Core::OConfig *m_config; | 36 | Opie::Core::OConfig *m_config; |
37 | Opie::Ui::OKeyConfigManager *m_manager; | 37 | Opie::Core::OKeyConfigManager *m_manager; |
38 | }; | 38 | }; |
39 | 39 | ||
40 | #endif | 40 | #endif |