summaryrefslogtreecommitdiffstats
path: root/tools/configure
diff options
context:
space:
mode:
authorMiikka Heikkinen <miikka.heikkinen@digia.com>2010-12-08 14:06:18 (GMT)
committerMiikka Heikkinen <miikka.heikkinen@digia.com>2010-12-09 10:50:56 (GMT)
commit1b41444e13d3e9e2f0733129675d0c2996e7df57 (patch)
treecf4167eaa56f09cfd58c0cf18fce33f4e9d16a8c /tools/configure
parentdbc5757a546cdb3f1f4f80e178e76cd3cf687349 (diff)
downloadQt-1b41444e13d3e9e2f0733129675d0c2996e7df57.zip
Qt-1b41444e13d3e9e2f0733129675d0c2996e7df57.tar.gz
Qt-1b41444e13d3e9e2f0733129675d0c2996e7df57.tar.bz2
Add libinfix support for QML plugins in Symbian.
Task-number: QTBUG-14736 Reviewed-by: Alessandro Portale
Diffstat (limited to 'tools/configure')
-rw-r--r--tools/configure/configureapp.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/tools/configure/configureapp.cpp b/tools/configure/configureapp.cpp
index 050ad62..c967dad 100644
--- a/tools/configure/configureapp.cpp
+++ b/tools/configure/configureapp.cpp
@@ -1029,6 +1029,8 @@ void Configure::parseCmdLine()
if (dictionary.contains("XQMAKESPEC") && dictionary["XQMAKESPEC"].startsWith("symbian")) {
dictionary[ "QT_INSTALL_PLUGINS" ] =
QString("\\resource\\qt%1\\plugins").arg(dictionary[ "QT_LIBINFIX" ]);
+ dictionary[ "QT_INSTALL_IMPORTS" ] =
+ QString("\\resource\\qt%1\\imports").arg(dictionary[ "QT_LIBINFIX" ]);
}
} else if (configCmdLine.at(i) == "-D") {
++i;
ngs::warnings() } static QString tmpSourceFile; bool openResult = true; - QString templatePath = QDir::temp().absoluteFilePath("XXXXXX-test.cpp"); - QTemporaryFile tmpQSourceFile(templatePath); + const QString tmpBaseName("XXXXXX-test.cpp"); + QString templatePath = QDir::temp().absoluteFilePath(tmpBaseName); + QFile tmpQSourceFile(templatePath); if (tmpSourceFile.isEmpty()) { - tmpQSourceFile.open(); + tmpQSourceFile.open(QIODevice::ReadWrite | QIODevice::Truncate); tmpSourceFile = tmpQSourceFile.fileName(); QFile cppSource(":/test.cpp"); bool openResult = cppSource.open(QIODevice::ReadOnly); @@ -152,6 +153,7 @@ void tst_CompilerWarnings::warnings() out << in.readAll(); } } + tmpQSourceFile.close(); QVERIFY2(openResult, "Need resource temporary \"test.cpp\""); QStringList args; @@ -228,8 +230,8 @@ void tst_CompilerWarnings::warnings() #ifdef Q_CC_MSVC QString errs = QString::fromLocal8Bit(proc.readAllStandardOutput().constData()); - if (errs.startsWith(tmpSourceFile)) - errs = errs.mid(10); + if (errs.startsWith(tmpBaseName)) + errs = errs.mid(tmpBaseName.size()).simplified();; #else QString errs = QString::fromLocal8Bit(proc.readAllStandardError().constData()); #endif @@ -243,6 +245,8 @@ void tst_CompilerWarnings::warnings() } QCOMPARE(errList.count(), 0); // verbose info how many lines of errors in output QVERIFY(errs.isEmpty()); + + tmpQSourceFile.remove(); } QTEST_APPLESS_MAIN(tst_CompilerWarnings) -- cgit v0.12 From 8efe6915c9a6dfa531ec39d5de7e8af34f76dc3c Mon Sep 17 00:00:00 2001 From: Marius Storm-Olsen Date: Fri, 7 Aug 2009 08:32:35 +0200 Subject: Avoid compiling imageformats if you configure with -no-lib* Task-number: 239108 Reviewed-by: Andy Shaw --- configure | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/configure b/configure index e58180a..2b81cab 100755 --- a/configure +++ b/configure @@ -5706,7 +5706,9 @@ fi if [ "$CFG_INOTIFY" = "yes" ]; then QT_CONFIG="$QT_CONFIG inotify" fi -if [ "$CFG_LIBJPEG" = "system" ]; then +if [ "$CFG_LIBJPEG" = "no" ]; then + CFG_JPEG="no" +elif [ "$CFG_LIBJPEG" = "system" ]; then QT_CONFIG="$QT_CONFIG system-jpeg" fi if [ "$CFG_JPEG" = "no" ]; then @@ -5714,7 +5716,9 @@ if [ "$CFG_JPEG" = "no" ]; then elif [ "$CFG_JPEG" = "yes" ]; then QT_CONFIG="$QT_CONFIG jpeg" fi -if [ "$CFG_LIBMNG" = "system" ]; then +if [ "$CFG_LIBMNG" = "no" ]; then + CFG_MNG="no" +elif [ "$CFG_LIBMNG" = "system" ]; then QT_CONFIG="$QT_CONFIG system-mng" fi if [ "$CFG_MNG" = "no" ]; then @@ -5738,7 +5742,9 @@ if [ "$CFG_GIF" = "no" ]; then elif [ "$CFG_GIF" = "yes" ]; then QT_CONFIG="$QT_CONFIG gif" fi -if [ "$CFG_LIBTIFF" = "system" ]; then +if [ "$CFG_LIBTIFF" = "no" ]; then + CFG_TIFF="no" +elif [ "$CFG_LIBTIFF" = "system" ]; then QT_CONFIG="$QT_CONFIG system-tiff" fi if [ "$CFG_TIFF" = "no" ]; then -- cgit v0.12 From 41d27eac40cecbc0067be9622c9bc1c579582a47 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Fri, 7 Aug 2009 13:17:05 +0200 Subject: Autotest: ensure we don't mishandle SSL certificates with NULs This is a vulnerability in some implementations. Qt isn't affected because... well, we never implemented the decoding of escape sequences :-) --- .../more-certificates/badguy-nul-cn.crt | 81 ++++++++++++++++++++++ tests/auto/qsslcertificate/tst_qsslcertificate.cpp | 17 +++++ 2 files changed, 98 insertions(+) create mode 100644 tests/auto/qsslcertificate/more-certificates/badguy-nul-cn.crt diff --git a/tests/auto/qsslcertificate/more-certificates/badguy-nul-cn.crt b/tests/auto/qsslcertificate/more-certificates/badguy-nul-cn.crt new file mode 100644 index 0000000..b899733 --- /dev/null +++ b/tests/auto/qsslcertificate/more-certificates/badguy-nul-cn.crt @@ -0,0 +1,81 @@ +Certificate: + Data: + Version: 3 (0x2) + Serial Number: 1 (0x1) + Signature Algorithm: sha1WithRSAEncryption + Issuer: C=GB, ST=Berkshire, L=Newbury, O=My Company Ltd, OU=CA, CN=NULL-friendly CA + Validity + Not Before: Aug 4 07:33:43 2009 GMT + Not After : Aug 2 07:33:43 2019 GMT + Subject: CN=www.bank.com\x00.badguy.com + Subject Public Key Info: + Public Key Algorithm: rsaEncryption + RSA Public Key: (2048 bit) + Modulus (2048 bit): + 00:cd:26:70:96:a9:a6:5d:3e:9c:ed:0f:08:15:5a: + 7c:17:25:68:68:af:13:b9:ad:41:fa:12:54:e2:84: + 72:7d:58:d1:e2:40:42:c1:59:ed:05:3d:aa:10:53: + 70:00:88:3a:77:a0:c0:56:9e:ac:7d:21:2a:71:44: + 51:08:bc:17:07:da:a8:a3:76:dc:51:bc:1b:8a:f6: + 02:1a:55:bf:46:b4:44:6b:27:5e:be:e5:17:8b:56: + b2:c6:82:36:11:83:a8:bf:f7:2f:0d:17:f6:cd:47: + b5:6f:2b:a6:41:b6:8d:33:5f:ea:ea:8b:b1:1a:e2: + 99:38:ff:59:5b:0a:a1:71:13:ca:37:3f:b9:b0:1e: + 91:9a:c8:93:35:0c:4a:e0:9d:f4:d2:61:c7:4e:5b: + 41:0a:7c:31:54:99:db:f5:65:ce:80:d3:c2:02:37: + 64:fd:54:12:7b:ea:ac:85:59:5c:17:e1:2e:f6:d0: + a8:f2:d0:2e:94:59:2f:c2:a6:5f:da:07:de:7b:2e: + 14:07:ed:e4:27:24:37:9d:09:2e:b1:f9:5a:48:b9: + 80:24:43:e6:cb:c7:6e:35:df:d5:69:34:ff:e6:d6: + 9e:e8:76:66:6e:5f:59:01:3c:96:3b:ec:72:0b:3c: + 1e:95:0f:ce:68:13:9c:22:dd:1b:b5:44:28:50:4a: + 05:7f + Exponent: 65537 (0x10001) + X509v3 extensions: + X509v3 Basic Constraints: + CA:FALSE + Netscape Comment: + OpenSSL Generated Certificate + X509v3 Subject Key Identifier: + 33:15:24:BE:DA:66:3A:06:8B:D9:27:34:3A:AF:62:40:E4:95:66:5D + X509v3 Authority Key Identifier: + keyid:0A:69:39:5F:9D:30:04:18:08:2E:02:0E:E6:EA:9D:B2:26:F6:E2:6A + + Signature Algorithm: sha1WithRSAEncryption + 32:65:23:1f:c8:d9:53:84:82:d0:0a:eb:14:51:24:03:bc:6c: + 1b:2a:5a:fe:1b:f0:e8:69:0c:2b:19:86:cf:7f:32:76:d8:2b: + d2:cf:8b:c4:d1:b6:5b:9c:60:a3:99:2e:92:72:06:ce:de:8b: + d2:a2:d2:89:7c:13:a9:0b:4e:be:12:09:e5:d6:28:3a:ac:a7: + 26:56:94:7f:13:ee:64:7d:de:94:60:75:c1:bc:55:97:d4:aa: + 13:8e:02:d8:b0:b0:70:53:ae:18:53:ce:aa:b2:2c:85:3e:e3: + f3:e1:26:f3:fa:5c:ee:f8:7b:0b:c6:39:b5:04:33:5e:ae:b8: + 5e:0e:66:cc:a8:c0:6a:0d:ec:60:c1:c5:d9:39:ea:bd:1b:8f: + 1c:7d:16:38:b1:e8:c8:37:01:aa:4b:99:df:e4:0f:10:be:61: + ee:9a:cf:cd:27:05:46:00:60:d8:6a:74:08:32:3c:8b:90:01: + 6a:07:33:0c:6c:90:db:ea:fb:6a:17:1a:76:bb:73:14:27:e1: + a4:7e:d5:dd:30:b1:5d:f2:0e:aa:d4:b2:d5:4c:f6:4f:91:2a: + 07:f4:37:c1:cf:48:19:c5:fe:7e:92:96:a8:df:50:6a:31:92: + a3:b1:14:fe:41:cc:49:62:98:4d:ea:c5:ba:05:2d:49:c3:22: + 72:ef:41:09 +-----BEGIN CERTIFICATE----- +MIIDjTCCAnWgAwIBAgIBATANBgkqhkiG9w0BAQUFADB0MQswCQYDVQQGEwJHQjES +MBAGA1UECBMJQmVya3NoaXJlMRAwDgYDVQQHEwdOZXdidXJ5MRcwFQYDVQQKEw5N +eSBDb21wYW55IEx0ZDELMAkGA1UECxMCQ0ExGTAXBgNVBAMTEE5VTEwtZnJpZW5k +bHkgQ0EwHhcNMDkwODA0MDczMzQzWhcNMTkwODAyMDczMzQzWjAjMSEwHwYDVQQD +Exh3d3cuYmFuay5jb20ALmJhZGd1eS5jb20wggEiMA0GCSqGSIb3DQEBAQUAA4IB +DwAwggEKAoIBAQDNJnCWqaZdPpztDwgVWnwXJWhorxO5rUH6ElTihHJ9WNHiQELB +We0FPaoQU3AAiDp3oMBWnqx9ISpxRFEIvBcH2qijdtxRvBuK9gIaVb9GtERrJ16+ +5ReLVrLGgjYRg6i/9y8NF/bNR7VvK6ZBto0zX+rqi7Ea4pk4/1lbCqFxE8o3P7mw +HpGayJM1DErgnfTSYcdOW0EKfDFUmdv1Zc6A08ICN2T9VBJ76qyFWVwX4S720Kjy +0C6UWS/Cpl/aB957LhQH7eQnJDedCS6x+VpIuYAkQ+bLx24139VpNP/m1p7odmZu +X1kBPJY77HILPB6VD85oE5wi3Ru1RChQSgV/AgMBAAGjezB5MAkGA1UdEwQCMAAw +LAYJYIZIAYb4QgENBB8WHU9wZW5TU0wgR2VuZXJhdGVkIENlcnRpZmljYXRlMB0G +A1UdDgQWBBQzFSS+2mY6BovZJzQ6r2JA5JVmXTAfBgNVHSMEGDAWgBQKaTlfnTAE +GAguAg7m6p2yJvbiajANBgkqhkiG9w0BAQUFAAOCAQEAMmUjH8jZU4SC0ArrFFEk +A7xsGypa/hvw6GkMKxmGz38ydtgr0s+LxNG2W5xgo5kuknIGzt6L0qLSiXwTqQtO +vhIJ5dYoOqynJlaUfxPuZH3elGB1wbxVl9SqE44C2LCwcFOuGFPOqrIshT7j8+Em +8/pc7vh7C8Y5tQQzXq64Xg5mzKjAag3sYMHF2TnqvRuPHH0WOLHoyDcBqkuZ3+QP +EL5h7prPzScFRgBg2Gp0CDI8i5ABagczDGyQ2+r7ahcadrtzFCfhpH7V3TCxXfIO +qtSy1Uz2T5EqB/Q3wc9IGcX+fpKWqN9QajGSo7EU/kHMSWKYTerFugUtScMicu9B +CQ== +-----END CERTIFICATE----- diff --git a/tests/auto/qsslcertificate/tst_qsslcertificate.cpp b/tests/auto/qsslcertificate/tst_qsslcertificate.cpp index 7fd92d6..80ac228 100644 --- a/tests/auto/qsslcertificate/tst_qsslcertificate.cpp +++ b/tests/auto/qsslcertificate/tst_qsslcertificate.cpp @@ -100,6 +100,7 @@ private slots: void fromPath(); void certInfo(); void task256066toPem(); + void nulInCN(); // ### add tests for certificate bundles (multiple certificates concatenated into a single // structure); both PEM and DER formatted #endif @@ -727,6 +728,22 @@ void tst_QSslCertificate::task256066toPem() QCOMPARE(pem1, pem2); } +void tst_QSslCertificate::nulInCN() +{ + QList certList = + QSslCertificate::fromPath(SRCDIR "more-certificates/badguy-nul-cn.crt"); + QCOMPARE(certList.size(), 1); + + const QSslCertificate &cert = certList.at(0); + QVERIFY(!cert.isNull()); + + QString cn = cert.subjectInfo(QSslCertificate::CommonName); + QVERIFY(cn != "www.bank.com"); + + static const char realCN[] = "www.bank.com\\x00.badguy.com"; + QCOMPARE(cn, QString::fromLatin1(realCN, sizeof realCN - 1)); +} + #endif // QT_NO_OPENSSL QTEST_MAIN(tst_QSslCertificate) -- cgit v0.12 From 79c488a28819b58eed519fb3df2705b8c6e35e05 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Wed, 15 Jul 2009 17:22:11 +0200 Subject: Add functionality tests for XSync. It was reported to be auto-detected, but wasn't. Apparently, AIX 6's X11 doesn't have this. Reviewed-By: Denis Dzyubenko (cherry picked from commit 0a63875d787e1b035ace2c76fa1d0de6329127d7) --- config.tests/x11/xsync/xsync.cpp | 11 +++++++++++ config.tests/x11/xsync/xsync.pro | 3 +++ configure | 36 +++++++++++++++++++++++++++++++++++- 3 files changed, 49 insertions(+), 1 deletion(-) create mode 100644 config.tests/x11/xsync/xsync.cpp create mode 100644 config.tests/x11/xsync/xsync.pro diff --git a/config.tests/x11/xsync/xsync.cpp b/config.tests/x11/xsync/xsync.cpp new file mode 100644 index 0000000..a23fb08 --- /dev/null +++ b/config.tests/x11/xsync/xsync.cpp @@ -0,0 +1,11 @@ +#include +#include +#include + +int main(int, char **) +{ + XSyncValue value; + (void*)&XSyncIntToValue; + (void*)&XSyncCreateCounter; + return 0; +} diff --git a/config.tests/x11/xsync/xsync.pro b/config.tests/x11/xsync/xsync.pro new file mode 100644 index 0000000..58b8238 --- /dev/null +++ b/config.tests/x11/xsync/xsync.pro @@ -0,0 +1,3 @@ +CONFIG += x11 +CONFIG -= qt +SOURCES = xsync.cpp diff --git a/configure b/configure index 2b81cab..b5baadb 100755 --- a/configure +++ b/configure @@ -570,6 +570,7 @@ CFG_DEBUG_RELEASE=no CFG_SHARED=yes CFG_SM=auto CFG_XSHAPE=auto +CFG_XSYNC=auto CFG_XINERAMA=runtime CFG_XFIXES=runtime CFG_ZLIB=auto @@ -831,7 +832,7 @@ while [ "$#" -gt 0 ]; do VAL=no ;; #Qt style yes options - -incremental|-qvfb|-profile|-shared|-static|-sm|-xinerama|-xshape|-xinput|-reduce-exports|-pch|-separate-debug-info|-stl|-freetype|-xcursor|-xfixes|-xrandr|-xrender|-mitshm|-fontconfig|-xkb|-nis|-qdbus|-dbus|-dbus-linked|-glib|-gstreamer|-gtkstyle|-cups|-iconv|-largefile|-h|-help|-v|-verbose|-debug|-release|-fast|-accessibility|-confirm-license|-gnumake|-framework|-qt3support|-debug-and-release|-exceptions|-cocoa|-universal|-prefix-install|-silent|-armfpa|-optimized-qmake|-dwarf2|-reduce-relocations|-sse|-openssl|-openssl-linked|-ptmalloc|-xmlpatterns|-phonon|-phonon-backend|-svg|-webkit|-scripttools|-rpath|-force-pkg-config) + -incremental|-qvfb|-profile|-shared|-static|-sm|-xinerama|-xshape|-xshape|-xinput|-reduce-exports|-pch|-separate-debug-info|-stl|-freetype|-xcursor|-xfixes|-xrandr|-xrender|-mitshm|-fontconfig|-xkb|-nis|-qdbus|-dbus|-dbus-linked|-glib|-gstreamer|-gtkstyle|-cups|-iconv|-largefile|-h|-help|-v|-verbose|-debug|-release|-fast|-accessibility|-confirm-license|-gnumake|-framework|-qt3support|-debug-and-release|-exceptions|-cocoa|-universal|-prefix-install|-silent|-armfpa|-optimized-qmake|-dwarf2|-reduce-relocations|-sse|-openssl|-openssl-linked|-ptmalloc|-xmlpatterns|-phonon|-phonon-backend|-svg|-webkit|-scripttools|-rpath|-force-pkg-config) VAR=`echo $1 | sed "s,^-\(.*\),\1,"` VAL=yes ;; @@ -1419,6 +1420,13 @@ while [ "$#" -gt 0 ]; do UNKNOWN_OPT=yes fi ;; + xsync) + if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then + CFG_XSYNC="$VAL" + else + UNKNOWN_OPT=yes + fi + ;; xinput) if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ] || [ "$VAL" = "runtime" ]; then CFG_XINPUT="$VAL" @@ -3480,6 +3488,10 @@ Qt/X11 only: $SHY -xshape ............ Compile XShape support. Requires X11/extensions/shape.h. + $SHN -no-xsync .......... Do not compile XSync support. + $SHY -xsync ............. Compile XSync support. + Requires X11/extensions/sync.h. + $XAN -no-xinerama ....... Do not compile Xinerama (multihead) support. $XAY -xinerama .......... Compile Xinerama support. Requires X11/extensions/Xinerama.h and libXinerama. @@ -4993,6 +5005,23 @@ if [ "$PLATFORM_X11" = "yes" ]; then fi fi + # auto-detect XSync support + if [ "$CFG_XSYNC" != "no" ]; then + if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/x11/xsync "XSync" $L_FLAGS $I_FLAGS $l_FLAGS $X11TESTS_FLAGS; then + CFG_XSYNC=yes + else + if [ "$CFG_XSYNC" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then + echo "XSync support cannot be enabled due to functionality tests!" + echo " Turn on verbose messaging (-v) to $0 to see the final report." + echo " If you believe this message is in error you may use the continue" + echo " switch (-continue) to $0 to continue." + exit 101 + else + CFG_XSYNC=no + fi + fi + fi + # auto-detect Xinerama support if [ "$CFG_XINERAMA" != "no" ]; then if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/x11/xinerama "Xinerama" $L_FLAGS $I_FLAGS $l_FLAGS $X11TESTS_FLAGS; then @@ -5791,6 +5820,9 @@ if [ "$PLATFORM_X11" = "yes" ]; then if [ "$CFG_XSHAPE" = "yes" ]; then QT_CONFIG="$QT_CONFIG xshape" fi + if [ "$CFG_XSYNC" = "yes" ]; then + QT_CONFIG="$QT_CONFIG xsync" + fi if [ "$CFG_XINERAMA" = "yes" ]; then QT_CONFIG="$QT_CONFIG xinerama" QMakeVar set QMAKE_LIBS_X11 '-lXinerama $$QMAKE_LIBS_X11' @@ -6503,6 +6535,7 @@ fi [ "$CFG_XRENDER" = "no" ] && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_XRENDER" [ "$CFG_MITSHM" = "no" ] && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_MITSHM" [ "$CFG_XSHAPE" = "no" ] && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_SHAPE" +[ "$CFG_XSYNC" = "no" ] && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_XSYNC" [ "$CFG_XINPUT" = "no" ] && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_XINPUT QT_NO_TABLET" [ "$CFG_XCURSOR" = "runtime" ] && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_RUNTIME_XCURSOR" @@ -6944,6 +6977,7 @@ fi if [ "$PLATFORM_X11" = "yes" ]; then echo "NAS sound support ... $CFG_NAS" echo "XShape support ...... $CFG_XSHAPE" + echo "XSync support ....... $CFG_XSYNC" echo "Xinerama support .... $CFG_XINERAMA" echo "Xcursor support ..... $CFG_XCURSOR" echo "Xfixes support ...... $CFG_XFIXES" -- cgit v0.12 From 923134936e132e857b663c4837f66565dfa3d9e6 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Thu, 16 Jul 2009 15:38:27 +0200 Subject: xlC 7 cannot compile QtConcurrent with these templates here (cherry picked from commit cb64ac587249f5dc6563a035e2ef5a3ad2bc5d13) --- src/corelib/concurrent/qfuture.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/corelib/concurrent/qfuture.h b/src/corelib/concurrent/qfuture.h index 47015ee..f2db5ac 100644 --- a/src/corelib/concurrent/qfuture.h +++ b/src/corelib/concurrent/qfuture.h @@ -210,7 +210,7 @@ public: bool operator==(const QFuture &other) const { return (d == other.d); } bool operator!=(const QFuture &other) const { return (d != other.d); } -#ifndef QT_NO_MEMBER_TEMPLATES +#if !defined(QT_NO_MEMBER_TEMPLATES) && !defined(Q_CC_XLC) template QFuture(const QFuture &other) : d(other.d) -- cgit v0.12 From 3eb12a43e3cf673ec0608833551b25f153af1aa3 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Thu, 30 Jul 2009 16:40:06 +0200 Subject: Fix compilation with xlC 7: operands to ?: must match. "../shared/qm.cpp", line 556.45: 1540-0207 (S) No common type found for operands with type "const char [7]" and "QByteArray". Reviewed-by: Trust Me (cherry picked from commit 3ae2cab9c8bd1790a00da2755ac036143a3a35f4) --- tools/linguist/shared/qm.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/linguist/shared/qm.cpp b/tools/linguist/shared/qm.cpp index 381f5c5..231ec84 100644 --- a/tools/linguist/shared/qm.cpp +++ b/tools/linguist/shared/qm.cpp @@ -546,7 +546,7 @@ bool loadQM(Translator &translator, QIODevice &dev, ConversionData &cd) //qDebug() << "NUMITEMS: " << numItems; QTextCodec *codec = QTextCodec::codecForName( - cd.m_codecForSource.isEmpty() ? "Latin1" : cd.m_codecForSource); + cd.m_codecForSource.isEmpty() ? QByteArray("Latin1") : cd.m_codecForSource); QTextCodec *utf8Codec = 0; if (codec->name() != "UTF-8") utf8Codec = QTextCodec::codecForName("UTF-8"); -- cgit v0.12 From c39436c722e778460366995877d66a8935d2d636 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Fri, 31 Jul 2009 10:30:44 +0200 Subject: Fix compilation with xlC 7: operands to ?: must match. See 3ae2cab9c8bd1790a00da2755ac036143a3a35f4 for another similar fix. Reviewed-by: Trust Me (cherry picked from commit 18fbfdf0f774198e2e1277e064cc3a8eb9dbb29d) --- tools/linguist/shared/po.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/linguist/shared/po.cpp b/tools/linguist/shared/po.cpp index 4850cfd..575e751 100644 --- a/tools/linguist/shared/po.cpp +++ b/tools/linguist/shared/po.cpp @@ -359,7 +359,7 @@ bool loadPO(Translator &translator, QIODevice &dev, ConversionData &cd) const QChar quote = QLatin1Char('"'); const QChar newline = QLatin1Char('\n'); QTextStream in(&dev); - in.setCodec(cd.m_codecForSource.isEmpty() ? "UTF-8" : cd.m_codecForSource); + in.setCodec(cd.m_codecForSource.isEmpty() ? QByteArray("UTF-8") : cd.m_codecForSource); bool error = false; // format of a .po file entry: @@ -552,7 +552,7 @@ bool savePO(const Translator &translator, QIODevice &dev, ConversionData &cd) { bool ok = true; QTextStream out(&dev); - out.setCodec(cd.m_outputCodec.isEmpty() ? "UTF-8" : cd.m_outputCodec); + out.setCodec(cd.m_outputCodec.isEmpty() ? QByteArray("UTF-8") : cd.m_outputCodec); bool first = true; if (translator.messages().isEmpty() || !translator.messages().first().sourceText().isEmpty()) { -- cgit v0.12 From 47f58dfad1eb7fe61a523597023df33f3d320377 Mon Sep 17 00:00:00 2001 From: Denis Dzyubenko Date: Sat, 8 Aug 2009 23:58:46 +0200 Subject: Made the QGesture::reset function protected. By default the QGesture::reset function is protected, and it can be made public in the derived class if necessary. Reviewed-by: trustme --- src/gui/kernel/qgesture.h | 3 +-- src/gui/kernel/qstandardgestures.h | 4 +++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/gui/kernel/qgesture.h b/src/gui/kernel/qgesture.h index 7da37c4..839fdca 100644 --- a/src/gui/kernel/qgesture.h +++ b/src/gui/kernel/qgesture.h @@ -73,14 +73,13 @@ public: void setGraphicsItem(QGraphicsItem *); QGraphicsItem *graphicsItem() const; - virtual void reset(); - Qt::GestureState state() const; protected: QGesture(QGesturePrivate &dd, QObject *parent); bool eventFilter(QObject*, QEvent*); + virtual void reset(); void updateState(Qt::GestureState state); Q_SIGNALS: diff --git a/src/gui/kernel/qstandardgestures.h b/src/gui/kernel/qstandardgestures.h index c734fba..03a1374 100644 --- a/src/gui/kernel/qstandardgestures.h +++ b/src/gui/kernel/qstandardgestures.h @@ -66,11 +66,13 @@ public: QPanGesture(QWidget *parent); bool filterEvent(QEvent *event); - void reset(); QSize totalOffset() const; QSize lastOffset() const; +protected: + void reset(); + private: bool event(QEvent *event); bool eventFilter(QObject *receiver, QEvent *event); -- cgit v0.12 From 6826490774d66e0470fc1e5848ab89b3a0d0bb86 Mon Sep 17 00:00:00 2001 From: Denis Dzyubenko Date: Wed, 5 Aug 2009 18:57:25 +0200 Subject: Implemented QPinchGesture. Added a new standard gesture, which is implemented using a native zoom and rotate gestures on Windows and with a direct touch event handling on other platforms. Improved pan support - we subscribe to native pan gesture only when it's really needed, and we pass proper flags for single finger horizontal/vertical panning. Reviewed-by: Richard Moe Gustavsen --- src/gui/kernel/qapplication_p.h | 3 + src/gui/kernel/qapplication_win.cpp | 21 ++-- src/gui/kernel/qevent_p.h | 5 +- src/gui/kernel/qstandardgestures.cpp | 210 ++++++++++++++++++++++++++++++++++- src/gui/kernel/qstandardgestures.h | 39 +++++++ src/gui/kernel/qstandardgestures_p.h | 25 +++++ src/gui/kernel/qwidget_win.cpp | 40 ++++--- 7 files changed, 316 insertions(+), 27 deletions(-) diff --git a/src/gui/kernel/qapplication_p.h b/src/gui/kernel/qapplication_p.h index c4ce2ea..9953907 100644 --- a/src/gui/kernel/qapplication_p.h +++ b/src/gui/kernel/qapplication_p.h @@ -235,6 +235,7 @@ typedef struct tagGESTUREINFO # define GC_PAN_WITH_SINGLE_FINGER_HORIZONTALLY 0x00000004 # define GC_ZOOM 0x00000001 +# define GC_ROTATE 0x00000001 typedef struct tagGESTURECONFIG { @@ -243,6 +244,8 @@ typedef struct tagGESTURECONFIG DWORD dwBlock; } GESTURECONFIG; +# define GID_ROTATE_ANGLE_FROM_ARGUMENT(arg) ((((double)(arg) / 65535.0) * 4.0 * 3.14159265) - 2.0*3.14159265) + #endif // WM_GESTURE #endif // Q_WS_WIN diff --git a/src/gui/kernel/qapplication_win.cpp b/src/gui/kernel/qapplication_win.cpp index bdee6ec..cb67409 100644 --- a/src/gui/kernel/qapplication_win.cpp +++ b/src/gui/kernel/qapplication_win.cpp @@ -3721,17 +3721,18 @@ bool QETWidget::translateGestureEvent(const MSG &msg) QApplicationPrivate *qAppPriv = getQApplicationPrivateInternal(); BOOL bResult = qAppPriv->GetGestureInfo((HANDLE)msg.lParam, &gi); + if (bResult) { + const QPoint widgetPos = QPoint(gi.ptsLocation.x, gi.ptsLocation.y); + QWidget *alienWidget = !internalWinId() ? this : childAt(widgetPos); + if (alienWidget && alienWidget->internalWinId()) + alienWidget = 0; + QWidget *widget = alienWidget ? alienWidget : this; - const QPoint widgetPos = QPoint(gi.ptsLocation.x, gi.ptsLocation.y); - QWidget *alienWidget = !internalWinId() ? this : childAt(widgetPos); - if (alienWidget && alienWidget->internalWinId()) - alienWidget = 0; - QWidget *widget = alienWidget ? alienWidget : this; + QNativeGestureEvent event; + event.sequenceId = gi.dwSequenceID; + event.position = QPoint(gi.ptsLocation.x, gi.ptsLocation.y); + event.argument = gi.ullArguments; - QNativeGestureEvent event; - event.sequenceId = gi.dwSequenceID; - event.position = QPoint(gi.ptsLocation.x, gi.ptsLocation.y); - if (bResult) { switch (gi.dwID) { case GID_BEGIN: event.gestureType = QNativeGestureEvent::GestureBegin; @@ -3746,6 +3747,8 @@ bool QETWidget::translateGestureEvent(const MSG &msg) event.gestureType = QNativeGestureEvent::Pan; break; case GID_ROTATE: + event.gestureType = QNativeGestureEvent::Rotate; + break; case GID_TWOFINGERTAP: case GID_ROLLOVER: default: diff --git a/src/gui/kernel/qevent_p.h b/src/gui/kernel/qevent_p.h index b21b35c..2ff672b 100644 --- a/src/gui/kernel/qevent_p.h +++ b/src/gui/kernel/qevent_p.h @@ -133,9 +133,9 @@ public: }; QNativeGestureEvent() - : QEvent(QEvent::NativeGesture), gestureType(None), percentage(0), direction(0, 0) + : QEvent(QEvent::NativeGesture), gestureType(None), percentage(0) #ifdef Q_WS_WIN - , sequenceId(0) + , sequenceId(0), argument(0) #endif { } @@ -146,6 +146,7 @@ public: QSize direction; #ifdef Q_WS_WIN ulong sequenceId; + quint64 argument; #endif }; diff --git a/src/gui/kernel/qstandardgestures.cpp b/src/gui/kernel/qstandardgestures.cpp index 7078dbf..ac03cd2 100644 --- a/src/gui/kernel/qstandardgestures.cpp +++ b/src/gui/kernel/qstandardgestures.cpp @@ -132,8 +132,7 @@ bool QPanGesture::eventFilter(QObject *receiver, QEvent *event) it = qAppPriv->widgetGestures.find(static_cast(receiver)); if (it == qAppPriv->widgetGestures.end()) return false; - QPanGesture *gesture = it.value().pan; - if (this != gesture) + if (this != it.value().pan) return false; Qt::GestureState nextState = Qt::NoGesture; switch(ev->gestureType) { @@ -162,7 +161,7 @@ bool QPanGesture::eventFilter(QObject *receiver, QEvent *event) d->totalOffset += d->lastOffset; } d->lastPosition = ev->position; - gesture->updateState(nextState); + updateState(nextState); return true; } #endif @@ -248,6 +247,7 @@ void QPanGesture::reset() d->panFinishedTimer = 0; } #endif + QGesture::reset(); } /*! @@ -273,6 +273,210 @@ QSize QPanGesture::lastOffset() const return d->lastOffset; } + +/*! + \class QPinchGesture + \since 4.6 + + \brief The QPinchGesture class represents a Pinch gesture, + providing additional information related to zooming and/or rotation. +*/ + +/*! + Creates a new Pinch gesture handler object and marks it as a child of \a + parent. + + On some platform like Windows it's necessary to provide a non-null widget + as \a parent to get native gesture support. +*/ +QPinchGesture::QPinchGesture(QWidget *parent) + : QGesture(*new QPinchGesturePrivate, parent) +{ + if (parent) { + QApplicationPrivate *qAppPriv = getQApplicationPrivateInternal(); + qAppPriv->widgetGestures[parent].pinch = this; +#ifdef Q_WS_WIN + qt_widget_private(parent)->winSetupGestures(); +#endif + } +} + +/*! \internal */ +bool QPinchGesture::event(QEvent *event) +{ + switch (event->type()) { + case QEvent::ParentAboutToChange: + if (QWidget *w = qobject_cast(parent())) { + getQApplicationPrivateInternal()->widgetGestures[w].pinch = 0; +#ifdef Q_WS_WIN + qt_widget_private(w)->winSetupGestures(); +#endif + } + break; + case QEvent::ParentChange: + if (QWidget *w = qobject_cast(parent())) { + getQApplicationPrivateInternal()->widgetGestures[w].pinch = this; +#ifdef Q_WS_WIN + qt_widget_private(w)->winSetupGestures(); +#endif + } + break; + default: + break; + } + return QObject::event(event); +} + +bool QPinchGesture::eventFilter(QObject *receiver, QEvent *event) +{ +#ifdef Q_WS_WIN + Q_D(QPinchGesture); + if (receiver->isWidgetType() && event->type() == QEvent::NativeGesture) { + QNativeGestureEvent *ev = static_cast(event); + QApplicationPrivate *qAppPriv = getQApplicationPrivateInternal(); + QApplicationPrivate::WidgetStandardGesturesMap::iterator it; + it = qAppPriv->widgetGestures.find(static_cast(receiver)); + if (it == qAppPriv->widgetGestures.end()) + return false; + if (this != it.value().pinch) + return false; + Qt::GestureState nextState = Qt::NoGesture; + switch(ev->gestureType) { + case QNativeGestureEvent::GestureBegin: + // next we might receive the first gesture update event, so we + // prepare for it. + d->state = Qt::NoGesture; + d->scaleFactor = d->lastScaleFactor = 1; + d->rotationAngle = d->lastRotationAngle = 0; + d->startCenterPoint = d->centerPoint = d->lastCenterPoint = QPoint(); + d->initialDistance = 0; + return false; + case QNativeGestureEvent::Rotate: + d->lastRotationAngle = d->rotationAngle; + d->rotationAngle = -1 * GID_ROTATE_ANGLE_FROM_ARGUMENT(ev->argument); + nextState = Qt::GestureUpdated; + event->accept(); + break; + case QNativeGestureEvent::Zoom: + if (d->initialDistance != 0) { + d->lastScaleFactor = d->scaleFactor; + int distance = int(qint64(ev->argument)); + d->scaleFactor = (qreal) distance / d->initialDistance; + } else { + d->initialDistance = int(qint64(ev->argument)); + } + nextState = Qt::GestureUpdated; + event->accept(); + break; + case QNativeGestureEvent::GestureEnd: + if (state() == Qt::NoGesture) + return false; // some other gesture has ended + nextState = Qt::GestureFinished; + break; + default: + return false; + } + if (d->startCenterPoint.isNull()) + d->startCenterPoint = d->centerPoint; + d->lastCenterPoint = d->centerPoint; + d->centerPoint = static_cast(receiver)->mapFromGlobal(ev->position); + updateState(nextState); + return true; + } +#endif + return QGesture::eventFilter(receiver, event); +} + +/*! \internal */ +bool QPinchGesture::filterEvent(QEvent *event) +{ + Q_UNUSED(event); + return false; +} + +/*! \internal */ +void QPinchGesture::reset() +{ + Q_D(QPinchGesture); + d->scaleFactor = d->lastScaleFactor = 0; + d->rotationAngle = d->lastRotationAngle = 0; + d->startCenterPoint = d->centerPoint = d->lastCenterPoint = QPoint(); + QGesture::reset(); +} + +/*! + \property QPinchGesture::scaleFactor + + Specifies a scale factor of the pinch gesture. +*/ +qreal QPinchGesture::scaleFactor() const +{ + return d_func()->scaleFactor; +} + +/*! + \property QPinchGesture::lastScaleFactor + + Specifies a previous scale factor of the pinch gesture. +*/ +qreal QPinchGesture::lastScaleFactor() const +{ + return d_func()->lastScaleFactor; +} + +/*! + \property QPinchGesture::rotationAngle + + Specifies a rotation angle of the gesture. +*/ +qreal QPinchGesture::rotationAngle() const +{ + return d_func()->rotationAngle; +} + +/*! + \property QPinchGesture::lastRotationAngle + + Specifies a previous rotation angle of the gesture. +*/ +qreal QPinchGesture::lastRotationAngle() const +{ + return d_func()->lastRotationAngle; +} + +/*! + \property QPinchGesture::centerPoint + + Specifies a center point of the gesture. The point can be used as a center + point that the object is rotated around. +*/ +QPoint QPinchGesture::centerPoint() const +{ + return d_func()->centerPoint; +} + +/*! + \property QPinchGesture::lastCenterPoint + + Specifies a previous center point of the gesture. +*/ +QPoint QPinchGesture::lastCenterPoint() const +{ + return d_func()->lastCenterPoint; +} + +/*! + \property QPinchGesture::startCenterPoint + + Specifies an initial center point of the gesture. Difference between the + startCenterPoint and the centerPoint is the distance at which pinching + fingers has shifted. +*/ +QPoint QPinchGesture::startCenterPoint() const +{ + return d_func()->startCenterPoint; +} + QT_END_NAMESPACE #include "moc_qstandardgestures.cpp" diff --git a/src/gui/kernel/qstandardgestures.h b/src/gui/kernel/qstandardgestures.h index 03a1374..adee740 100644 --- a/src/gui/kernel/qstandardgestures.h +++ b/src/gui/kernel/qstandardgestures.h @@ -80,6 +80,45 @@ private: friend class QWidget; }; +class QPinchGesturePrivate; +class Q_GUI_EXPORT QPinchGesture : public QGesture +{ + Q_OBJECT + Q_DECLARE_PRIVATE(QPinchGesture) + + Q_PROPERTY(qreal scaleFactor READ scaleFactor) + Q_PROPERTY(qreal lastScaleFactor READ lastScaleFactor) + + Q_PROPERTY(qreal rotationAngle READ rotationAngle) + Q_PROPERTY(qreal lastRotationAngle READ lastRotationAngle) + + Q_PROPERTY(QPoint startCenterPoint READ startCenterPoint) + Q_PROPERTY(QPoint lastCenterPoint READ lastCenterPoint) + Q_PROPERTY(QPoint centerPoint READ centerPoint) + +public: + QPinchGesture(QWidget *parent); + + bool filterEvent(QEvent *event); + void reset(); + + QPoint startCenterPoint() const; + QPoint lastCenterPoint() const; + QPoint centerPoint() const; + + qreal scaleFactor() const; + qreal lastScaleFactor() const; + + qreal rotationAngle() const; + qreal lastRotationAngle() const; + +private: + bool event(QEvent *event); + bool eventFilter(QObject *receiver, QEvent *event); + + friend class QWidget; +}; + QT_END_NAMESPACE QT_END_HEADER diff --git a/src/gui/kernel/qstandardgestures_p.h b/src/gui/kernel/qstandardgestures_p.h index 0fe24ee..43636d0 100644 --- a/src/gui/kernel/qstandardgestures_p.h +++ b/src/gui/kernel/qstandardgestures_p.h @@ -85,6 +85,31 @@ public: #endif }; +class QPinchGesturePrivate : public QGesturePrivate +{ + Q_DECLARE_PUBLIC(QPinchGesture) + +public: + QPinchGesturePrivate() + : scaleFactor(0), lastScaleFactor(0), + rotationAngle(0), lastRotationAngle(0) +#ifdef Q_WS_WIN + ,initialDistance(0) +#endif + { + } + qreal scaleFactor; + qreal lastScaleFactor; + qreal rotationAngle; + qreal lastRotationAngle; + QPoint startCenterPoint; + QPoint lastCenterPoint; + QPoint centerPoint; +#ifdef Q_WS_WIN + int initialDistance; +#endif +}; + QT_END_NAMESPACE #endif // QSTANDARDGESTURES_P_H diff --git a/src/gui/kernel/qwidget_win.cpp b/src/gui/kernel/qwidget_win.cpp index 7cfa111..510df7f 100644 --- a/src/gui/kernel/qwidget_win.cpp +++ b/src/gui/kernel/qwidget_win.cpp @@ -1160,6 +1160,8 @@ void QWidgetPrivate::show_sys() data.window_state |= Qt::WindowMaximized; } + winSetupGestures(); + invalidateBuffer(q->rect()); } #endif //Q_WS_WINCE @@ -2058,8 +2060,11 @@ void QWidgetPrivate::winSetupGestures() Q_Q(QWidget); if (!q) return; - extern QApplicationPrivate* getQApplicationPrivateInternal(); - QApplicationPrivate *qAppPriv = getQApplicationPrivateInternal(); + q->setAttribute(Qt::WA_DontCreateNativeAncestors); + q->setAttribute(Qt::WA_NativeWindow); + if (!q->isVisible()) + return; + QApplicationPrivate *qAppPriv = QApplicationPrivate::instance(); bool needh = false; bool needv = false; bool singleFingerPanEnabled = false; @@ -2072,34 +2077,43 @@ void QWidgetPrivate::winSetupGestures() QScrollBar *vbar = asa->verticalScrollBar(); Qt::ScrollBarPolicy hbarpolicy = asa->horizontalScrollBarPolicy(); Qt::ScrollBarPolicy vbarpolicy = asa->verticalScrollBarPolicy(); - needh = (hbarpolicy == Qt::ScrollBarAlwaysOn - || (hbarpolicy == Qt::ScrollBarAsNeeded && hbar->minimum() < hbar->maximum())); - needv = (vbarpolicy == Qt::ScrollBarAlwaysOn - || (vbarpolicy == Qt::ScrollBarAsNeeded && vbar->minimum() < vbar->maximum())); + needh = (hbarpolicy == Qt::ScrollBarAlwaysOn || + (hbarpolicy == Qt::ScrollBarAsNeeded && hbar->minimum() < hbar->maximum())); + needv = (vbarpolicy == Qt::ScrollBarAlwaysOn || + (vbarpolicy == Qt::ScrollBarAsNeeded && vbar->minimum() < vbar->maximum())); singleFingerPanEnabled = asa->d_func()->singleFingerPanEnabled; } else { winid = q->winId(); } if (qAppPriv->SetGestureConfig) { - GESTURECONFIG gc[2]; + GESTURECONFIG gc[3]; + memset(gc, 0, sizeof(gc)); gc[0].dwID = GID_PAN; - if (gestures.pan || needh || needv) { + if (gestures.pan) { gc[0].dwWant = GC_PAN; - gc[0].dwBlock = 0; if (needv && singleFingerPanEnabled) gc[0].dwWant |= GC_PAN_WITH_SINGLE_FINGER_VERTICALLY; + else + gc[0].dwBlock |= GC_PAN_WITH_SINGLE_FINGER_VERTICALLY; if (needh && singleFingerPanEnabled) gc[0].dwWant |= GC_PAN_WITH_SINGLE_FINGER_HORIZONTALLY; + else + gc[0].dwBlock |= GC_PAN_WITH_SINGLE_FINGER_HORIZONTALLY; } else { - gc[0].dwWant = 0; gc[0].dwBlock = GC_PAN; } gc[1].dwID = GID_ZOOM; - if (gestures.pinch) { + if (gestures.pinch) gc[1].dwWant = GC_ZOOM; - gc[1].dwBlock = 0; - } + else + gc[1].dwBlock = GC_ZOOM; + gc[2].dwID = GID_ROTATE; + if (gestures.pinch) + gc[2].dwWant = GC_ROTATE; + else + gc[2].dwBlock = GC_ROTATE; + Q_ASSERT(winid); qAppPriv->SetGestureConfig(winid, 0, sizeof(gc)/sizeof(gc[0]), gc, sizeof(gc[0])); } -- cgit v0.12 From 65ba2c18a9a3ec82331c0ccab47edc8e252192df Mon Sep 17 00:00:00 2001 From: Thierry Bastian Date: Mon, 10 Aug 2009 13:45:24 +0200 Subject: Fixed an assert that could happen when the mediaSource is deleted When using streaming, it could happen that the last reference to the MediaSource is in another thread. So the objects are destroyed from another thread. In which case we would delete QObject (ioDevice) in another thread. That is fixed by calling deleteLater which will ensure that they are deleted in their own thread. Note: there was a nother assert that could happen due to a race condition in the worker thread. That is also fixed with this patch. Reviewed-by: jbache --- src/3rdparty/phonon/ds9/mediaobject.cpp | 55 ++++++++++-------------------- src/3rdparty/phonon/ds9/mediaobject.h | 1 - src/3rdparty/phonon/phonon/mediasource.cpp | 8 +++-- 3 files changed, 24 insertions(+), 40 deletions(-) diff --git a/src/3rdparty/phonon/ds9/mediaobject.cpp b/src/3rdparty/phonon/ds9/mediaobject.cpp index 10782c2..b163ad4 100644 --- a/src/3rdparty/phonon/ds9/mediaobject.cpp +++ b/src/3rdparty/phonon/ds9/mediaobject.cpp @@ -57,24 +57,6 @@ namespace Phonon { } - WorkerThread::Work WorkerThread::dequeueWork() - { - QMutexLocker locker(&m_mutex); - if (m_finished) { - return Work(); - } - Work ret = m_queue.dequeue(); - - //we ensure to have the wait condition in the right state - if (m_queue.isEmpty()) { - m_waitCondition.reset(); - } else { - m_waitCondition.set(); - } - - return ret; - } - void WorkerThread::run() { while (m_finished == false) { @@ -88,11 +70,6 @@ namespace Phonon } DWORD result = ::WaitForMultipleObjects(count, handles, FALSE, INFINITE); if (result == WAIT_OBJECT_0) { - if (m_finished) { - //that's the end of the thread execution - return; - } - handleTask(); } else { //this is the event management @@ -199,22 +176,25 @@ namespace Phonon void WorkerThread::handleTask() { - const Work w = dequeueWork(); - - if (m_finished) { + QMutexLocker locker(&m_mutex); + if (m_finished || m_queue.isEmpty()) { return; } - HRESULT hr = S_OK; + const Work w = m_queue.dequeue(); - { - QMutexLocker locker(&m_mutex); - m_currentRender = w.graph; - m_currentRenderId = w.id; + //we ensure to have the wait condition in the right state + if (m_queue.isEmpty()) { + m_waitCondition.reset(); + } else { + m_waitCondition.set(); } + HRESULT hr = S_OK; + + m_currentRender = w.graph; + m_currentRenderId = w.id; if (w.task == ReplaceGraph) { - QMutexLocker locker(&m_mutex); int index = -1; for(int i = 0; i < FILTER_COUNT; ++i) { if (m_graphHandle[i].graph == w.oldGraph) { @@ -237,6 +217,9 @@ namespace Phonon m_graphHandle[index].handle = h; } } else if (w.task == Render) { + //we need to unlock here because the use might trigger a call to abort + //which uses the same mutex + locker.unlock(); if (w.filter) { //let's render pins w.graph->AddFilter(w.filter, 0); @@ -255,6 +238,7 @@ namespace Phonon if (hr != E_ABORT) { emit asyncRenderFinished(w.id, hr, w.graph); } + locker.relock(); } else if (w.task == Seek) { //that's a seekrequest ComPointer mediaSeeking(w.graph, IID_IMediaSeeking); @@ -327,11 +311,8 @@ namespace Phonon } } - { - QMutexLocker locker(&m_mutex); - m_currentRender = Graph(); - m_currentRenderId = 0; - } + m_currentRender = Graph(); + m_currentRenderId = 0; } void WorkerThread::abortCurrentRender(qint16 renderId) diff --git a/src/3rdparty/phonon/ds9/mediaobject.h b/src/3rdparty/phonon/ds9/mediaobject.h index 2c34ffc..fe52604 100644 --- a/src/3rdparty/phonon/ds9/mediaobject.h +++ b/src/3rdparty/phonon/ds9/mediaobject.h @@ -135,7 +135,6 @@ namespace Phonon }; QList decoders; //for the state change requests }; - Work dequeueWork(); void handleTask(); Graph m_currentRender; diff --git a/src/3rdparty/phonon/phonon/mediasource.cpp b/src/3rdparty/phonon/phonon/mediasource.cpp index 0a21c87..c003af9 100644 --- a/src/3rdparty/phonon/phonon/mediasource.cpp +++ b/src/3rdparty/phonon/phonon/mediasource.cpp @@ -140,8 +140,12 @@ MediaSourcePrivate::~MediaSourcePrivate() { #ifndef QT_NO_PHONON_ABSTRACTMEDIASTREAM if (autoDelete) { - delete stream; - delete ioDevice; + //here we use deleteLater because this object + //might be destroyed from another thread + if (stream) + stream->deleteLater(); + if (ioDevice) + ioDevice->deleteLater(); } #endif //QT_NO_PHONON_ABSTRACTMEDIASTREAM } -- cgit v0.12 From 2a1dcf7a47d81ad8b492c312dfd5e422ba2e3cd0 Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Mon, 10 Aug 2009 14:57:30 +0200 Subject: qdoc: List the NOTIFY signal function in the property doc. --- tools/qdoc3/cppcodeparser.cpp | 3 +++ tools/qdoc3/generator.cpp | 2 +- tools/qdoc3/htmlgenerator.cpp | 8 ++++++++ tools/qdoc3/node.h | 5 +++-- tools/qdoc3/tree.cpp | 3 +++ 5 files changed, 18 insertions(+), 3 deletions(-) diff --git a/tools/qdoc3/cppcodeparser.cpp b/tools/qdoc3/cppcodeparser.cpp index 562684b..12ec7f3 100644 --- a/tools/qdoc3/cppcodeparser.cpp +++ b/tools/qdoc3/cppcodeparser.cpp @@ -1737,6 +1737,9 @@ bool CppCodeParser::matchProperty(InnerNode *parent) property->setDesignable(value.toLower() == "true"); else if (key == "RESET") tre->addPropertyFunction(property, value, PropertyNode::Resetter); + else if (key == "NOTIFY") { + tre->addPropertyFunction(property, value, PropertyNode::Notifier); + } } match(Tok_RightParen); return true; diff --git a/tools/qdoc3/generator.cpp b/tools/qdoc3/generator.cpp index e92f53b..9538dfe 100644 --- a/tools/qdoc3/generator.cpp +++ b/tools/qdoc3/generator.cpp @@ -283,7 +283,7 @@ bool Generator::generateText(const Text& text, bool Generator::generateQmlText(const Text& text, const Node *relative, CodeMarker *marker, - const QString& qmlName) + const QString& /* qmlName */ ) { const Atom* atom = text.firstAtom(); if (atom == 0) diff --git a/tools/qdoc3/htmlgenerator.cpp b/tools/qdoc3/htmlgenerator.cpp index 26874e1..c203c62 100644 --- a/tools/qdoc3/htmlgenerator.cpp +++ b/tools/qdoc3/htmlgenerator.cpp @@ -3420,6 +3420,14 @@ void HtmlGenerator::generateDetailedMember(const Node *node, out() << "

