summaryrefslogtreecommitdiff
path: root/library/qt_override.cpp
Unidiff
Diffstat (limited to 'library/qt_override.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--library/qt_override.cpp170
1 files changed, 0 insertions, 170 deletions
diff --git a/library/qt_override.cpp b/library/qt_override.cpp
deleted file mode 100644
index a0d753b..0000000
--- a/library/qt_override.cpp
+++ b/dev/null
@@ -1,170 +0,0 @@
1
2#include <qpe/qpeapplication.h>
3#include <qfontdatabase.h>
4
5#include <unistd.h>
6#include <stdlib.h>
7#include <stdio.h>
8#include <limits.h>
9#include <sys/param.h> // for toolchains with old libc headers
10
11#include <qtopia/qpeglobal.h>
12#include "qt_override_p.h"
13
14#if QT_VERSION > 233
15
16#ifndef OPIE_NO_ERASE_RECT_HACKFIX
17struct color_fix_t {
18 char *m_app;
19 char *m_class;
20 char *m_name;
21 QColorGroup::ColorRole m_set;
22 QColorGroup::ColorRole m_get;
23};
24
25
26
27static const color_fix_t apps_that_need_special_colors [] = {
28 { "HancomMobileWord", "HTextEdit", 0, QColorGroup::Background, QColorGroup::Base },
29 { "neocal", "Display", 0, QColorGroup::Background, QColorGroup::Base },
30
31 { 0, 0, 0, QColorGroup::Base, QColorGroup::Base }
32};
33
34#endif
35
36#ifndef OPIE_NO_OVERRIDE_QT
37
38static const char * const apps_that_need_pointsizes_times_10 [] = {
39 "HancomMobileWord",
40 "hancomsheet",
41 "HancomPresenterViewer",
42
43 0
44};
45
46
47
48
49int Opie::force_appearance = 0;
50
51
52// Return the *real* name of the binary - not just a quick guess
53// by looking at argv [0] (which could be anything)
54
55static void binaryNameFree ( )
56{
57 ::free ((void *) Opie::binaryName ( )); // we need to cast away the const here
58}
59
60const char *Opie::binaryName ( )
61{
62 static const char *appname = 0;
63
64 if ( !appname ) {
65 char dst [PATH_MAX + 1];
66 int l = ::readlink ( "/proc/self/exe", dst, PATH_MAX );
67
68 if ( l <= 0 )
69 l = 0;
70
71 dst [l] = 0;
72 const char *b = ::strrchr ( dst, '/' );
73 appname = ::strdup ( b ? b + 1 : dst );
74
75 ::atexit ( binaryNameFree );
76 }
77 return appname;
78}
79
80#else
81int Opie::force_appearance = 0;
82#endif
83
84// Fix for a toolchain incompatibility (binaries compiled with
85// old tcs using shared libs compiled with newer tcs)
86
87extern "C" {
88
89extern void __gmon_start__ ( ) QPE_WEAK_SYMBOL;
90extern void __gmon_start__ ( )
91{
92}
93
94}
95
96
97#ifndef OPIE_NO_ERASE_RECT_HACKFIX
98// Fix for apps, that use QPainter::eraseRect() which doesn't work with styles
99// that set a background pixmap (it would be easier to fix eraseRect(), but
100// TT made it an inline ...)
101
102void QPEApplication::polish ( QWidget *w )
103{
104#ifndef OPIE_NO_OVERRIDE_QT
105 for ( const color_fix_t *ptr = apps_that_need_special_colors; ptr-> m_app; ptr++ ) {
106 if (( ::strcmp ( Opie::binaryName ( ), ptr-> m_app ) == 0 ) &&
107 ( ptr-> m_class ? w-> inherits ( ptr-> m_class ) : true ) &&
108 ( ptr-> m_name ? ( ::strcmp ( w-> name ( ), ptr-> m_name ) == 0 ) : true )) {
109 QPalette pal = w-> palette ( );
110 pal. setColor ( ptr-> m_set, pal. color ( QPalette::Active, ptr-> m_get ));
111 w-> setPalette ( pal );
112 }
113 }
114#endif
115 QApplication::polish ( w );
116}
117#endif
118
119
120#ifndef OPIE_NO_OVERRIDE_QT
121// Fix for the binary incompatibility that TT introduced in Qt/E 2.3.4 -- point sizes
122// were multiplied by 10 (which was incorrect)
123
124QValueList <int> QFontDatabase::pointSizes ( QString const &family, QString const &style, QString const &charset )
125{
126 QValueList <int> sl = pointSizes_NonWeak ( family, style, charset );
127
128 for ( const char * const *ptr = apps_that_need_pointsizes_times_10; *ptr; ptr++ ) {
129 if ( ::strcmp ( Opie::binaryName ( ), *ptr ) == 0 ) {
130 for ( QValueList <int>::Iterator it = sl. begin ( ); it != sl. end ( ); ++it )
131 *it *= 10;
132 }
133 }
134 return sl;
135}
136
137
138// Various style/font/color related overrides for weak symbols in Qt/E,
139// which allows us to force the usage of the global Opie appearance.
140
141void QApplication::setStyle ( QStyle *style )
142{
143 if ( Opie::force_appearance & Opie::Force_Style )
144 delete style;
145 else
146 QApplication::setStyle_NonWeak ( style );
147}
148
149void QApplication::setPalette ( const QPalette &pal, bool informWidgets, const char *className )
150{
151 if (!( Opie::force_appearance & Opie::Force_Style ))
152 QApplication::setPalette_NonWeak ( pal, informWidgets, className );
153}
154
155void QApplication::setFont ( const QFont &fnt, bool informWidgets, const char *className )
156{
157 if (!( Opie::force_appearance & Opie::Force_Font ))
158 QApplication::setFont_NonWeak ( fnt, informWidgets, className );
159}
160
161
162void QApplication::qwsSetDecoration ( QWSDecoration *deco )
163{
164 if ( Opie::force_appearance & Opie::Force_Decoration )
165 delete deco;
166 else
167 QApplication::qwsSetDecoration_NonWeak ( deco );
168}
169#endif
170#endif