Commit Graph

1074 Commits

Author SHA1 Message Date
Stephen Kelly
4319f698c8 Remove metatype registration of built-in types.
As they are built-in, they are effectively registered at compile-time
already.

Change-Id: I7ae6ba16088eab5d19213fa7b07c2a7760988a86
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@digia.com>
2013-01-03 16:15:37 +01:00
hjk
03a666760c Speed up and fix QByteArray::setNum()
Going through QLocale and QString is not really needed.

This also makes the result of the conversion of negative numbers
in bases other than 10 independent of the architecture and
implements the documented behavior of treating them as
unsigned types.

Change-Id: Ibc231dc5241deb5cbadd9796484a8b5f79c29410
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
2012-12-30 10:44:44 +01:00
hjk
4eac2c4728 Add test for QByteArray::setNum
Change-Id: I66f3954433bf50fb23fdaeef804838d993e965b5
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
2012-12-28 15:09:19 +01:00
Thiago Macieira
3adbcb58d5 Fix QMutex::tryLock with negative values
The Linux futex implementation had a Q_ASSERT for positive values, but
the documentation says that negative values should be interpreted as
infinite (equal to lock()).

Test that too.

Change-Id: I2f96a502d672732781e88e49797756ca9a809121
Reviewed-by: David Faure (KDE) <faure@kde.org>
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
2012-12-23 20:34:46 +01:00
David Faure
8b2728ec38 QUrl::fromUserInput: fix for urls without a host.
QUrl::fromUserInput("http://") was invalid, which doesn't make sense
since QUrl("http://") is valid. Same for "smb:" which is actually
even more a valid URL from a user's point of view.

Change-Id: I371ac393d61b49499edf5adbbc2a90b426fe9e5d
Reviewed-by: Marco Martin <mart@kde.org>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2012-12-23 10:50:28 +01:00
Thiago Macieira
e1a1e80d46 Make sure that the strict parser is also operating on setXxx
These cases weren't handled before.

The validateComponent function is copied from QUrlPrivate::parse, with
the added modification that it now needs to check the gen-delims for
the userinfo.

Change-Id: I055167b977199fa86b56a3a7259a7445585129c6
Reviewed-by: David Faure (KDE) <faure@kde.org>
2012-12-21 20:54:51 +01:00
Oswald Buddenhagen
586adeabe4 add and use qtHaveModule() function
this is much more elegant than the so far propagated !isEmpty(QT.foo.name).
also replace feature-specific tests (no-gui and no-widgets) and the
obsolete contains(QT_CONFIG, foo) syntax.

Change-Id: Ia4b3c8febcabf9eeca67b1f9173a523820b1038b
Reviewed-by: Sergio Ahumada <sergio.ahumada@digia.com>
Reviewed-by: Tasuku Suzuki <stasuku@gmail.com>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
2012-12-21 19:05:02 +01:00
Peter Hartmann
fbdea2c993 QUrl auto tests: make sure setAuthority is consistent with setHost
... with respect to empty and null strings.

Change-Id: Ic107d5bcc8b659497a567b75a7244caceba5a715
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2012-12-20 16:48:36 +01:00
Peter Hartmann
cc79ed5c6a QUrl auto tests: ensure toEncoded() and toString() match wrt. empty auth
Task-number: QTBUG-8701

Change-Id: I55780a910a0d0996488475f5ce49a240f6223df0
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2012-12-20 01:42:05 +01:00
Sergio Ahumada
5efcd5a6c3 Change ftp.qt.nokia.com -> ftp.qt-project.org
Task-number: QTBUG-28156
Change-Id: I0060144f0336791933205355b125251ccba73b3e
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2012-12-18 23:13:35 +01:00
Giuseppe D'Angelo
cc89509f83 Delete the QSlotObject when disconnect()ing
When disconnect()ing through a QMetaObject::Connection,  if the
QObjectPrivate::Connection contains a slot object, deref it, so
that it will be destroyed before the next run of cleanConnectionList.

Previously, a copy of the functor passed to connect() was kept until
QObjectPrivate::cleanConnectionLists was called (by adding a new signal,
or the sender was destroyed), even after a successful call to
disconnect(). That is, we were keeping that copy allocated without
any good reason.

