From a135a11faeafaed264e264975b74ba7665ff5e42 Mon Sep 17 00:00:00 2001 From: Janne Anttila Date: Wed, 27 May 2009 13:21:57 +0300 Subject: Configured qtwidgets autotest to use default IAP without user prompts. --- tests/auto/qtwidgets/tst_qtwidgets.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/tests/auto/qtwidgets/tst_qtwidgets.cpp b/tests/auto/qtwidgets/tst_qtwidgets.cpp index a6a3be1..6a79242 100644 --- a/tests/auto/qtwidgets/tst_qtwidgets.cpp +++ b/tests/auto/qtwidgets/tst_qtwidgets.cpp @@ -47,15 +47,28 @@ #include "mainwindow.h" +#include "../network-settings.h" class tst_QtWidgets: public QObject { Q_OBJECT +public: + tst_QtWidgets(); + virtual ~tst_QtWidgets(); + private slots: void snapshot(); }; +tst_QtWidgets::tst_QtWidgets() +{ + Q_SET_DEFAULT_IAP +} + +tst_QtWidgets::~tst_QtWidgets() +{ +} void tst_QtWidgets::snapshot() { -- cgit v0.12 From 86d5c38d3f21a7d89dd619fa448a9c50527d8ba5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sami=20Meril=C3=A4?= Date: Wed, 27 May 2009 13:44:40 +0300 Subject: S60Style: Keep the background texture in static QPixmap pointer. --- src/gui/styles/qs60style.cpp | 27 +++++++++++++++++---------- src/gui/styles/qs60style_p.h | 20 ++++++++++++-------- src/gui/styles/qs60style_simulated.cpp | 19 +++++-------------- src/gui/styles/qs60style_symbian.cpp | 34 ++++++++++++---------------------- 4 files changed, 46 insertions(+), 54 deletions(-) diff --git a/src/gui/styles/qs60style.cpp b/src/gui/styles/qs60style.cpp index 071b60a..5f7c083 100644 --- a/src/gui/styles/qs60style.cpp +++ b/src/gui/styles/qs60style.cpp @@ -95,7 +95,8 @@ const short QS60StylePrivate::data[][MAX_PIXELMETRICS] = { const short *QS60StylePrivate::m_pmPointer = QS60StylePrivate::data[0]; #endif // defined(QT_S60STYLE_LAYOUTDATA_SIMULATED) -bool QS60StylePrivate::m_backgroundValid = false; +// theme background texture +QPixmap *QS60StylePrivate::m_background = 0; const struct QS60StylePrivate::frameElementCenter QS60StylePrivate::m_frameElementsData[] = { {SE_ButtonNormal, QS60StyleEnums::SP_QsnFrButtonTbCenter}, @@ -352,25 +353,25 @@ QFont QS60StylePrivate::s60Font( void QS60StylePrivate::clearCaches(QS60StylePrivate::CacheClearReason reason) { - switch(reason){ + switch(reason){ case CC_LayoutChange: // when layout changes, the colors remain in cache, but graphics and fonts can change m_mappedFontsCache.clear(); - m_backgroundValid = false; + deleteBackground(); QPixmapCache::clear(); break; case CC_ThemeChange: m_colorCache.clear(); QPixmapCache::clear(); - m_backgroundValid = false; + deleteBackground(); case CC_UndefinedChange: default: m_colorCache.clear(); m_mappedFontsCache.clear(); QPixmapCache::clear(); - m_backgroundValid = false; + deleteBackground(); break; - } + } } // Since S60Style has 'button' and 'tooltip' as a graphic, we don't have any native color which to use @@ -561,6 +562,14 @@ void QS60StylePrivate::setBackgroundTexture(QApplication *app) const app->setPalette(applicationPalette); } +void QS60StylePrivate::deleteBackground() +{ + if (QS60StylePrivate::m_background) { + delete QS60StylePrivate::m_background; + QS60StylePrivate::m_background = 0; + } +} + int QS60StylePrivate::focusRectPenWidth() { return pixelMetric(QS60Style::PM_DefaultFrameWidth); @@ -1314,16 +1323,14 @@ void QS60Style::drawControl(ControlElement element, const QStyleOption *option, (listView->selectionMode() == QAbstractItemView::SingleSelection || listView->selectionMode() == QAbstractItemView::NoSelection); QRect selectionRect = subElementRect(SE_ItemViewItemCheckIndicator, &voptAdj, widget); - if (voptAdj.state & QStyle::State_Selected && - !singleSelection) { + if (voptAdj.state & QStyle::State_Selected && !singleSelection) { QStyleOptionViewItemV4 option(voptAdj); option.rect = selectionRect; // Draw selection mark. drawPrimitive(QStyle::PE_IndicatorViewItemCheck, &option, painter, widget); if ( textRect.right() > selectionRect.left() ) textRect.setRight(selectionRect.left()); - } - else if (singleSelection && + } else if (singleSelection && voptAdj.features & QStyleOptionViewItemV2::HasCheckIndicator) { // draw the check mark if (selectionRect.isValid()) { diff --git a/src/gui/styles/qs60style_p.h b/src/gui/styles/qs60style_p.h index ba7dca3..bedff58 100644 --- a/src/gui/styles/qs60style_p.h +++ b/src/gui/styles/qs60style_p.h @@ -331,13 +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 @@ -373,8 +373,10 @@ public: int pointSize = -1) const; // clears all style caches (fonts, colors, pixmaps) void clearCaches(CacheClearReason reason = CC_UndefinedChange); - // returns themed background texture - static QPixmap backgroundTexture(); + + // themed main background oprations + void setBackgroundTexture(QApplication *application) const; + static void deleteBackground(); static bool isTouchSupported(); static bool isToolBarBackground(); @@ -383,7 +385,6 @@ public: QColor colorFromFrameGraphics(QS60StylePrivate::SkinFrameElements frame) const; void setThemePalette(QApplication *application) const; void setThemePalette(QWidget *widget) const; - void setBackgroundTexture(QApplication *application) const; static int focusRectPenWidth(); @@ -411,6 +412,8 @@ public: static QPixmap frame(SkinFrameElements frame, const QSize &size, SkinElementFlags flags = KDefaultSkinElementFlags); + static QPixmap backgroundTexture(); + private: static void drawPart(QS60StyleEnums::SkinParts part, QPainter *painter, const QRect &rect, SkinElementFlags flags = KDefaultSkinElementFlags); @@ -424,9 +427,9 @@ private: SkinElementFlags flags = KDefaultSkinElementFlags); static QPixmap cachedFrame(SkinFrameElements frame, const QSize &size, SkinElementFlags flags = KDefaultSkinElementFlags); - + static void refreshUI(); - + static QSize partSize(QS60StyleEnums::SkinParts part, SkinElementFlags flags = KDefaultSkinElementFlags); static QPixmap part(QS60StyleEnums::SkinParts part, const QSize &size, @@ -436,7 +439,8 @@ private: static QSize screenSize(); - static bool m_backgroundValid; + // Contains background texture. + static QPixmap *m_background; const static SkinElementFlags KDefaultSkinElementFlags; }; diff --git a/src/gui/styles/qs60style_simulated.cpp b/src/gui/styles/qs60style_simulated.cpp index 65336ae..3edc874 100644 --- a/src/gui/styles/qs60style_simulated.cpp +++ b/src/gui/styles/qs60style_simulated.cpp @@ -193,24 +193,15 @@ QVariant QS60StylePrivate::styleProperty_specific(const char *name) const QPixmap QS60StylePrivate::backgroundTexture() { - static QPixmap result; - // Poor mans caching. + Making sure that there is always only one background image in memory at a time - -/* - TODO: 1) Hold the background QPixmap as pointer in a static class member. - Also add a deleteBackground() function and call that in ~QS60StylePrivate() - 2) Don't cache the background at all as soon as we have native pixmap support -*/ - - if (!m_backgroundValid) { - result = QPixmap(); + if (!m_background) { const QSize size = QApplication::activeWindow()?QApplication::activeWindow()->size():QSize(100, 100); - result = part(QS60StyleEnums::SP_QsnBgScreen, size); - m_backgroundValid = true; + QPixmap background = part(QS60StyleEnums::SP_QsnBgScreen, size); + m_background = new QPixmap(background); } - return result; + return *m_background; } + bool QS60StylePrivate::isTouchSupported() { #ifdef QT_KEYPAD_NAVIGATION diff --git a/src/gui/styles/qs60style_symbian.cpp b/src/gui/styles/qs60style_symbian.cpp index 3fc4c8c..f860842 100644 --- a/src/gui/styles/qs60style_symbian.cpp +++ b/src/gui/styles/qs60style_symbian.cpp @@ -583,26 +583,6 @@ QPixmap QS60StyleModeSpecifics::fromFbsBitmap(CFbsBitmap *icon, CFbsBitmap *mask return QPixmap::fromImage(iconImage); } -QPixmap QS60StylePrivate::backgroundTexture() -{ - static QPixmap result; - // Poor mans caching. + Making sure that there is always only one background image in memory at a time - -/* - TODO: 1) Hold the background QPixmap as pointer in a static class member. - Also add a deleteBackground() function and call that in ~QS60StylePrivate() - 2) Don't cache the background at all as soon as we have native pixmap support -*/ - - if (!m_backgroundValid) { - result = QPixmap(); - result = part(QS60StyleEnums::SP_QsnBgScreen, - QSize(S60->screenWidthInPixels, S60->screenHeightInPixels), SkinElementFlags()); - m_backgroundValid = true; - } - return result; -} - bool QS60StylePrivate::isTouchSupported() { return bool(AknLayoutUtils::PenEnabled()); @@ -975,7 +955,7 @@ void QS60StylePrivate::setActiveLayout() break; } } - + //not found, lets try without mirroring info if (activeLayoutIndex==-1){ for (int i=0; iscreenWidthInPixels, S60->screenHeightInPixels), SkinElementFlags()); + m_background = new QPixmap(background); + } + return *m_background; +} + // If the public SDK returns compressed images, please let us also uncompress those! void QS60StyleModeSpecifics::unCompressBitmapL(const TRect& aTrgRect, CFbsBitmap* aTrgBitmap, CFbsBitmap* aSrcBitmap) { -- cgit v0.12 From 97228a74cbb6bffa2d621f3267da9270381aec37 Mon Sep 17 00:00:00 2001 From: Janne Anttila Date: Wed, 27 May 2009 13:48:48 +0300 Subject: Workaround for non-native makefile target names with symbian-abl. --- tests/auto/qresourceengine/qresourceengine.pro | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tests/auto/qresourceengine/qresourceengine.pro b/tests/auto/qresourceengine/qresourceengine.pro index f487b97..d98c2db 100644 --- a/tests/auto/qresourceengine/qresourceengine.pro +++ b/tests/auto/qresourceengine/qresourceengine.pro @@ -9,7 +9,11 @@ load(resources) SOURCES += tst_resourceengine.cpp RESOURCES += testqrc/test.qrc -runtime_resource.target = $$PWD/runtime_resource.rcc +symbian-sbsv2 { + runtime_resource.target = $$PWD/runtime_resource.rcc +} else { + runtime_resource.target = runtime_resource.rcc +} runtime_resource.depends = $$PWD/testqrc/test.qrc runtime_resource.commands = $$QMAKE_RCC -root /runtime_resource/ -binary $${runtime_resource.depends} -o $${runtime_resource.target} QMAKE_EXTRA_TARGETS = runtime_resource -- cgit v0.12 From df4a095019638356520728f88ac4d919e654dcdd Mon Sep 17 00:00:00 2001 From: Jason Barron Date: Wed, 27 May 2009 15:41:01 +0200 Subject: Modify QDesktopWidget to emit proper signals on resize. The resize behavior of QDesktopWidget was somewhat undefined on Symbian because we weren't actually changing the size of the widget. This patch fixes that and also implements the resizeEvent() function so that it properly emits signals. We didn't call resize() to change the size here because our implementation of setGeometry_sys() ignores the desktop widget since it doesn't have a backing store and isn't a real window. Task-number: 253930 --- src/gui/kernel/qapplication_s60.cpp | 10 ++++++ src/gui/kernel/qdesktopwidget_s60.cpp | 63 ++++++++++++++++++++++++++++++----- 2 files changed, 65 insertions(+), 8 deletions(-) diff --git a/src/gui/kernel/qapplication_s60.cpp b/src/gui/kernel/qapplication_s60.cpp index dd51fcd..5b2c1fb 100644 --- a/src/gui/kernel/qapplication_s60.cpp +++ b/src/gui/kernel/qapplication_s60.cpp @@ -14,6 +14,7 @@ #include "qevent.h" #include "qeventdispatcher_s60_p.h" #include "qwidget.h" +#include "qdesktopwidget.h" #include "private/qbackingstore_p.h" #include "qt_s60_p.h" #include "private/qevent_p.h" @@ -49,6 +50,8 @@ static bool appNoGrab = false; // Grabbing enabled Q_GUI_EXPORT QS60Data *qt_s60Data = 0; extern bool qt_sendSpontaneousEvent(QObject*,QEvent*); +extern QDesktopWidget *qt_desktopWidget; // qapplication.cpp + QWidget *qt_button_down = 0; // widget got last button-down bool qt_nograb() // application no-grab option @@ -988,6 +991,13 @@ int QApplication::s60ProcessEvent(TWsEvent *event) case EEventScreenDeviceChanged: if (S60) S60->updateScreenSize(); + if (qt_desktopWidget) { + QSize oldSize = qt_desktopWidget->size(); + qt_desktopWidget->data->crect.setWidth(S60->screenWidthInPixels); + qt_desktopWidget->data->crect.setHeight(S60->screenHeightInPixels); + QResizeEvent e(qt_desktopWidget->size(), oldSize); + QApplication::sendEvent(qt_desktopWidget, &e); + } return 0; // Propagate to CONE case EEventWindowVisibilityChanged: if (controlInMap) { diff --git a/src/gui/kernel/qdesktopwidget_s60.cpp b/src/gui/kernel/qdesktopwidget_s60.cpp index 029892e..d57d289 100644 --- a/src/gui/kernel/qdesktopwidget_s60.cpp +++ b/src/gui/kernel/qdesktopwidget_s60.cpp @@ -32,34 +32,58 @@ public: static int screenCount; static int primaryScreen; + + static QVector *rects; + static QVector *workrects; + + static int refcount; }; int QDesktopWidgetPrivate::screenCount = 1; int QDesktopWidgetPrivate::primaryScreen = 0; +QVector *QDesktopWidgetPrivate::rects = 0; +QVector *QDesktopWidgetPrivate::workrects = 0; +int QDesktopWidgetPrivate::refcount = 0; QDesktopWidgetPrivate::QDesktopWidgetPrivate() { + ++refcount; } QDesktopWidgetPrivate::~QDesktopWidgetPrivate() { + if (!--refcount) + cleanup(); } void QDesktopWidgetPrivate::init(QDesktopWidget *that) { - TInt screenCount=0; - TInt result=0; + int screenCount=0; + + if (HAL::Get(0, HALData::EDisplayNumberOfScreens, screenCount) == KErrNone) + QDesktopWidgetPrivate::screenCount = screenCount; + else + QDesktopWidgetPrivate::screenCount = 0; - result = HAL::Get(0, HALData::EDisplayNumberOfScreens, screenCount); - QDesktopWidgetPrivate::screenCount = screenCount; - if( result != KErrNone) - { - // ### What to do if no screens found? - } + rects = new QVector(); + workrects = new QVector(); + + rects->resize(QDesktopWidgetPrivate::screenCount); + workrects->resize(QDesktopWidgetPrivate::screenCount); + + // ### TODO: Implement proper multi-display support + rects->resize(1); + rects->replace(0, that->rect()); + workrects->resize(1); + workrects->replace(0, that->rect()); } void QDesktopWidgetPrivate::cleanup() { + delete rects; + rects = 0; + delete workrects; + workrects = 0; } @@ -120,6 +144,29 @@ int QDesktopWidget::screenNumber(const QPoint &point) const void QDesktopWidget::resizeEvent(QResizeEvent *) { + Q_D(QDesktopWidget); + QVector oldrects; + oldrects = *d->rects; + QVector oldworkrects; + oldworkrects = *d->workrects; + int oldscreencount = d->screenCount; + + QDesktopWidgetPrivate::cleanup(); + QDesktopWidgetPrivate::init(this); + + for (int i = 0; i < qMin(oldscreencount, d->screenCount); ++i) { + QRect oldrect = oldrects[i]; + QRect newrect = d->rects->at(i); + if (oldrect != newrect) + emit resized(i); + } + + for (int j = 0; j < qMin(oldscreencount, d->screenCount); ++j) { + QRect oldrect = oldworkrects[j]; + QRect newrect = d->workrects->at(j); + if (oldrect != newrect) + emit workAreaResized(j); + } } QT_END_NAMESPACE -- cgit v0.12 From f96614f608d080b89fde95118f0eb35443b671ea Mon Sep 17 00:00:00 2001 From: Aleksandar Sasha Babic Date: Wed, 27 May 2009 18:55:18 +0200 Subject: InputMethods supported enabled for QPlainTextEdit. --- src/gui/widgets/qplaintextedit.cpp | 20 ++++++++++++++++++-- src/gui/widgets/qplaintextedit_p.h | 6 +++++- 2 files changed, 23 insertions(+), 3 deletions(-) diff --git a/src/gui/widgets/qplaintextedit.cpp b/src/gui/widgets/qplaintextedit.cpp index e563fa1..3d2c4f5 100644 --- a/src/gui/widgets/qplaintextedit.cpp +++ b/src/gui/widgets/qplaintextedit.cpp @@ -72,6 +72,11 @@ QT_BEGIN_NAMESPACE +static inline bool shouldEnableInputMethod(QPlainTextEdit *plaintextedit) +{ + return !plaintextedit->isReadOnly(); +} + class QPlainTextDocumentLayoutPrivate : public QAbstractTextDocumentLayoutPrivate { Q_DECLARE_PUBLIC(QPlainTextDocumentLayout) @@ -705,7 +710,8 @@ QPlainTextEditPrivate::QPlainTextEditPrivate() tabChangesFocus(false), lineWrap(QPlainTextEdit::WidgetWidth), wordWrap(QTextOption::WrapAtWordBoundaryOrAnywhere), - topLine(0), pageUpDownLastCursorYIsValid(false) + clickCausedFocus(0),topLine(0), + pageUpDownLastCursorYIsValid(false) { showCursorOnInitialShow = true; backgroundVisible = false; @@ -1905,6 +1911,13 @@ void QPlainTextEdit::mouseReleaseEvent(QMouseEvent *e) d->autoScrollTimer.stop(); d->ensureCursorVisible(); } + + if (e->button() == Qt::LeftButton && qApp->autoSipEnabled() + && (!d->clickCausedFocus || qApp->autoSipOnMouseFocus())) { + QEvent event(QEvent::RequestSoftwareInputPanel); + QApplication::sendEvent(this, &event); + } + d->clickCausedFocus = 0; } /*! \reimp @@ -2038,6 +2051,9 @@ QVariant QPlainTextEdit::inputMethodQuery(Qt::InputMethodQuery property) const void QPlainTextEdit::focusInEvent(QFocusEvent *e) { Q_D(QPlainTextEdit); + if (e->reason() == Qt::MouseFocusReason) { + d->clickCausedFocus = 1; + } QAbstractScrollArea::focusInEvent(e); d->sendControlEvent(e); } @@ -2304,7 +2320,7 @@ void QPlainTextEdit::setReadOnly(bool ro) } else { flags = Qt::TextEditorInteraction; } - setAttribute(Qt::WA_InputMethodEnabled, !ro); + setAttribute(Qt::WA_InputMethodEnabled, shouldEnableInputMethod(this)); d->control->setTextInteractionFlags(flags); } diff --git a/src/gui/widgets/qplaintextedit_p.h b/src/gui/widgets/qplaintextedit_p.h index 0739d53..56a3aa9 100644 --- a/src/gui/widgets/qplaintextedit_p.h +++ b/src/gui/widgets/qplaintextedit_p.h @@ -91,7 +91,10 @@ public: return r; } inline QRectF cursorRect() { return cursorRect(textCursor()); } - void ensureCursorVisible() { textEdit->ensureCursorVisible(); } + void ensureCursorVisible() { + textEdit->ensureCursorVisible(); + emit microFocusChanged(); + } QPlainTextEdit *textEdit; @@ -148,6 +151,7 @@ public: uint backgroundVisible : 1; uint centerOnScroll : 1; uint inDrag : 1; + uint clickCausedFocus : 1; int topLine; -- cgit v0.12 From 2f42ad94f671d50568afa2a1d0ef82e921cc73a0 Mon Sep 17 00:00:00 2001 From: Jason Barron Date: Thu, 28 May 2009 09:09:07 +0200 Subject: Optimize font DPI calculation by using cached value. The default DPI is stored in the S60 structure, so that can simply be used here instead of re-calculating it each time. Task-number: 247279 --- src/gui/text/qfont.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/gui/text/qfont.cpp b/src/gui/text/qfont.cpp index 4d316f6..930e8af 100644 --- a/src/gui/text/qfont.cpp +++ b/src/gui/text/qfont.cpp @@ -173,8 +173,7 @@ Q_GUI_EXPORT int qt_defaultDpiX() screen = subScreens.at(0); dpi = qRound(screen->width() / (screen->physicalWidth() / qreal(25.4))); #elif defined(Q_WS_S60) - const TReal inchWidth = (TReal)S60->screenWidthInTwips / KTwipsPerInch; - dpi = S60->screenWidthInPixels / inchWidth; + dpi = S60->defaultDpiX; #endif // Q_WS_X11 return dpi; @@ -202,8 +201,7 @@ Q_GUI_EXPORT int qt_defaultDpiY() screen = subScreens.at(0); dpi = qRound(screen->height() / (screen->physicalHeight() / qreal(25.4))); #elif defined(Q_WS_S60) - const TReal inchHeight = (TReal)S60->screenHeightInTwips / KTwipsPerInch; - dpi = S60->screenHeightInPixels / inchHeight; + dpi = S60->defaultDpiY; #endif // Q_WS_X11 return dpi; -- cgit v0.12 From ec081e992b1c8588bd08fef677fe090f6fe5c693 Mon Sep 17 00:00:00 2001 From: Aleksandar Sasha Babic Date: Thu, 28 May 2009 09:24:58 +0200 Subject: No need for this IP address. --- tests/auto/qhostinfo/tst_qhostinfo.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/auto/qhostinfo/tst_qhostinfo.cpp b/tests/auto/qhostinfo/tst_qhostinfo.cpp index c3aca7a..0395ca0 100644 --- a/tests/auto/qhostinfo/tst_qhostinfo.cpp +++ b/tests/auto/qhostinfo/tst_qhostinfo.cpp @@ -92,7 +92,6 @@ //TESTED_CLASS= //TESTED_FILES= -const char * const lupinellaIp = "10.3.4.6"; class tst_QHostInfo : public QObject { -- cgit v0.12 From 349dd6ef5cbba0c45d8089a3cf65f587c2662c4d Mon Sep 17 00:00:00 2001 From: Janne Anttila Date: Thu, 28 May 2009 13:59:31 +0300 Subject: Fixed Qt/Symbian compilation with -stl configure option. The STL enabled config does not have implicit include for e32base.h. --- src/plugins/s60/src/qdesktopservices_3_2.cpp | 4 +++- src/plugins/s60/src/qlocale_3_2.cpp | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/plugins/s60/src/qdesktopservices_3_2.cpp b/src/plugins/s60/src/qdesktopservices_3_2.cpp index e563c14..679b370 100644 --- a/src/plugins/s60/src/qdesktopservices_3_2.cpp +++ b/src/plugins/s60/src/qdesktopservices_3_2.cpp @@ -10,10 +10,12 @@ ****************************************************************************/ #include -#include // CDirectoryLocalizer #include #include +#include // CBase -> Required by cdirectorylocalizer.h +#include // CDirectoryLocalizer + EXPORT_C QString localizedDirectoryName(QString& rawPath) { QString ret; diff --git a/src/plugins/s60/src/qlocale_3_2.cpp b/src/plugins/s60/src/qlocale_3_2.cpp index 027eefc..fe1d642 100644 --- a/src/plugins/s60/src/qlocale_3_2.cpp +++ b/src/plugins/s60/src/qlocale_3_2.cpp @@ -10,6 +10,7 @@ ****************************************************************************/ #include +#include EXPORT_C TPtrC defaultGetLongDateFormatSpec(TExtendedLocale& locale) { -- cgit v0.12 From f4d9a9458451ad4b3bd63bfafa34a57e3ba91c4a Mon Sep 17 00:00:00 2001 From: Janne Anttila Date: Thu, 28 May 2009 14:03:24 +0300 Subject: Enabled STL support by default in configure.exe for Symbian. This change should be quite safe, since all Qt <-> STL type conversions are implemented in inline methods. The only major difference is that new operator is now used from STL instead of one from e32base.h Of course, this change also requires that you have STLport installed to your SDK. This should be the case if you have installed the latest Open C/C++ plug-in from forum nokia. --- configure.exe | Bin 535040 -> 1183744 bytes tools/configure/configureapp.cpp | 2 +- 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.exe b/configure.exe index 30383d8..b3e68c2 100755 Binary files a/configure.exe and b/configure.exe differ diff --git a/tools/configure/configureapp.cpp b/tools/configure/configureapp.cpp index a879e5d..40caff0 100644 --- a/tools/configure/configureapp.cpp +++ b/tools/configure/configureapp.cpp @@ -1405,7 +1405,7 @@ void Configure::applySpecSpecifics() dictionary[ "QT3SUPPORT" ] = "no"; dictionary[ "OPENGL" ] = "no"; dictionary[ "OPENSSL" ] = "no"; - dictionary[ "STL" ] = "no"; + dictionary[ "STL" ] = "yes"; dictionary[ "EXCEPTIONS" ] = "no"; dictionary[ "RTTI" ] = "no"; dictionary[ "ARCHITECTURE" ] = "symbian"; -- cgit v0.12 From 131d8f90aa2991866884a896fdebcc05a020a905 Mon Sep 17 00:00:00 2001 From: axis Date: Thu, 28 May 2009 13:24:10 +0200 Subject: Recompiled configure.exe with MSVC6. --- configure.exe | Bin 1183744 -> 868352 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/configure.exe b/configure.exe index b3e68c2..65db048 100755 Binary files a/configure.exe and b/configure.exe differ -- cgit v0.12 From 1ee484031d2a240bd7019753e83bb473ea9891de Mon Sep 17 00:00:00 2001 From: Alessandro Portale Date: Thu, 28 May 2009 13:49:08 +0200 Subject: Enabled QtS60Style background filling also for _simulated, by moving some code to qs60style.cpp. De-duplicated some code in qt_s60_fill_background. The unused QT_S60STYLE_LAYOUTDATA_SIMULATED had to go, too. --- src/gui/kernel/qwidget.cpp | 23 +++++++------- src/gui/styles/qs60style.cpp | 55 ++++++++++++++++++++++++---------- src/gui/styles/qs60style_p.h | 2 -- src/gui/styles/qs60style_simulated.cpp | 23 +++++--------- src/gui/styles/qs60style_symbian.cpp | 52 +++----------------------------- src/gui/styles/styles.pri | 1 - 6 files changed, 65 insertions(+), 91 deletions(-) diff --git a/src/gui/kernel/qwidget.cpp b/src/gui/kernel/qwidget.cpp index dae4179..4fcedb4 100644 --- a/src/gui/kernel/qwidget.cpp +++ b/src/gui/kernel/qwidget.cpp @@ -2046,17 +2046,20 @@ static inline void fillRegion(QPainter *painter, const QRegion &rgn, const QPoin // Defined in qmacstyle_mac.cpp extern void qt_mac_fill_background(QPainter *painter, const QRegion &rgn, const QPoint &offset, const QBrush &brush); qt_mac_fill_background(painter, rgn, offset, brush); -#elif defined(Q_WS_S60) - // Defined in qs60style_symbian.cpp - extern void qt_s60_fill_background(QPainter *painter, const QRegion &rgn, - const QPoint &offset, const QBrush &brush); - qt_s60_fill_background(painter, rgn, offset, brush); #else - const QRegion translated = rgn.translated(offset); - const QRect rect(translated.boundingRect()); - painter->setClipRegion(translated); - painter->drawTiledPixmap(rect, brush.texture(), rect.topLeft()); -#endif +#if !defined(QT_NO_STYLE_S60) + // Defined in qs60style.cpp + extern bool qt_s60_fill_background(QPainter *painter, const QRegion &rgn, + const QPoint &offset, const QBrush &brush); + if (!qt_s60_fill_background(painter, rgn, offset, brush)) +#endif // !defined(QT_NO_STYLE_S60) + { + const QRegion translated = rgn.translated(offset); + const QRect rect(translated.boundingRect()); + painter->setClipRegion(translated); + painter->drawTiledPixmap(rect, brush.texture(), rect.topLeft()); + } +#endif // Q_WS_MAC } else { const QVector &rects = rgn.rects(); for (int i = 0; i < rects.size(); ++i) diff --git a/src/gui/styles/qs60style.cpp b/src/gui/styles/qs60style.cpp index 5f7c083..b066967 100644 --- a/src/gui/styles/qs60style.cpp +++ b/src/gui/styles/qs60style.cpp @@ -57,7 +57,6 @@ const QS60StylePrivate::SkinElementFlags QS60StylePrivate::KDefaultSkinElementFl static const QByteArray propertyKeyLayouts = "layouts"; static const QByteArray propertyKeyCurrentlayout = "currentlayout"; -#if defined(QT_S60STYLE_LAYOUTDATA_SIMULATED) const layoutHeader QS60StylePrivate::m_layoutHeaders[] = { // *** generated layout data *** {240,320,1,14,true,QLatin1String("QVGA Landscape Mirrored")}, @@ -93,7 +92,6 @@ const short QS60StylePrivate::data[][MAX_PIXELMETRICS] = { }; const short *QS60StylePrivate::m_pmPointer = QS60StylePrivate::data[0]; -#endif // defined(QT_S60STYLE_LAYOUTDATA_SIMULATED) // theme background texture QPixmap *QS60StylePrivate::m_background = 0; @@ -119,6 +117,11 @@ static const int frameElementsCount = const int KNotFound = -1; +QS60StylePrivate::~QS60StylePrivate() +{ + deleteBackground(); +} + void QS60StylePrivate::drawSkinElement(SkinElements element, QPainter *painter, const QRect &rect, SkinElementFlags flags) { @@ -252,10 +255,18 @@ void QS60StylePrivate::drawSkinPart(QS60StyleEnums::SkinParts part, drawPart(part, painter, rect, flags); } +short QS60StylePrivate::pixelMetric(int metric) +{ + Q_ASSERT(metric < MAX_PIXELMETRICS); + const short returnValue = m_pmPointer[metric]; + if (returnValue==-909) + return -1; + return returnValue; +} + void QS60StylePrivate::setStyleProperty(const char *name, const QVariant &value) { if (name == propertyKeyCurrentlayout) { -#if !defined(QT_WS_S60) || defined(QT_S60STYLE_LAYOUTDATA_SIMULATED) static const QStringList layouts = styleProperty(propertyKeyLayouts).toStringList(); const QString layout = value.toString(); Q_ASSERT(layouts.contains(layout)); @@ -265,24 +276,17 @@ void QS60StylePrivate::setStyleProperty(const char *name, const QVariant &value) clearCaches(); refreshUI(); return; -#else - qFatal("Cannot set static layout. Dynamic layouts are used!"); -#endif } } QVariant QS60StylePrivate::styleProperty(const char *name) const { if (name == propertyKeyLayouts) { -#if !defined(QT_WS_S60) || defined(QT_S60STYLE_LAYOUTDATA_SIMULATED) static QStringList layouts; if (layouts.isEmpty()) for (int i = 0; i < QS60StylePrivate::m_numberOfLayouts; i++) layouts.append(QS60StylePrivate::m_layoutHeaders[i].layoutName); return layouts; -#else - qFatal("Cannot return list of 'canned' static layouts. Dynamic layouts are used!"); -#endif } return QVariant(); } @@ -575,13 +579,10 @@ int QS60StylePrivate::focusRectPenWidth() return pixelMetric(QS60Style::PM_DefaultFrameWidth); } -#if !defined(QT_WS_S60) || defined(QT_S60STYLE_LAYOUTDATA_SIMULATED) void QS60StylePrivate::setCurrentLayout(int index) { m_pmPointer = data[index]; } -#endif - void QS60StylePrivate::drawPart(QS60StyleEnums::SkinParts skinPart, QPainter *painter, const QRect &rect, SkinElementFlags flags) @@ -2185,7 +2186,6 @@ int QS60Style::pixelMetric(PixelMetric metric, const QStyleOption *option, const metricValue = QCommonStyle::pixelMetric(metric, option, widget); if (metric == PM_SubMenuOverlap && widget){ - const int widgetWidth = widget->width(); const QMenu *menu = qobject_cast(widget); if (menu && menu->activeAction() && menu->activeAction()->menu()) { const int menuWidth = menu->activeAction()->menu()->sizeHint().width(); @@ -2415,11 +2415,12 @@ QRect QS60Style::subControlRect(ComplexControl control, const QStyleOptionComple ret = QCommonStyle::subControlRect(control, option, scontrol, widget); switch (scontrol) { case SC_GroupBoxCheckBox: //fallthrough - case SC_GroupBoxLabel: + case SC_GroupBoxLabel: { //slightly indent text and boxes, so that dialog border does not mess with them. const int horizontalSpacing = QS60StylePrivate::pixelMetric(QStyle::PM_LayoutHorizontalSpacing); ret.adjust(2,horizontalSpacing-3,0,0); + } break; case SC_GroupBoxFrame: { const QRect textBox = subControlRect(control, option, SC_GroupBoxLabel, widget); @@ -2685,6 +2686,7 @@ void QS60Style::polish(QApplication *application) void QS60Style::unpolish(QApplication *application) { + Q_UNUSED(application) QPalette newPalette = qApp->style()->standardPalette(); application->setPalette(newPalette); QApplicationPrivate::setSystemPalette(originalPalette); @@ -2787,6 +2789,29 @@ QIcon QS60Style::standardIconImplementation(StandardPixmap standardIcon, QCommonStyle::standardIconImplementation(standardIcon, option, widget) : QIcon(cachedPixMap); } +extern QPoint qt_s60_fill_background_offset(const QWidget *targetWidget); + +bool qt_s60_fill_background(QPainter *painter, const QRegion &rgn, const QPoint &offset, + const QBrush &brush) +{ + const QPixmap backgroundTexture(QS60StylePrivate::backgroundTexture()); + if (backgroundTexture.cacheKey() != brush.texture().cacheKey()) + return false; + + const QPaintDevice *target = painter->device(); + if (target->devType() == QInternal::Widget) { + const QWidget *widget = static_cast(target); + const QRegion translated = rgn.translated(offset); + const QVector &rects = translated.rects(); + for (int i = 0; i < rects.size(); ++i) { + const QRect rect(rects.at(i)); + painter->drawPixmap(rect.topLeft(), backgroundTexture, + rect.translated(qt_s60_fill_background_offset(widget))); + } + } + return true; +} + QT_END_NAMESPACE #endif // QT_NO_STYLE_S60 || QT_PLUGIN diff --git a/src/gui/styles/qs60style_p.h b/src/gui/styles/qs60style_p.h index bedff58..22b01f6 100644 --- a/src/gui/styles/qs60style_p.h +++ b/src/gui/styles/qs60style_p.h @@ -388,7 +388,6 @@ public: static int focusRectPenWidth(); -#if defined(QT_S60STYLE_LAYOUTDATA_SIMULATED) static const layoutHeader m_layoutHeaders[]; static const short data[][MAX_PIXELMETRICS]; @@ -398,7 +397,6 @@ public: static short const *m_pmPointer; // number of layouts supported by the style static const int m_numberOfLayouts; -#endif // defined(QT_S60STYLE_LAYOUTDATA_SIMULATED) mutable QHash, QFont> m_mappedFontsCache; mutable QHash m_colorCache; diff --git a/src/gui/styles/qs60style_simulated.cpp b/src/gui/styles/qs60style_simulated.cpp index 3edc874..b6ad0ac 100644 --- a/src/gui/styles/qs60style_simulated.cpp +++ b/src/gui/styles/qs60style_simulated.cpp @@ -42,19 +42,6 @@ QS60StylePrivate::QS60StylePrivate() setCurrentLayout(0); } -QS60StylePrivate::~QS60StylePrivate() -{ -} - -short QS60StylePrivate::pixelMetric(int metric) -{ - Q_ASSERT(metric < MAX_PIXELMETRICS); - const short returnValue = m_pmPointer[metric]; - if (returnValue==-909) - return -1; - return returnValue; -} - QColor QS60StylePrivate::s60Color(QS60StyleEnums::ColorLists list, int index, const QStyleOption *option) { @@ -194,7 +181,7 @@ QVariant QS60StylePrivate::styleProperty_specific(const char *name) const QPixmap QS60StylePrivate::backgroundTexture() { if (!m_background) { - const QSize size = QApplication::activeWindow()?QApplication::activeWindow()->size():QSize(100, 100); + const QSize size = QApplication::desktop()->screen()->size(); QPixmap background = part(QS60StyleEnums::SP_QsnBgScreen, size); m_background = new QPixmap(background); } @@ -216,7 +203,6 @@ bool QS60StylePrivate::isToolBarBackground() return true; } - QFont QS60StylePrivate::s60Font_specific(QS60StyleEnums::FontCategories fontCategory, int pointSize) { QFont result; @@ -281,6 +267,13 @@ void QS60Style::setS60Theme(const QHash &parts, QS60StyleModeSpecifics::m_partPictures = parts; QS60StyleModeSpecifics::m_colors = colors; d->clearCaches(QS60StylePrivate::CC_ThemeChange); + d->setBackgroundTexture(qApp); +} + +QPoint qt_s60_fill_background_offset(const QWidget *targetWidget) +{ + Q_UNUSED(targetWidget) + return QPoint(); } QT_END_NAMESPACE diff --git a/src/gui/styles/qs60style_symbian.cpp b/src/gui/styles/qs60style_symbian.cpp index f860842..ddee4ba 100644 --- a/src/gui/styles/qs60style_symbian.cpp +++ b/src/gui/styles/qs60style_symbian.cpp @@ -593,30 +593,11 @@ bool QS60StylePrivate::isToolBarBackground() return (QSysInfo::s60Version() == QSysInfo::SV_S60_3_1 || QSysInfo::s60Version() == QSysInfo::SV_S60_3_2); } -void qt_s60_fill_background(QPainter *painter, const QRegion &rgn, const QPoint &offset, - const QBrush &brush) +QPoint qt_s60_fill_background_offset(const QWidget *targetWidget) { - const QPixmap backgroundTexture(QS60StylePrivate::backgroundTexture()); - if (backgroundTexture.cacheKey() == brush.texture().cacheKey()) { - const QPaintDevice *target = painter->device(); - if (target->devType() == QInternal::Widget) { - const QWidget *widget = static_cast(target); - CCoeControl *control = widget->effectiveWinId(); - TPoint globalPos = control ? control->PositionRelativeToScreen() : TPoint(0,0); - const QRegion translated = rgn.translated(offset); - const QVector &rects = translated.rects(); - for (int i = 0; i < rects.size(); ++i) { - const QRect rect(rects.at(i)); - painter->drawPixmap(rect.topLeft(), backgroundTexture, - rect.translated(globalPos.iX, globalPos.iY)); - } - } - } else { - const QRegion translated = rgn.translated(offset); - const QRect rect(translated.boundingRect()); - painter->setClipRegion(translated); - painter->drawTiledPixmap(rect, brush.texture(), rect.topLeft()); - } + CCoeControl *control = targetWidget->effectiveWinId(); + TPoint globalPos = control ? control->PositionRelativeToScreen() : TPoint(0,0); + return QPoint(globalPos.iX, globalPos.iY); } QPixmap QS60StyleModeSpecifics::createSkinnedGraphicsL( @@ -939,7 +920,6 @@ QFont QS60StylePrivate::s60Font_specific( return result; } -#ifdef QT_S60STYLE_LAYOUTDATA_SIMULATED void QS60StylePrivate::setActiveLayout() { const QSize activeScreenSize(screenSize()); @@ -979,19 +959,11 @@ void QS60StylePrivate::setActiveLayout() m_pmPointer = data[activeLayoutIndex]; } -#endif // QT_S60STYLE_LAYOUTDATA_SIMULATED QS60StylePrivate::QS60StylePrivate() { -#ifdef QT_S60STYLE_LAYOUTDATA_SIMULATED // No need to set active layout, if dynamic metrics API is available setActiveLayout(); -#endif // QT_S60STYLE_LAYOUTDATA_SIMULATED -} - -QS60StylePrivate::~QS60StylePrivate() -{ - deleteBackground(); } void QS60StylePrivate::setStyleProperty_specific(const char *name, const QVariant &value) @@ -1011,20 +983,6 @@ QVariant QS60StylePrivate::styleProperty_specific(const char *name) const return styleProperty(name); } -short QS60StylePrivate::pixelMetric(int metric) -{ -#ifdef QT_S60STYLE_LAYOUTDATA_SIMULATED - Q_ASSERT(metric < MAX_PIXELMETRICS); - const short returnValue = m_pmPointer[metric]; - if (returnValue==-909) - return -1; - return returnValue; -#else - //todo - call the pixelmetrics API directly - return 0; -#endif // QT_S60STYLE_LAYOUTDATA_SIMULATED -} - QColor QS60StylePrivate::s60Color(QS60StyleEnums::ColorLists list, int index, const QStyleOption *option) { @@ -1343,9 +1301,7 @@ void QS60Style::handleDynamicLayoutVariantSwitch() { Q_D(QS60Style); d->clearCaches(QS60StylePrivate::CC_LayoutChange); -#ifdef QT_S60STYLE_LAYOUTDATA_SIMULATED d->setActiveLayout(); -#endif // QT_S60STYLE_LAYOUTDATA_SIMULATED d->refreshUI(); d->setBackgroundTexture(qApp); foreach (QWidget *widget, QApplication::allWidgets()) diff --git a/src/gui/styles/styles.pri b/src/gui/styles/styles.pri index 9aa170e..b0e9f21 100644 --- a/src/gui/styles/styles.pri +++ b/src/gui/styles/styles.pri @@ -160,7 +160,6 @@ contains( styles, s60 ) { styles/qs60style.h \ styles/qs60style_p.h SOURCES += styles/qs60style.cpp - DEFINES += QT_S60STYLE_LAYOUTDATA_SIMULATED symbian { SOURCES += styles/qs60style_symbian.cpp # TODO: fix the following LIBS hack. Line 1 is for armv5, 2 for winscw -- cgit v0.12