-rw-r--r-- | library/applnk.cpp | 6 | ||||
-rw-r--r-- | library/qpeapplication.cpp | 5 | ||||
-rw-r--r-- | library/qpeapplication.h | 5 |
3 files changed, 12 insertions, 4 deletions
diff --git a/library/applnk.cpp b/library/applnk.cpp index c82d3b9..874a1b6 100644 --- a/library/applnk.cpp +++ b/library/applnk.cpp | |||
@@ -656,67 +656,69 @@ AppLnk::AppLnk( const AppLnk © ) | |||
656 | */ | 656 | */ |
657 | AppLnk::~AppLnk() | 657 | AppLnk::~AppLnk() |
658 | { | 658 | { |
659 | if ( mId ) | 659 | if ( mId ) |
660 | qWarning("Deleting AppLnk that is in an AppLnkSet"); | 660 | qWarning("Deleting AppLnk that is in an AppLnkSet"); |
661 | if ( d ) | 661 | if ( d ) |
662 | delete d; | 662 | delete d; |
663 | } | 663 | } |
664 | 664 | ||
665 | /*! | 665 | /*! |
666 | \overload | 666 | \overload |
667 | Executes the application associated with this AppLnk. | 667 | Executes the application associated with this AppLnk. |
668 | 668 | ||
669 | \sa exec() | 669 | \sa exec() |
670 | */ | 670 | */ |
671 | void AppLnk::execute() const | 671 | void AppLnk::execute() const |
672 | { | 672 | { |
673 | execute( QStringList::split( ' ', property( "Arguments" ) ) ); | 673 | execute( QStringList::split( ' ', property( "Arguments" ) ) ); |
674 | } | 674 | } |
675 | 675 | ||
676 | /*! | 676 | /*! |
677 | Executes the application associated with this AppLnk, with | 677 | Executes the application associated with this AppLnk, with |
678 | \a args as arguments. | 678 | \a args as arguments. |
679 | 679 | ||
680 | \sa exec() | 680 | \sa exec() |
681 | */ | 681 | */ |
682 | void AppLnk::execute(const QStringList& args) const | 682 | void AppLnk::execute(const QStringList& args) const |
683 | { | 683 | { |
684 | #ifdef Q_WS_QWS | 684 | #ifdef Q_WS_QWS |
685 | if ( !mRotation.isEmpty() ) { | 685 | if ( !mRotation.isEmpty() ) { |
686 | // ######## this will only work in the server | 686 | // ######## this will only work in the server |
687 | int rot = QPEApplication::defaultRotation(); | 687 | int rot = QPEApplication::defaultRotation(); |
688 | int j = 0; | ||
688 | rot = (rot+mRotation.toInt())%360; | 689 | rot = (rot+mRotation.toInt())%360; |
689 | QCString old = getenv("QWS_DISPLAY"); | 690 | QCString old = getenv( "QWS_DISPLAY" ) ? getenv( "QWS_DISPLAY" ) : "Transformed"; |
690 | setenv("QWS_DISPLAY", QString("Transformed:Rot%1:0").arg(rot), 1); | 691 | QString driver( old.left( ( ( j = old.find( ':' ) ) >= 0 ) ? j : old.size() ).data() ); |
692 | setenv( "QWS_DISPLAY", QString( "%1:Rot%2:0" ).arg( driver ).arg( rot ), 1 ); | ||
691 | invoke(args); | 693 | invoke(args); |
692 | setenv("QWS_DISPLAY", old.data(), 1); | 694 | setenv("QWS_DISPLAY", old.data(), 1); |
693 | } else | 695 | } else |
694 | #endif | 696 | #endif |
695 | invoke(args); | 697 | invoke(args); |
696 | } | 698 | } |
697 | 699 | ||
698 | /*! | 700 | /*! |
699 | Invokes the application associated with this AppLnk, with | 701 | Invokes the application associated with this AppLnk, with |
700 | \a args as arguments. Rotation is not taken into account by | 702 | \a args as arguments. Rotation is not taken into account by |
701 | this function, so you should not call it directly. | 703 | this function, so you should not call it directly. |
702 | 704 | ||
703 | \sa execute() | 705 | \sa execute() |
704 | */ | 706 | */ |
705 | void AppLnk::invoke(const QStringList& args) const | 707 | void AppLnk::invoke(const QStringList& args) const |
706 | { | 708 | { |
707 | if ( property( "Arguments" ).isEmpty() ) | 709 | if ( property( "Arguments" ).isEmpty() ) |
708 | Global::execute( exec(), args[0] ); | 710 | Global::execute( exec(), args[0] ); |
709 | else | 711 | else |
710 | Global::execute( exec(), args.join( " " ) ); | 712 | Global::execute( exec(), args.join( " " ) ); |
711 | } | 713 | } |
712 | 714 | ||
713 | /*! | 715 | /*! |
714 | Sets the Exec property to \a exec. | 716 | Sets the Exec property to \a exec. |
715 | 717 | ||
716 | \sa exec() name() | 718 | \sa exec() name() |
717 | */ | 719 | */ |
718 | void AppLnk::setExec( const QString& exec ) | 720 | void AppLnk::setExec( const QString& exec ) |
719 | { | 721 | { |
720 | mExec = exec; | 722 | mExec = exec; |
721 | } | 723 | } |
722 | 724 | ||
diff --git a/library/qpeapplication.cpp b/library/qpeapplication.cpp index 0f3e4a4..19e99f2 100644 --- a/library/qpeapplication.cpp +++ b/library/qpeapplication.cpp | |||
@@ -1259,65 +1259,68 @@ QString QPEApplication::documentDir() | |||
1259 | static int deforient = -1; | 1259 | static int deforient = -1; |
1260 | 1260 | ||
1261 | /*! | 1261 | /*! |
1262 | \internal | 1262 | \internal |
1263 | */ | 1263 | */ |
1264 | int QPEApplication::defaultRotation() | 1264 | int QPEApplication::defaultRotation() |
1265 | { | 1265 | { |
1266 | if ( deforient < 0 ) { | 1266 | if ( deforient < 0 ) { |
1267 | QString d = getenv( "QWS_DISPLAY" ); | 1267 | QString d = getenv( "QWS_DISPLAY" ); |
1268 | if ( d.contains( "Rot90" ) ) { | 1268 | if ( d.contains( "Rot90" ) ) { |
1269 | deforient = 90; | 1269 | deforient = 90; |
1270 | } | 1270 | } |
1271 | else if ( d.contains( "Rot180" ) ) { | 1271 | else if ( d.contains( "Rot180" ) ) { |
1272 | deforient = 180; | 1272 | deforient = 180; |
1273 | } | 1273 | } |
1274 | else if ( d.contains( "Rot270" ) ) { | 1274 | else if ( d.contains( "Rot270" ) ) { |
1275 | deforient = 270; | 1275 | deforient = 270; |
1276 | } | 1276 | } |
1277 | else { | 1277 | else { |
1278 | deforient = 0; | 1278 | deforient = 0; |
1279 | } | 1279 | } |
1280 | } | 1280 | } |
1281 | return deforient; | 1281 | return deforient; |
1282 | } | 1282 | } |
1283 | 1283 | ||
1284 | /*! | 1284 | /*! |
1285 | \internal | 1285 | \internal |
1286 | */ | 1286 | */ |
1287 | void QPEApplication::setDefaultRotation( int r ) | 1287 | void QPEApplication::setDefaultRotation( int r ) |
1288 | { | 1288 | { |
1289 | if ( qApp->type() == GuiServer ) { | 1289 | if ( qApp->type() == GuiServer ) { |
1290 | deforient = r; | 1290 | deforient = r; |
1291 | setenv( "QWS_DISPLAY", QString( "Transformed:Rot%1:0" ).arg( r ).latin1(), 1 ); | 1291 | int j = 0; |
1292 | QCString old = getenv( "QWS_DISPLAY" ) ? getenv( "QWS_DISPLAY" ) : "Transformed"; | ||
1293 | QString driver( old.left( ( ( j = old.find( ':' ) ) >= 0 ) ? j : old.size() ).data() ); | ||
1294 | setenv( "QWS_DISPLAY", QString( "%1:Rot%2:0" ).arg(driver).arg( r ).latin1(), 1 ); | ||
1292 | Config config("qpe"); | 1295 | Config config("qpe"); |
1293 | config.setGroup( "Rotation" ); | 1296 | config.setGroup( "Rotation" ); |
1294 | config.writeEntry( "Rot", r ); | 1297 | config.writeEntry( "Rot", r ); |
1295 | } | 1298 | } |
1296 | else { | 1299 | else { |
1297 | #ifndef QT_NO_COP | 1300 | #ifndef QT_NO_COP |
1298 | { QCopEnvelope e( "QPE/System", "setDefaultRotation(int)" ); | 1301 | { QCopEnvelope e( "QPE/System", "setDefaultRotation(int)" ); |
1299 | e << r; | 1302 | e << r; |
1300 | } | 1303 | } |
1301 | #endif | 1304 | #endif |
1302 | 1305 | ||
1303 | } | 1306 | } |
1304 | } | 1307 | } |
1305 | 1308 | ||
1306 | #include <qgfx_qws.h> | 1309 | #include <qgfx_qws.h> |
1307 | #include <qwindowsystem_qws.h> | 1310 | #include <qwindowsystem_qws.h> |
1308 | 1311 | ||
1309 | #if QT_VERSION > 236 | 1312 | #if QT_VERSION > 236 |
1310 | extern void qws_clearLoadedFonts(); | 1313 | extern void qws_clearLoadedFonts(); |
1311 | #endif | 1314 | #endif |
1312 | 1315 | ||
1313 | void QPEApplication::setCurrentMode( int x, int y, int depth ) | 1316 | void QPEApplication::setCurrentMode( int x, int y, int depth ) |
1314 | { | 1317 | { |
1315 | // Reset the caches | 1318 | // Reset the caches |
1316 | #if QT_VERSION > 236 | 1319 | #if QT_VERSION > 236 |
1317 | qws_clearLoadedFonts(); | 1320 | qws_clearLoadedFonts(); |
1318 | #endif | 1321 | #endif |
1319 | QPixmapCache::clear(); | 1322 | QPixmapCache::clear(); |
1320 | 1323 | ||
1321 | // Change the screen mode | 1324 | // Change the screen mode |
1322 | qt_screen->setMode(x, y, depth); | 1325 | qt_screen->setMode(x, y, depth); |
1323 | 1326 | ||
diff --git a/library/qpeapplication.h b/library/qpeapplication.h index 167fe69..cff3e43 100644 --- a/library/qpeapplication.h +++ b/library/qpeapplication.h | |||
@@ -179,61 +179,64 @@ private: | |||
179 | bool reserved_sh; | 179 | bool reserved_sh; |
180 | 180 | ||
181 | }; | 181 | }; |
182 | 182 | ||
183 | 183 | ||
184 | 184 | ||
185 | enum Transformation { Rot0, Rot90, Rot180, Rot270 }; /* from qgfxtransformed_qws.cpp */ | 185 | enum Transformation { Rot0, Rot90, Rot180, Rot270 }; /* from qgfxtransformed_qws.cpp */ |
186 | 186 | ||
187 | inline int TransToDeg ( Transformation t ) | 187 | inline int TransToDeg ( Transformation t ) |
188 | { | 188 | { |
189 | int d = static_cast<int>( t ); | 189 | int d = static_cast<int>( t ); |
190 | return d * 90; | 190 | return d * 90; |
191 | } | 191 | } |
192 | 192 | ||
193 | inline Transformation DegToTrans ( int d ) | 193 | inline Transformation DegToTrans ( int d ) |
194 | { | 194 | { |
195 | Transformation t = static_cast<Transformation>( d / 90 ); | 195 | Transformation t = static_cast<Transformation>( d / 90 ); |
196 | return t; | 196 | return t; |
197 | } | 197 | } |
198 | 198 | ||
199 | /* | 199 | /* |
200 | * Set current rotation of Opie, and rotation for newly started apps. | 200 | * Set current rotation of Opie, and rotation for newly started apps. |
201 | * Differs from setDefaultRotation in that 1) it rotates currently running apps, | 201 | * Differs from setDefaultRotation in that 1) it rotates currently running apps, |
202 | * and 2) does not set deforient or save orientation to qpe.conf. | 202 | * and 2) does not set deforient or save orientation to qpe.conf. |
203 | */ | 203 | */ |
204 | 204 | ||
205 | inline void QPEApplication::setCurrentRotation( int r ) | 205 | inline void QPEApplication::setCurrentRotation( int r ) |
206 | { | 206 | { |
207 | // setTransformation has been introduced in Qt/Embedded 2.3.4 snapshots | 207 | // setTransformation has been introduced in Qt/Embedded 2.3.4 snapshots |
208 | // for compatibility with the SharpROM use fallback to setDefaultTransformation() | 208 | // for compatibility with the SharpROM use fallback to setDefaultTransformation() |
209 | #if QT_VERSION > 233 | 209 | #if QT_VERSION > 233 |
210 | Transformation e = DegToTrans( r ); | 210 | Transformation e = DegToTrans( r ); |
211 | ::setenv( "QWS_DISPLAY", QString( "Transformed:Rot%1:0" ).arg( r ).latin1(), 1 ); | 211 | QCString old = getenv("QWS_DISPLAY") ? getenv( "QWS_DISPLAY" ) : "Transformed"; |
212 | int j = 0; | ||
213 | QString driver( old.left( ( ( j = old.find( ':' ) ) >= 0 ) ? j : old.size() ).data() ); | ||
214 | ::setenv( "QWS_DISPLAY", QString( "%1:Rot%2:0" ).arg( driver ).arg( r ).latin1(), 1 ); | ||
212 | qApp->desktop()->qwsDisplay()->setTransformation( e ); | 215 | qApp->desktop()->qwsDisplay()->setTransformation( e ); |
213 | #else | 216 | #else |
214 | setDefaultRotation( r ); | 217 | setDefaultRotation( r ); |
215 | #endif | 218 | #endif |
216 | } | 219 | } |
217 | 220 | ||
218 | /* | 221 | /* |
219 | * Qtopia 1.7 SDK compatibility macros | 222 | * Qtopia 1.7 SDK compatibility macros |
220 | * FIXME: Support Opie Quicklaunch Interface | 223 | * FIXME: Support Opie Quicklaunch Interface |
221 | */ | 224 | */ |
222 | #define QTOPIA_ADD_APPLICATION(NAME,IMPLEMENTATION) \ | 225 | #define QTOPIA_ADD_APPLICATION(NAME,IMPLEMENTATION) \ |
223 | int main( int argc, char** argv ) \ | 226 | int main( int argc, char** argv ) \ |
224 | { \ | 227 | { \ |
225 | QPEApplication app = QPEApplication( argc, argv );\ | 228 | QPEApplication app = QPEApplication( argc, argv );\ |
226 | IMPLEMENTATION* mw = new IMPLEMENTATION(); \ | 229 | IMPLEMENTATION* mw = new IMPLEMENTATION(); \ |
227 | app.showMainWidget( mw ); \ | 230 | app.showMainWidget( mw ); \ |
228 | app.exec(); \ | 231 | app.exec(); \ |
229 | } | 232 | } |
230 | #define QTOPIA_MAIN // Bee-Bop-Alula | 233 | #define QTOPIA_MAIN // Bee-Bop-Alula |
231 | 234 | ||
232 | /* | 235 | /* |
233 | * -remove me | 236 | * -remove me |
234 | */ | 237 | */ |
235 | #ifdef Q_WS_QWS | 238 | #ifdef Q_WS_QWS |
236 | extern Q_EXPORT QRect qt_maxWindowRect; | 239 | extern Q_EXPORT QRect qt_maxWindowRect; |
237 | #endif | 240 | #endif |
238 | 241 | ||
239 | #endif | 242 | #endif |