Change-Id: Ie6074ea797df1611cb995dec07c5b5a742360833
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
2012-12-17 19:50:33 +01:00
Giuseppe D'Angelo
c4f433d581 Reset the QMetaObject::Connection dptr when disconnect()ing
The QObjectPrivate::Connection refcount was not decreased
when disconnect()ing, therefore it was kept alive by the
owning QMetaObject::Connection object.

This removes a leak in case the QMetaObject::Connection
survives the sender object, after a successful disconnect().

Change-Id: Ie2ea59b269a0e589ae23c1457df7533be77c0797
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
2012-12-17 19:50:31 +01:00
Giuseppe D'Angelo
058c029b1e Remove useless QVERIFY(true)
More QVERIFY()s were added in the meanwhile to the test function,
so we can drop this one.

Change-Id: If6f137f45ba606b61d6a7004556a667ed316b61f
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
2012-12-17 19:50:27 +01:00
Oswald Buddenhagen
09331062bb remove some unnecessary CONFIG additions
qt is already added by spec_pre.prf, warn_on and depend_includepath by
default_pre.prf.

Change-Id: Ic00e0ba496d698ed9659c476f2ca99fc0f86a093
Reviewed-by: Joerg Bornemann <joerg.bornemann@digia.com>
2012-12-17 14:08:17 +01:00
Peter Kümmel
a42ad77ec9 Fix possible crash in tst_QThread::quitLock() test
Don't read member variable of deleted Job object.

Change-Id: I71a6565c4932427e9cbab744c2e472b62ea98ca2
Reviewed-by: Andreas Aardal Hanssen <andreas@hanssen.name>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2012-12-17 14:08:17 +01:00
Friedemann Kleint
0e4c41b7a3 Remove MSVC2012-optimization for the QMetaType-test.
As otherwise compilation takes hours.

Task-number: QTBUG-28611
Change-Id: I0ad73bf6ea4d7d4594e902c101bf52969daca341
Reviewed-by: Oliver Wolff <oliver.wolff@digia.com>
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@digia.com>
2012-12-14 15:06:22 +01:00
Denis Dzyubenko
6b5b5d4e53 Added missing detach() to QJsonObject::take()
We also need to detach() the taken value in case the compaction triggers and
modifies the underlaying data.

Change-Id: Idcdeba4236b8e208d107d41be2decbdfc5721300
Reviewed-by: Bjørn Erik Nilsen <post@bjoernen.com>
Reviewed-by: Denis Dzyubenko <denis@ddenis.info>
2012-12-13 23:58:51 +01:00
Stephen Kelly
5809485dbe Move a Q_DECLARE_METATYPE higher up in the file.
Having it low in the file causes ODR violations.

Change-Id: I6267c7c1b043e77b251a88cb8940a9f063160891
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
2012-12-10 20:22:09 +01:00
Peter Kümmel
24013d8a87 Don't pass invalid strings to strcmp()
The address behind a string doesn't point to a string.

Change-Id: Ic54f652ae781fea278f60cc49d219c1c610ba29f
Reviewed-by: Paul Olav Tvete <paul.tvete@digia.com>
2012-12-06 16:45:52 +01:00
David Faure
418890e074 QPluginLoader: fix loading of plugins with a relative file name
This makes QT_PLUGIN_PATH / QCoreApplication::libraryPaths() actually work,
as a search path for plugins, when apps look for a specific plugin by name.

To make it possible to write portable code (unlike the current QPluginLoader
unittest), let QPluginLoader figure out the extension, too.

Change-Id: I895d597d7cb05ded268734bc5f313f32d8d12cb9
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
2012-12-04 18:38:41 +01:00
Stephen Kelly
348c5bd19a Fix some typos in QProcess and QSslSocket unit tests.
The QSslSocket one is both wrong and redundant as there is a
Q_DECLARE_METATYPE for it already.

Change-Id: I63d065abfb3d0e3d82a8b1f29a6752b7676db847
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@digia.com>
2012-12-04 14:41:43 +01:00
Oswald Buddenhagen
4873c4151e remove pointless QT.<module>.sources references
there is no point to use this for in-module references.
cleaning it out in an attempt to purge the constants entirely.

