summaryrefslogtreecommitdiff
authorerik <erik>2007-01-19 01:15:31 (UTC)
committer erik <erik>2007-01-19 01:15:31 (UTC)
commitac0ce844e90a64247c0adb210e0a23021b011d57 (patch) (unidiff)
tree1fd3b8d0c24d8f2054ed45e7e2e102f940343462
parent1ab92f1d2b346de7da8ca5c3aaa6bc75b43981e7 (diff)
downloadopie-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.
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--library/qpeapplication.cpp16
-rw-r--r--library/qpeapplication.h2
-rw-r--r--library/widget_showing.cpp9
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
@@ -98,12 +98,13 @@
98#endif 98#endif
99 99
100#include <backend/rohfeedback.h> 100#include <backend/rohfeedback.h>
101 101
102 102
103static bool useBigPixmaps = 0; 103static bool useBigPixmaps = 0;
104static bool saveWindowsPos = 0;
104 105
105class HackWidget : public QWidget 106class HackWidget : public QWidget
106{ 107{
107public: 108public:
108 bool needsOk() 109 bool needsOk()
109 { return (getWState() & WState_Reserved1 ); } 110 { return (getWState() & WState_Reserved1 ); }
@@ -126,12 +127,13 @@ public:
126 cfg.setGroup( "Appearance" ); 127 cfg.setGroup( "Appearance" );
127 useBigPixmaps = cfg.readBoolEntry( "useBigPixmaps", false ); 128 useBigPixmaps = cfg.readBoolEntry( "useBigPixmaps", false );
128 fontFamily = cfg.readEntry( "FontFamily", "Vera" ); 129 fontFamily = cfg.readEntry( "FontFamily", "Vera" );
129 fontSize = cfg.readNumEntry( "FontSize", 10 ); 130 fontSize = cfg.readNumEntry( "FontSize", 10 );
130 smallIconSize = cfg.readNumEntry( "SmallIconSize", 14 ); 131 smallIconSize = cfg.readNumEntry( "SmallIconSize", 14 );
131 bigIconSize = cfg.readNumEntry( "BigIconSize", 32 ); 132 bigIconSize = cfg.readNumEntry( "BigIconSize", 32 );
133 saveWindowsPos = cfg.readBoolEntry( "AllowWindowed", false );
132#ifdef OPIE_WITHROHFEEDBACK 134#ifdef OPIE_WITHROHFEEDBACK
133 RoH = 0; 135 RoH = 0;
134#endif 136#endif
135 } 137 }
136 138
137 int presstimer; 139 int presstimer;
@@ -247,13 +249,14 @@ public:
247 } 249 }
248 } 250 }
249 } 251 }
250 252
251 static bool read_widget_rect(const QString &app, bool &maximized, QPoint &p, QSize &s) 253 static bool read_widget_rect(const QString &app, bool &maximized, QPoint &p, QSize &s)
252 { 254 {
253#ifndef OPIE_NO_WINDOWED 255 if (!saveWindowsPos)
256 return FALSE;
254 maximized = TRUE; 257 maximized = TRUE;
255 // 350 is the trigger in qwsdefaultdecoration for providing a resize button 258 // 350 is the trigger in qwsdefaultdecoration for providing a resize button
256 if ( qApp->desktop()->width() <= 350 ) 259 if ( qApp->desktop()->width() <= 350 )
257 return FALSE; 260 return FALSE;
258 261
259 Config cfg( "qpe" ); 262 Config cfg( "qpe" );
@@ -269,14 +272,12 @@ public:
269 s.setHeight( l[3].toInt() ); 272 s.setHeight( l[3].toInt() );
270 273
271 maximized = l[4].toInt(); 274 maximized = l[4].toInt();
272 275
273 return TRUE; 276 return TRUE;
274 } 277 }
275#endif
276 return FALSE;
277 } 278 }
278 279
279 280
280 static bool validate_widget_size(const QWidget *w, QPoint &p, QSize &s) 281 static bool validate_widget_size(const QWidget *w, QPoint &p, QSize &s)
281 { 282 {
282#ifndef Q_WS_QWS 283#ifndef Q_WS_QWS
@@ -319,13 +320,14 @@ public:
319 } 320 }
320 321
321 static void store_widget_rect(QWidget *w, QString &app) 322 static void store_widget_rect(QWidget *w, QString &app)
322 { 323 {
323 if( !w ) 324 if( !w )
324 return; 325 return;
325#ifndef OPIE_NO_WINDOWED 326 if (!saveWindowsPos)
327 return;
326 // 350 is the trigger in qwsdefaultdecoration for providing a resize button 328 // 350 is the trigger in qwsdefaultdecoration for providing a resize button
327 if ( qApp->desktop()->width() <= 350 ) 329 if ( qApp->desktop()->width() <= 350 )
328 return; 330 return;
329 // we use these to map the offset of geometry and pos. ( we can only use normalGeometry to 331 // we use these to map the offset of geometry and pos. ( we can only use normalGeometry to
330 // get the non-maximized version, so we have to do it the hard way ) 332 // get the non-maximized version, so we have to do it the hard way )
331 int offsetX = w->x() - w->geometry().left(); 333 int offsetX = w->x() - w->geometry().left();
@@ -340,13 +342,12 @@ public:
340 // Stores the window placement as pos(), size() (due to the offset mapping) 342 // Stores the window placement as pos(), size() (due to the offset mapping)
341 Config cfg( "qpe" ); 343 Config cfg( "qpe" );
342 cfg.setGroup("ApplicationPositions"); 344 cfg.setGroup("ApplicationPositions");
343 QString s; 345 QString s;
344 s.sprintf("%d,%d,%d,%d,%d", r.left() + offsetX, r.top() + offsetY, r.width(), r.height(), w->isMaximized() ); 346 s.sprintf("%d,%d,%d,%d,%d", r.left() + offsetX, r.top() + offsetY, r.width(), r.height(), w->isMaximized() );
345 cfg.writeEntry( app, s ); 347 cfg.writeEntry( app, s );
346#endif
347 } 348 }
348 349
349 static bool setWidgetCaptionFromAppName( QWidget* /*mw*/, const QString& /*appName*/, const QString& /*appsPath*/ ) 350 static bool setWidgetCaptionFromAppName( QWidget* /*mw*/, const QString& /*appName*/, const QString& /*appsPath*/ )
350 { 351 {
351 /* 352 /*
352 // This works but disable it for now until it is safe to apply 353 // This works but disable it for now until it is safe to apply
@@ -2204,12 +2205,17 @@ void QPEApplication::hideOrQuit()
2204 } 2205 }
2205#endif 2206#endif
2206 else 2207 else
2207 quit(); 2208 quit();
2208} 2209}
2209 2210
2211bool QPEApplication::isSaveWindowsPos()
2212{
2213 return saveWindowsPos;
2214}
2215
2210#if (__GNUC__ > 2 ) && !defined(_OS_MACX_) 2216#if (__GNUC__ > 2 ) && !defined(_OS_MACX_)
2211extern "C" void __cxa_pure_virtual(); 2217extern "C" void __cxa_pure_virtual();
2212 2218
2213void __cxa_pure_virtual() 2219void __cxa_pure_virtual()
2214{ 2220{
2215 fprintf( stderr, "Pure virtual called\n"); 2221 fprintf( stderr, "Pure virtual called\n");
diff --git a/library/qpeapplication.h b/library/qpeapplication.h
index 6486cad..7c99a9a 100644
--- a/library/qpeapplication.h
+++ b/library/qpeapplication.h
@@ -134,12 +134,14 @@ public:
134 bool keepRunning() const; 134 bool keepRunning() const;
135 135
136 bool keyboardGrabbed() const; 136 bool keyboardGrabbed() const;
137 137
138 int exec(); 138 int exec();
139 139
140 static bool isSaveWindowsPos();
141
140signals: 142signals:
141 void clientMoused(); 143 void clientMoused();
142 void timeChanged(); 144 void timeChanged();
143 void clockChanged( bool pm ); 145 void clockChanged( bool pm );
144 void micChanged( bool muted ); 146 void micChanged( bool muted );
145 void volumeChanged( bool muted ); 147 void volumeChanged( bool muted );
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
@@ -49,19 +49,14 @@ int QPEApplication::execDialog( QDialog* d, bool nomax )
49void QPEApplication::showWidget( QWidget* wg, bool nomax ) { 49void QPEApplication::showWidget( QWidget* wg, bool nomax ) {
50 if ( wg->isVisible() ) { 50 if ( wg->isVisible() ) {
51 wg->show(); 51 wg->show();
52 return; 52 return;
53 } 53 }
54 54
55#ifdef OPIE_NO_WINDOWED 55 if ( !isSaveWindowsPos() || (!nomax
56 Q_UNUSED( nomax ) 56 && ( qApp->desktop()->width() <= 30 )) ){
57 if ( TRUE ) {
58#else
59 if ( !nomax
60 && ( qApp->desktop()->width() <= 320 ) ){
61#endif
62 wg->showMaximized(); 57 wg->showMaximized();
63 } else { 58 } else {
64#ifdef Q_WS_QWS 59#ifdef Q_WS_QWS
65 QSize desk = QSize( qApp->desktop()->width(), qApp->desktop()->height() ); 60 QSize desk = QSize( qApp->desktop()->width(), qApp->desktop()->height() );
66#else 61#else
67 QSize desk = QSize( qt_maxWindowRect.width(), qt_maxWindowRect.height() ); 62 QSize desk = QSize( qt_maxWindowRect.width(), qt_maxWindowRect.height() );