-rw-r--r-- | libopie2/opiecore/device/odevice_simpad.cpp | 27 | ||||
-rw-r--r-- | libopie2/opiecore/device/odevice_simpad.h | 12 |
2 files changed, 23 insertions, 16 deletions
diff --git a/libopie2/opiecore/device/odevice_simpad.cpp b/libopie2/opiecore/device/odevice_simpad.cpp index ebf0cbb..9fde7f9 100644 --- a/libopie2/opiecore/device/odevice_simpad.cpp +++ b/libopie2/opiecore/device/odevice_simpad.cpp | |||
@@ -52,16 +52,28 @@ | |||
52 | #include <sys/time.h> | 52 | #include <sys/time.h> |
53 | #include <unistd.h> | 53 | #include <unistd.h> |
54 | #ifndef QT_NO_SOUND | 54 | #ifndef QT_NO_SOUND |
55 | #include <linux/soundcard.h> | 55 | #include <linux/soundcard.h> |
56 | #endif | 56 | #endif |
57 | 57 | ||
58 | using namespace Opie::Core; | 58 | namespace Opie { |
59 | using namespace Opie::Core::Internal; | 59 | namespace Core { |
60 | namespace Internal { | ||
61 | namespace { | ||
62 | struct s_button { | ||
63 | uint model; | ||
64 | Qt::Key code; | ||
65 | char *utext; | ||
66 | char *pix; | ||
67 | char *fpressedservice; | ||
68 | char *fpressedaction; | ||
69 | char *fheldservice; | ||
70 | char *fheldaction; | ||
71 | }; | ||
60 | 72 | ||
61 | struct s_button simpad_buttons [] = { | 73 | static struct s_button simpad_buttons [] = { |
62 | { Model_SIMpad_CL4 | Model_SIMpad_SL4 | Model_SIMpad_SLC | Model_SIMpad_TSinus, | 74 | { Model_SIMpad_CL4 | Model_SIMpad_SL4 | Model_SIMpad_SLC | Model_SIMpad_TSinus, |
63 | Qt::Key_F9, QT_TRANSLATE_NOOP("Button", "Lower+Up"), | 75 | Qt::Key_F9, QT_TRANSLATE_NOOP("Button", "Lower+Up"), |
64 | "devicebuttons/simpad_lower_up", | 76 | "devicebuttons/simpad_lower_up", |
65 | "datebook", "nextView()", | 77 | "datebook", "nextView()", |
66 | "today", "raise()" }, | 78 | "today", "raise()" }, |
67 | { Model_SIMpad_CL4 | Model_SIMpad_SL4 | Model_SIMpad_SLC | Model_SIMpad_TSinus, | 79 | { Model_SIMpad_CL4 | Model_SIMpad_SL4 | Model_SIMpad_SLC | Model_SIMpad_TSinus, |
@@ -110,12 +122,14 @@ struct s_button simpad_buttons [] = { | |||
110 | Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "Lower+Upper"), | 122 | Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "Lower+Upper"), |
111 | "devicebuttons/simpad_upper_lower", | 123 | "devicebuttons/simpad_upper_lower", |
112 | "QPE/Launcher", "home()", | 124 | "QPE/Launcher", "home()", |
113 | "buttonsettings", "raise()" }, | 125 | "buttonsettings", "raise()" }, |
114 | */ | 126 | */ |
115 | }; | 127 | }; |
128 | } | ||
129 | |||
116 | 130 | ||
117 | void SIMpad::init(const QString&) | 131 | void SIMpad::init(const QString&) |
118 | { | 132 | { |
119 | d->m_vendorstr = "SIEMENS"; | 133 | d->m_vendorstr = "SIEMENS"; |
120 | d->m_vendor = Vendor_SIEMENS; | 134 | d->m_vendor = Vendor_SIEMENS; |
121 | 135 | ||
@@ -146,13 +160,14 @@ void SIMpad::initButtons() | |||
146 | { | 160 | { |
147 | if ( d->m_buttons ) | 161 | if ( d->m_buttons ) |
148 | return; | 162 | return; |
149 | 163 | ||
150 | d->m_buttons = new QValueList <ODeviceButton>; | 164 | d->m_buttons = new QValueList <ODeviceButton>; |
151 | 165 | ||
152 | for ( uint i = 0; i < ( sizeof( simpad_buttons ) / sizeof( s_button )); i++ ) { | 166 | uint size = sizeof(simpad_buttons)/sizeof(s_button); |
167 | for ( uint i = 0; i < size; i++ ) { | ||
153 | s_button *sb = simpad_buttons + i; | 168 | s_button *sb = simpad_buttons + i; |
154 | ODeviceButton b; | 169 | ODeviceButton b; |
155 | 170 | ||
156 | if (( sb->model & d->m_model ) == d->m_model ) { | 171 | if (( sb->model & d->m_model ) == d->m_model ) { |
157 | b. setKeycode ( sb->code ); | 172 | b. setKeycode ( sb->code ); |
158 | b. setUserText ( QObject::tr ( "Button", sb->utext )); | 173 | b. setUserText ( QObject::tr ( "Button", sb->utext )); |
@@ -378,6 +393,10 @@ void SIMpad::updateAllWidgets() { | |||
378 | wid->update(); | 393 | wid->update(); |
379 | ++it; | 394 | ++it; |
380 | } | 395 | } |
381 | 396 | ||
382 | delete list; | 397 | delete list; |
383 | } | 398 | } |
399 | |||
400 | } | ||
401 | } | ||
402 | } | ||
diff --git a/libopie2/opiecore/device/odevice_simpad.h b/libopie2/opiecore/device/odevice_simpad.h index c25b911..41b94d1 100644 --- a/libopie2/opiecore/device/odevice_simpad.h +++ b/libopie2/opiecore/device/odevice_simpad.h | |||
@@ -65,23 +65,11 @@ protected: | |||
65 | int m_power_timer; | 65 | int m_power_timer; |
66 | 66 | ||
67 | OLedState m_leds [2]; | 67 | OLedState m_leds [2]; |
68 | private: | 68 | private: |
69 | static void updateAllWidgets(); | 69 | static void updateAllWidgets(); |
70 | }; | 70 | }; |
71 | |||
72 | struct s_button { | ||
73 | uint model; | ||
74 | Qt::Key code; | ||
75 | char *utext; | ||
76 | char *pix; | ||
77 | char *fpressedservice; | ||
78 | char *fpressedaction; | ||
79 | char *fheldservice; | ||
80 | char *fheldaction; | ||
81 | }; | ||
82 | |||
83 | } | 71 | } |
84 | } | 72 | } |
85 | } | 73 | } |
86 | 74 | ||
87 | #endif | 75 | #endif |