summaryrefslogtreecommitdiff
authorharlekin <harlekin>2003-04-19 22:19:11 (UTC)
committer harlekin <harlekin>2003-04-19 22:19:11 (UTC)
commit0374e0e52e9b754ae48ada631cad2b397feabb21 (patch) (unidiff)
treec4dff4db838838956d7f137b52839a11ddaad0e1
parent29c556ffc9b1497cd996ceb46d646b1eaf1288be (diff)
downloadopie-0374e0e52e9b754ae48ada631cad2b397feabb21.zip
opie-0374e0e52e9b754ae48ada631cad2b397feabb21.tar.gz
opie-0374e0e52e9b754ae48ada631cad2b397feabb21.tar.bz2
big toolbar icons for screenwidths > 600
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--library/qpeapplication.cpp18
1 files changed, 14 insertions, 4 deletions
diff --git a/library/qpeapplication.cpp b/library/qpeapplication.cpp
index 2ef60d5..7f8299a 100644
--- a/library/qpeapplication.cpp
+++ b/library/qpeapplication.cpp
@@ -29,48 +29,49 @@
29#if QT_VERSION <= 231 29#if QT_VERSION <= 231
30#define private public 30#define private public
31#define sendLocally processEvent 31#define sendLocally processEvent
32#include "qcopenvelope_qws.h" 32#include "qcopenvelope_qws.h"
33#undef private 33#undef private
34#else 34#else
35#include "qcopenvelope_qws.h" 35#include "qcopenvelope_qws.h"
36#endif 36#endif
37#endif 37#endif
38#include <qwindowsystem_qws.h> 38#include <qwindowsystem_qws.h>
39#endif 39#endif
40#include <qtextstream.h> 40#include <qtextstream.h>
41#include <qpalette.h> 41#include <qpalette.h>
42#include <qbuffer.h> 42#include <qbuffer.h>
43#include <qptrdict.h> 43#include <qptrdict.h>
44#include <qregexp.h> 44#include <qregexp.h>
45#include <qdir.h> 45#include <qdir.h>
46#include <qlabel.h> 46#include <qlabel.h>
47#include <qdialog.h> 47#include <qdialog.h>
48#include <qdragobject.h> 48#include <qdragobject.h>
49#include <qtextcodec.h> 49#include <qtextcodec.h>
50#include <qevent.h> 50#include <qevent.h>
51#include <qtooltip.h> 51#include <qtooltip.h>
52#include <qsignal.h> 52#include <qsignal.h>
53#include <qmainwindow.h>
53#include "qpeapplication.h" 54#include "qpeapplication.h"
54#include "qpestyle.h" 55#include "qpestyle.h"
55#include "styleinterface.h" 56#include "styleinterface.h"
56#if QT_VERSION >= 300 57#if QT_VERSION >= 300
57#include <qstylefactory.h> 58#include <qstylefactory.h>
58#else 59#else
59#include <qplatinumstyle.h> 60#include <qplatinumstyle.h>
60#include <qwindowsstyle.h> 61#include <qwindowsstyle.h>
61#include <qmotifstyle.h> 62#include <qmotifstyle.h>
62#include <qmotifplusstyle.h> 63#include <qmotifplusstyle.h>
63#include "lightstyle.h" 64#include "lightstyle.h"
64 65
65#include <qpe/qlibrary.h> 66#include <qpe/qlibrary.h>
66#endif 67#endif
67#include "global.h" 68#include "global.h"
68#include "resource.h" 69#include "resource.h"
69#if QT_VERSION <= 230 && defined(QT_NO_CODECS) 70#if QT_VERSION <= 230 && defined(QT_NO_CODECS)
70#include "qutfcodec.h" 71#include "qutfcodec.h"
71#endif 72#endif
72#include "config.h" 73#include "config.h"
73#include "network.h" 74#include "network.h"
74#ifdef QWS 75#ifdef QWS
75#include "fontmanager.h" 76#include "fontmanager.h"
76#endif 77#endif
@@ -125,48 +126,54 @@ public:
125 QCString message; 126 QCString message;
126 QByteArray data; 127 QByteArray data;
127 }; 128 };
128 QWidget* qpe_main_widget; 129 QWidget* qpe_main_widget;
129 QList<QCopRec> qcopq; 130 QList<QCopRec> qcopq;
130 131
131 void enqueueQCop( const QCString &ch, const QCString &msg, 132 void enqueueQCop( const QCString &ch, const QCString &msg,
132 const QByteArray &data ) 133 const QByteArray &data )
133 { 134 {
134 qcopq.append( new QCopRec( ch, msg, data ) ); 135 qcopq.append( new QCopRec( ch, msg, data ) );
135 } 136 }
136 void sendQCopQ() 137 void sendQCopQ()
137 { 138 {
138 QCopRec * r; 139 QCopRec * r;
139#ifndef QT_NO_COP 140#ifndef QT_NO_COP
140 141
141 for ( QListIterator<QCopRec> it( qcopq ); ( r = it.current() ); ++it ) 142 for ( QListIterator<QCopRec> it( qcopq ); ( r = it.current() ); ++it )
142 QCopChannel::sendLocally( r->channel, r->message, r->data ); 143 QCopChannel::sendLocally( r->channel, r->message, r->data );
143#endif 144#endif
144 145
145 qcopq.clear(); 146 qcopq.clear();
146 } 147 }
147 static void show_mx(QWidget* mw, bool nomaximize) 148 static void show_mx(QWidget* mw, bool nomaximize)
148 { 149 {
150
151 // ugly hack, remove that later after finding a sane solution
152 if ( QPEApplication::desktop() ->width() >= 600 && ( mw->inherits("QMainWindow") || mw->isA("QMainWindow") ) ) {
153 ( ( QMainWindow* ) mw )->setUsesBigPixmaps( true );
154 }
155
149 if ( mw->layout() && mw->inherits("QDialog") ) { 156 if ( mw->layout() && mw->inherits("QDialog") ) {
150 QPEApplication::showDialog((QDialog*)mw, nomaximize); 157 QPEApplication::showDialog((QDialog*)mw, nomaximize);
151 } 158 }
152 else { 159 else {
153#ifdef Q_WS_QWS 160#ifdef Q_WS_QWS
154 if ( !nomaximize ) 161 if ( !nomaximize )
155 mw->showMaximized(); 162 mw->showMaximized();
156 else 163 else
157#endif 164#endif
158 165
159 mw->show(); 166 mw->show();
160 } 167 }
161 } 168 }
162 static bool setWidgetCaptionFromAppName( QWidget* /*mw*/, const QString& /*appName*/, const QString& /*appsPath*/ ) 169 static bool setWidgetCaptionFromAppName( QWidget* /*mw*/, const QString& /*appName*/, const QString& /*appsPath*/ )
163 { 170 {
164 /* 171 /*
165 // This works but disable it for now until it is safe to apply 172 // This works but disable it for now until it is safe to apply
166 // What is does is scan the .desktop files of all the apps for 173 // What is does is scan the .desktop files of all the apps for
167 // the applnk that has the corresponding argv[0] as this program 174 // the applnk that has the corresponding argv[0] as this program
168 // then it uses the name stored in the .desktop file as the caption 175 // then it uses the name stored in the .desktop file as the caption
169 // for the main widget. This saves duplicating translations for 176 // for the main widget. This saves duplicating translations for
170 // the app name in the program and in the .desktop files. 177 // the app name in the program and in the .desktop files.
171 178
172 AppLnkSet apps( appsPath ); 179 AppLnkSet apps( appsPath );
@@ -487,58 +494,58 @@ static void setTreble( int t = 0, int percent = -1 )
487 } else if ( msg == "otherMessage(QString)" ) { 494 } else if ( msg == "otherMessage(QString)" ) {
488 ... 495 ...
489 } 496 }
490 } 497 }
491\endcode 498\endcode
492 499
493 \sa qcop.html 500 \sa qcop.html
494 Note that messages received here may be processed by qpe application 501 Note that messages received here may be processed by qpe application
495 and emitted as signals, such as flush() and reload(). 502 and emitted as signals, such as flush() and reload().
496*/ 503*/
497 504
498/*! 505/*!
499 Constructs a QPEApplication just as you would construct 506 Constructs a QPEApplication just as you would construct
500 a QApplication, passing \a argc, \a argv, and \a t. 507 a QApplication, passing \a argc, \a argv, and \a t.
501 508
502 For applications, \a t should be the default, GuiClient. Only 509 For applications, \a t should be the default, GuiClient. Only
503 the Qtopia server passes GuiServer. 510 the Qtopia server passes GuiServer.
504*/ 511*/
505QPEApplication::QPEApplication( int & argc, char **argv, Type t ) 512QPEApplication::QPEApplication( int & argc, char **argv, Type t )
506 : QApplication( argc, argv, t ) 513 : QApplication( argc, argv, t )
507{ 514{
508 d = new QPEApplicationData; 515 d = new QPEApplicationData;
509 d->loadTextCodecs(); 516 d->loadTextCodecs();
510 d->loadImageCodecs(); 517 d->loadImageCodecs();
511 int dw = desktop() ->width(); 518 int dw = desktop() ->width();
512 519
513 if ( dw < 200 ) { 520 if ( dw < 200 ) {
514 setFont( QFont( "helvetica", 8 ) ); 521 setFont( QFont( "helvetica", 8 ) );
515 AppLnk::setSmallIconSize( 10 ); 522 AppLnk::setSmallIconSize( 10 );
516 AppLnk::setBigIconSize( 28 ); 523 AppLnk::setBigIconSize( 28 );
517 } 524 }
518 else if ( dw > 600 ) { 525 else if ( dw > 600 ) {
519 setFont( QFont( "helvetica", 18 ) ); 526 setFont( QFont( "helvetica", 18 ) );
520 AppLnk::setSmallIconSize( 24 ); 527 AppLnk::setSmallIconSize( 24 );
521 AppLnk::setBigIconSize( 48 ); 528 AppLnk::setBigIconSize( 48 );
522 } 529 }
523 else if ( dw > 200 ) { 530 else if ( dw > 200 ) {
524 setFont( QFont( "helvetica", 10 ) ); 531 setFont( QFont( "helvetica", 10 ) );
525 AppLnk::setSmallIconSize( 14 ); 532 AppLnk::setSmallIconSize( 14 );
526 AppLnk::setBigIconSize( 32 ); 533 AppLnk::setBigIconSize( 32 );
527 } 534 }
528 535
529 536
530 QMimeSourceFactory::setDefaultFactory( new ResourceMimeFactory ); 537 QMimeSourceFactory::setDefaultFactory( new ResourceMimeFactory );
531 538
532 connect( this, SIGNAL( lastWindowClosed() ), this, SLOT( hideOrQuit() ) ); 539 connect( this, SIGNAL( lastWindowClosed() ), this, SLOT( hideOrQuit() ) );
533#if defined(Q_WS_QWS) && !defined(QT_NO_COP) 540#if defined(Q_WS_QWS) && !defined(QT_NO_COP)
534 541
535 QString qcopfn( "/tmp/qcop-msg-" ); 542 QString qcopfn( "/tmp/qcop-msg-" );
536 qcopfn += QString( argv[ 0 ] ); // append command name 543 qcopfn += QString( argv[ 0 ] ); // append command name
537 544
538 QFile f( qcopfn ); 545 QFile f( qcopfn );
539 if ( f.open( IO_ReadOnly ) ) { 546 if ( f.open( IO_ReadOnly ) ) {
540 flock( f.handle(), LOCK_EX ); 547 flock( f.handle(), LOCK_EX );
541 } 548 }
542 549
543 sysChannel = new QCopChannel( "QPE/System", this ); 550 sysChannel = new QCopChannel( "QPE/System", this );
544 connect( sysChannel, SIGNAL( received( const QCString &, const QByteArray & ) ), 551 connect( sysChannel, SIGNAL( received( const QCString &, const QByteArray & ) ),
@@ -842,48 +849,50 @@ bool QPEApplication::qwsEventFilter( QWSEvent * e )
842 if ( e->type == QWSEvent::Focus ) { 849 if ( e->type == QWSEvent::Focus ) {
843 QWSFocusEvent * fe = ( QWSFocusEvent* ) e; 850 QWSFocusEvent * fe = ( QWSFocusEvent* ) e;
844 if ( !fe->simpleData.get_focus ) { 851 if ( !fe->simpleData.get_focus ) {
845 QWidget * active = activeWindow(); 852 QWidget * active = activeWindow();
846 while ( active && active->isPopup() ) { 853 while ( active && active->isPopup() ) {
847 active->close(); 854 active->close();
848 active = activeWindow(); 855 active = activeWindow();
849 } 856 }
850 } 857 }
851 else { 858 else {
852 // make sure our modal widget is ALWAYS on top 859 // make sure our modal widget is ALWAYS on top
853 QWidget *topm = activeModalWidget(); 860 QWidget *topm = activeModalWidget();
854 if ( topm ) { 861 if ( topm ) {
855 topm->raise(); 862 topm->raise();
856 } 863 }
857 } 864 }
858 if ( fe->simpleData.get_focus && inputMethodDict ) { 865 if ( fe->simpleData.get_focus && inputMethodDict ) {
859 InputMethodHint m = inputMethodHint( QWidget::find( e->window() ) ); 866 InputMethodHint m = inputMethodHint( QWidget::find( e->window() ) );
860 if ( m == AlwaysOff ) 867 if ( m == AlwaysOff )
861 Global::hideInputMethod(); 868 Global::hideInputMethod();
862 if ( m == AlwaysOn ) 869 if ( m == AlwaysOn )
863 Global::showInputMethod(); 870 Global::showInputMethod();
864 } 871 }
865 } 872 }
873
874
866 return QApplication::qwsEventFilter( e ); 875 return QApplication::qwsEventFilter( e );
867} 876}
868#endif 877#endif
869 878
870/*! 879/*!
871 Destroys the QPEApplication. 880 Destroys the QPEApplication.
872*/ 881*/
873QPEApplication::~QPEApplication() 882QPEApplication::~QPEApplication()
874{ 883{
875 ungrabKeyboard(); 884 ungrabKeyboard();
876#if defined(Q_WS_QWS) && !defined(QT_NO_COP) 885#if defined(Q_WS_QWS) && !defined(QT_NO_COP)
877 // Need to delete QCopChannels early, since the display will 886 // Need to delete QCopChannels early, since the display will
878 // be gone by the time we get to ~QObject(). 887 // be gone by the time we get to ~QObject().
879 delete sysChannel; 888 delete sysChannel;
880 delete pidChannel; 889 delete pidChannel;
881#endif 890#endif
882 891
883 delete d; 892 delete d;
884} 893}
885 894
886/*! 895/*!
887 Returns <tt>$OPIEDIR/</tt>. 896 Returns <tt>$OPIEDIR/</tt>.
888*/ 897*/
889QString QPEApplication::qpeDir() 898QString QPEApplication::qpeDir()
@@ -1296,67 +1305,68 @@ void QPEApplication::pidMessage( const QCString& msg, const QByteArray& data)
1296 } 1305 }
1297 else if ( msg == "nextView()" ) { 1306 else if ( msg == "nextView()" ) {
1298 qDebug("got nextView()"); 1307 qDebug("got nextView()");
1299 /* 1308 /*
1300 if ( raiseAppropriateWindow() ) 1309 if ( raiseAppropriateWindow() )
1301 */ 1310 */
1302 emit appMessage( msg, data); 1311 emit appMessage( msg, data);
1303 } 1312 }
1304 else { 1313 else {
1305 emit appMessage( msg, data); 1314 emit appMessage( msg, data);
1306 } 1315 }
1307 1316
1308#endif 1317#endif
1309} 1318}
1310 1319
1311 1320
1312/*! 1321/*!
1313 Sets widget \a mw as the mainWidget() and shows it. For small windows, 1322 Sets widget \a mw as the mainWidget() and shows it. For small windows,
1314 consider passing TRUE for \a nomaximize rather than the default FALSE. 1323 consider passing TRUE for \a nomaximize rather than the default FALSE.
1315 1324
1316 \sa showMainDocumentWidget() 1325 \sa showMainDocumentWidget()
1317*/ 1326*/
1318void QPEApplication::showMainWidget( QWidget* mw, bool nomaximize ) 1327void QPEApplication::showMainWidget( QWidget* mw, bool nomaximize )
1319{ 1328{
1320 d->show(mw, nomaximize ); 1329 d->show(mw, nomaximize );
1321} 1330}
1322 1331
1323/*! 1332/*!
1324 Sets widget \a mw as the mainWidget() and shows it. For small windows, 1333 Sets widget \a mw as the mainWidget() and shows it. For small windows,
1325 consider passing TRUE for \a nomaximize rather than the default FALSE. 1334 consider passing TRUE for \a nomaximize rather than the default FALSE.
1326 1335
1327 This calls designates the application as 1336 This calls designates the application as
1328 a \link docwidget.html document-oriented\endlink application. 1337 a \link docwidget.html document-oriented\endlink application.
1329 1338
1330 The \a mw widget \e must have this slot: setDocument(const QString&). 1339 The \a mw widget \e must have this slot: setDocument(const QString&).
1331 1340
1332 \sa showMainWidget() 1341 \sa showMainWidget()
1333*/ 1342*/
1334void QPEApplication::showMainDocumentWidget( QWidget* mw, bool nomaximize ) 1343void QPEApplication::showMainDocumentWidget( QWidget* mw, bool nomaximize )
1335{ 1344{
1336 if ( mw && argc() == 2 ) 1345 if ( mw && argc() == 2 )
1337 Global::setDocument( mw, QString::fromUtf8(argv()[1]) ); 1346 Global::setDocument( mw, QString::fromUtf8(argv()[1]) );
1338 1347
1348
1339 d->show(mw, nomaximize ); 1349 d->show(mw, nomaximize );
1340} 1350}
1341 1351
1342 1352
1343/*! 1353/*!
1344 If an application is started via a \link qcop.html QCop\endlink 1354 If an application is started via a \link qcop.html QCop\endlink
1345 message, the application will process the \link qcop.html 1355 message, the application will process the \link qcop.html
1346 QCop\endlink message and then quit. If the application calls this 1356 QCop\endlink message and then quit. If the application calls this
1347 function while processing a \link qcop.html QCop\endlink message, 1357 function while processing a \link qcop.html QCop\endlink message,
1348 after processing its outstanding \link qcop.html QCop\endlink 1358 after processing its outstanding \link qcop.html QCop\endlink
1349 messages the application will start 'properly' and show itself. 1359 messages the application will start 'properly' and show itself.
1350 1360
1351 \sa keepRunning() 1361 \sa keepRunning()
1352*/ 1362*/
1353void QPEApplication::setKeepRunning() 1363void QPEApplication::setKeepRunning()
1354{ 1364{
1355 if ( qApp && qApp->inherits( "QPEApplication" ) ) { 1365 if ( qApp && qApp->inherits( "QPEApplication" ) ) {
1356 QPEApplication * qpeApp = ( QPEApplication* ) qApp; 1366 QPEApplication * qpeApp = ( QPEApplication* ) qApp;
1357 qpeApp->d->keep_running = TRUE; 1367 qpeApp->d->keep_running = TRUE;
1358 } 1368 }
1359} 1369}
1360 1370
1361/*! 1371/*!
1362 Returns TRUE if the application will quit after processing the 1372 Returns TRUE if the application will quit after processing the