Change-Id: I1da4d70e3778257dd43eda0bdfc71eaec1124732
Reviewed-by: Joerg Bornemann <joerg.bornemann@digia.com>
2012-12-04 13:58:29 +01:00
Sergio Ahumada
0df026de86 Stop using the name "Trolltech" in QSettings
Also change Trolltech for QtProject in other places

Task-number: QTBUG-23269
Change-Id: Ie4e344f23cab77c575562d18b481b3369ce30491
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
2012-12-03 03:47:08 +01:00
Peter Kümmel
1211b956de Fix wrong string length
Change-Id: Ic10aed6fc59d2518583caf78848711bdc97b4665
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2012-12-01 17:16:54 +01:00
Friedemann Kleint
43ee10518a Improve auto-test of QFile.
Execute the test in a temporary directory, purge remaining files
except the special readonly-files in cleanup().
Avoid repeated invocation of QFINDTESTDATA() by assigning to
member variables.
Do more checks in rename(), check on contents of file.
Generally, use more QVERIFY2, print error messages.

Task-number: QTBUG-3570
Change-Id: Ibd0e11a361208a716ea3efbcca76adeda70e061a
Reviewed-by: David Faure (KDE) <faure@kde.org>
2012-12-01 13:51:52 +01:00
Olivier Goffart
d8e6be1603 Fix connecting to a functor with 3 arguments
Task-number: QTBUG-28285

Change-Id: I07bd870c093482035728aa783d0ecbc8aa8670d2
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2012-11-30 01:23:48 +01:00
J-P Nurmi
12702d2b12 tst_QSharedPointer: update application types
QCoreApplication::Type enum was removed in 553e21. This change updates
the (un)tested application types to match the application types
available in Qt 5.

Change-Id: I8631987a9ff31dc81baa013619cfc18616b851d1
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
2012-11-26 14:16:44 +01:00
Konstantin Ritt
9b85b81bc8 QLocale: Fix matchingLocales() behavior if script or country is not Any*
Since the documentation doesn't mention the search should be done by language only,
consider the current behavior incorrect.
As of now, it is possible to get a list of locales by Country or Script as well.

Also fix countriesForLanguage() to be in-sync with matchingLocales().

Change-Id: I6a09ca459120143565fa6099d2b823df1fed7c25
Reviewed-by: Denis Dzyubenko <denis@ddenis.info>
2012-11-25 04:06:51 +01:00
Jędrzej Nowacki
cf1e315e28 Fix QVariant streaming in Qt3 compatibility mode.
Task-number: QTBUG-27700
Change-Id: I0408293e43c3330dbc4746198a19709e795f552a
Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com>
2012-11-24 14:55:30 +01:00
Konstantin Ritt
3c0ac52081 QLocale: Fix toCurrencyString() didn't respect group separator option
Change-Id: Icda43d71d600d77fe1ed4fcde1ef4478ef29c1d5
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Reviewed-by: Denis Dzyubenko <denis@ddenis.info>
2012-11-23 22:58:59 +01:00
Mitch Curtis
a87ce448ed Prevent "number of sections exceeded" when compiling qmetatype tests.
When compiling qmetatype auto tests with msvc2008 64-bit, I receive:

qmetatype.h(383) : fatal error C1128: number of sections exceeded
object file format limit : compile with /bigobj

This patch follows that advice and adds /bigobj to QMAKE_CXXFLAGS.

Change-Id: I05b3cf9dfdb6a93649c692e2df22365d200e6f2f
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@digia.com>
2012-11-23 17:04:00 +01:00
Friedemann Kleint
1022c3ce9d Do not detect directories ending in ".lnk" as link files.
Task-number: QTBUG-21863

