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