summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--libopie2/opiecore/device/odevice.cpp33
-rw-r--r--libopie2/opiecore/device/odevice.h15
-rw-r--r--libopie2/opiecore/device/odevice_ipaq.cpp4
-rw-r--r--libopie2/opiecore/device/odevice_simpad.cpp4
-rw-r--r--libopie2/opiecore/device/odevice_zaurus.cpp4
5 files changed, 54 insertions, 6 deletions
diff --git a/libopie2/opiecore/device/odevice.cpp b/libopie2/opiecore/device/odevice.cpp
index ee66d95..62a2e03 100644
--- a/libopie2/opiecore/device/odevice.cpp
+++ b/libopie2/opiecore/device/odevice.cpp
@@ -53,24 +53,47 @@ _;:, .> :=|. This program is free software; you can
53#include <signal.h> 53#include <signal.h>
54#include <sys/ioctl.h> 54#include <sys/ioctl.h>
55#include <sys/time.h> 55#include <sys/time.h>
56#include <unistd.h> 56#include <unistd.h>
57#ifndef QT_NO_SOUND 57#ifndef QT_NO_SOUND
58#include <linux/soundcard.h> 58#include <linux/soundcard.h>
59#endif 59#endif
60 60
61const char* PATH_PROC_CPUINFO = "/proc/cpuinfo"; 61const char* PATH_PROC_CPUINFO = "/proc/cpuinfo";
62 62
63using namespace Opie::Core; 63using namespace Opie::Core;
64 64
65struct default_button default_buttons [] = {
66 { Qt::Key_F9, QT_TRANSLATE_NOOP("Button", "Calendar Button"),
67 "devicebuttons/z_calendar",
68 "datebook", "nextView()",
69 "today", "raise()" },
70 { Qt::Key_F10, QT_TRANSLATE_NOOP("Button", "Contacts Button"),
71 "devicebuttons/z_contact",
72 "addressbook", "raise()",
73 "addressbook", "beamBusinessCard()" },
74 { Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "Home Button"),
75 "devicebuttons/z_home",
76 "QPE/Launcher", "home()",
77 "buttonsettings", "raise()" },
78 { Qt::Key_F11, QT_TRANSLATE_NOOP("Button", "Menu Button"),
79 "devicebuttons/z_menu",
80 "QPE/TaskBar", "toggleMenu()",
81 "QPE/TaskBar", "toggleStartMenu()" },
82 { Qt::Key_F13, QT_TRANSLATE_NOOP("Button", "Mail Button"),
83 "devicebuttons/z_mail",
84 "opiemail", "raise()",
85 "opiemail", "newMail()" },
86};
87
65ODevice *ODevice::inst() 88ODevice *ODevice::inst()
66{ 89{
67 static ODevice *dev = 0; 90 static ODevice *dev = 0;
68 91
69 // rewrite this to only use /proc/cpuinfo or so 92 // rewrite this to only use /proc/cpuinfo or so
70 93
71 if ( !dev ) 94 if ( !dev )
72 { 95 {
73 QFile f( PATH_PROC_CPUINFO ); 96 QFile f( PATH_PROC_CPUINFO );
74 if ( f.open( IO_ReadOnly ) ) 97 if ( f.open( IO_ReadOnly ) )
75 { 98 {
76 QTextStream s( &f ); 99 QTextStream s( &f );
@@ -132,24 +155,34 @@ void ODevice::init()
132} 155}
133 156
134/** 157/**
135* This method initialises the button mapping 158* This method initialises the button mapping
136*/ 159*/
137void ODevice::initButtons() 160void ODevice::initButtons()
138{ 161{
139 if ( d->m_buttons ) 162 if ( d->m_buttons )
140 return; 163 return;
141 164
142 qDebug ( "init Buttons" ); 165 qDebug ( "init Buttons" );
143 d->m_buttons = new QValueList <ODeviceButton>; 166 d->m_buttons = new QValueList <ODeviceButton>;
167 for ( uint i = 0; i < ( sizeof( default_buttons ) / sizeof( default_button )); i++ ) {
168 default_button *db = default_buttons + i;
169 ODeviceButton b;
170 b. setKeycode ( db->code );
171 b. setUserText ( QObject::tr ( "Button", db->utext ));
172 b. setPixmap ( Resource::loadPixmap ( db->pix ));
173 b. setFactoryPresetPressedAction ( OQCopMessage ( makeChannel ( db->fpressedservice ), db->fpressedaction ));
174 b. setFactoryPresetHeldAction ( OQCopMessage ( makeChannel ( db->fheldservice ), db->fheldaction ));
175 d->m_buttons->append ( b );
176 }
144 177
145 reloadButtonMapping(); 178 reloadButtonMapping();
146 179
147 QCopChannel *sysch = new QCopChannel ( "QPE/System", this ); 180 QCopChannel *sysch = new QCopChannel ( "QPE/System", this );
148 connect ( sysch, SIGNAL( received(const QCString&,const QByteArray&)), this, SLOT( systemMessage(const QCString&,const QByteArray&))); 181 connect ( sysch, SIGNAL( received(const QCString&,const QByteArray&)), this, SLOT( systemMessage(const QCString&,const QByteArray&)));
149} 182}
150 183
151ODevice::~ODevice() 184ODevice::~ODevice()
152{ 185{
153// we leak m_devicebuttons and m_cpu_frequency 186// we leak m_devicebuttons and m_cpu_frequency
154// but it's a singleton and it is not so importantant 187// but it's a singleton and it is not so importantant
155// -zecke 188// -zecke
diff --git a/libopie2/opiecore/device/odevice.h b/libopie2/opiecore/device/odevice.h
index 5ee9cca..0ba58f0 100644
--- a/libopie2/opiecore/device/odevice.h
+++ b/libopie2/opiecore/device/odevice.h
@@ -151,24 +151,39 @@ enum ODirection {
151 CW = 0, 151 CW = 0,
152 CCW = 1, 152 CCW = 1,
153 Flip = 2, 153 Flip = 2,
154}; 154};
155 155
156enum OHingeStatus { 156enum OHingeStatus {
157 CASE_CLOSED = 3, 157 CASE_CLOSED = 3,
158 CASE_PORTRAIT = 2, 158 CASE_PORTRAIT = 2,
159 CASE_LANDSCAPE = 0, 159 CASE_LANDSCAPE = 0,
160 CASE_UNKNOWN = 1, 160 CASE_UNKNOWN = 1,
161}; 161};
162 162
163/* default button for qvfb or such
164 * see odevice.cpp for details.
165 * hint: manage a user defined button for qvfb?
166 * alwin
167 */
168struct default_button {
169 Qt::Key code;
170 char *utext;
171 char *pix;
172 char *fpressedservice;
173 char *fpressedaction;
174 char *fheldservice;
175 char *fheldaction;
176};
177
163/** 178/**
164 * A singleton which gives informations about device specefic option 179 * A singleton which gives informations about device specefic option
165 * like the Hardware used, LEDs, the Base Distribution and 180 * like the Hardware used, LEDs, the Base Distribution and
166 * hardware key mappings. 181 * hardware key mappings.
167 * 182 *
168 * @short A small class for device specefic options 183 * @short A small class for device specefic options
169 * @see QObject 184 * @see QObject
170 * @author Robert Griebl 185 * @author Robert Griebl
171 * @version 1.0 186 * @version 1.0
172 */ 187 */
173class ODevice : public QObject 188class ODevice : public QObject
174{ 189{
diff --git a/libopie2/opiecore/device/odevice_ipaq.cpp b/libopie2/opiecore/device/odevice_ipaq.cpp
index 2efcd3a..98e2ffa 100644
--- a/libopie2/opiecore/device/odevice_ipaq.cpp
+++ b/libopie2/opiecore/device/odevice_ipaq.cpp
@@ -91,26 +91,26 @@ struct i_button ipaq_buttons [] = {
91 Qt::Key_F10, QT_TRANSLATE_NOOP("Button", "Contacts Button"), 91 Qt::Key_F10, QT_TRANSLATE_NOOP("Button", "Contacts Button"),
92 "devicebuttons/ipaq_contact", 92 "devicebuttons/ipaq_contact",
93 "addressbook", "raise()", 93 "addressbook", "raise()",
94 "addressbook", "beamBusinessCard()" }, 94 "addressbook", "beamBusinessCard()" },
95 { Model_iPAQ_H31xx | Model_iPAQ_H36xx | Model_iPAQ_H37xx, 95 { Model_iPAQ_H31xx | Model_iPAQ_H36xx | Model_iPAQ_H37xx,
96 Qt::Key_F11, QT_TRANSLATE_NOOP("Button", "Menu Button"), 96 Qt::Key_F11, QT_TRANSLATE_NOOP("Button", "Menu Button"),
97 "devicebuttons/ipaq_menu", 97 "devicebuttons/ipaq_menu",
98 "QPE/TaskBar", "toggleMenu()", 98 "QPE/TaskBar", "toggleMenu()",
99 "QPE/TaskBar", "toggleStartMenu()" }, 99 "QPE/TaskBar", "toggleStartMenu()" },
100 { Model_iPAQ_H38xx | Model_iPAQ_H39xx | Model_iPAQ_H5xxx, 100 { Model_iPAQ_H38xx | Model_iPAQ_H39xx | Model_iPAQ_H5xxx,
101 Qt::Key_F13, QT_TRANSLATE_NOOP("Button", "Mail Button"), 101 Qt::Key_F13, QT_TRANSLATE_NOOP("Button", "Mail Button"),
102 "devicebuttons/ipaq_mail", 102 "devicebuttons/ipaq_mail",
103 "mail", "raise()", 103 "opiemail", "raise()",
104 "mail", "newMail()" }, 104 "opiemail", "newMail()" },
105 { Model_iPAQ_H31xx | Model_iPAQ_H36xx | Model_iPAQ_H37xx | Model_iPAQ_H38xx | Model_iPAQ_H39xx | Model_iPAQ_H5xxx, 105 { Model_iPAQ_H31xx | Model_iPAQ_H36xx | Model_iPAQ_H37xx | Model_iPAQ_H38xx | Model_iPAQ_H39xx | Model_iPAQ_H5xxx,
106 Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "Home Button"), 106 Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "Home Button"),
107 "devicebuttons/ipaq_home", 107 "devicebuttons/ipaq_home",
108 "QPE/Launcher", "home()", 108 "QPE/Launcher", "home()",
109 "buttonsettings", "raise()" }, 109 "buttonsettings", "raise()" },
110 { Model_iPAQ_H31xx | Model_iPAQ_H36xx | Model_iPAQ_H37xx | Model_iPAQ_H38xx | Model_iPAQ_H39xx | Model_iPAQ_H5xxx, 110 { Model_iPAQ_H31xx | Model_iPAQ_H36xx | Model_iPAQ_H37xx | Model_iPAQ_H38xx | Model_iPAQ_H39xx | Model_iPAQ_H5xxx,
111 Qt::Key_F24, QT_TRANSLATE_NOOP("Button", "Record Button"), 111 Qt::Key_F24, QT_TRANSLATE_NOOP("Button", "Record Button"),
112 "devicebuttons/ipaq_record", 112 "devicebuttons/ipaq_record",
113 "QPE/VMemo", "toggleRecord()", 113 "QPE/VMemo", "toggleRecord()",
114 "sound", "raise()" }, 114 "sound", "raise()" },
115}; 115};
116 116
diff --git a/libopie2/opiecore/device/odevice_simpad.cpp b/libopie2/opiecore/device/odevice_simpad.cpp
index 7d79ef5..e9481bb 100644
--- a/libopie2/opiecore/device/odevice_simpad.cpp
+++ b/libopie2/opiecore/device/odevice_simpad.cpp
@@ -66,26 +66,26 @@ struct s_button simpad_buttons [] = {
66 Qt::Key_F10, QT_TRANSLATE_NOOP("Button", "Lower+Down"), 66 Qt::Key_F10, QT_TRANSLATE_NOOP("Button", "Lower+Down"),
67 "devicebuttons/simpad_lower_down", 67 "devicebuttons/simpad_lower_down",
68 "addressbook", "raise()", 68 "addressbook", "raise()",
69 "addressbook", "beamBusinessCard()" }, 69 "addressbook", "beamBusinessCard()" },
70 { Model_SIMpad_CL4 | Model_SIMpad_SL4 | Model_SIMpad_SLC | Model_SIMpad_TSinus, 70 { Model_SIMpad_CL4 | Model_SIMpad_SL4 | Model_SIMpad_SLC | Model_SIMpad_TSinus,
71 Qt::Key_F11, QT_TRANSLATE_NOOP("Button", "Lower+Right"), 71 Qt::Key_F11, QT_TRANSLATE_NOOP("Button", "Lower+Right"),
72 "devicebuttons/simpad_lower_right", 72 "devicebuttons/simpad_lower_right",
73 "QPE/TaskBar", "toggleMenu()", 73 "QPE/TaskBar", "toggleMenu()",
74 "QPE/TaskBar", "toggleStartMenu()" }, 74 "QPE/TaskBar", "toggleStartMenu()" },
75 { Model_SIMpad_CL4 | Model_SIMpad_SL4 | Model_SIMpad_SLC | Model_SIMpad_TSinus, 75 { Model_SIMpad_CL4 | Model_SIMpad_SL4 | Model_SIMpad_SLC | Model_SIMpad_TSinus,
76 Qt::Key_F13, QT_TRANSLATE_NOOP("Button", "Lower+Left"), 76 Qt::Key_F13, QT_TRANSLATE_NOOP("Button", "Lower+Left"),
77 "devicebuttons/simpad_lower_left", 77 "devicebuttons/simpad_lower_left",
78 "mail", "raise()", 78 "opiemail", "raise()",
79 "mail", "newMail()" }, 79 "opiemail", "newMail()" },
80 80
81 { Model_SIMpad_CL4 | Model_SIMpad_SL4 | Model_SIMpad_SLC | Model_SIMpad_TSinus, 81 { Model_SIMpad_CL4 | Model_SIMpad_SL4 | Model_SIMpad_SLC | Model_SIMpad_TSinus,
82 Qt::Key_F5, QT_TRANSLATE_NOOP("Button", "Upper+Up"), 82 Qt::Key_F5, QT_TRANSLATE_NOOP("Button", "Upper+Up"),
83 "devicebuttons/simpad_upper_up", 83 "devicebuttons/simpad_upper_up",
84 "QPE/Launcher", "home()", 84 "QPE/Launcher", "home()",
85 "buttonsettings", "raise()" }, 85 "buttonsettings", "raise()" },
86 { Model_SIMpad_CL4 | Model_SIMpad_SL4 | Model_SIMpad_SLC | Model_SIMpad_TSinus, 86 { Model_SIMpad_CL4 | Model_SIMpad_SL4 | Model_SIMpad_SLC | Model_SIMpad_TSinus,
87 Qt::Key_F6, QT_TRANSLATE_NOOP("Button", "Upper+Down"), 87 Qt::Key_F6, QT_TRANSLATE_NOOP("Button", "Upper+Down"),
88 "devicebuttons/simpad_upper_down", 88 "devicebuttons/simpad_upper_down",
89 "addressbook", "raise()", 89 "addressbook", "raise()",
90 "addressbook", "beamBusinessCard()" }, 90 "addressbook", "beamBusinessCard()" },
91 { Model_SIMpad_CL4 | Model_SIMpad_SL4 | Model_SIMpad_SLC | Model_SIMpad_TSinus, 91 { Model_SIMpad_CL4 | Model_SIMpad_SL4 | Model_SIMpad_SLC | Model_SIMpad_TSinus,
diff --git a/libopie2/opiecore/device/odevice_zaurus.cpp b/libopie2/opiecore/device/odevice_zaurus.cpp
index 000d29c..1434e69 100644
--- a/libopie2/opiecore/device/odevice_zaurus.cpp
+++ b/libopie2/opiecore/device/odevice_zaurus.cpp
@@ -66,26 +66,26 @@ struct z_button z_buttons [] = {
66 "addressbook", "raise()", 66 "addressbook", "raise()",
67 "addressbook", "beamBusinessCard()" }, 67 "addressbook", "beamBusinessCard()" },
68 { Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "Home Button"), 68 { Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "Home Button"),
69 "devicebuttons/z_home", 69 "devicebuttons/z_home",
70 "QPE/Launcher", "home()", 70 "QPE/Launcher", "home()",
71 "buttonsettings", "raise()" }, 71 "buttonsettings", "raise()" },
72 { Qt::Key_F11, QT_TRANSLATE_NOOP("Button", "Menu Button"), 72 { Qt::Key_F11, QT_TRANSLATE_NOOP("Button", "Menu Button"),
73 "devicebuttons/z_menu", 73 "devicebuttons/z_menu",
74 "QPE/TaskBar", "toggleMenu()", 74 "QPE/TaskBar", "toggleMenu()",
75 "QPE/TaskBar", "toggleStartMenu()" }, 75 "QPE/TaskBar", "toggleStartMenu()" },
76 { Qt::Key_F13, QT_TRANSLATE_NOOP("Button", "Mail Button"), 76 { Qt::Key_F13, QT_TRANSLATE_NOOP("Button", "Mail Button"),
77 "devicebuttons/z_mail", 77 "devicebuttons/z_mail",
78 "mail", "raise()", 78 "opiemail", "raise()",
79 "mail", "newMail()" }, 79 "opiemail", "newMail()" },
80}; 80};
81 81
82struct z_button z_buttons_c700 [] = { 82struct z_button z_buttons_c700 [] = {
83 { Qt::Key_F9, QT_TRANSLATE_NOOP("Button", "Calendar Button"), 83 { Qt::Key_F9, QT_TRANSLATE_NOOP("Button", "Calendar Button"),
84 "devicebuttons/z_calendar", 84 "devicebuttons/z_calendar",
85 "datebook", "nextView()", 85 "datebook", "nextView()",
86 "today", "raise()" }, 86 "today", "raise()" },
87 { Qt::Key_F10, QT_TRANSLATE_NOOP("Button", "Contacts Button"), 87 { Qt::Key_F10, QT_TRANSLATE_NOOP("Button", "Contacts Button"),
88 "devicebuttons/z_contact", 88 "devicebuttons/z_contact",
89 "addressbook", "raise()", 89 "addressbook", "raise()",
90 "addressbook", "beamBusinessCard()" }, 90 "addressbook", "beamBusinessCard()" },
91 { Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "Home Button"), 91 { Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "Home Button"),