author | erik <erik> | 2007-01-19 01:15:31 (UTC) |
---|---|---|
committer | erik <erik> | 2007-01-19 01:15:31 (UTC) |
commit | ac0ce844e90a64247c0adb210e0a23021b011d57 (patch) (side-by-side diff) | |
tree | 1fd3b8d0c24d8f2054ed45e7e2e102f940343462 | |
parent | 1ab92f1d2b346de7da8ca5c3aaa6bc75b43981e7 (diff) | |
download | opie-ac0ce844e90a64247c0adb210e0a23021b011d57.zip opie-ac0ce844e90a64247c0adb210e0a23021b011d57.tar.gz opie-ac0ce844e90a64247c0adb210e0a23021b011d57.tar.bz2 |
Commit of Paul's patch to remove a macro and substitute it with a
class variable.
-rw-r--r-- | library/qpeapplication.cpp | 16 | ||||
-rw-r--r-- | library/qpeapplication.h | 2 | ||||
-rw-r--r-- | library/widget_showing.cpp | 9 |
3 files changed, 15 insertions, 12 deletions
diff --git a/library/qpeapplication.cpp b/library/qpeapplication.cpp index dcc1001..34f5e6a 100644 --- a/library/qpeapplication.cpp +++ b/library/qpeapplication.cpp @@ -92,24 +92,25 @@ #include <unistd.h> #include <sys/file.h> #include <sys/ioctl.h> #ifndef QT_NO_SOUND #include <sys/soundcard.h> #endif #include <backend/rohfeedback.h> static bool useBigPixmaps = 0; +static bool saveWindowsPos = 0; class HackWidget : public QWidget { public: bool needsOk() { return (getWState() & WState_Reserved1 ); } QRect normalGeometry() { return topData()->normalGeometry; }; }; class QPEApplicationData @@ -120,24 +121,25 @@ public: notbusysent( false ), preloaded( false ), forceshow( false ), nomaximize( false ), keep_running( true ), qcopQok( false ), fontFamily( "Vera" ), fontSize( 10 ), smallIconSize( 14 ), bigIconSize( 32 ), qpe_main_widget( 0 ) { Config cfg( "qpe" ); cfg.setGroup( "Appearance" ); useBigPixmaps = cfg.readBoolEntry( "useBigPixmaps", false ); fontFamily = cfg.readEntry( "FontFamily", "Vera" ); fontSize = cfg.readNumEntry( "FontSize", 10 ); smallIconSize = cfg.readNumEntry( "SmallIconSize", 14 ); bigIconSize = cfg.readNumEntry( "BigIconSize", 32 ); + saveWindowsPos = cfg.readBoolEntry( "AllowWindowed", false ); #ifdef OPIE_WITHROHFEEDBACK RoH = 0; #endif } int presstimer; QWidget* presswidget; QPoint presspos; #ifdef OPIE_WITHROHFEEDBACK Opie::Internal::RoHFeedback *RoH; #endif @@ -241,48 +243,47 @@ public: #endif } if ( max && !nomaximize ) mw->showMaximized(); else mw->show(); } } } static bool read_widget_rect(const QString &app, bool &maximized, QPoint &p, QSize &s) { -#ifndef OPIE_NO_WINDOWED + if (!saveWindowsPos) + return FALSE; maximized = TRUE; // 350 is the trigger in qwsdefaultdecoration for providing a resize button if ( qApp->desktop()->width() <= 350 ) return FALSE; Config cfg( "qpe" ); cfg.setGroup("ApplicationPositions"); QString str = cfg.readEntry( app, QString::null ); QStringList l = QStringList::split(",", str); if ( l.count() == 5) { p.setX( l[0].toInt() ); p.setY( l[1].toInt() ); s.setWidth( l[2].toInt() ); s.setHeight( l[3].toInt() ); maximized = l[4].toInt(); return TRUE; } -#endif - return FALSE; } static bool validate_widget_size(const QWidget *w, QPoint &p, QSize &s) { #ifndef Q_WS_QWS QRect qt_maxWindowRect = qApp->desktop()->geometry(); #endif int maxX = qt_maxWindowRect.width(); int maxY = qt_maxWindowRect.height(); int wWidth = s.width() + ( w->frameGeometry().width() - w->geometry().width() ); int wHeight = s.height() + ( w->frameGeometry().height() - w->geometry().height() ); @@ -313,46 +314,46 @@ public: if ( p.x() + wWidth > maxX ) p.setX( maxX - wWidth ); if ( p.y() + wHeight > maxY ) p.setY( maxY - wHeight ); return TRUE; } static void store_widget_rect(QWidget *w, QString &app) { if( !w ) return; -#ifndef OPIE_NO_WINDOWED + if (!saveWindowsPos) + return; // 350 is the trigger in qwsdefaultdecoration for providing a resize button if ( qApp->desktop()->width() <= 350 ) return; // we use these to map the offset of geometry and pos. ( we can only use normalGeometry to // get the non-maximized version, so we have to do it the hard way ) int offsetX = w->x() - w->geometry().left(); int offsetY = w->y() - w->geometry().top(); QRect r; if ( w->isMaximized() ) r = ( (HackWidget *) w)->normalGeometry(); else r = w->geometry(); // Stores the window placement as pos(), size() (due to the offset mapping) Config cfg( "qpe" ); cfg.setGroup("ApplicationPositions"); QString s; s.sprintf("%d,%d,%d,%d,%d", r.left() + offsetX, r.top() + offsetY, r.width(), r.height(), w->isMaximized() ); cfg.writeEntry( app, s ); -#endif } static bool setWidgetCaptionFromAppName( QWidget* /*mw*/, const QString& /*appName*/, const QString& /*appsPath*/ ) { /* // This works but disable it for now until it is safe to apply // What is does is scan the .desktop files of all the apps for // the applnk that has the corresponding argv[0] as this program // then it uses the name stored in the .desktop file as the caption // for the main widget. This saves duplicating translations for // the app name in the program and in the .desktop files. @@ -2198,24 +2199,29 @@ void QPEApplication::hideOrQuit() #ifndef QT_NO_COP { QCopEnvelope e("QPE/System", "fastAppHiding(QString)" ); e << d->appName; d->qpe_main_widget->hide(); } #endif else quit(); } +bool QPEApplication::isSaveWindowsPos() +{ + return saveWindowsPos; +} + #if (__GNUC__ > 2 ) && !defined(_OS_MACX_) extern "C" void __cxa_pure_virtual(); void __cxa_pure_virtual() { fprintf( stderr, "Pure virtual called\n"); abort(); } #endif diff --git a/library/qpeapplication.h b/library/qpeapplication.h index 6486cad..7c99a9a 100644 --- a/library/qpeapplication.h +++ b/library/qpeapplication.h @@ -128,24 +128,26 @@ public: /* Merge setTempScreenSaverMode */ #ifdef QTOPIA_INTERNAL_INITAPP void initApp( int argv, char **argv ); #endif static void setKeepRunning(); bool keepRunning() const; bool keyboardGrabbed() const; int exec(); + static bool isSaveWindowsPos(); + signals: void clientMoused(); void timeChanged(); void clockChanged( bool pm ); void micChanged( bool muted ); void volumeChanged( bool muted ); void appMessage( const QCString& msg, const QByteArray& data); void weekChanged( bool startOnMonday ); void dateFormatChanged( DateFormat ); void flush(); void reload(); /* linkChanged signal */ diff --git a/library/widget_showing.cpp b/library/widget_showing.cpp index e43a16a..cc1bfb2 100644 --- a/library/widget_showing.cpp +++ b/library/widget_showing.cpp @@ -43,31 +43,26 @@ void QPEApplication::showDialog( QDialog* d, bool nomax ) int QPEApplication::execDialog( QDialog* d, bool nomax ) { showDialog( d, nomax ); return d->exec(); } void QPEApplication::showWidget( QWidget* wg, bool nomax ) { if ( wg->isVisible() ) { wg->show(); return; } -#ifdef OPIE_NO_WINDOWED - Q_UNUSED( nomax ) - if ( TRUE ) { -#else - if ( !nomax - && ( qApp->desktop()->width() <= 320 ) ){ -#endif + if ( !isSaveWindowsPos() || (!nomax + && ( qApp->desktop()->width() <= 30 )) ){ wg->showMaximized(); } else { #ifdef Q_WS_QWS QSize desk = QSize( qApp->desktop()->width(), qApp->desktop()->height() ); #else QSize desk = QSize( qt_maxWindowRect.width(), qt_maxWindowRect.height() ); #endif QSize sh = wg->sizeHint(); int w = QMAX( sh.width(), wg->width() ); int h = QMAX( sh.height(), wg->height() ); // desktop widget-frame taskbar |