Diffstat (limited to 'libopie2/opiecore/device/odevice_yopy.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | libopie2/opiecore/device/odevice_yopy.cpp | 4 |
1 files changed, 0 insertions, 4 deletions
diff --git a/libopie2/opiecore/device/odevice_yopy.cpp b/libopie2/opiecore/device/odevice_yopy.cpp index a06d7ec..8f22514 100644 --- a/libopie2/opiecore/device/odevice_yopy.cpp +++ b/libopie2/opiecore/device/odevice_yopy.cpp | |||
@@ -16,142 +16,138 @@ _;:, .> :=|. This program is free software; you can | |||
16 | : .. .:, . . . without even the implied warranty of | 16 | : .. .:, . . . without even the implied warranty of |
17 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | 17 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
18 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | 18 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU |
19 | ..}^=.= = ; Library General Public License for more | 19 | ..}^=.= = ; Library General Public License for more |
20 | ++= -. .` .: details. | 20 | ++= -. .` .: details. |
21 | : = ...= . :.=- | 21 | : = ...= . :.=- |
22 | -. .:....=;==+<; You should have received a copy of the GNU | 22 | -. .:....=;==+<; You should have received a copy of the GNU |
23 | -_. . . )=. = Library General Public License along with | 23 | -_. . . )=. = Library General Public License along with |
24 | -- :-=` this library; see the file COPYING.LIB. | 24 | -- :-=` this library; see the file COPYING.LIB. |
25 | If not, write to the Free Software Foundation, | 25 | If not, write to the Free Software Foundation, |
26 | Inc., 59 Temple Place - Suite 330, | 26 | Inc., 59 Temple Place - Suite 330, |
27 | Boston, MA 02111-1307, USA. | 27 | Boston, MA 02111-1307, USA. |
28 | */ | 28 | */ |
29 | 29 | ||
30 | #include "odevice_yopy.h" | 30 | #include "odevice_yopy.h" |
31 | 31 | ||
32 | /* QT */ | 32 | /* QT */ |
33 | #include <qapplication.h> | 33 | #include <qapplication.h> |
34 | #include <qfile.h> | 34 | #include <qfile.h> |
35 | #include <qtextstream.h> | 35 | #include <qtextstream.h> |
36 | #include <qwindowsystem_qws.h> | 36 | #include <qwindowsystem_qws.h> |
37 | 37 | ||
38 | /* OPIE */ | 38 | /* OPIE */ |
39 | #include <qpe/config.h> | 39 | #include <qpe/config.h> |
40 | #include <qpe/resource.h> | 40 | #include <qpe/resource.h> |
41 | #include <qpe/sound.h> | 41 | #include <qpe/sound.h> |
42 | #include <qpe/qcopenvelope_qws.h> | 42 | #include <qpe/qcopenvelope_qws.h> |
43 | 43 | ||
44 | /* STD */ | 44 | /* STD */ |
45 | #include <fcntl.h> | 45 | #include <fcntl.h> |
46 | #include <math.h> | 46 | #include <math.h> |
47 | #include <stdlib.h> | 47 | #include <stdlib.h> |
48 | #include <signal.h> | 48 | #include <signal.h> |
49 | #include <sys/ioctl.h> | 49 | #include <sys/ioctl.h> |
50 | #include <sys/time.h> | 50 | #include <sys/time.h> |
51 | #include <unistd.h> | 51 | #include <unistd.h> |
52 | #ifndef QT_NO_SOUND | 52 | #ifndef QT_NO_SOUND |
53 | #include <linux/soundcard.h> | 53 | #include <linux/soundcard.h> |
54 | #endif | 54 | #endif |
55 | 55 | ||
56 | using namespace Opie::Core; | 56 | using namespace Opie::Core; |
57 | using namespace Opie::Core::Internal; | 57 | using namespace Opie::Core::Internal; |
58 | 58 | ||
59 | struct yopy_button yopy_buttons [] = { | 59 | struct yopy_button yopy_buttons [] = { |
60 | { Qt::Key_F10, QT_TRANSLATE_NOOP( "Button", "Action Button" ), | 60 | { Qt::Key_F10, QT_TRANSLATE_NOOP( "Button", "Action Button" ), |
61 | "devicebuttons/yopy_action", | 61 | "devicebuttons/yopy_action", |
62 | "datebook", "nextView()", | 62 | "datebook", "nextView()", |
63 | "today", "raise()" }, | 63 | "today", "raise()" }, |
64 | { Qt::Key_F11, QT_TRANSLATE_NOOP( "Button", "OK Button" ), | 64 | { Qt::Key_F11, QT_TRANSLATE_NOOP( "Button", "OK Button" ), |
65 | "devicebuttons/yopy_ok", | 65 | "devicebuttons/yopy_ok", |
66 | "addressbook", "raise()", | 66 | "addressbook", "raise()", |
67 | "addressbook", "beamBusinessCard()" }, | 67 | "addressbook", "beamBusinessCard()" }, |
68 | { Qt::Key_F12, QT_TRANSLATE_NOOP( "Button", "End Button" ), | 68 | { Qt::Key_F12, QT_TRANSLATE_NOOP( "Button", "End Button" ), |
69 | "devicebuttons/yopy_end", | 69 | "devicebuttons/yopy_end", |
70 | "QPE/Launcher", "home()", | 70 | "QPE/Launcher", "home()", |
71 | "buttonsettings", "raise()" }, | 71 | "buttonsettings", "raise()" }, |
72 | }; | 72 | }; |
73 | 73 | ||
74 | void Yopy::init(const QString&) | 74 | void Yopy::init(const QString&) |
75 | { | 75 | { |
76 | d->m_vendorstr = "G.Mate"; | 76 | d->m_vendorstr = "G.Mate"; |
77 | d->m_vendor = Vendor_GMate; | 77 | d->m_vendor = Vendor_GMate; |
78 | d->m_modelstr = "Yopy3700"; | 78 | d->m_modelstr = "Yopy3700"; |
79 | d->m_model = Model_Yopy_3700; | 79 | d->m_model = Model_Yopy_3700; |
80 | d->m_rotation = Rot0; | 80 | d->m_rotation = Rot0; |
81 | d->m_systemstr = "Linupy"; | 81 | d->m_systemstr = "Linupy"; |
82 | d->m_system = System_Linupy; | 82 | d->m_system = System_Linupy; |
83 | // Distribution detection code now in the base class | 83 | // Distribution detection code now in the base class |
84 | } | 84 | } |
85 | 85 | ||
86 | 86 | ||
87 | void Yopy::initButtons() | 87 | void Yopy::initButtons() |
88 | { | 88 | { |
89 | if ( d->m_buttons ) | 89 | if ( d->m_buttons ) |
90 | return ; | 90 | return ; |
91 | 91 | ||
92 | d->m_buttons = new QValueList <ODeviceButton>; | 92 | d->m_buttons = new QValueList <ODeviceButton>; |
93 | 93 | ||
94 | for ( uint i = 0; i < ( sizeof( yopy_buttons ) / sizeof( yopy_button ) ); i++ ) | 94 | for ( uint i = 0; i < ( sizeof( yopy_buttons ) / sizeof( yopy_button ) ); i++ ) |
95 | { | 95 | { |
96 | 96 | ||
97 | yopy_button *ib = yopy_buttons + i; | 97 | yopy_button *ib = yopy_buttons + i; |
98 | 98 | ||
99 | ODeviceButton b; | 99 | ODeviceButton b; |
100 | 100 | ||
101 | b. setKeycode ( ib->code ); | 101 | b. setKeycode ( ib->code ); |
102 | b. setUserText ( QObject::tr ( "Button", ib->utext ) ); | 102 | b. setUserText ( QObject::tr ( "Button", ib->utext ) ); |
103 | b. setPixmap ( Resource::loadPixmap ( ib->pix ) ); | 103 | b. setPixmap ( Resource::loadPixmap ( ib->pix ) ); |
104 | b. setFactoryPresetPressedAction | 104 | b. setFactoryPresetPressedAction |
105 | ( OQCopMessage( makeChannel( ib->fpressedservice ), ib->fpressedaction ) ); | 105 | ( OQCopMessage( makeChannel( ib->fpressedservice ), ib->fpressedaction ) ); |
106 | b. setFactoryPresetHeldAction | 106 | b. setFactoryPresetHeldAction |
107 | ( OQCopMessage( makeChannel( ib->fheldservice ), ib->fheldaction ) ); | 107 | ( OQCopMessage( makeChannel( ib->fheldservice ), ib->fheldaction ) ); |
108 | 108 | ||
109 | d->m_buttons->append ( b ); | 109 | d->m_buttons->append ( b ); |
110 | } | 110 | } |
111 | reloadButtonMapping(); | 111 | reloadButtonMapping(); |
112 | |||
113 | QCopChannel *sysch = new QCopChannel( "QPE/System", this ); | ||
114 | connect( sysch, SIGNAL( received(const QCString&,const QByteArray&) ), | ||
115 | this, SLOT( systemMessage(const QCString&,const QByteArray&) ) ); | ||
116 | } | 112 | } |
117 | 113 | ||
118 | 114 | ||
119 | bool Yopy::suspend() | 115 | bool Yopy::suspend() |
120 | { | 116 | { |
121 | /* Opie for Yopy does not implement its own power management at the | 117 | /* Opie for Yopy does not implement its own power management at the |
122 | moment. The public version runs parallel to X, and relies on the | 118 | moment. The public version runs parallel to X, and relies on the |
123 | existing power management features. */ | 119 | existing power management features. */ |
124 | return false; | 120 | return false; |
125 | } | 121 | } |
126 | 122 | ||
127 | 123 | ||
128 | bool Yopy::setDisplayBrightness( int bright ) | 124 | bool Yopy::setDisplayBrightness( int bright ) |
129 | { | 125 | { |
130 | /* The code here works, but is disabled as the current version runs | 126 | /* The code here works, but is disabled as the current version runs |
131 | parallel to X, and relies on the existing backlight demon. */ | 127 | parallel to X, and relies on the existing backlight demon. */ |
132 | #if 0 | 128 | #if 0 |
133 | if ( QFile::exists( "/proc/sys/pm/light" ) ) | 129 | if ( QFile::exists( "/proc/sys/pm/light" ) ) |
134 | { | 130 | { |
135 | int fd = ::open( "/proc/sys/pm/light", O_WRONLY ); | 131 | int fd = ::open( "/proc/sys/pm/light", O_WRONLY ); |
136 | if ( fd >= 0 ) | 132 | if ( fd >= 0 ) |
137 | { | 133 | { |
138 | if ( bright ) | 134 | if ( bright ) |
139 | ::write( fd, "1\n", 2 ); | 135 | ::write( fd, "1\n", 2 ); |
140 | else | 136 | else |
141 | ::write( fd, "0\n", 2 ); | 137 | ::write( fd, "0\n", 2 ); |
142 | ::close( fd ); | 138 | ::close( fd ); |
143 | return true; | 139 | return true; |
144 | } | 140 | } |
145 | } | 141 | } |
146 | #else | 142 | #else |
147 | Q_UNUSED( bright ) | 143 | Q_UNUSED( bright ) |
148 | #endif | 144 | #endif |
149 | return false; | 145 | return false; |
150 | } | 146 | } |
151 | 147 | ||
152 | 148 | ||
153 | int Yopy::displayBrightnessResolution() const | 149 | int Yopy::displayBrightnessResolution() const |
154 | { | 150 | { |
155 | return 2; | 151 | return 2; |
156 | } | 152 | } |
157 | 153 | ||