Access functions:

\n"; generateSectionList(section, node, marker, CodeMarker::Accessors); } + + Section notifiers; + notifiers.members += property->notifiers(); + + if (!notifiers.members.isEmpty()) { + out() << "

Notifier signal:

\n"; + generateSectionList(notifiers, node, marker, CodeMarker::Accessors); + } } else if (node->type() == Node::Enum) { const EnumNode *enume = static_cast(node); diff --git a/tools/qdoc3/node.h b/tools/qdoc3/node.h index 17ec447..61f2a76 100644 --- a/tools/qdoc3/node.h +++ b/tools/qdoc3/node.h @@ -590,8 +590,8 @@ class FunctionNode : public LeafNode class PropertyNode : public LeafNode { public: - enum FunctionRole { Getter, Setter, Resetter }; - enum { NumFunctionRoles = Resetter + 1 }; + enum FunctionRole { Getter, Setter, Resetter, Notifier }; + enum { NumFunctionRoles = Notifier + 1 }; PropertyNode(InnerNode *parent, const QString& name); virtual ~PropertyNode() { } @@ -609,6 +609,7 @@ class PropertyNode : public LeafNode NodeList getters() const { return functions(Getter); } NodeList setters() const { return functions(Setter); } NodeList resetters() const { return functions(Resetter); } + NodeList notifiers() const { return functions(Notifier); } bool isStored() const { return fromTrool(sto, storedDefault()); } bool isDesignable() const { return fromTrool(des, designableDefault()); } const PropertyNode *overriddenFrom() const { return overrides; } diff --git a/tools/qdoc3/tree.cpp b/tools/qdoc3/tree.cpp index f832062..a5e22f1 100644 --- a/tools/qdoc3/tree.cpp +++ b/tools/qdoc3/tree.cpp @@ -485,6 +485,7 @@ void Tree::resolveProperties() QString getterName = (*propEntry)[PropertyNode::Getter]; QString setterName = (*propEntry)[PropertyNode::Setter]; QString resetterName = (*propEntry)[PropertyNode::Resetter]; + QString notifierName = (*propEntry)[PropertyNode::Notifier]; NodeList::ConstIterator c = parent->childNodes().begin(); while (c != parent->childNodes().end()) { @@ -499,6 +500,8 @@ void Tree::resolveProperties() property->addFunction(function, PropertyNode::Setter); } else if (function->name() == resetterName) { property->addFunction(function, PropertyNode::Resetter); + } else if (function->name() == notifierName) { + property->addFunction(function, PropertyNode::Notifier); } } } -- cgit v0.12 From 4fe7c464be95fbbcb663a21f9519024486123248 Mon Sep 17 00:00:00 2001 From: hjk Date: Mon, 10 Aug 2009 11:26:01 +0200 Subject: Compile fix with namespaces --- examples/statemachine/rogue/window.h | 2 ++ src/corelib/kernel/qeventdispatcher_unix.cpp | 2 +- src/corelib/tools/qsharedpointer.cpp | 10 ++++++++++ src/gui/graphicsview/qgraphicstransform_p.h | 4 ++++ src/gui/image/qimagepixmapcleanuphooks.cpp | 3 +++ src/network/access/qnetworkcookie.h | 6 +++--- 6 files changed, 23 insertions(+), 4 deletions(-) diff --git a/examples/statemachine/rogue/window.h b/examples/statemachine/rogue/window.h index bcd86bd..1df566d 100644 --- a/examples/statemachine/rogue/window.h +++ b/examples/statemachine/rogue/window.h @@ -44,9 +44,11 @@ #include +QT_BEGIN_NAMESPACE class QState; class QStateMachine; class QTransition; +QT_END_NAMESPACE #define WIDTH 35 #define HEIGHT 20 diff --git a/src/corelib/kernel/qeventdispatcher_unix.cpp b/src/corelib/kernel/qeventdispatcher_unix.cpp index 7982d4c..da15148 100644 --- a/src/corelib/kernel/qeventdispatcher_unix.cpp +++ b/src/corelib/kernel/qeventdispatcher_unix.cpp @@ -627,7 +627,7 @@ QEventDispatcherUNIX::~QEventDispatcherUNIX() int QEventDispatcherUNIX::select(int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, timeval *timeout) { - return ::qt_safe_select(nfds, readfds, writefds, exceptfds, timeout); + return qt_safe_select(nfds, readfds, writefds, exceptfds, timeout); } /*! diff --git a/src/corelib/tools/qsharedpointer.cpp b/src/corelib/tools/qsharedpointer.cpp index f18dee8..cdb7d1d 100644 --- a/src/corelib/tools/qsharedpointer.cpp +++ b/src/corelib/tools/qsharedpointer.cpp @@ -867,6 +867,8 @@ #if !defined(QT_NO_QOBJECT) #include "../kernel/qobject_p.h" +QT_BEGIN_NAMESPACE + /*! \internal This function is called for a just-created QObject \a obj, to enable @@ -910,6 +912,9 @@ QtSharedPointer::ExternalRefCountData *QtSharedPointer::ExternalRefCountData::ge } return d->sharedRefcount; } + +QT_END_NAMESPACE + #endif @@ -932,6 +937,8 @@ QtSharedPointer::ExternalRefCountData *QtSharedPointer::ExternalRefCountData::ge # include # include +QT_BEGIN_NAMESPACE + static inline QByteArray saveBacktrace() __attribute__((always_inline)); static inline QByteArray saveBacktrace() { @@ -992,6 +999,9 @@ static void printBacktrace(QByteArray stacktrace) waitpid(child, 0, 0); } } + +QT_END_NAMESPACE + # endif // BACKTRACE_SUPPORTED namespace { diff --git a/src/gui/graphicsview/qgraphicstransform_p.h b/src/gui/graphicsview/qgraphicstransform_p.h index 2d36eda..467021f 100644 --- a/src/gui/graphicsview/qgraphicstransform_p.h +++ b/src/gui/graphicsview/qgraphicstransform_p.h @@ -55,6 +55,8 @@ #include "private/qobject_p.h" +QT_BEGIN_NAMESPACE + class QGraphicsItem; class QGraphicsTransformPrivate : public QObjectPrivate { @@ -70,4 +72,6 @@ public: static void updateItem(QGraphicsItem *item); }; +QT_END_NAMESPACE + #endif // QGRAPHICSTRANSFORM_P_H diff --git a/src/gui/image/qimagepixmapcleanuphooks.cpp b/src/gui/image/qimagepixmapcleanuphooks.cpp index 7d1c5fb..789700a 100644 --- a/src/gui/image/qimagepixmapcleanuphooks.cpp +++ b/src/gui/image/qimagepixmapcleanuphooks.cpp @@ -43,6 +43,8 @@ #include "qpixmapdata_p.h" +QT_BEGIN_NAMESPACE + // Legacy, single instance hooks: ### Qt 5: remove typedef void (*_qt_pixmap_cleanup_hook)(int); typedef void (*_qt_pixmap_cleanup_hook_64)(qint64); @@ -108,3 +110,4 @@ void QImagePixmapCleanupHooks::executeImageHooks(qint64 key) qt_image_cleanup_hook_64(key); } +QT_END_NAMESPACE diff --git a/src/network/access/qnetworkcookie.h b/src/network/access/qnetworkcookie.h index ef309a8..4bc3f3f 100644 --- a/src/network/access/qnetworkcookie.h +++ b/src/network/access/qnetworkcookie.h @@ -106,9 +106,6 @@ private: }; Q_DECLARE_TYPEINFO(QNetworkCookie, Q_MOVABLE_TYPE); -// ### Qt5 remove this include -#include "qnetworkcookiejar.h" - #ifndef QT_NO_DEBUG_STREAM class QDebug; Q_NETWORK_EXPORT QDebug operator<<(QDebug, const QNetworkCookie &); @@ -116,6 +113,9 @@ Q_NETWORK_EXPORT QDebug operator<<(QDebug, const QNetworkCookie &); QT_END_NAMESPACE +// ### Qt5 remove this include +#include "qnetworkcookiejar.h" + Q_DECLARE_METATYPE(QNetworkCookie) Q_DECLARE_METATYPE(QList) -- cgit v0.12 From cbf60a676402eebae558568a2da4574a20f7a27e Mon Sep 17 00:00:00 2001 From: hjk Date: Mon, 10 Aug 2009 15:10:22 +0200 Subject: Compile fix for QStringBuilder auto test --- tests/auto/qstringbuilder/scenario1.pro | 1 + tests/auto/qstringbuilder/scenario2.pro | 1 + tests/auto/qstringbuilder/scenario3.pro | 1 + tests/auto/qstringbuilder/scenario4.pro | 1 + tests/auto/qstringbuilder/tst_qstringbuilder.cpp | 11 +---- tests/auto/qstringbuilder/tst_qstringbuilder.h | 55 ++++++++++++++++++++++++ 6 files changed, 60 insertions(+), 10 deletions(-) create mode 100644 tests/auto/qstringbuilder/tst_qstringbuilder.h diff --git a/tests/auto/qstringbuilder/scenario1.pro b/tests/auto/qstringbuilder/scenario1.pro index 4ce7156..d72451c 100644 --- a/tests/auto/qstringbuilder/scenario1.pro +++ b/tests/auto/qstringbuilder/scenario1.pro @@ -3,6 +3,7 @@ load(qttest_p4) QT = core SOURCES += scenario1.cpp +HEADERS += tst_qstringbuilder.h DEFINES += SCENARIO=1 diff --git a/tests/auto/qstringbuilder/scenario2.pro b/tests/auto/qstringbuilder/scenario2.pro index 64c46e2..78e0c68 100644 --- a/tests/auto/qstringbuilder/scenario2.pro +++ b/tests/auto/qstringbuilder/scenario2.pro @@ -3,5 +3,6 @@ load(qttest_p4) QT = core SOURCES += scenario2.cpp +HEADERS += tst_qstringbuilder.h DEFINES += SCENARIO=2 diff --git a/tests/auto/qstringbuilder/scenario3.pro b/tests/auto/qstringbuilder/scenario3.pro index beedffd..7b9e5af 100644 --- a/tests/auto/qstringbuilder/scenario3.pro +++ b/tests/auto/qstringbuilder/scenario3.pro @@ -3,5 +3,6 @@ load(qttest_p4) QT = core SOURCES += scenario3.cpp +HEADERS += tst_qstringbuilder.h DEFINES += SCENARIO=3 diff --git a/tests/auto/qstringbuilder/scenario4.pro b/tests/auto/qstringbuilder/scenario4.pro index 1c45a70..1b62b25 100644 --- a/tests/auto/qstringbuilder/scenario4.pro +++ b/tests/auto/qstringbuilder/scenario4.pro @@ -3,5 +3,6 @@ load(qttest_p4) QT = core SOURCES += scenario4.cpp +HEADERS += tst_qstringbuilder.h DEFINES += SCENARIO=4 diff --git a/tests/auto/qstringbuilder/tst_qstringbuilder.cpp b/tests/auto/qstringbuilder/tst_qstringbuilder.cpp index 72889bc..86f6ada 100644 --- a/tests/auto/qstringbuilder/tst_qstringbuilder.cpp +++ b/tests/auto/qstringbuilder/tst_qstringbuilder.cpp @@ -86,20 +86,13 @@ #endif #include +#include "tst_qstringbuilder.h" //TESTED_CLASS=QStringBuilder //TESTED_FILES=qstringbuilder.cpp #define LITERAL "some literal" -class tst_QStringBuilder : public QObject -{ - Q_OBJECT - -private slots: - void scenario(); -}; - void tst_QStringBuilder::scenario() { QLatin1Literal l1literal(LITERAL); @@ -138,5 +131,3 @@ void tst_QStringBuilder::scenario() } QTEST_APPLESS_MAIN(tst_QStringBuilder) - -#include "tst_qstringbuilder.moc" diff --git a/tests/auto/qstringbuilder/tst_qstringbuilder.h b/tests/auto/qstringbuilder/tst_qstringbuilder.h new file mode 100644 index 0000000..92c66d8 --- /dev/null +++ b/tests/auto/qstringbuilder/tst_qstringbuilder.h @@ -0,0 +1,55 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at http://www.qtsoftware.com/contact. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef TST_QSTRINGBUILDER_H +#define TST_QSTRINGBUILDER_H + +#include + +class tst_QStringBuilder : public QObject +{ + Q_OBJECT + +private slots: + void scenario(); +}; + +#endif -- cgit v0.12 From 56f58a397ace5985571995ddfce98a99c490ebf8 Mon Sep 17 00:00:00 2001 From: "Bradley T. Hughes" Date: Mon, 10 Aug 2009 15:45:02 +0200 Subject: Removed unused member in QApplicationPrivate The appAllTouchPoints variable isn't used on Windows, remove it. --- src/gui/kernel/qapplication_p.h | 1 - 1 file changed, 1 deletion(-) diff --git a/src/gui/kernel/qapplication_p.h b/src/gui/kernel/qapplication_p.h index 9953907..f809672 100644 --- a/src/gui/kernel/qapplication_p.h +++ b/src/gui/kernel/qapplication_p.h @@ -527,7 +527,6 @@ public: static PtrCloseTouchInputHandle CloseTouchInputHandle; QHash touchInputIDToTouchPointID; - QList appAllTouchPoints; bool translateTouchEvent(const MSG &msg); PtrGetGestureInfo GetGestureInfo; -- cgit v0.12 From 24aa36349b9fc0be9d9bf80b0db607588e0a54f6 Mon Sep 17 00:00:00 2001 From: Volker Hilsheimer Date: Mon, 10 Aug 2009 15:50:43 +0200 Subject: Doc: Fix qdoc warnings --- src/gui/kernel/qgesture.cpp | 2 +- src/testlib/qabstracttestlogger.cpp | 4 +++- src/testlib/qbenchmark.cpp | 8 +++++++- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/gui/kernel/qgesture.cpp b/src/gui/kernel/qgesture.cpp index 38e8851..672fc1c 100644 --- a/src/gui/kernel/qgesture.cpp +++ b/src/gui/kernel/qgesture.cpp @@ -204,7 +204,7 @@ Qt::GestureState QGesture::state() const \a state, and it should be called after all the internal properties have been initialized. - \sa started, triggered, finished, cancelled + \sa started(), triggered(), finished(), cancelled() */ void QGesture::updateState(Qt::GestureState state) { diff --git a/src/testlib/qabstracttestlogger.cpp b/src/testlib/qabstracttestlogger.cpp index 2fa535e..6b4b375 100644 --- a/src/testlib/qabstracttestlogger.cpp +++ b/src/testlib/qabstracttestlogger.cpp @@ -114,7 +114,9 @@ namespace QTest extern void filter_unprintable(char *str); -/*! \internal +/*! + \fn int QTest::qt_asprintf(QTestCharBuffer *buf, const char *format, ...); + \internal */ int qt_asprintf(QTestCharBuffer *str, const char *format, ...) { diff --git a/src/testlib/qbenchmark.cpp b/src/testlib/qbenchmark.cpp index bad3379..eaec02f 100644 --- a/src/testlib/qbenchmark.cpp +++ b/src/testlib/qbenchmark.cpp @@ -179,11 +179,17 @@ void QBenchmarkTestMethodData::setResult(qint64 value) QBenchmarkResult(QBenchmarkGlobalData::current->context, value, iterationCount); } -/*! \internal +/*! + \class QTest::QBenchmarkIterationController + \internal + The QBenchmarkIterationController class is used by the QBENCHMARK macro to drive the benchmarking loop. It is repsonsible for starting and stopping the timing measurements as well as calling the result reporting functions. */ + +/*! \internal +*/ QTest::QBenchmarkIterationController::QBenchmarkIterationController(RunMode runMode) { QTest::beginBenchmarkMeasurement(); -- cgit v0.12 From 0c98e05dfeccdca99bc180ccccd04b38305ad025 Mon Sep 17 00:00:00 2001 From: hjk Date: Mon, 10 Aug 2009 16:07:33 +0200 Subject: Compile fix on Linux. Reviewed-by: brad The declaration of getQApplicationPrivateInternal was only available as 'friend' on Q_WS_WIN. --- src/gui/kernel/qapplication.h | 4 ---- src/gui/kernel/qapplication_win.cpp | 11 +++-------- src/gui/kernel/qstandardgestures.cpp | 8 ++++---- 3 files changed, 7 insertions(+), 16 deletions(-) diff --git a/src/gui/kernel/qapplication.h b/src/gui/kernel/qapplication.h index 19ae085..58e0cc3 100644 --- a/src/gui/kernel/qapplication.h +++ b/src/gui/kernel/qapplication.h @@ -375,10 +375,6 @@ private: friend class QDirectPainterPrivate; #endif -#if defined(Q_WS_WIN) - friend QApplicationPrivate* getQApplicationPrivateInternal(); -#endif - #if defined(Q_WS_MAC) || defined(Q_WS_X11) Q_PRIVATE_SLOT(d_func(), void _q_alertTimeOut()) #endif diff --git a/src/gui/kernel/qapplication_win.cpp b/src/gui/kernel/qapplication_win.cpp index cb67409..d5448db 100644 --- a/src/gui/kernel/qapplication_win.cpp +++ b/src/gui/kernel/qapplication_win.cpp @@ -428,11 +428,6 @@ extern QCursor *qt_grab_cursor(); #define __export #endif -QApplicationPrivate* getQApplicationPrivateInternal() -{ - return qApp->d_func(); -} - extern "C" LRESULT CALLBACK QtWndProc(HWND, UINT, WPARAM, LPARAM); class QETWidget : public QWidget // event translator widget @@ -1461,7 +1456,7 @@ LRESULT CALLBACK QtWndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam // we receive the message for each toplevel window included internal hidden ones, // but the aboutToQuit signal should be emitted only once. - QApplicationPrivate *qAppPriv = getQApplicationPrivateInternal(); + QApplicationPrivate *qAppPriv = QApplicationPrivate::instance(); if (endsession && !qAppPriv->aboutToQuitEmitted) { qAppPriv->aboutToQuitEmitted = true; int index = QApplication::staticMetaObject.indexOfSignal("aboutToQuit()"); @@ -1648,7 +1643,7 @@ LRESULT CALLBACK QtWndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam } else { switch (message) { case WM_TOUCH: - result = getQApplicationPrivateInternal()->translateTouchEvent(msg); + result = QApplicationPrivate::instance()->translateTouchEvent(msg); break; case WM_KEYDOWN: // keyboard event case WM_SYSKEYDOWN: @@ -3719,7 +3714,7 @@ bool QETWidget::translateGestureEvent(const MSG &msg) memset(&gi, 0, sizeof(GESTUREINFO)); gi.cbSize = sizeof(GESTUREINFO); - QApplicationPrivate *qAppPriv = getQApplicationPrivateInternal(); + QApplicationPrivate *qAppPriv = QApplicationPrivate::instance(); BOOL bResult = qAppPriv->GetGestureInfo((HANDLE)msg.lParam, &gi); if (bResult) { const QPoint widgetPos = QPoint(gi.ptsLocation.x, gi.ptsLocation.y); diff --git a/src/gui/kernel/qstandardgestures.cpp b/src/gui/kernel/qstandardgestures.cpp index ac03cd2..b4c3787 100644 --- a/src/gui/kernel/qstandardgestures.cpp +++ b/src/gui/kernel/qstandardgestures.cpp @@ -293,7 +293,7 @@ QPinchGesture::QPinchGesture(QWidget *parent) : QGesture(*new QPinchGesturePrivate, parent) { if (parent) { - QApplicationPrivate *qAppPriv = getQApplicationPrivateInternal(); + QApplicationPrivate *qAppPriv = QApplicationPrivate::instance(); qAppPriv->widgetGestures[parent].pinch = this; #ifdef Q_WS_WIN qt_widget_private(parent)->winSetupGestures(); @@ -307,7 +307,7 @@ bool QPinchGesture::event(QEvent *event) switch (event->type()) { case QEvent::ParentAboutToChange: if (QWidget *w = qobject_cast(parent())) { - getQApplicationPrivateInternal()->widgetGestures[w].pinch = 0; + QApplicationPrivate::instance()->widgetGestures[w].pinch = 0; #ifdef Q_WS_WIN qt_widget_private(w)->winSetupGestures(); #endif @@ -315,7 +315,7 @@ bool QPinchGesture::event(QEvent *event) break; case QEvent::ParentChange: if (QWidget *w = qobject_cast(parent())) { - getQApplicationPrivateInternal()->widgetGestures[w].pinch = this; + QApplicationPrivate::instance()->widgetGestures[w].pinch = this; #ifdef Q_WS_WIN qt_widget_private(w)->winSetupGestures(); #endif @@ -333,7 +333,7 @@ bool QPinchGesture::eventFilter(QObject *receiver, QEvent *event) Q_D(QPinchGesture); if (receiver->isWidgetType() && event->type() == QEvent::NativeGesture) { QNativeGestureEvent *ev = static_cast(event); - QApplicationPrivate *qAppPriv = getQApplicationPrivateInternal(); + QApplicationPrivate *qAppPriv = QApplicationPrivate::instance(); QApplicationPrivate::WidgetStandardGesturesMap::iterator it; it = qAppPriv->widgetGestures.find(static_cast(receiver)); if (it == qAppPriv->widgetGestures.end()) -- cgit v0.12 From eeb206d41d386d4d3dee1ff2813d132d15f670d0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Trond=20Kjern=C3=A5sen?= Date: Mon, 10 Aug 2009 16:16:16 +0200 Subject: Compile and work on Linux. Reviewed-by: Kim --- tests/arthur/lance/main.cpp | 2 +- tests/arthur/lance/widgets.h | 39 +++++++++++++++++++++------------------ 2 files changed, 22 insertions(+), 19 deletions(-) diff --git a/tests/arthur/lance/main.cpp b/tests/arthur/lance/main.cpp index f95b426..0c9f3d8 100644 --- a/tests/arthur/lance/main.cpp +++ b/tests/arthur/lance/main.cpp @@ -271,7 +271,7 @@ int main(int argc, char **argv) QString format = QString(argv[++i]).toLower(); imageFormat = QImage::Format_Invalid; - static const unsigned int formatCount = + static const int formatCount = sizeof(imageFormats) / sizeof(imageFormats[0]); for (int ff = 0; ff < formatCount; ++ff) { if (QLatin1String(imageFormats[ff].name) == format) { diff --git a/tests/arthur/lance/widgets.h b/tests/arthur/lance/widgets.h index 7247608..61691dc 100644 --- a/tests/arthur/lance/widgets.h +++ b/tests/arthur/lance/widgets.h @@ -56,6 +56,9 @@ #include #include #include +#include +#include + #include @@ -96,8 +99,8 @@ public: OnScreenWidget(const QString &file, QWidget *parent = 0) : T(parent), - m_view_mode(RenderView), - m_filename(file) + m_filename(file), + m_view_mode(RenderView) { QSettings settings("Trolltech", "lance"); for (int i=0; i<10; ++i) { @@ -117,36 +120,36 @@ public: } if (m_baseline.isNull()) { - setWindowTitle("Rendering: '" + file + "'. No baseline available"); + T::setWindowTitle("Rendering: '" + file + "'. No baseline available"); } else { - setWindowTitle("Rendering: '" + file + "'. Shortcuts: 1=render, 2=baseline, 3=difference"); + T::setWindowTitle("Rendering: '" + file + "'. Shortcuts: 1=render, 2=baseline, 3=difference"); StupidWorkaround *workaround = new StupidWorkaround(this, &m_view_mode); QSignalMapper *mapper = new QSignalMapper(this); - connect(mapper, SIGNAL(mapped(int)), workaround, SLOT(setViewMode(int))); - connect(mapper, SIGNAL(mapped(QString)), this, SLOT(setWindowTitle(QString))); + T::connect(mapper, SIGNAL(mapped(int)), workaround, SLOT(setViewMode(int))); + T::connect(mapper, SIGNAL(mapped(QString)), this, SLOT(setWindowTitle(QString))); QAction *renderViewAction = new QAction("Render View", this); renderViewAction->setShortcut(Qt::Key_1); - connect(renderViewAction, SIGNAL(triggered()), mapper, SLOT(map())); + T::connect(renderViewAction, SIGNAL(triggered()), mapper, SLOT(map())); mapper->setMapping(renderViewAction, RenderView); mapper->setMapping(renderViewAction, "Render View: " + file); - addAction(renderViewAction); + T::addAction(renderViewAction); QAction *baselineAction = new QAction("Baseline", this); baselineAction->setShortcut(Qt::Key_2); - connect(baselineAction, SIGNAL(triggered()), mapper, SLOT(map())); + T::connect(baselineAction, SIGNAL(triggered()), mapper, SLOT(map())); mapper->setMapping(baselineAction, BaselineView); mapper->setMapping(baselineAction, "Baseline View: " + file); - addAction(baselineAction); + T::addAction(baselineAction); QAction *differenceAction = new QAction("Differenfe View", this); differenceAction->setShortcut(Qt::Key_3); - connect(differenceAction, SIGNAL(triggered()), mapper, SLOT(map())); + T::connect(differenceAction, SIGNAL(triggered()), mapper, SLOT(map())); mapper->setMapping(differenceAction, DifferenceView); mapper->setMapping(differenceAction, "Difference View" + file); - addAction(differenceAction); + T::addAction(differenceAction); } @@ -178,7 +181,7 @@ public: } } - void OnScreenWidget::paintRenderView() + void paintRenderView() { QPainter pt; QPaintDevice *dev = this; @@ -233,7 +236,7 @@ public: } if (m_render_view.isNull()) { - m_render_view = window()->windowSurface()->grabWidget(this); + m_render_view = T::window()->windowSurface()->grabWidget(this); m_render_view.save("renderView.png"); } } @@ -242,7 +245,7 @@ public: QPainter p(this); if (m_baseline.isNull()) { - p.drawText(rect(), Qt::AlignCenter, + p.drawText(T::rect(), Qt::AlignCenter, "No baseline found\n" "file '" + m_baseline_name + "' does not exist..."); return; @@ -258,7 +261,7 @@ public: QPixmap generateDifference() { - QImage img(size(), QImage::Format_RGB32); + QImage img(T::size(), QImage::Format_RGB32); img.fill(0); QPainter p(&img); @@ -275,13 +278,13 @@ public: void paintDifferenceView() { QPainter p(this); if (m_baseline.isNull()) { - p.drawText(rect(), Qt::AlignCenter, + p.drawText(T::rect(), Qt::AlignCenter, "No baseline found\n" "file '" + m_baseline_name + "' does not exist..."); return; } - p.fillRect(rect(), Qt::black); + p.fillRect(T::rect(), Qt::black); p.drawPixmap(0, 0, generateDifference()); } -- cgit v0.12 From 9c4ed99ede2de8dae005cef9a6c519e2b561a54f Mon Sep 17 00:00:00 2001 From: Thierry Bastian Date: Mon, 10 Aug 2009 16:15:03 +0200 Subject: Fixed a possible problem when unplugging a QToolBar The 'break' statement was misplaced... This was found thanks to coverity --- src/gui/widgets/qtoolbararealayout.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/widgets/qtoolbararealayout.cpp b/src/gui/widgets/qtoolbararealayout.cpp index b4a0ef0..afd526a 100644 --- a/src/gui/widgets/qtoolbararealayout.cpp +++ b/src/gui/widgets/qtoolbararealayout.cpp @@ -1156,8 +1156,8 @@ QLayoutItem *QToolBarAreaLayout::unplug(const QList &path, QToolBarAreaLayo if (!next.skip()) { newExtraSpace = next.pos - previous.pos - pick(line.o, previous.sizeHint()); previous.resize(line.o, next.pos - previous.pos); + break; } - break; } break; } -- cgit v0.12 From f4dba5394f6772a61af56fd25052e29a44de89ed Mon Sep 17 00:00:00 2001 From: David Boddie Date: Mon, 10 Aug 2009 16:27:51 +0200 Subject: Doc: Clarified the behavior of QDir::exists(). Task-number: 259091 Reviewed-by: Trust Me --- src/corelib/io/qdir.cpp | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src/corelib/io/qdir.cpp b/src/corelib/io/qdir.cpp index 072eb27..cb0fdeb 100644 --- a/src/corelib/io/qdir.cpp +++ b/src/corelib/io/qdir.cpp @@ -1541,9 +1541,11 @@ bool QDir::isReadable() const /*! \overload - Returns true if the \e directory exists; otherwise returns false. - (If a file with the same name is found this function will return - false). + Returns true if the directory exists; otherwise returns false. + (If a file with the same name is found this function will return false). + + The overload of this function that accepts an argument is used to test + for the presence of files and directories within a directory. \sa QFileInfo::exists(), QFile::exists() */ @@ -1773,8 +1775,11 @@ bool QDir::rename(const QString &oldName, const QString &newName) /*! Returns true if the file called \a name exists; otherwise returns - false. Unless \a name contains an absolute file path, the file - name is assumed to be relative to the current directory. + false. + + Unless \a name contains an absolute file path, the file name is assumed + to be relative to the directory itself, so this function is typically used + to check for the presence of files within a directory. \sa QFileInfo::exists(), QFile::exists() */ -- cgit v0.12 From a4b6a5ccf5146dc5fbe2b8363b4c6fb73a8d975e Mon Sep 17 00:00:00 2001 From: Volker Hilsheimer Date: Mon, 10 Aug 2009 16:33:25 +0200 Subject: Doc: add \since 4.6 for new functions --- src/corelib/kernel/qmetaobject.cpp | 2 ++ src/testlib/qtestcase.cpp | 1 + 2 files changed, 3 insertions(+) diff --git a/src/corelib/kernel/qmetaobject.cpp b/src/corelib/kernel/qmetaobject.cpp index d43c5dd..f153c7e 100644 --- a/src/corelib/kernel/qmetaobject.cpp +++ b/src/corelib/kernel/qmetaobject.cpp @@ -2488,6 +2488,7 @@ bool QMetaProperty::isUser(const QObject *object) const } /*! + \since 4.6 Returns true if the property is constant; otherwise returns false. A property is constant if the \c{Q_PROPERTY()}'s \c CONSTANT attribute @@ -2502,6 +2503,7 @@ bool QMetaProperty::isConstant() const } /*! + \since 4.6 Returns true if the property is final; otherwise returns false. A property is final if the \c{Q_PROPERTY()}'s \c FINAL attribute diff --git a/src/testlib/qtestcase.cpp b/src/testlib/qtestcase.cpp index 21a686e..51e767c 100644 --- a/src/testlib/qtestcase.cpp +++ b/src/testlib/qtestcase.cpp @@ -353,6 +353,7 @@ QT_BEGIN_NAMESPACE /*! \macro QBENCHMARK_ONCE + \since 4.6 \relates QTest -- cgit v0.12 From 724d7721331b444a6dd817cd4e12909a2cae709a Mon Sep 17 00:00:00 2001 From: David Boddie Date: Mon, 10 Aug 2009 16:34:12 +0200 Subject: Doc: Fixed spelling mistake and some acronyms. Task-number: 259268 Reviewed-by: Trust Me --- src/network/access/qhttp.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/network/access/qhttp.cpp b/src/network/access/qhttp.cpp index faa2398..4c06848 100644 --- a/src/network/access/qhttp.cpp +++ b/src/network/access/qhttp.cpp @@ -1597,11 +1597,11 @@ QHttp::~QHttp() This enum is used to specify the mode of connection to use: - \value ConnectionModeHttp The connection is a regular Http connection to the server - \value ConnectionModeHttps The Https protocol is used and the connection is encrypted using SSL. + \value ConnectionModeHttp The connection is a regular HTTP connection to the server + \value ConnectionModeHttps The HTTPS protocol is used and the connection is encrypted using SSL. - When using the Https mode, care should be taken to connect to the sslErrors signal, and - handle possible Ssl errors. + When using the HTTPS mode, care should be taken to connect to the sslErrors signal, and + handle possible SSL errors. \sa QSslSocket */ @@ -2039,7 +2039,7 @@ int QHttp::setHost(const QString &hostName, quint16 port) port \a port using the connection mode \a mode. If port is 0, it will use the default port for the \a mode used - (80 for Http and 443 fopr Https). + (80 for HTTP and 443 for HTTPS). The function does not block; instead, it returns immediately. The request is scheduled, and its execution is performed asynchronously. The -- cgit v0.12 From 41537bb8ea6f6174690d244a1cc07678f4bf4229 Mon Sep 17 00:00:00 2001 From: Kent Hansen Date: Mon, 10 Aug 2009 16:47:41 +0200 Subject: fix issues reported by Coverity --- src/corelib/statemachine/qhistorystate.cpp | 4 +--- src/corelib/statemachine/qstate_p.h | 2 +- src/corelib/statemachine/qstatemachine.cpp | 1 + 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/src/corelib/statemachine/qhistorystate.cpp b/src/corelib/statemachine/qhistorystate.cpp index e5ca837..d21eee9 100644 --- a/src/corelib/statemachine/qhistorystate.cpp +++ b/src/corelib/statemachine/qhistorystate.cpp @@ -120,7 +120,7 @@ QT_BEGIN_NAMESPACE */ QHistoryStatePrivate::QHistoryStatePrivate() - : defaultState(0) + : defaultState(0), historyType(QHistoryState::ShallowHistory) { } @@ -135,8 +135,6 @@ QHistoryStatePrivate *QHistoryStatePrivate::get(QHistoryState *q) QHistoryState::QHistoryState(QState *parent) : QAbstractState(*new QHistoryStatePrivate, parent) { - Q_D(QHistoryState); - d->historyType = ShallowHistory; } /*! Constructs a new history state of the given \a type, with the given \a diff --git a/src/corelib/statemachine/qstate_p.h b/src/corelib/statemachine/qstate_p.h index 20eb5ea..c43a26c 100644 --- a/src/corelib/statemachine/qstate_p.h +++ b/src/corelib/statemachine/qstate_p.h @@ -64,7 +64,7 @@ QT_BEGIN_NAMESPACE struct QPropertyAssignment { QPropertyAssignment() - : object(0) {} + : object(0), explicitlySet(true) {} QPropertyAssignment(QObject *o, const QByteArray &n, const QVariant &v, bool es = true) : object(o), propertyName(n), value(v), explicitlySet(es) diff --git a/src/corelib/statemachine/qstatemachine.cpp b/src/corelib/statemachine/qstatemachine.cpp index 9cb1d4d..5926176 100644 --- a/src/corelib/statemachine/qstatemachine.cpp +++ b/src/corelib/statemachine/qstatemachine.cpp @@ -209,6 +209,7 @@ QStateMachinePrivate::QStateMachinePrivate() processing = false; processingScheduled = false; stop = false; + stopProcessingReason = EventQueueEmpty; error = QStateMachine::NoError; globalRestorePolicy = QStateMachine::DoNotRestoreProperties; signalEventGenerator = 0; -- cgit v0.12 From 66f26230a463fef12e8c95ea7819e476e038d4f8 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Mon, 10 Aug 2009 16:53:28 +0200 Subject: Linguist: Fixed spehling error. --- tools/linguist/linguist/mainwindow.cpp | 10 +++++----- tools/linguist/linguist/mainwindow.ui | 6 +++--- tools/linguist/linguist/messageeditor.cpp | 2 +- tools/linguist/linguist/messageeditor.h | 2 +- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/tools/linguist/linguist/mainwindow.cpp b/tools/linguist/linguist/mainwindow.cpp index bb79b19..22ff46a 100644 --- a/tools/linguist/linguist/mainwindow.cpp +++ b/tools/linguist/linguist/mainwindow.cpp @@ -482,9 +482,9 @@ MainWindow::MainWindow() readConfig(); m_statistics = 0; - connect(m_ui.actionLenghtVariants, SIGNAL(toggled(bool)), - m_messageEditor, SLOT(setLenghtVariants(bool))); - m_messageEditor->setLenghtVariants(m_ui.actionLenghtVariants->isChecked()); + connect(m_ui.actionLengthVariants, SIGNAL(toggled(bool)), + m_messageEditor, SLOT(setLengthVariants(bool))); + m_messageEditor->setLengthVariants(m_ui.actionLengthVariants->isChecked()); m_focusWatcher = new FocusWatcher(m_messageEditor, this); m_contextView->installEventFilter(m_focusWatcher); @@ -2521,7 +2521,7 @@ void MainWindow::readConfig() config.value(settingPath("Validators/PhraseMatch"), true).toBool()); m_ui.actionPlaceMarkerMatches->setChecked( config.value(settingPath("Validators/PlaceMarkers"), true).toBool()); - m_ui.actionLenghtVariants->setChecked( + m_ui.actionLengthVariants->setChecked( config.value(settingPath("Options/LengthVariants"), false).toBool()); recentFiles().readConfig(); @@ -2548,7 +2548,7 @@ void MainWindow::writeConfig() config.setValue(settingPath("Validators/PlaceMarkers"), m_ui.actionPlaceMarkerMatches->isChecked()); config.setValue(settingPath("Options/LengthVariants"), - m_ui.actionLenghtVariants->isChecked()); + m_ui.actionLengthVariants->isChecked()); config.setValue(settingPath("MainWindowState"), saveState()); recentFiles().writeConfig(); diff --git a/tools/linguist/linguist/mainwindow.ui b/tools/linguist/linguist/mainwindow.ui index 613241b..9dfb1ff 100644 --- a/tools/linguist/linguist/mainwindow.ui +++ b/tools/linguist/linguist/mainwindow.ui @@ -116,7 +116,7 @@ - + @@ -878,12 +878,12 @@ Ctrl+W - + true - Lenght Variants + Length Variants diff --git a/tools/linguist/linguist/messageeditor.cpp b/tools/linguist/linguist/messageeditor.cpp index 9e598a8..e911389 100644 --- a/tools/linguist/linguist/messageeditor.cpp +++ b/tools/linguist/linguist/messageeditor.cpp @@ -710,7 +710,7 @@ void MessageEditor::setEditingEnabled(int model, bool enabled) updateCanPaste(); } -void MessageEditor::setLenghtVariants(bool on) +void MessageEditor::setLengthVariants(bool on) { m_lengthVariants = on; foreach (const MessageEditorData &ed, m_editors) diff --git a/tools/linguist/linguist/messageeditor.h b/tools/linguist/linguist/messageeditor.h index 4106036..b195a04 100644 --- a/tools/linguist/linguist/messageeditor.h +++ b/tools/linguist/linguist/messageeditor.h @@ -110,7 +110,7 @@ public slots: void beginFromSource(); void setEditorFocus(); void setTranslation(int latestModel, const QString &translation); - void setLenghtVariants(bool on); + void setLengthVariants(bool on); private slots: void editorCreated(QTextEdit *); -- cgit v0.12 From cbd8a54f8c55e1982430fc929e9d74f977699428 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Mon, 10 Aug 2009 16:54:24 +0200 Subject: Translations: Purged and updated German of Assistant/Linguist/Help. --- translations/assistant_de.ts | 304 +++-------- translations/linguist_de.ts | 1180 +++++++----------------------------------- translations/qt_help_de.ts | 40 +- 3 files changed, 310 insertions(+), 1214 deletions(-) diff --git a/translations/assistant_de.ts b/translations/assistant_de.ts index f702465..ce32062 100644 --- a/translations/assistant_de.ts +++ b/translations/assistant_de.ts @@ -52,11 +52,11 @@ Neuer Ordner - + - - - + + + Bookmarks Lesezeichen @@ -66,7 +66,7 @@ + - + Delete Folder Ordner löschen @@ -79,12 +79,12 @@ BookmarkManager - + Bookmarks Lesezeichen - + Remove Entfernen @@ -94,7 +94,7 @@ Wenn Sie diesen Ordner löschen, wird auch<br>dessen kompletter Inhalt gelöscht. Möchten Sie wirklich fortfahren? - + New Folder Neuer Ordner @@ -103,25 +103,17 @@ BookmarkWidget - + Filter: Filter: - Bookmarks - Lesezeichen - - - + Remove Entfernen - You are going to delete a Folder, this will also<br>remove it's content. Are you sure to continue? - Wenn Sie dieses Verzeichnis löschen, wird auch<br>dessen kompletter Inhalt gelöscht! Fortfahren? - - - + Delete Folder Ordner löschen @@ -151,11 +143,7 @@ Lesezeichen umbenennen - Search for: - Suchen: - - - + Add Hinzufügen @@ -163,7 +151,7 @@ CentralWidget - + Add new page Neue Seite hinzufügen @@ -173,7 +161,7 @@ Aktuelle Seite schließen - + Print Document Drucken @@ -184,7 +172,7 @@ unbekannt - + Add New Page Neue Seite hinzufügen @@ -204,7 +192,7 @@ Lesezeichen für diese Seite hinzufügen ... - + Search Suchen @@ -212,7 +200,7 @@ ContentWindow - + Open Link Link öffnen @@ -225,10 +213,6 @@ FilterNameDialogClass - FilterNameDialog - FilterNameDialog - - Add Filter Name Filternamen hinzufügen @@ -242,7 +226,7 @@ FindWidget - + Previous Zurück @@ -303,12 +287,6 @@ Hilfe - Unable to launch web browser. - - Der Webbrowser konnte nicht gestarted werden. - - - OK OK @@ -362,13 +340,13 @@ InstallDialog - + Install Documentation Dokumentation installieren - + Downloading documentation info... Dokumentationsinformation herunterladen ... @@ -462,20 +440,20 @@ MainWindow - - + + Index Index - - + + Contents Inhalt - - + + Bookmarks Lesezeichen @@ -485,24 +463,20 @@ Suchen - - - + + + Qt Assistant Qt Assistant - + Unfiltered Ohne Filter - File - Datei - - - + Page Set&up... S&eite einrichten ... @@ -517,111 +491,62 @@ &Drucken ... - CTRL+P - CTRL+P - - - + New &Tab Neuer &Tab - CTRL+T - CTRL+T - - &Close Tab Tab &schließen - CTRL+W - CTRL+W - - &Quit &Beenden - - CTRL+Q - CTRL+Q - - - Edit - Bearbeiten - - - + &Copy selected Text Ausgewählten Text &kopieren - Ctrl+C - Ctrl+C - - - + &Find in Text... &Textsuche ... - Ctrl+F - Ctrl+F - - - + Find &Next &Weitersuchen - F3 - F3 - - Find &Previous &Vorheriges suchen - Shift+F3 - Shift+F3 - - Preferences... Einstellungen ... - View - Ansicht - - Zoom &in &Vergrößern - Ctrl++ - Ctrl++ - - - + Zoom &out Ver&kleinern - Ctrl+- - Ctrl+- - - - + Normal &Size Standard&größe - + Ctrl+0 Ctrl+0 @@ -636,30 +561,17 @@ ALT+I - ALT+B - ALT+B - - ALT+S ALT+S - Go - Gehe - - &Home &Startseite - - Ctrl+Home - Ctrl+Home - - - + &Back &Rückwärts @@ -669,12 +581,12 @@ &Vorwärts - + Sync with Table of Contents Seite mit Inhalt-Tab abgleichen - + Next Page Nächste Seite @@ -699,15 +611,7 @@ Lesezeichen hinzufügen ... - CTRL+B - CTRL+B - - - Help - Hilfe - - - + About... Über ... @@ -747,38 +651,22 @@ Der zugehörige Inhaltseintrag konnte nicht gefunden werden. - Open Source Edition - Open Source Edition - - - This version of Qt Assistant is part of the Qt Open Source Edition, for use in the development of Open Source applications. Qt is a comprehensive C++ framework for cross-platform application development. - This version of Qt Assistant is part of the Qt Open Source Edition, for use in the development of Open Source applications. Qt is a comprehensive C++ framework for cross-platform application development. - - - You need a commercial Qt license for development of proprietary (closed source) applications. Please see <a href="http://qtsoftware.com/company/model.html">qtsoftware.com/company/model.html</a> for an overview of Qt licensing. - You need a commercial Qt license for development of proprietary (closed source) applications. Please see <a href="http://qtsoftware.com/company/model.html">qtsoftware.com/company/model.html</a> for an overview of Qt licensing. - - - This program is licensed to you under the terms of the Qt Commercial License Agreement. For details, see the file LICENSE that came with this software distribution. - This program is licensed to you under the terms of the Qt Commercial License Agreement. For details, see the file LICENSE that came with this software distribution. - - - + About %1 Über %1 - + Updating search index Suchindex wird aufgebaut - + Looking for Qt Documentation... Suche nach Qt-Dokumentation ... - + &Window &Fenster @@ -798,54 +686,47 @@ Zoom - Add - Hinzufügen - - - Remove - Entfernen - - - + &File &Datei - + &Edit &Bearbeiten - + &View &Ansicht - + &Go &Gehe zu + + ALT+Home + + + &Bookmarks &Lesezeichen - + &Help &Hilfe - You need a commercial Qt license for development of proprietary (closed source) applications. Please see <a href="http://qtsoftware.com/company/about/businessmodel">http://qtsoftware.com/company/about/businessmodel</a> for an overview of Qt licensing. - Sie benötigen eine kommerzielle Qt Lizenz für die Entwicklung von proprietären (geschlossenen) Anwendungen. Besuchen Sie <a href="http://qtsoftware.com/company/about/businessmodel">http://qtsoftware.com/company/about/businessmodel</a> um sich einen Überblick über die Qt Lizenzvergabe zu verschaffen. - - - + ALT+O ALT+O - + CTRL+D CTRL+D @@ -853,15 +734,7 @@ PreferencesDialog - From Local File System... - Von Dateisystem... - - - Download from Help Server... - Von Hilfe-Server herunterladen... - - - + Add Documentation Dokumentation hinzufügen @@ -902,7 +775,7 @@ OK - + Use custom settings Benutzerdefinierte Einstellungen verwenden @@ -980,22 +853,6 @@ Hinzufügen ... - Network - Netzwerk - - - Use Http Proxy - Http Proxy - - - Http Proxy: - Http Proxy: - - - Port: - Port: - - Options Einstellungen @@ -1015,14 +872,35 @@ Homepage Startseite + + + On help start: + Zu Beginn: + + + + Show my home page + Startseite zeigen + + + + Show a blank page + Leere Seite zeigen + + + + Show my tabs from last session + Reiter aus letzter Sitzung zeigen + + + + Blank Page + Leere Seite + QObject - New Folder - Neuer Ordner - - The specified collection file does not exist! Die angegebene Katalogdatei (collection file) kann nicht gefunden werden. @@ -1085,7 +963,7 @@ Qt Assistant - + Could not register documentation file %1 @@ -1128,12 +1006,6 @@ Grund: The specified collection file could not be read! Die angegebene Katalogdatei (collection file) kann nicht gelesen werden. - - - - Bookmark - Lesezeichen - RemoteControl @@ -1170,10 +1042,6 @@ Grund: Select All Alles markieren - - Open Link - Link öffnen - TopicChooser diff --git a/translations/linguist_de.ts b/translations/linguist_de.ts index 48f1f2e..8924b6e 100644 --- a/translations/linguist_de.ts +++ b/translations/linguist_de.ts @@ -2,24 +2,9 @@ - - - - (New Entry) - (Neuer Eintrag) - - - - @default - - (New Phrase) - (Neue Phrase) - - - AboutDialog - + Qt Linguist Qt Linguist @@ -76,11 +61,6 @@ - Note that the modified entries will be reset to unfinished if 'Set translated entries to finished' above is unchecked. - Beachten Sie, dass die geänderten Einträge in den Status 'unerledigt' zurückgesetzt werden, wenn 'Übersetzung als erledigt markieren' deaktiviert ist. - - - Translate also finished entries Erledigte Einträge übersetzen @@ -101,11 +81,6 @@ - The batch translator will search through the selected phrase books in the order given above. - Der automatische Übersetzer wird in der angegebenen Reihenfolge durch die ausgewählten Wörterbücher gehen. - - - &Run &Ausführen @@ -114,6 +89,16 @@ Cancel Abbrechen + + + Note that the modified entries will be reset to unfinished if 'Set translated entries to finished' above is unchecked + Geänderte Einträge werden als unerledigt gekennzeichnet, wenn die obige Einstellung 'Übersetzung als erledigt markieren' nicht aktiviert ist + + + + The batch translator will search through the selected phrase books in the order given above + Der automatische Übersetzer wird in der angegebenen Reihenfolge durch die ausgewählten Wörterbücher gehen + DataModel @@ -156,61 +141,6 @@ Es wird mit einer einfachen Universalform gearbeitet. - EditorPage - - Source text - Ursprungstext - - - This area shows the source text. - Dieser Bereich zeigt den Ursprungstext. - - - This area shows a comment that may guide you, and the context in which the text occurs. - Dieser Bereich zeigt eventuelle Kommentare und den Kontext, in dem der Text auftritt. - - - Existing %1 translation - Existierende Übersetzung %1 - - - Translation - Übersetzung - - - %1 translation - Übersetzung %1 - - - %1 translation (%2) - Übersetzung %1 (%2) - - - This is where you can enter or modify the translation of some source text. - Hier können Sie die Übersetzung des Ursprungstextes eingeben bzw. ändern. - - - German - Deutsch - - - Japanese - Japanisch - - - French - Französisch - - - Polish - Polnisch - - - Chinese - Chinesisch - - - ErrorsView @@ -251,19 +181,11 @@ Es wird mit einer einfachen Universalform gearbeitet. FindDialog - Qt Linguist - Qt Linguist - - This window allows you to search for some text in the translation source file. Dieses Fenster erlaubt die Suche in der Übersetzungsdatei. - Find what: - Suchen nach: - - Type in the text to search for. Geben Sie den Text ein, nach dem gesucht werden soll. @@ -279,37 +201,21 @@ Es wird mit einer einfachen Universalform gearbeitet. Wenn aktiviert, wird in den Ursprungstexten gesucht. - Source texts - Ursprungsstexte - - Translations are searched when checked. Wenn ausgewählt, wird in den Übersetzungen gesucht. - Translations - Übersetzungen - - Texts such as 'TeX' and 'tex' are considered as different when checked. Wenn aktiviert, werden Texte wie 'TeX' und 'tex' als unterschiedlich betrachtet. - Match case - Groß-/Kleinschreibung beachten - - Comments and contexts are searched when checked. Wenn ausgewählt, werden Kommentare und Kontextnamen durchsucht. - Comments - Kommentare - - Find Suchen @@ -365,10 +271,6 @@ Es wird mit einer einfachen Universalform gearbeitet. Abbrechen - Ignore accelerators - Kurztasten ignorieren - - Choose Edit|Find from the menu bar or press Ctrl+F to pop up the Find dialog @@ -376,16 +278,56 @@ Es wird mit einer einfachen Universalform gearbeitet. - FormHolder + FormMultiWidget + + + Alt+Delete + translate, but don't change + + + + + Shift+Alt+Insert + translate, but don't change + + + + + Alt+Insert + translate, but don't change + + + + + Confirmation - Qt Linguist + Bestätigung - Qt Linguist + - Preview Form - Vorschau + + Delete non-empty length variant? + Soll die ausgefüllte Längenvariante gelöscht werden? LRelease - + + Dropped %n message(s) which had no ID. + + Es wurde ein Eintrag ohne Bezeichner gelöscht. + Es wurde %n Einträge ohne Bezeichner gelöscht. + + + + + Excess context/disambiguation dropped from %n message(s). + + Es wurde überflüssiger Kontext beziehungsweise überflüssige Infomation zur Unterscheidung bei einem Eintrag entfernt. + Es wurde überflüssiger Kontext beziehungsweise überflüssige Infomation zur Unterscheidung bei %n Einträgen entfernt. + + + + Generated %n translation(s) (%1 finished and %2 unfinished) @@ -408,89 +350,6 @@ Es wird mit einer einfachen Universalform gearbeitet. - LanguagesDialog - - Open Translation File - Öffne Übersetzungsdatei - - - Qt translation sources (%1);;Qt translation sources (*.ts);;XLIFF localization files (*.xlf);;All files (*) - Qt Übersetzungsdateien (%1);;Qt Übersetzungsdateien (*.ts);;XLIFF Lokalisierungsdateien (*.xlf);;Alle Dateien (*) - - - Auxiliary Languages - Unterstützende Sprachen - - - Locale - Regionalschema - - - File - Datei - - - <html><head><meta name="qrichtext" content="1" /><style type="text/css"> -p, li { white-space: pre-wrap; } -</style></head><body style=" font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;"> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Move selected language up</p></body></html> - <html><head><meta name="qrichtext" content="1" /><style type="text/css"> -p, li { white-space: pre-wrap; } -</style></head><body style=" font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;"> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Bewege ausgewählte Sprache herauf</p></body></html> - - - up - Hoch - - - <html><head><meta name="qrichtext" content="1" /><style type="text/css"> -p, li { white-space: pre-wrap; } -</style></head><body style=" font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;"> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:8pt;">Move selected language down</p></body></html> - <html><head><meta name="qrichtext" content="1" /><style type="text/css"> -p, li { white-space: pre-wrap; } -</style></head><body style=" font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;"> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:8pt;">Bewege ausgewählte Sprache herunter</p></body></html> - - - down - Herunter - - - <html><head><meta name="qrichtext" content="1" /><style type="text/css"> -p, li { white-space: pre-wrap; } -</style></head><body style=" font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;"> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Remove selected language</p></body></html> - <html><head><meta name="qrichtext" content="1" /><style type="text/css"> -p, li { white-space: pre-wrap; } -</style></head><body style=" font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;"> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Entferne ausgewählte Sprache</p></body></html> - - - remove - Entfernen - - - <html><head><meta name="qrichtext" content="1" /><style type="text/css"> -p, li { white-space: pre-wrap; } -</style></head><body style=" font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;"> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Open auxiliary language files</p></body></html> - <html><head><meta name="qrichtext" content="1" /><style type="text/css"> -p, li { white-space: pre-wrap; } -</style></head><body style=" font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;"> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Öffne unterstützende Sprachen</p></body></html> - - - ... - ... - - - OK - OK - - - MainWindow @@ -538,10 +397,6 @@ p, li { white-space: pre-wrap; } &Werkzeugleisten - Too&ls - &Werkzeuge - - &Help &Hilfe @@ -557,19 +412,11 @@ p, li { white-space: pre-wrap; } &Datei - Re&cently Opened Files - &Zuletzt geöffnete Dateien - - &Edit &Bearbeiten - &New - &Neu - - &Open... Ö&ffnen ... @@ -612,51 +459,26 @@ p, li { white-space: pre-wrap; } - Previous unfinished item. - Vorheriger unerledigter Eintrag. - - - Move to the previous unfinished item. Zum vorherigen unerledigten Eintrag gehen. - Next unfinished item. - Nächster unerledigter Eintrag. - - - Move to the next unfinished item. Zum nächsten unerledigten Eintrag gehen. - Move to previous item. - Zum vorigen Eintrag gehen. - - - Move to the previous item. Zum vorigen Eintrag gehen. - Next item. - Nächster Eintrag. - - - Move to the next item. Zum nächsten Eintrag gehen. - Mark item as done and move to the next unfinished item. - Eintrag als erledigt markieren und zum nächsten unerledigten Eintrag gehen. - - - Mark this item as done and move to the next unfinished item. Diesen Eintrag als erledigt markieren und zum nächsten unerledigten Eintrag gehen. @@ -667,21 +489,11 @@ p, li { white-space: pre-wrap; } - Toggle the validity check of accelerators. - Prüfung der Tastenkürzel ein- bzw. ausschalten. - - - Toggle the validity check of accelerators, i.e. whether the number of ampersands in the source and translation text is the same. If the check fails, a message is shown in the warnings window. Die Prüfung der Tastenkürzel, das heißt, die Übereinstimmung der kaufmännischen Und-Zeichen in Quelle und Übersetzung ein- bzw. ausschalten. Bei Fehlschlag wird eine Warnung im Hinweis-Fenster angezeigt. - Toggle the validity check of ending punctuation. - Prüfung der Satzendezeichen am Ende des Textes ein- bzw. ausschalten. - - - Toggle the validity check of ending punctuation. If the check fails, a message is shown in the warnings window. Die Prüfung der Satzendezeichen am Ende des Textes ein- bzw. ausschalten. Bei Fehlschlag wird eine Warnung im Hinweis-Fenster angezeigt. @@ -692,11 +504,6 @@ p, li { white-space: pre-wrap; } - Toggle the validity check of place markers. - Prüfung der Platzhalter ein- bzw. ausschalten. - - - Toggle the validity check of place markers, i.e. whether %1, %2, ... are used consistently in the source text and translation text. If the check fails, a message is shown in the warnings window. Die Prüfung der Platzhalter, das heißt, ob %1, %2 usw. in Ursprungstext und Übersetzung übereinstimmend verwendet werden, ein- bzw. ausschalten. Bei Fehlschlag wird eine Warnung im Hinweis-Fenster angezeigt. @@ -716,14 +523,14 @@ p, li { white-space: pre-wrap; } Ctrl+S + - Save &As... Speichern &unter... - + Save As... Speichern unter ... @@ -748,10 +555,6 @@ p, li { white-space: pre-wrap; } &Drucken ... - Print a list of all the phrases in the current Qt translation source file. - Drucke die Liste aller Übersetzungen in der aktuellen Qt Übersetzungsdatei. - - Ctrl+P Ctrl+P @@ -762,10 +565,6 @@ p, li { white-space: pre-wrap; } &Rückgängig - Undo the last editing operation performed on the translation. - Mache die letzte Änderung an der Übersetzung rückgängig. - - Recently Opened &Files Zu&letzt bearbeitete Dateien @@ -916,10 +715,6 @@ p, li { white-space: pre-wrap; } Ctrl+W - Moves to the previous unfinished item. - Gehe zum letzten unerledigten Eintrag. - - Ctrl+K Ctrl+K @@ -930,23 +725,11 @@ p, li { white-space: pre-wrap; } &Nächster Unerledigter - Moves to the next unfinished item. - Gehe zum nächsten unerledigten Eintrag. - - - Ctrl+L - Ctrl+L - - P&rev V&orheriger - Moves to the previous item. - Gehe zum letzten Eintrag. - - Ctrl+Shift+K Ctrl+Shift+K @@ -957,27 +740,11 @@ p, li { white-space: pre-wrap; } Nä&chster - Moves to the next item. - Gehe zum nächsten Eintrag. - - - Ctrl+Shift+L - Ctrl+Shift+L - - &Done and Next &Fertig und Nächster - Marks this item as done and moves to the next unfinished item. - Markiere diesen Eintrag als erledigt und gehe zum nächsten unerledigten Eintrg. - - - &Begin from source - Übernehme &Ursprungstext - - Copies the source text into the translation field. Kopiert den Ursprungstext in das Übersetzungsfeld. @@ -993,38 +760,21 @@ p, li { white-space: pre-wrap; } &Kurzbefehle - Toggle validity checks of accelerators. - Aktiviere/Deaktiviere Validitätsprüfung für Kurztasten. - - &Ending Punctuation &Punktierung am Ende - Toggle validity checks of ending punctuation. - Aktiviere/Deaktiviere Validitätsprüfung für Punktierung am Ende des Textes. - - &Phrase matches &Wörterbuch - Toggle checking that phrase suggestions are used. - Überprüfung, ob Wörterbucheinträge benutzt werden, aktivieren/deaktivieren. - - - Place &Marker Matches Platz&halter - Toggle validity checks of place markers. - Aktiviere/Deaktiviere Validitätsprüfung für Platzhalter . - - &New Phrase Book... &Neues Wörterbuch ... @@ -1140,36 +890,31 @@ p, li { white-space: pre-wrap; } Die Übersetzung aller Einträge ersetzen, die dem Suchtext entsprechen. + - &Batch Translation... &Automatische Übersetzung ... - + Batch translate all entries using the information in the phrase books. Alle Einträge automatisch mit Hilfe des Wörterbuchs übersetzen. + - Release As... Freigeben unter ... - - Create a Qt message file suitable for released applications from the current message file. The filename will automatically be determined from the name of the .ts file. - Eine Qt-Nachrichtendatei aus der aktuellen Übersetzungsdatei erzeugen. Der Dateiname wird automatisch aus dem Namen der TS-Datei abgeleitet. - - - + This is the application's main window. - + Source text Ursprungstext @@ -1181,17 +926,17 @@ p, li { white-space: pre-wrap; } - + Context Kontext - + Items Einträge - + This panel lists the source contexts. Dieser Bereich zeigt die Kontexte an. @@ -1219,10 +964,10 @@ p, li { white-space: pre-wrap; } MOD status bar: file(s) modified - + Geändert - + Loading... Lade ... @@ -1275,14 +1020,19 @@ Soll die erstgenannte Datei übersprungen werden? Datei gespeichert. - - + + <center><img src=":/images/splash.png"/></img><p>%1</p></center><p>Qt Linguist is a tool for adding translations to Qt applications.</p><p>Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).</p><p>The program is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.</p> + + + + + Release Freigeben - + Qt message files for released applications (*.qm) All files (*) Qt-Nachrichtendateien (*.qm) @@ -1295,7 +1045,7 @@ Alle Dateien (*) Datei erzeugt. - + Printing... Drucke ... @@ -1346,7 +1096,7 @@ Alle Dateien (*) - + @@ -1358,18 +1108,11 @@ Alle Dateien (*) Qt Linguist - + Cannot find the string '%1'. Kann Zeichenkette '%1' nicht finden. - - Translated %n entries to '%1' - - Ein Eintrag wurde mit '%1' übersetzt - %n Einträge wurden mit '%1' übersetzt - - Search And Translate in '%1' - Qt Linguist @@ -1463,16 +1206,7 @@ Alle Dateien (*) Version %1 - Open Source Edition - Open Source Edition - - - - <center><img src=":/images/splash.png"/></img><p>%1</p></center><p>Qt Linguist is a tool for adding translations to Qt applications.</p><p>%2</p><p>Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).</p><p>The program is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.</p> - <center><img src=":/images/splash.png"/></img><p>%1</p></center><p>Qt Linguist ist ein Werkzeug zum Übersetzen von Qt-Anwendungen.</p><p>%2</p><p>Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).</p><p>The program is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.</p> - - - + Do you want to save the modified files? Möchten Sie die geänderten Dateien speichern? @@ -1559,13 +1293,13 @@ Alle Dateien (*) Alles speichern - + &Release All Alles f&reigeben - + Close All Alle schließen @@ -1590,37 +1324,37 @@ Alle Dateien (*) Suchen und &übersetzen ... - + File Datei - - + + Edit Bearbeiten - - + + Translation Übersetzung - - + + Validation Validierung - - + + Help Hilfe - + Cannot read from phrase book '%1'. Wörterbuch '%1' kann nicht gelesen werden. @@ -1650,7 +1384,7 @@ Alle Dateien (*) Möchten Sie das Wörterbuch '%1' speichern? - + All Alle @@ -1670,21 +1404,13 @@ Alle Dateien (*) F5 - - + + Translation File &Settings... E&instellungen ... - Other &Languages... - A&ndere Sprachen... - - - Edit which other languages to show. - Welche anderen Sprachen sollen dargestellt werden. - - - + &Add to Phrase Book Zum Wörterbuch &hinzufügen @@ -1703,22 +1429,93 @@ Alle Dateien (*) Ctrl+Shift+J Ctrl+Shift+J - - - MessageEditor - - German - Deutsch + + Previous unfinished item + Vorheriger unerledigter Eintrag - - Japanese - Japanisch + + Next unfinished item + Nächster unerledigter Eintrag - - French + + Move to previous item + Zum vorigen Eintrag gehen + + + + Next item + Nächster Eintrag + + + + Mark item as done and move to the next unfinished item + Eintrag als erledigt markieren und zum nächsten unerledigten Eintrag gehen + + + + Copies the source text into the translation field + Kopiert den Ursprungstext in das Übersetzungsfeld + + + + Toggle the validity check of accelerators + Prüfung der Tastenkürzel ein- bzw. ausschalten + + + + Toggle the validity check of ending punctuation + Prüfung der Satzendezeichen am Ende des Textes ein- bzw. ausschalten + + + + Toggle checking that phrase suggestions are used + Überprüfung, ob Wörterbucheinträge benutzt werden, aktivieren/deaktivieren + + + + Toggle the validity check of place markers + Prüfung der Platzhalter ein- bzw. ausschalten' + + + + Create a Qt message file suitable for released applications from the current message file. The filename will automatically be determined from the name of the TS file. + Eine Qt-Nachrichtendatei aus der aktuellen Übersetzungsdatei erzeugen. Der Dateiname wird automatisch aus dem Namen der TS-Datei abgeleitet. + + + + Length Variants + Längenvarianten + + + + MessageEditor + + + + This is the right panel of the main window. + + + + + Russian + Russisch + + + + German + Deutsch + + + + Japanese + Japanisch + + + + French Französisch @@ -1732,7 +1529,7 @@ Alle Dateien (*) Chinesisch - + This whole panel allows you to view and edit the translation of some source text. Dieser Bereich erlaubt die Darstellung und Änderung der Übersetzung eines Textes. @@ -1747,7 +1544,7 @@ Alle Dateien (*) Dieser Bereich zeigt den Ursprungstext. - + Source text (Plural) Ursprungstext (Plural) @@ -1757,7 +1554,7 @@ Alle Dateien (*) Dieser Bereich zeigt die Pluralform des Ursprungstexts. - + Developer comments Hinweise des Entwicklers @@ -1772,12 +1569,12 @@ Alle Dateien (*) Hier können Sie Hinweise für den eigenen Gebrauch eintragen. Diese haben keinen Einflusse auf die Übersetzung. - + %1 translation (%2) Übersetzung %1 (%2) - + This is where you can enter or modify the translation of the above source text. Hier können Sie die Übersetzung des Ursprungstextes eingeben bzw. ändern. @@ -1792,56 +1589,16 @@ Alle Dateien (*) %1 Hinweise des Übersetzers - + '%1' Line: %2 '%1' Zeile: %2 - - %1 Translation (%2) - Übersetzung %1 (%2) - - - bell - bell - - - backspace - Rücktaste - - - new page - Neue Seite - - - new line - Neue Zeile - - - carriage return - Carriage Return - - - tab - Tab - MessageModel - Context - Kontext - - - Items - Einträge - - - Index - Index - - Completion status for %1 Bearbeitungsstand von %1 @@ -1863,16 +1620,9 @@ Zeile: %2 - MessagesTreeView - - Done - Done - - - MsgEdit - + This is the right panel of the main window. @@ -1881,17 +1631,18 @@ Zeile: %2 PhraseBookBox - %1 - %2[*] - %1 - %2[*] - - - + Go to Phrase > Edit Phrase Book... The dialog that pops up is a PhraseBookBox. - + + (New Entry) + (Neuer Eintrag) + + + %1[*] - Qt Linguist %1[*] - Qt Linguist @@ -1911,10 +1662,6 @@ Zeile: %2 Wörterbuch bearbeiten - This window allows you to add, modify, or delete phrases in a phrase book. - Dieses Fenster erlaubt das Hinzufügen, Ändern und Entfernen von Einträgen aus dem Wörterbuch. - - This window allows you to add, modify, or delete entries in a phrase book. Dieses Fenster erlaubt das Hinzufügen, Ändern und Entfernen von Wörterbuch-Einträgen. @@ -1975,18 +1722,6 @@ Zeile: %2 &Einstellungen ... - &New Phrase - &Neuer Eintrag - - - Click here to remove the phrase from the phrase book. - Entferne den Eintrag aus dem Wörterbuch. - - - &Remove Phrase - &Entferne Eintrag - - Click here to save the changes made. Änderungen speichern. @@ -2028,7 +1763,7 @@ Zeile: %2 PhraseView - + Insert Einfügen @@ -2056,7 +1791,7 @@ Zeile: %2 Kompilierte Qt-Übersetzungen - + Translation files (%1);; Übersetzungsdateien (%1);; @@ -2077,26 +1812,11 @@ Zeile: %2 Qt Linguist - - C++ source files - C++-Quelltextdateien - - - - Java source files - Java-Quelltextdateien - - - + GNU Gettext localization files GNU-Gettext-Übersetzungsdateien - - Qt Script source files - Qt-Skript-Quelltextdateien - - Qt translation sources (format 1.1) Qt-Übersetzungsdateien (Formatversion 1.1) @@ -2112,61 +1832,17 @@ Zeile: %2 Qt-Übersetzungsdateien (aktuelles Format) - - Qt Designer form files - Formulardateien für Qt Designer - - - - Qt Jambi form files - Formulardateien für Qt Jambi - - - + XLIFF localization files XLIFF-Übersetzungsdateien - + Qt Linguist 'Phrase Book' Qt-Linguist-Wörterbuch - QtWindowListMenu - - Tile - Teilen - - - Cascade - Kaskadieren - - - Close - Schließen - - - Close All - Alle schließen - - - - SortedMessagesModel - - Source text - Ursprungstext - - - Translation - Übersetzung - - - Index - Index - - - SourceCodeView @@ -2192,10 +1868,6 @@ Zeile: %2 Statistiken - &Close - &Schließen - - Translation Übersetzung @@ -2232,406 +1904,8 @@ Zeile: %2 - TrPreviewTool - - <No Translation> - <Keine Übersetzung> - - - Open Forms - Öffne Maske - - - User interface form files (*.ui);;All files (*.*) - User Interface Masken Dateien (*.ui);;Alle Dateien (*.*) - - - Could not load form file(s): - - Könnte Quelldateien nicht laden: - - - - Load Translation - Lade Übersetzung - - - Translation files (*.qm);;All files (*.*) - Übersetzungsdateien (*.qm);;Alle Dateien (*.*) - - - Could not load translation file: - - Konnte Übersetzungsdatei nicht laden: - - - - Could not reload translation file(s): - - Konnte Übersetzungsdateien nicht erneut laden: - - - - Qt Translation Preview Tool: Warning - Qt Vorschau: Warnung - - - About - Info - - - Could not load form file: -%1. - Konnte Maskendatei nicht laden. -%1. - - - - TrPreviewToolClass - - Qt Translation Preview Tool - Qt Vorschau Tool - - - &View - &Ansicht - - - &Views - &Ansichten - - - &Help - &Hilfe - - - &File - &Datei - - - Forms - Masken - - - &Open Form... - &Öffne Maske... - - - &Load Translation... - &Lade Übersetzung... - - - &Reload Translations - Lade Übersetzungen &neu - - - F5 - F5 - - - &Close - &Schließen - - - About - Info - - - About Qt - Über Qt - - - - TrWindow - - Context - Kontext - - - This panel lists the source contexts. - Dieser Bereich zeigt die Kontexte an. - - - Strings - Zeichenketten - - - Phrases and guesses - Wörterbuch und Vorschläge - - - Source code - Quelltext - - - Warnings - Warnungen - - - MOD - MOD - - - Loading... - Lade... - - - Qt Linguist - Qt Linguist - - - Cannot open '%1'. - Kann '%1' nicht öffnen. - - - %n source phrase(s) loaded. - - Einen Ursprungstext geladen. - %n Ursprungstexte geladen. - - - - Open Translation File - Öffne Übersetzungsdatei - - - Qt translation sources (*.ts);;XLIFF localization files (*.xlf);;All files (*) - Qt Übersetzungsdateien (*.ts);;Qt Übersetzungsdateien (*.ts);;Alle Dateien (*) - - - File saved. - Datei gespeichert. - - - Cannot save '%1'. - Kann '%1' nicht speichern. - - - Qt translation source (*.ts) -XLIFF localization file (*.xlf) -All files (*) - Qt Übersetzungsdateien (*.ts) -Qt Übersetzungsdateien (*.ts) -Alle Dateien (*) - - - Release - Freigeben - - - Qt message files for released applications (*.qm) -All files (*) - Qt Nachrichtendateien (*.qm) -Alle Dateien (*) - - - File created. - Datei erzeugt. - - - Printing... - Drucke... - - - Context: %1 - Kontext: %1 - - - finished - erledigt - - - unresolved - ungelöst - - - obsolete - veraltet - - - Printing... (page %1) - Drucke... (Seite %1) - - - Printing completed - Drucken beendet - - - Printing aborted - Drucken abgebrochen - - - Search wrapped. - Suche beginnt von oben. - - - Cannot find the string '%1'. - Kann Zeichenkette '%1' nicht finden. - - - Translate - Übersetzungen - - - Translated %n entries to '%1' - - Ein Eintrag wurde mit '%1' übersetzt - %n Einträge wurden mit '%1' übersetzt - - - - Create New Phrase Book - Erzeugen eines neuen Wörterbuchs - - - Qt phrase books (*.qph) -All files (*) - Qt Wörterbücher (*.qph) -Alle Dateien (*) - - - A file called '%1' already exists. Please choose another name. - Die Datei '%1' existiert schon. Bitte wählen Sie einen anderen Namen. - - - Phrase book created. - Wörterbuch erzeugt. - - - Open Phrase Book - Öffne Wörterbuch - - - Qt phrase books (*.qph);;All files (*) - Qt Wörterbücher (*.qph);;Alle Dateien (*) - - - %n phrase(s) loaded. - - Ein Wörterbucheintrag geladen. - %n Wörterbucheinträge geladen. - - - - Add to phrase book - Hinzufügen zum Wörterbuch - - - Adding phrase to phrasebook %1 - Eintrag zu Wörterbuch %1 hinzufügen - - - Select phrase book to add to - Zu welchem Wörterbuch soll der Eintrag hinzugefügt werden? - - - Unable to launch Qt Assistant (%1) - Kann Qt Assistant nicht starten (%1) - - - Version %1 - Version %1 - - - Open Source Edition - Open Source Edition - - - <center><img src=":/images/splash.png"/></img><p>%1</p></center><p>Qt Linguist is a tool for adding translations to Qt applications.</p><p>%2</p><p>Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).</p><p>The program is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.</p> - <center><img src=":/images/splash.png"/></img><p>%1</p></center><p>Qt Linguist ist ein Werkzeug zum Übersetzen von Qt Anwendungen.</p><p>%2</p><p>Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).</p><p>The program is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.</p> - - - Do you want to save '%1'? - Wollen Sie '%1' speichern? - - - Qt Linguist by Trolltech[*] - Qt Linguist von Trolltech[*] - - - %1 - %2[*] - %1 - %2[*] - - - Qt Linguist by Trolltech - Qt Linguist von Trolltech - - - No untranslated phrases left. - Alle Einträge sind übersetzt. - - - &Window - &Fenster - - - Minimize - Minimieren - - - Ctrl+M - Ctrl+M - - - Display the manual for %1. - Zeige Handbuch für %1 an. - - - Display information about %1. - Zeige Informationen über %1 an. - - - File - Datei - - - Edit - Bearbeiten - - - Translation - Übersetzung - - - Validation - Validierung - - - Help - Hilfe - - - Cannot read from phrase book '%1'. - Kann Wörterbuch '%1' nicht lesen. - - - Close this phrase book. - Schließe dieses Wörterbuch. - - - Allow you to add, modify, or delete phrases of this phrase book. - Erlaubt das Hinzufügen, Ändern und Entfernen von Einträgen aus dem Wörterbuch. - - - Print the entries of the phrase book. - Drucke die Einträge des Wörterbuchs. - - - Cannot create phrase book '%1'. - Kann Wörterbuch '%1' nicht erzeugen. - - - Do you want to save phrasebook '%1'? - Wollen Sie das Wörterbuch '%1' speichern? - - - TranslateDialog - Qt Linguist - Qt Linguist - - This window allows you to search for some text in the translation source file. Dieses Fenster erlaubt die Suche in der Übersetzungsdatei. @@ -2703,25 +1977,6 @@ Alle Dateien (*) - TranslationSettings - - Qt Linguist - Translation file settings - Qt Linguist - Einstellungen der Übersetzungsdatei - - - Target language - Zielsprache - - - Language - Sprache - - - Country/Region - Land/Region - - - TranslationSettingsDialog @@ -2755,47 +2010,4 @@ Alle Dateien (*) Zielsprache - - databaseTranslationDialog - - Qt Linguist - Batch Translation - Qt Linguist - Automatische Übersetzung - - - Options - Optionen - - - Only translate entries with no translation - Übersetze nur Einträge ohne bisherige Übersetzung - - - Set translated entries to finished - Markiere Übersetzung als erledigt - - - Phrase book preference - Wörterbücher - - - Move up - Nach oben - - - Move down - Nach unten - - - The batch translator will search through the selected phrasebooks in the order given above. - Der automatische Übersetzer wird in der angegebenen Reihenfolge durch die ausgewählten Wörterbücher gehen. - - - &Run - &Ausführen - - - &Cancel - &Abbrechen - - diff --git a/translations/qt_help_de.ts b/translations/qt_help_de.ts index 9d48661..8e6cb85 100644 --- a/translations/qt_help_de.ts +++ b/translations/qt_help_de.ts @@ -111,8 +111,9 @@ QHelpDBReader - + Cannot open database '%1' '%2': %3 + The placeholders are: %1 - The name of the database which cannot be opened %2 - The unique id for the connection %3 - The actual error string Kann Datenbank nicht öffnen: '%1' '%2': %3 @@ -200,17 +201,22 @@ Dateien einfügen... - + + The referenced file %1 must be inside or within a subdirectory of (%2). Skipping it. + Die referenzierte Datei %1 muss sich im Verzeichnis %2 oder in einem Unterverzeichnis davon befinden. Sie wird übersprungen. + + + The file %1 does not exist! Skipping it. Die Datei %1 existiert nicht. Wird übersprungen. - + Cannot open file %1! Skipping it. Die Datei %1 kann nicht geöffnet werden. Wird übersprungen. - + The filter %1 is already registered! Der Filter %1 ist bereits registriert. @@ -243,17 +249,27 @@ QHelpSearchQueryWidget - + Search for: Suche nach: + + Previous search + Vorige Suche + + + + Next search + Nächste Suche + + Search Suche - + Advanced search Erweiterte Suche @@ -263,22 +279,22 @@ Worte <B>ähnlich</B> zu: - + <B>without</B> the words: <B>ohne</B> die Wörter: - + with <B>exact phrase</B>: mit der <B>genauen Wortgruppe</B>: - + with <B>all</B> of the words: mit <B>allen</B> Wörtern: - + with <B>at least one</B> of the words: mit <B>irgendeinem</B> der Wörter: @@ -307,7 +323,7 @@ Ohne Titel - + Unknown token. Unbekanntes Token. @@ -347,7 +363,7 @@ Fehlendes Attribut in Schlagwort in Zeile %1. - + The input file %1 could not be opened! Die Eingabe-Datei %1 kann nicht geöffnet werden. -- cgit v0.12 From 4111f8d417409579d591798c491f9f2aa7c0021d Mon Sep 17 00:00:00 2001 From: Thomas Hartmann Date: Mon, 10 Aug 2009 16:54:28 +0200 Subject: New mkspecs for Windows Mobile 6.5 We need extra mkspecs for Windows Mobile 6.5 to support gestures, since gestures are only supported with 6.5 Reviewed-by: Maurice --- .../default_post.prf | 1 + mkspecs/wincewm65professional-msvc2005/qmake.conf | 5 +++ .../wincewm65professional-msvc2005/qplatformdefs.h | 42 +++++++++++++++++++++ .../default_post.prf | 1 + mkspecs/wincewm65professional-msvc2008/qmake.conf | 3 ++ .../wincewm65professional-msvc2008/qplatformdefs.h | 43 ++++++++++++++++++++++ 6 files changed, 95 insertions(+) create mode 100644 mkspecs/wincewm65professional-msvc2005/default_post.prf create mode 100644 mkspecs/wincewm65professional-msvc2005/qmake.conf create mode 100644 mkspecs/wincewm65professional-msvc2005/qplatformdefs.h create mode 100644 mkspecs/wincewm65professional-msvc2008/default_post.prf create mode 100644 mkspecs/wincewm65professional-msvc2008/qmake.conf create mode 100644 mkspecs/wincewm65professional-msvc2008/qplatformdefs.h diff --git a/mkspecs/wincewm65professional-msvc2005/default_post.prf b/mkspecs/wincewm65professional-msvc2005/default_post.prf new file mode 100644 index 0000000..86bc964 --- /dev/null +++ b/mkspecs/wincewm65professional-msvc2005/default_post.prf @@ -0,0 +1 @@ +include(../wincewm60professional-msvc2005/default_post.prf) diff --git a/mkspecs/wincewm65professional-msvc2005/qmake.conf b/mkspecs/wincewm65professional-msvc2005/qmake.conf new file mode 100644 index 0000000..b4ae096 --- /dev/null +++ b/mkspecs/wincewm65professional-msvc2005/qmake.conf @@ -0,0 +1,5 @@ +include(../wincewm60professional-msvc2005/qmake.conf) + +DEFINES += QT_WINCE_GESTURES +QMAKE_LIBS_GUI += TouchGestureCore.lib + diff --git a/mkspecs/wincewm65professional-msvc2005/qplatformdefs.h b/mkspecs/wincewm65professional-msvc2005/qplatformdefs.h new file mode 100644 index 0000000..4317bc1 --- /dev/null +++ b/mkspecs/wincewm65professional-msvc2005/qplatformdefs.h @@ -0,0 +1,42 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the qmake spec of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at http://www.qtsoftware.com/contact. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "../wincewm60professional-msvc2005/qplatformdefs.h" diff --git a/mkspecs/wincewm65professional-msvc2008/default_post.prf b/mkspecs/wincewm65professional-msvc2008/default_post.prf new file mode 100644 index 0000000..c854561 --- /dev/null +++ b/mkspecs/wincewm65professional-msvc2008/default_post.prf @@ -0,0 +1 @@ +include(../wincewm65professional-msvc2005/default_post.prf) diff --git a/mkspecs/wincewm65professional-msvc2008/qmake.conf b/mkspecs/wincewm65professional-msvc2008/qmake.conf new file mode 100644 index 0000000..552c7c8 --- /dev/null +++ b/mkspecs/wincewm65professional-msvc2008/qmake.conf @@ -0,0 +1,3 @@ +include(../wincewm65professional-msvc2005/qmake.conf) +QMAKE_COMPILER_DEFINES -= _MSC_VER=1400 +QMAKE_COMPILER_DEFINES += _MSC_VER=1500 diff --git a/mkspecs/wincewm65professional-msvc2008/qplatformdefs.h b/mkspecs/wincewm65professional-msvc2008/qplatformdefs.h new file mode 100644 index 0000000..7f724f9 --- /dev/null +++ b/mkspecs/wincewm65professional-msvc2008/qplatformdefs.h @@ -0,0 +1,43 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the qmake spec of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at http://www.qtsoftware.com/contact. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "../wincewm65professional-msvc2005/qplatformdefs.h" + -- cgit v0.12 From 9a92aee8ff94a1b705e92f895831f9437762da75 Mon Sep 17 00:00:00 2001 From: Thomas Hartmann Date: Mon, 10 Aug 2009 16:56:22 +0200 Subject: Gesture support for Windows Mobile 6.5 Gestures on Windows Mobile 6.5 rely on a statically linked library, that is added in the mkspecs for Windows Mobile 6.5 In the case the gesture functions do not have been resolved (==0), we do not call them. Reviewed-by: Joerg --- src/gui/kernel/qapplication_win.cpp | 58 ++++++++++++++++++++++++++----------- 1 file changed, 41 insertions(+), 17 deletions(-) diff --git a/src/gui/kernel/qapplication_win.cpp b/src/gui/kernel/qapplication_win.cpp index bdee6ec..281be33 100644 --- a/src/gui/kernel/qapplication_win.cpp +++ b/src/gui/kernel/qapplication_win.cpp @@ -51,6 +51,9 @@ extern void qt_wince_hide_taskbar(HWND hwnd); //defined in qguifunctions_wince.c #ifdef Q_WS_WINCE_WM #include #include +#ifdef QT_WINCE_GESTURES +#include +#endif #endif #include "qapplication.h" @@ -815,30 +818,41 @@ void qt_init(QApplicationPrivate *priv, int) ptrSetProcessDPIAware(); #endif + priv->GetGestureInfo = 0; + priv->GetGestureExtraArgs = 0; + +#ifdef Q_WS_WINCE_WM + priv->GetGestureInfo = (PtrGetGestureInfo) &TKGetGestureInfo; + priv->GetGestureExtraArgs = (PtrGetGestureExtraArgs) &TKGetGestureExtraArguments; + priv->CloseGestureInfoHandle = (PtrCloseGestureInfoHandle) 0; + priv->SetGestureConfig = (PtrSetGestureConfig) 0; + priv->GetGestureConfig = (PtrGetGestureConfig) 0; +#else priv->GetGestureInfo = - (PtrGetGestureInfo)QLibrary::resolve(QLatin1String("user32"), - "GetGestureInfo"); + (PtrGetGestureInfo)QLibrary::resolve(QLatin1String("user32"), + "GetGestureInfo"); priv->GetGestureExtraArgs = - (PtrGetGestureExtraArgs)QLibrary::resolve(QLatin1String("user32"), - "GetGestureExtraArgs"); + (PtrGetGestureExtraArgs)QLibrary::resolve(QLatin1String("user32"), + "GetGestureExtraArgs"); priv->CloseGestureInfoHandle = - (PtrCloseGestureInfoHandle)QLibrary::resolve(QLatin1String("user32"), - "CloseGestureInfoHandle"); + (PtrCloseGestureInfoHandle)QLibrary::resolve(QLatin1String("user32"), + "CloseGestureInfoHandle"); + priv->SetGestureConfig = + (PtrSetGestureConfig)QLibrary::resolve(QLatin1String("user32"), + "SetGestureConfig"); priv->SetGestureConfig = - (PtrSetGestureConfig)QLibrary::resolve(QLatin1String("user32"), - "SetGestureConfig"); - priv->GetGestureConfig = - (PtrGetGestureConfig)QLibrary::resolve(QLatin1String("user32"), - "GetGestureConfig"); + (PtrGetGestureConfig)QLibrary::resolve(QLatin1String("user32"), + "GetGestureConfig"); priv->BeginPanningFeedback = - (PtrBeginPanningFeedback)QLibrary::resolve(QLatin1String("uxtheme"), - "BeginPanningFeedback"); + (PtrBeginPanningFeedback)QLibrary::resolve(QLatin1String("uxtheme"), + "BeginPanningFeedback"); priv->UpdatePanningFeedback = - (PtrUpdatePanningFeedback)QLibrary::resolve(QLatin1String("uxtheme"), - "UpdatePanningFeedback"); + (PtrUpdatePanningFeedback)QLibrary::resolve(QLatin1String("uxtheme"), + "UpdatePanningFeedback"); priv->EndPanningFeedback = (PtrEndPanningFeedback)QLibrary::resolve(QLatin1String("uxtheme"), "EndPanningFeedback"); +#endif } /***************************************************************************** @@ -3720,7 +3734,16 @@ bool QETWidget::translateGestureEvent(const MSG &msg) gi.cbSize = sizeof(GESTUREINFO); QApplicationPrivate *qAppPriv = getQApplicationPrivateInternal(); - BOOL bResult = qAppPriv->GetGestureInfo((HANDLE)msg.lParam, &gi); +#ifdef Q_WS_WINCE_WM +#define GID_ZOOM 0xf000 +#define GID_ROTATE 0xf001 +#define GID_TWOFINGERTAP 0xf002 +#define GID_ROLLOVER 0xf003 +#endif + BOOL bResult = false; + if (qAppPriv->GetGestureInfo) + bResult = qAppPriv->GetGestureInfo((HANDLE)msg.lParam, &gi); + const QPoint widgetPos = QPoint(gi.ptsLocation.x, gi.ptsLocation.y); QWidget *alienWidget = !internalWinId() ? this : childAt(widgetPos); @@ -3751,7 +3774,8 @@ bool QETWidget::translateGestureEvent(const MSG &msg) default: break; } - qAppPriv->CloseGestureInfoHandle((HANDLE)msg.lParam); + if (qAppPriv->CloseGestureInfoHandle) + qAppPriv->CloseGestureInfoHandle((HANDLE)msg.lParam); if (event.gestureType != QNativeGestureEvent::None) qt_sendSpontaneousEvent(widget, &event); } else { -- cgit v0.12 From d918f98a4ab80405e0fe75fadf8491069a4c7ab8 Mon Sep 17 00:00:00 2001 From: Harald Fernengel Date: Mon, 10 Aug 2009 17:02:32 +0200 Subject: Make chooseConfig work on some EGL implementations According to the spec, if we pass a 0 out pointer, EGL should tell us how many configurations are available. However, we pass a 0 out pointer, but say that it's 256 elements big, it confuses some implementations. Fix that by passing a 0 out pointer and saying that it has space for 0 elements. Now we correctly get the amount of available configs. Reviewed-by: Rhys Weatherley --- src/gui/egl/qegl.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/egl/qegl.cpp b/src/gui/egl/qegl.cpp index ebdac9a..1c45a58 100644 --- a/src/gui/egl/qegl.cpp +++ b/src/gui/egl/qegl.cpp @@ -95,7 +95,7 @@ bool QEglContext::chooseConfig do { // Get the number of matching configurations for this set of properties. EGLint matching = 0; - if (!eglChooseConfig(dpy, props.properties(), 0, 256, &matching) || !matching) + if (!eglChooseConfig(dpy, props.properties(), 0, 0, &matching) || !matching) continue; // If we want the best pixel format, then return the first -- cgit v0.12 From c3610da4be9b12bfe01b565db5ed2508da88c120 Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Mon, 10 Aug 2009 12:13:46 +0200 Subject: tst_QSharedPointer fixed for Windows CE We cannot create too many threads on Windows CE. Reviewed-By: thartman --- tests/auto/qsharedpointer/tst_qsharedpointer.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/auto/qsharedpointer/tst_qsharedpointer.cpp b/tests/auto/qsharedpointer/tst_qsharedpointer.cpp index 1101a08..516729c 100644 --- a/tests/auto/qsharedpointer/tst_qsharedpointer.cpp +++ b/tests/auto/qsharedpointer/tst_qsharedpointer.cpp @@ -1373,7 +1373,9 @@ void tst_QSharedPointer::threadStressTest_data() QTest::newRow("5+10") << 5 << 10; QTest::newRow("5+30") << 5 << 30; +#ifndef Q_OS_WINCE QTest::newRow("100+100") << 100 << 100; +#endif } void tst_QSharedPointer::threadStressTest() -- cgit v0.12 From a6d51bc97a923bd990e5188035f7c913456138f7 Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Mon, 10 Aug 2009 15:12:08 +0200 Subject: respect QAbstractSpinBox::NoButtons in windowsce / windowsmobile styles Code is adapted from QCommonStyle which handles this case for other styles. Reviewed-by: thartman --- src/gui/styles/qwindowscestyle.cpp | 6 +++++- src/gui/styles/qwindowsmobilestyle.cpp | 4 ++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/gui/styles/qwindowscestyle.cpp b/src/gui/styles/qwindowscestyle.cpp index 997fc72..cd13dd8 100644 --- a/src/gui/styles/qwindowscestyle.cpp +++ b/src/gui/styles/qwindowscestyle.cpp @@ -1951,7 +1951,11 @@ QRect QWindowsCEStyle::subControlRect(ComplexControl control, const QStyleOption rect = QRect(x, y , bs.width(), bs.height()); break; case SC_SpinBoxEditField: - rect = QRect(lx, fw, rx-2, spinbox->rect.height() - 2*fw); + if (spinbox->buttonSymbols == QAbstractSpinBox::NoButtons) { + rect = QRect(lx, fw, spinbox->rect.width() - 2*fw - 2, spinbox->rect.height() - 2*fw); + } else { + rect = QRect(lx, fw, rx-2, spinbox->rect.height() - 2*fw); + } break; case SC_SpinBoxFrame: rect = spinbox->rect; diff --git a/src/gui/styles/qwindowsmobilestyle.cpp b/src/gui/styles/qwindowsmobilestyle.cpp index c70b4c8..e708042 100644 --- a/src/gui/styles/qwindowsmobilestyle.cpp +++ b/src/gui/styles/qwindowsmobilestyle.cpp @@ -2984,7 +2984,11 @@ QRect QWindowsMobileStyle::subControlRect(ComplexControl control, const QStyleOp rect = QRect(x + bs.width(), 0, bs.width(), bs.height()); break; case SC_SpinBoxEditField: + if (spinBox->buttonSymbols == QAbstractSpinBox::NoButtons) { + rect = QRect(lx, fw, spinBox->rect.width() - 2*fw - 2, spinBox->rect.height() - 2*fw); + } else { rect = QRect(lx, fw, rx-2, spinBox->rect.height() - 2*fw); + } break; case SC_SpinBoxFrame: rect = spinBox->rect; -- cgit v0.12 From 8262b8b7dfda60446685eed8ec373c4da252cbeb Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Mon, 10 Aug 2009 15:18:35 +0200 Subject: remove compiler warning for Windows CE whitespaces fixed Reviewed-by: TrustMe --- src/corelib/io/qprocess_win.cpp | 46 ++++++++++++++++++++--------------------- 1 file changed, 22 insertions(+), 24 deletions(-) diff --git a/src/corelib/io/qprocess_win.cpp b/src/corelib/io/qprocess_win.cpp index eae17b4..d8da606 100644 --- a/src/corelib/io/qprocess_win.cpp +++ b/src/corelib/io/qprocess_win.cpp @@ -372,32 +372,30 @@ void QProcessPrivate::startProcess() qDebug(" pass environment : %s", environment.isEmpty() ? "no" : "yes"); #endif - DWORD dwCreationFlags = CREATE_NO_WINDOW; - #if defined(Q_OS_WINCE) - QString fullPathProgram = program; - if (!QDir::isAbsolutePath(fullPathProgram)) - fullPathProgram = QFileInfo(fullPathProgram).absoluteFilePath(); - fullPathProgram.replace(QLatin1Char('/'), QLatin1Char('\\')); - success = CreateProcess((wchar_t*)fullPathProgram.utf16(), - (wchar_t*)args.utf16(), - 0, 0, false, 0, 0, 0, 0, pid); + QString fullPathProgram = program; + if (!QDir::isAbsolutePath(fullPathProgram)) + fullPathProgram = QFileInfo(fullPathProgram).absoluteFilePath(); + fullPathProgram.replace(QLatin1Char('/'), QLatin1Char('\\')); + success = CreateProcess((wchar_t*)fullPathProgram.utf16(), + (wchar_t*)args.utf16(), + 0, 0, false, 0, 0, 0, 0, pid); #else - dwCreationFlags |= CREATE_UNICODE_ENVIRONMENT; - STARTUPINFOW startupInfo = { sizeof( STARTUPINFO ), 0, 0, 0, - (ulong)CW_USEDEFAULT, (ulong)CW_USEDEFAULT, - (ulong)CW_USEDEFAULT, (ulong)CW_USEDEFAULT, - 0, 0, 0, - STARTF_USESTDHANDLES, - 0, 0, 0, - stdinChannel.pipe[0], stdoutChannel.pipe[1], stderrChannel.pipe[1] - }; - success = CreateProcess(0, (wchar_t*)args.utf16(), - 0, 0, TRUE, dwCreationFlags, - environment ? envlist.data() : 0, - workingDirectory.isEmpty() ? 0 - : (wchar_t*)QDir::toNativeSeparators(workingDirectory).utf16(), - &startupInfo, pid); + DWORD dwCreationFlags = CREATE_NO_WINDOW; + dwCreationFlags |= CREATE_UNICODE_ENVIRONMENT; + STARTUPINFOW startupInfo = { sizeof( STARTUPINFO ), 0, 0, 0, + (ulong)CW_USEDEFAULT, (ulong)CW_USEDEFAULT, + (ulong)CW_USEDEFAULT, (ulong)CW_USEDEFAULT, + 0, 0, 0, + STARTF_USESTDHANDLES, + 0, 0, 0, + stdinChannel.pipe[0], stdoutChannel.pipe[1], stderrChannel.pipe[1] + }; + success = CreateProcess(0, (wchar_t*)args.utf16(), + 0, 0, TRUE, dwCreationFlags, + environment ? envlist.data() : 0, + workingDirectory.isEmpty() ? 0 : (wchar_t*)QDir::toNativeSeparators(workingDirectory).utf16(), + &startupInfo, pid); if (stdinChannel.pipe[0] != INVALID_Q_PIPE) { CloseHandle(stdinChannel.pipe[0]); -- cgit v0.12 From 33e9b82813f5573be6e5a780524044a2170d8dd4 Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Mon, 10 Aug 2009 17:00:27 +0200 Subject: don't test dbus stuff where no dbus is Reviewed-by: Leo --- tests/auto/auto.pro | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/auto/auto.pro b/tests/auto/auto.pro index d3e295b..d7f27bd 100644 --- a/tests/auto/auto.pro +++ b/tests/auto/auto.pro @@ -106,8 +106,6 @@ SUBDIRS += \ qdate \ qdatetime \ qdatetimeedit \ - qdbuspendingcall \ - qdbuspendingreply \ qdebug \ qdesktopservices \ qdesktopwidget \ @@ -457,6 +455,8 @@ unix:!embedded:contains(QT_CONFIG, dbus):SUBDIRS += \ qdbusmarshall \ qdbusmetaobject \ qdbusmetatype \ + qdbuspendingcall \ + qdbuspendingreply \ qdbusperformance \ qdbusreply \ qdbusthreading \ -- cgit v0.12 From 70b5327e51481bf7b91d8fad50e3fc9ff3a1e888 Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Mon, 10 Aug 2009 12:13:02 +0200 Subject: QtWebKit compile fix for Windows CE There's no getenv on Windows CE. Reviewed-By: Simon Hausmann --- src/3rdparty/webkit/WebKit/qt/Api/qwebpage.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/3rdparty/webkit/WebKit/qt/Api/qwebpage.cpp b/src/3rdparty/webkit/WebKit/qt/Api/qwebpage.cpp index 1a45fe6..613a72f 100644 --- a/src/3rdparty/webkit/WebKit/qt/Api/qwebpage.cpp +++ b/src/3rdparty/webkit/WebKit/qt/Api/qwebpage.cpp @@ -105,7 +105,7 @@ void QWEBKIT_EXPORT qt_drt_overwritePluginDirectories() PluginDatabase* db = PluginDatabase::installedPlugins(/* populate */ false); Vector paths; - String qtPath(getenv("QTWEBKIT_PLUGIN_PATH")); + String qtPath(qgetenv("QTWEBKIT_PLUGIN_PATH").data()); qtPath.split(UChar(':'), /* allowEmptyEntries */ false, paths); db->setPluginDirectories(paths); -- cgit v0.12 From 35ef002453cbe9841e23a7d33064a51dbe99fb06 Mon Sep 17 00:00:00 2001 From: Thomas Hartmann Date: Mon, 10 Aug 2009 17:15:03 +0200 Subject: Manual merge --- src/gui/kernel/qapplication_win.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/gui/kernel/qapplication_win.cpp b/src/gui/kernel/qapplication_win.cpp index 5843c34..bb910b7 100644 --- a/src/gui/kernel/qapplication_win.cpp +++ b/src/gui/kernel/qapplication_win.cpp @@ -3728,7 +3728,7 @@ bool QETWidget::translateGestureEvent(const MSG &msg) memset(&gi, 0, sizeof(GESTUREINFO)); gi.cbSize = sizeof(GESTUREINFO); - QApplicationPrivate *qAppPriv = getQApplicationPrivateInternal(); + QApplicationPrivate *qAppPriv = QApplicationPrivate::instance(); #ifdef Q_WS_WINCE_WM #define GID_ZOOM 0xf000 #define GID_ROTATE 0xf001 @@ -3739,8 +3739,6 @@ bool QETWidget::translateGestureEvent(const MSG &msg) if (qAppPriv->GetGestureInfo) bResult = qAppPriv->GetGestureInfo((HANDLE)msg.lParam, &gi); - QApplicationPrivate *qAppPriv = QApplicationPrivate::instance(); - BOOL bResult = qAppPriv->GetGestureInfo((HANDLE)msg.lParam, &gi); if (bResult) { const QPoint widgetPos = QPoint(gi.ptsLocation.x, gi.ptsLocation.y); QWidget *alienWidget = !internalWinId() ? this : childAt(widgetPos); -- cgit v0.12 From 13a31fe82845f8b1f4d86919080d3b2a87c4d061 Mon Sep 17 00:00:00 2001 From: Jens Bache-Wiig Date: Mon, 10 Aug 2009 17:15:03 +0200 Subject: Introducing icon theme support Added some static functions to QIcon to support desktop themes based on the freedesktop spec. It is not intended to replace KIcon and the intention is to use it when available to share icon cache between applications. Applications currently using icon themes are Assistant, Designer and the textedit demo. Reviewed-by: ogoffart --- demos/textedit/textedit.cpp | 65 +- doc/src/snippets/code/src_gui_image_qicon.cpp | 9 + src/gui/gui.pro | 1 - src/gui/image/image.pri | 3 + src/gui/image/qicon.cpp | 226 ++++-- src/gui/image/qicon.h | 10 + src/gui/image/qicon_p.h | 138 ++++ src/gui/image/qiconloader.cpp | 599 ++++++++++++++++ src/gui/image/qiconloader_p.h | 185 +++++ src/gui/kernel/qapplication_x11.cpp | 4 +- src/gui/styles/gtksymbols.cpp | 8 +- src/gui/styles/gtksymbols_p.h | 1 + src/gui/styles/qcleanlooksstyle.cpp | 563 +-------------- src/gui/styles/qcleanlooksstyle_p.h | 2 - src/gui/styles/qcommonstyle.cpp | 770 ++++++--------------- src/gui/styles/qcommonstyle_p.h | 13 - src/gui/styles/qgtkstyle.cpp | 96 +-- src/gui/styles/qgtkstyle.h | 4 + .../testtheme/16x16/actions/appointment-new.png | Bin 0 -> 897 bytes .../testtheme/22x22/actions/appointment-new.png | Bin 0 -> 1411 bytes .../testtheme/32x32/actions/appointment-new.png | Bin 0 -> 2399 bytes tests/auto/qicon/icons/testtheme/index.theme | 492 +++++++++++++ .../icons/testtheme/scalable/actions/svg-only.svg | 425 ++++++++++++ .../themeparent/16x16/actions/address-book-new.png | Bin 0 -> 796 bytes .../themeparent/16x16/actions/appointment-new.png | Bin 0 -> 897 bytes .../themeparent/22x22/actions/address-book-new.png | Bin 0 -> 924 bytes .../themeparent/22x22/actions/appointment-new.png | Bin 0 -> 1411 bytes .../themeparent/32x32/actions/address-book-new.png | Bin 0 -> 1897 bytes .../themeparent/32x32/actions/appointment-new.png | Bin 0 -> 2399 bytes tests/auto/qicon/icons/themeparent/index.theme | 492 +++++++++++++ .../scalable/actions/address-book-new.svg | 389 +++++++++++ .../scalable/actions/appointment-new.svg | 425 ++++++++++++ tests/auto/qicon/tst_qicon.cpp | 67 ++ tools/assistant/compat/mainwindow.cpp | 10 + tools/assistant/tools/assistant/mainwindow.cpp | 13 + .../components/buddyeditor/buddyeditor_plugin.cpp | 5 +- .../components/formeditor/formwindowmanager.cpp | 22 +- .../signalsloteditor/signalsloteditor_plugin.cpp | 3 +- .../tabordereditor/tabordereditor_plugin.cpp | 4 +- tools/designer/src/designer/qdesigner_actions.cpp | 7 +- tools/designer/src/lib/shared/actioneditor.cpp | 18 +- tools/designer/src/lib/shared/qtresourceview.cpp | 10 +- 42 files changed, 3784 insertions(+), 1295 deletions(-) create mode 100644 src/gui/image/qicon_p.h create mode 100644 src/gui/image/qiconloader.cpp create mode 100644 src/gui/image/qiconloader_p.h create mode 100644 tests/auto/qicon/icons/testtheme/16x16/actions/appointment-new.png create mode 100644 tests/auto/qicon/icons/testtheme/22x22/actions/appointment-new.png create mode 100644 tests/auto/qicon/icons/testtheme/32x32/actions/appointment-new.png create mode 100644 tests/auto/qicon/icons/testtheme/index.theme create mode 100644 tests/auto/qicon/icons/testtheme/scalable/actions/svg-only.svg create mode 100644 tests/auto/qicon/icons/themeparent/16x16/actions/address-book-new.png create mode 100644 tests/auto/qicon/icons/themeparent/16x16/actions/appointment-new.png create mode 100644 tests/auto/qicon/icons/themeparent/22x22/actions/address-book-new.png create mode 100644 tests/auto/qicon/icons/themeparent/22x22/actions/appointment-new.png create mode 100644 tests/auto/qicon/icons/themeparent/32x32/actions/address-book-new.png create mode 100644 tests/auto/qicon/icons/themeparent/32x32/actions/appointment-new.png create mode 100644 tests/auto/qicon/icons/themeparent/index.theme create mode 100644 tests/auto/qicon/icons/themeparent/scalable/actions/address-book-new.svg create mode 100644 tests/auto/qicon/icons/themeparent/scalable/actions/appointment-new.svg diff --git a/demos/textedit/textedit.cpp b/demos/textedit/textedit.cpp index d1e12bb..31b419a 100644 --- a/demos/textedit/textedit.cpp +++ b/demos/textedit/textedit.cpp @@ -158,14 +158,16 @@ void TextEdit::setupFileActions() QAction *a; - a = new QAction(QIcon(rsrcPath + "/filenew.png"), tr("&New"), this); + QIcon newIcon = QIcon::fromTheme("document-new", QIcon(rsrcPath + "/filenew.png")); + a = new QAction( newIcon, tr("&New"), this); a->setPriority(QAction::LowPriority); a->setShortcut(QKeySequence::New); connect(a, SIGNAL(triggered()), this, SLOT(fileNew())); tb->addAction(a); menu->addAction(a); - a = new QAction(QIcon(rsrcPath + "/fileopen.png"), tr("&Open..."), this); + a = new QAction(QIcon::fromTheme("document-open", QIcon(rsrcPath + "/fileopen.png")), + tr("&Open..."), this); a->setShortcut(QKeySequence::Open); connect(a, SIGNAL(triggered()), this, SLOT(fileOpen())); tb->addAction(a); @@ -173,7 +175,8 @@ void TextEdit::setupFileActions() menu->addSeparator(); - actionSave = a = new QAction(QIcon(rsrcPath + "/filesave.png"), tr("&Save"), this); + actionSave = a = new QAction(QIcon::fromTheme("document-save", QIcon(rsrcPath + "/filesave.png")), + tr("&Save"), this); a->setShortcut(QKeySequence::Save); connect(a, SIGNAL(triggered()), this, SLOT(fileSave())); a->setEnabled(false); @@ -187,17 +190,21 @@ void TextEdit::setupFileActions() menu->addSeparator(); #ifndef QT_NO_PRINTER - a = new QAction(QIcon(rsrcPath + "/fileprint.png"), tr("&Print..."), this); + a = new QAction(QIcon::fromTheme("document-print", QIcon(rsrcPath + "/fileprint.png")), + tr("&Print..."), this); + a->setPriority(QAction::LowPriority); a->setShortcut(QKeySequence::Print); connect(a, SIGNAL(triggered()), this, SLOT(filePrint())); tb->addAction(a); menu->addAction(a); - a = new QAction(QIcon(rsrcPath + "/fileprint.png"), tr("Print Preview..."), this); + a = new QAction(QIcon::fromTheme("fileprint", QIcon(rsrcPath + "/fileprint.png")), + tr("Print Preview..."), this); connect(a, SIGNAL(triggered()), this, SLOT(filePrintPreview())); menu->addAction(a); - a = new QAction(QIcon(rsrcPath + "/exportpdf.png"), tr("&Export PDF..."), this); + a = new QAction(QIcon::fromTheme("exportpdf", QIcon(rsrcPath + "/exportpdf.png")), + tr("&Export PDF..."), this); a->setPriority(QAction::LowPriority); a->setShortcut(Qt::CTRL + Qt::Key_D); connect(a, SIGNAL(triggered()), this, SLOT(filePrintPdf())); @@ -218,32 +225,36 @@ void TextEdit::setupEditActions() QToolBar *tb = new QToolBar(this); tb->setWindowTitle(tr("Edit Actions")); addToolBar(tb); - QMenu *menu = new QMenu(tr("&Edit"), this); menuBar()->addMenu(menu); QAction *a; - a = actionUndo = new QAction(QIcon(rsrcPath + "/editundo.png"), tr("&Undo"), this); + a = actionUndo = new QAction(QIcon::fromTheme("edit-undo", QIcon(rsrcPath + "/editundo.png")), + tr("&Undo"), this); a->setShortcut(QKeySequence::Undo); tb->addAction(a); menu->addAction(a); - a = actionRedo = new QAction(QIcon(rsrcPath + "/editredo.png"), tr("&Redo"), this); + a = actionRedo = new QAction(QIcon::fromTheme("edit-redo", QIcon(rsrcPath + "/editredo.png")), + tr("&Redo"), this); a->setPriority(QAction::LowPriority); a->setShortcut(QKeySequence::Redo); tb->addAction(a); menu->addAction(a); menu->addSeparator(); - a = actionCut = new QAction(QIcon(rsrcPath + "/editcut.png"), tr("Cu&t"), this); + a = actionCut = new QAction(QIcon::fromTheme("edit-cut", QIcon(rsrcPath + "/editcut.png")), + tr("Cu&t"), this); a->setPriority(QAction::LowPriority); a->setShortcut(QKeySequence::Cut); tb->addAction(a); menu->addAction(a); - a = actionCopy = new QAction(QIcon(rsrcPath + "/editcopy.png"), tr("&Copy"), this); + a = actionCopy = new QAction(QIcon::fromTheme("edit-copy", QIcon(rsrcPath + "/editcopy.png")), + tr("&Copy"), this); a->setPriority(QAction::LowPriority); a->setShortcut(QKeySequence::Copy); tb->addAction(a); menu->addAction(a); - a = actionPaste = new QAction(QIcon(rsrcPath + "/editpaste.png"), tr("&Paste"), this); + a = actionPaste = new QAction(QIcon::fromTheme("edit-paste", QIcon(rsrcPath + "/editpaste.png")), + tr("&Paste"), this); a->setPriority(QAction::LowPriority); a->setShortcut(QKeySequence::Paste); tb->addAction(a); @@ -260,10 +271,11 @@ void TextEdit::setupTextActions() QMenu *menu = new QMenu(tr("F&ormat"), this); menuBar()->addMenu(menu); - actionTextBold = new QAction(QIcon(rsrcPath + "/textbold.png"), tr("&Bold"), this); - actionTextBold->setPriority(QAction::LowPriority); + actionTextBold = new QAction(QIcon::fromTheme("format-text-bold", QIcon(rsrcPath + "/textbold.png")), + tr("&Bold"), this); actionTextBold->setShortcut(Qt::CTRL + Qt::Key_B); - QFont bold; + actionTextBold->setPriority(QAction::LowPriority); + QFont bold; bold.setBold(true); actionTextBold->setFont(bold); connect(actionTextBold, SIGNAL(triggered()), this, SLOT(textBold())); @@ -271,7 +283,8 @@ void TextEdit::setupTextActions() menu->addAction(actionTextBold); actionTextBold->setCheckable(true); - actionTextItalic = new QAction(QIcon(rsrcPath + "/textitalic.png"), tr("&Italic"), this); + actionTextItalic = new QAction(QIcon::fromTheme("format-text-italic", QIcon(rsrcPath + "/textitalic.png")), + tr("&Italic"), this); actionTextItalic->setPriority(QAction::LowPriority); actionTextItalic->setShortcut(Qt::CTRL + Qt::Key_I); QFont italic; @@ -282,9 +295,10 @@ void TextEdit::setupTextActions() menu->addAction(actionTextItalic); actionTextItalic->setCheckable(true); - actionTextUnderline = new QAction(QIcon(rsrcPath + "/textunder.png"), tr("&Underline"), this); - actionTextUnderline->setPriority(QAction::LowPriority); + actionTextUnderline = new QAction(QIcon::fromTheme("format-text-underline", QIcon(rsrcPath + "/textunder.png")), + tr("&Underline"), this); actionTextUnderline->setShortcut(Qt::CTRL + Qt::Key_U); + actionTextUnderline->setPriority(QAction::LowPriority); QFont underline; underline.setUnderline(true); actionTextUnderline->setFont(underline); @@ -300,15 +314,16 @@ void TextEdit::setupTextActions() // Make sure the alignLeft is always left of the alignRight if (QApplication::isLeftToRight()) { - actionAlignLeft = new QAction(QIcon(rsrcPath + "/textleft.png"), tr("&Left"), grp); - actionAlignCenter = new QAction(QIcon(rsrcPath + "/textcenter.png"), tr("C&enter"), grp); - actionAlignRight = new QAction(QIcon(rsrcPath + "/textright.png"), tr("&Right"), grp); + actionAlignLeft = new QAction(QIcon::fromTheme("format-justify-left", QIcon(rsrcPath + "/textleft.png")), + tr("&Left"), grp); + actionAlignCenter = new QAction(QIcon::fromTheme("format-justify-center", QIcon(rsrcPath + "/textcenter.png")), tr("C&enter"), grp); + actionAlignRight = new QAction(QIcon::fromTheme("format-justify-right", QIcon(rsrcPath + "/textright.png")), tr("&Right"), grp); } else { - actionAlignRight = new QAction(QIcon(rsrcPath + "/textright.png"), tr("&Right"), grp); - actionAlignCenter = new QAction(QIcon(rsrcPath + "/textcenter.png"), tr("C&enter"), grp); - actionAlignLeft = new QAction(QIcon(rsrcPath + "/textleft.png"), tr("&Left"), grp); + actionAlignRight = new QAction(QIcon::fromTheme("format-justify-right", QIcon(rsrcPath + "/textright.png")), tr("&Right"), grp); + actionAlignCenter = new QAction(QIcon::fromTheme("format-justify-center", QIcon(rsrcPath + "/textcenter.png")), tr("C&enter"), grp); + actionAlignLeft = new QAction(QIcon::fromTheme("format-justify-left", QIcon(rsrcPath + "/textleft.png")), tr("&Left"), grp); } - actionAlignJustify = new QAction(QIcon(rsrcPath + "/textjustify.png"), tr("&Justify"), grp); + actionAlignJustify = new QAction(QIcon::fromTheme("format-justify-fill", QIcon(rsrcPath + "/textjustify.png")), tr("&Justify"), grp); actionAlignLeft->setShortcut(Qt::CTRL + Qt::Key_L); actionAlignLeft->setCheckable(true); diff --git a/doc/src/snippets/code/src_gui_image_qicon.cpp b/doc/src/snippets/code/src_gui_image_qicon.cpp index 2b7c893..455fd84 100644 --- a/doc/src/snippets/code/src_gui_image_qicon.cpp +++ b/doc/src/snippets/code/src_gui_image_qicon.cpp @@ -20,3 +20,12 @@ void MyWidget::drawIcon(QPainter *painter, QPoint pos) painter->drawPixmap(pos, pixmap); } //! [2] + +//! [3] + QIcon undoicon = QIcon::fromTheme("edit-undo"); +//! [3] + +//! [4] + QIcon undoicon = QIcon::fromTheme("edit-undo", QIcon(":/undo.png")); +//! [4] + diff --git a/src/gui/gui.pro b/src/gui/gui.pro index b77bfdc..a49d680 100644 --- a/src/gui/gui.pro +++ b/src/gui/gui.pro @@ -46,4 +46,3 @@ contains(DEFINES,QT_EVAL):include($$QT_SOURCE_TREE/src/corelib/eval.pri) QMAKE_DYNAMIC_LIST_FILE = $$PWD/QtGui.dynlist DEFINES += Q_INTERNAL_QAPP_SRC - diff --git a/src/gui/image/image.pri b/src/gui/image/image.pri index b9c36dc..baf2125 100644 --- a/src/gui/image/image.pri +++ b/src/gui/image/image.pri @@ -6,6 +6,8 @@ HEADERS += \ image/qbitmap.h \ image/qicon.h \ + image/qicon_p.h \ + image/qiconloader_p.h \ image/qiconengine.h \ image/qiconengineplugin.h \ image/qimage.h \ @@ -32,6 +34,7 @@ HEADERS += \ SOURCES += \ image/qbitmap.cpp \ image/qicon.cpp \ + image/qiconloader.cpp \ image/qimage.cpp \ image/qimageiohandler.cpp \ image/qimagereader.cpp \ diff --git a/src/gui/image/qicon.cpp b/src/gui/image/qicon.cpp index fa407c7..7a43514 100644 --- a/src/gui/image/qicon.cpp +++ b/src/gui/image/qicon.cpp @@ -40,9 +40,11 @@ ****************************************************************************/ #include "qicon.h" +#include "qicon_p.h" #include "qiconengine.h" #include "qiconengineplugin.h" #include "private/qfactoryloader_p.h" +#include "private/qiconloader_p.h" #include "qapplication.h" #include "qstyleoption.h" #include "qpainter.h" @@ -50,6 +52,7 @@ #include "qstyle.h" #include "qpixmapcache.h" #include "qvariant.h" +#include "qcache.h" #include "qdebug.h" #ifdef Q_WS_MAC @@ -57,6 +60,11 @@ #include #endif +#ifdef Q_WS_X11 +#include "private/qt_x11_p.h" +#include "private/qkde_p.h" +#endif + QT_BEGIN_NAMESPACE /*! @@ -94,73 +102,14 @@ QT_BEGIN_NAMESPACE static QBasicAtomicInt serialNumCounter = Q_BASIC_ATOMIC_INITIALIZER(1); -class QIconPrivate -{ -public: - QIconPrivate(): engine(0), ref(1), serialNum(serialNumCounter.fetchAndAddRelaxed(1)), detach_no(0), engine_version(2), v1RefCount(0) {} - - ~QIconPrivate() { - if (engine_version == 1) { - if (!v1RefCount->deref()) { - delete engine; - delete v1RefCount; - } - } else if (engine_version == 2) { - delete engine; - } - } - - QIconEngine *engine; - - QAtomicInt ref; - int serialNum; - int detach_no; - int engine_version; - - QAtomicInt *v1RefCount; -}; - - -struct QPixmapIconEngineEntry +QIconPrivate::QIconPrivate() + : engine(0), ref(1), + serialNum(serialNumCounter.fetchAndAddRelaxed(1)), + detach_no(0), + engine_version(2), + v1RefCount(0) { - QPixmapIconEngineEntry():mode(QIcon::Normal), state(QIcon::Off){} - QPixmapIconEngineEntry(const QPixmap &pm, QIcon::Mode m = QIcon::Normal, QIcon::State s = QIcon::Off) - :pixmap(pm), size(pm.size()), mode(m), state(s){} - QPixmapIconEngineEntry(const QString &file, const QSize &sz = QSize(), QIcon::Mode m = QIcon::Normal, QIcon::State s = QIcon::Off) - :fileName(file), size(sz), mode(m), state(s){} - QPixmap pixmap; - QString fileName; - QSize size; - QIcon::Mode mode; - QIcon::State state; - bool isNull() const {return (fileName.isEmpty() && pixmap.isNull()); } -}; - -class QPixmapIconEngine : public QIconEngineV2 { -public: - QPixmapIconEngine(); - QPixmapIconEngine(const QPixmapIconEngine &); - ~QPixmapIconEngine(); - void paint(QPainter *painter, const QRect &rect, QIcon::Mode mode, QIcon::State state); - QPixmap pixmap(const QSize &size, QIcon::Mode mode, QIcon::State state); - QPixmapIconEngineEntry *bestMatch(const QSize &size, QIcon::Mode mode, QIcon::State state, bool sizeOnly); - QSize actualSize(const QSize &size, QIcon::Mode mode, QIcon::State state); - void addPixmap(const QPixmap &pixmap, QIcon::Mode mode, QIcon::State state); - void addFile(const QString &fileName, const QSize &size, QIcon::Mode mode, QIcon::State state); - - // v2 functions - QString key() const; - QIconEngineV2 *clone() const; - bool read(QDataStream &in); - bool write(QDataStream &out) const; - void virtual_hook(int id, void *data); - -private: - QPixmapIconEngineEntry *tryMatch(const QSize &size, QIcon::Mode mode, QIcon::State state); - QVector pixmaps; - - friend QDataStream &operator<<(QDataStream &s, const QIcon &icon); -}; +} QPixmapIconEngine::QPixmapIconEngine() { @@ -918,6 +867,146 @@ QList QIcon::availableSizes(Mode mode, State state) const return engine->availableSizes(mode, state); } +/*! + \since 4.6 + + Sets the search paths for icon themes. + \sa themeSearchPaths(), fromTheme() +*/ +void QIcon::setThemeSearchPaths(const QStringList &paths) +{ + QIconLoader::instance()->setThemeSearchPath(paths); +} + +/*! + \since 4.6 + + Returns the search paths for icon themes. + + The default value will depend on the platform: + + On X11, the search path will use the XDG_DATA_DIRS environment + variable if available. + + On Windows the search path defaults to [Application Directory]/icons + + On Mac the default search path will search in the + [Contents/Resources/icons] part of the application bundle. + + \sa setThemeSearchPaths(), fromName() +*/ +QStringList QIcon::themeSearchPaths() +{ + return QIconLoader::instance()->themeSearchPaths(); +} + +/*! + \since 4.6 + + Sets the current icon theme. + + The name should correspond to a directory name in the + current \ themeSearchPath() containing an index.theme + file describing it's contents.. + +*/ +void QIcon::setThemeName(const QString &path) +{ + QIconLoader::instance()->setThemeName(path); +} + +/*! + \since 4.6 + + Returns the name of the current icon theme. + + On X11, the current icon theme depends on your desktop + settings. On other platforms it is not set by default. + + \sa themeSearchPaths(), themeIcon(), fromTheme(), hasThemeIcon() +*/ +QString QIcon::themeName() +{ + return QIconLoader::instance()->themeName(); +} + +/*! + \since 4.6 + + Returns the QIcon corresponding to \a name in the current + icon theme. If no such icon is found in the current theme + \a fallback is return instead. + + To use an icon theme on Windows or Mac, you will need to + bundle a compliant theme with your application and make sure + it is located in your themeSarchPaths. + + The lastest version of the freedesktop icon specification and naming + spesification can be obtained here: + http://standards.freedesktop.org/icon-theme-spec/icon-theme-spec-latest.html + http://standards.freedesktop.org/icon-naming-spec/icon-naming-spec-latest.html + + To fetch an icon from the current icon theme: + + \snippet doc/src/snippets/code/src_gui_image_qicon.cpp 3 + + Or if you want to provide a guaranteed fallback for platforms that + do not support theme icons, you can use the second argument: + + \snippet doc/src/snippets/code/src_gui_image_qicon.cpp 4 + + \note By default, only X11 will support themed icons. In order to + use themed icons on Mac and Windows, you will have to bundle a + compliant theme in one of your themeSearchPaths() and set the + appropriate themeName(). + + \sa themeName(), themeSearchPaths() +*/ +QIcon QIcon::fromTheme(const QString &name, const QIcon &fallback) +{ + + static QCache 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 { + QIcon *cachedIcon = new QIcon(new QIconLoaderEngine(name)); + iconCache.insert(name, cachedIcon); + icon = *cachedIcon; + } + + if (icon.availableSizes().isEmpty()) + return fallback; + + return icon; +} + +/*! + \since 4.6 + + Returns true if there is an icon available for a \a name in the current + icon theme, otherwise returns false. + + \sa themeSearchPaths(), fromTheme() +*/ +bool QIcon::hasThemeIcon(const QString &name) +{ + QIcon icon = fromTheme(name); + + return !icon.isNull(); +} + + /***************************************************************************** QIcon stream functions *****************************************************************************/ @@ -989,6 +1078,11 @@ QDataStream &operator>>(QDataStream &s, QIcon &icon) QIconEngineV2 *engine = new QPixmapIconEngine; icon.d->engine = engine; engine->read(s); + } else if (key == QLatin1String("QIconLoaderEngine")) { + icon.d = new QIconPrivate; + QIconEngineV2 *engine = new QIconLoaderEngine(); + icon.d->engine = engine; + engine->read(s); #if !defined (QT_NO_LIBRARY) && !defined(QT_NO_SETTINGS) } else if (QIconEngineFactoryInterfaceV2 *factory = qobject_cast(loaderV2()->instance(key))) { if (QIconEngineV2 *engine= factory->create()) { diff --git a/src/gui/image/qicon.h b/src/gui/image/qicon.h index c318e14..2a71717 100644 --- a/src/gui/image/qicon.h +++ b/src/gui/image/qicon.h @@ -97,6 +97,16 @@ public: QList availableSizes(Mode mode = Normal, State state = Off) const; + static QIcon fromTheme(const QString &name, const QIcon &fallback = QIcon()); + static bool hasThemeIcon(const QString &name); + + static QStringList themeSearchPaths(); + static void setThemeSearchPaths(const QStringList &searchpath); + + static QString themeName(); + static void setThemeName(const QString &path); + + #ifdef QT3_SUPPORT enum Size { Small, Large, Automatic = Small }; static QT3_SUPPORT void setPixmapSize(Size which, const QSize &size); diff --git a/src/gui/image/qicon_p.h b/src/gui/image/qicon_p.h new file mode 100644 index 0000000..ccac4c3 --- /dev/null +++ b/src/gui/image/qicon_p.h @@ -0,0 +1,138 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QICON_P_H +#define QICON_P_H + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + +#include +#include +#include +#include +#include +#include + +QT_BEGIN_NAMESPACE + +class QIconPrivate +{ +public: + QIconPrivate(); + + ~QIconPrivate() { + if (engine_version == 1) { + if (!v1RefCount->deref()) { + delete engine; + delete v1RefCount; + } + } else if (engine_version == 2) { + delete engine; + } + } + + QIconEngine *engine; + + QAtomicInt ref; + int serialNum; + int detach_no; + int engine_version; + + QAtomicInt *v1RefCount; +}; + + +struct QPixmapIconEngineEntry +{ + QPixmapIconEngineEntry():mode(QIcon::Normal), state(QIcon::Off){} + QPixmapIconEngineEntry(const QPixmap &pm, QIcon::Mode m = QIcon::Normal, QIcon::State s = QIcon::Off) + :pixmap(pm), size(pm.size()), mode(m), state(s){} + QPixmapIconEngineEntry(const QString &file, const QSize &sz = QSize(), QIcon::Mode m = QIcon::Normal, QIcon::State s = QIcon::Off) + :fileName(file), size(sz), mode(m), state(s){} + QPixmap pixmap; + QString fileName; + QSize size; + QIcon::Mode mode; + QIcon::State state; + bool isNull() const {return (fileName.isEmpty() && pixmap.isNull()); } +}; + + + +class QPixmapIconEngine : public QIconEngineV2 { +public: + QPixmapIconEngine(); + QPixmapIconEngine(const QPixmapIconEngine &); + ~QPixmapIconEngine(); + void paint(QPainter *painter, const QRect &rect, QIcon::Mode mode, QIcon::State state); + QPixmap pixmap(const QSize &size, QIcon::Mode mode, QIcon::State state); + QPixmapIconEngineEntry *bestMatch(const QSize &size, QIcon::Mode mode, QIcon::State state, bool sizeOnly); + QSize actualSize(const QSize &size, QIcon::Mode mode, QIcon::State state); + void addPixmap(const QPixmap &pixmap, QIcon::Mode mode, QIcon::State state); + void addFile(const QString &fileName, const QSize &size, QIcon::Mode mode, QIcon::State state); + + // v2 functions + QString key() const; + QIconEngineV2 *clone() const; + bool read(QDataStream &in); + bool write(QDataStream &out) const; + void virtual_hook(int id, void *data); + +private: + QPixmapIconEngineEntry *tryMatch(const QSize &size, QIcon::Mode mode, QIcon::State state); + QVector pixmaps; + + friend QDataStream &operator<<(QDataStream &s, const QIcon &icon); + friend class QIconThemeEngine; +}; + +QT_END_NAMESPACE + +#endif // QICON_P_H diff --git a/src/gui/image/qiconloader.cpp b/src/gui/image/qiconloader.cpp new file mode 100644 index 0000000..6bf8d3b --- /dev/null +++ b/src/gui/image/qiconloader.cpp @@ -0,0 +1,599 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at http://www.qtsoftware.com/contact. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +#ifdef Q_WS_MAC +#include +#endif + +#ifdef Q_WS_X11 +#include +#include +#endif + +QT_BEGIN_NAMESPACE + +Q_GLOBAL_STATIC(QIconLoader, iconLoaderInstance) + +static QString systemThemeName() +{ + QString result; +#ifdef Q_WS_X11 + if (X11->desktopEnvironment == DE_GNOME) { + result = QGtk::getGConfString(QLatin1String("/desktop/gnome/interface/icon_theme"), + QLatin1String("gnome")); + } else if (X11->desktopEnvironment == DE_KDE) { + QString kdeDefault = X11->desktopVersion >= 4 ? + QString::fromLatin1("oxygen") : + QString::fromLatin1("crystalsvg"); + + QSettings settings(QKde::kdeHome() + + QLatin1String("/share/config/kdeglobals"), + QSettings::IniFormat); + + settings.beginGroup(QLatin1String("Icons")); + + result = settings.value(QLatin1String("Theme"), kdeDefault).toString(); + } +#endif + return result; +} + +static QString fallbackTheme() +{ + QString defaultTheme = systemThemeName(); + if (defaultTheme.isEmpty()) + defaultTheme = QLatin1String("hicolor"); + return defaultTheme; +} + +QIconLoader::QIconLoader() : + m_themeKey(1), m_supportsSvg(false) +{ + m_systemTheme = systemThemeName(); + + QFactoryLoader iconFactoryLoader(QIconEngineFactoryInterfaceV2_iid, + QLatin1String("/iconengines"), + Qt::CaseInsensitive); + if (iconFactoryLoader.keys().contains(QLatin1String("svg"))) + m_supportsSvg = true; +} + +QIconLoader *QIconLoader::instance() +{ + return iconLoaderInstance(); +} + +// Queries the system theme and invalidates existing +// icons if the theme has changed. +void QIconLoader::updateSystemTheme() +{ + // Only change if this is not explicitly set by the user + if (m_userTheme.isEmpty()) { + QString theme = systemThemeName(); + if (theme != m_systemTheme) { + m_systemTheme = theme; + invalidateKey(); + } + } +} + +void QIconLoader::setThemeName(const QString &themeName) +{ + m_userTheme = themeName; + invalidateKey(); +} + +void QIconLoader::setThemeSearchPath(const QStringList &searchPaths) +{ + m_iconDirs = searchPaths; + themeList.clear(); + invalidateKey(); +} + +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()); + +#elif 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 + } + return m_iconDirs; +} + +QIconTheme::QIconTheme(const QString &themeName) + : m_valid(false) +{ + QFile themeIndex; + + QList keyList; + QStringList iconDirs = QIcon::themeSearchPaths(); + for ( int i = 0 ; i < iconDirs.size() ; ++i) { + QDir iconDir(iconDirs[i]); + QString themeDir = iconDir.path() + QLatin1Char('/') + themeName; + themeIndex.setFileName(themeDir + QLatin1String("/index.theme")); + if (themeIndex.exists()) { + m_contentDir = themeDir; + m_valid = true; + break; + } + } + + if (themeIndex.exists()) { + const QSettings indexReader(themeIndex.fileName(), QSettings::IniFormat); + QStringListIterator keyIterator(indexReader.allKeys()); + while (keyIterator.hasNext()) { + + const QString key = keyIterator.next(); + if (key.endsWith(QLatin1String("/Size"))) { + // Note the QSettings ini-format does not accept + // slashes in key names, hence we have to cheat + if (int size = indexReader.value(key).toInt()) { + QString directoryKey = key.left(key.size() - 5); + QIconDirInfo dirInfo(directoryKey); + dirInfo.size = size; + QString type = indexReader.value(directoryKey + + QLatin1String("/Type") + ).toString(); + + if (type == QLatin1String("Fixed")) + dirInfo.type = QIconDirInfo::Fixed; + else if (type == QLatin1String("Scalable")) + dirInfo.type = QIconDirInfo::Scalable; + else + dirInfo.type = QIconDirInfo::Threshold; + + dirInfo.threshold = indexReader.value(directoryKey + + QLatin1String("/Threshold"), + 2).toInt(); + + dirInfo.minSize = indexReader.value(directoryKey + + QLatin1String("/MinSize"), + size).toInt(); + + dirInfo.maxSize = indexReader.value(directoryKey + + QLatin1String("/MaxSize"), + size).toInt(); + m_keyList.append(dirInfo); + } + } + } + + // Parent themes provide fallbacks for missing icons + m_parents = indexReader.value( + QLatin1String("Icon Theme/Inherits")).toStringList(); + + // Ensure a default platform fallback for all themes + if (m_parents.isEmpty()) + m_parents.append(fallbackTheme()); + + // Ensure that all themes fall back to hicolor + if (!m_parents.isEmpty()) + m_parents.append(QLatin1String("hicolor")); + } +} + +QThemeIconEntries QIconLoader::findIconHelper(const QString &themeName, + const QString &iconName, + QStringList &visited) const +{ + QThemeIconEntries entries; + Q_ASSERT(!themeName.isEmpty()); + + QPixmap pixmap; + + // Used to protect against potential recursions + visited << themeName; + + QIconTheme theme = themeList.value(themeName); + if (!theme.isValid()) { + theme = QIconTheme(themeName); + if (!theme.isValid()) + theme = fallbackTheme(); + + themeList.insert(themeName, theme); + } + + QString contentDir = theme.contentDir() + QLatin1Char('/'); + QList subDirs = theme.keyList(); + + const QString svgext(QLatin1String(".svg")); + const QString pngext(QLatin1String(".png")); + + // Add all relevant files + for (int i = 0; i < subDirs.size() ; ++i) { + const QIconDirInfo &dirInfo = subDirs.at(i); + QString subdir = dirInfo.path; + QDir currentDir(contentDir + subdir); + + if (dirInfo.type == QIconDirInfo::Scalable && m_supportsSvg && + currentDir.exists(iconName + svgext)) { + ScalableEntry *iconEntry = new ScalableEntry; + iconEntry->dir = dirInfo; + iconEntry->filename = currentDir.filePath(iconName + svgext); + entries.append(iconEntry); + + } else if (currentDir.exists(iconName + pngext)) { + PixmapEntry *iconEntry = new PixmapEntry; + iconEntry->dir = dirInfo; + iconEntry->filename = currentDir.filePath(iconName + pngext); + // Notice we ensure that pixmap entries allways come before + // scalable to preserve search order afterwards + entries.prepend(iconEntry); + } + } + + if (entries.isEmpty()) { + const QStringList parents = theme.parents(); + // Search recursively through inherited themes + for (int i = 0 ; i < parents.size() ; ++i) { + + const QString parentTheme = parents.at(i).trimmed(); + + if (!visited.contains(parentTheme)) // guard against recursion + entries = findIconHelper(parentTheme, iconName, visited); + + if (!entries.isEmpty()) // success + break; + } + } + return entries; +} + +QThemeIconEntries QIconLoader::loadIcon(const QString &name) const +{ + if (!themeName().isEmpty()) { + QStringList visited; + return findIconHelper(themeName(), name, visited); + } + + return QThemeIconEntries(); +} + + +// -------- Icon Loader Engine -------- // + + +QIconLoaderEngine::QIconLoaderEngine(const QString& iconName) + : m_iconName(iconName), m_key(0) +{ +} + +QIconLoaderEngine::~QIconLoaderEngine() +{ + while (!m_entries.isEmpty()) + delete m_entries.takeLast(); + Q_ASSERT(m_entries.size() == 0); +} + +QIconLoaderEngine::QIconLoaderEngine(const QIconLoaderEngine &other) + : QIconEngineV2(other), + m_iconName(other.m_iconName), + m_key(0) +{ +} + +QIconEngineV2 *QIconLoaderEngine::clone() const +{ + return new QIconLoaderEngine(*this); +} + +bool QIconLoaderEngine::read(QDataStream &in) { + in >> m_iconName; + return true; +} + +bool QIconLoaderEngine::write(QDataStream &out) const +{ + out << m_iconName; + return true; +} + +bool QIconLoaderEngine::hasIcon() const +{ + return !(m_entries.isEmpty()); +} + +// Lazily load the icon +void QIconLoaderEngine::ensureLoaded() +{ + if (!(iconLoaderInstance()->themeKey() == m_key)) { + + while (!m_entries.isEmpty()) + delete m_entries.takeLast(); + + Q_ASSERT(m_entries.size() == 0); + m_entries = iconLoaderInstance()->loadIcon(m_iconName); + m_key = iconLoaderInstance()->themeKey(); + } +} + +void QIconLoaderEngine::paint(QPainter *painter, const QRect &rect, + QIcon::Mode mode, QIcon::State state) +{ + QSize pixmapSize = rect.size(); +#if defined(Q_WS_MAC) + pixmapSize *= qt_mac_get_scalefactor(); +#endif + painter->drawPixmap(rect, pixmap(pixmapSize, mode, state)); +} + +/* + * This algorithm is defined by the freedesktop spec: + * http://standards.freedesktop.org/icon-theme-spec/icon-theme-spec-latest.html + */ +static bool directoryMatchesSize(const QIconDirInfo &dir, int iconsize) +{ + if (dir.type == QIconDirInfo::Fixed) { + return dir.size == iconsize; + + } else if (dir.type == QIconDirInfo::Scalable) { + return dir.size <= dir.maxSize && + iconsize >= dir.minSize; + + } else if (dir.type == QIconDirInfo::Threshold) { + return iconsize >= dir.size - dir.threshold && + iconsize <= dir.size + dir.threshold; + } + + Q_ASSERT(1); // Not a valid value + return false; +} + +/* + * This algorithm is defined by the freedesktop spec: + * http://standards.freedesktop.org/icon-theme-spec/icon-theme-spec-latest.html + */ +static int directorySizeDistance(const QIconDirInfo &dir, int iconsize) +{ + if (dir.type == QIconDirInfo::Fixed) { + return qAbs(dir.size - iconsize); + + } else if (dir.type == QIconDirInfo::Scalable) { + if (iconsize < dir.minSize) + return dir.minSize - iconsize; + else if (iconsize > dir.maxSize) + return iconsize - dir.maxSize; + else + return 0; + + } else if (dir.type == QIconDirInfo::Threshold) { + if (iconsize < dir.size - dir.threshold) + return dir.minSize - iconsize; + else if (iconsize > dir.size + dir.threshold) + return iconsize - dir.maxSize; + else return 0; + } + + Q_ASSERT(1); // Not a valid value + return INT_MAX; +} + +QIconLoaderEngineEntry *QIconLoaderEngine::entryForSize(const QSize &size) +{ + int iconsize = qMin(size.width(), size.height()); + + // Note that m_entries are sorted so that png-files + // come first + + // Search for exact matches first + for (int i = 0; i < m_entries.count(); ++i) { + QIconLoaderEngineEntry *entry = m_entries.at(i); + if (directoryMatchesSize(entry->dir, iconsize)) { + return entry; + } + } + + // Find the minimum distance icon + int minimalSize = INT_MAX; + QIconLoaderEngineEntry *closestMatch = 0; + for (int i = 0; i < m_entries.count(); ++i) { + QIconLoaderEngineEntry *entry = m_entries.at(i); + int distance = directorySizeDistance(entry->dir, iconsize); + if (distance < minimalSize) { + minimalSize = distance; + closestMatch = entry; + } + } + return closestMatch; +} + +/* + * Returns the actual icon size. For scalable svg's this is equivalent + * to the requested size. Otherwise the closest match is returned. + * + * todo: the spec is a bit fuzzy in this area, but we should probably + * allow scaling down pixmap icons as well. + * + */ +QSize QIconLoaderEngine::actualSize(const QSize &size, QIcon::Mode mode, + QIcon::State state) +{ + ensureLoaded(); + + QIconLoaderEngineEntry *entry = entryForSize(size); + if (entry) { + const QIconDirInfo &dir = entry->dir; + if (dir.type == QIconDirInfo::Scalable) + return size; + else + return QSize(dir.size, dir.size); + } + return QIconEngineV2::actualSize(size, mode, state); +} + +QPixmap PixmapEntry::pixmap(const QSize &size, QIcon::Mode mode, QIcon::State state) +{ + Q_UNUSED(state); + + // Ensure that basePixmap is lazily initialized before generating the + // key, otherwise the cache key is not unique + if (basePixmap.isNull()) + basePixmap.load(filename); + + int actualSize = qMin(size.width(), size.height()); + QString key = QLatin1String("$qt_theme_") + + QString::number(basePixmap.cacheKey(), 16) + + QLatin1Char('_') + + QString::number(mode) + + QLatin1Char('_') + + QString::number(qApp->palette().cacheKey(), 16) + + QLatin1Char('_') + + QString::number(actualSize); + + QPixmap cachedPixmap; + if (QPixmapCache::find(key, &cachedPixmap)) { + return cachedPixmap; + } else { + QStyleOption opt(0); + opt.palette = qApp->palette(); + cachedPixmap = qApp->style()->generatedIconPixmap(mode, basePixmap, &opt); + QPixmapCache::insert(key, cachedPixmap); + } + return cachedPixmap; +} + +QPixmap ScalableEntry::pixmap(const QSize &size, QIcon::Mode mode, QIcon::State state) +{ + if (svgIcon.isNull()) + svgIcon = QIcon(filename); + + // Simply reuse svg icon engine + return svgIcon.pixmap(size, mode, state); +} + +QPixmap QIconLoaderEngine::pixmap(const QSize &size, QIcon::Mode mode, + QIcon::State state) +{ + ensureLoaded(); + + QIconLoaderEngineEntry *entry = entryForSize(size); + if (entry) + return entry->pixmap(size, mode, state); + + return QPixmap(); +} + +QString QIconLoaderEngine::key() const +{ + return QLatin1String("QIconLoaderEngine"); +} + +void QIconLoaderEngine::virtual_hook(int id, void *data) +{ + ensureLoaded(); + + switch (id) { + case QIconEngineV2::AvailableSizesHook: + { + QIconEngineV2::AvailableSizesArgument &arg + = *reinterpret_cast(data); + const QList directoryKey = iconLoaderInstance()->theme().keyList(); + arg.sizes.clear(); + + // Gets all sizes from the DirectoryInfo entries + for (int i = 0 ; i < m_entries.size() ; ++i) { + int size = m_entries.at(i)->dir.size; + arg.sizes.append(QSize(size, size)); + } + } + break; + default: + QIconEngineV2::virtual_hook(id, data); + } +} + +QT_END_NAMESPACE diff --git a/src/gui/image/qiconloader_p.h b/src/gui/image/qiconloader_p.h new file mode 100644 index 0000000..707107c --- /dev/null +++ b/src/gui/image/qiconloader_p.h @@ -0,0 +1,185 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QDESKTOPICON_P_H +#define QDESKTOPICON_P_H + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + +#include +#include +#include +#include +#include + +QT_BEGIN_NAMESPACE + +class QIconLoader; + +struct QIconDirInfo +{ + enum Type { Fixed, Scalable, Threshold }; + QIconDirInfo(const QString &_path = QString()) : + path(_path), + size(0), + maxSize(0), + minSize(0), + threshold(0), + type(Threshold) {} + QString path; + short size; + short maxSize; + short minSize; + short threshold; + Type type : 4; +}; + +class QIconLoaderEngineEntry + { +public: + virtual QPixmap pixmap(const QSize &size, + QIcon::Mode mode, + QIcon::State state) = 0; + QString filename; + QIconDirInfo dir; + static int count; +}; + +struct ScalableEntry : public QIconLoaderEngineEntry +{ + QPixmap pixmap(const QSize &size, QIcon::Mode mode, QIcon::State state); + QIcon svgIcon; +}; + +struct PixmapEntry : public QIconLoaderEngineEntry +{ + QPixmap pixmap(const QSize &size, QIcon::Mode mode, QIcon::State state); + QPixmap basePixmap; +}; + +typedef QList QThemeIconEntries; + +class QIconLoaderEngine : public QIconEngineV2 +{ +public: + QIconLoaderEngine(const QString& iconName = QString()); + ~QIconLoaderEngine(); + + void paint(QPainter *painter, const QRect &rect, QIcon::Mode mode, QIcon::State state); + QPixmap pixmap(const QSize &size, QIcon::Mode mode, QIcon::State state); + QSize actualSize(const QSize &size, QIcon::Mode mode, QIcon::State state); + QIconEngineV2 *clone() const; + bool read(QDataStream &in); + bool write(QDataStream &out) const; + +private: + QString key() const; + bool hasIcon() const; + void ensureLoaded(); + void virtual_hook(int id, void *data); + QIconLoaderEngineEntry *entryForSize(const QSize &size); + QIconLoaderEngine(const QIconLoaderEngine &other); + QThemeIconEntries m_entries; + QString m_iconName; + uint m_key; + + friend class QIconLoader; +}; + +class QIconTheme +{ +public: + QIconTheme(const QString &name); + QIconTheme() : m_valid(false) {}; + QStringList parents() { return m_parents; } + QList keyList() { return m_keyList; } + QString contentDir() { return m_contentDir; } + bool isValid() { return m_valid; } + +private: + QString m_contentDir; + QList m_keyList; + QStringList m_parents; + bool m_valid; +}; + +class QIconLoader : public QObject +{ +public: + QIconLoader(); + QThemeIconEntries loadIcon(const QString &iconName) const; + uint themeKey() const { return m_themeKey; } + + QString themeName() const { return m_userTheme.isEmpty() ? m_systemTheme : m_userTheme; } + void setThemeName(const QString &themeName); + QIconTheme theme() { return themeList.value(themeName()); } + void setThemeSearchPath(const QStringList &searchPaths); + QStringList themeSearchPaths() const; + QIconDirInfo dirInfo(int dirindex); + static QIconLoader *instance(); + void updateSystemTheme(); + void invalidateKey() { m_themeKey++; } + +private: + QThemeIconEntries findIconHelper(const QString &themeName, + const QString &iconName, + QStringList &visited) const; + uint m_themeKey; + bool m_supportsSvg; + + mutable QString m_userTheme; + mutable QString m_systemTheme; + mutable QStringList m_iconDirs; + mutable QHash themeList; +}; + +QT_END_NAMESPACE + +#endif // QDESKTOPICON_P_H diff --git a/src/gui/kernel/qapplication_x11.cpp b/src/gui/kernel/qapplication_x11.cpp index 32e7e3c..221101a 100644 --- a/src/gui/kernel/qapplication_x11.cpp +++ b/src/gui/kernel/qapplication_x11.cpp @@ -78,6 +78,7 @@ #include #include #include +#include #include "qstyle.h" #include "qmetaobject.h" #include "qtimer.h" @@ -1087,7 +1088,6 @@ static void qt_set_x11_resources(const char* font = 0, const char* fg = 0, if (QApplication::desktopSettingsAware()) { // first, read from settings QApplicationPrivate::x11_apply_settings(); - // the call to QApplication::style() below creates the system // palette, which breaks the logic after the RESOURCE_MANAGER // loop... so I have to save this value to be able to use it later @@ -1328,6 +1328,8 @@ static void qt_set_x11_resources(const char* font = 0, const char* fg = 0, QApplication::setEffectEnabled(Qt::UI_AnimateToolBox, effects.contains(QLatin1String("animatetoolbox"))); } + + QIconLoader::instance()->updateSystemTheme(); } diff --git a/src/gui/styles/gtksymbols.cpp b/src/gui/styles/gtksymbols.cpp index f947ac1..c8b4fda 100644 --- a/src/gui/styles/gtksymbols.cpp +++ b/src/gui/styles/gtksymbols.cpp @@ -60,6 +60,7 @@ #include #include +#include #include #include @@ -341,9 +342,9 @@ static bool resolveGConf() typedef int (*x11ErrorHandler)(Display*, XErrorEvent*); -static QString getGConfString(const QString &value) +QString QGtk::getGConfString(const QString &value, const QString &fallback) { - QString retVal; + QString retVal = fallback; if (resolveGConf()) { g_type_init(); GConfClient* client = QGtk::gconf_client_get_default(); @@ -393,7 +394,7 @@ static QString getThemeName() // Fall back to gconf if (themeName.isEmpty() && resolveGConf()) - themeName = getGConfString(QLS("/desktop/gnome/interface/gtk_theme")); + themeName = QGtk::getGConfString(QLS("/desktop/gnome/interface/gtk_theme")); return themeName; } @@ -561,6 +562,7 @@ void QGtkStyleUpdateScheduler::updateTheme() QApplication::sendEvent(widget, &e); } } + QIconLoader::instance()->updateSystemTheme(); } static void add_widget(GtkWidget *widget) diff --git a/src/gui/styles/gtksymbols_p.h b/src/gui/styles/gtksymbols_p.h index 18c6dc5..68e970a 100644 --- a/src/gui/styles/gtksymbols_p.h +++ b/src/gui/styles/gtksymbols_p.h @@ -216,6 +216,7 @@ public: static QString openDirectory(QWidget *parent, const QString &caption, const QString &dir, QFileDialog::Options options); static QStringList openFilenames(QWidget *parent, const QString &caption, const QString &dir, const QString &filter, QString *selectedFilter, QFileDialog::Options options); + static QString getGConfString(const QString &key, const QString &fallback = QString()); static Ptr_gtk_container_forall gtk_container_forall; static Ptr_gtk_init gtk_init; diff --git a/src/gui/styles/qcleanlooksstyle.cpp b/src/gui/styles/qcleanlooksstyle.cpp index 8f88781..1782e36 100644 --- a/src/gui/styles/qcleanlooksstyle.cpp +++ b/src/gui/styles/qcleanlooksstyle.cpp @@ -462,26 +462,6 @@ static const char * const qt_cleanlooks_checkbox_checked[] = { " ", " "}; -#ifdef Q_WS_X11 -extern "C" { - struct GConfClient; - struct GError; - typedef void (*Ptr_g_type_init)(); - typedef GConfClient* (*Ptr_gconf_client_get_default)(); - typedef char* (*Ptr_gconf_client_get_string)(GConfClient*, const char*, GError **); - typedef void (*Ptr_g_object_unref)(void *); - typedef void (*Ptr_g_error_free)(GError *); - typedef void (*Ptr_g_free)(void*); -} - -static Ptr_g_type_init p_g_type_init = 0; -static Ptr_gconf_client_get_default p_gconf_client_get_default = 0; -static Ptr_gconf_client_get_string p_gconf_client_get_string = 0; -static Ptr_g_object_unref p_g_object_unref = 0; -static Ptr_g_error_free p_g_error_free = 0; -static Ptr_g_free p_g_free = 0; -#endif - static void qt_cleanlooks_draw_gradient(QPainter *painter, const QRect &rect, const QColor &gradientStart, const QColor &gradientStop, Direction direction = TopDown, QBrush bgBrush = QBrush()) { @@ -3848,17 +3828,6 @@ QSize QCleanlooksStyle::sizeFromContents(ContentsType type, const QStyleOption * void QCleanlooksStyle::polish(QApplication *app) { QWindowsStyle::polish(app); -#ifdef Q_WS_X11 - Q_D(QCleanlooksStyle); - - QString dataDirs = QLatin1String(getenv("XDG_DATA_DIRS")); - - if (dataDirs.isEmpty()) - dataDirs = QLatin1String("/usr/local/share/:/usr/share/"); - - dataDirs.prepend(QDir::homePath() + QLatin1String("/:")); - d->iconDirs = dataDirs.split(QLatin1Char(':')); -#endif } /*! @@ -4376,44 +4345,6 @@ QRect QCleanlooksStyle::subElementRect(SubElement sr, const QStyleOption *opt, c return r; } -void QCleanlooksStylePrivate::lookupIconTheme() const -{ -#ifdef Q_WS_X11 - - if (themeName.isEmpty()) { - //resolve glib and gconf functions - p_g_type_init = (Ptr_g_type_init)QLibrary::resolve(QLatin1String("gobject-2.0"), 0, "g_type_init"); - p_gconf_client_get_default = (Ptr_gconf_client_get_default)QLibrary::resolve(QLatin1String("gconf-2"), 4, "gconf_client_get_default"); - p_gconf_client_get_string = (Ptr_gconf_client_get_string)QLibrary::resolve(QLatin1String("gconf-2"), 4, "gconf_client_get_string"); - p_g_object_unref = (Ptr_g_object_unref)QLibrary::resolve(QLatin1String("gobject-2.0"), 0, "g_object_unref"); - p_g_error_free = (Ptr_g_error_free)QLibrary::resolve(QLatin1String("glib-2.0"), 0, "g_error_free"); - p_g_free = (Ptr_g_free)QLibrary::resolve(QLatin1String("glib-2.0"), 0, "g_free"); - - if (p_g_type_init && - p_gconf_client_get_default && - p_gconf_client_get_string && - p_g_object_unref && - p_g_error_free && - p_g_free) { - - p_g_type_init(); - GConfClient* client = p_gconf_client_get_default(); - GError *err = 0; - char *str = p_gconf_client_get_string(client, "/desktop/gnome/interface/icon_theme", &err); - if (!err) { - themeName = QString::fromUtf8(str); - p_g_free(str); - } - p_g_object_unref(client); - if (err) - p_g_error_free (err); - } - if (themeName.isEmpty()) - themeName = QLatin1String("gnome"); - } -#endif -} - /*! \internal */ @@ -4421,165 +4352,6 @@ QIcon QCleanlooksStyle::standardIconImplementation(StandardPixmap standardIcon, const QStyleOption *option, const QWidget *widget) const { -#ifdef Q_WS_X11 - Q_D(const QCleanlooksStyle); - if (!QApplication::desktopSettingsAware()) - return QWindowsStyle::standardIconImplementation(standardIcon, option, widget); - QIcon icon; - QPixmap pixmap; - QPixmap link; - d->lookupIconTheme(); - switch (standardIcon) { - case SP_DirIcon: { - icon = QIcon(proxy()->standardPixmap(standardIcon, option, widget)); - icon.addPixmap(proxy()->standardPixmap(SP_DirClosedIcon, option, widget), - QIcon::Normal, QIcon::Off); - pixmap = d->findIcon(16, QLatin1String("gnome-fs-directory.png")); - if (!pixmap.isNull()) - icon.addPixmap(pixmap, QIcon::Normal, QIcon::Off); - pixmap = d->findIcon(48, QLatin1String("gnome-fs-directory.png")); - if (!pixmap.isNull()) - icon.addPixmap(pixmap, QIcon::Normal, QIcon::Off); - pixmap = d->findIcon(16, QLatin1String("gnome-fs-directory-accept.png")); - if (!pixmap.isNull()) - icon.addPixmap(pixmap, QIcon::Normal, QIcon::On); - pixmap = d->findIcon(16, QLatin1String("gnome-fs-directory-accept.png")); - if (!pixmap.isNull()) - icon.addPixmap(pixmap, QIcon::Normal, QIcon::On); - } - break; - case SP_DirLinkIcon: - { - icon = QIcon(proxy()->standardPixmap(standardIcon, option, widget)); - QPixmap link = d->findIcon(12, QLatin1String("emblem-symbolic-link.png")); - if (!link.isNull()) { - icon.addPixmap(proxy()->standardPixmap(SP_DirLinkIcon, option, widget)); - pixmap = d->findIcon(16, QLatin1String("gnome-fs-directory.png")); - if (!pixmap.isNull()) { - QPainter painter(&pixmap); - painter.drawPixmap(8, 8, 8, 8, link); - painter.end(); - icon.addPixmap(pixmap); - } - } - break; - } - case SP_FileIcon: - { - icon = d->createIcon(QLatin1String("unknown.png")); - if (icon.isNull()) - icon = d->createIcon(QLatin1String("gnome-fs-regular.png")); - if (icon.isNull()) - icon = d->createIcon(QLatin1String("stock_new.png")); - break; - } - case SP_DialogCloseButton: - { - icon = d->createIcon(QLatin1String("gtk-close.png")); - if (icon.isNull()) - icon = d->createIcon(QLatin1String("stock-close.png")); - break; - } - case SP_DirHomeIcon: - { - icon = d->createIcon(QLatin1String("folder_home.png")); - if (icon.isNull()) - icon = d->createIcon(QLatin1String("gnome_home.png")); - break; - } - case SP_DriveFDIcon: - { - icon = d->createIcon(QLatin1String("gnome-dev-floppy.png")); - break; - } - case SP_ComputerIcon: - { - icon = d->createIcon(QLatin1String("gnome-fs-client.png")); - break; - } - case SP_DesktopIcon: - { - icon = d->createIcon(QLatin1String("gnome-fs-desktop.png")); - break; - } - case SP_TrashIcon: - { - icon = d->createIcon(QLatin1String("gnome-fs-trash-empty.png")); - break; - } - case SP_DriveCDIcon: - case SP_DriveDVDIcon: - { - icon = d->createIcon(QLatin1String("gnome-dev-cdrom.png")); - break; - } - case SP_DriveHDIcon: - { - icon = d->createIcon(QLatin1String("gnome-dev-harddisk.png")); - break; - } - case SP_ArrowUp: - { - icon = d->createIcon(QLatin1String("stock_up.png")); - break; - } - case SP_ArrowDown: - { - icon = d->createIcon(QLatin1String("stock_down.png")); - break; - } - case SP_ArrowRight: - { - icon = d->createIcon(QLatin1String("stock_right.png")); - break; - } - case SP_ArrowLeft: - { - icon = d->createIcon(QLatin1String("stock_left.png")); - break; - } - case SP_BrowserReload: - { - icon = d->createIcon(QLatin1String("view-refresh.png")); - break; - } - case SP_BrowserStop: - { - pixmap = d->findIcon(24, QLatin1String("stop.png")); - break; - } - case SP_FileLinkIcon: - { - icon = QIcon(proxy()->standardPixmap(standardIcon, option, widget)); - QPixmap link = d->findIcon(12, QLatin1String("emblem-symbolic-link.png")); - if (!link.isNull()) { - icon.addPixmap(proxy()->standardPixmap(SP_FileLinkIcon,option, widget)); - pixmap = d->findIcon(16, QLatin1String("unknown.png")); - if (pixmap.isNull()) - pixmap = d->findIcon(16, QLatin1String("stock_new.png")); - if (!pixmap.isNull()) { - QPainter painter(&pixmap); - painter.drawPixmap(8, 8, 8, 8, link); - painter.end(); - icon.addPixmap(pixmap); - } - } - break; - } - case SP_ArrowForward: - if (QApplication::layoutDirection() == Qt::RightToLeft) - return standardIconImplementation(SP_ArrowLeft, option, widget); - return standardIconImplementation(SP_ArrowRight, option, widget); - case SP_ArrowBack: - if (QApplication::layoutDirection() == Qt::RightToLeft) - return standardIconImplementation(SP_ArrowRight, option, widget); - return standardIconImplementation(SP_ArrowLeft, option, widget); - default: - icon = QIcon(proxy()->standardPixmap(standardIcon, option, widget)); - } - if (!icon.isNull()) - return icon; -#endif // Q_WS_X11 return QWindowsStyle::standardIconImplementation(standardIcon, option, widget); } @@ -4589,341 +4361,10 @@ QIcon QCleanlooksStyle::standardIconImplementation(StandardPixmap standardIcon, QPixmap QCleanlooksStyle::standardPixmap(StandardPixmap standardPixmap, const QStyleOption *opt, const QWidget *widget) const { -#ifdef Q_WS_X11 - Q_D(const QCleanlooksStyle); QPixmap pixmap; - if (!QApplication::desktopSettingsAware()) - return QWindowsStyle::standardPixmap(standardPixmap, opt, widget); - d->lookupIconTheme(); + #ifndef QT_NO_IMAGEFORMAT_XPM switch (standardPixmap) { - case SP_MessageBoxInformation: - { - pixmap = d->findIcon(48, QLatin1String("dialog-info.png")); - if (pixmap.isNull()) - pixmap = d->findIcon(48, QLatin1String("stock_dialog-info.png")); - if (!pixmap.isNull()) - return pixmap; - break; - } - case SP_MessageBoxWarning: - { - pixmap = d->findIcon(48, QLatin1String("dialog-warning.png")); - if (pixmap.isNull()) - pixmap = d->findIcon(48, QLatin1String("stock_dialog-warning.png")); - if (!pixmap.isNull()) - return pixmap; - break; - } - case SP_MessageBoxCritical: - { - pixmap = d->findIcon(48, QLatin1String("dialog-error.png")); - if (pixmap.isNull()) - pixmap = d->findIcon(48, QLatin1String("stock_dialog-error.png")); - if (!pixmap.isNull()) - return pixmap; - break; - } - case SP_MessageBoxQuestion: - { - pixmap = d->findIcon(48, QLatin1String("dialog-question.png")); - if (!pixmap.isNull()) - return pixmap; - break; - } - case SP_DirHomeIcon: - { - pixmap = d->findIcon(16, QLatin1String("folder_home.png")); - if (pixmap.isNull()) - pixmap = d->findIcon(16, QLatin1String("gnome_home.png")); - if (!pixmap.isNull()) - return pixmap; - break; - } - case SP_DialogOpenButton: - case SP_DirOpenIcon: - { - pixmap = d->findIcon(24, QLatin1String("stock_open.png")); - if (!pixmap.isNull()) - return pixmap; - break; - } - case SP_FileIcon: - { - pixmap = d->findIcon(24, QLatin1String("unknown.png")); - if (pixmap.isNull()) - pixmap = d->findIcon(24, QLatin1String("gnome-fs-regular.png")); - if (pixmap.isNull()) - pixmap = d->findIcon(24, QLatin1String("stock_new.png")); - if (!pixmap.isNull()) - return pixmap; - break; - } - case SP_FileLinkIcon: - { - pixmap = d->findIcon(24, QLatin1String("emblem-symbolic-link.png")); - if (!pixmap.isNull()) { - QPixmap fileIcon = d->findIcon(24, QLatin1String("unknown.png")); - if (fileIcon.isNull()) - fileIcon = d->findIcon(24, QLatin1String("stock_new.png")); - if (!fileIcon.isNull()) { - QPainter painter(&fileIcon); - painter.setRenderHint(QPainter::SmoothPixmapTransform); - painter.drawPixmap(12, 12, 12, 12, pixmap); - return fileIcon; - } - } - break; - } - case SP_DirClosedIcon: - case SP_DirIcon: - { - pixmap = d->findIcon(24, QLatin1String("gnome-fs-directory.png")); - if (!pixmap.isNull()) - return pixmap; - break; - } - case SP_DirLinkIcon: - { - pixmap = d->findIcon(24, QLatin1String("emblem-symbolic-link.png")); - if (!pixmap.isNull()) { - QPixmap dirIcon = d->findIcon(24, QLatin1String("gnome-fs-directory.png")); - if (!dirIcon.isNull()) { - QPainter painter(&dirIcon); - painter.setRenderHint(QPainter::SmoothPixmapTransform); - painter.drawPixmap(12, 12, 12, 12, pixmap); - return dirIcon; - } - } - break; - } - case SP_DriveFDIcon: - { - pixmap = d->findIcon(24, QLatin1String("gnome-dev-floppy.png")); - if (!pixmap.isNull()) - return pixmap; - break; - } - case SP_ComputerIcon: - { - pixmap = d->findIcon(24, QLatin1String("gnome-fs-client.png")); - if (!pixmap.isNull()) - return pixmap; - break; - } - case SP_DesktopIcon: - { - pixmap = d->findIcon(24, QLatin1String("gnome-fs-desktop.png")); - if (!pixmap.isNull()) - return pixmap; - break; - } - case SP_TrashIcon: - { - pixmap = d->findIcon(24, QLatin1String("gnome-fs-trash-empty.png")); - if (!pixmap.isNull()) - return pixmap; - break; - } - case SP_DriveCDIcon: - case SP_DriveDVDIcon: - { - pixmap = d->findIcon(24, QLatin1String("gnome-dev-cdrom.png")); - if (!pixmap.isNull()) - return pixmap; - break; - } - case SP_DriveHDIcon: - { - pixmap = d->findIcon(24, QLatin1String("gnome-dev-harddisk.png")); - if (!pixmap.isNull()) - return pixmap; - break; - } - case SP_FileDialogToParent: - { - pixmap = d->findIcon(16, QLatin1String("stock_up.png")); - if (!pixmap.isNull()) - return pixmap; - break; - } - case SP_FileDialogNewFolder: - { - pixmap = d->findIcon(16, QLatin1String("stock_new-dir.png")); - if (!pixmap.isNull()) - return pixmap; - break; - } - case SP_ArrowUp: - { - pixmap = d->findIcon(16, QLatin1String("stock_up.png")); - if (!pixmap.isNull()) - return pixmap; - break; - } - case SP_ArrowDown: - { - pixmap = d->findIcon(16, QLatin1String("stock_down.png")); - if (!pixmap.isNull()) - return pixmap; - break; - } - case SP_ArrowRight: - { - pixmap = d->findIcon(16, QLatin1String("stock_right.png")); - if (!pixmap.isNull()) - return pixmap; - break; - } - case SP_ArrowLeft: - { - pixmap = d->findIcon(16, QLatin1String("stock_left.png")); - if (!pixmap.isNull()) - return pixmap; - break; - } - case SP_DialogCloseButton: - { - pixmap = d->findIcon(24, QLatin1String("gtk-close.png")); - if (pixmap.isNull()) - pixmap = d->findIcon(24, QLatin1String("stock-close.png")); - if (!pixmap.isNull()) - return pixmap; - break; - } - case SP_DialogApplyButton: - { - pixmap = d->findIcon(24, QLatin1String("dialog-apply.png")); - if (pixmap.isNull()) - pixmap = d->findIcon(24, QLatin1String("stock-apply.png")); - if (!pixmap.isNull()) - return pixmap; - break; - } - case SP_DialogResetButton: - { - pixmap = d->findIcon(24, QLatin1String("gtk-clear.png")); - if (!pixmap.isNull()) - return pixmap; - break; - } - case SP_DialogHelpButton: - { - pixmap = d->findIcon(24, QLatin1String("gtk-help.png")); - if (!pixmap.isNull()) - return pixmap; - break; - } - case SP_DialogOkButton: - { - pixmap = d->findIcon(24, QLatin1String("dialog-ok.png")); - if (pixmap.isNull()) - pixmap = d->findIcon(24, QLatin1String("stock-ok.png")); - if (!pixmap.isNull()) - return pixmap; - break; - } - case SP_DialogCancelButton: - { - pixmap = d->findIcon(24, QLatin1String("dialog-cancel.png")); - if (pixmap.isNull()) - pixmap = d->findIcon(24, QLatin1String("stock-cancel.png")); - if (pixmap.isNull()) - pixmap = d->findIcon(24, QLatin1String("process-stop.png")); - if (!pixmap.isNull()) - return pixmap; - break; - } - case SP_DialogSaveButton: - { - pixmap = d->findIcon(24, QLatin1String("stock_save.png")); - if (!pixmap.isNull()) - return pixmap; - break; - } - case SP_BrowserStop: - { - pixmap = d->findIcon(16, QLatin1String("process-stop.png")); - if (!pixmap.isNull()) - return pixmap; - break; - } - case SP_BrowserReload: - { - pixmap = d->findIcon(16, QLatin1String("view-refresh.png")); - if (!pixmap.isNull()) - return pixmap; - break; - } - case SP_MediaPlay: - { - pixmap = d->findIcon(24, QLatin1String("media-playback-start.png")); - if (!pixmap.isNull()) - return pixmap; - break; - } - case SP_MediaPause: - { - pixmap = d->findIcon(24, QLatin1String("media-playback-pause.png")); - if (!pixmap.isNull()) - return pixmap; - break; - } - case SP_MediaStop: - { - pixmap = d->findIcon(24, QLatin1String("media-playback-stop.png")); - if (!pixmap.isNull()) - return pixmap; - break; - } - case SP_MediaVolume: - { - pixmap = d->findIcon(16, QLatin1String("audio-volume-medium.png")); - if (!pixmap.isNull()) - return pixmap; - break; - } - case SP_MediaVolumeMuted: - { - pixmap = d->findIcon(16, QLatin1String("audio-volume-muted.png")); - if (!pixmap.isNull()) - return pixmap; - break; - } - case SP_MediaSeekForward: - { - pixmap = d->findIcon(24, QLatin1String("media-seek-forward.png")); - if (!pixmap.isNull()) - return pixmap; - break; - } - case SP_MediaSeekBackward: - { - pixmap = d->findIcon(24, QLatin1String("media-seek-backward.png")); - if (!pixmap.isNull()) - return pixmap; - break; - } - case SP_MediaSkipForward: - { - pixmap = d->findIcon(24, QLatin1String("media-skip-forward.png")); - if (!pixmap.isNull()) - return pixmap; - break; - } - case SP_MediaSkipBackward: - { - pixmap = d->findIcon(24, QLatin1String("media-skip-backward.png")); - if (!pixmap.isNull()) - return pixmap; - break; - } - case SP_TitleBarMenuButton: - case SP_TitleBarShadeButton: - case SP_TitleBarUnshadeButton: - case SP_TitleBarMaxButton: - case SP_TitleBarContextHelpButton: - return QWindowsStyle::standardPixmap(standardPixmap, opt, widget); case SP_TitleBarNormalButton: return QPixmap((const char **)dock_widget_restore_xpm); case SP_TitleBarMinButton: @@ -4936,7 +4377,7 @@ QPixmap QCleanlooksStyle::standardPixmap(StandardPixmap standardPixmap, const QS break; } #endif //QT_NO_IMAGEFORMAT_XPM -#endif //Q_WS_X11 + return QWindowsStyle::standardPixmap(standardPixmap, opt, widget); } diff --git a/src/gui/styles/qcleanlooksstyle_p.h b/src/gui/styles/qcleanlooksstyle_p.h index a26d40d..d325499 100644 --- a/src/gui/styles/qcleanlooksstyle_p.h +++ b/src/gui/styles/qcleanlooksstyle_p.h @@ -71,8 +71,6 @@ public: ~QCleanlooksStylePrivate() { } - - void lookupIconTheme() const; }; QT_END_NAMESPACE diff --git a/src/gui/styles/qcommonstyle.cpp b/src/gui/styles/qcommonstyle.cpp index c7feb25..3878856 100644 --- a/src/gui/styles/qcommonstyle.cpp +++ b/src/gui/styles/qcommonstyle.cpp @@ -840,176 +840,8 @@ static void drawArrow(const QStyle *style, const QStyleOptionToolButton *toolbut #endif // QT_NO_TOOLBUTTON - #ifdef Q_WS_X11 // These functions are used to parse the X11 freedesktop icon spec -void QCommonStylePrivate::lookupIconTheme() const -{ - if (!themeName.isEmpty()) - return; - - QString dataDirs = QString::fromLocal8Bit(getenv("XDG_DATA_DIRS")); - if (dataDirs.isEmpty()) - dataDirs = QLatin1String("/usr/local/share/:/usr/share/"); - dataDirs += QLatin1Char(':') + QKde::kdeHome() + QLatin1String("/share"); - dataDirs.prepend(QDir::homePath() + QLatin1String("/:")); - QStringList kdeDirs = QString::fromLocal8Bit(getenv("KDEDIRS")).split(QLatin1Char(':'), QString::SkipEmptyParts); - foreach (const QString &dirName, kdeDirs) - dataDirs.append(QLatin1Char(':') + dirName + QLatin1String("/share")); - iconDirs = dataDirs.split(QLatin1Char(':')); - - QFileInfo fileInfo(QLatin1String("/usr/share/icons/default.kde")); - QDir dir(fileInfo.canonicalFilePath()); - QString kdeDefault = (X11->desktopEnvironment != DE_KDE || X11->desktopVersion >= 4) - ? QString::fromLatin1("oxygen") : QString::fromLatin1("crystalsvg"); - QString defaultTheme = fileInfo.exists() ? dir.dirName() : kdeDefault; - QSettings settings(QKde::kdeHome() + - QLatin1String("/share/config/kdeglobals"), QSettings::IniFormat); - settings.beginGroup(QLatin1String("Icons")); - themeName = settings.value(QLatin1String("Theme"), defaultTheme).toString(); -} - -QIconTheme QCommonStylePrivate::parseIndexFile(const QString &themeName) const -{ - Q_Q(const QCommonStyle); - QIconTheme theme; - QFile themeIndex; - QStringList parents; - QHash dirList; - - for ( int i = 0 ; i < iconDirs.size() && !themeIndex.exists() ; ++i) { - QString contentDir = QLatin1String(iconDirs[i].startsWith(QDir::homePath()) ? - "/.icons/" : "/icons/"); - themeIndex.setFileName(iconDirs[i] + contentDir + - themeName + QLatin1String("/index.theme")); - } - - if (themeIndex.open(QIODevice::ReadOnly | QIODevice::Text)) { - - QTextStream in(&themeIndex); - - while (!in.atEnd()) { - - QString line = in.readLine(); - - if (line.startsWith(QLatin1String("Inherits="))) { - line = line.right(line.length() - 9); - parents = line.split(QLatin1Char(',')); - } - - if (line.startsWith(QLatin1Char('['))) { - line = line.trimmed(); - line.chop(1); - QString dirName = line.right(line.length() - 1); - if (!in.atEnd()) { - line = in.readLine(); - int size; - if (line.startsWith(QLatin1String("Size="))) { - size = line.right(line.length() - 5).toInt(); - if (size) - dirList.insertMulti(size, dirName); - } - } - } - } - } - - if (q->inherits("QPlastiqueStyle")) { - QFileInfo fileInfo(QLatin1String("/usr/share/icons/default.kde")); - QDir dir(fileInfo.canonicalFilePath()); - QString defaultKDETheme = dir.exists() ? dir.dirName() : QString::fromLatin1("crystalsvg"); - if (!parents.contains(defaultKDETheme) && themeName != defaultKDETheme) - parents.append(defaultKDETheme); - } else if (parents.isEmpty() && themeName != QLatin1String("hicolor")) { - parents.append(QLatin1String("hicolor")); - } - theme = QIconTheme(dirList, parents); - return theme; -} - -QPixmap QCommonStylePrivate::findIconHelper(int size, - const QString &themeName, - const QString &iconName, - QStringList &visited) const -{ - QPixmap pixmap; - - if (!themeName.isEmpty()) { - - visited << themeName; - QIconTheme theme = themeList.value(themeName); - - if (!theme.isValid()) { - theme = parseIndexFile(themeName); - themeList.insert(themeName, theme); - } - - if (!theme.isValid()) - return QPixmap(); - - QList subDirs = theme.dirList().values(size); - - for ( int i = 0 ; i < iconDirs.size() ; ++i) { - for ( int j = 0 ; j < subDirs.size() ; ++j) { - QString contentDir = (iconDirs[i].startsWith(QDir::homePath())) ? - QLatin1String("/.icons/") : QLatin1String("/icons/"); - QString fileName = iconDirs[i] + contentDir + themeName + QLatin1Char('/') + subDirs[j] + QLatin1Char('/') + iconName; - QFile file(fileName); - if (file.exists()) - pixmap.load(fileName); - if (!pixmap.isNull()) - break; - } - } - - if (pixmap.isNull()) { - QStringList parents = theme.parents(); - //search recursively through inherited themes - for (int i = 0 ; pixmap.isNull() && i < parents.size() ; ++i) { - QString parentTheme = parents[i].trimmed(); - if (!visited.contains(parentTheme)) //guard against endless recursion - pixmap = findIconHelper(size, parentTheme, iconName, visited); - } - } - } - return pixmap; -} - -/*! \internal - find a pixmap with the given size and name from the freedesktop theme. -*/ -QPixmap QCommonStylePrivate::findIcon(int size, const QString &name) const -{ - QIcon icon = QKde::kdeIcon(name); - if (!icon.isNull()) - return icon.pixmap(size); - - QPixmap pixmap; - QString pixmapName = QLatin1String("$qt") + name + QString::number(size); - - if (QPixmapCache::find(pixmapName, pixmap)) - return pixmap; - - if (!themeName.isEmpty()) { - QStringList visited; - pixmap = findIconHelper(size, themeName, name, visited); - } - QPixmapCache::insert(pixmapName, pixmap); - return pixmap; -} -/*! \internal - create an Icon from the freedesktop theme. - */ -QIcon QCommonStylePrivate::createIcon(const QString &name) const -{ - QIcon icon = QKde::kdeIcon(name); - if (icon.isNull()) { - icon.addPixmap(findIcon(16, name)); - icon.addPixmap(findIcon(24, name)); - icon.addPixmap(findIcon(32, name)); - } - return icon; -} /*!internal Checks if you are running KDE and looks up the toolbar @@ -4859,8 +4691,24 @@ int QCommonStyle::pixelMetric(PixelMetric m, const QStyleOption *opt, const QWid ret = int(QStyleHelper::dpiScaled(6.)); break; - case PM_TabBarIconSize: case PM_ToolBarIconSize: +#ifdef Q_WS_X11 + if (X11->desktopVersion >= 4) { + static int iconSize = 0; + if (!iconSize) { + QSettings settings(QKde::kdeHome() + + QLatin1String("/share/config/kdeglobals"), + QSettings::IniFormat); + settings.beginGroup(QLatin1String("ToolbarIcons")); + iconSize = settings.value(QLatin1String("Size"), QLatin1String("22")).toInt(); + } + ret = iconSize; + } else +#endif + ret = proxy()->pixelMetric(PM_SmallIconSize, opt, widget); + break; + + case PM_TabBarIconSize: case PM_ListViewIconSize: ret = proxy()->pixelMetric(PM_SmallIconSize, opt, widget); break; @@ -5371,293 +5219,161 @@ QPixmap QCommonStyle::standardPixmap(StandardPixmap sp, const QStyleOption *opti Q_UNUSED(widget); Q_UNUSED(sp); #else -#ifdef Q_WS_X11 - Q_D(const QCommonStyle); QPixmap pixmap; - if (QApplication::desktopSettingsAware()) { - d->lookupIconTheme(); + + if (QApplication::desktopSettingsAware() && !QIcon::themeName().isEmpty()) { switch (sp) { case SP_DirHomeIcon: - { - pixmap = d->findIcon(16, QLatin1String("folder_home.png")); - if (!pixmap.isNull()) - return pixmap; - break; - } + pixmap = QIcon::fromTheme(QLatin1String("user-home")).pixmap(16); + break; case SP_MessageBoxInformation: - { - pixmap = d->findIcon(32, QLatin1String("messagebox_info.png")); - if (!pixmap.isNull()) - return pixmap; - break; - } + pixmap = QIcon::fromTheme(QLatin1String("messagebox_info")).pixmap(16); + break; case SP_MessageBoxWarning: - { - pixmap = d->findIcon(32, QLatin1String("messagebox_warning.png")); - if (!pixmap.isNull()) - return pixmap; - break; - } + pixmap = QIcon::fromTheme(QLatin1String("messagebox_warning")).pixmap(16); + break; case SP_MessageBoxCritical: - { - pixmap = d->findIcon(32, QLatin1String("messagebox_critical.png")); - if (!pixmap.isNull()) - return pixmap; - break; - } + pixmap = QIcon::fromTheme(QLatin1String("messagebox_critical")).pixmap(16); + break; case SP_MessageBoxQuestion: - { - pixmap = d->findIcon(32, QLatin1String("help.png")); - if (!pixmap.isNull()) - return pixmap; - break; - } + pixmap = QIcon::fromTheme(QLatin1String("help")).pixmap(16); + break; case SP_DialogOpenButton: case SP_DirOpenIcon: - { - pixmap = d->findIcon(16, QLatin1String("folder-open.png")); - if (pixmap.isNull()) - pixmap = d->findIcon(16, QLatin1String("folder_open.png")); - if (!pixmap.isNull()) - return pixmap; - break; - } + pixmap = QIcon::fromTheme(QLatin1String("folder-open")).pixmap(16); + break; case SP_FileIcon: - { - pixmap = d->findIcon(16, QLatin1String("text-x-generic.png")); - if (pixmap.isNull()) - pixmap = d->findIcon(16, QLatin1String("empty.png")); - if (!pixmap.isNull()) - return pixmap; - break; - } - case SP_FileLinkIcon: - { - pixmap = d->findIcon(16, QLatin1String("link_overlay.png")); - if (!pixmap.isNull()) { - QPixmap fileIcon = d->findIcon(16, QLatin1String("text-x-generic.png")); - if (fileIcon.isNull()) - fileIcon = d->findIcon(16, QLatin1String("empty.png")); - if (!fileIcon.isNull()) { - QPainter painter(&fileIcon); - painter.drawPixmap(0, 0, 16, 16, pixmap); - return fileIcon; - } - } - break; - } + pixmap = QIcon::fromTheme(QLatin1String("text-x-generic"), + QIcon::fromTheme(QLatin1String("empty"))).pixmap(16); + break; case SP_DirClosedIcon: case SP_DirIcon: - { - pixmap = d->findIcon(16, QLatin1String("folder.png")); - if (!pixmap.isNull()) - return pixmap; + pixmap = QIcon::fromTheme(QLatin1String("folder")).pixmap(16); break; - } - case SP_DirLinkIcon: - { - pixmap = d->findIcon(16, QLatin1String("link_overlay.png")); - if (!pixmap.isNull()) { - QPixmap dirIcon = d->findIcon(16, QLatin1String("folder.png")); - if (!dirIcon.isNull()) { - QPainter painter(&dirIcon); - painter.drawPixmap(0, 0, 16, 16, pixmap); - return dirIcon; - } - } - break; - } case SP_DriveFDIcon: - { - pixmap = d->findIcon(16, QLatin1String("media-floppy.png")); - if (pixmap.isNull()) - pixmap = d->findIcon(16, QLatin1String("3floppy_unmount.png")); - if (!pixmap.isNull()) - return pixmap; + pixmap = QIcon::fromTheme(QLatin1String("media-floppy"), + QIcon::fromTheme(QLatin1String("3floppy_unmount"))).pixmap(16); break; - } case SP_ComputerIcon: - { - pixmap = d->findIcon(16, QLatin1String("computer.png")); - if (pixmap.isNull()) - pixmap = d->findIcon(16, QLatin1String("system.png")); - if (!pixmap.isNull()) - return pixmap; + pixmap = QIcon::fromTheme(QLatin1String("computer"), + QIcon::fromTheme(QLatin1String("system"))).pixmap(16); break; - } case SP_DesktopIcon: - { - pixmap = d->findIcon(16, QLatin1String("user-desktop.png")); - if (pixmap.isNull()) - pixmap = d->findIcon(16, QLatin1String("desktop.png")); - if (!pixmap.isNull()) - return pixmap; + pixmap = QIcon::fromTheme(QLatin1String("user-desktop"), + QIcon::fromTheme(QLatin1String("desktop"))).pixmap(16); break; - } case SP_TrashIcon: - { - pixmap = d->findIcon(16, QLatin1String("user-trash.png")); - if (pixmap.isNull()) - pixmap = d->findIcon(16, QLatin1String("trashcan_empty.png")); - if (!pixmap.isNull()) - return pixmap; + pixmap = QIcon::fromTheme(QLatin1String("user-trash"), + QIcon::fromTheme(QLatin1String("trashcan_empty"))).pixmap(16); break; - } case SP_DriveCDIcon: case SP_DriveDVDIcon: - { - pixmap = d->findIcon(16, QLatin1String("media-optical.png")); - if (pixmap.isNull()) - pixmap = d->findIcon(16, QLatin1String("cdrom_unmount.png")); - if (!pixmap.isNull()) - return pixmap; + pixmap = QIcon::fromTheme(QLatin1String("media-optical"), + QIcon::fromTheme(QLatin1String("cdrom_unmount"))).pixmap(16); break; - } case SP_DriveHDIcon: - { - pixmap = d->findIcon(16, QLatin1String("drive-harddisk.png")); - if (pixmap.isNull()) - pixmap = d->findIcon(16, QLatin1String("hdd_unmount.png")); - if (!pixmap.isNull()) - return pixmap; + pixmap = QIcon::fromTheme(QLatin1String("drive-harddisk"), + QIcon::fromTheme(QLatin1String("hdd_unmount"))).pixmap(16); break; - } case SP_FileDialogToParent: - { - pixmap = d->findIcon(32, QLatin1String("go-up.png")); - if (pixmap.isNull()) - pixmap = d->findIcon(32, QLatin1String("up.png")); - if (!pixmap.isNull()) - return pixmap; + pixmap = QIcon::fromTheme(QLatin1String("go-up"), + QIcon::fromTheme(QLatin1String("up"))).pixmap(16); break; - } case SP_FileDialogNewFolder: - { - pixmap = d->findIcon(16, QLatin1String("folder_new.png")); - if (!pixmap.isNull()) - return pixmap; + pixmap = QIcon::fromTheme(QLatin1String("folder_new")).pixmap(16); break; - } case SP_ArrowUp: - { - pixmap = d->findIcon(32, QLatin1String("go-up.png")); - if (pixmap.isNull()) - pixmap = d->findIcon(32, QLatin1String("up.png")); - if (!pixmap.isNull()) - return pixmap; + pixmap = QIcon::fromTheme(QLatin1String("go-up"), + QIcon::fromTheme(QLatin1String("up"))).pixmap(16); break; - } case SP_ArrowDown: - { - pixmap = d->findIcon(32, QLatin1String("go-down.png")); - if (pixmap.isNull()) - pixmap = d->findIcon(32, QLatin1String("down.png")); - if (!pixmap.isNull()) - return pixmap; + pixmap = QIcon::fromTheme(QLatin1String("go-down"), + QIcon::fromTheme(QLatin1String("down"))).pixmap(16); break; - } case SP_ArrowRight: - { - pixmap = d->findIcon(32, QLatin1String("go-next.png")); - if (pixmap.isNull()) - pixmap = d->findIcon(32, QLatin1String("forward.png")); - if (!pixmap.isNull()) - return pixmap; + pixmap = QIcon::fromTheme(QLatin1String("go-next"), + QIcon::fromTheme(QLatin1String("forward"))).pixmap(16); break; - } case SP_ArrowLeft: - { - pixmap = d->findIcon(32, QLatin1String("go-previous.png")); - if (pixmap.isNull()) - pixmap = d->findIcon(32, QLatin1String("back.png")); - if (!pixmap.isNull()) - return pixmap; + pixmap = QIcon::fromTheme(QLatin1String("go-previous"), + QIcon::fromTheme(QLatin1String("back"))).pixmap(16); break; - } case SP_FileDialogDetailedView: - { - pixmap = d->findIcon(16, QLatin1String("view_detailed.png")); - if (!pixmap.isNull()) - return pixmap; + pixmap = QIcon::fromTheme(QLatin1String("view_detailed")).pixmap(16); break; - } - case SP_FileDialogListView: - { - pixmap = d->findIcon(16, QLatin1String("view_icon.png")); - if (!pixmap.isNull()) - return pixmap; + pixmap = QIcon::fromTheme(QLatin1String("view_icon")).pixmap(16); break; - } case SP_BrowserReload: - { - pixmap = d->findIcon(32, QLatin1String("reload.png")); - if (!pixmap.isNull()) - return pixmap; + pixmap = QIcon::fromTheme(QLatin1String("reload")).pixmap(16); break; - } case SP_BrowserStop: - { - pixmap = d->findIcon(32, QLatin1String("stop.png")); - if (!pixmap.isNull()) - return pixmap; + pixmap = QIcon::fromTheme(QLatin1String("process-stop")).pixmap(16); break; - } case SP_MediaPlay: - { - pixmap = d->findIcon(16, QLatin1String("player_play.png")); - if (!pixmap.isNull()) - return pixmap; + pixmap = QIcon::fromTheme(QLatin1String("media-playback-start")).pixmap(16); break; - } case SP_MediaPause: - { - pixmap = d->findIcon(16, QLatin1String("player_pause.png")); - if (!pixmap.isNull()) - return pixmap; + pixmap = QIcon::fromTheme(QLatin1String("media-playback-pause")).pixmap(16); break; - } case SP_MediaStop: - { - pixmap = d->findIcon(16, QLatin1String("player_stop.png")); - if (!pixmap.isNull()) - return pixmap; + pixmap = QIcon::fromTheme(QLatin1String("media-playback-stop")).pixmap(16); break; - } case SP_MediaSeekForward: - { - pixmap = d->findIcon(16, QLatin1String("player_fwd.png")); - if (!pixmap.isNull()) - return pixmap; + pixmap = QIcon::fromTheme(QLatin1String("media-seek-forward")).pixmap(16); break; - } case SP_MediaSeekBackward: - { - pixmap = d->findIcon(16, QLatin1String("player_rew.png")); - if (!pixmap.isNull()) - return pixmap; + pixmap = QIcon::fromTheme(QLatin1String("media-seek-backward")).pixmap(16); break; - } case SP_MediaSkipForward: - { - pixmap = d->findIcon(16, QLatin1String("player_end.png")); - if (!pixmap.isNull()) - return pixmap; + pixmap = QIcon::fromTheme(QLatin1String("media-skip-backward")).pixmap(16); break; - } case SP_MediaSkipBackward: - { - pixmap = d->findIcon(16, QLatin1String("player_start.png")); - if (!pixmap.isNull()) - return pixmap; + pixmap = QIcon::fromTheme(QLatin1String("media-skip-backward")).pixmap(16); + break; + case SP_DialogResetButton: + pixmap = QIcon::fromTheme(QLatin1String("edit-clear")).pixmap(24); + break; + case SP_DialogHelpButton: + pixmap = QIcon::fromTheme(QLatin1String("help-contents")).pixmap(24); + break; + case SP_DialogCancelButton: + pixmap = QIcon::fromTheme(QLatin1String("process-stop")).pixmap(24); + break; + case SP_DialogSaveButton: + pixmap = QIcon::fromTheme(QLatin1String("document-save")).pixmap(24); break; + case SP_FileLinkIcon: + pixmap = QIcon::fromTheme(QLatin1String("emblem-symbolic-link")).pixmap(16); + if (!pixmap.isNull()) { + QPixmap fileIcon = QIcon::fromTheme(QLatin1String("text-x-generic")).pixmap(16); + if (fileIcon.isNull()) + fileIcon = QIcon::fromTheme(QLatin1String("empty")).pixmap(16); + if (!fileIcon.isNull()) { + QPainter painter(&fileIcon); + painter.drawPixmap(0, 0, 16, 16, pixmap); + return fileIcon; + } } - + break; + case SP_DirLinkIcon: + pixmap = QIcon::fromTheme(QLatin1String("emblem-symbolic-link")).pixmap(16); + if (!pixmap.isNull()) { + QPixmap dirIcon = QIcon::fromTheme(QLatin1String("folder")).pixmap(16); + if (!dirIcon.isNull()) { + QPainter painter(&dirIcon); + painter.drawPixmap(0, 0, 16, 16, pixmap); + return dirIcon; + } + } + break; default: break; } } -#endif //Q_WS_X11 + + if (!pixmap.isNull()) + return pixmap; #endif //QT_NO_IMAGEFORMAT_PNG switch (sp) { #ifndef QT_NO_IMAGEFORMAT_XPM @@ -5793,254 +5509,178 @@ QIcon QCommonStyle::standardIconImplementation(StandardPixmap standardIcon, cons const QWidget *widget) const { QIcon icon; - if (QApplication::desktopSettingsAware()) { -#ifdef Q_WS_X11 - Q_D(const QCommonStyle); - d->lookupIconTheme(); - QPixmap pixmap; + if (QApplication::desktopSettingsAware() && !QIcon::themeName().isEmpty()) { switch (standardIcon) { case SP_DirHomeIcon: - { - icon = d->createIcon(QLatin1String("folder_home.png")); + icon = QIcon::fromTheme(QLatin1String("user-home")); break; - } case SP_MessageBoxInformation: - { - icon = d->createIcon(QLatin1String("dialog-information.png")); - if (icon.isNull()) - icon = d->createIcon(QLatin1String("messagebox_info.png")); + icon = QIcon::fromTheme(QLatin1String("dialog-information")); break; - } case SP_MessageBoxWarning: - { - icon = d->createIcon(QLatin1String("dialog-warning.png")); - icon = d->createIcon(QLatin1String("dialog-warning.png")); - if (icon.isNull()) - icon = d->createIcon(QLatin1String("messagebox_warning.png")); + icon = QIcon::fromTheme(QLatin1String("dialog-warning")); break; - } case SP_MessageBoxCritical: - { - icon = d->createIcon(QLatin1String("dialog-error.png")); - if (icon.isNull()) - icon = d->createIcon(QLatin1String("messagebox_critical.png")); + icon = QIcon::fromTheme(QLatin1String("dialog-error")); break; - } case SP_MessageBoxQuestion: - { - icon = d->createIcon(QLatin1String("help.png")); + icon = QIcon::fromTheme(QLatin1String("dialog-question")); break; - } case SP_DialogOpenButton: case SP_DirOpenIcon: - { - icon = d->createIcon(QLatin1String("folder-open.png")); - if (icon.isNull()) - icon = d->createIcon(QLatin1String("folder_open.png")); + icon = QIcon::fromTheme(QLatin1String("folder-open")); break; - } case SP_FileIcon: - { - icon = d->createIcon(QLatin1String("text-x-generic.png")); - if (icon.isNull()) - icon = d->createIcon(QLatin1String("empty.png")); + icon = QIcon::fromTheme(QLatin1String("text-x-generic")); break; - } case SP_DirClosedIcon: case SP_DirIcon: - { - icon = d->createIcon(QLatin1String("folder.png")); + icon = QIcon::fromTheme(QLatin1String("folder")); break; - } case SP_DriveFDIcon: - { - icon = d->createIcon(QLatin1String("floppy_unmount.png")); + icon = QIcon::fromTheme(QLatin1String("floppy_unmount")); break; - } case SP_ComputerIcon: - { - icon = d->createIcon(QLatin1String("computer.png")); - if (icon.isNull()) - icon = d->createIcon(QLatin1String("system.png")); + icon = QIcon::fromTheme(QLatin1String("computer"), + QIcon::fromTheme(QLatin1String("system"))); break; - } case SP_DesktopIcon: - { - icon = d->createIcon(QLatin1String("user-desktop.png")); + icon = QIcon::fromTheme(QLatin1String("user-desktop")); break; - } case SP_TrashIcon: - { - icon = d->createIcon(QLatin1String("user-trash.png")); + icon = QIcon::fromTheme(QLatin1String("user-trash")); break; - } case SP_DriveCDIcon: case SP_DriveDVDIcon: - { - icon = d->createIcon(QLatin1String("media-optical.png")); - if (icon.isNull()) - icon = d->createIcon(QLatin1String("cdrom_unmount.png")); + icon = QIcon::fromTheme(QLatin1String("media-optical")); break; - } case SP_DriveHDIcon: - { - icon = d->createIcon(QLatin1String("drive-harddisk.png")); - if (icon.isNull()) - icon = d->createIcon(QLatin1String("hdd_unmount.png")); + icon = QIcon::fromTheme(QLatin1String("drive-harddisk")); break; - } case SP_FileDialogToParent: - { - icon = d->createIcon(QLatin1String("go-up.png")); - if (icon.isNull()) - icon = d->createIcon(QLatin1String("up.png")); + icon = QIcon::fromTheme(QLatin1String("go-up")); break; - } case SP_FileDialogNewFolder: - { - icon = d->createIcon(QLatin1String("folder_new.png")); + icon = QIcon::fromTheme(QLatin1String("folder-new")); break; - } case SP_ArrowUp: - { - icon = d->createIcon(QLatin1String("go-up.png")); - if (icon.isNull()) - icon = d->createIcon(QLatin1String("up.png")); + icon = QIcon::fromTheme(QLatin1String("go-up")); break; - } case SP_ArrowDown: - { - icon = d->createIcon(QLatin1String("go-down.png")); - if (icon.isNull()) - icon = d->createIcon(QLatin1String("down.png")); + icon = QIcon::fromTheme(QLatin1String("go-down")); break; - } case SP_ArrowRight: - { - icon = d->createIcon(QLatin1String("go-next.png")); - if (icon.isNull()) - icon = d->createIcon(QLatin1String("forward.png")); + icon = QIcon::fromTheme(QLatin1String("go-next")); break; - } case SP_ArrowLeft: - { - icon = d->createIcon(QLatin1String("go-previous.png")); - if (icon.isNull()) - icon = d->createIcon(QLatin1String("back.png")); + icon = QIcon::fromTheme(QLatin1String("go-previous")); + break; + case SP_DialogHelpButton: + icon = QIcon::fromTheme(QLatin1String("help-contents")); + break; + case SP_DialogCancelButton: + icon = QIcon::fromTheme(QLatin1String("process-stop")); + break; + case SP_DialogCloseButton: + icon = QIcon::fromTheme(QLatin1String("window-close")); + break; + case SP_DialogApplyButton: + icon = QIcon::fromTheme(QLatin1String("dialog-ok-apply")); + break; + case SP_DialogOkButton: + icon = QIcon::fromTheme(QLatin1String("dialog-ok")); break; - } case SP_FileDialogDetailedView: - { - icon = d->createIcon(QLatin1String("view-list-details.png")); - if (icon.isNull()) - icon = d->createIcon(QLatin1String("view_detailed.png")); + icon = QIcon::fromTheme(QLatin1String("view-list-details")); break; - } case SP_FileDialogListView: - { - icon = d->createIcon(QLatin1String("view-list-icons.png")); - if (icon.isNull()) - icon = d->createIcon(QLatin1String("view_icon.png")); + icon = QIcon::fromTheme(QLatin1String("view-list-icons")); break; - } case SP_BrowserReload: - { - icon = d->createIcon(QLatin1String("view-refresh.png")); - if (icon.isNull()) - icon = d->createIcon(QLatin1String("reload.png")); + icon = QIcon::fromTheme(QLatin1String("view-refresh")); break; - } case SP_BrowserStop: - { - icon = d->createIcon(QLatin1String("process-stop.png")); - if (icon.isNull()) - icon = d->createIcon(QLatin1String("stop.png")); + icon = QIcon::fromTheme(QLatin1String("process-stop")); break; - } case SP_MediaPlay: - { - icon = d->createIcon(QLatin1String("media-playback-start.png")); - if (icon.isNull()) - icon = d->createIcon(QLatin1String("player_play.png")); + icon = QIcon::fromTheme(QLatin1String("media-playback-start")); break; - } case SP_MediaPause: - { - icon = d->createIcon(QLatin1String("media-playback-pause.png")); - if (icon.isNull()) - icon = d->createIcon(QLatin1String("player_pause.png")); + icon = QIcon::fromTheme(QLatin1String("media-playback-pause")); break; - } case SP_MediaStop: - { - icon = d->createIcon(QLatin1String("media-playback-stop.png")); - if (icon.isNull()) - icon = d->createIcon(QLatin1String("player_stop.png")); + icon = QIcon::fromTheme(QLatin1String("media-playback-stop")); break; - } case SP_MediaSeekForward: - { - icon = d->createIcon(QLatin1String("media-skip-forward.png")); - if (icon.isNull()) - icon = d->createIcon(QLatin1String("player_fwd.png")); + icon = QIcon::fromTheme(QLatin1String("media-seek-forward")); break; - } case SP_MediaSeekBackward: - { - icon = d->createIcon(QLatin1String("media-skip-backward.png")); - if (icon.isNull()) - icon = d->createIcon(QLatin1String("player_rew.png")); + icon = QIcon::fromTheme(QLatin1String("media-seek-backward")); break; - } case SP_MediaSkipForward: - { - icon = d->createIcon(QLatin1String("media-skip-forward.png")); - if (icon.isNull()) - icon = d->createIcon(QLatin1String("player_end.png")); + icon = QIcon::fromTheme(QLatin1String("media-skip-forward")); break; - } case SP_MediaSkipBackward: - { - icon = d->createIcon(QLatin1String("media-skip-backward.png")); - if (icon.isNull()) - icon = d->createIcon(QLatin1String("player_start.png")); + icon = QIcon::fromTheme(QLatin1String("media-skip-backward")); break; - } - - case SP_FileLinkIcon: { - icon = QIcon(proxy()->standardPixmap(standardIcon, option, widget)); - QPixmap pixmap = d->findIcon(32, QLatin1String("link_overlay.png")); - if (!pixmap.isNull()) { - QPixmap fileIcon = d->findIcon(32, QLatin1String("text-x-generic.png")); - if (fileIcon.isNull()) - fileIcon = d->findIcon(32, QLatin1String("empty.png")); - if (!fileIcon.isNull()) { - QPainter painter(&fileIcon); - painter.drawPixmap(0, 0, 32, 32, pixmap); - icon.addPixmap(fileIcon); + case SP_MediaVolume: + icon = QIcon::fromTheme(QLatin1String("audio-volume-medium")); + break; + case SP_MediaVolumeMuted: + icon = QIcon::fromTheme(QLatin1String("audio-volume-muted")); + break; + case SP_DialogResetButton: + icon = QIcon::fromTheme(QLatin1String("edit-clear")); + break; + case SP_ArrowForward: + if (QApplication::layoutDirection() == Qt::RightToLeft) + return standardIconImplementation(SP_ArrowLeft, option, widget); + return standardIconImplementation(SP_ArrowRight, option, widget); + case SP_ArrowBack: + if (QApplication::layoutDirection() == Qt::RightToLeft) + return standardIconImplementation(SP_ArrowRight, option, widget); + return standardIconImplementation(SP_ArrowLeft, option, widget); + case SP_FileLinkIcon: + { + QIcon linkIcon = QIcon::fromTheme(QLatin1String("emblem-symbolic-link")); + if (!linkIcon.isNull()) { + QIcon baseIcon = standardIconImplementation(SP_FileIcon, option, widget); + const QList sizes = baseIcon.availableSizes(QIcon::Normal, QIcon::Off); + for (int i = 0 ; i < sizes.size() ; ++i) { + int size = sizes[i].width(); + QPixmap basePixmap = baseIcon.pixmap(size); + QPixmap linkPixmap = linkIcon.pixmap(size/2); + QPainter painter(&basePixmap); + painter.drawPixmap(size/2, size/2, linkPixmap); + icon.addPixmap(basePixmap); + } } } - } - break; - case SP_DirLinkIcon: { - icon = QIcon(proxy()->standardPixmap(standardIcon, option, widget)); - QPixmap pixmap = d->findIcon(32, QLatin1String("link_overlay.png")); - if (!pixmap.isNull()) { - QPixmap fileIcon = d->findIcon(32, QLatin1String("folder.png")); - if (!fileIcon.isNull()) { - QPainter painter(&fileIcon); - painter.drawPixmap(0, 0, 32, 32, pixmap); - icon.addPixmap(fileIcon); + break; + case SP_DirLinkIcon: + { + QIcon linkIcon = QIcon::fromTheme(QLatin1String("emblem-symbolic-link")); + if (!linkIcon.isNull()) { + QIcon baseIcon = standardIconImplementation(SP_DirIcon, option, widget); + const QList sizes = baseIcon.availableSizes(QIcon::Normal, QIcon::Off); + for (int i = 0 ; i < sizes.size() ; ++i) { + int size = sizes[i].width(); + QPixmap basePixmap = baseIcon.pixmap(size); + QPixmap linkPixmap = linkIcon.pixmap(size/2); + QPainter painter(&basePixmap); + painter.drawPixmap(size/2, size/2, linkPixmap); + icon.addPixmap(basePixmap); + } } - } } break; default: break; } + if (!icon.isNull()) return icon; -#elif defined(Q_WS_MAC) +#if defined(Q_WS_MAC) OSType iconType = 0; switch (standardIcon) { case QStyle::SP_MessageBoxQuestion: @@ -6131,11 +5771,9 @@ QIcon QCommonStyle::standardIconImplementation(StandardPixmap standardIcon, cons ReleaseIconRef(overlayIcon); return retIcon; } - -#endif //Q_WS_X11 || Q_WS_MAC +#endif // Q_WS_MAC } - switch (standardIcon) { #ifndef QT_NO_IMAGEFORMAT_PNG case SP_FileDialogNewFolder: diff --git a/src/gui/styles/qcommonstyle_p.h b/src/gui/styles/qcommonstyle_p.h index f2af5b2..cff46e6 100644 --- a/src/gui/styles/qcommonstyle_p.h +++ b/src/gui/styles/qcommonstyle_p.h @@ -122,20 +122,7 @@ public: } #endif mutable QIcon tabBarcloseButtonIcon; - -//icon detection on X11 -#ifdef Q_WS_X11 - void lookupIconTheme() const; int lookupToolButtonStyle() const; - QIcon createIcon(const QString &) const; - QPixmap findIcon(int size, const QString &) const; - QPixmap findIconHelper(int size, const QString &, const QString &, QStringList &visited) const; - QIconTheme parseIndexFile(const QString &themeName) const; - mutable QString themeName; - mutable QStringList iconDirs; - mutable QHash themeList; -#endif - }; QT_END_NAMESPACE diff --git a/src/gui/styles/qgtkstyle.cpp b/src/gui/styles/qgtkstyle.cpp index 660b4c3..f6d8c88 100644 --- a/src/gui/styles/qgtkstyle.cpp +++ b/src/gui/styles/qgtkstyle.cpp @@ -3239,6 +3239,7 @@ QSize QGtkStyle::sizeFromContents(ContentsType type, const QStyleOption *option, return newSize; } + /*! \reimp */ QPixmap QGtkStyle::standardPixmap(StandardPixmap sp, const QStyleOption *option, const QWidget *widget) const @@ -3271,65 +3272,80 @@ QPixmap QGtkStyle::standardPixmap(StandardPixmap sp, const QStyleOption *option, } break; - case SP_DialogDiscardButton: { + case SP_DialogDiscardButton: return QGtkPainter::getIcon(GTK_STOCK_DELETE); - } - - case SP_DialogOkButton: { + case SP_DialogOkButton: return QGtkPainter::getIcon(GTK_STOCK_OK); - } - - case SP_DialogCancelButton: { + case SP_DialogCancelButton: return QGtkPainter::getIcon(GTK_STOCK_CANCEL); - } - - case SP_DialogYesButton: { + case SP_DialogYesButton: return QGtkPainter::getIcon(GTK_STOCK_YES); - } - - case SP_DialogNoButton: { + case SP_DialogNoButton: return QGtkPainter::getIcon(GTK_STOCK_NO); - } - - case SP_DialogOpenButton: { + case SP_DialogOpenButton: return QGtkPainter::getIcon(GTK_STOCK_OPEN); - } - - case SP_DialogCloseButton: { + case SP_DialogCloseButton: return QGtkPainter::getIcon(GTK_STOCK_CLOSE); - } - - case SP_DialogApplyButton: { + case SP_DialogApplyButton: return QGtkPainter::getIcon(GTK_STOCK_APPLY); - } - - case SP_DialogSaveButton: { + case SP_DialogSaveButton: return QGtkPainter::getIcon(GTK_STOCK_SAVE); - } - - case SP_MessageBoxWarning: { + case SP_MessageBoxWarning: return QGtkPainter::getIcon(GTK_STOCK_DIALOG_WARNING, GTK_ICON_SIZE_DIALOG); - } - - case SP_MessageBoxQuestion: { + case SP_MessageBoxQuestion: return QGtkPainter::getIcon(GTK_STOCK_DIALOG_QUESTION, GTK_ICON_SIZE_DIALOG); - } - - case SP_MessageBoxInformation: { + case SP_MessageBoxInformation: return QGtkPainter::getIcon(GTK_STOCK_DIALOG_INFO, GTK_ICON_SIZE_DIALOG); - } - - case SP_MessageBoxCritical: { + case SP_MessageBoxCritical: return QGtkPainter::getIcon(GTK_STOCK_DIALOG_ERROR, GTK_ICON_SIZE_DIALOG); - } - default: return QCleanlooksStyle::standardPixmap(sp, option, widget); } + return pixmap; +} - return QPixmap(); +/*! + \internal +*/ +QIcon QGtkStyle::standardIconImplementation(StandardPixmap standardIcon, + const QStyleOption *option, + const QWidget *widget) const +{ + if (!QGtk::isThemeAvailable()) + return QCleanlooksStyle::standardIconImplementation(standardIcon, option, widget); + switch (standardIcon) { + case SP_DialogDiscardButton: + return QGtkPainter::getIcon(GTK_STOCK_DELETE); + case SP_DialogOkButton: + return QGtkPainter::getIcon(GTK_STOCK_OK); + case SP_DialogCancelButton: + return QGtkPainter::getIcon(GTK_STOCK_CANCEL); + case SP_DialogYesButton: + return QGtkPainter::getIcon(GTK_STOCK_YES); + case SP_DialogNoButton: + return QGtkPainter::getIcon(GTK_STOCK_NO); + case SP_DialogOpenButton: + return QGtkPainter::getIcon(GTK_STOCK_OPEN); + case SP_DialogCloseButton: + return QGtkPainter::getIcon(GTK_STOCK_CLOSE); + case SP_DialogApplyButton: + return QGtkPainter::getIcon(GTK_STOCK_APPLY); + case SP_DialogSaveButton: + return QGtkPainter::getIcon(GTK_STOCK_SAVE); + case SP_MessageBoxWarning: + return QGtkPainter::getIcon(GTK_STOCK_DIALOG_WARNING, GTK_ICON_SIZE_DIALOG); + case SP_MessageBoxQuestion: + return QGtkPainter::getIcon(GTK_STOCK_DIALOG_QUESTION, GTK_ICON_SIZE_DIALOG); + case SP_MessageBoxInformation: + return QGtkPainter::getIcon(GTK_STOCK_DIALOG_INFO, GTK_ICON_SIZE_DIALOG); + case SP_MessageBoxCritical: + return QGtkPainter::getIcon(GTK_STOCK_DIALOG_ERROR, GTK_ICON_SIZE_DIALOG); + default: + return QCleanlooksStyle::standardIconImplementation(standardIcon, option, widget); + } } + /*! \reimp */ QRect QGtkStyle::subElementRect(SubElement element, const QStyleOption *option, const QWidget *widget) const { diff --git a/src/gui/styles/qgtkstyle.h b/src/gui/styles/qgtkstyle.h index e12f175..f12de52 100644 --- a/src/gui/styles/qgtkstyle.h +++ b/src/gui/styles/qgtkstyle.h @@ -106,6 +106,10 @@ public: void unpolish(QWidget *widget); void unpolish(QApplication *app); + +protected Q_SLOTS: + QIcon standardIconImplementation(StandardPixmap standardIcon, const QStyleOption *option, + const QWidget *widget = 0) const; }; diff --git a/tests/auto/qicon/icons/testtheme/16x16/actions/appointment-new.png b/tests/auto/qicon/icons/testtheme/16x16/actions/appointment-new.png new file mode 100644 index 0000000..18b7c67 Binary files /dev/null and b/tests/auto/qicon/icons/testtheme/16x16/actions/appointment-new.png differ diff --git a/tests/auto/qicon/icons/testtheme/22x22/actions/appointment-new.png b/tests/auto/qicon/icons/testtheme/22x22/actions/appointment-new.png new file mode 100644 index 0000000..d676ffd Binary files /dev/null and b/tests/auto/qicon/icons/testtheme/22x22/actions/appointment-new.png differ diff --git a/tests/auto/qicon/icons/testtheme/32x32/actions/appointment-new.png b/tests/auto/qicon/icons/testtheme/32x32/actions/appointment-new.png new file mode 100644 index 0000000..85daef3 Binary files /dev/null and b/tests/auto/qicon/icons/testtheme/32x32/actions/appointment-new.png differ diff --git a/tests/auto/qicon/icons/testtheme/index.theme b/tests/auto/qicon/icons/testtheme/index.theme new file mode 100644 index 0000000..e18736a --- /dev/null +++ b/tests/auto/qicon/icons/testtheme/index.theme @@ -0,0 +1,492 @@ +[Icon Theme] +_Name=Test +_Comment=Test Theme +Inherits=crystalsvg, themeparent +Example=x-directory-normal + +# KDE Specific Stuff +DisplayDepth=32 +LinkOverlay=link_overlay +LockOverlay=lock_overlay +ZipOverlay=zip_overlay +DesktopDefault=48 +DesktopSizes=16,22,32,48,64,72,96,128 +ToolbarDefault=22 +ToolbarSizes=16,22,32,48 +MainToolbarDefault=22 +MainToolbarSizes=16,22,32,48 +SmallDefault=16 +SmallSizes=16 +PanelDefault=32 +PanelSizes=16,22,32,48,64,72,96,128 + +# Directory list +Directories=16x16/actions,16x16/apps,16x16/categories,16x16/devices,16x16/emblems,16x16/emotes,16x16/mimetypes,16x16/places,16x16/status,22x22/actions,22x22/apps,22x22/categories,22x22/devices,22x22/emblems,22x22/emotes,22x22/mimetypes,22x22/places,22x22/status,24x24/actions,24x24/apps,24x24/categories,24x24/devices,24x24/emblems,24x24/emotes,24x24/mimetypes,24x24/places,24x24/status,32x32/actions,32x32/apps,32x32/categories,32x32/devices,32x32/emblems,32x32/emotes,32x32/mimetypes,32x32/places,32x32/status,48x48/actions,48x48/apps,48x48/categories,48x48/devices,48x48/emblems,48x48/emotes,48x48/mimetypes,48x48/places,48x48/status,64x64/actions,64x64/apps,64x64/categories,64x64/devices,64x64/emblems,64x64/emotes,64x64/mimetypes,64x64/places,64x64/status,72x72/actions,72x72/apps,72x72/categories,72x72/devices,72x72/emblems,72x72/emotes,72x72/mimetypes,72x72/places,72x72/status,96x96/actions,96x96/apps,96x96/categories,96x96/devices,96x96/emblems,96x96/emotes,96x96/mimetypes,96x96/places,96x96/status,128x128/actions,128x128/apps,128x128/categories,128x128/devices,128x128/emblems,128x128/emotes,128x128/mimetypes,128x128/places,128x128/status,scalable/actions,scalable/apps,scalable/categories,scalable/devices,scalable/emblems,scalable/emotes,scalable/mimetypes,scalable/places,scalable/status + +[16x16/actions] +Size=16 +Context=Actions +Type=Fixed + +[16x16/apps] +Size=16 +Context=Applications +Type=Fixed + +[16x16/categories] +Size=16 +Context=Categories +Type=Fixed + +[16x16/devices] +Size=16 +Context=Devices +Type=Fixed + +[16x16/emblems] +Size=16 +Context=Emblems +Type=Fixed + +[16x16/emotes] +Size=16 +Context=Emotes +Type=Fixed + +[16x16/mimetypes] +Size=16 +Context=MimeTypes +Type=Fixed + +[16x16/places] +Size=16 +Context=Places +Type=Fixed + +[16x16/status] +Size=16 +Context=Status +Type=Fixed + +[22x22/actions] +Size=22 +Context=Actions +Type=Fixed + +[22x22/apps] +Size=22 +Context=Applications +Type=Fixed + +[22x22/categories] +Size=22 +Context=Categories +Type=Fixed + +[22x22/devices] +Size=22 +Context=Devices +Type=Fixed + +[22x22/emblems] +Size=22 +Context=Emblems +Type=Fixed + +[22x22/emotes] +Size=22 +Context=Emotes +Type=Fixed + +[22x22/mimetypes] +Size=22 +Context=MimeTypes +Type=Fixed + +[22x22/places] +Size=22 +Context=Places +Type=Fixed + +[22x22/status] +Size=22 +Context=Status +Type=Fixed + +[24x24/actions] +Size=24 +Context=Actions +Type=Fixed + +[24x24/apps] +Size=24 +Context=Applications +Type=Fixed + +[24x24/categories] +Size=24 +Context=Categories +Type=Fixed + +[24x24/devices] +Size=24 +Context=Devices +Type=Fixed + +[24x24/emblems] +Size=24 +Context=Emblems +Type=Fixed + +[24x24/emotes] +Size=24 +Context=Emotes +Type=Fixed + +[24x24/mimetypes] +Size=24 +Context=MimeTypes +Type=Fixed + +[24x24/places] +Size=24 +Context=Places +Type=Fixed + +[24x24/status] +Size=24 +Context=Status +Type=Fixed + +[32x32/actions] +Size=32 +Context=Actions +Type=Fixed + +[32x32/apps] +Size=32 +Context=Applications +Type=Fixed + +[32x32/categories] +Size=32 +Context=Categories +Type=Fixed + +[32x32/devices] +Size=32 +Context=Devices +Type=Fixed + +[32x32/emblems] +Size=32 +Context=Emblems +Type=Fixed + +[32x32/emotes] +Size=32 +Context=Emotes +Type=Fixed + +[32x32/mimetypes] +Size=32 +Context=MimeTypes +Type=Fixed + +[32x32/places] +Size=32 +Context=Places +Type=Fixed + +[32x32/status] +Size=32 +Context=Status +Type=Fixed + +[48x48/actions] +Size=48 +Context=Actions +Type=Fixed + +[48x48/apps] +Size=48 +Context=Applications +Type=Fixed + +[48x48/categories] +Size=48 +Context=Categories +Type=Fixed + +[48x48/devices] +Size=48 +Context=Devices +Type=Fixed + +[48x48/emblems] +Size=48 +Context=Emblems +Type=Fixed + +[48x48/emotes] +Size=48 +Context=Emotes +Type=Fixed + +[48x48/mimetypes] +Size=48 +Context=MimeTypes +Type=Fixed + +[48x48/places] +Size=48 +Context=Places +Type=Fixed + +[48x48/status] +Size=48 +Context=Status +Type=Fixed + +[64x64/actions] +Size=64 +Context=Actions +Type=Fixed + +[64x64/apps] +Size=64 +Context=Applications +Type=Fixed + +[64x64/categories] +Size=64 +Context=Categories +Type=Fixed + +[64x64/devices] +Size=64 +Context=Devices +Type=Fixed + +[64x64/emblems] +Size=64 +Context=Emblems +Type=Fixed + +[64x64/emotes] +Size=64 +Context=Emotes +Type=Fixed + +[64x64/mimetypes] +Size=64 +Context=MimeTypes +Type=Fixed + +[64x64/places] +Size=64 +Context=Places +Type=Fixed + +[64x64/status] +Size=64 +Context=Status +Type=Fixed + +[72x72/actions] +Size=72 +Context=Actions +Type=Fixed + +[72x72/apps] +Size=72 +Context=Applications +Type=Fixed + +[72x72/categories] +Size=72 +Context=Categories +Type=Fixed + +[72x72/devices] +Size=72 +Context=Devices +Type=Fixed + +[72x72/emblems] +Size=72 +Context=Emblems +Type=Fixed + +[72x72/emotes] +Size=72 +Context=Emotes +Type=Fixed + +[72x72/mimetypes] +Size=72 +Context=MimeTypes +Type=Fixed + +[72x72/places] +Size=72 +Context=Places +Type=Fixed + +[72x72/status] +Size=72 +Context=Status +Type=Fixed + +[96x96/actions] +Size=96 +Context=Actions +Type=Fixed + +[96x96/apps] +Size=96 +Context=Applications +Type=Fixed + +[96x96/categories] +Size=96 +Context=Categories +Type=Fixed + +[96x96/devices] +Size=96 +Context=Devices +Type=Fixed + +[96x96/emblems] +Size=96 +Context=Emblems +Type=Fixed + +[96x96/emotes] +Size=96 +Context=Emotes +Type=Fixed + +[96x96/mimetypes] +Size=96 +Context=MimeTypes +Type=Fixed + +[96x96/places] +Size=96 +Context=Places +Type=Fixed + +[96x96/status] +Size=96 +Context=Status +Type=Fixed + +[128x128/actions] +Size=128 +Context=Actions +Type=Fixed + +[128x128/apps] +Size=128 +Context=Applications +Type=Fixed + +[128x128/categories] +Size=128 +Context=Categories +Type=Fixed + +[128x128/devices] +Size=128 +Context=Devices +Type=Fixed + +[128x128/emblems] +Size=128 +Context=Emblems +Type=Fixed + +[128x128/emotes] +Size=128 +Context=Emotes +Type=Fixed + +[128x128/mimetypes] +Size=128 +Context=MimeTypes +Type=Fixed + +[128x128/places] +Size=128 +Context=Places +Type=Fixed + +[128x128/status] +Size=128 +Context=Status +Type=Fixed + +[scalable/actions] +Size=48 +Context=Actions +Type=Scalable +MinSize=32 +MaxSize=256 + +[scalable/apps] +Size=48 +Context=Applications +Type=Scalable +MinSize=32 +MaxSize=256 + +[scalable/categories] +Size=48 +Context=Categories +Type=Scalable +MinSize=32 +MaxSize=256 + +[scalable/devices] +Size=48 +Context=Devices +Type=Scalable +MinSize=32 +MaxSize=256 + +[scalable/emblems] +Size=48 +Context=Emblems +Type=Scalable +MinSize=32 +MaxSize=256 + +[scalable/emotes] +Size=48 +Context=Emotes +Type=Scalable +Minsize=32 +MaxSize=256 + +[scalable/mimetypes] +Size=48 +Context=MimeTypes +Type=Scalable +MinSize=32 +MaxSize=256 + +[scalable/places] +Size=48 +Context=Places +Type=Scalable +MinSize=32 +MaxSize=256 + +[scalable/status] +Size=48 +Context=Status +Type=Scalable +MinSize=32 +MaxSize=256 diff --git a/tests/auto/qicon/icons/testtheme/scalable/actions/svg-only.svg b/tests/auto/qicon/icons/testtheme/scalable/actions/svg-only.svg new file mode 100644 index 0000000..4cb14f8 --- /dev/null +++ b/tests/auto/qicon/icons/testtheme/scalable/actions/svg-only.svg @@ -0,0 +1,425 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + Jakub Steiner + + + http://jimmac.musichall.cz + + New Appointment + + + appointment + new + meeting + rvsp + + + + + + + + + + + + + + + + + + + + + + +