diff options
author | Janne Anttila <janne.anttila@digia.com> | 2009-05-26 09:56:18 (GMT) |
---|---|---|
committer | Janne Anttila <janne.anttila@digia.com> | 2009-05-26 09:56:18 (GMT) |
commit | b8baa33fb9a385c5f4462dea73bd5cb3ac239203 (patch) | |
tree | b366701673eec92910ae968d13a19287edcb72ea /src | |
parent | 5f87463105f534cf357feba50f97c3f31ba7344f (diff) | |
parent | b0b4e58ed417d4fab5f73c0e6f82a2fb6a68f59f (diff) | |
download | Qt-b8baa33fb9a385c5f4462dea73bd5cb3ac239203.zip Qt-b8baa33fb9a385c5f4462dea73bd5cb3ac239203.tar.gz Qt-b8baa33fb9a385c5f4462dea73bd5cb3ac239203.tar.bz2 |
Merge branch 'master' of git@scm.dev.troll.no:qt/qt-s60-public
Diffstat (limited to 'src')
-rw-r--r-- | src/corelib/io/qfile.cpp | 1 | ||||
-rw-r--r-- | src/gui/styles/qs60style.cpp | 31 | ||||
-rw-r--r-- | src/gui/styles/qs60style_p.h | 9 | ||||
-rw-r--r-- | src/gui/styles/qs60style_simulated.cpp | 2 | ||||
-rw-r--r-- | src/gui/styles/qs60style_symbian.cpp | 4 |
5 files changed, 28 insertions, 19 deletions
diff --git a/src/corelib/io/qfile.cpp b/src/corelib/io/qfile.cpp index 4277779..551485d 100644 --- a/src/corelib/io/qfile.cpp +++ b/src/corelib/io/qfile.cpp @@ -741,7 +741,6 @@ QFile::rename(const QString &newName) error = true; } if(!error) { - in.close(); if (!remove()) { d->setError(QFile::RenameError, tr("Cannot remove source file")); error = true; diff --git a/src/gui/styles/qs60style.cpp b/src/gui/styles/qs60style.cpp index f8cf885..5026d5c 100644 --- a/src/gui/styles/qs60style.cpp +++ b/src/gui/styles/qs60style.cpp @@ -350,14 +350,24 @@ QFont QS60StylePrivate::s60Font( return result; } -//todo: you could pass a reason to clear cache here, so that we could -// deduce whether or not the specific cache needs to be cleared -void QS60StylePrivate::clearCaches() +void QS60StylePrivate::clearCaches(QS60StylePrivate::CacheClearReason reason) { - m_colorCache.clear(); - m_mappedFontsCache.clear(); - QPixmapCache::clear(); - m_backgroundValid = false; + switch(reason){ + case CC_LayoutChange: + // when layout changes, the colors remain in cache + m_mappedFontsCache.clear(); //todo: can font change, when layout changes? + m_backgroundValid = false; + QPixmapCache::clear(); + break; + case CC_ThemeChange: //todo: can font change when theme changes? + case CC_UndefinedChange: + default: + m_colorCache.clear(); + m_mappedFontsCache.clear(); + QPixmapCache::clear(); + m_backgroundValid = false; + break; + } } // Since S60Style has 'button' and 'tooltip' as a graphic, we don't have any native color which to use @@ -381,7 +391,6 @@ QColor QS60StylePrivate::colorFromFrameGraphics(QS60StylePrivate::SkinFrameEleme const int pixels = frameImage.numBytes()/sizeof(QRgb); const int bytesPerLine = frameImage.bytesPerLine(); Q_ASSERT(bytesPerLine); - const int rows = frameImage.numBytes()/(sizeof(QRgb)*bytesPerLine); int estimatedRed = 0; int estimatedGreen = 0; @@ -761,8 +770,6 @@ void QS60Style::drawComplexControl(ComplexControl control, const QStyleOptionCom const QS60StylePrivate::SkinElementFlags flags = (option->state & State_Enabled) ? QS60StylePrivate::SF_StateEnabled : QS60StylePrivate::SF_StateDisabled; SubControls sub = option->subControls; - Q_D(const QS60Style); - switch (control) { #ifndef QT_NO_SCROLLBAR case CC_ScrollBar: @@ -2413,7 +2420,6 @@ QRect QS60Style::subControlRect(ComplexControl control, const QStyleOptionComple //slightly indent text and boxes, so that dialog border does not mess with them. const int horizontalSpacing = QS60StylePrivate::pixelMetric(QStyle::PM_LayoutHorizontalSpacing); - const int bottomMargin = QS60StylePrivate::pixelMetric(QStyle::PM_LayoutBottomMargin); ret.adjust(2,horizontalSpacing-3,0,0); break; case SC_GroupBoxFrame: { @@ -2518,13 +2524,10 @@ QRect QS60Style::subElementRect(SubElement element, const QStyleOption *opt, con } } else if (const QStyleOptionMenuItem *menuItem = qstyleoption_cast<const QStyleOptionMenuItem *>(opt)) { const bool checkable = menuItem->checkType != QStyleOptionMenuItem::NotCheckable; - const bool subMenu = menuItem->menuItemType == QStyleOptionMenuItem::SubMenu; int indicatorWidth = checkable ? pixelMetric(PM_ListViewIconSize, opt, widget) : pixelMetric(PM_SmallIconSize, opt, widget); ret = menuItem->rect; - const int verticalSpacing = - QS60StylePrivate::pixelMetric(QStyle::PM_LayoutVerticalSpacing); if (element == SE_ItemViewItemDecoration) { if (menuItem->direction == Qt::RightToLeft) diff --git a/src/gui/styles/qs60style_p.h b/src/gui/styles/qs60style_p.h index 37c6ec7..ba7dca3 100644 --- a/src/gui/styles/qs60style_p.h +++ b/src/gui/styles/qs60style_p.h @@ -331,6 +331,13 @@ public: SF_StateDisabled = 0x0020, SF_ColorSkinned = 0x0040, }; + + enum CacheClearReason { + CC_UndefinedChange = 0, + CC_LayoutChange, + CC_ThemeChange + }; + Q_DECLARE_FLAGS(SkinElementFlags, SkinElementFlag) // draws skin element @@ -365,7 +372,7 @@ public: QFont s60Font(QS60StyleEnums::FontCategories fontCategory, int pointSize = -1) const; // clears all style caches (fonts, colors, pixmaps) - void clearCaches(); + void clearCaches(CacheClearReason reason = CC_UndefinedChange); // returns themed background texture static QPixmap backgroundTexture(); diff --git a/src/gui/styles/qs60style_simulated.cpp b/src/gui/styles/qs60style_simulated.cpp index f10da2b..65336ae 100644 --- a/src/gui/styles/qs60style_simulated.cpp +++ b/src/gui/styles/qs60style_simulated.cpp @@ -289,7 +289,7 @@ void QS60Style::setS60Theme(const QHash<QString, QPicture> &parts, Q_D(QS60Style); QS60StyleModeSpecifics::m_partPictures = parts; QS60StyleModeSpecifics::m_colors = colors; - d->clearCaches(); + d->clearCaches(QS60StylePrivate::CC_ThemeChange); } QT_END_NAMESPACE diff --git a/src/gui/styles/qs60style_symbian.cpp b/src/gui/styles/qs60style_symbian.cpp index 48b759a..3fc4c8c 100644 --- a/src/gui/styles/qs60style_symbian.cpp +++ b/src/gui/styles/qs60style_symbian.cpp @@ -1352,7 +1352,7 @@ void QS60StyleModeSpecifics::colorGroupAndIndex( void QS60Style::handleDynamicLayoutVariantSwitch() { Q_D(QS60Style); - d->clearCaches(); + d->clearCaches(QS60StylePrivate::CC_LayoutChange); #ifdef QT_S60STYLE_LAYOUTDATA_SIMULATED d->setActiveLayout(); #endif // QT_S60STYLE_LAYOUTDATA_SIMULATED @@ -1365,7 +1365,7 @@ void QS60Style::handleDynamicLayoutVariantSwitch() void QS60Style::handleSkinChange() { Q_D(QS60Style); - d->clearCaches(); + d->clearCaches(QS60StylePrivate::CC_ThemeChange); d->setThemePalette(qApp); foreach (QWidget *topLevelWidget, QApplication::allWidgets()){ QEvent e(QEvent::StyleChange); |