summaryrefslogtreecommitdiff
path: root/library/qpeapplication.cpp
authorzecke <zecke>2003-10-07 13:00:31 (UTC)
committer zecke <zecke>2003-10-07 13:00:31 (UTC)
commit62d81aa76146401087e3ec9dcebd298a7d030c4a (patch) (unidiff)
treec84a25f10fef6ca178f66eb1eee92916c6860db9 /library/qpeapplication.cpp
parent6f807f937764d0b80d38cd5e29983ad4ec2ae3c8 (diff)
downloadopie-62d81aa76146401087e3ec9dcebd298a7d030c4a.zip
opie-62d81aa76146401087e3ec9dcebd298a7d030c4a.tar.gz
opie-62d81aa76146401087e3ec9dcebd298a7d030c4a.tar.bz2
Add the possible defines to the custom- device headers
-storage remove stupid check for custom.h. We gurantee it to be present ( even if it is empty ) -qpeapplication -introduce OPIE_NEW_MALLOC This will use malloc and free for new and delete -introduce OPIE_HIGH_RES_SMALL_PHY define this if you've a high resolution but physical smaller display FIXME: some one needs to introduce a C7xx Custom.h or define OPIE_HIGH_RES_SMALL_PHY somewhere in the custom-sharp.h
Diffstat (limited to 'library/qpeapplication.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--library/qpeapplication.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/library/qpeapplication.cpp b/library/qpeapplication.cpp
index feba8b6..cd1c62e 100644
--- a/library/qpeapplication.cpp
+++ b/library/qpeapplication.cpp
@@ -138,65 +138,65 @@ public:
138 QString decorationName; 138 QString decorationName;
139 139
140 void enqueueQCop( const QCString &ch, const QCString &msg, 140 void enqueueQCop( const QCString &ch, const QCString &msg,
141 const QByteArray &data ) 141 const QByteArray &data )
142 { 142 {
143 qcopq.enqueue( new QCopRec( ch, msg, data ) ); 143 qcopq.enqueue( new QCopRec( ch, msg, data ) );
144 } 144 }
145 void sendQCopQ() 145 void sendQCopQ()
146 { 146 {
147 if (!qcopQok ) 147 if (!qcopQok )
148 return; 148 return;
149 149
150 QCopRec * r; 150 QCopRec * r;
151 151
152 while((r=qcopq.dequeue())) { 152 while((r=qcopq.dequeue())) {
153 // remove from queue before sending... 153 // remove from queue before sending...
154 // event loop can come around again before getting 154 // event loop can come around again before getting
155 // back from sendLocally 155 // back from sendLocally
156#ifndef QT_NO_COP 156#ifndef QT_NO_COP
157 QCopChannel::sendLocally( r->channel, r->message, r->data ); 157 QCopChannel::sendLocally( r->channel, r->message, r->data );
158#endif 158#endif
159 159
160 delete r; 160 delete r;
161 } 161 }
162 } 162 }
163 static void show_mx(QWidget* mw, bool nomaximize, const QString & = QString::null ) 163 static void show_mx(QWidget* mw, bool nomaximize, const QString & = QString::null )
164 { 164 {
165 165
166 // ugly hack, remove that later after finding a sane solution 166 // ugly hack, remove that later after finding a sane solution
167 // Addendum: Only Sharp currently has models with high resolution but (physically) small displays, 167 // Addendum: Only Sharp currently has models with high resolution but (physically) small displays,
168 // so this is only useful if QT_QWS_SIMPAD is NOT defined. E.g. SIMpad has 800x600 but has 168 // so this is only useful if QT_QWS_SIMPAD is NOT defined. E.g. SIMpad has 800x600 but has
169 // a (physically) large enough display to use the small icons 169 // a (physically) large enough display to use the small icons
170#ifndef QT_QWS_SIMPAD 170#if defined(OPIE_HIGH_RES_SMALL_PHY)
171 if ( QPEApplication::desktop() ->width() >= 600 && ( mw->inherits("QMainWindow") || mw->isA("QMainWindow") ) ) { 171 if ( QPEApplication::desktop() ->width() >= 600 && ( mw->inherits("QMainWindow") || mw->isA("QMainWindow") ) ) {
172 ( ( QMainWindow* ) mw )->setUsesBigPixmaps( true ); 172 ( ( QMainWindow* ) mw )->setUsesBigPixmaps( true );
173 } 173 }
174#endif 174#endif
175 175
176 if ( mw->layout() && mw->inherits("QDialog") ) { 176 if ( mw->layout() && mw->inherits("QDialog") ) {
177 QPEApplication::showDialog((QDialog*)mw, nomaximize); 177 QPEApplication::showDialog((QDialog*)mw, nomaximize);
178 } 178 }
179 else { 179 else {
180#ifdef Q_WS_QWS 180#ifdef Q_WS_QWS
181 if ( !nomaximize ) 181 if ( !nomaximize )
182 mw->showMaximized(); 182 mw->showMaximized();
183 else 183 else
184#endif 184#endif
185 185
186 mw->show(); 186 mw->show();
187 } 187 }
188 } 188 }
189 static bool setWidgetCaptionFromAppName( QWidget* /*mw*/, const QString& /*appName*/, const QString& /*appsPath*/ ) 189 static bool setWidgetCaptionFromAppName( QWidget* /*mw*/, const QString& /*appName*/, const QString& /*appsPath*/ )
190 { 190 {
191 /* 191 /*
192 // This works but disable it for now until it is safe to apply 192 // This works but disable it for now until it is safe to apply
193 // What is does is scan the .desktop files of all the apps for 193 // What is does is scan the .desktop files of all the apps for
194 // the applnk that has the corresponding argv[0] as this program 194 // the applnk that has the corresponding argv[0] as this program
195 // then it uses the name stored in the .desktop file as the caption 195 // then it uses the name stored in the .desktop file as the caption
196 // for the main widget. This saves duplicating translations for 196 // for the main widget. This saves duplicating translations for
197 // the app name in the program and in the .desktop files. 197 // the app name in the program and in the .desktop files.
198 198
199 AppLnkSet apps( appsPath ); 199 AppLnkSet apps( appsPath );
200 200
201 QList<AppLnk> appsList = apps.children(); 201 QList<AppLnk> appsList = apps.children();
202 for ( QListIterator<AppLnk> it(appsList); it.current(); ++it ) { 202 for ( QListIterator<AppLnk> it(appsList); it.current(); ++it ) {
@@ -561,68 +561,68 @@ void QPEApplication::processQCopFile()
561 ... 561 ...
562 } 562 }
563 } 563 }
564\endcode 564\endcode
565 565
566 \sa qcop.html 566 \sa qcop.html
567 Note that messages received here may be processed by qpe application 567 Note that messages received here may be processed by qpe application
568 and emitted as signals, such as flush() and reload(). 568 and emitted as signals, such as flush() and reload().
569*/ 569*/
570 570
571/*! 571/*!
572 Constructs a QPEApplication just as you would construct 572 Constructs a QPEApplication just as you would construct
573 a QApplication, passing \a argc, \a argv, and \a t. 573 a QApplication, passing \a argc, \a argv, and \a t.
574 574
575 For applications, \a t should be the default, GuiClient. Only 575 For applications, \a t should be the default, GuiClient. Only
576 the Qtopia server passes GuiServer. 576 the Qtopia server passes GuiServer.
577*/ 577*/
578QPEApplication::QPEApplication( int & argc, char **argv, Type t ) 578QPEApplication::QPEApplication( int & argc, char **argv, Type t )
579 : QApplication( hack(argc), argv, t ), pidChannel( 0 ) 579 : QApplication( hack(argc), argv, t ), pidChannel( 0 )
580{ 580{
581 QPixmapCache::setCacheLimit(256); // sensible default for smaller devices. 581 QPixmapCache::setCacheLimit(256); // sensible default for smaller devices.
582 582
583 d = new QPEApplicationData; 583 d = new QPEApplicationData;
584 d->loadTextCodecs(); 584 d->loadTextCodecs();
585 d->loadImageCodecs(); 585 d->loadImageCodecs();
586 int dw = desktop() ->width(); 586 int dw = desktop() ->width();
587 587
588 if ( dw < 200 ) { 588 if ( dw < 200 ) {
589 setFont( QFont( "vera", 8 ) ); 589 setFont( QFont( "vera", 8 ) );
590 AppLnk::setSmallIconSize( 10 ); 590 AppLnk::setSmallIconSize( 10 );
591 AppLnk::setBigIconSize( 28 ); 591 AppLnk::setBigIconSize( 28 );
592 } 592 }
593#ifndef QT_QWS_SIMPAD 593#ifndef OPIE_HIGH_RES_SMALL_PHY
594 else if ( dw > 600 ) { 594 else if ( dw > 600 ) {
595 setFont( QFont( "vera", 16 ) ); 595 setFont( QFont( "vera", 16 ) );
596 AppLnk::setSmallIconSize( 24 ); 596 AppLnk::setSmallIconSize( 24 );
597 AppLnk::setBigIconSize( 48 ); 597 AppLnk::setBigIconSize( 48 );
598 } 598 }
599#endif 599#endif
600 else if ( dw > 200 ) { 600 else if ( dw > 200 ) {
601 setFont( QFont( "vera", 10 ) ); 601 setFont( QFont( "vera", 10 ) );
602 AppLnk::setSmallIconSize( 14 ); 602 AppLnk::setSmallIconSize( 14 );
603 AppLnk::setBigIconSize( 32 ); 603 AppLnk::setBigIconSize( 32 );
604 } 604 }
605 605
606 QMimeSourceFactory::setDefaultFactory( new ResourceMimeFactory ); 606 QMimeSourceFactory::setDefaultFactory( new ResourceMimeFactory );
607 607
608 connect( this, SIGNAL( lastWindowClosed() ), this, SLOT( hideOrQuit() ) ); 608 connect( this, SIGNAL( lastWindowClosed() ), this, SLOT( hideOrQuit() ) );
609 609
610 610
611 sysChannel = new QCopChannel( "QPE/System", this ); 611 sysChannel = new QCopChannel( "QPE/System", this );
612 connect( sysChannel, SIGNAL( received( const QCString &, const QByteArray & ) ), 612 connect( sysChannel, SIGNAL( received( const QCString &, const QByteArray & ) ),
613 this, SLOT( systemMessage( const QCString &, const QByteArray & ) ) ); 613 this, SLOT( systemMessage( const QCString &, const QByteArray & ) ) );
614 614
615/* COde now in initapp */ 615/* COde now in initapp */
616#if 0 616#if 0
617#if defined(Q_WS_QWS) && !defined(QT_NO_COP) 617#if defined(Q_WS_QWS) && !defined(QT_NO_COP)
618 618
619 QString qcopfn( "/tmp/qcop-msg-" ); 619 QString qcopfn( "/tmp/qcop-msg-" );
620 qcopfn += QString( argv[ 0 ] ); // append command name 620 qcopfn += QString( argv[ 0 ] ); // append command name
621 621
622 QFile f( qcopfn ); 622 QFile f( qcopfn );
623 if ( f.open( IO_ReadOnly ) ) { 623 if ( f.open( IO_ReadOnly ) ) {
624 flock( f.handle(), LOCK_EX ); 624 flock( f.handle(), LOCK_EX );
625 } 625 }
626 626
627 627
628 628
@@ -1979,65 +1979,65 @@ void QPEApplication::installTranslation( const QString& baseName ) {
1979void QPEApplication::hideOrQuit() 1979void QPEApplication::hideOrQuit()
1980{ 1980{
1981 processEvents(); 1981 processEvents();
1982 1982
1983 // If we are a preloaded application we don't actually quit, so emit 1983 // If we are a preloaded application we don't actually quit, so emit
1984 // a System message indicating we're quasi-closing. 1984 // a System message indicating we're quasi-closing.
1985 if ( d->preloaded && d->qpe_main_widget ) 1985 if ( d->preloaded && d->qpe_main_widget )
1986#ifndef QT_NO_COP 1986#ifndef QT_NO_COP
1987 1987
1988 { 1988 {
1989 QCopEnvelope e("QPE/System", "fastAppHiding(QString)" ); 1989 QCopEnvelope e("QPE/System", "fastAppHiding(QString)" );
1990 e << d->appName; 1990 e << d->appName;
1991 d->qpe_main_widget->hide(); 1991 d->qpe_main_widget->hide();
1992 } 1992 }
1993#endif 1993#endif
1994 else 1994 else
1995 quit(); 1995 quit();
1996} 1996}
1997 1997
1998#if (__GNUC__ > 2 ) 1998#if (__GNUC__ > 2 )
1999extern "C" void __cxa_pure_virtual(); 1999extern "C" void __cxa_pure_virtual();
2000 2000
2001void __cxa_pure_virtual() 2001void __cxa_pure_virtual()
2002{ 2002{
2003 fprintf( stderr, "Pure virtual called\n"); 2003 fprintf( stderr, "Pure virtual called\n");
2004 abort(); 2004 abort();
2005 2005
2006} 2006}
2007 2007
2008#endif 2008#endif
2009 2009
2010 2010
2011#if defined(QT_QWS_IPAQ) || defined(QT_QWS_SL5XXX) || defined(QT_QWS_RAMSES) 2011#if defined(OPIE_NEW_MALLOC)
2012 2012
2013// The libraries with the skiff package (and possibly others) have 2013// The libraries with the skiff package (and possibly others) have
2014// completely useless implementations of builtin new and delete that 2014// completely useless implementations of builtin new and delete that
2015// use about 50% of your CPU. Here we revert to the simple libc 2015// use about 50% of your CPU. Here we revert to the simple libc
2016// functions. 2016// functions.
2017 2017
2018void* operator new[]( size_t size ) 2018void* operator new[]( size_t size )
2019{ 2019{
2020 return malloc( size ); 2020 return malloc( size );
2021} 2021}
2022 2022
2023void* operator new( size_t size ) 2023void* operator new( size_t size )
2024{ 2024{
2025 return malloc( size ); 2025 return malloc( size );
2026} 2026}
2027 2027
2028void operator delete[]( void* p ) 2028void operator delete[]( void* p )
2029{ 2029{
2030 free( p ); 2030 free( p );
2031} 2031}
2032 2032
2033void operator delete[]( void* p, size_t /*size*/ ) 2033void operator delete[]( void* p, size_t /*size*/ )
2034{ 2034{
2035 free( p ); 2035 free( p );
2036} 2036}
2037 2037
2038 2038
2039void operator delete( void* p ) 2039void operator delete( void* p )
2040{ 2040{
2041 free( p ); 2041 free( p );
2042} 2042}
2043 2043