summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMiikka Heikkinen <miikka.heikkinen@digia.com>2009-06-10 07:07:16 (GMT)
committerMiikka Heikkinen <miikka.heikkinen@digia.com>2009-06-10 07:07:16 (GMT)
commit0b5b2664d5ca6dfbe9c6a0170bbd2caaa47ccd3b (patch)
tree193a05bb6b8b08571e1eb89d44de91981cd80f7f
parent9108392448f4906bbd6916dcb0bc8117171c7804 (diff)
parentb97671a3b40623c1499c13c3d74c896ac6b9406f (diff)
downloadQt-0b5b2664d5ca6dfbe9c6a0170bbd2caaa47ccd3b.zip
Qt-0b5b2664d5ca6dfbe9c6a0170bbd2caaa47ccd3b.tar.gz
Qt-0b5b2664d5ca6dfbe9c6a0170bbd2caaa47ccd3b.tar.bz2
Merge branch 'master' of git@scm.dev.troll.no:qt/qt-s60-public
-rw-r--r--examples/network/ftp/ftp.pro4
-rw-r--r--examples/network/ftp/main.cpp23
-rw-r--r--src/corelib/global/qglobal.h5
-rw-r--r--src/gui/styles/qs60style.cpp70
-rw-r--r--src/gui/styles/qs60style_simulated.cpp4
-rw-r--r--src/gui/text/qfont.cpp1
-rw-r--r--src/s60installs/qt_libs.pro2
-rw-r--r--tests/auto/qplaintextedit/tst_qplaintextedit.cpp2
-rw-r--r--tests/auto/qvariant/tst_qvariant.cpp26
-rw-r--r--util/s60theme/s60theme.pro3
-rw-r--r--util/s60theme/s60themeconvert.cpp7
11 files changed, 90 insertions, 57 deletions
diff --git a/examples/network/ftp/ftp.pro b/examples/network/ftp/ftp.pro
index 90594f5..b958f6a 100644
--- a/examples/network/ftp/ftp.pro
+++ b/examples/network/ftp/ftp.pro
@@ -13,9 +13,7 @@ INSTALLS += target sources
include($$QT_SOURCE_TREE/examples/examplebase.pri)
symbian {
- #Enable this macro if you have latest Open C and you want to get rid of IAP queries
- #DEFINES += SETDEFAULTIF_AVAILABLE
TARGET.CAPABILITY="NetworkServices"
TARGET.UID3 = 0xA000A648
- contains( DEFINES, SETDEFAULTIF_AVAILABLE ):LIBS+=-lesock
+ LIBS+=-lesock # For IAP selection
} \ No newline at end of file
diff --git a/examples/network/ftp/main.cpp b/examples/network/ftp/main.cpp
index a472fd7..a92a8b2 100644
--- a/examples/network/ftp/main.cpp
+++ b/examples/network/ftp/main.cpp
@@ -40,13 +40,12 @@
****************************************************************************/
#include <QApplication>
+#include "ftpwindow.h"
+
#ifdef Q_OS_SYMBIAN
#include <QDir>
#include <QDesktopWidget>
-#endif
-#include "ftpwindow.h"
-#if defined Q_OS_SYMBIAN && defined SETDEFAULTIF_AVAILABLE
#include <es_sock.h>
#include <sys/socket.h>
#include <net/if.h>
@@ -66,13 +65,15 @@ static void setDefaultIapL()
_LIT(KIapNameSetting, "IAP\\Name");
TBuf8<50> iapName;
User::LeaveIfError(conn.GetDesSetting(TPtrC(KIapNameSetting), iapName));
+ iapName.ZeroTerminate();
+
+ conn.Stop();
+ CleanupStack::PopAndDestroy(&conn);
+ CleanupStack::PopAndDestroy(&serv);
- struct ifreq ifReq;
+ struct ifreq ifReq;
strcpy( ifReq.ifr_name, (char*)iapName.Ptr());
User::LeaveIfError(setdefaultif( &ifReq ));
-
- CleanupStack::PopAndDestroy(&conn);
- CleanupStack::PopAndDestroy(&serv);
}
static int setDefaultIap()
@@ -80,7 +81,6 @@ static int setDefaultIap()
TRAPD(err, setDefaultIapL());
return err;
}
-
#endif
int main(int argc, char *argv[])
@@ -88,9 +88,7 @@ int main(int argc, char *argv[])
Q_INIT_RESOURCE(ftp);
#ifdef Q_OS_SYMBIAN
-#ifdef SETDEFAULTIF_AVAILABLE
- setDefaultIap();
-#endif
+ setDefaultIap();
// Change current directory from default private to c:\data
// in order that user can access the downloaded content
QDir::setCurrent( "c:\\data" );
@@ -100,7 +98,8 @@ int main(int argc, char *argv[])
#ifdef Q_OS_SYMBIAN
// Make application better looking and more usable on small screen
ftpWin.showMaximized();
-#endif
+#else
ftpWin.show();
+#endif
return ftpWin.exec();
}
diff --git a/src/corelib/global/qglobal.h b/src/corelib/global/qglobal.h
index 27aaac1..b075db6 100644
--- a/src/corelib/global/qglobal.h
+++ b/src/corelib/global/qglobal.h
@@ -1055,8 +1055,13 @@ inline T qAbs(const T &t) { return t >= 0 ? t : -t; }
inline int qRound(qreal d)
{ return d >= 0.0 ? int(d + 0.5) : int(d - int(d-1) + 0.5) + int(d-1); }
+#if defined(QT_NO_FPU) || defined(QT_ARCH_ARM) || defined(QT_ARCH_WINDOWSCE) || defined(QT_ARCH_SYMBIAN)
+inline qint64 qRound64(double d)
+{ return d >= 0.0 ? qint64(d + 0.5) : qint64(d - qint64(d-1) + 0.5) + qint64(d-1); }
+#else
inline qint64 qRound64(qreal d)
{ return d >= 0.0 ? qint64(d + 0.5) : qint64(d - qint64(d-1) + 0.5) + qint64(d-1); }
+#endif
template <typename T>
inline const T &qMin(const T &a, const T &b) { if (a < b) return a; return b; }
diff --git a/src/gui/styles/qs60style.cpp b/src/gui/styles/qs60style.cpp
index 6d24d54..180937f 100644
--- a/src/gui/styles/qs60style.cpp
+++ b/src/gui/styles/qs60style.cpp
@@ -318,8 +318,8 @@ QVariant QS60StylePrivate::styleProperty(const char *name) const
if (name == propertyKeyLayouts) {
static QStringList layouts;
if (layouts.isEmpty())
- for (int i = 0; i < QS60StylePrivate::m_numberOfLayouts; i++)
- layouts.append(QS60StylePrivate::m_layoutHeaders[i].layoutName);
+ for (int i = 0; i < m_numberOfLayouts; i++)
+ layouts.append(m_layoutHeaders[i].layoutName);
return layouts;
}
return QVariant();
@@ -388,7 +388,7 @@ QFont QS60StylePrivate::s60Font(
return result;
}
-void QS60StylePrivate::clearCaches(QS60StylePrivate::CacheClearReason reason)
+void QS60StylePrivate::clearCaches(CacheClearReason reason)
{
switch(reason){
case CC_LayoutChange:
@@ -416,12 +416,12 @@ void QS60StylePrivate::clearCaches(QS60StylePrivate::CacheClearReason reason)
// for QPalette::Button and QPalette::ToolTipBase. Therefore S60Style needs to guesstimate
// palette colors by calculating average rgb values for button pixels.
// Returns Qt::black if there is an issue with the graphics (image is NULL, or no bits() found).
-QColor QS60StylePrivate::colorFromFrameGraphics(QS60StylePrivate::SkinFrameElements frame) const
+QColor QS60StylePrivate::colorFromFrameGraphics(SkinFrameElements frame) const
{
const bool cachedColorExists = m_colorCache.contains(frame);
if (!cachedColorExists) {
- const int frameCornerWidth = QS60StylePrivate::pixelMetric(PM_Custom_FrameCornerWidth);
- const int frameCornerHeight = QS60StylePrivate::pixelMetric(PM_Custom_FrameCornerHeight);
+ const int frameCornerWidth = pixelMetric(PM_Custom_FrameCornerWidth);
+ const int frameCornerHeight = pixelMetric(PM_Custom_FrameCornerHeight);
Q_ASSERT(2*frameCornerWidth<32);
Q_ASSERT(2*frameCornerHeight<32);
@@ -495,15 +495,15 @@ void QS60StylePrivate::setBackgroundTexture(QApplication *app) const
{
Q_UNUSED(app)
QPalette applicationPalette = QApplication::palette();
- applicationPalette.setBrush(QPalette::Window, QS60StylePrivate::backgroundTexture());
+ applicationPalette.setBrush(QPalette::Window, backgroundTexture());
QApplication::setPalette(applicationPalette);
}
void QS60StylePrivate::deleteBackground()
{
- if (QS60StylePrivate::m_background) {
- delete QS60StylePrivate::m_background;
- QS60StylePrivate::m_background = 0;
+ if (m_background) {
+ delete m_background;
+ m_background = 0;
}
}
@@ -670,7 +670,7 @@ void QS60StylePrivate::setThemePalette(QWidget *widget) const
//draw transparent theme graphics to table column and row headers.
if (qobject_cast<QHeaderView *>(widget)){
widgetPalette.setColor(QPalette::Active, QPalette::ButtonText,
- QS60StylePrivate::s60Color(QS60StyleEnums::CL_QsnTextColors, 23, 0));
+ s60Color(QS60StyleEnums::CL_QsnTextColors, 23, 0));
QHeaderView* header = qobject_cast<QHeaderView *>(widget);
widgetPalette.setColor(QPalette::Button, Qt::transparent );
if ( header->viewport() )
@@ -686,30 +686,30 @@ void QS60StylePrivate::setThemePalette(QPalette *palette) const
// basic colors
palette->setColor(QPalette::WindowText,
- QS60StylePrivate::s60Color(QS60StyleEnums::CL_QsnTextColors, 6, 0));
+ s60Color(QS60StyleEnums::CL_QsnTextColors, 6, 0));
palette->setColor(QPalette::ButtonText,
- QS60StylePrivate::s60Color(QS60StyleEnums::CL_QsnTextColors, 6, 0));
+ s60Color(QS60StyleEnums::CL_QsnTextColors, 6, 0));
palette->setColor(QPalette::Text,
- QS60StylePrivate::s60Color(QS60StyleEnums::CL_QsnTextColors, 6, 0));
+ s60Color(QS60StyleEnums::CL_QsnTextColors, 6, 0));
palette->setColor(QPalette::ToolTipText,
- QS60StylePrivate::s60Color(QS60StyleEnums::CL_QsnTextColors, 55, 0));
+ s60Color(QS60StyleEnums::CL_QsnTextColors, 55, 0));
palette->setColor(QPalette::BrightText, palette->color(QPalette::WindowText).lighter());
palette->setColor(QPalette::HighlightedText,
- QS60StylePrivate::s60Color(QS60StyleEnums::CL_QsnTextColors, 10, 0));
+ s60Color(QS60StyleEnums::CL_QsnTextColors, 10, 0));
palette->setColor(QPalette::Link,
- QS60StylePrivate::s60Color(QS60StyleEnums::CL_QsnHighlightColors, 3, 0));
+ s60Color(QS60StyleEnums::CL_QsnHighlightColors, 3, 0));
palette->setColor(QPalette::LinkVisited, palette->color(QPalette::Link).darker());
palette->setColor(QPalette::Highlight,
- QS60StylePrivate::s60Color(QS60StyleEnums::CL_QsnHighlightColors, 2, 0));
+ s60Color(QS60StyleEnums::CL_QsnHighlightColors, 2, 0));
// set background image as a texture brush
- palette->setBrush(QPalette::Window, QS60StylePrivate::backgroundTexture());
+ palette->setBrush(QPalette::Window, backgroundTexture());
// set these as transparent so that styled full screen theme background is visible
palette->setColor(QPalette::AlternateBase, Qt::transparent);
palette->setBrush(QPalette::Base, Qt::transparent);
// set button and tooltipbase based on pixel colors
- const QColor buttonColor = this->colorFromFrameGraphics(QS60StylePrivate::SF_ButtonNormal);
+ const QColor buttonColor = this->colorFromFrameGraphics(SF_ButtonNormal);
palette->setColor(QPalette::Button, buttonColor );
- const QColor toolTipColor = this->colorFromFrameGraphics(QS60StylePrivate::SF_ToolTip);
+ const QColor toolTipColor = this->colorFromFrameGraphics(SF_ToolTip);
palette->setColor(QPalette::ToolTipBase, toolTipColor );
palette->setColor(QPalette::Light, palette->color(QPalette::Button).lighter());
palette->setColor(QPalette::Dark, palette->color(QPalette::Button).darker());
@@ -718,7 +718,7 @@ void QS60StylePrivate::setThemePalette(QPalette *palette) const
palette->setColor(QPalette::Shadow, Qt::black);
setThemePaletteHash(palette);
- QS60StylePrivate::storeThemePalette(palette);
+ storeThemePalette(palette);
}
void QS60StylePrivate::deleteThemePalette()
@@ -745,10 +745,10 @@ void QS60StylePrivate::setThemePaletteHash(QPalette *palette) const
//store the original palette
QPalette widgetPalette = *palette;
const QColor mainAreaTextColor =
- QS60StylePrivate::s60Color(QS60StyleEnums::CL_QsnTextColors, 6, 0);
+ s60Color(QS60StyleEnums::CL_QsnTextColors, 6, 0);
widgetPalette.setColor(QPalette::All, QPalette::WindowText,
- QS60StylePrivate::s60Color(QS60StyleEnums::CL_QsnLineColors, 8, 0));
+ s60Color(QS60StyleEnums::CL_QsnLineColors, 8, 0));
QApplication::setPalette(widgetPalette, "QSlider");
// return to original palette after each widget
widgetPalette = *palette;
@@ -757,7 +757,7 @@ void QS60StylePrivate::setThemePaletteHash(QPalette *palette) const
widgetPalette.setColor(QPalette::Inactive, QPalette::ButtonText, mainAreaTextColor);
const QStyleOption opt;
widgetPalette.setColor(QPalette::Disabled, QPalette::ButtonText,
- QS60StylePrivate::s60Color(QS60StyleEnums::CL_QsnTextColors, 6, &opt));
+ s60Color(QS60StyleEnums::CL_QsnTextColors, 6, &opt));
QApplication::setPalette(widgetPalette, "QPushButton");
widgetPalette = *palette;
@@ -767,27 +767,27 @@ void QS60StylePrivate::setThemePaletteHash(QPalette *palette) const
widgetPalette = *palette;
widgetPalette.setColor(QPalette::Active, QPalette::ButtonText,
- QS60StylePrivate::s60Color(QS60StyleEnums::CL_QsnTextColors, 23, 0));
+ s60Color(QS60StyleEnums::CL_QsnTextColors, 23, 0));
QApplication::setPalette(widgetPalette, "QHeaderView");
widgetPalette = *palette;
widgetPalette.setColor(QPalette::All, QPalette::ButtonText,
- QS60StylePrivate::s60Color(QS60StyleEnums::CL_QsnTextColors, 8, 0));
+ s60Color(QS60StyleEnums::CL_QsnTextColors, 8, 0));
QApplication::setPalette(widgetPalette, "QMenuBar");
widgetPalette = *palette;
widgetPalette.setColor(QPalette::Active, QPalette::WindowText,
- QS60StylePrivate::s60Color(QS60StyleEnums::CL_QsnTextColors, 4, 0));
+ s60Color(QS60StyleEnums::CL_QsnTextColors, 4, 0));
QApplication::setPalette(widgetPalette, "QTabBar");
widgetPalette = *palette;
widgetPalette.setColor(QPalette::All, QPalette::Text,
- QS60StylePrivate::s60Color(QS60StyleEnums::CL_QsnTextColors, 22, 0));
+ s60Color(QS60StyleEnums::CL_QsnTextColors, 22, 0));
QApplication::setPalette(widgetPalette, "QTableView");
widgetPalette = *palette;
widgetPalette.setColor(QPalette::All, QPalette::HighlightedText,
- QS60StylePrivate::s60Color(QS60StyleEnums::CL_QsnTextColors, 24, 0));
+ s60Color(QS60StyleEnums::CL_QsnTextColors, 24, 0));
QApplication::setPalette(widgetPalette, "QLineEdit");
widgetPalette = *palette;
@@ -861,7 +861,7 @@ QSize QS60StylePrivate::partSize(QS60StyleEnums::SkinParts part, SkinElementFlag
}
break;
}
- if (flags & (QS60StylePrivate::SF_PointEast | QS60StylePrivate::SF_PointWest)) {
+ if (flags & (SF_PointEast | SF_PointWest)) {
const int temp = result.width();
result.setWidth(result.height());
result.setHeight(temp);
@@ -1880,11 +1880,11 @@ void QS60Style::drawControl(ControlElement element, const QStyleOption *option,
}
break;
#endif //QT_NO_TOOLBAR
- case CE_ShapedFrame: {
- const QTextEdit *txt = qobject_cast<const QTextEdit *>(widget);
- if (txt)
+ case CE_ShapedFrame:
+ if (qobject_cast<const QTextEdit *>(widget))
QS60StylePrivate::drawSkinElement(QS60StylePrivate::SE_Editor, painter, option->rect, flags);
- }
+ if (option->state & State_HasFocus)
+ drawPrimitive(PE_FrameFocusRect, option, painter, widget);
break;
default:
QCommonStyle::drawControl(element, option, painter, widget);
diff --git a/src/gui/styles/qs60style_simulated.cpp b/src/gui/styles/qs60style_simulated.cpp
index a94d73e..7667f92 100644
--- a/src/gui/styles/qs60style_simulated.cpp
+++ b/src/gui/styles/qs60style_simulated.cpp
@@ -359,7 +359,9 @@ QS60Style::QS60Style()
: QCommonStyle(*new QS60StylePrivate)
{
// Assume, that the resource system has a ':/s60Stylethemes/Default.blob'
- loadS60ThemeFromBlob(QString::fromLatin1(":/s60Stylethemes/Default.blob"));
+ const QString defaultBlob = QString::fromLatin1(":/s60Stylethemes/Default.blob");
+ if (QFile::exists(defaultBlob))
+ loadS60ThemeFromBlob(defaultBlob);
}
Q_GLOBAL_STATIC_WITH_INITIALIZER(QStringList, enumPartKeys, {
diff --git a/src/gui/text/qfont.cpp b/src/gui/text/qfont.cpp
index 930e8af..dd50d12 100644
--- a/src/gui/text/qfont.cpp
+++ b/src/gui/text/qfont.cpp
@@ -796,7 +796,6 @@ QFont::QFont(const QString &family, int pointSize, int weight, bool italic)
if (pointSize <= 0) {
#ifdef Q_WS_S60
- // TODO: What should the default QFont pointSize for Q_WS_S60 be?
pointSize = 7;
#else
pointSize = 12;
diff --git a/src/s60installs/qt_libs.pro b/src/s60installs/qt_libs.pro
index 9aadfc0..e9da90d 100644
--- a/src/s60installs/qt_libs.pro
+++ b/src/s60installs/qt_libs.pro
@@ -41,7 +41,7 @@ symbian: {
contains(QT_CONFIG, openssl) | contains(QT_CONFIG, openssl-linked) {
qtlibraries.depends += "(0x200110CB), 1, 5, 1, {\"Open C LIBSSL Common\"}"
}
- contains(QT_CONFIG, stl) {
+ contains(CONFIG, stl) {
qtlibraries.depends += "(0x2000F866), 1, 0, 0, {\"Standard C++ Library Common\"}"
}
diff --git a/tests/auto/qplaintextedit/tst_qplaintextedit.cpp b/tests/auto/qplaintextedit/tst_qplaintextedit.cpp
index 6835c21..456ab7b 100644
--- a/tests/auto/qplaintextedit/tst_qplaintextedit.cpp
+++ b/tests/auto/qplaintextedit/tst_qplaintextedit.cpp
@@ -221,7 +221,7 @@ void tst_QPlainTextEdit::getSetCheck()
QCOMPARE(0, obj1.tabStopWidth());
obj1.setTabStopWidth(INT_MIN);
QCOMPARE(0, obj1.tabStopWidth()); // Makes no sense to set a negative tabstop value
-#if defined(QT_ARCH_WINDOWSCE)
+#if defined(QT_ARCH_WINDOWSCE) || defined (QT_ARCH_SYMBIAN)
// due to rounding error in qRound when qreal==float
// we cannot use INT_MAX for this check
obj1.setTabStopWidth(SHRT_MAX*2);
diff --git a/tests/auto/qvariant/tst_qvariant.cpp b/tests/auto/qvariant/tst_qvariant.cpp
index d15f9c8..9c9ff33 100644
--- a/tests/auto/qvariant/tst_qvariant.cpp
+++ b/tests/auto/qvariant/tst_qvariant.cpp
@@ -255,6 +255,7 @@ private slots:
void convertByteArrayToBool() const;
void convertByteArrayToBool_data() const;
void toIntFromQString() const;
+ void toIntFromDouble() const;
};
Q_DECLARE_METATYPE(QDate)
@@ -2909,5 +2910,30 @@ void tst_QVariant::toIntFromQString() const
QVERIFY(ok);
}
+/*!
+ We verify that:
+ 1. Conversion from (64 bit) double to int works (no overflow).
+ 2. Same conversion works for QVariant::convert.
+
+ Rationale: if 2147483630 is set in float and then converted to int,
+ there will be overflow and the result will be -2147483648.
+
+ See task 250267.
+ */
+void tst_QVariant::toIntFromDouble() const
+{
+ double d = 2147483630; // max int 2147483647
+ QVERIFY((int)d == 2147483630);
+
+ QVariant var(d);
+ QVERIFY( var.canConvert( QVariant::Int ) );
+
+ bool ok;
+ int result = var.toInt(&ok);
+
+ QVERIFY( ok == true );
+ QCOMPARE(result, 2147483630);
+}
+
QTEST_MAIN(tst_QVariant)
#include "tst_qvariant.moc"
diff --git a/util/s60theme/s60theme.pro b/util/s60theme/s60theme.pro
index 02c2449..83c0cf2 100644
--- a/util/s60theme/s60theme.pro
+++ b/util/s60theme/s60theme.pro
@@ -7,3 +7,6 @@ HEADERS += \
QT += \
webkit
+
+CONFIG += \
+ console
diff --git a/util/s60theme/s60themeconvert.cpp b/util/s60theme/s60themeconvert.cpp
index 4fe2980..a1e1d58 100644
--- a/util/s60theme/s60themeconvert.cpp
+++ b/util/s60theme/s60themeconvert.cpp
@@ -206,7 +206,7 @@ bool loadThemeFromTdf(const QString &tdfFile,
const QString tdfFullName =
tdfBasePath + QDir::separator() + parsedPartSvgs.value(partKey);
if (!QFile(tdfFullName).exists())
- qWarning() << "Could not load part " << tdfFullName;
+ qWarning() << "Could not find part:" << parsedPartSvgs.value(partKey);
const QPicture partPicture = renderer.svgToQPicture(tdfFullName);
parsedPartPictures.insert(partKey, partPicture);
}
@@ -273,9 +273,10 @@ bool loadDefaultTheme(const QString &themePath,
WebKitSVGRenderer renderer;
foreach (const QString &partKey, QS60Style::partKeys()) {
- const QString partFile(dir.absolutePath() + QDir::separator() + partKey + QLatin1String(".svg"));
+ const QString partFileName = partKey + QLatin1String(".svg");
+ const QString partFile(dir.absolutePath() + QDir::separator() + partFileName);
if (!QFile::exists(partFile)) {
- qWarning() << "Could not load part " << partFile;
+ qWarning() << "Could not find part:" << partFileName;
continue;
}
const QPicture partPicture = renderer.svgToQPicture(partFile);