author | mickeyl <mickeyl> | 2005-01-29 14:23:27 (UTC) |
---|---|---|
committer | mickeyl <mickeyl> | 2005-01-29 14:23:27 (UTC) |
commit | 20b3de56573b9e86c6b6041faf684adc8cbb2a45 (patch) (unidiff) | |
tree | e0d91c84dee46d1cce3b0d68fd2c10c3dd7ce3a1 /libopie2/examples/opieui/okeyconfigwidget | |
parent | 555b999359a5aad999eaaf48632ce85f25125b85 (diff) | |
download | opie-20b3de56573b9e86c6b6041faf684adc8cbb2a45.zip opie-20b3de56573b9e86c6b6041faf684adc8cbb2a45.tar.gz opie-20b3de56573b9e86c6b6041faf684adc8cbb2a45.tar.bz2 |
examples to where they belong
Diffstat (limited to 'libopie2/examples/opieui/okeyconfigwidget') (more/less context) (ignore whitespace changes)
3 files changed, 0 insertions, 180 deletions
diff --git a/libopie2/examples/opieui/okeyconfigwidget/keyconfig.pro b/libopie2/examples/opieui/okeyconfigwidget/keyconfig.pro deleted file mode 100644 index 5f379ef..0000000 --- a/libopie2/examples/opieui/okeyconfigwidget/keyconfig.pro +++ b/dev/null | |||
@@ -1,12 +0,0 @@ | |||
1 | CONFIG += qt | ||
2 | |||
3 | TEMPLATE = app | ||
4 | SOURCES = testwidget.cpp | ||
5 | HEADERS = testwidget.h | ||
6 | |||
7 | INCLUDEPATH += $(OPIEDIR)/include $(OPIEDIR)/noncore/graphics/opie-eye/lib/ | ||
8 | DESTPATH += $(OPIEDIR)/include | ||
9 | |||
10 | LIBS += -lopieui2 -lopiecore2 | ||
11 | |||
12 | include( $(OPIEDIR)/include.pro ) | ||
diff --git a/libopie2/examples/opieui/okeyconfigwidget/testwidget.cpp b/libopie2/examples/opieui/okeyconfigwidget/testwidget.cpp deleted file mode 100644 index 6d2c773..0000000 --- a/libopie2/examples/opieui/okeyconfigwidget/testwidget.cpp +++ b/dev/null | |||
@@ -1,128 +0,0 @@ | |||
1 | #include "testwidget.h" | ||
2 | |||
3 | #include <opie2/okeyconfigwidget.h> | ||
4 | |||
5 | #include <opie2/oapplicationfactory.h> | ||
6 | #include <opie2/otabwidget.h> | ||
7 | |||
8 | #include <qpe/qpeapplication.h> | ||
9 | |||
10 | #include <qevent.h> | ||
11 | #include <qlayout.h> | ||
12 | #include <qpushbutton.h> | ||
13 | #include <qmainwindow.h> | ||
14 | #include <qdialog.h> | ||
15 | |||
16 | |||
17 | /** | ||
18 | * QObject with signals and slots inside a .cpp | ||
19 | * requires the .moc at the bottom! and a run of qmake | ||
20 | */ | ||
21 | class MainWindow : public QMainWindow { | ||
22 | Q_OBJECT | ||
23 | public: | ||
24 | static QString appName() { | ||
25 | return QString::fromLatin1("keyconfig"); | ||
26 | } | ||
27 | MainWindow( QWidget*, const char*, WFlags fl ); | ||
28 | ~MainWindow() {} | ||
29 | private slots: | ||
30 | void slotClicked(); | ||
31 | private: | ||
32 | Opie::Core::OKeyConfigManager *m_manager; | ||
33 | }; | ||
34 | |||
35 | |||
36 | OPIE_EXPORT_APP( Opie::Core::OApplicationFactory<MainWindow> ) | ||
37 | |||
38 | |||
39 | MainWindow::MainWindow( QWidget* parent, const char* name, WFlags fl ) | ||
40 | : QMainWindow( parent, name, fl ) | ||
41 | { | ||
42 | QVBoxLayout *lay = new QVBoxLayout( this ); | ||
43 | QPushButton *btn = new QPushButton( tr("Configure" ), this ); | ||
44 | TestMainWindow *wid = new TestMainWindow( this, "name", 0 ); | ||
45 | |||
46 | lay->addWidget( btn ); | ||
47 | lay->addWidget( wid ); | ||
48 | m_manager = wid->manager(); | ||
49 | |||
50 | connect( btn, SIGNAL(clicked()), this, SLOT(slotClicked()) ); | ||
51 | } | ||
52 | |||
53 | void MainWindow::slotClicked() { | ||
54 | QDialog diag( this, "name", true ); | ||
55 | diag.setCaption( tr( "Manage Keys" ) ); | ||
56 | |||
57 | QHBoxLayout *lay = new QHBoxLayout( &diag ); | ||
58 | Opie::Ui::OKeyConfigWidget *wid = new Opie::Ui::OKeyConfigWidget( &diag, "key config" ); | ||
59 | wid->setChangeMode( Opie::Ui::OKeyConfigWidget::Queue ); | ||
60 | wid->insert( tr("MainWindow Options" ), m_manager ); | ||
61 | wid->load(); | ||
62 | |||
63 | lay->addWidget( wid ); | ||
64 | |||
65 | if ( QPEApplication::execDialog( &diag ) == QDialog::Accepted ) { | ||
66 | wid->save(); | ||
67 | } | ||
68 | } | ||
69 | |||
70 | TestMainWindow::TestMainWindow( QWidget* parent, const char* slot, WFlags fl ) | ||
71 | : Opie::Ui::OListView( parent, slot, fl) | ||
72 | { | ||
73 | addColumn( tr( "A Doo" ) ); | ||
74 | addColumn( tr( "B Doo" ) ); | ||
75 | |||
76 | m_config = new Opie::Core::OConfig( "test_config_foo" ); | ||
77 | |||
78 | /* generate the black list */ | ||
79 | Opie::Core::OKeyPair::List blackList; | ||
80 | blackList.append( Opie::Core::OKeyPair::leftArrowKey() ); | ||
81 | blackList.append( Opie::Core::OKeyPair::rightArrowKey() ); | ||
82 | blackList.append( Opie::Core::OKeyPair::downArrowKey() ); | ||
83 | blackList.append( Opie::Core::OKeyPair::upArrowKey() ); | ||
84 | |||
85 | m_manager = new Opie::Core::OKeyConfigManager( m_config, "Key Group", | ||
86 | blackList, false, this, "Key Manager" ); | ||
87 | |||
88 | m_manager->addKeyConfig( Opie::Core::OKeyConfigItem( tr( "Delete Action" ), "delete_key", QPixmap(), | ||
89 | 10, Opie::Core::OKeyPair( Qt::Key_D, Qt::ShiftButton ), this, | ||
90 | SLOT(slotDelete(QWidget*,QKeyEvent*)) ) ); | ||
91 | m_manager->addKeyConfig( Opie::Core::OKeyConfigItem( tr( "Show Action" ), "show_key", QPixmap(), | ||
92 | 11, Opie::Core::OKeyPair( Qt::Key_S, Qt::AltButton ) ) ); | ||
93 | |||
94 | connect(m_manager, SIGNAL(actionActivated(QWidget*,QKeyEvent*,const Opie::Core::OKeyConfigItem&)), | ||
95 | this, SLOT(slotAction(QWidget*, QKeyEvent*, const Opie::Core::OKeyConfigItem&)) ); | ||
96 | // when commenting the line below out the keyPressEvent will work | ||
97 | m_manager->handleWidget( this ); | ||
98 | m_manager->load(); | ||
99 | } | ||
100 | |||
101 | TestMainWindow::~TestMainWindow() { | ||
102 | m_manager->save(); | ||
103 | delete m_config; | ||
104 | } | ||
105 | |||
106 | Opie::Core::OKeyConfigManager* TestMainWindow::manager() { | ||
107 | return m_manager; | ||
108 | } | ||
109 | |||
110 | /* | ||
111 | * This only works if we do not handle the even with m_manager->handleWidget( this ) | ||
112 | * So this is only for demo purposes | ||
113 | */ | ||
114 | void TestMainWindow::keyPressEvent( QKeyEvent* ev ) { | ||
115 | owarn << "String is "+ m_manager->handleKeyEvent( ev ).text() << oendl; | ||
116 | owarn << "Id was " << m_manager->handleKeyEventId( ev ) << " " << ev->key() << " " << ev->state() << " " << ev->ascii() << "" << oendl; | ||
117 | ev->ignore(); | ||
118 | } | ||
119 | |||
120 | void TestMainWindow::slotDelete( QWidget* wid, QKeyEvent* ev ) { | ||
121 | owarn << "Slot Delete " << wid << " " << ev->key() << " " << ev->state() << "" << oendl; | ||
122 | } | ||
123 | |||
124 | void TestMainWindow::slotAction( QWidget* wid, QKeyEvent* ev, const Opie::Core::OKeyConfigItem& item) { | ||
125 | owarn << "Slot Action " << wid << " " << ev->key() << " " << ev->state() << " " << item.text() << " " << item.id() << "" << oendl; | ||
126 | } | ||
127 | |||
128 | #include "testwidget.moc" | ||
diff --git a/libopie2/examples/opieui/okeyconfigwidget/testwidget.h b/libopie2/examples/opieui/okeyconfigwidget/testwidget.h deleted file mode 100644 index 6ecb346..0000000 --- a/libopie2/examples/opieui/okeyconfigwidget/testwidget.h +++ b/dev/null | |||
@@ -1,40 +0,0 @@ | |||
1 | #ifndef TEST_WIDGET_H | ||
2 | #define TEST_WIDGET_H | ||
3 | |||
4 | #include <qmainwindow.h> | ||
5 | |||
6 | #include <opie2/olistview.h> | ||
7 | |||
8 | namespace Opie{ | ||
9 | namespace Ui{ | ||
10 | class OTabWidget; | ||
11 | class OListView; | ||
12 | } | ||
13 | namespace Core { | ||
14 | class OConfig; | ||
15 | class OKeyConfigManager; | ||
16 | class OKeyConfigItem; | ||
17 | } | ||
18 | } | ||
19 | class QKeyEvent; | ||
20 | |||
21 | |||
22 | class TestMainWindow : public Opie::Ui::OListView { | ||
23 | Q_OBJECT | ||
24 | public: | ||
25 | |||
26 | TestMainWindow(QWidget* parent, const char*, WFlags fl ); | ||
27 | ~TestMainWindow(); | ||
28 | |||
29 | Opie::Core::OKeyConfigManager *manager(); | ||
30 | protected: | ||
31 | void keyPressEvent( QKeyEvent* ); | ||
32 | private slots: | ||
33 | void slotDelete( QWidget*, QKeyEvent* ); | ||
34 | void slotAction( QWidget*, QKeyEvent*, const Opie::Core::OKeyConfigItem& ); | ||
35 | private: | ||
36 | Opie::Core::OConfig *m_config; | ||
37 | Opie::Core::OKeyConfigManager *m_manager; | ||
38 | }; | ||
39 | |||
40 | #endif | ||