Change-Id: I70b661fa5fcaba1293a80c971c506798826f5b23
Reviewed-by: Joerg Bornemann <joerg.bornemann@digia.com>
2012-11-23 17:04:00 +01:00
Konstantin Ritt
2fbb69a093 QTBF: Fix issue with no splitting the words at "." (FULL STOP)
As of Unicode 5.1, some punctuation marks were mapped to MidLetter and MidNumLet
for better URL and abbreviations handling which caused "hi.there" to be treated
like if it were just a single word;
until we have the Unicode Text Segmentation tailoring mechanism, retain
the old behavior by remapping (some of) those characters back to their old values.

Change-Id: I49dea6064f2ea40a82fc0b1bc3c4f0b4e803919f
Reviewed-by: David Faure <david.faure@kdab.com>
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
2012-11-23 11:59:50 +01:00
Christian Strømme
3f936e9094 Fixes problem with single precision floats in QDataStream (Windows).
When the floating-point behavior in MSVC is set to "precise" (default),
assigning nan numbers to a float causes the bit pattern to be altered
(only affects 32bit builds). We should therefore not assign the swapped
value back to a float and use it.

Task-number: QTBUG-25950

Change-Id: I7b6cc4d546e5c8aeafdede749056358b7d639ec7
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@digia.com>
2012-11-23 02:32:19 +01:00
Marc Mutz
aba0e53db9 tst_QMetaProperty doesn't need QtGui
Change-Id: Id286827f692b7c49436ae8247f49eff993a47bdc
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
2012-11-22 14:54:31 +01:00
David Faure
8a83c1bb55 Add QMimeType::aliases().
Requested by Allan Sandfeld Jensen for QWebkit, which needs to register
upfront all the mimetypes that a given plugin can handle.

Change-Id: I64b8d39c7988adfc7db4ed8bfdc73acd16e999da
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@digia.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2012-11-22 00:11:21 +01:00
Konstantin Ritt
3791d21f72 Update Qlocale data up to CLDR 22.1
Change-Id: Ie6ddfec14cb052e0b89230dc93290ff79488fb25
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
2012-11-21 18:23:59 +01:00
Konstantin Ritt
4a115ab4ae Update Qlocale data up to CLDR 2.0.1
Change-Id: I4279fac57436d7009a6d61dab5936b72fd39fc14
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
2012-11-21 18:23:59 +01:00
Konstantin Ritt
fe8962d3a5 Use likelySubtags to instantiate a locale id from it's short form
...just like described in http://www.unicode.org/reports/tr35/#Likely_Subtags.
This is much more effective than current "guessing" algorithm
+ makes it possible to instantiate a locale by the script or territory code only.

Change-Id: I674f8476e65b01c56960b6e83a1a346df0715274
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
2012-11-21 18:23:59 +01:00
Konstantin Ritt
e7c79face6 [SIC/BIC] QLocale: update enums up to CLRD 1.9.1
This patch adds some missing codes (two-letter ones only),
removes an outdated ones, and updates some names.
The legacy language codes are handled in QLocalePrivate::codeToLanguage()
(fortunately, there are only 4 of such codes).

Change-Id: Iff50aecd1c762b6399cd151aebb955f341d366c6
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
2012-11-21 18:23:59 +01:00
Bernd Weimer
146f63bea4 BlackBerry: Changed QSettings file access
On the BlackBerry platform, applications run in a sandbox. They are
not allowed to read or write outside of this sandbox. Hence in
QSettings there is no use for the system scope and differentiating
between organization and application. This change will also improve
performance.

Change-Id: I79fee0140595385f3d33bd89fe5daa36b04836bc
Reviewed-by: Thomas McGuire <thomas.mcguire@kdab.com>
Reviewed-by: Fabian Bumberger <fbumberger@rim.com>
Reviewed-by: Alan Alpert (RIM) <aalpert@rim.com>
2012-11-21 16:36:50 +01:00
Jonathan Liu
96361d82c9 Fix MinGW compilation for tst_qwinoverlappedionotifier
Change-Id: I664761e7e6fd1c00067ae1def496ba4974e539be
Reviewed-by: Janne Anttila <janne.anttila@digia.com>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
2012-11-21 14:08:12 +01:00
Jan Arve Saether
035d93a6e1 Fix regression in QXmlStreamWriter with codec set to UTF-16
Actually, this broke using QXmlStreamWriter with any codec
where characters in the ASCII range have a different encoding
than the ASCII standard.

