summaryrefslogtreecommitdiffstats
path: root/src/gui/image
diff options
context:
space:
mode:
authorMichael Brasser <michael.brasser@nokia.com>2009-10-19 00:13:48 (GMT)
committerMichael Brasser <michael.brasser@nokia.com>2009-10-19 00:13:48 (GMT)
commit55bddd50925da27f7a106041db44c15057aac6c1 (patch)
treea5a1ca8f7867b692d0b73e252dd2b9815107425a /src/gui/image
parent81093ae5ba8260f5f5b79f317dd461128e76b5fd (diff)
parent1433a2c8682cb1c8f89ceaf97ad7a509ac686879 (diff)
downloadQt-55bddd50925da27f7a106041db44c15057aac6c1.zip
Qt-55bddd50925da27f7a106041db44c15057aac6c1.tar.gz
Qt-55bddd50925da27f7a106041db44c15057aac6c1.tar.bz2
Merge branch '4.6' of git@scm.dev.nokia.troll.no:qt/qt into kinetic-declarativeui
Conflicts: configure.exe src/corelib/animation/qabstractanimation.cpp src/s60installs/qt.iby util/qlalr/cppgenerator.cpp
Diffstat (limited to 'src/gui/image')
-rw-r--r--src/gui/image/qicon.cpp10
-rw-r--r--src/gui/image/qiconloader.cpp94
-rw-r--r--src/gui/image/qpixmap_s60.cpp47
-rw-r--r--src/gui/image/qpixmap_s60_p.h4
4 files changed, 41 insertions, 114 deletions
diff --git a/src/gui/image/qicon.cpp b/src/gui/image/qicon.cpp
index fce4508..e0779a0 100644
--- a/src/gui/image/qicon.cpp
+++ b/src/gui/image/qicon.cpp
@@ -54,6 +54,7 @@
#include "qvariant.h"
#include "qcache.h"
#include "qdebug.h"
+#include "private/qguiplatformplugin_p.h"
#ifdef Q_WS_MAC
#include <private/qt_mac_p.h>
@@ -961,19 +962,10 @@ QString QIcon::themeName()
*/
QIcon QIcon::fromTheme(const QString &name, const QIcon &fallback)
{
-
static QCache <QString, QIcon> iconCache;
QIcon icon;
-#ifdef Q_WS_X11
- if (X11->desktopEnvironment == DE_KDE) {
- icon = QKde::kdeIcon(name);
- if (!icon.isNull())
- return icon;
- }
-#endif
-
if (iconCache.contains(name)) {
icon = *iconCache.object(name);
} else {
diff --git a/src/gui/image/qiconloader.cpp b/src/gui/image/qiconloader.cpp
index adc2967..46c5431 100644
--- a/src/gui/image/qiconloader.cpp
+++ b/src/gui/image/qiconloader.cpp
@@ -43,7 +43,7 @@
#include <private/qapplication_p.h>
#include <private/qicon_p.h>
-#include <private/qkde_p.h>
+#include <private/qguiplatformplugin_p.h>
#include <QtGui/QIconEnginePlugin>
#include <QtGui/QPixmapCache>
@@ -68,47 +68,29 @@ QT_BEGIN_NAMESPACE
Q_GLOBAL_STATIC(QIconLoader, iconLoaderInstance)
+/* Theme to use in last resort, if the theme does not have the icon, neither the parents */
static QString fallbackTheme()
{
- QString defaultTheme;
-#ifdef Q_WS_X11
- if (X11->desktopEnvironment == DE_GNOME)
- defaultTheme = QLatin1String("gnome");
- else if (X11->desktopEnvironment == DE_KDE)
- defaultTheme = X11->desktopVersion >= 4 ?
- QString::fromLatin1("oxygen") :
- QString::fromLatin1("crystalsvg");
-#endif
- return defaultTheme;
-}
-
-static QString systemThemeName()
-{
- QString result = fallbackTheme();
#ifdef Q_WS_X11
if (X11->desktopEnvironment == DE_GNOME) {
-#ifndef QT_NO_STYLE_GTK
- result = QGtk::getGConfString(QLatin1String("/desktop/gnome/interface/icon_theme"),
- result);
-#endif
+ return QLatin1String("gnome");
} else if (X11->desktopEnvironment == DE_KDE) {
- QSettings settings(QKde::kdeHome() +
- QLatin1String("/share/config/kdeglobals"),
- QSettings::IniFormat);
-
- settings.beginGroup(QLatin1String("Icons"));
-
- result = settings.value(QLatin1String("Theme"), result).toString();
+ return X11->desktopVersion >= 4
+ ? QString::fromLatin1("oxygen")
+ : QString::fromLatin1("crystalsvg");
+ } else {
+ return QLatin1String("hicolor");
}
#endif
- return result;
+ return QString();
}
-
QIconLoader::QIconLoader() :
m_themeKey(1), m_supportsSvg(false)
{
- m_systemTheme = systemThemeName();
+ m_systemTheme = qt_guiPlatformPlugin()->systemIconThemeName();
+ if (m_systemTheme.isEmpty())
+ m_systemTheme = fallbackTheme();
QFactoryLoader iconFactoryLoader(QIconEngineFactoryInterfaceV2_iid,
QLatin1String("/iconengines"),
@@ -128,7 +110,9 @@ void QIconLoader::updateSystemTheme()
{
// Only change if this is not explicitly set by the user
if (m_userTheme.isEmpty()) {
- QString theme = systemThemeName();
+ QString theme = qt_guiPlatformPlugin()->systemIconThemeName();
+ if (theme.isEmpty())
+ theme = fallbackTheme();
if (theme != m_systemTheme) {
m_systemTheme = theme;
invalidateKey();
@@ -152,51 +136,7 @@ void QIconLoader::setThemeSearchPath(const QStringList &searchPaths)
QStringList QIconLoader::themeSearchPaths() const
{
if (m_iconDirs.isEmpty()) {
-
-#if defined(Q_WS_X11)
-
- QString xdgDirString = QFile::decodeName(getenv("XDG_DATA_DIRS"));
- if (xdgDirString.isEmpty())
- xdgDirString = QLatin1String("/usr/local/share/:/usr/share/");
-
- QStringList xdgDirs = xdgDirString.split(QLatin1Char(':'));
-
- for (int i = 0 ; i < xdgDirs.size() ; ++i) {
- QDir dir(xdgDirs[i]);
- if (dir.exists())
- m_iconDirs.append(dir.path() +
- QLatin1String("/icons"));
- }
-
- if (X11->desktopEnvironment == DE_KDE) {
-
- m_iconDirs << QLatin1Char(':') +
- QKde::kdeHome() +
- QLatin1String("/share/icons");
- QStringList kdeDirs =
- QFile::decodeName(getenv("KDEDIRS")).split(QLatin1Char(':'));
-
- for (int i = 0 ; i< kdeDirs.count() ; ++i) {
- QDir dir(QLatin1Char(':') + kdeDirs.at(i) +
- QLatin1String("/share/icons"));
- if (dir.exists())
- m_iconDirs.append(dir.path());
- }
- }
-
- // Add home directory first in search path
- QDir homeDir(QDir::homePath() + QLatin1String("/.icons"));
- if (homeDir.exists())
- m_iconDirs.prepend(homeDir.path());
-#endif
-
-#if defined(Q_WS_WIN)
- m_iconDirs.append(qApp->applicationDirPath() +
- QLatin1String("/icons"));
-#elif defined(Q_WS_MAC)
- m_iconDirs.append(qApp->applicationDirPath() +
- QLatin1String("/../Resources/icons"));
-#endif
+ m_iconDirs = qt_guiPlatformPlugin()->iconThemeSearchPaths();
// Allways add resource directory as search path
m_iconDirs.append(QLatin1String(":/icons"));
}
@@ -291,7 +231,7 @@ QThemeIconEntries QIconLoader::findIconHelper(const QString &themeName,
if (!theme.isValid()) {
theme = QIconTheme(themeName);
if (!theme.isValid())
- theme = fallbackTheme();
+ theme = QIconTheme(fallbackTheme());
themeList.insert(themeName, theme);
}
diff --git a/src/gui/image/qpixmap_s60.cpp b/src/gui/image/qpixmap_s60.cpp
index 37b6438..9ae8d72 100644
--- a/src/gui/image/qpixmap_s60.cpp
+++ b/src/gui/image/qpixmap_s60.cpp
@@ -229,24 +229,15 @@ static CFbsBitmap* uncompress(CFbsBitmap* bitmap)
lock.relock();
- CBitmapContext *bitmapContext = 0;
CFbsBitmapDevice* bitmapDevice = 0;
+ CFbsBitGc *bitmapGc = 0;
QT_TRAP_THROWING(bitmapDevice = CFbsBitmapDevice::NewL(uncompressed));
- TInt err = bitmapDevice->CreateBitmapContext(bitmapContext);
- if (err != KErrNone) {
- delete bitmap;
- delete bitmapDevice;
- bitmap = 0;
- bitmapDevice = 0;
-
- lock.relock();
-
- return bitmap;
- }
+ QT_TRAP_THROWING(bitmapGc = CFbsBitGc::NewL());
+ bitmapGc->Activate(bitmapDevice);
- bitmapContext->DrawBitmap(TPoint(), bitmap);
+ bitmapGc->DrawBitmap(TPoint(), bitmap);
- delete bitmapContext;
+ delete bitmapGc;
delete bitmapDevice;
return uncompressed;
@@ -355,7 +346,7 @@ QS60PixmapData::QS60PixmapData(PixelType type) : QRasterPixmapData(type),
symbianBitmapDataAccess(new QSymbianBitmapDataAccess),
cfbsBitmap(0),
bitmapDevice(0),
- bitmapContext(0),
+ bitmapGc(0),
pengine(0),
bytes(0)
{
@@ -365,6 +356,7 @@ QS60PixmapData::QS60PixmapData(PixelType type) : QRasterPixmapData(type),
QS60PixmapData::~QS60PixmapData()
{
release();
+ delete symbianBitmapDataAccess;
}
void QS60PixmapData::resize(int width, int height)
@@ -391,6 +383,8 @@ void QS60PixmapData::resize(int width, int height)
if(cfbsBitmap->SizeInPixels() != newSize) {
cfbsBitmap->Resize(TSize(width, height));
+ bitmapDevice->Resize(TSize(width, height));
+ bitmapGc->Resized();
if(pengine) {
delete pengine;
pengine = 0;
@@ -404,12 +398,9 @@ void QS60PixmapData::resize(int width, int height)
bool QS60PixmapData::initSymbianBitmapContext()
{
QT_TRAP_THROWING(bitmapDevice = CFbsBitmapDevice::NewL(cfbsBitmap));
- TInt err = bitmapDevice->CreateBitmapContext(bitmapContext);
- if (err != KErrNone) {
- delete bitmapDevice;
- bitmapDevice = 0;
- return false;
- }
+ QT_TRAP_THROWING(bitmapGc = CFbsBitGc::NewL());
+ bitmapGc->Activate(bitmapDevice);
+
return true;
}
@@ -417,7 +408,7 @@ void QS60PixmapData::release()
{
if (cfbsBitmap) {
QSymbianFbsHeapLock lock(QSymbianFbsHeapLock::Unlock);
- delete bitmapContext;
+ delete bitmapGc;
delete bitmapDevice;
delete cfbsBitmap;
lock.relock();
@@ -426,7 +417,7 @@ void QS60PixmapData::release()
delete pengine;
image = QImage();
cfbsBitmap = 0;
- bitmapContext = 0;
+ bitmapGc = 0;
bitmapDevice = 0;
pengine = 0;
bytes = 0;
@@ -559,13 +550,15 @@ void QS60PixmapData::copy(const QPixmapData *data, const QRect &rect)
resize(rect.width(), rect.height());
cfbsBitmap->SetDisplayMode(s60Data->cfbsBitmap->DisplayMode());
- bitmapContext->BitBlt(TPoint(0, 0), s60Data->cfbsBitmap, qt_QRect2TRect(rect));
+ bitmapGc->BitBlt(TPoint(0, 0), s60Data->cfbsBitmap, qt_QRect2TRect(rect));
}
bool QS60PixmapData::scroll(int dx, int dy, const QRect &rect)
{
- bitmapContext->CopyRect(TPoint(dx, dy), qt_QRect2TRect(rect));
- return true;
+ beginDataAccess();
+ bool res = QRasterPixmapData::scroll(dx, dy, rect);
+ endDataAccess();
+ return res;
}
int QS60PixmapData::metric(QPaintDevice::PaintDeviceMetric metric) const
@@ -723,6 +716,8 @@ void QS60PixmapData::beginDataAccess()
void QS60PixmapData::endDataAccess(bool readOnly) const
{
+ Q_UNUSED(readOnly);
+
if(!cfbsBitmap)
return;
diff --git a/src/gui/image/qpixmap_s60_p.h b/src/gui/image/qpixmap_s60_p.h
index 4498c05..b23961a 100644
--- a/src/gui/image/qpixmap_s60_p.h
+++ b/src/gui/image/qpixmap_s60_p.h
@@ -59,7 +59,7 @@ QT_BEGIN_NAMESPACE
class CFbsBitmap;
class CFbsBitmapDevice;
-class CBitmapContext;
+class CFbsBitGc;
class QSymbianBitmapDataAccess;
@@ -114,7 +114,7 @@ private:
CFbsBitmap *cfbsBitmap;
CFbsBitmapDevice *bitmapDevice;
- CBitmapContext *bitmapContext;
+ CFbsBitGc *bitmapGc;
QPaintEngine *pengine;
uchar* bytes;