From 8fe7f1340bbb09db3d14923835c4e678134c4018 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Wed, 6 Jan 2010 16:20:39 +0100 Subject: remove dead code --- tools/linguist/lupdate/main.cpp | 8 -------- 1 file changed, 8 deletions(-) diff --git a/tools/linguist/lupdate/main.cpp b/tools/linguist/lupdate/main.cpp index 9a9af68..a0ab7f9 100644 --- a/tools/linguist/lupdate/main.cpp +++ b/tools/linguist/lupdate/main.cpp @@ -237,18 +237,12 @@ int main(int argc, char **argv) Verbose | // verbose is on by default starting with Qt 4.2 HeuristicSameText | HeuristicSimilarText | HeuristicNumber; int numFiles = 0; - bool standardSyntax = true; bool metTsFlag = false; bool recursiveScan = true; QString extensions = m_defaultExtensions; QSet extensionsNameFilters; - for (int i = 1; i < argc; ++i) { - if (args.at(i) == QLatin1String("-ts")) - standardSyntax = false; - } - for (int i = 1; i < argc; ++i) { QString arg = args.at(i); if (arg == QLatin1String("-help") @@ -375,8 +369,6 @@ int main(int argc, char **argv) numFiles++; - QString fullText; - codecForTr.clear(); codecForSource.clear(); -- cgit v0.12 From f562d3056a1977ce63653477f095d9678021cf0f Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Wed, 6 Jan 2010 13:03:52 +0100 Subject: tidy up the test .pro files --- .../linguist/lupdate/testdata/good/backslashes/project.pro | 10 ---------- .../linguist/lupdate/testdata/good/codecforsrc/project.pro | 10 +--------- .../auto/linguist/lupdate/testdata/good/codecfortr/project.pro | 8 +------- .../linguist/lupdate/testdata/good/codecfortr1/project.pro | 4 +--- .../linguist/lupdate/testdata/good/codecfortr2/project.pro | 4 +--- .../linguist/lupdate/testdata/good/lacksqobject/project.pro | 5 +---- .../linguist/lupdate/testdata/good/merge_ordering/project.pro | 5 +---- .../linguist/lupdate/testdata/good/merge_versions/project.pro | 5 +---- .../lupdate/testdata/good/merge_whitespace/project.pro | 5 +---- tests/auto/linguist/lupdate/testdata/good/mergecpp/project.pro | 5 +---- .../lupdate/testdata/good/mergecpp_noobsolete/project.pro | 5 +---- .../lupdate/testdata/good/mergecpp_obsolete/project.pro | 5 +---- tests/auto/linguist/lupdate/testdata/good/mergeui/project.pro | 5 +---- .../lupdate/testdata/good/mergeui_obsolete/project.pro | 5 +---- .../lupdate/testdata/good/multiple_locations/project.pro | 5 +---- .../auto/linguist/lupdate/testdata/good/namespaces/project.pro | 5 +---- .../lupdate/testdata/good/parse_special_chars/project.pro | 5 +---- .../linguist/lupdate/testdata/good/parsecontexts/project.pro | 5 +---- tests/auto/linguist/lupdate/testdata/good/parsecpp/project.pro | 5 +---- .../auto/linguist/lupdate/testdata/good/parsecpp2/project.pro | 5 +---- .../auto/linguist/lupdate/testdata/good/parsejava/project.pro | 5 +---- tests/auto/linguist/lupdate/testdata/good/parseui/project.pro | 5 +---- tests/auto/linguist/lupdate/testdata/good/prefix/project.pro | 5 +---- .../auto/linguist/lupdate/testdata/good/preprocess/project.pro | 5 +---- .../auto/linguist/lupdate/testdata/good/proparsing/project.pro | 5 +---- .../linguist/lupdate/testdata/good/proparsing2/project.pro | 5 +---- .../linguist/lupdate/testdata/good/proparsingpri/project.pro | 4 +--- .../lupdate/testdata/good/proparsingsubdirs/project.pro | 5 ++--- .../lupdate/testdata/good/proparsingsubdirs/sub1/sub1.pro | 6 +----- .../lupdate/testdata/good/proparsingsubs/common/common.pro | 5 +---- .../linguist/lupdate/testdata/good/proparsingsubs/mac/mac.pro | 6 +----- .../lupdate/testdata/good/proparsingsubs/unix/unix.pro | 6 +----- .../linguist/lupdate/testdata/good/proparsingsubs/win/win.pro | 6 +----- .../linguist/lupdate/testdata/good/textsimilarity/project.pro | 5 +---- .../testdata/output_ts/toplevel/library/tools/tools.pro | 5 +---- 35 files changed, 35 insertions(+), 154 deletions(-) diff --git a/tests/auto/linguist/lupdate/testdata/good/backslashes/project.pro b/tests/auto/linguist/lupdate/testdata/good/backslashes/project.pro index 3584c89..33eb1f3 100644 --- a/tests/auto/linguist/lupdate/testdata/good/backslashes/project.pro +++ b/tests/auto/linguist/lupdate/testdata/good/backslashes/project.pro @@ -1,13 +1,3 @@ -###################################################################### -# Automatically generated by qmake (2.01a) ma 22. jan 10:10:16 2007 -###################################################################### - -TEMPLATE = app -TARGET = -DEPENDPATH += . -INCLUDEPATH += . - -# Input SOURCES += src\main.cpp TRANSLATIONS = ts\project.ts diff --git a/tests/auto/linguist/lupdate/testdata/good/codecforsrc/project.pro b/tests/auto/linguist/lupdate/testdata/good/codecforsrc/project.pro index 848ebda..3b6559d 100644 --- a/tests/auto/linguist/lupdate/testdata/good/codecforsrc/project.pro +++ b/tests/auto/linguist/lupdate/testdata/good/codecforsrc/project.pro @@ -1,13 +1,7 @@ -TEMPLATE = app -TARGET += -DEPENDPATH += . -INCLUDEPATH += . - -# Input SOURCES += main.cpp +CONFIG+= console TRANSLATIONS = project.ts -CONFIG+= console CODECFORTR = utf-8 CODECFORSRC = utf-8 @@ -16,5 +10,3 @@ exists( $$TRANSLATIONS ) { win32: system(del $$TRANSLATIONS) unix: system(rm $$TRANSLATIONS) } - - diff --git a/tests/auto/linguist/lupdate/testdata/good/codecfortr/project.pro b/tests/auto/linguist/lupdate/testdata/good/codecfortr/project.pro index 81273ee..841cfa6 100644 --- a/tests/auto/linguist/lupdate/testdata/good/codecfortr/project.pro +++ b/tests/auto/linguist/lupdate/testdata/good/codecfortr/project.pro @@ -1,13 +1,7 @@ -TEMPLATE = app -TARGET += -DEPENDPATH += . -INCLUDEPATH += . - -# Input SOURCES += main.cpp +CONFIG+= console TRANSLATIONS = project.ts -CONFIG+= console CODECFORTR = CP1251 diff --git a/tests/auto/linguist/lupdate/testdata/good/codecfortr1/project.pro b/tests/auto/linguist/lupdate/testdata/good/codecfortr1/project.pro index 1d5b071..acbf8b9 100644 --- a/tests/auto/linguist/lupdate/testdata/good/codecfortr1/project.pro +++ b/tests/auto/linguist/lupdate/testdata/good/codecfortr1/project.pro @@ -1,9 +1,7 @@ -TEMPLATE = app - SOURCES += main.cpp +CONFIG += console TRANSLATIONS = project.ts -CONFIG += console CODECFORTR = CP1252 diff --git a/tests/auto/linguist/lupdate/testdata/good/codecfortr2/project.pro b/tests/auto/linguist/lupdate/testdata/good/codecfortr2/project.pro index f4975f2..5b382ad 100644 --- a/tests/auto/linguist/lupdate/testdata/good/codecfortr2/project.pro +++ b/tests/auto/linguist/lupdate/testdata/good/codecfortr2/project.pro @@ -1,9 +1,7 @@ -TEMPLATE = app - SOURCES += main.cpp +CONFIG += console TRANSLATIONS = project.ts -CONFIG += console CODECFORSRC = CP1252 CODECFORTR = UTF-8 diff --git a/tests/auto/linguist/lupdate/testdata/good/lacksqobject/project.pro b/tests/auto/linguist/lupdate/testdata/good/lacksqobject/project.pro index 7547a8d..ff4dbd2 100644 --- a/tests/auto/linguist/lupdate/testdata/good/lacksqobject/project.pro +++ b/tests/auto/linguist/lupdate/testdata/good/lacksqobject/project.pro @@ -1,9 +1,6 @@ -TEMPLATE = app -LANGUAGE = C++ - SOURCES = main.cpp -TRANSLATIONS += project.ts +TRANSLATIONS = project.ts exists( $$TRANSLATIONS ) { win32: system(del $$TRANSLATIONS) diff --git a/tests/auto/linguist/lupdate/testdata/good/merge_ordering/project.pro b/tests/auto/linguist/lupdate/testdata/good/merge_ordering/project.pro index e79456f..f8c7ca2 100644 --- a/tests/auto/linguist/lupdate/testdata/good/merge_ordering/project.pro +++ b/tests/auto/linguist/lupdate/testdata/good/merge_ordering/project.pro @@ -1,9 +1,6 @@ -TEMPLATE = app -LANGUAGE = C++ - SOURCES += foo.cpp -TRANSLATIONS = project.ts +TRANSLATIONS = project.ts # Copy the ts to a temp file because: # 1. The depot file is usually read-only diff --git a/tests/auto/linguist/lupdate/testdata/good/merge_versions/project.pro b/tests/auto/linguist/lupdate/testdata/good/merge_versions/project.pro index 6c704c2..70dd7ce 100644 --- a/tests/auto/linguist/lupdate/testdata/good/merge_versions/project.pro +++ b/tests/auto/linguist/lupdate/testdata/good/merge_versions/project.pro @@ -1,9 +1,6 @@ -TEMPLATE = app -LANGUAGE = C++ - FORMS += project.ui -TRANSLATIONS = project.ts +TRANSLATIONS = project.ts # Copy the ts to a temp file because: # 1. The depot file is usually read-only diff --git a/tests/auto/linguist/lupdate/testdata/good/merge_whitespace/project.pro b/tests/auto/linguist/lupdate/testdata/good/merge_whitespace/project.pro index f4faf2f..7eea86d 100644 --- a/tests/auto/linguist/lupdate/testdata/good/merge_whitespace/project.pro +++ b/tests/auto/linguist/lupdate/testdata/good/merge_whitespace/project.pro @@ -1,9 +1,6 @@ -TEMPLATE = app -LANGUAGE = C++ - SOURCES = main.cpp -TRANSLATIONS = project.ts +TRANSLATIONS = project.ts # Copy the ts to a temp file because: # 1. The depot file is usually read-only diff --git a/tests/auto/linguist/lupdate/testdata/good/mergecpp/project.pro b/tests/auto/linguist/lupdate/testdata/good/mergecpp/project.pro index e988c0a..698047a 100644 --- a/tests/auto/linguist/lupdate/testdata/good/mergecpp/project.pro +++ b/tests/auto/linguist/lupdate/testdata/good/mergecpp/project.pro @@ -1,9 +1,6 @@ -TEMPLATE = app -LANGUAGE = C++ - SOURCES += finddialog.cpp -TRANSLATIONS = project.ts +TRANSLATIONS = project.ts # Copy the ts to a temp file because: # 1. The depot file is usually read-only diff --git a/tests/auto/linguist/lupdate/testdata/good/mergecpp_noobsolete/project.pro b/tests/auto/linguist/lupdate/testdata/good/mergecpp_noobsolete/project.pro index e988c0a..698047a 100644 --- a/tests/auto/linguist/lupdate/testdata/good/mergecpp_noobsolete/project.pro +++ b/tests/auto/linguist/lupdate/testdata/good/mergecpp_noobsolete/project.pro @@ -1,9 +1,6 @@ -TEMPLATE = app -LANGUAGE = C++ - SOURCES += finddialog.cpp -TRANSLATIONS = project.ts +TRANSLATIONS = project.ts # Copy the ts to a temp file because: # 1. The depot file is usually read-only diff --git a/tests/auto/linguist/lupdate/testdata/good/mergecpp_obsolete/project.pro b/tests/auto/linguist/lupdate/testdata/good/mergecpp_obsolete/project.pro index e988c0a..698047a 100644 --- a/tests/auto/linguist/lupdate/testdata/good/mergecpp_obsolete/project.pro +++ b/tests/auto/linguist/lupdate/testdata/good/mergecpp_obsolete/project.pro @@ -1,9 +1,6 @@ -TEMPLATE = app -LANGUAGE = C++ - SOURCES += finddialog.cpp -TRANSLATIONS = project.ts +TRANSLATIONS = project.ts # Copy the ts to a temp file because: # 1. The depot file is usually read-only diff --git a/tests/auto/linguist/lupdate/testdata/good/mergeui/project.pro b/tests/auto/linguist/lupdate/testdata/good/mergeui/project.pro index 28ba291..9a0d55d 100644 --- a/tests/auto/linguist/lupdate/testdata/good/mergeui/project.pro +++ b/tests/auto/linguist/lupdate/testdata/good/mergeui/project.pro @@ -1,9 +1,6 @@ -TEMPLATE = app -LANGUAGE = C++ - FORMS += project.ui -TRANSLATIONS = project.ts +TRANSLATIONS = project.ts # Copy the ts to a temp file because: # 1. The depot file is usually read-only diff --git a/tests/auto/linguist/lupdate/testdata/good/mergeui_obsolete/project.pro b/tests/auto/linguist/lupdate/testdata/good/mergeui_obsolete/project.pro index 28ba291..9a0d55d 100644 --- a/tests/auto/linguist/lupdate/testdata/good/mergeui_obsolete/project.pro +++ b/tests/auto/linguist/lupdate/testdata/good/mergeui_obsolete/project.pro @@ -1,9 +1,6 @@ -TEMPLATE = app -LANGUAGE = C++ - FORMS += project.ui -TRANSLATIONS = project.ts +TRANSLATIONS = project.ts # Copy the ts to a temp file because: # 1. The depot file is usually read-only diff --git a/tests/auto/linguist/lupdate/testdata/good/multiple_locations/project.pro b/tests/auto/linguist/lupdate/testdata/good/multiple_locations/project.pro index 4582705..c3f1112 100644 --- a/tests/auto/linguist/lupdate/testdata/good/multiple_locations/project.pro +++ b/tests/auto/linguist/lupdate/testdata/good/multiple_locations/project.pro @@ -1,10 +1,7 @@ -TEMPLATE = app -LANGUAGE = C++ - SOURCES += main.cpp SOURCES += finddialog.cpp -TRANSLATIONS += project.ts +TRANSLATIONS = project.ts exists( $$TRANSLATIONS ) { win32: system(del $$TRANSLATIONS) diff --git a/tests/auto/linguist/lupdate/testdata/good/namespaces/project.pro b/tests/auto/linguist/lupdate/testdata/good/namespaces/project.pro index 56d472c..4ab0edf 100644 --- a/tests/auto/linguist/lupdate/testdata/good/namespaces/project.pro +++ b/tests/auto/linguist/lupdate/testdata/good/namespaces/project.pro @@ -1,9 +1,6 @@ -TEMPLATE = app -LANGUAGE = C++ - SOURCES += main.cpp -TRANSLATIONS += project.ts +TRANSLATIONS = project.ts exists( $$TRANSLATIONS ) { win32: system(del $$TRANSLATIONS) diff --git a/tests/auto/linguist/lupdate/testdata/good/parse_special_chars/project.pro b/tests/auto/linguist/lupdate/testdata/good/parse_special_chars/project.pro index cb18ea4..4ab0edf 100644 --- a/tests/auto/linguist/lupdate/testdata/good/parse_special_chars/project.pro +++ b/tests/auto/linguist/lupdate/testdata/good/parse_special_chars/project.pro @@ -1,9 +1,6 @@ -TEMPLATE = app -LANGUAGE = C++ - SOURCES += main.cpp -TRANSLATIONS += project.ts +TRANSLATIONS = project.ts exists( $$TRANSLATIONS ) { win32: system(del $$TRANSLATIONS) diff --git a/tests/auto/linguist/lupdate/testdata/good/parsecontexts/project.pro b/tests/auto/linguist/lupdate/testdata/good/parsecontexts/project.pro index 7547a8d..ff4dbd2 100644 --- a/tests/auto/linguist/lupdate/testdata/good/parsecontexts/project.pro +++ b/tests/auto/linguist/lupdate/testdata/good/parsecontexts/project.pro @@ -1,9 +1,6 @@ -TEMPLATE = app -LANGUAGE = C++ - SOURCES = main.cpp -TRANSLATIONS += project.ts +TRANSLATIONS = project.ts exists( $$TRANSLATIONS ) { win32: system(del $$TRANSLATIONS) diff --git a/tests/auto/linguist/lupdate/testdata/good/parsecpp/project.pro b/tests/auto/linguist/lupdate/testdata/good/parsecpp/project.pro index 4582705..c3f1112 100644 --- a/tests/auto/linguist/lupdate/testdata/good/parsecpp/project.pro +++ b/tests/auto/linguist/lupdate/testdata/good/parsecpp/project.pro @@ -1,10 +1,7 @@ -TEMPLATE = app -LANGUAGE = C++ - SOURCES += main.cpp SOURCES += finddialog.cpp -TRANSLATIONS += project.ts +TRANSLATIONS = project.ts exists( $$TRANSLATIONS ) { win32: system(del $$TRANSLATIONS) diff --git a/tests/auto/linguist/lupdate/testdata/good/parsecpp2/project.pro b/tests/auto/linguist/lupdate/testdata/good/parsecpp2/project.pro index 7547a8d..ff4dbd2 100644 --- a/tests/auto/linguist/lupdate/testdata/good/parsecpp2/project.pro +++ b/tests/auto/linguist/lupdate/testdata/good/parsecpp2/project.pro @@ -1,9 +1,6 @@ -TEMPLATE = app -LANGUAGE = C++ - SOURCES = main.cpp -TRANSLATIONS += project.ts +TRANSLATIONS = project.ts exists( $$TRANSLATIONS ) { win32: system(del $$TRANSLATIONS) diff --git a/tests/auto/linguist/lupdate/testdata/good/parsejava/project.pro b/tests/auto/linguist/lupdate/testdata/good/parsejava/project.pro index 7e64c80..2032674 100644 --- a/tests/auto/linguist/lupdate/testdata/good/parsejava/project.pro +++ b/tests/auto/linguist/lupdate/testdata/good/parsejava/project.pro @@ -1,9 +1,6 @@ -TEMPLATE = app -LANGUAGE = Java - SOURCES += main.java -TRANSLATIONS += project.ts +TRANSLATIONS = project.ts exists( $$TRANSLATIONS ) { win32: system(del $$TRANSLATIONS) diff --git a/tests/auto/linguist/lupdate/testdata/good/parseui/project.pro b/tests/auto/linguist/lupdate/testdata/good/parseui/project.pro index bdc06e7..9ae812c 100644 --- a/tests/auto/linguist/lupdate/testdata/good/parseui/project.pro +++ b/tests/auto/linguist/lupdate/testdata/good/parseui/project.pro @@ -1,9 +1,6 @@ -TEMPLATE = app -LANGUAGE = C++ - FORMS += project.ui -TRANSLATIONS = project.ts +TRANSLATIONS = project.ts exists( $$TRANSLATIONS ) { win32 : system(del $$TRANSLATIONS) diff --git a/tests/auto/linguist/lupdate/testdata/good/prefix/project.pro b/tests/auto/linguist/lupdate/testdata/good/prefix/project.pro index 7547a8d..ff4dbd2 100644 --- a/tests/auto/linguist/lupdate/testdata/good/prefix/project.pro +++ b/tests/auto/linguist/lupdate/testdata/good/prefix/project.pro @@ -1,9 +1,6 @@ -TEMPLATE = app -LANGUAGE = C++ - SOURCES = main.cpp -TRANSLATIONS += project.ts +TRANSLATIONS = project.ts exists( $$TRANSLATIONS ) { win32: system(del $$TRANSLATIONS) diff --git a/tests/auto/linguist/lupdate/testdata/good/preprocess/project.pro b/tests/auto/linguist/lupdate/testdata/good/preprocess/project.pro index 012c7e0..a66306d 100644 --- a/tests/auto/linguist/lupdate/testdata/good/preprocess/project.pro +++ b/tests/auto/linguist/lupdate/testdata/good/preprocess/project.pro @@ -1,9 +1,6 @@ -TEMPLATE = app -LANGUAGE = C++ - SOURCES += main.cpp -TRANSLATIONS += project.ts +TRANSLATIONS = project.ts exists( $$TRANSLATIONS ) { win32: system(del $$TRANSLATIONS) diff --git a/tests/auto/linguist/lupdate/testdata/good/proparsing/project.pro b/tests/auto/linguist/lupdate/testdata/good/proparsing/project.pro index 3078817..5282863 100644 --- a/tests/auto/linguist/lupdate/testdata/good/proparsing/project.pro +++ b/tests/auto/linguist/lupdate/testdata/good/proparsing/project.pro @@ -1,6 +1,3 @@ -TEMPLATE = app -LANGUAGE = C++ - # Try to reference a variable that does not exist: MYVAR=$$THIS_VARIABLE_IS_NOT_DEFINED @@ -31,7 +28,7 @@ if (exists($$member($$(PATH), 0))) { SOURCES += main_dependpath.cpp } -TRANSLATIONS += project.ts +TRANSLATIONS = project.ts exists( $$TRANSLATIONS ) { win32: system(del $$TRANSLATIONS) diff --git a/tests/auto/linguist/lupdate/testdata/good/proparsing2/project.pro b/tests/auto/linguist/lupdate/testdata/good/proparsing2/project.pro index 1d6895a..92644e5 100644 --- a/tests/auto/linguist/lupdate/testdata/good/proparsing2/project.pro +++ b/tests/auto/linguist/lupdate/testdata/good/proparsing2/project.pro @@ -3,9 +3,6 @@ # It also tries to verify the behaviour of combining quoted and non-quoted elements with literals. # -TEMPLATE = app -LANGUAGE = C++ - QUOTED = $$quote(variable with spaces) VERSIONAB = "a.b" VAB = $$split(VERSIONAB, ".") @@ -33,7 +30,7 @@ SOURCES += $$Q3 win32: SOURCES += $$system(type files-cc.txt) unix: SOURCES += $$system(cat files-cc.txt) -TRANSLATIONS += project.ts +TRANSLATIONS = project.ts exists( $$TRANSLATIONS ) { win32: system(del $$TRANSLATIONS) diff --git a/tests/auto/linguist/lupdate/testdata/good/proparsingpri/project.pro b/tests/auto/linguist/lupdate/testdata/good/proparsingpri/project.pro index 3810a02..14a991f 100644 --- a/tests/auto/linguist/lupdate/testdata/good/proparsingpri/project.pro +++ b/tests/auto/linguist/lupdate/testdata/good/proparsingpri/project.pro @@ -1,6 +1,3 @@ -TEMPLATE = app -LANGUAGE = C++ - include(win/win.pri) include(mac/mac.pri) include(unix/unix.pri) @@ -8,6 +5,7 @@ include (common/common.pri) # Important: keep the space before the ' include(relativity/relativity.pri) message($$SOURCES) + TRANSLATIONS = project.ts exists( $$TRANSLATIONS ) { diff --git a/tests/auto/linguist/lupdate/testdata/good/proparsingsubdirs/project.pro b/tests/auto/linguist/lupdate/testdata/good/proparsingsubdirs/project.pro index 4de6622..88f2435 100644 --- a/tests/auto/linguist/lupdate/testdata/good/proparsingsubdirs/project.pro +++ b/tests/auto/linguist/lupdate/testdata/good/proparsingsubdirs/project.pro @@ -1,3 +1,2 @@ -TEMPLATE =subdirs - -SUBDIRS = sub1 +TEMPLATE = subdirs +SUBDIRS = sub1 diff --git a/tests/auto/linguist/lupdate/testdata/good/proparsingsubdirs/sub1/sub1.pro b/tests/auto/linguist/lupdate/testdata/good/proparsingsubdirs/sub1/sub1.pro index 1d50c2b..cf55f10 100644 --- a/tests/auto/linguist/lupdate/testdata/good/proparsingsubdirs/sub1/sub1.pro +++ b/tests/auto/linguist/lupdate/testdata/good/proparsingsubdirs/sub1/sub1.pro @@ -1,12 +1,8 @@ -TEMPLATE = app -LANGUAGE = C++ - SOURCES += main.cpp -TRANSLATIONS += ../project.ts +TRANSLATIONS = ../project.ts exists( $$TRANSLATIONS ) { win32: system(del $$TRANSLATIONS) unix: system(rm -f $$TRANSLATIONS) } - diff --git a/tests/auto/linguist/lupdate/testdata/good/proparsingsubs/common/common.pro b/tests/auto/linguist/lupdate/testdata/good/proparsingsubs/common/common.pro index a8b3106..3f6c643 100644 --- a/tests/auto/linguist/lupdate/testdata/good/proparsingsubs/common/common.pro +++ b/tests/auto/linguist/lupdate/testdata/good/proparsingsubs/common/common.pro @@ -1,5 +1,2 @@ -TEMPLATE = app -LANGUAGE = C++ - -SOURCES += main.cpp +SOURCES += main.cpp diff --git a/tests/auto/linguist/lupdate/testdata/good/proparsingsubs/mac/mac.pro b/tests/auto/linguist/lupdate/testdata/good/proparsingsubs/mac/mac.pro index 87478bf..a1863b6 100644 --- a/tests/auto/linguist/lupdate/testdata/good/proparsingsubs/mac/mac.pro +++ b/tests/auto/linguist/lupdate/testdata/good/proparsingsubs/mac/mac.pro @@ -1,5 +1 @@ -TEMPLATE = app -LANGUAGE = C++ - -SOURCES += main_mac.cpp - +SOURCES += main_mac.cpp diff --git a/tests/auto/linguist/lupdate/testdata/good/proparsingsubs/unix/unix.pro b/tests/auto/linguist/lupdate/testdata/good/proparsingsubs/unix/unix.pro index d0ebec7..71b1a22 100644 --- a/tests/auto/linguist/lupdate/testdata/good/proparsingsubs/unix/unix.pro +++ b/tests/auto/linguist/lupdate/testdata/good/proparsingsubs/unix/unix.pro @@ -1,5 +1 @@ -TEMPLATE = app -LANGUAGE = C++ - -SOURCES += main_unix.cpp - +SOURCES += main_unix.cpp diff --git a/tests/auto/linguist/lupdate/testdata/good/proparsingsubs/win/win.pro b/tests/auto/linguist/lupdate/testdata/good/proparsingsubs/win/win.pro index a9a9751..afd7197 100644 --- a/tests/auto/linguist/lupdate/testdata/good/proparsingsubs/win/win.pro +++ b/tests/auto/linguist/lupdate/testdata/good/proparsingsubs/win/win.pro @@ -1,5 +1 @@ -TEMPLATE = app -LANGUAGE = C++ - -SOURCES += main_win.cpp - +SOURCES += main_win.cpp diff --git a/tests/auto/linguist/lupdate/testdata/good/textsimilarity/project.pro b/tests/auto/linguist/lupdate/testdata/good/textsimilarity/project.pro index 28ba291..9a0d55d 100644 --- a/tests/auto/linguist/lupdate/testdata/good/textsimilarity/project.pro +++ b/tests/auto/linguist/lupdate/testdata/good/textsimilarity/project.pro @@ -1,9 +1,6 @@ -TEMPLATE = app -LANGUAGE = C++ - FORMS += project.ui -TRANSLATIONS = project.ts +TRANSLATIONS = project.ts # Copy the ts to a temp file because: # 1. The depot file is usually read-only diff --git a/tests/auto/linguist/lupdate/testdata/output_ts/toplevel/library/tools/tools.pro b/tests/auto/linguist/lupdate/testdata/output_ts/toplevel/library/tools/tools.pro index ec6c01d..5d263ae 100644 --- a/tests/auto/linguist/lupdate/testdata/output_ts/toplevel/library/tools/tools.pro +++ b/tests/auto/linguist/lupdate/testdata/output_ts/toplevel/library/tools/tools.pro @@ -1,9 +1,6 @@ -TEMPLATE = app -LANGUAGE = C++ - SOURCES += main.cpp -TRANSLATIONS += translations/project.ts +TRANSLATIONS = translations/project.ts exists( $$TRANSLATIONS ) { win32: system(del $$TRANSLATIONS) -- cgit v0.12 From 9e6104565cbe2ae7559791fa6e4787d890477588 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Wed, 6 Jan 2010 18:36:35 +0100 Subject: clean up the lupdatecmd files --- tests/auto/linguist/lupdate/testdata/good/backslashes/lupdatecmd | 3 +-- tests/auto/linguist/lupdate/testdata/good/merge_ordering/lupdatecmd | 6 +----- .../linguist/lupdate/testdata/good/mergecpp_noobsolete/lupdatecmd | 6 +----- tests/auto/linguist/lupdate/testdata/output_ts/lupdatecmd | 4 ---- 4 files changed, 3 insertions(+), 16 deletions(-) diff --git a/tests/auto/linguist/lupdate/testdata/good/backslashes/lupdatecmd b/tests/auto/linguist/lupdate/testdata/good/backslashes/lupdatecmd index 9b83a04..13b2927 100644 --- a/tests/auto/linguist/lupdate/testdata/good/backslashes/lupdatecmd +++ b/tests/auto/linguist/lupdate/testdata/good/backslashes/lupdatecmd @@ -1,3 +1,2 @@ -# Add the command that lupdate should run here. If it can't find anything it will default to TRANSLATION: ts\project.ts -lupdate -silent project.pro +lupdate project.pro diff --git a/tests/auto/linguist/lupdate/testdata/good/merge_ordering/lupdatecmd b/tests/auto/linguist/lupdate/testdata/good/merge_ordering/lupdatecmd index 91a4800..82b4b0d 100644 --- a/tests/auto/linguist/lupdate/testdata/good/merge_ordering/lupdatecmd +++ b/tests/auto/linguist/lupdate/testdata/good/merge_ordering/lupdatecmd @@ -1,5 +1 @@ -# Add the command that lupdate should run here. If it can't find anything it will default to -# 'lupdate project.pro -ts project.ts' - -# lupdate project.pro -lupdate -silent -locations relative project.pro +lupdate -locations relative project.pro diff --git a/tests/auto/linguist/lupdate/testdata/good/mergecpp_noobsolete/lupdatecmd b/tests/auto/linguist/lupdate/testdata/good/mergecpp_noobsolete/lupdatecmd index d200143..500a822 100644 --- a/tests/auto/linguist/lupdate/testdata/good/mergecpp_noobsolete/lupdatecmd +++ b/tests/auto/linguist/lupdate/testdata/good/mergecpp_noobsolete/lupdatecmd @@ -1,5 +1 @@ -# Add the command that lupdate should run here. If it can't find anything it will default to -# 'lupdate project.pro -ts project.ts' - -# lupdate project.pro -lupdate -silent -noobsolete project.pro +lupdate -noobsolete project.pro diff --git a/tests/auto/linguist/lupdate/testdata/output_ts/lupdatecmd b/tests/auto/linguist/lupdate/testdata/output_ts/lupdatecmd index 80319de..d3a5bf7 100644 --- a/tests/auto/linguist/lupdate/testdata/output_ts/lupdatecmd +++ b/tests/auto/linguist/lupdate/testdata/output_ts/lupdatecmd @@ -1,5 +1 @@ -# Add the command that lupdate should run here. If it can't find anything it will default to -# 'lupdate project.pro -ts project.ts' - -# lupdate project.pro lupdate toplevel/library/tools/tools.pro -- cgit v0.12 From 79f1414fabe097d1fb87b2f3153dcde910e0b2cb Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Wed, 6 Jan 2010 14:11:42 +0100 Subject: no point in specifying -ts when a .pro file is specified ... unless of course one hits this weird lupdate behavior regarding SUBDIRS in conjunction with -ts. just use the flag for this one test for now. --- tests/auto/linguist/lupdate/testdata/good/backslashes/lupdatecmd | 1 - tests/auto/linguist/lupdate/testdata/good/proparsingsubs/lupdatecmd | 1 + tests/auto/linguist/lupdate/tst_lupdate.cpp | 5 ++--- 3 files changed, 3 insertions(+), 4 deletions(-) create mode 100644 tests/auto/linguist/lupdate/testdata/good/proparsingsubs/lupdatecmd diff --git a/tests/auto/linguist/lupdate/testdata/good/backslashes/lupdatecmd b/tests/auto/linguist/lupdate/testdata/good/backslashes/lupdatecmd index 13b2927..f0e1ab2 100644 --- a/tests/auto/linguist/lupdate/testdata/good/backslashes/lupdatecmd +++ b/tests/auto/linguist/lupdate/testdata/good/backslashes/lupdatecmd @@ -1,2 +1 @@ TRANSLATION: ts\project.ts -lupdate project.pro diff --git a/tests/auto/linguist/lupdate/testdata/good/proparsingsubs/lupdatecmd b/tests/auto/linguist/lupdate/testdata/good/proparsingsubs/lupdatecmd new file mode 100644 index 0000000..b7e12cc --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/proparsingsubs/lupdatecmd @@ -0,0 +1 @@ +lupdate project.pro -ts project.ts diff --git a/tests/auto/linguist/lupdate/tst_lupdate.cpp b/tests/auto/linguist/lupdate/tst_lupdate.cpp index 7140ede..e880eed 100644 --- a/tests/auto/linguist/lupdate/tst_lupdate.cpp +++ b/tests/auto/linguist/lupdate/tst_lupdate.cpp @@ -197,9 +197,8 @@ void tst_lupdate::good() file.close(); } - if (lupdatecmd.isEmpty()) { - lupdatecmd = QLatin1String("project.pro -ts project.ts"); - } + if (lupdatecmd.isEmpty()) + lupdatecmd = QLatin1String("project.pro"); lupdatecmd.prepend("-silent "); m_lupdate.updateProFile(lupdatecmd); -- cgit v0.12 From 14fc1147d156b9f600a66ec8a5bfc71e936f0bdf Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Tue, 5 Jan 2010 21:01:30 +0100 Subject: fix number heuristics, part 1 Reviewed-by: TrustMe --- tools/linguist/lupdate/merge.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/linguist/lupdate/merge.cpp b/tools/linguist/lupdate/merge.cpp index fa0dd3d..1f006ea 100644 --- a/tools/linguist/lupdate/merge.cpp +++ b/tools/linguist/lupdate/merge.cpp @@ -63,7 +63,7 @@ static bool isDigitFriendly(QChar c) static int numberLength(const QString &s, int i) { - if (i < s.size() || !s.at(i).isDigit()) + if (i >= s.size() || !s.at(i).isDigit()) return 0; int pos = i; @@ -90,7 +90,7 @@ static QString zeroKey(const QString &key) QString zeroed; bool metSomething = false; - for (int i = 0; i != key.size(); ++i) { + for (int i = 0; i < key.size(); ++i) { int len = numberLength(key, i); if (len > 0) { i += len; -- cgit v0.12 From 2bd2e35078e0cdf9f1458892adcd0939504b59bb Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Wed, 6 Jan 2010 12:34:12 +0100 Subject: fix sametext and number heuristics 92e9a48 ("eliminate Translator::replace()") eliminated the correctness as well. whoops. this code should be more efficient as well ... --- .../testdata/good/heuristics/expectedoutput.txt | 5 ++ .../lupdate/testdata/good/heuristics/lupdatecmd | 2 + .../lupdate/testdata/good/heuristics/main.cpp | 62 +++++++++++++++ .../lupdate/testdata/good/heuristics/project.pro | 3 + .../testdata/good/heuristics/project.ts.before | 38 +++++++++ .../testdata/good/heuristics/project.ts.result | 22 ++++++ tools/linguist/lupdate/merge.cpp | 91 +++++++++++----------- 7 files changed, 178 insertions(+), 45 deletions(-) create mode 100644 tests/auto/linguist/lupdate/testdata/good/heuristics/expectedoutput.txt create mode 100644 tests/auto/linguist/lupdate/testdata/good/heuristics/lupdatecmd create mode 100644 tests/auto/linguist/lupdate/testdata/good/heuristics/main.cpp create mode 100644 tests/auto/linguist/lupdate/testdata/good/heuristics/project.pro create mode 100644 tests/auto/linguist/lupdate/testdata/good/heuristics/project.ts.before create mode 100644 tests/auto/linguist/lupdate/testdata/good/heuristics/project.ts.result diff --git a/tests/auto/linguist/lupdate/testdata/good/heuristics/expectedoutput.txt b/tests/auto/linguist/lupdate/testdata/good/heuristics/expectedoutput.txt new file mode 100644 index 0000000..1eed403 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/heuristics/expectedoutput.txt @@ -0,0 +1,5 @@ +Updating 'project\.ts'\.\.\. + Found 3 source text\(s\) \(3 new and 0 already existing\) + Removed 5 obsolete entries + Number heuristic provided 1 translation\(s\) + Same-text heuristic provided 1 translation\(s\) diff --git a/tests/auto/linguist/lupdate/testdata/good/heuristics/lupdatecmd b/tests/auto/linguist/lupdate/testdata/good/heuristics/lupdatecmd new file mode 100644 index 0000000..6bda261 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/heuristics/lupdatecmd @@ -0,0 +1,2 @@ +TRANSLATION: project.ts +lupdate -verbose -disable-heuristic similartext -no-obsolete project.pro diff --git a/tests/auto/linguist/lupdate/testdata/good/heuristics/main.cpp b/tests/auto/linguist/lupdate/testdata/good/heuristics/main.cpp new file mode 100644 index 0000000..9f36b33 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/heuristics/main.cpp @@ -0,0 +1,62 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** 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 Technology Preview License Agreement accompanying +** this package. +** +** 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.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +// IMPORTANT!!!! If you want to add testdata to this file, +// always add it to the end in order to not change the linenumbers of translations!!! + +#define QTCORE +#include QTCORE // Hidden from lupdate, but compiles + +class A: public QObject { + Q_OBJECT + void foo() + { + // number Heuristics + tr("version 2.0 now"); + + // same text match + tr("this is the matched same text"); + + // failed same text + tr("this is the non-matched same text"); + } +}; + diff --git a/tests/auto/linguist/lupdate/testdata/good/heuristics/project.pro b/tests/auto/linguist/lupdate/testdata/good/heuristics/project.pro new file mode 100644 index 0000000..759bea0 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/heuristics/project.pro @@ -0,0 +1,3 @@ +SOURCES = main.cpp + +TRANSLATIONS = project.ts diff --git a/tests/auto/linguist/lupdate/testdata/good/heuristics/project.ts.before b/tests/auto/linguist/lupdate/testdata/good/heuristics/project.ts.before new file mode 100644 index 0000000..ce82810 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/heuristics/project.ts.before @@ -0,0 +1,38 @@ + + + + + A + + + version 1.0 now + teraz wersja 1.0 + + + + B + + + this is the matched same text + der same-text-treffer + + + + this is the non-matched same text + same-text-reinfall variante eins + + + + C + + + this is the matched same text + der same-text-treffer + + + + this is the non-matched same text + völlig andere variante des reinfalls mit same-text + + + diff --git a/tests/auto/linguist/lupdate/testdata/good/heuristics/project.ts.result b/tests/auto/linguist/lupdate/testdata/good/heuristics/project.ts.result new file mode 100644 index 0000000..402ad9a --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/heuristics/project.ts.result @@ -0,0 +1,22 @@ + + + + + A + + + version 2.0 now + teraz wersja 1.0 {2.0 ?} + + + + this is the matched same text + der same-text-treffer + + + + this is the non-matched same text + + + + diff --git a/tools/linguist/lupdate/merge.cpp b/tools/linguist/lupdate/merge.cpp index 1f006ea..b657282 100644 --- a/tools/linguist/lupdate/merge.cpp +++ b/tools/linguist/lupdate/merge.cpp @@ -50,9 +50,6 @@ #include #include -typedef QList TML; -typedef QMap TMM; - QT_BEGIN_NAMESPACE @@ -225,31 +222,36 @@ static QString translationAttempt(const QString &oldTranslation, */ int applyNumberHeuristic(Translator &tor) { - TMM translated, untranslated; - TMM::Iterator t, u; - TML all = tor.messages(); - TML::Iterator it; + QMap > translated; + QVector untranslated(tor.messageCount()); int inserted = 0; - for (it = all.begin(); it != all.end(); ++it) { - bool hasTranslation = it->isTranslated(); - if (it->type() == TranslatorMessage::Unfinished) { + for (int i = 0; i < tor.messageCount(); ++i) { + const TranslatorMessage &msg = tor.message(i); + bool hasTranslation = msg.isTranslated(); + if (msg.type() == TranslatorMessage::Unfinished) { if (!hasTranslation) - untranslated.insert(it->context() + QLatin1Char('\n') - + it->sourceText() + QLatin1Char('\n') - + it->comment(), *it); - } else if (hasTranslation && it->translations().count() == 1) { - translated.insert(zeroKey(it->sourceText()), *it); + untranslated[i] = true; + } else if (hasTranslation && msg.translations().count() == 1) { + const QString &key = zeroKey(msg.sourceText()); + if (!key.isEmpty()) + translated.insert(key, qMakePair(msg.sourceText(), msg.translation())); } } - for (u = untranslated.begin(); u != untranslated.end(); ++u) { - t = translated.find(zeroKey((*u).sourceText())); - if (t != translated.end() && !t.key().isEmpty() - && t->sourceText() != u->sourceText()) { - u->setTranslation(translationAttempt(t->translation(), t->sourceText(), - u->sourceText())); - inserted++; + for (int i = 0; i < tor.messageCount(); ++i) { + if (untranslated[i]) { + TranslatorMessage &msg = tor.message(i); + const QString &key = zeroKey(msg.sourceText()); + if (!key.isEmpty()) { + QMap >::ConstIterator t = + translated.constFind(key); + if (t != translated.constEnd() && t->first != msg.sourceText()) { + msg.setTranslation(translationAttempt(t->second, t->first, + msg.sourceText())); + inserted++; + } + } } } return inserted; @@ -268,43 +270,42 @@ int applyNumberHeuristic(Translator &tor) int applySameTextHeuristic(Translator &tor) { - TMM translated; - TMM avoid; - TMM::Iterator t; - TML untranslated; - TML::Iterator u; - TML all = tor.messages(); - TML::Iterator it; + QMap translated; + QMap avoid; // Want a QTreeSet, in fact + QVector untranslated(tor.messageCount()); int inserted = 0; - for (it = all.begin(); it != all.end(); ++it) { - if (!it->isTranslated()) { - if (it->type() == TranslatorMessage::Unfinished) - untranslated.append(*it); + for (int i = 0; i < tor.messageCount(); ++i) { + const TranslatorMessage &msg = tor.message(i); + if (!msg.isTranslated()) { + if (msg.type() == TranslatorMessage::Unfinished) + untranslated[i] = true; } else { - QString key = it->sourceText(); - t = translated.find(key); - if (t != translated.end()) { + const QString &key = msg.sourceText(); + QMap::ConstIterator t = translated.constFind(key); + if (t != translated.constEnd()) { /* The same source text is translated at least two different ways. Do nothing then. */ - if (t->translations() != it->translations()) { + if (*t != msg.translations()) { translated.remove(key); - avoid.insert(key, *it); + avoid.insert(key, true); } } else if (!avoid.contains(key)) { - translated.insert(key, *it); + translated.insert(key, msg.translations()); } } } - for (u = untranslated.begin(); u != untranslated.end(); ++u) { - QString key = u->sourceText(); - t = translated.find(key); - if (t != translated.end()) { - u->setTranslations(t->translations()); - ++inserted; + for (int i = 0; i < tor.messageCount(); ++i) { + if (untranslated[i]) { + TranslatorMessage &msg = tor.message(i); + QMap::ConstIterator t = translated.constFind(msg.sourceText()); + if (t != translated.constEnd()) { + msg.setTranslations(*t); + ++inserted; + } } } return inserted; -- cgit v0.12 From 1ee6d3dc9529be1304c5d546e92bf1db832b5bb4 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Wed, 6 Jan 2010 12:51:43 +0100 Subject: look for the .result file in the dir where the output is expected to go that makes manual diffing simpler and makes more complex dir structures less confusing. --- .../linguist/lupdate/testdata/good/backslashes/project.pro | 6 ------ .../lupdate/testdata/good/backslashes/project.ts.result | 13 ------------- .../lupdate/testdata/good/backslashes/ts/project.ts.result | 13 +++++++++++++ tests/auto/linguist/lupdate/tst_lupdate.cpp | 2 +- 4 files changed, 14 insertions(+), 20 deletions(-) delete mode 100644 tests/auto/linguist/lupdate/testdata/good/backslashes/project.ts.result create mode 100644 tests/auto/linguist/lupdate/testdata/good/backslashes/ts/project.ts.result diff --git a/tests/auto/linguist/lupdate/testdata/good/backslashes/project.pro b/tests/auto/linguist/lupdate/testdata/good/backslashes/project.pro index 33eb1f3..4698b2b 100644 --- a/tests/auto/linguist/lupdate/testdata/good/backslashes/project.pro +++ b/tests/auto/linguist/lupdate/testdata/good/backslashes/project.pro @@ -1,9 +1,3 @@ SOURCES += src\main.cpp TRANSLATIONS = ts\project.ts - - -!exists(ts) { - win32: system(md ts) - else: system(mkdir ts) -} diff --git a/tests/auto/linguist/lupdate/testdata/good/backslashes/project.ts.result b/tests/auto/linguist/lupdate/testdata/good/backslashes/project.ts.result deleted file mode 100644 index d3a5fdf..0000000 --- a/tests/auto/linguist/lupdate/testdata/good/backslashes/project.ts.result +++ /dev/null @@ -1,13 +0,0 @@ - - - - - QApplication - - - QT_LAYOUT_DIRECTION - Translate this string to the string 'LTR' in left-to-right languages or to 'RTL' in right-to-left languages (such as Hebrew and Arabic) to get proper widget layout. - - - - diff --git a/tests/auto/linguist/lupdate/testdata/good/backslashes/ts/project.ts.result b/tests/auto/linguist/lupdate/testdata/good/backslashes/ts/project.ts.result new file mode 100644 index 0000000..d3a5fdf --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/backslashes/ts/project.ts.result @@ -0,0 +1,13 @@ + + + + + QApplication + + + QT_LAYOUT_DIRECTION + Translate this string to the string 'LTR' in left-to-right languages or to 'RTL' in right-to-left languages (such as Hebrew and Arabic) to get proper widget layout. + + + + diff --git a/tests/auto/linguist/lupdate/tst_lupdate.cpp b/tests/auto/linguist/lupdate/tst_lupdate.cpp index e880eed..0442d27 100644 --- a/tests/auto/linguist/lupdate/tst_lupdate.cpp +++ b/tests/auto/linguist/lupdate/tst_lupdate.cpp @@ -167,7 +167,6 @@ void tst_lupdate::good() QFETCH(QString, directory); QString dir = m_basePath + "good/" + directory; - QString expectedFile = dir + QLatin1String("/project.ts.result"); qDebug() << "Checking..."; @@ -213,6 +212,7 @@ void tst_lupdate::good() return; } + QString expectedFile = generatedtsfile + QLatin1String(".result"); doCompare(generatedtsfile, expectedFile, false); } -- cgit v0.12 From a54a8961bad16c55bd0a56896dec42de875cc0b4 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Wed, 6 Jan 2010 12:51:02 +0100 Subject: move equivalent of output_ts test to good/ --- tests/auto/linguist/lupdate/.gitignore | 2 +- .../lupdate/testdata/good/reloutput/lupdatecmd | 2 + .../lupdate/testdata/good/reloutput/main.cpp | 50 ++++++++++++++++++++++ .../lupdate/testdata/good/reloutput/project.pro | 9 ++++ .../good/reloutput/translations/project.ts.result | 12 ++++++ .../linguist/lupdate/testdata/output_ts/lupdatecmd | 1 - .../lupdate/testdata/output_ts/project.ts.result | 12 ------ .../output_ts/toplevel/library/tools/main.cpp | 50 ---------------------- .../output_ts/toplevel/library/tools/tools.pro | 9 ---- .../toplevel/library/tools/translations/readme.txt | 2 - tests/auto/linguist/lupdate/tst_lupdate.cpp | 49 --------------------- 11 files changed, 74 insertions(+), 124 deletions(-) create mode 100644 tests/auto/linguist/lupdate/testdata/good/reloutput/lupdatecmd create mode 100644 tests/auto/linguist/lupdate/testdata/good/reloutput/main.cpp create mode 100644 tests/auto/linguist/lupdate/testdata/good/reloutput/project.pro create mode 100644 tests/auto/linguist/lupdate/testdata/good/reloutput/translations/project.ts.result delete mode 100644 tests/auto/linguist/lupdate/testdata/output_ts/lupdatecmd delete mode 100644 tests/auto/linguist/lupdate/testdata/output_ts/project.ts.result delete mode 100644 tests/auto/linguist/lupdate/testdata/output_ts/toplevel/library/tools/main.cpp delete mode 100644 tests/auto/linguist/lupdate/testdata/output_ts/toplevel/library/tools/tools.pro delete mode 100644 tests/auto/linguist/lupdate/testdata/output_ts/toplevel/library/tools/translations/readme.txt diff --git a/tests/auto/linguist/lupdate/.gitignore b/tests/auto/linguist/lupdate/.gitignore index 4ba5b79..389f2dc 100644 --- a/tests/auto/linguist/lupdate/.gitignore +++ b/tests/auto/linguist/lupdate/.gitignore @@ -1,4 +1,4 @@ tst_lupdate testdata/good/*/project.ts -testdata/output_ts/toplevel/library/tools/translations/project.ts +testdata/good/*/*/project.ts testdata/recursivescan/*.ts diff --git a/tests/auto/linguist/lupdate/testdata/good/reloutput/lupdatecmd b/tests/auto/linguist/lupdate/testdata/good/reloutput/lupdatecmd new file mode 100644 index 0000000..da6103f --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/reloutput/lupdatecmd @@ -0,0 +1,2 @@ +TRANSLATION: translations/project.ts +lupdate project.pro -ts translations/project.ts diff --git a/tests/auto/linguist/lupdate/testdata/good/reloutput/main.cpp b/tests/auto/linguist/lupdate/testdata/good/reloutput/main.cpp new file mode 100644 index 0000000..5a681e2 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/reloutput/main.cpp @@ -0,0 +1,50 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** 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 Technology Preview License Agreement accompanying +** this package. +** +** 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.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +// IMPORTANT!!!! If you want to add testdata to this file, +// always add it to the end in order to not change the linenumbers of translations!!! + + +void func1() { + QApplication::tr("Hello world"); +} + + diff --git a/tests/auto/linguist/lupdate/testdata/good/reloutput/project.pro b/tests/auto/linguist/lupdate/testdata/good/reloutput/project.pro new file mode 100644 index 0000000..5d263ae --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/reloutput/project.pro @@ -0,0 +1,9 @@ +SOURCES += main.cpp + +TRANSLATIONS = translations/project.ts + +exists( $$TRANSLATIONS ) { + win32: system(del $$TRANSLATIONS) + unix: system(rm -f $$TRANSLATIONS) +} + diff --git a/tests/auto/linguist/lupdate/testdata/good/reloutput/translations/project.ts.result b/tests/auto/linguist/lupdate/testdata/good/reloutput/translations/project.ts.result new file mode 100644 index 0000000..e398701 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/reloutput/translations/project.ts.result @@ -0,0 +1,12 @@ + + + + + QApplication + + + Hello world + + + + diff --git a/tests/auto/linguist/lupdate/testdata/output_ts/lupdatecmd b/tests/auto/linguist/lupdate/testdata/output_ts/lupdatecmd deleted file mode 100644 index d3a5bf7..0000000 --- a/tests/auto/linguist/lupdate/testdata/output_ts/lupdatecmd +++ /dev/null @@ -1 +0,0 @@ -lupdate toplevel/library/tools/tools.pro diff --git a/tests/auto/linguist/lupdate/testdata/output_ts/project.ts.result b/tests/auto/linguist/lupdate/testdata/output_ts/project.ts.result deleted file mode 100644 index e398701..0000000 --- a/tests/auto/linguist/lupdate/testdata/output_ts/project.ts.result +++ /dev/null @@ -1,12 +0,0 @@ - - - - - QApplication - - - Hello world - - - - diff --git a/tests/auto/linguist/lupdate/testdata/output_ts/toplevel/library/tools/main.cpp b/tests/auto/linguist/lupdate/testdata/output_ts/toplevel/library/tools/main.cpp deleted file mode 100644 index 5a681e2..0000000 --- a/tests/auto/linguist/lupdate/testdata/output_ts/toplevel/library/tools/main.cpp +++ /dev/null @@ -1,50 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** 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 Technology Preview License Agreement accompanying -** this package. -** -** 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.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -// IMPORTANT!!!! If you want to add testdata to this file, -// always add it to the end in order to not change the linenumbers of translations!!! - - -void func1() { - QApplication::tr("Hello world"); -} - - diff --git a/tests/auto/linguist/lupdate/testdata/output_ts/toplevel/library/tools/tools.pro b/tests/auto/linguist/lupdate/testdata/output_ts/toplevel/library/tools/tools.pro deleted file mode 100644 index 5d263ae..0000000 --- a/tests/auto/linguist/lupdate/testdata/output_ts/toplevel/library/tools/tools.pro +++ /dev/null @@ -1,9 +0,0 @@ -SOURCES += main.cpp - -TRANSLATIONS = translations/project.ts - -exists( $$TRANSLATIONS ) { - win32: system(del $$TRANSLATIONS) - unix: system(rm -f $$TRANSLATIONS) -} - diff --git a/tests/auto/linguist/lupdate/testdata/output_ts/toplevel/library/tools/translations/readme.txt b/tests/auto/linguist/lupdate/testdata/output_ts/toplevel/library/tools/translations/readme.txt deleted file mode 100644 index 83adcd2..0000000 --- a/tests/auto/linguist/lupdate/testdata/output_ts/toplevel/library/tools/translations/readme.txt +++ /dev/null @@ -1,2 +0,0 @@ -This is just a dummy file so that GIT creates this folder - diff --git a/tests/auto/linguist/lupdate/tst_lupdate.cpp b/tests/auto/linguist/lupdate/tst_lupdate.cpp index 0442d27..73ede2f 100644 --- a/tests/auto/linguist/lupdate/tst_lupdate.cpp +++ b/tests/auto/linguist/lupdate/tst_lupdate.cpp @@ -60,7 +60,6 @@ public: private slots: void good_data(); void good(); - void output_ts(); void commandline_data(); void commandline(); #if CHECK_SIMTEXTH @@ -216,54 +215,6 @@ void tst_lupdate::good() doCompare(generatedtsfile, expectedFile, false); } -void tst_lupdate::output_ts() -{ - QString dir = m_basePath + "output_ts"; - m_lupdate.setWorkingDirectory(dir); - - // look for a command - QString lupdatecmd; - QFile file(dir + "/lupdatecmd"); - if (file.exists()) { - QVERIFY(file.open(QIODevice::ReadOnly | QIODevice::Text)); - while (!file.atEnd()) { - QByteArray cmdstring = file.readLine().simplified(); - if (cmdstring.startsWith('#')) - continue; - if (cmdstring.startsWith("lupdate")) { - cmdstring.remove(0, 8); - lupdatecmd.append(cmdstring); - break; - } - } - file.close(); - } - - QDir parsingDir(m_basePath + "output_ts"); - - QString generatedtsfile = - dir + QLatin1String("/toplevel/library/tools/translations/project.ts"); - - QFile::remove(generatedtsfile); - - lupdatecmd.prepend("-silent "); - m_lupdate.qmake(); - m_lupdate.updateProFile(lupdatecmd); - - // If the file expectedoutput.txt exists, compare the - // console output with the content of that file - QFile outfile(dir + "/expectedoutput.txt"); - if (outfile.exists()) { - QString errs = m_lupdate.getErrorMessages().at(1).trimmed(); - QStringList errslist = errs.split(QLatin1Char('\n')); - doCompare(errslist, outfile.fileName(), true); - if (QTest::currentTestFailed()) - return; - } - - doCompare(generatedtsfile, dir + QLatin1String("/project.ts.result"), false); -} - void tst_lupdate::commandline_data() { QTest::addColumn("currentPath"); -- cgit v0.12 From 40e3c68a38152ecdc354a2d503490f9b0ff49740 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Wed, 6 Jan 2010 14:17:57 +0100 Subject: don't use qmake for test setup this makes the tests rather significantly faster --- tests/auto/linguist/lupdate/testdata/good/codecforsrc/project.pro | 5 ----- tests/auto/linguist/lupdate/testdata/good/codecfortr/project.pro | 7 ------- tests/auto/linguist/lupdate/testdata/good/codecfortr1/project.pro | 7 ------- tests/auto/linguist/lupdate/testdata/good/codecfortr2/project.pro | 7 ------- .../auto/linguist/lupdate/testdata/good/lacksqobject/project.pro | 6 ------ .../linguist/lupdate/testdata/good/merge_ordering/project.pro | 8 -------- .../linguist/lupdate/testdata/good/merge_versions/project.pro | 8 -------- .../linguist/lupdate/testdata/good/merge_whitespace/project.pro | 8 -------- tests/auto/linguist/lupdate/testdata/good/mergecpp/project.pro | 8 -------- .../lupdate/testdata/good/mergecpp_noobsolete/project.pro | 8 -------- .../linguist/lupdate/testdata/good/mergecpp_obsolete/project.pro | 8 -------- tests/auto/linguist/lupdate/testdata/good/mergeui/project.pro | 8 -------- .../linguist/lupdate/testdata/good/mergeui_obsolete/project.pro | 8 -------- .../linguist/lupdate/testdata/good/multiple_locations/project.pro | 6 ------ tests/auto/linguist/lupdate/testdata/good/namespaces/project.pro | 6 ------ .../lupdate/testdata/good/parse_special_chars/project.pro | 6 ------ .../auto/linguist/lupdate/testdata/good/parsecontexts/project.pro | 6 ------ tests/auto/linguist/lupdate/testdata/good/parsecpp/project.pro | 6 ------ tests/auto/linguist/lupdate/testdata/good/parsecpp2/project.pro | 6 ------ tests/auto/linguist/lupdate/testdata/good/parsejava/project.pro | 6 ------ tests/auto/linguist/lupdate/testdata/good/parseui/project.pro | 7 ------- tests/auto/linguist/lupdate/testdata/good/prefix/project.pro | 6 ------ tests/auto/linguist/lupdate/testdata/good/preprocess/project.pro | 6 ------ tests/auto/linguist/lupdate/testdata/good/proparsing/project.pro | 6 ------ tests/auto/linguist/lupdate/testdata/good/proparsing2/project.pro | 6 ------ .../linguist/lupdate/testdata/good/proparsingpaths/project.pro | 5 ----- .../auto/linguist/lupdate/testdata/good/proparsingpri/project.pro | 5 ----- .../lupdate/testdata/good/proparsingsubdirs/sub1/sub1.pro | 5 ----- .../linguist/lupdate/testdata/good/proparsingsubs/project.pro | 5 ----- tests/auto/linguist/lupdate/testdata/good/reloutput/project.pro | 6 ------ .../linguist/lupdate/testdata/good/textsimilarity/project.pro | 8 -------- tests/auto/linguist/lupdate/testlupdate.cpp | 8 -------- tests/auto/linguist/lupdate/testlupdate.h | 2 -- tests/auto/linguist/lupdate/tst_lupdate.cpp | 7 +++++-- 34 files changed, 5 insertions(+), 215 deletions(-) diff --git a/tests/auto/linguist/lupdate/testdata/good/codecforsrc/project.pro b/tests/auto/linguist/lupdate/testdata/good/codecforsrc/project.pro index 3b6559d..7225608 100644 --- a/tests/auto/linguist/lupdate/testdata/good/codecforsrc/project.pro +++ b/tests/auto/linguist/lupdate/testdata/good/codecforsrc/project.pro @@ -5,8 +5,3 @@ TRANSLATIONS = project.ts CODECFORTR = utf-8 CODECFORSRC = utf-8 - -exists( $$TRANSLATIONS ) { - win32: system(del $$TRANSLATIONS) - unix: system(rm $$TRANSLATIONS) -} diff --git a/tests/auto/linguist/lupdate/testdata/good/codecfortr/project.pro b/tests/auto/linguist/lupdate/testdata/good/codecfortr/project.pro index 841cfa6..64f3c85 100644 --- a/tests/auto/linguist/lupdate/testdata/good/codecfortr/project.pro +++ b/tests/auto/linguist/lupdate/testdata/good/codecfortr/project.pro @@ -4,10 +4,3 @@ CONFIG+= console TRANSLATIONS = project.ts CODECFORTR = CP1251 - -exists( $$TRANSLATIONS ) { - win32: system(del $$TRANSLATIONS) - unix: system(rm $$TRANSLATIONS) -} - - diff --git a/tests/auto/linguist/lupdate/testdata/good/codecfortr1/project.pro b/tests/auto/linguist/lupdate/testdata/good/codecfortr1/project.pro index acbf8b9..d5697eb 100644 --- a/tests/auto/linguist/lupdate/testdata/good/codecfortr1/project.pro +++ b/tests/auto/linguist/lupdate/testdata/good/codecfortr1/project.pro @@ -4,10 +4,3 @@ CONFIG += console TRANSLATIONS = project.ts CODECFORTR = CP1252 - -exists( $$TRANSLATIONS ) { - win32: system(del $$TRANSLATIONS) - unix: system(rm $$TRANSLATIONS) -} - - diff --git a/tests/auto/linguist/lupdate/testdata/good/codecfortr2/project.pro b/tests/auto/linguist/lupdate/testdata/good/codecfortr2/project.pro index 5b382ad..c95939c 100644 --- a/tests/auto/linguist/lupdate/testdata/good/codecfortr2/project.pro +++ b/tests/auto/linguist/lupdate/testdata/good/codecfortr2/project.pro @@ -5,10 +5,3 @@ TRANSLATIONS = project.ts CODECFORSRC = CP1252 CODECFORTR = UTF-8 - -exists( $$TRANSLATIONS ) { - win32: system(del $$TRANSLATIONS) - unix: system(rm $$TRANSLATIONS) -} - - diff --git a/tests/auto/linguist/lupdate/testdata/good/lacksqobject/project.pro b/tests/auto/linguist/lupdate/testdata/good/lacksqobject/project.pro index ff4dbd2..759bea0 100644 --- a/tests/auto/linguist/lupdate/testdata/good/lacksqobject/project.pro +++ b/tests/auto/linguist/lupdate/testdata/good/lacksqobject/project.pro @@ -1,9 +1,3 @@ SOURCES = main.cpp TRANSLATIONS = project.ts - -exists( $$TRANSLATIONS ) { - win32: system(del $$TRANSLATIONS) - unix: system(rm $$TRANSLATIONS) -} - diff --git a/tests/auto/linguist/lupdate/testdata/good/merge_ordering/project.pro b/tests/auto/linguist/lupdate/testdata/good/merge_ordering/project.pro index f8c7ca2..6149858 100644 --- a/tests/auto/linguist/lupdate/testdata/good/merge_ordering/project.pro +++ b/tests/auto/linguist/lupdate/testdata/good/merge_ordering/project.pro @@ -1,11 +1,3 @@ SOURCES += foo.cpp TRANSLATIONS = project.ts - -# Copy the ts to a temp file because: -# 1. The depot file is usually read-only -# 2. We don't want to modify the original file, since then it won't be possible to run the test twice -# without reverting the original file again. - -win32: system(copy /Y project.ts.before $$TRANSLATIONS) -unix: system(cp -f project.ts.before $$TRANSLATIONS && chmod a+w $$TRANSLATIONS) diff --git a/tests/auto/linguist/lupdate/testdata/good/merge_versions/project.pro b/tests/auto/linguist/lupdate/testdata/good/merge_versions/project.pro index 70dd7ce..fa56972 100644 --- a/tests/auto/linguist/lupdate/testdata/good/merge_versions/project.pro +++ b/tests/auto/linguist/lupdate/testdata/good/merge_versions/project.pro @@ -1,11 +1,3 @@ FORMS += project.ui TRANSLATIONS = project.ts - -# Copy the ts to a temp file because: -# 1. The depot file is usually read-only -# 2. We don't want to modify the original file, since then it won't be possible to run the test twice -# without reverting the original file again. - -win32: system(copy /Y project.ts.before $$TRANSLATIONS) -unix: system(cp -f project.ts.before $$TRANSLATIONS && chmod a+w $$TRANSLATIONS) diff --git a/tests/auto/linguist/lupdate/testdata/good/merge_whitespace/project.pro b/tests/auto/linguist/lupdate/testdata/good/merge_whitespace/project.pro index 7eea86d..759bea0 100644 --- a/tests/auto/linguist/lupdate/testdata/good/merge_whitespace/project.pro +++ b/tests/auto/linguist/lupdate/testdata/good/merge_whitespace/project.pro @@ -1,11 +1,3 @@ SOURCES = main.cpp TRANSLATIONS = project.ts - -# Copy the ts to a temp file because: -# 1. The depot file is usually read-only -# 2. We don't want to modify the original file, since then it won't be possible to run the test twice -# without reverting the original file again. - -win32: system(copy /Y project.ts.before $$TRANSLATIONS) -unix: system(cp -f project.ts.before $$TRANSLATIONS && chmod a+w $$TRANSLATIONS) diff --git a/tests/auto/linguist/lupdate/testdata/good/mergecpp/project.pro b/tests/auto/linguist/lupdate/testdata/good/mergecpp/project.pro index 698047a..63f5d66 100644 --- a/tests/auto/linguist/lupdate/testdata/good/mergecpp/project.pro +++ b/tests/auto/linguist/lupdate/testdata/good/mergecpp/project.pro @@ -1,11 +1,3 @@ SOURCES += finddialog.cpp TRANSLATIONS = project.ts - -# Copy the ts to a temp file because: -# 1. The depot file is usually read-only -# 2. We don't want to modify the original file, since then it won't be possible to run the test twice -# without reverting the original file again. - -win32: system(copy /Y project.ts.before $$TRANSLATIONS) -unix: system(cp -f project.ts.before $$TRANSLATIONS && chmod a+w $$TRANSLATIONS) diff --git a/tests/auto/linguist/lupdate/testdata/good/mergecpp_noobsolete/project.pro b/tests/auto/linguist/lupdate/testdata/good/mergecpp_noobsolete/project.pro index 698047a..63f5d66 100644 --- a/tests/auto/linguist/lupdate/testdata/good/mergecpp_noobsolete/project.pro +++ b/tests/auto/linguist/lupdate/testdata/good/mergecpp_noobsolete/project.pro @@ -1,11 +1,3 @@ SOURCES += finddialog.cpp TRANSLATIONS = project.ts - -# Copy the ts to a temp file because: -# 1. The depot file is usually read-only -# 2. We don't want to modify the original file, since then it won't be possible to run the test twice -# without reverting the original file again. - -win32: system(copy /Y project.ts.before $$TRANSLATIONS) -unix: system(cp -f project.ts.before $$TRANSLATIONS && chmod a+w $$TRANSLATIONS) diff --git a/tests/auto/linguist/lupdate/testdata/good/mergecpp_obsolete/project.pro b/tests/auto/linguist/lupdate/testdata/good/mergecpp_obsolete/project.pro index 698047a..63f5d66 100644 --- a/tests/auto/linguist/lupdate/testdata/good/mergecpp_obsolete/project.pro +++ b/tests/auto/linguist/lupdate/testdata/good/mergecpp_obsolete/project.pro @@ -1,11 +1,3 @@ SOURCES += finddialog.cpp TRANSLATIONS = project.ts - -# Copy the ts to a temp file because: -# 1. The depot file is usually read-only -# 2. We don't want to modify the original file, since then it won't be possible to run the test twice -# without reverting the original file again. - -win32: system(copy /Y project.ts.before $$TRANSLATIONS) -unix: system(cp -f project.ts.before $$TRANSLATIONS && chmod a+w $$TRANSLATIONS) diff --git a/tests/auto/linguist/lupdate/testdata/good/mergeui/project.pro b/tests/auto/linguist/lupdate/testdata/good/mergeui/project.pro index 9a0d55d..fa56972 100644 --- a/tests/auto/linguist/lupdate/testdata/good/mergeui/project.pro +++ b/tests/auto/linguist/lupdate/testdata/good/mergeui/project.pro @@ -1,11 +1,3 @@ FORMS += project.ui TRANSLATIONS = project.ts - -# Copy the ts to a temp file because: -# 1. The depot file is usually read-only -# 2. We don't want to modify the original file, since then it won't be possible to run the test twice -# without reverting the original file again. - -win32: system(copy /Y project.ts.before $$TRANSLATIONS) -unix: system(cp -f project.ts.before $$TRANSLATIONS && chmod a+w $$TRANSLATIONS) diff --git a/tests/auto/linguist/lupdate/testdata/good/mergeui_obsolete/project.pro b/tests/auto/linguist/lupdate/testdata/good/mergeui_obsolete/project.pro index 9a0d55d..fa56972 100644 --- a/tests/auto/linguist/lupdate/testdata/good/mergeui_obsolete/project.pro +++ b/tests/auto/linguist/lupdate/testdata/good/mergeui_obsolete/project.pro @@ -1,11 +1,3 @@ FORMS += project.ui TRANSLATIONS = project.ts - -# Copy the ts to a temp file because: -# 1. The depot file is usually read-only -# 2. We don't want to modify the original file, since then it won't be possible to run the test twice -# without reverting the original file again. - -win32: system(copy /Y project.ts.before $$TRANSLATIONS) -unix: system(cp -f project.ts.before $$TRANSLATIONS && chmod a+w $$TRANSLATIONS) diff --git a/tests/auto/linguist/lupdate/testdata/good/multiple_locations/project.pro b/tests/auto/linguist/lupdate/testdata/good/multiple_locations/project.pro index c3f1112..bbabdfb 100644 --- a/tests/auto/linguist/lupdate/testdata/good/multiple_locations/project.pro +++ b/tests/auto/linguist/lupdate/testdata/good/multiple_locations/project.pro @@ -2,9 +2,3 @@ SOURCES += main.cpp SOURCES += finddialog.cpp TRANSLATIONS = project.ts - -exists( $$TRANSLATIONS ) { - win32: system(del $$TRANSLATIONS) - unix: system(rm $$TRANSLATIONS) -} - diff --git a/tests/auto/linguist/lupdate/testdata/good/namespaces/project.pro b/tests/auto/linguist/lupdate/testdata/good/namespaces/project.pro index 4ab0edf..c96859b 100644 --- a/tests/auto/linguist/lupdate/testdata/good/namespaces/project.pro +++ b/tests/auto/linguist/lupdate/testdata/good/namespaces/project.pro @@ -1,9 +1,3 @@ SOURCES += main.cpp TRANSLATIONS = project.ts - -exists( $$TRANSLATIONS ) { - win32: system(del $$TRANSLATIONS) - unix: system(rm $$TRANSLATIONS) -} - diff --git a/tests/auto/linguist/lupdate/testdata/good/parse_special_chars/project.pro b/tests/auto/linguist/lupdate/testdata/good/parse_special_chars/project.pro index 4ab0edf..c96859b 100644 --- a/tests/auto/linguist/lupdate/testdata/good/parse_special_chars/project.pro +++ b/tests/auto/linguist/lupdate/testdata/good/parse_special_chars/project.pro @@ -1,9 +1,3 @@ SOURCES += main.cpp TRANSLATIONS = project.ts - -exists( $$TRANSLATIONS ) { - win32: system(del $$TRANSLATIONS) - unix: system(rm $$TRANSLATIONS) -} - diff --git a/tests/auto/linguist/lupdate/testdata/good/parsecontexts/project.pro b/tests/auto/linguist/lupdate/testdata/good/parsecontexts/project.pro index ff4dbd2..759bea0 100644 --- a/tests/auto/linguist/lupdate/testdata/good/parsecontexts/project.pro +++ b/tests/auto/linguist/lupdate/testdata/good/parsecontexts/project.pro @@ -1,9 +1,3 @@ SOURCES = main.cpp TRANSLATIONS = project.ts - -exists( $$TRANSLATIONS ) { - win32: system(del $$TRANSLATIONS) - unix: system(rm $$TRANSLATIONS) -} - diff --git a/tests/auto/linguist/lupdate/testdata/good/parsecpp/project.pro b/tests/auto/linguist/lupdate/testdata/good/parsecpp/project.pro index c3f1112..bbabdfb 100644 --- a/tests/auto/linguist/lupdate/testdata/good/parsecpp/project.pro +++ b/tests/auto/linguist/lupdate/testdata/good/parsecpp/project.pro @@ -2,9 +2,3 @@ SOURCES += main.cpp SOURCES += finddialog.cpp TRANSLATIONS = project.ts - -exists( $$TRANSLATIONS ) { - win32: system(del $$TRANSLATIONS) - unix: system(rm $$TRANSLATIONS) -} - diff --git a/tests/auto/linguist/lupdate/testdata/good/parsecpp2/project.pro b/tests/auto/linguist/lupdate/testdata/good/parsecpp2/project.pro index ff4dbd2..759bea0 100644 --- a/tests/auto/linguist/lupdate/testdata/good/parsecpp2/project.pro +++ b/tests/auto/linguist/lupdate/testdata/good/parsecpp2/project.pro @@ -1,9 +1,3 @@ SOURCES = main.cpp TRANSLATIONS = project.ts - -exists( $$TRANSLATIONS ) { - win32: system(del $$TRANSLATIONS) - unix: system(rm $$TRANSLATIONS) -} - diff --git a/tests/auto/linguist/lupdate/testdata/good/parsejava/project.pro b/tests/auto/linguist/lupdate/testdata/good/parsejava/project.pro index 2032674..657b535 100644 --- a/tests/auto/linguist/lupdate/testdata/good/parsejava/project.pro +++ b/tests/auto/linguist/lupdate/testdata/good/parsejava/project.pro @@ -1,9 +1,3 @@ SOURCES += main.java TRANSLATIONS = project.ts - -exists( $$TRANSLATIONS ) { - win32: system(del $$TRANSLATIONS) - unix: system(rm $$TRANSLATIONS) -} - diff --git a/tests/auto/linguist/lupdate/testdata/good/parseui/project.pro b/tests/auto/linguist/lupdate/testdata/good/parseui/project.pro index 9ae812c..fa56972 100644 --- a/tests/auto/linguist/lupdate/testdata/good/parseui/project.pro +++ b/tests/auto/linguist/lupdate/testdata/good/parseui/project.pro @@ -1,10 +1,3 @@ FORMS += project.ui TRANSLATIONS = project.ts - -exists( $$TRANSLATIONS ) { - win32 : system(del $$TRANSLATIONS) - unix : system(rm $$TRANSLATIONS) -} - - diff --git a/tests/auto/linguist/lupdate/testdata/good/prefix/project.pro b/tests/auto/linguist/lupdate/testdata/good/prefix/project.pro index ff4dbd2..759bea0 100644 --- a/tests/auto/linguist/lupdate/testdata/good/prefix/project.pro +++ b/tests/auto/linguist/lupdate/testdata/good/prefix/project.pro @@ -1,9 +1,3 @@ SOURCES = main.cpp TRANSLATIONS = project.ts - -exists( $$TRANSLATIONS ) { - win32: system(del $$TRANSLATIONS) - unix: system(rm $$TRANSLATIONS) -} - diff --git a/tests/auto/linguist/lupdate/testdata/good/preprocess/project.pro b/tests/auto/linguist/lupdate/testdata/good/preprocess/project.pro index a66306d..c96859b 100644 --- a/tests/auto/linguist/lupdate/testdata/good/preprocess/project.pro +++ b/tests/auto/linguist/lupdate/testdata/good/preprocess/project.pro @@ -1,9 +1,3 @@ SOURCES += main.cpp TRANSLATIONS = project.ts - -exists( $$TRANSLATIONS ) { - win32: system(del $$TRANSLATIONS) - unix: system(rm -f $$TRANSLATIONS) -} - diff --git a/tests/auto/linguist/lupdate/testdata/good/proparsing/project.pro b/tests/auto/linguist/lupdate/testdata/good/proparsing/project.pro index 5282863..0e920f9 100644 --- a/tests/auto/linguist/lupdate/testdata/good/proparsing/project.pro +++ b/tests/auto/linguist/lupdate/testdata/good/proparsing/project.pro @@ -29,9 +29,3 @@ if (exists($$member($$(PATH), 0))) { } TRANSLATIONS = project.ts - -exists( $$TRANSLATIONS ) { - win32: system(del $$TRANSLATIONS) - unix: system(rm -f $$TRANSLATIONS) -} - diff --git a/tests/auto/linguist/lupdate/testdata/good/proparsing2/project.pro b/tests/auto/linguist/lupdate/testdata/good/proparsing2/project.pro index 92644e5..3dc4208 100644 --- a/tests/auto/linguist/lupdate/testdata/good/proparsing2/project.pro +++ b/tests/auto/linguist/lupdate/testdata/good/proparsing2/project.pro @@ -31,9 +31,3 @@ win32: SOURCES += $$system(type files-cc.txt) unix: SOURCES += $$system(cat files-cc.txt) TRANSLATIONS = project.ts - -exists( $$TRANSLATIONS ) { - win32: system(del $$TRANSLATIONS) - unix: system(rm $$TRANSLATIONS) -} - diff --git a/tests/auto/linguist/lupdate/testdata/good/proparsingpaths/project.pro b/tests/auto/linguist/lupdate/testdata/good/proparsingpaths/project.pro index 820b4fa..6bfe751 100644 --- a/tests/auto/linguist/lupdate/testdata/good/proparsingpaths/project.pro +++ b/tests/auto/linguist/lupdate/testdata/good/proparsingpaths/project.pro @@ -3,8 +3,3 @@ SOURCES += file*.cpp filter.cpp non-existing.cpp include(sub/sub.pri) TRANSLATIONS = project.ts - -exists( $$TRANSLATIONS ) { - win32: system(del $$TRANSLATIONS) - unix: system(rm -f $$TRANSLATIONS) -} diff --git a/tests/auto/linguist/lupdate/testdata/good/proparsingpri/project.pro b/tests/auto/linguist/lupdate/testdata/good/proparsingpri/project.pro index 14a991f..5e23538 100644 --- a/tests/auto/linguist/lupdate/testdata/good/proparsingpri/project.pro +++ b/tests/auto/linguist/lupdate/testdata/good/proparsingpri/project.pro @@ -7,8 +7,3 @@ include(relativity/relativity.pri) message($$SOURCES) TRANSLATIONS = project.ts - -exists( $$TRANSLATIONS ) { - win32: system(del $$TRANSLATIONS) - unix: system(rm $$TRANSLATIONS) -} diff --git a/tests/auto/linguist/lupdate/testdata/good/proparsingsubdirs/sub1/sub1.pro b/tests/auto/linguist/lupdate/testdata/good/proparsingsubdirs/sub1/sub1.pro index cf55f10..df18c5a 100644 --- a/tests/auto/linguist/lupdate/testdata/good/proparsingsubdirs/sub1/sub1.pro +++ b/tests/auto/linguist/lupdate/testdata/good/proparsingsubdirs/sub1/sub1.pro @@ -1,8 +1,3 @@ SOURCES += main.cpp TRANSLATIONS = ../project.ts - -exists( $$TRANSLATIONS ) { - win32: system(del $$TRANSLATIONS) - unix: system(rm -f $$TRANSLATIONS) -} diff --git a/tests/auto/linguist/lupdate/testdata/good/proparsingsubs/project.pro b/tests/auto/linguist/lupdate/testdata/good/proparsingsubs/project.pro index 668ecf4..f75a462 100644 --- a/tests/auto/linguist/lupdate/testdata/good/proparsingsubs/project.pro +++ b/tests/auto/linguist/lupdate/testdata/good/proparsingsubs/project.pro @@ -1,7 +1,2 @@ TEMPLATE = subdirs SUBDIRS = win mac unix common - -exists( project.ts ) { - win32: system(del project.ts) - unix: system(rm project.ts) -} diff --git a/tests/auto/linguist/lupdate/testdata/good/reloutput/project.pro b/tests/auto/linguist/lupdate/testdata/good/reloutput/project.pro index 5d263ae..4e2e6ad 100644 --- a/tests/auto/linguist/lupdate/testdata/good/reloutput/project.pro +++ b/tests/auto/linguist/lupdate/testdata/good/reloutput/project.pro @@ -1,9 +1,3 @@ SOURCES += main.cpp TRANSLATIONS = translations/project.ts - -exists( $$TRANSLATIONS ) { - win32: system(del $$TRANSLATIONS) - unix: system(rm -f $$TRANSLATIONS) -} - diff --git a/tests/auto/linguist/lupdate/testdata/good/textsimilarity/project.pro b/tests/auto/linguist/lupdate/testdata/good/textsimilarity/project.pro index 9a0d55d..fa56972 100644 --- a/tests/auto/linguist/lupdate/testdata/good/textsimilarity/project.pro +++ b/tests/auto/linguist/lupdate/testdata/good/textsimilarity/project.pro @@ -1,11 +1,3 @@ FORMS += project.ui TRANSLATIONS = project.ts - -# Copy the ts to a temp file because: -# 1. The depot file is usually read-only -# 2. We don't want to modify the original file, since then it won't be possible to run the test twice -# without reverting the original file again. - -win32: system(copy /Y project.ts.before $$TRANSLATIONS) -unix: system(cp -f project.ts.before $$TRANSLATIONS && chmod a+w $$TRANSLATIONS) diff --git a/tests/auto/linguist/lupdate/testlupdate.cpp b/tests/auto/linguist/lupdate/testlupdate.cpp index d43fbc4..877959a 100644 --- a/tests/auto/linguist/lupdate/testlupdate.cpp +++ b/tests/auto/linguist/lupdate/testlupdate.cpp @@ -58,7 +58,6 @@ TestLUpdate::TestLUpdate() childProc = 0; QString binPath = QLibraryInfo::location(QLibraryInfo::BinariesPath); m_cmdLupdate = binPath + QLatin1String("/lupdate"); - m_cmdQMake = binPath + QLatin1String("/qmake"); } TestLUpdate::~TestLUpdate() @@ -149,10 +148,3 @@ bool TestLUpdate::updateProFile(const QString &arguments) QStringList args = arguments.split(QChar(' ')); return runChild( true, m_cmdLupdate, args ); } - -bool TestLUpdate::qmake() -{ - QStringList args; - args << "-r"; - return runChild(true, m_cmdQMake, args); -} diff --git a/tests/auto/linguist/lupdate/testlupdate.h b/tests/auto/linguist/lupdate/testlupdate.h index 581e5e9..153d7ba 100644 --- a/tests/auto/linguist/lupdate/testlupdate.h +++ b/tests/auto/linguist/lupdate/testlupdate.h @@ -57,7 +57,6 @@ public: void setWorkingDirectory( const QString &workDir); bool run( const QString &commandline); bool updateProFile( const QString &arguments); - bool qmake(); QStringList getErrorMessages() { return make_result; } @@ -66,7 +65,6 @@ public: } private: QString m_cmdLupdate; - QString m_cmdQMake; QString m_workDir; QProcess *childProc; QStringList env_list; diff --git a/tests/auto/linguist/lupdate/tst_lupdate.cpp b/tests/auto/linguist/lupdate/tst_lupdate.cpp index 73ede2f..02bb71e 100644 --- a/tests/auto/linguist/lupdate/tst_lupdate.cpp +++ b/tests/auto/linguist/lupdate/tst_lupdate.cpp @@ -169,11 +169,9 @@ void tst_lupdate::good() qDebug() << "Checking..."; - // qmake will delete the previous one, to ensure that we don't do any merging.... QString generatedtsfile(QLatin1String("project.ts")); m_lupdate.setWorkingDirectory(dir); - m_lupdate.qmake(); // look for a command QString lupdatecmd; QFile file(dir + "/lupdatecmd"); @@ -195,6 +193,11 @@ void tst_lupdate::good() file.close(); } + QFile::remove(generatedtsfile); + QString beforetsfile = generatedtsfile + QLatin1String(".before"); + if (QFile::exists(beforetsfile)) + QVERIFY2(QFile::copy(beforetsfile, generatedtsfile), qPrintable(beforetsfile)); + if (lupdatecmd.isEmpty()) lupdatecmd = QLatin1String("project.pro"); lupdatecmd.prepend("-silent "); -- cgit v0.12 From b1b6b0aae294def9b7d04a1fea387d82ed852026 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Wed, 6 Jan 2010 12:36:35 +0100 Subject: make the lupdate tests more verbose in case of failure on the way, replace the convoluted TestLUpdate class with a few QProcess calls. --- tests/auto/linguist/lupdate/lupdate.pro | 3 +- tests/auto/linguist/lupdate/testlupdate.cpp | 150 ---------------------------- tests/auto/linguist/lupdate/testlupdate.h | 85 ---------------- tests/auto/linguist/lupdate/tst_lupdate.cpp | 50 +++++++--- 4 files changed, 37 insertions(+), 251 deletions(-) delete mode 100644 tests/auto/linguist/lupdate/testlupdate.cpp delete mode 100644 tests/auto/linguist/lupdate/testlupdate.h diff --git a/tests/auto/linguist/lupdate/lupdate.pro b/tests/auto/linguist/lupdate/lupdate.pro index 19259dc..bcaaf66 100644 --- a/tests/auto/linguist/lupdate/lupdate.pro +++ b/tests/auto/linguist/lupdate/lupdate.pro @@ -2,6 +2,5 @@ CONFIG += qttest_p4 TARGET = tst_lupdate -HEADERS += testlupdate.h -SOURCES += tst_lupdate.cpp testlupdate.cpp +SOURCES += tst_lupdate.cpp diff --git a/tests/auto/linguist/lupdate/testlupdate.cpp b/tests/auto/linguist/lupdate/testlupdate.cpp deleted file mode 100644 index 877959a..0000000 --- a/tests/auto/linguist/lupdate/testlupdate.cpp +++ /dev/null @@ -1,150 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the Qt Linguist 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 Technology Preview License Agreement accompanying -** this package. -** -** 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.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "testlupdate.h" -#include -#include -#include -#include -#include - -#ifdef Q_OS_WIN32 -# include -#endif - -#include - - -TestLUpdate::TestLUpdate() -{ - childProc = 0; - QString binPath = QLibraryInfo::location(QLibraryInfo::BinariesPath); - m_cmdLupdate = binPath + QLatin1String("/lupdate"); -} - -TestLUpdate::~TestLUpdate() -{ - if (childProc) - delete childProc; -} - -void TestLUpdate::setWorkingDirectory(const QString &workDir) -{ - m_workDir = workDir; - QDir::setCurrent(m_workDir); -} - -void TestLUpdate::addMakeResult( const QString &result ) -{ - make_result.append( result ); -} - -bool TestLUpdate::runChild( bool showOutput, const QString &program, const QStringList &argList) -{ - make_result.clear(); - exit_ok = FALSE; - if (childProc) - delete childProc; - - child_show = showOutput; - if ( showOutput ) { - QString S = argList.join(" "); - addMakeResult( program + QLatin1String(" ") + S ); - } - - childProc = new QProcess(); - Q_ASSERT(childProc); - - childProc->setWorkingDirectory(m_workDir); - connect(childProc, SIGNAL(finished(int)), this, SLOT(childReady(int))); - childProc->setProcessChannelMode(QProcess::MergedChannels); - if (argList.isEmpty()) { - childProc->start( program, QIODevice::ReadWrite | QIODevice::Text ); - } else { - childProc->start( program, argList, QIODevice::ReadWrite | QIODevice::Text ); - } - bool ok; - - ok = childProc->waitForStarted(); - - if (ok) - ok = childProc->waitForFinished(); - - if (!ok) - addMakeResult( "Error executing '" + program + "'." ); - - childReady(ok ? 0 : -1); - - return ok; -} - -void TestLUpdate::childReady(int /*exitCode*/) -{ - if (childProc != 0) { - childHasData(); - exit_ok = childProc->state() == QProcess::NotRunning - && childProc->exitStatus() == 0; - childProc->deleteLater(); - } - childProc = 0; -} - -void TestLUpdate::childHasData() -{ - //QByteArray ba = childProc->readAllStandardError(); - //qDebug() << "ERROR:" << ba; - QString stdoutput = childProc->readAllStandardOutput(); - stdoutput = stdoutput.replace("\t", " "); - if (child_show) - addMakeResult(stdoutput); -} - -bool TestLUpdate::run(const QString &commandline) -{ - return runChild(true, m_cmdLupdate + QLatin1String(" ") + commandline); -} - - -bool TestLUpdate::updateProFile(const QString &arguments) -{ - QStringList args = arguments.split(QChar(' ')); - return runChild( true, m_cmdLupdate, args ); -} diff --git a/tests/auto/linguist/lupdate/testlupdate.h b/tests/auto/linguist/lupdate/testlupdate.h deleted file mode 100644 index 153d7ba..0000000 --- a/tests/auto/linguist/lupdate/testlupdate.h +++ /dev/null @@ -1,85 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the Qt Linguist 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 Technology Preview License Agreement accompanying -** this package. -** -** 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.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef TESTLUPDATE_H -#define TESTLUPDATE_H - -#include -#include -#include - -class TestLUpdate : public QObject -{ - Q_OBJECT - -public: - TestLUpdate(); - virtual ~TestLUpdate(); - - void setWorkingDirectory( const QString &workDir); - bool run( const QString &commandline); - bool updateProFile( const QString &arguments); - QStringList getErrorMessages() { - return make_result; - } - void clearResult() { - make_result.clear(); - } -private: - QString m_cmdLupdate; - QString m_workDir; - QProcess *childProc; - QStringList env_list; - QStringList make_result; - - bool child_show; - bool qws_mode; - bool exit_ok; - - bool runChild( bool showOutput, const QString &program, const QStringList &argList = QStringList()); - void addMakeResult( const QString &result ); - void childHasData(); - -private slots: - void childReady(int exitCode); -}; - -#endif // TESTLUPDATE_H diff --git a/tests/auto/linguist/lupdate/tst_lupdate.cpp b/tests/auto/linguist/lupdate/tst_lupdate.cpp index 02bb71e..80c8f4f 100644 --- a/tests/auto/linguist/lupdate/tst_lupdate.cpp +++ b/tests/auto/linguist/lupdate/tst_lupdate.cpp @@ -39,7 +39,6 @@ ** ****************************************************************************/ -#include "testlupdate.h" #if CHECK_SIMTEXTH #include "../shared/simtexth.h" #endif @@ -55,7 +54,7 @@ class tst_lupdate : public QObject { Q_OBJECT public: - tst_lupdate() { m_basePath = QDir::currentPath() + QLatin1String("/testdata/"); } + tst_lupdate(); private slots: void good_data(); @@ -68,7 +67,7 @@ private slots: #endif private: - TestLUpdate m_lupdate; + QString m_cmdLupdate; QString m_basePath; void doCompare(const QStringList &actual, const QString &expectedFn, bool err); @@ -76,10 +75,17 @@ private: }; +tst_lupdate::tst_lupdate() +{ + QString binPath = QLibraryInfo::location(QLibraryInfo::BinariesPath); + m_cmdLupdate = binPath + QLatin1String("/lupdate"); + m_basePath = QDir::currentPath() + QLatin1String("/testdata/"); +} + void tst_lupdate::doCompare(const QStringList &actual, const QString &expectedFn, bool err) { QFile file(expectedFn); - QVERIFY(file.open(QIODevice::ReadOnly | QIODevice::Text)); + QVERIFY2(file.open(QIODevice::ReadOnly | QIODevice::Text), qPrintable(expectedFn)); QStringList expected = QString(file.readAll()).trimmed().split('\n'); int i = 0, ei = expected.size(), gi = actual.size(); @@ -140,7 +146,7 @@ void tst_lupdate::doCompare(const QStringList &actual, const QString &expectedFn void tst_lupdate::doCompare(const QString &actualFn, const QString &expectedFn, bool err) { QFile afile(actualFn); - QVERIFY(afile.open(QIODevice::ReadOnly | QIODevice::Text)); + QVERIFY2(afile.open(QIODevice::ReadOnly | QIODevice::Text), qPrintable(actualFn)); QStringList actual = QString(afile.readAll()).trimmed().split('\n'); doCompare(actual, expectedFn, err); @@ -169,14 +175,13 @@ void tst_lupdate::good() qDebug() << "Checking..."; - QString generatedtsfile(QLatin1String("project.ts")); + QString generatedtsfile(dir + QLatin1String("/project.ts")); - m_lupdate.setWorkingDirectory(dir); // look for a command QString lupdatecmd; QFile file(dir + "/lupdatecmd"); if (file.exists()) { - QVERIFY(file.open(QIODevice::ReadOnly | QIODevice::Text)); + QVERIFY2(file.open(QIODevice::ReadOnly | QIODevice::Text), qPrintable(file.fileName())); while (!file.atEnd()) { QByteArray cmdstring = file.readLine().simplified(); if (cmdstring.startsWith('#')) @@ -201,14 +206,24 @@ void tst_lupdate::good() if (lupdatecmd.isEmpty()) lupdatecmd = QLatin1String("project.pro"); lupdatecmd.prepend("-silent "); - m_lupdate.updateProFile(lupdatecmd); + + QProcess proc; + proc.setWorkingDirectory(dir); + proc.setProcessChannelMode(QProcess::MergedChannels); + proc.start(m_cmdLupdate + ' ' + lupdatecmd, QIODevice::ReadWrite | QIODevice::Text); + QVERIFY2(proc.waitForFinished(5000), qPrintable(lupdatecmd)); + QByteArray output = proc.readAll().trimmed(); + QVERIFY2(proc.exitStatus() == QProcess::NormalExit, + "\"lupdate " + lupdatecmd.toLatin1() + "\" crashed\n" + output); + QVERIFY2(!proc.exitCode(), + "\"lupdate " + lupdatecmd.toLatin1() + "\" exited with code " + + QByteArray::number(proc.exitCode()) + "\n" + proc.readAll()); // If the file expectedoutput.txt exists, compare the // console output with the content of that file QFile outfile(dir + "/expectedoutput.txt"); if (outfile.exists()) { - QString errs = m_lupdate.getErrorMessages().at(1).trimmed(); - QStringList errslist = errs.split(QLatin1Char('\n')); + QStringList errslist = QString::fromLatin1(output).split(QLatin1Char('\n')); doCompare(errslist, outfile.fileName(), true); if (QTest::currentTestFailed()) return; @@ -238,14 +253,21 @@ void tst_lupdate::commandline() QFETCH(QString, generatedtsfile); QFETCH(QString, expectedtsfile); - m_lupdate.setWorkingDirectory(m_basePath + currentPath); QString generated = m_basePath + currentPath + QLatin1Char('/') + generatedtsfile; QFile gen(generated); if (gen.exists()) QVERIFY(gen.remove()); - if (!m_lupdate.run("-silent " + commandline)) - qDebug() << m_lupdate.getErrorMessages().last(); + QProcess proc; + proc.setWorkingDirectory(m_basePath + currentPath); + proc.setProcessChannelMode(QProcess::MergedChannels); + proc.start(m_cmdLupdate + " -silent " + commandline, QIODevice::ReadWrite | QIODevice::Text); + QVERIFY2(proc.waitForFinished(5000), qPrintable(commandline)); + QVERIFY2(proc.exitStatus() == QProcess::NormalExit, + "\"lupdate -silent " + commandline.toLatin1() + "\" crashed\n" + proc.readAll()); + QVERIFY2(!proc.exitCode(), + "\"lupdate -silent " + commandline.toLatin1() + "\" exited with code " + + QByteArray::number(proc.exitCode()) + "\n" + proc.readAll()); doCompare(generated, m_basePath + currentPath + QLatin1Char('/') + expectedtsfile, false); } -- cgit v0.12 From 1ff8e5ae0a3108086aacd53d3f8d213f13e05a4e Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Thu, 7 Jan 2010 21:56:55 +0100 Subject: don't complain about unresolved base when the reference is absolute Task-number: QTBUG-6072 --- tools/linguist/lupdate/cpp.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/linguist/lupdate/cpp.cpp b/tools/linguist/lupdate/cpp.cpp index 857233e..b7f7807 100644 --- a/tools/linguist/lupdate/cpp.cpp +++ b/tools/linguist/lupdate/cpp.cpp @@ -1732,7 +1732,7 @@ void CppParser::parseInternal(ConversionData &cd, QSet &inclusions) plural = true; } } - if (!pendingContext.isEmpty()) { + if (!pendingContext.isEmpty() && !prefix.startsWith(strColons)) { QStringList unresolved; if (!fullyQualify(namespaces, pendingContext, true, &functionContext, &unresolved)) { functionContextUnresolved = unresolved.join(strColons); -- cgit v0.12 From a25fbb9afdda4315a501ebf10c9fede8905b4329 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Thu, 7 Jan 2010 22:05:28 +0100 Subject: fix test under windows the windows mkspecs auto-add debug_and_release to CONFIG and thus trigger warnings from the profile parser. --- tests/auto/linguist/lupdate/testdata/good/heuristics/project.pro | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/auto/linguist/lupdate/testdata/good/heuristics/project.pro b/tests/auto/linguist/lupdate/testdata/good/heuristics/project.pro index 759bea0..034f298 100644 --- a/tests/auto/linguist/lupdate/testdata/good/heuristics/project.pro +++ b/tests/auto/linguist/lupdate/testdata/good/heuristics/project.pro @@ -1,3 +1,4 @@ SOURCES = main.cpp +CONFIG -= debug_and_release TRANSLATIONS = project.ts -- cgit v0.12 From 4f362459366122d12939057bfa13c770f09037a3 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Fri, 8 Jan 2010 11:11:15 +0100 Subject: Translations: Update German for 4.6.1 --- translations/qt_de.ts | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/translations/qt_de.ts b/translations/qt_de.ts index 81968fb..a06691a 100644 --- a/translations/qt_de.ts +++ b/translations/qt_de.ts @@ -7958,6 +7958,34 @@ Bitte wählen Sie einen anderen Dateinamen. + QXmlPatternistCLI + + + Warning in %1, at line %2, column %3: %4 + Fehler in %1, bei Zeile %2, Spalte %3: %4 + + + + Warning in %1: %2 + Warnung in %1: %2 + + + + Unknown location + unbekannt + + + + Error %1 in %2, at line %3, column %4: %5 + Fehler %1 in %2, bei Zeile %3, Spalte %4: %5 + + + + Error %1 in %2: %3 + Fehler %1 in %2: %3 + + + QXmlStream -- cgit v0.12 From 5533c854c154ec39ecdf15734a5be090dba19d0e Mon Sep 17 00:00:00 2001 From: Jarek Kobus Date: Fri, 8 Jan 2010 13:51:58 +0100 Subject: Doc typos fixed Reviewed-by: David Boddie --- doc/src/examples/moveblocks.qdoc | 6 +++--- examples/animation/moveblocks/main.cpp | 1 - 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/doc/src/examples/moveblocks.qdoc b/doc/src/examples/moveblocks.qdoc index 2dce477..250251d 100644 --- a/doc/src/examples/moveblocks.qdoc +++ b/doc/src/examples/moveblocks.qdoc @@ -60,7 +60,7 @@ states. \o \c StateSwitchTransition is a custom transition that triggers on \c{StateSwitchEvent}s. - \o \c StateSwitchEvent is a QEvent that trigger \c{StateSwitchTransition}s. + \o \c StateSwitchEvent is a QEvent that triggers \c{StateSwitchTransition}s. \o \c QGraphicsRectWidget is a QGraphicsWidget that simply paints its background in a solid \l{Qt::}{blue} color. \endlist @@ -141,7 +141,7 @@ Finally, we can create the state machine, add our initial state, and start execution of the state graph. - \section2 The \c createGemetryState() Function + \section2 The \c createGeometryState() Function In \c createGeometryState(), we set up the geometry for each graphics item. @@ -155,7 +155,7 @@ \section1 The StateSwitcher Class \c StateSwitcher has state switch transitions to each \l{QState}s - we created with \c createGemetryState(). Its job is to transition + we created with \c createGeometryState(). Its job is to transition to one of these states at random when it is entered. All functions in \c StateSwitcher are inlined. We'll step through diff --git a/examples/animation/moveblocks/main.cpp b/examples/animation/moveblocks/main.cpp index f8aa434..a2c0958 100644 --- a/examples/animation/moveblocks/main.cpp +++ b/examples/animation/moveblocks/main.cpp @@ -147,7 +147,6 @@ QState *createGeometryState(QObject *w1, const QRect &rect1, { QState *result = new QState(parent); result->assignProperty(w1, "geometry", rect1); - result->assignProperty(w1, "geometry", rect1); result->assignProperty(w2, "geometry", rect2); result->assignProperty(w3, "geometry", rect3); result->assignProperty(w4, "geometry", rect4); -- cgit v0.12 From 7d3cdcb63c4030926ef5224d7e986de6d67da31b Mon Sep 17 00:00:00 2001 From: Gareth Stockwell Date: Tue, 8 Dec 2009 14:44:31 +0000 Subject: Fixed typo in Phonon::EffectWidget implementation Task-number: QTBUG-4659 Reviewed-by: trustme --- src/3rdparty/phonon/phonon/effectwidget.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/3rdparty/phonon/phonon/effectwidget.cpp b/src/3rdparty/phonon/phonon/effectwidget.cpp index 2334d7f..b39299a 100644 --- a/src/3rdparty/phonon/phonon/effectwidget.cpp +++ b/src/3rdparty/phonon/phonon/effectwidget.cpp @@ -151,7 +151,7 @@ void EffectWidgetPrivate::autogenerateUi() bool minValueOk = false; bool maxValueOk = false; const int minValue = para.minimumValue().toInt(&minValueOk); - const int maxValue = para.minimumValue().toInt(&maxValueOk); + const int maxValue = para.maximumValue().toInt(&maxValueOk); sb->setRange(minValueOk ? minValue : DEFAULT_MIN_INT, maxValueOk ? maxValue : DEFAULT_MAX_INT); sb->setValue(value.toInt()); -- cgit v0.12 From d44c661d75ff6edcabf70b188b18bc991611628b Mon Sep 17 00:00:00 2001 From: Gareth Stockwell Date: Tue, 8 Dec 2009 17:18:17 +0000 Subject: Corrected parameter name ordering in internal Phonon MMF function signatures Some instances of the changeState signal declaration had the newState and oldState parameters in the wrong order. While this has no effect on the behaviour of the code, it can be confusing to developers reading it. Reviewed-by: trustme --- src/3rdparty/phonon/mmf/abstractplayer.h | 4 ++-- src/3rdparty/phonon/mmf/mediaobject.h | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/3rdparty/phonon/mmf/abstractplayer.h b/src/3rdparty/phonon/mmf/abstractplayer.h index 40ad7f8..dbcbe63 100644 --- a/src/3rdparty/phonon/mmf/abstractplayer.h +++ b/src/3rdparty/phonon/mmf/abstractplayer.h @@ -106,8 +106,8 @@ Q_SIGNALS: void finished(); void tick(qint64 time); void bufferStatus(int percentFilled); - void stateChanged(Phonon::State oldState, - Phonon::State newState); + void stateChanged(Phonon::State newState, + Phonon::State oldState); void metaDataChanged(const QMultiMap& metaData); void aboutToFinish(); void prefinishMarkReached(qint32 remaining); diff --git a/src/3rdparty/phonon/mmf/mediaobject.h b/src/3rdparty/phonon/mmf/mediaobject.h index 668b953..7d330e7 100644 --- a/src/3rdparty/phonon/mmf/mediaobject.h +++ b/src/3rdparty/phonon/mmf/mediaobject.h @@ -101,8 +101,8 @@ Q_SIGNALS: // TODO: emit metaDataChanged from MediaObject void metaDataChanged(const QMultiMap& metaData); void currentSourceChanged(const MediaSource& source); - void stateChanged(Phonon::State oldState, - Phonon::State newState); + void stateChanged(Phonon::State newState, + Phonon::State oldState); void finished(); void tick(qint64 time); -- cgit v0.12 From 4c95ec342c62183ecc3dffe50497b4858bc27c8d Mon Sep 17 00:00:00 2001 From: Gareth Stockwell Date: Fri, 8 Jan 2010 18:09:27 +0000 Subject: Implemented audio effects capability querying in Phonon MMF backend This patch addresses the following deficiencies in the existing implementation of audio effects: 1. Native effect objects (e.g. CAudioEqualizer, CBassBoost etc) were created frequently, just in order to check whether a given effect is supported, or retrieve the list of parameters which it requires. Although this is in part due to a deficiency in the S60 audio effects API (it doesn't have a 'capability query' concept), it can be improved by using caching. This patch introduces a singleton EffectFactory object, which lazily initializes a data structure containing information about support and parameters. 2. In order to either query effect support, the native effect object ultimately needs to access a DevSound instance. Previously, the effect object was provided with a CMdaAudioPlayerUtility object. If this player utility has not loaded an MMF controller plugin *before* the effects object makes any calls to the player utility, incorrect results will be returned. This was observed in the previous code. For querying, we don't actually need to load an MMF controller; instead, we would like to directly provide a CMMFDevSound instance to the effect object. Unfortunately, this API is not available in public S60 SDKs, so we must use the next lowest interface available, namely CMdaAudioOutputStream. By making this change, this patch ensures that support and parameter queries made via the EffectFactory will return the correct result. At this point, however, effect settings made via the Phonon API are not actually applied to the audio output. Fixing this will require notifying the audio effects backend nodes of state changes in the MediaObject. Task-number: QTBUG-4659 Reviewed-by: Espen Riskedal --- src/3rdparty/phonon/mmf/abstractaudioeffect.cpp | 9 +- src/3rdparty/phonon/mmf/abstractaudioeffect.h | 12 -- src/3rdparty/phonon/mmf/audioequalizer.cpp | 40 ++--- src/3rdparty/phonon/mmf/audioequalizer.h | 13 +- src/3rdparty/phonon/mmf/backend.cpp | 11 +- src/3rdparty/phonon/mmf/backend.h | 2 + src/3rdparty/phonon/mmf/bassboost.cpp | 21 ++- src/3rdparty/phonon/mmf/bassboost.h | 10 +- src/3rdparty/phonon/mmf/effectfactory.cpp | 189 +++++++++++++++--------- src/3rdparty/phonon/mmf/effectfactory.h | 50 +++++-- src/plugins/phonon/mmf/mmf.pro | 1 + 11 files changed, 226 insertions(+), 132 deletions(-) diff --git a/src/3rdparty/phonon/mmf/abstractaudioeffect.cpp b/src/3rdparty/phonon/mmf/abstractaudioeffect.cpp index e7ef9b2..c75c08e 100644 --- a/src/3rdparty/phonon/mmf/abstractaudioeffect.cpp +++ b/src/3rdparty/phonon/mmf/abstractaudioeffect.cpp @@ -37,10 +37,11 @@ using namespace Phonon::MMF; AbstractAudioEffect::AbstractAudioEffect(QObject *parent, const QList ¶ms) - : MediaNode::MediaNode(parent) + : MediaNode(parent) , m_player(0) , m_params(params) { + } QList AbstractAudioEffect::parameters() const @@ -63,8 +64,10 @@ void AbstractAudioEffect::setParameterValue(const EffectParameter ¶m, { m_values.insert(param.id(), newValue); parameterChanged(param.id(), newValue); - // TODO: handle audio effect errors - TRAP_IGNORE(m_effect->ApplyL()); + + if (m_effect.data()) + // TODO: handle audio effect errors + TRAP_IGNORE(m_effect->ApplyL()); } void AbstractAudioEffect::connectMediaObject(MediaObject *mediaObject) diff --git a/src/3rdparty/phonon/mmf/abstractaudioeffect.h b/src/3rdparty/phonon/mmf/abstractaudioeffect.h index 6f74a73..df1d08a 100644 --- a/src/3rdparty/phonon/mmf/abstractaudioeffect.h +++ b/src/3rdparty/phonon/mmf/abstractaudioeffect.h @@ -68,18 +68,6 @@ public: virtual void setParameterValue(const EffectParameter &, const QVariant &newValue); - enum Type - { - EffectAudioEqualizer = 1, - EffectBassBoost, - EffectDistanceAttenuation, - EffectEnvironmentalReverb, - EffectListenerOrientation, - EffectLoudness, - EffectSourceOrientation, - EffectStereoWidening - }; - protected: // MediaNode void connectMediaObject(MediaObject *mediaObject); diff --git a/src/3rdparty/phonon/mmf/audioequalizer.cpp b/src/3rdparty/phonon/mmf/audioequalizer.cpp index c2936c5..5aa659a 100644 --- a/src/3rdparty/phonon/mmf/audioequalizer.cpp +++ b/src/3rdparty/phonon/mmf/audioequalizer.cpp @@ -28,8 +28,10 @@ using namespace Phonon::MMF; \internal */ -AudioEqualizer::AudioEqualizer(QObject *parent) : AbstractAudioEffect::AbstractAudioEffect(parent, createParams()) +AudioEqualizer::AudioEqualizer(QObject *parent, const QList ¶meters) + : AbstractAudioEffect::AbstractAudioEffect(parent, parameters) { + } void AudioEqualizer::parameterChanged(const int pid, @@ -68,30 +70,32 @@ void AudioEqualizer::setBandLevel(int band, int level) TRAP_IGNORE(effect->SetBandLevelL(band, level)); } -QList AudioEqualizer::createParams() -{ - QList retval; - - // We temporarily create an AudioPlayer, and run the effect on it, so - // we can extract the readonly data we need. - AudioPlayer dummyPlayer; +//----------------------------------------------------------------------------- +// Static functions +//----------------------------------------------------------------------------- - CAudioEqualizer *eqPtr = 0; - QT_TRAP_THROWING(eqPtr = CAudioEqualizer::NewL(*dummyPlayer.nativePlayer())); - QScopedPointer e(eqPtr); +const char* AudioEqualizer::description() +{ + return "Audio equalizer"; +} +void AudioEqualizer::getParameters(NativeEffect *effect, + QList ¶meters) +{ TInt32 dbMin; TInt32 dbMax; - e->DbLevelLimits(dbMin, dbMax); + effect->DbLevelLimits(dbMin, dbMax); - const int bandCount = e->NumberOfBands(); + const int bandCount = effect->NumberOfBands(); - for (int i = 0; i < bandCount; ++i) { - const qint32 hz = e->CenterFrequency(i); + // For some reason, band IDs are 1-based, as opposed to the + // 0-based indices used in just about other Symbian API...! + for (int i = 1; i <= bandCount; ++i) { + const qint32 hz = effect->CenterFrequency(i); - const qint32 defVol = e->BandLevel(i); + const qint32 defVol = effect->BandLevel(i); - retval.append(EffectParameter(i, + parameters.append(EffectParameter(i, tr("Frequency band, %1 Hz").arg(hz), EffectParameter::LogarithmicHint, QVariant(qint32(defVol)), @@ -100,8 +104,6 @@ QList AudioEqualizer::createParams() QVariantList(), QString())); } - - return retval; } QT_END_NAMESPACE diff --git a/src/3rdparty/phonon/mmf/audioequalizer.h b/src/3rdparty/phonon/mmf/audioequalizer.h index 10fe9ad..ee3d297 100644 --- a/src/3rdparty/phonon/mmf/audioequalizer.h +++ b/src/3rdparty/phonon/mmf/audioequalizer.h @@ -21,6 +21,8 @@ along with this library. If not, see . #include "abstractaudioeffect.h" +class CAudioEqualizer; + QT_BEGIN_NAMESPACE namespace Phonon @@ -39,7 +41,13 @@ class AudioEqualizer : public AbstractAudioEffect { Q_OBJECT public: - AudioEqualizer(QObject *parent); + AudioEqualizer(QObject *parent, const QList ¶meters); + + // Static interface required by EffectFactory + static const char* description(); + typedef CAudioEqualizer NativeEffect; + static void getParameters(NativeEffect *effect, + QList ¶meters); protected: // AbstractAudioEffect @@ -50,9 +58,6 @@ protected: private: void setBandLevel(int band, int level); -private: - static QList createParams(); - }; } } diff --git a/src/3rdparty/phonon/mmf/backend.cpp b/src/3rdparty/phonon/mmf/backend.cpp index 0c07f66..3568a49 100644 --- a/src/3rdparty/phonon/mmf/backend.cpp +++ b/src/3rdparty/phonon/mmf/backend.cpp @@ -45,6 +45,7 @@ using namespace Phonon::MMF; Backend::Backend(QObject *parent) : QObject(parent) , m_ancestorMoveMonitor(new AncestorMoveMonitor(this)) + , m_effectFactory(new EffectFactory(this)) { TRACE_CONTEXT(Backend::Backend, EBackend); TRACE_ENTRY_0(); @@ -81,9 +82,9 @@ QObject *Backend::createObject(BackendInterface::Class c, QObject *parent, const { Q_ASSERT(args.count() == 1); Q_ASSERT(args.first().type() == QVariant::Int); - const AbstractAudioEffect::Type effect = AbstractAudioEffect::Type(args.first().toInt()); - - return EffectFactory::createAudioEffect(effect, parent); + const EffectFactory::Type type = + static_cast(args.first().toInt()); + return m_effectFactory->createAudioEffect(type, parent); } case VideoWidgetClass: result = new VideoWidget(m_ancestorMoveMonitor.data(), qobject_cast(parent)); @@ -105,7 +106,7 @@ QList Backend::objectDescriptionIndexes(ObjectDescriptionType type) const switch(type) { case EffectType: - retval.append(EffectFactory::effectIndexes()); + retval.append(m_effectFactory->effectIndexes()); break; case AudioOutputDeviceType: // We only have one possible output device, but we need at least @@ -126,7 +127,7 @@ QHash Backend::objectDescriptionProperties(ObjectDescripti switch (type) { case EffectType: - return EffectFactory::audioEffectDescriptions(AbstractAudioEffect::Type(index)); + return m_effectFactory->audioEffectDescriptions(EffectFactory::Type(index)); case AudioOutputDeviceType: return AudioOutput::audioOutputDescription(index); default: diff --git a/src/3rdparty/phonon/mmf/backend.h b/src/3rdparty/phonon/mmf/backend.h index 9e3d3b3..6b85625 100644 --- a/src/3rdparty/phonon/mmf/backend.h +++ b/src/3rdparty/phonon/mmf/backend.h @@ -20,6 +20,7 @@ along with this library. If not, see . #define PHONON_MMF_BACKEND_H #include "ancestormovemonitor.h" +#include "effectfactory.h" #include #include @@ -53,6 +54,7 @@ Q_SIGNALS: private: QScopedPointer m_ancestorMoveMonitor; + QScopedPointer m_effectFactory; }; } diff --git a/src/3rdparty/phonon/mmf/bassboost.cpp b/src/3rdparty/phonon/mmf/bassboost.cpp index ae96b45..4edd102 100644 --- a/src/3rdparty/phonon/mmf/bassboost.cpp +++ b/src/3rdparty/phonon/mmf/bassboost.cpp @@ -28,15 +28,16 @@ using namespace Phonon::MMF; \internal */ -BassBoost::BassBoost(QObject *parent) : AbstractAudioEffect::AbstractAudioEffect(parent, - QList()) +BassBoost::BassBoost(QObject *parent, const QList ¶meters) + : AbstractAudioEffect::AbstractAudioEffect(parent, parameters) { + } void BassBoost::parameterChanged(const int, const QVariant &) { - Q_ASSERT_X(false, Q_FUNC_INFO, "BassBoost has not parameters"); + Q_ASSERT_X(false, Q_FUNC_INFO, "BassBoost has no parameters"); } void BassBoost::connectAudioPlayer(AudioPlayer::NativePlayer *player) @@ -51,5 +52,19 @@ void BassBoost::applyParameters() // No parameters to apply } +//----------------------------------------------------------------------------- +// Static functions +//----------------------------------------------------------------------------- + +const char* BassBoost::description() +{ + return "Bass boost"; +} + +void BassBoost::getParameters(NativeEffect*, QList&) +{ + +} + QT_END_NAMESPACE diff --git a/src/3rdparty/phonon/mmf/bassboost.h b/src/3rdparty/phonon/mmf/bassboost.h index 4ad0a6c..c3c48d0 100644 --- a/src/3rdparty/phonon/mmf/bassboost.h +++ b/src/3rdparty/phonon/mmf/bassboost.h @@ -21,6 +21,8 @@ along with this library. If not, see . #include "abstractaudioeffect.h" +class CBassBoost; + QT_BEGIN_NAMESPACE namespace Phonon @@ -37,7 +39,13 @@ class BassBoost : public AbstractAudioEffect { Q_OBJECT public: - BassBoost(QObject *parent); + BassBoost(QObject *parent, const QList ¶meters); + + // Static interface required by EffectFactory + static const char* description(); + typedef CBassBoost NativeEffect; + static void getParameters(NativeEffect *effect, + QList ¶meters); protected: // AbstractAudioEffect diff --git a/src/3rdparty/phonon/mmf/effectfactory.cpp b/src/3rdparty/phonon/mmf/effectfactory.cpp index cc94367..a8cbf24 100644 --- a/src/3rdparty/phonon/mmf/effectfactory.cpp +++ b/src/3rdparty/phonon/mmf/effectfactory.cpp @@ -30,6 +30,8 @@ along with this library. If not, see . #include #include +#include + #include "audioequalizer.h" #include "bassboost.h" @@ -44,111 +46,154 @@ using namespace Phonon::MMF; \internal */ -QHash EffectFactory::constructEffectDescription(const QString &name, - const QString &description) +EffectFactory::EffectFactory(QObject *parent) + : QObject(parent) + , m_initialized(false) { - QHash retval; - - retval.insert("name", name); - retval.insert("description", description); - retval.insert("available", true); - return retval; } - -QHash EffectFactory::audioEffectDescriptions(AbstractAudioEffect::Type type) +EffectFactory::~EffectFactory() { - switch (type) - { - case AbstractAudioEffect::EffectAudioEqualizer: - return constructEffectDescription(QCoreApplication::translate("Phonon::MMF::EffectFactory", "Audio Equalizer"), "Audio equalizer."); - case AbstractAudioEffect::EffectBassBoost: - return constructEffectDescription(QCoreApplication::translate("Phonon::MMF::EffectFactory", "Bass Boost"), "Bass boost."); - case AbstractAudioEffect::EffectDistanceAttenuation: - return constructEffectDescription(QCoreApplication::translate("Phonon::MMF::EffectFactory", "Distance Attenuation"), "Distance Attenuation."); - case AbstractAudioEffect::EffectEnvironmentalReverb: - return constructEffectDescription(QCoreApplication::translate("Phonon::MMF::EffectFactory", "Environmental Reverb"), "Environmental Reverb."); - case AbstractAudioEffect::EffectListenerOrientation: - return constructEffectDescription(QCoreApplication::translate("Phonon::MMF::EffectFactory", "Environmental Reverb"), "Environmental Reverb."); - case AbstractAudioEffect::EffectLoudness: - return constructEffectDescription(QCoreApplication::translate("Phonon::MMF::EffectFactory", "Loudness"), "Loudness."); - case AbstractAudioEffect::EffectSourceOrientation: - return constructEffectDescription(QCoreApplication::translate("Phonon::MMF::EffectFactory", "Source Orientation"), "Source Orientation."); - case AbstractAudioEffect::EffectStereoWidening: - return constructEffectDescription(QCoreApplication::translate("Phonon::MMF::EffectFactory", "Stereo Widening"), "Stereo Widening."); - } - Q_ASSERT_X(false, Q_FUNC_INFO, "Unknown effect type."); - return QHash(); } -AbstractAudioEffect *EffectFactory::createAudioEffect(AbstractAudioEffect::Type type, +//----------------------------------------------------------------------------- +// Public functions +//----------------------------------------------------------------------------- + +AbstractAudioEffect *EffectFactory::createAudioEffect(Type type, QObject *parent) { + // Lazily initialize + if (!m_initialized) + initialize(); + Q_ASSERT(parent); + const QList& parameters = data(type).m_parameters; + + AbstractAudioEffect *effect = 0; + switch (type) { - case AbstractAudioEffect::EffectBassBoost: - return new BassBoost(parent); - case AbstractAudioEffect::EffectAudioEqualizer: - return new AudioEqualizer(parent); - case AbstractAudioEffect::EffectDistanceAttenuation: - case AbstractAudioEffect::EffectEnvironmentalReverb: - case AbstractAudioEffect::EffectListenerOrientation: - case AbstractAudioEffect::EffectLoudness: - case AbstractAudioEffect::EffectSourceOrientation: - case AbstractAudioEffect::EffectStereoWidening: - ; + case TypeBassBoost: + effect = new BassBoost(parent, parameters); + case TypeAudioEqualizer: + effect = new AudioEqualizer(parent, parameters); + case TypeDistanceAttenuation: + case TypeEnvironmentalReverb: + case TypeListenerOrientation: + case TypeLoudness: + case TypeSourceOrientation: + case TypeStereoWidening: + break; + default: + Q_ASSERT_X(false, Q_FUNC_INFO, "Unknown effect"); } - Q_ASSERT_X(false, Q_FUNC_INFO, "Unknown effect."); - return 0; + return effect; } -template -bool isEffectSupported() +QHash EffectFactory::audioEffectDescriptions(Type type) { - AudioPlayer audioPlayer; - - QScopedPointer eff; - TRAPD(errorCode, eff.reset(TEffect::NewL(*audioPlayer.nativePlayer()))); + // Lazily initialize + if (!m_initialized) + initialize(); - return errorCode != KErrNone; + return data(type).m_descriptions; } QList EffectFactory::effectIndexes() { - QList retval; + // Lazily initialize + if (!m_initialized) + initialize(); + + QList result; - if (isEffectSupported()) - retval.append(AbstractAudioEffect::EffectAudioEqualizer); + QHash::const_iterator i = m_effectData.begin(); + for ( ; i != m_effectData.end(); ++i) + if (i.value().m_supported) + result.append(i.key()); - if (isEffectSupported()) - retval.append(AbstractAudioEffect::EffectBassBoost); + return result; +} + +//----------------------------------------------------------------------------- +// Private functions +//----------------------------------------------------------------------------- - /* We haven't implemented these yet. - if (isEffectSupported()) - retval.append(AbstractAudioEffect::EffectDistanceAttenuation); +#define INITIALIZE_EFFECT(Effect) \ + { \ + EffectData data = getData(); \ + m_effectData.insert(Type##Effect, data); \ + } - if (isEffectSupported()) - retval.append(AbstractAudioEffect::EffectEnvironmentalReverb); +void EffectFactory::initialize() +{ + Q_ASSERT_X(!m_initialized, Q_FUNC_INFO, "Already initialized"); - if (isEffectSupported()) - retval.append(AbstractAudioEffect::EffectLoudness); + INITIALIZE_EFFECT(AudioEqualizer) + //INITIALIZE_EFFECT(BassBoost) - if (isEffectSupported()) - retval.append(AbstractAudioEffect::EffectListenerOrientation); + m_initialized = true; +} - if (isEffectSupported()) - retval.append(AbstractAudioEffect::EffectSourceOrientation); +// This class is just a wrapper which allows us to instantiate a +// CMdaAudioOutputStream object. This is done in order to allow the +// effects API to query the DevSound implementation, to discover +// which effects are supported and what parameters they take. +// Ideally, we would use CMMFDevSound directly, but this class is not +// available in the public S60 SDK. +class OutputStreamFactory : public MMdaAudioOutputStreamCallback +{ +public: + CMdaAudioOutputStream* create() + { + CMdaAudioOutputStream* stream = 0; + QT_TRAP_THROWING(stream = CMdaAudioOutputStream::NewL(*this)); + return stream; + } +private: + void MaoscOpenComplete(TInt /*aError*/) { } + void MaoscBufferCopied(TInt /*aError*/, const TDesC8& /*aBuffer*/) { } + void MaoscPlayComplete(TInt /*aError*/) { } +}; + +template +EffectFactory::EffectData EffectFactory::getData() +{ + EffectData data; + + // Create a temporary CMdaAudioOutputStream object, so that the effects + // API can query DevSound to discover which effects are supported. + OutputStreamFactory streamFactory; + QScopedPointer stream(streamFactory.create()); + + typedef typename BackendNode::NativeEffect NativeEffect; + QScopedPointer effect; + TRAPD(err, effect.reset(NativeEffect::NewL(*stream))); + data.m_supported = (KErrNone == err); + + if (KErrNone == err) { + const QString description = QCoreApplication::translate + ("Phonon::MMF::EffectFactory", BackendNode::description()); + data.m_descriptions.insert("name", description); + data.m_descriptions.insert("description", description); + data.m_descriptions.insert("available", true); + + BackendNode::getParameters(effect.data(), data.m_parameters); + } - if (isEffectSupported()) - retval.append(AbstractAudioEffect::EffectStereoWidening); - */ + return data; +} - return retval; +const EffectFactory::EffectData& EffectFactory::data(Type type) const +{ + QHash::const_iterator i = m_effectData.find(type); + Q_ASSERT_X(i != m_effectData.end(), Q_FUNC_INFO, "Effect data not found"); + return i.value(); } QT_END_NAMESPACE diff --git a/src/3rdparty/phonon/mmf/effectfactory.h b/src/3rdparty/phonon/mmf/effectfactory.h index e83ad15..45bd0f0 100644 --- a/src/3rdparty/phonon/mmf/effectfactory.h +++ b/src/3rdparty/phonon/mmf/effectfactory.h @@ -31,14 +31,30 @@ namespace MMF /** * @short Contains utility functions related to effects. */ -class EffectFactory +class EffectFactory : public QObject { + Q_OBJECT + public: + EffectFactory(QObject *parent); + ~EffectFactory(); + + enum Type + { + TypeAudioEqualizer = 0 + , TypeBassBoost + , TypeDistanceAttenuation + , TypeEnvironmentalReverb + , TypeListenerOrientation + , TypeLoudness + , TypeSourceOrientation + , TypeStereoWidening + }; + /** * @short Creates an audio effect of type @p type. */ - static AbstractAudioEffect *createAudioEffect(AbstractAudioEffect::Type type, - QObject *parent); + AbstractAudioEffect *createAudioEffect(Type type, QObject *parent); /** * @short Return the properties for effect @p type. @@ -46,7 +62,7 @@ public: * This handles the effects for * BackendInterface::objectDescriptionProperties(). */ - static QHash audioEffectDescriptions(AbstractAudioEffect::Type type); + QHash audioEffectDescriptions(Type type); /** * @short Returns the indexes for the supported effects. @@ -54,19 +70,27 @@ public: * This handles the effects for * BackendInterface::objectDescriptionIndexes(). */ - static QList effectIndexes(); + QList effectIndexes(); private: - static inline QHash constructEffectDescription(const QString &name, - const QString &description); + void initialize(); + + struct EffectData + { + bool m_supported; + QHash m_descriptions; + QList m_parameters; + }; + + template EffectData getData(); + const EffectData& data(Type type) const; + +private: + bool m_initialized; + QHash m_effectData; - /** - * This class is not supposed to be instantiated, so disable - * the default constructor. - */ - inline EffectFactory(); - Q_DISABLE_COPY(EffectFactory) }; + } } diff --git a/src/plugins/phonon/mmf/mmf.pro b/src/plugins/phonon/mmf/mmf.pro index 854f893..65a7a29 100644 --- a/src/plugins/phonon/mmf/mmf.pro +++ b/src/plugins/phonon/mmf/mmf.pro @@ -81,6 +81,7 @@ LIBS += -lws32 # For RWindow LIBS += -lefsrv # For file server LIBS += -lapgrfx -lapmime # For recognizer LIBS += -lmmfcontrollerframework # For CMMFMetaDataEntry +LIBS += -lmediaclientaudiostream # For CMdaAudioOutputStream # These are for effects. LIBS += -lAudioEqualizerEffect -lBassBoostEffect -lDistanceAttenuationEffect -lDopplerBase -lEffectBase -lEnvironmentalReverbEffect -lListenerDopplerEffect -lListenerLocationEffect -lListenerOrientationEffect -lLocationBase -lLoudnessEffect -lOrientationBase -lSourceDopplerEffect -lSourceLocationEffect -lSourceOrientationEffect -lStereoWideningEffect -- cgit v0.12 From 31cc1b382fbcd77def12cd0ad4fe9fc0fabdf60b Mon Sep 17 00:00:00 2001 From: Michael Brasser Date: Mon, 11 Jan 2010 11:01:18 +1000 Subject: Correctly determine QScriptValue::isQObject() for QObjects using the QScriptDeclarativeClass. Task-number: QTBUG-6178 Reviewed-by: Kent Hansen Reviewed-by: Aaron Kennedy --- src/script/api/qscriptvalue.cpp | 12 ++++++++---- src/script/bridge/qscriptdeclarativeclass.cpp | 5 +++++ src/script/bridge/qscriptdeclarativeclass_p.h | 1 + 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/src/script/api/qscriptvalue.cpp b/src/script/api/qscriptvalue.cpp index 286230f..b9be285 100644 --- a/src/script/api/qscriptvalue.cpp +++ b/src/script/api/qscriptvalue.cpp @@ -54,6 +54,7 @@ #include "bridge/qscriptvariant_p.h" #include "bridge/qscriptqobject_p.h" #include "bridge/qscriptdeclarativeclass_p.h" +#include "bridge/qscriptdeclarativeobject_p.h" /*! \since 4.3 @@ -1570,9 +1571,10 @@ QObject *QScriptValue::toQObject() const Q_D(const QScriptValue); if (isQObject()) { QScriptObject *object = static_cast(JSC::asObject(d->jscValue)); - return static_cast(object->delegate())->value(); - } else if (QScriptDeclarativeClass *dc = QScriptDeclarativeClass::scriptClass(*this)) { - return dc->toQObject(QScriptDeclarativeClass::object(*this)); + QScriptObjectDelegate *delegate = object->delegate(); + if (delegate->type() == QScriptObjectDelegate::DeclarativeClassObject) + return static_cast(delegate)->scriptClass()->toQObject(QScriptDeclarativeClass::object(*this)); + return static_cast(delegate)->value(); } else if (isVariant()) { QVariant var = toVariant(); int type = var.userType(); @@ -2245,7 +2247,9 @@ bool QScriptValue::isQObject() const return false; QScriptObject *object = static_cast(JSC::asObject(d->jscValue)); QScriptObjectDelegate *delegate = object->delegate(); - return (delegate && (delegate->type() == QScriptObjectDelegate::QtObject)); + return (delegate && (delegate->type() == QScriptObjectDelegate::QtObject || + (delegate->type() == QScriptObjectDelegate::DeclarativeClassObject && + static_cast(delegate)->scriptClass()->isQObject()))); } /*! diff --git a/src/script/bridge/qscriptdeclarativeclass.cpp b/src/script/bridge/qscriptdeclarativeclass.cpp index df00ce9..5e363d2 100644 --- a/src/script/bridge/qscriptdeclarativeclass.cpp +++ b/src/script/bridge/qscriptdeclarativeclass.cpp @@ -319,6 +319,11 @@ QStringList QScriptDeclarativeClass::propertyNames(Object *object) return QStringList(); } +bool QScriptDeclarativeClass::isQObject() const +{ + return false; +} + QObject *QScriptDeclarativeClass::toQObject(Object *, bool *ok) { if (ok) *ok = false; diff --git a/src/script/bridge/qscriptdeclarativeclass_p.h b/src/script/bridge/qscriptdeclarativeclass_p.h index 40e5051..f2557bd 100644 --- a/src/script/bridge/qscriptdeclarativeclass_p.h +++ b/src/script/bridge/qscriptdeclarativeclass_p.h @@ -97,6 +97,7 @@ public: virtual QStringList propertyNames(Object *); + virtual bool isQObject() const; virtual QObject *toQObject(Object *, bool *ok = 0); virtual QVariant toVariant(Object *, bool *ok = 0); -- cgit v0.12 From 8d76de98d93421395306941e59d136f1e7395d15 Mon Sep 17 00:00:00 2001 From: Bill King Date: Mon, 11 Jan 2010 14:15:56 +1000 Subject: (Sqlite2) Fix for QTBUG-6421 Forgot to port the fix over to sqlite2 which seems to also be affected by the setForwardOnly caching bug as well. Task-number: QTBUG-6421 Reviewed-by: Justin McPherson --- src/sql/drivers/sqlite2/qsql_sqlite2.cpp | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/sql/drivers/sqlite2/qsql_sqlite2.cpp b/src/sql/drivers/sqlite2/qsql_sqlite2.cpp index 1c1a411..20cb01b 100644 --- a/src/sql/drivers/sqlite2/qsql_sqlite2.cpp +++ b/src/sql/drivers/sqlite2/qsql_sqlite2.cpp @@ -110,10 +110,11 @@ public: const char *currentTail; sqlite_vm *currentMachine; - uint skippedStatus: 1; // the status of the fetchNext() that's skipped - uint skipRow: 1; // skip the next fetchNext()? - uint utf8: 1; + bool skippedStatus; // the status of the fetchNext() that's skipped + bool skipRow; // skip the next fetchNext()? + bool utf8; QSqlRecord rInf; + QVector firstRow; }; static const uint initial_cache_size = 128; @@ -192,6 +193,8 @@ bool QSQLite2ResultPrivate::fetchNext(QSqlCachedResult::ValueCache &values, int // already fetched Q_ASSERT(!initialFetch); skipRow = false; + for(int i=0;iskippedStatus = d->fetchNext(cache(), 0, true); + d->skippedStatus = d->fetchNext(d->firstRow, 0, true); if (lastError().isValid()) { setSelect(false); setActive(false); -- cgit v0.12 From d8ad9ac86dac9489b553e6416329308ae7d823d0 Mon Sep 17 00:00:00 2001 From: Jani Hautakangas Date: Mon, 11 Jan 2010 11:11:59 +0200 Subject: Fix for QTBUG-6408 QFontEngineS60::QFontEngineS60 called hundreds of times, taking up to 1ms each call. Use S60->ScreenDevice() to get/release fonts instead of create a new screen device each time. Task-number: QTBUG-6408 Reviewed-by: Jason Barron --- src/gui/text/qfontengine_s60.cpp | 36 +++++++----------------------------- src/gui/text/qfontengine_s60_p.h | 3 --- 2 files changed, 7 insertions(+), 32 deletions(-) diff --git a/src/gui/text/qfontengine_s60.cpp b/src/gui/text/qfontengine_s60.cpp index e279ad2..7fad188 100644 --- a/src/gui/text/qfontengine_s60.cpp +++ b/src/gui/text/qfontengine_s60.cpp @@ -45,12 +45,11 @@ #include #include "qimage.h" #include "qt_s60_p.h" -#include "qpixmap_s60_p.h" #include #include -#include -#include +#include +#include QT_BEGIN_NAMESPACE @@ -135,42 +134,21 @@ QFontEngineS60::QFontEngineS60(const QFontDef &request, const QFontEngineS60Exte { QFontEngine::fontDef = request; m_fontSizeInPixels = (request.pixelSize >= 0)? - request.pixelSize:pointsToPixels(request.pointSize); - - QSymbianFbsHeapLock lock(QSymbianFbsHeapLock::Unlock); - - m_textRenderBitmap = q_check_ptr(new CFbsBitmap()); // CBase derived object needs check on new - const TSize bitmapSize(1, 1); // It is just a dummy bitmap that I need to keep the font alive (or maybe not) - qt_symbian_throwIfError(m_textRenderBitmap->Create(bitmapSize, EGray256)); - QT_TRAP_THROWING(m_textRenderBitmapDevice = CFbsBitmapDevice::NewL(m_textRenderBitmap)); - qt_symbian_throwIfError(m_textRenderBitmapDevice->CreateContext(m_textRenderBitmapGc)); - cache_cost = sizeof(QFontEngineS60) + bitmapSize.iHeight * bitmapSize.iWidth * 4; + request.pixelSize:pointsToPixels(request.pointSize); TFontSpec fontSpec(qt_QString2TPtrC(request.family), m_fontSizeInPixels); fontSpec.iFontStyle.SetBitmapType(EAntiAliasedGlyphBitmap); fontSpec.iFontStyle.SetPosture(request.style == QFont::StyleNormal?EPostureUpright:EPostureItalic); fontSpec.iFontStyle.SetStrokeWeight(request.weight > QFont::Normal?EStrokeWeightBold:EStrokeWeightNormal); - const TInt errorCode = m_textRenderBitmapDevice->GetNearestFontInPixels(m_font, fontSpec); + const TInt errorCode = S60->screenDevice()->GetNearestFontToDesignHeightInPixels(m_font, fontSpec); Q_ASSERT(errorCode == 0); - m_textRenderBitmapGc->UseFont(m_font); - - lock.relock(); + + cache_cost = sizeof(QFontEngineS60); } QFontEngineS60::~QFontEngineS60() { - QSymbianFbsHeapLock lock(QSymbianFbsHeapLock::Unlock); - - m_textRenderBitmapGc->DiscardFont(); - delete m_textRenderBitmapGc; - m_textRenderBitmapGc = NULL; - m_textRenderBitmapDevice->ReleaseFont(m_font); - delete m_textRenderBitmapDevice; - m_textRenderBitmapDevice = NULL; - delete m_textRenderBitmap; - m_textRenderBitmap = NULL; - - lock.relock(); + S60->screenDevice()->ReleaseFont(m_font); } bool QFontEngineS60::stringToCMap(const QChar *characters, int len, QGlyphLayout *glyphs, int *nglyphs, QTextEngine::ShaperFlags flags) const diff --git a/src/gui/text/qfontengine_s60_p.h b/src/gui/text/qfontengine_s60_p.h index 9e22245..b21f1c8 100644 --- a/src/gui/text/qfontengine_s60_p.h +++ b/src/gui/text/qfontengine_s60_p.h @@ -126,9 +126,6 @@ private: QFixed glyphAdvance(HB_Glyph glyph) const; - CFbsBitmap *m_textRenderBitmap; - CFbsBitmapDevice *m_textRenderBitmapDevice; - CFbsBitGc *m_textRenderBitmapGc; CFont* m_font; const QFontEngineS60Extensions *m_extensions; qreal m_fontSizeInPixels; -- cgit v0.12 From 8b42e57fe2946f2cd17f538d0dec2ba6edc06a11 Mon Sep 17 00:00:00 2001 From: Gabriel de Dietrich Date: Mon, 11 Jan 2010 10:44:55 +0100 Subject: QTreeView::selectAll() wouldn't work when first column hidden QTreeView::selectAll() called QTreeView::select() on the first column, first and last rows, and rows selection flags. As the first row was hidden, this range spanned to void. We now pass the upper-left and lower-right indices to select(). Auto-test included. Reviewed-by: Olivier Task-number: QTBUG-6450 --- src/gui/itemviews/qtreeview.cpp | 7 +++++-- tests/auto/qtreeview/tst_qtreeview.cpp | 22 ++++++++++++++++++++++ 2 files changed, 27 insertions(+), 2 deletions(-) diff --git a/src/gui/itemviews/qtreeview.cpp b/src/gui/itemviews/qtreeview.cpp index bf88a75..f25d648 100644 --- a/src/gui/itemviews/qtreeview.cpp +++ b/src/gui/itemviews/qtreeview.cpp @@ -2644,10 +2644,13 @@ void QTreeView::selectAll() return; SelectionMode mode = d->selectionMode; d->executePostedLayout(); //make sure we lay out the items - if (mode != SingleSelection && !d->viewItems.isEmpty()) - d->select(d->viewItems.first().index, d->viewItems.last().index, + if (mode != SingleSelection && !d->viewItems.isEmpty()) { + const QModelIndex &idx = d->viewItems.last().index; + QModelIndex lastItemIndex = idx.sibling(idx.row(), d->model->columnCount(idx.parent()) - 1); + d->select(d->viewItems.first().index, lastItemIndex, QItemSelectionModel::ClearAndSelect |QItemSelectionModel::Rows); + } } /*! diff --git a/tests/auto/qtreeview/tst_qtreeview.cpp b/tests/auto/qtreeview/tst_qtreeview.cpp index 4fc6dd3..06bc93e 100644 --- a/tests/auto/qtreeview/tst_qtreeview.cpp +++ b/tests/auto/qtreeview/tst_qtreeview.cpp @@ -236,6 +236,7 @@ private slots: void task248022_changeSelection(); void task245654_changeModelAndExpandAll(); void doubleClickedWithSpans(); + void taskQTBUG_6450_selectAllWith1stColumnHidden(); }; class QtTestModel: public QAbstractItemModel @@ -3678,5 +3679,26 @@ void tst_QTreeView::doubleClickedWithSpans() QTRY_COMPARE(spy.count(), 2); } +void tst_QTreeView::taskQTBUG_6450_selectAllWith1stColumnHidden() +{ + QTreeWidget tree; + tree.setSelectionMode(QAbstractItemView::MultiSelection); + tree.setColumnCount(2); + QList items; + const int nrRows = 10; + for (int i = 0; i < nrRows; ++i) { + items.append(new QTreeWidgetItem((QTreeWidget*)0, QStringList(QString("item: %1").arg(i)))); + items.last()->setText(1, QString("is an item")); + } + tree.insertTopLevelItems(0, items); + + tree.hideColumn(0); + tree.selectAll(); + + QVERIFY(tree.selectionModel()->hasSelection()); + for (int i = 0; i < nrRows; ++i) + QVERIFY(tree.selectionModel()->isRowSelected(i, QModelIndex())); +} + QTEST_MAIN(tst_QTreeView) #include "tst_qtreeview.moc" -- cgit v0.12 From dbf9e912180d06dd83cd61dc704af194d7e89013 Mon Sep 17 00:00:00 2001 From: Christian Kamm Date: Mon, 11 Jan 2010 10:41:16 +0100 Subject: Do not set the font size unnecessarily in the simulated s60 style. Reviewed-by: Alessandro Portale --- src/gui/styles/qs60style.cpp | 9 ++++++--- src/gui/styles/qs60style_p.h | 5 +++-- src/gui/styles/qs60style_s60.cpp | 5 ++++- src/gui/styles/qs60style_simulated.cpp | 7 +++++-- 4 files changed, 18 insertions(+), 8 deletions(-) diff --git a/src/gui/styles/qs60style.cpp b/src/gui/styles/qs60style.cpp index bcc993a..5c61949 100644 --- a/src/gui/styles/qs60style.cpp +++ b/src/gui/styles/qs60style.cpp @@ -343,7 +343,8 @@ bool QS60StylePrivate::drawsOwnThemeBackground(const QWidget *widget) } QFont QS60StylePrivate::s60Font( - QS60StyleEnums::FontCategories fontCategory, int pointSize) const + QS60StyleEnums::FontCategories fontCategory, + int pointSize, bool resolveFontSize) const { QFont result; int actualPointSize = pointSize; @@ -356,7 +357,7 @@ QFont QS60StylePrivate::s60Font( Q_ASSERT(actualPointSize > 0); const QPair key(fontCategory, actualPointSize); if (!m_mappedFontsCache.contains(key)) { - result = s60Font_specific(fontCategory, actualPointSize); + result = s60Font_specific(fontCategory, actualPointSize, resolveFontSize); m_mappedFontsCache.insert(key, result); } else { result = m_mappedFontsCache.value(key); @@ -620,8 +621,10 @@ void QS60StylePrivate::setFont(QWidget *widget) const fontCategory = QS60StyleEnums::FC_Title; } if (fontCategory != QS60StyleEnums::FC_Undefined) { + const bool resolveFontSize = widget->testAttribute(Qt::WA_SetFont) + && (widget->font().resolve() & QFont::SizeResolved); const QFont suggestedFont = - s60Font(fontCategory, widget->font().pointSizeF()); + s60Font(fontCategory, widget->font().pointSizeF(), resolveFontSize); widget->setFont(suggestedFont); } } diff --git a/src/gui/styles/qs60style_p.h b/src/gui/styles/qs60style_p.h index 65d7574..bc3c4dc 100644 --- a/src/gui/styles/qs60style_p.h +++ b/src/gui/styles/qs60style_p.h @@ -401,7 +401,7 @@ public: static bool drawsOwnThemeBackground(const QWidget *widget); QFont s60Font(QS60StyleEnums::FontCategories fontCategory, - int pointSize = -1) const; + int pointSize = -1, bool resolveFontSize = true) const; // clears all style caches (fonts, colors, pixmaps) void clearCaches(CacheClearReason reason = CC_UndefinedChange); @@ -484,7 +484,8 @@ private: static QPixmap part(QS60StyleEnums::SkinParts part, const QSize &size, QPainter *painter, SkinElementFlags flags = KDefaultSkinElementFlags); - static QFont s60Font_specific(QS60StyleEnums::FontCategories fontCategory, int pointSize); + static QFont s60Font_specific(QS60StyleEnums::FontCategories fontCategory, + int pointSize, bool resolveFontSize); static QSize screenSize(); diff --git a/src/gui/styles/qs60style_s60.cpp b/src/gui/styles/qs60style_s60.cpp index fb9665a..3f90415 100644 --- a/src/gui/styles/qs60style_s60.cpp +++ b/src/gui/styles/qs60style_s60.cpp @@ -909,8 +909,11 @@ TAknsItemID QS60StyleModeSpecifics::partSpecificThemeId(int part) } QFont QS60StylePrivate::s60Font_specific( - QS60StyleEnums::FontCategories fontCategory, int pointSize) + QS60StyleEnums::FontCategories fontCategory, + int pointSize, bool resolveFontSize) { + Q_UNUSED(resolveFontSize); + TAknFontCategory aknFontCategory = EAknFontCategoryUndefined; switch (fontCategory) { case QS60StyleEnums::FC_Primary: diff --git a/src/gui/styles/qs60style_simulated.cpp b/src/gui/styles/qs60style_simulated.cpp index e49854f..e47abbf 100644 --- a/src/gui/styles/qs60style_simulated.cpp +++ b/src/gui/styles/qs60style_simulated.cpp @@ -342,10 +342,13 @@ bool QS60StylePrivate::hasSliderGrooveGraphic() return false; } -QFont QS60StylePrivate::s60Font_specific(QS60StyleEnums::FontCategories fontCategory, int pointSize) +QFont QS60StylePrivate::s60Font_specific( + QS60StyleEnums::FontCategories fontCategory, + int pointSize, bool resolveFontSize) { QFont result; - result.setPointSize(pointSize); + if (resolveFontSize) + result.setPointSize(pointSize); switch (fontCategory) { case QS60StyleEnums::FC_Primary: result.setBold(true); -- cgit v0.12 From 45fedfeb405807453e94958808c2f1d48bb846ca Mon Sep 17 00:00:00 2001 From: Tom Cooksey Date: Fri, 8 Jan 2010 15:51:59 +0100 Subject: Track the glVertexAttribPointer and only update it if it's changed This removes a lot of unnecessary GL state changes resulting in an 18% performance boost on desktop and 5% on SGX for the 25920 3x3 solid rectangle test case. Reviewed-By: Samuel --- .../gl2paintengineex/qpaintengineex_opengl2.cpp | 48 +++++++++------------- .../gl2paintengineex/qpaintengineex_opengl2_p.h | 20 +++++++++ .../gl2paintengineex/qtextureglyphcache_gl.cpp | 27 +++++++++--- 3 files changed, 61 insertions(+), 34 deletions(-) diff --git a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp index ff096c2..f8f0347 100644 --- a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp +++ b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp @@ -580,19 +580,19 @@ void QGL2PaintEngineExPrivate::transferMode(EngineMode newMode) } if (newMode == TextDrawingMode) { - glVertexAttribPointer(QT_VERTEX_COORDS_ATTR, 2, GL_FLOAT, GL_FALSE, 0, vertexCoordinateArray.data()); - glVertexAttribPointer(QT_TEXTURE_COORDS_ATTR, 2, GL_FLOAT, GL_FALSE, 0, textureCoordinateArray.data()); + setVertexAttributePointer(QT_VERTEX_COORDS_ATTR, (GLfloat*)vertexCoordinateArray.data()); + setVertexAttributePointer(QT_TEXTURE_COORDS_ATTR, (GLfloat*)textureCoordinateArray.data()); } if (newMode == ImageDrawingMode) { - glVertexAttribPointer(QT_VERTEX_COORDS_ATTR, 2, GL_FLOAT, GL_FALSE, 0, staticVertexCoordinateArray); - glVertexAttribPointer(QT_TEXTURE_COORDS_ATTR, 2, GL_FLOAT, GL_FALSE, 0, staticTextureCoordinateArray); + setVertexAttributePointer(QT_VERTEX_COORDS_ATTR, staticVertexCoordinateArray); + setVertexAttributePointer(QT_TEXTURE_COORDS_ATTR, staticTextureCoordinateArray); } if (newMode == ImageArrayDrawingMode) { - glVertexAttribPointer(QT_VERTEX_COORDS_ATTR, 2, GL_FLOAT, GL_FALSE, 0, vertexCoordinateArray.data()); - glVertexAttribPointer(QT_TEXTURE_COORDS_ATTR, 2, GL_FLOAT, GL_FALSE, 0, textureCoordinateArray.data()); - glVertexAttribPointer(QT_OPACITY_ATTR, 1, GL_FLOAT, GL_FALSE, 0, opacityArray.data()); + setVertexAttributePointer(QT_VERTEX_COORDS_ATTR, (GLfloat*)vertexCoordinateArray.data()); + setVertexAttributePointer(QT_TEXTURE_COORDS_ATTR, (GLfloat*)textureCoordinateArray.data()); + setVertexAttributePointer(QT_OPACITY_ATTR, (GLfloat*)opacityArray.data()); } // This needs to change when we implement high-quality anti-aliasing... @@ -707,9 +707,9 @@ void QGL2PaintEngineExPrivate::fill(const QVectorPath& path) prepareForDraw(currentBrush.isOpaque()); #ifdef QT_OPENGL_CACHE_AS_VBOS glBindBuffer(GL_ARRAY_BUFFER, cache->vbo); - glVertexAttribPointer(QT_VERTEX_COORDS_ATTR, 2, GL_FLOAT, false, 0, 0); + setVertexAttributePointer(QT_VERTEX_COORDS_ATTR, 0); #else - glVertexAttribPointer(QT_VERTEX_COORDS_ATTR, 2, GL_FLOAT, false, 0, cache->vertices); + setVertexAttributePointer(QT_VERTEX_COORDS_ATTR, cache->vertices); #endif glDrawArrays(cache->primitiveType, 0, cache->vertexCount); @@ -829,7 +829,7 @@ void QGL2PaintEngineExPrivate::fillStencilWithVertexArray(const float *data, glStencilMask(GL_STENCIL_HIGH_BIT); #if 0 glStencilOp(GL_KEEP, GL_KEEP, GL_INVERT); // Simply invert the stencil bit - glVertexAttribPointer(QT_VERTEX_COORDS_ATTR, 2, GL_FLOAT, GL_FALSE, 0, data); + setVertexAttributePointer(QT_VERTEX_COORDS_ATTR, data); glDrawArrays(GL_TRIANGLE_STRIP, 0, count); #else @@ -840,7 +840,7 @@ void QGL2PaintEngineExPrivate::fillStencilWithVertexArray(const float *data, } else { glStencilFunc(GL_ALWAYS, GL_STENCIL_HIGH_BIT, 0xff); } - glVertexAttribPointer(QT_VERTEX_COORDS_ATTR, 2, GL_FLOAT, GL_FALSE, 0, data); + setVertexAttributePointer(QT_VERTEX_COORDS_ATTR, data); glDrawArrays(GL_TRIANGLE_STRIP, 0, count); #endif } @@ -954,15 +954,8 @@ bool QGL2PaintEngineExPrivate::prepareForDraw(bool srcPixelsAreOpaque) void QGL2PaintEngineExPrivate::composite(const QGLRect& boundingRect) { - // Setup a vertex array for the bounding rect: - GLfloat rectVerts[] = { - boundingRect.left, boundingRect.top, - boundingRect.left, boundingRect.bottom, - boundingRect.right, boundingRect.bottom, - boundingRect.right, boundingRect.top - }; - - glVertexAttribPointer(QT_VERTEX_COORDS_ATTR, 2, GL_FLOAT, GL_FALSE, 0, rectVerts); + setCoords(staticVertexCoordinateArray, boundingRect); + setVertexAttributePointer(QT_VERTEX_COORDS_ATTR, staticVertexCoordinateArray); glDrawArrays(GL_TRIANGLE_FAN, 0, 4); } @@ -971,7 +964,7 @@ void QGL2PaintEngineExPrivate::drawVertexArrays(const float *data, int *stops, i GLenum primitive) { // Now setup the pointer to the vertex array: - glVertexAttribPointer(QT_VERTEX_COORDS_ATTR, 2, GL_FLOAT, GL_FALSE, 0, data); + setVertexAttributePointer(QT_VERTEX_COORDS_ATTR, (GLfloat*)data); int previousStop = 0; for (int i=0; iwidth(); GLfloat dy = 1.0 / cache->height(); - QGLPoint *oldVertexCoordinateDataPtr = vertexCoordinateArray.data(); - QGLPoint *oldTextureCoordinateDataPtr = textureCoordinateArray.data(); - vertexCoordinateArray.clear(); textureCoordinateArray.clear(); @@ -1306,10 +1296,8 @@ void QGL2PaintEngineExPrivate::drawCachedGlyphs(const QPointF &p, QFontEngineGly textureCoordinateArray.addRect(QRectF(c.x*dx, c.y*dy, c.w * dx, c.h * dy)); } - if (vertexCoordinateArray.data() != oldVertexCoordinateDataPtr) - glVertexAttribPointer(QT_VERTEX_COORDS_ATTR, 2, GL_FLOAT, GL_FALSE, 0, vertexCoordinateArray.data()); - if (textureCoordinateArray.data() != oldTextureCoordinateDataPtr) - glVertexAttribPointer(QT_TEXTURE_COORDS_ATTR, 2, GL_FLOAT, GL_FALSE, 0, textureCoordinateArray.data()); + setVertexAttributePointer(QT_VERTEX_COORDS_ATTR, (GLfloat*)vertexCoordinateArray.data()); + setVertexAttributePointer(QT_TEXTURE_COORDS_ATTR, (GLfloat*)textureCoordinateArray.data()); if (addOffset) { addOffset = false; @@ -1641,6 +1629,8 @@ void QGL2PaintEngineEx::ensureActive() d->shaderManager->setDirty(); d->ctx->d_func()->syncGlState(); setState(state()); + for (int i = 0; i < 3; ++i) + d->vertexAttribPointers[i] = (GLfloat*)-1; // Assume the pointers are clobbered } } diff --git a/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h b/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h index eaae187..f745196 100644 --- a/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h +++ b/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h @@ -196,6 +196,9 @@ public: void drawPixmaps(const QDrawPixmaps::Data *drawingData, int dataCount, const QPixmap &pixmap, QDrawPixmaps::DrawingHints hints); void drawCachedGlyphs(const QPointF &p, QFontEngineGlyphCache::Type glyphType, const QTextItemInt &ti); + // Calls glVertexAttributePointer if the pointer has changed + inline void setVertexAttributePointer(unsigned int arrayIndex, const GLfloat *pointer); + // draws whatever is in the vertex array: void drawVertexArrays(const float *data, int *stops, int stopCount, GLenum primitive); void drawVertexArrays(QGL2PEXVertexArray &vertexArray, GLenum primitive) { @@ -230,6 +233,7 @@ public: void regenerateClip(); void systemStateChanged(); + static QGLEngineShaderManager* shaderManagerForEngine(QGL2PaintEngineEx *engine) { return engine->d_func()->shaderManager; } static QGL2PaintEngineExPrivate *getData(QGL2PaintEngineEx *engine) { return engine->d_func(); } static void cleanupVectorPath(QPaintEngineEx *engine, void *data); @@ -291,8 +295,24 @@ public: QSet pathCaches; QVector unusedVBOSToClean; + + const GLfloat *vertexAttribPointers[3]; }; + +void QGL2PaintEngineExPrivate::setVertexAttributePointer(unsigned int arrayIndex, const GLfloat *pointer) +{ + Q_ASSERT(arrayIndex < 3); + if (pointer == vertexAttribPointers[arrayIndex]) + return; + + vertexAttribPointers[arrayIndex] = pointer; + if (arrayIndex == QT_OPACITY_ATTR) + glVertexAttribPointer(arrayIndex, 1, GL_FLOAT, GL_FALSE, 0, pointer); + else + glVertexAttribPointer(arrayIndex, 2, GL_FLOAT, GL_FALSE, 0, pointer); +} + QT_END_NAMESPACE #endif diff --git a/src/opengl/gl2paintengineex/qtextureglyphcache_gl.cpp b/src/opengl/gl2paintengineex/qtextureglyphcache_gl.cpp index 047876f..4034448 100644 --- a/src/opengl/gl2paintengineex/qtextureglyphcache_gl.cpp +++ b/src/opengl/gl2paintengineex/qtextureglyphcache_gl.cpp @@ -127,11 +127,28 @@ void QGLTextureGlyphCache::resizeTextureData(int width, int height) glViewport(0, 0, oldWidth, oldHeight); - float vertexCoordinateArray[] = { -1, -1, 1, -1, 1, 1, -1, 1 }; - float textureCoordinateArray[] = { 0, 0, 1, 0, 1, 1, 0, 1 }; - - glVertexAttribPointer(QT_VERTEX_COORDS_ATTR, 2, GL_FLOAT, GL_FALSE, 0, vertexCoordinateArray); - glVertexAttribPointer(QT_TEXTURE_COORDS_ATTR, 2, GL_FLOAT, GL_FALSE, 0, textureCoordinateArray); + GLfloat* vertexCoordinateArray = pex->staticVertexCoordinateArray; + vertexCoordinateArray[0] = -1.0f; + vertexCoordinateArray[1] = -1.0f; + vertexCoordinateArray[2] = 1.0f; + vertexCoordinateArray[3] = -1.0f; + vertexCoordinateArray[4] = 1.0f; + vertexCoordinateArray[5] = 1.0f; + vertexCoordinateArray[6] = -1.0f; + vertexCoordinateArray[7] = 1.0f; + + GLfloat* textureCoordinateArray = pex->staticTextureCoordinateArray; + textureCoordinateArray[0] = 0.0f; + textureCoordinateArray[1] = 0.0f; + textureCoordinateArray[2] = 1.0f; + textureCoordinateArray[3] = 0.0f; + textureCoordinateArray[4] = 1.0f; + textureCoordinateArray[5] = 1.0f; + textureCoordinateArray[6] = 0.0f; + textureCoordinateArray[7] = 1.0f; + + pex->setVertexAttributePointer(QT_VERTEX_COORDS_ATTR, vertexCoordinateArray); + pex->setVertexAttributePointer(QT_TEXTURE_COORDS_ATTR, textureCoordinateArray); pex->shaderManager->useBlitProgram(); pex->shaderManager->blitProgram()->setUniformValue("imageTexture", QT_IMAGE_TEXTURE_UNIT); -- cgit v0.12 From 820db2b2c5a0fc470fa5759d95ea49305ec98654 Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Mon, 11 Jan 2010 11:39:19 +0100 Subject: Fix incorrect drawing of the hovered row on QTreeView with some styles. Some styles such as oxygen, or gtk, require the whole row to be redrawn in case of mouse hover the items. There was special code that handle that in the MouseMove event of the QTreeView, but that did not covered all the case (such as scrolling with the mouse wheel) Reviewed-by: Gabriel --- src/gui/itemviews/qabstractitemview.cpp | 11 +++++++++-- src/gui/itemviews/qtreeview.cpp | 9 --------- 2 files changed, 9 insertions(+), 11 deletions(-) diff --git a/src/gui/itemviews/qabstractitemview.cpp b/src/gui/itemviews/qabstractitemview.cpp index f447989..f852e67 100644 --- a/src/gui/itemviews/qabstractitemview.cpp +++ b/src/gui/itemviews/qabstractitemview.cpp @@ -146,9 +146,16 @@ void QAbstractItemViewPrivate::setHoverIndex(const QPersistentModelIndex &index) if (hover == index) return; - q->update(hover); //update the old one + if (selectionBehavior != QAbstractItemView::SelectRows) { + q->update(hover); //update the old one + q->update(index); //update the new one + } else { + QRect oldHoverRect = q->visualRect(hover); + QRect newHoverRect = q->visualRect(index); + viewport->update(QRect(0, newHoverRect.y(), viewport->width(), newHoverRect.height())); + viewport->update(QRect(0, oldHoverRect.y(), viewport->width(), oldHoverRect.height())); + } hover = index; - q->update(hover); //update the new one } void QAbstractItemViewPrivate::checkMouseMove(const QPersistentModelIndex &index) diff --git a/src/gui/itemviews/qtreeview.cpp b/src/gui/itemviews/qtreeview.cpp index f25d648..24b448c 100644 --- a/src/gui/itemviews/qtreeview.cpp +++ b/src/gui/itemviews/qtreeview.cpp @@ -1241,15 +1241,6 @@ bool QTreeView::viewportEvent(QEvent *event) viewport()->update(newRect); } } - if (selectionBehavior() == QAbstractItemView::SelectRows) { - QModelIndex newHoverIndex = indexAt(he->pos()); - if (d->hover != newHoverIndex) { - QRect oldHoverRect = visualRect(d->hover); - QRect newHoverRect = visualRect(newHoverIndex); - viewport()->update(QRect(0, newHoverRect.y(), viewport()->width(), newHoverRect.height())); - viewport()->update(QRect(0, oldHoverRect.y(), viewport()->width(), oldHoverRect.height())); - } - } break; } default: break; -- cgit v0.12 From af7a0cbe4d6dcbae5d16e91d488df5a5dc8919c2 Mon Sep 17 00:00:00 2001 From: Gareth Stockwell Date: Tue, 8 Dec 2009 14:39:51 +0000 Subject: Shortened description of audio equalizer bands This improves the small-screen layout of the equalizer configuration dialog. Task-number: QTBUG-4659 Reviewed-by: trustme --- src/3rdparty/phonon/mmf/audioequalizer.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/3rdparty/phonon/mmf/audioequalizer.cpp b/src/3rdparty/phonon/mmf/audioequalizer.cpp index 5aa659a..37ba328 100644 --- a/src/3rdparty/phonon/mmf/audioequalizer.cpp +++ b/src/3rdparty/phonon/mmf/audioequalizer.cpp @@ -96,7 +96,7 @@ void AudioEqualizer::getParameters(NativeEffect *effect, const qint32 defVol = effect->BandLevel(i); parameters.append(EffectParameter(i, - tr("Frequency band, %1 Hz").arg(hz), + tr("%1 Hz").arg(hz), EffectParameter::LogarithmicHint, QVariant(qint32(defVol)), QVariant(qint32(dbMin)), -- cgit v0.12 From a56a9b9d84c40de55255fc58be1ae80cdfaa0c35 Mon Sep 17 00:00:00 2001 From: Peter Hartmann Date: Mon, 11 Jan 2010 14:34:13 +0100 Subject: network internals: fix build on S60 Reviewed-by: Paul --- src/network/access/qnetworkaccesshttpbackend.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/network/access/qnetworkaccesshttpbackend.cpp b/src/network/access/qnetworkaccesshttpbackend.cpp index ada00df..dacb2bb 100644 --- a/src/network/access/qnetworkaccesshttpbackend.cpp +++ b/src/network/access/qnetworkaccesshttpbackend.cpp @@ -596,7 +596,7 @@ void QNetworkAccessHttpBackend::open() // unsuitable proxies QMetaObject::invokeMethod(this, "error", Qt::QueuedConnection, Q_ARG(QNetworkReply::NetworkError, QNetworkReply::ProxyNotFoundError), - Q_ARG(QString, QCoreApplication::translate("QNetworkAccessHttpBackend", "No suitable proxy found"))); + Q_ARG(QString, tr("No suitable proxy found"))); QMetaObject::invokeMethod(this, "finished", Qt::QueuedConnection); return; } -- cgit v0.12 From 7bd7dabe915df8833601a48de3fee6ad7fac82e9 Mon Sep 17 00:00:00 2001 From: Markus Goetz Date: Mon, 11 Jan 2010 13:54:35 +0100 Subject: QNAM HTTP: Check if socket already tries to connect. This should get rid of QAbstractSocket warnings we sometimes emit. Reviewed-by: Thiago Reviewed-by: Peter Hartmann --- src/network/access/qhttpnetworkconnectionchannel.cpp | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/src/network/access/qhttpnetworkconnectionchannel.cpp b/src/network/access/qhttpnetworkconnectionchannel.cpp index 7cf632f..b612d26 100644 --- a/src/network/access/qhttpnetworkconnectionchannel.cpp +++ b/src/network/access/qhttpnetworkconnectionchannel.cpp @@ -419,15 +419,22 @@ void QHttpNetworkConnectionChannel::_q_receiveReply() bool QHttpNetworkConnectionChannel::ensureConnection() { + // resend this request after we receive the disconnected signal + if (socket->state() == QAbstractSocket::ClosingState) { + resendCurrent = true; + return false; + } + + // already trying to connect? + if (socket->state() == QAbstractSocket::HostLookupState || + socket->state() == QAbstractSocket::ConnectingState) { + return false; + } + // make sure that this socket is in a connected state, if not initiate // connection to the host. if (socket->state() != QAbstractSocket::ConnectedState) { // connect to the host if not already connected. - // resend this request after we receive the disconnected signal - if (socket->state() == QAbstractSocket::ClosingState) { - resendCurrent = true; - return false; - } state = QHttpNetworkConnectionChannel::ConnectingState; pendingEncrypt = connection->d_func()->encrypt; -- cgit v0.12 From e2a94baeed03edbaeea9b4658f2a820520e1363f Mon Sep 17 00:00:00 2001 From: Markus Goetz Date: Mon, 11 Jan 2010 14:10:04 +0100 Subject: QNAM HTTP: Optimize eatWhitespace() Avoid calling socket->bytesAvailable(). Reviewed-by: Thiago --- src/network/access/qhttpnetworkconnectionchannel.cpp | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/network/access/qhttpnetworkconnectionchannel.cpp b/src/network/access/qhttpnetworkconnectionchannel.cpp index b612d26..53c2596 100644 --- a/src/network/access/qhttpnetworkconnectionchannel.cpp +++ b/src/network/access/qhttpnetworkconnectionchannel.cpp @@ -625,10 +625,17 @@ void QHttpNetworkConnectionChannel::requeueCurrentlyPipelinedRequests() void QHttpNetworkConnectionChannel::eatWhitespace() { char c; - while (socket->bytesAvailable()) { - if (socket->peek(&c, 1) != 1) + do { + qint64 ret = socket->peek(&c, 1); + + // nothing read, fine. + if (ret == 0) return; + // EOF from socket? + if (ret == -1) + return; // FIXME, we need to stop processing. however the next stuff done will also do that. + // read all whitespace and line endings if (c == 11 || c == '\n' || c == '\r' || c == ' ' || c == 31) { socket->read(&c, 1); @@ -636,7 +643,7 @@ void QHttpNetworkConnectionChannel::eatWhitespace() } else { break; } - } + } while(true); } void QHttpNetworkConnectionChannel::handleStatus() -- cgit v0.12 From a34d372b45d75a32dcc300dbb7f8151e15df4294 Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Mon, 11 Jan 2010 14:49:39 +0100 Subject: Fixes warning in the QMacStyle Warning such as QFont::setPointSizeF: Point size <= 0 (-1.000000), must be greater than 0 because the font size might be specified in pixel, and pointSizeF returns -1 if the font size is in pixel (as documented) Reviewed-by: jbache Task-number: QTBUG-7263 --- src/gui/styles/qcleanlooksstyle.cpp | 2 +- src/gui/styles/qmacstyle_mac.mm | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gui/styles/qcleanlooksstyle.cpp b/src/gui/styles/qcleanlooksstyle.cpp index b08847d..78beb5b 100644 --- a/src/gui/styles/qcleanlooksstyle.cpp +++ b/src/gui/styles/qcleanlooksstyle.cpp @@ -2069,7 +2069,7 @@ void QCleanlooksStyle::drawControl(ControlElement element, const QStyleOption *o // This is mainly to handle cases where someone sets the font on the window // and then the combo inherits it and passes it onward. At that point the resolve mask // is very, very weak. This makes it stonger. - font.setPointSizeF(menuItem->font.pointSizeF()); + font.setPointSizeF(QFontInfo(menuItem->font).pointSizeF()); if (menuitem->menuItemType == QStyleOptionMenuItem::DefaultItem) font.setBold(true); diff --git a/src/gui/styles/qmacstyle_mac.mm b/src/gui/styles/qmacstyle_mac.mm index 4075cf7..25e3028 100644 --- a/src/gui/styles/qmacstyle_mac.mm +++ b/src/gui/styles/qmacstyle_mac.mm @@ -3996,7 +3996,7 @@ void QMacStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPainter // This is mainly to handle cases where someone sets the font on the window // and then the combo inherits it and passes it onward. At that point the resolve mask // is very, very weak. This makes it stonger. - myFont.setPointSizeF(mi->font.pointSizeF()); + myFont.setPointSizeF(QFontInfo(mi->font).pointSizeF()); p->setFont(myFont); p->drawText(xpos, yPos, contentRect.width() - xm - tabwidth + 1, contentRect.height(), text_flags ^ Qt::AlignRight, s); -- cgit v0.12 From eb84acd899aee992f5631ee0b9c0d992c8fbbd5a Mon Sep 17 00:00:00 2001 From: Kim Motoyoshi Kalland Date: Mon, 11 Jan 2010 15:05:20 +0100 Subject: Fixed subpixel antialiased text drawing with the GL2 engine. Fixed bug where drawing subpixel antialiased glyphs on a translucent surface would cause all the pixels in the glyphs' bounding box to become opaque. Task-number: QTBUG-7190 Reviewed-by: Trond --- src/opengl/gl2paintengineex/qtextureglyphcache_gl.cpp | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/src/opengl/gl2paintengineex/qtextureglyphcache_gl.cpp b/src/opengl/gl2paintengineex/qtextureglyphcache_gl.cpp index 4034448..0720170 100644 --- a/src/opengl/gl2paintengineex/qtextureglyphcache_gl.cpp +++ b/src/opengl/gl2paintengineex/qtextureglyphcache_gl.cpp @@ -81,7 +81,7 @@ void QGLTextureGlyphCache::createTextureData(int width, int height) data[i] = 0; if (m_type == QFontEngineGlyphCache::Raster_RGBMask) - glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, width, height, 0, GL_ALPHA, GL_UNSIGNED_BYTE, &data[0]); + glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, width, height, 0, GL_ALPHA, GL_UNSIGNED_BYTE, &data[0]); else glTexImage2D(GL_TEXTURE_2D, 0, GL_ALPHA, width, height, 0, GL_ALPHA, GL_UNSIGNED_BYTE, &data[0]); @@ -196,8 +196,20 @@ void QGLTextureGlyphCache::fillTexture(const Coord &c, glyph_t glyph) for (int x = 0; x < maskWidth; ++x) src[x] = -src[x]; // convert 0 and 1 into 0 and 255 } - } - + } else if (mask.format() == QImage::Format_RGB32) { + // Make the alpha component equal to the average of the RGB values. + // This is needed when drawing sub-pixel antialiased text on translucent targets. + for (int y = 0; y < maskHeight; ++y) { + quint32 *src = (quint32 *) mask.scanLine(y); + for (int x = 0; x < maskWidth; ++x) { + uchar r = src[x] >> 16; + uchar g = src[x] >> 8; + uchar b = src[x]; + quint32 avg = (quint32(r) + quint32(g) + quint32(b) + 1) / 3; // "+1" for rounding. + src[x] = (src[x] & 0x00ffffff) | (avg << 24); + } + } + } glBindTexture(GL_TEXTURE_2D, m_texture); if (mask.format() == QImage::Format_RGB32) { -- cgit v0.12 From dfcc48e9201dd64cce696248a9938d541a1a8cad Mon Sep 17 00:00:00 2001 From: Thomas Zander Date: Mon, 11 Jan 2010 15:13:58 +0100 Subject: Add odf-writer benchmark. --- tests/benchmarks/qtext/main.cpp | 79 +++++++++++++++++++++++++++++++++++++++-- 1 file changed, 77 insertions(+), 2 deletions(-) diff --git a/tests/benchmarks/qtext/main.cpp b/tests/benchmarks/qtext/main.cpp index 3c973b6..4bd2bee 100644 --- a/tests/benchmarks/qtext/main.cpp +++ b/tests/benchmarks/qtext/main.cpp @@ -41,19 +41,36 @@ #include #include +#include #include +#include #include +#include #include +Q_DECLARE_METATYPE(QTextDocument*) + class tst_QText: public QObject { Q_OBJECT +public: + tst_QText() { + m_lorem = QString::fromLatin1("Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi."); + } + private slots: void loadHtml_data(); void loadHtml(); void shaping_data(); void shaping(); + + void odfWriting_empty(); + void odfWriting_text(); + void odfWriting_images(); + +private: + QString m_lorem; }; void tst_QText::loadHtml_data() @@ -63,7 +80,7 @@ void tst_QText::loadHtml_data() QTest::newRow("simple") << QString::fromLatin1("Foo"); QTest::newRow("simple2") << QString::fromLatin1("Foo"); - QString parag = QString::fromLatin1("

Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi.

"); + QString parag = QString::fromLatin1("

%1

").arg(m_lorem); QString header = QString::fromLatin1("test"); QTest::newRow("long") << QString::fromLatin1("test") + parag + parag + parag + parag + parag + parag + parag + parag + parag + parag + parag + parag + parag + parag + parag + parag + parag @@ -87,7 +104,7 @@ void tst_QText::shaping_data() { QTest::addColumn("parag"); QTest::newRow("empty") << QString(); - QTest::newRow("lorem") << QString::fromLatin1("Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi."); + QTest::newRow("lorem") << m_lorem; QTest::newRow("short") << QString::fromLatin1("Lorem ipsum dolor sit amet"); QFile file(QString::fromLatin1(SRCDIR) + QLatin1String("/bidi.txt")); @@ -120,6 +137,64 @@ void tst_QText::shaping() } } +void tst_QText::odfWriting_empty() +{ + QVERIFY(QTextDocumentWriter::supportedDocumentFormats().contains("ODF")); // odf compiled in + QTextDocument *doc = new QTextDocument(); + // write it + QBENCHMARK { + QBuffer buffer; + buffer.open(QIODevice::WriteOnly); + QTextDocumentWriter writer(&buffer, "ODF"); + writer.write(doc); + } + delete doc; +} + +void tst_QText::odfWriting_text() +{ + QTextDocument *doc = new QTextDocument(); + QTextCursor cursor(doc); + QTextBlockFormat bf; + bf.setIndent(2); + cursor.insertBlock(bf); + cursor.insertText(m_lorem); + bf.setTopMargin(10); + cursor.insertBlock(bf); + cursor.insertText(m_lorem); + bf.setRightMargin(30); + cursor.insertBlock(bf); + cursor.insertText(m_lorem); + + // write it + QBENCHMARK { + QBuffer buffer; + buffer.open(QIODevice::WriteOnly); + QTextDocumentWriter writer(&buffer, "ODF"); + writer.write(doc); + } + delete doc; +} + +void tst_QText::odfWriting_images() +{ + QTextDocument *doc = new QTextDocument(); + QTextCursor cursor(doc); + cursor.insertText(m_lorem); + QImage image(400, 200, QImage::Format_ARGB32_Premultiplied); + cursor.insertImage(image); + cursor.insertText(m_lorem); + + // write it + QBENCHMARK { + QBuffer buffer; + buffer.open(QIODevice::WriteOnly); + QTextDocumentWriter writer(&buffer, "ODF"); + writer.write(doc); + } + delete doc; +} + QTEST_MAIN(tst_QText) #include "main.moc" -- cgit v0.12 From 36dcdcdf5b6869ded0401a879b1397ad9d20b324 Mon Sep 17 00:00:00 2001 From: Markus Goetz Date: Mon, 11 Jan 2010 13:24:15 +0100 Subject: QNAM HTTP: Fix readBuffer maximum size. QHttpNetworkReply has now a throttled mode. If this is activated, it will only read HTTP body when its internal buffer is empty. This means that QNetworkReply.setReadBufferSize() can finally be used for bandwidth limiting. Thanks to David Faure for helping out. Reviewed-By: Peter Hartmann --- src/network/access/qhttpnetworkconnection.cpp | 10 ++ src/network/access/qhttpnetworkconnection_p.h | 3 + .../access/qhttpnetworkconnectionchannel.cpp | 10 ++ src/network/access/qhttpnetworkreply.cpp | 12 +- src/network/access/qhttpnetworkreply_p.h | 2 + src/network/access/qnetworkaccessbackend.cpp | 6 + src/network/access/qnetworkaccessbackend_p.h | 1 + src/network/access/qnetworkaccesshttpbackend.cpp | 6 + src/network/access/qnetworkaccesshttpbackend_p.h | 2 + src/network/access/qnetworkreplyimpl.cpp | 3 + tests/manual/qnetworkreply/main.cpp | 130 +++++++++++++++++++++ tests/manual/qnetworkreply/qnetworkreply.pro | 13 +++ 12 files changed, 197 insertions(+), 1 deletion(-) create mode 100644 tests/manual/qnetworkreply/main.cpp create mode 100644 tests/manual/qnetworkreply/qnetworkreply.pro diff --git a/src/network/access/qhttpnetworkconnection.cpp b/src/network/access/qhttpnetworkconnection.cpp index 2c56524..b7dbeac 100644 --- a/src/network/access/qhttpnetworkconnection.cpp +++ b/src/network/access/qhttpnetworkconnection.cpp @@ -731,6 +731,16 @@ void QHttpNetworkConnectionPrivate::_q_restartAuthPendingRequests() } } +void QHttpNetworkConnectionPrivate::readMoreLater(QHttpNetworkReply *reply) +{ + for (int i = 0 ; i < channelCount; ++i) { + if (channels[i].reply == reply) { + // emulate a readyRead() from the socket + QMetaObject::invokeMethod(&channels[i], "_q_readyRead", Qt::QueuedConnection); + return; + } + } +} QHttpNetworkConnection::QHttpNetworkConnection(const QString &hostName, quint16 port, bool encrypt, QObject *parent) : QObject(*(new QHttpNetworkConnectionPrivate(hostName, port, encrypt)), parent) diff --git a/src/network/access/qhttpnetworkconnection_p.h b/src/network/access/qhttpnetworkconnection_p.h index 00eb1ef..76da883 100644 --- a/src/network/access/qhttpnetworkconnection_p.h +++ b/src/network/access/qhttpnetworkconnection_p.h @@ -174,6 +174,9 @@ public: void fillPipeline(QAbstractSocket *socket); bool fillPipeline(QList &queue, QHttpNetworkConnectionChannel &channel); + // read more HTTP body after the next event loop spin + void readMoreLater(QHttpNetworkReply *reply); + void copyCredentials(int fromChannel, QAuthenticator *auth, bool isProxy); // private slots diff --git a/src/network/access/qhttpnetworkconnectionchannel.cpp b/src/network/access/qhttpnetworkconnectionchannel.cpp index 53c2596..b1b0304 100644 --- a/src/network/access/qhttpnetworkconnectionchannel.cpp +++ b/src/network/access/qhttpnetworkconnectionchannel.cpp @@ -350,6 +350,16 @@ void QHttpNetworkConnectionChannel::_q_receiveReply() } break; case QHttpNetworkReplyPrivate::ReadingDataState: { + if (reply->d_func()->downstreamLimited && !reply->d_func()->responseData.isEmpty() && reply->d_func()->shouldEmitSignals()) { + // We already have some HTTP body data. We don't read more from the socket until + // this is fetched by QHttpNetworkAccessHttpBackend. If we would read more, + // we could not limit our read buffer usage. + // We only do this when shouldEmitSignals==true because our HTTP parsing + // always needs to parse the 401/407 replies. Therefore they don't really obey + // to the read buffer maximum size, but we don't care since they should be small. + return; + } + if (!reply->d_func()->isChunked() && !reply->d_func()->autoDecompress && reply->d_func()->bodyLength > 0) { // bulk files like images should fulfill these properties and diff --git a/src/network/access/qhttpnetworkreply.cpp b/src/network/access/qhttpnetworkreply.cpp index 7025f1d..a5223d1 100644 --- a/src/network/access/qhttpnetworkreply.cpp +++ b/src/network/access/qhttpnetworkreply.cpp @@ -179,9 +179,19 @@ qint64 QHttpNetworkReply::bytesAvailableNextBlock() const QByteArray QHttpNetworkReply::readAny() { Q_D(QHttpNetworkReply); + // we'll take the last buffer, so schedule another read from http + if (d->downstreamLimited && d->responseData.bufferCount() == 1) + d->connection->d_func()->readMoreLater(this); return d->responseData.read(); } +void QHttpNetworkReply::setDownstreamLimited(bool dsl) +{ + Q_D(QHttpNetworkReply); + d->downstreamLimited = dsl; + d->connection->d_func()->readMoreLater(this); +} + bool QHttpNetworkReply::isFinished() const { return d_func()->state == QHttpNetworkReplyPrivate::AllDoneState; @@ -201,7 +211,7 @@ QHttpNetworkReplyPrivate::QHttpNetworkReplyPrivate(const QUrl &newUrl) forceConnectionCloseEnabled(false), currentChunkSize(0), currentChunkRead(0), connection(0), initInflate(false), autoDecompress(false), responseData(), requestIsPrepared(false) - ,pipeliningUsed(false) + ,pipeliningUsed(false), downstreamLimited(false) { } diff --git a/src/network/access/qhttpnetworkreply_p.h b/src/network/access/qhttpnetworkreply_p.h index a8b4a79..af9266b 100644 --- a/src/network/access/qhttpnetworkreply_p.h +++ b/src/network/access/qhttpnetworkreply_p.h @@ -125,6 +125,7 @@ public: qint64 bytesAvailable() const; qint64 bytesAvailableNextBlock() const; QByteArray readAny(); + void setDownstreamLimited(bool t); bool isFinished() const; @@ -229,6 +230,7 @@ public: bool requestIsPrepared; bool pipeliningUsed; + bool downstreamLimited; }; diff --git a/src/network/access/qnetworkaccessbackend.cpp b/src/network/access/qnetworkaccessbackend.cpp index de947e8..8ac64d2 100644 --- a/src/network/access/qnetworkaccessbackend.cpp +++ b/src/network/access/qnetworkaccessbackend.cpp @@ -161,6 +161,12 @@ void QNetworkAccessBackend::downstreamReadyWrite() // do nothing } +void QNetworkAccessBackend::setDownstreamLimited(bool b) +{ + Q_UNUSED(b); + // do nothing +} + void QNetworkAccessBackend::copyFinished(QIODevice *) { // do nothing diff --git a/src/network/access/qnetworkaccessbackend_p.h b/src/network/access/qnetworkaccessbackend_p.h index 30ef5b3..43d993c 100644 --- a/src/network/access/qnetworkaccessbackend_p.h +++ b/src/network/access/qnetworkaccessbackend_p.h @@ -116,6 +116,7 @@ public: // slot-like: virtual void downstreamReadyWrite(); + virtual void setDownstreamLimited(bool b); virtual void copyFinished(QIODevice *); virtual void ignoreSslErrors(); virtual void ignoreSslErrors(const QList &errors); diff --git a/src/network/access/qnetworkaccesshttpbackend.cpp b/src/network/access/qnetworkaccesshttpbackend.cpp index dacb2bb..a639e0d 100644 --- a/src/network/access/qnetworkaccesshttpbackend.cpp +++ b/src/network/access/qnetworkaccesshttpbackend.cpp @@ -657,6 +657,12 @@ void QNetworkAccessHttpBackend::downstreamReadyWrite() replyFinished(); } +void QNetworkAccessHttpBackend::setDownstreamLimited(bool b) +{ + if (httpReply) + httpReply->setDownstreamLimited(b); +} + void QNetworkAccessHttpBackend::replyReadyRead() { readFromHttp(); diff --git a/src/network/access/qnetworkaccesshttpbackend_p.h b/src/network/access/qnetworkaccesshttpbackend_p.h index 705323d..0eaf003 100644 --- a/src/network/access/qnetworkaccesshttpbackend_p.h +++ b/src/network/access/qnetworkaccesshttpbackend_p.h @@ -82,6 +82,8 @@ public: virtual bool waitForDownstreamReadyRead(int msecs); virtual void downstreamReadyWrite(); + virtual void setDownstreamLimited(bool b); + virtual void copyFinished(QIODevice *); #ifndef QT_NO_OPENSSL virtual void ignoreSslErrors(); diff --git a/src/network/access/qnetworkreplyimpl.cpp b/src/network/access/qnetworkreplyimpl.cpp index 285864d..59c7d76 100644 --- a/src/network/access/qnetworkreplyimpl.cpp +++ b/src/network/access/qnetworkreplyimpl.cpp @@ -652,6 +652,9 @@ void QNetworkReplyImpl::setReadBufferSize(qint64 size) d->backendNotify(QNetworkReplyImplPrivate::NotifyDownstreamReadyWrite); QNetworkReply::setReadBufferSize(size); + + if (d->backend) + d->backend->setDownstreamLimited(d->readBufferMaxSize > 0); } #ifndef QT_NO_OPENSSL diff --git a/tests/manual/qnetworkreply/main.cpp b/tests/manual/qnetworkreply/main.cpp new file mode 100644 index 0000000..015d66e --- /dev/null +++ b/tests/manual/qnetworkreply/main.cpp @@ -0,0 +1,130 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** 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 Technology Preview License Agreement accompanying +** this package. +** +** 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.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +// This file contains benchmarks for QNetworkReply functions. + +#include +#include +#include +#include +#include +#include +#include "../../auto/network-settings.h" + +#define BANDWIDTH_LIMIT_BYTES (1024*100) +#define TIME_ESTIMATION_SECONDS (97) + +class tst_qnetworkreply : public QObject +{ + Q_OBJECT + private slots: + void limiting_data(); + void limiting(); + +}; + +QNetworkReply *reply; + +class HttpReceiver : public QObject +{ + Q_OBJECT + public slots: + void finishedSlot() { + quint64 bytesPerSec = (reply->header(QNetworkRequest::ContentLengthHeader).toLongLong()) / (stopwatch.elapsed() / 1000.0); + qDebug() << "Finished HTTP(S) request with" << bytesPerSec << "bytes/sec"; + QVERIFY(bytesPerSec < BANDWIDTH_LIMIT_BYTES*1.05); + QVERIFY(bytesPerSec > BANDWIDTH_LIMIT_BYTES*0.95); + timer->stop(); + QTestEventLoop::instance().exitLoop(); + } + void readyReadSlot() { + } + void timeoutSlot() { + reply->read(BANDWIDTH_LIMIT_BYTES).size(); + } + void startTimer() { + stopwatch.start(); + timer = new QTimer(this); + QObject::connect(timer, SIGNAL(timeout()), this, SLOT(timeoutSlot())); + timer->start(1000); + } +protected: + QTimer *timer; + QTime stopwatch; +}; + +void tst_qnetworkreply::limiting_data() +{ + QTest::addColumn("url"); + + QTest::newRow("HTTP") << QUrl("http://" + QtNetworkSettings::serverName() + "/mediumfile"); +#ifndef QT_NO_OPENSSL + QTest::newRow("HTTP+SSL") << QUrl("https://" + QtNetworkSettings::serverName() + "/mediumfile"); +#endif + +} + +void tst_qnetworkreply::limiting() +{ + HttpReceiver receiver; + QNetworkAccessManager manager; + + QFETCH(QUrl, url); + QNetworkRequest req (url); + + qDebug() << "Starting. This will take a while (around" << TIME_ESTIMATION_SECONDS << "sec)."; + qDebug() << "Please check the actual bandwidth usage with a network monitor, e.g. the KDE"; + qDebug() << "network plasma widget. It should be around" << BANDWIDTH_LIMIT_BYTES << "bytes/sec."; + reply = manager.get(req); + reply->ignoreSslErrors(); + reply->setReadBufferSize(BANDWIDTH_LIMIT_BYTES); + QObject::connect(reply, SIGNAL(readyRead()), &receiver, SLOT(readyReadSlot())); + QObject::connect(reply, SIGNAL(finished()), &receiver, SLOT(finishedSlot())); + receiver.startTimer(); + + // event loop + QTestEventLoop::instance().enterLoop(TIME_ESTIMATION_SECONDS + 20); + QVERIFY(!QTestEventLoop::instance().timeout()); +} + + +QTEST_MAIN(tst_qnetworkreply) + +#include "main.moc" diff --git a/tests/manual/qnetworkreply/qnetworkreply.pro b/tests/manual/qnetworkreply/qnetworkreply.pro new file mode 100644 index 0000000..060acf5 --- /dev/null +++ b/tests/manual/qnetworkreply/qnetworkreply.pro @@ -0,0 +1,13 @@ +load(qttest_p4) +TEMPLATE = app +TARGET = tst_qnetworkreply +DEPENDPATH += . +INCLUDEPATH += . + +QT -= gui +QT += network + +CONFIG += release + +# Input +SOURCES += main.cpp -- cgit v0.12 From f9a6458f4abf8327354d227b3dd87bbab50d44e9 Mon Sep 17 00:00:00 2001 From: Kim Motoyoshi Kalland Date: Mon, 11 Jan 2010 15:43:52 +0100 Subject: Fixed justify aligned text drawing with the GL1 engine. The text was blurry because it wasn't pixel aligned. Fixed by using nearest-neighbour texture filtering when using only translations on the painter. Reviewed-by: Trond --- src/opengl/qpaintengine_opengl.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/opengl/qpaintengine_opengl.cpp b/src/opengl/qpaintengine_opengl.cpp index 8dae02a..d20f96c 100644 --- a/src/opengl/qpaintengine_opengl.cpp +++ b/src/opengl/qpaintengine_opengl.cpp @@ -4931,7 +4931,8 @@ void QOpenGLPaintEngine::drawTextItem(const QPointF &p, const QTextItem &textIte glEnableClientState(GL_VERTEX_ARRAY); glEnableClientState(GL_TEXTURE_COORD_ARRAY); - bool antialias = !(ti.fontEngine->fontDef.styleStrategy & QFont::NoAntialias); + bool antialias = !(ti.fontEngine->fontDef.styleStrategy & QFont::NoAntialias) + && (d->matrix.type() > QTransform::TxTranslate); glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, antialias ? GL_LINEAR : GL_NEAREST); glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, antialias ? GL_LINEAR : GL_NEAREST); -- cgit v0.12 From e4f2a7f7aae733df87a60f0e9b32dd4d4f6ddcd0 Mon Sep 17 00:00:00 2001 From: Gareth Stockwell Date: Tue, 8 Dec 2009 14:41:31 +0000 Subject: Added comments to clarify usage of Phonon::EffectParameter API Task-number: QTBUG-4659 Reviewed-by: trustme --- src/3rdparty/phonon/mmf/audioequalizer.cpp | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/3rdparty/phonon/mmf/audioequalizer.cpp b/src/3rdparty/phonon/mmf/audioequalizer.cpp index 37ba328..5a1ce19 100644 --- a/src/3rdparty/phonon/mmf/audioequalizer.cpp +++ b/src/3rdparty/phonon/mmf/audioequalizer.cpp @@ -95,14 +95,15 @@ void AudioEqualizer::getParameters(NativeEffect *effect, const qint32 defVol = effect->BandLevel(i); - parameters.append(EffectParameter(i, - tr("%1 Hz").arg(hz), - EffectParameter::LogarithmicHint, - QVariant(qint32(defVol)), - QVariant(qint32(dbMin)), - QVariant(qint32(dbMax)), - QVariantList(), - QString())); + parameters.append(EffectParameter( + /* parameterId */ i, + /* name */ tr("%1 Hz").arg(hz), + /* hints */ EffectParameter::LogarithmicHint, + /* defaultValue */ QVariant(qint32(defVol)), + /* minimumValue */ QVariant(qint32(dbMin)), + /* maximumValue */ QVariant(qint32(dbMax)), + /* values */ QVariantList(), + /* description */ QString())); } } -- cgit v0.12 From 96827cf7675c8555a97ff6b3ec8083940e27a41d Mon Sep 17 00:00:00 2001 From: Markus Goetz Date: Mon, 11 Jan 2010 15:36:01 +0100 Subject: QNAM HTTP: Don't call d_func() so often Reviewed-by: Peter Hartmann --- .../access/qhttpnetworkconnectionchannel.cpp | 57 ++++++++++++---------- 1 file changed, 30 insertions(+), 27 deletions(-) diff --git a/src/network/access/qhttpnetworkconnectionchannel.cpp b/src/network/access/qhttpnetworkconnectionchannel.cpp index b1b0304..da305a0 100644 --- a/src/network/access/qhttpnetworkconnectionchannel.cpp +++ b/src/network/access/qhttpnetworkconnectionchannel.cpp @@ -326,31 +326,34 @@ void QHttpNetworkConnectionChannel::_q_receiveReply() lastStatus = reply->d_func()->statusCode; break; } - case QHttpNetworkReplyPrivate::ReadingHeaderState: - bytes += reply->d_func()->readHeader(socket); - if (reply->d_func()->state == QHttpNetworkReplyPrivate::ReadingDataState) { - if (reply->d_func()->isGzipped() && reply->d_func()->autoDecompress) { + case QHttpNetworkReplyPrivate::ReadingHeaderState: { + QHttpNetworkReplyPrivate *replyPrivate = reply->d_func(); + bytes += replyPrivate->readHeader(socket); + if (replyPrivate->state == QHttpNetworkReplyPrivate::ReadingDataState) { + if (replyPrivate->isGzipped() && replyPrivate->autoDecompress) { // remove the Content-Length from header - reply->d_func()->removeAutoDecompressHeader(); + replyPrivate->removeAutoDecompressHeader(); } else { - reply->d_func()->autoDecompress = false; + replyPrivate->autoDecompress = false; } - if (reply && reply->d_func()->statusCode == 100) { - reply->d_func()->state = QHttpNetworkReplyPrivate::ReadingStatusState; + if (replyPrivate->statusCode == 100) { + replyPrivate->state = QHttpNetworkReplyPrivate::ReadingStatusState; break; // ignore } - if (reply->d_func()->shouldEmitSignals()) + if (replyPrivate->shouldEmitSignals()) emit reply->headerChanged(); - if (!reply->d_func()->expectContent()) { - reply->d_func()->state = QHttpNetworkReplyPrivate::AllDoneState; + if (!replyPrivate->expectContent()) { + replyPrivate->state = QHttpNetworkReplyPrivate::AllDoneState; this->state = QHttpNetworkConnectionChannel::IdleState; allDone(); return; } } break; + } case QHttpNetworkReplyPrivate::ReadingDataState: { - if (reply->d_func()->downstreamLimited && !reply->d_func()->responseData.isEmpty() && reply->d_func()->shouldEmitSignals()) { + QHttpNetworkReplyPrivate *replyPrivate = reply->d_func(); + if (replyPrivate->downstreamLimited && !replyPrivate->responseData.isEmpty() && replyPrivate->shouldEmitSignals()) { // We already have some HTTP body data. We don't read more from the socket until // this is fetched by QHttpNetworkAccessHttpBackend. If we would read more, // we could not limit our read buffer usage. @@ -360,19 +363,19 @@ void QHttpNetworkConnectionChannel::_q_receiveReply() return; } - if (!reply->d_func()->isChunked() && !reply->d_func()->autoDecompress - && reply->d_func()->bodyLength > 0) { + if (!replyPrivate->isChunked() && !replyPrivate->autoDecompress + && replyPrivate->bodyLength > 0) { // bulk files like images should fulfill these properties and // we can therefore save on memory copying - bytes = reply->d_func()->readBodyFast(socket, &reply->d_func()->responseData); - reply->d_func()->totalProgress += bytes; - if (reply->d_func()->shouldEmitSignals()) { + bytes = replyPrivate->readBodyFast(socket, &replyPrivate->responseData); + replyPrivate->totalProgress += bytes; + if (replyPrivate->shouldEmitSignals()) { QPointer replyPointer = reply; emit reply->readyRead(); // make sure that the reply is valid if (replyPointer.isNull()) return; - emit reply->dataReadProgress(reply->d_func()->totalProgress, reply->d_func()->bodyLength); + emit reply->dataReadProgress(replyPrivate->totalProgress, replyPrivate->bodyLength); // make sure that the reply is valid if (replyPointer.isNull()) return; @@ -383,16 +386,16 @@ void QHttpNetworkConnectionChannel::_q_receiveReply() // use the traditional slower reading (for compressed encoding, chunked encoding, // no content-length etc) QByteDataBuffer byteDatas; - bytes = reply->d_func()->readBody(socket, &byteDatas); + bytes = replyPrivate->readBody(socket, &byteDatas); if (bytes) { - if (reply->d_func()->autoDecompress) - reply->d_func()->appendCompressedReplyData(byteDatas); + if (replyPrivate->autoDecompress) + replyPrivate->appendCompressedReplyData(byteDatas); else - reply->d_func()->appendUncompressedReplyData(byteDatas); + replyPrivate->appendUncompressedReplyData(byteDatas); - if (!reply->d_func()->autoDecompress) { - reply->d_func()->totalProgress += bytes; - if (reply->d_func()->shouldEmitSignals()) { + if (!replyPrivate->autoDecompress) { + replyPrivate->totalProgress += bytes; + if (replyPrivate->shouldEmitSignals()) { QPointer replyPointer = reply; // important: At the point of this readyRead(), the byteDatas list must be empty, // else implicit sharing will trigger memcpy when the user is reading data! @@ -400,7 +403,7 @@ void QHttpNetworkConnectionChannel::_q_receiveReply() // make sure that the reply is valid if (replyPointer.isNull()) return; - emit reply->dataReadProgress(reply->d_func()->totalProgress, reply->d_func()->bodyLength); + emit reply->dataReadProgress(replyPrivate->totalProgress, replyPrivate->bodyLength); // make sure that the reply is valid if (replyPointer.isNull()) return; @@ -413,7 +416,7 @@ void QHttpNetworkConnectionChannel::_q_receiveReply() #endif } } - if (reply->d_func()->state == QHttpNetworkReplyPrivate::ReadingDataState) + if (replyPrivate->state == QHttpNetworkReplyPrivate::ReadingDataState) break; // everything done, fall through } -- cgit v0.12 From 483893142dcec15c646ef997309dcede76466766 Mon Sep 17 00:00:00 2001 From: Gareth Stockwell Date: Mon, 11 Jan 2010 15:03:29 +0000 Subject: Modified effect parameter handling to improve user experience This change is to work around a limitation in the Phonon::EffectWidget class. This widget only displays sliders for parameters with numeric values if the variant type of the parameter is QReal and the range is exactly -1.0 to +1.0; otherwise, a spinbox is displayed. This is rather inconvenient for many effects, such as the audio equalizer, for which a slider is a much more natural UI control. The MMF backend therefore reports the type of numeric parameters to be QReal, and the range to be -1.0 to +1.0. Internally, the integer range for the parameter is stored. Changes to the parameter value are converted from the client-side, floating point representation to the internal, integer representation. Task-number: QTBUG-4659 Reviewed-by: Espen Riskedal --- src/3rdparty/phonon/mmf/abstractaudioeffect.cpp | 15 ++++-- src/3rdparty/phonon/mmf/abstractaudioeffect.h | 11 ++-- src/3rdparty/phonon/mmf/audioequalizer.cpp | 30 +++++++---- src/3rdparty/phonon/mmf/audioequalizer.h | 2 +- src/3rdparty/phonon/mmf/effectfactory.h | 1 + src/3rdparty/phonon/mmf/effectparameter.cpp | 63 ++++++++++++++++++++++ src/3rdparty/phonon/mmf/effectparameter.h | 72 +++++++++++++++++++++++++ src/3rdparty/phonon/phonon/effectwidget.cpp | 2 +- src/plugins/phonon/mmf/mmf.pro | 2 + 9 files changed, 175 insertions(+), 23 deletions(-) create mode 100644 src/3rdparty/phonon/mmf/effectparameter.cpp create mode 100644 src/3rdparty/phonon/mmf/effectparameter.h diff --git a/src/3rdparty/phonon/mmf/abstractaudioeffect.cpp b/src/3rdparty/phonon/mmf/abstractaudioeffect.cpp index c75c08e..1939e04 100644 --- a/src/3rdparty/phonon/mmf/abstractaudioeffect.cpp +++ b/src/3rdparty/phonon/mmf/abstractaudioeffect.cpp @@ -38,18 +38,23 @@ using namespace Phonon::MMF; AbstractAudioEffect::AbstractAudioEffect(QObject *parent, const QList ¶ms) : MediaNode(parent) - , m_player(0) , m_params(params) + , m_player(0) { } -QList AbstractAudioEffect::parameters() const +QList AbstractAudioEffect::parameters() const { - return m_params; + // Convert from QList to QList + QList result; + EffectParameter param; + foreach (param, m_params) + result += param; + return result; } -QVariant AbstractAudioEffect::parameterValue(const EffectParameter &queriedParam) const +QVariant AbstractAudioEffect::parameterValue(const Phonon::EffectParameter &queriedParam) const { const QVariant &val = m_values.value(queriedParam.id()); @@ -59,7 +64,7 @@ QVariant AbstractAudioEffect::parameterValue(const EffectParameter &queriedParam return val; } -void AbstractAudioEffect::setParameterValue(const EffectParameter ¶m, +void AbstractAudioEffect::setParameterValue(const Phonon::EffectParameter ¶m, const QVariant &newValue) { m_values.insert(param.id(), newValue); diff --git a/src/3rdparty/phonon/mmf/abstractaudioeffect.h b/src/3rdparty/phonon/mmf/abstractaudioeffect.h index df1d08a..4772eb8 100644 --- a/src/3rdparty/phonon/mmf/abstractaudioeffect.h +++ b/src/3rdparty/phonon/mmf/abstractaudioeffect.h @@ -24,9 +24,9 @@ along with this library. If not, see . #include #include -#include #include "audioplayer.h" +#include "effectparameter.h" #include "mmf_medianode.h" #include "mmf_videoplayer.h" @@ -63,9 +63,10 @@ public: AbstractAudioEffect(QObject *parent, const QList ¶ms); - virtual QList parameters() const; - virtual QVariant parameterValue(const EffectParameter ¶m) const; - virtual void setParameterValue(const EffectParameter &, + // Phonon::EffectInterface + virtual QList parameters() const; + virtual QVariant parameterValue(const Phonon::EffectParameter ¶m) const; + virtual void setParameterValue(const Phonon::EffectParameter &, const QVariant &newValue); protected: @@ -81,10 +82,10 @@ protected: protected: QScopedPointer m_effect; + const QList m_params; private: AbstractMediaPlayer * m_player; - const QList m_params; QHash m_values; }; diff --git a/src/3rdparty/phonon/mmf/audioequalizer.cpp b/src/3rdparty/phonon/mmf/audioequalizer.cpp index 5a1ce19..adbe6c8 100644 --- a/src/3rdparty/phonon/mmf/audioequalizer.cpp +++ b/src/3rdparty/phonon/mmf/audioequalizer.cpp @@ -39,7 +39,7 @@ void AudioEqualizer::parameterChanged(const int pid, { if (m_effect.data()) { const int band = pid; - const int level = value.toInt(); + const qreal level = value.toReal(); setBandLevel(band, level); } } @@ -54,7 +54,7 @@ void AudioEqualizer::connectAudioPlayer(AudioPlayer::NativePlayer *player) void AudioEqualizer::applyParameters() { if (m_effect.data()) { - EffectParameter param; + Phonon::EffectParameter param; foreach (param, parameters()) { const int band = param.id(); const int level = parameterValue(param).toInt(); @@ -63,11 +63,14 @@ void AudioEqualizer::applyParameters() } } -void AudioEqualizer::setBandLevel(int band, int level) +void AudioEqualizer::setBandLevel(int band, qreal externalLevel) { + const EffectParameter ¶m = m_params[band]; + const int internalLevel = param.toInternalValue(externalLevel); + CAudioEqualizer *const effect = static_cast(m_effect.data()); // TODO: handle audio effect errors - TRAP_IGNORE(effect->SetBandLevelL(band, level)); + TRAP_IGNORE(effect->SetBandLevelL(band, internalLevel)); } //----------------------------------------------------------------------------- @@ -93,17 +96,22 @@ void AudioEqualizer::getParameters(NativeEffect *effect, for (int i = 1; i <= bandCount; ++i) { const qint32 hz = effect->CenterFrequency(i); - const qint32 defVol = effect->BandLevel(i); - - parameters.append(EffectParameter( + // We pass a floating-point parameter range of -1.0 to +1.0 for + // each band in order to work around a limitation in + // Phonon::EffectWidget. See documentation of EffectParameter + // for more details. + EffectParameter param( /* parameterId */ i, /* name */ tr("%1 Hz").arg(hz), /* hints */ EffectParameter::LogarithmicHint, - /* defaultValue */ QVariant(qint32(defVol)), - /* minimumValue */ QVariant(qint32(dbMin)), - /* maximumValue */ QVariant(qint32(dbMax)), + /* defaultValue */ QVariant(qreal(0.0)), + /* minimumValue */ QVariant(qreal(-1.0)), + /* maximumValue */ QVariant(qreal(+1.0)), /* values */ QVariantList(), - /* description */ QString())); + /* description */ QString()); + + param.setInternalRange(dbMin, dbMax); + parameters.append(param); } } diff --git a/src/3rdparty/phonon/mmf/audioequalizer.h b/src/3rdparty/phonon/mmf/audioequalizer.h index ee3d297..d10cbf3 100644 --- a/src/3rdparty/phonon/mmf/audioequalizer.h +++ b/src/3rdparty/phonon/mmf/audioequalizer.h @@ -56,7 +56,7 @@ protected: virtual void parameterChanged(const int id, const QVariant &value); private: - void setBandLevel(int band, int level); + void setBandLevel(int band, qreal externalLevel); }; } diff --git a/src/3rdparty/phonon/mmf/effectfactory.h b/src/3rdparty/phonon/mmf/effectfactory.h index 45bd0f0..dd4b58d 100644 --- a/src/3rdparty/phonon/mmf/effectfactory.h +++ b/src/3rdparty/phonon/mmf/effectfactory.h @@ -20,6 +20,7 @@ along with this library. If not, see . #define PHONON_MMF_EFFECTFACTORY_H #include "abstractaudioeffect.h" +#include "effectparameter.h" QT_BEGIN_NAMESPACE diff --git a/src/3rdparty/phonon/mmf/effectparameter.cpp b/src/3rdparty/phonon/mmf/effectparameter.cpp new file mode 100644 index 0000000..f4287b8 --- /dev/null +++ b/src/3rdparty/phonon/mmf/effectparameter.cpp @@ -0,0 +1,63 @@ +/* This file is part of the KDE project. + +Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). + +This library is free software: you can redistribute it and/or modify +it under the terms of the GNU Lesser General Public License as published by +the Free Software Foundation, either version 2.1 or 3 of the License. + +This library is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU Lesser General Public License for more details. + +You should have received a copy of the GNU Lesser General Public License +along with this library. If not, see . + +*/ + +#include "effectparameter.h" + +QT_BEGIN_NAMESPACE + +using namespace Phonon; +using namespace Phonon::MMF; + +/*! \class MMF::EffectParameter + \internal +*/ + +MMF::EffectParameter::EffectParameter() + : m_hasInternalRange(false) +{ + +} + +MMF::EffectParameter::EffectParameter( + int parameterId, const QString &name, Hints hints, + const QVariant &defaultValue, const QVariant &min, + const QVariant &max, const QVariantList &values, + const QString &description) + : Phonon::EffectParameter(parameterId, name, hints, defaultValue, + min, max, values, description) + , m_hasInternalRange(false) +{ + +} + +void MMF::EffectParameter::setInternalRange(qint32 min, qint32 max) +{ + Q_ASSERT_X(max >= min, Q_FUNC_INFO, "Invalid range"); + m_internalRange = QPair(min, max); + m_hasInternalRange = true; +} + +qint32 MMF::EffectParameter::toInternalValue(qreal external) const +{ + Q_ASSERT_X(m_hasInternalRange, Q_FUNC_INFO, "Does not have internal range"); + const qint32 range = m_internalRange.second - m_internalRange.first; + return m_internalRange.first + ((1.0 + external) / 2) * range; +} + +QT_END_NAMESPACE + diff --git a/src/3rdparty/phonon/mmf/effectparameter.h b/src/3rdparty/phonon/mmf/effectparameter.h new file mode 100644 index 0000000..3008159 --- /dev/null +++ b/src/3rdparty/phonon/mmf/effectparameter.h @@ -0,0 +1,72 @@ +/* This file is part of the KDE project. + +Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). + +This library is free software: you can redistribute it and/or modify +it under the terms of the GNU Lesser General Public License as published by +the Free Software Foundation, either version 2.1 or 3 of the License. + +This library is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU Lesser General Public License for more details. + +You should have received a copy of the GNU Lesser General Public License +along with this library. If not, see . + +*/ + +#ifndef PHONON_MMF_EFFECTPARAMETER_H +#define PHONON_MMF_EFFECTPARAMETER_H + +#include + +QT_BEGIN_NAMESPACE + +namespace Phonon +{ +namespace MMF +{ + +/** + * @short Parameter value for an audio effect + * + * The base class is extended in order to work around a shortcoming + * in Phonon::EffectWidget. This widget only displays sliders for + * parameters with numeric values if the variant type of the parameter + * is QReal and the range is exactly -1.0 to +1.0; otherwise, a + * spinbox is used to set numeric parameters. This is rather + * inconvenient for many effects, such as the audio equalizer, for + * which a slider is a much more natural UI control. + * + * For many such parameters, we therefore report the type to be QReal + * and the range to be -1.0 to +1.0. This class stores the actual + * integer range for the parameter, and provides the toInternalValue + * function for converting between the client-side floating point + * value and the internal integer value. + */ +class EffectParameter : public Phonon::EffectParameter +{ +public: + EffectParameter(); + EffectParameter(int parameterId, const QString &name, Hints hints, + const QVariant &defaultValue, const QVariant &min = QVariant(), + const QVariant &max = QVariant(), const QVariantList &values = QVariantList(), + const QString &description = QString()); + + void setInternalRange(qint32 min, qint32 max); + qint32 toInternalValue(qreal external) const; + +private: + bool m_hasInternalRange; + QPair m_internalRange; + +}; + +} +} + +QT_END_NAMESPACE + +#endif + diff --git a/src/3rdparty/phonon/phonon/effectwidget.cpp b/src/3rdparty/phonon/phonon/effectwidget.cpp index b39299a..a2fe50f 100644 --- a/src/3rdparty/phonon/phonon/effectwidget.cpp +++ b/src/3rdparty/phonon/phonon/effectwidget.cpp @@ -15,7 +15,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. - You should have received a copy of the GNU Lesser General Public + You should have received a copy of the GNU Lesser General Public License along with this library. If not, see . */ diff --git a/src/plugins/phonon/mmf/mmf.pro b/src/plugins/phonon/mmf/mmf.pro index 65a7a29..f72a657 100644 --- a/src/plugins/phonon/mmf/mmf.pro +++ b/src/plugins/phonon/mmf/mmf.pro @@ -35,6 +35,7 @@ HEADERS += \ $$PHONON_MMF_DIR/defs.h \ $$PHONON_MMF_DIR/dummyplayer.h \ $$PHONON_MMF_DIR/effectfactory.h \ + $$PHONON_MMF_DIR/effectparameter.h \ $$PHONON_MMF_DIR/mediaobject.h \ $$PHONON_MMF_DIR/mmf_medianode.h \ $$PHONON_MMF_DIR/mmf_videoplayer.h \ @@ -57,6 +58,7 @@ SOURCES += \ $$PHONON_MMF_DIR/bassboost.cpp \ $$PHONON_MMF_DIR/dummyplayer.cpp \ $$PHONON_MMF_DIR/effectfactory.cpp \ + $$PHONON_MMF_DIR/effectparameter.cpp \ $$PHONON_MMF_DIR/mediaobject.cpp \ $$PHONON_MMF_DIR/mmf_medianode.cpp \ $$PHONON_MMF_DIR/mmf_videoplayer.cpp \ -- cgit v0.12 From d1fe5a2c0b9d21b32e9d65b59f120776a79d022c Mon Sep 17 00:00:00 2001 From: Ritt Konstantin Date: Mon, 11 Jan 2010 15:23:06 +0100 Subject: fix typo in qreadwritelock's documentation Merge-request: 426 Reviewed-by: Thiago Macieira --- src/corelib/thread/qreadwritelock.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/corelib/thread/qreadwritelock.cpp b/src/corelib/thread/qreadwritelock.cpp index 3463eab..bd07a97 100644 --- a/src/corelib/thread/qreadwritelock.cpp +++ b/src/corelib/thread/qreadwritelock.cpp @@ -82,7 +82,7 @@ QT_BEGIN_NAMESPACE Like QMutex, a QReadWriteLock can be recursively locked by the same thread when constructed in - \l{QReadWriteLock::RecursionMode}recursive mode}. In such cases, + \l{QReadWriteLock::RecursionMode}. In such cases, unlock() must be called the same number of times lockForWrite() or lockForRead() was called. Note that the lock type cannot be changed when trying to lock recursively, i.e. it is not possible @@ -266,12 +266,12 @@ bool QReadWriteLock::tryLockForRead(int timeout) return true; } - /*! +/*! Locks the lock for writing. This function will block the current thread if another thread has locked for reading or writing. \sa unlock() lockForRead() tryLockForWrite() - */ +*/ void QReadWriteLock::lockForWrite() { QMutexLocker lock(&d->mutex); -- cgit v0.12 From 02c6e391176f448ea2a45415140f432851aa376a Mon Sep 17 00:00:00 2001 From: Bernhard Rosenkraenzer Date: Mon, 11 Jan 2010 15:33:00 +0100 Subject: Fix code example The example given for QAudioOutput doesn't actually compile: QAudioOutput::start takes a pointer to a QIODevice, but it's passed a QFile (not the pointer). Merge-request: 418 Reviewed-by: Thiago Macieira --- src/multimedia/audio/qaudiooutput.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/multimedia/audio/qaudiooutput.cpp b/src/multimedia/audio/qaudiooutput.cpp index 613056c..b61aa4f 100644 --- a/src/multimedia/audio/qaudiooutput.cpp +++ b/src/multimedia/audio/qaudiooutput.cpp @@ -98,7 +98,7 @@ QT_BEGIN_NAMESPACE audio = new QAudioOutput(format, this); connect(audio,SIGNAL(stateChanged(QAudio::State)),SLOT(finishedPlaying(QAudio::State))); - audio->start(inputFile); + audio->start(&inputFile); \endcode -- cgit v0.12 From e53306725e52407146304df9d8d3a65920fc3e8d Mon Sep 17 00:00:00 2001 From: Gareth Stockwell Date: Mon, 11 Jan 2010 15:30:15 +0000 Subject: Delayed creation of audio effect object until audio is initialized When applying effects to an audio stream, we must ensure that the MMF utility API (CMdaAudioPlayerUtility or CVideoPlayerUtility) instance has loaded a controller before calling attempting to create a CAudioEffect- derived object. If the controller has not been loaded, construction of the effect object will fail. Even if we mitigate against this, calling CAudioEffect::ApplyL() will only have an effect if there is a controller object - or more precisely, a DevSound instance - on which to apply the effect. This patch delays construction of the effect object until the MediaObject has transitioned out of the LoadingState, indicating that an underlying DevSound instance will have been created. Task-number: QTBUG-4659 Reviewed-by: Espen Riskedal --- src/3rdparty/phonon/mmf/abstractaudioeffect.cpp | 59 ++++++++++++++++++------- src/3rdparty/phonon/mmf/abstractaudioeffect.h | 11 ++++- src/3rdparty/phonon/mmf/audioequalizer.cpp | 6 +-- src/3rdparty/phonon/mmf/audioequalizer.h | 2 +- src/3rdparty/phonon/mmf/bassboost.cpp | 2 +- src/3rdparty/phonon/mmf/bassboost.h | 2 +- src/3rdparty/phonon/mmf/mediaobject.cpp | 3 ++ src/3rdparty/phonon/mmf/mediaobject.h | 1 + 8 files changed, 63 insertions(+), 23 deletions(-) diff --git a/src/3rdparty/phonon/mmf/abstractaudioeffect.cpp b/src/3rdparty/phonon/mmf/abstractaudioeffect.cpp index 1939e04..cdddf02 100644 --- a/src/3rdparty/phonon/mmf/abstractaudioeffect.cpp +++ b/src/3rdparty/phonon/mmf/abstractaudioeffect.cpp @@ -68,11 +68,26 @@ void AbstractAudioEffect::setParameterValue(const Phonon::EffectParameter ¶m const QVariant &newValue) { m_values.insert(param.id(), newValue); - parameterChanged(param.id(), newValue); - if (m_effect.data()) + if (m_effect.data()) { + parameterChanged(param.id(), newValue); // TODO: handle audio effect errors TRAP_IGNORE(m_effect->ApplyL()); + } +} + +void AbstractAudioEffect::abstractPlayerChanged(AbstractPlayer *player) +{ + m_player = qobject_cast(player); + m_effect.reset(); +} + +void AbstractAudioEffect::stateChanged(Phonon::State newState, + Phonon::State oldState) +{ + if (Phonon::LoadingState == oldState + && Phonon::LoadingState != newState) + createEffect(); } void AbstractAudioEffect::connectMediaObject(MediaObject *mediaObject) @@ -80,25 +95,37 @@ void AbstractAudioEffect::connectMediaObject(MediaObject *mediaObject) Q_ASSERT_X(!m_player, Q_FUNC_INFO, "Player already connected"); Q_ASSERT_X(!m_effect.data(), Q_FUNC_INFO, "Effect already created"); - AbstractMediaPlayer *const player = - qobject_cast(mediaObject->abstractPlayer()); + abstractPlayerChanged(mediaObject->abstractPlayer()); - if (player) { - m_player = player; + connect(mediaObject, SIGNAL(stateChanged(Phonon::State, Phonon::State)), + SLOT(stateChanged(Phonon::State, Phonon::State))); - if (AudioPlayer *audioPlayer = qobject_cast(player)) { - connectAudioPlayer(audioPlayer->nativePlayer()); - applyParameters(); - // TODO: handle audio effect errors - TRAP_IGNORE(m_effect->EnableL()); - } - } + connect(mediaObject, SIGNAL(abstractPlayerChanged(AbstractPlayer *)), + SLOT(abstractPlayerChanged(AbstractPlayer *))); + + if (mediaObject->state() != Phonon::LoadingState) + createEffect(); } -void AbstractAudioEffect::disconnectMediaObject(MediaObject * /*mediaObject*/) +void AbstractAudioEffect::disconnectMediaObject(MediaObject *mediaObject) { - m_player = 0; - m_effect.reset(); + mediaObject->disconnect(this); + abstractPlayerChanged(0); +} + +void AbstractAudioEffect::createEffect() +{ + Q_ASSERT_X(m_player, Q_FUNC_INFO, "Invalid media player pointer"); + + if (AudioPlayer *audioPlayer = qobject_cast(m_player)) { + createEffect(audioPlayer->nativePlayer()); + } + + if (m_effect.data()) { + applyParameters(); + // TODO: handle audio effect errors + TRAP_IGNORE(m_effect->EnableL()); + } } QT_END_NAMESPACE diff --git a/src/3rdparty/phonon/mmf/abstractaudioeffect.h b/src/3rdparty/phonon/mmf/abstractaudioeffect.h index 4772eb8..7d44bf0 100644 --- a/src/3rdparty/phonon/mmf/abstractaudioeffect.h +++ b/src/3rdparty/phonon/mmf/abstractaudioeffect.h @@ -36,6 +36,7 @@ namespace Phonon { namespace MMF { +class AbstractPlayer; class AbstractMediaPlayer; /** @@ -69,17 +70,25 @@ public: virtual void setParameterValue(const Phonon::EffectParameter &, const QVariant &newValue); +public Q_SLOTS: + void abstractPlayerChanged(AbstractPlayer *player); + void stateChanged(Phonon::State newState, + Phonon::State oldState); + protected: // MediaNode void connectMediaObject(MediaObject *mediaObject); void disconnectMediaObject(MediaObject *mediaObject); - virtual void connectAudioPlayer(AudioPlayer::NativePlayer *player) = 0; + virtual void createEffect(AudioPlayer::NativePlayer *player) = 0; virtual void applyParameters() = 0; virtual void parameterChanged(const int id, const QVariant &value) = 0; +private: + void createEffect(); + protected: QScopedPointer m_effect; const QList m_params; diff --git a/src/3rdparty/phonon/mmf/audioequalizer.cpp b/src/3rdparty/phonon/mmf/audioequalizer.cpp index adbe6c8..b41eda4 100644 --- a/src/3rdparty/phonon/mmf/audioequalizer.cpp +++ b/src/3rdparty/phonon/mmf/audioequalizer.cpp @@ -44,7 +44,7 @@ void AudioEqualizer::parameterChanged(const int pid, } } -void AudioEqualizer::connectAudioPlayer(AudioPlayer::NativePlayer *player) +void AudioEqualizer::createEffect(AudioPlayer::NativePlayer *player) { CAudioEqualizer *ptr = 0; QT_TRAP_THROWING(ptr = CAudioEqualizer::NewL(*player)); @@ -57,7 +57,7 @@ void AudioEqualizer::applyParameters() Phonon::EffectParameter param; foreach (param, parameters()) { const int band = param.id(); - const int level = parameterValue(param).toInt(); + const qreal level = parameterValue(param).toReal(); setBandLevel(band, level); } } @@ -65,7 +65,7 @@ void AudioEqualizer::applyParameters() void AudioEqualizer::setBandLevel(int band, qreal externalLevel) { - const EffectParameter ¶m = m_params[band]; + const EffectParameter ¶m = m_params[band-1]; // Band IDs are 1-based const int internalLevel = param.toInternalValue(externalLevel); CAudioEqualizer *const effect = static_cast(m_effect.data()); diff --git a/src/3rdparty/phonon/mmf/audioequalizer.h b/src/3rdparty/phonon/mmf/audioequalizer.h index d10cbf3..22fa1e8 100644 --- a/src/3rdparty/phonon/mmf/audioequalizer.h +++ b/src/3rdparty/phonon/mmf/audioequalizer.h @@ -51,7 +51,7 @@ public: protected: // AbstractAudioEffect - virtual void connectAudioPlayer(AudioPlayer::NativePlayer *player); + virtual void createEffect(AudioPlayer::NativePlayer *player); virtual void applyParameters(); virtual void parameterChanged(const int id, const QVariant &value); diff --git a/src/3rdparty/phonon/mmf/bassboost.cpp b/src/3rdparty/phonon/mmf/bassboost.cpp index 4edd102..9f62ecc 100644 --- a/src/3rdparty/phonon/mmf/bassboost.cpp +++ b/src/3rdparty/phonon/mmf/bassboost.cpp @@ -40,7 +40,7 @@ void BassBoost::parameterChanged(const int, Q_ASSERT_X(false, Q_FUNC_INFO, "BassBoost has no parameters"); } -void BassBoost::connectAudioPlayer(AudioPlayer::NativePlayer *player) +void BassBoost::createEffect(AudioPlayer::NativePlayer *player) { CBassBoost *ptr = 0; QT_TRAP_THROWING(ptr = CBassBoost::NewL(*player)); diff --git a/src/3rdparty/phonon/mmf/bassboost.h b/src/3rdparty/phonon/mmf/bassboost.h index c3c48d0..9f3d764 100644 --- a/src/3rdparty/phonon/mmf/bassboost.h +++ b/src/3rdparty/phonon/mmf/bassboost.h @@ -49,7 +49,7 @@ public: protected: // AbstractAudioEffect - virtual void connectAudioPlayer(AudioPlayer::NativePlayer *player); + virtual void createEffect(AudioPlayer::NativePlayer *player); virtual void applyParameters(); virtual void parameterChanged(const int id, const QVariant &value); diff --git a/src/3rdparty/phonon/mmf/mediaobject.cpp b/src/3rdparty/phonon/mmf/mediaobject.cpp index 4653fee..9744774 100644 --- a/src/3rdparty/phonon/mmf/mediaobject.cpp +++ b/src/3rdparty/phonon/mmf/mediaobject.cpp @@ -297,7 +297,10 @@ void MMF::MediaObject::createPlayer(const MediaSource &source) break; } + if (oldPlayer) + emit abstractPlayerChanged(0); m_player.reset(newPlayer); + emit abstractPlayerChanged(newPlayer); if (oldPlayerHasVideo != hasVideo()) { emit hasVideoChanged(hasVideo()); diff --git a/src/3rdparty/phonon/mmf/mediaobject.h b/src/3rdparty/phonon/mmf/mediaobject.h index 7d330e7..c87d755 100644 --- a/src/3rdparty/phonon/mmf/mediaobject.h +++ b/src/3rdparty/phonon/mmf/mediaobject.h @@ -92,6 +92,7 @@ public Q_SLOTS: void switchToNextSource(); Q_SIGNALS: + void abstractPlayerChanged(AbstractPlayer *player); void totalTimeChanged(qint64 length); void hasVideoChanged(bool hasVideo); void seekableChanged(bool seekable); -- cgit v0.12 From 088e1bce77aa2e780a79237b94393082490d771c Mon Sep 17 00:00:00 2001 From: Andre Pedralho Date: Mon, 11 Jan 2010 16:32:47 +0100 Subject: Added the 'framecapture' WebKit example to the default build. Merge-request: 2235 Reviewed-by: Thiago Macieira Reviewed-by: Simon Hausmann --- examples/webkit/webkit.pro | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/examples/webkit/webkit.pro b/examples/webkit/webkit.pro index c985ed5..76c8801 100644 --- a/examples/webkit/webkit.pro +++ b/examples/webkit/webkit.pro @@ -3,7 +3,8 @@ SUBDIRS += domtraversal \ formextractor \ previewer \ fancybrowser \ - simpleselector + simpleselector \ + framecapture contains(QT_CONFIG, openssl):SUBDIRS += googlechat -- cgit v0.12 From 894bb6e1742b75312feb7a18d043a67a3dba4cb9 Mon Sep 17 00:00:00 2001 From: Gareth Stockwell Date: Mon, 11 Jan 2010 15:38:07 +0000 Subject: Removed dependency of EffectFactory on native effect headers By refactoring the static capabilities / parameters interface exposed by AbstractAudioEffect-derived classes to the EffectFactory, the latter's implementation no longer needs access to the headers for native effect classes. Previously, during the initialization phase, the EffectFactory tried to create an instance of each native effect class, in order to determine whether that effect is supported. This is now done inside the backend class for each effect, thereby improving encapsulation. Task-number: QTBUG-4659 Reviewed-by: Espen Riskedal --- src/3rdparty/phonon/mmf/abstractaudioeffect.h | 2 + src/3rdparty/phonon/mmf/audioequalizer.cpp | 67 +++++++++++++++------------ src/3rdparty/phonon/mmf/audioequalizer.h | 7 +-- src/3rdparty/phonon/mmf/bassboost.cpp | 4 +- src/3rdparty/phonon/mmf/bassboost.h | 7 +-- src/3rdparty/phonon/mmf/effectfactory.cpp | 21 +-------- 6 files changed, 48 insertions(+), 60 deletions(-) diff --git a/src/3rdparty/phonon/mmf/abstractaudioeffect.h b/src/3rdparty/phonon/mmf/abstractaudioeffect.h index 7d44bf0..9e5a6eb 100644 --- a/src/3rdparty/phonon/mmf/abstractaudioeffect.h +++ b/src/3rdparty/phonon/mmf/abstractaudioeffect.h @@ -30,6 +30,8 @@ along with this library. If not, see . #include "mmf_medianode.h" #include "mmf_videoplayer.h" +class CMdaAudioOutputStream; + QT_BEGIN_NAMESPACE namespace Phonon diff --git a/src/3rdparty/phonon/mmf/audioequalizer.cpp b/src/3rdparty/phonon/mmf/audioequalizer.cpp index b41eda4..a4127c4 100644 --- a/src/3rdparty/phonon/mmf/audioequalizer.cpp +++ b/src/3rdparty/phonon/mmf/audioequalizer.cpp @@ -82,37 +82,46 @@ const char* AudioEqualizer::description() return "Audio equalizer"; } -void AudioEqualizer::getParameters(NativeEffect *effect, - QList ¶meters) +bool AudioEqualizer::getParameters(CMdaAudioOutputStream *stream, + QList& parameters) { - TInt32 dbMin; - TInt32 dbMax; - effect->DbLevelLimits(dbMin, dbMax); - - const int bandCount = effect->NumberOfBands(); - - // For some reason, band IDs are 1-based, as opposed to the - // 0-based indices used in just about other Symbian API...! - for (int i = 1; i <= bandCount; ++i) { - const qint32 hz = effect->CenterFrequency(i); - - // We pass a floating-point parameter range of -1.0 to +1.0 for - // each band in order to work around a limitation in - // Phonon::EffectWidget. See documentation of EffectParameter - // for more details. - EffectParameter param( - /* parameterId */ i, - /* name */ tr("%1 Hz").arg(hz), - /* hints */ EffectParameter::LogarithmicHint, - /* defaultValue */ QVariant(qreal(0.0)), - /* minimumValue */ QVariant(qreal(-1.0)), - /* maximumValue */ QVariant(qreal(+1.0)), - /* values */ QVariantList(), - /* description */ QString()); - - param.setInternalRange(dbMin, dbMax); - parameters.append(param); + bool supported = false; + + QScopedPointer effect; + TRAPD(err, effect.reset(CAudioEqualizer::NewL(*stream))); + + if (KErrNone == err) { + supported = true; + + TInt32 dbMin; + TInt32 dbMax; + effect->DbLevelLimits(dbMin, dbMax); + + const int bandCount = effect->NumberOfBands(); + + // For some reason, band IDs are 1-based, as opposed to the + // 0-based indices used in just about other Symbian API...! + for (int i = 1; i <= bandCount; ++i) { + const qint32 hz = effect->CenterFrequency(i); + + // We pass a floating-point parameter range of -1.0 to +1.0 for + // each band in order to work around a limitation in + // Phonon::EffectWidget. See documentation of EffectParameter + // for more details. + EffectParameter param( + /* parameterId */ i, + /* name */ tr("%1 Hz").arg(hz), + /* hints */ EffectParameter::LogarithmicHint, + /* defaultValue */ QVariant(qreal(0.0)), + /* minimumValue */ QVariant(qreal(-1.0)), + /* maximumValue */ QVariant(qreal(+1.0))); + + param.setInternalRange(dbMin, dbMax); + parameters.append(param); + } } + + return supported; } QT_END_NAMESPACE diff --git a/src/3rdparty/phonon/mmf/audioequalizer.h b/src/3rdparty/phonon/mmf/audioequalizer.h index 22fa1e8..35592f4 100644 --- a/src/3rdparty/phonon/mmf/audioequalizer.h +++ b/src/3rdparty/phonon/mmf/audioequalizer.h @@ -21,8 +21,6 @@ along with this library. If not, see . #include "abstractaudioeffect.h" -class CAudioEqualizer; - QT_BEGIN_NAMESPACE namespace Phonon @@ -45,9 +43,8 @@ public: // Static interface required by EffectFactory static const char* description(); - typedef CAudioEqualizer NativeEffect; - static void getParameters(NativeEffect *effect, - QList ¶meters); + static bool getParameters(CMdaAudioOutputStream *stream, + QList& parameters); protected: // AbstractAudioEffect diff --git a/src/3rdparty/phonon/mmf/bassboost.cpp b/src/3rdparty/phonon/mmf/bassboost.cpp index 9f62ecc..642d782 100644 --- a/src/3rdparty/phonon/mmf/bassboost.cpp +++ b/src/3rdparty/phonon/mmf/bassboost.cpp @@ -61,9 +61,9 @@ const char* BassBoost::description() return "Bass boost"; } -void BassBoost::getParameters(NativeEffect*, QList&) +bool BassBoost::getParameters(CMdaAudioOutputStream *, QList&) { - + return true; } QT_END_NAMESPACE diff --git a/src/3rdparty/phonon/mmf/bassboost.h b/src/3rdparty/phonon/mmf/bassboost.h index 9f3d764..241cda9 100644 --- a/src/3rdparty/phonon/mmf/bassboost.h +++ b/src/3rdparty/phonon/mmf/bassboost.h @@ -21,8 +21,6 @@ along with this library. If not, see . #include "abstractaudioeffect.h" -class CBassBoost; - QT_BEGIN_NAMESPACE namespace Phonon @@ -43,9 +41,8 @@ public: // Static interface required by EffectFactory static const char* description(); - typedef CBassBoost NativeEffect; - static void getParameters(NativeEffect *effect, - QList ¶meters); + static bool getParameters(CMdaAudioOutputStream *stream, + QList& parameters); protected: // AbstractAudioEffect diff --git a/src/3rdparty/phonon/mmf/effectfactory.cpp b/src/3rdparty/phonon/mmf/effectfactory.cpp index a8cbf24..19c6d90 100644 --- a/src/3rdparty/phonon/mmf/effectfactory.cpp +++ b/src/3rdparty/phonon/mmf/effectfactory.cpp @@ -19,17 +19,6 @@ along with this library. If not, see . #include #include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - #include #include "audioequalizer.h" @@ -171,19 +160,13 @@ EffectFactory::EffectData EffectFactory::getData() OutputStreamFactory streamFactory; QScopedPointer stream(streamFactory.create()); - typedef typename BackendNode::NativeEffect NativeEffect; - QScopedPointer effect; - TRAPD(err, effect.reset(NativeEffect::NewL(*stream))); - data.m_supported = (KErrNone == err); - - if (KErrNone == err) { + if (data.m_supported = BackendNode::getParameters + (stream.data(), data.m_parameters)) { const QString description = QCoreApplication::translate ("Phonon::MMF::EffectFactory", BackendNode::description()); data.m_descriptions.insert("name", description); data.m_descriptions.insert("description", description); data.m_descriptions.insert("available", true); - - BackendNode::getParameters(effect.data(), data.m_parameters); } return data; -- cgit v0.12 From a6592a167c2c4d2714d701e49d332217749124f4 Mon Sep 17 00:00:00 2001 From: Ritt Konstantin Date: Mon, 11 Jan 2010 16:48:11 +0100 Subject: typo fix Merge-request: 2077 Reviewed-by: Thiago Macieira --- src/gui/itemviews/qtreeview.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/itemviews/qtreeview.cpp b/src/gui/itemviews/qtreeview.cpp index e9643aa..efb8422 100644 --- a/src/gui/itemviews/qtreeview.cpp +++ b/src/gui/itemviews/qtreeview.cpp @@ -178,7 +178,7 @@ QT_BEGIN_NAMESPACE */ /*! - Constructs a table view with a \a parent to represent a model's + Constructs a tree view with a \a parent to represent a model's data. Use setModel() to set the model. \sa QAbstractItemModel -- cgit v0.12 From 1a7234e3a27b592565241e9044919f7842fc5f08 Mon Sep 17 00:00:00 2001 From: Gareth Stockwell Date: Mon, 11 Jan 2010 15:50:19 +0000 Subject: Added a macro to reduce boilerplate code in Phonon MMF backend Task-number: QTBUG-4659 Reviewed-by: Espen Riskedal --- src/3rdparty/phonon/mmf/abstractaudioeffect.h | 19 +++++++++++++++++++ src/3rdparty/phonon/mmf/audioequalizer.cpp | 15 +++++---------- src/3rdparty/phonon/mmf/audioequalizer.h | 3 +++ src/3rdparty/phonon/mmf/bassboost.cpp | 10 +++------- src/3rdparty/phonon/mmf/bassboost.h | 5 +++++ 5 files changed, 35 insertions(+), 17 deletions(-) diff --git a/src/3rdparty/phonon/mmf/abstractaudioeffect.h b/src/3rdparty/phonon/mmf/abstractaudioeffect.h index 9e5a6eb..b34ad0d 100644 --- a/src/3rdparty/phonon/mmf/abstractaudioeffect.h +++ b/src/3rdparty/phonon/mmf/abstractaudioeffect.h @@ -103,6 +103,25 @@ private: } } + +// Macro for defining functions which depend on the native class name +// for each of the effects. Using this reduces repetition of boilerplate +// in the implementations of the backend effect nodes. + +#define PHONON_MMF_DEFINE_EFFECT_FUNCTIONS(Effect) \ + \ +void Effect##::createEffect(AudioPlayer::NativePlayer *player) \ +{ \ + C##Effect *ptr = 0; \ + QT_TRAP_THROWING(ptr = C##Effect::NewL(*player)); \ + m_effect.reset(ptr); \ +} \ + \ +C##Effect* Effect::concreteEffect() \ +{ \ + return static_cast(m_effect.data()); \ +} + QT_END_NAMESPACE #endif diff --git a/src/3rdparty/phonon/mmf/audioequalizer.cpp b/src/3rdparty/phonon/mmf/audioequalizer.cpp index a4127c4..ab95f30 100644 --- a/src/3rdparty/phonon/mmf/audioequalizer.cpp +++ b/src/3rdparty/phonon/mmf/audioequalizer.cpp @@ -28,7 +28,10 @@ using namespace Phonon::MMF; \internal */ -AudioEqualizer::AudioEqualizer(QObject *parent, const QList ¶meters) +// Define functions which depend on concrete native effect class name +PHONON_MMF_DEFINE_EFFECT_FUNCTIONS(AudioEqualizer) + +AudioEqualizer::AudioEqualizer(QObject *parent, const QList& parameters) : AbstractAudioEffect::AbstractAudioEffect(parent, parameters) { @@ -44,13 +47,6 @@ void AudioEqualizer::parameterChanged(const int pid, } } -void AudioEqualizer::createEffect(AudioPlayer::NativePlayer *player) -{ - CAudioEqualizer *ptr = 0; - QT_TRAP_THROWING(ptr = CAudioEqualizer::NewL(*player)); - m_effect.reset(ptr); -} - void AudioEqualizer::applyParameters() { if (m_effect.data()) { @@ -68,9 +64,8 @@ void AudioEqualizer::setBandLevel(int band, qreal externalLevel) const EffectParameter ¶m = m_params[band-1]; // Band IDs are 1-based const int internalLevel = param.toInternalValue(externalLevel); - CAudioEqualizer *const effect = static_cast(m_effect.data()); // TODO: handle audio effect errors - TRAP_IGNORE(effect->SetBandLevelL(band, internalLevel)); + TRAP_IGNORE(concreteEffect()->SetBandLevelL(band, internalLevel)); } //----------------------------------------------------------------------------- diff --git a/src/3rdparty/phonon/mmf/audioequalizer.h b/src/3rdparty/phonon/mmf/audioequalizer.h index 35592f4..9eda994 100644 --- a/src/3rdparty/phonon/mmf/audioequalizer.h +++ b/src/3rdparty/phonon/mmf/audioequalizer.h @@ -21,6 +21,8 @@ along with this library. If not, see . #include "abstractaudioeffect.h" +class CAudioEqualizer; + QT_BEGIN_NAMESPACE namespace Phonon @@ -54,6 +56,7 @@ protected: private: void setBandLevel(int band, qreal externalLevel); + CAudioEqualizer *concreteEffect(); }; } diff --git a/src/3rdparty/phonon/mmf/bassboost.cpp b/src/3rdparty/phonon/mmf/bassboost.cpp index 642d782..c8c4831 100644 --- a/src/3rdparty/phonon/mmf/bassboost.cpp +++ b/src/3rdparty/phonon/mmf/bassboost.cpp @@ -24,6 +24,9 @@ QT_BEGIN_NAMESPACE using namespace Phonon; using namespace Phonon::MMF; +// Define functions which depend on concrete native effect class name +PHONON_MMF_DEFINE_EFFECT_FUNCTIONS(BassBoost) + /*! \class MMF::BassBoost \internal */ @@ -40,13 +43,6 @@ void BassBoost::parameterChanged(const int, Q_ASSERT_X(false, Q_FUNC_INFO, "BassBoost has no parameters"); } -void BassBoost::createEffect(AudioPlayer::NativePlayer *player) -{ - CBassBoost *ptr = 0; - QT_TRAP_THROWING(ptr = CBassBoost::NewL(*player)); - m_effect.reset(ptr); -} - void BassBoost::applyParameters() { // No parameters to apply diff --git a/src/3rdparty/phonon/mmf/bassboost.h b/src/3rdparty/phonon/mmf/bassboost.h index 241cda9..d3cda34 100644 --- a/src/3rdparty/phonon/mmf/bassboost.h +++ b/src/3rdparty/phonon/mmf/bassboost.h @@ -21,6 +21,8 @@ along with this library. If not, see . #include "abstractaudioeffect.h" +class CBassBoost; + QT_BEGIN_NAMESPACE namespace Phonon @@ -50,6 +52,9 @@ protected: virtual void applyParameters(); virtual void parameterChanged(const int id, const QVariant &value); +private: + CBassBoost *concreteEffect(); + }; } } -- cgit v0.12 From f10a3a1008c2ccbfbdf7f3e0cfe6af34c8a7db9c Mon Sep 17 00:00:00 2001 From: Jani Hautakangas Date: Mon, 11 Jan 2010 17:52:31 +0200 Subject: Fix for QTBUG-7267 Qs60Style::drawControl() does not align CE_ItemViewItem control element correctly if given widget is null. Uses now alignment hint value given in style option. Task-number: QTBUG-7267 Reviewed-by: Janne Koskinen --- src/gui/styles/qs60style.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/styles/qs60style.cpp b/src/gui/styles/qs60style.cpp index bcc993a..d78ea21 100644 --- a/src/gui/styles/qs60style.cpp +++ b/src/gui/styles/qs60style.cpp @@ -1363,7 +1363,7 @@ void QS60Style::drawControl(ControlElement element, const QStyleOption *option, } } - int rightValue = widget ? widget->contentsRect().right() : 0; + int rightValue = widget ? widget->contentsRect().right() : voptAdj.rect.right(); if (isScrollBarVisible) rightValue -= scrollBarWidth; -- cgit v0.12 From aefcf35b4e4dd62771b9fe531c84d35e13f2c660 Mon Sep 17 00:00:00 2001 From: Gareth Stockwell Date: Tue, 8 Dec 2009 18:26:17 +0000 Subject: Removed unnecessary check in Phonon MMF backend This pointer is guaranteed not to be null by the check in AbstractAudioEffect::setParameterValue. Task-number: QTBUG-4659 Reviewed-by: trustme --- src/3rdparty/phonon/mmf/audioequalizer.cpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/3rdparty/phonon/mmf/audioequalizer.cpp b/src/3rdparty/phonon/mmf/audioequalizer.cpp index ab95f30..e3b1ab3 100644 --- a/src/3rdparty/phonon/mmf/audioequalizer.cpp +++ b/src/3rdparty/phonon/mmf/audioequalizer.cpp @@ -40,11 +40,9 @@ AudioEqualizer::AudioEqualizer(QObject *parent, const QList& pa void AudioEqualizer::parameterChanged(const int pid, const QVariant &value) { - if (m_effect.data()) { - const int band = pid; - const qreal level = value.toReal(); - setBandLevel(band, level); - } + const int band = pid; + const qreal level = value.toReal(); + setBandLevel(band, level); } void AudioEqualizer::applyParameters() -- cgit v0.12 From 99acb8f8e53767e59a5634609b0d3582ae5b0d7c Mon Sep 17 00:00:00 2001 From: Gareth Stockwell Date: Mon, 11 Jan 2010 16:05:17 +0000 Subject: Refactored AbstractAudioEffect to reduce redundancy in derived classes Task-number: QTBUG-4659 Reviewed-by: Espen Riskedal --- src/3rdparty/phonon/mmf/abstractaudioeffect.cpp | 21 +++++++++++++-- src/3rdparty/phonon/mmf/abstractaudioeffect.h | 6 ++--- src/3rdparty/phonon/mmf/audioequalizer.cpp | 35 +++++++------------------ src/3rdparty/phonon/mmf/audioequalizer.h | 5 ++-- src/3rdparty/phonon/mmf/bassboost.cpp | 7 +---- src/3rdparty/phonon/mmf/bassboost.h | 4 +-- 6 files changed, 37 insertions(+), 41 deletions(-) diff --git a/src/3rdparty/phonon/mmf/abstractaudioeffect.cpp b/src/3rdparty/phonon/mmf/abstractaudioeffect.cpp index cdddf02..3bce86b 100644 --- a/src/3rdparty/phonon/mmf/abstractaudioeffect.cpp +++ b/src/3rdparty/phonon/mmf/abstractaudioeffect.cpp @@ -70,7 +70,8 @@ void AbstractAudioEffect::setParameterValue(const Phonon::EffectParameter ¶m m_values.insert(param.id(), newValue); if (m_effect.data()) { - parameterChanged(param.id(), newValue); + const EffectParameter& internalParam = internalParameter(param.id()); + parameterChanged(internalParam, newValue); // TODO: handle audio effect errors TRAP_IGNORE(m_effect->ApplyL()); } @@ -122,11 +123,27 @@ void AbstractAudioEffect::createEffect() } if (m_effect.data()) { - applyParameters(); + EffectParameter param; + foreach (param, m_params) { + const QVariant value = parameterValue(param); + parameterChanged(param, value); + } + // TODO: handle audio effect errors TRAP_IGNORE(m_effect->EnableL()); } } +const MMF::EffectParameter& AbstractAudioEffect::internalParameter(int id) const +{ + const EffectParameter *result = 0; + for (int i=0; i m_effect; - const QList m_params; private: + const QList m_params; AbstractMediaPlayer * m_player; QHash m_values; }; diff --git a/src/3rdparty/phonon/mmf/audioequalizer.cpp b/src/3rdparty/phonon/mmf/audioequalizer.cpp index e3b1ab3..1584cf7 100644 --- a/src/3rdparty/phonon/mmf/audioequalizer.cpp +++ b/src/3rdparty/phonon/mmf/audioequalizer.cpp @@ -37,35 +37,18 @@ AudioEqualizer::AudioEqualizer(QObject *parent, const QList& pa } -void AudioEqualizer::parameterChanged(const int pid, +void AudioEqualizer::parameterChanged(const EffectParameter ¶m, const QVariant &value) { - const int band = pid; - const qreal level = value.toReal(); - setBandLevel(band, level); -} - -void AudioEqualizer::applyParameters() -{ - if (m_effect.data()) { - Phonon::EffectParameter param; - foreach (param, parameters()) { - const int band = param.id(); - const qreal level = parameterValue(param).toReal(); - setBandLevel(band, level); - } - } -} - -void AudioEqualizer::setBandLevel(int band, qreal externalLevel) -{ - const EffectParameter ¶m = m_params[band-1]; // Band IDs are 1-based + const int band = param.id() + 1; + const qreal externalLevel = value.toReal(); const int internalLevel = param.toInternalValue(externalLevel); // TODO: handle audio effect errors TRAP_IGNORE(concreteEffect()->SetBandLevelL(band, internalLevel)); } + //----------------------------------------------------------------------------- // Static functions //----------------------------------------------------------------------------- @@ -92,10 +75,12 @@ bool AudioEqualizer::getParameters(CMdaAudioOutputStream *stream, const int bandCount = effect->NumberOfBands(); - // For some reason, band IDs are 1-based, as opposed to the - // 0-based indices used in just about other Symbian API...! - for (int i = 1; i <= bandCount; ++i) { - const qint32 hz = effect->CenterFrequency(i); + for (int i = 0; i < bandCount; ++i) { + // For some reason, band IDs are 1-based, as opposed to the + // 0-based indices used in just about other Symbian API...! + const int band = i + 1; + + const qint32 hz = effect->CenterFrequency(band); // We pass a floating-point parameter range of -1.0 to +1.0 for // each band in order to work around a limitation in diff --git a/src/3rdparty/phonon/mmf/audioequalizer.h b/src/3rdparty/phonon/mmf/audioequalizer.h index 9eda994..3a9a5ca 100644 --- a/src/3rdparty/phonon/mmf/audioequalizer.h +++ b/src/3rdparty/phonon/mmf/audioequalizer.h @@ -51,11 +51,10 @@ public: protected: // AbstractAudioEffect virtual void createEffect(AudioPlayer::NativePlayer *player); - virtual void applyParameters(); - virtual void parameterChanged(const int id, const QVariant &value); + virtual void parameterChanged(const EffectParameter ¶m, + const QVariant &value); private: - void setBandLevel(int band, qreal externalLevel); CAudioEqualizer *concreteEffect(); }; diff --git a/src/3rdparty/phonon/mmf/bassboost.cpp b/src/3rdparty/phonon/mmf/bassboost.cpp index c8c4831..997bae4 100644 --- a/src/3rdparty/phonon/mmf/bassboost.cpp +++ b/src/3rdparty/phonon/mmf/bassboost.cpp @@ -37,17 +37,12 @@ BassBoost::BassBoost(QObject *parent, const QList ¶meters) } -void BassBoost::parameterChanged(const int, +void BassBoost::parameterChanged(const EffectParameter &, const QVariant &) { Q_ASSERT_X(false, Q_FUNC_INFO, "BassBoost has no parameters"); } -void BassBoost::applyParameters() -{ - // No parameters to apply -} - //----------------------------------------------------------------------------- // Static functions //----------------------------------------------------------------------------- diff --git a/src/3rdparty/phonon/mmf/bassboost.h b/src/3rdparty/phonon/mmf/bassboost.h index d3cda34..b2bc854 100644 --- a/src/3rdparty/phonon/mmf/bassboost.h +++ b/src/3rdparty/phonon/mmf/bassboost.h @@ -49,8 +49,8 @@ public: protected: // AbstractAudioEffect virtual void createEffect(AudioPlayer::NativePlayer *player); - virtual void applyParameters(); - virtual void parameterChanged(const int id, const QVariant &value); + virtual void parameterChanged(const EffectParameter ¶m, + const QVariant &value); private: CBassBoost *concreteEffect(); -- cgit v0.12 From edbbbe81675e1b9792f43232963c399ff2fffbd6 Mon Sep 17 00:00:00 2001 From: Gareth Stockwell Date: Mon, 11 Jan 2010 16:13:10 +0000 Subject: Implemented bass boost in Phonon MMF backend Task-number: QTBUG-4659 Reviewed-by: Espen Riskedal --- src/3rdparty/phonon/mmf/abstractaudioeffect.cpp | 12 ++++++++++ src/3rdparty/phonon/mmf/abstractaudioeffect.h | 2 ++ src/3rdparty/phonon/mmf/bassboost.cpp | 29 ++++++++++++++++++++----- src/3rdparty/phonon/mmf/bassboost.h | 5 +---- src/3rdparty/phonon/mmf/effectfactory.cpp | 5 +++-- 5 files changed, 42 insertions(+), 11 deletions(-) diff --git a/src/3rdparty/phonon/mmf/abstractaudioeffect.cpp b/src/3rdparty/phonon/mmf/abstractaudioeffect.cpp index 3bce86b..593e00f 100644 --- a/src/3rdparty/phonon/mmf/abstractaudioeffect.cpp +++ b/src/3rdparty/phonon/mmf/abstractaudioeffect.cpp @@ -114,6 +114,16 @@ void AbstractAudioEffect::disconnectMediaObject(MediaObject *mediaObject) abstractPlayerChanged(0); } +void AbstractAudioEffect::setEnabled(bool enabled) +{ + if (enabled) + // TODO: handle audio effect errors + TRAP_IGNORE(m_effect->EnableL()) + else + // TODO: handle audio effect errors + TRAP_IGNORE(m_effect->DisableL()) +} + void AbstractAudioEffect::createEffect() { Q_ASSERT_X(m_player, Q_FUNC_INFO, "Invalid media player pointer"); @@ -131,6 +141,8 @@ void AbstractAudioEffect::createEffect() // TODO: handle audio effect errors TRAP_IGNORE(m_effect->EnableL()); + + setEnabled(true); } } diff --git a/src/3rdparty/phonon/mmf/abstractaudioeffect.h b/src/3rdparty/phonon/mmf/abstractaudioeffect.h index 9b9c47d..57427e7 100644 --- a/src/3rdparty/phonon/mmf/abstractaudioeffect.h +++ b/src/3rdparty/phonon/mmf/abstractaudioeffect.h @@ -82,6 +82,8 @@ protected: void connectMediaObject(MediaObject *mediaObject); void disconnectMediaObject(MediaObject *mediaObject); + void setEnabled(bool enabled); + virtual void createEffect(AudioPlayer::NativePlayer *player) = 0; virtual void parameterChanged(const EffectParameter ¶m, diff --git a/src/3rdparty/phonon/mmf/bassboost.cpp b/src/3rdparty/phonon/mmf/bassboost.cpp index 997bae4..a8631e0 100644 --- a/src/3rdparty/phonon/mmf/bassboost.cpp +++ b/src/3rdparty/phonon/mmf/bassboost.cpp @@ -37,10 +37,11 @@ BassBoost::BassBoost(QObject *parent, const QList ¶meters) } -void BassBoost::parameterChanged(const EffectParameter &, - const QVariant &) +void BassBoost::parameterChanged(const EffectParameter ¶m, + const QVariant &value) { - Q_ASSERT_X(false, Q_FUNC_INFO, "BassBoost has no parameters"); + Q_ASSERT_X(param.id() == 0, Q_FUNC_INFO, "Invalid parameter ID"); + setEnabled(value.toBool()); } //----------------------------------------------------------------------------- @@ -52,9 +53,27 @@ const char* BassBoost::description() return "Bass boost"; } -bool BassBoost::getParameters(CMdaAudioOutputStream *, QList&) +bool BassBoost::getParameters(CMdaAudioOutputStream *stream, + QList ¶meters) { - return true; + bool supported = false; + + QScopedPointer effect; + TRAPD(err, effect.reset(CBassBoost::NewL(*stream))); + + if(KErrNone == err) { + supported = true; + + EffectParameter param( + /* parameterId */ 0, + /* name */ tr("Enabled"), + /* hints */ EffectParameter::ToggledHint, + /* defaultValue */ QVariant(bool(true))); + + parameters.append(param); + } + + return supported; } QT_END_NAMESPACE diff --git a/src/3rdparty/phonon/mmf/bassboost.h b/src/3rdparty/phonon/mmf/bassboost.h index b2bc854..82a3bab 100644 --- a/src/3rdparty/phonon/mmf/bassboost.h +++ b/src/3rdparty/phonon/mmf/bassboost.h @@ -30,10 +30,7 @@ namespace Phonon namespace MMF { /** - * @short An "bass boost" effect. - * - * The documentation does not say what "bass boost" is, neither has it anykind - * of setting. It's an on or off thing. + * @short A "bass boost" effect. */ class BassBoost : public AbstractAudioEffect { diff --git a/src/3rdparty/phonon/mmf/effectfactory.cpp b/src/3rdparty/phonon/mmf/effectfactory.cpp index 19c6d90..c6593bb 100644 --- a/src/3rdparty/phonon/mmf/effectfactory.cpp +++ b/src/3rdparty/phonon/mmf/effectfactory.cpp @@ -68,15 +68,16 @@ AbstractAudioEffect *EffectFactory::createAudioEffect(Type type, { case TypeBassBoost: effect = new BassBoost(parent, parameters); + break; case TypeAudioEqualizer: effect = new AudioEqualizer(parent, parameters); + break; case TypeDistanceAttenuation: case TypeEnvironmentalReverb: case TypeListenerOrientation: case TypeLoudness: case TypeSourceOrientation: case TypeStereoWidening: - break; default: Q_ASSERT_X(false, Q_FUNC_INFO, "Unknown effect"); } @@ -124,7 +125,7 @@ void EffectFactory::initialize() Q_ASSERT_X(!m_initialized, Q_FUNC_INFO, "Already initialized"); INITIALIZE_EFFECT(AudioEqualizer) - //INITIALIZE_EFFECT(BassBoost) + INITIALIZE_EFFECT(BassBoost) m_initialized = true; } -- cgit v0.12 From 14412557e7523ca39698ca4f4aa40ebe9c051d77 Mon Sep 17 00:00:00 2001 From: Markus Goetz Date: Mon, 11 Jan 2010 16:09:12 +0100 Subject: QNAM HTTP Code: When starting new request, prefer connected sockets. Prefer a QHttpNetworkConnectionChannel which has a connected socket to a channel which doesn't have a connected socket. Reviewed-by: Peter Hartmann --- src/network/access/qhttpnetworkconnection.cpp | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/src/network/access/qhttpnetworkconnection.cpp b/src/network/access/qhttpnetworkconnection.cpp index b7dbeac..20baac8 100644 --- a/src/network/access/qhttpnetworkconnection.cpp +++ b/src/network/access/qhttpnetworkconnection.cpp @@ -691,19 +691,31 @@ void QHttpNetworkConnectionPrivate::_q_startNextRequest() channels[i].sendRequest(); } } + + // dequeue new ones + QAbstractSocket *socket = 0; for (int i = 0; i < channelCount; ++i) { QAbstractSocket *chSocket = channels[i].socket; - // send the request using the idle socket - if (!channels[i].isSocketBusy()) { + // try to get a free AND connected socket + if (!channels[i].isSocketBusy() && channels[i].socket->state() == QAbstractSocket::ConnectedState) { socket = chSocket; + dequeueAndSendRequest(socket); break; } } - // this socket is free, - if (socket) - dequeueAndSendRequest(socket); + if (!socket) { + for (int i = 0; i < channelCount; ++i) { + QAbstractSocket *chSocket = channels[i].socket; + // try to get a free unconnected socket + if (!channels[i].isSocketBusy()) { + socket = chSocket; + dequeueAndSendRequest(socket); + break; + } + } + } // try to push more into all sockets // ### FIXME we should move this to the beginning of the function -- cgit v0.12 From 8798b36880d1387d2d27f7fb35ccbf02af6232a0 Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Mon, 11 Jan 2010 17:48:23 +0100 Subject: fix release mode crash in qfont.cpp initFontSubst() on Windows mobile Since we've disabled LTCG for Windows CE by default, the code in initFontSubst() crashes on Windows mobile. Adding the extra const solves this problem. Task-number: QTBUG-6641 Reviewed-by: ossi --- src/gui/text/qfont.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/gui/text/qfont.cpp b/src/gui/text/qfont.cpp index f1cd6bb..b414263 100644 --- a/src/gui/text/qfont.cpp +++ b/src/gui/text/qfont.cpp @@ -1780,7 +1780,7 @@ Q_GLOBAL_STATIC(QFontSubst, globalFontSubst) static void initFontSubst() { // default substitutions - static const char *initTbl[] = { + static const char * const initTbl[] = { #if defined(Q_WS_X11) "arial", "helvetica", @@ -1812,7 +1812,6 @@ static void initFontSubst() } } - /*! Returns the first family name to be used whenever \a familyName is specified. The lookup is case insensitive. -- cgit v0.12 From c69b85ebf532bf7daf0644f4b3d0b2a6c19ace1d Mon Sep 17 00:00:00 2001 From: Markus Goetz Date: Mon, 11 Jan 2010 17:49:02 +0100 Subject: tst_qhttpnetworkconnection: Relax condition in getMultipleWithPriorities Test failed in 1 out of 5 cases. Relax the condition. It is not that bad if some (max connection count + 1) low priority requests finish first. Reviewed-by: Peter Hartmann --- tests/auto/qhttpnetworkconnection/tst_qhttpnetworkconnection.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/auto/qhttpnetworkconnection/tst_qhttpnetworkconnection.cpp b/tests/auto/qhttpnetworkconnection/tst_qhttpnetworkconnection.cpp index 6fa09d5..cafbc2c 100644 --- a/tests/auto/qhttpnetworkconnection/tst_qhttpnetworkconnection.cpp +++ b/tests/auto/qhttpnetworkconnection/tst_qhttpnetworkconnection.cpp @@ -939,7 +939,7 @@ public Q_SLOTS: else QFAIL("Wrong priority!?"); - QVERIFY(highPrioReceived >= lowPrioReceived); + QVERIFY(highPrioReceived + 7 >= lowPrioReceived); if (highPrioReceived + lowPrioReceived == requestCount) QTestEventLoop::instance().exitLoop(); -- cgit v0.12 From 1b1aab443117f818914ed2434a5ea7a1002d4cc9 Mon Sep 17 00:00:00 2001 From: Markus Goetz Date: Mon, 11 Jan 2010 17:58:52 +0100 Subject: tst_qhttpnetworkconnection: Test also HEAD in some tests Reviewed-by: TrustMe --- .../qhttpnetworkconnection/tst_qhttpnetworkconnection.cpp | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/tests/auto/qhttpnetworkconnection/tst_qhttpnetworkconnection.cpp b/tests/auto/qhttpnetworkconnection/tst_qhttpnetworkconnection.cpp index cafbc2c..f27f469 100644 --- a/tests/auto/qhttpnetworkconnection/tst_qhttpnetworkconnection.cpp +++ b/tests/auto/qhttpnetworkconnection/tst_qhttpnetworkconnection.cpp @@ -866,8 +866,11 @@ void tst_QHttpNetworkConnection::getMultipleWithPipeliningAndMultiplePriorities( QList replies; for (int i = 0; i < requestCount; i++) { - - QHttpNetworkRequest *request = new QHttpNetworkRequest("http://" + QtNetworkSettings::serverName() + "/qtest/rfc3252.txt"); + QHttpNetworkRequest *request = 0; + if (i % 3) + request = new QHttpNetworkRequest("http://" + QtNetworkSettings::serverName() + "/qtest/rfc3252.txt", QHttpNetworkRequest::Get); + else + request = new QHttpNetworkRequest("http://" + QtNetworkSettings::serverName() + "/qtest/rfc3252.txt", QHttpNetworkRequest::Head); if (i % 2 || i % 3) request->setPipeliningAllowed(true); @@ -957,7 +960,11 @@ void tst_QHttpNetworkConnection::getMultipleWithPriorities() QList replies; for (int i = 0; i < requestCount; i++) { - QHttpNetworkRequest *request = new QHttpNetworkRequest(url);; + QHttpNetworkRequest *request = 0; + if (i % 3) + request = new QHttpNetworkRequest(url, QHttpNetworkRequest::Get); + else + request = new QHttpNetworkRequest(url, QHttpNetworkRequest::Head); if (i % 2) request->setPriority(QHttpNetworkRequest::HighPriority); -- cgit v0.12 From dd68d100e08a6e58fce1d15a5f6db5f054bafd31 Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Mon, 11 Jan 2010 18:04:34 +0100 Subject: warning fixes for platforms, where qreal == float Reviewed-by: thartman --- src/corelib/kernel/qmath.cpp | 512 +++++++++++++++++++++---------------------- 1 file changed, 256 insertions(+), 256 deletions(-) diff --git a/src/corelib/kernel/qmath.cpp b/src/corelib/kernel/qmath.cpp index 7c1e726..efa064d 100644 --- a/src/corelib/kernel/qmath.cpp +++ b/src/corelib/kernel/qmath.cpp @@ -44,262 +44,262 @@ QT_BEGIN_NAMESPACE const qreal qt_sine_table[QT_SINE_TABLE_SIZE] = { - 0.0, - 0.024541228522912288, - 0.049067674327418015, - 0.073564563599667426, - 0.098017140329560604, - 0.1224106751992162, - 0.14673047445536175, - 0.17096188876030122, - 0.19509032201612825, - 0.2191012401568698, - 0.24298017990326387, - 0.26671275747489837, - 0.29028467725446233, - 0.31368174039889152, - 0.33688985339222005, - 0.35989503653498811, - 0.38268343236508978, - 0.40524131400498986, - 0.42755509343028208, - 0.44961132965460654, - 0.47139673682599764, - 0.49289819222978404, - 0.51410274419322166, - 0.53499761988709715, - 0.55557023301960218, - 0.57580819141784534, - 0.59569930449243336, - 0.61523159058062682, - 0.63439328416364549, - 0.65317284295377676, - 0.67155895484701833, - 0.68954054473706683, - 0.70710678118654746, - 0.72424708295146689, - 0.74095112535495911, - 0.75720884650648446, - 0.77301045336273699, - 0.78834642762660623, - 0.80320753148064483, - 0.81758481315158371, - 0.83146961230254524, - 0.84485356524970701, - 0.85772861000027212, - 0.87008699110871135, - 0.88192126434835494, - 0.89322430119551532, - 0.90398929312344334, - 0.91420975570353069, - 0.92387953251128674, - 0.93299279883473885, - 0.94154406518302081, - 0.94952818059303667, - 0.95694033573220894, - 0.96377606579543984, - 0.97003125319454397, - 0.97570213003852857, - 0.98078528040323043, - 0.98527764238894122, - 0.98917650996478101, - 0.99247953459870997, - 0.99518472667219682, - 0.99729045667869021, - 0.99879545620517241, - 0.99969881869620425, - 1.0, - 0.99969881869620425, - 0.99879545620517241, - 0.99729045667869021, - 0.99518472667219693, - 0.99247953459870997, - 0.98917650996478101, - 0.98527764238894122, - 0.98078528040323043, - 0.97570213003852857, - 0.97003125319454397, - 0.96377606579543984, - 0.95694033573220894, - 0.94952818059303667, - 0.94154406518302081, - 0.93299279883473885, - 0.92387953251128674, - 0.91420975570353069, - 0.90398929312344345, - 0.89322430119551521, - 0.88192126434835505, - 0.87008699110871146, - 0.85772861000027212, - 0.84485356524970723, - 0.83146961230254546, - 0.81758481315158371, - 0.80320753148064494, - 0.78834642762660634, - 0.7730104533627371, - 0.75720884650648468, - 0.74095112535495899, - 0.72424708295146689, - 0.70710678118654757, - 0.68954054473706705, - 0.67155895484701855, - 0.65317284295377664, - 0.63439328416364549, - 0.61523159058062693, - 0.59569930449243347, - 0.57580819141784545, - 0.55557023301960218, - 0.53499761988709715, - 0.51410274419322177, - 0.49289819222978415, - 0.47139673682599786, - 0.44961132965460687, - 0.42755509343028203, - 0.40524131400498992, - 0.38268343236508989, - 0.35989503653498833, - 0.33688985339222033, - 0.31368174039889141, - 0.29028467725446239, - 0.26671275747489848, - 0.24298017990326407, - 0.21910124015687005, - 0.19509032201612861, - 0.17096188876030122, - 0.1467304744553618, - 0.12241067519921635, - 0.098017140329560826, - 0.073564563599667732, - 0.049067674327417966, - 0.024541228522912326, - 0.0, - -0.02454122852291208, - -0.049067674327417724, - -0.073564563599667496, - -0.09801714032956059, - -0.1224106751992161, - -0.14673047445536158, - -0.17096188876030097, - -0.19509032201612836, - -0.2191012401568698, - -0.24298017990326382, - -0.26671275747489825, - -0.29028467725446211, - -0.31368174039889118, - -0.33688985339222011, - -0.35989503653498811, - -0.38268343236508967, - -0.40524131400498969, - -0.42755509343028181, - -0.44961132965460665, - -0.47139673682599764, - -0.49289819222978393, - -0.51410274419322155, - -0.53499761988709693, - -0.55557023301960196, - -0.57580819141784534, - -0.59569930449243325, - -0.61523159058062671, - -0.63439328416364527, - -0.65317284295377653, - -0.67155895484701844, - -0.68954054473706683, - -0.70710678118654746, - -0.72424708295146678, - -0.74095112535495888, - -0.75720884650648423, - -0.77301045336273666, - -0.78834642762660589, - -0.80320753148064505, - -0.81758481315158382, - -0.83146961230254524, - -0.84485356524970701, - -0.85772861000027201, - -0.87008699110871135, - -0.88192126434835494, - -0.89322430119551521, - -0.90398929312344312, - -0.91420975570353047, - -0.92387953251128652, - -0.93299279883473896, - -0.94154406518302081, - -0.94952818059303667, - -0.95694033573220882, - -0.96377606579543984, - -0.97003125319454397, - -0.97570213003852846, - -0.98078528040323032, - -0.98527764238894111, - -0.9891765099647809, - -0.99247953459871008, - -0.99518472667219693, - -0.99729045667869021, - -0.99879545620517241, - -0.99969881869620425, - -1.0, - -0.99969881869620425, - -0.99879545620517241, - -0.99729045667869021, - -0.99518472667219693, - -0.99247953459871008, - -0.9891765099647809, - -0.98527764238894122, - -0.98078528040323043, - -0.97570213003852857, - -0.97003125319454397, - -0.96377606579543995, - -0.95694033573220894, - -0.94952818059303679, - -0.94154406518302092, - -0.93299279883473907, - -0.92387953251128663, - -0.91420975570353058, - -0.90398929312344334, - -0.89322430119551532, - -0.88192126434835505, - -0.87008699110871146, - -0.85772861000027223, - -0.84485356524970723, - -0.83146961230254546, - -0.81758481315158404, - -0.80320753148064528, - -0.78834642762660612, - -0.77301045336273688, - -0.75720884650648457, - -0.74095112535495911, - -0.724247082951467, - -0.70710678118654768, - -0.68954054473706716, - -0.67155895484701866, - -0.65317284295377709, - -0.63439328416364593, - -0.61523159058062737, - -0.59569930449243325, - -0.57580819141784523, - -0.55557023301960218, - -0.53499761988709726, - -0.51410274419322188, - -0.49289819222978426, - -0.47139673682599792, - -0.44961132965460698, - -0.42755509343028253, - -0.40524131400499042, - -0.38268343236509039, - -0.359895036534988, - -0.33688985339222, - -0.31368174039889152, - -0.2902846772544625, - -0.26671275747489859, - -0.24298017990326418, - -0.21910124015687016, - -0.19509032201612872, - -0.17096188876030177, - -0.14673047445536239, - -0.12241067519921603, - -0.098017140329560506, - -0.073564563599667412, - -0.049067674327418091, - -0.024541228522912448 + qreal(0.0), + qreal(0.024541228522912288), + qreal(0.049067674327418015), + qreal(0.073564563599667426), + qreal(0.098017140329560604), + qreal(0.1224106751992162), + qreal(0.14673047445536175), + qreal(0.17096188876030122), + qreal(0.19509032201612825), + qreal(0.2191012401568698), + qreal(0.24298017990326387), + qreal(0.26671275747489837), + qreal(0.29028467725446233), + qreal(0.31368174039889152), + qreal(0.33688985339222005), + qreal(0.35989503653498811), + qreal(0.38268343236508978), + qreal(0.40524131400498986), + qreal(0.42755509343028208), + qreal(0.44961132965460654), + qreal(0.47139673682599764), + qreal(0.49289819222978404), + qreal(0.51410274419322166), + qreal(0.53499761988709715), + qreal(0.55557023301960218), + qreal(0.57580819141784534), + qreal(0.59569930449243336), + qreal(0.61523159058062682), + qreal(0.63439328416364549), + qreal(0.65317284295377676), + qreal(0.67155895484701833), + qreal(0.68954054473706683), + qreal(0.70710678118654746), + qreal(0.72424708295146689), + qreal(0.74095112535495911), + qreal(0.75720884650648446), + qreal(0.77301045336273699), + qreal(0.78834642762660623), + qreal(0.80320753148064483), + qreal(0.81758481315158371), + qreal(0.83146961230254524), + qreal(0.84485356524970701), + qreal(0.85772861000027212), + qreal(0.87008699110871135), + qreal(0.88192126434835494), + qreal(0.89322430119551532), + qreal(0.90398929312344334), + qreal(0.91420975570353069), + qreal(0.92387953251128674), + qreal(0.93299279883473885), + qreal(0.94154406518302081), + qreal(0.94952818059303667), + qreal(0.95694033573220894), + qreal(0.96377606579543984), + qreal(0.97003125319454397), + qreal(0.97570213003852857), + qreal(0.98078528040323043), + qreal(0.98527764238894122), + qreal(0.98917650996478101), + qreal(0.99247953459870997), + qreal(0.99518472667219682), + qreal(0.99729045667869021), + qreal(0.99879545620517241), + qreal(0.99969881869620425), + qreal(1.0), + qreal(0.99969881869620425), + qreal(0.99879545620517241), + qreal(0.99729045667869021), + qreal(0.99518472667219693), + qreal(0.99247953459870997), + qreal(0.98917650996478101), + qreal(0.98527764238894122), + qreal(0.98078528040323043), + qreal(0.97570213003852857), + qreal(0.97003125319454397), + qreal(0.96377606579543984), + qreal(0.95694033573220894), + qreal(0.94952818059303667), + qreal(0.94154406518302081), + qreal(0.93299279883473885), + qreal(0.92387953251128674), + qreal(0.91420975570353069), + qreal(0.90398929312344345), + qreal(0.89322430119551521), + qreal(0.88192126434835505), + qreal(0.87008699110871146), + qreal(0.85772861000027212), + qreal(0.84485356524970723), + qreal(0.83146961230254546), + qreal(0.81758481315158371), + qreal(0.80320753148064494), + qreal(0.78834642762660634), + qreal(0.7730104533627371), + qreal(0.75720884650648468), + qreal(0.74095112535495899), + qreal(0.72424708295146689), + qreal(0.70710678118654757), + qreal(0.68954054473706705), + qreal(0.67155895484701855), + qreal(0.65317284295377664), + qreal(0.63439328416364549), + qreal(0.61523159058062693), + qreal(0.59569930449243347), + qreal(0.57580819141784545), + qreal(0.55557023301960218), + qreal(0.53499761988709715), + qreal(0.51410274419322177), + qreal(0.49289819222978415), + qreal(0.47139673682599786), + qreal(0.44961132965460687), + qreal(0.42755509343028203), + qreal(0.40524131400498992), + qreal(0.38268343236508989), + qreal(0.35989503653498833), + qreal(0.33688985339222033), + qreal(0.31368174039889141), + qreal(0.29028467725446239), + qreal(0.26671275747489848), + qreal(0.24298017990326407), + qreal(0.21910124015687005), + qreal(0.19509032201612861), + qreal(0.17096188876030122), + qreal(0.1467304744553618), + qreal(0.12241067519921635), + qreal(0.098017140329560826), + qreal(0.073564563599667732), + qreal(0.049067674327417966), + qreal(0.024541228522912326), + qreal(0.0), + qreal(-0.02454122852291208), + qreal(-0.049067674327417724), + qreal(-0.073564563599667496), + qreal(-0.09801714032956059), + qreal(-0.1224106751992161), + qreal(-0.14673047445536158), + qreal(-0.17096188876030097), + qreal(-0.19509032201612836), + qreal(-0.2191012401568698), + qreal(-0.24298017990326382), + qreal(-0.26671275747489825), + qreal(-0.29028467725446211), + qreal(-0.31368174039889118), + qreal(-0.33688985339222011), + qreal(-0.35989503653498811), + qreal(-0.38268343236508967), + qreal(-0.40524131400498969), + qreal(-0.42755509343028181), + qreal(-0.44961132965460665), + qreal(-0.47139673682599764), + qreal(-0.49289819222978393), + qreal(-0.51410274419322155), + qreal(-0.53499761988709693), + qreal(-0.55557023301960196), + qreal(-0.57580819141784534), + qreal(-0.59569930449243325), + qreal(-0.61523159058062671), + qreal(-0.63439328416364527), + qreal(-0.65317284295377653), + qreal(-0.67155895484701844), + qreal(-0.68954054473706683), + qreal(-0.70710678118654746), + qreal(-0.72424708295146678), + qreal(-0.74095112535495888), + qreal(-0.75720884650648423), + qreal(-0.77301045336273666), + qreal(-0.78834642762660589), + qreal(-0.80320753148064505), + qreal(-0.81758481315158382), + qreal(-0.83146961230254524), + qreal(-0.84485356524970701), + qreal(-0.85772861000027201), + qreal(-0.87008699110871135), + qreal(-0.88192126434835494), + qreal(-0.89322430119551521), + qreal(-0.90398929312344312), + qreal(-0.91420975570353047), + qreal(-0.92387953251128652), + qreal(-0.93299279883473896), + qreal(-0.94154406518302081), + qreal(-0.94952818059303667), + qreal(-0.95694033573220882), + qreal(-0.96377606579543984), + qreal(-0.97003125319454397), + qreal(-0.97570213003852846), + qreal(-0.98078528040323032), + qreal(-0.98527764238894111), + qreal(-0.9891765099647809), + qreal(-0.99247953459871008), + qreal(-0.99518472667219693), + qreal(-0.99729045667869021), + qreal(-0.99879545620517241), + qreal(-0.99969881869620425), + qreal(-1.0), + qreal(-0.99969881869620425), + qreal(-0.99879545620517241), + qreal(-0.99729045667869021), + qreal(-0.99518472667219693), + qreal(-0.99247953459871008), + qreal(-0.9891765099647809), + qreal(-0.98527764238894122), + qreal(-0.98078528040323043), + qreal(-0.97570213003852857), + qreal(-0.97003125319454397), + qreal(-0.96377606579543995), + qreal(-0.95694033573220894), + qreal(-0.94952818059303679), + qreal(-0.94154406518302092), + qreal(-0.93299279883473907), + qreal(-0.92387953251128663), + qreal(-0.91420975570353058), + qreal(-0.90398929312344334), + qreal(-0.89322430119551532), + qreal(-0.88192126434835505), + qreal(-0.87008699110871146), + qreal(-0.85772861000027223), + qreal(-0.84485356524970723), + qreal(-0.83146961230254546), + qreal(-0.81758481315158404), + qreal(-0.80320753148064528), + qreal(-0.78834642762660612), + qreal(-0.77301045336273688), + qreal(-0.75720884650648457), + qreal(-0.74095112535495911), + qreal(-0.724247082951467), + qreal(-0.70710678118654768), + qreal(-0.68954054473706716), + qreal(-0.67155895484701866), + qreal(-0.65317284295377709), + qreal(-0.63439328416364593), + qreal(-0.61523159058062737), + qreal(-0.59569930449243325), + qreal(-0.57580819141784523), + qreal(-0.55557023301960218), + qreal(-0.53499761988709726), + qreal(-0.51410274419322188), + qreal(-0.49289819222978426), + qreal(-0.47139673682599792), + qreal(-0.44961132965460698), + qreal(-0.42755509343028253), + qreal(-0.40524131400499042), + qreal(-0.38268343236509039), + qreal(-0.359895036534988), + qreal(-0.33688985339222), + qreal(-0.31368174039889152), + qreal(-0.2902846772544625), + qreal(-0.26671275747489859), + qreal(-0.24298017990326418), + qreal(-0.21910124015687016), + qreal(-0.19509032201612872), + qreal(-0.17096188876030177), + qreal(-0.14673047445536239), + qreal(-0.12241067519921603), + qreal(-0.098017140329560506), + qreal(-0.073564563599667412), + qreal(-0.049067674327418091), + qreal(-0.024541228522912448) }; QT_END_NAMESPACE -- cgit v0.12 From d993351832c34f51056af06eb83d18f71fa9fd9d Mon Sep 17 00:00:00 2001 From: Gareth Stockwell Date: Thu, 10 Dec 2009 15:43:37 +0000 Subject: Implemented loudness effect in Phonon MMF backend Task-number: QTBUG-4659 Reviewed-by: Espen Riskedal --- src/3rdparty/phonon/mmf/effectfactory.cpp | 4 ++ src/3rdparty/phonon/mmf/loudness.cpp | 80 +++++++++++++++++++++++++++++++ src/3rdparty/phonon/mmf/loudness.h | 62 ++++++++++++++++++++++++ src/plugins/phonon/mmf/mmf.pro | 2 + 4 files changed, 148 insertions(+) create mode 100644 src/3rdparty/phonon/mmf/loudness.cpp create mode 100644 src/3rdparty/phonon/mmf/loudness.h diff --git a/src/3rdparty/phonon/mmf/effectfactory.cpp b/src/3rdparty/phonon/mmf/effectfactory.cpp index c6593bb..50d08e7 100644 --- a/src/3rdparty/phonon/mmf/effectfactory.cpp +++ b/src/3rdparty/phonon/mmf/effectfactory.cpp @@ -23,6 +23,7 @@ along with this library. If not, see . #include "audioequalizer.h" #include "bassboost.h" +#include "loudness.h" #include "effectfactory.h" @@ -76,6 +77,8 @@ AbstractAudioEffect *EffectFactory::createAudioEffect(Type type, case TypeEnvironmentalReverb: case TypeListenerOrientation: case TypeLoudness: + effect = new Loudness(parent, parameters); + break; case TypeSourceOrientation: case TypeStereoWidening: default: @@ -126,6 +129,7 @@ void EffectFactory::initialize() INITIALIZE_EFFECT(AudioEqualizer) INITIALIZE_EFFECT(BassBoost) + INITIALIZE_EFFECT(Loudness) m_initialized = true; } diff --git a/src/3rdparty/phonon/mmf/loudness.cpp b/src/3rdparty/phonon/mmf/loudness.cpp new file mode 100644 index 0000000..7a033fa --- /dev/null +++ b/src/3rdparty/phonon/mmf/loudness.cpp @@ -0,0 +1,80 @@ +/* This file is part of the KDE project. + +Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). + +This library is free software: you can redistribute it and/or modify +it under the terms of the GNU Lesser General Public License as published by +the Free Software Foundation, either version 2.1 or 3 of the License. + +This library is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU Lesser General Public License for more details. + +You should have received a copy of the GNU Lesser General Public License +along with this library. If not, see . + +*/ + +#include +#include "loudness.h" + +QT_BEGIN_NAMESPACE + +using namespace Phonon; +using namespace Phonon::MMF; + +// Define functions which depend on concrete native effect class name +PHONON_MMF_DEFINE_EFFECT_FUNCTIONS(Loudness) + +/*! \class MMF::Loudness + \internal +*/ + +Loudness::Loudness(QObject *parent, const QList& parameters) + : AbstractAudioEffect::AbstractAudioEffect(parent, parameters) +{ + +} + +void Loudness::parameterChanged(const EffectParameter ¶m, + const QVariant &value) +{ + Q_ASSERT_X(param.id() == 0, Q_FUNC_INFO, "Invalid parameter ID"); + setEnabled(value.toBool()); +} + +//----------------------------------------------------------------------------- +// Static functions +//----------------------------------------------------------------------------- + +const char* Loudness::description() +{ + return "Loudness"; +} + +bool Loudness::getParameters(CMdaAudioOutputStream *stream, + QList ¶meters) +{ + bool supported = false; + + QScopedPointer effect; + TRAPD(err, effect.reset(CLoudness::NewL(*stream))); + + if(KErrNone == err) { + supported = true; + + EffectParameter param( + /* parameterId */ 0, + /* name */ tr("Enabled"), + /* hints */ EffectParameter::ToggledHint, + /* defaultValue */ QVariant(bool(true))); + + parameters.append(param); + } + + return supported; +} + +QT_END_NAMESPACE + diff --git a/src/3rdparty/phonon/mmf/loudness.h b/src/3rdparty/phonon/mmf/loudness.h new file mode 100644 index 0000000..f772d7f --- /dev/null +++ b/src/3rdparty/phonon/mmf/loudness.h @@ -0,0 +1,62 @@ +/* This file is part of the KDE project. + +Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). + +This library is free software: you can redistribute it and/or modify +it under the terms of the GNU Lesser General Public License as published by +the Free Software Foundation, either version 2.1 or 3 of the License. + +This library is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU Lesser General Public License for more details. + +You should have received a copy of the GNU Lesser General Public License +along with this library. If not, see . + +*/ + +#ifndef PHONON_MMF_LOUDNESS_H +#define PHONON_MMF_LOUDNESS_H + +#include "abstractaudioeffect.h" + +class CLoudness; + +QT_BEGIN_NAMESPACE + +namespace Phonon +{ +namespace MMF +{ +/** + * @short A "loudness" effect. + */ +class Loudness : public AbstractAudioEffect +{ + Q_OBJECT +public: + Loudness(QObject *parent, const QList& parameters); + + // Static interface required by EffectFactory + static const char* description(); + static bool getParameters(CMdaAudioOutputStream *stream, + QList& parameters); + +protected: + // AbstractAudioEffect + virtual void createEffect(AudioPlayer::NativePlayer *player); + virtual void parameterChanged(const EffectParameter ¶m, + const QVariant &value); + +private: + CLoudness *concreteEffect(); + +}; +} +} + +QT_END_NAMESPACE + +#endif + diff --git a/src/plugins/phonon/mmf/mmf.pro b/src/plugins/phonon/mmf/mmf.pro index f72a657..37c613c 100644 --- a/src/plugins/phonon/mmf/mmf.pro +++ b/src/plugins/phonon/mmf/mmf.pro @@ -36,6 +36,7 @@ HEADERS += \ $$PHONON_MMF_DIR/dummyplayer.h \ $$PHONON_MMF_DIR/effectfactory.h \ $$PHONON_MMF_DIR/effectparameter.h \ + $$PHONON_MMF_DIR/loudness.h \ $$PHONON_MMF_DIR/mediaobject.h \ $$PHONON_MMF_DIR/mmf_medianode.h \ $$PHONON_MMF_DIR/mmf_videoplayer.h \ @@ -59,6 +60,7 @@ SOURCES += \ $$PHONON_MMF_DIR/dummyplayer.cpp \ $$PHONON_MMF_DIR/effectfactory.cpp \ $$PHONON_MMF_DIR/effectparameter.cpp \ + $$PHONON_MMF_DIR/loudness.cpp \ $$PHONON_MMF_DIR/mediaobject.cpp \ $$PHONON_MMF_DIR/mmf_medianode.cpp \ $$PHONON_MMF_DIR/mmf_videoplayer.cpp \ -- cgit v0.12 From bc0e4aa8aec231b43a6033f3f4f12037b02ee64e Mon Sep 17 00:00:00 2001 From: Gareth Stockwell Date: Thu, 10 Dec 2009 17:24:03 +0000 Subject: Implemented reverb effect in Phonon MMF backend Task-number: QTBUG-4659 Reviewed-by: Espen Riskedal --- src/3rdparty/phonon/mmf/effectfactory.cpp | 11 +- src/3rdparty/phonon/mmf/effectparameter.cpp | 8 + src/3rdparty/phonon/mmf/effectparameter.h | 2 + src/3rdparty/phonon/mmf/environmentalreverb.cpp | 202 ++++++++++++++++++++++++ src/3rdparty/phonon/mmf/environmentalreverb.h | 62 ++++++++ src/plugins/phonon/mmf/mmf.pro | 2 + 6 files changed, 285 insertions(+), 2 deletions(-) create mode 100644 src/3rdparty/phonon/mmf/environmentalreverb.cpp create mode 100644 src/3rdparty/phonon/mmf/environmentalreverb.h diff --git a/src/3rdparty/phonon/mmf/effectfactory.cpp b/src/3rdparty/phonon/mmf/effectfactory.cpp index 50d08e7..ef2ddf7 100644 --- a/src/3rdparty/phonon/mmf/effectfactory.cpp +++ b/src/3rdparty/phonon/mmf/effectfactory.cpp @@ -23,6 +23,7 @@ along with this library. If not, see . #include "audioequalizer.h" #include "bassboost.h" +#include "environmentalreverb.h" #include "loudness.h" #include "effectfactory.h" @@ -73,14 +74,19 @@ AbstractAudioEffect *EffectFactory::createAudioEffect(Type type, case TypeAudioEqualizer: effect = new AudioEqualizer(parent, parameters); break; - case TypeDistanceAttenuation: case TypeEnvironmentalReverb: - case TypeListenerOrientation: + effect = new EnvironmentalReverb(parent, parameters); + break; case TypeLoudness: effect = new Loudness(parent, parameters); break; + + // Not implemented + case TypeDistanceAttenuation: + case TypeListenerOrientation: case TypeSourceOrientation: case TypeStereoWidening: + // Fall through default: Q_ASSERT_X(false, Q_FUNC_INFO, "Unknown effect"); } @@ -129,6 +135,7 @@ void EffectFactory::initialize() INITIALIZE_EFFECT(AudioEqualizer) INITIALIZE_EFFECT(BassBoost) + INITIALIZE_EFFECT(EnvironmentalReverb) INITIALIZE_EFFECT(Loudness) m_initialized = true; diff --git a/src/3rdparty/phonon/mmf/effectparameter.cpp b/src/3rdparty/phonon/mmf/effectparameter.cpp index f4287b8..17c1315 100644 --- a/src/3rdparty/phonon/mmf/effectparameter.cpp +++ b/src/3rdparty/phonon/mmf/effectparameter.cpp @@ -59,5 +59,13 @@ qint32 MMF::EffectParameter::toInternalValue(qreal external) const return m_internalRange.first + ((1.0 + external) / 2) * range; } +qreal MMF::EffectParameter::toExternalValue + (qint32 value, qint32 min, qint32 max) +{ + Q_ASSERT_X(max >= min, Q_FUNC_INFO, "Invalid range"); + const qint32 range = max - min; + return range == 0 ? 0.0 : ((2.0 * value - min) / range) - 1.0; +} + QT_END_NAMESPACE diff --git a/src/3rdparty/phonon/mmf/effectparameter.h b/src/3rdparty/phonon/mmf/effectparameter.h index 3008159..27cc018 100644 --- a/src/3rdparty/phonon/mmf/effectparameter.h +++ b/src/3rdparty/phonon/mmf/effectparameter.h @@ -57,6 +57,8 @@ public: void setInternalRange(qint32 min, qint32 max); qint32 toInternalValue(qreal external) const; + static qreal toExternalValue(qint32 value, qint32 min, qint32 max); + private: bool m_hasInternalRange; QPair m_internalRange; diff --git a/src/3rdparty/phonon/mmf/environmentalreverb.cpp b/src/3rdparty/phonon/mmf/environmentalreverb.cpp new file mode 100644 index 0000000..2e30ca1 --- /dev/null +++ b/src/3rdparty/phonon/mmf/environmentalreverb.cpp @@ -0,0 +1,202 @@ +/* This file is part of the KDE project. + +Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). + +This library is free software: you can redistribute it and/or modify +it under the terms of the GNU Lesser General Public License as published by +the Free Software Foundation, either version 2.1 or 3 of the License. + +This library is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU Lesser General Public License for more details. + +You should have received a copy of the GNU Lesser General Public License +along with this library. If not, see . + +*/ + +#include +#include "environmentalreverb.h" + +QT_BEGIN_NAMESPACE + +using namespace Phonon; +using namespace Phonon::MMF; + +/*! \class MMF::EnvironmentalReverb + \internal +*/ + +// Define functions which depend on concrete native effect class name +PHONON_MMF_DEFINE_EFFECT_FUNCTIONS(EnvironmentalReverb) + +enum Parameters +{ + DecayHFRatio, + DecayTime, + Density, + Diffusion, + ReflectionsDelay, + ReflectionsLevel, + ReverbDelay, + ReverbLevel, + RoomHFLevel, + RoomLevel +}; + +EnvironmentalReverb::EnvironmentalReverb(QObject *parent, const QList& parameters) + : AbstractAudioEffect::AbstractAudioEffect(parent, parameters) +{ + +} + +void EnvironmentalReverb::parameterChanged(const EffectParameter ¶m, + const QVariant &value) +{ + const qreal externalLevel = value.toReal(); + const int internalLevel = param.toInternalValue(externalLevel); + + TInt err = 0; + + switch(param.id()) { + case DecayHFRatio: + TRAP(err, concreteEffect()->SetDecayHFRatioL(internalLevel)); + break; + case DecayTime: + TRAP(err, concreteEffect()->SetDecayTimeL(internalLevel)); + break; + case Density: + TRAP(err, concreteEffect()->SetDensityL(internalLevel)); + break; + case Diffusion: + TRAP(err, concreteEffect()->SetDiffusionL(internalLevel)); + break; + case ReflectionsDelay: + TRAP(err, concreteEffect()->SetReflectionsDelayL(internalLevel)); + break; + case ReflectionsLevel: + TRAP(err, concreteEffect()->SetReflectionsLevelL(internalLevel)); + break; + case ReverbDelay: + TRAP(err, concreteEffect()->SetReverbDelayL(internalLevel)); + break; + case ReverbLevel: + TRAP(err, concreteEffect()->SetReverbLevelL(internalLevel)); + break; + case RoomHFLevel: + TRAP(err, concreteEffect()->SetRoomHFLevelL(internalLevel)); + break; + case RoomLevel: + TRAP(err, concreteEffect()->SetRoomLevelL(internalLevel)); + break; + default: + Q_ASSERT_X(false, Q_FUNC_INFO, "Unknown parameter"); + } + + // TODO: handle audio effect errors + Q_UNUSED(err); +} + + +//----------------------------------------------------------------------------- +// Static functions +//----------------------------------------------------------------------------- + +const char* EnvironmentalReverb::description() +{ + return "Reverb"; +} + +// Internal helper function +Phonon::MMF::EffectParameter createParameter(int id, const QString &name, + int defaultValue, int minValue, int maxValue, + Phonon::EffectParameter::Hint hint = Phonon::EffectParameter::IntegerHint) +{ + const qreal externalDefaultValue = + Phonon::MMF::EffectParameter::toExternalValue + (defaultValue, minValue, maxValue); + + Phonon::MMF::EffectParameter param(id, name, hint, + /* defaultValue */ QVariant(externalDefaultValue), + /* minimumValue */ QVariant(qreal(-1.0)), + /* maximumValue */ QVariant(qreal(+1.0))); + + param.setInternalRange(minValue, maxValue); + return param; +} + +bool EnvironmentalReverb::getParameters(CMdaAudioOutputStream *stream, + QList& parameters) +{ + bool supported = false; + + QScopedPointer effect; + TRAPD(err, effect.reset(CEnvironmentalReverb::NewL(*stream))); + + if (KErrNone == err) { + supported = true; + + TInt32 min, max; + TUint32 umin, umax; + + // DecayHFRatio + effect->DecayHFRatioRange(umin, umax); + parameters.append(createParameter( + DecayHFRatio, tr("Decay HF ratio (%)"), effect->DecayHFRatio(), + umin, umax)); + + // DecayTime + effect->DecayTimeRange(umin, umax); + parameters.append(createParameter( + DecayTime, tr("Decay time (ms)"), effect->DecayTime(), + umin, umax)); + + // Density + parameters.append(createParameter( + Density, tr("Density (%)"), effect->Density(), 0, 100)); + + // Diffusion + parameters.append(createParameter( + Diffusion, tr("Diffusion (%)"), effect->Diffusion(), 0, 100)); + + // ReflectionsDelay + parameters.append(createParameter( + ReflectionsDelay, tr("Reflections delay (ms)"), + effect->ReflectionsDelay(), 0, effect->ReflectionsDelayMax())); + + // ReflectionsLevel + effect->ReflectionLevelRange(min, max); + parameters.append(createParameter( + ReflectionsLevel, tr("Reflections level (mB)"), + effect->ReflectionsLevel(), + min, max, EffectParameter::LogarithmicHint)); + + // ReverbDelay + parameters.append(createParameter( + ReverbDelay, tr("Reverb delay (ms)"), effect->ReverbDelay(), + 0, effect->ReverbDelayMax())); + + // ReverbLevel + effect->ReverbLevelRange(min, max); + parameters.append(createParameter( + ReverbLevel, tr("Reverb level (mB)"), effect->ReverbLevel(), + min, max, EffectParameter::LogarithmicHint)); + + // RoomHFLevel + effect->RoomHFLevelRange(min, max); + parameters.append(createParameter( + RoomHFLevel, tr("Room HF level"), effect->RoomHFLevel(), + min, max)); + + // RoomLevel + effect->RoomLevelRange(min, max); + parameters.append(createParameter( + RoomLevel, tr("Room level (mB)"), effect->RoomLevel(), + min, max, EffectParameter::LogarithmicHint)); + } + + return supported; +} + +QT_END_NAMESPACE diff --git a/src/3rdparty/phonon/mmf/environmentalreverb.h b/src/3rdparty/phonon/mmf/environmentalreverb.h new file mode 100644 index 0000000..5760c0a --- /dev/null +++ b/src/3rdparty/phonon/mmf/environmentalreverb.h @@ -0,0 +1,62 @@ +/* This file is part of the KDE project. + +Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). + +This library is free software: you can redistribute it and/or modify +it under the terms of the GNU Lesser General Public License as published by +the Free Software Foundation, either version 2.1 or 3 of the License. + +This library is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU Lesser General Public License for more details. + +You should have received a copy of the GNU Lesser General Public License +along with this library. If not, see . + +*/ + +#ifndef PHONON_MMF_ENVIRONMENTALREVERB_H +#define PHONON_MMF_ENVIRONMENTALREVERB_H + +#include "abstractaudioeffect.h" + +class CEnvironmentalReverb; + +QT_BEGIN_NAMESPACE + +namespace Phonon +{ +namespace MMF +{ +/** + * @short A reverb effect. + */ +class EnvironmentalReverb : public AbstractAudioEffect +{ + Q_OBJECT +public: + EnvironmentalReverb(QObject *parent, const QList& parameters); + + // Static interface required by EffectFactory + static const char* description(); + static bool getParameters(CMdaAudioOutputStream *stream, + QList& parameters); + +protected: + // AbstractAudioEffect + virtual void createEffect(AudioPlayer::NativePlayer *player); + virtual void parameterChanged(const EffectParameter ¶m, + const QVariant &value); + +private: + CEnvironmentalReverb *concreteEffect(); + +}; +} +} + +QT_END_NAMESPACE + +#endif + diff --git a/src/plugins/phonon/mmf/mmf.pro b/src/plugins/phonon/mmf/mmf.pro index 37c613c..78e23d9 100644 --- a/src/plugins/phonon/mmf/mmf.pro +++ b/src/plugins/phonon/mmf/mmf.pro @@ -36,6 +36,7 @@ HEADERS += \ $$PHONON_MMF_DIR/dummyplayer.h \ $$PHONON_MMF_DIR/effectfactory.h \ $$PHONON_MMF_DIR/effectparameter.h \ + $$PHONON_MMF_DIR/environmentalreverb.h \ $$PHONON_MMF_DIR/loudness.h \ $$PHONON_MMF_DIR/mediaobject.h \ $$PHONON_MMF_DIR/mmf_medianode.h \ @@ -60,6 +61,7 @@ SOURCES += \ $$PHONON_MMF_DIR/dummyplayer.cpp \ $$PHONON_MMF_DIR/effectfactory.cpp \ $$PHONON_MMF_DIR/effectparameter.cpp \ + $$PHONON_MMF_DIR/environmentalreverb.cpp \ $$PHONON_MMF_DIR/loudness.cpp \ $$PHONON_MMF_DIR/mediaobject.cpp \ $$PHONON_MMF_DIR/mmf_medianode.cpp \ -- cgit v0.12 From f42624c9f88cbbb71d6857566e00348b119d486c Mon Sep 17 00:00:00 2001 From: Gareth Stockwell Date: Thu, 10 Dec 2009 17:44:39 +0000 Subject: Implemented stereo widening effect in Phonon MMF backend Task-number: QTBUG-4659 Reviewed-by: Espen Riskedal --- src/3rdparty/phonon/mmf/effectfactory.cpp | 6 +- src/3rdparty/phonon/mmf/stereowidening.cpp | 94 ++++++++++++++++++++++++++++++ src/3rdparty/phonon/mmf/stereowidening.h | 62 ++++++++++++++++++++ src/plugins/phonon/mmf/mmf.pro | 2 + 4 files changed, 163 insertions(+), 1 deletion(-) create mode 100644 src/3rdparty/phonon/mmf/stereowidening.cpp create mode 100644 src/3rdparty/phonon/mmf/stereowidening.h diff --git a/src/3rdparty/phonon/mmf/effectfactory.cpp b/src/3rdparty/phonon/mmf/effectfactory.cpp index ef2ddf7..081f6a3 100644 --- a/src/3rdparty/phonon/mmf/effectfactory.cpp +++ b/src/3rdparty/phonon/mmf/effectfactory.cpp @@ -25,6 +25,7 @@ along with this library. If not, see . #include "bassboost.h" #include "environmentalreverb.h" #include "loudness.h" +#include "stereowidening.h" #include "effectfactory.h" @@ -80,12 +81,14 @@ AbstractAudioEffect *EffectFactory::createAudioEffect(Type type, case TypeLoudness: effect = new Loudness(parent, parameters); break; + case TypeStereoWidening: + effect = new StereoWidening(parent, parameters); + break; // Not implemented case TypeDistanceAttenuation: case TypeListenerOrientation: case TypeSourceOrientation: - case TypeStereoWidening: // Fall through default: Q_ASSERT_X(false, Q_FUNC_INFO, "Unknown effect"); @@ -137,6 +140,7 @@ void EffectFactory::initialize() INITIALIZE_EFFECT(BassBoost) INITIALIZE_EFFECT(EnvironmentalReverb) INITIALIZE_EFFECT(Loudness) + INITIALIZE_EFFECT(StereoWidening) m_initialized = true; } diff --git a/src/3rdparty/phonon/mmf/stereowidening.cpp b/src/3rdparty/phonon/mmf/stereowidening.cpp new file mode 100644 index 0000000..4fee1aa --- /dev/null +++ b/src/3rdparty/phonon/mmf/stereowidening.cpp @@ -0,0 +1,94 @@ +/* This file is part of the KDE project. + +Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). + +This library is free software: you can redistribute it and/or modify +it under the terms of the GNU Lesser General Public License as published by +the Free Software Foundation, either version 2.1 or 3 of the License. + +This library is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU Lesser General Public License for more details. + +You should have received a copy of the GNU Lesser General Public License +along with this library. If not, see . + +*/ + +#include +#include "stereowidening.h" + +QT_BEGIN_NAMESPACE + +using namespace Phonon; +using namespace Phonon::MMF; + +// Define functions which depend on concrete native effect class name +PHONON_MMF_DEFINE_EFFECT_FUNCTIONS(StereoWidening) + +/*! \class MMF::StereoWidening + \internal +*/ + +StereoWidening::StereoWidening(QObject *parent, const QList& parameters) + : AbstractAudioEffect::AbstractAudioEffect(parent, parameters) +{ + +} + +void StereoWidening::parameterChanged(const EffectParameter ¶m, + const QVariant &value) +{ + Q_ASSERT_X(param.id() == 0, Q_FUNC_INFO, "Invalid parameter ID"); + + const qreal externalLevel = value.toReal(); + const int internalLevel = param.toInternalValue(externalLevel); + + TRAPD(err, concreteEffect()->SetStereoWideningLevelL(internalLevel)); + + // TODO: handle audio effect errors + Q_UNUSED(err); +} + +//----------------------------------------------------------------------------- +// Static functions +//----------------------------------------------------------------------------- + +const char* StereoWidening::description() +{ + return "Stereo widening"; +} + +bool StereoWidening::getParameters(CMdaAudioOutputStream *stream, + QList ¶meters) +{ + bool supported = false; + + QScopedPointer effect; + TRAPD(err, effect.reset(CStereoWidening::NewL(*stream))); + + if (KErrNone == err) { + supported = true; + + const qreal defaultValue = + Phonon::MMF::EffectParameter::toExternalValue + (effect->StereoWideningLevel(), 0, 100); + + EffectParameter param( + /* parameterId */ 0, + /* name */ tr("Level (%)"), + /* hints */ EffectParameter::IntegerHint, + /* defaultValue */ QVariant(defaultValue), + /* minimumValue */ QVariant(qreal(-1.0)), + /* maximumValue */ QVariant(qreal(+1.0))); + + param.setInternalRange(0, 100); + parameters.append(param); + } + + return supported; +} + +QT_END_NAMESPACE + diff --git a/src/3rdparty/phonon/mmf/stereowidening.h b/src/3rdparty/phonon/mmf/stereowidening.h new file mode 100644 index 0000000..249c279 --- /dev/null +++ b/src/3rdparty/phonon/mmf/stereowidening.h @@ -0,0 +1,62 @@ +/* This file is part of the KDE project. + +Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). + +This library is free software: you can redistribute it and/or modify +it under the terms of the GNU Lesser General Public License as published by +the Free Software Foundation, either version 2.1 or 3 of the License. + +This library is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU Lesser General Public License for more details. + +You should have received a copy of the GNU Lesser General Public License +along with this library. If not, see . + +*/ + +#ifndef PHONON_MMF_STEREOWIDENING_H +#define PHONON_MMF_STEREOWIDENING_H + +#include "abstractaudioeffect.h" + +class CStereoWidening; + +QT_BEGIN_NAMESPACE + +namespace Phonon +{ +namespace MMF +{ +/** + * @short A "bass boost" effect. + */ +class StereoWidening : public AbstractAudioEffect +{ + Q_OBJECT +public: + StereoWidening(QObject *parent, const QList& parameters); + + // Static interface required by EffectFactory + static const char* description(); + static bool getParameters(CMdaAudioOutputStream *stream, + QList& parameters); + +protected: + // AbstractAudioEffect + virtual void createEffect(AudioPlayer::NativePlayer *player); + virtual void parameterChanged(const EffectParameter ¶m, + const QVariant &value); + +private: + CStereoWidening *concreteEffect(); + +}; +} +} + +QT_END_NAMESPACE + +#endif + diff --git a/src/plugins/phonon/mmf/mmf.pro b/src/plugins/phonon/mmf/mmf.pro index 78e23d9..cfaca9d 100644 --- a/src/plugins/phonon/mmf/mmf.pro +++ b/src/plugins/phonon/mmf/mmf.pro @@ -41,6 +41,7 @@ HEADERS += \ $$PHONON_MMF_DIR/mediaobject.h \ $$PHONON_MMF_DIR/mmf_medianode.h \ $$PHONON_MMF_DIR/mmf_videoplayer.h \ + $$PHONON_MMF_DIR/stereowidening.h \ $$PHONON_MMF_DIR/objectdump.h \ $$PHONON_MMF_DIR/objectdump_symbian.h \ $$PHONON_MMF_DIR/objecttree.h \ @@ -66,6 +67,7 @@ SOURCES += \ $$PHONON_MMF_DIR/mediaobject.cpp \ $$PHONON_MMF_DIR/mmf_medianode.cpp \ $$PHONON_MMF_DIR/mmf_videoplayer.cpp \ + $$PHONON_MMF_DIR/stereowidening.cpp \ $$PHONON_MMF_DIR/objectdump.cpp \ $$PHONON_MMF_DIR/objectdump_symbian.cpp \ $$PHONON_MMF_DIR/objecttree.cpp \ -- cgit v0.12 From 5a8c0ded599263446010dfc1729dcab8b2f62f0d Mon Sep 17 00:00:00 2001 From: Gareth Stockwell Date: Mon, 11 Jan 2010 17:41:23 +0000 Subject: Simplified error handling for audio effects Task-number: QTBUG-4659 Reviewed-by: Espen Riskedal --- src/3rdparty/phonon/mmf/abstractaudioeffect.cpp | 22 ++++++++++++---------- src/3rdparty/phonon/mmf/abstractaudioeffect.h | 2 +- src/3rdparty/phonon/mmf/audioequalizer.cpp | 6 +++--- src/3rdparty/phonon/mmf/audioequalizer.h | 2 +- src/3rdparty/phonon/mmf/bassboost.cpp | 3 ++- src/3rdparty/phonon/mmf/bassboost.h | 4 ++-- src/3rdparty/phonon/mmf/environmentalreverb.cpp | 5 ++--- src/3rdparty/phonon/mmf/environmentalreverb.h | 4 ++-- src/3rdparty/phonon/mmf/loudness.cpp | 3 ++- src/3rdparty/phonon/mmf/loudness.h | 4 ++-- src/3rdparty/phonon/mmf/stereowidening.cpp | 5 ++--- src/3rdparty/phonon/mmf/stereowidening.h | 4 ++-- 12 files changed, 33 insertions(+), 31 deletions(-) diff --git a/src/3rdparty/phonon/mmf/abstractaudioeffect.cpp b/src/3rdparty/phonon/mmf/abstractaudioeffect.cpp index 593e00f..e3672e6 100644 --- a/src/3rdparty/phonon/mmf/abstractaudioeffect.cpp +++ b/src/3rdparty/phonon/mmf/abstractaudioeffect.cpp @@ -71,9 +71,10 @@ void AbstractAudioEffect::setParameterValue(const Phonon::EffectParameter ¶m if (m_effect.data()) { const EffectParameter& internalParam = internalParameter(param.id()); - parameterChanged(internalParam, newValue); + int err = parameterChanged(internalParam, newValue); + TRAP(err, m_effect->ApplyL()); // TODO: handle audio effect errors - TRAP_IGNORE(m_effect->ApplyL()); + Q_UNUSED(err); } } @@ -116,12 +117,16 @@ void AbstractAudioEffect::disconnectMediaObject(MediaObject *mediaObject) void AbstractAudioEffect::setEnabled(bool enabled) { + TInt err = KErrNone; + if (enabled) // TODO: handle audio effect errors - TRAP_IGNORE(m_effect->EnableL()) + TRAP(err, m_effect->EnableL()) else // TODO: handle audio effect errors - TRAP_IGNORE(m_effect->DisableL()) + TRAP(err, m_effect->DisableL()) + + Q_UNUSED(err); } void AbstractAudioEffect::createEffect() @@ -134,15 +139,12 @@ void AbstractAudioEffect::createEffect() if (m_effect.data()) { EffectParameter param; + int err = 0; foreach (param, m_params) { const QVariant value = parameterValue(param); - parameterChanged(param, value); + err = parameterChanged(param, value); } - - // TODO: handle audio effect errors - TRAP_IGNORE(m_effect->EnableL()); - - setEnabled(true); + Q_UNUSED(err) } } diff --git a/src/3rdparty/phonon/mmf/abstractaudioeffect.h b/src/3rdparty/phonon/mmf/abstractaudioeffect.h index 57427e7..a3b35c2 100644 --- a/src/3rdparty/phonon/mmf/abstractaudioeffect.h +++ b/src/3rdparty/phonon/mmf/abstractaudioeffect.h @@ -86,7 +86,7 @@ protected: virtual void createEffect(AudioPlayer::NativePlayer *player) = 0; - virtual void parameterChanged(const EffectParameter ¶m, + virtual int parameterChanged(const EffectParameter ¶m, const QVariant &value) = 0; private: diff --git a/src/3rdparty/phonon/mmf/audioequalizer.cpp b/src/3rdparty/phonon/mmf/audioequalizer.cpp index 1584cf7..201a5fc 100644 --- a/src/3rdparty/phonon/mmf/audioequalizer.cpp +++ b/src/3rdparty/phonon/mmf/audioequalizer.cpp @@ -37,15 +37,15 @@ AudioEqualizer::AudioEqualizer(QObject *parent, const QList& pa } -void AudioEqualizer::parameterChanged(const EffectParameter ¶m, +int AudioEqualizer::parameterChanged(const EffectParameter ¶m, const QVariant &value) { const int band = param.id() + 1; const qreal externalLevel = value.toReal(); const int internalLevel = param.toInternalValue(externalLevel); - // TODO: handle audio effect errors - TRAP_IGNORE(concreteEffect()->SetBandLevelL(band, internalLevel)); + TRAPD(err, concreteEffect()->SetBandLevelL(band, internalLevel)); + return err; } diff --git a/src/3rdparty/phonon/mmf/audioequalizer.h b/src/3rdparty/phonon/mmf/audioequalizer.h index 3a9a5ca..acfe9b5 100644 --- a/src/3rdparty/phonon/mmf/audioequalizer.h +++ b/src/3rdparty/phonon/mmf/audioequalizer.h @@ -51,7 +51,7 @@ public: protected: // AbstractAudioEffect virtual void createEffect(AudioPlayer::NativePlayer *player); - virtual void parameterChanged(const EffectParameter ¶m, + virtual int parameterChanged(const EffectParameter ¶m, const QVariant &value); private: diff --git a/src/3rdparty/phonon/mmf/bassboost.cpp b/src/3rdparty/phonon/mmf/bassboost.cpp index a8631e0..6996ba9 100644 --- a/src/3rdparty/phonon/mmf/bassboost.cpp +++ b/src/3rdparty/phonon/mmf/bassboost.cpp @@ -37,11 +37,12 @@ BassBoost::BassBoost(QObject *parent, const QList ¶meters) } -void BassBoost::parameterChanged(const EffectParameter ¶m, +int BassBoost::parameterChanged(const EffectParameter ¶m, const QVariant &value) { Q_ASSERT_X(param.id() == 0, Q_FUNC_INFO, "Invalid parameter ID"); setEnabled(value.toBool()); + return 0; } //----------------------------------------------------------------------------- diff --git a/src/3rdparty/phonon/mmf/bassboost.h b/src/3rdparty/phonon/mmf/bassboost.h index 82a3bab..e8e8094 100644 --- a/src/3rdparty/phonon/mmf/bassboost.h +++ b/src/3rdparty/phonon/mmf/bassboost.h @@ -46,8 +46,8 @@ public: protected: // AbstractAudioEffect virtual void createEffect(AudioPlayer::NativePlayer *player); - virtual void parameterChanged(const EffectParameter ¶m, - const QVariant &value); + virtual int parameterChanged(const EffectParameter ¶m, + const QVariant &value); private: CBassBoost *concreteEffect(); diff --git a/src/3rdparty/phonon/mmf/environmentalreverb.cpp b/src/3rdparty/phonon/mmf/environmentalreverb.cpp index 2e30ca1..f362afd 100644 --- a/src/3rdparty/phonon/mmf/environmentalreverb.cpp +++ b/src/3rdparty/phonon/mmf/environmentalreverb.cpp @@ -51,7 +51,7 @@ EnvironmentalReverb::EnvironmentalReverb(QObject *parent, const QList& parameters) } -void Loudness::parameterChanged(const EffectParameter ¶m, +int Loudness::parameterChanged(const EffectParameter ¶m, const QVariant &value) { Q_ASSERT_X(param.id() == 0, Q_FUNC_INFO, "Invalid parameter ID"); setEnabled(value.toBool()); + return 0; } //----------------------------------------------------------------------------- diff --git a/src/3rdparty/phonon/mmf/loudness.h b/src/3rdparty/phonon/mmf/loudness.h index f772d7f..bb3380e 100644 --- a/src/3rdparty/phonon/mmf/loudness.h +++ b/src/3rdparty/phonon/mmf/loudness.h @@ -46,8 +46,8 @@ public: protected: // AbstractAudioEffect virtual void createEffect(AudioPlayer::NativePlayer *player); - virtual void parameterChanged(const EffectParameter ¶m, - const QVariant &value); + virtual int parameterChanged(const EffectParameter ¶m, + const QVariant &value); private: CLoudness *concreteEffect(); diff --git a/src/3rdparty/phonon/mmf/stereowidening.cpp b/src/3rdparty/phonon/mmf/stereowidening.cpp index 4fee1aa..d14617d 100644 --- a/src/3rdparty/phonon/mmf/stereowidening.cpp +++ b/src/3rdparty/phonon/mmf/stereowidening.cpp @@ -37,7 +37,7 @@ StereoWidening::StereoWidening(QObject *parent, const QList& pa } -void StereoWidening::parameterChanged(const EffectParameter ¶m, +int StereoWidening::parameterChanged(const EffectParameter ¶m, const QVariant &value) { Q_ASSERT_X(param.id() == 0, Q_FUNC_INFO, "Invalid parameter ID"); @@ -47,8 +47,7 @@ void StereoWidening::parameterChanged(const EffectParameter ¶m, TRAPD(err, concreteEffect()->SetStereoWideningLevelL(internalLevel)); - // TODO: handle audio effect errors - Q_UNUSED(err); + return err; } //----------------------------------------------------------------------------- diff --git a/src/3rdparty/phonon/mmf/stereowidening.h b/src/3rdparty/phonon/mmf/stereowidening.h index 249c279..c967e37 100644 --- a/src/3rdparty/phonon/mmf/stereowidening.h +++ b/src/3rdparty/phonon/mmf/stereowidening.h @@ -46,8 +46,8 @@ public: protected: // AbstractAudioEffect virtual void createEffect(AudioPlayer::NativePlayer *player); - virtual void parameterChanged(const EffectParameter ¶m, - const QVariant &value); + virtual int parameterChanged(const EffectParameter ¶m, + const QVariant &value); private: CStereoWidening *concreteEffect(); -- cgit v0.12 From 24392fb62bb34a80eb7ce13662b0a8744c9ab415 Mon Sep 17 00:00:00 2001 From: Gareth Stockwell Date: Mon, 11 Jan 2010 18:08:00 +0000 Subject: Added enable/disable parameter to each effect in Phonon MMF backend Task-number: QTBUG-4659 Reviewed-by: Espen Riskedal --- src/3rdparty/phonon/mmf/abstractaudioeffect.cpp | 33 ++++++++++++++++++++++++- src/3rdparty/phonon/mmf/abstractaudioeffect.h | 17 ++++++++++--- src/3rdparty/phonon/mmf/audioequalizer.cpp | 7 +++--- src/3rdparty/phonon/mmf/audioequalizer.h | 4 +-- src/3rdparty/phonon/mmf/bassboost.cpp | 25 +------------------ src/3rdparty/phonon/mmf/bassboost.h | 2 -- src/3rdparty/phonon/mmf/effectfactory.cpp | 15 +++++++++++ src/3rdparty/phonon/mmf/environmentalreverb.cpp | 4 +-- src/3rdparty/phonon/mmf/environmentalreverb.h | 4 +-- src/3rdparty/phonon/mmf/loudness.cpp | 25 +------------------ src/3rdparty/phonon/mmf/loudness.h | 2 -- src/3rdparty/phonon/mmf/stereowidening.cpp | 4 +-- 12 files changed, 74 insertions(+), 68 deletions(-) diff --git a/src/3rdparty/phonon/mmf/abstractaudioeffect.cpp b/src/3rdparty/phonon/mmf/abstractaudioeffect.cpp index e3672e6..132eb79 100644 --- a/src/3rdparty/phonon/mmf/abstractaudioeffect.cpp +++ b/src/3rdparty/phonon/mmf/abstractaudioeffect.cpp @@ -72,7 +72,6 @@ void AbstractAudioEffect::setParameterValue(const Phonon::EffectParameter ¶m if (m_effect.data()) { const EffectParameter& internalParam = internalParameter(param.id()); int err = parameterChanged(internalParam, newValue); - TRAP(err, m_effect->ApplyL()); // TODO: handle audio effect errors Q_UNUSED(err); } @@ -159,5 +158,37 @@ const MMF::EffectParameter& AbstractAudioEffect::internalParameter(int id) const return *result; } +int AbstractAudioEffect::parameterChanged(const EffectParameter ¶m, + const QVariant &value) +{ + int err = 0; + + switch (param.id()) { + case ParameterEnable: + setEnabled(value.toBool()); + break; + default: + { + const EffectParameter& internalParam = internalParameter(param.id()); + err = effectParameterChanged(internalParam, value); + } + break; + } + + if (!err) + TRAP(err, m_effect->ApplyL()); + + return err; +} + +int AbstractAudioEffect::effectParameterChanged( + const EffectParameter ¶m, const QVariant &value) +{ + // Default implementation + Q_ASSERT_X(false, Q_FUNC_INFO, "Effect has no parameters"); + return 0; +} + + QT_END_NAMESPACE diff --git a/src/3rdparty/phonon/mmf/abstractaudioeffect.h b/src/3rdparty/phonon/mmf/abstractaudioeffect.h index a3b35c2..9878472 100644 --- a/src/3rdparty/phonon/mmf/abstractaudioeffect.h +++ b/src/3rdparty/phonon/mmf/abstractaudioeffect.h @@ -72,6 +72,13 @@ public: virtual void setParameterValue(const Phonon::EffectParameter &, const QVariant &newValue); + // Parameters which are shared by all effects + enum CommonParameters + { + ParameterEnable = 0, + ParameterBase // must be last entry in enum + }; + public Q_SLOTS: void abstractPlayerChanged(AbstractPlayer *player); void stateChanged(Phonon::State newState, @@ -82,16 +89,18 @@ protected: void connectMediaObject(MediaObject *mediaObject); void disconnectMediaObject(MediaObject *mediaObject); - void setEnabled(bool enabled); - virtual void createEffect(AudioPlayer::NativePlayer *player) = 0; - virtual int parameterChanged(const EffectParameter ¶m, - const QVariant &value) = 0; + // Effect-specific parameter changed + virtual int effectParameterChanged(const EffectParameter ¶m, + const QVariant &value); private: void createEffect(); + void setEnabled(bool enabled); const EffectParameter& internalParameter(int id) const; + int parameterChanged(const EffectParameter ¶m, + const QVariant &value); protected: QScopedPointer m_effect; diff --git a/src/3rdparty/phonon/mmf/audioequalizer.cpp b/src/3rdparty/phonon/mmf/audioequalizer.cpp index 201a5fc..1d2bbd4 100644 --- a/src/3rdparty/phonon/mmf/audioequalizer.cpp +++ b/src/3rdparty/phonon/mmf/audioequalizer.cpp @@ -37,10 +37,11 @@ AudioEqualizer::AudioEqualizer(QObject *parent, const QList& pa } -int AudioEqualizer::parameterChanged(const EffectParameter ¶m, +int AudioEqualizer::effectParameterChanged(const EffectParameter ¶m, const QVariant &value) { - const int band = param.id() + 1; + const int band = param.id() - ParameterBase + 1; + const qreal externalLevel = value.toReal(); const int internalLevel = param.toInternalValue(externalLevel); @@ -87,7 +88,7 @@ bool AudioEqualizer::getParameters(CMdaAudioOutputStream *stream, // Phonon::EffectWidget. See documentation of EffectParameter // for more details. EffectParameter param( - /* parameterId */ i, + /* parameterId */ ParameterBase + i, /* name */ tr("%1 Hz").arg(hz), /* hints */ EffectParameter::LogarithmicHint, /* defaultValue */ QVariant(qreal(0.0)), diff --git a/src/3rdparty/phonon/mmf/audioequalizer.h b/src/3rdparty/phonon/mmf/audioequalizer.h index acfe9b5..9c3770a 100644 --- a/src/3rdparty/phonon/mmf/audioequalizer.h +++ b/src/3rdparty/phonon/mmf/audioequalizer.h @@ -51,8 +51,8 @@ public: protected: // AbstractAudioEffect virtual void createEffect(AudioPlayer::NativePlayer *player); - virtual int parameterChanged(const EffectParameter ¶m, - const QVariant &value); + virtual int effectParameterChanged(const EffectParameter ¶m, + const QVariant &value); private: CAudioEqualizer *concreteEffect(); diff --git a/src/3rdparty/phonon/mmf/bassboost.cpp b/src/3rdparty/phonon/mmf/bassboost.cpp index 6996ba9..c7af939 100644 --- a/src/3rdparty/phonon/mmf/bassboost.cpp +++ b/src/3rdparty/phonon/mmf/bassboost.cpp @@ -37,14 +37,6 @@ BassBoost::BassBoost(QObject *parent, const QList ¶meters) } -int BassBoost::parameterChanged(const EffectParameter ¶m, - const QVariant &value) -{ - Q_ASSERT_X(param.id() == 0, Q_FUNC_INFO, "Invalid parameter ID"); - setEnabled(value.toBool()); - return 0; -} - //----------------------------------------------------------------------------- // Static functions //----------------------------------------------------------------------------- @@ -57,24 +49,9 @@ const char* BassBoost::description() bool BassBoost::getParameters(CMdaAudioOutputStream *stream, QList ¶meters) { - bool supported = false; - QScopedPointer effect; TRAPD(err, effect.reset(CBassBoost::NewL(*stream))); - - if(KErrNone == err) { - supported = true; - - EffectParameter param( - /* parameterId */ 0, - /* name */ tr("Enabled"), - /* hints */ EffectParameter::ToggledHint, - /* defaultValue */ QVariant(bool(true))); - - parameters.append(param); - } - - return supported; + return (KErrNone == err); } QT_END_NAMESPACE diff --git a/src/3rdparty/phonon/mmf/bassboost.h b/src/3rdparty/phonon/mmf/bassboost.h index e8e8094..fc40e21 100644 --- a/src/3rdparty/phonon/mmf/bassboost.h +++ b/src/3rdparty/phonon/mmf/bassboost.h @@ -46,8 +46,6 @@ public: protected: // AbstractAudioEffect virtual void createEffect(AudioPlayer::NativePlayer *player); - virtual int parameterChanged(const EffectParameter ¶m, - const QVariant &value); private: CBassBoost *concreteEffect(); diff --git a/src/3rdparty/phonon/mmf/effectfactory.cpp b/src/3rdparty/phonon/mmf/effectfactory.cpp index 081f6a3..c5e33d5 100644 --- a/src/3rdparty/phonon/mmf/effectfactory.cpp +++ b/src/3rdparty/phonon/mmf/effectfactory.cpp @@ -176,6 +176,13 @@ EffectFactory::EffectData EffectFactory::getData() OutputStreamFactory streamFactory; QScopedPointer stream(streamFactory.create()); + EffectParameter param( + /* parameterId */ AbstractAudioEffect::ParameterEnable, + /* name */ tr("Enabled"), + /* hints */ EffectParameter::ToggledHint, + /* defaultValue */ QVariant(bool(true))); + data.m_parameters.append(param); + if (data.m_supported = BackendNode::getParameters (stream.data(), data.m_parameters)) { const QString description = QCoreApplication::translate @@ -185,6 +192,14 @@ EffectFactory::EffectData EffectFactory::getData() data.m_descriptions.insert("available", true); } + // Sanity check to ensure that all parameter IDs are unique + QSet ids; + foreach (param, data.m_parameters) { + Q_ASSERT_X(ids.find(param.id()) == ids.end(), Q_FUNC_INFO, + "Parameter list contains duplicates"); + ids.insert(param.id()); + } + return data; } diff --git a/src/3rdparty/phonon/mmf/environmentalreverb.cpp b/src/3rdparty/phonon/mmf/environmentalreverb.cpp index f362afd..89f8d60 100644 --- a/src/3rdparty/phonon/mmf/environmentalreverb.cpp +++ b/src/3rdparty/phonon/mmf/environmentalreverb.cpp @@ -33,7 +33,7 @@ PHONON_MMF_DEFINE_EFFECT_FUNCTIONS(EnvironmentalReverb) enum Parameters { - DecayHFRatio, + DecayHFRatio = AbstractAudioEffect::ParameterBase, DecayTime, Density, Diffusion, @@ -51,7 +51,7 @@ EnvironmentalReverb::EnvironmentalReverb(QObject *parent, const QList& parameters) } -int Loudness::parameterChanged(const EffectParameter ¶m, - const QVariant &value) -{ - Q_ASSERT_X(param.id() == 0, Q_FUNC_INFO, "Invalid parameter ID"); - setEnabled(value.toBool()); - return 0; -} - //----------------------------------------------------------------------------- // Static functions //----------------------------------------------------------------------------- @@ -57,24 +49,9 @@ const char* Loudness::description() bool Loudness::getParameters(CMdaAudioOutputStream *stream, QList ¶meters) { - bool supported = false; - QScopedPointer effect; TRAPD(err, effect.reset(CLoudness::NewL(*stream))); - - if(KErrNone == err) { - supported = true; - - EffectParameter param( - /* parameterId */ 0, - /* name */ tr("Enabled"), - /* hints */ EffectParameter::ToggledHint, - /* defaultValue */ QVariant(bool(true))); - - parameters.append(param); - } - - return supported; + return (KErrNone == err); } QT_END_NAMESPACE diff --git a/src/3rdparty/phonon/mmf/loudness.h b/src/3rdparty/phonon/mmf/loudness.h index bb3380e..a688a67 100644 --- a/src/3rdparty/phonon/mmf/loudness.h +++ b/src/3rdparty/phonon/mmf/loudness.h @@ -46,8 +46,6 @@ public: protected: // AbstractAudioEffect virtual void createEffect(AudioPlayer::NativePlayer *player); - virtual int parameterChanged(const EffectParameter ¶m, - const QVariant &value); private: CLoudness *concreteEffect(); diff --git a/src/3rdparty/phonon/mmf/stereowidening.cpp b/src/3rdparty/phonon/mmf/stereowidening.cpp index d14617d..f90651b 100644 --- a/src/3rdparty/phonon/mmf/stereowidening.cpp +++ b/src/3rdparty/phonon/mmf/stereowidening.cpp @@ -40,7 +40,7 @@ StereoWidening::StereoWidening(QObject *parent, const QList& pa int StereoWidening::parameterChanged(const EffectParameter ¶m, const QVariant &value) { - Q_ASSERT_X(param.id() == 0, Q_FUNC_INFO, "Invalid parameter ID"); + Q_ASSERT_X(param.id() == ParameterBase, Q_FUNC_INFO, "Invalid parameter ID"); const qreal externalLevel = value.toReal(); const int internalLevel = param.toInternalValue(externalLevel); @@ -75,7 +75,7 @@ bool StereoWidening::getParameters(CMdaAudioOutputStream *stream, (effect->StereoWideningLevel(), 0, 100); EffectParameter param( - /* parameterId */ 0, + /* parameterId */ ParameterBase, /* name */ tr("Level (%)"), /* hints */ EffectParameter::IntegerHint, /* defaultValue */ QVariant(defaultValue), -- cgit v0.12 From 3efc651f6695ec224374bf29ad5b695a8e492a65 Mon Sep 17 00:00:00 2001 From: Markus Goetz Date: Mon, 11 Jan 2010 19:49:43 +0100 Subject: QNAM HTTP Code: Cache socket state inside ensureConnection() Reviewed-by: TrustMe --- src/network/access/qhttpnetworkconnectionchannel.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/network/access/qhttpnetworkconnectionchannel.cpp b/src/network/access/qhttpnetworkconnectionchannel.cpp index da305a0..39d09aa 100644 --- a/src/network/access/qhttpnetworkconnectionchannel.cpp +++ b/src/network/access/qhttpnetworkconnectionchannel.cpp @@ -432,21 +432,23 @@ void QHttpNetworkConnectionChannel::_q_receiveReply() bool QHttpNetworkConnectionChannel::ensureConnection() { + QAbstractSocket::SocketState socketState = socket->state(); + // resend this request after we receive the disconnected signal - if (socket->state() == QAbstractSocket::ClosingState) { + if (socketState == QAbstractSocket::ClosingState) { resendCurrent = true; return false; } // already trying to connect? - if (socket->state() == QAbstractSocket::HostLookupState || - socket->state() == QAbstractSocket::ConnectingState) { + if (socketState == QAbstractSocket::HostLookupState || + socketState == QAbstractSocket::ConnectingState) { return false; } // make sure that this socket is in a connected state, if not initiate // connection to the host. - if (socket->state() != QAbstractSocket::ConnectedState) { + if (socketState != QAbstractSocket::ConnectedState) { // connect to the host if not already connected. state = QHttpNetworkConnectionChannel::ConnectingState; pendingEncrypt = connection->d_func()->encrypt; -- cgit v0.12 From 7abb2cfdea14fa71aabcd79635aa8f407ed96186 Mon Sep 17 00:00:00 2001 From: Rhys Weatherley Date: Tue, 12 Jan 2010 08:36:29 +1000 Subject: Update changes file with Rhys Weatherley's work. --- dist/changes-4.6.1 | 45 +++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 43 insertions(+), 2 deletions(-) diff --git a/dist/changes-4.6.1 b/dist/changes-4.6.1 index 145e09e..65b865a 100644 --- a/dist/changes-4.6.1 +++ b/dist/changes-4.6.1 @@ -73,6 +73,39 @@ QtOpenGL * bindTexture(QString) now supports DDS, ETC1, PVRTC2, and PVRTC4 compressed textures if the appropriate extensions are present in the GL implementation. + * bindTexture(QImage): Reduce double-copying of textures when flipping. + * [QTBUG-6454] Better EGL extension checking to avoid prefix problems + with EGL_foo matching EGL_foo_bar. + * [QTBUG-6217] Work around problems with glColor4ub() on Intel Q45/Q43 + Express by consistently using glColor4f() everywhere. + * bindTexture(QImage): Fix GL_BGRA formats under OpenGL/ES by using + the same value for both internal and external texture formats. + * [QTBUG-5041] Disable depth testing while in renderText(). + - QGLPaintDevice + * [QTBUG-6204] Rebind window surface fbo after native GL rendering. + - QGLEngineSelector + * [QTBUG-5638] Detect GL2 based on fragment shaders, not programs. + Fragment programs are a GL1 feature. + - QGLFramebufferObject + * [QTBUG-6712] Update docs to better explain how QPainter changes + the GL state when used on an FBO. + - QGLPixmapData + * [QTBUG-6902] Align GL_RGB data on a 4-byte line boundary. + - QTriangulatingStroker + * [QTBUG-6045] Crash in dashed line handling in the GL stroker. + - QGLGlyphCache + * [QTBUG-6936] Fix memory leak of QGLGlyphCoord objects. + +QtOpenVG +-------- + + - [QT-2555] Automatically destroy VG pixmaps when the last window surface + goes away to reduce memory consumption of backgrounded applications. + - [QTBUG-6639] Recover from out-of-memory when creating VGImage's. + - [QT-2554] Add a VGImage allocation pool to support reclaiming older + images when the GPU runs out of memory. + - [QTBUG-7051] Reset the OpenVG scissor after a native painting call-out. + - [QTBUG-7015] Avoid deep copies of QImage in QImage::bits() calls. QtScript -------- @@ -95,8 +128,16 @@ QtXml Qt Plugins ---------- - - foo - * bar + - JPEG plugin + * Remove obsolete parameter string handling. + * [QT-2023] Re-implement ScaledSize, ClipRect, ScaledClipRect with + libjpeg features for greater performance. + - PBM plugin + * [QTBUG-6937] Use Mono instead of MonoLSB when writing pbm files. + - TIFF plugin + * [QTBUG-6870] BitsPerSample should default to 1 in TIFF files. + - PNG plugin + * [QTBUG-7161] Avoid a deep copy of QImage::bits() in the png writer. Third party components ---------------------- -- cgit v0.12 From 54044ee128f0e2e2ecdbffd03de7241702fd4ba7 Mon Sep 17 00:00:00 2001 From: Gunnar Sletta Date: Thu, 7 Jan 2010 10:14:06 +0100 Subject: Fix point drawing on raster engine for flat and square caps Task: http://bugreports.qt.nokia.com/browse/QTBUG-6721 Reviewed-by: Samuel --- src/gui/painting/qpaintengineex.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/gui/painting/qpaintengineex.cpp b/src/gui/painting/qpaintengineex.cpp index 9a0e319..67c4998 100644 --- a/src/gui/painting/qpaintengineex.cpp +++ b/src/gui/painting/qpaintengineex.cpp @@ -860,7 +860,7 @@ void QPaintEngineEx::drawPoints(const QPointF *points, int pointCount) for (int i=0; i Date: Tue, 12 Jan 2010 09:20:02 +0100 Subject: Added changelog entries. --- dist/changes-4.6.1 | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/dist/changes-4.6.1 b/dist/changes-4.6.1 index 145e09e..e26cc8d 100644 --- a/dist/changes-4.6.1 +++ b/dist/changes-4.6.1 @@ -145,6 +145,15 @@ Qt for Windows CE - +Qt for Symbian +-------------- + + - QApplication + * [QTBUG-6098] Added a flag to avoid construction of application panes. + + - Other: + * [QTBUG-4990] Rewrote most of the regular pointer handling. + **************************************************************************** * Tools * **************************************************************************** -- cgit v0.12 From 8b56ffee8bb4ec0c56c2c05ccc1e088f6d9ae8a8 Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Tue, 12 Jan 2010 09:42:00 +0100 Subject: Prevent a crash when creating an inputContext from the QApplication dtor. Complete the fix in f72165460d27860cabd51691f4d935fd74b50f80 by applying the same fix to Symbian and QWS. Task-number: QTBUG-7105 Reviewed-by: Alexis Reviewed-by: Jason McDonald --- src/gui/kernel/qwidget_qws.cpp | 2 +- src/gui/kernel/qwidget_s60.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gui/kernel/qwidget_qws.cpp b/src/gui/kernel/qwidget_qws.cpp index 1f1dac6..b827e8b 100644 --- a/src/gui/kernel/qwidget_qws.cpp +++ b/src/gui/kernel/qwidget_qws.cpp @@ -287,7 +287,7 @@ void QWidget::destroy(bool destroyWindow, bool destroySubWindows) } else { // release previous focus information participating with // preedit preservation of qic -- while we still have a winId - QInputContext *qic = inputContext(); + QInputContext *qic = QApplicationPrivate::inputContext; if (qic) qic->widgetDestroyed(this); } diff --git a/src/gui/kernel/qwidget_s60.cpp b/src/gui/kernel/qwidget_s60.cpp index 75c2e31..c65a162 100644 --- a/src/gui/kernel/qwidget_s60.cpp +++ b/src/gui/kernel/qwidget_s60.cpp @@ -1152,7 +1152,7 @@ void QWidget::destroy(bool destroyWindow, bool destroySubWindows) if (d->ic) { delete d->ic; } else { - QInputContext *ic = inputContext(); + QInputContext *ic = QApplicationPrivate::inputContext; if (ic) { ic->widgetDestroyed(this); } -- cgit v0.12 From 2efba0002d26b584c771aa9260e6d699e5ff8da3 Mon Sep 17 00:00:00 2001 From: Kent Hansen Date: Tue, 12 Jan 2010 10:03:50 +0100 Subject: doc: update snippets for QtScript function expressions With the JSC-based back-end it's necessary to wrap the function in parentheses. Task-number: QTBUG-6644 --- doc/src/snippets/code/doc_src_qtscript.qdoc | 6 +++--- doc/src/snippets/code/src_script_qscriptengine.cpp | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/doc/src/snippets/code/doc_src_qtscript.qdoc b/doc/src/snippets/code/doc_src_qtscript.qdoc index 00dd716..a33a982 100644 --- a/doc/src/snippets/code/doc_src_qtscript.qdoc +++ b/doc/src/snippets/code/doc_src_qtscript.qdoc @@ -513,7 +513,7 @@ int main(int argc, char **argv) //! [47] QScriptEngine eng; QLineEdit *edit = new QLineEdit(...); -QScriptValue handler = eng.evaluate("function(text) { print('text was changed to', text); }"); +QScriptValue handler = eng.evaluate("(function(text) { print('text was changed to', text); })"); qScriptConnect(edit, SIGNAL(textChanged(const QString &)), QScriptValue(), handler); //! [47] @@ -521,7 +521,7 @@ qScriptConnect(edit, SIGNAL(textChanged(const QString &)), QScriptValue(), handl QLineEdit *edit1 = new QLineEdit(...); QLineEdit *edit2 = new QLineEdit(...); -QScriptValue handler = eng.evaluate("function() { print('I am', this.name); }"); +QScriptValue handler = eng.evaluate("(function() { print('I am', this.name); })"); QScriptValue obj1 = eng.newObject(); obj1.setProperty("name", "the walrus"); QScriptValue obj2 = eng.newObject(); @@ -790,7 +790,7 @@ QScriptValue counter_hybrid(QScriptContext *ctx, QScriptEngine *eng) { QScriptValue act = ctx->activationObject(); act.setProperty("count", 0); - return eng->evaluate("function() { return count++; }"); + return eng->evaluate("(function() { return count++; })"); } //! [74] diff --git a/doc/src/snippets/code/src_script_qscriptengine.cpp b/doc/src/snippets/code/src_script_qscriptengine.cpp index c82eb65..f0165fd 100644 --- a/doc/src/snippets/code/src_script_qscriptengine.cpp +++ b/doc/src/snippets/code/src_script_qscriptengine.cpp @@ -46,7 +46,7 @@ QScriptValue three = myEngine.evaluate("1 + 2"); //! [1] -QScriptValue fun = myEngine.evaluate("function(a, b) { return a + b; }"); +QScriptValue fun = myEngine.evaluate("(function(a, b) { return a + b; })"); QScriptValueList args; args << 1 << 2; QScriptValue threeAgain = fun.call(QScriptValue(), args); -- cgit v0.12 From a1ec686734e105228ff539c0e3bfc7850c66dc04 Mon Sep 17 00:00:00 2001 From: Alexis Menard Date: Tue, 12 Jan 2010 10:35:26 +0100 Subject: Fix completion in QFileDialog. Completing under the root directory was "eating" the first letter. On windows under C:\ the completion was not working at all. Task-number: QTBUG-4933 Reviewed-by:janarve Reviewed-by:gabi --- src/gui/dialogs/qfiledialog.cpp | 8 ++++++ tests/auto/qfiledialog2/tst_qfiledialog2.cpp | 42 +++++++++++++++++++++++++++- 2 files changed, 49 insertions(+), 1 deletion(-) diff --git a/src/gui/dialogs/qfiledialog.cpp b/src/gui/dialogs/qfiledialog.cpp index 3c388de..ab44fe7 100644 --- a/src/gui/dialogs/qfiledialog.cpp +++ b/src/gui/dialogs/qfiledialog.cpp @@ -3245,6 +3245,10 @@ QString QFSCompleter::pathFromIndex(const QModelIndex &index) const QString currentLocation = dirModel->rootPath(); QString path = index.data(QFileSystemModel::FilePathRole).toString(); if (!currentLocation.isEmpty() && path.startsWith(currentLocation)) { +#if defined(Q_OS_UNIX) || defined(Q_OS_WINCE) + if (currentLocation == QDir::separator()) + return path.mid(currentLocation.length()); +#endif return path.mid(currentLocation.length() + 1); } return index.data(QFileSystemModel::FilePathRole).toString(); @@ -3300,6 +3304,10 @@ QStringList QFSCompleter::splitPath(const QString &path) const else dirModel = sourceModel; QString currentLocation = QDir::toNativeSeparators(dirModel->rootPath()); +#if defined(Q_OS_WIN) || defined(Q_OS_SYMBIAN) + if (currentLocation.endsWith(QLatin1Char(':'))) + currentLocation.append(sep); +#endif if (currentLocation.contains(sep) && path != currentLocation) { QStringList currentLocationList = splitPath(currentLocation); while (!currentLocationList.isEmpty() diff --git a/tests/auto/qfiledialog2/tst_qfiledialog2.cpp b/tests/auto/qfiledialog2/tst_qfiledialog2.cpp index c3f88c4..f1fac17 100644 --- a/tests/auto/qfiledialog2/tst_qfiledialog2.cpp +++ b/tests/auto/qfiledialog2/tst_qfiledialog2.cpp @@ -116,6 +116,7 @@ private slots: #if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) void task226366_lowerCaseHardDriveWindows(); #endif + void completionOnLevelAfterRoot(); void task233037_selectingDirectory(); void task235069_hideOnEscape(); void task236402_dontWatchDeletedDir(); @@ -202,7 +203,7 @@ void tst_QFiledialog::heapCorruption() qDeleteAll(dialogs); } -struct FriendlyQFileDialog : public QFileDialog +struct FriendlyQFileDialog : public QNonNativeFileDialog { friend class tst_QFileDialog; Q_DECLARE_PRIVATE(QFileDialog) @@ -552,6 +553,45 @@ void tst_QFiledialog::task226366_lowerCaseHardDriveWindows() } #endif +void tst_QFiledialog::completionOnLevelAfterRoot() +{ + QNonNativeFileDialog fd; +#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) + fd.setDirectory("C:"); + QDir current = fd.directory(); + current.mkdir("completionOnLevelAfterRootTest"); +#else + fd.setFilter(QDir::Hidden | QDir::AllDirs | QDir::Files | QDir::System); + fd.setDirectory("/"); + QDir etc("/etc"); + if (!etc.exists()) + QSKIP("This test requires to have an etc directory under /", SkipAll); +#endif + fd.show(); + QLineEdit *edit = qFindChild(&fd, "fileNameEdit"); + QTest::qWait(2000); +#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) + //I love testlib :D + QTest::keyClick(edit, Qt::Key_C); + QTest::keyClick(edit, Qt::Key_O); + QTest::keyClick(edit, Qt::Key_M); + QTest::keyClick(edit, Qt::Key_P); + QTest::keyClick(edit, Qt::Key_L); +#else + QTest::keyClick(edit, Qt::Key_E); + QTest::keyClick(edit, Qt::Key_T); +#endif + QTest::qWait(200); + QTest::keyClick(edit->completer()->popup(), Qt::Key_Down); + QTest::qWait(200); +#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) + QCOMPARE(edit->text(), QString("completionOnLevelAfterRootTest")); + current.rmdir("completionOnLevelAfterRootTest"); +#else + QCOMPARE(edit->text(), QString("etc")); +#endif +} + void tst_QFiledialog::task233037_selectingDirectory() { QDir current = QDir::currentPath(); -- cgit v0.12 From eef74a19b867f307d7a0c0c47f3ee0ce2c4d283e Mon Sep 17 00:00:00 2001 From: "Bradley T. Hughes" Date: Tue, 12 Jan 2010 11:31:34 +0100 Subject: my 4.6.1 changelog contributions --- dist/changes-4.6.1 | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/dist/changes-4.6.1 b/dist/changes-4.6.1 index 145e09e..b1eb6e2 100644 --- a/dist/changes-4.6.1 +++ b/dist/changes-4.6.1 @@ -46,6 +46,10 @@ QtCore QtGui ----- + - QApplication + * [QTBUG-6654] Fix crashes when deleting QWidgets in touch event + handlers. + - QPixmap * load() and loadFromData() can now support compressed GL textures in the DDS, ETC1, PVRTC2, and PVRTC4 formats if the OpenGL graphics @@ -54,6 +58,10 @@ QtGui - QGraphicsObject * 'id' property was removed. Use the 'objectName' property instead. + - QGraphicsScene + * [QTBUG-6654] Fix crashes when deleting QGraphicsItems in touch + event handlers. + QtDBus ------ @@ -118,12 +126,23 @@ Qt for Unix (X11 and Mac OS X) Qt for Linux/X11 ---------------- - - + - QGuiEventDispatcherGlib (internal class) + * Fix regression introduced in 4.6.0 that could cause X11 event + processing to starve timer events. + + - QFileSystemWatcher + * [QTBUG-4840] Fix memory leak in the dnotify implementation. Qt for Windows -------------- - - + - QAtomicPointer + * [QTBUG-6079] Fix compilation for 64-bit Windows targets. + + - QEventDispatchWin32 (internal class) + * [QTBUG-6083] Fix a performance regression introduced in 4.6.0 + that would cause all Qt posted events to be sent at 15-16ms + intervals (instead of as quickly as possible). Qt for Mac OS X --------------- -- cgit v0.12 From 008bae01b016926209dddacc6e31c79b9d99d4f7 Mon Sep 17 00:00:00 2001 From: Miikka Heikkinen Date: Tue, 12 Jan 2010 12:29:35 +0200 Subject: Added absolute path to sqlite3.sis in s60installs.pro Relative path was only working when package was created from s60installs directory. Binary installer creation requires package creation to work also from Qt root, so added absolute path to sqlite3.sis. Task-number: QTBUG-7275 Reviewed-by: Janne Anttila --- src/s60installs/s60installs.pro | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/s60installs/s60installs.pro b/src/s60installs/s60installs.pro index eb35419..bbc758b 100644 --- a/src/s60installs/s60installs.pro +++ b/src/s60installs/s60installs.pro @@ -36,7 +36,7 @@ symbian: { sqlitedeployment = \ "; Deploy sqlite onto phone that does not have it already" \ - "@\"sqlite3.sis\", (0x2002af5f)" + "@\"$$PWD/sqlite3.sis\", (0x2002af5f)" qtlibraries.pkg_postrules += sqlitedeployment qtlibraries.path = c:/sys/bin -- cgit v0.12 From d1f73b7be62b0f6e9294b5d78ccd0680cb9fe118 Mon Sep 17 00:00:00 2001 From: Markus Goetz Date: Tue, 12 Jan 2010 12:14:41 +0100 Subject: Update changelog with some of my stuff --- dist/changes-4.6.1 | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/dist/changes-4.6.1 b/dist/changes-4.6.1 index b1eb6e2..5255894 100644 --- a/dist/changes-4.6.1 +++ b/dist/changes-4.6.1 @@ -40,8 +40,11 @@ Optimizations QtCore ------ - - foo - * bar + - QFile + * Improve performance of getting the canonical filename on Linux + and Symbian by using realpath() system call + * Avoid stat() when opening a file + QtGui ----- @@ -71,8 +74,18 @@ QtDBus QtNetwork --------- - - foo - * bar + - QNetworkAccessManager + * HTTP: Smaller improvements + * HTTP: Send our locale with the HTTP request + * HTTP: Start Accept-language and Authorization header with capital letter + * file: Introduce special subclass for higher performance with file:// URLs + - QTcpSocket + * [QTBUG-5799] Fix waitForConnected() on Windows + - QNetworkProxyFactory + * Fixed systemProxyForQuery(), it could sometimes return invalid empty list + on Windows + - QHostInfo + * Use 5 parallel threads for host lookup instead of 1 QtOpenGL -------- -- cgit v0.12 From 83e3c4677a71d8f890f9506360b95b7f9ac9bd84 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Mon, 11 Jan 2010 13:48:27 +0100 Subject: print actual rather than expected output for matching text the expected may contain regular expressions. --- tests/auto/linguist/lupdate/tst_lupdate.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/auto/linguist/lupdate/tst_lupdate.cpp b/tests/auto/linguist/lupdate/tst_lupdate.cpp index 80c8f4f..ff3ab68 100644 --- a/tests/auto/linguist/lupdate/tst_lupdate.cpp +++ b/tests/auto/linguist/lupdate/tst_lupdate.cpp @@ -120,7 +120,7 @@ void tst_lupdate::doCompare(const QStringList &actual, const QString &expectedFn } QByteArray diff; for (int j = qMax(0, i - 3); j < i; j++) - diff += expected.at(j) + '\n'; + diff += actual.at(j) + '\n'; diff += "<<<<<<< got\n"; for (int j = i; j < gi; j++) { diff += actual.at(j) + '\n'; @@ -138,8 +138,8 @@ void tst_lupdate::doCompare(const QStringList &actual, const QString &expectedFn } } diff += ">>>>>>> expected\n"; - for (int j = ei; j < qMin(ei + 3, expected.size()); j++) - diff += expected.at(j) + '\n'; + for (int j = gi; j < qMin(gi + 3, actual.size()); j++) + diff += actual.at(j) + '\n'; QFAIL(qPrintable((err ? "Output for " : "Result for ") + expectedFn + " does not meet expectations:\n" + diff)); } -- cgit v0.12 From 72eceedb1eee049ebb10ebf7f7b1b0037e1ebbf3 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Mon, 11 Jan 2010 13:48:59 +0100 Subject: remove superfluous \r filtering we are opening the files/processes in text mode already --- tests/auto/linguist/lupdate/tst_lupdate.cpp | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/tests/auto/linguist/lupdate/tst_lupdate.cpp b/tests/auto/linguist/lupdate/tst_lupdate.cpp index ff3ab68..38bc24e 100644 --- a/tests/auto/linguist/lupdate/tst_lupdate.cpp +++ b/tests/auto/linguist/lupdate/tst_lupdate.cpp @@ -99,17 +99,13 @@ void tst_lupdate::doCompare(const QStringList &actual, const QString &expectedFn ei = 0; break; } else { - QString act = actual.at(i); - act.remove('\r'); - if (err ? !QRegExp(expected.at(i)).exactMatch(act) : - (act != expected.at(i))) { + if (err ? !QRegExp(expected.at(i)).exactMatch(actual.at(i)) : + (actual.at(i) != expected.at(i))) { bool cond = true; while (cond) { - act = actual.at(gi - 1); - act.remove('\r'); cond = (ei - 1) >= i && (gi - 1) >= i && - (err ? QRegExp(expected.at(ei - 1)).exactMatch(act) : - (act == expected.at(ei - 1))); + (err ? QRegExp(expected.at(ei - 1)).exactMatch(actual.at(gi - 1)) : + (actual.at(gi - 1) == expected.at(ei - 1))); if (cond) { ei--, gi--; } -- cgit v0.12 From bb1b7fcc4d9377bccd8e4cc031a94784c9b5d5fe Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Tue, 12 Jan 2010 12:14:24 +0100 Subject: support regexp-like quantifiers of expected output lines makes platform-specific optional output possible --- tests/auto/linguist/lupdate/tst_lupdate.cpp | 126 ++++++++++++++++++++++------ 1 file changed, 100 insertions(+), 26 deletions(-) diff --git a/tests/auto/linguist/lupdate/tst_lupdate.cpp b/tests/auto/linguist/lupdate/tst_lupdate.cpp index 38bc24e..f0ff350 100644 --- a/tests/auto/linguist/lupdate/tst_lupdate.cpp +++ b/tests/auto/linguist/lupdate/tst_lupdate.cpp @@ -82,59 +82,133 @@ tst_lupdate::tst_lupdate() m_basePath = QDir::currentPath() + QLatin1String("/testdata/"); } +static bool prepareMatch(const QString &expect, QString *tmpl, int *require, int *accept) +{ + if (expect.startsWith(QLatin1Char('\\'))) { + *tmpl = expect.mid(1); + *require = *accept = 1; + } else if (expect.startsWith(QLatin1Char('?'))) { + *tmpl = expect.mid(1); + *require = 0; + *accept = 1; + } else if (expect.startsWith(QLatin1Char('*'))) { + *tmpl = expect.mid(1); + *require = 0; + *accept = INT_MAX; + } else if (expect.startsWith(QLatin1Char('+'))) { + *tmpl = expect.mid(1); + *require = 1; + *accept = INT_MAX; + } else if (expect.startsWith(QLatin1Char('{'))) { + int brc = expect.indexOf(QLatin1Char('}'), 1); + if (brc < 0) + return false; + *tmpl = expect.mid(brc + 1); + QString sub = expect.mid(1, brc - 1); + int com = sub.indexOf(QLatin1Char(',')); + bool ok; + if (com < 0) { + *require = *accept = sub.toInt(&ok); + return ok; + } else { + *require = sub.left(com).toInt(); + *accept = sub.mid(com + 1).toInt(&ok); + if (!ok) + *accept = INT_MAX; + return *accept >= *require; + } + } else { + *tmpl = expect; + *require = *accept = 1; + } + return true; +} + void tst_lupdate::doCompare(const QStringList &actual, const QString &expectedFn, bool err) { QFile file(expectedFn); QVERIFY2(file.open(QIODevice::ReadOnly | QIODevice::Text), qPrintable(expectedFn)); QStringList expected = QString(file.readAll()).trimmed().split('\n'); - int i = 0, ei = expected.size(), gi = actual.size(); - for (; ; i++) { - if (i == gi) { - if (i == ei) - return; - gi = 0; - break; - } else if (i == ei) { - ei = 0; + int ei = 0, ai = 0, em = expected.size(), am = actual.size(); + int oei = 0, oai = 0, oem = em, oam = am; + int require = 0, accept = 0; + QString tmpl; + forever { + if (!accept) { + oei = ei, oai = ai; + if (ei == em) { + if (ai == am) + return; + break; + } + if (!prepareMatch(expected.at(ei++), &tmpl, &require, &accept)) + QFAIL(qPrintable(QString("Malformed expected %1 at %3:%2") + .arg(err ? "output" : "result").arg(ei).arg(expectedFn))); + } + if (ai == am) { + if (require <= 0) { + accept = 0; + continue; + } break; - } else { - if (err ? !QRegExp(expected.at(i)).exactMatch(actual.at(i)) : - (actual.at(i) != expected.at(i))) { - bool cond = true; - while (cond) { - cond = (ei - 1) >= i && (gi - 1) >= i && - (err ? QRegExp(expected.at(ei - 1)).exactMatch(actual.at(gi - 1)) : - (actual.at(gi - 1) == expected.at(ei - 1))); - if (cond) { - ei--, gi--; + } + if (err ? !QRegExp(tmpl).exactMatch(actual.at(ai)) : (actual.at(ai) != tmpl)) { + if (require <= 0) { + accept = 0; + continue; + } + ei--; + require = accept = 0; + forever { + if (!accept) { + oem = em, oam = am; + if (ei == em) + break; + if (!prepareMatch(expected.at(--em), &tmpl, &require, &accept)) + QFAIL(qPrintable(QString("Malformed expected %1 at %3:%2") + .arg(err ? "output" : "result") + .arg(em + 1).arg(expectedFn))); + } + if (ai == am || (err ? !QRegExp(tmpl).exactMatch(actual.at(am - 1)) : + (actual.at(am - 1) != tmpl))) { + if (require <= 0) { + accept = 0; + continue; } + break; } - break; + accept--; + require--; + am--; } + break; } + accept--; + require--; + ai++; } QByteArray diff; - for (int j = qMax(0, i - 3); j < i; j++) + for (int j = qMax(0, oai - 3); j < oai; j++) diff += actual.at(j) + '\n'; diff += "<<<<<<< got\n"; - for (int j = i; j < gi; j++) { + for (int j = oai; j < oam; j++) { diff += actual.at(j) + '\n'; - if (j >= i + 5) { + if (j >= oai + 5) { diff += "...\n"; break; } } diff += "=========\n"; - for (int j = i; j < ei; j++) { + for (int j = oei; j < oem; j++) { diff += expected.at(j) + '\n'; - if (j >= i + 5) { + if (j >= oei + 5) { diff += "...\n"; break; } } diff += ">>>>>>> expected\n"; - for (int j = gi; j < qMin(gi + 3, actual.size()); j++) + for (int j = oam; j < qMin(oam + 3, actual.size()); j++) diff += actual.at(j) + '\n'; QFAIL(qPrintable((err ? "Output for " : "Result for ") + expectedFn + " does not meet expectations:\n" + diff)); } -- cgit v0.12 From 273b575e16d0c84fa6b57b70a74107b86ad7aaa3 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Tue, 12 Jan 2010 12:15:52 +0100 Subject: really fix the autotest --- tests/auto/linguist/lupdate/testdata/good/heuristics/expectedoutput.txt | 1 + tests/auto/linguist/lupdate/testdata/good/heuristics/project.pro | 1 - 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/auto/linguist/lupdate/testdata/good/heuristics/expectedoutput.txt b/tests/auto/linguist/lupdate/testdata/good/heuristics/expectedoutput.txt index 1eed403..d5112cc 100644 --- a/tests/auto/linguist/lupdate/testdata/good/heuristics/expectedoutput.txt +++ b/tests/auto/linguist/lupdate/testdata/good/heuristics/expectedoutput.txt @@ -1,3 +1,4 @@ +*.*Function _eval_ is not implemented Updating 'project\.ts'\.\.\. Found 3 source text\(s\) \(3 new and 0 already existing\) Removed 5 obsolete entries diff --git a/tests/auto/linguist/lupdate/testdata/good/heuristics/project.pro b/tests/auto/linguist/lupdate/testdata/good/heuristics/project.pro index 034f298..759bea0 100644 --- a/tests/auto/linguist/lupdate/testdata/good/heuristics/project.pro +++ b/tests/auto/linguist/lupdate/testdata/good/heuristics/project.pro @@ -1,4 +1,3 @@ SOURCES = main.cpp -CONFIG -= debug_and_release TRANSLATIONS = project.ts -- cgit v0.12 From b4067f455dca3007236a1043d641e92ecb8d3d54 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Tue, 12 Jan 2010 12:16:12 +0100 Subject: remove trimming of (expected) output it's needless and potentially detrimental --- .../linguist/lupdate/testdata/good/parsecpp2/expectedoutput.txt | 1 + tests/auto/linguist/lupdate/tst_lupdate.cpp | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/tests/auto/linguist/lupdate/testdata/good/parsecpp2/expectedoutput.txt b/tests/auto/linguist/lupdate/testdata/good/parsecpp2/expectedoutput.txt index 8d057d8..e3543c9 100644 --- a/tests/auto/linguist/lupdate/testdata/good/parsecpp2/expectedoutput.txt +++ b/tests/auto/linguist/lupdate/testdata/good/parsecpp2/expectedoutput.txt @@ -5,3 +5,4 @@ .*/lupdate/testdata/good/parsecpp2/main.cpp:61: Excess closing brace .* .*/lupdate/testdata/good/parsecpp2/main.cpp:65: Excess closing brace .* + diff --git a/tests/auto/linguist/lupdate/tst_lupdate.cpp b/tests/auto/linguist/lupdate/tst_lupdate.cpp index f0ff350..5c910da 100644 --- a/tests/auto/linguist/lupdate/tst_lupdate.cpp +++ b/tests/auto/linguist/lupdate/tst_lupdate.cpp @@ -128,7 +128,7 @@ void tst_lupdate::doCompare(const QStringList &actual, const QString &expectedFn { QFile file(expectedFn); QVERIFY2(file.open(QIODevice::ReadOnly | QIODevice::Text), qPrintable(expectedFn)); - QStringList expected = QString(file.readAll()).trimmed().split('\n'); + QStringList expected = QString(file.readAll()).split('\n'); int ei = 0, ai = 0, em = expected.size(), am = actual.size(); int oei = 0, oai = 0, oem = em, oam = am; @@ -217,7 +217,7 @@ void tst_lupdate::doCompare(const QString &actualFn, const QString &expectedFn, { QFile afile(actualFn); QVERIFY2(afile.open(QIODevice::ReadOnly | QIODevice::Text), qPrintable(actualFn)); - QStringList actual = QString(afile.readAll()).trimmed().split('\n'); + QStringList actual = QString(afile.readAll()).split('\n'); doCompare(actual, expectedFn, err); } @@ -282,7 +282,7 @@ void tst_lupdate::good() proc.setProcessChannelMode(QProcess::MergedChannels); proc.start(m_cmdLupdate + ' ' + lupdatecmd, QIODevice::ReadWrite | QIODevice::Text); QVERIFY2(proc.waitForFinished(5000), qPrintable(lupdatecmd)); - QByteArray output = proc.readAll().trimmed(); + QByteArray output = proc.readAll(); QVERIFY2(proc.exitStatus() == QProcess::NormalExit, "\"lupdate " + lupdatecmd.toLatin1() + "\" crashed\n" + output); QVERIFY2(!proc.exitCode(), -- cgit v0.12 From 04bdf9f6a77e9ebf96431f89b8240a037b3d2b09 Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Tue, 12 Jan 2010 12:28:22 +0100 Subject: Updated WebKit from /home/shausman/src/webkit/trunk to qtwebkit/qtwebkit-4.6 ( bd6591b4acaf2172ab05702153ef539c0ac89cbb ) Changes in WebKit/qt since the last update: ++ b/WebKit/qt/ChangeLog 2009-12-18 Joe Ligman Reviewed by Kenneth Rohde Christiansen. [Qt] Add new API to QWebFrame to scrollRecursively starting with any css overflow then checking current frame and then ancestors https://bugs.webkit.org/show_bug.cgi?id=32668 * Api/qwebframe.cpp: (QWebFramePrivate::scrollOverflow): (QWebFrame::scrollRecursively): * Api/qwebframe.h: * Api/qwebframe_p.h: * tests/qwebframe/qwebframe.qrc: * tests/qwebframe/testiframe.html: Added. * tests/qwebframe/testiframe2.html: Added. * tests/qwebframe/tst_qwebframe.cpp: --- src/3rdparty/webkit/VERSION | 2 +- src/3rdparty/webkit/WebCore/ChangeLog | 13 ++++ .../webkit/WebCore/xml/XSLTProcessorQt.cpp | 30 ++++++++ src/3rdparty/webkit/WebKit/qt/Api/qwebframe.cpp | 84 ++++++++++++++++++++++ src/3rdparty/webkit/WebKit/qt/Api/qwebframe_p.h | 2 + src/3rdparty/webkit/WebKit/qt/ChangeLog | 18 +++++ .../webkit/WebKit/qt/tests/qwebframe/qwebframe.qrc | 2 + .../WebKit/qt/tests/qwebframe/testiframe.html | 54 ++++++++++++++ .../WebKit/qt/tests/qwebframe/testiframe2.html | 21 ++++++ .../WebKit/qt/tests/qwebframe/tst_qwebframe.cpp | 67 +++++++++++++++++ 10 files changed, 292 insertions(+), 1 deletion(-) create mode 100644 src/3rdparty/webkit/WebKit/qt/tests/qwebframe/testiframe.html create mode 100644 src/3rdparty/webkit/WebKit/qt/tests/qwebframe/testiframe2.html diff --git a/src/3rdparty/webkit/VERSION b/src/3rdparty/webkit/VERSION index 0b88429..b69ac98 100644 --- a/src/3rdparty/webkit/VERSION +++ b/src/3rdparty/webkit/VERSION @@ -8,4 +8,4 @@ The commit imported was from the and has the sha1 checksum - 99ccc1c3e4db5354246720f9b9aa3d282e64497d + bd6591b4acaf2172ab05702153ef539c0ac89cbb diff --git a/src/3rdparty/webkit/WebCore/ChangeLog b/src/3rdparty/webkit/WebCore/ChangeLog index 516fadd..ab5b131 100644 --- a/src/3rdparty/webkit/WebCore/ChangeLog +++ b/src/3rdparty/webkit/WebCore/ChangeLog @@ -1,3 +1,16 @@ +2010-01-12 Jakub Wieczorek + + Reviewed by Adam Barth. + + [Qt] XSL stylesheets can load documents from a different origin + + https://bugs.webkit.org/show_bug.cgi?id=33423 + + * xml/XSLTProcessorQt.cpp: + (WebCore::XSLTUriResolver::XSLTUriResolver): + (WebCore::XSLTUriResolver::resolve): + (WebCore::XSLTProcessor::transformToString): + 2010-01-07 Yael Aharon Reviewed by Kenneth Rohde Christiansen. diff --git a/src/3rdparty/webkit/WebCore/xml/XSLTProcessorQt.cpp b/src/3rdparty/webkit/WebCore/xml/XSLTProcessorQt.cpp index 50ee427..3e05ca0 100644 --- a/src/3rdparty/webkit/WebCore/xml/XSLTProcessorQt.cpp +++ b/src/3rdparty/webkit/WebCore/xml/XSLTProcessorQt.cpp @@ -36,6 +36,7 @@ #include #include +#include #include #include #include @@ -87,6 +88,31 @@ void XSLTMessageHandler::handleMessage(QtMsgType type, const QString& descriptio sourceLocation.line(), sourceLocation.uri().toString()); } +class XSLTUriResolver : public QAbstractUriResolver { + +public: + XSLTUriResolver(Document* document); + virtual QUrl resolve(const QUrl& relative, const QUrl& baseURI) const; + +private: + Document* m_document; +}; + +XSLTUriResolver::XSLTUriResolver(Document* document) + : QAbstractUriResolver() + , m_document(document) +{ +} + +QUrl XSLTUriResolver::resolve(const QUrl& relative, const QUrl& baseURI) const +{ + QUrl url = baseURI.resolved(relative); + + if (!m_document->frame() || !m_document->securityOrigin()->canRequest(url)) + return QUrl(); + return url; +} + bool XSLTProcessor::transformToString(Node* sourceNode, String&, String& resultString, String&) { bool success = false; @@ -107,6 +133,7 @@ bool XSLTProcessor::transformToString(Node* sourceNode, String&, String& resultS QXmlQuery query(QXmlQuery::XSLT20); XSLTMessageHandler messageHandler(ownerDocument.get()); + XSLTUriResolver uriResolver(ownerDocument.get()); query.setMessageHandler(&messageHandler); XSLTProcessor::ParameterMap::iterator end = m_parameters.end(); @@ -132,6 +159,9 @@ bool XSLTProcessor::transformToString(Node* sourceNode, String&, String& resultS query.setFocus(&inputBuffer); query.setQuery(&styleSheetBuffer, QUrl(stylesheet->href())); + + query.setUriResolver(&uriResolver); + success = query.evaluateTo(&outputBuffer); outputBuffer.reset(); resultString = QString::fromUtf8(outputBuffer.readAll()).trimmed(); diff --git a/src/3rdparty/webkit/WebKit/qt/Api/qwebframe.cpp b/src/3rdparty/webkit/WebKit/qt/Api/qwebframe.cpp index 90d98be..29bde0d 100644 --- a/src/3rdparty/webkit/WebKit/qt/Api/qwebframe.cpp +++ b/src/3rdparty/webkit/WebKit/qt/Api/qwebframe.cpp @@ -324,6 +324,45 @@ void QWebFramePrivate::renderPrivate(QPainter *painter, QWebFrame::RenderLayer l } } +static bool webframe_scrollOverflow(WebCore::Frame* frame, int dx, int dy) +{ + if (!frame || !frame->document() || !frame->eventHandler()) + return false; + + Node* node = frame->document()->focusedNode(); + if (!node) + node = frame->document()->elementFromPoint(frame->eventHandler()->currentMousePosition().x(), + frame->eventHandler()->currentMousePosition().y()); + if (!node) + return false; + + RenderObject* renderer = node->renderer(); + if (!renderer) + return false; + + if (renderer->isListBox()) + return false; + + RenderLayer* renderLayer = renderer->enclosingLayer(); + if (!renderLayer) + return false; + + bool scrolledHorizontal = false; + bool scrolledVertical = false; + + if (dx > 0) + scrolledHorizontal = renderLayer->scroll(ScrollRight, ScrollByPixel, dx); + else if (dx < 0) + scrolledHorizontal = renderLayer->scroll(ScrollLeft, ScrollByPixel, qAbs(dx)); + + if (dy > 0) + scrolledVertical = renderLayer->scroll(ScrollDown, ScrollByPixel, dy); + else if (dy < 0) + scrolledVertical = renderLayer->scroll(ScrollUp, ScrollByPixel, qAbs(dy)); + + return (scrolledHorizontal || scrolledVertical); +} + /*! \class QWebFrame \since 4.4 @@ -1008,6 +1047,51 @@ void QWebFrame::scroll(int dx, int dy) } /*! + \since 4.7 + \internal + Scrolls nested frames starting at this frame, \a dx pixels to the right + and \a dy pixels downward. Both \a dx and \a dy may be negative. First attempts + to scroll elements with CSS overflow followed by this frame. If this + frame doesn't scroll, attempts to scroll the parent + + \sa QWebFrame::scroll +*/ +bool QWEBKIT_EXPORT qtwebkit_webframe_scrollRecursively(QWebFrame* qFrame, int dx, int dy) +{ + Frame* frame = QWebFramePrivate::core(qFrame); + bool scrolledHorizontal = false; + bool scrolledVertical = false; + bool scrolledOverflow = webframe_scrollOverflow(frame, dx, dy); + + if (!scrolledOverflow) { + if (!frame || !frame->view()) + return false; + + do { + IntSize scrollOffset = frame->view()->scrollOffset(); + IntPoint maxScrollOffset = frame->view()->maximumScrollPosition(); + + if (dx > 0) // scroll right + scrolledHorizontal = scrollOffset.width() < maxScrollOffset.x(); + else if (dx < 0) // scroll left + scrolledHorizontal = scrollOffset.width() > 0; + + if (dy > 0) // scroll down + scrolledVertical = scrollOffset.height() < maxScrollOffset.y(); + else if (dy < 0) //scroll up + scrolledVertical = scrollOffset.height() > 0; + + if (scrolledHorizontal || scrolledVertical) { + frame->view()->scrollBy(IntSize(dx, dy)); + return true; + } + frame = frame->tree()->parent(); + } while (frame && frame->view()); + } + return (scrolledHorizontal || scrolledVertical || scrolledOverflow); +} + +/*! \property QWebFrame::scrollPosition \since 4.5 \brief the position the frame is currently scrolled to. diff --git a/src/3rdparty/webkit/WebKit/qt/Api/qwebframe_p.h b/src/3rdparty/webkit/WebKit/qt/Api/qwebframe_p.h index 081e65d..095d134 100644 --- a/src/3rdparty/webkit/WebKit/qt/Api/qwebframe_p.h +++ b/src/3rdparty/webkit/WebKit/qt/Api/qwebframe_p.h @@ -83,6 +83,8 @@ public: void renderPrivate(QPainter*, QWebFrame::RenderLayer, const QRegion& clip); + bool scrollOverflow(int dx, int dy); + QWebFrame *q; Qt::ScrollBarPolicy horizontalScrollBarPolicy; Qt::ScrollBarPolicy verticalScrollBarPolicy; diff --git a/src/3rdparty/webkit/WebKit/qt/ChangeLog b/src/3rdparty/webkit/WebKit/qt/ChangeLog index 31fad69..357b787 100644 --- a/src/3rdparty/webkit/WebKit/qt/ChangeLog +++ b/src/3rdparty/webkit/WebKit/qt/ChangeLog @@ -1,3 +1,21 @@ +2009-12-18 Joe Ligman + + Reviewed by Kenneth Rohde Christiansen. + + [Qt] Add new API to QWebFrame to scrollRecursively starting with any css overflow + then checking current frame and then ancestors + https://bugs.webkit.org/show_bug.cgi?id=32668 + + * Api/qwebframe.cpp: + (QWebFramePrivate::scrollOverflow): + (QWebFrame::scrollRecursively): + * Api/qwebframe.h: + * Api/qwebframe_p.h: + * tests/qwebframe/qwebframe.qrc: + * tests/qwebframe/testiframe.html: Added. + * tests/qwebframe/testiframe2.html: Added. + * tests/qwebframe/tst_qwebframe.cpp: + 2010-01-07 Yael Aharon Reviewed by Kenneth Rohde Christiansen. diff --git a/src/3rdparty/webkit/WebKit/qt/tests/qwebframe/qwebframe.qrc b/src/3rdparty/webkit/WebKit/qt/tests/qwebframe/qwebframe.qrc index 9615e27..8afa0c1 100644 --- a/src/3rdparty/webkit/WebKit/qt/tests/qwebframe/qwebframe.qrc +++ b/src/3rdparty/webkit/WebKit/qt/tests/qwebframe/qwebframe.qrc @@ -4,5 +4,7 @@ style.css test1.html test2.html +testiframe.html +testiframe2.html diff --git a/src/3rdparty/webkit/WebKit/qt/tests/qwebframe/testiframe.html b/src/3rdparty/webkit/WebKit/qt/tests/qwebframe/testiframe.html new file mode 100644 index 0000000..9f3ae85 --- /dev/null +++ b/src/3rdparty/webkit/WebKit/qt/tests/qwebframe/testiframe.html @@ -0,0 +1,54 @@ + + + + + + + + +
You can use the overflow property when you want to have better control of the layout. Try to change the overflow property to: visible, hidden, auto, or inherit and see what happens. The default value is visible. +You can use the overflow property when you want to have better control of the layout. Try to change the overflow property to: visible, hidden, auto, or inherit and see what happens. The default value is visible. +You can use the overflow property when you want to have better control of the layout. Try to change the overflow property to: visible, hidden, auto, or inherit and see what happens. The default value is visible. +You can use the overflow property when you want to have better control of the layout. Try to change the overflow property to: visible, hidden, auto, or inherit and see what happens. The default value is visible. +You can use the overflow property when you want to have better control of the layout. Try to change the overflow property to: visible, hidden, auto, or inherit and see what happens. The default value is visible. +You can use the overflow property when you want to have better control of the layout. Try to change the overflow property to: visible, hidden, auto, or inherit and see what happens. The default value is visible.
+ + + + \ No newline at end of file diff --git a/src/3rdparty/webkit/WebKit/qt/tests/qwebframe/testiframe2.html b/src/3rdparty/webkit/WebKit/qt/tests/qwebframe/testiframe2.html new file mode 100644 index 0000000..1913a89 --- /dev/null +++ b/src/3rdparty/webkit/WebKit/qt/tests/qwebframe/testiframe2.html @@ -0,0 +1,21 @@ + + + + + + + +
+ + \ No newline at end of file diff --git a/src/3rdparty/webkit/WebKit/qt/tests/qwebframe/tst_qwebframe.cpp b/src/3rdparty/webkit/WebKit/qt/tests/qwebframe/tst_qwebframe.cpp index 8cc7953..609f8b4 100644 --- a/src/3rdparty/webkit/WebKit/qt/tests/qwebframe/tst_qwebframe.cpp +++ b/src/3rdparty/webkit/WebKit/qt/tests/qwebframe/tst_qwebframe.cpp @@ -606,6 +606,7 @@ private slots: void scrollPosition(); void evaluateWillCauseRepaint(); void qObjectWrapperWithSameIdentity(); + void scrollRecursively(); private: QString evalJS(const QString&s) { @@ -2824,5 +2825,71 @@ void tst_QWebFrame::qObjectWrapperWithSameIdentity() QCOMPARE(mainFrame->toPlainText(), QString("test2")); } +bool QWEBKIT_EXPORT qtwebkit_webframe_scrollRecursively(QWebFrame* qFrame, int dx, int dy); + +void tst_QWebFrame::scrollRecursively() +{ + // The test content is + // a nested frame set + // The main frame scrolls + // and has two children + // an iframe and a div overflow + // both scroll + QWebView webView; + QWebPage* webPage = webView.page(); + QSignalSpy loadSpy(webPage, SIGNAL(loadFinished(bool))); + QUrl url = QUrl("qrc:///testiframe.html"); + webPage->mainFrame()->load(url); + QTRY_COMPARE(loadSpy.count(), 1); + + QList children = webPage->mainFrame()->childFrames(); + QVERIFY(children.count() == 1); + + // 1st test + // call scrollRecursively over mainframe + // verify scrolled + // verify scroll postion changed + QPoint scrollPosition(webPage->mainFrame()->scrollPosition()); + QVERIFY(qtwebkit_webframe_scrollRecursively(webPage->mainFrame(), 10, 10)); + QVERIFY(scrollPosition != webPage->mainFrame()->scrollPosition()); + + // 2nd test + // call scrollRecursively over child iframe + // verify scrolled + // verify child scroll position changed + // verify parent's scroll position did not change + scrollPosition = webPage->mainFrame()->scrollPosition(); + QPoint childScrollPosition = children.at(0)->scrollPosition(); + QVERIFY(qtwebkit_webframe_scrollRecursively(children.at(0), 10, 10)); + QVERIFY(scrollPosition == webPage->mainFrame()->scrollPosition()); + QVERIFY(childScrollPosition != children.at(0)->scrollPosition()); + + // 3rd test + // call scrollRecursively over div overflow + // verify scrolled == true + // verify parent and child frame's scroll postion did not change + QWebElement div = webPage->mainFrame()->documentElement().findFirst("#content1"); + QMouseEvent evpres(QEvent::MouseMove, div.geometry().center(), Qt::NoButton, Qt::NoButton, Qt::NoModifier); + webPage->event(&evpres); + scrollPosition = webPage->mainFrame()->scrollPosition(); + childScrollPosition = children.at(0)->scrollPosition(); + QVERIFY(qtwebkit_webframe_scrollRecursively(webPage->mainFrame(), 5, 5)); + QVERIFY(childScrollPosition == children.at(0)->scrollPosition()); + QVERIFY(scrollPosition == webPage->mainFrame()->scrollPosition()); + + // 4th test + // call scrollRecursively twice over childs iframe + // verify scrolled == true first time + // verify parent's scroll == true second time + // verify parent and childs scroll position changed + childScrollPosition = children.at(0)->scrollPosition(); + QVERIFY(qtwebkit_webframe_scrollRecursively(children.at(0), -10, -10)); + QVERIFY(childScrollPosition != children.at(0)->scrollPosition()); + scrollPosition = webPage->mainFrame()->scrollPosition(); + QVERIFY(qtwebkit_webframe_scrollRecursively(children.at(0), -10, -10)); + QVERIFY(scrollPosition != webPage->mainFrame()->scrollPosition()); + +} + QTEST_MAIN(tst_QWebFrame) #include "tst_qwebframe.moc" -- cgit v0.12 From 2b50979c0a957ed1712a3becdd394f83e9b7f153 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Tue, 12 Jan 2010 12:28:57 +0100 Subject: QFile cannot deal with crlf-translated stdio, so use binary mode of course, this will break if somebody actually pipes in windows files. oh, well. Suggested-by: joao --- tools/linguist/shared/translator.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/tools/linguist/shared/translator.cpp b/tools/linguist/shared/translator.cpp index 8a071d3..2d92dd5 100644 --- a/tools/linguist/shared/translator.cpp +++ b/tools/linguist/shared/translator.cpp @@ -44,6 +44,10 @@ #include "simtexth.h" #include +#ifdef Q_OS_WIN +#include // required for _setmode, to avoid _O_TEXT streams... +#include // for _O_BINARY +#endif #include #include @@ -207,6 +211,10 @@ bool Translator::load(const QString &filename, ConversionData &cd, const QString QFile file; if (filename.isEmpty() || filename == QLatin1String("-")) { +#ifdef Q_OS_WIN + // QFile is broken for text files + ::_setmode(0, _O_BINARY); +#endif if (!file.open(stdin, QIODevice::ReadOnly)) { cd.appendError(QString::fromLatin1("Cannot open stdin!? (%1)") .arg(file.errorString())); @@ -243,6 +251,10 @@ bool Translator::save(const QString &filename, ConversionData &cd, const QString { QFile file; if (filename.isEmpty() || filename == QLatin1String("-")) { +#ifdef Q_OS_WIN + // QFile is broken for text files + ::_setmode(1, _O_BINARY); +#endif if (!file.open(stdout, QIODevice::WriteOnly)) { cd.appendError(QString::fromLatin1("Cannot open stdout!? (%1)") .arg(file.errorString())); -- cgit v0.12 From 81e1d9a9e9ff6649727bd26ea0c3be971813866d Mon Sep 17 00:00:00 2001 From: Yoann Lopes Date: Tue, 12 Jan 2010 12:32:09 +0100 Subject: Update change log with Yoann Lopes work. --- dist/changes-4.6.1 | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/dist/changes-4.6.1 b/dist/changes-4.6.1 index 65b865a..d35a4c1 100644 --- a/dist/changes-4.6.1 +++ b/dist/changes-4.6.1 @@ -53,6 +53,25 @@ QtGui GL implementation. - QGraphicsObject * 'id' property was removed. Use the 'objectName' property instead. + - QPrinter + * [QTBUG-3412] QGraphicsProxyWidgets are now rendered correctly when + printing a QGraphicsScene to PDF format. + - QPainter + * [QTBUG-5939] Fixed incorrect redirection matrix that was causing + wrong transformation for QGraphicsProxyWidgets. + - QGraphicsView + * [QTBUG-6935] When using CacheBackground, the background is now + correctly repainted after the QGraphicsView is shown after being + hidden. + * [QTBUG-6835] Mouse tracking is now automatically enabled when using + AnchorUnderMouse for view transformation. + - QGraphicsItem + * [QTBUG-5917] Fixed memory leaks when removing a QGraphicsEffect from + a QGraphicsItem or QWidget with setGraphicsEffect(0). + * [QTBUG-5859] Fixes incorrect rounding of the exposed rectangle of the + QGraphicsItem causing painting issues when scaling the QGraphicsView. + * [QTBUG-5071] Fixes transformation problems when grouping/ungrouping + the item with a QGraphicsItemGroup. QtDBus ------ -- cgit v0.12 From 4da15757269feb872432c43a3516a1349d6dcf39 Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Tue, 12 Jan 2010 13:09:31 +0100 Subject: doc: Updated the descriptions of the connection types. Replaced the ambiguous "delivered" with the explanation that the blocking queued connection type blocks the emitter's thread until the slot finishes executing in the receiver's thread. Task-number: QTBUG-6392 --- doc/src/frameworks-technologies/threads.qdoc | 45 +++++++++++------ src/corelib/global/qnamespace.qdoc | 73 ++++++++++++++++------------ src/corelib/kernel/qobject.cpp | 2 +- 3 files changed, 73 insertions(+), 47 deletions(-) diff --git a/doc/src/frameworks-technologies/threads.qdoc b/doc/src/frameworks-technologies/threads.qdoc index 10da936..fd6bebb 100644 --- a/doc/src/frameworks-technologies/threads.qdoc +++ b/doc/src/frameworks-technologies/threads.qdoc @@ -472,24 +472,37 @@ \section1 Signals and Slots Across Threads - Qt supports three types of signal-slot connections: + Qt supports these signal-slot connection types: \list - \o With \l{Qt::DirectConnection}{direct connections}, the - slot gets called immediately when the signal is emitted. The - slot is executed in the thread that emitted the signal (which - is not necessarily the thread where the receiver object - lives). - - \o With \l{Qt::QueuedConnection}{queued connections}, the - slot is invoked when control returns to the event loop of the - thread to which the object belongs. The slot is executed in - the thread where the receiver object lives. - - \o With \l{Qt::AutoConnection}{auto connections} (the default), - the behavior is the same as with direct connections if - the signal is emitted in the thread where the receiver lives; - otherwise, the behavior is that of a queued connection. + + \o \l{Qt::AutoConnection}{Auto Connection} (default) The behavior + is the same as the Direct Connection, if the emitter and + receiver are in the same thread. The behavior is the same as + the Queued Connection, if the emitter and receiver are in + different threads. + + \o \l{Qt::DirectConnection}{Direct Connection} The slot is invoked + immediately, when the signal is emitted. The slot is executed + in the emitter's thread, which is not necessarily the + receiver's thread. + + \o \l{Qt::QueuedConnection}{Queued Connection} The slot is invoked + when control returns to the event loop of the receiver's + thread. The slot is executed in the receiver's thread. + + \o \l{Qt::BlockingQueuedConnection}{Blocking Queued Connection} + The slot is invoked as for the Queued Connection, except the + current thread blocks until the slot returns. \note Using this + type to connect objects in the same thread will cause deadlock. + + \o \l{Qt::UniqueConnection}{Unique Connection} The behavior is the + same as the Auto Connection, but the connection is made only if + it does not duplicate an existing connection. i.e., if the same + signal is already connected to the same slot for the same pair + of objects, then the connection is not made and connect() + returns false. + \endlist The connection type can be specified by passing an additional diff --git a/src/corelib/global/qnamespace.qdoc b/src/corelib/global/qnamespace.qdoc index 9ef2101..871dd5c 100644 --- a/src/corelib/global/qnamespace.qdoc +++ b/src/corelib/global/qnamespace.qdoc @@ -514,45 +514,58 @@ /*! \enum Qt::ConnectionType - This enum describes the types of connection that can be used between signals and - slots. In particular, it determines whether a particular signal is delivered to a - slot immediately or queued for delivery at a later time. + This enum describes the types of connection that can be used + between signals and slots. In particular, it determines whether a + particular signal is delivered to a slot immediately or queued for + delivery at a later time. + + \value AutoConnection + (default) Same as DirectConnection, if the emitter and + receiver are in the same thread. Same as QueuedConnection, + if the emitter and receiver are in different threads. + + \value DirectConnection + The slot is invoked immediately, when the signal is + emitted. + + \value QueuedConnection + The slot is invoked when control returns to the event loop + of the receiver's thread. The slot is executed in the + receiver's thread. - \value DirectConnection When emitted, the signal is immediately delivered to the slot. - \value QueuedConnection When emitted, the signal is queued until the event loop is - able to deliver it to the slot. \value BlockingQueuedConnection - Same as QueuedConnection, except that the current thread blocks - until the slot has been delivered. This connection type should - only be used for receivers in a different thread. Note that misuse - of this type can lead to deadlocks in your application. - \value AutoConnection If the signal is emitted from the thread - in which the receiving object lives, the - slot is invoked directly, as with - Qt::DirectConnection; otherwise the - signal is queued, as with - Qt::QueuedConnection. - \value UniqueConnection Same as AutoConnection, but there will be a check that the signal is - not already connected to the same slot before connecting, otherwise, - the connection will fail. - This value was introduced in Qt 4.6. + Same as QueuedConnection, except the current thread blocks + until the slot returns. This connection type should only be + used where the emitter and receiver are in different + threads. \note Violating this rule can cause your + application to deadlock. + + \value UniqueConnection + Same as AutoConnection, but the connection is made only if + it does not duplicate an existing connection. i.e., if the + same signal is already connected to the same slot for the + same pair of objects, then the connection will fail. This + connection type was introduced in Qt 4.6. + \value AutoCompatConnection - The default connection type for signals and slots when Qt 3 support - is enabled. Equivalent to AutoConnection for connections but will cause warnings - to be output under certain circumstances. See - \l{Porting to Qt 4#Compatibility Signals and Slots}{Compatibility Signals and Slots} - for further information. + The default type when Qt 3 support is enabled. Same as + AutoConnection but will also cause warnings to be output in + certain situations. See \l{Porting to Qt 4#Compatibility + Signals and Slots}{Compatibility Signals and Slots} for + further information. - With queued connections, the parameters must be of types that are known to - Qt's meta-object system, because Qt needs to copy the arguments to store them - in an event behind the scenes. If you try to use a queued connection and - get the error message + With queued connections, the parameters must be of types that are + known to Qt's meta-object system, because Qt needs to copy the + arguments to store them in an event behind the scenes. If you try + to use a queued connection and get the error message: \snippet doc/src/snippets/code/doc_src_qnamespace.qdoc 0 - call qRegisterMetaType() to register the data type before you + Call qRegisterMetaType() to register the data type before you establish the connection. + When using signals and slots with multiple threads, see \l{Signals and Slots Across Threads}. + \sa {Thread Support in Qt}, QObject::connect(), qRegisterMetaType() */ diff --git a/src/corelib/kernel/qobject.cpp b/src/corelib/kernel/qobject.cpp index 3564a35..8346fe4 100644 --- a/src/corelib/kernel/qobject.cpp +++ b/src/corelib/kernel/qobject.cpp @@ -2456,7 +2456,7 @@ int QObject::receivers(const char *signal) const If you pass the Qt::UniqueConnection \a type, the connection will only be made if it is not a duplicate. If there is already a duplicate (exact same signal to the exact same slot on the same objects), - the connection will fail and connect will return false + the connection will fail and connect will return false. The optional \a type parameter describes the type of connection to establish. In particular, it determines whether a particular -- cgit v0.12 From c90c5b6124bb952500c1d3ca0114163729414771 Mon Sep 17 00:00:00 2001 From: Prasanth Ullattil Date: Tue, 12 Jan 2010 13:13:35 +0100 Subject: Changed log updated --- dist/changes-4.6.1 | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/dist/changes-4.6.1 b/dist/changes-4.6.1 index 5255894..40066bb 100644 --- a/dist/changes-4.6.1 +++ b/dist/changes-4.6.1 @@ -160,7 +160,12 @@ Qt for Windows Qt for Mac OS X --------------- - - + - [QTBUG-6973] Fixed a memory leak when using QWidget::setWindowIcon() in carbon. + - [QTBUG-5186] Fixed a bug which caused drag and drop icons to show + incorrectly. + - [QTBUG-6636] Fixed a crash due to stack overflow in QColorDialog on cocoa. + - [QTBUG-6378] Fix a text cursor rendering bug. + - [QTBUG-6636] Fixed a crash when calling removeToolBar on Mac native toolbars using cocoa. Qt for Embedded Linux --------------------- -- cgit v0.12 From 48b4a790b94acab1000c0e3bb3c6780bf6b9ba0b Mon Sep 17 00:00:00 2001 From: Kim Motoyoshi Kalland Date: Tue, 12 Jan 2010 13:29:11 +0100 Subject: Fixed bug where QGLPixmapData::toImage() returned too dark image. QGLPixmapData::toImage() called qt_gl_read_texture() which didn't take into account that the texture was in a premultiplied format. Task-number: QTBUG-7190 Reviewed-by: Trond --- src/opengl/qgl.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/opengl/qgl.cpp b/src/opengl/qgl.cpp index 4a79427..602c14d 100644 --- a/src/opengl/qgl.cpp +++ b/src/opengl/qgl.cpp @@ -1555,7 +1555,7 @@ QImage qt_gl_read_framebuffer(const QSize &size, bool alpha_format, bool include QImage qt_gl_read_texture(const QSize &size, bool alpha_format, bool include_alpha) { - QImage img(size, alpha_format ? QImage::Format_ARGB32 : QImage::Format_RGB32); + QImage img(size, alpha_format ? QImage::Format_ARGB32_Premultiplied : QImage::Format_RGB32); int w = size.width(); int h = size.height(); #if !defined(QT_OPENGL_ES_2) && !defined(QT_OPENGL_ES_1) && !defined(QT_OPENGL_ES_1_CL) -- cgit v0.12 From 5a4a0af70184888fa05769bae2d22ee39d905bc0 Mon Sep 17 00:00:00 2001 From: Prasanth Ullattil Date: Tue, 12 Jan 2010 14:53:30 +0100 Subject: Revert "Fixed qxmlstream autotest when using shadow builds." This reverts commit f8780558e3fc68321a0dd6dcef611eeee0805a2e. --- tests/auto/qxmlstream/qxmlstream.pro | 4 ---- tests/auto/qxmlstream/tst_qxmlstream.cpp | 6 +++--- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/tests/auto/qxmlstream/qxmlstream.pro b/tests/auto/qxmlstream/qxmlstream.pro index 89d7bc1..ac03d42 100644 --- a/tests/auto/qxmlstream/qxmlstream.pro +++ b/tests/auto/qxmlstream/qxmlstream.pro @@ -8,8 +8,4 @@ wince*|symbian*: { addFiles.sources = data XML-Test-Suite addFiles.path = . DEPLOYMENT += addFiles - DEFINES += SRCDIR=\\\"\\\" -} else { - DEFINES += SRCDIR=\\\"$$PWD/\\\" } - diff --git a/tests/auto/qxmlstream/tst_qxmlstream.cpp b/tests/auto/qxmlstream/tst_qxmlstream.cpp index 6aa9955..27ae089 100644 --- a/tests/auto/qxmlstream/tst_qxmlstream.cpp +++ b/tests/auto/qxmlstream/tst_qxmlstream.cpp @@ -57,7 +57,7 @@ Q_DECLARE_METATYPE(QXmlStreamReader::ReadElementTextBehaviour) -static const char *const catalogFile = SRCDIR "XML-Test-Suite/xmlconf/finalCatalog.xml"; +static const char *const catalogFile = "XML-Test-Suite/xmlconf/finalCatalog.xml"; static const int expectedRunCount = 1646; static const int expectedSkipCount = 532; @@ -804,7 +804,7 @@ void tst_QXmlStream::testReader_data() const QTest::addColumn("xml"); QTest::addColumn("ref"); QDir dir; - dir.cd(SRCDIR "data/"); + dir.cd("data/"); foreach(QString filename , dir.entryList(QStringList() << "*.xml")) { QString reference = QFileInfo(filename).baseName() + ".ref"; QTest::newRow(dir.filePath(filename).toLatin1().data()) << dir.filePath(filename) << dir.filePath(reference); @@ -1183,7 +1183,7 @@ void tst_QXmlStream::crashInUTF16Codec() const QEventLoop eventLoop; QNetworkAccessManager networkManager; - QNetworkRequest request(QUrl::fromLocalFile(QLatin1String(SRCDIR "data/051reduced.xml"))); + QNetworkRequest request(QUrl::fromLocalFile(QLatin1String("data/051reduced.xml"))); QNetworkReply *const reply = networkManager.get(request); eventLoop.connect(reply, SIGNAL(finished()), SLOT(quit())); -- cgit v0.12 From ea24edbf74d29cfa128b651e41fde14a0d2a79f8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Trond=20Kjern=C3=A5sen?= Date: Tue, 12 Jan 2010 14:55:01 +0100 Subject: 4.6.1 changes --- dist/changes-4.6.1 | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/dist/changes-4.6.1 b/dist/changes-4.6.1 index d35a4c1..b3c076e 100644 --- a/dist/changes-4.6.1 +++ b/dist/changes-4.6.1 @@ -51,16 +51,20 @@ QtGui in the DDS, ETC1, PVRTC2, and PVRTC4 formats if the OpenGL graphics system is active and the appropriate extensions are present in the GL implementation. + * [QTBUG-6840] Fixed load() to not modify referenced copies. + * [QTBUG-5840] Fixed a crash in fromImage() when passing in a null image. + - QRasterPixmapData + * [QTBUG-6985] Fixed metric() to return the correct height in mm. - QGraphicsObject * 'id' property was removed. Use the 'objectName' property instead. - QPrinter * [QTBUG-3412] QGraphicsProxyWidgets are now rendered correctly when printing a QGraphicsScene to PDF format. - QPainter - * [QTBUG-5939] Fixed incorrect redirection matrix that was causing + * [QTBUG-5939] Fixed incorrect redirection matrix that was causing wrong transformation for QGraphicsProxyWidgets. - QGraphicsView - * [QTBUG-6935] When using CacheBackground, the background is now + * [QTBUG-6935] When using CacheBackground, the background is now correctly repainted after the QGraphicsView is shown after being hidden. * [QTBUG-6835] Mouse tracking is now automatically enabled when using @@ -73,6 +77,9 @@ QtGui * [QTBUG-5071] Fixes transformation problems when grouping/ungrouping the item with a QGraphicsItemGroup. + - QTextDocument + * [QTBUG-6051] Fixed an endless loop when printing a QTextDocument. + QtDBus ------ @@ -114,6 +121,8 @@ QtOpenGL * [QTBUG-6045] Crash in dashed line handling in the GL stroker. - QGLGlyphCache * [QTBUG-6936] Fix memory leak of QGLGlyphCoord objects. + - QGLWidget + * [QTBUG-5002, QTBUG-6931] Fixed QGLWidget::renderText(). QtOpenVG -------- @@ -173,12 +182,15 @@ Third party components Qt for Unix (X11 and Mac OS X) ------------------------------ - - + - Qt for Linux/X11 ---------------- - - + - QGL + * [QTBUG-5732] Fixed querying of GLX extensions under X11. + - QPrintDialog + * [QTBUG-5547] Fixed handling of the "..." button. Qt for Windows -------------- @@ -188,7 +200,9 @@ Qt for Windows Qt for Mac OS X --------------- - - + - QPixmap + * [QTBUG-5070] Fixed a crash on Mac that could occur when loading + pixmaps of different sizes into the same QPixmap object. Qt for Embedded Linux --------------------- -- cgit v0.12 From c186438710bb0f5a09ba6168a5b35d8b485da41d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= Date: Tue, 12 Jan 2010 14:52:38 +0100 Subject: Update changelog with my 4.6.1 changes. --- dist/changes-4.6.1 | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/dist/changes-4.6.1 b/dist/changes-4.6.1 index b3c076e..e2ec649 100644 --- a/dist/changes-4.6.1 +++ b/dist/changes-4.6.1 @@ -46,6 +46,8 @@ QtCore QtGui ----- + - QPixmapCache + * Fixed a small leak when using the new QPixmapCAche::Key based API. - QPixmap * load() and loadFromData() can now support compressed GL textures in the DDS, ETC1, PVRTC2, and PVRTC4 formats if the OpenGL graphics @@ -63,6 +65,11 @@ QtGui - QPainter * [QTBUG-5939] Fixed incorrect redirection matrix that was causing wrong transformation for QGraphicsProxyWidgets. + * [QTBUG-6684] Added optimizations of 32-bit blend functions + for ARM platforms with NEON support. + - QGraphicsEffect + * [QTBUG-5918] Fixed redraw bugs when using graphics effects on + items while animating them by transformations. - QGraphicsView * [QTBUG-6935] When using CacheBackground, the background is now correctly repainted after the QGraphicsView is shown after being @@ -76,6 +83,9 @@ QtGui QGraphicsItem causing painting issues when scaling the QGraphicsView. * [QTBUG-5071] Fixes transformation problems when grouping/ungrouping the item with a QGraphicsItemGroup. + - QTextDocument + * [QTBUG-5397] Fixed printing of QTextDocuments not including custom + text objects. - QTextDocument * [QTBUG-6051] Fixed an endless loop when printing a QTextDocument. -- cgit v0.12 From ddd193b39ba0fa26c18cb13743d9f68cb3749054 Mon Sep 17 00:00:00 2001 From: Peter Hartmann Date: Tue, 12 Jan 2010 14:57:17 +0100 Subject: my changelog for 4.6.1 --- dist/changes-4.6.1 | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/dist/changes-4.6.1 b/dist/changes-4.6.1 index 40066bb..b7073fc 100644 --- a/dist/changes-4.6.1 +++ b/dist/changes-4.6.1 @@ -45,6 +45,9 @@ QtCore and Symbian by using realpath() system call * Avoid stat() when opening a file + - QXmlStreamreader + * [merge request 1926] Fix parsing of DTDs that contain empty markup + declarations QtGui ----- @@ -84,6 +87,8 @@ QtNetwork - QNetworkProxyFactory * Fixed systemProxyForQuery(), it could sometimes return invalid empty list on Windows + - QNetworkCookieJar + * [QTBUG-5815] do not check paths when accepting cookies - QHostInfo * Use 5 parallel threads for host lookup instead of 1 -- cgit v0.12 From d4e81805ff47a266890f9638cf29647889d5c730 Mon Sep 17 00:00:00 2001 From: Gunnar Sletta Date: Tue, 12 Jan 2010 15:13:46 +0100 Subject: Avoid coordinate limitations in the raster engine. Lines that are longer than 2^15 will overflow in qgrayraster.c so we need to clip them. Also, we need to clip the bounding rectangle to avoid an endless clip-loop Task: http://bugreports.qt.nokia.com/browse/QTBUG-6198 Reviewed-by: Samuel --- src/gui/painting/qoutlinemapper.cpp | 9 ++++++--- src/gui/painting/qpaintengine_raster.cpp | 4 +++- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/gui/painting/qoutlinemapper.cpp b/src/gui/painting/qoutlinemapper.cpp index ee33024..078d002 100644 --- a/src/gui/painting/qoutlinemapper.cpp +++ b/src/gui/painting/qoutlinemapper.cpp @@ -225,9 +225,10 @@ void QOutlineMapper::endOutline() controlPointRect = boundingRect(elements, element_count); #ifdef QT_DEBUG_CONVERT - printf(" - control point rect (%.2f, %.2f) %.2f x %.2f\n", + printf(" - control point rect (%.2f, %.2f) %.2f x %.2f, clip=(%d,%d, %dx%d)\n", controlPointRect.x(), controlPointRect.y(), - controlPointRect.width(), controlPointRect.height()); + controlPointRect.width(), controlPointRect.height(), + m_clip_rect.x(), m_clip_rect.y(), m_clip_rect.width(), m_clip_rect.height()); #endif @@ -235,7 +236,9 @@ void QOutlineMapper::endOutline() const bool do_clip = (controlPointRect.left() < -QT_RASTER_COORD_LIMIT || controlPointRect.right() > QT_RASTER_COORD_LIMIT || controlPointRect.top() < -QT_RASTER_COORD_LIMIT - || controlPointRect.bottom() > QT_RASTER_COORD_LIMIT); + || controlPointRect.bottom() > QT_RASTER_COORD_LIMIT + || controlPointRect.width() > QT_RASTER_COORD_LIMIT + || controlPointRect.height() > QT_RASTER_COORD_LIMIT); if (do_clip) { clipElements(elements, elementTypes(), element_count); diff --git a/src/gui/painting/qpaintengine_raster.cpp b/src/gui/painting/qpaintengine_raster.cpp index aa3b89e..eeb90e5 100644 --- a/src/gui/painting/qpaintengine_raster.cpp +++ b/src/gui/painting/qpaintengine_raster.cpp @@ -475,8 +475,10 @@ bool QRasterPaintEngine::begin(QPaintDevice *device) QRasterPaintEngineState *s = state(); ensureOutlineMapper(); d->outlineMapper->m_clip_rect = d->deviceRect.adjusted(-10, -10, 10, 10); + + // This is the upp QRect bounds(-QT_RASTER_COORD_LIMIT, -QT_RASTER_COORD_LIMIT, - 2*QT_RASTER_COORD_LIMIT, 2*QT_RASTER_COORD_LIMIT); + QT_RASTER_COORD_LIMIT*2 - 1, QT_RASTER_COORD_LIMIT * 2 - 1); d->outlineMapper->m_clip_rect = bounds.intersected(d->outlineMapper->m_clip_rect); -- cgit v0.12 From 30ea9ef54bc54a122263dd3174c5ee8b70355088 Mon Sep 17 00:00:00 2001 From: Richard Moe Gustavsen Date: Tue, 12 Jan 2010 15:22:15 +0100 Subject: My changes to changes-4.6.1 --- dist/changes-4.6.1 | 2 ++ 1 file changed, 2 insertions(+) diff --git a/dist/changes-4.6.1 b/dist/changes-4.6.1 index b7073fc..4372423 100644 --- a/dist/changes-4.6.1 +++ b/dist/changes-4.6.1 @@ -171,6 +171,8 @@ Qt for Mac OS X - [QTBUG-6636] Fixed a crash due to stack overflow in QColorDialog on cocoa. - [QTBUG-6378] Fix a text cursor rendering bug. - [QTBUG-6636] Fixed a crash when calling removeToolBar on Mac native toolbars using cocoa. + - [QTBUG-5613] Fixed a bug where the application refued to quit when showing a single modal dialog. + - Gestures are now available for the Carbon port also when building Qt against SDK < 10.6 Qt for Embedded Linux --------------------- -- cgit v0.12 From 1595d8594782321de9d92659e2a0cd03148c7ff5 Mon Sep 17 00:00:00 2001 From: Tom Cooksey Date: Tue, 12 Jan 2010 15:21:32 +0100 Subject: Update changes file for 4.6.1 --- dist/changes-4.6.1 | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/dist/changes-4.6.1 b/dist/changes-4.6.1 index e2ec649..e9e5922 100644 --- a/dist/changes-4.6.1 +++ b/dist/changes-4.6.1 @@ -133,6 +133,15 @@ QtOpenGL * [QTBUG-6936] Fix memory leak of QGLGlyphCoord objects. - QGLWidget * [QTBUG-5002, QTBUG-6931] Fixed QGLWidget::renderText(). + * Fixed WA_TranslucentBackground for QGLWidgets on X11/EGL + * Fix EGL surface leaks when re-parenting on X11/EGL + - QGL2PaintEngineEx + * Performance: Don't mark brush as dirty if it hasn't changed + * Performance: Use 3x3 PMV matrices rather than 4x4 + * Performance: Move the 0.5 offset we add for aliased rendering to updateMatrix() + * Performance: Remove superfluous enable/disable vertex arrtib arrays + * Performance: Track the glVertexAttribPointer and only update it if it's changed + * [QTBUG-7094] Introduce new "snapToPixelGrid" flag for drawText QtOpenVG -------- @@ -197,10 +206,10 @@ Qt for Unix (X11 and Mac OS X) Qt for Linux/X11 ---------------- - - QGL - * [QTBUG-5732] Fixed querying of GLX extensions under X11. - - QPrintDialog - * [QTBUG-5547] Fixed handling of the "..." button. + - [QTBUG-5732] Fixed querying of GLX extensions under X11. + - [QTBUG-5547] Fixed handling of the "..." button. + - Added new mkspec for Maemo targets (linux-g++-maemo) + - Added new mkspec for Scratchbox host compiler (unsupported/linux-host-g++) Qt for Windows -------------- -- cgit v0.12 From 2a4a76767849b1325927db17383679a46c16d38d Mon Sep 17 00:00:00 2001 From: Gunnar Sletta Date: Tue, 12 Jan 2010 15:24:18 +0100 Subject: Put LinesHint into QVectorPath hints to enable further optimizations Reviewed-by: Samuel --- src/gui/painting/qpainterpath_p.h | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/gui/painting/qpainterpath_p.h b/src/gui/painting/qpainterpath_p.h index 54b9392..4cd8a1a 100644 --- a/src/gui/painting/qpainterpath_p.h +++ b/src/gui/painting/qpainterpath_p.h @@ -97,6 +97,7 @@ public: flags(0) { int ptsPos = 0; + bool isLines = true; for (int i=0; i elements; QVarLengthArray points; -- cgit v0.12 From bc62c67c08a9c03d237f63c87f743a08a3dc9d14 Mon Sep 17 00:00:00 2001 From: Kim Motoyoshi Kalland Date: Tue, 12 Jan 2010 15:09:56 +0100 Subject: Added my changes to the 4.6.1 change log. --- dist/changes-4.6.1 | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/dist/changes-4.6.1 b/dist/changes-4.6.1 index e9e5922..15f1fad 100644 --- a/dist/changes-4.6.1 +++ b/dist/changes-4.6.1 @@ -55,6 +55,8 @@ QtGui GL implementation. * [QTBUG-6840] Fixed load() to not modify referenced copies. * [QTBUG-5840] Fixed a crash in fromImage() when passing in a null image. + * [QTBUG-6116] Fixed memory leak where a global object was not destroyed + at program exit. - QRasterPixmapData * [QTBUG-6985] Fixed metric() to return the correct height in mm. - QGraphicsObject @@ -166,6 +168,15 @@ QtSql - foo * bar +QtSvg +----- + + - QSvgRenderer + * [QTBUG-6867] Fixed regression in the parsing of paths with relative + offsets. + * [QTBUG-6899] Fixed crash when parsing invalid coordinate list. + + QtXml ----- -- cgit v0.12 From 4c85bf275c9d472a17cc9210aebf6eb880be740a Mon Sep 17 00:00:00 2001 From: Alexis Menard Date: Tue, 12 Jan 2010 15:30:36 +0100 Subject: My changelog for 4.6.1. --- dist/changes-4.6.1 | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/dist/changes-4.6.1 b/dist/changes-4.6.1 index 15f1fad..513cace 100644 --- a/dist/changes-4.6.1 +++ b/dist/changes-4.6.1 @@ -78,6 +78,9 @@ QtGui hidden. * [QTBUG-6835] Mouse tracking is now automatically enabled when using AnchorUnderMouse for view transformation. + * [QTBUG-6958] Fix speed regression in _q_polishItems() + * [QTBUG-6544] Fix a crash on the focus chain when removing items from the scene. + * Fix a crash in KDE/Plasma with QGraphicsView with topLevels. - QGraphicsItem * [QTBUG-5917] Fixed memory leaks when removing a QGraphicsEffect from a QGraphicsItem or QWidget with setGraphicsEffect(0). @@ -85,6 +88,8 @@ QtGui QGraphicsItem causing painting issues when scaling the QGraphicsView. * [QTBUG-5071] Fixes transformation problems when grouping/ungrouping the item with a QGraphicsItemGroup. + - QGraphicsWidget + * [QTBUG-6272] Only call updateFont if the font have changed. - QTextDocument * [QTBUG-5397] Fixed printing of QTextDocuments not including custom text objects. -- cgit v0.12 From 12e320a7a3a5ca93dd5287315571db1d1728e322 Mon Sep 17 00:00:00 2001 From: Gabriel de Dietrich Date: Tue, 12 Jan 2010 15:09:42 +0100 Subject: Significant digits were lost in QDoubleSpinBox range when changing precision When setting the range, the actual value precision was lost because the min and max were saved after being formatted to the current precison (decimals property), thus losing information. We now keep the user original values, and use these whenever the decimals property is changed. Auto-test included. Reviewed-by: leo Task-number: QTBUG-6496 --- src/gui/widgets/qspinbox.cpp | 16 +++++++++++++--- tests/auto/qdoublespinbox/tst_qdoublespinbox.cpp | 13 +++++++++++++ 2 files changed, 26 insertions(+), 3 deletions(-) diff --git a/src/gui/widgets/qspinbox.cpp b/src/gui/widgets/qspinbox.cpp index 50b225c..f382f96 100644 --- a/src/gui/widgets/qspinbox.cpp +++ b/src/gui/widgets/qspinbox.cpp @@ -99,6 +99,10 @@ public: Q_Q(QDoubleSpinBox); q->setInputMethodHints(Qt::ImhFormattedNumbersOnly); } + + // When fiddling with the decimals property, we may lose precision in these properties. + double actualMin; + double actualMax; }; @@ -762,6 +766,7 @@ double QDoubleSpinBox::minimum() const void QDoubleSpinBox::setMinimum(double minimum) { Q_D(QDoubleSpinBox); + d->actualMin = minimum; const QVariant m(d->round(minimum)); d->setRange(m, (d->variantCompare(d->maximum, m) > 0 ? d->maximum : m)); } @@ -792,6 +797,7 @@ double QDoubleSpinBox::maximum() const void QDoubleSpinBox::setMaximum(double maximum) { Q_D(QDoubleSpinBox); + d->actualMax = maximum; const QVariant m(d->round(maximum)); d->setRange((d->variantCompare(d->minimum, m) < 0 ? d->minimum : m), m); } @@ -813,6 +819,8 @@ void QDoubleSpinBox::setMaximum(double maximum) void QDoubleSpinBox::setRange(double minimum, double maximum) { Q_D(QDoubleSpinBox); + d->actualMin = minimum; + d->actualMax = maximum; d->setRange(QVariant(d->round(minimum)), QVariant(d->round(maximum))); } @@ -843,7 +851,7 @@ void QDoubleSpinBox::setDecimals(int decimals) Q_D(QDoubleSpinBox); d->decimals = qBound(0, decimals, DBL_MAX_10_EXP + DBL_DIG); - setRange(minimum(), maximum()); // make sure values are rounded + setRange(d->actualMin, d->actualMax); // make sure values are rounded setValue(value()); } @@ -1051,8 +1059,10 @@ QVariant QSpinBoxPrivate::validateAndInterpret(QString &input, int &pos, QDoubleSpinBoxPrivate::QDoubleSpinBoxPrivate() { - minimum = QVariant(0.0); - maximum = QVariant(99.99); + actualMin = 0.0; + actualMax = 99.99; + minimum = QVariant(actualMin); + maximum = QVariant(actualMax); value = minimum; singleStep = QVariant(1.0); decimals = 2; diff --git a/tests/auto/qdoublespinbox/tst_qdoublespinbox.cpp b/tests/auto/qdoublespinbox/tst_qdoublespinbox.cpp index a3f0915..35cffd6 100644 --- a/tests/auto/qdoublespinbox/tst_qdoublespinbox.cpp +++ b/tests/auto/qdoublespinbox/tst_qdoublespinbox.cpp @@ -149,6 +149,7 @@ private slots: void taskQTBUG_5008_textFromValueAndValidate(); void taskQTBUG_6670_selectAllWithPrefix(); + void taskQTBUG_6496_fiddlingWithPrecision(); public slots: void valueChangedHelper(const QString &); @@ -1096,5 +1097,17 @@ void tst_QDoubleSpinBox::taskQTBUG_6670_selectAllWithPrefix() QCOMPARE(spin.value(), 12.); } +void tst_QDoubleSpinBox::taskQTBUG_6496_fiddlingWithPrecision() +{ + QDoubleSpinBox dsb; + dsb.setRange(0, 0.991); + dsb.setDecimals(1); + QCOMPARE(dsb.maximum(), 1.0); + dsb.setDecimals(2); + QCOMPARE(dsb.maximum(), 0.99); + dsb.setDecimals(3); + QCOMPARE(dsb.maximum(), 0.991); +} + QTEST_MAIN(tst_QDoubleSpinBox) #include "tst_qdoublespinbox.moc" -- cgit v0.12 From 4f7ebc24de5496c468e38b36aaba3ad3d877198a Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Tue, 12 Jan 2010 15:19:45 +0100 Subject: Autotest: don't depend on QtGui just because of QDesktopServices::storageLocation Task-number: QTBUG-7060 Reviewed-by: Trust Me --- tests/auto/qabstractnetworkcache/qabstractnetworkcache.pro | 1 + tests/auto/qabstractnetworkcache/tst_qabstractnetworkcache.cpp | 4 +--- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/tests/auto/qabstractnetworkcache/qabstractnetworkcache.pro b/tests/auto/qabstractnetworkcache/qabstractnetworkcache.pro index 11e340d..a57c56f 100644 --- a/tests/auto/qabstractnetworkcache/qabstractnetworkcache.pro +++ b/tests/auto/qabstractnetworkcache/qabstractnetworkcache.pro @@ -1,5 +1,6 @@ load(qttest_p4) QT += network +QT -= gui SOURCES += tst_qabstractnetworkcache.cpp wince*|symbian: { diff --git a/tests/auto/qabstractnetworkcache/tst_qabstractnetworkcache.cpp b/tests/auto/qabstractnetworkcache/tst_qabstractnetworkcache.cpp index e5646c1..ac73f08 100644 --- a/tests/auto/qabstractnetworkcache/tst_qabstractnetworkcache.cpp +++ b/tests/auto/qabstractnetworkcache/tst_qabstractnetworkcache.cpp @@ -41,7 +41,6 @@ #include -#include #include #include "../../shared/util.h" #include "../network-settings.h" @@ -83,8 +82,7 @@ public: : QNetworkDiskCache(parent) , gotData(false) { - QString location = QDesktopServices::storageLocation(QDesktopServices::CacheLocation) - + QLatin1String("/qnetworkdiskcache/"); + QString location = QDir::tempPath() + QLatin1String("/tst_qnetworkdiskcache/"); setCacheDirectory(location); clear(); } -- cgit v0.12 From 589568759b074dd0478615f785a2297a1800d79f Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Tue, 12 Jan 2010 15:20:28 +0100 Subject: Fix an issue with HTTP headers like "private, max-age=300". The parsing would ignore the fact that "private" ended at the comma and would instead try to get the continuation as the value. We have to check if equal < comma and it's not -1. Using unsigned comparisons does both things at once for us. Task-number: QTBUG-7060 Reviewed-by: Peter Hartmann --- src/network/access/qnetworkaccesshttpbackend.cpp | 2 +- .../tests/httpcachetest_cachecontrol200.cgi | 9 +++++++++ tests/auto/qabstractnetworkcache/tst_qabstractnetworkcache.cpp | 8 +++++++- 3 files changed, 17 insertions(+), 2 deletions(-) create mode 100644 tests/auto/qabstractnetworkcache/tests/httpcachetest_cachecontrol200.cgi diff --git a/src/network/access/qnetworkaccesshttpbackend.cpp b/src/network/access/qnetworkaccesshttpbackend.cpp index a639e0d..58123b2 100644 --- a/src/network/access/qnetworkaccesshttpbackend.cpp +++ b/src/network/access/qnetworkaccesshttpbackend.cpp @@ -144,7 +144,7 @@ static QHash parseHttpOptionHeader(const QByteArray &hea QByteArray key = QByteArray(header.constData() + pos, end - pos).trimmed().toLower(); pos = end + 1; - if (equal != -1) { + if (uint(equal) < uint(comma)) { // case: token "=" (token | quoted-string) // skip spaces pos = nextNonWhitespace(header, pos); diff --git a/tests/auto/qabstractnetworkcache/tests/httpcachetest_cachecontrol200.cgi b/tests/auto/qabstractnetworkcache/tests/httpcachetest_cachecontrol200.cgi new file mode 100644 index 0000000..e44d5ed --- /dev/null +++ b/tests/auto/qabstractnetworkcache/tests/httpcachetest_cachecontrol200.cgi @@ -0,0 +1,9 @@ +#!/bin/bash +cc=`echo "${QUERY_STRING}" | sed -e s/%20/\ /g` +echo "Status: 200" +echo "Cache-Control: $cc" +echo "Last-Modified: Sat, 31 Oct 1981 06:00:00 GMT" +echo "Content-type: text/html"; +echo "X-Script: $0" +echo "" +echo "Hello World!" diff --git a/tests/auto/qabstractnetworkcache/tst_qabstractnetworkcache.cpp b/tests/auto/qabstractnetworkcache/tst_qabstractnetworkcache.cpp index ac73f08..04bd432 100644 --- a/tests/auto/qabstractnetworkcache/tst_qabstractnetworkcache.cpp +++ b/tests/auto/qabstractnetworkcache/tst_qabstractnetworkcache.cpp @@ -205,6 +205,11 @@ void tst_QAbstractNetworkCache::cacheControl_data() QTest::newRow("304-2") << QNetworkRequest::PreferNetwork << "httpcachetest_cachecontrol.cgi?max-age=1000, must-revalidate" << true; QTest::newRow("304-3") << QNetworkRequest::AlwaysCache << "httpcachetest_cachecontrol.cgi?max-age=1000, must-revalidate" << AlwaysTrue; QTest::newRow("304-4") << QNetworkRequest::PreferCache << "httpcachetest_cachecontrol.cgi?max-age=1000, must-revalidate" << true; + + // see QTBUG-7060 + //QTest::newRow("nokia-boston") << QNetworkRequest::PreferNetwork << "http://waplabdc.nokia-boston.com/browser/users/venkat/cache/Cache_directives/private_1b.asp" << true; + QTest::newRow("304-2b") << QNetworkRequest::PreferNetwork << "httpcachetest_cachecontrol200.cgi?private, max-age=1000" << true; + QTest::newRow("304-4b") << QNetworkRequest::PreferCache << "httpcachetest_cachecontrol200.cgi?private, max-age=1000" << true; } void tst_QAbstractNetworkCache::cacheControl() @@ -223,7 +228,8 @@ void tst_QAbstractNetworkCache::check() manager.setCache(diskCache); QCOMPARE(diskCache->gotData, false); - QNetworkRequest request(QUrl(TESTFILE + url)); + QUrl realUrl = url.contains("://") ? url : TESTFILE + url; + QNetworkRequest request(realUrl); // prime the cache QNetworkReply *reply = manager.get(request); -- cgit v0.12 From d09836caf877ad8ebd03899a2033320682c5154f Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Tue, 12 Jan 2010 15:52:11 +0100 Subject: Autotest: set these files to executable. They are CGI scripts. Reviewed-by: Trust Me --- .../qabstractnetworkcache/tests/httpcachetest_cachecontrol-expire.cgi | 0 tests/auto/qabstractnetworkcache/tests/httpcachetest_cachecontrol.cgi | 0 tests/auto/qabstractnetworkcache/tests/httpcachetest_cachecontrol200.cgi | 0 tests/auto/qabstractnetworkcache/tests/httpcachetest_etag200.cgi | 0 tests/auto/qabstractnetworkcache/tests/httpcachetest_etag304.cgi | 0 tests/auto/qabstractnetworkcache/tests/httpcachetest_expires200.cgi | 0 tests/auto/qabstractnetworkcache/tests/httpcachetest_expires304.cgi | 0 tests/auto/qabstractnetworkcache/tests/httpcachetest_expires500.cgi | 0 tests/auto/qabstractnetworkcache/tests/httpcachetest_lastModified200.cgi | 0 tests/auto/qabstractnetworkcache/tests/httpcachetest_lastModified304.cgi | 0 10 files changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 tests/auto/qabstractnetworkcache/tests/httpcachetest_cachecontrol-expire.cgi mode change 100644 => 100755 tests/auto/qabstractnetworkcache/tests/httpcachetest_cachecontrol.cgi mode change 100644 => 100755 tests/auto/qabstractnetworkcache/tests/httpcachetest_cachecontrol200.cgi mode change 100644 => 100755 tests/auto/qabstractnetworkcache/tests/httpcachetest_etag200.cgi mode change 100644 => 100755 tests/auto/qabstractnetworkcache/tests/httpcachetest_etag304.cgi mode change 100644 => 100755 tests/auto/qabstractnetworkcache/tests/httpcachetest_expires200.cgi mode change 100644 => 100755 tests/auto/qabstractnetworkcache/tests/httpcachetest_expires304.cgi mode change 100644 => 100755 tests/auto/qabstractnetworkcache/tests/httpcachetest_expires500.cgi mode change 100644 => 100755 tests/auto/qabstractnetworkcache/tests/httpcachetest_lastModified200.cgi mode change 100644 => 100755 tests/auto/qabstractnetworkcache/tests/httpcachetest_lastModified304.cgi diff --git a/tests/auto/qabstractnetworkcache/tests/httpcachetest_cachecontrol-expire.cgi b/tests/auto/qabstractnetworkcache/tests/httpcachetest_cachecontrol-expire.cgi old mode 100644 new mode 100755 diff --git a/tests/auto/qabstractnetworkcache/tests/httpcachetest_cachecontrol.cgi b/tests/auto/qabstractnetworkcache/tests/httpcachetest_cachecontrol.cgi old mode 100644 new mode 100755 diff --git a/tests/auto/qabstractnetworkcache/tests/httpcachetest_cachecontrol200.cgi b/tests/auto/qabstractnetworkcache/tests/httpcachetest_cachecontrol200.cgi old mode 100644 new mode 100755 diff --git a/tests/auto/qabstractnetworkcache/tests/httpcachetest_etag200.cgi b/tests/auto/qabstractnetworkcache/tests/httpcachetest_etag200.cgi old mode 100644 new mode 100755 diff --git a/tests/auto/qabstractnetworkcache/tests/httpcachetest_etag304.cgi b/tests/auto/qabstractnetworkcache/tests/httpcachetest_etag304.cgi old mode 100644 new mode 100755 diff --git a/tests/auto/qabstractnetworkcache/tests/httpcachetest_expires200.cgi b/tests/auto/qabstractnetworkcache/tests/httpcachetest_expires200.cgi old mode 100644 new mode 100755 diff --git a/tests/auto/qabstractnetworkcache/tests/httpcachetest_expires304.cgi b/tests/auto/qabstractnetworkcache/tests/httpcachetest_expires304.cgi old mode 100644 new mode 100755 diff --git a/tests/auto/qabstractnetworkcache/tests/httpcachetest_expires500.cgi b/tests/auto/qabstractnetworkcache/tests/httpcachetest_expires500.cgi old mode 100644 new mode 100755 diff --git a/tests/auto/qabstractnetworkcache/tests/httpcachetest_lastModified200.cgi b/tests/auto/qabstractnetworkcache/tests/httpcachetest_lastModified200.cgi old mode 100644 new mode 100755 diff --git a/tests/auto/qabstractnetworkcache/tests/httpcachetest_lastModified304.cgi b/tests/auto/qabstractnetworkcache/tests/httpcachetest_lastModified304.cgi old mode 100644 new mode 100755 -- cgit v0.12 From a902d9e486a0e2460f4888ce610bac269abc5563 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan-Arve=20S=C3=A6ther?= Date: Tue, 12 Jan 2010 15:53:27 +0100 Subject: My changes --- dist/changes-4.6.1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dist/changes-4.6.1 b/dist/changes-4.6.1 index 513cace..ff1f7fe 100644 --- a/dist/changes-4.6.1 +++ b/dist/changes-4.6.1 @@ -229,7 +229,7 @@ Qt for Linux/X11 Qt for Windows -------------- - + - [QTBUG-5145] Compile fixes for win32-icc. - Qt for Mac OS X -- cgit v0.12 From ecef74a8ecfd75b58c99a0131d1a42750051eb76 Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Tue, 12 Jan 2010 16:10:40 +0100 Subject: Skip tst_QSystemLock::processes This test is currently taking 15 minutes to execute, slowing down the entire Qt integration. It needs to be trimmed down before re-enabling it. Reviewed-by: Paul --- tests/auto/qsharedmemory/qsystemlock/tst_qsystemlock.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/auto/qsharedmemory/qsystemlock/tst_qsystemlock.cpp b/tests/auto/qsharedmemory/qsystemlock/tst_qsystemlock.cpp index 8c4eeb1..ea906b7 100644 --- a/tests/auto/qsharedmemory/qsystemlock/tst_qsystemlock.cpp +++ b/tests/auto/qsharedmemory/qsystemlock/tst_qsystemlock.cpp @@ -197,6 +197,7 @@ void tst_QSystemLock::processes_data() */ void tst_QSystemLock::processes() { + QSKIP("This test takes about 15 minutes and needs to be trimmed down before we can re-enable it", SkipAll); QFETCH(int, readOnly); QFETCH(int, readWrite); -- cgit v0.12 From 58a319f851bb5d1a4634df36215694ae1786fbd0 Mon Sep 17 00:00:00 2001 From: Jens Bache-Wiig Date: Tue, 12 Jan 2010 16:13:16 +0100 Subject: Fixes: Add some changes for 4.6.1 --- dist/changes-4.6.1 | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/dist/changes-4.6.1 b/dist/changes-4.6.1 index 4372423..4aa4d5a 100644 --- a/dist/changes-4.6.1 +++ b/dist/changes-4.6.1 @@ -68,6 +68,7 @@ QtGui * [QTBUG-6654] Fix crashes when deleting QGraphicsItems in touch event handlers. + QtDBus ------ @@ -151,6 +152,12 @@ Qt for Linux/X11 - QFileSystemWatcher * [QTBUG-4840] Fix memory leak in the dnotify implementation. + - QIcon + * [QTBUG-6121] Fixed a problem causing svg-based icon themes to look fuzzy. + + - QGtkStyle + * [QTBUG-6484] Ensure that gtk-enable-mnemonics is respected. + Qt for Windows -------------- @@ -161,6 +168,9 @@ Qt for Windows * [QTBUG-6083] Fix a performance regression introduced in 4.6.0 that would cause all Qt posted events to be sent at 15-16ms intervals (instead of as quickly as possible). + - Vista/XP styles + * [QTBUG-6271] Fixed a compatibility issue with MDI windows in + certain non-standard themes. Qt for Mac OS X --------------- -- cgit v0.12 From 152e4ee249915b15241c5f37830f37bb569151b6 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Tue, 12 Jan 2010 16:14:07 +0100 Subject: Fix D-Bus calls with QDBus::BlockWithGui. We must wait for a reply in case the reply hasn't been received yet, not if it has already been received. Simple typo. Task-number: QT-2307 Reviewed-by: Trust Me --- src/dbus/qdbusintegrator.cpp | 2 +- tests/auto/qdbusconnection/tst_qdbusconnection.cpp | 17 +++++++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/src/dbus/qdbusintegrator.cpp b/src/dbus/qdbusintegrator.cpp index 572c050..30fa0b6 100644 --- a/src/dbus/qdbusintegrator.cpp +++ b/src/dbus/qdbusintegrator.cpp @@ -1826,7 +1826,7 @@ QDBusMessage QDBusConnectionPrivate::sendWithReply(const QDBusMessage &message, QDBusPendingCallPrivate *pcall = sendWithReplyAsync(message, timeout); Q_ASSERT(pcall); - if (pcall->replyMessage.type() != QDBusMessage::InvalidMessage) { + if (pcall->replyMessage.type() == QDBusMessage::InvalidMessage) { pcall->watcherHelper = new QDBusPendingCallWatcherHelper; QEventLoop loop; loop.connect(pcall->watcherHelper, SIGNAL(reply(QDBusMessage)), SLOT(quit())); diff --git a/tests/auto/qdbusconnection/tst_qdbusconnection.cpp b/tests/auto/qdbusconnection/tst_qdbusconnection.cpp index 606659f..5e2f3a9 100644 --- a/tests/auto/qdbusconnection/tst_qdbusconnection.cpp +++ b/tests/auto/qdbusconnection/tst_qdbusconnection.cpp @@ -86,6 +86,7 @@ private slots: void connectToBus(); void connect(); void send(); + void sendWithGui(); void sendAsync(); void sendSignal(); @@ -173,6 +174,22 @@ void tst_QDBusConnection::send() QVERIFY(reply.arguments().at(0).toStringList().contains(con.baseService())); } +void tst_QDBusConnection::sendWithGui() +{ + QDBusConnection con = QDBusConnection::sessionBus(); + + QVERIFY(con.isConnected()); + + QDBusMessage msg = QDBusMessage::createMethodCall("org.freedesktop.DBus", + "/org/freedesktop/DBus", "org.freedesktop.DBus", "ListNames"); + + QDBusMessage reply = con.call(msg, QDBus::BlockWithGui); + + QCOMPARE(reply.arguments().count(), 1); + QCOMPARE(reply.arguments().at(0).typeName(), "QStringList"); + QVERIFY(reply.arguments().at(0).toStringList().contains(con.baseService())); +} + void tst_QDBusConnection::sendAsync() { QDBusConnection con = QDBusConnection::sessionBus(); -- cgit v0.12 From 6088336d9237eaa94def8c2a83901b547e682abb Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Tue, 12 Jan 2010 17:00:00 +0100 Subject: really, *really* fix the test :} stupid testr ... and me. --- tests/auto/linguist/lupdate/testdata/good/heuristics/expectedoutput.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/auto/linguist/lupdate/testdata/good/heuristics/expectedoutput.txt b/tests/auto/linguist/lupdate/testdata/good/heuristics/expectedoutput.txt index d5112cc..093610d 100644 --- a/tests/auto/linguist/lupdate/testdata/good/heuristics/expectedoutput.txt +++ b/tests/auto/linguist/lupdate/testdata/good/heuristics/expectedoutput.txt @@ -1,4 +1,4 @@ -*.*Function _eval_ is not implemented +*.*Function 'eval' is not implemented Updating 'project\.ts'\.\.\. Found 3 source text\(s\) \(3 new and 0 already existing\) Removed 5 obsolete entries -- cgit v0.12 From 4db1405ffa66c33f3746baa09301cdc4e05cacc7 Mon Sep 17 00:00:00 2001 From: Pierre Rossi Date: Thu, 7 Jan 2010 13:25:23 +0100 Subject: Modifies the google chat example to use the DOM API Now that it's there, we might as well use it! Reviewed-by: Benjamin Poulain --- examples/webkit/googlechat/form.ui | 6 +++++ examples/webkit/googlechat/googlechat.cpp | 38 +++++++++++++++++-------------- examples/webkit/googlechat/googlechat.h | 3 ++- 3 files changed, 29 insertions(+), 18 deletions(-) diff --git a/examples/webkit/googlechat/form.ui b/examples/webkit/googlechat/form.ui index 3b9fb82..4939ea1 100644 --- a/examples/webkit/googlechat/form.ui +++ b/examples/webkit/googlechat/form.ui @@ -48,6 +48,9 @@ Qt::AlignCenter + + true + @@ -160,6 +163,9 @@ Login + + true + diff --git a/examples/webkit/googlechat/googlechat.cpp b/examples/webkit/googlechat/googlechat.cpp index 12ea071..8eb033c 100644 --- a/examples/webkit/googlechat/googlechat.cpp +++ b/examples/webkit/googlechat/googlechat.cpp @@ -80,9 +80,8 @@ void GoogleChat::showError(const QString &msg) { showStatus(QString("Error: %1").arg(msg)); } -QString GoogleChat::evalJS(const QString &js) { - QWebFrame *frame = form.webView->page()->mainFrame(); - return frame->evaluateJavaScript(js).toString(); +QWebElement GoogleChat::document() const { + return form.webView->page()->mainFrame()->documentElement(); } void GoogleChat::adjustLoginButton() { @@ -112,9 +111,11 @@ void GoogleChat::doLogin() { showStatus("Logging in..."); QString userEmail = userName + "@gmail.com"; - evalJS(QString("document.getElementById('Email').value = \"%1\";").arg(userEmail)); - evalJS(QString("document.getElementById('Passwd').value = \"%1\";").arg(password)); - evalJS("document.getElementById('gaia_loginform').submit();"); + + document().findFirst("#Email").setAttribute("value", userEmail); + document().findFirst("#Passwd").setAttribute("value", password); + document().findFirst("#gaia_loginform").evaluateJavaScript("this.submit();"); + } void GoogleChat::initialPage(bool ok) { @@ -124,11 +125,12 @@ void GoogleChat::initialPage(bool ok) { } if (ok) { - QString s1 = evalJS("document.getElementById('Email').name"); - QString s2 = evalJS("document.getElementById('Passwd').name"); - QString s3 = evalJS("document.getElementById('gaia_loginform').id"); - if (s1 == "Email" && s2 == "Passwd" && s3 == "gaia_loginform") { + QWebElement email = document().findFirst("#Email"); + QWebElement passwd = document().findFirst("#Passwd"); + QWebElement loginForm = document().findFirst("#gaia_loginform"); + if (!email.isNull() && !passwd.isNull() && !loginForm.isNull()) { form.stackedWidget->setCurrentIndex(1); + form.userNameEdit->setFocus(); form.webView->disconnect(); return; } @@ -139,8 +141,8 @@ void GoogleChat::initialPage(bool ok) { void GoogleChat::hideElements() { - evalJS("var e = document.getElementsByClassName('footer-footer')[0]; e.parentElement.removeChild(e)"); - evalJS("var e = document.getElementsByClassName('title-bar-bg title-bar')[0]; e.parentElement.removeChild(e)"); + document().findFirst(".footer-footer").removeFromDocument(); + document().findFirst(".title-bar-bg .title-bar").removeFromDocument(); QTimer::singleShot(2000, this, SLOT(hideElements())); } @@ -152,16 +154,18 @@ void GoogleChat::loginPage(bool ok) { showError("Service unavailable"); } else { // check for any error message - QString c = evalJS("document.getElementsByClassName('errormsg').length"); - if (c == "0") { + + QWebElement e = document().findFirst(".errormsg"); + if (e.isNull()) { form.stackedWidget->setCurrentIndex(2); QTimer::singleShot(500, this, SLOT(hideElements())); return; } - QString err = "Unknown login failure."; - if (c == "1") { - err = evalJS("document.getElementsByClassName('errormsg')[0].textContent"); + QString err = "Unknown login failure."; + const QString errorMessage = e.toPlainText(); + if (!errorMessage.isEmpty()) { + err = errorMessage; err = err.simplified(); } showError(err); diff --git a/examples/webkit/googlechat/googlechat.h b/examples/webkit/googlechat/googlechat.h index 70f921e..617587a 100644 --- a/examples/webkit/googlechat/googlechat.h +++ b/examples/webkit/googlechat/googlechat.h @@ -40,6 +40,7 @@ ****************************************************************************/ #include +#include #include "ui_form.h" @@ -53,7 +54,7 @@ public: protected: void showStatus(const QString &msg); void showError(const QString &msg); - QString evalJS(const QString &js); + QWebElement document() const; private slots: -- cgit v0.12 From c603ca1c8e99dd0ec7e1d0b56b432d8eca21226a Mon Sep 17 00:00:00 2001 From: Pierre Rossi Date: Mon, 11 Jan 2010 15:10:17 +0100 Subject: Make compile on HPUX Reviewed-by: axis --- src/corelib/kernel/qcore_unix.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/corelib/kernel/qcore_unix.cpp b/src/corelib/kernel/qcore_unix.cpp index 328fd3d..0fd965b 100644 --- a/src/corelib/kernel/qcore_unix.cpp +++ b/src/corelib/kernel/qcore_unix.cpp @@ -42,7 +42,9 @@ #include "qcore_unix_p.h" #ifndef Q_OS_VXWORKS +# if !defined(Q_OS_HPUX) || defined(__ia64) # include +# endif # include #else # include -- cgit v0.12 From 06b513193715d5f442a6fd749667aed83944927a Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Tue, 12 Jan 2010 21:57:13 +0100 Subject: QtWebKit changelog for Qt 4.6.1 From qtwebkit-4.6.0 to de77f8ee69c434bde9306c8f407ee2e443a00188 --- dist/changes-4.6.1 | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/dist/changes-4.6.1 b/dist/changes-4.6.1 index 4aa4d5a..612aeda 100644 --- a/dist/changes-4.6.1 +++ b/dist/changes-4.6.1 @@ -101,6 +101,18 @@ QtOpenGL compressed textures if the appropriate extensions are present in the GL implementation. +QtwebKit +-------- + + - Fixed user agent string on Symbian (webkit.org/b/31961) + - QWebInspector: Don't disable when hiding (webkit.org/b/31851) + - Fix JavaScript prompt behaviour for empty/null strings (webkit.org/b/30914) + - Fixed lastIndexOf() on Symbian (webkit.org/b/31773) + - Fixed crash with Flash on Windows with MinGW + - Fixed wrapping of QObjects with recurring identity (webkit.org/b/31681) + - Fixed compilation with ICC + - Fixed assertion when dragging SVG images (webkit.org/b/32511) + QtScript -------- -- cgit v0.12 From 5acc7d86245c17c690b09a742acfe80e6076f599 Mon Sep 17 00:00:00 2001 From: Kurt Korbatits Date: Wed, 13 Jan 2010 14:01:13 +1000 Subject: Fix example in QAudioOutput/QAudioInput docs Fixed error in doc comments. Reviewed-by:Justin McPherson --- src/multimedia/audio/qaudioinput.cpp | 2 +- src/multimedia/audio/qaudiooutput.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/multimedia/audio/qaudioinput.cpp b/src/multimedia/audio/qaudioinput.cpp index 733ff4e..6bc2758 100644 --- a/src/multimedia/audio/qaudioinput.cpp +++ b/src/multimedia/audio/qaudioinput.cpp @@ -103,7 +103,7 @@ QT_BEGIN_NAMESPACE audio = new QAudioInput(format, this); QTimer::singleShot(3000, this, SLOT(stopRecording())); - audio->start(outputFile); + audio->start(&outputFile); // Records audio for 3000ms } \endcode diff --git a/src/multimedia/audio/qaudiooutput.cpp b/src/multimedia/audio/qaudiooutput.cpp index 6633308..a98c360 100644 --- a/src/multimedia/audio/qaudiooutput.cpp +++ b/src/multimedia/audio/qaudiooutput.cpp @@ -98,7 +98,7 @@ QT_BEGIN_NAMESPACE audio = new QAudioOutput(format, this); connect(audio,SIGNAL(stateChanged(QAudio::State)),SLOT(finishedPlaying(QAudio::State))); - audio->start(inputFile); + audio->start(&inputFile); \endcode -- cgit v0.12 From f8621acaffff3a466e92d121c44f142116bb7373 Mon Sep 17 00:00:00 2001 From: Bill King Date: Wed, 13 Jan 2010 14:21:45 +1000 Subject: SQL 4.6.1 changelog --- dist/changes-4.6.1 | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/dist/changes-4.6.1 b/dist/changes-4.6.1 index 7813cbe..0971f40 100644 --- a/dist/changes-4.6.1 +++ b/dist/changes-4.6.1 @@ -208,8 +208,11 @@ QtScript QtSql ----- - - foo - * bar + - [QTBUG-5373] Fixed QSqlRelationalTableModel doesn't correctly work with relation in other database schema. + - [QTBUG-5298] (OCI) Fixed QSqlDatabase.tables() does not work with system tables. + - [QTBUG-6421] Fixed setForwardOnly() for both OCI and SQLite + - [QTBUG-6618] (ODBC) Fixed segfault when error string is larger than 256 chars. + - [QTBUG-4461] (OCI) Fixed problem with clobs being handled as binary QtSvg ----- -- cgit v0.12 From 58be75dec90afbda3c9640266708a7d5b30a1f50 Mon Sep 17 00:00:00 2001 From: Bill King Date: Wed, 13 Jan 2010 15:04:55 +1000 Subject: Update autotest database connection settings --- tests/auto/qsqldatabase/tst_databases.h | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/tests/auto/qsqldatabase/tst_databases.h b/tests/auto/qsqldatabase/tst_databases.h index 4176122..4e99f18 100644 --- a/tests/auto/qsqldatabase/tst_databases.h +++ b/tests/auto/qsqldatabase/tst_databases.h @@ -221,7 +221,8 @@ public: // addDb( "QMYSQL3", "testdb", "troll", "trond", "horsehead.nokia.troll.no", 3309, "CLIENT_COMPRESS=1;CLIENT_SSL=1" ); // MySQL 5.0.18 Linux // addDb( "QMYSQL3", "testdb", "troll", "trond", "silence.nokia.troll.no" ); // MySQL 5.1.36 Windows // addDb( "QMYSQL3", "testdb", "testuser", "Ee4Gabf6_", "mysql4-nokia.trolltech.com.au" ); // MySQL 4.1.22-2.el4 linux -// addDb( "QMYSQL3", "testdb", "testuser", "Ee4Gabf6_", "mysql5-nokia.trolltech.com.au" ); // MySQL 5.0.45-7.el5 linux +// addDb( "QMYSQL3", "testdb", "testuser", "Ee4Gabf6_", "bq-mysql50.apac.nokia.com" ); // MySQL 5.0.45-7.el5 linux +// addDb( "QMYSQL3", "testdb", "testuser", "Ee4Gabf6_", "bq-mysql51.apac.nokia.com" ); // MySQL 5.1.36-6.7.2.i586 linux // addDb( "QPSQL7", "testdb", "troll", "trond", "horsehead.nokia.troll.no" ); // V7.2 NOT SUPPORTED! // addDb( "QPSQL7", "testdb", "troll", "trond", "horsehead.nokia.troll.no", 5434 ); // V7.2 NOT SUPPORTED! Multi-byte @@ -230,7 +231,8 @@ public: // addDb( "QPSQL7", "testdb", "troll", "trond", "horsehead.nokia.troll.no", 5437 ); // V8.0.3 // addDb( "QPSQL7", "testdb", "troll", "trond", "silence.nokia.troll.no" ); // V8.2.1, UTF-8 // addDb( "QPSQL7", "testdb", "testuser", "Ee4Gabf6_", "postgres74-nokia.trolltech.com.au" ); // Version 7.4.19-1.el4_6.1 -// addDb( "QPSQL7", "testdb", "testuser", "Ee4Gabf6_", "postgres81-nokia.trolltech.com.au" ); // Version 8.1.11-1.el5_1.1 +// addDb( "QPSQL7", "testdb", "testuser", "Ee4Gabf6_", "bq-pgsql81.apac.nokia.com" ); // Version 8.1.11-1.el5_1.1 +// addDb( "QPSQL7", "testdb", "testuser", "Ee4Gabf6_", "bq-pgsql84.apac.nokia.com" ); // Version 8.4.1-2.1.i586 // addDb( "QDB2", "testdb", "troll", "trond", "silence.nokia.troll.no" ); // DB2 v9.1 on silence @@ -248,7 +250,7 @@ public: // addDb( "QODBC3", "DRIVER={SQL SERVER};SERVER=iceblink.nokia.troll.no\\ICEBLINK", "troll", "trond", "" ); // addDb( "QODBC3", "DRIVER={SQL Native Client};SERVER=silence.nokia.troll.no\\SQLEXPRESS", "troll", "trond", "" ); -// addDb( "QODBC", "DRIVER={MySQL ODBC 3.51 Driver};SERVER=mysql5-nokia.trolltech.com.au;DATABASE=testdb", "testuser", "Ee4Gabf6_", "" ); +// addDb( "QODBC", "DRIVER={MySQL ODBC 5.1 Driver};SERVER=mysql5-nokia.trolltech.com.au;DATABASE=testdb", "testuser", "Ee4Gabf6_", "" ); // addDb( "QODBC", "DRIVER={MySQL ODBC 5.1 Driver};SERVER=mysql4-nokia.trolltech.com.au;DATABASE=testdb", "testuser", "Ee4Gabf6_", "" ); // addDb( "QODBC", "DRIVER={FreeTDS};SERVER=horsehead.nokia.troll.no;DATABASE=testdb;PORT=4101;UID=troll;PWD=trondk", "troll", "trondk", "" ); // addDb( "QODBC", "DRIVER={FreeTDS};SERVER=silence.nokia.troll.no;DATABASE=testdb;PORT=2392;UID=troll;PWD=trond", "troll", "trond", "" ); @@ -259,6 +261,7 @@ public: // addDb( "QODBC3", "DRIVER={SQL SERVER};SERVER=bq-winserv2003-x86-01.apac.nokia.com;DATABASE=testdb;PORT=1433", "testuser", "Ee4Gabf6_", "" ); // addDb( "QODBC3", "DRIVER={SQL SERVER};SERVER=bq-winserv2008-x86-01.apac.nokia.com;DATABASE=testdb;PORT=1433", "testuser", "Ee4Gabf6_", "" ); // addDb( "QODBC", "DRIVER={Microsoft Access Driver (*.mdb)};DBQ=c:\\dbs\\access\\testdb.mdb", "", "", "" ); +// addDb( "QODBC", "DRIVER={Postgresql};SERVER=postgres81-nokia.trolltech.com.au;DATABASE=testdb", "testuser", "Ee4Gabf6_", "" ); } void open() @@ -335,7 +338,10 @@ public: foreach(const QString &table2, dbtables.filter(table, Qt::CaseInsensitive)) { if(table2.compare(table.section('.', -1, -1), Qt::CaseInsensitive) == 0) { table=db.driver()->escapeIdentifier(table2, QSqlDriver::TableName); - wasDropped = q.exec( "drop table " + table); + if(db.driverName().startsWith( "QPSQL" )) + wasDropped = q.exec( "drop table " + table + " cascade"); + else + wasDropped = q.exec( "drop table " + table); dbtables.removeAll(table2); } } -- cgit v0.12 From dd62687182830aa353ef573f653fe913fd42a8d0 Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Wed, 13 Jan 2010 10:21:04 +0100 Subject: Updated WebKit from /home/shausman/src/webkit/trunk to qtwebkit/qtwebkit-4.6 ( 8b9165d3bc84d1c8cc7df49a191cc3857b5530d4 ) Changes in WebKit/qt since the last update: * Cherry-pick of http://trac.webkit.org/changeset/53181 ( http://bugreports.qt.nokia.com/browse/QTBUG-7290 ) --- src/3rdparty/webkit/VERSION | 2 +- src/3rdparty/webkit/WebCore/ChangeLog | 12 ++++++++++++ src/3rdparty/webkit/WebCore/WebCore.pro | 9 +++++++++ 3 files changed, 22 insertions(+), 1 deletion(-) diff --git a/src/3rdparty/webkit/VERSION b/src/3rdparty/webkit/VERSION index b69ac98..bc6d661 100644 --- a/src/3rdparty/webkit/VERSION +++ b/src/3rdparty/webkit/VERSION @@ -8,4 +8,4 @@ The commit imported was from the and has the sha1 checksum - bd6591b4acaf2172ab05702153ef539c0ac89cbb + 8b9165d3bc84d1c8cc7df49a191cc3857b5530d4 diff --git a/src/3rdparty/webkit/WebCore/ChangeLog b/src/3rdparty/webkit/WebCore/ChangeLog index ab5b131..02daf86 100644 --- a/src/3rdparty/webkit/WebCore/ChangeLog +++ b/src/3rdparty/webkit/WebCore/ChangeLog @@ -1,3 +1,15 @@ +2010-01-13 Miikka Heikkinen + + Reviewed by Simon Hausmann. + + [Qt/Symbian] Added missing vendor information to qtwebkit.sis + + This information is necessary to Symbian sign the package. + + http://bugreports.qt.nokia.com/browse/QTBUG-7290 + + * WebCore.pro: + 2010-01-12 Jakub Wieczorek Reviewed by Adam Barth. diff --git a/src/3rdparty/webkit/WebCore/WebCore.pro b/src/3rdparty/webkit/WebCore/WebCore.pro index 3eba696..9432217 100644 --- a/src/3rdparty/webkit/WebCore/WebCore.pro +++ b/src/3rdparty/webkit/WebCore/WebCore.pro @@ -9,6 +9,15 @@ symbian: { webkitlibs.sources = QtWebKit.dll webkitlibs.path = /sys/bin + vendorinfo = \ + "; Localised Vendor name" \ + "%{\"Nokia, Qt\"}" \ + " " \ + "; Unique Vendor name" \ + ":\"Nokia, Qt\"" \ + " " + webkitlibs.pkg_prerules = vendorinfo + DEPLOYMENT += webkitlibs TARGET.UID3 = 0x200267C2 -- cgit v0.12 From 826d995ff48a01fffc22eafe7b3127e44ed60496 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= Date: Wed, 13 Jan 2010 10:31:38 +0100 Subject: Fixed tst_qgl multipleFBOInterleavedRendering. We need to clobber the vertex attribute pointers _before_ we call setState() to regenerate the clip, or we'll use invalid vertex pointers when writing the clip. Reviewed-by: Paul --- src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp index 2a33255..caa679b 100644 --- a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp +++ b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp @@ -1628,9 +1628,9 @@ void QGL2PaintEngineEx::ensureActive() d->needsSync = false; d->shaderManager->setDirty(); d->ctx->d_func()->syncGlState(); - setState(state()); for (int i = 0; i < 3; ++i) d->vertexAttribPointers[i] = (GLfloat*)-1; // Assume the pointers are clobbered + setState(state()); } } -- cgit v0.12 From 15b10bf77dde5235083f383c186e809c16e2e56a Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Wed, 13 Jan 2010 10:37:10 +0100 Subject: Remove erroneous warning in QFileInfo::absolutePath() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit QFileInfo().absolutePath() is legal and shouldn't produce a warning. Reviewed-by: João Abecasis --- src/corelib/io/qfileinfo.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/corelib/io/qfileinfo.cpp b/src/corelib/io/qfileinfo.cpp index b4437db..e90529e 100644 --- a/src/corelib/io/qfileinfo.cpp +++ b/src/corelib/io/qfileinfo.cpp @@ -573,10 +573,13 @@ QString QFileInfo::canonicalFilePath() const QString QFileInfo::absolutePath() const { Q_D(const QFileInfo); - if (d->data->fileName.isEmpty()) + + if (!d->data->fileEngine) { + return QLatin1String(""); + } else if (d->data->fileName.isEmpty()) { qWarning("QFileInfo::absolutePath: Constructed with empty filename"); - if(!d->data->fileEngine) return QLatin1String(""); + } return d->getFileName(QAbstractFileEngine::AbsolutePathName); } -- cgit v0.12 From 42fc59ed04e1675ecae7fa87303a148c4b0c1ed1 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Wed, 13 Jan 2010 12:21:09 +0100 Subject: My changes for 4.6.1 --- dist/changes-4.6.1 | 66 +++++++++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 60 insertions(+), 6 deletions(-) diff --git a/dist/changes-4.6.1 b/dist/changes-4.6.1 index 0f8c2bc..b07551a 100644 --- a/dist/changes-4.6.1 +++ b/dist/changes-4.6.1 @@ -29,7 +29,9 @@ New features Optimizations ------------- - - Optimized foo in QSomeClass + - Optimized empty QUrl creation + * Empty QUrls no longer allocate memory now + * See list of Important Behavior Changes below @@ -45,6 +47,17 @@ QtCore and Symbian by using realpath() system call * Avoid stat() when opening a file + - QLibrary and QPluginLoader + * Do not look at the Qt patch-level version embedded in plugins' + buildkeys when trying to determine if the plugin is compatible + + - QProcessEnvironment + * [QTBUG-6701] Ensure we don't crash in operator== + + - QTextEncoder + * [merge request 399] QTextEncoder::fromUnicode as QT3 support + member + - QXmlStreamreader * [merge request 1926] Fix parsing of DTDs that contain empty markup declarations @@ -72,8 +85,30 @@ QtGui QtDBus ------ - - foo - * bar + - QDBusConnection + * [QTBUG-5979] Fixed the signal-delivery mechanism to update + correctly when the sender name changes/appears on the bus. + * [QTBUG-7041] Fixed marshalling of booleans in release mode. + * [QT-2307] Fixed calls with the QDBus::BlockWithGui mode. + + - QDBusInterface + * Made it continue working even when the remote object + introspection fails. + + - QDBusInterface and qdbuscpp2xml + * [QTBUG-5563] Fixed an issue with generating annotations in + signals + + - QDBusPendingReply and QDBusReply + * [QTBUG-6571] Fixed a crash that would happen if you tried to + make a call with a disconnected QDBusConnection + +QtMultimedia +------------ + + - QAudioOutput + * [Merge request 418] Fixed compilation the example provided for + QAudioOutput::start QtNetwork --------- @@ -82,6 +117,8 @@ QtNetwork * HTTP: Smaller improvements * HTTP: Send our locale with the HTTP request * HTTP: Start Accept-language and Authorization header with capital letter + * HTTP: Fix caching algorithm, matching RFC 2612 and the documentation + * HTTP [QTBUG-7060]: Fix an issue with headers like "private, max-age=300" * file: Introduce special subclass for higher performance with file:// URLs - QTcpSocket * [QTBUG-5799] Fix waitForConnected() on Windows @@ -101,7 +138,7 @@ QtOpenGL compressed textures if the appropriate extensions are present in the GL implementation. -QtwebKit +QtWebKit -------- - Fixed user agent string on Symbian (webkit.org/b/31961) @@ -112,6 +149,7 @@ QtwebKit - Fixed wrapping of QObjects with recurring identity (webkit.org/b/31681) - Fixed compilation with ICC - Fixed assertion when dragging SVG images (webkit.org/b/32511) + - Added the framecapture example to the default build (merge request 2235) QtScript -------- @@ -152,7 +190,15 @@ Third party components Qt for Unix (X11 and Mac OS X) ------------------------------ - - + - [QTBUG-6755] Ensure we don't call select(2) with a negative timeout + if the timer expires during timeout recalculation. + + - Added mkspecs for Sun CC that enable -library=stlport by default, + to restore STL capability with that compiler. + + - [QTBUG-6576] Fixed compilation on HP-UX 11.11 + + - [QTBUG-6961] Fixed compilation on HURD Qt for Linux/X11 ---------------- @@ -244,5 +290,13 @@ Qt for Symbian * Important Behavior Changes * **************************************************************************** - - + - Phonon + * Include headers have been changed. The only official method for + including Phonon headers is or + . This change was necessary because of + frameworks on Mac. + + Compatibility is provided for includes, but is not + guaranteed to work. Including and is not + supported. -- cgit v0.12 From 8c7e85c7b9933949c7a7c05489f5f6bfd1ce4312 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Wed, 13 Jan 2010 12:39:16 +0100 Subject: Update my changelog for 4.6.1 --- dist/changes-4.6.1 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dist/changes-4.6.1 b/dist/changes-4.6.1 index b07551a..b8994df 100644 --- a/dist/changes-4.6.1 +++ b/dist/changes-4.6.1 @@ -30,9 +30,9 @@ Optimizations ------------- - Optimized empty QUrl creation - * Empty QUrls no longer allocate memory now + * [QTBUG-4030] Empty QUrls no longer allocate memory now - * See list of Important Behavior Changes below + * See list of Important Behavior Changes below **************************************************************************** -- cgit v0.12 From cd0772335cc9bcedd582cacc834bf4609ca650b0 Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Wed, 13 Jan 2010 13:13:07 +0100 Subject: doc: This bug wasn't really a bug; it just required clarification. The reported bug was actually not a bug. It is ok to pass the enum value as a string here, because the enumeration type has been registered with the meta-object system with the Q_ENUMS() macro. However, I have added a bit of text to clarify things a bit. Task-number: QTBUG-7158 --- doc/src/objectmodel/properties.qdoc | 19 +++++++++++-------- doc/src/snippets/code/doc_src_properties.qdoc | 2 +- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/doc/src/objectmodel/properties.qdoc b/doc/src/objectmodel/properties.qdoc index 076c544..a807caf 100644 --- a/doc/src/objectmodel/properties.qdoc +++ b/doc/src/objectmodel/properties.qdoc @@ -208,17 +208,20 @@ the property type. The meta-object compiler enforces these requirements. - Given a pointer to an instance of MyClass or a pointer to an - instance of QObject that happens to be an instance of MyClass, we - have two ways to set its priority property. + Given a pointer to an instance of MyClass or a pointer to a + QObject that is an instance of MyClass, we have two ways to set + its priority property: \snippet doc/src/snippets/code/doc_src_properties.qdoc 6 - In the example, the enumeration type used for the property type - was locally declared in MyClass. Had it been declared in another - class, its fully qualified name (i.e., OtherClass::Priority) would - be required. In addition, that other class must also inherit - QObject and register the enum type using Q_ENUMS(). + In the example, the enumeration type that is the property type is + declared in MyClass and registered with the \l{Meta-Object System} + using the Q_ENUMS() macro. This makes the enumeration values + available as strings for use as in the call to setProperty(). Had + the enumeration type been declared in another class, its fully + qualified name (i.e., OtherClass::Priority) would be required, and + that other class would also have to inherit QObject and register + the enumeration type there using the Q_ENUMS() macro. A similar macro, Q_FLAGS(), is also available. Like Q_ENUMS(), it registers an enumeration type, but it marks the type as being a diff --git a/doc/src/snippets/code/doc_src_properties.qdoc b/doc/src/snippets/code/doc_src_properties.qdoc index 38cc139..962d930 100644 --- a/doc/src/snippets/code/doc_src_properties.qdoc +++ b/doc/src/snippets/code/doc_src_properties.qdoc @@ -112,7 +112,7 @@ MyClass *myinstance = new MyClass; QObject *object = myinstance; myinstance->setPriority(MyClass::VeryHigh); -object->setProperty("priority", (int)MyClass::VeryHigh); +object->setProperty("priority", "VeryHigh"); //! [6] -- cgit v0.12 From 6e5b5305a07d89e67d7867f150283476bcf1f72c Mon Sep 17 00:00:00 2001 From: Markus Goetz Date: Tue, 12 Jan 2010 14:35:05 +0100 Subject: QSslSocket: Remove writeBuffer,readBuffer and use from QAbstractSocket We're using the ones from our parent class instead of own instance. Reviewed-by: Thiago Reviewed-by: joao --- src/network/ssl/qsslsocket_p.h | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/network/ssl/qsslsocket_p.h b/src/network/ssl/qsslsocket_p.h index 5615685..8e22664 100644 --- a/src/network/ssl/qsslsocket_p.h +++ b/src/network/ssl/qsslsocket_p.h @@ -83,9 +83,6 @@ public: QList ignoreErrorsList; bool* readyReadEmittedPointer; - QRingBuffer readBuffer; - QRingBuffer writeBuffer; - QSslConfigurationPrivate configuration; QList sslErrors; -- cgit v0.12 From 82b3e65875fe018c2571d83dabe87bb396e8b60a Mon Sep 17 00:00:00 2001 From: Markus Goetz Date: Wed, 13 Jan 2010 14:23:14 +0100 Subject: tst_qnetworkreply benchmark: Properly finish the thread End the thread at the proper point, before possibly failing one of the test conditions. Reviewed-by: TrustMe --- tests/benchmarks/qnetworkreply/tst_qnetworkreply.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/benchmarks/qnetworkreply/tst_qnetworkreply.cpp b/tests/benchmarks/qnetworkreply/tst_qnetworkreply.cpp index edaf545..6327123 100644 --- a/tests/benchmarks/qnetworkreply/tst_qnetworkreply.cpp +++ b/tests/benchmarks/qnetworkreply/tst_qnetworkreply.cpp @@ -561,15 +561,15 @@ void tst_qnetworkreply::httpUploadPerformance() generator.start(); time.start(); QTestEventLoop::instance().enterLoop(40); + qint64 elapsed = time.elapsed(); + reader.exit(); + reader.wait(); + QVERIFY(reply->isFinished()); QCOMPARE(reply->error(), QNetworkReply::NoError); QVERIFY(!QTestEventLoop::instance().timeout()); - qint64 elapsed = time.elapsed(); qDebug() << "tst_QNetworkReply::httpUploadPerformance" << elapsed << "msec, " << ((UploadSize/1024.0)/(elapsed/1000.0)) << " kB/sec"; - - reader.exit(); - reader.wait(); } -- cgit v0.12