author | zecke <zecke> | 2004-10-15 19:23:42 (UTC) |
---|---|---|
committer | zecke <zecke> | 2004-10-15 19:23:42 (UTC) |
commit | ac36bfe2794741188da1d6d4b471f96fd15d47ee (patch) (side-by-side diff) | |
tree | 5c1bc264fd554142993be8963aed159f32877d6a | |
parent | a979ea08e8f9dbade70a9bf4fdc93dcbebb5f3fa (diff) | |
download | opie-ac36bfe2794741188da1d6d4b471f96fd15d47ee.zip opie-ac36bfe2794741188da1d6d4b471f96fd15d47ee.tar.gz opie-ac36bfe2794741188da1d6d4b471f96fd15d47ee.tar.bz2 |
-Add a QPEGLOBAL that adds define for 'weak', 'used' and unused symbols
Make use of the newly added qpeglobal.h to kill custom versions of
similiar macros
-rw-r--r-- | library/calendar.cpp | 11 | ||||
-rw-r--r-- | library/library.pro | 3 | ||||
-rw-r--r-- | library/qpeapplication.cpp | 8 | ||||
-rw-r--r-- | library/qpeglobal.h | 55 | ||||
-rw-r--r-- | library/qpemessagebox.cpp | 9 | ||||
-rw-r--r-- | library/qt_override.cpp | 16 | ||||
-rw-r--r-- | library/stable.h | 2 |
7 files changed, 67 insertions, 37 deletions
diff --git a/library/calendar.cpp b/library/calendar.cpp index 70e764c..d281a14 100644 --- a/library/calendar.cpp +++ b/library/calendar.cpp @@ -9,44 +9,39 @@ ** packaging of this file. ** ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. ** ** See http://www.trolltech.com/gpl/ for GPL licensing information. ** ** Contact info@trolltech.com if any conditions of this licensing are ** not clear to you. ** **********************************************************************/ #include "calendar.h" +#include "qpeglobal.h" #include <qdatetime.h> #include <qobject.h> + /*! \class Calendar calendar.html \brief The Calendar class provides programmers with an easy to calculate and get information about dates, months and years. \ingroup qtopiaemb */ -#ifdef Q_OS_MACX - #define ATTRIBUTE_UNUSED -#else - #define ATTRIBUTE_UNUSED __attribute__((unused)) -#endif - - -static void never_called_tr_function_um_libqpe_ts_etwas_unter_zu_jubeln() ATTRIBUTE_UNUSED; +static void never_called_tr_function_um_libqpe_ts_etwas_unter_zu_jubeln() QPE_SYMBOL_UNUSED; static void never_called_tr_function_um_libqpe_ts_etwas_unter_zu_jubeln() { (void)QObject::tr("Jan"); (void)QObject::tr("Feb"); (void)QObject::tr("Mar"); (void)QObject::tr("Apr"); (void)QObject::tr("May"); (void)QObject::tr("Jun"); (void)QObject::tr("Jul"); (void)QObject::tr("Aug"); (void)QObject::tr("Sep"); (void)QObject::tr("Oct"); (void)QObject::tr("Nov"); diff --git a/library/library.pro b/library/library.pro index ffd20fd..cdc1dab 100644 --- a/library/library.pro +++ b/library/library.pro @@ -50,25 +50,26 @@ HEADERS = calendar.h \ categorymenu.h \ categoryedit_p.h \ categoryselect.h \ categorywidget.h \ ir.h \ backend/vobject_p.h \ findwidget_p.h \ finddialog.h \ lnkproperties.h \ windowdecorationinterface.h \ textcodecinterface.h \ imagecodecinterface.h \ - qt_override_p.h + qt_override_p.h \ + qpeglobal.h SOURCES = calendar.cpp \ global.cpp \ xmlreader.cpp \ mimetype.cpp \ menubutton.cpp \ network.cpp \ networkinterface.cpp \ filemanager.cpp \ fontmanager.cpp \ qdawg.cpp \ datebookmonth.cpp \ diff --git a/library/qpeapplication.cpp b/library/qpeapplication.cpp index df313ce..3efba20 100644 --- a/library/qpeapplication.cpp +++ b/library/qpeapplication.cpp @@ -79,24 +79,25 @@ #include "config.h" #include "network.h" #ifdef QWS #include "fontmanager.h" #include "fontdatabase.h" #endif #include "alarmserver.h" #include "applnk.h" #include "qpemenubar.h" #include "textcodecinterface.h" #include "imagecodecinterface.h" +#include <qtopia/qpeglobal.h> #include <unistd.h> #include <sys/file.h> #include <sys/ioctl.h> #ifndef QT_NO_SOUND #include <sys/soundcard.h> #endif #include "qt_override_p.h" #include <backend/rohfeedback.h> @@ -1285,30 +1286,25 @@ void QPEApplication::setCurrentMode( int x, int y, int depth ) void QPEApplication::reset() { // Reconnect to the screen qt_screen->disconnect(); qt_screen->connect( QString::null ); // Redraw everything applyStyle(); } #if (QT_VERSION < 238) && defined Q_OS_MACX bool qt_left_hand_scrollbars = false; #else -#ifdef Q_OS_MACX -#define WEAK_SYMBOL __attribute__((weak_import)) -#else -#define WEAK_SYMBOL __attribute__((weak)) -#endif -extern bool qt_left_hand_scrollbars WEAK_SYMBOL; +extern bool qt_left_hand_scrollbars QPE_WEAK_SYMBOL; #endif /*! \internal */ void QPEApplication::applyStyle() { Config config( "qpe" ); config.setGroup( "Appearance" ); #if QT_VERSION > 233 #if !defined(OPIE_NO_OVERRIDE_QT) diff --git a/library/qpeglobal.h b/library/qpeglobal.h new file mode 100644 index 0000000..96ce3a6 --- a/dev/null +++ b/library/qpeglobal.h @@ -0,0 +1,55 @@ +/* + =. This file is part of the OPIE Project + .=l. Copyright (c) 2002,2003,2004 Holger Hans Peter Freyther <freyther@handhelds.org> + .>+-= + _;:, .> :=|. 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. + +*/ + +#ifndef QPE_GLOBAL_H +#define QPE_GLOBAL_H + +/** + * Defines for used compiler attributes + * + */ +#if defined(Q_OS_MACX) +#define QPE_WEAK_SYMBOL __attribute__((weak_import)) +#define QPE_SYMBOL_USED +#define QPE_SYMBOL_UNUSED + +#elif defined(_OS_UNIX_) +#define QPE_WEAK_SYMBOL __attribute__((weak)) +#define QPE_SYMBOL_USED __attribute__((used)) +#define QPE_SYMBOL_UNUSED __attribute__((unused)) + + +#else // defined(Q_OS_WIN32) +#define QPE_WEAK_SYMBOL +#define QPE_SYMBOL_USED +#define QPE_SYMBOL_UNUSED +#endif + + + +#endif diff --git a/library/qpemessagebox.cpp b/library/qpemessagebox.cpp index c38828a..1df108a 100644 --- a/library/qpemessagebox.cpp +++ b/library/qpemessagebox.cpp @@ -10,35 +10,30 @@ ** ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. ** ** See http://www.trolltech.com/gpl/ for GPL licensing information. ** ** Contact info@trolltech.com if any conditions of this licensing are ** not clear to you. ** **********************************************************************/ #include "qpemessagebox.h" +#include "qpeglobal.h" #include <qtopia/stringutil.h> #include <qmessagebox.h> -#ifdef Q_OS_MACX - #define ATTRIBUTE_UNUSED -#else - #define ATTRIBUTE_UNUSED __attribute__((unused)) -#endif - -static void never_called_tr_function_um_libqpe_ts_etwas_unter_zu_jubeln() ATTRIBUTE_UNUSED; +static void never_called_tr_function_um_libqpe_ts_etwas_unter_zu_jubeln() QPE_SYMBOL_UNUSED; static void never_called_tr_function_um_libqpe_ts_etwas_unter_zu_jubeln() { (void)QMessageBox::tr("Yes"); (void)QMessageBox::tr("No"); } /*! \class QPEMessageBox qpemessagebox.h \brief A message box that provides yes, no and cancel options. \ingroup qtopiaemb */ diff --git a/library/qt_override.cpp b/library/qt_override.cpp index 56f82d7..a0d753b 100644 --- a/library/qt_override.cpp +++ b/library/qt_override.cpp @@ -1,22 +1,23 @@ #include <qpe/qpeapplication.h> #include <qfontdatabase.h> #include <unistd.h> #include <stdlib.h> #include <stdio.h> #include <limits.h> #include <sys/param.h> // for toolchains with old libc headers +#include <qtopia/qpeglobal.h> #include "qt_override_p.h" #if QT_VERSION > 233 #ifndef OPIE_NO_ERASE_RECT_HACKFIX struct color_fix_t { char *m_app; char *m_class; char *m_name; QColorGroup::ColorRole m_set; QColorGroup::ColorRole m_get; }; @@ -76,107 +77,94 @@ const char *Opie::binaryName ( ) return appname; } #else int Opie::force_appearance = 0; #endif // Fix for a toolchain incompatibility (binaries compiled with // old tcs using shared libs compiled with newer tcs) extern "C" { -extern void __gmon_start__ ( ) __attribute__(( weak )); - +extern void __gmon_start__ ( ) QPE_WEAK_SYMBOL; extern void __gmon_start__ ( ) { } } #ifndef OPIE_NO_ERASE_RECT_HACKFIX // Fix for apps, that use QPainter::eraseRect() which doesn't work with styles // that set a background pixmap (it would be easier to fix eraseRect(), but // TT made it an inline ...) void QPEApplication::polish ( QWidget *w ) { #ifndef OPIE_NO_OVERRIDE_QT -// qDebug ( "QPEApplication::polish()" ); - for ( const color_fix_t *ptr = apps_that_need_special_colors; ptr-> m_app; ptr++ ) { if (( ::strcmp ( Opie::binaryName ( ), ptr-> m_app ) == 0 ) && ( ptr-> m_class ? w-> inherits ( ptr-> m_class ) : true ) && ( ptr-> m_name ? ( ::strcmp ( w-> name ( ), ptr-> m_name ) == 0 ) : true )) { QPalette pal = w-> palette ( ); pal. setColor ( ptr-> m_set, pal. color ( QPalette::Active, ptr-> m_get )); w-> setPalette ( pal ); } } #endif QApplication::polish ( w ); } #endif #ifndef OPIE_NO_OVERRIDE_QT // Fix for the binary incompatibility that TT introduced in Qt/E 2.3.4 -- point sizes // were multiplied by 10 (which was incorrect) QValueList <int> QFontDatabase::pointSizes ( QString const &family, QString const &style, QString const &charset ) { -// qDebug ( "QFontDatabase::pointSizes()" ); - QValueList <int> sl = pointSizes_NonWeak ( family, style, charset ); for ( const char * const *ptr = apps_that_need_pointsizes_times_10; *ptr; ptr++ ) { if ( ::strcmp ( Opie::binaryName ( ), *ptr ) == 0 ) { for ( QValueList <int>::Iterator it = sl. begin ( ); it != sl. end ( ); ++it ) *it *= 10; } } return sl; } // Various style/font/color related overrides for weak symbols in Qt/E, // which allows us to force the usage of the global Opie appearance. void QApplication::setStyle ( QStyle *style ) { -// qDebug ( "QApplication::setStyle()" ); - if ( Opie::force_appearance & Opie::Force_Style ) delete style; else QApplication::setStyle_NonWeak ( style ); } void QApplication::setPalette ( const QPalette &pal, bool informWidgets, const char *className ) { -// qDebug ( "QApplication::setPalette()" ); - if (!( Opie::force_appearance & Opie::Force_Style )) QApplication::setPalette_NonWeak ( pal, informWidgets, className ); } void QApplication::setFont ( const QFont &fnt, bool informWidgets, const char *className ) { -// qDebug ( "QApplication::setFont()" ); - if (!( Opie::force_appearance & Opie::Force_Font )) QApplication::setFont_NonWeak ( fnt, informWidgets, className ); } void QApplication::qwsSetDecoration ( QWSDecoration *deco ) { -// qDebug ( "QApplication::qwsSetDecoration()" ); - if ( Opie::force_appearance & Opie::Force_Decoration ) delete deco; else QApplication::qwsSetDecoration_NonWeak ( deco ); } #endif #endif diff --git a/library/stable.h b/library/stable.h index 10f13a6..ea4526c 100644 --- a/library/stable.h +++ b/library/stable.h @@ -63,15 +63,15 @@ #undef QTOPIA_INTERAL_PRELOADACCESS #undef QTOPIA_INTERNAL_INITAPP #undef QTOPIA_INTERNAL_LANGLIST #include <qtopia/xmlreader.h> #include <qtopia/windowdecorationinterface.h> #define QTOPIA_INTERNAL_TZSELECT_INC_LOCAL #include <qtopia/tzselect.h> #undef QTOPIA_INTERNAL_TZSELECT_INC_LOCAL #include <qtopia/applicationinterface.h> - +#include <qtopia/qpeglobal.h> #endif |