summaryrefslogtreecommitdiff
authormickeyl <mickeyl>2005-02-19 17:18:27 (UTC)
committer mickeyl <mickeyl>2005-02-19 17:18:27 (UTC)
commitbe32e0c045814142954ac37c89715313633d6aa2 (patch) (side-by-side diff)
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 @@
2005-??-?? Opie 1.2.0
New Features
------------
* Launcher: Support a static background pixmap (mickeyl)
* LauncherSettings: Choose whether to have a static background pixmap (mickeyl)
Fixed Bugs
----------
* #1236 - VCards contained empty home and work address entries causing Palms to crash (eilers)
* #1472 - Opie textedit now check for unsaved changes on ESC key (ljp)
* #1474 - Implement GUI for Scrollbars on the Left in Appearance (zecke)
* #1482 - Fix double '/' in paths (zecke)
* #1536 - Autosave of custom locations in opie backup (ar)
* #1539 - Fixed displaying too long path in the delete dialog in opie-eye (zecke)
* #1540 - Implemented deletion of DocLnks in opie-eye (zecke)
* #1542 - Fix Todo crash when priority < 1 or > 5 (drw)
* #1550 - Browse for alarm sound start in QPEDIR/sounds/ (zecke)
* #1554 - Fixed Opie-Console name in .desktop file (mickeyl)
* #1556 - Start to look for sound files in /opt/QtPalmtop/sounds (zecke)
* #1558 - Fixed opie-login breaking opie startup (mickeyl)
* #1570 - Confirmation needed befor Restore a backup and overwrite local data (ar)
* n.a. - PackageManager - fixed where last package in status file was not shown as installed when it should be (drw)
Internal
--------
- * Work around bug in Qt/Embedded 2.3.10: qt_version() returns 231 (mickeyl)
+ * Worked around bug in Qt/Embedded 2.3.10: qt_version() returns 231 (mickeyl)
* Killed the need for weak symbols in QtE (zecke)
+ * Added optional building libqpe without inline images (mickeyl)
2005-02-03 Opie 1.1.9
New Features
------------
* Number of icon columns in Launcher is customizable through Launcher.conf (hrw,zecke,mickeyl)
* Number of icon columns in Launcher is customizable through LauncherSettings (mickeyl)
* Usability enhancements in OpieIRC (skyhusker)
Fixed Bugs
----------
* #1501 - Fixed bug in todo sql backend (eilers)
* #1505 - Added more Swap sizes in memoryapplet (mickeyl)
* #1525 - Hopefully fixed double alarms and not removing alarms set with the Clock application (zecke)
* #1533 - Security Owner Dialog (shown in case of unsuccessfull authentiacation) wasn't able to display information in non latin1 encoding (zecke)
* n.a. - Removed hard coded font sizes in a couple of inputmethods (mickeyl)
* n.a. - Removed MediumDlg appearing prior to FirstUsage wizard (i.e. calibration) (mickeyl)
* n.a. - Fixed numerous buglets in OpieIRC (skyhusker)
Internal
--------
* Added the Qtopia 1.7 SDK macros for quick-apps to easa compilation of 3rd party apps against our headers (mickeyl)
* You can now use the Opie build system in combination with a OpenEmbedded staging area which makes a nice cross development environment (mickeyl)
* Made Opie compilable with Qt/Embedded 2.3.10 (ar)
* Changed Launcher to get default orientation from ODevice w/ QWS_DISPLAY overriding (mickeyl)
* Build tree cleanups (mickeyl)
2004-11-26 Opie 1.1.8
New Features
------------
* 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)
echo CONFIG += staticlib >> $@
echo \} >> $@
endif
ifeq ($(filter 3.%,$(QTE_VERSION)),) # not qt3
echo CONFIG -= qt3 >> $@
else
echo CONFIG += qt3 >> $@
endif
ifneq ($(CONFIG_QUICK_LAUNCH),)
echo contains\( CONFIG, quick-app \) \{ >> $@
echo CONFIG -= staticlib >> $@
echo CONFIG -= quick-app >> $@
echo CONFIG += quick-app-lib >> $@
echo QUICKLAUNCH_PATH = $(CONFIG_QUICKLAUNCH_PATH) >> $@
echo \} >> $@
else
echo contains\( CONFIG, quick-app \) \{ >> $@
echo CONFIG -= quick-app >> $@
echo CONFIG += quick-app-bin >> $@
echo \} >> $@
endif
ifeq ($(CONFIG_SQL_PIM_BACKEND),y)
echo ENABLE_SQL_PIM_BACKEND=$(CONFIG_SQL_PIM_BACKEND) >> $@
else
echo ENABLE_SQL_PIM_BACKEND=n >> $@
endif
ifeq ($(CONFIG_OPIELOGIN_USEPAM),y)
echo CONFIG += OPIELOGIN_USEPAM >> $@
endif
ifeq ($(CONFIG_LIBQPE_WITHROHFEEDBACK),y)
echo CONFIG += LIBQPE_WITHROHFEEDBACK >> $@
endif
+ifeq ($(CONFIG_LIBQPE_NO_INLINE_IMAGES),y)
+ echo DEFINES += LIBQPE_NO_INLINE_IMAGES >> $@
+endif
ifeq ($(CONFIG_OPIE_NO_BUILTIN_SHUTDOWN),y)
echo DEFINES += OPIE_NO_BUILTIN_SHUTDOWN >> $@
endif
ifeq ($(CONFIG_OPIE_NO_BUILTIN_CALIBRATE),y)
echo DEFINES += OPIE_NO_BUILTIN_CALIBRATE >> $@
endif
ifeq ($(CONFIG_USE_REALTIME_AUDIO_THREAD),y)
echo DEFINES += USE_REALTIME_AUDIO_THREAD >> $@
endif
ifeq ($(CONFIG_USE_FILE_NOTIFICATION),y)
echo DEFINES += USE_FILE_NOTIFICATION >> $@
endif
ifeq ($(CONFIG_QT_QWS_ALLOW_CLOCK),y)
echo DEFINES += QT_QWS_ALLOW_OVERCLOCK >> $@
endif
ifeq ($(CONFIG_OPIE_NEW_ALLOC),y)
echo DEFINES += OPIE_NEW_MALLOC >> $@
endif
ifeq ($(CONFIG_OPIE_NO_SOUND_PCM_READ_BITS),y)
echo DEFINES += OPIE_NO_SOUND_PCM_READ_BITS >> $@
endif
echo DEFINES += OPIE_SOUND_FRAGMENT_SHIFT=$(CONFIG_OPIE_SOUND_FRAGMENT_SHIFT) >> $@
ifeq ($(CONFIG_OPIE_WE_VERSION_OVERRIDE),y)
echo DEFINES += OPIE_WE_VERSION=$(CONFIG_OPIE_WE_VERSION) >> $@
endif
ifeq ($(CONFIG_OPIE_TASKBAR_LOCK_KEY_STATE),y)
echo DEFINES += OPIE_TASKBAR_LOCK_KEY_STATE >> $@
endif
# Write LIB dirs and INC dirs...
ifeq ($(CONFIG_LIBETPAN_DEP),y)
echo LIBETPAN_LIB_DIR = $(CONFIG_LIBETPAN_LIB_DIR) >> $@
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
string "The sound fragment used in Opie Player I"
default "14" if TARGET_IPAQ
default "16" if ! TARGET_IPAQ
config USE_REALTIME_AUDIO_THREAD
boolean "Use a realtime thread in Opie Player I"
default y if TARGET_IPAQ || TARGET_SIMPAD || TARGET_RAMSES || TARGET_SHARP
default n if ! (TARGET_IPAQ || TARGET_SIMPAD || TARGET_RAMSES || TARGET_SHARP)
config QT_QWS_ALLOW_OVERCLOCK
boolean "Allow the user to overclock the device"
depends TARGET_RAMSES
default n
config USE_FILE_NOTIFICATION
boolean "Substitute (some) polling interfaces with OFileNotifier"
default y
config OPIE_NEW_ALLOC
boolean "Use malloc and free for the implementation"
default y if TARGET_RAMSES || TARGET_IPAQ || TARGET_SIMPAD || TARGET_SHARP
default n if ! (TARGET_IPAQ || TARGET_SIMPAD || TARGET_RAMSES || TARGET_SHARP)
config OPIE_TASKBAR_LOCK_KEY_STATE
boolean "Have a KeyLock state indicator on the taskbar"
default y if TARGET_SHARP
default n if !TARGET_SHARP
config LIBQPE_WITHROHFEEDBACK
boolean "Build libqpe with Right-On-Hold feedback"
default y
+config LIBQPE_NO_INLINE_IMAGES
+ boolean "Build libqpe without inline images"
+ default y
+
config OPIE_NO_SOUND_PCM_READ_BITS
boolean "There is not a pcm_read_bits io control"
default y if TARGET_SHARP
default n if ! TARGET_SHARP
endmenu
menu "Dependencies"
source dependencies.in
endmenu
menu "Base"
choice
prompt "Qpe Library Selection"
default LIBQPE
source library/config.in
source x11/config.in
endchoice
source libopie2/config.in
source libqtaux/config.in
source rsync/config.in
source core/opie-login/config.in
source core/opiealarm/config.in
source core/tools/quicklauncher/config.in
source core/launcher/config.in
source core/symlinker/config.in
endmenu
comment ""
menu "Applets"
source core/applets/config.in
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 @@
/**********************************************************************
** Copyright (C) 2000-2002 Trolltech AS. All rights reserved.
**
** This file is part of the Qtopia Environment.
**
** This file may be distributed and/or modified under the terms of the
** GNU General Public License version 2 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file.
**
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
**
** See http://www.trolltech.com/gpl/ for GPL licensing information.
**
** Contact info@trolltech.com if any conditions of this licensing are
** not clear to you.
**
**********************************************************************/
#define QTOPIA_INTERNAL_MIMEEXT
#include <qpe/qpeapplication.h>
#include "resource.h"
#include "mimetype.h"
#include <qdir.h>
#include <qpixmapcache.h>
// this namespace is just a workaround for a gcc bug
// gcc exports inline functions in the generated file
// inlinepics_p.h
+#ifndef LIBQPE_NO_INLINE_IMAGES
namespace {
#include "inlinepics_p.h"
}
+#endif
static bool g_notUseSet = ::getenv("OVERWRITE_ICON_SET");
/*!
\class Resource resource.h
\brief The Resource class provides access to named resources.
The resources may be provided from files or other sources.
The allSounds() function returns a list of all the sounds available.
A particular sound can be searched for using findSound().
Images can be loaded with loadImage(), loadPixmap(), loadBitmap()
and loadIconSet().
\ingroup qtopiaemb
*/
/*!
\fn Resource::Resource()
\internal
*/
/*!
Returns the QPixmap called \a pix. You should avoid including
any filename type extension (e.g. .png, .xpm).
*/
#include <stdio.h>
QPixmap Resource::loadPixmap( const QString &pix )
{
QPixmap pm; // null pixmap
QString key="QPE_"+pix;
if ( !QPixmapCache::find(key,pm) ) {
QImage I = loadImage(pix);
if( I.isNull() ) {
qWarning( "Could not load %s", pix.latin1() );
} else {
pm.convertFromImage(I);
QPixmapCache::insert(key,pm);
}
}
return pm;
}
/*!
Returns the QBitmap called \a pix. You should avoid including
any filename type extension (e.g. .png, .xpm).
*/
QBitmap Resource::loadBitmap( const QString &pix )
{
QBitmap bm;
bm = loadPixmap(pix);
return bm;
}
/*!
Returns the filename of a pixmap called \a pix. You should avoid including
any filename type extension (e.g. .png, .xpm).
Normally you will use loadPixmap() rather than this function.
*/
QString Resource::findPixmap( const QString &pix )
{
QString picsPath = QPEApplication::qpeDir() + "pics/";
-
QString f;
// Common case optimizations...
f = picsPath + pix + ".png";
if ( QFile( f ).exists() )
return f;
f = picsPath + pix + ".xpm";
if ( QFile( f ).exists() )
return f;
+#ifdef LIBQPE_NO_INLINE_IMAGES
+ QString picsPathInline = picsPath + "inline/";
+ // Common case optimizations...
+ f = picsPathInline + pix + ".png";
+ if ( QFile( f ).exists() )
+ return f;
+ f = picsPathInline + pix + ".xpm";
+ if ( QFile( f ).exists() )
+ return f;
+#endif
+
// All formats...
QStrList fileFormats = QImageIO::inputFormats();
QString ff = fileFormats.first();
while ( fileFormats.current() ) {
QStringList exts = MimeType("image/"+ff.lower()).extensions();
for ( QStringList::ConstIterator it = exts.begin(); it!=exts.end(); ++it ) {
QString f = picsPath + pix + "." + *it;
if ( QFile(f).exists() )
return f;
}
ff = fileFormats.next();
}
// Finally, no (or existing) extension...
if ( QFile( picsPath + pix ).exists() )
return picsPath + pix;
//qDebug("Cannot find pixmap: %s", pix.latin1());
return QString();
}
/*!
Returns a sound file for a sound called \a name.
You should avoid including any filename type extension (e.g. .wav),
as the system will search for only those fileformats which are supported
by the library.
Currently, only WAV files are supported.
*/
QString Resource::findSound( const QString &name )
{
QString picsPath = QPEApplication::qpeDir() + "sounds/";
QString result;
if ( QFile( (result = picsPath + name + ".wav") ).exists() )
return result;
return QString();
}
/*!
Returns a list of all sound names.
*/
QStringList Resource::allSounds()
{
QDir resourcedir( QPEApplication::qpeDir() + "sounds/", "*.wav" );
QStringList entries = resourcedir.entryList();
QStringList result;
for (QStringList::Iterator i=entries.begin(); i != entries.end(); ++i)
result.append((*i).replace(QRegExp("\\.wav"),""));
return result;
}
static QImage load_image(const QString &name)
{
+ QImage img;
+
if (g_notUseSet ) {
// try file
- QImage img;
QString f = Resource::findPixmap(name);
if ( !f.isEmpty() )
img.load(f);
+#ifndef LIBQPE_NO_INLINE_IMAGES
if (img.isNull() )
img = qembed_findImage(name.latin1() );
+#endif
return img;
}
else{
- QImage img = qembed_findImage(name.latin1());
-
- if ( img.isNull() ) {
+#ifndef LIBQPE_NO_INLINE_IMAGES
+ img = qembed_findImage(name.latin1());
+#else
+ QString f = Resource::findPixmap( "/inline/" + name );
+ if ( !f.isEmpty() )
+ {
+ img.load(f);
+ return img;
+ }
+#endif
+ if ( img.isNull() )
+ {
// No inlined image, try file
QString f = Resource::findPixmap(name);
if ( !f.isEmpty() )
img.load(f);
}
return img;
}
}
/*!
Returns the QImage called \a name. You should avoid including
any filename type extension (e.g. .png, .xpm).
*/
QImage Resource::loadImage( const QString &name)
{
#ifndef QT_NO_DEPTH_32 // have alpha-blended pixmaps
static QImage last_enabled;
static QString last_enabled_name;
if ( name == last_enabled_name )
return last_enabled;
#endif
QImage img = load_image(name);
#ifndef QT_NO_DEPTH_32 // have alpha-blended pixmaps
if ( img.isNull() ) {
// No file, try generating
if ( name[name.length()-1]=='d' && name.right(9)=="_disabled" ) {
last_enabled_name = name.left(name.length()-9);
last_enabled = load_image(last_enabled_name);
if ( last_enabled.isNull() ) {
last_enabled_name = QString::null;
} else {
img.detach();