summaryrefslogtreecommitdiff
path: root/library
authorzecke <zecke>2004-10-15 19:23:42 (UTC)
committer zecke <zecke>2004-10-15 19:23:42 (UTC)
commitac36bfe2794741188da1d6d4b471f96fd15d47ee (patch) (side-by-side diff)
tree5c1bc264fd554142993be8963aed159f32877d6a /library
parenta979ea08e8f9dbade70a9bf4fdc93dcbebb5f3fa (diff)
downloadopie-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
Diffstat (limited to 'library') (more/less context) (show whitespace changes)
-rw-r--r--library/calendar.cpp11
-rw-r--r--library/library.pro3
-rw-r--r--library/qpeapplication.cpp8
-rw-r--r--library/qpeglobal.h55
-rw-r--r--library/qpemessagebox.cpp9
-rw-r--r--library/qt_override.cpp16
-rw-r--r--library/stable.h2
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
@@ -15,32 +15,27 @@
**
** 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");
diff --git a/library/library.pro b/library/library.pro
index ffd20fd..cdc1dab 100644
--- a/library/library.pro
+++ b/library/library.pro
@@ -56,13 +56,14 @@ HEADERS = calendar.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 \
diff --git a/library/qpeapplication.cpp b/library/qpeapplication.cpp
index df313ce..3efba20 100644
--- a/library/qpeapplication.cpp
+++ b/library/qpeapplication.cpp
@@ -85,12 +85,13 @@
#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>
@@ -1291,18 +1292,13 @@ void QPEApplication::reset() {
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()
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
@@ -16,23 +16,18 @@
** 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");
}
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
@@ -5,12 +5,13 @@
#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 {
@@ -82,14 +83,13 @@ int Opie::force_appearance = 0;
// 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__ ( )
{
}
}
@@ -99,14 +99,12 @@ extern void __gmon_start__ ( )
// 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 ));
@@ -122,14 +120,12 @@ void QPEApplication::polish ( QWidget *w )
#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;
@@ -141,41 +137,33 @@ QValueList <int> QFontDatabase::pointSizes ( QString const &family, QString cons
// 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
diff --git a/library/stable.h b/library/stable.h
index 10f13a6..ea4526c 100644
--- a/library/stable.h
+++ b/library/stable.h
@@ -69,9 +69,9 @@
#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