-rw-r--r-- | core/apps/calibrate/main.cpp | 2 | ||||
-rw-r--r-- | core/apps/embeddedkonsole/TEWidget.cpp | 2 | ||||
-rw-r--r-- | core/launcher/desktop.cpp | 2 | ||||
-rw-r--r-- | core/launcher/main.cpp | 8 | ||||
-rw-r--r-- | core/launcher/taskbar.cpp | 4 | ||||
-rw-r--r-- | core/multimedia/opieplayer/loopcontrol_threaded.cpp | 2 | ||||
-rw-r--r-- | core/opie-login/main.cpp | 2 | ||||
-rw-r--r-- | library/power.cpp | 2 | ||||
-rw-r--r-- | library/qpeapplication.cpp | 2 | ||||
-rw-r--r-- | library/storage.cpp | 2 | ||||
-rw-r--r-- | mkspecs/qws/linux-sharp-g++/qmake.conf | 2 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/mediaplayer.cpp | 6 | ||||
-rw-r--r-- | noncore/settings/sound/soundsettings.cpp | 2 | ||||
-rw-r--r-- | noncore/tools/formatter/formatter.cpp | 4 | ||||
-rw-r--r-- | qt/qconfig-qpe.h | 2 | ||||
-rw-r--r-- | x11/libqpe-x11/qpe/qpeapplication.cpp | 2 |
16 files changed, 23 insertions, 23 deletions
diff --git a/core/apps/calibrate/main.cpp b/core/apps/calibrate/main.cpp index cb041c9..d1ad083 100644 --- a/core/apps/calibrate/main.cpp +++ b/core/apps/calibrate/main.cpp | |||
@@ -1,42 +1,42 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of Qtopia Environment. | 4 | ** This file is part of Qtopia Environment. |
5 | ** | 5 | ** |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | ** This file may be distributed and/or modified under the terms of the |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | ** GNU General Public License version 2 as published by the Free Software |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | ** Foundation and appearing in the file LICENSE.GPL included in the |
9 | ** packaging of this file. | 9 | ** packaging of this file. |
10 | ** | 10 | ** |
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
13 | ** | 13 | ** |
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
15 | ** | 15 | ** |
16 | ** Contact info@trolltech.com if any conditions of this licensing are | 16 | ** Contact info@trolltech.com if any conditions of this licensing are |
17 | ** not clear to you. | 17 | ** not clear to you. |
18 | ** | 18 | ** |
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | 20 | ||
21 | #include "calibrate.h" | 21 | #include "calibrate.h" |
22 | 22 | ||
23 | #include <qfile.h> | 23 | #include <qfile.h> |
24 | #include <qpe/qpeapplication.h> | 24 | #include <qpe/qpeapplication.h> |
25 | 25 | ||
26 | int main( int argc, char ** argv ) | 26 | int main( int argc, char ** argv ) |
27 | { | 27 | { |
28 | QPEApplication a( argc, argv ); | 28 | QPEApplication a( argc, argv ); |
29 | int retval = 0; | 29 | int retval = 0; |
30 | 30 | ||
31 | #if defined(QT_QWS_CASSIOPEIA) || defined(QT_QWS_IPAQ) || defined(QT_QWS_EBX) | 31 | #if defined(QT_QWS_CASSIOPEIA) || defined(QT_QWS_IPAQ) || defined(QT_QWS_SL5XXX) |
32 | if ( !QFile::exists( "/etc/pointercal" ) ) { | 32 | if ( !QFile::exists( "/etc/pointercal" ) ) { |
33 | // Make sure calibration widget starts on top. | 33 | // Make sure calibration widget starts on top. |
34 | Calibrate *cal = new Calibrate; | 34 | Calibrate *cal = new Calibrate; |
35 | a.setMainWidget(cal); | 35 | a.setMainWidget(cal); |
36 | a.showMainWidget(cal); | 36 | a.showMainWidget(cal); |
37 | retval = a.exec(); | 37 | retval = a.exec(); |
38 | delete cal; | 38 | delete cal; |
39 | } | 39 | } |
40 | #endif | 40 | #endif |
41 | return retval; | 41 | return retval; |
42 | } | 42 | } |
diff --git a/core/apps/embeddedkonsole/TEWidget.cpp b/core/apps/embeddedkonsole/TEWidget.cpp index 8214e7d..d0850e3 100644 --- a/core/apps/embeddedkonsole/TEWidget.cpp +++ b/core/apps/embeddedkonsole/TEWidget.cpp | |||
@@ -1017,193 +1017,193 @@ bool TEWidget::eventFilter( QObject *obj, QEvent *e ) | |||
1017 | 1017 | ||
1018 | #ifdef FAKE_CTRL_AND_ALT | 1018 | #ifdef FAKE_CTRL_AND_ALT |
1019 | static bool control = FALSE; | 1019 | static bool control = FALSE; |
1020 | static bool alt = FALSE; | 1020 | static bool alt = FALSE; |
1021 | // qDebug(" Has a keyboard with no CTRL and ALT keys, but we fake it:"); | 1021 | // qDebug(" Has a keyboard with no CTRL and ALT keys, but we fake it:"); |
1022 | bool dele=FALSE; | 1022 | bool dele=FALSE; |
1023 | if ( e->type() == QEvent::KeyPress || e->type() == QEvent::KeyRelease ) { | 1023 | if ( e->type() == QEvent::KeyPress || e->type() == QEvent::KeyRelease ) { |
1024 | QKeyEvent* ke = (QKeyEvent*)e; | 1024 | QKeyEvent* ke = (QKeyEvent*)e; |
1025 | bool keydown = e->type() == QEvent::KeyPress || ke->isAutoRepeat(); | 1025 | bool keydown = e->type() == QEvent::KeyPress || ke->isAutoRepeat(); |
1026 | switch (ke->key()) { | 1026 | switch (ke->key()) { |
1027 | case Key_F9: // let this be "Control" | 1027 | case Key_F9: // let this be "Control" |
1028 | control = keydown; | 1028 | control = keydown; |
1029 | e = new QKeyEvent(QEvent::KeyPress, Key_Control, 0, ke->state()); | 1029 | e = new QKeyEvent(QEvent::KeyPress, Key_Control, 0, ke->state()); |
1030 | dele=TRUE; | 1030 | dele=TRUE; |
1031 | break; | 1031 | break; |
1032 | case Key_F13: // let this be "Alt" | 1032 | case Key_F13: // let this be "Alt" |
1033 | alt = keydown; | 1033 | alt = keydown; |
1034 | e = new QKeyEvent(QEvent::KeyPress, Key_Alt, 0, ke->state()); | 1034 | e = new QKeyEvent(QEvent::KeyPress, Key_Alt, 0, ke->state()); |
1035 | dele=TRUE; | 1035 | dele=TRUE; |
1036 | break; | 1036 | break; |
1037 | default: | 1037 | default: |
1038 | if ( control ) { | 1038 | if ( control ) { |
1039 | int a = toupper(ke->ascii())-64; | 1039 | int a = toupper(ke->ascii())-64; |
1040 | if ( a >= 0 && a < ' ' ) { | 1040 | if ( a >= 0 && a < ' ' ) { |
1041 | e = new QKeyEvent(e->type(), ke->key(), | 1041 | e = new QKeyEvent(e->type(), ke->key(), |
1042 | a, ke->state()|ControlButton, QChar(a,0)); | 1042 | a, ke->state()|ControlButton, QChar(a,0)); |
1043 | dele=TRUE; | 1043 | dele=TRUE; |
1044 | } | 1044 | } |
1045 | } | 1045 | } |
1046 | if ( alt ) { | 1046 | if ( alt ) { |
1047 | e = new QKeyEvent(e->type(), ke->key(), | 1047 | e = new QKeyEvent(e->type(), ke->key(), |
1048 | ke->ascii(), ke->state()|AltButton, ke->text()); | 1048 | ke->ascii(), ke->state()|AltButton, ke->text()); |
1049 | dele=TRUE; | 1049 | dele=TRUE; |
1050 | } | 1050 | } |
1051 | } | 1051 | } |
1052 | } | 1052 | } |
1053 | #endif | 1053 | #endif |
1054 | 1054 | ||
1055 | if ( e->type() == QEvent::KeyPress ) { | 1055 | if ( e->type() == QEvent::KeyPress ) { |
1056 | QKeyEvent* ke = (QKeyEvent*)e; | 1056 | QKeyEvent* ke = (QKeyEvent*)e; |
1057 | actSel=0; // Key stroke implies a screen update, so TEWidget won't | 1057 | actSel=0; // Key stroke implies a screen update, so TEWidget won't |
1058 | // know where the current selection is. | 1058 | // know where the current selection is. |
1059 | 1059 | ||
1060 | // qDebug("key pressed is 0x%x, ascii is 0x%x, state %d", ke->key(), ke->ascii(), ke->state()); | 1060 | // qDebug("key pressed is 0x%x, ascii is 0x%x, state %d", ke->key(), ke->ascii(), ke->state()); |
1061 | 1061 | ||
1062 | if( ke->state() == ShiftButton && ke->key() == Key_Tab) { | 1062 | if( ke->state() == ShiftButton && ke->key() == Key_Tab) { |
1063 | //lets hardcode this sucker | 1063 | //lets hardcode this sucker |
1064 | 1064 | ||
1065 | // qDebug("key pressed 2 is 0x%x", ke->key()); | 1065 | // qDebug("key pressed 2 is 0x%x", ke->key()); |
1066 | emitText("\\"); // expose | 1066 | emitText("\\"); // expose |
1067 | } | 1067 | } |
1068 | else if( ke->state() == ControlButton && ke->key() == Key_V) { | 1068 | else if( ke->state() == ControlButton && ke->key() == Key_V) { |
1069 | pasteClipboard(); | 1069 | pasteClipboard(); |
1070 | } | 1070 | } |
1071 | // else if( ke->state() == ControlButton && ke->key() == Key_C) { | 1071 | // else if( ke->state() == ControlButton && ke->key() == Key_C) { |
1072 | // pasteClipboard(); | 1072 | // pasteClipboard(); |
1073 | // } | 1073 | // } |
1074 | else | 1074 | else |
1075 | emit keyPressedSignal(ke); // expose | 1075 | emit keyPressedSignal(ke); // expose |
1076 | ke->accept(); | 1076 | ke->accept(); |
1077 | #ifdef FAKE_CTRL_AND_ALT | 1077 | #ifdef FAKE_CTRL_AND_ALT |
1078 | if ( dele ) delete e; | 1078 | if ( dele ) delete e; |
1079 | #endif | 1079 | #endif |
1080 | return true; // stop the event | 1080 | return true; // stop the event |
1081 | } | 1081 | } |
1082 | if ( e->type() == QEvent::Enter ) { | 1082 | if ( e->type() == QEvent::Enter ) { |
1083 | QObject::disconnect( (QObject*)cb, SIGNAL(dataChanged()), | 1083 | QObject::disconnect( (QObject*)cb, SIGNAL(dataChanged()), |
1084 | this, SLOT(onClearSelection()) ); | 1084 | this, SLOT(onClearSelection()) ); |
1085 | } | 1085 | } |
1086 | if ( e->type() == QEvent::Leave ) { | 1086 | if ( e->type() == QEvent::Leave ) { |
1087 | QObject::connect( (QObject*)cb, SIGNAL(dataChanged()), | 1087 | QObject::connect( (QObject*)cb, SIGNAL(dataChanged()), |
1088 | this, SLOT(onClearSelection()) ); | 1088 | this, SLOT(onClearSelection()) ); |
1089 | } | 1089 | } |
1090 | return QFrame::eventFilter( obj, e ); | 1090 | return QFrame::eventFilter( obj, e ); |
1091 | } | 1091 | } |
1092 | 1092 | ||
1093 | /* ------------------------------------------------------------------------- */ | 1093 | /* ------------------------------------------------------------------------- */ |
1094 | /* */ | 1094 | /* */ |
1095 | /* Frame */ | 1095 | /* Frame */ |
1096 | /* */ | 1096 | /* */ |
1097 | /* ------------------------------------------------------------------------- */ | 1097 | /* ------------------------------------------------------------------------- */ |
1098 | 1098 | ||
1099 | void TEWidget::frameChanged() | 1099 | void TEWidget::frameChanged() |
1100 | { | 1100 | { |
1101 | propagateSize(); | 1101 | propagateSize(); |
1102 | update(); | 1102 | update(); |
1103 | } | 1103 | } |
1104 | 1104 | ||
1105 | /* ------------------------------------------------------------------------- */ | 1105 | /* ------------------------------------------------------------------------- */ |
1106 | /* */ | 1106 | /* */ |
1107 | /* Sound */ | 1107 | /* Sound */ |
1108 | /* */ | 1108 | /* */ |
1109 | /* ------------------------------------------------------------------------- */ | 1109 | /* ------------------------------------------------------------------------- */ |
1110 | 1110 | ||
1111 | void TEWidget::Bell() | 1111 | void TEWidget::Bell() |
1112 | { | 1112 | { |
1113 | //#ifdef QT_QWS_SHARP | 1113 | //#ifdef QT_QWS_SL5XXX |
1114 | //# ifndef QT_NO_COP | 1114 | //# ifndef QT_NO_COP |
1115 | if(useBeep) | 1115 | if(useBeep) |
1116 | QCopEnvelope( "QPE/TaskBar", "soundAlarm()" ); | 1116 | QCopEnvelope( "QPE/TaskBar", "soundAlarm()" ); |
1117 | 1117 | ||
1118 | //# endif | 1118 | //# endif |
1119 | //#else | 1119 | //#else |
1120 | //# ifndef QT_NO_SOUND | 1120 | //# ifndef QT_NO_SOUND |
1121 | // QSound::play(Resource::findSound("alarm")); | 1121 | // QSound::play(Resource::findSound("alarm")); |
1122 | //# endif | 1122 | //# endif |
1123 | //#endif | 1123 | //#endif |
1124 | 1124 | ||
1125 | // QApplication::beep(); | 1125 | // QApplication::beep(); |
1126 | } | 1126 | } |
1127 | 1127 | ||
1128 | /* ------------------------------------------------------------------------- */ | 1128 | /* ------------------------------------------------------------------------- */ |
1129 | /* */ | 1129 | /* */ |
1130 | /* Auxiluary */ | 1130 | /* Auxiluary */ |
1131 | /* */ | 1131 | /* */ |
1132 | /* ------------------------------------------------------------------------- */ | 1132 | /* ------------------------------------------------------------------------- */ |
1133 | 1133 | ||
1134 | void TEWidget::clearImage() | 1134 | void TEWidget::clearImage() |
1135 | // initialize the image | 1135 | // initialize the image |
1136 | // for internal use only | 1136 | // for internal use only |
1137 | { | 1137 | { |
1138 | for (int y = 0; y < lines; y++) | 1138 | for (int y = 0; y < lines; y++) |
1139 | for (int x = 0; x < columns; x++) | 1139 | for (int x = 0; x < columns; x++) |
1140 | { | 1140 | { |
1141 | image[loc(x,y)].c = 0xff; //' '; | 1141 | image[loc(x,y)].c = 0xff; //' '; |
1142 | image[loc(x,y)].f = 0xff; //DEFAULT_FORE_COLOR; | 1142 | image[loc(x,y)].f = 0xff; //DEFAULT_FORE_COLOR; |
1143 | image[loc(x,y)].b = 0xff; //DEFAULT_BACK_COLOR; | 1143 | image[loc(x,y)].b = 0xff; //DEFAULT_BACK_COLOR; |
1144 | image[loc(x,y)].r = 0xff; //DEFAULT_RENDITION; | 1144 | image[loc(x,y)].r = 0xff; //DEFAULT_RENDITION; |
1145 | } | 1145 | } |
1146 | } | 1146 | } |
1147 | 1147 | ||
1148 | // Create Image /////////////////////////////////////////////////////// | 1148 | // Create Image /////////////////////////////////////////////////////// |
1149 | 1149 | ||
1150 | void TEWidget::calcGeometry() | 1150 | void TEWidget::calcGeometry() |
1151 | { | 1151 | { |
1152 | int showhscrollbar = 1; | 1152 | int showhscrollbar = 1; |
1153 | int hwidth = 0; | 1153 | int hwidth = 0; |
1154 | int dcolumns; | 1154 | int dcolumns; |
1155 | Config cfg("Konsole"); | 1155 | Config cfg("Konsole"); |
1156 | cfg.setGroup("ScrollBar"); | 1156 | cfg.setGroup("ScrollBar"); |
1157 | useHorzScroll=cfg.readBoolEntry("HorzScroll",0); | 1157 | useHorzScroll=cfg.readBoolEntry("HorzScroll",0); |
1158 | 1158 | ||
1159 | if(vcolumns == 0) showhscrollbar = 0; | 1159 | if(vcolumns == 0) showhscrollbar = 0; |
1160 | if(showhscrollbar == 1) hwidth = QApplication::style().scrollBarExtent().width(); | 1160 | if(showhscrollbar == 1) hwidth = QApplication::style().scrollBarExtent().width(); |
1161 | 1161 | ||
1162 | scrollbar->resize(QApplication::style().scrollBarExtent().width(), | 1162 | scrollbar->resize(QApplication::style().scrollBarExtent().width(), |
1163 | contentsRect().height() - hwidth); | 1163 | contentsRect().height() - hwidth); |
1164 | 1164 | ||
1165 | switch(scrollLoc) { | 1165 | switch(scrollLoc) { |
1166 | case SCRNONE : | 1166 | case SCRNONE : |
1167 | columns = ( contentsRect().width() - 2 * rimX ) / font_w; | 1167 | columns = ( contentsRect().width() - 2 * rimX ) / font_w; |
1168 | dcolumns = columns; | 1168 | dcolumns = columns; |
1169 | if(vcolumns) columns = vcolumns; | 1169 | if(vcolumns) columns = vcolumns; |
1170 | blX = (contentsRect().width() - (columns*font_w) ) / 2; | 1170 | blX = (contentsRect().width() - (columns*font_w) ) / 2; |
1171 | if(showhscrollbar) | 1171 | if(showhscrollbar) |
1172 | blX = -hposition * font_w; | 1172 | blX = -hposition * font_w; |
1173 | brX = blX; | 1173 | brX = blX; |
1174 | scrollbar->hide(); | 1174 | scrollbar->hide(); |
1175 | break; | 1175 | break; |
1176 | case SCRLEFT : | 1176 | case SCRLEFT : |
1177 | columns = ( contentsRect().width() - 2 * rimX - scrollbar->width()) / font_w; | 1177 | columns = ( contentsRect().width() - 2 * rimX - scrollbar->width()) / font_w; |
1178 | dcolumns = columns; | 1178 | dcolumns = columns; |
1179 | if(vcolumns) columns = vcolumns; | 1179 | if(vcolumns) columns = vcolumns; |
1180 | brX = (contentsRect().width() - (columns*font_w) - scrollbar->width() ) / 2; | 1180 | brX = (contentsRect().width() - (columns*font_w) - scrollbar->width() ) / 2; |
1181 | if(showhscrollbar) | 1181 | if(showhscrollbar) |
1182 | brX = -hposition * font_w; | 1182 | brX = -hposition * font_w; |
1183 | blX = brX + scrollbar->width(); | 1183 | blX = brX + scrollbar->width(); |
1184 | scrollbar->move(contentsRect().topLeft()); | 1184 | scrollbar->move(contentsRect().topLeft()); |
1185 | scrollbar->show(); | 1185 | scrollbar->show(); |
1186 | break; | 1186 | break; |
1187 | case SCRRIGHT: | 1187 | case SCRRIGHT: |
1188 | columns = ( contentsRect().width() - 2 * rimX - scrollbar->width()) / font_w; | 1188 | columns = ( contentsRect().width() - 2 * rimX - scrollbar->width()) / font_w; |
1189 | dcolumns = columns; | 1189 | dcolumns = columns; |
1190 | if(vcolumns) columns = vcolumns; | 1190 | if(vcolumns) columns = vcolumns; |
1191 | blX = (contentsRect().width() - (columns*font_w) - scrollbar->width() ) / 2; | 1191 | blX = (contentsRect().width() - (columns*font_w) - scrollbar->width() ) / 2; |
1192 | if(showhscrollbar) | 1192 | if(showhscrollbar) |
1193 | blX = -hposition * font_w; | 1193 | blX = -hposition * font_w; |
1194 | brX = blX; | 1194 | brX = blX; |
1195 | scrollbar->move(contentsRect().topRight() - QPoint(scrollbar->width()-1,0)); | 1195 | scrollbar->move(contentsRect().topRight() - QPoint(scrollbar->width()-1,0)); |
1196 | scrollbar->show(); | 1196 | scrollbar->show(); |
1197 | break; | 1197 | break; |
1198 | } | 1198 | } |
1199 | //FIXME: support 'rounding' styles | 1199 | //FIXME: support 'rounding' styles |
1200 | lines = ( contentsRect().height() - 2 * rimY ) / font_h; | 1200 | lines = ( contentsRect().height() - 2 * rimY ) / font_h; |
1201 | bY = (contentsRect().height() - (lines *font_h)) / 2; | 1201 | bY = (contentsRect().height() - (lines *font_h)) / 2; |
1202 | 1202 | ||
1203 | if(showhscrollbar == 1) { | 1203 | if(showhscrollbar == 1) { |
1204 | hScrollbar->resize(contentsRect().width() - hwidth, hwidth); | 1204 | hScrollbar->resize(contentsRect().width() - hwidth, hwidth); |
1205 | hScrollbar->setRange(0, vcolumns - dcolumns); | 1205 | hScrollbar->setRange(0, vcolumns - dcolumns); |
1206 | 1206 | ||
1207 | QPoint p = contentsRect().bottomLeft(); | 1207 | QPoint p = contentsRect().bottomLeft(); |
1208 | if(scrollLoc == SCRLEFT) | 1208 | if(scrollLoc == SCRLEFT) |
1209 | hScrollbar->move(QPoint(p.x()+hwidth, p.y() - hwidth)); | 1209 | hScrollbar->move(QPoint(p.x()+hwidth, p.y() - hwidth)); |
diff --git a/core/launcher/desktop.cpp b/core/launcher/desktop.cpp index ba4fd66..59f2aea 100644 --- a/core/launcher/desktop.cpp +++ b/core/launcher/desktop.cpp | |||
@@ -1,141 +1,141 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of Qtopia Environment. | 4 | ** This file is part of Qtopia Environment. |
5 | ** | 5 | ** |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | ** This file may be distributed and/or modified under the terms of the |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | ** GNU General Public License version 2 as published by the Free Software |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | ** Foundation and appearing in the file LICENSE.GPL included in the |
9 | ** packaging of this file. | 9 | ** packaging of this file. |
10 | ** | 10 | ** |
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
13 | ** | 13 | ** |
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
15 | ** | 15 | ** |
16 | ** Contact info@trolltech.com if any conditions of this licensing are | 16 | ** Contact info@trolltech.com if any conditions of this licensing are |
17 | ** not clear to you. | 17 | ** not clear to you. |
18 | ** | 18 | ** |
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | 20 | ||
21 | #include <syslog.h> | 21 | #include <syslog.h> |
22 | 22 | ||
23 | #include "desktop.h" | 23 | #include "desktop.h" |
24 | #include "info.h" | 24 | #include "info.h" |
25 | #include "launcher.h" | 25 | #include "launcher.h" |
26 | #include "qcopbridge.h" | 26 | #include "qcopbridge.h" |
27 | #include "shutdownimpl.h" | 27 | #include "shutdownimpl.h" |
28 | #include "startmenu.h" | 28 | #include "startmenu.h" |
29 | #include "taskbar.h" | 29 | #include "taskbar.h" |
30 | #include "transferserver.h" | 30 | #include "transferserver.h" |
31 | #include "irserver.h" | 31 | #include "irserver.h" |
32 | #include "packageslave.h" | 32 | #include "packageslave.h" |
33 | #include "screensaver.h" | 33 | #include "screensaver.h" |
34 | 34 | ||
35 | #include <qpe/applnk.h> | 35 | #include <qpe/applnk.h> |
36 | #include <qpe/mimetype.h> | 36 | #include <qpe/mimetype.h> |
37 | #include <qpe/password.h> | 37 | #include <qpe/password.h> |
38 | #include <qpe/config.h> | 38 | #include <qpe/config.h> |
39 | #include <qpe/power.h> | 39 | #include <qpe/power.h> |
40 | #include <qpe/timeconversion.h> | 40 | #include <qpe/timeconversion.h> |
41 | #include <qpe/qcopenvelope_qws.h> | 41 | #include <qpe/qcopenvelope_qws.h> |
42 | #include <qpe/network.h> | 42 | #include <qpe/network.h> |
43 | #include <qpe/global.h> | 43 | #include <qpe/global.h> |
44 | 44 | ||
45 | #if defined( QT_QWS_SHARP ) || defined( QT_QWS_IPAQ ) | 45 | #if defined( QT_QWS_SL5XXX ) || defined( QT_QWS_IPAQ ) |
46 | #include <qpe/custom.h> | 46 | #include <qpe/custom.h> |
47 | #endif | 47 | #endif |
48 | 48 | ||
49 | #include <opie/odevice.h> | 49 | #include <opie/odevice.h> |
50 | 50 | ||
51 | #include <qgfx_qws.h> | 51 | #include <qgfx_qws.h> |
52 | #include <qmainwindow.h> | 52 | #include <qmainwindow.h> |
53 | #include <qmessagebox.h> | 53 | #include <qmessagebox.h> |
54 | #include <qtimer.h> | 54 | #include <qtimer.h> |
55 | #include <qwindowsystem_qws.h> | 55 | #include <qwindowsystem_qws.h> |
56 | 56 | ||
57 | #include <qvaluelist.h> | 57 | #include <qvaluelist.h> |
58 | 58 | ||
59 | #include <stdlib.h> | 59 | #include <stdlib.h> |
60 | #include <unistd.h> | 60 | #include <unistd.h> |
61 | #include <fcntl.h> | 61 | #include <fcntl.h> |
62 | 62 | ||
63 | 63 | ||
64 | using namespace Opie; | 64 | using namespace Opie; |
65 | 65 | ||
66 | class QCopKeyRegister | 66 | class QCopKeyRegister |
67 | { | 67 | { |
68 | public: | 68 | public: |
69 | QCopKeyRegister() : keyCode( 0 ) | 69 | QCopKeyRegister() : keyCode( 0 ) |
70 | { } | 70 | { } |
71 | QCopKeyRegister( int k, const QCString &c, const QCString &m ) | 71 | QCopKeyRegister( int k, const QCString &c, const QCString &m ) |
72 | : keyCode( k ), channel( c ), message( m ) | 72 | : keyCode( k ), channel( c ), message( m ) |
73 | { } | 73 | { } |
74 | 74 | ||
75 | int getKeyCode() const | 75 | int getKeyCode() const |
76 | { | 76 | { |
77 | return keyCode; | 77 | return keyCode; |
78 | } | 78 | } |
79 | QCString getChannel() const | 79 | QCString getChannel() const |
80 | { | 80 | { |
81 | return channel; | 81 | return channel; |
82 | } | 82 | } |
83 | QCString getMessage() const | 83 | QCString getMessage() const |
84 | { | 84 | { |
85 | return message; | 85 | return message; |
86 | } | 86 | } |
87 | 87 | ||
88 | private: | 88 | private: |
89 | int keyCode; | 89 | int keyCode; |
90 | QCString channel, message; | 90 | QCString channel, message; |
91 | }; | 91 | }; |
92 | 92 | ||
93 | typedef QValueList<QCopKeyRegister> KeyRegisterList; | 93 | typedef QValueList<QCopKeyRegister> KeyRegisterList; |
94 | KeyRegisterList keyRegisterList; | 94 | KeyRegisterList keyRegisterList; |
95 | 95 | ||
96 | static Desktop* qpedesktop = 0; | 96 | static Desktop* qpedesktop = 0; |
97 | static int loggedin = 0; | 97 | static int loggedin = 0; |
98 | static void login( bool at_poweron ) | 98 | static void login( bool at_poweron ) |
99 | { | 99 | { |
100 | if ( !loggedin ) { | 100 | if ( !loggedin ) { |
101 | Global::terminateBuiltin( "calibrate" ); | 101 | Global::terminateBuiltin( "calibrate" ); |
102 | Password::authenticate( at_poweron ); | 102 | Password::authenticate( at_poweron ); |
103 | loggedin = 1; | 103 | loggedin = 1; |
104 | QCopEnvelope e( "QPE/Desktop", "unlocked()" ); | 104 | QCopEnvelope e( "QPE/Desktop", "unlocked()" ); |
105 | } | 105 | } |
106 | } | 106 | } |
107 | 107 | ||
108 | bool Desktop::screenLocked() | 108 | bool Desktop::screenLocked() |
109 | { | 109 | { |
110 | return loggedin == 0; | 110 | return loggedin == 0; |
111 | } | 111 | } |
112 | 112 | ||
113 | /* | 113 | /* |
114 | Priority is number of alerts that are needed to pop up | 114 | Priority is number of alerts that are needed to pop up |
115 | alert. | 115 | alert. |
116 | */ | 116 | */ |
117 | class DesktopPowerAlerter : public QMessageBox | 117 | class DesktopPowerAlerter : public QMessageBox |
118 | { | 118 | { |
119 | public: | 119 | public: |
120 | DesktopPowerAlerter( QWidget *parent, const char *name = 0 ) | 120 | DesktopPowerAlerter( QWidget *parent, const char *name = 0 ) |
121 | : QMessageBox( tr( "Battery Status" ), "Low Battery", | 121 | : QMessageBox( tr( "Battery Status" ), "Low Battery", |
122 | QMessageBox::Critical, | 122 | QMessageBox::Critical, |
123 | QMessageBox::Ok | QMessageBox::Default, | 123 | QMessageBox::Ok | QMessageBox::Default, |
124 | QMessageBox::NoButton, QMessageBox::NoButton, | 124 | QMessageBox::NoButton, QMessageBox::NoButton, |
125 | parent, name, FALSE ) | 125 | parent, name, FALSE ) |
126 | { | 126 | { |
127 | currentPriority = INT_MAX; | 127 | currentPriority = INT_MAX; |
128 | alertCount = 0; | 128 | alertCount = 0; |
129 | } | 129 | } |
130 | 130 | ||
131 | void alert( const QString &text, int priority ); | 131 | void alert( const QString &text, int priority ); |
132 | void hideEvent( QHideEvent * ); | 132 | void hideEvent( QHideEvent * ); |
133 | private: | 133 | private: |
134 | int currentPriority; | 134 | int currentPriority; |
135 | int alertCount; | 135 | int alertCount; |
136 | }; | 136 | }; |
137 | 137 | ||
138 | void DesktopPowerAlerter::alert( const QString &text, int priority ) | 138 | void DesktopPowerAlerter::alert( const QString &text, int priority ) |
139 | { | 139 | { |
140 | alertCount++; | 140 | alertCount++; |
141 | if ( alertCount < priority ) | 141 | if ( alertCount < priority ) |
diff --git a/core/launcher/main.cpp b/core/launcher/main.cpp index 49b41d6..8eaea17 100644 --- a/core/launcher/main.cpp +++ b/core/launcher/main.cpp | |||
@@ -1,177 +1,177 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of Qtopia Environment. | 4 | ** This file is part of Qtopia Environment. |
5 | ** | 5 | ** |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | ** This file may be distributed and/or modified under the terms of the |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | ** GNU General Public License version 2 as published by the Free Software |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | ** Foundation and appearing in the file LICENSE.GPL included in the |
9 | ** packaging of this file. | 9 | ** packaging of this file. |
10 | ** | 10 | ** |
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
13 | ** | 13 | ** |
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
15 | ** | 15 | ** |
16 | ** Contact info@trolltech.com if any conditions of this licensing are | 16 | ** Contact info@trolltech.com if any conditions of this licensing are |
17 | ** not clear to you. | 17 | ** not clear to you. |
18 | ** | 18 | ** |
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | 20 | ||
21 | #include "desktop.h" | 21 | #include "desktop.h" |
22 | #include "taskbar.h" | 22 | #include "taskbar.h" |
23 | #include "stabmon.h" | 23 | #include "stabmon.h" |
24 | 24 | ||
25 | #include <qpe/qpeapplication.h> | 25 | #include <qpe/qpeapplication.h> |
26 | #include <qpe/network.h> | 26 | #include <qpe/network.h> |
27 | #include <qpe/config.h> | 27 | #include <qpe/config.h> |
28 | #if defined( QT_QWS_SHARP ) || defined( QT_QWS_IPAQ ) | 28 | #if defined( QT_QWS_SL5XXX ) || defined( QT_QWS_IPAQ ) |
29 | #include <qpe/custom.h> | 29 | #include <qpe/custom.h> |
30 | #endif | 30 | #endif |
31 | 31 | ||
32 | #include <opie/odevice.h> | 32 | #include <opie/odevice.h> |
33 | 33 | ||
34 | #include <qmessagebox.h> | 34 | #include <qmessagebox.h> |
35 | #include <qfile.h> | 35 | #include <qfile.h> |
36 | #include <qimage.h> | 36 | #include <qimage.h> |
37 | #include <qwindowsystem_qws.h> | 37 | #include <qwindowsystem_qws.h> |
38 | #include <qpe/qcopenvelope_qws.h> | 38 | #include <qpe/qcopenvelope_qws.h> |
39 | #include <qpe/alarmserver.h> | 39 | #include <qpe/alarmserver.h> |
40 | 40 | ||
41 | #include <stdlib.h> | 41 | #include <stdlib.h> |
42 | #include <stdio.h> | 42 | #include <stdio.h> |
43 | #include <signal.h> | 43 | #include <signal.h> |
44 | #include <unistd.h> | 44 | #include <unistd.h> |
45 | 45 | ||
46 | #if defined(QT_QWS_IPAQ) || defined(QT_QWS_EBX) | 46 | #if defined(QT_QWS_IPAQ) || defined(QT_QWS_SL5XXX) |
47 | #include "../calibrate/calibrate.h" | 47 | #include "../calibrate/calibrate.h" |
48 | #endif | 48 | #endif |
49 | 49 | ||
50 | using namespace Opie; | 50 | using namespace Opie; |
51 | 51 | ||
52 | void initEnvironment() | 52 | void initEnvironment() |
53 | { | 53 | { |
54 | Config config("locale"); | 54 | Config config("locale"); |
55 | config.setGroup( "Location" ); | 55 | config.setGroup( "Location" ); |
56 | QString tz = config.readEntry( "Timezone", getenv("TZ") ); | 56 | QString tz = config.readEntry( "Timezone", getenv("TZ") ); |
57 | 57 | ||
58 | // if not timezone set, pick New York | 58 | // if not timezone set, pick New York |
59 | if (tz.isNull()) | 59 | if (tz.isNull()) |
60 | tz = "America/New_York"; | 60 | tz = "America/New_York"; |
61 | 61 | ||
62 | setenv( "TZ", tz, 1 ); | 62 | setenv( "TZ", tz, 1 ); |
63 | config.writeEntry( "Timezone", tz); | 63 | config.writeEntry( "Timezone", tz); |
64 | 64 | ||
65 | config.setGroup( "Language" ); | 65 | config.setGroup( "Language" ); |
66 | QString lang = config.readEntry( "Language", getenv("LANG") ); | 66 | QString lang = config.readEntry( "Language", getenv("LANG") ); |
67 | if ( !lang.isNull() ) | 67 | if ( !lang.isNull() ) |
68 | setenv( "LANG", lang, 1 ); | 68 | setenv( "LANG", lang, 1 ); |
69 | } | 69 | } |
70 | 70 | ||
71 | 71 | ||
72 | int initApplication( int argc, char ** argv ) | 72 | int initApplication( int argc, char ** argv ) |
73 | { | 73 | { |
74 | initEnvironment(); | 74 | initEnvironment(); |
75 | 75 | ||
76 | #if !defined(QT_QWS_CASSIOPEIA) && !defined(QT_QWS_IPAQ) && !defined(QT_QWS_EBX) | 76 | #if !defined(QT_QWS_CASSIOPEIA) && !defined(QT_QWS_IPAQ) && !defined(QT_QWS_SL5XXX) |
77 | setenv( "QWS_SIZE", "240x320", 0 ); | 77 | setenv( "QWS_SIZE", "240x320", 0 ); |
78 | #endif | 78 | #endif |
79 | 79 | ||
80 | //Don't flicker at startup: | 80 | //Don't flicker at startup: |
81 | QWSServer::setDesktopBackground( QImage() ); | 81 | QWSServer::setDesktopBackground( QImage() ); |
82 | DesktopApplication a( argc, argv, QApplication::GuiServer ); | 82 | DesktopApplication a( argc, argv, QApplication::GuiServer ); |
83 | 83 | ||
84 | ODevice::inst ( )-> setSoftSuspend ( true ); | 84 | ODevice::inst ( )-> setSoftSuspend ( true ); |
85 | 85 | ||
86 | { // init backlight | 86 | { // init backlight |
87 | QCopEnvelope e("QPE/System", "setBacklight(int)" ); | 87 | QCopEnvelope e("QPE/System", "setBacklight(int)" ); |
88 | e << -3; // Forced on | 88 | e << -3; // Forced on |
89 | } | 89 | } |
90 | 90 | ||
91 | AlarmServer::initialize(); | 91 | AlarmServer::initialize(); |
92 | 92 | ||
93 | Desktop *d = new Desktop(); | 93 | Desktop *d = new Desktop(); |
94 | 94 | ||
95 | QObject::connect( &a, SIGNAL(power()), d, SLOT(togglePower()) ); | 95 | QObject::connect( &a, SIGNAL(power()), d, SLOT(togglePower()) ); |
96 | QObject::connect( &a, SIGNAL(backlight()), d, SLOT(toggleLight()) ); | 96 | QObject::connect( &a, SIGNAL(backlight()), d, SLOT(toggleLight()) ); |
97 | QObject::connect( &a, SIGNAL(symbol()), d, SLOT(toggleSymbolInput()) ); | 97 | QObject::connect( &a, SIGNAL(symbol()), d, SLOT(toggleSymbolInput()) ); |
98 | QObject::connect( &a, SIGNAL(numLockStateToggle()), d, SLOT(toggleNumLockState()) ); | 98 | QObject::connect( &a, SIGNAL(numLockStateToggle()), d, SLOT(toggleNumLockState()) ); |
99 | QObject::connect( &a, SIGNAL(capsLockStateToggle()), d, SLOT(toggleCapsLockState()) ); | 99 | QObject::connect( &a, SIGNAL(capsLockStateToggle()), d, SLOT(toggleCapsLockState()) ); |
100 | QObject::connect( &a, SIGNAL(prepareForRestart()), d, SLOT(terminateServers()) ); | 100 | QObject::connect( &a, SIGNAL(prepareForRestart()), d, SLOT(terminateServers()) ); |
101 | 101 | ||
102 | (void)new SysFileMonitor(d); | 102 | (void)new SysFileMonitor(d); |
103 | Network::createServer(d); | 103 | Network::createServer(d); |
104 | 104 | ||
105 | #if defined(QT_QWS_CASSIOPEIA) || defined(QT_QWS_IPAQ) || defined(QT_QWS_EBX) | 105 | #if defined(QT_QWS_CASSIOPEIA) || defined(QT_QWS_IPAQ) || defined(QT_QWS_SL5XXX) |
106 | if ( !QFile::exists( "/etc/pointercal" ) ) { | 106 | if ( !QFile::exists( "/etc/pointercal" ) ) { |
107 | // Make sure calibration widget starts on top. | 107 | // Make sure calibration widget starts on top. |
108 | Calibrate *cal = new Calibrate; | 108 | Calibrate *cal = new Calibrate; |
109 | cal->exec(); | 109 | cal->exec(); |
110 | delete cal; | 110 | delete cal; |
111 | } | 111 | } |
112 | #endif | 112 | #endif |
113 | 113 | ||
114 | d->show(); | 114 | d->show(); |
115 | 115 | ||
116 | if ( QDate::currentDate ( ). year ( ) < 2000 ) { | 116 | if ( QDate::currentDate ( ). year ( ) < 2000 ) { |
117 | if ( QMessageBox::information ( 0, DesktopApplication::tr( "Information" ), DesktopApplication::tr( "<p>The system date doesn't seem to be valid.\n(%1)</p><p>Do you want to correct the clock ?</p>" ). arg( TimeString::dateString ( QDate::currentDate ( ))), QMessageBox::Yes, QMessageBox::No ) == QMessageBox::Yes ) { | 117 | if ( QMessageBox::information ( 0, DesktopApplication::tr( "Information" ), DesktopApplication::tr( "<p>The system date doesn't seem to be valid.\n(%1)</p><p>Do you want to correct the clock ?</p>" ). arg( TimeString::dateString ( QDate::currentDate ( ))), QMessageBox::Yes, QMessageBox::No ) == QMessageBox::Yes ) { |
118 | QCopEnvelope e ( "QPE/Application/systemtime", "setDocument(QString)" ); | 118 | QCopEnvelope e ( "QPE/Application/systemtime", "setDocument(QString)" ); |
119 | e << QString ( ); | 119 | e << QString ( ); |
120 | } | 120 | } |
121 | } | 121 | } |
122 | 122 | ||
123 | int rv = a.exec(); | 123 | int rv = a.exec(); |
124 | 124 | ||
125 | delete d; | 125 | delete d; |
126 | 126 | ||
127 | ODevice::inst ( )-> setSoftSuspend ( false ); | 127 | ODevice::inst ( )-> setSoftSuspend ( false ); |
128 | 128 | ||
129 | return rv; | 129 | return rv; |
130 | } | 130 | } |
131 | 131 | ||
132 | static const char *pidfile_path = "/var/run/opie.pid"; | 132 | static const char *pidfile_path = "/var/run/opie.pid"; |
133 | 133 | ||
134 | void create_pidfile ( ) | 134 | void create_pidfile ( ) |
135 | { | 135 | { |
136 | FILE *f; | 136 | FILE *f; |
137 | 137 | ||
138 | if (( f = ::fopen ( pidfile_path, "w" ))) { | 138 | if (( f = ::fopen ( pidfile_path, "w" ))) { |
139 | ::fprintf ( f, "%d", getpid ( )); | 139 | ::fprintf ( f, "%d", getpid ( )); |
140 | ::fclose ( f ); | 140 | ::fclose ( f ); |
141 | } | 141 | } |
142 | } | 142 | } |
143 | 143 | ||
144 | void remove_pidfile ( ) | 144 | void remove_pidfile ( ) |
145 | { | 145 | { |
146 | ::unlink ( pidfile_path ); | 146 | ::unlink ( pidfile_path ); |
147 | } | 147 | } |
148 | 148 | ||
149 | void handle_sigterm ( int /* sig */ ) | 149 | void handle_sigterm ( int /* sig */ ) |
150 | { | 150 | { |
151 | if ( qApp ) | 151 | if ( qApp ) |
152 | qApp-> quit ( ); | 152 | qApp-> quit ( ); |
153 | } | 153 | } |
154 | 154 | ||
155 | int main( int argc, char ** argv ) | 155 | int main( int argc, char ** argv ) |
156 | { | 156 | { |
157 | ::signal ( SIGCHLD, SIG_IGN ); | 157 | ::signal ( SIGCHLD, SIG_IGN ); |
158 | 158 | ||
159 | ::signal ( SIGTERM, handle_sigterm ); | 159 | ::signal ( SIGTERM, handle_sigterm ); |
160 | ::signal ( SIGINT, handle_sigterm ); | 160 | ::signal ( SIGINT, handle_sigterm ); |
161 | 161 | ||
162 | ::setsid ( ); | 162 | ::setsid ( ); |
163 | ::setpgid ( 0, 0 ); | 163 | ::setpgid ( 0, 0 ); |
164 | 164 | ||
165 | ::atexit ( remove_pidfile ); | 165 | ::atexit ( remove_pidfile ); |
166 | create_pidfile ( ); | 166 | create_pidfile ( ); |
167 | 167 | ||
168 | int retVal = initApplication ( argc, argv ); | 168 | int retVal = initApplication ( argc, argv ); |
169 | 169 | ||
170 | // Kill them. Kill them all. | 170 | // Kill them. Kill them all. |
171 | ::kill ( 0, SIGTERM ); | 171 | ::kill ( 0, SIGTERM ); |
172 | ::sleep ( 1 ); | 172 | ::sleep ( 1 ); |
173 | ::kill ( 0, SIGKILL ); | 173 | ::kill ( 0, SIGKILL ); |
174 | 174 | ||
175 | return retVal; | 175 | return retVal; |
176 | } | 176 | } |
177 | 177 | ||
diff --git a/core/launcher/taskbar.cpp b/core/launcher/taskbar.cpp index 77035a3..8af568d 100644 --- a/core/launcher/taskbar.cpp +++ b/core/launcher/taskbar.cpp | |||
@@ -1,181 +1,181 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of Qtopia Environment. | 4 | ** This file is part of Qtopia Environment. |
5 | ** | 5 | ** |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | ** This file may be distributed and/or modified under the terms of the |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | ** GNU General Public License version 2 as published by the Free Software |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | ** Foundation and appearing in the file LICENSE.GPL included in the |
9 | ** packaging of this file. | 9 | ** packaging of this file. |
10 | ** | 10 | ** |
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
13 | ** | 13 | ** |
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
15 | ** | 15 | ** |
16 | ** Contact info@trolltech.com if any conditions of this licensing are | 16 | ** Contact info@trolltech.com if any conditions of this licensing are |
17 | ** not clear to you. | 17 | ** not clear to you. |
18 | ** | 18 | ** |
19 | *********************************************************************/ | 19 | *********************************************************************/ |
20 | 20 | ||
21 | #include "startmenu.h" | 21 | #include "startmenu.h" |
22 | #include "inputmethods.h" | 22 | #include "inputmethods.h" |
23 | #include "runningappbar.h" | 23 | #include "runningappbar.h" |
24 | #include "systray.h" | 24 | #include "systray.h" |
25 | #include "calibrate.h" | 25 | #include "calibrate.h" |
26 | #include "wait.h" | 26 | #include "wait.h" |
27 | #include "appicons.h" | 27 | #include "appicons.h" |
28 | 28 | ||
29 | #include "taskbar.h" | 29 | #include "taskbar.h" |
30 | #include "desktop.h" | 30 | #include "desktop.h" |
31 | 31 | ||
32 | #include <qpe/qpeapplication.h> | 32 | #include <qpe/qpeapplication.h> |
33 | #include <qpe/qcopenvelope_qws.h> | 33 | #include <qpe/qcopenvelope_qws.h> |
34 | #include <qpe/global.h> | 34 | #include <qpe/global.h> |
35 | 35 | ||
36 | #if defined( QT_QWS_SHARP ) || defined( QT_QWS_IPAQ ) | 36 | #if defined( QT_QWS_SL5XXX ) || defined( QT_QWS_IPAQ ) |
37 | #include <qpe/custom.h> | 37 | #include <qpe/custom.h> |
38 | #endif | 38 | #endif |
39 | 39 | ||
40 | #include <opie/odevice.h> | 40 | #include <opie/odevice.h> |
41 | 41 | ||
42 | #include <qlabel.h> | 42 | #include <qlabel.h> |
43 | #include <qlayout.h> | 43 | #include <qlayout.h> |
44 | #include <qtimer.h> | 44 | #include <qtimer.h> |
45 | #include <qwindowsystem_qws.h> | 45 | #include <qwindowsystem_qws.h> |
46 | #include <qwidgetstack.h> | 46 | #include <qwidgetstack.h> |
47 | 47 | ||
48 | #if defined( Q_WS_QWS ) | 48 | #if defined( Q_WS_QWS ) |
49 | #include <qwsdisplay_qws.h> | 49 | #include <qwsdisplay_qws.h> |
50 | #include <qgfx_qws.h> | 50 | #include <qgfx_qws.h> |
51 | #endif | 51 | #endif |
52 | 52 | ||
53 | 53 | ||
54 | using namespace Opie; | 54 | using namespace Opie; |
55 | 55 | ||
56 | #define FACTORY(T) \ | 56 | #define FACTORY(T) \ |
57 | static QWidget *new##T( bool maximized ) { \ | 57 | static QWidget *new##T( bool maximized ) { \ |
58 | QWidget *w = new T( 0, "test", QWidget::WDestructiveClose | QWidget::WGroupLeader ); \ | 58 | QWidget *w = new T( 0, "test", QWidget::WDestructiveClose | QWidget::WGroupLeader ); \ |
59 | if ( maximized ) { \ | 59 | if ( maximized ) { \ |
60 | if ( qApp->desktop()->width() <= 350 ) { \ | 60 | if ( qApp->desktop()->width() <= 350 ) { \ |
61 | w->showMaximized(); \ | 61 | w->showMaximized(); \ |
62 | } else { \ | 62 | } else { \ |
63 | w->resize( QSize( 300, 300 ) ); \ | 63 | w->resize( QSize( 300, 300 ) ); \ |
64 | } \ | 64 | } \ |
65 | } \ | 65 | } \ |
66 | w->show(); \ | 66 | w->show(); \ |
67 | return w; \ | 67 | return w; \ |
68 | } | 68 | } |
69 | 69 | ||
70 | 70 | ||
71 | #ifdef SINGLE_APP | 71 | #ifdef SINGLE_APP |
72 | #define APP(a,b,c,d) FACTORY(b) | 72 | #define APP(a,b,c,d) FACTORY(b) |
73 | #include "../launcher/apps.h" | 73 | #include "../launcher/apps.h" |
74 | #undef APP | 74 | #undef APP |
75 | #endif // SINGLE_APP | 75 | #endif // SINGLE_APP |
76 | 76 | ||
77 | static Global::Command builtins[] = { | 77 | static Global::Command builtins[] = { |
78 | 78 | ||
79 | #ifdef SINGLE_APP | 79 | #ifdef SINGLE_APP |
80 | #define APP(a,b,c,d) { a, new##b, c }, | 80 | #define APP(a,b,c,d) { a, new##b, c }, |
81 | #include "../launcher/apps.h" | 81 | #include "../launcher/apps.h" |
82 | #undef APP | 82 | #undef APP |
83 | #endif | 83 | #endif |
84 | 84 | ||
85 | #if defined(QT_QWS_IPAQ) || defined(QT_QWS_CASSIOPEIA) || defined(QT_QWS_SHARP) | 85 | #if defined(QT_QWS_IPAQ) || defined(QT_QWS_CASSIOPEIA) || defined(QT_QWS_SL5XXX) |
86 | { "calibrate", TaskBar::calibrate, 1, 0 }, | 86 | { "calibrate", TaskBar::calibrate, 1, 0 }, |
87 | #endif | 87 | #endif |
88 | #if !defined(QT_QWS_CASSIOPEIA) | 88 | #if !defined(QT_QWS_CASSIOPEIA) |
89 | { "shutdown", Global::shutdown, 1, 0 }, | 89 | { "shutdown", Global::shutdown, 1, 0 }, |
90 | // { "run", run, 1, 0 }, | 90 | // { "run", run, 1, 0 }, |
91 | #endif | 91 | #endif |
92 | 92 | ||
93 | { 0, TaskBar::calibrate, 0, 0 }, | 93 | { 0, TaskBar::calibrate, 0, 0 }, |
94 | }; | 94 | }; |
95 | 95 | ||
96 | static bool initNumLock() | 96 | static bool initNumLock() |
97 | { | 97 | { |
98 | #ifdef QPE_INITIAL_NUMLOCK_STATE | 98 | #ifdef QPE_INITIAL_NUMLOCK_STATE |
99 | QPE_INITIAL_NUMLOCK_STATE | 99 | QPE_INITIAL_NUMLOCK_STATE |
100 | #endif | 100 | #endif |
101 | return FALSE; | 101 | return FALSE; |
102 | } | 102 | } |
103 | 103 | ||
104 | class LockKeyState : public QWidget | 104 | class LockKeyState : public QWidget |
105 | { | 105 | { |
106 | public: | 106 | public: |
107 | LockKeyState( QWidget *parent ) : | 107 | LockKeyState( QWidget *parent ) : |
108 | QWidget(parent), | 108 | QWidget(parent), |
109 | nl(initNumLock()), cl(FALSE) | 109 | nl(initNumLock()), cl(FALSE) |
110 | { | 110 | { |
111 | nl_pm = Resource::loadPixmap("numlock"); | 111 | nl_pm = Resource::loadPixmap("numlock"); |
112 | cl_pm = Resource::loadPixmap("capslock"); | 112 | cl_pm = Resource::loadPixmap("capslock"); |
113 | } | 113 | } |
114 | QSize sizeHint() const | 114 | QSize sizeHint() const |
115 | { | 115 | { |
116 | return QSize(nl_pm.width()+2,nl_pm.width()+nl_pm.height()+1); | 116 | return QSize(nl_pm.width()+2,nl_pm.width()+nl_pm.height()+1); |
117 | } | 117 | } |
118 | void toggleNumLockState() | 118 | void toggleNumLockState() |
119 | { | 119 | { |
120 | nl = !nl; repaint(); | 120 | nl = !nl; repaint(); |
121 | } | 121 | } |
122 | void toggleCapsLockState() | 122 | void toggleCapsLockState() |
123 | { | 123 | { |
124 | cl = !cl; repaint(); | 124 | cl = !cl; repaint(); |
125 | } | 125 | } |
126 | void paintEvent( QPaintEvent * ) | 126 | void paintEvent( QPaintEvent * ) |
127 | { | 127 | { |
128 | int y = (height()-sizeHint().height())/2; | 128 | int y = (height()-sizeHint().height())/2; |
129 | QPainter p(this); | 129 | QPainter p(this); |
130 | if ( nl ) | 130 | if ( nl ) |
131 | p.drawPixmap(1,y,nl_pm); | 131 | p.drawPixmap(1,y,nl_pm); |
132 | if ( cl ) | 132 | if ( cl ) |
133 | p.drawPixmap(1,y+nl_pm.height()+1,cl_pm); | 133 | p.drawPixmap(1,y+nl_pm.height()+1,cl_pm); |
134 | } | 134 | } |
135 | private: | 135 | private: |
136 | QPixmap nl_pm, cl_pm; | 136 | QPixmap nl_pm, cl_pm; |
137 | bool nl, cl; | 137 | bool nl, cl; |
138 | }; | 138 | }; |
139 | 139 | ||
140 | TaskBar::~TaskBar() | 140 | TaskBar::~TaskBar() |
141 | { | 141 | { |
142 | } | 142 | } |
143 | 143 | ||
144 | 144 | ||
145 | TaskBar::TaskBar() : QHBox(0, 0, WStyle_Customize | WStyle_Tool | WStyle_StaysOnTop | WGroupLeader) | 145 | TaskBar::TaskBar() : QHBox(0, 0, WStyle_Customize | WStyle_Tool | WStyle_StaysOnTop | WGroupLeader) |
146 | { | 146 | { |
147 | Global::setBuiltinCommands(builtins); | 147 | Global::setBuiltinCommands(builtins); |
148 | 148 | ||
149 | sm = new StartMenu( this ); | 149 | sm = new StartMenu( this ); |
150 | 150 | ||
151 | inputMethods = new InputMethods( this ); | 151 | inputMethods = new InputMethods( this ); |
152 | connect( inputMethods, SIGNAL(inputToggled(bool)), | 152 | connect( inputMethods, SIGNAL(inputToggled(bool)), |
153 | this, SLOT(calcMaxWindowRect()) ); | 153 | this, SLOT(calcMaxWindowRect()) ); |
154 | //new QuickLauncher( this ); | 154 | //new QuickLauncher( this ); |
155 | 155 | ||
156 | stack = new QWidgetStack( this ); | 156 | stack = new QWidgetStack( this ); |
157 | stack->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Minimum ) ); | 157 | stack->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Minimum ) ); |
158 | label = new QLabel(stack); | 158 | label = new QLabel(stack); |
159 | 159 | ||
160 | //mru = new MRUList( stack ); | 160 | //mru = new MRUList( stack ); |
161 | //stack->raiseWidget( mru ); | 161 | //stack->raiseWidget( mru ); |
162 | 162 | ||
163 | runningAppBar = new RunningAppBar(stack); | 163 | runningAppBar = new RunningAppBar(stack); |
164 | stack->raiseWidget(runningAppBar); | 164 | stack->raiseWidget(runningAppBar); |
165 | 165 | ||
166 | waitIcon = new Wait( this ); | 166 | waitIcon = new Wait( this ); |
167 | (void) new AppIcons( this ); | 167 | (void) new AppIcons( this ); |
168 | 168 | ||
169 | sysTray = new SysTray( this ); | 169 | sysTray = new SysTray( this ); |
170 | 170 | ||
171 | // ## make customizable in some way? | 171 | // ## make customizable in some way? |
172 | lockState = new LockKeyState( this ); | 172 | lockState = new LockKeyState( this ); |
173 | 173 | ||
174 | #if defined(Q_WS_QWS) | 174 | #if defined(Q_WS_QWS) |
175 | #if !defined(QT_NO_COP) | 175 | #if !defined(QT_NO_COP) |
176 | QCopChannel *channel = new QCopChannel( "QPE/TaskBar", this ); | 176 | QCopChannel *channel = new QCopChannel( "QPE/TaskBar", this ); |
177 | connect( channel, SIGNAL(received(const QCString&, const QByteArray&)), | 177 | connect( channel, SIGNAL(received(const QCString&, const QByteArray&)), |
178 | this, SLOT(receive(const QCString&, const QByteArray&)) ); | 178 | this, SLOT(receive(const QCString&, const QByteArray&)) ); |
179 | #endif | 179 | #endif |
180 | #endif | 180 | #endif |
181 | waitTimer = new QTimer( this ); | 181 | waitTimer = new QTimer( this ); |
diff --git a/core/multimedia/opieplayer/loopcontrol_threaded.cpp b/core/multimedia/opieplayer/loopcontrol_threaded.cpp index 1b89bc8..6817d5b 100644 --- a/core/multimedia/opieplayer/loopcontrol_threaded.cpp +++ b/core/multimedia/opieplayer/loopcontrol_threaded.cpp | |||
@@ -1,138 +1,138 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of Qtopia Environment. | 4 | ** This file is part of Qtopia Environment. |
5 | ** | 5 | ** |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | ** This file may be distributed and/or modified under the terms of the |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | ** GNU General Public License version 2 as published by the Free Software |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | ** Foundation and appearing in the file LICENSE.GPL included in the |
9 | ** packaging of this file. | 9 | ** packaging of this file. |
10 | ** | 10 | ** |
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
13 | ** | 13 | ** |
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
15 | ** | 15 | ** |
16 | ** Contact info@trolltech.com if any conditions of this licensing are | 16 | ** Contact info@trolltech.com if any conditions of this licensing are |
17 | ** not clear to you. | 17 | ** not clear to you. |
18 | ** | 18 | ** |
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | #define _REENTRANT | 20 | #define _REENTRANT |
21 | 21 | ||
22 | #include <qpe/qpeapplication.h> | 22 | #include <qpe/qpeapplication.h> |
23 | #include <qimage.h> | 23 | #include <qimage.h> |
24 | #include <qpainter.h> | 24 | #include <qpainter.h> |
25 | #ifdef Q_WS_QWS | 25 | #ifdef Q_WS_QWS |
26 | #include <qpe/qcopenvelope_qws.h> | 26 | #include <qpe/qcopenvelope_qws.h> |
27 | #endif | 27 | #endif |
28 | #include "mediaplayerplugininterface.h" | 28 | #include "mediaplayerplugininterface.h" |
29 | #include <stdio.h> | 29 | #include <stdio.h> |
30 | #include <stdlib.h> | 30 | #include <stdlib.h> |
31 | #include <string.h> | 31 | #include <string.h> |
32 | #include <time.h> | 32 | #include <time.h> |
33 | #include <unistd.h> | 33 | #include <unistd.h> |
34 | #include <pthread.h> | 34 | #include <pthread.h> |
35 | #include "loopcontrol.h" | 35 | #include "loopcontrol.h" |
36 | #include "audiodevice.h" | 36 | #include "audiodevice.h" |
37 | #include "videowidget.h" | 37 | #include "videowidget.h" |
38 | #include "audiowidget.h" | 38 | #include "audiowidget.h" |
39 | #include "mediaplayerstate.h" | 39 | #include "mediaplayerstate.h" |
40 | 40 | ||
41 | 41 | ||
42 | #if defined(QT_QWS_SHARP) || defined(QT_QWS_IPAQ) | 42 | #if defined(QT_QWS_SL5XXX) || defined(QT_QWS_IPAQ) |
43 | #define USE_REALTIME_AUDIO_THREAD | 43 | #define USE_REALTIME_AUDIO_THREAD |
44 | #endif | 44 | #endif |
45 | 45 | ||
46 | 46 | ||
47 | extern VideoWidget *videoUI; // now only needed to tell it to play a frame | 47 | extern VideoWidget *videoUI; // now only needed to tell it to play a frame |
48 | extern MediaPlayerState *mediaPlayerState; | 48 | extern MediaPlayerState *mediaPlayerState; |
49 | 49 | ||
50 | 50 | ||
51 | #define DecodeLoopDebug(x) qDebug x | 51 | #define DecodeLoopDebug(x) qDebug x |
52 | //#define DecodeLoopDebug(x) | 52 | //#define DecodeLoopDebug(x) |
53 | 53 | ||
54 | 54 | ||
55 | static char *audioBuffer = NULL; | 55 | static char *audioBuffer = NULL; |
56 | static AudioDevice *audioDevice = NULL; | 56 | static AudioDevice *audioDevice = NULL; |
57 | static bool disabledSuspendScreenSaver = FALSE; | 57 | static bool disabledSuspendScreenSaver = FALSE; |
58 | 58 | ||
59 | 59 | ||
60 | pthread_tvideo_tid; | 60 | pthread_tvideo_tid; |
61 | pthread_attr_t video_attr; | 61 | pthread_attr_t video_attr; |
62 | pthread_taudio_tid; | 62 | pthread_taudio_tid; |
63 | pthread_attr_t audio_attr; | 63 | pthread_attr_t audio_attr; |
64 | 64 | ||
65 | 65 | ||
66 | bool emitPlayFinished = FALSE; | 66 | bool emitPlayFinished = FALSE; |
67 | bool emitChangePos = FALSE; | 67 | bool emitChangePos = FALSE; |
68 | 68 | ||
69 | 69 | ||
70 | class Mutex { | 70 | class Mutex { |
71 | public: | 71 | public: |
72 | Mutex() { | 72 | Mutex() { |
73 | pthread_mutexattr_t attr; | 73 | pthread_mutexattr_t attr; |
74 | pthread_mutexattr_init( &attr ); | 74 | pthread_mutexattr_init( &attr ); |
75 | pthread_mutex_init( &mutex, &attr ); | 75 | pthread_mutex_init( &mutex, &attr ); |
76 | pthread_mutexattr_destroy( &attr ); | 76 | pthread_mutexattr_destroy( &attr ); |
77 | } | 77 | } |
78 | 78 | ||
79 | ~Mutex() { | 79 | ~Mutex() { |
80 | pthread_mutex_destroy( &mutex ); | 80 | pthread_mutex_destroy( &mutex ); |
81 | } | 81 | } |
82 | 82 | ||
83 | void lock() { | 83 | void lock() { |
84 | pthread_mutex_lock( &mutex ); | 84 | pthread_mutex_lock( &mutex ); |
85 | } | 85 | } |
86 | 86 | ||
87 | void unlock() { | 87 | void unlock() { |
88 | pthread_mutex_unlock( &mutex ); | 88 | pthread_mutex_unlock( &mutex ); |
89 | } | 89 | } |
90 | /* | 90 | /* |
91 | bool locked() { | 91 | bool locked() { |
92 | switch ( pthread_mutex_trylock( &mutex ) ) { | 92 | switch ( pthread_mutex_trylock( &mutex ) ) { |
93 | case EBUSY: | 93 | case EBUSY: |
94 | return TRUE; | 94 | return TRUE; |
95 | case 0: | 95 | case 0: |
96 | pthread_mutex_unlock( &mutex ); | 96 | pthread_mutex_unlock( &mutex ); |
97 | default: | 97 | default: |
98 | return FALSE; | 98 | return FALSE; |
99 | } | 99 | } |
100 | } | 100 | } |
101 | */ | 101 | */ |
102 | private: | 102 | private: |
103 | pthread_mutex_t mutex; | 103 | pthread_mutex_t mutex; |
104 | }; | 104 | }; |
105 | 105 | ||
106 | 106 | ||
107 | class currentFrameObj { | 107 | class currentFrameObj { |
108 | public: | 108 | public: |
109 | currentFrameObj() : value( 0 ) { } | 109 | currentFrameObj() : value( 0 ) { } |
110 | void set( long f ) { | 110 | void set( long f ) { |
111 | mutex.lock(); | 111 | mutex.lock(); |
112 | value = f; | 112 | value = f; |
113 | mediaPlayerState->curDecoder()->videoSetFrame( f, 0 ); | 113 | mediaPlayerState->curDecoder()->videoSetFrame( f, 0 ); |
114 | mutex.unlock(); | 114 | mutex.unlock(); |
115 | } | 115 | } |
116 | long get() { | 116 | long get() { |
117 | return value; | 117 | return value; |
118 | } | 118 | } |
119 | private: | 119 | private: |
120 | long value; | 120 | long value; |
121 | Mutex mutex; | 121 | Mutex mutex; |
122 | }; | 122 | }; |
123 | 123 | ||
124 | 124 | ||
125 | Mutex *videoMutex; | 125 | Mutex *videoMutex; |
126 | Mutex *audioMutex; | 126 | Mutex *audioMutex; |
127 | Mutex *globalMutex; | 127 | Mutex *globalMutex; |
128 | 128 | ||
129 | 129 | ||
130 | clock_tbegin; | 130 | clock_tbegin; |
131 | 131 | ||
132 | 132 | ||
133 | LoopControl::LoopControl( QObject *parent, const char *name ) | 133 | LoopControl::LoopControl( QObject *parent, const char *name ) |
134 | : QObject( parent, name ) { | 134 | : QObject( parent, name ) { |
135 | isMuted = FALSE; | 135 | isMuted = FALSE; |
136 | connect( qApp, SIGNAL( volumeChanged(bool) ), this, SLOT( setMute(bool) ) ); | 136 | connect( qApp, SIGNAL( volumeChanged(bool) ), this, SLOT( setMute(bool) ) ); |
137 | timerid = startTimer( 200 ); | 137 | timerid = startTimer( 200 ); |
138 | videoMutex = new Mutex; | 138 | videoMutex = new Mutex; |
diff --git a/core/opie-login/main.cpp b/core/opie-login/main.cpp index 81f4d1e..1800be0 100644 --- a/core/opie-login/main.cpp +++ b/core/opie-login/main.cpp | |||
@@ -230,139 +230,139 @@ public: | |||
230 | setBacklight ( -3 ); | 230 | setBacklight ( -3 ); |
231 | } | 231 | } |
232 | bool save( int level ) | 232 | bool save( int level ) |
233 | { | 233 | { |
234 | switch ( level ) { | 234 | switch ( level ) { |
235 | case 0: | 235 | case 0: |
236 | if ( backlight() > 1 ) | 236 | if ( backlight() > 1 ) |
237 | setBacklight( 1 ); // lowest non-off | 237 | setBacklight( 1 ); // lowest non-off |
238 | return true; | 238 | return true; |
239 | break; | 239 | break; |
240 | case 1: | 240 | case 1: |
241 | setBacklight( 0 ); // off | 241 | setBacklight( 0 ); // off |
242 | return true; | 242 | return true; |
243 | break; | 243 | break; |
244 | case 2: | 244 | case 2: |
245 | // We're going to suspend the whole machine | 245 | // We're going to suspend the whole machine |
246 | if ( PowerStatusManager::readStatus().acStatus() != PowerStatus::Online ) { | 246 | if ( PowerStatusManager::readStatus().acStatus() != PowerStatus::Online ) { |
247 | QWSServer::sendKeyEvent( 0xffff, Qt::Key_F34, FALSE, TRUE, FALSE ); | 247 | QWSServer::sendKeyEvent( 0xffff, Qt::Key_F34, FALSE, TRUE, FALSE ); |
248 | return true; | 248 | return true; |
249 | } | 249 | } |
250 | break; | 250 | break; |
251 | } | 251 | } |
252 | return false; | 252 | return false; |
253 | } | 253 | } |
254 | 254 | ||
255 | private: | 255 | private: |
256 | public: | 256 | public: |
257 | void setIntervals( int i1 = 30, int i2 = 20, int i3 = 60 ) | 257 | void setIntervals( int i1 = 30, int i2 = 20, int i3 = 60 ) |
258 | { | 258 | { |
259 | int v [4]; | 259 | int v [4]; |
260 | 260 | ||
261 | v [ 0 ] = QMAX( 1000 * i1, 100 ); | 261 | v [ 0 ] = QMAX( 1000 * i1, 100 ); |
262 | v [ 1 ] = QMAX( 1000 * i2, 100 ); | 262 | v [ 1 ] = QMAX( 1000 * i2, 100 ); |
263 | v [ 2 ] = QMAX( 1000 * i3, 100 ); | 263 | v [ 2 ] = QMAX( 1000 * i3, 100 ); |
264 | v [ 3 ] = 0; | 264 | v [ 3 ] = 0; |
265 | 265 | ||
266 | if ( !i1 && !i2 && !i3 ) | 266 | if ( !i1 && !i2 && !i3 ) |
267 | QWSServer::setScreenSaverInterval ( 0 ); | 267 | QWSServer::setScreenSaverInterval ( 0 ); |
268 | else | 268 | else |
269 | QWSServer::setScreenSaverIntervals ( v ); | 269 | QWSServer::setScreenSaverIntervals ( v ); |
270 | } | 270 | } |
271 | 271 | ||
272 | int backlight ( ) | 272 | int backlight ( ) |
273 | { | 273 | { |
274 | if ( m_backlight_bright == -1 ) | 274 | if ( m_backlight_bright == -1 ) |
275 | m_backlight_bright = 255; | 275 | m_backlight_bright = 255; |
276 | 276 | ||
277 | return m_backlight_bright; | 277 | return m_backlight_bright; |
278 | } | 278 | } |
279 | 279 | ||
280 | void setBacklight ( int bright ) | 280 | void setBacklight ( int bright ) |
281 | { | 281 | { |
282 | if ( bright == -3 ) { | 282 | if ( bright == -3 ) { |
283 | // Forced on | 283 | // Forced on |
284 | m_backlight_forcedoff = false; | 284 | m_backlight_forcedoff = false; |
285 | bright = -1; | 285 | bright = -1; |
286 | } | 286 | } |
287 | if ( m_backlight_forcedoff && bright != -2 ) | 287 | if ( m_backlight_forcedoff && bright != -2 ) |
288 | return ; | 288 | return ; |
289 | if ( bright == -2 ) { | 289 | if ( bright == -2 ) { |
290 | // Toggle between off and on | 290 | // Toggle between off and on |
291 | bright = m_backlight_bright ? 0 : -1; | 291 | bright = m_backlight_bright ? 0 : -1; |
292 | m_backlight_forcedoff = !bright; | 292 | m_backlight_forcedoff = !bright; |
293 | } | 293 | } |
294 | 294 | ||
295 | m_backlight_bright = bright; | 295 | m_backlight_bright = bright; |
296 | 296 | ||
297 | bright = backlight ( ); | 297 | bright = backlight ( ); |
298 | ODevice::inst ( ) -> setDisplayBrightness ( bright ); | 298 | ODevice::inst ( ) -> setDisplayBrightness ( bright ); |
299 | 299 | ||
300 | m_backlight_bright = bright; | 300 | m_backlight_bright = bright; |
301 | } | 301 | } |
302 | 302 | ||
303 | private: | 303 | private: |
304 | bool m_lcd_status; | 304 | bool m_lcd_status; |
305 | 305 | ||
306 | int m_backlight_bright; | 306 | int m_backlight_bright; |
307 | bool m_backlight_forcedoff; | 307 | bool m_backlight_forcedoff; |
308 | }; | 308 | }; |
309 | 309 | ||
310 | 310 | ||
311 | namespace Opie { extern int force_appearance; } // HACK to get around the force-style setting | 311 | namespace Opie { extern int force_appearance; } // HACK to get around the force-style setting |
312 | 312 | ||
313 | 313 | ||
314 | int login_main ( int argc, char **argv, pid_t ppid ) | 314 | int login_main ( int argc, char **argv, pid_t ppid ) |
315 | { | 315 | { |
316 | QWSServer::setDesktopBackground( QImage() ); | 316 | QWSServer::setDesktopBackground( QImage() ); |
317 | LoginApplication *app = new LoginApplication ( argc, argv, ppid ); | 317 | LoginApplication *app = new LoginApplication ( argc, argv, ppid ); |
318 | 318 | ||
319 | Opie::force_appearance = 0; | 319 | Opie::force_appearance = 0; |
320 | 320 | ||
321 | app-> setFont ( QFont ( "Helvetica", 10 )); | 321 | app-> setFont ( QFont ( "Helvetica", 10 )); |
322 | app-> setStyle ( new QPEStyle ( )); | 322 | app-> setStyle ( new QPEStyle ( )); |
323 | 323 | ||
324 | ODevice::inst ( )-> setSoftSuspend ( true ); | 324 | ODevice::inst ( )-> setSoftSuspend ( true ); |
325 | 325 | ||
326 | #if defined(QT_QWS_CASSIOPEIA) || defined(QT_QWS_IPAQ) || defined(QT_QWS_EBX) | 326 | #if defined(QT_QWS_CASSIOPEIA) || defined(QT_QWS_IPAQ) || defined(QT_QWS_SL5XXX) |
327 | if ( !QFile::exists ( "/etc/pointercal" )) { | 327 | if ( !QFile::exists ( "/etc/pointercal" )) { |
328 | // Make sure calibration widget starts on top. | 328 | // Make sure calibration widget starts on top. |
329 | Calibrate *cal = new Calibrate; | 329 | Calibrate *cal = new Calibrate; |
330 | cal-> exec ( ); | 330 | cal-> exec ( ); |
331 | delete cal; | 331 | delete cal; |
332 | } | 332 | } |
333 | #endif | 333 | #endif |
334 | 334 | ||
335 | LoginScreenSaver *saver = new LoginScreenSaver; | 335 | LoginScreenSaver *saver = new LoginScreenSaver; |
336 | 336 | ||
337 | saver-> setIntervals ( ); | 337 | saver-> setIntervals ( ); |
338 | QWSServer::setScreenSaver ( saver ); | 338 | QWSServer::setScreenSaver ( saver ); |
339 | saver-> restore ( ); | 339 | saver-> restore ( ); |
340 | 340 | ||
341 | 341 | ||
342 | LoginWindowImpl *lw = new LoginWindowImpl ( ); | 342 | LoginWindowImpl *lw = new LoginWindowImpl ( ); |
343 | app-> setMainWidget ( lw ); | 343 | app-> setMainWidget ( lw ); |
344 | lw-> setGeometry ( 0, 0, app-> desktop ( )-> width ( ), app-> desktop ( )-> height ( )); | 344 | lw-> setGeometry ( 0, 0, app-> desktop ( )-> width ( ), app-> desktop ( )-> height ( )); |
345 | lw-> show ( ); | 345 | lw-> show ( ); |
346 | 346 | ||
347 | int rc = app-> exec ( ); | 347 | int rc = app-> exec ( ); |
348 | 348 | ||
349 | ODevice::inst ( )-> setSoftSuspend ( false ); | 349 | ODevice::inst ( )-> setSoftSuspend ( false ); |
350 | 350 | ||
351 | if ( app-> loginAs ( )) { | 351 | if ( app-> loginAs ( )) { |
352 | if ( app-> changeIdentity ( )) { | 352 | if ( app-> changeIdentity ( )) { |
353 | app-> login ( ); | 353 | app-> login ( ); |
354 | 354 | ||
355 | // if login succeeds, it never comes back | 355 | // if login succeeds, it never comes back |
356 | 356 | ||
357 | QMessageBox::critical ( 0, LoginWindowImpl::tr( "Failure" ), LoginWindowImpl::tr( "Could not start OPIE." )); | 357 | QMessageBox::critical ( 0, LoginWindowImpl::tr( "Failure" ), LoginWindowImpl::tr( "Could not start OPIE." )); |
358 | rc = 1; | 358 | rc = 1; |
359 | } | 359 | } |
360 | else { | 360 | else { |
361 | QMessageBox::critical ( 0, LoginWindowImpl::tr( "Failure" ), LoginWindowImpl::tr( "Could not switch to new user identity" )); | 361 | QMessageBox::critical ( 0, LoginWindowImpl::tr( "Failure" ), LoginWindowImpl::tr( "Could not switch to new user identity" )); |
362 | rc = 2; | 362 | rc = 2; |
363 | } | 363 | } |
364 | 364 | ||
365 | } | 365 | } |
366 | return rc; | 366 | return rc; |
367 | } | 367 | } |
368 | 368 | ||
diff --git a/library/power.cpp b/library/power.cpp index 21c8960..5310b47 100644 --- a/library/power.cpp +++ b/library/power.cpp | |||
@@ -1,119 +1,119 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of the Qtopia Environment. | 4 | ** This file is part of the Qtopia Environment. |
5 | ** | 5 | ** |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | ** This file may be distributed and/or modified under the terms of the |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | ** GNU General Public License version 2 as published by the Free Software |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | ** Foundation and appearing in the file LICENSE.GPL included in the |
9 | ** packaging of this file. | 9 | ** packaging of this file. |
10 | ** | 10 | ** |
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
13 | ** | 13 | ** |
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
15 | ** | 15 | ** |
16 | ** Contact info@trolltech.com if any conditions of this licensing are | 16 | ** Contact info@trolltech.com if any conditions of this licensing are |
17 | ** not clear to you. | 17 | ** not clear to you. |
18 | ** | 18 | ** |
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | 20 | ||
21 | #include "power.h" | 21 | #include "power.h" |
22 | 22 | ||
23 | #ifdef QT_QWS_SHARP | 23 | #ifdef QT_QWS_SL5XXX |
24 | #include "custom.h" | 24 | #include "custom.h" |
25 | #endif | 25 | #endif |
26 | 26 | ||
27 | #include <unistd.h> | 27 | #include <unistd.h> |
28 | #include <stdlib.h> | 28 | #include <stdlib.h> |
29 | #include <stdio.h> | 29 | #include <stdio.h> |
30 | #include <fcntl.h> | 30 | #include <fcntl.h> |
31 | #include <sys/ioctl.h> | 31 | #include <sys/ioctl.h> |
32 | 32 | ||
33 | #ifdef QT_QWS_IPAQ_NO_APM | 33 | #ifdef QT_QWS_IPAQ_NO_APM |
34 | #include <linux/h3600_ts.h> | 34 | #include <linux/h3600_ts.h> |
35 | #endif | 35 | #endif |
36 | 36 | ||
37 | PowerStatusManager *PowerStatusManager::powerManager = 0; | 37 | PowerStatusManager *PowerStatusManager::powerManager = 0; |
38 | PowerStatus *PowerStatusManager::ps = 0; | 38 | PowerStatus *PowerStatusManager::ps = 0; |
39 | 39 | ||
40 | static bool haveProcApm = false; | 40 | static bool haveProcApm = false; |
41 | 41 | ||
42 | PowerStatusManager::PowerStatusManager() | 42 | PowerStatusManager::PowerStatusManager() |
43 | { | 43 | { |
44 | powerManager = this; | 44 | powerManager = this; |
45 | ps = new PowerStatus; | 45 | ps = new PowerStatus; |
46 | FILE *f = fopen("/proc/apm", "r"); | 46 | FILE *f = fopen("/proc/apm", "r"); |
47 | if ( f ) { | 47 | if ( f ) { |
48 | fclose(f); | 48 | fclose(f); |
49 | haveProcApm = TRUE; | 49 | haveProcApm = TRUE; |
50 | } | 50 | } |
51 | } | 51 | } |
52 | 52 | ||
53 | const PowerStatus &PowerStatusManager::readStatus() | 53 | const PowerStatus &PowerStatusManager::readStatus() |
54 | { | 54 | { |
55 | if ( !powerManager ) | 55 | if ( !powerManager ) |
56 | (void)new PowerStatusManager; | 56 | (void)new PowerStatusManager; |
57 | 57 | ||
58 | powerManager->getStatus(); | 58 | powerManager->getStatus(); |
59 | 59 | ||
60 | return *ps; | 60 | return *ps; |
61 | } | 61 | } |
62 | 62 | ||
63 | // Standard /proc/apm reader | 63 | // Standard /proc/apm reader |
64 | bool PowerStatusManager::getProcApmStatus( int &ac, int &bs, int &bf, int &pc, int &sec ) | 64 | bool PowerStatusManager::getProcApmStatus( int &ac, int &bs, int &bf, int &pc, int &sec ) |
65 | { | 65 | { |
66 | bool ok = false; | 66 | bool ok = false; |
67 | 67 | ||
68 | ac = 0xff; | 68 | ac = 0xff; |
69 | bs = 0xff; | 69 | bs = 0xff; |
70 | bf = 0xff; | 70 | bf = 0xff; |
71 | pc = -1; | 71 | pc = -1; |
72 | sec = -1; | 72 | sec = -1; |
73 | 73 | ||
74 | FILE *f = fopen("/proc/apm", "r"); | 74 | FILE *f = fopen("/proc/apm", "r"); |
75 | if ( f ) { | 75 | if ( f ) { |
76 | //I 1.13 1.2 0x02 0x00 0xff 0xff 49% 147 sec | 76 | //I 1.13 1.2 0x02 0x00 0xff 0xff 49% 147 sec |
77 | char u; | 77 | char u; |
78 | fscanf(f, "%*[^ ] %*d.%*d 0x%*x 0x%x 0x%x 0x%x %d%% %i %c", | 78 | fscanf(f, "%*[^ ] %*d.%*d 0x%*x 0x%x 0x%x 0x%x %d%% %i %c", |
79 | &ac, &bs, &bf, &pc, &sec, &u); | 79 | &ac, &bs, &bf, &pc, &sec, &u); |
80 | fclose(f); | 80 | fclose(f); |
81 | switch ( u ) { | 81 | switch ( u ) { |
82 | case 'm': sec *= 60; | 82 | case 'm': sec *= 60; |
83 | case 's': break; // ok | 83 | case 's': break; // ok |
84 | default: sec = -1; // unknown | 84 | default: sec = -1; // unknown |
85 | } | 85 | } |
86 | 86 | ||
87 | // extract data | 87 | // extract data |
88 | switch ( bs ) { | 88 | switch ( bs ) { |
89 | case 0x00: | 89 | case 0x00: |
90 | ps->bs = PowerStatus::High; | 90 | ps->bs = PowerStatus::High; |
91 | break; | 91 | break; |
92 | case 0x01: | 92 | case 0x01: |
93 | ps->bs = PowerStatus::Low; | 93 | ps->bs = PowerStatus::Low; |
94 | break; | 94 | break; |
95 | case 0x7f: | 95 | case 0x7f: |
96 | ps->bs = PowerStatus::VeryLow; | 96 | ps->bs = PowerStatus::VeryLow; |
97 | break; | 97 | break; |
98 | case 0x02: | 98 | case 0x02: |
99 | ps->bs = PowerStatus::Critical; | 99 | ps->bs = PowerStatus::Critical; |
100 | break; | 100 | break; |
101 | case 0x03: | 101 | case 0x03: |
102 | ps->bs = PowerStatus::Charging; | 102 | ps->bs = PowerStatus::Charging; |
103 | break; | 103 | break; |
104 | case 0x04: | 104 | case 0x04: |
105 | case 0xff: // 0xff is Unknown but we map to NotPresent | 105 | case 0xff: // 0xff is Unknown but we map to NotPresent |
106 | default: | 106 | default: |
107 | ps->bs = PowerStatus::NotPresent; | 107 | ps->bs = PowerStatus::NotPresent; |
108 | break; | 108 | break; |
109 | } | 109 | } |
110 | 110 | ||
111 | switch ( ac ) { | 111 | switch ( ac ) { |
112 | case 0x00: | 112 | case 0x00: |
113 | ps->ac = PowerStatus::Offline; | 113 | ps->ac = PowerStatus::Offline; |
114 | break; | 114 | break; |
115 | case 0x01: | 115 | case 0x01: |
116 | ps->ac = PowerStatus::Online; | 116 | ps->ac = PowerStatus::Online; |
117 | break; | 117 | break; |
118 | case 0x02: | 118 | case 0x02: |
119 | ps->ac = PowerStatus::Backup; | 119 | ps->ac = PowerStatus::Backup; |
diff --git a/library/qpeapplication.cpp b/library/qpeapplication.cpp index 95c4a1b..7463074 100644 --- a/library/qpeapplication.cpp +++ b/library/qpeapplication.cpp | |||
@@ -1648,159 +1648,159 @@ bool QPEApplication::keyboardGrabbed() const | |||
1648 | 1648 | ||
1649 | 1649 | ||
1650 | /*! | 1650 | /*! |
1651 | Reverses the effect of grabKeyboard(). This is called automatically | 1651 | Reverses the effect of grabKeyboard(). This is called automatically |
1652 | on program exit. | 1652 | on program exit. |
1653 | */ | 1653 | */ |
1654 | void QPEApplication::ungrabKeyboard() | 1654 | void QPEApplication::ungrabKeyboard() |
1655 | { | 1655 | { |
1656 | ((QPEApplication *) qApp )-> d-> kbgrabbed = false; | 1656 | ((QPEApplication *) qApp )-> d-> kbgrabbed = false; |
1657 | } | 1657 | } |
1658 | 1658 | ||
1659 | /*! | 1659 | /*! |
1660 | Grabs the physical keyboard keys, e.g. the application's launching | 1660 | Grabs the physical keyboard keys, e.g. the application's launching |
1661 | keys. Instead of launching applications when these keys are pressed | 1661 | keys. Instead of launching applications when these keys are pressed |
1662 | the signals emitted are sent to this application instead. Some games | 1662 | the signals emitted are sent to this application instead. Some games |
1663 | programs take over the launch keys in this way to make interaction | 1663 | programs take over the launch keys in this way to make interaction |
1664 | easier. | 1664 | easier. |
1665 | 1665 | ||
1666 | \sa ungrabKeyboard() | 1666 | \sa ungrabKeyboard() |
1667 | */ | 1667 | */ |
1668 | void QPEApplication::grabKeyboard() | 1668 | void QPEApplication::grabKeyboard() |
1669 | { | 1669 | { |
1670 | ((QPEApplication *) qApp )-> d-> kbgrabbed = true; | 1670 | ((QPEApplication *) qApp )-> d-> kbgrabbed = true; |
1671 | } | 1671 | } |
1672 | 1672 | ||
1673 | /*! | 1673 | /*! |
1674 | \reimp | 1674 | \reimp |
1675 | */ | 1675 | */ |
1676 | int QPEApplication::exec() | 1676 | int QPEApplication::exec() |
1677 | { | 1677 | { |
1678 | #ifndef QT_NO_COP | 1678 | #ifndef QT_NO_COP |
1679 | d->sendQCopQ(); | 1679 | d->sendQCopQ(); |
1680 | #endif | 1680 | #endif |
1681 | 1681 | ||
1682 | if ( d->keep_running ) | 1682 | if ( d->keep_running ) |
1683 | //|| d->qpe_main_widget && d->qpe_main_widget->isVisible() ) | 1683 | //|| d->qpe_main_widget && d->qpe_main_widget->isVisible() ) |
1684 | return QApplication::exec(); | 1684 | return QApplication::exec(); |
1685 | 1685 | ||
1686 | #ifndef QT_NO_COP | 1686 | #ifndef QT_NO_COP |
1687 | 1687 | ||
1688 | { | 1688 | { |
1689 | QCopEnvelope e( "QPE/System", "closing(QString)" ); | 1689 | QCopEnvelope e( "QPE/System", "closing(QString)" ); |
1690 | e << d->appName; | 1690 | e << d->appName; |
1691 | } | 1691 | } |
1692 | #endif | 1692 | #endif |
1693 | processEvents(); | 1693 | processEvents(); |
1694 | return 0; | 1694 | return 0; |
1695 | } | 1695 | } |
1696 | 1696 | ||
1697 | /*! | 1697 | /*! |
1698 | \internal | 1698 | \internal |
1699 | External request for application to quit. Quits if possible without | 1699 | External request for application to quit. Quits if possible without |
1700 | loosing state. | 1700 | loosing state. |
1701 | */ | 1701 | */ |
1702 | void QPEApplication::tryQuit() | 1702 | void QPEApplication::tryQuit() |
1703 | { | 1703 | { |
1704 | if ( activeModalWidget() || strcmp( argv() [ 0 ], "embeddedkonsole" ) == 0 ) | 1704 | if ( activeModalWidget() || strcmp( argv() [ 0 ], "embeddedkonsole" ) == 0 ) |
1705 | return ; // Inside modal loop or konsole. Too hard to save state. | 1705 | return ; // Inside modal loop or konsole. Too hard to save state. |
1706 | #ifndef QT_NO_COP | 1706 | #ifndef QT_NO_COP |
1707 | 1707 | ||
1708 | { | 1708 | { |
1709 | QCopEnvelope e( "QPE/System", "closing(QString)" ); | 1709 | QCopEnvelope e( "QPE/System", "closing(QString)" ); |
1710 | e << d->appName; | 1710 | e << d->appName; |
1711 | } | 1711 | } |
1712 | #endif | 1712 | #endif |
1713 | processEvents(); | 1713 | processEvents(); |
1714 | 1714 | ||
1715 | quit(); | 1715 | quit(); |
1716 | } | 1716 | } |
1717 | 1717 | ||
1718 | /*! | 1718 | /*! |
1719 | \internal | 1719 | \internal |
1720 | User initiated quit. Makes the window 'Go Away'. If preloaded this means | 1720 | User initiated quit. Makes the window 'Go Away'. If preloaded this means |
1721 | hiding the window. If not it means quitting the application. | 1721 | hiding the window. If not it means quitting the application. |
1722 | As this is user initiated we don't need to check state. | 1722 | As this is user initiated we don't need to check state. |
1723 | */ | 1723 | */ |
1724 | void QPEApplication::hideOrQuit() | 1724 | void QPEApplication::hideOrQuit() |
1725 | { | 1725 | { |
1726 | processEvents(); | 1726 | processEvents(); |
1727 | 1727 | ||
1728 | // If we are a preloaded application we don't actually quit, so emit | 1728 | // If we are a preloaded application we don't actually quit, so emit |
1729 | // a System message indicating we're quasi-closing. | 1729 | // a System message indicating we're quasi-closing. |
1730 | if ( d->preloaded && d->qpe_main_widget ) | 1730 | if ( d->preloaded && d->qpe_main_widget ) |
1731 | #ifndef QT_NO_COP | 1731 | #ifndef QT_NO_COP |
1732 | 1732 | ||
1733 | { | 1733 | { |
1734 | QCopEnvelope e("QPE/System", "fastAppHiding(QString)" ); | 1734 | QCopEnvelope e("QPE/System", "fastAppHiding(QString)" ); |
1735 | e << d->appName; | 1735 | e << d->appName; |
1736 | d->qpe_main_widget->hide(); | 1736 | d->qpe_main_widget->hide(); |
1737 | } | 1737 | } |
1738 | #endif | 1738 | #endif |
1739 | else | 1739 | else |
1740 | quit(); | 1740 | quit(); |
1741 | } | 1741 | } |
1742 | 1742 | ||
1743 | 1743 | ||
1744 | #if defined(QT_QWS_IPAQ) || defined(QT_QWS_SHARP) | 1744 | #if defined(QT_QWS_IPAQ) || defined(QT_QWS_SL5XXX) |
1745 | 1745 | ||
1746 | // The libraries with the skiff package (and possibly others) have | 1746 | // The libraries with the skiff package (and possibly others) have |
1747 | // completely useless implementations of builtin new and delete that | 1747 | // completely useless implementations of builtin new and delete that |
1748 | // use about 50% of your CPU. Here we revert to the simple libc | 1748 | // use about 50% of your CPU. Here we revert to the simple libc |
1749 | // functions. | 1749 | // functions. |
1750 | 1750 | ||
1751 | void* operator new[]( size_t size ) | 1751 | void* operator new[]( size_t size ) |
1752 | { | 1752 | { |
1753 | return malloc( size ); | 1753 | return malloc( size ); |
1754 | } | 1754 | } |
1755 | 1755 | ||
1756 | void* operator new( size_t size ) | 1756 | void* operator new( size_t size ) |
1757 | { | 1757 | { |
1758 | return malloc( size ); | 1758 | return malloc( size ); |
1759 | } | 1759 | } |
1760 | 1760 | ||
1761 | void operator delete[]( void* p ) | 1761 | void operator delete[]( void* p ) |
1762 | { | 1762 | { |
1763 | free( p ); | 1763 | free( p ); |
1764 | } | 1764 | } |
1765 | 1765 | ||
1766 | void operator delete[]( void* p, size_t /*size*/ ) | 1766 | void operator delete[]( void* p, size_t /*size*/ ) |
1767 | { | 1767 | { |
1768 | free( p ); | 1768 | free( p ); |
1769 | } | 1769 | } |
1770 | 1770 | ||
1771 | void operator delete( void* p ) | 1771 | void operator delete( void* p ) |
1772 | { | 1772 | { |
1773 | free( p ); | 1773 | free( p ); |
1774 | } | 1774 | } |
1775 | 1775 | ||
1776 | void operator delete( void* p, size_t /*size*/ ) | 1776 | void operator delete( void* p, size_t /*size*/ ) |
1777 | { | 1777 | { |
1778 | free( p ); | 1778 | free( p ); |
1779 | } | 1779 | } |
1780 | 1780 | ||
1781 | #endif | 1781 | #endif |
1782 | 1782 | ||
1783 | #if ( QT_VERSION <= 230 ) && !defined(SINGLE_APP) | 1783 | #if ( QT_VERSION <= 230 ) && !defined(SINGLE_APP) |
1784 | #include <qwidgetlist.h> | 1784 | #include <qwidgetlist.h> |
1785 | #ifdef QWS | 1785 | #ifdef QWS |
1786 | #include <qgfx_qws.h> | 1786 | #include <qgfx_qws.h> |
1787 | extern QRect qt_maxWindowRect; | 1787 | extern QRect qt_maxWindowRect; |
1788 | void qt_setMaxWindowRect(const QRect& r ) | 1788 | void qt_setMaxWindowRect(const QRect& r ) |
1789 | { | 1789 | { |
1790 | qt_maxWindowRect = qt_screen->mapFromDevice( r, | 1790 | qt_maxWindowRect = qt_screen->mapFromDevice( r, |
1791 | qt_screen->mapToDevice( QSize( qt_screen->width(), qt_screen->height() ) ) ); | 1791 | qt_screen->mapToDevice( QSize( qt_screen->width(), qt_screen->height() ) ) ); |
1792 | // Re-resize any maximized windows | 1792 | // Re-resize any maximized windows |
1793 | QWidgetList* l = QApplication::topLevelWidgets(); | 1793 | QWidgetList* l = QApplication::topLevelWidgets(); |
1794 | if ( l ) { | 1794 | if ( l ) { |
1795 | QWidget * w = l->first(); | 1795 | QWidget * w = l->first(); |
1796 | while ( w ) { | 1796 | while ( w ) { |
1797 | if ( w->isVisible() && w->isMaximized() ) { | 1797 | if ( w->isVisible() && w->isMaximized() ) { |
1798 | w->showMaximized(); | 1798 | w->showMaximized(); |
1799 | } | 1799 | } |
1800 | w = l->next(); | 1800 | w = l->next(); |
1801 | } | 1801 | } |
1802 | delete l; | 1802 | delete l; |
1803 | } | 1803 | } |
1804 | } | 1804 | } |
1805 | #endif | 1805 | #endif |
1806 | #endif | 1806 | #endif |
diff --git a/library/storage.cpp b/library/storage.cpp index 3668d29..a7c466d 100644 --- a/library/storage.cpp +++ b/library/storage.cpp | |||
@@ -1,119 +1,119 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) Holger 'zecke' Freyther <freyther@kde.org> | 2 | ** Copyright (C) Holger 'zecke' Freyther <freyther@kde.org> |
3 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. | 3 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. |
4 | ** | 4 | ** |
5 | ** This file is part of Qtopia Environment. | 5 | ** This file is part of Qtopia Environment. |
6 | ** | 6 | ** |
7 | ** This file may be distributed and/or modified under the terms of the | 7 | ** This file may be distributed and/or modified under the terms of the |
8 | ** GNU General Public License version 2 as published by the Free Software | 8 | ** GNU General Public License version 2 as published by the Free Software |
9 | ** Foundation and appearing in the file LICENSE.GPL included in the | 9 | ** Foundation and appearing in the file LICENSE.GPL included in the |
10 | ** packaging of this file. | 10 | ** packaging of this file. |
11 | ** | 11 | ** |
12 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 12 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
13 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 13 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
14 | ** | 14 | ** |
15 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 15 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
16 | ** | 16 | ** |
17 | ** Contact info@trolltech.com if any conditions of this licensing are | 17 | ** Contact info@trolltech.com if any conditions of this licensing are |
18 | ** not clear to you. | 18 | ** not clear to you. |
19 | ** | 19 | ** |
20 | **********************************************************************/ | 20 | **********************************************************************/ |
21 | 21 | ||
22 | #include <qpe/storage.h> | 22 | #include <qpe/storage.h> |
23 | #ifdef QT_QWS_SHARP | 23 | #ifdef QT_QWS_SL5XXX |
24 | #include <qpe/custom.h> | 24 | #include <qpe/custom.h> |
25 | #endif | 25 | #endif |
26 | 26 | ||
27 | #include <qfile.h> | 27 | #include <qfile.h> |
28 | #include <qtimer.h> | 28 | #include <qtimer.h> |
29 | #include <qcopchannel_qws.h> | 29 | #include <qcopchannel_qws.h> |
30 | 30 | ||
31 | #include <stdio.h> | 31 | #include <stdio.h> |
32 | 32 | ||
33 | #if defined(_OS_LINUX_) || defined(Q_OS_LINUX) | 33 | #if defined(_OS_LINUX_) || defined(Q_OS_LINUX) |
34 | #include <sys/vfs.h> | 34 | #include <sys/vfs.h> |
35 | #include <mntent.h> | 35 | #include <mntent.h> |
36 | #endif | 36 | #endif |
37 | 37 | ||
38 | #include <qstringlist.h> | 38 | #include <qstringlist.h> |
39 | 39 | ||
40 | static bool isCF(const QString& m) | 40 | static bool isCF(const QString& m) |
41 | { | 41 | { |
42 | FILE* f = fopen("/var/run/stab", "r"); | 42 | FILE* f = fopen("/var/run/stab", "r"); |
43 | if (!f) f = fopen("/var/state/pcmcia/stab", "r"); | 43 | if (!f) f = fopen("/var/state/pcmcia/stab", "r"); |
44 | if (!f) f = fopen("/var/lib/pcmcia/stab", "r"); | 44 | if (!f) f = fopen("/var/lib/pcmcia/stab", "r"); |
45 | if ( f ) { | 45 | if ( f ) { |
46 | char line[1024]; | 46 | char line[1024]; |
47 | char devtype[80]; | 47 | char devtype[80]; |
48 | char devname[80]; | 48 | char devname[80]; |
49 | while ( fgets( line, 1024, f ) ) { | 49 | while ( fgets( line, 1024, f ) ) { |
50 | // 0 ide ide-cs 0 hda 3 0 | 50 | // 0 ide ide-cs 0 hda 3 0 |
51 | if ( sscanf(line,"%*d %s %*s %*s %s", devtype, devname )==2 ) | 51 | if ( sscanf(line,"%*d %s %*s %*s %s", devtype, devname )==2 ) |
52 | { | 52 | { |
53 | if ( QString(devtype) == "ide" && m.find(devname)>0 ) { | 53 | if ( QString(devtype) == "ide" && m.find(devname)>0 ) { |
54 | fclose(f); | 54 | fclose(f); |
55 | return TRUE; | 55 | return TRUE; |
56 | } | 56 | } |
57 | } | 57 | } |
58 | } | 58 | } |
59 | fclose(f); | 59 | fclose(f); |
60 | } | 60 | } |
61 | return FALSE; | 61 | return FALSE; |
62 | } | 62 | } |
63 | 63 | ||
64 | StorageInfo::StorageInfo( QObject *parent ) | 64 | StorageInfo::StorageInfo( QObject *parent ) |
65 | : QObject( parent ) | 65 | : QObject( parent ) |
66 | { | 66 | { |
67 | mFileSystems.setAutoDelete( TRUE ); | 67 | mFileSystems.setAutoDelete( TRUE ); |
68 | channel = new QCopChannel( "QPE/Card", this ); | 68 | channel = new QCopChannel( "QPE/Card", this ); |
69 | connect( channel, SIGNAL(received(const QCString &, const QByteArray &)), | 69 | connect( channel, SIGNAL(received(const QCString &, const QByteArray &)), |
70 | this, SLOT(cardMessage( const QCString &, const QByteArray &)) ); | 70 | this, SLOT(cardMessage( const QCString &, const QByteArray &)) ); |
71 | update(); | 71 | update(); |
72 | } | 72 | } |
73 | 73 | ||
74 | const FileSystem *StorageInfo::fileSystemOf( const QString &filename ) | 74 | const FileSystem *StorageInfo::fileSystemOf( const QString &filename ) |
75 | { | 75 | { |
76 | for (QListIterator<FileSystem> i(mFileSystems); i.current(); ++i) { | 76 | for (QListIterator<FileSystem> i(mFileSystems); i.current(); ++i) { |
77 | if ( filename.startsWith( (*i)->path() ) ) | 77 | if ( filename.startsWith( (*i)->path() ) ) |
78 | return (*i); | 78 | return (*i); |
79 | } | 79 | } |
80 | return 0; | 80 | return 0; |
81 | } | 81 | } |
82 | 82 | ||
83 | 83 | ||
84 | void StorageInfo::cardMessage( const QCString& msg, const QByteArray& ) | 84 | void StorageInfo::cardMessage( const QCString& msg, const QByteArray& ) |
85 | { | 85 | { |
86 | if ( msg == "mtabChanged()" ) | 86 | if ( msg == "mtabChanged()" ) |
87 | update(); | 87 | update(); |
88 | } | 88 | } |
89 | // cause of the lack of a d pointer we need | 89 | // cause of the lack of a d pointer we need |
90 | // to store informations in a config file :( | 90 | // to store informations in a config file :( |
91 | void StorageInfo::update() | 91 | void StorageInfo::update() |
92 | { | 92 | { |
93 | //qDebug("StorageInfo::updating"); | 93 | //qDebug("StorageInfo::updating"); |
94 | #if defined(_OS_LINUX_) || defined(Q_OS_LINUX) | 94 | #if defined(_OS_LINUX_) || defined(Q_OS_LINUX) |
95 | struct mntent *me; | 95 | struct mntent *me; |
96 | FILE *mntfp = setmntent( "/etc/mtab", "r" ); | 96 | FILE *mntfp = setmntent( "/etc/mtab", "r" ); |
97 | 97 | ||
98 | QStringList curdisks; | 98 | QStringList curdisks; |
99 | QStringList curopts; | 99 | QStringList curopts; |
100 | QStringList curfs; | 100 | QStringList curfs; |
101 | bool rebuild = FALSE; | 101 | bool rebuild = FALSE; |
102 | int n=0; | 102 | int n=0; |
103 | if ( mntfp ) { | 103 | if ( mntfp ) { |
104 | while ( (me = getmntent( mntfp )) != 0 ) { | 104 | while ( (me = getmntent( mntfp )) != 0 ) { |
105 | QString fs = me->mnt_fsname; | 105 | QString fs = me->mnt_fsname; |
106 | if ( fs.left(7)=="/dev/hd" || fs.left(7)=="/dev/sd" | 106 | if ( fs.left(7)=="/dev/hd" || fs.left(7)=="/dev/sd" |
107 | || fs.left(8)=="/dev/mtd" || fs.left(9) == "/dev/mmcd" | 107 | || fs.left(8)=="/dev/mtd" || fs.left(9) == "/dev/mmcd" |
108 | || fs.left( 14 ) == "/dev/mmc/part1" | 108 | || fs.left( 14 ) == "/dev/mmc/part1" |
109 | || fs.left(5)=="tmpfs" ) | 109 | || fs.left(5)=="tmpfs" ) |
110 | { | 110 | { |
111 | n++; | 111 | n++; |
112 | curdisks.append(fs); | 112 | curdisks.append(fs); |
113 | curopts.append( me->mnt_opts ); | 113 | curopts.append( me->mnt_opts ); |
114 | //qDebug("-->fs %s opts %s", fs.latin1(), me->mnt_opts ); | 114 | //qDebug("-->fs %s opts %s", fs.latin1(), me->mnt_opts ); |
115 | curfs.append( me->mnt_dir ); | 115 | curfs.append( me->mnt_dir ); |
116 | bool found = FALSE; | 116 | bool found = FALSE; |
117 | for (QListIterator<FileSystem> i(mFileSystems); i.current(); ++i) { | 117 | for (QListIterator<FileSystem> i(mFileSystems); i.current(); ++i) { |
118 | if ( (*i)->disk() == fs ) { | 118 | if ( (*i)->disk() == fs ) { |
119 | found = TRUE; | 119 | found = TRUE; |
diff --git a/mkspecs/qws/linux-sharp-g++/qmake.conf b/mkspecs/qws/linux-sharp-g++/qmake.conf index 06bf445..814b4fc 100644 --- a/mkspecs/qws/linux-sharp-g++/qmake.conf +++ b/mkspecs/qws/linux-sharp-g++/qmake.conf | |||
@@ -1,76 +1,76 @@ | |||
1 | # | 1 | # |
2 | # $Id$ | 2 | # $Id$ |
3 | # | 3 | # |
4 | # qmake configuration for linux-g++ using the arm-linux-g++ crosscompiler | 4 | # qmake configuration for linux-g++ using the arm-linux-g++ crosscompiler |
5 | # | 5 | # |
6 | 6 | ||
7 | MAKEFILE_GENERATOR= UNIX | 7 | MAKEFILE_GENERATOR= UNIX |
8 | TEMPLATE = app | 8 | TEMPLATE = app |
9 | CONFIG += qt warn_on release | 9 | CONFIG += qt warn_on release |
10 | 10 | ||
11 | QMAKE_CC = arm-linux-gcc | 11 | QMAKE_CC = arm-linux-gcc |
12 | QMAKE_LEX = flex | 12 | QMAKE_LEX = flex |
13 | QMAKE_LEXFLAGS = | 13 | QMAKE_LEXFLAGS = |
14 | QMAKE_YACC = yacc | 14 | QMAKE_YACC = yacc |
15 | QMAKE_YACCFLAGS = -d | 15 | QMAKE_YACCFLAGS = -d |
16 | QMAKE_CFLAGS = -pipe $(CFLAGS_EXTRA) | 16 | QMAKE_CFLAGS = -pipe $(CFLAGS_EXTRA) |
17 | QMAKE_CFLAGS_WARN_ON= -Wall -W | 17 | QMAKE_CFLAGS_WARN_ON= -Wall -W |
18 | QMAKE_CFLAGS_WARN_OFF= | 18 | QMAKE_CFLAGS_WARN_OFF= |
19 | QMAKE_CFLAGS_RELEASE= $(if $(CFLAGS_RELEASE),$(CFLAGS_RELEASE), -O2) | 19 | QMAKE_CFLAGS_RELEASE= $(if $(CFLAGS_RELEASE),$(CFLAGS_RELEASE), -O2) |
20 | QMAKE_CFLAGS_DEBUG= -g | 20 | QMAKE_CFLAGS_DEBUG= -g |
21 | QMAKE_CFLAGS_SHLIB= -fPIC | 21 | QMAKE_CFLAGS_SHLIB= -fPIC |
22 | QMAKE_CFLAGS_YACC= -Wno-unused -Wno-parentheses | 22 | QMAKE_CFLAGS_YACC= -Wno-unused -Wno-parentheses |
23 | QMAKE_CFLAGS_THREAD= -D_REENTRANT | 23 | QMAKE_CFLAGS_THREAD= -D_REENTRANT |
24 | 24 | ||
25 | QMAKE_CXX = arm-linux-g++ -DQT_QWS_SHARP -DQT_QWS_EBX | 25 | QMAKE_CXX = arm-linux-g++ -DQT_QWS_SL5XXX -DQT_QWS_SHARP -DQT_QWS_EBX -DQT_QWS_CUSTOM |
26 | QMAKE_CXXFLAGS = $$QMAKE_CFLAGS -DQWS -fno-exceptions -fno-rtti $(CXXFLAGS_EXTRA) | 26 | QMAKE_CXXFLAGS = $$QMAKE_CFLAGS -DQWS -fno-exceptions -fno-rtti $(CXXFLAGS_EXTRA) |
27 | QMAKE_CXXFLAGS_WARN_ON= $$QMAKE_CFLAGS_WARN_ON | 27 | QMAKE_CXXFLAGS_WARN_ON= $$QMAKE_CFLAGS_WARN_ON |
28 | QMAKE_CXXFLAGS_WARN_OFF= $$QMAKE_CFLAGS_WARN_OFF | 28 | QMAKE_CXXFLAGS_WARN_OFF= $$QMAKE_CFLAGS_WARN_OFF |
29 | QMAKE_CXXFLAGS_RELEASE= $$QMAKE_CFLAGS_RELEASE | 29 | QMAKE_CXXFLAGS_RELEASE= $$QMAKE_CFLAGS_RELEASE |
30 | QMAKE_CXXFLAGS_DEBUG= $$QMAKE_CFLAGS_DEBUG | 30 | QMAKE_CXXFLAGS_DEBUG= $$QMAKE_CFLAGS_DEBUG |
31 | QMAKE_CXXFLAGS_SHLIB= $$QMAKE_CFLAGS_SHLIB | 31 | QMAKE_CXXFLAGS_SHLIB= $$QMAKE_CFLAGS_SHLIB |
32 | QMAKE_CXXFLAGS_YACC= $$QMAKE_CFLAGS_YACC | 32 | QMAKE_CXXFLAGS_YACC= $$QMAKE_CFLAGS_YACC |
33 | QMAKE_CXXFLAGS_THREAD= $$QMAKE_CFLAGS_THREAD | 33 | QMAKE_CXXFLAGS_THREAD= $$QMAKE_CFLAGS_THREAD |
34 | 34 | ||
35 | QMAKE_INCDIR = | 35 | QMAKE_INCDIR = |
36 | QMAKE_LIBDIR = | 36 | QMAKE_LIBDIR = |
37 | QMAKE_INCDIR_X11= | 37 | QMAKE_INCDIR_X11= |
38 | QMAKE_LIBDIR_X11= | 38 | QMAKE_LIBDIR_X11= |
39 | QMAKE_INCDIR_QT = $(QTDIR)/include | 39 | QMAKE_INCDIR_QT = $(QTDIR)/include |
40 | QMAKE_LIBDIR_QT = $(QTDIR)/lib | 40 | QMAKE_LIBDIR_QT = $(QTDIR)/lib |
41 | QMAKE_INCDIR_OPENGL= /usr/X11R6/include | 41 | QMAKE_INCDIR_OPENGL= /usr/X11R6/include |
42 | QMAKE_LIBDIR_OPENGL= /usr/X11R6/lib | 42 | QMAKE_LIBDIR_OPENGL= /usr/X11R6/lib |
43 | 43 | ||
44 | QMAKE_LINK = arm-linux-gcc | 44 | QMAKE_LINK = arm-linux-gcc |
45 | QMAKE_LINK_SHLIB= arm-linux-gcc | 45 | QMAKE_LINK_SHLIB= arm-linux-gcc |
46 | QMAKE_LFLAGS = $(LFLAGS_EXTRA) | 46 | QMAKE_LFLAGS = $(LFLAGS_EXTRA) |
47 | QMAKE_LFLAGS_RELEASE= | 47 | QMAKE_LFLAGS_RELEASE= |
48 | QMAKE_LFLAGS_DEBUG= | 48 | QMAKE_LFLAGS_DEBUG= |
49 | QMAKE_LFLAGS_SHLIB = -shared | 49 | QMAKE_LFLAGS_SHLIB = -shared |
50 | QMAKE_LFLAGS_PLUGIN = $$QMAKE_LFLAGS_SHLIB | 50 | QMAKE_LFLAGS_PLUGIN = $$QMAKE_LFLAGS_SHLIB |
51 | QMAKE_LFLAGS_SONAME = -Wl,-soname, | 51 | QMAKE_LFLAGS_SONAME = -Wl,-soname, |
52 | QMAKE_LFLAGS_THREAD = | 52 | QMAKE_LFLAGS_THREAD = |
53 | QMAKE_RPATH = -Wl,-rpath, | 53 | QMAKE_RPATH = -Wl,-rpath, |
54 | 54 | ||
55 | QMAKE_LIBS = $(LIBS_EXTRA) | 55 | QMAKE_LIBS = $(LIBS_EXTRA) |
56 | QMAKE_LIBS_DYNLOAD = -ldl | 56 | QMAKE_LIBS_DYNLOAD = -ldl |
57 | QMAKE_LIBS_X11 = | 57 | QMAKE_LIBS_X11 = |
58 | QMAKE_LIBS_X11SM= | 58 | QMAKE_LIBS_X11SM= |
59 | QMAKE_LIBS_QT = -lqte | 59 | QMAKE_LIBS_QT = -lqte |
60 | QMAKE_LIBS_QT_THREAD = -lqte-mt | 60 | QMAKE_LIBS_QT_THREAD = -lqte-mt |
61 | QMAKE_LIBS_QT_OPENGL= -lqgl | 61 | QMAKE_LIBS_QT_OPENGL= -lqgl |
62 | QMAKE_LIBS_THREAD = -lpthread | 62 | QMAKE_LIBS_THREAD = -lpthread |
63 | 63 | ||
64 | QMAKE_MOC = $(QTDIR)/bin/moc | 64 | QMAKE_MOC = $(QTDIR)/bin/moc |
65 | QMAKE_UIC = $(QTDIR)/bin/uic | 65 | QMAKE_UIC = $(QTDIR)/bin/uic |
66 | 66 | ||
67 | QMAKE_AR = ar cqs | 67 | QMAKE_AR = ar cqs |
68 | QMAKE_RANLIB = | 68 | QMAKE_RANLIB = |
69 | 69 | ||
70 | QMAKE_TAR = tar -cf | 70 | QMAKE_TAR = tar -cf |
71 | QMAKE_GZIP = gzip -9f | 71 | QMAKE_GZIP = gzip -9f |
72 | 72 | ||
73 | QMAKE_COPY = cp -f | 73 | QMAKE_COPY = cp -f |
74 | QMAKE_MOVE = mv -f | 74 | QMAKE_MOVE = mv -f |
75 | QMAKE_DEL_FILE = rm -f | 75 | QMAKE_DEL_FILE = rm -f |
76 | QMAKE_DEL_DIR = rmdir | 76 | QMAKE_DEL_DIR = rmdir |
diff --git a/noncore/multimedia/opieplayer2/mediaplayer.cpp b/noncore/multimedia/opieplayer2/mediaplayer.cpp index 0ec6fad..d4396d2 100644 --- a/noncore/multimedia/opieplayer2/mediaplayer.cpp +++ b/noncore/multimedia/opieplayer2/mediaplayer.cpp | |||
@@ -200,212 +200,212 @@ void MediaPlayer::stopChangingVolume() { | |||
200 | onScreenDisplayVolume = 0; | 200 | onScreenDisplayVolume = 0; |
201 | int w=0; | 201 | int w=0; |
202 | int h=0; | 202 | int h=0; |
203 | if( !xineControl()->hasVideo() ) { | 203 | if( !xineControl()->hasVideo() ) { |
204 | w = audioUI()->width(); | 204 | w = audioUI()->width(); |
205 | h = audioUI()->height(); | 205 | h = audioUI()->height(); |
206 | audioUI()->repaint( ( w - 200 ) / 2, h - yoff, 200 + 9, 70, FALSE ); | 206 | audioUI()->repaint( ( w - 200 ) / 2, h - yoff, 200 + 9, 70, FALSE ); |
207 | } else { | 207 | } else { |
208 | w = videoUI()->width(); | 208 | w = videoUI()->width(); |
209 | h = videoUI()->height(); | 209 | h = videoUI()->height(); |
210 | videoUI()->repaint( ( w - 200 ) / 2, h - yoff, 200 + 9, 70, FALSE ); | 210 | videoUI()->repaint( ( w - 200 ) / 2, h - yoff, 200 + 9, 70, FALSE ); |
211 | } | 211 | } |
212 | } | 212 | } |
213 | 213 | ||
214 | 214 | ||
215 | void MediaPlayer::timerEvent( QTimerEvent * ) { | 215 | void MediaPlayer::timerEvent( QTimerEvent * ) { |
216 | if ( volumeDirection == +1 ) { | 216 | if ( volumeDirection == +1 ) { |
217 | volControl->incVol( 2 ); | 217 | volControl->incVol( 2 ); |
218 | } else if ( volumeDirection == -1 ) { | 218 | } else if ( volumeDirection == -1 ) { |
219 | volControl->decVol( 2 ); | 219 | volControl->decVol( 2 ); |
220 | } | 220 | } |
221 | 221 | ||
222 | 222 | ||
223 | // TODO FIXME | 223 | // TODO FIXME |
224 | // huh?? | 224 | // huh?? |
225 | unsigned int v= 0; | 225 | unsigned int v= 0; |
226 | v = volControl->volume(); | 226 | v = volControl->volume(); |
227 | v = v / 10; | 227 | v = v / 10; |
228 | 228 | ||
229 | if ( drawnOnScreenDisplay && onScreenDisplayVolume == v ) { | 229 | if ( drawnOnScreenDisplay && onScreenDisplayVolume == v ) { |
230 | return; | 230 | return; |
231 | } | 231 | } |
232 | 232 | ||
233 | int w=0; int h=0; | 233 | int w=0; int h=0; |
234 | if( !xineControl()->hasVideo() ) { | 234 | if( !xineControl()->hasVideo() ) { |
235 | w = audioUI()->width(); | 235 | w = audioUI()->width(); |
236 | h = audioUI()->height(); | 236 | h = audioUI()->height(); |
237 | 237 | ||
238 | if ( drawnOnScreenDisplay ) { | 238 | if ( drawnOnScreenDisplay ) { |
239 | if ( onScreenDisplayVolume > v ) { | 239 | if ( onScreenDisplayVolume > v ) { |
240 | audioUI()->repaint( ( w - 200 ) / 2 + v * 20 + 0, h - yoff + 40, ( onScreenDisplayVolume - v ) * 20 + 9, 30, FALSE ); | 240 | audioUI()->repaint( ( w - 200 ) / 2 + v * 20 + 0, h - yoff + 40, ( onScreenDisplayVolume - v ) * 20 + 9, 30, FALSE ); |
241 | } | 241 | } |
242 | } | 242 | } |
243 | drawnOnScreenDisplay = TRUE; | 243 | drawnOnScreenDisplay = TRUE; |
244 | onScreenDisplayVolume = v; | 244 | onScreenDisplayVolume = v; |
245 | QPainter p( audioUI() ); | 245 | QPainter p( audioUI() ); |
246 | p.setPen( QColor( 0x10, 0xD0, 0x10 ) ); | 246 | p.setPen( QColor( 0x10, 0xD0, 0x10 ) ); |
247 | p.setBrush( QColor( 0x10, 0xD0, 0x10 ) ); | 247 | p.setBrush( QColor( 0x10, 0xD0, 0x10 ) ); |
248 | 248 | ||
249 | QFont f; | 249 | QFont f; |
250 | f.setPixelSize( 20 ); | 250 | f.setPixelSize( 20 ); |
251 | f.setBold( TRUE ); | 251 | f.setBold( TRUE ); |
252 | p.setFont( f ); | 252 | p.setFont( f ); |
253 | p.drawText( (w - 200) / 2, h - yoff + 20, tr("Volume") ); | 253 | p.drawText( (w - 200) / 2, h - yoff + 20, tr("Volume") ); |
254 | 254 | ||
255 | for ( unsigned int i = 0; i < 10; i++ ) { | 255 | for ( unsigned int i = 0; i < 10; i++ ) { |
256 | if ( v > i ) { | 256 | if ( v > i ) { |
257 | p.drawRect( ( w - 200 ) / 2 + i * 20 + 0, h - yoff + 40, 9, 30 ); | 257 | p.drawRect( ( w - 200 ) / 2 + i * 20 + 0, h - yoff + 40, 9, 30 ); |
258 | } else { | 258 | } else { |
259 | p.drawRect( ( w - 200 ) / 2 + i * 20 + 3, h - yoff + 50, 3, 10 ); | 259 | p.drawRect( ( w - 200 ) / 2 + i * 20 + 3, h - yoff + 50, 3, 10 ); |
260 | } | 260 | } |
261 | } | 261 | } |
262 | } else { | 262 | } else { |
263 | w = videoUI()->width(); | 263 | w = videoUI()->width(); |
264 | h = videoUI()->height(); | 264 | h = videoUI()->height(); |
265 | 265 | ||
266 | if ( drawnOnScreenDisplay ) { | 266 | if ( drawnOnScreenDisplay ) { |
267 | if ( onScreenDisplayVolume > v ) { | 267 | if ( onScreenDisplayVolume > v ) { |
268 | videoUI()->repaint( (w - 200) / 2 + v * 20 + 0, h - yoff + 40, ( onScreenDisplayVolume - v ) * 20 + 9, 30, FALSE ); | 268 | videoUI()->repaint( (w - 200) / 2 + v * 20 + 0, h - yoff + 40, ( onScreenDisplayVolume - v ) * 20 + 9, 30, FALSE ); |
269 | } | 269 | } |
270 | } | 270 | } |
271 | drawnOnScreenDisplay = TRUE; | 271 | drawnOnScreenDisplay = TRUE; |
272 | onScreenDisplayVolume = v; | 272 | onScreenDisplayVolume = v; |
273 | QPainter p( videoUI() ); | 273 | QPainter p( videoUI() ); |
274 | p.setPen( QColor( 0x10, 0xD0, 0x10 ) ); | 274 | p.setPen( QColor( 0x10, 0xD0, 0x10 ) ); |
275 | p.setBrush( QColor( 0x10, 0xD0, 0x10 ) ); | 275 | p.setBrush( QColor( 0x10, 0xD0, 0x10 ) ); |
276 | 276 | ||
277 | QFont f; | 277 | QFont f; |
278 | f.setPixelSize( 20 ); | 278 | f.setPixelSize( 20 ); |
279 | f.setBold( TRUE ); | 279 | f.setBold( TRUE ); |
280 | p.setFont( f ); | 280 | p.setFont( f ); |
281 | p.drawText( (w - 200) / 2, h - yoff + 20, tr( "Volume" ) ); | 281 | p.drawText( (w - 200) / 2, h - yoff + 20, tr( "Volume" ) ); |
282 | 282 | ||
283 | for ( unsigned int i = 0; i < 10; i++ ) { | 283 | for ( unsigned int i = 0; i < 10; i++ ) { |
284 | if ( v > i ) { | 284 | if ( v > i ) { |
285 | p.drawRect( (w - 200) / 2 + i * 20 + 0, h - yoff + 40, 9, 30 ); | 285 | p.drawRect( (w - 200) / 2 + i * 20 + 0, h - yoff + 40, 9, 30 ); |
286 | } else { | 286 | } else { |
287 | p.drawRect( (w - 200) / 2 + i * 20 + 3, h - yoff + 50, 3, 10 ); | 287 | p.drawRect( (w - 200) / 2 + i * 20 + 3, h - yoff + 50, 3, 10 ); |
288 | } | 288 | } |
289 | } | 289 | } |
290 | } | 290 | } |
291 | } | 291 | } |
292 | 292 | ||
293 | 293 | ||
294 | void MediaPlayer::blank( bool b ) { | 294 | void MediaPlayer::blank( bool b ) { |
295 | fd=open("/dev/fb0",O_RDWR); | 295 | fd=open("/dev/fb0",O_RDWR); |
296 | #ifdef QT_QWS_EBX | 296 | #ifdef QT_QWS_SL5XXX |
297 | fl= open( "/dev/fl", O_RDWR ); | 297 | fl= open( "/dev/fl", O_RDWR ); |
298 | #endif | 298 | #endif |
299 | if (fd != -1) { | 299 | if (fd != -1) { |
300 | if ( b ) { | 300 | if ( b ) { |
301 | qDebug("do blanking"); | 301 | qDebug("do blanking"); |
302 | #ifdef QT_QWS_EBX | 302 | #ifdef QT_QWS_SL5XXX |
303 | ioctl( fd, FBIOBLANK, 1 ); | 303 | ioctl( fd, FBIOBLANK, 1 ); |
304 | if(fl !=-1) { | 304 | if(fl !=-1) { |
305 | ioctl( fl, 2 ); | 305 | ioctl( fl, 2 ); |
306 | ::close(fl); | 306 | ::close(fl); |
307 | } | 307 | } |
308 | #else | 308 | #else |
309 | ioctl( fd, FBIOBLANK, 3 ); | 309 | ioctl( fd, FBIOBLANK, 3 ); |
310 | #endif | 310 | #endif |
311 | isBlanked = TRUE; | 311 | isBlanked = TRUE; |
312 | } else { | 312 | } else { |
313 | qDebug("do unblanking"); | 313 | qDebug("do unblanking"); |
314 | ioctl( fd, FBIOBLANK, 0); | 314 | ioctl( fd, FBIOBLANK, 0); |
315 | #ifdef QT_QWS_EBX | 315 | #ifdef QT_QWS_SL5XXX |
316 | if(fl != -1) { | 316 | if(fl != -1) { |
317 | ioctl( fl, 1); | 317 | ioctl( fl, 1); |
318 | ::close(fl); | 318 | ::close(fl); |
319 | } | 319 | } |
320 | #endif | 320 | #endif |
321 | isBlanked = FALSE; | 321 | isBlanked = FALSE; |
322 | } | 322 | } |
323 | close( fd ); | 323 | close( fd ); |
324 | } else { | 324 | } else { |
325 | qDebug("<< /dev/fb0 could not be opened >>"); | 325 | qDebug("<< /dev/fb0 could not be opened >>"); |
326 | } | 326 | } |
327 | } | 327 | } |
328 | 328 | ||
329 | void MediaPlayer::keyReleaseEvent( QKeyEvent *e) { | 329 | void MediaPlayer::keyReleaseEvent( QKeyEvent *e) { |
330 | switch ( e->key() ) { | 330 | switch ( e->key() ) { |
331 | ////////////////////////////// Zaurus keys | 331 | ////////////////////////////// Zaurus keys |
332 | case Key_Home: | 332 | case Key_Home: |
333 | break; | 333 | break; |
334 | case Key_F9: //activity | 334 | case Key_F9: //activity |
335 | break; | 335 | break; |
336 | case Key_F10: //contacts | 336 | case Key_F10: //contacts |
337 | break; | 337 | break; |
338 | case Key_F11: //menu | 338 | case Key_F11: //menu |
339 | break; | 339 | break; |
340 | case Key_F12: //home | 340 | case Key_F12: //home |
341 | qDebug("Blank here"); | 341 | qDebug("Blank here"); |
342 | // mediaPlayerState->toggleBlank(); | 342 | // mediaPlayerState->toggleBlank(); |
343 | break; | 343 | break; |
344 | case Key_F13: //mail | 344 | case Key_F13: //mail |
345 | qDebug("Blank here"); | 345 | qDebug("Blank here"); |
346 | // mediaPlayerState->toggleBlank(); | 346 | // mediaPlayerState->toggleBlank(); |
347 | break; | 347 | break; |
348 | } | 348 | } |
349 | } | 349 | } |
350 | 350 | ||
351 | void MediaPlayer::cleanUp() {// this happens on closing | 351 | void MediaPlayer::cleanUp() {// this happens on closing |
352 | Config cfg( "OpiePlayer" ); | 352 | Config cfg( "OpiePlayer" ); |
353 | mediaPlayerState.writeConfig( cfg ); | 353 | mediaPlayerState.writeConfig( cfg ); |
354 | playList.writeDefaultPlaylist( ); | 354 | playList.writeDefaultPlaylist( ); |
355 | 355 | ||
356 | // QPEApplication::grabKeyboard(); | 356 | // QPEApplication::grabKeyboard(); |
357 | // QPEApplication::ungrabKeyboard(); | 357 | // QPEApplication::ungrabKeyboard(); |
358 | } | 358 | } |
359 | 359 | ||
360 | void MediaPlayer::recreateAudioAndVideoWidgets() const | 360 | void MediaPlayer::recreateAudioAndVideoWidgets() const |
361 | { | 361 | { |
362 | delete m_skinLoader; | 362 | delete m_skinLoader; |
363 | 363 | ||
364 | delete m_xineControl; | 364 | delete m_xineControl; |
365 | delete m_audioUI; | 365 | delete m_audioUI; |
366 | delete m_videoUI; | 366 | delete m_videoUI; |
367 | m_audioUI = new AudioWidget( playList, mediaPlayerState, 0, "audioUI" ); | 367 | m_audioUI = new AudioWidget( playList, mediaPlayerState, 0, "audioUI" ); |
368 | m_videoUI = new VideoWidget( playList, mediaPlayerState, 0, "videoUI" ); | 368 | m_videoUI = new VideoWidget( playList, mediaPlayerState, 0, "videoUI" ); |
369 | 369 | ||
370 | connect( m_audioUI, SIGNAL( moreClicked() ), this, SLOT( startIncreasingVolume() ) ); | 370 | connect( m_audioUI, SIGNAL( moreClicked() ), this, SLOT( startIncreasingVolume() ) ); |
371 | connect( m_audioUI, SIGNAL( lessClicked() ), this, SLOT( startDecreasingVolume() ) ); | 371 | connect( m_audioUI, SIGNAL( lessClicked() ), this, SLOT( startDecreasingVolume() ) ); |
372 | connect( m_audioUI, SIGNAL( moreReleased() ), this, SLOT( stopChangingVolume() ) ); | 372 | connect( m_audioUI, SIGNAL( moreReleased() ), this, SLOT( stopChangingVolume() ) ); |
373 | connect( m_audioUI, SIGNAL( lessReleased() ), this, SLOT( stopChangingVolume() ) ); | 373 | connect( m_audioUI, SIGNAL( lessReleased() ), this, SLOT( stopChangingVolume() ) ); |
374 | 374 | ||
375 | connect( m_videoUI, SIGNAL( moreClicked() ), this, SLOT( startIncreasingVolume() ) ); | 375 | connect( m_videoUI, SIGNAL( moreClicked() ), this, SLOT( startIncreasingVolume() ) ); |
376 | connect( m_videoUI, SIGNAL( lessClicked() ), this, SLOT( startDecreasingVolume() ) ); | 376 | connect( m_videoUI, SIGNAL( lessClicked() ), this, SLOT( startDecreasingVolume() ) ); |
377 | connect( m_videoUI, SIGNAL( moreReleased() ), this, SLOT( stopChangingVolume() ) ); | 377 | connect( m_videoUI, SIGNAL( moreReleased() ), this, SLOT( stopChangingVolume() ) ); |
378 | connect( m_videoUI, SIGNAL( lessReleased() ), this, SLOT( stopChangingVolume() ) ); | 378 | connect( m_videoUI, SIGNAL( lessReleased() ), this, SLOT( stopChangingVolume() ) ); |
379 | 379 | ||
380 | if ( !xine ) | 380 | if ( !xine ) |
381 | xine = new XINE::Lib( XINE::Lib::InitializeImmediately ); | 381 | xine = new XINE::Lib( XINE::Lib::InitializeImmediately ); |
382 | 382 | ||
383 | m_xineControl = new XineControl( xine, m_videoUI->vidWidget(), mediaPlayerState ); | 383 | m_xineControl = new XineControl( xine, m_videoUI->vidWidget(), mediaPlayerState ); |
384 | 384 | ||
385 | xine = 0; | 385 | xine = 0; |
386 | } | 386 | } |
387 | 387 | ||
388 | AudioWidget *MediaPlayer::audioUI() const | 388 | AudioWidget *MediaPlayer::audioUI() const |
389 | { | 389 | { |
390 | if ( !m_audioUI ) | 390 | if ( !m_audioUI ) |
391 | recreateAudioAndVideoWidgets(); | 391 | recreateAudioAndVideoWidgets(); |
392 | return m_audioUI; | 392 | return m_audioUI; |
393 | } | 393 | } |
394 | 394 | ||
395 | VideoWidget *MediaPlayer::videoUI() const | 395 | VideoWidget *MediaPlayer::videoUI() const |
396 | { | 396 | { |
397 | if ( !m_videoUI ) | 397 | if ( !m_videoUI ) |
398 | recreateAudioAndVideoWidgets(); | 398 | recreateAudioAndVideoWidgets(); |
399 | return m_videoUI; | 399 | return m_videoUI; |
400 | } | 400 | } |
401 | 401 | ||
402 | XineControl *MediaPlayer::xineControl() const | 402 | XineControl *MediaPlayer::xineControl() const |
403 | { | 403 | { |
404 | if ( !m_xineControl ) | 404 | if ( !m_xineControl ) |
405 | recreateAudioAndVideoWidgets(); | 405 | recreateAudioAndVideoWidgets(); |
406 | return m_xineControl; | 406 | return m_xineControl; |
407 | } | 407 | } |
408 | 408 | ||
409 | void MediaPlayer::reloadSkins() | 409 | void MediaPlayer::reloadSkins() |
410 | { | 410 | { |
411 | audioUI()->loadSkin(); | 411 | audioUI()->loadSkin(); |
diff --git a/noncore/settings/sound/soundsettings.cpp b/noncore/settings/sound/soundsettings.cpp index dd341c0..afcdd49 100644 --- a/noncore/settings/sound/soundsettings.cpp +++ b/noncore/settings/sound/soundsettings.cpp | |||
@@ -1,168 +1,168 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of Qtopia Environment. | 4 | ** This file is part of Qtopia Environment. |
5 | ** | 5 | ** |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | ** This file may be distributed and/or modified under the terms of the |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | ** GNU General Public License version 2 as published by the Free Software |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | ** Foundation and appearing in the file LICENSE.GPL included in the |
9 | ** packaging of this file. | 9 | ** packaging of this file. |
10 | ** | 10 | ** |
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
13 | ** | 13 | ** |
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
15 | ** | 15 | ** |
16 | ** Contact info@trolltech.com if any conditions of this licensing are | 16 | ** Contact info@trolltech.com if any conditions of this licensing are |
17 | ** not clear to you. | 17 | ** not clear to you. |
18 | ** | 18 | ** |
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | // parts copyright 2002 L.J. Potter | 20 | // parts copyright 2002 L.J. Potter |
21 | 21 | ||
22 | #include "soundsettings.h" | 22 | #include "soundsettings.h" |
23 | 23 | ||
24 | #include <qpe/qpeapplication.h> | 24 | #include <qpe/qpeapplication.h> |
25 | #include <qpe/config.h> | 25 | #include <qpe/config.h> |
26 | #include <qpe/qcopenvelope_qws.h> | 26 | #include <qpe/qcopenvelope_qws.h> |
27 | #include <qpe/storage.h> | 27 | #include <qpe/storage.h> |
28 | 28 | ||
29 | #include <qmessagebox.h> | 29 | #include <qmessagebox.h> |
30 | #include <qapplication.h> | 30 | #include <qapplication.h> |
31 | #include <qslider.h> | 31 | #include <qslider.h> |
32 | #include <qcheckbox.h> | 32 | #include <qcheckbox.h> |
33 | #include <qlineedit.h> | 33 | #include <qlineedit.h> |
34 | #include <qcombobox.h> | 34 | #include <qcombobox.h> |
35 | #include <qlabel.h> | 35 | #include <qlabel.h> |
36 | 36 | ||
37 | #include <sys/utsname.h> | 37 | #include <sys/utsname.h> |
38 | #include <sys/time.h> | 38 | #include <sys/time.h> |
39 | #include <sys/types.h> | 39 | #include <sys/types.h> |
40 | #include <unistd.h> | 40 | #include <unistd.h> |
41 | #include <stdio.h> | 41 | #include <stdio.h> |
42 | #include <sys/stat.h> | 42 | #include <sys/stat.h> |
43 | 43 | ||
44 | 44 | ||
45 | SoundSettings::SoundSettings( QWidget* parent, const char* objname, WFlags fl ) | 45 | SoundSettings::SoundSettings( QWidget* parent, const char* objname, WFlags fl ) |
46 | : SoundSettingsBase( parent, objname, TRUE, fl ) | 46 | : SoundSettingsBase( parent, objname, TRUE, fl ) |
47 | { | 47 | { |
48 | keyReset=FALSE; | 48 | keyReset=FALSE; |
49 | noWarning=false; | 49 | noWarning=false; |
50 | Config config( "qpe"); | 50 | Config config( "qpe"); |
51 | config.setGroup( "Volume" ); | 51 | config.setGroup( "Volume" ); |
52 | Config cfg("Vmemo"); | 52 | Config cfg("Vmemo"); |
53 | connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) ); | 53 | connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) ); |
54 | AlertCheckBox->setChecked(cfg.readBoolEntry("Alert")); | 54 | AlertCheckBox->setChecked(cfg.readBoolEntry("Alert")); |
55 | 55 | ||
56 | cfg.setGroup("Record"); | 56 | cfg.setGroup("Record"); |
57 | int rate=config.readNumEntry("SampleRate", 22050); | 57 | int rate=config.readNumEntry("SampleRate", 22050); |
58 | if(rate == 8000) | 58 | if(rate == 8000) |
59 | sampleRate->setCurrentItem(0); | 59 | sampleRate->setCurrentItem(0); |
60 | else if(rate == 11025) | 60 | else if(rate == 11025) |
61 | sampleRate->setCurrentItem(1); | 61 | sampleRate->setCurrentItem(1); |
62 | else if(rate == 22050) | 62 | else if(rate == 22050) |
63 | sampleRate->setCurrentItem(2); | 63 | sampleRate->setCurrentItem(2); |
64 | else if(rate == 33075) | 64 | else if(rate == 33075) |
65 | sampleRate->setCurrentItem(3); | 65 | sampleRate->setCurrentItem(3); |
66 | else if(rate==44100) | 66 | else if(rate==44100) |
67 | sampleRate->setCurrentItem(4); | 67 | sampleRate->setCurrentItem(4); |
68 | 68 | ||
69 | stereoCheckBox->setChecked(cfg.readNumEntry("Stereo", 0)); | 69 | stereoCheckBox->setChecked(cfg.readNumEntry("Stereo", 0)); |
70 | //TODO hide if zaurus- mono only | 70 | //TODO hide if zaurus- mono only |
71 | 71 | ||
72 | #if defined(QT_QWS_IPAQ) || defined(QT_QWS_EBX) | 72 | #if defined(QT_QWS_IPAQ) || defined(QT_QWS_SL5XXX) |
73 | //since ipaq and zaurus have particular | 73 | //since ipaq and zaurus have particular |
74 | //devices | 74 | //devices |
75 | bool systemZaurus=FALSE; | 75 | bool systemZaurus=FALSE; |
76 | struct utsname name; /* check for embedix kernel running on the zaurus*/ | 76 | struct utsname name; /* check for embedix kernel running on the zaurus*/ |
77 | if (uname(&name) != -1) {// TODO change this here,... | 77 | if (uname(&name) != -1) {// TODO change this here,... |
78 | QString release=name.release; | 78 | QString release=name.release; |
79 | if( release.find("embedix",0,TRUE) != -1) { | 79 | if( release.find("embedix",0,TRUE) != -1) { |
80 | qDebug("IS System Zaurus"); | 80 | qDebug("IS System Zaurus"); |
81 | systemZaurus=TRUE; | 81 | systemZaurus=TRUE; |
82 | } | 82 | } |
83 | } | 83 | } |
84 | if(!systemZaurus) { | 84 | if(!systemZaurus) { |
85 | stereoCheckBox->setChecked(TRUE); | 85 | stereoCheckBox->setChecked(TRUE); |
86 | } | 86 | } |
87 | stereoCheckBox->setEnabled(FALSE); | 87 | stereoCheckBox->setEnabled(FALSE); |
88 | sixteenBitCheckBox->setEnabled(FALSE); | 88 | sixteenBitCheckBox->setEnabled(FALSE); |
89 | #else | 89 | #else |
90 | #endif | 90 | #endif |
91 | int sRate=cfg.readNumEntry("SizeLimit", 30); | 91 | int sRate=cfg.readNumEntry("SizeLimit", 30); |
92 | qDebug("%d",sRate); | 92 | qDebug("%d",sRate); |
93 | 93 | ||
94 | if(sRate ==30) | 94 | if(sRate ==30) |
95 | timeLimitComboBox->setCurrentItem(0); | 95 | timeLimitComboBox->setCurrentItem(0); |
96 | else if(sRate==20) | 96 | else if(sRate==20) |
97 | timeLimitComboBox->setCurrentItem(1); | 97 | timeLimitComboBox->setCurrentItem(1); |
98 | else if(sRate == 15) | 98 | else if(sRate == 15) |
99 | timeLimitComboBox->setCurrentItem(2); | 99 | timeLimitComboBox->setCurrentItem(2); |
100 | else if(sRate == 10) | 100 | else if(sRate == 10) |
101 | timeLimitComboBox->setCurrentItem(3); | 101 | timeLimitComboBox->setCurrentItem(3); |
102 | else if(sRate == 5) | 102 | else if(sRate == 5) |
103 | timeLimitComboBox->setCurrentItem(4); | 103 | timeLimitComboBox->setCurrentItem(4); |
104 | else | 104 | else |
105 | timeLimitComboBox->setCurrentItem(5); | 105 | timeLimitComboBox->setCurrentItem(5); |
106 | 106 | ||
107 | sixteenBitCheckBox->setChecked(cfg.readNumEntry("SixteenBit", 1)); | 107 | sixteenBitCheckBox->setChecked(cfg.readNumEntry("SixteenBit", 1)); |
108 | 108 | ||
109 | cfg.setGroup("Defaults"); | 109 | cfg.setGroup("Defaults"); |
110 | keyComboBox->setCurrentItem(cfg.readNumEntry("toggleKey") ); | 110 | keyComboBox->setCurrentItem(cfg.readNumEntry("toggleKey") ); |
111 | 111 | ||
112 | updateStorageCombo(); | 112 | updateStorageCombo(); |
113 | connect( LocationComboBox,SIGNAL(activated(const QString &)), this, | 113 | connect( LocationComboBox,SIGNAL(activated(const QString &)), this, |
114 | SLOT( setLocation(const QString &))); | 114 | SLOT( setLocation(const QString &))); |
115 | connect( keyComboBox,SIGNAL(activated( int)), this, | 115 | connect( keyComboBox,SIGNAL(activated( int)), this, |
116 | SLOT( setKeyButton( int))); | 116 | SLOT( setKeyButton( int))); |
117 | connect( timeLimitComboBox,SIGNAL(activated( const QString &)), this, | 117 | connect( timeLimitComboBox,SIGNAL(activated( const QString &)), this, |
118 | SLOT( setSizeLimitButton(const QString &))); | 118 | SLOT( setSizeLimitButton(const QString &))); |
119 | connect( restartCheckBox,SIGNAL( toggled( bool)), this, | 119 | connect( restartCheckBox,SIGNAL( toggled( bool)), this, |
120 | SLOT( restartOpie( bool))); | 120 | SLOT( restartOpie( bool))); |
121 | // connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) ); | 121 | // connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) ); |
122 | } | 122 | } |
123 | 123 | ||
124 | void SoundSettings::updateStorageCombo() { | 124 | void SoundSettings::updateStorageCombo() { |
125 | 125 | ||
126 | Config config( "Vmemo" ); | 126 | Config config( "Vmemo" ); |
127 | config.setGroup( "System" ); | 127 | config.setGroup( "System" ); |
128 | QString loc = config.readEntry("RecLocation","/"); | 128 | QString loc = config.readEntry("RecLocation","/"); |
129 | int i=0; | 129 | int i=0; |
130 | int set=0; | 130 | int set=0; |
131 | StorageInfo storageInfo; | 131 | StorageInfo storageInfo; |
132 | QString sName, sPath; | 132 | QString sName, sPath; |
133 | QStringList list; | 133 | QStringList list; |
134 | list << "Documents : "+QPEApplication::documentDir(); | 134 | list << "Documents : "+QPEApplication::documentDir(); |
135 | list << "tmp : /tmp"; | 135 | list << "tmp : /tmp"; |
136 | 136 | ||
137 | const QList<FileSystem> &fs = storageInfo.fileSystems(); | 137 | const QList<FileSystem> &fs = storageInfo.fileSystems(); |
138 | QListIterator<FileSystem> it ( fs ); | 138 | QListIterator<FileSystem> it ( fs ); |
139 | for( ; it.current(); ++it ){ | 139 | for( ; it.current(); ++it ){ |
140 | const QString name = (*it)->name(); | 140 | const QString name = (*it)->name(); |
141 | const QString path = (*it)->path(); | 141 | const QString path = (*it)->path(); |
142 | qDebug("storage name "+name +" storage path is "+path); | 142 | qDebug("storage name "+name +" storage path is "+path); |
143 | list << name + ": " +path; | 143 | list << name + ": " +path; |
144 | if( loc.find( path,0,TRUE) != -1) | 144 | if( loc.find( path,0,TRUE) != -1) |
145 | set = i; | 145 | set = i; |
146 | // if(dit.current()->file().find(path) != -1 ) storage=name; | 146 | // if(dit.current()->file().find(path) != -1 ) storage=name; |
147 | i++; | 147 | i++; |
148 | } | 148 | } |
149 | 149 | ||
150 | LocationComboBox->insertStringList(list); | 150 | LocationComboBox->insertStringList(list); |
151 | qDebug("set item %d", set); | 151 | qDebug("set item %d", set); |
152 | LocationComboBox->setCurrentItem(set); | 152 | LocationComboBox->setCurrentItem(set); |
153 | } | 153 | } |
154 | 154 | ||
155 | void SoundSettings::setLocation(const QString & string) { | 155 | void SoundSettings::setLocation(const QString & string) { |
156 | Config config( "Vmemo" ); | 156 | Config config( "Vmemo" ); |
157 | config.setGroup( "System" ); | 157 | config.setGroup( "System" ); |
158 | config.writeEntry("RecLocation",string); | 158 | config.writeEntry("RecLocation",string); |
159 | qDebug("set location "+string); | 159 | qDebug("set location "+string); |
160 | config.write(); | 160 | config.write(); |
161 | } | 161 | } |
162 | 162 | ||
163 | void SoundSettings::cleanUp() { | 163 | void SoundSettings::cleanUp() { |
164 | Config cfg("Vmemo"); | 164 | Config cfg("Vmemo"); |
165 | cfg.writeEntry("Alert",AlertCheckBox->isChecked()); | 165 | cfg.writeEntry("Alert",AlertCheckBox->isChecked()); |
166 | 166 | ||
167 | cfg.setGroup("Record"); | 167 | cfg.setGroup("Record"); |
168 | cfg.writeEntry("SampleRate",sampleRate->currentText()); | 168 | cfg.writeEntry("SampleRate",sampleRate->currentText()); |
diff --git a/noncore/tools/formatter/formatter.cpp b/noncore/tools/formatter/formatter.cpp index f275fbe..79a7f9e 100644 --- a/noncore/tools/formatter/formatter.cpp +++ b/noncore/tools/formatter/formatter.cpp | |||
@@ -90,193 +90,193 @@ FormatterApp::FormatterApp( QWidget* parent, const char* name, bool modal, WFla | |||
90 | tabLayout->addMultiCellWidget( TextLabel2, 4, 4, 0, 1); | 90 | tabLayout->addMultiCellWidget( TextLabel2, 4, 4, 0, 1); |
91 | 91 | ||
92 | fileSystemsCombo = new QComboBox( FALSE, tab, "fileSystemsCombo" ); | 92 | fileSystemsCombo = new QComboBox( FALSE, tab, "fileSystemsCombo" ); |
93 | fileSystemsCombo->setMaximumWidth(220); | 93 | fileSystemsCombo->setMaximumWidth(220); |
94 | 94 | ||
95 | tabLayout->addMultiCellWidget( fileSystemsCombo, 3, 3, 0, 1); | 95 | tabLayout->addMultiCellWidget( fileSystemsCombo, 3, 3, 0, 1); |
96 | QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Minimum, QSizePolicy::Minimum ); | 96 | QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Minimum, QSizePolicy::Minimum ); |
97 | tabLayout->addItem( spacer, 2, 0 ); | 97 | tabLayout->addItem( spacer, 2, 0 ); |
98 | 98 | ||
99 | formatPushButton = new QPushButton( tab, "formatPushButton" ); | 99 | formatPushButton = new QPushButton( tab, "formatPushButton" ); |
100 | formatPushButton->setText( tr( "Format" ) ); | 100 | formatPushButton->setText( tr( "Format" ) ); |
101 | formatPushButton->setMaximumWidth(170); | 101 | formatPushButton->setMaximumWidth(170); |
102 | 102 | ||
103 | tabLayout->addMultiCellWidget( formatPushButton, 6, 6, 0, 1); | 103 | tabLayout->addMultiCellWidget( formatPushButton, 6, 6, 0, 1); |
104 | QSpacerItem* spacer_2 = new QSpacerItem( 20, 20, QSizePolicy::Minimum, QSizePolicy::Minimum ); | 104 | QSpacerItem* spacer_2 = new QSpacerItem( 20, 20, QSizePolicy::Minimum, QSizePolicy::Minimum ); |
105 | tabLayout->addItem( spacer_2, 5, 0 ); | 105 | tabLayout->addItem( spacer_2, 5, 0 ); |
106 | 106 | ||
107 | TabWidget->insertTab( tab, tr( "Main" ) ); | 107 | TabWidget->insertTab( tab, tr( "Main" ) ); |
108 | 108 | ||
109 | tab_2 = new QWidget( TabWidget, "tab_2" ); | 109 | tab_2 = new QWidget( TabWidget, "tab_2" ); |
110 | tabLayout_2 = new QGridLayout( tab_2 ); | 110 | tabLayout_2 = new QGridLayout( tab_2 ); |
111 | tabLayout_2->setSpacing(3); | 111 | tabLayout_2->setSpacing(3); |
112 | tabLayout_2->setMargin(2); | 112 | tabLayout_2->setMargin(2); |
113 | 113 | ||
114 | mountPointLineEdit = new QLineEdit( tab_2, "mountPointLineEdit" ); | 114 | mountPointLineEdit = new QLineEdit( tab_2, "mountPointLineEdit" ); |
115 | 115 | ||
116 | tabLayout_2->addMultiCellWidget( mountPointLineEdit, 0, 0, 0, 1); | 116 | tabLayout_2->addMultiCellWidget( mountPointLineEdit, 0, 0, 0, 1); |
117 | 117 | ||
118 | deviceComboBox = new QComboBox( FALSE, tab_2, "deviceComboBox" ); | 118 | deviceComboBox = new QComboBox( FALSE, tab_2, "deviceComboBox" ); |
119 | 119 | ||
120 | tabLayout_2->addMultiCellWidget( deviceComboBox, 3, 3, 0, 1); | 120 | tabLayout_2->addMultiCellWidget( deviceComboBox, 3, 3, 0, 1); |
121 | 121 | ||
122 | TextLabel5 = new QLabel( tab_2, "TextLabel5" ); | 122 | TextLabel5 = new QLabel( tab_2, "TextLabel5" ); |
123 | TextLabel5->setText( tr( "CAUTION:\n" | 123 | TextLabel5->setText( tr( "CAUTION:\n" |
124 | "Changing parameters on this \n" | 124 | "Changing parameters on this \n" |
125 | "page may cause your system \n" | 125 | "page may cause your system \n" |
126 | "to stop functioning properly!!" ) );//idiot message | 126 | "to stop functioning properly!!" ) );//idiot message |
127 | 127 | ||
128 | tabLayout_2->addMultiCellWidget( TextLabel5, 6, 6, 0, 1); | 128 | tabLayout_2->addMultiCellWidget( TextLabel5, 6, 6, 0, 1); |
129 | 129 | ||
130 | editPushButton = new QPushButton( tab_2, "editPushButton" ); | 130 | editPushButton = new QPushButton( tab_2, "editPushButton" ); |
131 | editPushButton->setText( tr( "Edit fstab" ) ); | 131 | editPushButton->setText( tr( "Edit fstab" ) ); |
132 | editPushButton->setMaximumWidth(100); | 132 | editPushButton->setMaximumWidth(100); |
133 | 133 | ||
134 | tabLayout_2->addMultiCellWidget( editPushButton, 7, 7, 0, 0 ); | 134 | tabLayout_2->addMultiCellWidget( editPushButton, 7, 7, 0, 0 ); |
135 | 135 | ||
136 | fsckButton = new QPushButton( tab_2, "fsckPushButton" ); | 136 | fsckButton = new QPushButton( tab_2, "fsckPushButton" ); |
137 | fsckButton->setText( tr( "Check Disk" ) ); | 137 | fsckButton->setText( tr( "Check Disk" ) ); |
138 | fsckButton->setMaximumWidth(100); | 138 | fsckButton->setMaximumWidth(100); |
139 | 139 | ||
140 | tabLayout_2->addMultiCellWidget( fsckButton, 7, 7, 1, 1); | 140 | tabLayout_2->addMultiCellWidget( fsckButton, 7, 7, 1, 1); |
141 | 141 | ||
142 | TextLabel3 = new QLabel( tab_2, "TextLabel3" ); | 142 | TextLabel3 = new QLabel( tab_2, "TextLabel3" ); |
143 | TextLabel3->setText( tr( "Device" ) ); | 143 | TextLabel3->setText( tr( "Device" ) ); |
144 | 144 | ||
145 | tabLayout_2->addMultiCellWidget( TextLabel3, 4, 4, 0, 1 ); | 145 | tabLayout_2->addMultiCellWidget( TextLabel3, 4, 4, 0, 1 ); |
146 | QSpacerItem* spacer_3 = new QSpacerItem( 20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding ); | 146 | QSpacerItem* spacer_3 = new QSpacerItem( 20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding ); |
147 | tabLayout_2->addItem( spacer_3, 5, 0 ); | 147 | tabLayout_2->addItem( spacer_3, 5, 0 ); |
148 | 148 | ||
149 | TextLabel1 = new QLabel( tab_2, "TextLabel1" ); | 149 | TextLabel1 = new QLabel( tab_2, "TextLabel1" ); |
150 | TextLabel1->setText( tr( "Mount Point" ) ); | 150 | TextLabel1->setText( tr( "Mount Point" ) ); |
151 | 151 | ||
152 | tabLayout_2->addMultiCellWidget( TextLabel1, 1, 1, 0, 1 ); | 152 | tabLayout_2->addMultiCellWidget( TextLabel1, 1, 1, 0, 1 ); |
153 | QSpacerItem* spacer_4 = new QSpacerItem( 20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding ); | 153 | QSpacerItem* spacer_4 = new QSpacerItem( 20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding ); |
154 | tabLayout_2->addItem( spacer_4, 2, 1 ); | 154 | tabLayout_2->addItem( spacer_4, 2, 1 ); |
155 | TabWidget->insertTab( tab_2, tr( "Advanced" ) ); | 155 | TabWidget->insertTab( tab_2, tr( "Advanced" ) ); |
156 | 156 | ||
157 | FormatterAppLayout->addWidget( TabWidget, 0, 1 ); | 157 | FormatterAppLayout->addWidget( TabWidget, 0, 1 ); |
158 | 158 | ||
159 | connect( formatPushButton ,SIGNAL(released()),this,SLOT( doFormat()) ); | 159 | connect( formatPushButton ,SIGNAL(released()),this,SLOT( doFormat()) ); |
160 | connect( editPushButton ,SIGNAL(released()),this,SLOT( editFstab()) ); | 160 | connect( editPushButton ,SIGNAL(released()),this,SLOT( editFstab()) ); |
161 | connect( fsckButton ,SIGNAL(released()),this,SLOT( doFsck()) ); | 161 | connect( fsckButton ,SIGNAL(released()),this,SLOT( doFsck()) ); |
162 | 162 | ||
163 | connect( fileSystemsCombo,SIGNAL(activated(int)),this,SLOT( fsComboSelected(int ) )); | 163 | connect( fileSystemsCombo,SIGNAL(activated(int)),this,SLOT( fsComboSelected(int ) )); |
164 | connect( storageComboBox,SIGNAL(activated(int)),this,SLOT( storageComboSelected(int ) )); | 164 | connect( storageComboBox,SIGNAL(activated(int)),this,SLOT( storageComboSelected(int ) )); |
165 | connect( deviceComboBox,SIGNAL(activated(int)),this,SLOT( deviceComboSelected(int ) )); | 165 | connect( deviceComboBox,SIGNAL(activated(int)),this,SLOT( deviceComboSelected(int ) )); |
166 | 166 | ||
167 | 167 | ||
168 | fillCombos(); | 168 | fillCombos(); |
169 | } | 169 | } |
170 | 170 | ||
171 | FormatterApp::~FormatterApp() { | 171 | FormatterApp::~FormatterApp() { |
172 | 172 | ||
173 | } | 173 | } |
174 | 174 | ||
175 | void FormatterApp::doFormat() { | 175 | void FormatterApp::doFormat() { |
176 | int err=0; | 176 | int err=0; |
177 | Output *outDlg; | 177 | Output *outDlg; |
178 | QString umountS, remountS; | 178 | QString umountS, remountS; |
179 | QString text = storageComboBox->currentText(); | 179 | QString text = storageComboBox->currentText(); |
180 | QString currentText = storageComboBox->currentText(); | 180 | QString currentText = storageComboBox->currentText(); |
181 | QString cmd; | 181 | QString cmd; |
182 | QString diskDevice = currentText.right( currentText.length() - currentText.find(" -> ",0,TRUE) - 4); | 182 | QString diskDevice = currentText.right( currentText.length() - currentText.find(" -> ",0,TRUE) - 4); |
183 | QString diskName = currentText.left(currentText.find(" -> ",0,TRUE)); | 183 | QString diskName = currentText.left(currentText.find(" -> ",0,TRUE)); |
184 | QString fs = fileSystemsCombo->currentText(); | 184 | QString fs = fileSystemsCombo->currentText(); |
185 | 185 | ||
186 | #if defined(QT_QWS_IPAQ) || defined(QT_QWS_EBX) // lets test on something cheap | 186 | #if defined(QT_QWS_IPAQ) || defined(QT_QWS_SL5XXX) // lets test on something cheap |
187 | #else | 187 | #else |
188 | currentText = diskDevice = "/dev/fd0"; | 188 | currentText = diskDevice = "/dev/fd0"; |
189 | umountS = "umount -v /floppy 2>&1"; | 189 | umountS = "umount -v /floppy 2>&1"; |
190 | remountS = "mount -v /floppy 2>&1"; | 190 | remountS = "mount -v /floppy 2>&1"; |
191 | #endif | 191 | #endif |
192 | 192 | ||
193 | if( currentText.find("CF",0,TRUE) != -1) { | 193 | if( currentText.find("CF",0,TRUE) != -1) { |
194 | umountS = "umount "; | 194 | umountS = "umount "; |
195 | remountS = "mount "; | 195 | remountS = "mount "; |
196 | 196 | ||
197 | // umountS = "/sbin/cardctl eject"; | 197 | // umountS = "/sbin/cardctl eject"; |
198 | // remountS = "/sbin/cardctl insert"; | 198 | // remountS = "/sbin/cardctl insert"; |
199 | } | 199 | } |
200 | if( currentText.find("SD",0,TRUE) != -1) { | 200 | if( currentText.find("SD",0,TRUE) != -1) { |
201 | umountS = "umount "; | 201 | umountS = "umount "; |
202 | remountS = "mount "; | 202 | remountS = "mount "; |
203 | // umountS = "/etc/sdcontrol compeject"; | 203 | // umountS = "/etc/sdcontrol compeject"; |
204 | // remountS = "/etc/sdcontrol insert"; | 204 | // remountS = "/etc/sdcontrol insert"; |
205 | } | 205 | } |
206 | 206 | ||
207 | switch ( QMessageBox::warning(this,tr("Format?!?"),tr("Really format\n") +diskName+" "+ currentText + | 207 | switch ( QMessageBox::warning(this,tr("Format?!?"),tr("Really format\n") +diskName+" "+ currentText + |
208 | tr("\nwith ") + fs + tr(" filesystem?!?\nYou will loose all data!!"),tr("Yes"),tr("No"),0,1,1) ) { | 208 | tr("\nwith ") + fs + tr(" filesystem?!?\nYou will loose all data!!"),tr("Yes"),tr("No"),0,1,1) ) { |
209 | case 0: { | 209 | case 0: { |
210 | if(fs == "vfat") | 210 | if(fs == "vfat") |
211 | cmd = "mkdosfs -v " + diskDevice+" 2>&1"; | 211 | cmd = "mkdosfs -v " + diskDevice+" 2>&1"; |
212 | else if(fs == "ext2") | 212 | else if(fs == "ext2") |
213 | cmd = "mke2fs -v " + diskDevice+" 2>&1"; | 213 | cmd = "mke2fs -v " + diskDevice+" 2>&1"; |
214 | else { | 214 | else { |
215 | QMessageBox::warning(this, tr("Formatter"),tr("Could not format.\nUnknown type"), tr("Ok")); | 215 | QMessageBox::warning(this, tr("Formatter"),tr("Could not format.\nUnknown type"), tr("Ok")); |
216 | break; | 216 | break; |
217 | } | 217 | } |
218 | // cmd = "ls -l"; | 218 | // cmd = "ls -l"; |
219 | outDlg = new Output(this, tr("Formatter Output"),FALSE); | 219 | outDlg = new Output(this, tr("Formatter Output"),FALSE); |
220 | outDlg->showMaximized(); | 220 | outDlg->showMaximized(); |
221 | outDlg->show(); | 221 | outDlg->show(); |
222 | qApp->processEvents(); | 222 | qApp->processEvents(); |
223 | FILE *fp; | 223 | FILE *fp; |
224 | char line[130]; | 224 | char line[130]; |
225 | outDlg->OutputEdit->append( tr("Trying to umount.") + currentText ); | 225 | outDlg->OutputEdit->append( tr("Trying to umount.") + currentText ); |
226 | outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); | 226 | outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); |
227 | 227 | ||
228 | sleep(1); | 228 | sleep(1); |
229 | qDebug("Command is "+umountS); | 229 | qDebug("Command is "+umountS); |
230 | fp = popen( (const char *) umountS, "r"); | 230 | fp = popen( (const char *) umountS, "r"); |
231 | qDebug("%d", fp); | 231 | qDebug("%d", fp); |
232 | if ( !fp ) { | 232 | if ( !fp ) { |
233 | qDebug("Could not execute '" + umountS + "'! err=%d\n" +(QString)strerror(errno), err); | 233 | qDebug("Could not execute '" + umountS + "'! err=%d\n" +(QString)strerror(errno), err); |
234 | QMessageBox::warning( this, tr("Formatter"), tr("umount failed!"), tr("&OK") ); | 234 | QMessageBox::warning( this, tr("Formatter"), tr("umount failed!"), tr("&OK") ); |
235 | pclose(fp); | 235 | pclose(fp); |
236 | return; | 236 | return; |
237 | } else { | 237 | } else { |
238 | // outDlg->OutputEdit->append( currentText + tr("\nhas been successfully umounted.")); | 238 | // outDlg->OutputEdit->append( currentText + tr("\nhas been successfully umounted.")); |
239 | // outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); | 239 | // outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); |
240 | while ( fgets( line, sizeof line, fp)) { | 240 | while ( fgets( line, sizeof line, fp)) { |
241 | if( ((QString)line).find("busy",0,TRUE) != -1) { | 241 | if( ((QString)line).find("busy",0,TRUE) != -1) { |
242 | qDebug("Could not find '" + umountS); | 242 | qDebug("Could not find '" + umountS); |
243 | QMessageBox::warning( this, tr("Formatter"), tr("Could not umount.\nDevice is busy!"), tr("&OK") ); | 243 | QMessageBox::warning( this, tr("Formatter"), tr("Could not umount.\nDevice is busy!"), tr("&OK") ); |
244 | pclose(fp); | 244 | pclose(fp); |
245 | return; | 245 | return; |
246 | } else { | 246 | } else { |
247 | QString lineStr = line; | 247 | QString lineStr = line; |
248 | lineStr=lineStr.left(lineStr.length()-1); | 248 | lineStr=lineStr.left(lineStr.length()-1); |
249 | outDlg->OutputEdit->append(lineStr); | 249 | outDlg->OutputEdit->append(lineStr); |
250 | outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); | 250 | outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); |
251 | } | 251 | } |
252 | } | 252 | } |
253 | } | 253 | } |
254 | pclose(fp); | 254 | pclose(fp); |
255 | 255 | ||
256 | qDebug("Command would be: "+cmd); | 256 | qDebug("Command would be: "+cmd); |
257 | outDlg->OutputEdit->append( tr("Trying to format.") ); | 257 | outDlg->OutputEdit->append( tr("Trying to format.") ); |
258 | outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); | 258 | outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); |
259 | 259 | ||
260 | fp = popen( (const char *) cmd, "r"); | 260 | fp = popen( (const char *) cmd, "r"); |
261 | while ( fgets( line, sizeof line, fp)) { | 261 | while ( fgets( line, sizeof line, fp)) { |
262 | if( ((QString)line).find("No such device",0,TRUE) != -1) { | 262 | if( ((QString)line).find("No such device",0,TRUE) != -1) { |
263 | qDebug("No such device '" + umountS); | 263 | qDebug("No such device '" + umountS); |
264 | QMessageBox::warning( this, tr("Formatter"), tr("No such device!"), tr("&OK") ); | 264 | QMessageBox::warning( this, tr("Formatter"), tr("No such device!"), tr("&OK") ); |
265 | pclose(fp); | 265 | pclose(fp); |
266 | // outDlg->OutputEdit->append("No such device"); | 266 | // outDlg->OutputEdit->append("No such device"); |
267 | // outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); | 267 | // outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); |
268 | return; | 268 | return; |
269 | } else { | 269 | } else { |
270 | QString lineStr = line; | 270 | QString lineStr = line; |
271 | lineStr=lineStr.left(lineStr.length()-1); | 271 | lineStr=lineStr.left(lineStr.length()-1); |
272 | outDlg->OutputEdit->append(lineStr); | 272 | outDlg->OutputEdit->append(lineStr); |
273 | outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); | 273 | outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); |
274 | } | 274 | } |
275 | } | 275 | } |
276 | outDlg->OutputEdit->append( currentText + tr("\nhas been successfully formatted.")); | 276 | outDlg->OutputEdit->append( currentText + tr("\nhas been successfully formatted.")); |
277 | outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); | 277 | outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); |
278 | pclose(fp); | 278 | pclose(fp); |
279 | 279 | ||
280 | outDlg->OutputEdit->append( tr("Trying to mount.") + currentText ); | 280 | outDlg->OutputEdit->append( tr("Trying to mount.") + currentText ); |
281 | outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); | 281 | outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); |
282 | fp = popen( (const char *) remountS, "r"); | 282 | fp = popen( (const char *) remountS, "r"); |
@@ -380,193 +380,193 @@ void FormatterApp::deviceComboSelected(int index) { | |||
380 | if ( !mult ) mult = 1; | 380 | if ( !mult ) mult = 1; |
381 | if ( !div ) div = 1; | 381 | if ( !div ) div = 1; |
382 | long total = (*it)->totalBlocks() * mult / div; | 382 | long total = (*it)->totalBlocks() * mult / div; |
383 | long totalMb = total/1024; | 383 | long totalMb = total/1024; |
384 | long avail = (*it)->availBlocks() * mult / div; | 384 | long avail = (*it)->availBlocks() * mult / div; |
385 | long availMb = avail/1024; | 385 | long availMb = avail/1024; |
386 | long used = total - avail; | 386 | long used = total - avail; |
387 | long usedMb = used/1024; | 387 | long usedMb = used/1024; |
388 | totalS.sprintf(tr("Total: %1 kB ( %d mB)\n").arg( total ), totalMb ); | 388 | totalS.sprintf(tr("Total: %1 kB ( %d mB)\n").arg( total ), totalMb ); |
389 | usedS.sprintf(tr("Used: %1 kB ( %d mB)\n").arg(used) ,usedMb); | 389 | usedS.sprintf(tr("Used: %1 kB ( %d mB)\n").arg(used) ,usedMb); |
390 | avS.sprintf( tr("Available: %1 kB ( %d mB)").arg(avail), availMb ); | 390 | avS.sprintf( tr("Available: %1 kB ( %d mB)").arg(avail), availMb ); |
391 | } | 391 | } |
392 | } | 392 | } |
393 | fsType = getFileSystemType((const QString &)selectedText); | 393 | fsType = getFileSystemType((const QString &)selectedText); |
394 | 394 | ||
395 | TextLabel5->setText("Type: "+ nameS+"\nFormatted with "+ fsType + " \n" + totalS + usedS + avS); | 395 | TextLabel5->setText("Type: "+ nameS+"\nFormatted with "+ fsType + " \n" + totalS + usedS + avS); |
396 | // storageComboSelected(0); | 396 | // storageComboSelected(0); |
397 | } | 397 | } |
398 | 398 | ||
399 | void FormatterApp::cleanUp() { | 399 | void FormatterApp::cleanUp() { |
400 | 400 | ||
401 | } | 401 | } |
402 | 402 | ||
403 | 403 | ||
404 | void FormatterApp::editFstab() { | 404 | void FormatterApp::editFstab() { |
405 | QCopEnvelope e("QPE/Application/textedit","setDocument(QString)"); | 405 | QCopEnvelope e("QPE/Application/textedit","setDocument(QString)"); |
406 | e << (const QString &)"/etc/fstab"; | 406 | e << (const QString &)"/etc/fstab"; |
407 | } | 407 | } |
408 | 408 | ||
409 | void FormatterApp::parsetab(const QString &fileName) { | 409 | void FormatterApp::parsetab(const QString &fileName) { |
410 | 410 | ||
411 | fileSystemTypeList.clear(); | 411 | fileSystemTypeList.clear(); |
412 | fsList.clear(); | 412 | fsList.clear(); |
413 | struct mntent *me; | 413 | struct mntent *me; |
414 | // if(fileName == "/etc/mtab") { | 414 | // if(fileName == "/etc/mtab") { |
415 | FILE *mntfp = setmntent( fileName.latin1(), "r" ); | 415 | FILE *mntfp = setmntent( fileName.latin1(), "r" ); |
416 | if ( mntfp ) { | 416 | if ( mntfp ) { |
417 | while ( (me = getmntent( mntfp )) != 0 ) { | 417 | while ( (me = getmntent( mntfp )) != 0 ) { |
418 | QString deviceName = me->mnt_fsname; | 418 | QString deviceName = me->mnt_fsname; |
419 | QString filesystemType = me->mnt_type; | 419 | QString filesystemType = me->mnt_type; |
420 | if(deviceName != "none") { | 420 | if(deviceName != "none") { |
421 | if( fsList.contains(filesystemType) == 0 | 421 | if( fsList.contains(filesystemType) == 0 |
422 | & filesystemType.find("proc",0,TRUE) == -1 | 422 | & filesystemType.find("proc",0,TRUE) == -1 |
423 | & filesystemType.find("cramfs",0,TRUE) == -1 | 423 | & filesystemType.find("cramfs",0,TRUE) == -1 |
424 | & filesystemType.find("auto",0,TRUE) == -1) | 424 | & filesystemType.find("auto",0,TRUE) == -1) |
425 | fsList << filesystemType; | 425 | fsList << filesystemType; |
426 | deviceList << deviceName; | 426 | deviceList << deviceName; |
427 | qDebug(deviceName+"::"+filesystemType); | 427 | qDebug(deviceName+"::"+filesystemType); |
428 | fileSystemTypeList << deviceName+"::"+filesystemType; | 428 | fileSystemTypeList << deviceName+"::"+filesystemType; |
429 | } | 429 | } |
430 | } | 430 | } |
431 | } | 431 | } |
432 | endmntent( mntfp ); | 432 | endmntent( mntfp ); |
433 | // } else if(fileName == "/etc/fstab") { | 433 | // } else if(fileName == "/etc/fstab") { |
434 | // QFile f("/etc/fstab"); | 434 | // QFile f("/etc/fstab"); |
435 | // if ( f.open(IO_ReadOnly) ) { | 435 | // if ( f.open(IO_ReadOnly) ) { |
436 | // QTextStream t (&f); | 436 | // QTextStream t (&f); |
437 | // QString s; | 437 | // QString s; |
438 | // while (! t.eof()) { | 438 | // while (! t.eof()) { |
439 | // s=t.readLine(); | 439 | // s=t.readLine(); |
440 | // s=s.simplifyWhiteSpace(); | 440 | // s=s.simplifyWhiteSpace(); |
441 | // if ( (!s.isEmpty() ) && (s.find(" ")!=0) ) { | 441 | // if ( (!s.isEmpty() ) && (s.find(" ")!=0) ) { |
442 | // // = me->mnt_fsname; | 442 | // // = me->mnt_fsname; |
443 | // QString filesystemType = me->mnt_type; | 443 | // QString filesystemType = me->mnt_type; |
444 | // QString deviceName = s.left(0,s.find(BLANK) ); | 444 | // QString deviceName = s.left(0,s.find(BLANK) ); |
445 | // s=s.remove(0,s.find(BLANK)+1 ); // devicename | 445 | // s=s.remove(0,s.find(BLANK)+1 ); // devicename |
446 | 446 | ||
447 | // s=s.remove(0,s.find(BLANK)+1 ); // mountpoint | 447 | // s=s.remove(0,s.find(BLANK)+1 ); // mountpoint |
448 | // QStringt mountPoint= s.left(0,s.find(BLANK) ); | 448 | // QStringt mountPoint= s.left(0,s.find(BLANK) ); |
449 | // s=s.remove(0,s.find(BLANK)+1 ); // fs | 449 | // s=s.remove(0,s.find(BLANK)+1 ); // fs |
450 | // QString filesystemType= s.left(0,s.find(BLANK) ); | 450 | // QString filesystemType= s.left(0,s.find(BLANK) ); |
451 | // } | 451 | // } |
452 | // } | 452 | // } |
453 | // } | 453 | // } |
454 | // f.close(); | 454 | // f.close(); |
455 | // } | 455 | // } |
456 | } | 456 | } |
457 | 457 | ||
458 | QString FormatterApp::getFileSystemType(const QString ¤tText) { | 458 | QString FormatterApp::getFileSystemType(const QString ¤tText) { |
459 | 459 | ||
460 | parsetab("/etc/mtab"); //why did TT forget filesystem type? | 460 | parsetab("/etc/mtab"); //why did TT forget filesystem type? |
461 | 461 | ||
462 | for ( QStringList::Iterator it = fileSystemTypeList.begin(); it != fileSystemTypeList.end(); ++it ) { | 462 | for ( QStringList::Iterator it = fileSystemTypeList.begin(); it != fileSystemTypeList.end(); ++it ) { |
463 | QString temp = (*it); | 463 | QString temp = (*it); |
464 | if( temp.find( currentText,0,TRUE) != -1) { | 464 | if( temp.find( currentText,0,TRUE) != -1) { |
465 | return temp.right( temp.length() - temp.find("::",0,TRUE) - 2); | 465 | return temp.right( temp.length() - temp.find("::",0,TRUE) - 2); |
466 | // qDebug(fsType); | 466 | // qDebug(fsType); |
467 | } | 467 | } |
468 | } | 468 | } |
469 | return ""; | 469 | return ""; |
470 | } | 470 | } |
471 | 471 | ||
472 | bool FormatterApp::doFsck() { | 472 | bool FormatterApp::doFsck() { |
473 | 473 | ||
474 | Output *outDlg; | 474 | Output *outDlg; |
475 | QString selectedDevice; | 475 | QString selectedDevice; |
476 | // #if defined(QT_QWS_IPAQ) || defined(QT_QWS_EBX) | 476 | // #if defined(QT_QWS_IPAQ) || defined(QT_QWS_SL5XXX) |
477 | selectedDevice = deviceComboBox->currentText(); | 477 | selectedDevice = deviceComboBox->currentText(); |
478 | QString mountPoint = mountPointLineEdit->text(); | 478 | QString mountPoint = mountPointLineEdit->text(); |
479 | QString umountS = "umount -v "+mountPoint+" 2>&1"; | 479 | QString umountS = "umount -v "+mountPoint+" 2>&1"; |
480 | QString remountS = "mount -v "+mountPoint+" 2>&1"; | 480 | QString remountS = "mount -v "+mountPoint+" 2>&1"; |
481 | // #else | 481 | // #else |
482 | // // for testing | 482 | // // for testing |
483 | // // currentText = diskDevice = "/dev/fd0"; | 483 | // // currentText = diskDevice = "/dev/fd0"; |
484 | // QString umountS = "umount -v /floppy 2>&1"; | 484 | // QString umountS = "umount -v /floppy 2>&1"; |
485 | // QString remountS = "mount -v /floppy 2>&1"; | 485 | // QString remountS = "mount -v /floppy 2>&1"; |
486 | // selectedDevice ="/dev/fd0"; | 486 | // selectedDevice ="/dev/fd0"; |
487 | 487 | ||
488 | // #endif | 488 | // #endif |
489 | 489 | ||
490 | QString fsType = getFileSystemType((const QString &)selectedDevice); | 490 | QString fsType = getFileSystemType((const QString &)selectedDevice); |
491 | QString cmd; | 491 | QString cmd; |
492 | qDebug( selectedDevice +" "+ fsType); | 492 | qDebug( selectedDevice +" "+ fsType); |
493 | if(fsType == "vfat") cmd = "dosfsck -vy "; | 493 | if(fsType == "vfat") cmd = "dosfsck -vy "; |
494 | if(fsType == "ext2") cmd = "e2fsck -cpvy "; | 494 | if(fsType == "ext2") cmd = "e2fsck -cpvy "; |
495 | cmd += selectedDevice + " 2>&1"; | 495 | cmd += selectedDevice + " 2>&1"; |
496 | 496 | ||
497 | outDlg = new Output(this, tr("Formatter Output"),FALSE); | 497 | outDlg = new Output(this, tr("Formatter Output"),FALSE); |
498 | outDlg->showMaximized(); | 498 | outDlg->showMaximized(); |
499 | outDlg->show(); | 499 | outDlg->show(); |
500 | qApp->processEvents(); | 500 | qApp->processEvents(); |
501 | FILE *fp; | 501 | FILE *fp; |
502 | char line[130]; | 502 | char line[130]; |
503 | outDlg->OutputEdit->append( tr("Trying to umount.")); | 503 | outDlg->OutputEdit->append( tr("Trying to umount.")); |
504 | outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); | 504 | outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); |
505 | 505 | ||
506 | sleep(1); | 506 | sleep(1); |
507 | // qDebug("Command is "+umountS); | 507 | // qDebug("Command is "+umountS); |
508 | fp = popen( (const char *) umountS, "r"); | 508 | fp = popen( (const char *) umountS, "r"); |
509 | // qDebug("%d", fp); | 509 | // qDebug("%d", fp); |
510 | if ( !fp ) { | 510 | if ( !fp ) { |
511 | qDebug("Could not execute '" + umountS + "'!\n" +(QString)strerror(errno)); | 511 | qDebug("Could not execute '" + umountS + "'!\n" +(QString)strerror(errno)); |
512 | QMessageBox::warning( this, tr("Formatter"), tr("umount failed!"), tr("&OK") ); | 512 | QMessageBox::warning( this, tr("Formatter"), tr("umount failed!"), tr("&OK") ); |
513 | pclose(fp); | 513 | pclose(fp); |
514 | return false; | 514 | return false; |
515 | } else { | 515 | } else { |
516 | // outDlg->OutputEdit->append( currentText + tr("\nhas been successfully umounted.")); | 516 | // outDlg->OutputEdit->append( currentText + tr("\nhas been successfully umounted.")); |
517 | // outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); | 517 | // outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); |
518 | while ( fgets( line, sizeof line, fp)) { | 518 | while ( fgets( line, sizeof line, fp)) { |
519 | if( ((QString)line).find("busy",0,TRUE) != -1) { | 519 | if( ((QString)line).find("busy",0,TRUE) != -1) { |
520 | qDebug("Could not find '" + umountS); | 520 | qDebug("Could not find '" + umountS); |
521 | QMessageBox::warning( this, tr("Formatter"), | 521 | QMessageBox::warning( this, tr("Formatter"), |
522 | tr("Could not umount.\nDevice is busy!"), tr("&OK") ); | 522 | tr("Could not umount.\nDevice is busy!"), tr("&OK") ); |
523 | pclose(fp); | 523 | pclose(fp); |
524 | return false; | 524 | return false; |
525 | } else { | 525 | } else { |
526 | QString lineStr = line; | 526 | QString lineStr = line; |
527 | lineStr=lineStr.left(lineStr.length()-1); | 527 | lineStr=lineStr.left(lineStr.length()-1); |
528 | outDlg->OutputEdit->append(lineStr); | 528 | outDlg->OutputEdit->append(lineStr); |
529 | outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); | 529 | outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); |
530 | } | 530 | } |
531 | } | 531 | } |
532 | } | 532 | } |
533 | pclose(fp); | 533 | pclose(fp); |
534 | ///////////////////////////////////// | 534 | ///////////////////////////////////// |
535 | fp = popen( (const char *) cmd, "r"); | 535 | fp = popen( (const char *) cmd, "r"); |
536 | while ( fgets( line, sizeof line, fp)) { | 536 | while ( fgets( line, sizeof line, fp)) { |
537 | if( ((QString)line).find("No such device",0,TRUE) != -1) { | 537 | if( ((QString)line).find("No such device",0,TRUE) != -1) { |
538 | qDebug("No such device '" + umountS); | 538 | qDebug("No such device '" + umountS); |
539 | QMessageBox::warning( this, tr("Formatter"), tr("No such device!"), tr("&OK") ); | 539 | QMessageBox::warning( this, tr("Formatter"), tr("No such device!"), tr("&OK") ); |
540 | pclose(fp); | 540 | pclose(fp); |
541 | // outDlg->OutputEdit->append("No such device"); | 541 | // outDlg->OutputEdit->append("No such device"); |
542 | // outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); | 542 | // outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); |
543 | return false; | 543 | return false; |
544 | } else { | 544 | } else { |
545 | QString lineStr = line; | 545 | QString lineStr = line; |
546 | lineStr=lineStr.left(lineStr.length()-1); | 546 | lineStr=lineStr.left(lineStr.length()-1); |
547 | outDlg->OutputEdit->append(lineStr); | 547 | outDlg->OutputEdit->append(lineStr); |
548 | outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); | 548 | outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); |
549 | } | 549 | } |
550 | } | 550 | } |
551 | outDlg->OutputEdit->append(tr("You can now close the output window.")); | 551 | outDlg->OutputEdit->append(tr("You can now close the output window.")); |
552 | outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); | 552 | outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); |
553 | // outDlg->OutputEdit->append( currentText + tr("\nhas been successfully formatted.")); | 553 | // outDlg->OutputEdit->append( currentText + tr("\nhas been successfully formatted.")); |
554 | // outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); | 554 | // outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); |
555 | pclose(fp); | 555 | pclose(fp); |
556 | 556 | ||
557 | ///////////////////////////////////////// | 557 | ///////////////////////////////////////// |
558 | 558 | ||
559 | return true; | 559 | return true; |
560 | } | 560 | } |
561 | 561 | ||
562 | bool FormatterApp::doFsckCheck() { | 562 | bool FormatterApp::doFsckCheck() { |
563 | 563 | ||
564 | return FALSE; | 564 | return FALSE; |
565 | } | 565 | } |
566 | 566 | ||
567 | int FormatterApp::formatCheck(const QString &deviceStr) { | 567 | int FormatterApp::formatCheck(const QString &deviceStr) { |
568 | 568 | ||
569 | return -1; | 569 | return -1; |
570 | } | 570 | } |
571 | 571 | ||
572 | int FormatterApp::runCommand(const QString &command) { | 572 | int FormatterApp::runCommand(const QString &command) { |
diff --git a/qt/qconfig-qpe.h b/qt/qconfig-qpe.h index 2b05f90..30d8190 100644 --- a/qt/qconfig-qpe.h +++ b/qt/qconfig-qpe.h | |||
@@ -1,99 +1,99 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of Qtopia Environment. | 4 | ** This file is part of Qtopia Environment. |
5 | ** | 5 | ** |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | ** This file may be distributed and/or modified under the terms of the |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | ** GNU General Public License version 2 as published by the Free Software |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | ** Foundation and appearing in the file LICENSE.GPL included in the |
9 | ** packaging of this file. | 9 | ** packaging of this file. |
10 | ** | 10 | ** |
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
13 | ** | 13 | ** |
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
15 | ** | 15 | ** |
16 | ** Contact info@trolltech.com if any conditions of this licensing are | 16 | ** Contact info@trolltech.com if any conditions of this licensing are |
17 | ** not clear to you. | 17 | ** not clear to you. |
18 | ** | 18 | ** |
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | #ifndef QT_H | 20 | #ifndef QT_H |
21 | #endif // QT_H | 21 | #endif // QT_H |
22 | 22 | ||
23 | // Empty leaves all features enabled. See doc/html/features.html for choices. | 23 | // Empty leaves all features enabled. See doc/html/features.html for choices. |
24 | 24 | ||
25 | // Note that disabling some features will produce a libqt that is not | 25 | // Note that disabling some features will produce a libqt that is not |
26 | // compatible with other libqt builds. Such modifications are only | 26 | // compatible with other libqt builds. Such modifications are only |
27 | // supported on Qt/Embedded where reducing the library size is important | 27 | // supported on Qt/Embedded where reducing the library size is important |
28 | // and where the application-suite is often a fixed set. | 28 | // and where the application-suite is often a fixed set. |
29 | 29 | ||
30 | #ifndef QT_DLL | 30 | #ifndef QT_DLL |
31 | #define QT_DLL // Internal | 31 | #define QT_DLL // Internal |
32 | #endif | 32 | #endif |
33 | 33 | ||
34 | #if defined(QT_QWS_IPAQ) || defined(QT_QWS_CASSIOPEIA) || defined(QT_QWS_EBX) | 34 | #if defined(QT_QWS_IPAQ) || defined(QT_QWS_CASSIOPEIA) || defined(QT_QWS_SL5XXX) |
35 | # define QT_NO_QWS_CURSOR | 35 | # define QT_NO_QWS_CURSOR |
36 | # define QT_NO_QWS_MOUSE_AUTO | 36 | # define QT_NO_QWS_MOUSE_AUTO |
37 | #endif | 37 | #endif |
38 | #ifndef QT_NO_CODECS | 38 | #ifndef QT_NO_CODECS |
39 | #define QT_NO_CODECS | 39 | #define QT_NO_CODECS |
40 | #endif | 40 | #endif |
41 | #define QT_NO_UNICODETABLES | 41 | #define QT_NO_UNICODETABLES |
42 | //#define QT_NO_IMAGEIO_BMP | 42 | //#define QT_NO_IMAGEIO_BMP |
43 | #define QT_NO_IMAGEIO_PPM | 43 | #define QT_NO_IMAGEIO_PPM |
44 | //#define QT_NO_ASYNC_IO | 44 | //#define QT_NO_ASYNC_IO |
45 | //#define QT_NO_ASYNC_IMAGE_IO | 45 | //#define QT_NO_ASYNC_IMAGE_IO |
46 | #define QT_NO_FREETYPE | 46 | #define QT_NO_FREETYPE |
47 | #define QT_NO_BDF | 47 | #define QT_NO_BDF |
48 | //#define QT_NO_FONTDATABASE | 48 | //#define QT_NO_FONTDATABASE |
49 | #define QT_NO_DRAGANDDROP | 49 | #define QT_NO_DRAGANDDROP |
50 | //#define QT_NO_CLIPBOARD | 50 | //#define QT_NO_CLIPBOARD |
51 | #define QT_NO_PROPERTIES | 51 | #define QT_NO_PROPERTIES |
52 | #define QT_NO_NETWORKPROTOCOL | 52 | #define QT_NO_NETWORKPROTOCOL |
53 | 53 | ||
54 | #define QT_NO_IMAGE_TEXT | 54 | #define QT_NO_IMAGE_TEXT |
55 | 55 | ||
56 | //#define QT_NO_TOOLTIP | 56 | //#define QT_NO_TOOLTIP |
57 | #define QT_NO_COLORNAMES | 57 | #define QT_NO_COLORNAMES |
58 | #define QT_NO_TRANSFORMATIONS | 58 | #define QT_NO_TRANSFORMATIONS |
59 | #define QT_NO_TRANSLATION_BUILDER | 59 | #define QT_NO_TRANSLATION_BUILDER |
60 | #define QT_NO_COMPLEXTEXT | 60 | #define QT_NO_COMPLEXTEXT |
61 | #define QT_NO_PRINTER | 61 | #define QT_NO_PRINTER |
62 | #define QT_NO_PICTURE | 62 | #define QT_NO_PICTURE |
63 | //#define QT_NO_ICONVIEW | 63 | //#define QT_NO_ICONVIEW |
64 | #define QT_NO_DIAL | 64 | #define QT_NO_DIAL |
65 | #define QT_NO_SIZEGRIP | 65 | #define QT_NO_SIZEGRIP |
66 | #define QT_NO_WORKSPACE | 66 | #define QT_NO_WORKSPACE |
67 | //#define QT_NO_TABLE | 67 | //#define QT_NO_TABLE |
68 | //#define QT_NO_ACTION | 68 | //#define QT_NO_ACTION |
69 | //#define QT_NO_SETTINGS | 69 | //#define QT_NO_SETTINGS |
70 | #define QT_NO_STYLE_POCKETPC | 70 | #define QT_NO_STYLE_POCKETPC |
71 | #ifndef QT_NO_STYLE_AQUA | 71 | #ifndef QT_NO_STYLE_AQUA |
72 | # define QT_NO_STYLE_AQUA | 72 | # define QT_NO_STYLE_AQUA |
73 | #endif | 73 | #endif |
74 | #define QT_NO_STYLE_MOTIF | 74 | #define QT_NO_STYLE_MOTIF |
75 | #define QT_NO_STYLE_PLATINUM | 75 | #define QT_NO_STYLE_PLATINUM |
76 | #define QT_NO_FILEDIALOG | 76 | #define QT_NO_FILEDIALOG |
77 | #define QT_NO_FONTDIALOG | 77 | #define QT_NO_FONTDIALOG |
78 | #define QT_NO_PRINTDIALOG | 78 | #define QT_NO_PRINTDIALOG |
79 | #define QT_NO_COLORDIALOG | 79 | #define QT_NO_COLORDIALOG |
80 | #define QT_NO_INPUTDIALOG | 80 | #define QT_NO_INPUTDIALOG |
81 | //#define QT_NO_MESSAGEBOX | 81 | //#define QT_NO_MESSAGEBOX |
82 | #define QT_NO_PROGRESSDIALOG | 82 | #define QT_NO_PROGRESSDIALOG |
83 | //#define QT_NO_TABDIALOG | 83 | //#define QT_NO_TABDIALOG |
84 | #define QT_NO_WIZARD | 84 | #define QT_NO_WIZARD |
85 | #define QT_NO_EFFECTS | 85 | #define QT_NO_EFFECTS |
86 | //#define QT_NO_COMPONENT | 86 | //#define QT_NO_COMPONENT |
87 | #define QT_NO_DOM | 87 | #define QT_NO_DOM |
88 | #define QT_NO_SEMIMODAL | 88 | #define QT_NO_SEMIMODAL |
89 | //#define QT_NO_PROGRESSBAR | 89 | //#define QT_NO_PROGRESSBAR |
90 | #define QT_NO_SPLITTER | 90 | #define QT_NO_SPLITTER |
91 | 91 | ||
92 | //#define QT_NO_QWS_SAVEFONTS | 92 | //#define QT_NO_QWS_SAVEFONTS |
93 | //#define QT_NO_QWS_PROPERTIES | 93 | //#define QT_NO_QWS_PROPERTIES |
94 | 94 | ||
95 | #define QT_NO_QWS_BEOS_WM_STYLE | 95 | #define QT_NO_QWS_BEOS_WM_STYLE |
96 | #define QT_NO_QWS_KDE2_WM_STYLE | 96 | #define QT_NO_QWS_KDE2_WM_STYLE |
97 | #define QT_NO_QWS_KDE_WM_STYLE | 97 | #define QT_NO_QWS_KDE_WM_STYLE |
98 | #define QT_NO_QWS_WINDOWS_WM_STYLE | 98 | #define QT_NO_QWS_WINDOWS_WM_STYLE |
99 | 99 | ||
diff --git a/x11/libqpe-x11/qpe/qpeapplication.cpp b/x11/libqpe-x11/qpe/qpeapplication.cpp index ed815f8..eb01e50 100644 --- a/x11/libqpe-x11/qpe/qpeapplication.cpp +++ b/x11/libqpe-x11/qpe/qpeapplication.cpp | |||
@@ -662,134 +662,134 @@ bool QPEApplication::eventFilter( QObject* o, QEvent* e ) { | |||
662 | } | 662 | } |
663 | return FALSE; | 663 | return FALSE; |
664 | } | 664 | } |
665 | 665 | ||
666 | // Quit stuff | 666 | // Quit stuff |
667 | void QPEApplication::restart() { | 667 | void QPEApplication::restart() { |
668 | 668 | ||
669 | } | 669 | } |
670 | void QPEApplication::shutdown() { | 670 | void QPEApplication::shutdown() { |
671 | 671 | ||
672 | } | 672 | } |
673 | void QPEApplication::tryQuit() { | 673 | void QPEApplication::tryQuit() { |
674 | qWarning("TryQuit!!"); | 674 | qWarning("TryQuit!!"); |
675 | if ( activeModalWidget() || strcmp( argv() [ 0 ], "embeddedkonsole" ) == 0 ) | 675 | if ( activeModalWidget() || strcmp( argv() [ 0 ], "embeddedkonsole" ) == 0 ) |
676 | return ; // Inside modal loop or konsole. Too hard to save state. | 676 | return ; // Inside modal loop or konsole. Too hard to save state. |
677 | { | 677 | { |
678 | QCopEnvelope e( "QPE/System", "closing(QString)" ); | 678 | QCopEnvelope e( "QPE/System", "closing(QString)" ); |
679 | e << d->appName; | 679 | e << d->appName; |
680 | } | 680 | } |
681 | processEvents(); | 681 | processEvents(); |
682 | 682 | ||
683 | quit(); | 683 | quit(); |
684 | } | 684 | } |
685 | void QPEApplication::hideOrQuit() { | 685 | void QPEApplication::hideOrQuit() { |
686 | qWarning("hide or close"); | 686 | qWarning("hide or close"); |
687 | processEvents(); | 687 | processEvents(); |
688 | qWarning("past processing"); | 688 | qWarning("past processing"); |
689 | 689 | ||
690 | // If we are a preloaded application we don't actually quit, so emit | 690 | // If we are a preloaded application we don't actually quit, so emit |
691 | // a System message indicating we're quasi-closing. | 691 | // a System message indicating we're quasi-closing. |
692 | if ( d->preloaded && d->qpe_main_widget ) | 692 | if ( d->preloaded && d->qpe_main_widget ) |
693 | 693 | ||
694 | { | 694 | { |
695 | qWarning("hiding"); | 695 | qWarning("hiding"); |
696 | QCopEnvelope e("QPE/System", "fastAppHiding(QString)" ); | 696 | QCopEnvelope e("QPE/System", "fastAppHiding(QString)" ); |
697 | e << d->appName; | 697 | e << d->appName; |
698 | d->qpe_main_widget->hide(); | 698 | d->qpe_main_widget->hide(); |
699 | } | 699 | } |
700 | else | 700 | else |
701 | quit(); | 701 | quit(); |
702 | } | 702 | } |
703 | 703 | ||
704 | /*! | 704 | /*! |
705 | \internal | 705 | \internal |
706 | */ | 706 | */ |
707 | void QPEApplication::prepareForTermination( bool willrestart ) | 707 | void QPEApplication::prepareForTermination( bool willrestart ) |
708 | { | 708 | { |
709 | if ( willrestart ) { | 709 | if ( willrestart ) { |
710 | // Draw a big wait icon, the image can be altered in later revisions | 710 | // Draw a big wait icon, the image can be altered in later revisions |
711 | // QWidget *d = QApplication::desktop(); | 711 | // QWidget *d = QApplication::desktop(); |
712 | QImage img = Resource::loadImage( "launcher/new_wait" ); | 712 | QImage img = Resource::loadImage( "launcher/new_wait" ); |
713 | QPixmap pix; | 713 | QPixmap pix; |
714 | pix.convertFromImage( img.smoothScale( 1 * img.width(), 1 * img.height() ) ); | 714 | pix.convertFromImage( img.smoothScale( 1 * img.width(), 1 * img.height() ) ); |
715 | QLabel *lblWait = new QLabel( 0, "wait hack!", QWidget::WStyle_Customize | | 715 | QLabel *lblWait = new QLabel( 0, "wait hack!", QWidget::WStyle_Customize | |
716 | QWidget::WStyle_NoBorder | QWidget::WStyle_Tool ); | 716 | QWidget::WStyle_NoBorder | QWidget::WStyle_Tool ); |
717 | lblWait->setPixmap( pix ); | 717 | lblWait->setPixmap( pix ); |
718 | lblWait->setAlignment( QWidget::AlignCenter ); | 718 | lblWait->setAlignment( QWidget::AlignCenter ); |
719 | lblWait->show(); | 719 | lblWait->show(); |
720 | lblWait->showMaximized(); | 720 | lblWait->showMaximized(); |
721 | } | 721 | } |
722 | #ifndef SINGLE_APP | 722 | #ifndef SINGLE_APP |
723 | { QCopEnvelope envelope( "QPE/System", "forceQuit()" ); | 723 | { QCopEnvelope envelope( "QPE/System", "forceQuit()" ); |
724 | } | 724 | } |
725 | processEvents(); // ensure the message goes out. | 725 | processEvents(); // ensure the message goes out. |
726 | sleep( 1 ); // You have 1 second to comply. | 726 | sleep( 1 ); // You have 1 second to comply. |
727 | #endif | 727 | #endif |
728 | } | 728 | } |
729 | int QPEApplication::x11ClientMessage(QWidget* w, XEvent* event, bool b ) { | 729 | int QPEApplication::x11ClientMessage(QWidget* w, XEvent* event, bool b ) { |
730 | qWarning("X11 ClientMessage %d %d", event->type, ClientMessage); | 730 | qWarning("X11 ClientMessage %d %d", event->type, ClientMessage); |
731 | if ( event->type == ClientMessage ) { | 731 | if ( event->type == ClientMessage ) { |
732 | if ( (event->xclient.message_type == d->wm_protocols) && | 732 | if ( (event->xclient.message_type == d->wm_protocols) && |
733 | (event->xclient.data.l[0] == d->wm_context_accept ) ) { | 733 | (event->xclient.data.l[0] == d->wm_context_accept ) ) { |
734 | qWarning("accepted!!!"); | 734 | qWarning("accepted!!!"); |
735 | /* | 735 | /* |
736 | * I'm not sure if we should use activeWidget | 736 | * I'm not sure if we should use activeWidget |
737 | * or activeModalWidget | 737 | * or activeModalWidget |
738 | * a QDialog could be not modal too | 738 | * a QDialog could be not modal too |
739 | */ | 739 | */ |
740 | if ( w->inherits("QDialog" ) ) { | 740 | if ( w->inherits("QDialog" ) ) { |
741 | qWarning("inherits QDialog!!!"); | 741 | qWarning("inherits QDialog!!!"); |
742 | QDialog* dia = (QDialog*)w; | 742 | QDialog* dia = (QDialog*)w; |
743 | /* | 743 | /* |
744 | * call it directly or via QTimer::singleShot? | 744 | * call it directly or via QTimer::singleShot? |
745 | */ | 745 | */ |
746 | QTimer::singleShot(0, dia, SLOT(accept() ) ); | 746 | QTimer::singleShot(0, dia, SLOT(accept() ) ); |
747 | return 0; | 747 | return 0; |
748 | } | 748 | } |
749 | 749 | ||
750 | } | 750 | } |
751 | } | 751 | } |
752 | return QApplication::x11ClientMessage(w, event, b ); | 752 | return QApplication::x11ClientMessage(w, event, b ); |
753 | } | 753 | } |
754 | 754 | ||
755 | #define KeyPress XKeyPress | 755 | #define KeyPress XKeyPress |
756 | #define KeyRelease XKeyRelease | 756 | #define KeyRelease XKeyRelease |
757 | 757 | ||
758 | #if defined(QT_QWS_IPAQ) || defined(QT_QWS_EBX) | 758 | #if defined(QT_QWS_IPAQ) || defined(QT_QWS_SL5XXX) |
759 | 759 | ||
760 | // The libraries with the skiff package (and possibly others) have | 760 | // The libraries with the skiff package (and possibly others) have |
761 | // completely useless implementations of builtin new and delete that | 761 | // completely useless implementations of builtin new and delete that |
762 | // use about 50% of your CPU. Here we revert to the simple libc | 762 | // use about 50% of your CPU. Here we revert to the simple libc |
763 | // functions. | 763 | // functions. |
764 | 764 | ||
765 | void* operator new[]( size_t size ) | 765 | void* operator new[]( size_t size ) |
766 | { | 766 | { |
767 | return malloc( size ); | 767 | return malloc( size ); |
768 | } | 768 | } |
769 | 769 | ||
770 | void* operator new( size_t size ) | 770 | void* operator new( size_t size ) |
771 | { | 771 | { |
772 | return malloc( size ); | 772 | return malloc( size ); |
773 | } | 773 | } |
774 | 774 | ||
775 | void operator delete[]( void* p ) | 775 | void operator delete[]( void* p ) |
776 | { | 776 | { |
777 | free( p ); | 777 | free( p ); |
778 | } | 778 | } |
779 | 779 | ||
780 | void operator delete[]( void* p, size_t /*size*/ ) | 780 | void operator delete[]( void* p, size_t /*size*/ ) |
781 | { | 781 | { |
782 | free( p ); | 782 | free( p ); |
783 | } | 783 | } |
784 | 784 | ||
785 | void operator delete( void* p ) | 785 | void operator delete( void* p ) |
786 | { | 786 | { |
787 | free( p ); | 787 | free( p ); |
788 | } | 788 | } |
789 | 789 | ||
790 | void operator delete( void* p, size_t /*size*/ ) | 790 | void operator delete( void* p, size_t /*size*/ ) |
791 | { | 791 | { |
792 | free( p ); | 792 | free( p ); |
793 | } | 793 | } |
794 | 794 | ||
795 | #endif | 795 | #endif |