-rw-r--r-- | library/fileselector.h | 5 | ||||
-rw-r--r-- | library/library.pro | 3 | ||||
-rw-r--r-- | library/qcom.h | 3 | ||||
-rw-r--r-- | library/qpeapplication.cpp | 4 | ||||
-rw-r--r-- | library/qpeapplication.h | 58 | ||||
-rw-r--r-- | library/qpedecoration_qws.cpp | 3 | ||||
-rw-r--r-- | library/qpeglobal.h | 41 | ||||
-rw-r--r-- | library/qpemenubar.h | 4 | ||||
-rw-r--r-- | library/qpetoolbar.h | 3 | ||||
-rw-r--r-- | library/widget_showing.cpp | 74 |
10 files changed, 139 insertions, 59 deletions
diff --git a/library/fileselector.h b/library/fileselector.h index e3ae891..f1738db 100644 --- a/library/fileselector.h +++ b/library/fileselector.h @@ -20,16 +20,17 @@ #ifndef FILESELECTOR_H #define FILESELECTOR_H #include <qhbox.h> #include <qvbox.h> #include <qtoolbutton.h> #include <qlistview.h> +#include "qpeglobal.h" #include "filemanager.h" #include "applnk.h" class QPopupMenu; class QPushButton; class FileSelectorView; class FileSelectorItem : public QListViewItem @@ -48,17 +49,17 @@ class FileSelectorPrivate; class FileSelector : public QVBox { Q_OBJECT public: FileSelector( const QString &mimefilter, QWidget *parent, const char *name=0, bool newVisible = TRUE, bool closeVisible = TRUE ); ~FileSelector(); void setNewVisible( bool b ); - void setCloseVisible( bool b ); + void setCloseVisible( bool b ) QPE_DEPRECATED; void setTypeComboVisible( bool b = TRUE ); void setCategorySelectVisible( bool b = TRUE ); void reread(); int fileCount(); DocLnk selectedDocument() const { const DocLnk* rp = ((FileSelector*)this)->selected(); if (!rp) { @@ -100,16 +101,16 @@ private slots: void cardMessage( const QCString &, const QByteArray &); private: void updateView(); void updateWhatsThis(); private: // RESOLVE please -zecke@handhelds.org - const DocLnk *selected(); // use selectedDocument() luckily no compiler is putting the access into the symbol name + const DocLnk *selected() QPE_DEPRECATED; // use selectedDocument() luckily no compiler is putting the access into the symbol name FileSelectorView *view; QString filter; QToolButton *buttonNew, *buttonClose; FileSelectorPrivate *d; }; #endif diff --git a/library/library.pro b/library/library.pro index cdc1dab..45e69bc 100644 --- a/library/library.pro +++ b/library/library.pro @@ -112,17 +112,18 @@ SOURCES = calendar.cpp \ categoryselect.cpp \ categorywidget.cpp \ ir.cpp \ backend/vcc_yacc.cpp \ backend/vobject.cpp \ findwidget_p.cpp \ finddialog.cpp \ lnkproperties.cpp \ - qt_override.cpp + qt_override.cpp \ + widget_showing.cpp # Qt 3 compatibility HEADERS += quuid.h qcom.h qlibrary.h qlibrary_p.h SOURCES += quuid.cpp qlibrary.cpp qlibrary_unix.cpp INCLUDEPATH += $(OPIEDIR)/include backend LIBS += -ldl -lcrypt -lm diff --git a/library/qcom.h b/library/qcom.h index 9972d8f..5703800 100644 --- a/library/qcom.h +++ b/library/qcom.h @@ -21,16 +21,17 @@ #ifndef QCOM_H #define QCOM_H #include <qstringlist.h> #ifndef QT_NO_COMPONENT #include <qpe/quuid.h> +#include <qpe/qpeglobal.h> #define QRESULT unsigned long #define QS_OK (QRESULT)0x00000000 #define QS_FALSE (QRESULT)0x00000001 #define QE_NOTIMPL (QRESULT)0x80000001 #define QE_OUTOFMEMORY (QRESULT)0x80000002 #define QE_INVALIDARG (QRESULT)0x80000003 @@ -146,17 +147,17 @@ struct Q_EXPORT QtULong unsigned long operator++( int ) { return ref++; } unsigned long& operator--() { return --ref; } unsigned long operator--( int ) { return ref--; } unsigned long ref; }; #define Q_EXPORT_INTERFACE() \ - extern "C" QUnknownInterface* ucm_instantiate() + extern "C" QUnknownInterface* ucm_instantiate QPE_EXPORT_SYMBOL () #define Q_REFCOUNT \ private: \ QtULong qtrefcount; \ public: \ ulong addRef() {return qtrefcount++;} \ ulong release() {if(!--qtrefcount){delete this;return 0;}return qtrefcount;} diff --git a/library/qpeapplication.cpp b/library/qpeapplication.cpp index 4adfc8f..43a9be5 100644 --- a/library/qpeapplication.cpp +++ b/library/qpeapplication.cpp @@ -193,25 +193,25 @@ public: #ifndef QT_NO_COP QCopChannel::sendLocally( r->channel, r->message, r->data ); #endif delete r; } } - static void show_mx(QWidget* mw, bool nomaximize, QString &strName) - { + static void show_mx(QWidget* mw, bool nomaximize, QString &strName) { if ( mw->inherits("QMainWindow") || mw->isA("QMainWindow") ) { ( ( QMainWindow* ) mw )->setUsesBigPixmaps( useBigPixmaps ); } QPoint p; QSize s; bool max; + if ( mw->isVisible() ) { if ( read_widget_rect(strName, max, p, s) && validate_widget_size(mw, p, s) ) { mw->resize(s); mw->move(p); } mw->raise(); } else { diff --git a/library/qpeapplication.h b/library/qpeapplication.h index 579fc44..00d3d31 100644 --- a/library/qpeapplication.h +++ b/library/qpeapplication.h @@ -26,16 +26,17 @@ #include <qapplication.h> #include <qdialog.h> #include <qwsdisplay_qws.h> #if defined(_WS_QWS_) && !defined(Q_WS_QWS) #define Q_WS_QWS #endif #include "qpedecoration_qws.h" #include "timestring.h" +#include "qpeglobal.h" class QCopChannel; class QPEApplicationData; class QWSEvent; class QWSKeyEvent; /** \brief The QPEApplication class implements various system services @@ -115,19 +116,20 @@ public: Enable = 100 }; static void setInputMethodHint( QWidget *, InputMethodHint ); static InputMethodHint inputMethodHint( QWidget * ); void showMainWidget( QWidget*, bool nomax=FALSE ); void showMainDocumentWidget( QWidget*, bool nomax=FALSE ); - static void showDialog( QDialog*, bool nomax=FALSE ); - static int execDialog( QDialog*, bool nomax=FALSE ); - static void showWidget( QWidget*, bool nomax=FALSE ); + + static void showDialog( QDialog*, bool nomax=FALSE ) QPE_WEAK_SYMBOL; + static int execDialog ( QDialog*, bool nomax=FALSE ) QPE_WEAK_SYMBOL; + static void showWidget( QWidget*, bool nomax=FALSE ) QPE_WEAK_SYMBOL; /* Merge setTempScreenSaverMode */ #ifdef QTOPIA_INTERNAL_INITAPP void initApp( int argv, char **argv ); #endif static void setKeepRunning(); bool keepRunning() const; @@ -178,60 +180,17 @@ private: QCopChannel *pidChannel; #endif QPEApplicationData *d; bool reserved_sh; }; -inline void QPEApplication::showDialog( QDialog* d, bool nomax ) -{ - showWidget( d, nomax ); -} -inline int QPEApplication::execDialog( QDialog* d, bool nomax ) -{ - showDialog( d, nomax ); - return d->exec(); -} - -#ifdef Q_WS_QWS -extern Q_EXPORT QRect qt_maxWindowRect; -#endif - -inline void QPEApplication::showWidget( QWidget* wg, bool nomax ) -{ - if ( wg->isVisible() ) - wg->show(); - else - { - if ( !nomax - && ( qApp->desktop()->width() <= 320 ) ) - { - 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 - w = QMIN( w, ( desk.width() - ( wg->frameGeometry().width() - wg->geometry().width() ) - 25 ) ); - h = QMIN( h, ( desk.height() - ( wg->frameGeometry().height() - wg->geometry().height() ) - 25 ) ); - - wg->resize( w, h ); - wg->show(); - } - } -} enum Transformation { Rot0, Rot90, Rot180, Rot270 }; /* from qgfxtransformed_qws.cpp */ inline int TransToDeg ( Transformation t ) { int d = static_cast<int>( t ); return d * 90; } @@ -257,9 +216,16 @@ inline void QPEApplication::setCurrentRotation( int r ) ::setenv( "QWS_DISPLAY", QString( "Transformed:Rot%1:0" ).arg( r ).latin1(), 1 ); qApp->desktop()->qwsDisplay()->setTransformation( e ); #else setDefaultRotation( r ); #endif } +/* + * -remove me + */ +#ifdef Q_WS_QWS +extern Q_EXPORT QRect qt_maxWindowRect; +#endif + #endif diff --git a/library/qpedecoration_qws.cpp b/library/qpedecoration_qws.cpp index 8b02de6..fa38180 100644 --- a/library/qpedecoration_qws.cpp +++ b/library/qpedecoration_qws.cpp @@ -105,17 +105,18 @@ public: return (getWState() & WState_Reserved1 ) || (inherits("QDialog") && !inherits("QMessageBox") && !inherits("QWizard") ); } }; static QImage scaleButton( const QImage &img, int height ) { - if ( img.height() != 0 && img.height() != height ) { + //ML: We don't want to scale if the difference is less than 4 pixels to prevent blurring + if ( img.height() != 0 && ::abs( img.height()-height ) > 4 ) { return img.smoothScale( img.width()*height/img.height(), height ); } else { return img; } } class TLWidget : public QWidget { diff --git a/library/qpeglobal.h b/library/qpeglobal.h index 96ce3a6..a84e435 100644 --- a/library/qpeglobal.h +++ b/library/qpeglobal.h @@ -1,11 +1,15 @@ /* - =. This file is part of the OPIE Project - .=l. Copyright (c) 2002,2003,2004 Holger Hans Peter Freyther <freyther@handhelds.org> + This file is part of the OPIE Project + Copyright (c) 2002,2003,2004 Holger Hans Peter Freyther <freyther@handhelds.org> + Copyright (c) 2002,2003,2004 Stefan Eilers <eilers@handhelds.org> + + =. + .=l. .>+-= _;:, .> :=|. This library is free software; you can .> <`_, > . <= redistribute it and/or modify it under :`=1 )Y*s>-.-- : the terms of the GNU Library General Public .="- .-=="i, .._ License as published by the Free Software - . .-<_> .<> Foundation; either version 2 of the License, ._= =} : or (at your option) any later version. .%`+i> _;_. @@ -21,35 +25,64 @@ -_. . . )=. = Library General Public License along with -- :-=` this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#ifndef QPE_GLOBAL_H -#define QPE_GLOBAL_H +#ifndef QPE_GLOBAL_DEFINES_H +#define QPE_GLOBAL_DEFINES_H /** * Defines for used compiler attributes * */ + +/* + * commons + */ +#define QPE_DEPRECATED + + #if defined(Q_OS_MACX) #define QPE_WEAK_SYMBOL __attribute__((weak_import)) #define QPE_SYMBOL_USED #define QPE_SYMBOL_UNUSED +#define QPE_EXPORT_SYMBOL #elif defined(_OS_UNIX_) #define QPE_WEAK_SYMBOL __attribute__((weak)) #define QPE_SYMBOL_USED __attribute__((used)) #define QPE_SYMBOL_UNUSED __attribute__((unused)) +#define QPE_EXPORT_SYMBOL + + +/* + * mark method as deprecated + */ +#if __GNUC__ - 0 > 3 || (__GNUC__ - 0 == 3 && __GNUC_MINOR__ - 0 >= 2) + /* gcc >= 3.2 */ +#undef QPE_DEPRECATED +#define QPE_DEPRECATED __attribute__((deprecated)) +#endif + +/* + * Defined if Compiler supports attributes + */ +#ifdef GCC_SUPPORTS_VISIBILITY +#undef QPE_EXPORT_SYMBOL +#define QPE_EXPORT_SYMBOL __attribute__((visibility("default"))) +#endif + #else // defined(Q_OS_WIN32) #define QPE_WEAK_SYMBOL #define QPE_SYMBOL_USED #define QPE_SYMBOL_UNUSED +#define QPE_EXPORT_SYMBOL #endif #endif diff --git a/library/qpemenubar.h b/library/qpemenubar.h index 66d0c85..64bf39c 100644 --- a/library/qpemenubar.h +++ b/library/qpemenubar.h @@ -20,16 +20,18 @@ #ifndef QPEMENUBAR_H #define QPEMENUBAR_H #include <qmenubar.h> #include <qguardedptr.h> #include <qvaluelist.h> +#include <qtopia/qpeglobal.h> + class QPEMenuToolFocusManager : public QObject { Q_OBJECT public: QPEMenuToolFocusManager(); void addWidget( QWidget *w ); void removeWidget( QWidget *w ); @@ -54,17 +56,17 @@ private: GuardedWidget oldFocus; static QPEMenuToolFocusManager *me; private: // Sharp ROM compatibility void setMenukeyEnabled ( bool b ); }; -class QPEMenuBar : public QMenuBar +class QPE_DEPRECATED QPEMenuBar : public QMenuBar { Q_OBJECT public: QPEMenuBar( QWidget *parent=0, const char* name=0 ); ~QPEMenuBar(); protected: virtual void keyPressEvent( QKeyEvent *e ); diff --git a/library/qpetoolbar.h b/library/qpetoolbar.h index 53d21c0..c894ec9 100644 --- a/library/qpetoolbar.h +++ b/library/qpetoolbar.h @@ -17,20 +17,21 @@ ** not clear to you. ** **********************************************************************/ #ifndef QPETOOLBAR_H #define QPETOOLBAR_H #include <qtoolbar.h> +#include <qtopia/qpeglobal.h> class QMainWindow; -class QPEToolBar : public QToolBar +class QPE_DEPRECATED QPEToolBar : public QToolBar { Q_OBJECT public: QPEToolBar( QMainWindow *parent = 0, const char *name = 0 ); protected: virtual void childEvent( QChildEvent *e ); }; diff --git a/library/widget_showing.cpp b/library/widget_showing.cpp new file mode 100644 index 0000000..43ece64 --- a/dev/null +++ b/library/widget_showing.cpp @@ -0,0 +1,74 @@ +/* + This file is part of the OPIE Project + Copyright (c) 2004 Andreas Richter <ar@handhelds.org> + Copyright (c) 2004 Holger Hans Peter Freyther <freyther@handhelds.org> + =. + .=l. + .>+-= + _;:, .> :=|. This library is free software; you can +.> <`_, > . <= redistribute it and/or modify it under +:`=1 )Y*s>-.-- : the terms of the GNU Library General Public +.="- .-=="i, .._ License as published by the Free Software + - . .-<_> .<> Foundation; either version 2 of the License, + ._= =} : or (at your option) any later version. + .%`+i> _;_. + .i_,=:_. -<s. This library is distributed in the hope that + + . -:. = it will be useful, but WITHOUT ANY WARRANTY; + : .. .:, . . . without even the implied warranty of + =_ + =;=|` MERCHANTABILITY or FITNESS FOR A + _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU +..}^=.= = ; Library General Public License for more +++= -. .` .: details. + : = ...= . :.=- + -. .:....=;==+<; You should have received a copy of the GNU + -_. . . )=. = Library General Public License along with + -- :-=` this library; see the file COPYING.LIB. + If not, write to the Free Software Foundation, + Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. + +*/ + +#include <qtopia/qpeapplication.h> + +#ifdef Q_WS_QWS +extern Q_EXPORT QRect qt_maxWindowRect; +#endif + +void QPEApplication::showDialog( QDialog* d, bool nomax ) +{ + showWidget( d, 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; + } + + if ( !nomax + && ( qApp->desktop()->width() <= 320 ) ){ + 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 + w = QMIN( w, ( desk.width() - ( wg->frameGeometry().width() - wg->geometry().width() ) - 25 ) ); + h = QMIN( h, ( desk.height() - ( wg->frameGeometry().height() - wg->geometry().height() ) - 25 ) ); + wg->resize( w, h ); + wg->show(); + } +} |