This was a regression from 558fe9383ba0aecbec09cc411c0ebab132aac137

Task-number: QTBUG-23310

Change-Id: I75bd013e9d5de53da564a76c2f06e95ff35303a8
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
2012-11-20 18:53:49 +01:00
Konstantin Ritt
da90a3a490 QLocale: replace hard-coded default country-for-language map
...with a generated one in a way similar to what
http://www.unicode.org/reports/tr35/#Likely_Subtags suggests.
The supplemental/likelySubtags.xml contains all the required data.
This changes some default countries to a most-expected ones.

Change-Id: I920a5623601d8661a943e78197d3bcc838191483
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
2012-11-19 21:18:03 +01:00
Giuseppe D'Angelo
8cb319939a Fix QStringList::sort test
Checking that the result of sort() is a specific list is wrong,
as sort() can put equivalent elements in an arbitrary order.

Change-Id: Ib06399cdecedb6cf01e721d4d92048449d66b40d
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2012-11-16 06:38:01 +01:00
Olivier Goffart
2b308d4cb5 Fix QMutex::tryLock timeout computation on Linux
The timeout is in millisecond. So we just need to divide by 1000 to get
the number of seconds

Regression introduced in f587e8f4fd
Reported in the comments of QTBUG-24795

Change-Id: Id16e05e7d04d33605860926f7516d14cdefd6a36
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2012-11-16 01:37:01 +01:00
David Faure
7721c3d27c QMimeDatabase: Fix handling of duplicate mimetype definitions.
When both freedesktop.org.xml and kde.xml define text/x-qml (*.qml),
the XML provider would look up *.qml, see two mimetypes, and treat that
as a glob conflict, and proceed with contents-based-determination,
which for this sample file, would find "C source" due to the C comment.

Fixed by ignoring duplicate pattern-mimetype associations.

The binary-cache provider doesn't have this problem, update-mime-database
already filters out duplicates when generating the on-disk extension tree.

Change-Id: Ie335b0b419e7413fa0550779709513f68c2bfc68
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2012-11-14 14:18:31 +01:00
Andreas Aardal Hanssen
f3597af5ad Fix zero-duration animations running Backwards.
If you set the duration of any variant or property animation to 0,
its progress will be stuck at 1 (0..1), and its "end" value set on
the target object, after start() has been called. If you change the
direction of the animation to QAbstractAnimation::Backward, you
would expect the progress to be 0 after start. Instead it's still
1; the code seems to assume that if the duration is 0, the
progress must be 1 always.

The fix is that if the duration is 0, the direction is checked to
determine whether progress should be 0 (Backward) or 1 (Forward).

Task-number: QTBUG-27969
Change-Id: Ibeca084bbbce41df1dca7b7d96c15b6b54394996
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Thierry Bastian <thierryb@filewave.com>
Reviewed-by: Magne Zachrisen <mazachri@cisco.com>
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
2012-11-13 15:34:56 +01:00
Jędrzej Nowacki
21c07f56e2 Fix a warning on compilers not supporting constexpr.
Macros should call QSKIP instead of creating a semi-empty function body.

Change-Id: I389701f618fe9bf0a40aa26f161620389a80e407
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com>
Reviewed-by: Mitch Curtis <mitch.curtis@digia.com>
2012-11-11 12:10:49 +01:00
Liang Qi
8e722eb85a test: fix tst_QLocale::macDefaultLocale
1. There is a behaviour change for CFDateFormatterGetFormat() between
10.6 and later, QLocale::dateFormat(QLocale::LongFormat) will return
"MMMM d, yyyy" for 10.6 and "MMMM d, y" for 10.7, 10.8
2. Add a comment for toCurrencyString() test, need another system
settings

Task-number: QTBUG-27790
Change-Id: I4fe684d6e0c1d4a140e3b1f1ef395b7fdad030b4
Reviewed-by: Samuli Piippo <samuli.piippo@digia.com>
Reviewed-by: Janne Anttila <janne.anttila@digia.com>
Reviewed-by: Sergio Ahumada <sergio.ahumada@digia.com>
2012-11-09 08:25:51 +01:00