-rw-r--r-- | core/launcher/libpreload/libpreload.pro | 2 | ||||
-rw-r--r-- | core/launcher/libpreload/preload.cpp | 45 |
2 files changed, 45 insertions, 2 deletions
diff --git a/core/launcher/libpreload/libpreload.pro b/core/launcher/libpreload/libpreload.pro index 7630d01..ed426da 100644 --- a/core/launcher/libpreload/libpreload.pro +++ b/core/launcher/libpreload/libpreload.pro | |||
@@ -1,14 +1,14 @@ | |||
1 | TEMPLATE = lib | 1 | TEMPLATE = lib |
2 | 2 | ||
3 | CONFIG = release warn_on | 3 | CONFIG = qt release warn_on |
4 | 4 | ||
5 | SOURCES = preload.cpp | 5 | SOURCES = preload.cpp |
6 | 6 | ||
7 | HEADERS = | 7 | HEADERS = |
8 | 8 | ||
9 | INCLUDEPATH += $(QTDIR)/include | 9 | INCLUDEPATH += $(QTDIR)/include |
10 | 10 | ||
11 | DESTDIR = $(QTDIR)/lib | 11 | DESTDIR = $(QTDIR)/lib |
12 | TARGET = preload | 12 | TARGET = preload |
13 | 13 | ||
14 | VERSION = 1.0.0 | 14 | VERSION = 1.0.0 |
diff --git a/core/launcher/libpreload/preload.cpp b/core/launcher/libpreload/preload.cpp index cc1baac..345620b 100644 --- a/core/launcher/libpreload/preload.cpp +++ b/core/launcher/libpreload/preload.cpp | |||
@@ -1,95 +1,138 @@ | |||
1 | 1 | ||
2 | #define _GNU_SOURCE | 2 | #define _GNU_SOURCE |
3 | //#define private public | 3 | //#define private public |
4 | //#define protected public | 4 | //#define protected public |
5 | 5 | ||
6 | #include <qapplication.h> | ||
6 | #include <qwsdecoration_qws.h> | 7 | #include <qwsdecoration_qws.h> |
7 | #include <qcommonstyle.h> | 8 | #include <qcommonstyle.h> |
8 | 9 | ||
9 | //#include <qapplication.h> | 10 | //#include <qapplication.h> |
10 | //#include <qfont.h> | 11 | //#include <qfont.h> |
11 | 12 | ||
12 | //class QStyle; | 13 | //class QStyle; |
13 | class QApplication; | 14 | //class QApplication; |
14 | class QFont; | 15 | class QFont; |
15 | //class QWSDecoration; | 16 | //class QWSDecoration; |
17 | class QFontDatabase; | ||
16 | 18 | ||
17 | #include <dlfcn.h> | 19 | #include <dlfcn.h> |
18 | #include <unistd.h> | 20 | #include <unistd.h> |
19 | #include <stdio.h> | 21 | #include <stdio.h> |
20 | #include <stdlib.h> | 22 | #include <stdlib.h> |
21 | 23 | ||
22 | 24 | ||
23 | typedef void ( *qapp_setstyle_t ) ( QStyle * ); | 25 | typedef void ( *qapp_setstyle_t ) ( QStyle * ); |
24 | typedef void ( *qapp_setdeco_t ) ( QWSDecoration * ); | 26 | typedef void ( *qapp_setdeco_t ) ( QWSDecoration * ); |
25 | typedef void ( *qapp_setfont_t ) ( const QFont &, bool, const char * ); | 27 | typedef void ( *qapp_setfont_t ) ( const QFont &, bool, const char * ); |
28 | typedef void ( *qapp_polish_t ) ( QApplication *, QWidget * ); | ||
29 | typedef QValueList <int> ( *qfdb_pointsizes_t ) ( QFontDatabase *, QString const &, QString const &, QString const & ); | ||
26 | 30 | ||
27 | 31 | ||
28 | static int *opie_block_style_p = 0; | 32 | static int *opie_block_style_p = 0; |
29 | 33 | ||
30 | extern "C" { | 34 | extern "C" { |
31 | 35 | ||
32 | extern void __gmon_start ( ) __attribute(( weak )); | 36 | extern void __gmon_start ( ) __attribute(( weak )); |
33 | 37 | ||
34 | extern void __gmon_start__ ( ) | 38 | extern void __gmon_start__ ( ) |
35 | { | 39 | { |
36 | } | 40 | } |
37 | 41 | ||
38 | static void *resolve_symbol ( const char *sym ) | 42 | static void *resolve_symbol ( const char *sym ) |
39 | { | 43 | { |
40 | void *adr = ::dlsym ( RTLD_NEXT, sym ); | 44 | void *adr = ::dlsym ( RTLD_NEXT, sym ); |
41 | 45 | ||
42 | if ( !adr ) | 46 | if ( !adr ) |
43 | ::fprintf ( stderr, "PANIC: Could not resolve symbol \"%s\"\n", sym ); | 47 | ::fprintf ( stderr, "PANIC: Could not resolve symbol \"%s\"\n", sym ); |
44 | 48 | ||
45 | return adr; | 49 | return adr; |
46 | } | 50 | } |
47 | 51 | ||
52 | void polish__12QApplicationP7QWidget ( QApplication *that, QWidget *w ) | ||
53 | { | ||
54 | static qapp_polish_t qpolish = 0; | ||
55 | |||
56 | if ( !qpolish ) | ||
57 | qpolish = (qapp_polish_t) resolve_symbol ( "polish__12QApplicationP7QWidget" ); | ||
58 | |||
59 | if ( qpolish ) | ||
60 | ( *qpolish ) ( that, w ); | ||
61 | |||
62 | if (( ::strcmp ( qApp-> argv ( ) [0], "HancomMobileWord" ) == 0 ) && ( w-> inherits ( "HTextEdit" ))) { | ||
63 | QPalette pal = w-> palette ( ); | ||
64 | pal. setColor ( QColorGroup::Background, pal. color ( QPalette::Active, QColorGroup::Base )); | ||
65 | w-> setPalette ( pal ); | ||
66 | // w-> setPalette ( w-> palette ( ). active ( ). color ( QColorGroup::Base )); | ||
67 | } | ||
68 | } | ||
69 | |||
70 | extern QValueList <int> pointSizes__13QFontDatabaseRC7QStringN21 ( QFontDatabase *that, QString const &family, QString const &style, QString const &charset ) | ||
71 | { | ||
72 | static qfdb_pointsizes_t qpointsizes = 0; | ||
73 | |||
74 | if ( !qpointsizes ) | ||
75 | qpointsizes = (qfdb_pointsizes_t) resolve_symbol ( "pointSizes__13QFontDatabaseRC7QStringN21" ); | ||
76 | |||
77 | QValueList <int> sl; | ||
78 | |||
79 | if ( qpointsizes ) { | ||
80 | sl = ( *qpointsizes ) ( that, family, style, charset ); | ||
81 | |||
82 | if ( ::strcmp ( qApp-> argv ( ) [0], "HancomMobileWord" ) == 0 ) { | ||
83 | for ( QValueList <int>::Iterator it = sl. begin ( ); it != sl. end ( ); ++it ) | ||
84 | *it *= 10; | ||
85 | } | ||
86 | } | ||
87 | |||
88 | return sl; | ||
89 | } | ||
90 | |||
48 | extern void setStyle__12QApplicationP6QStyle ( QStyle *style ) | 91 | extern void setStyle__12QApplicationP6QStyle ( QStyle *style ) |
49 | { | 92 | { |
50 | static qapp_setstyle_t qsetstyle = 0; | 93 | static qapp_setstyle_t qsetstyle = 0; |
51 | 94 | ||
52 | if ( !qsetstyle ) | 95 | if ( !qsetstyle ) |
53 | qsetstyle = (qapp_setstyle_t) resolve_symbol ( "setStyle__12QApplicationP6QStyle" ); | 96 | qsetstyle = (qapp_setstyle_t) resolve_symbol ( "setStyle__12QApplicationP6QStyle" ); |
54 | 97 | ||
55 | if ( !opie_block_style_p ) | 98 | if ( !opie_block_style_p ) |
56 | opie_block_style_p = (int *) resolve_symbol ( "opie_block_style" ); | 99 | opie_block_style_p = (int *) resolve_symbol ( "opie_block_style" ); |
57 | 100 | ||
58 | if ( !qsetstyle || ( opie_block_style_p && ( *opie_block_style_p & 0x01 ))) | 101 | if ( !qsetstyle || ( opie_block_style_p && ( *opie_block_style_p & 0x01 ))) |
59 | delete style; | 102 | delete style; |
60 | else | 103 | else |
61 | ( *qsetstyle ) ( style ); | 104 | ( *qsetstyle ) ( style ); |
62 | } | 105 | } |
63 | 106 | ||
64 | extern void setFont__12QApplicationRC5QFontbPCc ( const QFont &fnt, bool informWidgets, const char * className ) | 107 | extern void setFont__12QApplicationRC5QFontbPCc ( const QFont &fnt, bool informWidgets, const char * className ) |
65 | { | 108 | { |
66 | static qapp_setfont_t qsetfont = 0; | 109 | static qapp_setfont_t qsetfont = 0; |
67 | 110 | ||
68 | if ( !qsetfont ) | 111 | if ( !qsetfont ) |
69 | qsetfont = (qapp_setfont_t) resolve_symbol ( "setFont__12QApplicationRC5QFontbPCc" ); | 112 | qsetfont = (qapp_setfont_t) resolve_symbol ( "setFont__12QApplicationRC5QFontbPCc" ); |
70 | 113 | ||
71 | if ( !opie_block_style_p ) | 114 | if ( !opie_block_style_p ) |
72 | opie_block_style_p = (int *) resolve_symbol ( "opie_block_style" ); | 115 | opie_block_style_p = (int *) resolve_symbol ( "opie_block_style" ); |
73 | 116 | ||
74 | if ( qsetfont && !( opie_block_style_p && ( *opie_block_style_p & 0x02 ))) | 117 | if ( qsetfont && !( opie_block_style_p && ( *opie_block_style_p & 0x02 ))) |
75 | ( *qsetfont ) ( fnt, informWidgets, className ); | 118 | ( *qsetfont ) ( fnt, informWidgets, className ); |
76 | } | 119 | } |
77 | 120 | ||
78 | 121 | ||
79 | extern void qwsSetDecoration__12QApplicationP13QWSDecoration ( QWSDecoration *deco ) | 122 | extern void qwsSetDecoration__12QApplicationP13QWSDecoration ( QWSDecoration *deco ) |
80 | { | 123 | { |
81 | static qapp_setdeco_t qsetdeco = 0; | 124 | static qapp_setdeco_t qsetdeco = 0; |
82 | 125 | ||
83 | if ( !qsetdeco ) | 126 | if ( !qsetdeco ) |
84 | qsetdeco = (qapp_setdeco_t) resolve_symbol ( "qwsSetDecoration__12QApplicationP13QWSDecoration" ); | 127 | qsetdeco = (qapp_setdeco_t) resolve_symbol ( "qwsSetDecoration__12QApplicationP13QWSDecoration" ); |
85 | 128 | ||
86 | if ( !opie_block_style_p ) | 129 | if ( !opie_block_style_p ) |
87 | opie_block_style_p = (int *) resolve_symbol ( "opie_block_style" ); | 130 | opie_block_style_p = (int *) resolve_symbol ( "opie_block_style" ); |
88 | 131 | ||
89 | if ( !qsetdeco || ( opie_block_style_p && ( *opie_block_style_p & 0x04 ))) | 132 | if ( !qsetdeco || ( opie_block_style_p && ( *opie_block_style_p & 0x04 ))) |
90 | delete deco; | 133 | delete deco; |
91 | else | 134 | else |
92 | ( *qsetdeco ) ( deco ); | 135 | ( *qsetdeco ) ( deco ); |
93 | } | 136 | } |
94 | 137 | ||
95 | } | 138 | } |