summaryrefslogtreecommitdiff
path: root/library/qpeapplication.cpp
authorllornkcor <llornkcor>2002-05-23 01:59:47 (UTC)
committer llornkcor <llornkcor>2002-05-23 01:59:47 (UTC)
commitae177d167999f204a968ea21ae4a4a804d939e6d (patch) (unidiff)
treef73cde3f861b8016053d4cdfa5236e2394f45c97 /library/qpeapplication.cpp
parentb448fc3d97345bbc52ce79fb1901e0a610e9a55c (diff)
downloadopie-ae177d167999f204a968ea21ae4a4a804d939e6d.zip
opie-ae177d167999f204a968ea21ae4a4a804d939e6d.tar.gz
opie-ae177d167999f204a968ea21ae4a4a804d939e6d.tar.bz2
make sound conform to sharps warped sense of conf
Diffstat (limited to 'library/qpeapplication.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--library/qpeapplication.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/library/qpeapplication.cpp b/library/qpeapplication.cpp
index 5f61c0c..cf437da 100644
--- a/library/qpeapplication.cpp
+++ b/library/qpeapplication.cpp
@@ -127,118 +127,118 @@ public:
127 const QByteArray &data) 127 const QByteArray &data)
128 { 128 {
129 qcopq.append(new QCopRec(ch,msg,data)); 129 qcopq.append(new QCopRec(ch,msg,data));
130 } 130 }
131 void sendQCopQ() 131 void sendQCopQ()
132 { 132 {
133 QCopRec* r; 133 QCopRec* r;
134 for (QListIterator<QCopRec> it(qcopq); (r=it.current()); ++it) 134 for (QListIterator<QCopRec> it(qcopq); (r=it.current()); ++it)
135 QCopChannel::sendLocally(r->channel,r->message,r->data); 135 QCopChannel::sendLocally(r->channel,r->message,r->data);
136 qcopq.clear(); 136 qcopq.clear();
137 } 137 }
138}; 138};
139 139
140class ResourceMimeFactory : public QMimeSourceFactory { 140class ResourceMimeFactory : public QMimeSourceFactory {
141public: 141public:
142 ResourceMimeFactory() 142 ResourceMimeFactory()
143 { 143 {
144 setFilePath( Global::helpPath() ); 144 setFilePath( Global::helpPath() );
145 setExtensionType("html","text/html;charset=UTF-8"); 145 setExtensionType("html","text/html;charset=UTF-8");
146 } 146 }
147 147
148 const QMimeSource* data(const QString& abs_name) const 148 const QMimeSource* data(const QString& abs_name) const
149 { 149 {
150 const QMimeSource* r = QMimeSourceFactory::data(abs_name); 150 const QMimeSource* r = QMimeSourceFactory::data(abs_name);
151 if ( !r ) { 151 if ( !r ) {
152 int sl = abs_name.length(); 152 int sl = abs_name.length();
153 do { 153 do {
154 sl = abs_name.findRev('/',sl-1); 154 sl = abs_name.findRev('/',sl-1);
155 QString name = sl>=0 ? abs_name.mid(sl+1) : abs_name; 155 QString name = sl>=0 ? abs_name.mid(sl+1) : abs_name;
156 int dot = name.findRev('.'); 156 int dot = name.findRev('.');
157 if ( dot >= 0 ) 157 if ( dot >= 0 )
158 name = name.left(dot); 158 name = name.left(dot);
159 QImage img = Resource::loadImage(name); 159 QImage img = Resource::loadImage(name);
160 if ( !img.isNull() ) 160 if ( !img.isNull() )
161 r = new QImageDrag(img); 161 r = new QImageDrag(img);
162 } while (!r && sl>0); 162 } while (!r && sl>0);
163 } 163 }
164 return r; 164 return r;
165 } 165 }
166}; 166};
167 167
168static int muted=0; 168static int muted=0;
169static int micMuted=0; 169static int micMuted=0;
170 170
171static void setVolume(int t=0, int percent=-1) 171static void setVolume(int t=0, int percent=-1)
172{ 172{
173 switch (t) { 173 switch (t) {
174 case 0: { 174 case 0: {
175 Config cfg("Sound"); 175 Config cfg("qpe");
176 cfg.setGroup("System"); 176 cfg.setGroup("Volume");
177 if ( percent < 0 ) 177 if ( percent < 0 )
178 percent = cfg.readNumEntry("Volume",50); 178 percent = cfg.readNumEntry("VolumePercent",50);
179 int fd = 0; 179 int fd = 0;
180 if ((fd = open("/dev/mixer", O_RDWR))>=0) { 180 if ((fd = open("/dev/mixer", O_RDWR))>=0) {
181 int vol = muted ? 0 : percent; 181 int vol = muted ? 0 : percent;
182 // set both channels to same volume 182 // set both channels to same volume
183 vol |= vol << 8; 183 vol |= vol << 8;
184 ioctl(fd, MIXER_WRITE(0), &vol); 184 ioctl(fd, MIXER_WRITE(0), &vol);
185 ::close(fd); 185 ::close(fd);
186 } 186 }
187 } break; 187 } break;
188 } 188 }
189} 189}
190 190
191static void setMic(int t=0, int percent=-1) 191static void setMic(int t=0, int percent=-1)
192{ 192{
193 switch (t) { 193 switch (t) {
194 case 0: { 194 case 0: {
195 Config cfg("Sound"); 195 Config cfg("qpe");
196 cfg.setGroup("System"); 196 cfg.setGroup("Volume");
197 if ( percent < 0 ) 197 if ( percent < 0 )
198 percent = cfg.readNumEntry("Mic",50); 198 percent = cfg.readNumEntry("Mic",50);
199 199
200 int fd = 0; 200 int fd = 0;
201 int mic = micMuted ? 0 : percent; 201 int mic = micMuted ? 0 : percent;
202 if ((fd = open("/dev/mixer", O_RDWR))>=0) { 202 if ((fd = open("/dev/mixer", O_RDWR))>=0) {
203 ioctl(fd, MIXER_WRITE(SOUND_MIXER_MIC), &mic); 203 ioctl(fd, MIXER_WRITE(SOUND_MIXER_MIC), &mic);
204 ::close(fd); 204 ::close(fd);
205 } 205 }
206 } break; 206 } break;
207 } 207 }
208} 208}
209 209
210int qpe_sysBrightnessSteps() 210int qpe_sysBrightnessSteps()
211{ 211{
212#if defined(QT_QWS_IPAQ) 212#if defined(QT_QWS_IPAQ)
213 return 255; 213 return 255;
214#elif defined(QT_QWS_EBX) 214#elif defined(QT_QWS_EBX)
215 return 4; 215 return 4;
216#else 216#else
217 return 255; // ? 217 return 255; // ?
218#endif 218#endif
219} 219}
220 220
221 221
222static int& hack(int& i) 222static int& hack(int& i)
223{ 223{
224#if QT_VERSION <= 230 && defined(QT_NO_CODECS) 224#if QT_VERSION <= 230 && defined(QT_NO_CODECS)
225 // These should be created, but aren't in Qt 2.3.0 225 // These should be created, but aren't in Qt 2.3.0
226 (void)new QUtf8Codec; 226 (void)new QUtf8Codec;
227 (void)new QUtf16Codec; 227 (void)new QUtf16Codec;
228#endif 228#endif
229 return i; 229 return i;
230} 230}
231 231
232static bool forced_off = FALSE; 232static bool forced_off = FALSE;
233static int curbl=-1; 233static int curbl=-1;
234 234
235static int backlight() 235static int backlight()
236{ 236{
237 if ( curbl == -1 ) { 237 if ( curbl == -1 ) {
238 // Read from config 238 // Read from config
239 Config config( "qpe" ); 239 Config config( "qpe" );
240 config.setGroup( "Screensaver" ); 240 config.setGroup( "Screensaver" );
241 curbl = config.readNumEntry("Brightness",255); 241 curbl = config.readNumEntry("Brightness",255);
242 } 242 }
243 return curbl; 243 return curbl;
244} 244}