summaryrefslogtreecommitdiff
authormickeyl <mickeyl>2005-02-19 17:18:27 (UTC)
committer mickeyl <mickeyl>2005-02-19 17:18:27 (UTC)
commitbe32e0c045814142954ac37c89715313633d6aa2 (patch) (unidiff)
tree93a6fc7a84b4073fb04cc0b3377c4bb7e11bd091
parentb7bf9c7acdc010eb30bc246372efb0d1b394166a (diff)
downloadopie-be32e0c045814142954ac37c89715313633d6aa2.zip
opie-be32e0c045814142954ac37c89715313633d6aa2.tar.gz
opie-be32e0c045814142954ac37c89715313633d6aa2.tar.bz2
make inline image support optional
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--ChangeLog3
-rw-r--r--Rules.make3
-rw-r--r--config.in4
-rw-r--r--library/resource.cpp34
4 files changed, 38 insertions, 6 deletions
diff --git a/ChangeLog b/ChangeLog
index c39e7ce..86d9766 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,60 +1,61 @@
1 2005-??-??Opie 1.2.0 1 2005-??-??Opie 1.2.0
2 2
3 New Features 3 New Features
4 ------------ 4 ------------
5 * Launcher: Support a static background pixmap (mickeyl) 5 * Launcher: Support a static background pixmap (mickeyl)
6 * LauncherSettings: Choose whether to have a static background pixmap (mickeyl) 6 * LauncherSettings: Choose whether to have a static background pixmap (mickeyl)
7 7
8 Fixed Bugs 8 Fixed Bugs
9 ---------- 9 ----------
10 * #1236 - VCards contained empty home and work address entries causing Palms to crash (eilers) 10 * #1236 - VCards contained empty home and work address entries causing Palms to crash (eilers)
11 * #1472 - Opie textedit now check for unsaved changes on ESC key (ljp) 11 * #1472 - Opie textedit now check for unsaved changes on ESC key (ljp)
12 * #1474 - Implement GUI for Scrollbars on the Left in Appearance (zecke) 12 * #1474 - Implement GUI for Scrollbars on the Left in Appearance (zecke)
13 * #1482 - Fix double '/' in paths (zecke) 13 * #1482 - Fix double '/' in paths (zecke)
14 * #1536 - Autosave of custom locations in opie backup (ar) 14 * #1536 - Autosave of custom locations in opie backup (ar)
15 * #1539 - Fixed displaying too long path in the delete dialog in opie-eye (zecke) 15 * #1539 - Fixed displaying too long path in the delete dialog in opie-eye (zecke)
16 * #1540 - Implemented deletion of DocLnks in opie-eye (zecke) 16 * #1540 - Implemented deletion of DocLnks in opie-eye (zecke)
17 * #1542 - Fix Todo crash when priority < 1 or > 5 (drw) 17 * #1542 - Fix Todo crash when priority < 1 or > 5 (drw)
18 * #1550 - Browse for alarm sound start in QPEDIR/sounds/ (zecke) 18 * #1550 - Browse for alarm sound start in QPEDIR/sounds/ (zecke)
19 * #1554 - Fixed Opie-Console name in .desktop file (mickeyl) 19 * #1554 - Fixed Opie-Console name in .desktop file (mickeyl)
20 * #1556 - Start to look for sound files in /opt/QtPalmtop/sounds (zecke) 20 * #1556 - Start to look for sound files in /opt/QtPalmtop/sounds (zecke)
21 * #1558 - Fixed opie-login breaking opie startup (mickeyl) 21 * #1558 - Fixed opie-login breaking opie startup (mickeyl)
22 * #1570 - Confirmation needed befor Restore a backup and overwrite local data (ar) 22 * #1570 - Confirmation needed befor Restore a backup and overwrite local data (ar)
23 * n.a. - PackageManager - fixed where last package in status file was not shown as installed when it should be (drw) 23 * n.a. - PackageManager - fixed where last package in status file was not shown as installed when it should be (drw)
24 24
25 Internal 25 Internal
26 -------- 26 --------
27 * Work around bug in Qt/Embedded 2.3.10: qt_version() returns 231 (mickeyl) 27 * Worked around bug in Qt/Embedded 2.3.10: qt_version() returns 231 (mickeyl)
28 * Killed the need for weak symbols in QtE (zecke) 28 * Killed the need for weak symbols in QtE (zecke)
29 * Added optional building libqpe without inline images (mickeyl)
29 30
30 2005-02-03Opie 1.1.9 31 2005-02-03Opie 1.1.9
31 32
32 New Features 33 New Features
33 ------------ 34 ------------
34 * Number of icon columns in Launcher is customizable through Launcher.conf (hrw,zecke,mickeyl) 35 * Number of icon columns in Launcher is customizable through Launcher.conf (hrw,zecke,mickeyl)
35 * Number of icon columns in Launcher is customizable through LauncherSettings (mickeyl) 36 * Number of icon columns in Launcher is customizable through LauncherSettings (mickeyl)
36 * Usability enhancements in OpieIRC (skyhusker) 37 * Usability enhancements in OpieIRC (skyhusker)
37 38
38 Fixed Bugs 39 Fixed Bugs
39 ---------- 40 ----------
40 * #1501 - Fixed bug in todo sql backend (eilers) 41 * #1501 - Fixed bug in todo sql backend (eilers)
41 * #1505 - Added more Swap sizes in memoryapplet (mickeyl) 42 * #1505 - Added more Swap sizes in memoryapplet (mickeyl)
42 * #1525 - Hopefully fixed double alarms and not removing alarms set with the Clock application (zecke) 43 * #1525 - Hopefully fixed double alarms and not removing alarms set with the Clock application (zecke)
43 * #1533 - Security Owner Dialog (shown in case of unsuccessfull authentiacation) wasn't able to display information in non latin1 encoding (zecke) 44 * #1533 - Security Owner Dialog (shown in case of unsuccessfull authentiacation) wasn't able to display information in non latin1 encoding (zecke)
44 * n.a. - Removed hard coded font sizes in a couple of inputmethods (mickeyl) 45 * n.a. - Removed hard coded font sizes in a couple of inputmethods (mickeyl)
45 * n.a. - Removed MediumDlg appearing prior to FirstUsage wizard (i.e. calibration) (mickeyl) 46 * n.a. - Removed MediumDlg appearing prior to FirstUsage wizard (i.e. calibration) (mickeyl)
46 * n.a. - Fixed numerous buglets in OpieIRC (skyhusker) 47 * n.a. - Fixed numerous buglets in OpieIRC (skyhusker)
47 48
48 Internal 49 Internal
49 -------- 50 --------
50 * Added the Qtopia 1.7 SDK macros for quick-apps to easa compilation of 3rd party apps against our headers (mickeyl) 51 * Added the Qtopia 1.7 SDK macros for quick-apps to easa compilation of 3rd party apps against our headers (mickeyl)
51 * You can now use the Opie build system in combination with a OpenEmbedded staging area which makes a nice cross development environment (mickeyl) 52 * You can now use the Opie build system in combination with a OpenEmbedded staging area which makes a nice cross development environment (mickeyl)
52 * Made Opie compilable with Qt/Embedded 2.3.10 (ar) 53 * Made Opie compilable with Qt/Embedded 2.3.10 (ar)
53 * Changed Launcher to get default orientation from ODevice w/ QWS_DISPLAY overriding (mickeyl) 54 * Changed Launcher to get default orientation from ODevice w/ QWS_DISPLAY overriding (mickeyl)
54 * Build tree cleanups (mickeyl) 55 * Build tree cleanups (mickeyl)
55 56
56 2004-11-26Opie 1.1.8 57 2004-11-26Opie 1.1.8
57 58
58 New Features 59 New Features
59 ------------ 60 ------------
60 * PackageManager supports installation of local ipkg files (drw) 61 * PackageManager supports installation of local ipkg files (drw)
diff --git a/Rules.make b/Rules.make
index 64237cf..df1e6e5 100644
--- a/Rules.make
+++ b/Rules.make
@@ -31,64 +31,67 @@ ifeq ($(CONFIG_STATIC),y)
31 echo CONFIG += staticlib >> $@ 31 echo CONFIG += staticlib >> $@
32 echo \} >> $@ 32 echo \} >> $@
33endif 33endif
34ifeq ($(filter 3.%,$(QTE_VERSION)),) # not qt3 34ifeq ($(filter 3.%,$(QTE_VERSION)),) # not qt3
35 echo CONFIG -= qt3 >> $@ 35 echo CONFIG -= qt3 >> $@
36else 36else
37 echo CONFIG += qt3 >> $@ 37 echo CONFIG += qt3 >> $@
38endif 38endif
39ifneq ($(CONFIG_QUICK_LAUNCH),) 39ifneq ($(CONFIG_QUICK_LAUNCH),)
40 echo contains\( CONFIG, quick-app \) \{ >> $@ 40 echo contains\( CONFIG, quick-app \) \{ >> $@
41 echo CONFIG -= staticlib >> $@ 41 echo CONFIG -= staticlib >> $@
42 echo CONFIG -= quick-app >> $@ 42 echo CONFIG -= quick-app >> $@
43 echo CONFIG += quick-app-lib >> $@ 43 echo CONFIG += quick-app-lib >> $@
44 echo QUICKLAUNCH_PATH = $(CONFIG_QUICKLAUNCH_PATH) >> $@ 44 echo QUICKLAUNCH_PATH = $(CONFIG_QUICKLAUNCH_PATH) >> $@
45 echo \} >> $@ 45 echo \} >> $@
46else 46else
47 echo contains\( CONFIG, quick-app \) \{ >> $@ 47 echo contains\( CONFIG, quick-app \) \{ >> $@
48 echo CONFIG -= quick-app >> $@ 48 echo CONFIG -= quick-app >> $@
49 echo CONFIG += quick-app-bin >> $@ 49 echo CONFIG += quick-app-bin >> $@
50 echo \} >> $@ 50 echo \} >> $@
51endif 51endif
52ifeq ($(CONFIG_SQL_PIM_BACKEND),y) 52ifeq ($(CONFIG_SQL_PIM_BACKEND),y)
53 echo ENABLE_SQL_PIM_BACKEND=$(CONFIG_SQL_PIM_BACKEND) >> $@ 53 echo ENABLE_SQL_PIM_BACKEND=$(CONFIG_SQL_PIM_BACKEND) >> $@
54else 54else
55 echo ENABLE_SQL_PIM_BACKEND=n >> $@ 55 echo ENABLE_SQL_PIM_BACKEND=n >> $@
56endif 56endif
57ifeq ($(CONFIG_OPIELOGIN_USEPAM),y) 57ifeq ($(CONFIG_OPIELOGIN_USEPAM),y)
58 echo CONFIG += OPIELOGIN_USEPAM >> $@ 58 echo CONFIG += OPIELOGIN_USEPAM >> $@
59endif 59endif
60ifeq ($(CONFIG_LIBQPE_WITHROHFEEDBACK),y) 60ifeq ($(CONFIG_LIBQPE_WITHROHFEEDBACK),y)
61 echo CONFIG += LIBQPE_WITHROHFEEDBACK >> $@ 61 echo CONFIG += LIBQPE_WITHROHFEEDBACK >> $@
62endif 62endif
63ifeq ($(CONFIG_LIBQPE_NO_INLINE_IMAGES),y)
64 echo DEFINES += LIBQPE_NO_INLINE_IMAGES >> $@
65endif
63ifeq ($(CONFIG_OPIE_NO_BUILTIN_SHUTDOWN),y) 66ifeq ($(CONFIG_OPIE_NO_BUILTIN_SHUTDOWN),y)
64 echo DEFINES += OPIE_NO_BUILTIN_SHUTDOWN >> $@ 67 echo DEFINES += OPIE_NO_BUILTIN_SHUTDOWN >> $@
65endif 68endif
66ifeq ($(CONFIG_OPIE_NO_BUILTIN_CALIBRATE),y) 69ifeq ($(CONFIG_OPIE_NO_BUILTIN_CALIBRATE),y)
67 echo DEFINES += OPIE_NO_BUILTIN_CALIBRATE >> $@ 70 echo DEFINES += OPIE_NO_BUILTIN_CALIBRATE >> $@
68endif 71endif
69ifeq ($(CONFIG_USE_REALTIME_AUDIO_THREAD),y) 72ifeq ($(CONFIG_USE_REALTIME_AUDIO_THREAD),y)
70 echo DEFINES += USE_REALTIME_AUDIO_THREAD >> $@ 73 echo DEFINES += USE_REALTIME_AUDIO_THREAD >> $@
71endif 74endif
72ifeq ($(CONFIG_USE_FILE_NOTIFICATION),y) 75ifeq ($(CONFIG_USE_FILE_NOTIFICATION),y)
73 echo DEFINES += USE_FILE_NOTIFICATION >> $@ 76 echo DEFINES += USE_FILE_NOTIFICATION >> $@
74endif 77endif
75ifeq ($(CONFIG_QT_QWS_ALLOW_CLOCK),y) 78ifeq ($(CONFIG_QT_QWS_ALLOW_CLOCK),y)
76 echo DEFINES += QT_QWS_ALLOW_OVERCLOCK >> $@ 79 echo DEFINES += QT_QWS_ALLOW_OVERCLOCK >> $@
77endif 80endif
78ifeq ($(CONFIG_OPIE_NEW_ALLOC),y) 81ifeq ($(CONFIG_OPIE_NEW_ALLOC),y)
79 echo DEFINES += OPIE_NEW_MALLOC >> $@ 82 echo DEFINES += OPIE_NEW_MALLOC >> $@
80endif 83endif
81ifeq ($(CONFIG_OPIE_NO_SOUND_PCM_READ_BITS),y) 84ifeq ($(CONFIG_OPIE_NO_SOUND_PCM_READ_BITS),y)
82 echo DEFINES += OPIE_NO_SOUND_PCM_READ_BITS >> $@ 85 echo DEFINES += OPIE_NO_SOUND_PCM_READ_BITS >> $@
83endif 86endif
84 echo DEFINES += OPIE_SOUND_FRAGMENT_SHIFT=$(CONFIG_OPIE_SOUND_FRAGMENT_SHIFT) >> $@ 87 echo DEFINES += OPIE_SOUND_FRAGMENT_SHIFT=$(CONFIG_OPIE_SOUND_FRAGMENT_SHIFT) >> $@
85ifeq ($(CONFIG_OPIE_WE_VERSION_OVERRIDE),y) 88ifeq ($(CONFIG_OPIE_WE_VERSION_OVERRIDE),y)
86 echo DEFINES += OPIE_WE_VERSION=$(CONFIG_OPIE_WE_VERSION) >> $@ 89 echo DEFINES += OPIE_WE_VERSION=$(CONFIG_OPIE_WE_VERSION) >> $@
87endif 90endif
88ifeq ($(CONFIG_OPIE_TASKBAR_LOCK_KEY_STATE),y) 91ifeq ($(CONFIG_OPIE_TASKBAR_LOCK_KEY_STATE),y)
89 echo DEFINES += OPIE_TASKBAR_LOCK_KEY_STATE >> $@ 92 echo DEFINES += OPIE_TASKBAR_LOCK_KEY_STATE >> $@
90 endif 93 endif
91# Write LIB dirs and INC dirs... 94# Write LIB dirs and INC dirs...
92ifeq ($(CONFIG_LIBETPAN_DEP),y) 95ifeq ($(CONFIG_LIBETPAN_DEP),y)
93 echo LIBETPAN_LIB_DIR = $(CONFIG_LIBETPAN_LIB_DIR) >> $@ 96 echo LIBETPAN_LIB_DIR = $(CONFIG_LIBETPAN_LIB_DIR) >> $@
94 echo LIBETPAN_INC_DIR = $(CONFIG_LIBETPAN_INC_DIR) >> $@ 97 echo LIBETPAN_INC_DIR = $(CONFIG_LIBETPAN_INC_DIR) >> $@
diff --git a/config.in b/config.in
index e9ffed2..228e682 100644
--- a/config.in
+++ b/config.in
@@ -141,64 +141,68 @@ config OPIE_SOUND_FRAGMENT_SHIFT
141 string "The sound fragment used in Opie Player I" 141 string "The sound fragment used in Opie Player I"
142 default "14" if TARGET_IPAQ 142 default "14" if TARGET_IPAQ
143 default "16" if ! TARGET_IPAQ 143 default "16" if ! TARGET_IPAQ
144 144
145config USE_REALTIME_AUDIO_THREAD 145config USE_REALTIME_AUDIO_THREAD
146 boolean "Use a realtime thread in Opie Player I" 146 boolean "Use a realtime thread in Opie Player I"
147 default y if TARGET_IPAQ || TARGET_SIMPAD || TARGET_RAMSES || TARGET_SHARP 147 default y if TARGET_IPAQ || TARGET_SIMPAD || TARGET_RAMSES || TARGET_SHARP
148 default n if ! (TARGET_IPAQ || TARGET_SIMPAD || TARGET_RAMSES || TARGET_SHARP) 148 default n if ! (TARGET_IPAQ || TARGET_SIMPAD || TARGET_RAMSES || TARGET_SHARP)
149 149
150config QT_QWS_ALLOW_OVERCLOCK 150config QT_QWS_ALLOW_OVERCLOCK
151 boolean "Allow the user to overclock the device" 151 boolean "Allow the user to overclock the device"
152 depends TARGET_RAMSES 152 depends TARGET_RAMSES
153 default n 153 default n
154 154
155config USE_FILE_NOTIFICATION 155config USE_FILE_NOTIFICATION
156 boolean "Substitute (some) polling interfaces with OFileNotifier" 156 boolean "Substitute (some) polling interfaces with OFileNotifier"
157 default y 157 default y
158 158
159config OPIE_NEW_ALLOC 159config OPIE_NEW_ALLOC
160 boolean "Use malloc and free for the implementation" 160 boolean "Use malloc and free for the implementation"
161 default y if TARGET_RAMSES || TARGET_IPAQ || TARGET_SIMPAD || TARGET_SHARP 161 default y if TARGET_RAMSES || TARGET_IPAQ || TARGET_SIMPAD || TARGET_SHARP
162 default n if ! (TARGET_IPAQ || TARGET_SIMPAD || TARGET_RAMSES || TARGET_SHARP) 162 default n if ! (TARGET_IPAQ || TARGET_SIMPAD || TARGET_RAMSES || TARGET_SHARP)
163 163
164config OPIE_TASKBAR_LOCK_KEY_STATE 164config OPIE_TASKBAR_LOCK_KEY_STATE
165 boolean "Have a KeyLock state indicator on the taskbar" 165 boolean "Have a KeyLock state indicator on the taskbar"
166 default y if TARGET_SHARP 166 default y if TARGET_SHARP
167 default n if !TARGET_SHARP 167 default n if !TARGET_SHARP
168 168
169config LIBQPE_WITHROHFEEDBACK 169config LIBQPE_WITHROHFEEDBACK
170 boolean "Build libqpe with Right-On-Hold feedback" 170 boolean "Build libqpe with Right-On-Hold feedback"
171 default y 171 default y
172 172
173config LIBQPE_NO_INLINE_IMAGES
174 boolean "Build libqpe without inline images"
175 default y
176
173config OPIE_NO_SOUND_PCM_READ_BITS 177config OPIE_NO_SOUND_PCM_READ_BITS
174 boolean "There is not a pcm_read_bits io control" 178 boolean "There is not a pcm_read_bits io control"
175 default y if TARGET_SHARP 179 default y if TARGET_SHARP
176 default n if ! TARGET_SHARP 180 default n if ! TARGET_SHARP
177endmenu 181endmenu
178 182
179menu "Dependencies" 183menu "Dependencies"
180 source dependencies.in 184 source dependencies.in
181endmenu 185endmenu
182 186
183menu "Base" 187menu "Base"
184 choice 188 choice
185 prompt "Qpe Library Selection" 189 prompt "Qpe Library Selection"
186 default LIBQPE 190 default LIBQPE
187 source library/config.in 191 source library/config.in
188 source x11/config.in 192 source x11/config.in
189 endchoice 193 endchoice
190 source libopie2/config.in 194 source libopie2/config.in
191 source libqtaux/config.in 195 source libqtaux/config.in
192 source rsync/config.in 196 source rsync/config.in
193 source core/opie-login/config.in 197 source core/opie-login/config.in
194 source core/opiealarm/config.in 198 source core/opiealarm/config.in
195 source core/tools/quicklauncher/config.in 199 source core/tools/quicklauncher/config.in
196 source core/launcher/config.in 200 source core/launcher/config.in
197 source core/symlinker/config.in 201 source core/symlinker/config.in
198endmenu 202endmenu
199 203
200comment "" 204comment ""
201 205
202menu "Applets" 206menu "Applets"
203 source core/applets/config.in 207 source core/applets/config.in
204 source noncore/applets/config.in 208 source noncore/applets/config.in
diff --git a/library/resource.cpp b/library/resource.cpp
index b31876f..3b5e9ec 100644
--- a/library/resource.cpp
+++ b/library/resource.cpp
@@ -1,211 +1,235 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. 2** Copyright (C) 2000-2002 Trolltech AS. All rights reserved.
3** 3**
4** This file is part of the Qtopia Environment. 4** This file is part of the Qtopia Environment.
5** 5**
6** This file may be distributed and/or modified under the terms of the 6** This file may be distributed and/or modified under the terms of the
7** GNU General Public License version 2 as published by the Free Software 7** GNU General Public License version 2 as published by the Free Software
8** Foundation and appearing in the file LICENSE.GPL included in the 8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file. 9** packaging of this file.
10** 10**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13** 13**
14** See http://www.trolltech.com/gpl/ for GPL licensing information. 14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15** 15**
16** Contact info@trolltech.com if any conditions of this licensing are 16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you. 17** not clear to you.
18** 18**
19**********************************************************************/ 19**********************************************************************/
20 20
21#define QTOPIA_INTERNAL_MIMEEXT 21#define QTOPIA_INTERNAL_MIMEEXT
22#include <qpe/qpeapplication.h> 22#include <qpe/qpeapplication.h>
23#include "resource.h" 23#include "resource.h"
24#include "mimetype.h" 24#include "mimetype.h"
25#include <qdir.h> 25#include <qdir.h>
26#include <qpixmapcache.h> 26#include <qpixmapcache.h>
27 27
28// this namespace is just a workaround for a gcc bug 28// this namespace is just a workaround for a gcc bug
29// gcc exports inline functions in the generated file 29// gcc exports inline functions in the generated file
30// inlinepics_p.h 30// inlinepics_p.h
31 31
32#ifndef LIBQPE_NO_INLINE_IMAGES
32namespace { 33namespace {
33#include "inlinepics_p.h" 34#include "inlinepics_p.h"
34} 35}
36#endif
35 37
36static bool g_notUseSet = ::getenv("OVERWRITE_ICON_SET"); 38static bool g_notUseSet = ::getenv("OVERWRITE_ICON_SET");
37 39
38/*! 40/*!
39 \class Resource resource.h 41 \class Resource resource.h
40 \brief The Resource class provides access to named resources. 42 \brief The Resource class provides access to named resources.
41 43
42 The resources may be provided from files or other sources. 44 The resources may be provided from files or other sources.
43 45
44 The allSounds() function returns a list of all the sounds available. 46 The allSounds() function returns a list of all the sounds available.
45 A particular sound can be searched for using findSound(). 47 A particular sound can be searched for using findSound().
46 48
47 Images can be loaded with loadImage(), loadPixmap(), loadBitmap() 49 Images can be loaded with loadImage(), loadPixmap(), loadBitmap()
48 and loadIconSet(). 50 and loadIconSet().
49 51
50 \ingroup qtopiaemb 52 \ingroup qtopiaemb
51*/ 53*/
52 54
53/*! 55/*!
54 \fn Resource::Resource() 56 \fn Resource::Resource()
55 \internal 57 \internal
56*/ 58*/
57 59
58/*! 60/*!
59 Returns the QPixmap called \a pix. You should avoid including 61 Returns the QPixmap called \a pix. You should avoid including
60 any filename type extension (e.g. .png, .xpm). 62 any filename type extension (e.g. .png, .xpm).
61*/ 63*/
62#include <stdio.h> 64#include <stdio.h>
63QPixmap Resource::loadPixmap( const QString &pix ) 65QPixmap Resource::loadPixmap( const QString &pix )
64{ 66{
65 QPixmap pm; // null pixmap 67 QPixmap pm; // null pixmap
66 QString key="QPE_"+pix; 68 QString key="QPE_"+pix;
67 if ( !QPixmapCache::find(key,pm) ) { 69 if ( !QPixmapCache::find(key,pm) ) {
68 QImage I = loadImage(pix); 70 QImage I = loadImage(pix);
69 if( I.isNull() ) { 71 if( I.isNull() ) {
70 qWarning( "Could not load %s", pix.latin1() ); 72 qWarning( "Could not load %s", pix.latin1() );
71 } else { 73 } else {
72 pm.convertFromImage(I); 74 pm.convertFromImage(I);
73 QPixmapCache::insert(key,pm); 75 QPixmapCache::insert(key,pm);
74 } 76 }
75 } 77 }
76 return pm; 78 return pm;
77} 79}
78 80
79/*! 81/*!
80 Returns the QBitmap called \a pix. You should avoid including 82 Returns the QBitmap called \a pix. You should avoid including
81 any filename type extension (e.g. .png, .xpm). 83 any filename type extension (e.g. .png, .xpm).
82*/ 84*/
83QBitmap Resource::loadBitmap( const QString &pix ) 85QBitmap Resource::loadBitmap( const QString &pix )
84{ 86{
85 QBitmap bm; 87 QBitmap bm;
86 bm = loadPixmap(pix); 88 bm = loadPixmap(pix);
87 return bm; 89 return bm;
88} 90}
89 91
90/*! 92/*!
91 Returns the filename of a pixmap called \a pix. You should avoid including 93 Returns the filename of a pixmap called \a pix. You should avoid including
92 any filename type extension (e.g. .png, .xpm). 94 any filename type extension (e.g. .png, .xpm).
93 95
94 Normally you will use loadPixmap() rather than this function. 96 Normally you will use loadPixmap() rather than this function.
95*/ 97*/
96QString Resource::findPixmap( const QString &pix ) 98QString Resource::findPixmap( const QString &pix )
97{ 99{
98 QString picsPath = QPEApplication::qpeDir() + "pics/"; 100 QString picsPath = QPEApplication::qpeDir() + "pics/";
99
100 QString f; 101 QString f;
101 102
102 // Common case optimizations... 103 // Common case optimizations...
103 f = picsPath + pix + ".png"; 104 f = picsPath + pix + ".png";
104 if ( QFile( f ).exists() ) 105 if ( QFile( f ).exists() )
105 return f; 106 return f;
106 f = picsPath + pix + ".xpm"; 107 f = picsPath + pix + ".xpm";
107 if ( QFile( f ).exists() ) 108 if ( QFile( f ).exists() )
108 return f; 109 return f;
109 110
111#ifdef LIBQPE_NO_INLINE_IMAGES
112 QString picsPathInline = picsPath + "inline/";
113 // Common case optimizations...
114 f = picsPathInline + pix + ".png";
115 if ( QFile( f ).exists() )
116 return f;
117 f = picsPathInline + pix + ".xpm";
118 if ( QFile( f ).exists() )
119 return f;
120#endif
121
110 // All formats... 122 // All formats...
111 QStrList fileFormats = QImageIO::inputFormats(); 123 QStrList fileFormats = QImageIO::inputFormats();
112 QString ff = fileFormats.first(); 124 QString ff = fileFormats.first();
113 while ( fileFormats.current() ) { 125 while ( fileFormats.current() ) {
114 QStringList exts = MimeType("image/"+ff.lower()).extensions(); 126 QStringList exts = MimeType("image/"+ff.lower()).extensions();
115 for ( QStringList::ConstIterator it = exts.begin(); it!=exts.end(); ++it ) { 127 for ( QStringList::ConstIterator it = exts.begin(); it!=exts.end(); ++it ) {
116 QString f = picsPath + pix + "." + *it; 128 QString f = picsPath + pix + "." + *it;
117 if ( QFile(f).exists() ) 129 if ( QFile(f).exists() )
118 return f; 130 return f;
119 } 131 }
120 ff = fileFormats.next(); 132 ff = fileFormats.next();
121 } 133 }
122 134
123 // Finally, no (or existing) extension... 135 // Finally, no (or existing) extension...
124 if ( QFile( picsPath + pix ).exists() ) 136 if ( QFile( picsPath + pix ).exists() )
125 return picsPath + pix; 137 return picsPath + pix;
126 138
127 //qDebug("Cannot find pixmap: %s", pix.latin1()); 139 //qDebug("Cannot find pixmap: %s", pix.latin1());
128 return QString(); 140 return QString();
129} 141}
130 142
131/*! 143/*!
132 Returns a sound file for a sound called \a name. 144 Returns a sound file for a sound called \a name.
133 145
134 You should avoid including any filename type extension (e.g. .wav), 146 You should avoid including any filename type extension (e.g. .wav),
135 as the system will search for only those fileformats which are supported 147 as the system will search for only those fileformats which are supported
136 by the library. 148 by the library.
137 149
138 Currently, only WAV files are supported. 150 Currently, only WAV files are supported.
139*/ 151*/
140QString Resource::findSound( const QString &name ) 152QString Resource::findSound( const QString &name )
141{ 153{
142 QString picsPath = QPEApplication::qpeDir() + "sounds/"; 154 QString picsPath = QPEApplication::qpeDir() + "sounds/";
143 155
144 QString result; 156 QString result;
145 if ( QFile( (result = picsPath + name + ".wav") ).exists() ) 157 if ( QFile( (result = picsPath + name + ".wav") ).exists() )
146 return result; 158 return result;
147 159
148 return QString(); 160 return QString();
149} 161}
150 162
151/*! 163/*!
152 Returns a list of all sound names. 164 Returns a list of all sound names.
153*/ 165*/
154QStringList Resource::allSounds() 166QStringList Resource::allSounds()
155{ 167{
156 QDir resourcedir( QPEApplication::qpeDir() + "sounds/", "*.wav" ); 168 QDir resourcedir( QPEApplication::qpeDir() + "sounds/", "*.wav" );
157 QStringList entries = resourcedir.entryList(); 169 QStringList entries = resourcedir.entryList();
158 QStringList result; 170 QStringList result;
159 for (QStringList::Iterator i=entries.begin(); i != entries.end(); ++i) 171 for (QStringList::Iterator i=entries.begin(); i != entries.end(); ++i)
160 result.append((*i).replace(QRegExp("\\.wav"),"")); 172 result.append((*i).replace(QRegExp("\\.wav"),""));
161 return result; 173 return result;
162} 174}
163 175
164static QImage load_image(const QString &name) 176static QImage load_image(const QString &name)
165{ 177{
178 QImage img;
179
166 if (g_notUseSet ) { 180 if (g_notUseSet ) {
167 // try file 181 // try file
168 QImage img;
169 QString f = Resource::findPixmap(name); 182 QString f = Resource::findPixmap(name);
170 if ( !f.isEmpty() ) 183 if ( !f.isEmpty() )
171 img.load(f); 184 img.load(f);
185#ifndef LIBQPE_NO_INLINE_IMAGES
172 if (img.isNull() ) 186 if (img.isNull() )
173 img = qembed_findImage(name.latin1() ); 187 img = qembed_findImage(name.latin1() );
188#endif
174 return img; 189 return img;
175 } 190 }
176 else{ 191 else{
177 QImage img = qembed_findImage(name.latin1()); 192#ifndef LIBQPE_NO_INLINE_IMAGES
178 193 img = qembed_findImage(name.latin1());
179 if ( img.isNull() ) { 194#else
195 QString f = Resource::findPixmap( "/inline/" + name );
196 if ( !f.isEmpty() )
197 {
198 img.load(f);
199 return img;
200 }
201#endif
202 if ( img.isNull() )
203 {
180 // No inlined image, try file 204 // No inlined image, try file
181 QString f = Resource::findPixmap(name); 205 QString f = Resource::findPixmap(name);
182 if ( !f.isEmpty() ) 206 if ( !f.isEmpty() )
183 img.load(f); 207 img.load(f);
184 } 208 }
185 return img; 209 return img;
186 } 210 }
187} 211}
188 212
189/*! 213/*!
190 Returns the QImage called \a name. You should avoid including 214 Returns the QImage called \a name. You should avoid including
191 any filename type extension (e.g. .png, .xpm). 215 any filename type extension (e.g. .png, .xpm).
192*/ 216*/
193QImage Resource::loadImage( const QString &name) 217QImage Resource::loadImage( const QString &name)
194{ 218{
195 #ifndef QT_NO_DEPTH_32// have alpha-blended pixmaps 219 #ifndef QT_NO_DEPTH_32// have alpha-blended pixmaps
196 static QImage last_enabled; 220 static QImage last_enabled;
197 static QString last_enabled_name; 221 static QString last_enabled_name;
198 if ( name == last_enabled_name ) 222 if ( name == last_enabled_name )
199 return last_enabled; 223 return last_enabled;
200#endif 224#endif
201 QImage img = load_image(name); 225 QImage img = load_image(name);
202 #ifndef QT_NO_DEPTH_32// have alpha-blended pixmaps 226 #ifndef QT_NO_DEPTH_32// have alpha-blended pixmaps
203 if ( img.isNull() ) { 227 if ( img.isNull() ) {
204 // No file, try generating 228 // No file, try generating
205 if ( name[name.length()-1]=='d' && name.right(9)=="_disabled" ) { 229 if ( name[name.length()-1]=='d' && name.right(9)=="_disabled" ) {
206 last_enabled_name = name.left(name.length()-9); 230 last_enabled_name = name.left(name.length()-9);
207 last_enabled = load_image(last_enabled_name); 231 last_enabled = load_image(last_enabled_name);
208 if ( last_enabled.isNull() ) { 232 if ( last_enabled.isNull() ) {
209 last_enabled_name = QString::null; 233 last_enabled_name = QString::null;
210 } else { 234 } else {
211 img.detach(); 235 img.detach();