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 6ac37019b952c7d38ee2d04168ef21541f8c15c2 Mon Sep 17 00:00:00 2001 From: David Boddie Date: Fri, 8 Jan 2010 19:28:28 +0100 Subject: Doc: Clarified why a path matches in the example given. Task-number: QT-1519 (internal) Reviewed-by: Trust Me --- doc/src/deployment/qt-conf.qdoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/src/deployment/qt-conf.qdoc b/doc/src/deployment/qt-conf.qdoc index 4357c88..b195889 100644 --- a/doc/src/deployment/qt-conf.qdoc +++ b/doc/src/deployment/qt-conf.qdoc @@ -128,7 +128,7 @@ \list \o 4.0.1 matches \c Paths/4 \o 4.1.5 matches \c Paths/4.1 - \o 4.6.3 matches \c Paths/4.2.5 + \o 4.6.3 matches \c Paths/4.2.5 (because 4.2.5 is the latest version with the same major version number) \o 5.0.0 matches \c Paths \o 6.0.2 matches \c Paths/6 \endlist -- 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 bbac0f08d65b54eccadae7629a5eef10da3b3370 Mon Sep 17 00:00:00 2001 From: David Boddie Date: Mon, 11 Jan 2010 14:27:04 +0100 Subject: Doc: Added a missing example to the list of Graphics View examples. Reviewed-by: Trust Me --- examples/graphicsview/graphicsview.pro | 1 + 1 file changed, 1 insertion(+) diff --git a/examples/graphicsview/graphicsview.pro b/examples/graphicsview/graphicsview.pro index 210ab1f..8f65d51 100644 --- a/examples/graphicsview/graphicsview.pro +++ b/examples/graphicsview/graphicsview.pro @@ -10,6 +10,7 @@ SUBDIRS = \ dragdroprobot \ flowlayout \ anchorlayout \ + simpleanchorlayout \ weatheranchorlayout contains(QT_CONFIG, qt3support):SUBDIRS += portedcanvas portedasteroids -- 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 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 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 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 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 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 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 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 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 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 55305ee1ea58c52928079f83562ba7e680406969 Mon Sep 17 00:00:00 2001 From: David Boddie Date: Tue, 12 Jan 2010 10:25:46 +0100 Subject: Doc: Resized the window and added a title. Reviewed-by: Trust Me --- examples/widgets/validators/validators.ui | 321 +++++++++++++++--------------- 1 file changed, 161 insertions(+), 160 deletions(-) diff --git a/examples/widgets/validators/validators.ui b/examples/widgets/validators/validators.ui index f05b96f..cd984e6 100644 --- a/examples/widgets/validators/validators.ui +++ b/examples/widgets/validators/validators.ui @@ -1,41 +1,42 @@ - + + ValidatorsForm - - + + 0 0 526 - 668 + 443 - - Form + + Validators - - - 9 - - + + 6 + + 9 + - - - 0 - - + + 6 + + 0 + - + - + Qt::Horizontal - + 40 20 @@ -46,84 +47,84 @@ - - + + QIntValidator - - - 9 - - + + 6 + + 9 + - - - 0 - - + + 6 + + 0 + - - + + 0 - + 6 - - - + + + Min: - + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - + + + + 1 0 - + -1000000 - + 1000000 - - - + + + Max: - + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - + + + + 1 0 - + -1000000 - + 1000000 - + 1000 @@ -131,39 +132,39 @@ - - + + QFrame::StyledPanel - + QFrame::Sunken - - - 9 - - + + 6 + + 9 + - - - + + + 0 0 - - :/ledoff.png + + :/ledoff.png - + Qt::AlignCenter - - + + editingFinished() @@ -175,13 +176,13 @@ - + Qt::Vertical - + QSizePolicy::Fixed - + 20 20 @@ -190,134 +191,134 @@ - + - - + + QDoubleValidator - - - 9 - - + + 6 + + 9 + - - - 0 - - + + 6 + + 0 + - - + + 0 - + 6 - - - + + + Min: - + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - + + + + 1 0 - + -100000.000000000000000 - + 100000.000000000000000 - + 0.000000000000000 - - - + + + Format: - + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - + + - + Standard - + Scientific - - - + + + Max: - + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - + + + + 1 0 - + -100000.000000000000000 - + 100000.000000000000000 - + 1000.000000000000000 - - - + + + Decimals: - + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - + + + 2 @@ -325,36 +326,36 @@ - - + + QFrame::StyledPanel - + QFrame::Sunken - - - 9 - - + + 6 + + 9 + - - + + - - :/ledoff.png + + :/ledoff.png - + Qt::AlignCenter - - + + editingFinished() @@ -366,13 +367,13 @@ - + Qt::Vertical - + QSizePolicy::Fixed - + 20 20 @@ -381,17 +382,17 @@ - + - + Qt::Vertical - + 20 111 @@ -400,19 +401,19 @@ - - - 0 - - + + 6 + + 0 + - + Qt::Horizontal - + 40 20 @@ -421,8 +422,8 @@ - - + + Quit @@ -444,7 +445,7 @@ - + @@ -453,11 +454,11 @@ ValidatorsForm close() - + 94 274 - + 131 260 -- 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 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 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 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 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 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 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 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 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 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 From 6c56de757f235f7c18c51ba7215acc4127a8510c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= Date: Wed, 13 Jan 2010 12:27:14 +0100 Subject: Improved performance of translating device coordinate graphics effects. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Don't invalidate the cache if we're only translating and the effect rect is fully contained within the device rect of the painter. Task-number: QTBUG-6901 Reviewed-by: Bjørn Erik Nilsen --- src/gui/effects/qgraphicseffect.cpp | 5 +++ src/gui/effects/qgraphicseffect_p.h | 2 + src/gui/graphicsview/qgraphicsitem.cpp | 44 +++++++++++++-------- src/gui/graphicsview/qgraphicsitem_p.h | 1 + src/gui/graphicsview/qgraphicsscene.cpp | 25 +++++++++++- tests/auto/qgraphicseffect/tst_qgraphicseffect.cpp | 46 ++++++++++++++++++++++ 6 files changed, 105 insertions(+), 18 deletions(-) diff --git a/src/gui/effects/qgraphicseffect.cpp b/src/gui/effects/qgraphicseffect.cpp index 90145fe..ad23df3 100644 --- a/src/gui/effects/qgraphicseffect.cpp +++ b/src/gui/effects/qgraphicseffect.cpp @@ -374,6 +374,11 @@ QGraphicsEffectSourcePrivate::~QGraphicsEffectSourcePrivate() invalidateCache(); } +void QGraphicsEffectSourcePrivate::setCachedOffset(const QPoint &offset) +{ + m_cachedOffset = offset; +} + void QGraphicsEffectSourcePrivate::invalidateCache(InvalidateReason reason) const { if (m_cachedMode != QGraphicsEffect::PadToEffectiveBoundingRect diff --git a/src/gui/effects/qgraphicseffect_p.h b/src/gui/effects/qgraphicseffect_p.h index 91ad74a..e34dbf9 100644 --- a/src/gui/effects/qgraphicseffect_p.h +++ b/src/gui/effects/qgraphicseffect_p.h @@ -129,8 +129,10 @@ public: QGraphicsEffect::PixmapPadMode mode = QGraphicsEffect::PadToTransparentBorder) const = 0; virtual void effectBoundingRectChanged() = 0; + void setCachedOffset(const QPoint &offset); void invalidateCache(InvalidateReason reason = SourceChanged) const; Qt::CoordinateSystem currentCachedSystem() const { return m_cachedSystem; } + QGraphicsEffect::PixmapPadMode currentCachedMode() const { return m_cachedMode; } friend class QGraphicsScenePrivate; friend class QGraphicsItem; diff --git a/src/gui/graphicsview/qgraphicsitem.cpp b/src/gui/graphicsview/qgraphicsitem.cpp index 168a9a3..cae9660 100644 --- a/src/gui/graphicsview/qgraphicsitem.cpp +++ b/src/gui/graphicsview/qgraphicsitem.cpp @@ -10715,27 +10715,18 @@ void QGraphicsItemEffectSourcePrivate::draw(QPainter *painter) } } -QPixmap QGraphicsItemEffectSourcePrivate::pixmap(Qt::CoordinateSystem system, QPoint *offset, - QGraphicsEffect::PixmapPadMode mode) const +QRect QGraphicsItemEffectSourcePrivate::paddedEffectRect(Qt::CoordinateSystem system, QGraphicsEffect::PixmapPadMode mode, const QRectF &sourceRect, bool *unpadded) const { - const bool deviceCoordinates = (system == Qt::DeviceCoordinates); - if (!info && deviceCoordinates) { - // Device coordinates without info not yet supported. - qWarning("QGraphicsEffectSource::pixmap: Not yet implemented, lacking device context"); - return QPixmap(); - } - if (!item->d_ptr->scene) - return QPixmap(); - QGraphicsScenePrivate *scened = item->d_ptr->scene->d_func(); - - const QRectF sourceRect = boundingRect(system); QRectF effectRectF; - bool unpadded = false; + if (unpadded) + *unpadded = false; + if (mode == QGraphicsEffect::PadToEffectiveBoundingRect) { if (info) { effectRectF = item->graphicsEffect()->boundingRectFor(boundingRect(Qt::DeviceCoordinates)); - unpadded = (effectRectF.size() == sourceRect.size()); + if (unpadded) + *unpadded = (effectRectF.size() == sourceRect.size()); if (info && system == Qt::LogicalCoordinates) effectRectF = info->painter->worldTransform().inverted().mapRect(effectRectF); } else { @@ -10747,10 +10738,29 @@ QPixmap QGraphicsItemEffectSourcePrivate::pixmap(Qt::CoordinateSystem system, QP effectRectF = sourceRect.adjusted(-1.5, -1.5, 1.5, 1.5); } else { effectRectF = sourceRect; - unpadded = true; + if (unpadded) + *unpadded = true; + } + + return effectRectF.toAlignedRect(); +} + +QPixmap QGraphicsItemEffectSourcePrivate::pixmap(Qt::CoordinateSystem system, QPoint *offset, + QGraphicsEffect::PixmapPadMode mode) const +{ + const bool deviceCoordinates = (system == Qt::DeviceCoordinates); + if (!info && deviceCoordinates) { + // Device coordinates without info not yet supported. + qWarning("QGraphicsEffectSource::pixmap: Not yet implemented, lacking device context"); + return QPixmap(); } + if (!item->d_ptr->scene) + return QPixmap(); + QGraphicsScenePrivate *scened = item->d_ptr->scene->d_func(); - QRect effectRect = effectRectF.toAlignedRect(); + bool unpadded; + const QRectF sourceRect = boundingRect(system); + QRect effectRect = paddedEffectRect(system, mode, sourceRect, &unpadded); if (offset) *offset = effectRect.topLeft(); diff --git a/src/gui/graphicsview/qgraphicsitem_p.h b/src/gui/graphicsview/qgraphicsitem_p.h index c8d2061..2d34b80 100644 --- a/src/gui/graphicsview/qgraphicsitem_p.h +++ b/src/gui/graphicsview/qgraphicsitem_p.h @@ -609,6 +609,7 @@ public: QPixmap pixmap(Qt::CoordinateSystem system, QPoint *offset, QGraphicsEffect::PixmapPadMode mode) const; + QRect paddedEffectRect(Qt::CoordinateSystem system, QGraphicsEffect::PixmapPadMode mode, const QRectF &sourceRect, bool *unpadded = 0) const; QGraphicsItem *item; QGraphicsItemPaintInfo *info; diff --git a/src/gui/graphicsview/qgraphicsscene.cpp b/src/gui/graphicsview/qgraphicsscene.cpp index 5c6a8ae..cea723c 100644 --- a/src/gui/graphicsview/qgraphicsscene.cpp +++ b/src/gui/graphicsview/qgraphicsscene.cpp @@ -4686,8 +4686,31 @@ void QGraphicsScenePrivate::drawSubtreeRecursive(QGraphicsItem *item, QPainter * if (sourced->currentCachedSystem() != Qt::LogicalCoordinates && sourced->lastEffectTransform != painter->worldTransform()) { + bool unclipped = false; + if (sourced->lastEffectTransform.type() <= QTransform::TxTranslate + && painter->worldTransform().type() <= QTransform::TxTranslate) + { + QRectF itemRect = item->boundingRect(); + if (!item->d_ptr->children.isEmpty()) + itemRect |= item->childrenBoundingRect(); + + QRectF oldSourceRect = sourced->lastEffectTransform.mapRect(itemRect); + QRectF newSourceRect = painter->worldTransform().mapRect(itemRect); + + QRect oldEffectRect = sourced->paddedEffectRect(sourced->currentCachedSystem(), sourced->currentCachedMode(), oldSourceRect); + QRect newEffectRect = sourced->paddedEffectRect(sourced->currentCachedSystem(), sourced->currentCachedMode(), newSourceRect); + + QRect deviceRect(0, 0, painter->device()->width(), painter->device()->height()); + if (deviceRect.contains(oldEffectRect) && deviceRect.contains(newEffectRect)) { + sourced->setCachedOffset(newEffectRect.topLeft()); + unclipped = true; + } + } + sourced->lastEffectTransform = painter->worldTransform(); - sourced->invalidateCache(QGraphicsEffectSourcePrivate::TransformChanged); + + if (!unclipped) + sourced->invalidateCache(QGraphicsEffectSourcePrivate::TransformChanged); } item->d_ptr->graphicsEffect->draw(painter); diff --git a/tests/auto/qgraphicseffect/tst_qgraphicseffect.cpp b/tests/auto/qgraphicseffect/tst_qgraphicseffect.cpp index 95de70e..51e2a57 100644 --- a/tests/auto/qgraphicseffect/tst_qgraphicseffect.cpp +++ b/tests/auto/qgraphicseffect/tst_qgraphicseffect.cpp @@ -70,6 +70,7 @@ private slots: void grayscale(); void colorize(); void drawPixmapItem(); + void deviceCoordinateTranslateCaching(); }; void tst_QGraphicsEffect::initTestCase() @@ -514,6 +515,51 @@ void tst_QGraphicsEffect::drawPixmapItem() QTRY_VERIFY(effect->repaints >= 2); } +class DeviceEffect : public QGraphicsEffect +{ +public: + QRectF boundingRectFor(const QRectF &rect) const + { return rect; } + + void draw(QPainter *painter) + { + QPoint offset; + QPixmap pixmap = sourcePixmap(Qt::DeviceCoordinates, &offset, QGraphicsEffect::NoPad); + + if (pixmap.isNull()) + return; + + painter->save(); + painter->setWorldTransform(QTransform()); + painter->drawPixmap(offset, pixmap); + painter->restore(); + } +}; + +void tst_QGraphicsEffect::deviceCoordinateTranslateCaching() +{ + QGraphicsScene scene; + CustomItem *item = new CustomItem(0, 0, 10, 10); + scene.addItem(item); + scene.setSceneRect(0, 0, 50, 0); + + item->setGraphicsEffect(new DeviceEffect); + item->setPen(Qt::NoPen); + item->setBrush(Qt::red); + + QGraphicsView view(&scene); + view.show(); + QTest::qWaitForWindowShown(&view); + + QTRY_VERIFY(item->numRepaints >= 1); + int numRepaints = item->numRepaints; + + item->translate(10, 0); + QTest::qWait(50); + + QVERIFY(item->numRepaints == numRepaints); +} + QTEST_MAIN(tst_QGraphicsEffect) #include "tst_qgraphicseffect.moc" -- cgit v0.12 From 83ddf9cae0ef33aa0f07d7ea93460e5366efd786 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= Date: Wed, 13 Jan 2010 13:39:25 +0100 Subject: Removed pointless image comparison in raster colorize filter. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This test is meant to check whether the grayscale operation is done in-place or not. Task-number: QTBUG-6901 Reviewed-by: Bjørn Erik Nilsen --- src/gui/image/qpixmapfilter.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/image/qpixmapfilter.cpp b/src/gui/image/qpixmapfilter.cpp index 30fb7a3..37a6a18 100644 --- a/src/gui/image/qpixmapfilter.cpp +++ b/src/gui/image/qpixmapfilter.cpp @@ -953,7 +953,7 @@ static void grayscale(const QImage &image, QImage &dest, const QRect& rect = QRe srcRect = dest.rect(); destRect = dest.rect(); } - if (image != dest) { + if (&image != &dest) { destRect.moveTo(QPoint(0, 0)); } -- cgit v0.12 From a78792ce877e549b6b19c64abc457bb3ce0e3d82 Mon Sep 17 00:00:00 2001 From: Harald Fernengel Date: Tue, 12 Jan 2010 14:48:53 +0100 Subject: Use a QTextBrowser instead of a read only QTextEdit ... to display the extra text content. This works well on Maemo and on S60, and has the added benefit that external URLs (like in aboutQt) are opened correctly. Reviewed-By: Jason Barron --- src/gui/dialogs/qmessagebox.cpp | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/src/gui/dialogs/qmessagebox.cpp b/src/gui/dialogs/qmessagebox.cpp index 30892f2..d1b2e3f 100644 --- a/src/gui/dialogs/qmessagebox.cpp +++ b/src/gui/dialogs/qmessagebox.cpp @@ -58,6 +58,7 @@ #include #include #include +#include #include #include "qdialog_p.h" #include @@ -188,8 +189,8 @@ public: bool autoAddOkButton; QAbstractButton *detectedEscapeButton; QLabel *informativeLabel; -#ifdef Q_OS_SYMBIAN - QTextEdit *textEdit; +#if defined(Q_OS_SYMBIAN) || defined(Q_WS_MAEMO_5) + QTextBrowser *textBrowser; #endif QPointer receiverToDisconnectOnClose; QByteArray memberToDisconnectOnClose; @@ -2462,12 +2463,12 @@ void QMessageBox::setInformativeText(const QString &text) #endif label->setWordWrap(true); QGridLayout *grid = static_cast(layout()); -#ifdef Q_OS_SYMBIAN +#if defined(Q_OS_SYMBIAN) || defined(Q_WS_MAEMO_5) label->hide(); - QTextEdit *textEdit = new QTextEdit(this); - textEdit->setReadOnly(true); - grid->addWidget(textEdit, 1, 1, 1, 1); - d->textEdit = textEdit; + QTextBrowser *textBrowser = new QTextBrowser(this); + textBrowser->setOpenExternalLinks(true); + grid->addWidget(textBrowser, 1, 1, 1, 1); + d->textBrowser = textBrowser; #else grid->addWidget(label, 1, 1, 1, 1); #endif @@ -2475,9 +2476,9 @@ void QMessageBox::setInformativeText(const QString &text) } d->informativeLabel->setText(text); -#ifdef Q_OS_SYMBIAN - //We need to put the informative label inside textEdit to enable scrolling of long texts. - d->textEdit->setText(d->informativeLabel->text()); +#if defined(Q_OS_SYMBIAN) || defined(Q_WS_MAEMO_5) + //We need to put the informative label inside textBrowser to enable scrolling of long texts. + d->textBrowser->setText(d->informativeLabel->text()); #endif d->updateSize(); -- cgit v0.12 From e946653750da6b129096dacdf2336eb519179089 Mon Sep 17 00:00:00 2001 From: Thomas Zander Date: Wed, 13 Jan 2010 11:54:35 +0100 Subject: Make compile on symbian/Linux symbian headers on Linux are lowercase and this should work on Windows too. --- src/gui/widgets/qabstractspinbox.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/widgets/qabstractspinbox.cpp b/src/gui/widgets/qabstractspinbox.cpp index 13e67e9..4a6235c 100644 --- a/src/gui/widgets/qabstractspinbox.cpp +++ b/src/gui/widgets/qabstractspinbox.cpp @@ -66,7 +66,7 @@ #endif #if defined(Q_OS_SYMBIAN) -#include +#include #include #endif -- cgit v0.12 From 59ee1b9d387468a5a80b5c450aa202d1b33e6bd1 Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Wed, 13 Jan 2010 15:11:43 +0100 Subject: More changelog additions for QtWebKit Reviewed-by: Trust me --- 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 0971f40..e31fc7c 100644 --- a/dist/changes-4.6.1 +++ b/dist/changes-4.6.1 @@ -198,6 +198,8 @@ 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) + - Fixed crash with ACID3 test on Symbian + - Fixed security issue XSL stylesheets and security origins. QtScript -------- -- cgit v0.12 From f247315cece2929d471eebfbd7e40bfb4eca831b Mon Sep 17 00:00:00 2001 From: Iain Date: Wed, 13 Jan 2010 14:15:48 +0000 Subject: Use MMP keyword, not compiler flags, to update FPU option on Symbian This avoids two sets of --fpu flags being passed on the compiler command line, so we don't have to worry about which takes precedence (especially since it varies between RVCT and GCC). Putting ARMFPU in the MMP file means that the toolchain will replace its default option with the one we specify instead. Reviewed-by: Aleksandar Sasha Babic --- configure.exe | Bin 1176576 -> 1176064 bytes tools/configure/configureapp.cpp | 3 ++- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/configure.exe b/configure.exe index a410efc..d88da13 100644 Binary files a/configure.exe and b/configure.exe differ diff --git a/tools/configure/configureapp.cpp b/tools/configure/configureapp.cpp index 0ddb1df..78f65a6 100644 --- a/tools/configure/configureapp.cpp +++ b/tools/configure/configureapp.cpp @@ -2770,8 +2770,9 @@ void Configure::generateCachefile() if (!dictionary["QT_LIBINFIX"].isEmpty()) configStream << "QT_LIBINFIX = " << dictionary["QT_LIBINFIX"] << endl; + configStream << "#Qt for Symbian FPU settings" << endl; if(!dictionary["ARM_FPU_TYPE"].isEmpty()) { - configStream<<"QMAKE_CXXFLAGS.ARMCC += --fpu "<< dictionary["ARM_FPU_TYPE"]; + configStream<<"MMP_RULES += \"ARMFPU "<< dictionary["ARM_FPU_TYPE"]<< "\""; } configStream.flush(); -- cgit v0.12 From 7bfc32ca6a462b498b9f349454113cd37f64e89f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Trond=20Kjern=C3=A5sen?= Date: Wed, 13 Jan 2010 15:53:04 +0100 Subject: Rework how Qt handles GL extensions. Qt used to store the GL extensions a particular implementation supported in a global cache, which was initialized once and never updated. This could cause problems because different types of context might support different kinds of extensions (e.g. the difference between sw and hw contexts). With this patch, the GL extensions are cached and updated within each QGLContext. It also makes the extension initialization lazy, which saves application initialization costs for embedded platforms. The patch introduces a internal cross platform QGLTemporaryContext class that is used to create a light-weight GL context without going via QGLWidget and friends (QWS and WinCE still have QGLWidget fallbacks for now). Reviewed-by: Kim Reviewed-by: Samuel --- src/opengl/qgl.cpp | 85 +++++++++++----- src/opengl/qgl.h | 1 + src/opengl/qgl_mac.mm | 110 +++++++++++--------- src/opengl/qgl_p.h | 95 +++++++++++------- src/opengl/qgl_qws.cpp | 54 ++++------ src/opengl/qgl_win.cpp | 100 +++++++++---------- src/opengl/qgl_wince.cpp | 36 +++---- src/opengl/qgl_x11.cpp | 138 +++++++++++-------------- src/opengl/qgl_x11egl.cpp | 194 +++++++++++++++++------------------- src/opengl/qglframebufferobject.cpp | 12 +-- src/opengl/qglpixelbuffer_mac.mm | 4 +- src/opengl/qglpixelbuffer_p.h | 1 - src/opengl/qglpixelbuffer_win.cpp | 14 ++- src/opengl/qpaintengine_opengl.cpp | 46 ++++++--- src/opengl/qwindowsurface_gl.cpp | 7 +- 15 files changed, 469 insertions(+), 428 deletions(-) diff --git a/src/opengl/qgl.cpp b/src/opengl/qgl.cpp index a262ded..09ecfd1 100644 --- a/src/opengl/qgl.cpp +++ b/src/opengl/qgl.cpp @@ -124,9 +124,6 @@ public: }; Q_GLOBAL_STATIC(QGLDefaultOverlayFormat, defaultOverlayFormatInstance) -QGLExtensions::Extensions QGLExtensions::glExtensions = 0; -bool QGLExtensions::nvidiaFboNeedsFinish = false; - Q_GLOBAL_STATIC(QGLSignalProxy, theSignalProxy) QGLSignalProxy *QGLSignalProxy::instance() { @@ -154,11 +151,9 @@ public: // falling back to the GL 1 engine.. static bool mac_x1600_check_done = false; if (!mac_x1600_check_done) { - QGLWidget *tmp = 0; - if (!QGLContext::currentContext()) { - tmp = new QGLWidget(); - tmp->makeCurrent(); - } + QGLTemporaryContext *tmp = 0; + if (!QGLContext::currentContext()) + tmp = new QGLTemporaryContext(); if (strstr((char *) glGetString(GL_RENDERER), "X1600")) engineType = QPaintEngine::OpenGL; if (tmp) @@ -178,7 +173,7 @@ public: // from an old GL 1.1 server to a GL 2.x client. In that case we can't // use GL 2.0. if ((QGLFormat::openGLVersionFlags() & QGLFormat::OpenGL_Version_2_0) - && (QGLExtensions::glExtensions & QGLExtensions::FragmentShader) + && (QGLExtensions::glExtensions() & QGLExtensions::FragmentShader) && qgetenv("QT_GL_USE_OPENGL1ENGINE").isEmpty()) engineType = QPaintEngine::OpenGL2; else @@ -1250,7 +1245,7 @@ QGLFormat::OpenGLVersionFlags QGLFormat::openGLVersionFlags() static bool cachedDefault = false; static OpenGLVersionFlags defaultVersionFlags = OpenGL_Version_None; QGLContext *currentCtx = const_cast(QGLContext::currentContext()); - QGLWidget *dummy = 0; + QGLTemporaryContext *tmpContext = 0; if (currentCtx && currentCtx->d_func()->version_flags_cached) return currentCtx->d_func()->version_flags; @@ -1261,8 +1256,7 @@ QGLFormat::OpenGLVersionFlags QGLFormat::openGLVersionFlags() } else { if (!hasOpenGL()) return defaultVersionFlags; - dummy = new QGLWidget; - dummy->makeCurrent(); // glGetString() needs a current context + tmpContext = new QGLTemporaryContext; cachedDefault = true; } } @@ -1273,9 +1267,9 @@ QGLFormat::OpenGLVersionFlags QGLFormat::openGLVersionFlags() currentCtx->d_func()->version_flags_cached = true; currentCtx->d_func()->version_flags = versionFlags; } - if (dummy) { + if (tmpContext) { defaultVersionFlags = versionFlags; - delete dummy; + delete tmpContext; } return versionFlags; @@ -1493,6 +1487,8 @@ void QGLContextPrivate::init(QPaintDevice *dev, const QGLFormat &format) max_texture_size = -1; version_flags_cached = false; version_flags = QGLFormat::OpenGL_Version_None; + extension_flags_cached = false; + extension_flags = 0; current_fbo = 0; default_fbo = 0; active_engine = 0; @@ -2147,7 +2143,7 @@ QGLTexture* QGLContextPrivate::bindTexture(const QImage &image, GLenum target, G int tx_h = qt_next_power_of_two(image.height()); QImage img = image; - if (!(QGLExtensions::glExtensions & QGLExtensions::NPOTTextures) + if (!(QGLExtensions::glExtensions() & QGLExtensions::NPOTTextures) && !(QGLFormat::openGLVersionFlags() & QGLFormat::OpenGL_ES_Version_2_0) && (target == GL_TEXTURE_2D && (tx_w != image.width() || tx_h != image.height()))) { @@ -2169,7 +2165,7 @@ QGLTexture* QGLContextPrivate::bindTexture(const QImage &image, GLenum target, G bool genMipmap = false; #endif if (glFormat.directRendering() - && (QGLExtensions::glExtensions & QGLExtensions::GenerateMipmap) + && (QGLExtensions::glExtensions() & QGLExtensions::GenerateMipmap) && target == GL_TEXTURE_2D && (options & QGLContext::MipmapBindOption)) { @@ -2197,7 +2193,7 @@ QGLTexture* QGLContextPrivate::bindTexture(const QImage &image, GLenum target, G bool premul = options & QGLContext::PremultipliedAlphaBindOption; GLenum externalFormat; GLuint pixel_type; - if (QGLExtensions::glExtensions & QGLExtensions::BGRATextureFormat) { + if (QGLExtensions::glExtensions() & QGLExtensions::BGRATextureFormat) { externalFormat = GL_BGRA; pixel_type = GL_UNSIGNED_INT_8_8_8_8_REV; } else { @@ -4868,9 +4864,13 @@ QGLWidget::QGLWidget(QGLContext *context, QWidget *parent, #endif // QT3_SUPPORT -void QGLExtensions::init_extensions() +/* + Returns the GL extensions for the current context. +*/ +QGLExtensions::Extensions QGLExtensions::currentContextExtensions() { QGLExtensionMatcher extensions(reinterpret_cast(glGetString(GL_EXTENSIONS))); + Extensions glExtensions; if (extensions.match("GL_ARB_texture_rectangle")) glExtensions |= TextureRectangle; @@ -4931,6 +4931,46 @@ void QGLExtensions::init_extensions() if (extensions.match("GL_EXT_bgra")) glExtensions |= BGRATextureFormat; + + return glExtensions; +} + +/* + Returns the GL extensions for the current QGLContext. If there is no + current QGLContext, a default context will be created and the extensions + for that context will be returned instead. +*/ +QGLExtensions::Extensions QGLExtensions::glExtensions() +{ + QGLTemporaryContext *tmpContext = 0; + static bool cachedDefault = false; + static Extensions defaultExtensions = 0; + QGLContext *currentCtx = const_cast(QGLContext::currentContext()); + + if (currentCtx && currentCtx->d_func()->extension_flags_cached) + return currentCtx->d_func()->extension_flags; + + if (!currentCtx) { + if (cachedDefault) { + return defaultExtensions; + } else { + tmpContext = new QGLTemporaryContext; + cachedDefault = true; + } + } + + Extensions extensionFlags = currentContextExtensions(); + if (currentCtx) { + currentCtx->d_func()->extension_flags_cached = true; + currentCtx->d_func()->extension_flags = extensionFlags; + } else { + defaultExtensions = extensionFlags; + } + + if (tmpContext) + delete tmpContext; + + return extensionFlags; } /* @@ -4942,7 +4982,6 @@ void QGLWidgetPrivate::initContext(QGLContext *context, const QGLWidget* shareWi glDevice.setWidget(q); - QGLExtensions::init(); glcx = 0; autoSwap = true; @@ -5191,7 +5230,7 @@ QSize QGLTexture::bindCompressedTexture } #if !defined(QT_OPENGL_ES) if (!glCompressedTexImage2D) { - if (!(QGLExtensions::glExtensions & QGLExtensions::TextureCompression)) { + if (!(QGLExtensions::glExtensions() & QGLExtensions::TextureCompression)) { qWarning("QGLContext::bindTexture(): The GL implementation does " "not support texture compression extensions."); return QSize(); @@ -5230,7 +5269,7 @@ QSize QGLTexture::bindCompressedTextureDDS(const char *buf, int len) return QSize(); // Bail out if the necessary extension is not present. - if (!(QGLExtensions::glExtensions & QGLExtensions::DDSTextureCompression)) { + if (!(QGLExtensions::glExtensions() & QGLExtensions::DDSTextureCompression)) { qWarning("QGLContext::bindTexture(): DDS texture compression is not supported."); return QSize(); } @@ -5340,13 +5379,13 @@ QSize QGLTexture::bindCompressedTexturePVR(const char *buf, int len) // Bail out if the necessary extension is not present. if (textureFormat == GL_ETC1_RGB8_OES) { - if (!(QGLExtensions::glExtensions & + if (!(QGLExtensions::glExtensions() & QGLExtensions::ETC1TextureCompression)) { qWarning("QGLContext::bindTexture(): ETC1 texture compression is not supported."); return QSize(); } } else { - if (!(QGLExtensions::glExtensions & + if (!(QGLExtensions::glExtensions() & QGLExtensions::PVRTCTextureCompression)) { qWarning("QGLContext::bindTexture(): PVRTC texture compression is not supported."); return QSize(); diff --git a/src/opengl/qgl.h b/src/opengl/qgl.h index 374c6d6..1a04ff9 100644 --- a/src/opengl/qgl.h +++ b/src/opengl/qgl.h @@ -401,6 +401,7 @@ private: friend class QGLContextGroup; friend class QGLSharedResourceGuard; friend class QGLPixmapBlurFilter; + friend class QGLExtensions; friend QGLFormat::OpenGLVersionFlags QGLFormat::openGLVersionFlags(); #ifdef Q_WS_MAC public: diff --git a/src/opengl/qgl_mac.mm b/src/opengl/qgl_mac.mm index 6ed07e5..c01575b 100644 --- a/src/opengl/qgl_mac.mm +++ b/src/opengl/qgl_mac.mm @@ -116,6 +116,68 @@ extern void qt_mac_dispose_rgn(RgnHandle); //qregion_mac.cpp extern QRegion qt_mac_convert_mac_region(RgnHandle); //qregion_mac.cpp extern void qt_mac_to_pascal_string(QString s, Str255 str, TextEncoding encoding=0, int len=-1); //qglobal.cpp +/* + QGLTemporaryContext implementation +*/ + +class QGLTemporaryContextPrivate +{ +public: +#ifndef QT_MAC_USE_COCOA + AGLContext ctx; +#else + NSOpenGLContext *ctx; +#endif +}; + +QGLTemporaryContext::QGLTemporaryContext(bool, QWidget *) + : d(new QGLTemporaryContextPrivate) +{ + d->ctx = 0; +#ifndef QT_MAC_USE_COCOA + GLint attribs[] = {AGL_RGBA, AGL_NONE}; + AGLPixelFormat fmt = aglChoosePixelFormat(0, 0, attribs); + if (!fmt) { + qDebug("QGLTemporaryContext: Couldn't find any RGB visuals"); + return; + } + d->ctx = aglCreateContext(fmt, 0); + if (!d->ctx) + qDebug("QGLTemporaryContext: Unable to create context"); + else + aglSetCurrentContext(d->ctx); + aglDestroyPixelFormat(fmt); +#else + QMacCocoaAutoReleasePool pool; + NSOpenGLPixelFormatAttribute attribs[] = { 0 }; + NSOpenGLPixelFormat *fmt = [[NSOpenGLPixelFormat alloc] initWithAttributes:attribs]; + if (!fmt) { + qWarning("QGLTemporaryContext: Cannot find any visuals"); + return; + } + + d->ctx = [[NSOpenGLContext alloc] initWithFormat:fmt shareContext:0]; + if (!d->ctx) + qWarning("QGLTemporaryContext: Cannot create context"); + else + [d->ctx makeCurrentContext]; + [fmt release]; +#endif +} + +QGLTemporaryContext::~QGLTemporaryContext() +{ + if (d->ctx) { +#ifndef QT_MAC_USE_COCOA + aglSetCurrentContext(0); + aglDestroyContext(d->ctx); +#else + [NSOpenGLContext clearCurrentContext]; + [d->ctx release]; +#endif + } +} + bool QGLFormat::hasOpenGL() { return true; @@ -918,54 +980,6 @@ void QGLWidgetPrivate::updatePaintDevice() q->update(); } - -void QGLExtensions::init() -{ - static bool init_done = false; - - if (init_done) - return; - init_done = true; - -#ifndef QT_MAC_USE_COCOA - GLint attribs[] = { AGL_RGBA, AGL_NONE }; - AGLPixelFormat fmt = aglChoosePixelFormat(0, 0, attribs); - if (!fmt) { - qDebug("QGLExtensions: Couldn't find any RGB visuals"); - return; - } - AGLContext ctx = aglCreateContext(fmt, 0); - if (!ctx) { - qDebug("QGLExtensions: Unable to create context"); - } else { - aglSetCurrentContext(ctx); - init_extensions(); - aglSetCurrentContext(0); - aglDestroyContext(ctx); - } - aglDestroyPixelFormat(fmt); -#else - QMacCocoaAutoReleasePool pool; - NSOpenGLPixelFormatAttribute attribs[] = { 0 }; - NSOpenGLPixelFormat *fmt = [[NSOpenGLPixelFormat alloc] initWithAttributes:attribs]; - if (!fmt) { - qWarning("QGLExtensions: Cannot find any visuals"); - return; - } - - NSOpenGLContext *ctx = [[NSOpenGLContext alloc] initWithFormat:fmt shareContext:0]; - if (!ctx) { - qWarning("QGLExtensions: Cannot create context"); - } else { - [ctx makeCurrentContext]; - init_extensions(); - [NSOpenGLContext clearCurrentContext]; - [ctx release]; - } - [fmt release]; -#endif -} - #endif QT_END_NAMESPACE diff --git a/src/opengl/qgl_p.h b/src/opengl/qgl_p.h index 30f5591..0104f07 100644 --- a/src/opengl/qgl_p.h +++ b/src/opengl/qgl_p.h @@ -261,6 +261,60 @@ private: // "ctx" is destroyed. Returns null if nothing is sharing with ctx. Q_OPENGL_EXPORT const QGLContext *qt_gl_transfer_context(const QGLContext *); +// GL extension definitions +class QGLExtensions { +public: + enum Extension { + TextureRectangle = 0x00000001, + SampleBuffers = 0x00000002, + GenerateMipmap = 0x00000004, + TextureCompression = 0x00000008, + FragmentProgram = 0x00000010, + MirroredRepeat = 0x00000020, + FramebufferObject = 0x00000040, + StencilTwoSide = 0x00000080, + StencilWrap = 0x00000100, + PackedDepthStencil = 0x00000200, + NVFloatBuffer = 0x00000400, + PixelBufferObject = 0x00000800, + FramebufferBlit = 0x00001000, + NPOTTextures = 0x00002000, + BGRATextureFormat = 0x00004000, + DDSTextureCompression = 0x00008000, + ETC1TextureCompression = 0x00010000, + PVRTCTextureCompression = 0x00020000, + FragmentShader = 0x00040000 + }; + Q_DECLARE_FLAGS(Extensions, Extension) + + static Extensions glExtensions(); + +private: + static Extensions currentContextExtensions(); +}; + +/* + QGLTemporaryContext - the main objective of this class is to have a way of + creating a GL context and making it current, without going via QGLWidget + and friends. At certain points during GL initialization we need a current + context in order decide what GL features are available, and to resolve GL + extensions. Having a light-weight way of creating such a context saves + initial application startup time, and it doesn't wind up creating recursive + conflicts. + The class currently uses a private d pointer to hide the platform specific + types. This could possibly been done inline with #ifdef'ery, but it causes + major headaches on e.g. X11 due to namespace pollution. +*/ +class QGLTemporaryContextPrivate; +class QGLTemporaryContext { +public: + QGLTemporaryContext(bool directRendering = true, QWidget *parent = 0); + ~QGLTemporaryContext(); + +private: + QScopedPointer d; +}; + class QGLTexture; // This probably needs to grow to GL_MAX_VERTEX_ATTRIBS, but 3 is ok for now as that's @@ -333,10 +387,12 @@ public: uint crWin : 1; uint internal_context : 1; uint version_flags_cached : 1; + uint extension_flags_cached : 1; QPaintDevice *paintDevice; QColor transpColor; QGLContext *q_ptr; QGLFormat::OpenGLVersionFlags version_flags; + QGLExtensions::Extensions extension_flags; QGLContextGroup *group; GLint max_texture_size; @@ -375,41 +431,8 @@ Q_SIGNALS: void aboutToDestroyContext(const QGLContext *context); }; -// GL extension definitions -class QGLExtensions { -public: - enum Extension { - TextureRectangle = 0x00000001, - SampleBuffers = 0x00000002, - GenerateMipmap = 0x00000004, - TextureCompression = 0x00000008, - FragmentProgram = 0x00000010, - MirroredRepeat = 0x00000020, - FramebufferObject = 0x00000040, - StencilTwoSide = 0x00000080, - StencilWrap = 0x00000100, - PackedDepthStencil = 0x00000200, - NVFloatBuffer = 0x00000400, - PixelBufferObject = 0x00000800, - FramebufferBlit = 0x00001000, - NPOTTextures = 0x00002000, - BGRATextureFormat = 0x00004000, - DDSTextureCompression = 0x00008000, - ETC1TextureCompression = 0x00010000, - PVRTCTextureCompression = 0x00020000, - FragmentShader = 0x00040000 - }; - Q_DECLARE_FLAGS(Extensions, Extension) - - static Extensions glExtensions; - static bool nvidiaFboNeedsFinish; - static void init(); // sys dependent - static void init_extensions(); // general: called by init() -}; - Q_DECLARE_OPERATORS_FOR_FLAGS(QGLExtensions::Extensions) - // Temporarily make a context current if not already current or // shared with the current contex. The previous context is made // current when the object goes out of scope. @@ -533,7 +556,7 @@ bool qt_gl_preferGL2Engine(); inline GLenum qt_gl_preferredTextureFormat() { - return (QGLExtensions::glExtensions & QGLExtensions::BGRATextureFormat) && QSysInfo::ByteOrder == QSysInfo::LittleEndian + return (QGLExtensions::glExtensions() & QGLExtensions::BGRATextureFormat) && QSysInfo::ByteOrder == QSysInfo::LittleEndian ? GL_BGRA : GL_RGBA; } @@ -542,7 +565,7 @@ inline GLenum qt_gl_preferredTextureTarget() #if defined(QT_OPENGL_ES_2) return GL_TEXTURE_2D; #else - return (QGLExtensions::glExtensions & QGLExtensions::TextureRectangle) + return (QGLExtensions::glExtensions() & QGLExtensions::TextureRectangle) && !qt_gl_preferGL2Engine() ? GL_TEXTURE_RECTANGLE_NV : GL_TEXTURE_2D; @@ -614,7 +637,7 @@ private: }; -// This class can be used to match GL extensions with doing any mallocs. The +// This class can be used to match GL extensions without doing any mallocs. The // class assumes that the GL extension string ends with a space character, // which it should do on all conformant platforms. Create the object and pass // in a pointer to the extension string, then call match() on each extension diff --git a/src/opengl/qgl_qws.cpp b/src/opengl/qgl_qws.cpp index f69ad7b..d4adc8b 100644 --- a/src/opengl/qgl_qws.cpp +++ b/src/opengl/qgl_qws.cpp @@ -83,6 +83,28 @@ static QGLScreen *glScreenForDevice(QPaintDevice *device) return 0; } +/* + QGLTemporaryContext implementation +*/ + +class QGLTemporaryContextPrivate +{ +public: + QGLWidget *widget; +}; + +QGLTemporaryContext::QGLTemporaryContext(bool, QWidget *) + : d(new QGLTemporaryContextPrivate) +{ + d->widget = new QGLWidget; + d->widget->makeCurrent(); +} + +QGLTemporaryContext::~QGLTemporaryContext() +{ + delete d->widget; +} + /***************************************************************************** QOpenGL debug facilities *****************************************************************************/ @@ -311,36 +333,4 @@ void QGLWidget::setColormap(const QGLColormap &) { } -void QGLExtensions::init() -{ - static bool init_done = false; - - if (init_done) - return; - init_done = true; - - // We need a context current to initialize the extensions, - // but getting a valid EGLNativeWindowType this early can be - // problematic under QWS. So use a pbuffer instead. - // - // Unfortunately OpenGL/ES 2.0 systems don't normally - // support pbuffers, so we have no choice but to try - // our luck with a window on those systems. -#if defined(QT_OPENGL_ES_2) - QGLWidget tmpWidget; - tmpWidget.makeCurrent(); - - init_extensions(); - - tmpWidget.doneCurrent(); -#else - QGLPixelBuffer pbuffer(16, 16); - pbuffer.makeCurrent(); - - init_extensions(); - - pbuffer.doneCurrent(); -#endif -} - QT_END_NAMESPACE diff --git a/src/opengl/qgl_win.cpp b/src/opengl/qgl_win.cpp index 443fbf2..ed4814f 100644 --- a/src/opengl/qgl_win.cpp +++ b/src/opengl/qgl_win.cpp @@ -551,7 +551,7 @@ QGLFormat pfiToQGLFormat(HDC hdc, int pfi) QVarLengthArray iAttributes(40); QVarLengthArray iValues(40); int i = 0; - bool has_sample_buffers = QGLExtensions::glExtensions & QGLExtensions::SampleBuffers; + bool has_sample_buffers = QGLExtensions::glExtensions() & QGLExtensions::SampleBuffers; iAttributes[i++] = WGL_DOUBLE_BUFFER_ARB; // 0 iAttributes[i++] = WGL_DEPTH_BITS_ARB; // 1 @@ -628,52 +628,14 @@ QGLFormat pfiToQGLFormat(HDC hdc, int pfi) /* - Creates a temporary GL context and makes it current - - cleans up when the object is destructed. + QGLTemporaryContext implementation */ Q_GUI_EXPORT const QString qt_getRegisteredWndClass(); -class QGLTempContext +class QGLTemporaryContextPrivate { public: - QGLTempContext(bool directRendering, QWidget *parent = 0) - { - QString windowClassName = qt_getRegisteredWndClass(); - if (parent && !parent->internalWinId()) - parent = parent->nativeParentWidget(); - - dmy_id = CreateWindow((const wchar_t *)windowClassName.utf16(), - 0, 0, 0, 0, 1, 1, - parent ? parent->winId() : 0, 0, qWinAppInst(), 0); - - dmy_pdc = GetDC(dmy_id); - PIXELFORMATDESCRIPTOR dmy_pfd; - memset(&dmy_pfd, 0, sizeof(PIXELFORMATDESCRIPTOR)); - dmy_pfd.nSize = sizeof(PIXELFORMATDESCRIPTOR); - dmy_pfd.nVersion = 1; - dmy_pfd.dwFlags = PFD_SUPPORT_OPENGL | PFD_DRAW_TO_WINDOW; - dmy_pfd.iPixelType = PFD_TYPE_RGBA; - if (!directRendering) - dmy_pfd.dwFlags |= PFD_GENERIC_FORMAT; - - int dmy_pf = ChoosePixelFormat(dmy_pdc, &dmy_pfd); - SetPixelFormat(dmy_pdc, dmy_pf, &dmy_pfd); - dmy_rc = wglCreateContext(dmy_pdc); - old_dc = wglGetCurrentDC(); - old_context = wglGetCurrentContext(); - wglMakeCurrent(dmy_pdc, dmy_rc); - } - - ~QGLTempContext() { - wglMakeCurrent(dmy_pdc, 0); - wglDeleteContext(dmy_rc); - ReleaseDC(dmy_id, dmy_pdc); - DestroyWindow(dmy_id); - if (old_dc && old_context) - wglMakeCurrent(old_dc, old_context); - } - HDC dmy_pdc; HGLRC dmy_rc; HDC old_dc; @@ -681,6 +643,45 @@ public: WId dmy_id; }; +QGLTemporaryContext::QGLTemporaryContext(bool directRendering, QWidget *parent) + : d(new QGLTemporaryContextPrivate) +{ + QString windowClassName = qt_getRegisteredWndClass(); + if (parent && !parent->internalWinId()) + parent = parent->nativeParentWidget(); + + d->dmy_id = CreateWindow((const wchar_t *)windowClassName.utf16(), + 0, 0, 0, 0, 1, 1, + parent ? parent->winId() : 0, 0, qWinAppInst(), 0); + + d->dmy_pdc = GetDC(d->dmy_id); + PIXELFORMATDESCRIPTOR dmy_pfd; + memset(&dmy_pfd, 0, sizeof(PIXELFORMATDESCRIPTOR)); + dmy_pfd.nSize = sizeof(PIXELFORMATDESCRIPTOR); + dmy_pfd.nVersion = 1; + dmy_pfd.dwFlags = PFD_SUPPORT_OPENGL | PFD_DRAW_TO_WINDOW; + dmy_pfd.iPixelType = PFD_TYPE_RGBA; + if (!directRendering) + dmy_pfd.dwFlags |= PFD_GENERIC_FORMAT; + + int dmy_pf = ChoosePixelFormat(d->dmy_pdc, &dmy_pfd); + SetPixelFormat(d->dmy_pdc, dmy_pf, &dmy_pfd); + d->dmy_rc = wglCreateContext(d->dmy_pdc); + d->old_dc = wglGetCurrentDC(); + d->old_context = wglGetCurrentContext(); + wglMakeCurrent(d->dmy_pdc, d->dmy_rc); +} + +QGLTemporaryContext::~QGLTemporaryContext() +{ + wglMakeCurrent(d->dmy_pdc, 0); + wglDeleteContext(d->dmy_rc); + ReleaseDC(d->dmy_id, d->dmy_pdc); + DestroyWindow(d->dmy_id); + if (d->old_dc && d->old_context) + wglMakeCurrent(d->old_dc, d->old_context); +} + bool QGLContext::chooseContext(const QGLContext* shareContext) { Q_D(QGLContext); @@ -721,10 +722,10 @@ bool QGLContext::chooseContext(const QGLContext* shareContext) myDc = GetDC(d->win); } - // NB! the QGLTempContext object is needed for the + // NB! the QGLTemporaryContext object is needed for the // wglGetProcAddress() calls to succeed and are absolutely // necessary - don't remove! - QGLTempContext tmp_ctx(d->glFormat.directRendering(), widget); + QGLTemporaryContext tmp_ctx(d->glFormat.directRendering(), widget); if (!myDc) { qWarning("QGLContext::chooseContext(): Paint device cannot be null"); @@ -965,7 +966,7 @@ int QGLContext::choosePixelFormat(void* dummyPfd, HDC pdc) iAttributes[i++] = 1; } int si = 0; - bool trySampleBuffers = QGLExtensions::glExtensions & QGLExtensions::SampleBuffers; + bool trySampleBuffers = QGLExtensions::glExtensions() & QGLExtensions::SampleBuffers; if (trySampleBuffers && d->glFormat.sampleBuffers()) { iAttributes[i++] = WGL_SAMPLE_BUFFERS_ARB; iAttributes[i++] = TRUE; @@ -1471,15 +1472,4 @@ void QGLWidget::setColormap(const QGLColormap & c) } } -void QGLExtensions::init() -{ - static bool init_done = false; - - if (init_done) - return; - init_done = true; - QGLTempContext temp_ctx(QGLFormat::defaultFormat().directRendering()); - init_extensions(); -} - QT_END_NAMESPACE diff --git a/src/opengl/qgl_wince.cpp b/src/opengl/qgl_wince.cpp index 460f10d..00a125a 100644 --- a/src/opengl/qgl_wince.cpp +++ b/src/opengl/qgl_wince.cpp @@ -95,8 +95,27 @@ public: #include +/* + QGLTemporaryContext implementation +*/ +class QGLTemporaryContextPrivate +{ +public: + QGLWidget *widget; +}; +QGLTemporaryContext::QGLTemporaryContext(bool, QWidget *) + : d(new QGLTemporaryContextPrivate) +{ + d->widget = new QGLWidget; + d->widget->makeCurrent(); +} + +QGLTemporaryContext::~QGLTemporaryContext() +{ + delete d->widget; +} /***************************************************************************** QGLFormat Win32/WGL-specific code @@ -627,21 +646,4 @@ void QGLWidget::setColormap(const QGLColormap & c) } } -void QGLExtensions::init() -{ - static bool init_done = false; - - if (init_done) - return; - init_done = true; - - // We need a context current to initialize the extensions. - QGLWidget tmpWidget; - tmpWidget.makeCurrent(); - - init_extensions(); - - tmpWidget.doneCurrent(); -} - QT_END_NAMESPACE diff --git a/src/opengl/qgl_x11.cpp b/src/opengl/qgl_x11.cpp index e883ddc..f4cc7c7 100644 --- a/src/opengl/qgl_x11.cpp +++ b/src/opengl/qgl_x11.cpp @@ -549,7 +549,7 @@ void *QGLContext::chooseVisual() bool triedDouble = false; bool triedSample = false; if (fmt.sampleBuffers()) - fmt.setSampleBuffers(QGLExtensions::glExtensions & QGLExtensions::SampleBuffers); + fmt.setSampleBuffers(QGLExtensions::glExtensions() & QGLExtensions::SampleBuffers); while(!fail && !(vis = tryVisual(fmt, bufDepths[i]))) { if (!fmt.rgba() && bufDepths[i] > 1) { i++; @@ -1132,71 +1132,70 @@ void *QGLContext::getProcAddress(const QString &proc) const return glXGetProcAddressARB(reinterpret_cast(proc.toLatin1().data())); } -// -// This class is used to create a temporary, minimal GL context, which is used -// to retrive GL version and extension info. It's significantly faster to -// construct than a QGLWidget, and it doesn't have the recursive creation -// problem that QGLWidget would have. E.g. creating a temporary QGLWidget to -// retrieve GL info as part of the QGLWidget initialization. -// -class QGLTempContext -{ +/* + QGLTemporaryContext implementation +*/ + +class QGLTemporaryContextPrivate { public: - QGLTempContext(int screen = 0) : - initialized(false), - old_drawable(0), - old_context(0) - { - int attribs[] = {GLX_RGBA, XNone}; - XVisualInfo *vi = glXChooseVisual(X11->display, screen, attribs); - if (!vi) { - qWarning("QGLTempContext: No GL capable X visuals available."); - return; - } + bool initialized; + Window drawable; + GLXContext context; + GLXDrawable oldDrawable; + GLXContext oldContext; +}; - int useGL; - glXGetConfig(X11->display, vi, GLX_USE_GL, &useGL); - if (!useGL) { - XFree(vi); - return; - } +QGLTemporaryContext::QGLTemporaryContext(bool, QWidget *) + : d(new QGLTemporaryContextPrivate) +{ + d->initialized = false; + d->oldDrawable = 0; + d->oldContext = 0; + int screen = 0; + + int attribs[] = {GLX_RGBA, XNone}; + XVisualInfo *vi = glXChooseVisual(X11->display, screen, attribs); + if (!vi) { + qWarning("QGLTempContext: No GL capable X visuals available."); + return; + } - old_drawable = glXGetCurrentDrawable(); - old_context = glXGetCurrentContext(); - - XSetWindowAttributes a; - a.colormap = qt_gl_choose_cmap(X11->display, vi); - drawable = XCreateWindow(X11->display, RootWindow(X11->display, screen), - 0, 0, 1, 1, 0, - vi->depth, InputOutput, vi->visual, - CWColormap, &a); - context = glXCreateContext(X11->display, vi, 0, True); - if (context && glXMakeCurrent(X11->display, drawable, context)) { - initialized = true; - } else { - qWarning("QGLTempContext: Unable to create GL context."); - XDestroyWindow(X11->display, drawable); - } + int useGL; + glXGetConfig(X11->display, vi, GLX_USE_GL, &useGL); + if (!useGL) { XFree(vi); + return; } - ~QGLTempContext() { - if (initialized) { - glXMakeCurrent(X11->display, 0, 0); - glXDestroyContext(X11->display, context); - XDestroyWindow(X11->display, drawable); - } - if (old_drawable && old_context) - glXMakeCurrent(X11->display, old_drawable, old_context); + d->oldDrawable = glXGetCurrentDrawable(); + d->oldContext = glXGetCurrentContext(); + + XSetWindowAttributes a; + a.colormap = qt_gl_choose_cmap(X11->display, vi); + d->drawable = XCreateWindow(X11->display, RootWindow(X11->display, screen), + 0, 0, 1, 1, 0, + vi->depth, InputOutput, vi->visual, + CWColormap, &a); + d->context = glXCreateContext(X11->display, vi, 0, True); + if (d->context && glXMakeCurrent(X11->display, d->drawable, d->context)) { + d->initialized = true; + } else { + qWarning("QGLTempContext: Unable to create GL context."); + XDestroyWindow(X11->display, d->drawable); } + XFree(vi); +} -private: - bool initialized; - Window drawable; - GLXContext context; - GLXDrawable old_drawable; - GLXContext old_context; -}; +QGLTemporaryContext::~QGLTemporaryContext() +{ + if (d->initialized) { + glXMakeCurrent(X11->display, 0, 0); + glXDestroyContext(X11->display, d->context); + XDestroyWindow(X11->display, d->drawable); + } + if (d->oldDrawable && d->oldContext) + glXMakeCurrent(X11->display, d->oldDrawable, d->oldContext); +} /***************************************************************************** QGLOverlayWidget (Internal overlay class for X11) @@ -1632,27 +1631,6 @@ void QGLWidget::setColormap(const QGLColormap & c) delete [] cmw; } -void QGLExtensions::init() -{ - static bool init_done = false; - - if (init_done) - return; - init_done = true; - - QGLTempContext context; - init_extensions(); - - // nvidia 9x.xx unix drivers contain a bug which requires us to call glFinish before releasing an fbo - // to avoid painting artifacts - const QByteArray versionString(reinterpret_cast(glGetString(GL_VERSION))); - const int pos = versionString.indexOf("NVIDIA"); - if (pos >= 0) { - const float nvidiaDriverVersion = versionString.mid(pos + strlen("NVIDIA")).toFloat(); - nvidiaFboNeedsFinish = nvidiaDriverVersion >= 90.0 && nvidiaDriverVersion < 100.0; - } -} - // Solaris defines glXBindTexImageEXT as part of the GL library #if defined(GLX_VERSION_1_3) && !defined(Q_OS_HPUX) typedef void (*qt_glXBindTexImageEXT)(Display*, GLXDrawable, int, const int*); @@ -1668,7 +1646,7 @@ static bool qt_resolveTextureFromPixmap(QPaintDevice *paintDevice) resolvedTextureFromPixmap = true; // Check to see if we have NPOT texture support - if ( !(QGLExtensions::glExtensions & QGLExtensions::NPOTTextures) && + if ( !(QGLExtensions::glExtensions() & QGLExtensions::NPOTTextures) && !(QGLFormat::openGLVersionFlags() & QGLFormat::OpenGL_Version_2_0)) { return false; // Can't use TFP without NPOT diff --git a/src/opengl/qgl_x11egl.cpp b/src/opengl/qgl_x11egl.cpp index 85daf95..572834b 100644 --- a/src/opengl/qgl_x11egl.cpp +++ b/src/opengl/qgl_x11egl.cpp @@ -55,112 +55,115 @@ QT_BEGIN_NAMESPACE bool qt_egl_setup_x11_visual(XVisualInfo &vi, EGLDisplay display, EGLConfig config, const QX11Info &x11Info, bool useArgbVisual); -// -// QGLTempContext is a class for creating a temporary GL context -// (which is needed during QGLWidget initialization to retrieve GL -// extension info). Faster to construct than a full QGLWidget. -// -class QGLTempContext + +/* + QGLTemporaryContext implementation +*/ + +class QGLTemporaryContextPrivate { public: - QGLTempContext(int screen = 0) : - initialized(false), - window(0), - context(0), - surface(0) - { - display = eglGetDisplay(EGLNativeDisplayType(X11->display)); + bool initialized; + Window window; + EGLContext context; + EGLSurface surface; + EGLDisplay display; +}; - if (!eglInitialize(display, NULL, NULL)) { - qWarning("QGLTempContext: Unable to initialize EGL display."); - return; - } +QGLTemporaryContext::QGLTemporaryContext(bool, QWidget *) + : d(new QGLTemporaryContextPrivate) +{ + d->initialized = false; + d->window = 0; + d->context = 0; + d->surface = 0; + int screen = 0; + + d->display = eglGetDisplay(EGLNativeDisplayType(X11->display)); - EGLConfig config; - int numConfigs = 0; - EGLint attribs[] = { - EGL_SURFACE_TYPE, EGL_WINDOW_BIT, + if (!eglInitialize(d->display, NULL, NULL)) { + qWarning("QGLTemporaryContext: Unable to initialize EGL display."); + return; + } + + EGLConfig config; + int numConfigs = 0; + EGLint attribs[] = { + EGL_SURFACE_TYPE, EGL_WINDOW_BIT, #ifdef QT_OPENGL_ES_2 - EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT, + EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT, #endif - EGL_NONE - }; + EGL_NONE + }; - eglChooseConfig(display, attribs, &config, 1, &numConfigs); - if (!numConfigs) { - qWarning("QGLTempContext: No EGL configurations available."); - return; - } + eglChooseConfig(d->display, attribs, &config, 1, &numConfigs); + if (!numConfigs) { + qWarning("QGLTemporaryContext: No EGL configurations available."); + return; + } - XVisualInfo visualInfo; - XVisualInfo *vi; - int numVisuals; - EGLint id = 0; - - eglGetConfigAttrib(display, config, EGL_NATIVE_VISUAL_ID, &id); - if (id == 0) { - // EGL_NATIVE_VISUAL_ID is optional and might not be supported - // on some implementations - we'll have to do it the hard way - QX11Info xinfo; - qt_egl_setup_x11_visual(visualInfo, display, config, xinfo, false); - } else { - visualInfo.visualid = id; - } - vi = XGetVisualInfo(X11->display, VisualIDMask, &visualInfo, &numVisuals); - if (!vi || numVisuals < 1) { - qWarning("QGLTempContext: Unable to get X11 visual info id."); - return; - } + XVisualInfo visualInfo; + XVisualInfo *vi; + int numVisuals; + EGLint id = 0; + + eglGetConfigAttrib(d->display, config, EGL_NATIVE_VISUAL_ID, &id); + if (id == 0) { + // EGL_NATIVE_VISUAL_ID is optional and might not be supported + // on some implementations - we'll have to do it the hard way + QX11Info xinfo; + qt_egl_setup_x11_visual(visualInfo, d->display, config, xinfo, false); + } else { + visualInfo.visualid = id; + } + vi = XGetVisualInfo(X11->display, VisualIDMask, &visualInfo, &numVisuals); + if (!vi || numVisuals < 1) { + qWarning("QGLTemporaryContext: Unable to get X11 visual info id."); + return; + } - window = XCreateWindow(X11->display, RootWindow(X11->display, screen), - 0, 0, 1, 1, 0, - vi->depth, InputOutput, vi->visual, - 0, 0); + d->window = XCreateWindow(X11->display, RootWindow(X11->display, screen), + 0, 0, 1, 1, 0, + vi->depth, InputOutput, vi->visual, + 0, 0); - surface = eglCreateWindowSurface(display, config, (EGLNativeWindowType) window, NULL); + d->surface = eglCreateWindowSurface(d->display, config, (EGLNativeWindowType) d->window, NULL); - if (surface == EGL_NO_SURFACE) { - qWarning("QGLTempContext: Error creating EGL surface."); - XFree(vi); - XDestroyWindow(X11->display, window); - return; - } + if (d->surface == EGL_NO_SURFACE) { + qWarning("QGLTemporaryContext: Error creating EGL surface."); + XFree(vi); + XDestroyWindow(X11->display, d->window); + return; + } - EGLint contextAttribs[] = { + EGLint contextAttribs[] = { #ifdef QT_OPENGL_ES_2 - EGL_CONTEXT_CLIENT_VERSION, 2, + EGL_CONTEXT_CLIENT_VERSION, 2, #endif - EGL_NONE - }; - context = eglCreateContext(display, config, 0, contextAttribs); - if (context != EGL_NO_CONTEXT - && eglMakeCurrent(display, surface, surface, context)) - { - initialized = true; - } else { - qWarning("QGLTempContext: Error creating EGL context."); - eglDestroySurface(display, surface); - XDestroyWindow(X11->display, window); - } - XFree(vi); + EGL_NONE + }; + d->context = eglCreateContext(d->display, config, 0, contextAttribs); + if (d->context != EGL_NO_CONTEXT + && eglMakeCurrent(d->display, d->surface, d->surface, d->context)) + { + d->initialized = true; + } else { + qWarning("QGLTemporaryContext: Error creating EGL context."); + eglDestroySurface(d->display, d->surface); + XDestroyWindow(X11->display, d->window); } + XFree(vi); +} - ~QGLTempContext() { - if (initialized) { - eglMakeCurrent(display, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT); - eglDestroyContext(display, context); - eglDestroySurface(display, surface); - XDestroyWindow(X11->display, window); - } +QGLTemporaryContext::~QGLTemporaryContext() +{ + if (d->initialized) { + eglMakeCurrent(d->display, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT); + eglDestroyContext(d->display, d->context); + eglDestroySurface(d->display, d->surface); + XDestroyWindow(X11->display, d->window); } - -private: - bool initialized; - Window window; - EGLContext context; - EGLSurface surface; - EGLDisplay display; -}; +} bool QGLFormat::hasOpenGLOverlays() { @@ -547,19 +550,6 @@ void QGLWidget::setColormap(const QGLColormap &) { } -void QGLExtensions::init() -{ - static bool init_done = false; - - if (init_done) - return; - init_done = true; - - // We need a context current to initialize the extensions. - QGLTempContext context; - init_extensions(); -} - // Re-creates the EGL surface if the window ID has changed or if force is true void QGLWidgetPrivate::recreateEglSurface(bool force) { diff --git a/src/opengl/qglframebufferobject.cpp b/src/opengl/qglframebufferobject.cpp index ed21923..ce80796 100644 --- a/src/opengl/qglframebufferobject.cpp +++ b/src/opengl/qglframebufferobject.cpp @@ -396,7 +396,7 @@ void QGLFramebufferObjectPrivate::init(QGLFramebufferObject *q, const QSize &sz, QGLContext *ctx = const_cast(QGLContext::currentContext()); fbo_guard.setContext(ctx); - bool ext_detected = (QGLExtensions::glExtensions & QGLExtensions::FramebufferObject); + bool ext_detected = (QGLExtensions::glExtensions() & QGLExtensions::FramebufferObject); if (!ext_detected || (ext_detected && !qt_resolve_framebufferobject_extensions(ctx))) return; @@ -466,7 +466,7 @@ void QGLFramebufferObjectPrivate::init(QGLFramebufferObject *q, const QSize &sz, } if (attachment == QGLFramebufferObject::CombinedDepthStencil - && (QGLExtensions::glExtensions & QGLExtensions::PackedDepthStencil)) { + && (QGLExtensions::glExtensions() & QGLExtensions::PackedDepthStencil)) { // depth and stencil buffer needs another extension glGenRenderbuffers(1, &depth_stencil_buffer); Q_ASSERT(!glIsRenderbuffer(depth_stencil_buffer)); @@ -1028,8 +1028,7 @@ QPaintEngine *QGLFramebufferObject::paintEngine() const */ bool QGLFramebufferObject::hasOpenGLFramebufferObjects() { - QGLExtensions::init(); - return (QGLExtensions::glExtensions & QGLExtensions::FramebufferObject); + return (QGLExtensions::glExtensions() & QGLExtensions::FramebufferObject); } /*! @@ -1188,8 +1187,7 @@ bool QGLFramebufferObject::isBound() const */ bool QGLFramebufferObject::hasOpenGLFramebufferBlit() { - QGLExtensions::init(); - return (QGLExtensions::glExtensions & QGLExtensions::FramebufferBlit); + return (QGLExtensions::glExtensions() & QGLExtensions::FramebufferBlit); } /*! @@ -1229,7 +1227,7 @@ void QGLFramebufferObject::blitFramebuffer(QGLFramebufferObject *target, const Q GLbitfield buffers, GLenum filter) { - if (!(QGLExtensions::glExtensions & QGLExtensions::FramebufferBlit)) + if (!(QGLExtensions::glExtensions() & QGLExtensions::FramebufferBlit)) return; const QGLContext *ctx = QGLContext::currentContext(); diff --git a/src/opengl/qglpixelbuffer_mac.mm b/src/opengl/qglpixelbuffer_mac.mm index 49c1845..6731dd8 100644 --- a/src/opengl/qglpixelbuffer_mac.mm +++ b/src/opengl/qglpixelbuffer_mac.mm @@ -92,7 +92,7 @@ bool QGLPixelBufferPrivate::init(const QSize &size, const QGLFormat &f, QGLWidge GLenum target = GL_TEXTURE_2D; - if ((QGLExtensions::glExtensions & QGLExtensions::TextureRectangle) + if ((QGLExtensions::glExtensions() & QGLExtensions::TextureRectangle) && (size.width() != nearest_gl_texture_size(size.width()) || size.height() != nearest_gl_texture_size(size.height()))) { @@ -223,7 +223,7 @@ bool QGLPixelBufferPrivate::init(const QSize &size, const QGLFormat &f, QGLWidge GLenum target = GL_TEXTURE_2D; - if ((QGLExtensions::glExtensions & QGLExtensions::TextureRectangle) + if ((QGLExtensions::glExtensions() & QGLExtensions::TextureRectangle) && (size.width() != nearest_gl_texture_size(size.width()) || size.height() != nearest_gl_texture_size(size.height()))) { diff --git a/src/opengl/qglpixelbuffer_p.h b/src/opengl/qglpixelbuffer_p.h index f40b7c5..c85dc5a 100644 --- a/src/opengl/qglpixelbuffer_p.h +++ b/src/opengl/qglpixelbuffer_p.h @@ -154,7 +154,6 @@ class QGLPixelBufferPrivate { public: QGLPixelBufferPrivate(QGLPixelBuffer *q) : q_ptr(q), invalid(true), qctx(0), pbuf(0), ctx(0) { - QGLExtensions::init(); #ifdef Q_WS_WIN dc = 0; #elif defined(Q_WS_MACX) diff --git a/src/opengl/qglpixelbuffer_win.cpp b/src/opengl/qglpixelbuffer_win.cpp index a986ccf..8d0d105 100644 --- a/src/opengl/qglpixelbuffer_win.cpp +++ b/src/opengl/qglpixelbuffer_win.cpp @@ -221,7 +221,7 @@ static void qt_format_to_attrib_list(bool has_render_texture, const QGLFormat &f } if ((f.redBufferSize() > 8 || f.greenBufferSize() > 8 || f.blueBufferSize() > 8 || f.alphaBufferSize() > 8) - && (QGLExtensions::glExtensions & QGLExtensions::NVFloatBuffer)) + && (QGLExtensions::glExtensions() & QGLExtensions::NVFloatBuffer)) { attribs[i++] = WGL_FLOAT_COMPONENTS_NV; attribs[i++] = TRUE; @@ -368,11 +368,9 @@ void QGLPixelBuffer::releaseFromDynamicTexture() bool QGLPixelBuffer::hasOpenGLPbuffers() { bool ret = false; - QGLWidget *dmy = 0; - if (!QGLContext::currentContext()) { - dmy = new QGLWidget; - dmy->makeCurrent(); - } + QGLTemporaryContext *tmpContext = 0; + if (!QGLContext::currentContext()) + tmpContext = new QGLTemporaryContext; PFNWGLGETEXTENSIONSSTRINGARBPROC wglGetExtensionsStringARB = (PFNWGLGETEXTENSIONSSTRINGARBPROC) wglGetProcAddress("wglGetExtensionsStringARB"); if (wglGetExtensionsStringARB) { @@ -382,8 +380,8 @@ bool QGLPixelBuffer::hasOpenGLPbuffers() ret = true; } } - if (dmy) - delete dmy; + if (tmpContext) + delete tmpContext; return ret; } diff --git a/src/opengl/qpaintengine_opengl.cpp b/src/opengl/qpaintengine_opengl.cpp index c823187..57918d0 100644 --- a/src/opengl/qpaintengine_opengl.cpp +++ b/src/opengl/qpaintengine_opengl.cpp @@ -108,6 +108,10 @@ static bool DEBUG_TEMP_FLAG; #define DEBUG_ONCE_STR(str) DEBUG_ONCE qDebug() << (str); #endif +#ifdef Q_WS_X11 +static bool qt_nvidiaFboNeedsFinish = false; +#endif + static inline void qt_glColor4ubv(unsigned char *col) { glColor4f(col[0]/255.0f, col[1]/255.0f, col[2]/255.0f, col[3]/255.0f); @@ -423,7 +427,7 @@ inline void QGLOffscreen::release() #ifdef Q_WS_X11 // workaround for bug in nvidia driver versions 9x.xx - if (QGLExtensions::nvidiaFboNeedsFinish) + if (qt_nvidiaFboNeedsFinish) glFinish(); #endif @@ -477,7 +481,7 @@ inline QGLContext *QGLOffscreen::context() const bool QGLOffscreen::isSupported() { - return (QGLExtensions::glExtensions & QGLExtensions::FramebufferObject); // for fbo + return (QGLExtensions::glExtensions() & QGLExtensions::FramebufferObject); // for fbo } struct QDrawQueueItem @@ -1266,7 +1270,7 @@ bool QOpenGLPaintEngine::begin(QPaintDevice *pdev) for (int j = 0; j < 4; ++j) d->mv_matrix[i][j] = (i == j ? qreal(1) : qreal(0)); - bool has_frag_program = (QGLExtensions::glExtensions & QGLExtensions::FragmentProgram) + bool has_frag_program = (QGLExtensions::glExtensions() & QGLExtensions::FragmentProgram) && (pdev->devType() != QInternal::Pixmap); QGLContext *ctx = const_cast(d->device->context()); @@ -1279,11 +1283,27 @@ bool QOpenGLPaintEngine::begin(QPaintDevice *pdev) has_frag_program = qt_resolve_frag_program_extensions(ctx) && qt_resolve_version_1_3_functions(ctx); d->use_stencil_method = d->device->format().stencil() - && (QGLExtensions::glExtensions & QGLExtensions::StencilWrap); + && (QGLExtensions::glExtensions() & QGLExtensions::StencilWrap); if (d->device->format().directRendering() - && (d->use_stencil_method && QGLExtensions::glExtensions & QGLExtensions::StencilTwoSide)) + && (d->use_stencil_method && QGLExtensions::glExtensions() & QGLExtensions::StencilTwoSide)) d->has_stencil_face_ext = qt_resolve_stencil_face_extension(ctx); +#ifdef Q_WS_X11 + static bool nvidia_workaround_needs_init = true; + if (nvidia_workaround_needs_init) { + // nvidia 9x.xx unix drivers contain a bug which requires us to + // call glFinish before releasing an fbo to avoid painting + // artifacts + const QByteArray versionString(reinterpret_cast(glGetString(GL_VERSION))); + const int pos = versionString.indexOf("NVIDIA"); + if (pos >= 0) { + const float nvidiaDriverVersion = versionString.mid(pos + strlen("NVIDIA")).toFloat(); + qt_nvidiaFboNeedsFinish = nvidiaDriverVersion >= 90.0 && nvidiaDriverVersion < 100.0; + } + nvidia_workaround_needs_init = false; + } +#endif + #ifndef QT_OPENGL_ES if (!ctx->d_ptr->internal_context) { glGetDoublev(GL_PROJECTION_MATRIX, &d->projection_matrix[0][0]); @@ -1333,10 +1353,10 @@ bool QOpenGLPaintEngine::begin(QPaintDevice *pdev) glDisableClientState(GL_TEXTURE_COORD_ARRAY); glDisableClientState(GL_VERTEX_ARRAY); - if (QGLExtensions::glExtensions & QGLExtensions::SampleBuffers) + if (QGLExtensions::glExtensions() & QGLExtensions::SampleBuffers) glDisable(GL_MULTISAMPLE); glDisable(GL_TEXTURE_2D); - if (QGLExtensions::glExtensions & QGLExtensions::TextureRectangle) + if (QGLExtensions::glExtensions() & QGLExtensions::TextureRectangle) glDisable(GL_TEXTURE_RECTANGLE_NV); glDisable(GL_STENCIL_TEST); glDisable(GL_CULL_FACE); @@ -1534,7 +1554,7 @@ void QOpenGLPaintEnginePrivate::updateGradient(const QBrush &brush, const QRectF #ifdef QT_OPENGL_ES Q_UNUSED(brush); #else - bool has_mirrored_repeat = QGLExtensions::glExtensions & QGLExtensions::MirroredRepeat; + bool has_mirrored_repeat = QGLExtensions::glExtensions() & QGLExtensions::MirroredRepeat; Qt::BrushStyle style = brush.style(); QTransform m = brush.transform(); @@ -2098,7 +2118,7 @@ static inline bool needsEmulation(Qt::BrushStyle style) { return !(style == Qt::SolidPattern || (style == Qt::LinearGradientPattern - && (QGLExtensions::glExtensions & QGLExtensions::MirroredRepeat))); + && (QGLExtensions::glExtensions() & QGLExtensions::MirroredRepeat))); } void QOpenGLPaintEnginePrivate::updateUseEmulation() @@ -2420,12 +2440,12 @@ void QOpenGLPaintEngine::updateRenderHints(QPainter::RenderHints hints) d->high_quality_antialiasing = true; } else { d->high_quality_antialiasing = false; - if (QGLExtensions::glExtensions & QGLExtensions::SampleBuffers) + if (QGLExtensions::glExtensions() & QGLExtensions::SampleBuffers) glEnable(GL_MULTISAMPLE); } } else { d->high_quality_antialiasing = false; - if (QGLExtensions::glExtensions & QGLExtensions::SampleBuffers) + if (QGLExtensions::glExtensions() & QGLExtensions::SampleBuffers) glDisable(GL_MULTISAMPLE); } @@ -2435,14 +2455,14 @@ void QOpenGLPaintEngine::updateRenderHints(QPainter::RenderHints hints) if (!d->offscreen.isValid()) { DEBUG_ONCE_STR("Unable to initialize offscreen, disabling high quality antialiasing"); d->high_quality_antialiasing = false; - if (QGLExtensions::glExtensions & QGLExtensions::SampleBuffers) + if (QGLExtensions::glExtensions() & QGLExtensions::SampleBuffers) glEnable(GL_MULTISAMPLE); } } d->has_antialiasing = d->high_quality_antialiasing || ((hints & QPainter::Antialiasing) - && (QGLExtensions::glExtensions & QGLExtensions::SampleBuffers)); + && (QGLExtensions::glExtensions() & QGLExtensions::SampleBuffers)); } diff --git a/src/opengl/qwindowsurface_gl.cpp b/src/opengl/qwindowsurface_gl.cpp index 8ee4361..7a565e6 100644 --- a/src/opengl/qwindowsurface_gl.cpp +++ b/src/opengl/qwindowsurface_gl.cpp @@ -295,7 +295,6 @@ QGLWindowSurface::QGLWindowSurface(QWidget *window) : QWindowSurface(window), d_ptr(new QGLWindowSurfacePrivate) { Q_ASSERT(window->isTopLevel()); - QGLExtensions::init(); d_ptr->pb = 0; d_ptr->fbo = 0; d_ptr->ctx = 0; @@ -520,7 +519,7 @@ void QGLWindowSurface::flush(QWidget *widget, const QRegion &rgn, const QPoint & glDisable(GL_SCISSOR_TEST); - if (d_ptr->fbo && (QGLExtensions::glExtensions & QGLExtensions::FramebufferBlit)) { + if (d_ptr->fbo && (QGLExtensions::glExtensions() & QGLExtensions::FramebufferBlit)) { const int h = d_ptr->fbo->height(); const int sx0 = br.left(); @@ -698,7 +697,7 @@ void QGLWindowSurface::updateGeometry() { } if (d_ptr->destructive_swap_buffers - && (QGLExtensions::glExtensions & QGLExtensions::FramebufferObject) + && (QGLExtensions::glExtensions() & QGLExtensions::FramebufferObject) && (d_ptr->fbo || !d_ptr->tried_fbo) && qt_gl_preferGL2Engine()) { @@ -712,7 +711,7 @@ void QGLWindowSurface::updateGeometry() { format.setInternalTextureFormat(GLenum(GL_RGBA)); format.setTextureTarget(target); - if (QGLExtensions::glExtensions & QGLExtensions::FramebufferBlit) + if (QGLExtensions::glExtensions() & QGLExtensions::FramebufferBlit) format.setSamples(8); d_ptr->fbo = new QGLFramebufferObject(rect.size(), format); -- cgit v0.12 From ae5812ee793999f78f725e10cb8d531cbd51782f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan-Arve=20S=C3=A6ther?= Date: Wed, 13 Jan 2010 15:40:59 +0100 Subject: Replace the truncate function with fuzzierCompare(). truncate did a qRound of the two numbers, which could cause two numbers that were close to become far away (e.g. (0.000049 and 0.000051 would become 0 and 1 respectively) fuzzierCompare allows less precision than qFuzzyCompare. This is because the anchor layout engine can sometimes do quite a lot of calculations, and the error will be larger than what the qFuzzyCompare checks for. Thus, the factor in fuzzierCompare is not chosen due to mathematical proof but rather it is just chosen by what is acceptable. (actually it can still be larger and still be acceptable) --- .../tst_qgraphicsanchorlayout1.cpp | 26 +++++++++++----------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/tests/auto/qgraphicsanchorlayout1/tst_qgraphicsanchorlayout1.cpp b/tests/auto/qgraphicsanchorlayout1/tst_qgraphicsanchorlayout1.cpp index e3d1bbe..7cacd85 100644 --- a/tests/auto/qgraphicsanchorlayout1/tst_qgraphicsanchorlayout1.cpp +++ b/tests/auto/qgraphicsanchorlayout1/tst_qgraphicsanchorlayout1.cpp @@ -1669,16 +1669,16 @@ inline QGraphicsLayoutItem *getItem( return widgets[index]; } -static QRectF truncate(QRectF original) +static bool fuzzierCompare(qreal a, qreal b) { - QRectF result; + return qAbs(a - b) <= qreal(0.0001); +} - result.setX(qRound(original.x() * 1000000) / 1000000.0); - result.setY(qRound(original.y() * 1000000) / 1000000.0); - result.setWidth(qRound(original.width() * 1000000) / 1000000.0); - result.setHeight(qRound(original.height() * 1000000) / 1000000.0); +static bool fuzzierCompare(const QRectF &r1, const QRectF &r2) +{ - return result; + return fuzzierCompare(r1.x(), r2.x()) && fuzzierCompare(r1.y(), r2.y()) + && fuzzierCompare(r1.width(), r2.width()) && fuzzierCompare(r1.height(), r2.height()); } void tst_QGraphicsAnchorLayout1::testBasicLayout() @@ -1727,10 +1727,10 @@ void tst_QGraphicsAnchorLayout1::testBasicLayout() // Validate for (int i = 0; i < result.count(); ++i) { const BasicLayoutTestResult item = result[i]; - QRectF expected = truncate(item.rect); - QRectF actual = truncate(widgets[item.index]->geometry()); + QRectF expected = item.rect; + QRectF actual = widgets[item.index]->geometry(); - QCOMPARE(actual, expected); + QVERIFY(fuzzierCompare(actual, expected)); } // Test mirrored mode @@ -1744,10 +1744,10 @@ void tst_QGraphicsAnchorLayout1::testBasicLayout() if (mirroredRect.isValid()){ mirroredRect.moveLeft(size.width()-item.rect.width()-item.rect.left()); } - QRectF expected = truncate(mirroredRect); - QRectF actual = truncate(widgets[item.index]->geometry()); + QRectF expected = mirroredRect; + QRectF actual = widgets[item.index]->geometry(); - QCOMPARE(actual, expected); + QVERIFY(fuzzierCompare(actual, expected)); } qDeleteAll(widgets); -- cgit v0.12 From 6921f084df93fce24417f6a24764665cebe3da1a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan-Arve=20S=C3=A6ther?= Date: Wed, 13 Jan 2010 16:51:18 +0100 Subject: Disable some tests that require high floating point precision. Disable them if sizeof(qreal)==4 --- .../tst_qgraphicsanchorlayout.cpp | 3 +++ .../tst_qgraphicsanchorlayout1.cpp | 18 +++++++++++++++--- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/tests/auto/qgraphicsanchorlayout/tst_qgraphicsanchorlayout.cpp b/tests/auto/qgraphicsanchorlayout/tst_qgraphicsanchorlayout.cpp index 8c8ab81..16a621a 100644 --- a/tests/auto/qgraphicsanchorlayout/tst_qgraphicsanchorlayout.cpp +++ b/tests/auto/qgraphicsanchorlayout/tst_qgraphicsanchorlayout.cpp @@ -1669,6 +1669,9 @@ void tst_QGraphicsAnchorLayout::floatConflict() void tst_QGraphicsAnchorLayout::infiniteMaxSizes() { + if (sizeof(qreal) <= 4) { + QSKIP("qreal has too little precision, result will be wrong", SkipAll); + } QGraphicsAnchorLayout *l = new QGraphicsAnchorLayout; l->setContentsMargins(0, 0, 0, 0); l->setSpacing(0); diff --git a/tests/auto/qgraphicsanchorlayout1/tst_qgraphicsanchorlayout1.cpp b/tests/auto/qgraphicsanchorlayout1/tst_qgraphicsanchorlayout1.cpp index 7cacd85..7880d2d 100644 --- a/tests/auto/qgraphicsanchorlayout1/tst_qgraphicsanchorlayout1.cpp +++ b/tests/auto/qgraphicsanchorlayout1/tst_qgraphicsanchorlayout1.cpp @@ -1525,7 +1525,11 @@ void tst_QGraphicsAnchorLayout1::testMulti_data() } - QTest::newRow("Linear multi") << QSizeF(width, height) << theData << theResult; + if (sizeof(qreal) == 4) { + qDebug("Linear multi: Skipping! (qreal has too little precision, result will be wrong)"); + } else { + QTest::newRow("Linear multi") << QSizeF(width, height) << theData << theResult; + } } // Multiple widgets, V shape @@ -1595,7 +1599,11 @@ void tst_QGraphicsAnchorLayout1::testMulti_data() } } - QTest::newRow("V multi") << QSizeF(width, height) << theData << theResult; + if (sizeof(qreal) == 4) { + qDebug("V multi: Skipping! (qreal has too little precision, result will be wrong)"); + } else { + QTest::newRow("V multi") << QSizeF(width, height) << theData << theResult; + } } // Multiple widgets, grid @@ -1653,7 +1661,11 @@ void tst_QGraphicsAnchorLayout1::testMulti_data() << BasicResult(i, QRectF(((i%d)+1)*horizontalStep, ((i/d)+1)*verticalStep, horizontalStep, verticalStep) ); } - QTest::newRow("Grid multi") << QSizeF(200, 100) << theData << theResult; + if (sizeof(qreal) == 4) { + qDebug("Grid multi: Skipping! (qreal has too little precision, result will be wrong)"); + } else { + QTest::newRow("Grid multi") << QSizeF(200, 100) << theData << theResult; + } } } -- cgit v0.12 From 3531f4c831407016ef0735d9cdff9b193e4b3f92 Mon Sep 17 00:00:00 2001 From: Thomas Zander Date: Wed, 13 Jan 2010 17:08:55 +0100 Subject: Fix rules for recreating the Makefile in a subdir The code generated would always create the Makefile in the sourcedir, even if you had src!=build Reviewed-By: Thiago --- qmake/generators/makefile.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/qmake/generators/makefile.cpp b/qmake/generators/makefile.cpp index 4a01a89..c1ab60b 100644 --- a/qmake/generators/makefile.cpp +++ b/qmake/generators/makefile.cpp @@ -2411,17 +2411,17 @@ MakefileGenerator::writeSubTargets(QTextStream &t, QListprofile.isEmpty()) { - QString out = out_directory + subtarget->makefile, - in = fileFixify(in_directory + subtarget->profile, in_directory); + QString out = subtarget->makefile; + QString in = fileFixify(in_directory + subtarget->profile, in_directory); if(in.startsWith(in_directory)) in = in.mid(in_directory.length()); if(out.startsWith(in_directory)) out = out.mid(in_directory.length()); t << mkfile << ": " << "\n\t"; if(!in_directory.isEmpty()) { - t << mkdir_p_asstring(in_directory) - << in_directory_cdin - << "$(QMAKE) " << in << buildArgs(in_directory) << " -o " << out + t << mkdir_p_asstring(out_directory) + << out_directory_cdin + << "$(QMAKE) " << subtarget->in_directory << QDir::separator() << in << buildArgs(in_directory) << " -o " << out << in_directory_cdout << endl; } else { t << "$(QMAKE) " << in << buildArgs(in_directory) << " -o " << out << endl; @@ -2431,9 +2431,9 @@ MakefileGenerator::writeSubTargets(QTextStream &t, QListin_directory << QDir::separator() << in << buildArgs(in_directory) << " -o " << out << in_directory_cdout << endl; } else { t << "$(QMAKE) " << in << buildArgs(in_directory) << " -o " << out << endl; -- cgit v0.12 From cf32ca450a80d0a9d0be36d74320de651b83ad63 Mon Sep 17 00:00:00 2001 From: David Boddie Date: Wed, 13 Jan 2010 21:07:42 +0100 Subject: Doc: Describe QStackedWidget::removeWidget() more thoroughly. Reviewed-by: Pierre Rossi --- src/gui/widgets/qstackedwidget.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/gui/widgets/qstackedwidget.cpp b/src/gui/widgets/qstackedwidget.cpp index 396e233..2509a21 100644 --- a/src/gui/widgets/qstackedwidget.cpp +++ b/src/gui/widgets/qstackedwidget.cpp @@ -186,8 +186,11 @@ int QStackedWidget::insertWidget(int index, QWidget *widget) } /*! - Removes the given \a widget from the QStackedWidget. The widget - is \e not deleted. + Removes the given \a widget from the QStackedWidget. + + \bold{Note:} The ownership of \a widget remains the same. + The widget is \e not deleted, but simply removed from the widget's + stacked layout, causing it to be hidden. \sa addWidget(), insertWidget(), currentWidget() */ -- cgit v0.12 From 6c5454b0f8bc75f32af6ceaa7a5730413e9812f9 Mon Sep 17 00:00:00 2001 From: Kurt Korbatits Date: Thu, 14 Jan 2010 11:37:47 +1000 Subject: Revert "Added setChannelCount() to QAudioFormat." This reverts commit f124538ef4840c3d24b4c7e9e7221adb52bdee2c. Conflicts: examples/multimedia/audioinput/audioinput.cpp examples/multimedia/audiooutput/audiooutput.cpp src/multimedia/audio/qaudio_mac.cpp src/multimedia/audio/qaudiodeviceinfo_alsa_p.cpp src/multimedia/audio/qaudiodeviceinfo_mac_p.cpp src/multimedia/audio/qaudiodeviceinfo_win32_p.cpp src/multimedia/audio/qaudioformat.h src/multimedia/audio/qaudioinput.cpp src/multimedia/audio/qaudiooutput.cpp tests/auto/qaudiodeviceinfo/tst_qaudiodeviceinfo.cpp tests/auto/qaudioformat/tst_qaudioformat.cpp tests/auto/qaudioinput/tst_qaudioinput.cpp tests/auto/qaudiooutput/tst_qaudiooutput.cpp --- doc/src/snippets/audio/main.cpp | 2 +- examples/multimedia/audiodevices/audiodevices.cpp | 4 ++-- examples/multimedia/audioinput/audioinput.cpp | 4 ++-- examples/multimedia/audiooutput/audiooutput.cpp | 4 ++-- src/multimedia/audio/qaudio_mac.cpp | 4 ++-- src/multimedia/audio/qaudiodeviceinfo_alsa_p.cpp | 10 +++++----- src/multimedia/audio/qaudiodeviceinfo_mac_p.cpp | 8 ++++---- src/multimedia/audio/qaudiodeviceinfo_win32_p.cpp | 8 ++++---- src/multimedia/audio/qaudioformat.cpp | 9 --------- src/multimedia/audio/qaudioformat.h | 6 ------ src/multimedia/audio/qaudioinput.cpp | 4 ++-- src/multimedia/audio/qaudiooutput.cpp | 4 ++-- tests/auto/qaudiodeviceinfo/tst_qaudiodeviceinfo.cpp | 4 ++-- tests/auto/qaudioformat/tst_qaudioformat.cpp | 20 ++++++++++---------- tests/auto/qaudioinput/tst_qaudioinput.cpp | 4 ++-- tests/auto/qaudiooutput/tst_qaudiooutput.cpp | 4 ++-- 16 files changed, 42 insertions(+), 57 deletions(-) diff --git a/doc/src/snippets/audio/main.cpp b/doc/src/snippets/audio/main.cpp index f000075..6b7a6a5 100644 --- a/doc/src/snippets/audio/main.cpp +++ b/doc/src/snippets/audio/main.cpp @@ -91,7 +91,7 @@ private: QAudioFormat format; format.setSampleRate(44100); //![1] - format.setChannelCount(2); + format.setChannels(2); format.setSampleSize(16); format.setCodec("audio/pcm"); format.setByteOrder(QAudioFormat::LittleEndian); diff --git a/examples/multimedia/audiodevices/audiodevices.cpp b/examples/multimedia/audiodevices/audiodevices.cpp index 6373d57..b0d472c 100644 --- a/examples/multimedia/audiodevices/audiodevices.cpp +++ b/examples/multimedia/audiodevices/audiodevices.cpp @@ -160,7 +160,7 @@ void AudioTest::deviceChanged(int idx) for(int i = 0; i < chz.size(); ++i) channelsBox->addItem(QString("%1").arg(chz.at(i))); if(chz.size()) - settings.setChannelCount(chz.at(0)); + settings.setChannels(chz.at(0)); codecsBox->clear(); QStringList codecz = deviceInfo.supportedCodecs(); @@ -222,7 +222,7 @@ void AudioTest::freqChanged(int idx) void AudioTest::channelChanged(int idx) { - settings.setChannelCount(channelsBox->itemText(idx).toInt()); + settings.setChannels(channelsBox->itemText(idx).toInt()); } void AudioTest::codecChanged(int idx) diff --git a/examples/multimedia/audioinput/audioinput.cpp b/examples/multimedia/audioinput/audioinput.cpp index 86650da..8cc9948 100644 --- a/examples/multimedia/audioinput/audioinput.cpp +++ b/examples/multimedia/audioinput/audioinput.cpp @@ -198,8 +198,8 @@ InputTest::InputTest() pullMode = true; - format.setSampleRate(8000); - format.setChannelCount(1); + format.setFrequency(8000); + format.setChannels(1); format.setSampleSize(16); format.setSampleType(QAudioFormat::SignedInt); format.setByteOrder(QAudioFormat::LittleEndian); diff --git a/examples/multimedia/audiooutput/audiooutput.cpp b/examples/multimedia/audiooutput/audiooutput.cpp index 58dbbaf..0c57f4d 100644 --- a/examples/multimedia/audiooutput/audiooutput.cpp +++ b/examples/multimedia/audiooutput/audiooutput.cpp @@ -164,8 +164,8 @@ AudioTest::AudioTest() gen->start(); - settings.setSampleRate(SYSTEM_FREQ); - settings.setChannelCount(1); + settings.setFrequency(SYSTEM_FREQ); + settings.setChannels(1); settings.setSampleSize(16); settings.setCodec("audio/pcm"); settings.setByteOrder(QAudioFormat::LittleEndian); diff --git a/src/multimedia/audio/qaudio_mac.cpp b/src/multimedia/audio/qaudio_mac.cpp index 61a00ce..f6c4c02 100644 --- a/src/multimedia/audio/qaudio_mac.cpp +++ b/src/multimedia/audio/qaudio_mac.cpp @@ -64,8 +64,8 @@ QAudioFormat toQAudioFormat(AudioStreamBasicDescription const& sf) { QAudioFormat audioFormat; - audioFormat.setSampleRate(sf.mSampleRate); - audioFormat.setChannelCount(sf.mChannelsPerFrame); + audioFormat.setFrequency(sf.mSampleRate); + audioFormat.setChannels(sf.mChannelsPerFrame); audioFormat.setSampleSize(sf.mBitsPerChannel); audioFormat.setCodec(QString::fromLatin1("audio/pcm")); audioFormat.setByteOrder(sf.mFormatFlags & kLinearPCMFormatFlagIsBigEndian != 0 ? QAudioFormat::BigEndian : QAudioFormat::LittleEndian); diff --git a/src/multimedia/audio/qaudiodeviceinfo_alsa_p.cpp b/src/multimedia/audio/qaudiodeviceinfo_alsa_p.cpp index a77a428..ee1b775 100644 --- a/src/multimedia/audio/qaudiodeviceinfo_alsa_p.cpp +++ b/src/multimedia/audio/qaudiodeviceinfo_alsa_p.cpp @@ -78,20 +78,20 @@ QAudioFormat QAudioDeviceInfoInternal::preferredFormat() const { QAudioFormat nearest; if(mode == QAudio::AudioOutput) { - nearest.setSampleRate(44100); - nearest.setChannelCount(2); + nearest.setFrequency(44100); + nearest.setChannels(2); nearest.setByteOrder(QAudioFormat::LittleEndian); nearest.setSampleType(QAudioFormat::SignedInt); nearest.setSampleSize(16); nearest.setCodec(QLatin1String("audio/pcm")); } else { - nearest.setSampleRate(8000); - nearest.setChannelCount(1); + nearest.setFrequency(8000); + nearest.setChannels(1); nearest.setSampleType(QAudioFormat::UnSignedInt); nearest.setSampleSize(8); nearest.setCodec(QLatin1String("audio/pcm")); if(!testSettings(nearest)) { - nearest.setChannelCount(2); + nearest.setChannels(2); nearest.setSampleSize(16); nearest.setSampleType(QAudioFormat::SignedInt); } diff --git a/src/multimedia/audio/qaudiodeviceinfo_mac_p.cpp b/src/multimedia/audio/qaudiodeviceinfo_mac_p.cpp index 9334069..ecd03e5 100644 --- a/src/multimedia/audio/qaudiodeviceinfo_mac_p.cpp +++ b/src/multimedia/audio/qaudiodeviceinfo_mac_p.cpp @@ -144,10 +144,10 @@ QAudioFormat QAudioDeviceInfoInternal::nearestFormat(const QAudioFormat& format) rc.setCodec(QString::fromLatin1("audio/pcm")); - if (rc.sampleRate() != target.sampleRate()) - rc.setSampleRate(target.sampleRate()); - if (rc.channelCount() != target.channelCount()) - rc.setChannelCount(target.channelCount()); + if (rc.frequency() != target.frequency()) + rc.setFrequency(target.frequency()); + if (rc.channels() != target.channels()) + rc.setChannels(target.channels()); if (rc.sampleSize() != target.sampleSize()) rc.setSampleSize(target.sampleSize()); if (rc.byteOrder() != target.byteOrder()) diff --git a/src/multimedia/audio/qaudiodeviceinfo_win32_p.cpp b/src/multimedia/audio/qaudiodeviceinfo_win32_p.cpp index 373e23d..f2423f8 100644 --- a/src/multimedia/audio/qaudiodeviceinfo_win32_p.cpp +++ b/src/multimedia/audio/qaudiodeviceinfo_win32_p.cpp @@ -94,15 +94,15 @@ QAudioFormat QAudioDeviceInfoInternal::preferredFormat() const { QAudioFormat nearest; if(mode == QAudio::AudioOutput) { - nearest.setSampleRate(44100); - nearest.setChannelCount(2); + nearest.setFrequency(44100); + nearest.setChannels(2); nearest.setByteOrder(QAudioFormat::LittleEndian); nearest.setSampleType(QAudioFormat::SignedInt); nearest.setSampleSize(16); nearest.setCodec(QLatin1String("audio/pcm")); } else { - nearest.setSampleRate(11025); - nearest.setChannelCount(1); + nearest.setFrequency(11025); + nearest.setChannels(1); nearest.setByteOrder(QAudioFormat::LittleEndian); nearest.setSampleType(QAudioFormat::SignedInt); nearest.setSampleSize(8); diff --git a/src/multimedia/audio/qaudioformat.cpp b/src/multimedia/audio/qaudioformat.cpp index 58bb571..3b06b9a 100644 --- a/src/multimedia/audio/qaudioformat.cpp +++ b/src/multimedia/audio/qaudioformat.cpp @@ -263,15 +263,6 @@ int QAudioFormat::frequency() const Sets the channel count to \a channels. */ -void QAudioFormat::setChannelCount(int channels) -{ - d->channels = channels; -} - -/*! - \internal -*/ - void QAudioFormat::setChannels(int channels) { d->channels = channels; diff --git a/src/multimedia/audio/qaudioformat.h b/src/multimedia/audio/qaudioformat.h index b255907..cb58d1c 100644 --- a/src/multimedia/audio/qaudioformat.h +++ b/src/multimedia/audio/qaudioformat.h @@ -76,12 +76,6 @@ public: void setFrequency(int frequency); int frequency() const; - void setSampleRate(int samplerate); - int sampleRate() const; - - void setChannelCount(int channels); - int channelCount() const; - void setChannels(int channels); int channels() const; diff --git a/src/multimedia/audio/qaudioinput.cpp b/src/multimedia/audio/qaudioinput.cpp index da39c4a..45cafc1 100644 --- a/src/multimedia/audio/qaudioinput.cpp +++ b/src/multimedia/audio/qaudioinput.cpp @@ -88,8 +88,8 @@ QT_BEGIN_NAMESPACE QAudioFormat format; // set up the format you want, eg. - format.setSampleRate(8000); - format.setChannelCount(1); + format.setFrequency(8000); + format.setChannels(1); format.setSampleSize(8); format.setCodec("audio/pcm"); format.setByteOrder(QAudioFormat::LittleEndian); diff --git a/src/multimedia/audio/qaudiooutput.cpp b/src/multimedia/audio/qaudiooutput.cpp index b61aa4f..afd8a84 100644 --- a/src/multimedia/audio/qaudiooutput.cpp +++ b/src/multimedia/audio/qaudiooutput.cpp @@ -83,8 +83,8 @@ QT_BEGIN_NAMESPACE QAudioFormat format; // Set up the format, eg. - format.setSampleRate(8000); - format.setChannelCount(1); + format.setFrequency(8000); + format.setChannels(1); format.setSampleSize(8); format.setCodec("audio/pcm"); format.setByteOrder(QAudioFormat::LittleEndian); diff --git a/tests/auto/qaudiodeviceinfo/tst_qaudiodeviceinfo.cpp b/tests/auto/qaudiodeviceinfo/tst_qaudiodeviceinfo.cpp index e332e11..0c91d5c 100644 --- a/tests/auto/qaudiodeviceinfo/tst_qaudiodeviceinfo.cpp +++ b/tests/auto/qaudiodeviceinfo/tst_qaudiodeviceinfo.cpp @@ -169,8 +169,8 @@ void tst_QAudioDeviceInfo::isformat() { if(available) { QAudioFormat format; - format.setSampleRate(44100); - format.setChannelCount(2); + format.setFrequency(44100); + format.setChannels(2); format.setSampleType(QAudioFormat::SignedInt); format.setByteOrder(QAudioFormat::LittleEndian); format.setSampleSize(16); diff --git a/tests/auto/qaudioformat/tst_qaudioformat.cpp b/tests/auto/qaudioformat/tst_qaudioformat.cpp index a7200c4..1d3f313 100644 --- a/tests/auto/qaudioformat/tst_qaudioformat.cpp +++ b/tests/auto/qaudioformat/tst_qaudioformat.cpp @@ -77,8 +77,8 @@ void tst_QAudioFormat::checkNull() QAudioFormat audioFormat1(audioFormat0); QVERIFY(!audioFormat1.isValid()); - audioFormat0.setSampleRate(44100); - audioFormat0.setChannelCount(2); + audioFormat0.setFrequency(44100); + audioFormat0.setChannels(2); audioFormat0.setSampleSize(16); audioFormat0.setCodec("audio/pcm"); audioFormat0.setSampleType(QAudioFormat::SignedInt); @@ -95,8 +95,8 @@ void tst_QAudioFormat::checkFrequency() void tst_QAudioFormat::checkChannels() { QAudioFormat audioFormat; - audioFormat.setChannelCount(2); - QVERIFY(audioFormat.channelCount() == 2); + audioFormat.setChannels(2); + QVERIFY(audioFormat.channels() == 2); } void tst_QAudioFormat::checkSampleSize() @@ -137,15 +137,15 @@ void tst_QAudioFormat::checkEquality() QVERIFY(!(audioFormat0 != audioFormat1)); // on filled formats - audioFormat0.setSampleRate(8000); - audioFormat0.setChannelCount(1); + audioFormat0.setFrequency(8000); + audioFormat0.setChannels(1); audioFormat0.setSampleSize(8); audioFormat0.setCodec("audio/pcm"); audioFormat0.setByteOrder(QAudioFormat::LittleEndian); audioFormat0.setSampleType(QAudioFormat::UnSignedInt); - audioFormat1.setSampleRate(8000); - audioFormat1.setChannelCount(1); + audioFormat1.setFrequency(8000); + audioFormat1.setChannels(1); audioFormat1.setSampleSize(8); audioFormat1.setCodec("audio/pcm"); audioFormat1.setByteOrder(QAudioFormat::LittleEndian); @@ -164,8 +164,8 @@ void tst_QAudioFormat::checkAssignment() QAudioFormat audioFormat0; QAudioFormat audioFormat1; - audioFormat0.setSampleRate(8000); - audioFormat0.setChannelCount(1); + audioFormat0.setFrequency(8000); + audioFormat0.setChannels(1); audioFormat0.setSampleSize(8); audioFormat0.setCodec("audio/pcm"); audioFormat0.setByteOrder(QAudioFormat::LittleEndian); diff --git a/tests/auto/qaudioinput/tst_qaudioinput.cpp b/tests/auto/qaudioinput/tst_qaudioinput.cpp index 9468413..d17a12a 100644 --- a/tests/auto/qaudioinput/tst_qaudioinput.cpp +++ b/tests/auto/qaudioinput/tst_qaudioinput.cpp @@ -68,8 +68,8 @@ private: void tst_QAudioInput::initTestCase() { - format.setSampleRate(8000); - format.setChannelCount(1); + format.setFrequency(8000); + format.setChannels(1); format.setSampleSize(8); format.setCodec("audio/pcm"); format.setByteOrder(QAudioFormat::LittleEndian); diff --git a/tests/auto/qaudiooutput/tst_qaudiooutput.cpp b/tests/auto/qaudiooutput/tst_qaudiooutput.cpp index 5005838..e1b73da 100644 --- a/tests/auto/qaudiooutput/tst_qaudiooutput.cpp +++ b/tests/auto/qaudiooutput/tst_qaudiooutput.cpp @@ -71,8 +71,8 @@ private: void tst_QAudioOutput::initTestCase() { - format.setSampleRate(8000); - format.setChannelCount(1); + format.setFrequency(8000); + format.setChannels(1); format.setSampleSize(8); format.setCodec("audio/pcm"); format.setByteOrder(QAudioFormat::LittleEndian); -- cgit v0.12 From e2f1ae626840d3f7c13fb5e071506d545688a9ab Mon Sep 17 00:00:00 2001 From: Kurt Korbatits Date: Thu, 14 Jan 2010 11:58:01 +1000 Subject: Revert "Frequency to SampleRate and channels to channelCount." This reverts commit 80d4a4945d3273a4b2ce91e34597533f661af320. Conflicts: examples/multimedia/audioinput/audioinput.cpp examples/multimedia/audiooutput/audiooutput.cpp src/multimedia/audio/qaudio_mac.cpp src/multimedia/audio/qaudiodeviceinfo_alsa_p.cpp src/multimedia/audio/qaudiodeviceinfo_mac_p.cpp src/multimedia/audio/qaudiodeviceinfo_win32_p.cpp src/multimedia/audio/qaudioformat.h src/multimedia/audio/qaudioinput.cpp src/multimedia/audio/qaudiooutput.cpp tests/auto/qaudiodeviceinfo/tst_qaudiodeviceinfo.cpp tests/auto/qaudioformat/tst_qaudioformat.cpp tests/auto/qaudioinput/tst_qaudioinput.cpp tests/auto/qaudiooutput/tst_qaudiooutput.cpp --- doc/src/snippets/audio/main.cpp | 2 +- examples/multimedia/audiodevices/audiodevices.cpp | 12 +++---- src/multimedia/audio/qaudio_mac.cpp | 8 ++--- src/multimedia/audio/qaudiodeviceinfo.cpp | 26 +++------------ src/multimedia/audio/qaudiodeviceinfo.h | 2 -- src/multimedia/audio/qaudiodeviceinfo_alsa_p.cpp | 16 +++++----- src/multimedia/audio/qaudiodeviceinfo_win32_p.cpp | 6 ++-- src/multimedia/audio/qaudioformat.cpp | 37 +++------------------- src/multimedia/audio/qaudioinput_alsa_p.cpp | 8 ++--- src/multimedia/audio/qaudioinput_mac_p.cpp | 2 +- src/multimedia/audio/qaudioinput_win32_p.cpp | 14 ++++---- src/multimedia/audio/qaudiooutput_alsa_p.cpp | 6 ++-- src/multimedia/audio/qaudiooutput_mac_p.cpp | 6 ++-- src/multimedia/audio/qaudiooutput_win32_p.cpp | 14 ++++---- .../auto/qaudiodeviceinfo/tst_qaudiodeviceinfo.cpp | 12 +++---- tests/auto/qaudioformat/tst_qaudioformat.cpp | 26 +++++++++++++-- tests/auto/qaudioinput/tst_qaudioinput.cpp | 4 +-- tests/auto/qaudiooutput/tst_qaudiooutput.cpp | 4 +-- 18 files changed, 89 insertions(+), 116 deletions(-) diff --git a/doc/src/snippets/audio/main.cpp b/doc/src/snippets/audio/main.cpp index 6b7a6a5..019f208 100644 --- a/doc/src/snippets/audio/main.cpp +++ b/doc/src/snippets/audio/main.cpp @@ -89,7 +89,7 @@ private: { //![1] QAudioFormat format; - format.setSampleRate(44100); + format.setFrequency(44100); //![1] format.setChannels(2); format.setSampleSize(16); diff --git a/examples/multimedia/audiodevices/audiodevices.cpp b/examples/multimedia/audiodevices/audiodevices.cpp index b0d472c..7d09c38 100644 --- a/examples/multimedia/audiodevices/audiodevices.cpp +++ b/examples/multimedia/audiodevices/audiodevices.cpp @@ -96,8 +96,8 @@ void AudioTest::test() } else { QAudioFormat nearest = deviceInfo.nearestFormat(settings); logOutput->append(tr("Failed")); - nearestFreq->setText(QString("%1").arg(nearest.sampleRate())); - nearestChannel->setText(QString("%1").arg(nearest.channelCount())); + nearestFreq->setText(QString("%1").arg(nearest.frequency())); + nearestChannel->setText(QString("%1").arg(nearest.channels())); nearestCodec->setText(nearest.codec()); nearestSampleSize->setText(QString("%1").arg(nearest.sampleSize())); @@ -149,14 +149,14 @@ void AudioTest::deviceChanged(int idx) deviceInfo = deviceBox->itemData(idx).value(); frequencyBox->clear(); - QList freqz = deviceInfo.supportedSampleRates(); + QList freqz = deviceInfo.supportedFrequencies(); for(int i = 0; i < freqz.size(); ++i) frequencyBox->addItem(QString("%1").arg(freqz.at(i))); if(freqz.size()) - settings.setSampleRate(freqz.at(0)); + settings.setFrequency(freqz.at(0)); channelsBox->clear(); - QList chz = deviceInfo.supportedChannelCounts(); + QList chz = deviceInfo.supportedChannels(); for(int i = 0; i < chz.size(); ++i) channelsBox->addItem(QString("%1").arg(chz.at(i))); if(chz.size()) @@ -217,7 +217,7 @@ void AudioTest::deviceChanged(int idx) void AudioTest::freqChanged(int idx) { // freq has changed - settings.setSampleRate(frequencyBox->itemText(idx).toInt()); + settings.setFrequency(frequencyBox->itemText(idx).toInt()); } void AudioTest::channelChanged(int idx) diff --git a/src/multimedia/audio/qaudio_mac.cpp b/src/multimedia/audio/qaudio_mac.cpp index f6c4c02..14fee8b 100644 --- a/src/multimedia/audio/qaudio_mac.cpp +++ b/src/multimedia/audio/qaudio_mac.cpp @@ -48,8 +48,8 @@ QT_BEGIN_NAMESPACE QDebug operator<<(QDebug dbg, const QAudioFormat& audioFormat) { dbg.nospace() << "QAudioFormat(" << - audioFormat.sampleRate() << "," << - audioFormat.channelCount() << "," << + audioFormat.frequency() << "," << + audioFormat.channels() << "," << audioFormat.sampleSize()<< "," << audioFormat.codec() << "," << audioFormat.byteOrder() << "," << @@ -84,9 +84,9 @@ AudioStreamBasicDescription toAudioStreamBasicDescription(QAudioFormat const& au AudioStreamBasicDescription sf; sf.mFormatFlags = kAudioFormatFlagIsPacked; - sf.mSampleRate = audioFormat.sampleRate(); + sf.mSampleRate = audioFormat.frequency(); sf.mFramesPerPacket = 1; - sf.mChannelsPerFrame = audioFormat.channelCount(); + sf.mChannelsPerFrame = audioFormat.channels(); sf.mBitsPerChannel = audioFormat.sampleSize(); sf.mBytesPerFrame = sf.mChannelsPerFrame * (sf.mBitsPerChannel / 8); sf.mBytesPerPacket = sf.mFramesPerPacket * sf.mBytesPerFrame; diff --git a/src/multimedia/audio/qaudiodeviceinfo.cpp b/src/multimedia/audio/qaudiodeviceinfo.cpp index ca20eda..092efc5 100644 --- a/src/multimedia/audio/qaudiodeviceinfo.cpp +++ b/src/multimedia/audio/qaudiodeviceinfo.cpp @@ -100,13 +100,13 @@ public: You can also query each device for the formats it supports. A format in this context is a set consisting of a specific byte - order, channel, codec, sample rate, sample size and sample type. A + order, channel, codec, frequency, sample rate, and sample type. A format is represented by the QAudioFormat class. The values supported by the the device for each of these parameters can be fetched with supportedByteOrders(), supportedChannels(), supportedCodecs(), - supportedSampleRates(), supportedSampleSizes(), and + supportedFrequencies(), supportedSampleSizes(), and supportedSampleTypes(). The combinations supported are dependent on the platform, audio plugins installed and the audio device capabilities. If you need a specific format, you can check if the device supports it with isFormatSupported(), or fetch a @@ -259,16 +259,7 @@ QStringList QAudioDeviceInfo::supportedCodecs() const } /*! - Returns a list of supported sample rates. -*/ - -QList QAudioDeviceInfo::supportedSampleRates() const -{ - return supportedFrequencies(); -} - -/*! - \internal + Returns a list of supported frequencies. */ QList QAudioDeviceInfo::supportedFrequencies() const @@ -277,16 +268,7 @@ QList QAudioDeviceInfo::supportedFrequencies() const } /*! - Returns a list of supported channel counts. -*/ - -QList QAudioDeviceInfo::supportedChannelCounts() const -{ - return supportedChannels(); -} - -/*! - \internal + Returns a list of supported channels. */ QList QAudioDeviceInfo::supportedChannels() const diff --git a/src/multimedia/audio/qaudiodeviceinfo.h b/src/multimedia/audio/qaudiodeviceinfo.h index 1cc0731..62dc8a2 100644 --- a/src/multimedia/audio/qaudiodeviceinfo.h +++ b/src/multimedia/audio/qaudiodeviceinfo.h @@ -84,9 +84,7 @@ public: QStringList supportedCodecs() const; QList supportedFrequencies() const; - QList supportedSampleRates() const; QList supportedChannels() const; - QList supportedChannelCounts() const; QList supportedSampleSizes() const; QList supportedByteOrders() const; QList supportedSampleTypes() const; diff --git a/src/multimedia/audio/qaudiodeviceinfo_alsa_p.cpp b/src/multimedia/audio/qaudiodeviceinfo_alsa_p.cpp index ee1b775..36270a7 100644 --- a/src/multimedia/audio/qaudiodeviceinfo_alsa_p.cpp +++ b/src/multimedia/audio/qaudiodeviceinfo_alsa_p.cpp @@ -253,8 +253,8 @@ bool QAudioDeviceInfoInternal::testSettings(const QAudioFormat& format) const snd_pcm_hw_params_any( handle, params ); // set the values! - snd_pcm_hw_params_set_channels(handle,params,format.channelCount()); - snd_pcm_hw_params_set_rate(handle,params,format.sampleRate(),dir); + snd_pcm_hw_params_set_channels(handle,params,format.channels()); + snd_pcm_hw_params_set_rate(handle,params,format.frequency(),dir); switch(format.sampleSize()) { case 8: if(format.sampleType() == QAudioFormat::SignedInt) @@ -295,18 +295,18 @@ bool QAudioDeviceInfoInternal::testSettings(const QAudioFormat& format) const } else testCodec = true; - if(err>=0 && format.channelCount() != -1) { - err = snd_pcm_hw_params_test_channels(handle,params,format.channelCount()); + if(err>=0 && format.channels() != -1) { + err = snd_pcm_hw_params_test_channels(handle,params,format.channels()); if(err>=0) - err = snd_pcm_hw_params_set_channels(handle,params,format.channelCount()); + err = snd_pcm_hw_params_set_channels(handle,params,format.channels()); if(err>=0) testChannel = true; } - if(err>=0 && format.sampleRate() != -1) { - err = snd_pcm_hw_params_test_rate(handle,params,format.sampleRate(),0); + if(err>=0 && format.frequency() != -1) { + err = snd_pcm_hw_params_test_rate(handle,params,format.frequency(),0); if(err>=0) - err = snd_pcm_hw_params_set_rate(handle,params,format.sampleRate(),dir); + err = snd_pcm_hw_params_set_rate(handle,params,format.frequency(),dir); if(err>=0) testFreq = true; } diff --git a/src/multimedia/audio/qaudiodeviceinfo_win32_p.cpp b/src/multimedia/audio/qaudiodeviceinfo_win32_p.cpp index f2423f8..f6b8154 100644 --- a/src/multimedia/audio/qaudiodeviceinfo_win32_p.cpp +++ b/src/multimedia/audio/qaudiodeviceinfo_win32_p.cpp @@ -181,12 +181,12 @@ bool QAudioDeviceInfoInternal::testSettings(const QAudioFormat& format) const if(!format.codec().startsWith(QLatin1String("audio/pcm"))) failed = true; - if(!failed && !(format.channelCount() == 1 || format.channelCount() == 2)) + if(!failed && !(format.channels() == 1 || format.channels() == 2)) failed = true; if(!failed) { - if(!(format.sampleRate() == 8000 || format.sampleRate() == 11025 || format.sampleRate() == 22050 || - format.sampleRate() == 44100 || format.sampleRate() == 48000 || format.sampleRate() == 96000)) + if(!(format.frequency() == 8000 || format.frequency() == 11025 || format.frequency() == 22050 || + format.frequency() == 44100 || format.frequency() == 48000 || format.frequency() == 96000)) failed = true; } diff --git a/src/multimedia/audio/qaudioformat.cpp b/src/multimedia/audio/qaudioformat.cpp index 3b06b9a..89ae0ff 100644 --- a/src/multimedia/audio/qaudioformat.cpp +++ b/src/multimedia/audio/qaudioformat.cpp @@ -144,7 +144,7 @@ public: Values are initialized as follows: \list \o frequency() = -1 - \o channelCount() = -1 + \o channels() = -1 \o sampleSize() = -1 \o byteOrder() = QAudioFormat::Endian(QSysInfo::ByteOrder) \o sampleType() = QAudioFormat::Unknown @@ -224,16 +224,7 @@ bool QAudioFormat::isValid() const } /*! - Sets the sample rate to \a samplerate Hertz. -*/ - -void QAudioFormat::setSampleRate(int samplerate) -{ - d->frequency = samplerate; -} - -/*! - \internal + Sets the frequency to \a frequency. */ void QAudioFormat::setFrequency(int frequency) @@ -242,16 +233,7 @@ void QAudioFormat::setFrequency(int frequency) } /*! - Returns the current sample rate in Hertz. -*/ - -int QAudioFormat::sampleRate() const -{ - return d->frequency; -} - -/*! - \internal + Returns the current frequency value. */ int QAudioFormat::frequency() const @@ -260,7 +242,7 @@ int QAudioFormat::frequency() const } /*! - Sets the channel count to \a channels. + Sets the channels to \a channels. */ void QAudioFormat::setChannels(int channels) @@ -269,16 +251,7 @@ void QAudioFormat::setChannels(int channels) } /*! - Returns the current channel count value. -*/ - -int QAudioFormat::channelCount() const -{ - return d->channels; -} - -/*! - \internal + Returns the current channel value. */ int QAudioFormat::channels() const diff --git a/src/multimedia/audio/qaudioinput_alsa_p.cpp b/src/multimedia/audio/qaudioinput_alsa_p.cpp index ea68c8d6..26e46b3 100644 --- a/src/multimedia/audio/qaudioinput_alsa_p.cpp +++ b/src/multimedia/audio/qaudioinput_alsa_p.cpp @@ -256,7 +256,7 @@ bool QAudioInputPrivate::open() int dir; int err=-1; int count=0; - unsigned int freakuency=settings.sampleRate(); + unsigned int freakuency=settings.frequency(); QString dev = QString(QLatin1String(m_device.constData())); QList devices = QAudioDeviceInfoInternal::availableDevices(QAudio::AudioInput); @@ -332,7 +332,7 @@ bool QAudioInputPrivate::open() } } if ( !fatal ) { - err = snd_pcm_hw_params_set_channels( handle, hwparams, (unsigned int)settings.channelCount() ); + err = snd_pcm_hw_params_set_channels( handle, hwparams, (unsigned int)settings.channels() ); if ( err < 0 ) { fatal = true; errMessage = QString::fromLatin1("QAudioInput: snd_pcm_hw_params_set_channels: err = %1").arg(err); @@ -505,7 +505,7 @@ qint64 QAudioInputPrivate::read(char* data, qint64 len) errorState = QAudio::NoError; deviceState = QAudio::IdleState; } else { - totalTimeValue += snd_pcm_bytes_to_frames(handle, err)*1000000/settings.sampleRate(); + totalTimeValue += snd_pcm_bytes_to_frames(handle, err)*1000000/settings.frequency(); resuming = false; errorState = QAudio::NoError; deviceState = QAudio::ActiveState; @@ -702,7 +702,7 @@ qint64 InputPrivate::readData( char* data, qint64 len) count++; } if(err > 0 && readFrames > 0) { - audioDevice->totalTimeValue += readFrames*1000/audioDevice->settings.sampleRate()*1000; + audioDevice->totalTimeValue += readFrames*1000/audioDevice->settings.frequency()*1000; audioDevice->deviceState = QAudio::ActiveState; return err; } diff --git a/src/multimedia/audio/qaudioinput_mac_p.cpp b/src/multimedia/audio/qaudioinput_mac_p.cpp index f5be8ee..7251513 100644 --- a/src/multimedia/audio/qaudioinput_mac_p.cpp +++ b/src/multimedia/audio/qaudioinput_mac_p.cpp @@ -814,7 +814,7 @@ int QAudioInputPrivate::notifyInterval() const qint64 QAudioInputPrivate::processedUSecs() const { - return totalFrames * 1000000 / audioFormat.sampleRate(); + return totalFrames * 1000000 / audioFormat.frequency(); } qint64 QAudioInputPrivate::elapsedUSecs() const diff --git a/src/multimedia/audio/qaudioinput_win32_p.cpp b/src/multimedia/audio/qaudioinput_win32_p.cpp index 5c597ef..17e8bfb 100644 --- a/src/multimedia/audio/qaudioinput_win32_p.cpp +++ b/src/multimedia/audio/qaudioinput_win32_p.cpp @@ -225,16 +225,16 @@ bool QAudioInputPrivate::open() header = 0; if(buffer_size == 0) { // Default buffer size, 100ms, default period size is 20ms - buffer_size = settings.sampleRate()*settings.channelCount()*(settings.sampleSize()/8)*0.1; + buffer_size = settings.frequency()*settings.channels()*(settings.sampleSize()/8)*0.1; period_size = buffer_size/5; } else { period_size = buffer_size/5; } timeStamp.restart(); elapsedTimeOffset = 0; - wfx.nSamplesPerSec = settings.sampleRate(); + wfx.nSamplesPerSec = settings.frequency(); wfx.wBitsPerSample = settings.sampleSize(); - wfx.nChannels = settings.channelCount(); + wfx.nChannels = settings.channels(); wfx.cbSize = 0; wfx.wFormatTag = WAVE_FORMAT_PCM; @@ -374,8 +374,8 @@ qint64 QAudioInputPrivate::read(char* data, qint64 len) } else { totalTimeValue += waveBlocks[header].dwBytesRecorded - /((settings.channelCount()*settings.sampleSize()/8)) - *10000/settings.sampleRate()*100; + /((settings.channels()*settings.sampleSize()/8)) + *10000/settings.frequency()*100; errorState = QAudio::NoError; deviceState = QAudio::ActiveState; resuming = false; @@ -388,8 +388,8 @@ qint64 QAudioInputPrivate::read(char* data, qint64 len) qDebug()<<"IN: "< devices = QAudioDeviceInfoInternal::availableDevices(QAudio::AudioOutput); @@ -354,7 +354,7 @@ bool QAudioOutputPrivate::open() } } if ( !fatal ) { - err = snd_pcm_hw_params_set_channels( handle, hwparams, (unsigned int)settings.channelCount() ); + err = snd_pcm_hw_params_set_channels( handle, hwparams, (unsigned int)settings.channels() ); if ( err < 0 ) { fatal = true; errMessage = QString::fromLatin1("QAudioOutput: snd_pcm_hw_params_set_channels: err = %1").arg(err); @@ -494,7 +494,7 @@ qint64 QAudioOutputPrivate::write( const char *data, qint64 len ) err = snd_pcm_writei( handle, data, frames ); } if(err > 0) { - totalTimeValue += err*1000000/settings.sampleRate(); + totalTimeValue += err*1000000/settings.frequency(); resuming = false; errorState = QAudio::NoError; deviceState = QAudio::ActiveState; diff --git a/src/multimedia/audio/qaudiooutput_mac_p.cpp b/src/multimedia/audio/qaudiooutput_mac_p.cpp index 4367ee7..518f78f 100644 --- a/src/multimedia/audio/qaudiooutput_mac_p.cpp +++ b/src/multimedia/audio/qaudiooutput_mac_p.cpp @@ -87,8 +87,8 @@ public: m_device(0) { m_buffer = new QAudioRingBuffer(bufferSize + (bufferSize % maxPeriodSize == 0 ? 0 : maxPeriodSize - (bufferSize % maxPeriodSize))); - m_bytesPerFrame = (audioFormat.sampleSize() / 8) * audioFormat.channelCount(); - m_periodTime = m_maxPeriodSize / m_bytesPerFrame * 1000 / audioFormat.sampleRate(); + m_bytesPerFrame = (audioFormat.sampleSize() / 8) * audioFormat.channels(); + m_periodTime = m_maxPeriodSize / m_bytesPerFrame * 1000 / audioFormat.frequency(); m_fillTimer = new QTimer(this); connect(m_fillTimer, SIGNAL(timeout()), SLOT(fillBuffer())); @@ -546,7 +546,7 @@ int QAudioOutputPrivate::notifyInterval() const qint64 QAudioOutputPrivate::processedUSecs() const { - return totalFrames * 1000000 / audioFormat.sampleRate(); + return totalFrames * 1000000 / audioFormat.frequency(); } qint64 QAudioOutputPrivate::elapsedUSecs() const diff --git a/src/multimedia/audio/qaudiooutput_win32_p.cpp b/src/multimedia/audio/qaudiooutput_win32_p.cpp index b6e9762..c31e048 100644 --- a/src/multimedia/audio/qaudiooutput_win32_p.cpp +++ b/src/multimedia/audio/qaudiooutput_win32_p.cpp @@ -213,7 +213,7 @@ bool QAudioOutputPrivate::open() #endif if(buffer_size == 0) { // Default buffer size, 200ms, default period size is 40ms - buffer_size = settings.sampleRate()*settings.channelCount()*(settings.sampleSize()/8)*0.2; + buffer_size = settings.frequency()*settings.channels()*(settings.sampleSize()/8)*0.2; period_size = buffer_size/5; } else { period_size = buffer_size/5; @@ -232,9 +232,9 @@ bool QAudioOutputPrivate::open() timeStamp.restart(); elapsedTimeOffset = 0; - wfx.nSamplesPerSec = settings.sampleRate(); + wfx.nSamplesPerSec = settings.frequency(); wfx.wBitsPerSample = settings.sampleSize(); - wfx.nChannels = settings.channelCount(); + wfx.nChannels = settings.channels(); wfx.cbSize = 0; wfx.wFormatTag = WAVE_FORMAT_PCM; @@ -289,8 +289,8 @@ void QAudioOutputPrivate::close() return; deviceState = QAudio::StoppedState; - int delay = (buffer_size-bytesFree())*1000/(settings.sampleRate() - *settings.channelCount()*(settings.sampleSize()/8)); + int delay = (buffer_size-bytesFree())*1000/(settings.frequency() + *settings.channels()*(settings.sampleSize()/8)); waveOutReset(hWaveOut); Sleep(delay+10); @@ -386,8 +386,8 @@ qint64 QAudioOutputPrivate::write( const char *data, qint64 len ) LeaveCriticalSection(&waveOutCriticalSection); #endif totalTimeValue += current->dwBufferLength - /(settings.channelCount()*(settings.sampleSize()/8)) - *1000000/settings.sampleRate();; + /(settings.channels()*(settings.sampleSize()/8)) + *1000000/settings.frequency();; waveCurrentBlock++; waveCurrentBlock %= buffer_size/period_size; current = &waveBlocks[waveCurrentBlock]; diff --git a/tests/auto/qaudiodeviceinfo/tst_qaudiodeviceinfo.cpp b/tests/auto/qaudiodeviceinfo/tst_qaudiodeviceinfo.cpp index 0c91d5c..d3d81e6 100644 --- a/tests/auto/qaudiodeviceinfo/tst_qaudiodeviceinfo.cpp +++ b/tests/auto/qaudiodeviceinfo/tst_qaudiodeviceinfo.cpp @@ -128,7 +128,7 @@ void tst_QAudioDeviceInfo::codecs() void tst_QAudioDeviceInfo::channels() { if(available) { - QList avail = device->supportedChannelCounts(); + QList avail = device->supportedChannels(); QVERIFY(avail.size() > 0); } } @@ -160,7 +160,7 @@ void tst_QAudioDeviceInfo::sampleTypes() void tst_QAudioDeviceInfo::frequencies() { if(available) { - QList avail = device->supportedSampleRates(); + QList avail = device->supportedFrequencies(); QVERIFY(avail.size() > 0); } } @@ -185,8 +185,8 @@ void tst_QAudioDeviceInfo::preferred() { if(available) { QAudioFormat format = device->preferredFormat(); - QVERIFY(format.sampleRate() == 44100); - QVERIFY(format.channelCount() == 2); + QVERIFY(format.frequency() == 44100); + QVERIFY(format.channels() == 2); } } @@ -194,9 +194,9 @@ void tst_QAudioDeviceInfo::nearest() { if(available) { QAudioFormat format1, format2; - format1.setSampleRate(8000); + format1.setFrequency(8000); format2 = device->nearestFormat(format1); - QVERIFY(format2.sampleRate() == 44100); + QVERIFY(format2.frequency() == 44100); } } diff --git a/tests/auto/qaudioformat/tst_qaudioformat.cpp b/tests/auto/qaudioformat/tst_qaudioformat.cpp index 1d3f313..b36af03 100644 --- a/tests/auto/qaudioformat/tst_qaudioformat.cpp +++ b/tests/auto/qaudioformat/tst_qaudioformat.cpp @@ -78,7 +78,11 @@ void tst_QAudioFormat::checkNull() QVERIFY(!audioFormat1.isValid()); audioFormat0.setFrequency(44100); +<<<<<<< HEAD:tests/auto/qaudioformat/tst_qaudioformat.cpp audioFormat0.setChannels(2); +======= + audioFormat0.setChannelCount(2); +>>>>>>> 80d4a49... Frequency to SampleRate and channels to channelCount.:tests/auto/qaudioformat/tst_qaudioformat.cpp audioFormat0.setSampleSize(16); audioFormat0.setCodec("audio/pcm"); audioFormat0.setSampleType(QAudioFormat::SignedInt); @@ -88,14 +92,18 @@ void tst_QAudioFormat::checkNull() void tst_QAudioFormat::checkFrequency() { QAudioFormat audioFormat; - audioFormat.setSampleRate(44100); - QVERIFY(audioFormat.sampleRate() == 44100); + audioFormat.setFrequency(44100); + QVERIFY(audioFormat.frequency() == 44100); } void tst_QAudioFormat::checkChannels() { QAudioFormat audioFormat; +<<<<<<< HEAD:tests/auto/qaudioformat/tst_qaudioformat.cpp audioFormat.setChannels(2); +======= + audioFormat.setChannelCount(2); +>>>>>>> 80d4a49... Frequency to SampleRate and channels to channelCount.:tests/auto/qaudioformat/tst_qaudioformat.cpp QVERIFY(audioFormat.channels() == 2); } @@ -138,14 +146,22 @@ void tst_QAudioFormat::checkEquality() // on filled formats audioFormat0.setFrequency(8000); +<<<<<<< HEAD:tests/auto/qaudioformat/tst_qaudioformat.cpp audioFormat0.setChannels(1); +======= + audioFormat0.setChannelCount(1); +>>>>>>> 80d4a49... Frequency to SampleRate and channels to channelCount.:tests/auto/qaudioformat/tst_qaudioformat.cpp audioFormat0.setSampleSize(8); audioFormat0.setCodec("audio/pcm"); audioFormat0.setByteOrder(QAudioFormat::LittleEndian); audioFormat0.setSampleType(QAudioFormat::UnSignedInt); audioFormat1.setFrequency(8000); +<<<<<<< HEAD:tests/auto/qaudioformat/tst_qaudioformat.cpp audioFormat1.setChannels(1); +======= + audioFormat1.setChannelCount(1); +>>>>>>> 80d4a49... Frequency to SampleRate and channels to channelCount.:tests/auto/qaudioformat/tst_qaudioformat.cpp audioFormat1.setSampleSize(8); audioFormat1.setCodec("audio/pcm"); audioFormat1.setByteOrder(QAudioFormat::LittleEndian); @@ -154,7 +170,7 @@ void tst_QAudioFormat::checkEquality() QVERIFY(audioFormat0 == audioFormat1); QVERIFY(!(audioFormat0 != audioFormat1)); - audioFormat0.setSampleRate(44100); + audioFormat0.setFrequency(44100); QVERIFY(audioFormat0 != audioFormat1); QVERIFY(!(audioFormat0 == audioFormat1)); } @@ -165,7 +181,11 @@ void tst_QAudioFormat::checkAssignment() QAudioFormat audioFormat1; audioFormat0.setFrequency(8000); +<<<<<<< HEAD:tests/auto/qaudioformat/tst_qaudioformat.cpp audioFormat0.setChannels(1); +======= + audioFormat0.setChannelCount(1); +>>>>>>> 80d4a49... Frequency to SampleRate and channels to channelCount.:tests/auto/qaudioformat/tst_qaudioformat.cpp audioFormat0.setSampleSize(8); audioFormat0.setCodec("audio/pcm"); audioFormat0.setByteOrder(QAudioFormat::LittleEndian); diff --git a/tests/auto/qaudioinput/tst_qaudioinput.cpp b/tests/auto/qaudioinput/tst_qaudioinput.cpp index d17a12a..40b7fbb 100644 --- a/tests/auto/qaudioinput/tst_qaudioinput.cpp +++ b/tests/auto/qaudioinput/tst_qaudioinput.cpp @@ -94,8 +94,8 @@ void tst_QAudioInput::settings() // Confirm the setting we added in the init function. QAudioFormat f = audio->format(); - QVERIFY(format.channelCount() == f.channelCount()); - QVERIFY(format.sampleRate() == f.sampleRate()); + QVERIFY(format.channels() == f.channels()); + QVERIFY(format.frequency() == f.frequency()); QVERIFY(format.sampleSize() == f.sampleSize()); QVERIFY(format.codec() == f.codec()); QVERIFY(format.byteOrder() == f.byteOrder()); diff --git a/tests/auto/qaudiooutput/tst_qaudiooutput.cpp b/tests/auto/qaudiooutput/tst_qaudiooutput.cpp index e1b73da..aeb2286 100644 --- a/tests/auto/qaudiooutput/tst_qaudiooutput.cpp +++ b/tests/auto/qaudiooutput/tst_qaudiooutput.cpp @@ -95,8 +95,8 @@ void tst_QAudioOutput::settings() // Confirm the setting we added in the init function. QAudioFormat f = audio->format(); - QVERIFY(format.channelCount() == f.channelCount()); - QVERIFY(format.sampleRate() == f.sampleRate()); + QVERIFY(format.channels() == f.channels()); + QVERIFY(format.frequency() == f.frequency()); QVERIFY(format.sampleSize() == f.sampleSize()); QVERIFY(format.codec() == f.codec()); QVERIFY(format.byteOrder() == f.byteOrder()); -- cgit v0.12 From 5a91631ed3ac6a0d792d0445290a01f3e0f5d7d3 Mon Sep 17 00:00:00 2001 From: Kurt Korbatits Date: Thu, 14 Jan 2010 12:04:05 +1000 Subject: Revert "Frequency to SampleRate and channels to channelCount." missed unit test. This reverts commit 80d4a4945d3273a4b2ce91e34597533f661af320. unit test missed on last revert. --- tests/auto/qaudioformat/tst_qaudioformat.cpp | 20 -------------------- 1 file changed, 20 deletions(-) diff --git a/tests/auto/qaudioformat/tst_qaudioformat.cpp b/tests/auto/qaudioformat/tst_qaudioformat.cpp index b36af03..0206798 100644 --- a/tests/auto/qaudioformat/tst_qaudioformat.cpp +++ b/tests/auto/qaudioformat/tst_qaudioformat.cpp @@ -78,11 +78,7 @@ void tst_QAudioFormat::checkNull() QVERIFY(!audioFormat1.isValid()); audioFormat0.setFrequency(44100); -<<<<<<< HEAD:tests/auto/qaudioformat/tst_qaudioformat.cpp audioFormat0.setChannels(2); -======= - audioFormat0.setChannelCount(2); ->>>>>>> 80d4a49... Frequency to SampleRate and channels to channelCount.:tests/auto/qaudioformat/tst_qaudioformat.cpp audioFormat0.setSampleSize(16); audioFormat0.setCodec("audio/pcm"); audioFormat0.setSampleType(QAudioFormat::SignedInt); @@ -99,11 +95,7 @@ void tst_QAudioFormat::checkFrequency() void tst_QAudioFormat::checkChannels() { QAudioFormat audioFormat; -<<<<<<< HEAD:tests/auto/qaudioformat/tst_qaudioformat.cpp audioFormat.setChannels(2); -======= - audioFormat.setChannelCount(2); ->>>>>>> 80d4a49... Frequency to SampleRate and channels to channelCount.:tests/auto/qaudioformat/tst_qaudioformat.cpp QVERIFY(audioFormat.channels() == 2); } @@ -146,22 +138,14 @@ void tst_QAudioFormat::checkEquality() // on filled formats audioFormat0.setFrequency(8000); -<<<<<<< HEAD:tests/auto/qaudioformat/tst_qaudioformat.cpp audioFormat0.setChannels(1); -======= - audioFormat0.setChannelCount(1); ->>>>>>> 80d4a49... Frequency to SampleRate and channels to channelCount.:tests/auto/qaudioformat/tst_qaudioformat.cpp audioFormat0.setSampleSize(8); audioFormat0.setCodec("audio/pcm"); audioFormat0.setByteOrder(QAudioFormat::LittleEndian); audioFormat0.setSampleType(QAudioFormat::UnSignedInt); audioFormat1.setFrequency(8000); -<<<<<<< HEAD:tests/auto/qaudioformat/tst_qaudioformat.cpp audioFormat1.setChannels(1); -======= - audioFormat1.setChannelCount(1); ->>>>>>> 80d4a49... Frequency to SampleRate and channels to channelCount.:tests/auto/qaudioformat/tst_qaudioformat.cpp audioFormat1.setSampleSize(8); audioFormat1.setCodec("audio/pcm"); audioFormat1.setByteOrder(QAudioFormat::LittleEndian); @@ -181,11 +165,7 @@ void tst_QAudioFormat::checkAssignment() QAudioFormat audioFormat1; audioFormat0.setFrequency(8000); -<<<<<<< HEAD:tests/auto/qaudioformat/tst_qaudioformat.cpp audioFormat0.setChannels(1); -======= - audioFormat0.setChannelCount(1); ->>>>>>> 80d4a49... Frequency to SampleRate and channels to channelCount.:tests/auto/qaudioformat/tst_qaudioformat.cpp audioFormat0.setSampleSize(8); audioFormat0.setCodec("audio/pcm"); audioFormat0.setByteOrder(QAudioFormat::LittleEndian); -- cgit v0.12 From a998a8a1497c4c9176278bca9401f7954708eb9e Mon Sep 17 00:00:00 2001 From: Rohan McGovern Date: Thu, 14 Jan 2010 16:24:01 +1000 Subject: Add a selftest for tests/auto/auto.pro. This selftest enforces that tests/auto/auto.pro is properly maintained. It may be extended to check other elements of the environment necessary for autotests to run correctly. --- tests/auto/auto.pro | 10 ++- tests/auto/maketestselftest/maketestselftest.pro | 9 ++ .../auto/maketestselftest/tst_maketestselftest.cpp | 100 +++++++++++++++++++++ 3 files changed, 117 insertions(+), 2 deletions(-) create mode 100644 tests/auto/maketestselftest/maketestselftest.pro create mode 100644 tests/auto/maketestselftest/tst_maketestselftest.cpp diff --git a/tests/auto/auto.pro b/tests/auto/auto.pro index 4215e97..9b91c7d 100644 --- a/tests/auto/auto.pro +++ b/tests/auto/auto.pro @@ -8,10 +8,14 @@ TEMPLATE = subdirs compiler \ compilerwarnings \ linguist \ + maketestselftest \ moc \ uic \ uic3 \ - guiapplauncher + guiapplauncher \ + #atwrapper \ # These tests need significant updating, + #uiloader \ # they have hardcoded machine names etc. + Q3SUBDIRS += \ q3accel \ q3action \ @@ -130,6 +134,7 @@ SUBDIRS += \ qdoublevalidator \ qdrag \ qerrormessage \ + qevent \ qeventloop \ qexplicitlyshareddatapointer \ qfile \ @@ -478,7 +483,8 @@ embedded:!wince* { } symbian { - SUBDIRS += qsoftkeymanager + SUBDIRS += qsoftkeymanager \ + qs60mainapplication } # Enable the tests specific to QtXmlPatterns. If you add a test, remember to diff --git a/tests/auto/maketestselftest/maketestselftest.pro b/tests/auto/maketestselftest/maketestselftest.pro new file mode 100644 index 0000000..6cc1744 --- /dev/null +++ b/tests/auto/maketestselftest/maketestselftest.pro @@ -0,0 +1,9 @@ +load(qttest_p4) + +SOURCES += tst_maketestselftest.cpp +QT = core + +DEFINES += SRCDIR=\\\"$$PWD/\\\" + +requires(!cross_compile) + diff --git a/tests/auto/maketestselftest/tst_maketestselftest.cpp b/tests/auto/maketestselftest/tst_maketestselftest.cpp new file mode 100644 index 0000000..ea7f36c --- /dev/null +++ b/tests/auto/maketestselftest/tst_maketestselftest.cpp @@ -0,0 +1,100 @@ +/**************************************************************************** +** +** 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$ +** +****************************************************************************/ + +#include +#include +#include +#include +#include + +class tst_MakeTestSelfTest: public QObject +{ + Q_OBJECT + +private slots: + void auto_dot_pro(); + void auto_dot_pro_data(); +}; + +/* Verify that all tests are listed somewhere in auto.pro */ +void tst_MakeTestSelfTest::auto_dot_pro() +{ + static QStringList lines; + + if (lines.isEmpty()) { + QString filename = QString::fromLatin1(SRCDIR "/../auto.pro"); + QFile file(filename); + if (!file.open(QIODevice::ReadOnly)) { + QFAIL(qPrintable(QString("open %1: %2").arg(filename).arg(file.errorString()))); + } + while (!file.atEnd()) { + lines << file.readLine().trimmed(); + } + } + + QFETCH(QString, subdir); + QRegExp re(QString("( |=|^|#)%1( |\\\\|$)").arg(QRegExp::escape(subdir))); + foreach (const QString& line, lines) { + if (re.indexIn(line) != -1) { + return; + } + } + + QFAIL(qPrintable(QString( + "Subdir `%1' is missing from tests/auto/auto.pro\n" + "This means the test won't be compiled or run on any platform.\n" + "If this is intentional, please put the test name in a comment in auto.pro.").arg(subdir)) + ); +} + +void tst_MakeTestSelfTest::auto_dot_pro_data() +{ + QTest::addColumn("subdir"); + QDir dir(SRCDIR "/.."); + QStringList subdirs = dir.entryList(QDir::AllDirs|QDir::NoDotAndDotDot); + + foreach (const QString& subdir, subdirs) { + QTest::newRow(qPrintable(subdir)) << subdir; + } +} + +QTEST_MAIN(tst_MakeTestSelfTest) +#include "tst_maketestselftest.moc" -- cgit v0.12 From 6ba1ce5f73f1f203e6d1c9eb4464edbd5ea3a82c Mon Sep 17 00:00:00 2001 From: Markus Goetz Date: Thu, 14 Jan 2010 11:01:21 +0100 Subject: tst_qnetworkreply benchmark: Read HTTP headers when emulating HTTP Reviewed-by: Peter Hartmann --- tests/benchmarks/qnetworkreply/tst_qnetworkreply.cpp | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/tests/benchmarks/qnetworkreply/tst_qnetworkreply.cpp b/tests/benchmarks/qnetworkreply/tst_qnetworkreply.cpp index 6327123..a92359f 100644 --- a/tests/benchmarks/qnetworkreply/tst_qnetworkreply.cpp +++ b/tests/benchmarks/qnetworkreply/tst_qnetworkreply.cpp @@ -262,8 +262,22 @@ protected: port = server.serverPort(); ready.release(); - server.waitForNewConnection(-1); + QVERIFY(server.waitForNewConnection(10*1000)); client = server.nextPendingConnection(); + + // read lines until we read the empty line seperating HTTP request from HTTP request body + do { + if (client->canReadLine()) { + QString line = client->readLine(); + if (line == "\n" || line == "\r\n") + break; // empty line + } + if (!client->waitForReadyRead(10*1000)) { + client->close(); + return; + } + } while (client->state() == QAbstractSocket::ConnectedState); + client->write("HTTP/1.0 200 OK\r\n"); client->write("Content-length: 0\r\n"); client->write("\r\n"); -- cgit v0.12 From 9baeb2fc297a7a30bb467ea0d1986c7fecea2e58 Mon Sep 17 00:00:00 2001 From: Trond Kjernaasen Date: Thu, 14 Jan 2010 11:07:25 +0100 Subject: Fix QGLWidget::renderPixmap() on Windows. Using renderPixmap() with scenes that contained textures might not work due to the wrong texture format being used under certain circumstances. Task-number: QTBUG-7213 Reviewed-by: Gunnar --- src/opengl/qgl.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/opengl/qgl.cpp b/src/opengl/qgl.cpp index 09ecfd1..3f32cf3 100644 --- a/src/opengl/qgl.cpp +++ b/src/opengl/qgl.cpp @@ -2195,7 +2195,10 @@ QGLTexture* QGLContextPrivate::bindTexture(const QImage &image, GLenum target, G GLuint pixel_type; if (QGLExtensions::glExtensions() & QGLExtensions::BGRATextureFormat) { externalFormat = GL_BGRA; - pixel_type = GL_UNSIGNED_INT_8_8_8_8_REV; + if (QGLFormat::openGLVersionFlags() & QGLFormat::OpenGL_Version_1_2) + pixel_type = GL_UNSIGNED_INT_8_8_8_8_REV; + else + pixel_type = GL_UNSIGNED_BYTE; } else { externalFormat = GL_RGBA; pixel_type = GL_UNSIGNED_BYTE; @@ -2274,12 +2277,9 @@ QGLTexture* QGLContextPrivate::bindTexture(const QImage &image, GLenum target, G qgl_byteSwapImage(img, pixel_type); } #ifdef QT_OPENGL_ES - // OpenGL/ES requires that the internal and external formats be identical. - // This is typically used to convert GL_RGBA into GL_BGRA. - // Also, we need to use GL_UNSIGNED_BYTE when the format is GL_BGRA. + // OpenGL/ES requires that the internal and external formats be + // identical. internalFormat = externalFormat; - if (pixel_type == GL_UNSIGNED_INT_8_8_8_8_REV) - pixel_type = GL_UNSIGNED_BYTE; #endif #ifdef QGL_BIND_TEXTURE_DEBUG printf(" - uploading, image.format=%d, externalFormat=0x%x, internalFormat=0x%x, pixel_type=0x%x\n", -- cgit v0.12 From b095541b487ee2faaca27ff226502acb2f81c7d4 Mon Sep 17 00:00:00 2001 From: Kent Hansen Date: Thu, 14 Jan 2010 11:14:42 +0100 Subject: add tests for QFlags behavior in QtScript It's currently not even documented, but this test defines the current level of support. --- .../qscriptextqobject/tst_qscriptextqobject.cpp | 57 +++++++++++++++++++++- 1 file changed, 56 insertions(+), 1 deletion(-) diff --git a/tests/auto/qscriptextqobject/tst_qscriptextqobject.cpp b/tests/auto/qscriptextqobject/tst_qscriptextqobject.cpp index 73e4fb6..3415163 100644 --- a/tests/auto/qscriptextqobject/tst_qscriptextqobject.cpp +++ b/tests/auto/qscriptextqobject/tst_qscriptextqobject.cpp @@ -112,6 +112,7 @@ class MyQObject : public QObject Q_PROPERTY(QKeySequence shortcut READ shortcut WRITE setShortcut) Q_PROPERTY(CustomType propWithCustomType READ propWithCustomType WRITE setPropWithCustomType) Q_PROPERTY(Policy enumProperty READ enumProperty WRITE setEnumProperty) + Q_PROPERTY(Ability flagsProperty READ flagsProperty WRITE setFlagsProperty) Q_ENUMS(Policy Strategy) Q_FLAGS(Ability) @@ -150,6 +151,7 @@ public: m_writeOnlyValue(789), m_readOnlyValue(987), m_enumValue(BarPolicy), + m_flagsValue(FooAbility), m_qtFunctionInvoked(-1) { } @@ -216,6 +218,11 @@ public: void setEnumProperty(Policy policy) { m_enumValue = policy; } + Ability flagsProperty() const + { return m_flagsValue; } + void setFlagsProperty(Ability ability) + { m_flagsValue = ability; } + int qtFunctionInvoked() const { return m_qtFunctionInvoked; } @@ -316,6 +323,10 @@ public: { m_qtFunctionInvoked = 56; return arg; } Q_INVOKABLE QObject* myInvokableReturningMyQObjectAsQObject() { m_qtFunctionInvoked = 57; return this; } + Q_INVOKABLE Ability myInvokableWithFlagsArg(Ability arg) + { m_qtFunctionInvoked = 58; m_actuals << int(arg); return arg; } + Q_INVOKABLE MyQObject::Ability myInvokableWithQualifiedFlagsArg(MyQObject::Ability arg) + { m_qtFunctionInvoked = 59; m_actuals << int(arg); return arg; } Q_INVOKABLE QObjectList findObjects() const { return findChildren(); } @@ -433,6 +444,7 @@ protected: QKeySequence m_shortcut; CustomType m_customType; Policy m_enumValue; + Ability m_flagsValue; int m_qtFunctionInvoked; QVariantList m_actuals; QByteArray m_connectedSignal; @@ -826,7 +838,7 @@ void tst_QScriptExtQObject::getSetStaticProperty() { QScriptValue val = m_engine->evaluate("myObject.enumProperty"); QVERIFY(val.isNumber()); - QCOMPARE(val.toInt32(), (int)MyQObject::BarPolicy); + QCOMPARE(val.toInt32(), int(MyQObject::BarPolicy)); } m_engine->evaluate("myObject.enumProperty = 2"); QCOMPARE(m_myObject->enumProperty(), MyQObject::BazPolicy); @@ -846,6 +858,25 @@ void tst_QScriptExtQObject::getSetStaticProperty() m_engine->evaluate("myObject.enumProperty = 'nada'"); QCOMPARE(m_myObject->enumProperty(), (MyQObject::Policy)-1); + // flags property + QCOMPARE(m_myObject->flagsProperty(), MyQObject::FooAbility); + { + QScriptValue val = m_engine->evaluate("myObject.flagsProperty"); + QVERIFY(val.isNumber()); + QCOMPARE(val.toInt32(), int(MyQObject::FooAbility)); + } + m_engine->evaluate("myObject.flagsProperty = 0x80"); + QCOMPARE(m_myObject->flagsProperty(), MyQObject::BarAbility); + m_engine->evaluate("myObject.flagsProperty = 0x81"); + QCOMPARE(m_myObject->flagsProperty(), MyQObject::Ability(MyQObject::FooAbility | MyQObject::BarAbility)); + m_engine->evaluate("myObject.flagsProperty = 123"); // bogus values are accepted + QCOMPARE(int(m_myObject->flagsProperty()), 123); + m_engine->evaluate("myObject.flagsProperty = 'BazAbility'"); + QCOMPARE(m_myObject->flagsProperty(), MyQObject::BazAbility); + m_engine->evaluate("myObject.flagsProperty = 'ScoobyDoo'"); + // ### ouch! Shouldn't QMetaProperty::write() rather not change the value...? + QCOMPARE(m_myObject->flagsProperty(), (MyQObject::Ability)-1); + // auto-dereferencing of pointers { QBrush b = QColor(0xCA, 0xFE, 0xBA, 0xBE); @@ -2017,6 +2048,7 @@ void tst_QScriptExtQObject::classEnums() QScriptValue myClass = m_engine->newQMetaObject(m_myObject->metaObject(), m_engine->undefinedValue()); m_engine->globalObject().setProperty("MyQObject", myClass); + QVERIFY(m_engine->evaluate("MyQObject.FooPolicy").isNumber()); // no strong typing QCOMPARE(static_cast(m_engine->evaluate("MyQObject.FooPolicy").toInt32()), MyQObject::FooPolicy); QCOMPARE(static_cast(m_engine->evaluate("MyQObject.BarPolicy").toInt32()), @@ -2031,6 +2063,7 @@ void tst_QScriptExtQObject::classEnums() QCOMPARE(static_cast(m_engine->evaluate("MyQObject.BazStrategy").toInt32()), MyQObject::BazStrategy); + QVERIFY(m_engine->evaluate("MyQObject.NoAbility").isNumber()); // no strong typing QCOMPARE(MyQObject::Ability(m_engine->evaluate("MyQObject.NoAbility").toInt32()), MyQObject::NoAbility); QCOMPARE(MyQObject::Ability(m_engine->evaluate("MyQObject.FooAbility").toInt32()), @@ -2042,6 +2075,9 @@ void tst_QScriptExtQObject::classEnums() QCOMPARE(MyQObject::Ability(m_engine->evaluate("MyQObject.AllAbility").toInt32()), MyQObject::AllAbility); + // Constructors for flags are not provided + QVERIFY(m_engine->evaluate("MyQObject.Ability").isUndefined()); + QScriptValue::PropertyFlags expectedEnumFlags = QScriptValue::ReadOnly | QScriptValue::Undeletable; QCOMPARE(myClass.propertyFlags("FooPolicy"), expectedEnumFlags); QCOMPARE(myClass.propertyFlags("BarPolicy"), expectedEnumFlags); @@ -2094,6 +2130,25 @@ void tst_QScriptExtQObject::classEnums() QCOMPARE(ret.isNumber(), true); } + m_myObject->resetQtFunctionInvoked(); + { + QScriptValue ret = m_engine->evaluate("myObject.myInvokableWithFlagsArg(MyQObject.FooAbility)"); + QCOMPARE(m_myObject->qtFunctionInvoked(), 58); + QCOMPARE(m_myObject->qtFunctionActuals().size(), 1); + QCOMPARE(m_myObject->qtFunctionActuals().at(0).toInt(), int(MyQObject::FooAbility)); + QCOMPARE(ret.isNumber(), true); + QCOMPARE(ret.toInt32(), int(MyQObject::FooAbility)); + } + m_myObject->resetQtFunctionInvoked(); + { + QScriptValue ret = m_engine->evaluate("myObject.myInvokableWithQualifiedFlagsArg(MyQObject.BarAbility)"); + QCOMPARE(m_myObject->qtFunctionInvoked(), 59); + QCOMPARE(m_myObject->qtFunctionActuals().size(), 1); + QCOMPARE(m_myObject->qtFunctionActuals().at(0).toInt(), int(MyQObject::BarAbility)); + QCOMPARE(ret.isNumber(), true); + QCOMPARE(ret.toInt32(), int(MyQObject::BarAbility)); + } + // enum properties are not deletable or writable QVERIFY(!m_engine->evaluate("delete MyQObject.BazPolicy").toBool()); myClass.setProperty("BazPolicy", QScriptValue()); -- cgit v0.12 From e915c2408b2030b142dc309a9e4aba621341aa28 Mon Sep 17 00:00:00 2001 From: Prasanth Ullattil Date: Wed, 13 Jan 2010 14:06:56 +0100 Subject: File dialog mode is not correctly updated in Mac (Cocoa). QFileDialog shows a customized version of the native file dialog on Mac. When user changes the fileMode, the corresponding options needs to be updated in the native dialog as well. Some options like mode, filters, button text, dialog title etc needs to be updated for this. This patch also address the changing of 'acceptMode'. When user changes this, for e.g. the native dialog needs to switch from an open panel to save panel. It is easier to recreate the internal QNSOpenSavePanelDelegate than changing options individually. Task-number: QTBUG-7086 Reviewed-by: Richard Moe Gustavsen --- src/gui/dialogs/qfiledialog.cpp | 15 +++++++++------ src/gui/dialogs/qfiledialog_mac.mm | 7 +++++++ 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/src/gui/dialogs/qfiledialog.cpp b/src/gui/dialogs/qfiledialog.cpp index 3d59463..21650bb 100644 --- a/src/gui/dialogs/qfiledialog.cpp +++ b/src/gui/dialogs/qfiledialog.cpp @@ -1222,12 +1222,6 @@ QFileDialog::ViewMode QFileDialog::viewMode() const void QFileDialog::setFileMode(QFileDialog::FileMode mode) { Q_D(QFileDialog); - if (d->nativeDialogInUse){ - d->model->setFilter(d->filterForMode(filter())); - d->setFilter_sys(); - return; - } - d->fileMode = mode; d->retranslateWindowTitle(); @@ -1263,6 +1257,11 @@ void QFileDialog::setFileMode(QFileDialog::FileMode mode) } } setLabelText(Accept, buttonText); + if (d->nativeDialogInUse){ + d->setFilter_sys(); + return; + } + d->qFileDialogUi->fileTypeCombo->setEnabled(!testOption(ShowDirsOnly)); d->_q_updateOkButton(); } @@ -1300,6 +1299,10 @@ void QFileDialog::setAcceptMode(QFileDialog::AcceptMode mode) d->qFileDialogUi->lookInCombo->setEditable(false); } d->retranslateWindowTitle(); +#if defined(Q_WS_MAC) + d->deleteNativeDialog_sys(); + setAttribute(Qt::WA_DontShowOnScreen, false); +#endif } /* diff --git a/src/gui/dialogs/qfiledialog_mac.mm b/src/gui/dialogs/qfiledialog_mac.mm index db5c356..67daced 100644 --- a/src/gui/dialogs/qfiledialog_mac.mm +++ b/src/gui/dialogs/qfiledialog_mac.mm @@ -639,9 +639,16 @@ void QFileDialogPrivate::setFilter_sys() { #ifndef QT_MAC_USE_COCOA #else + Q_Q(QFileDialog); QMacCocoaAutoReleasePool pool; QNSOpenSavePanelDelegate *delegate = static_cast(mDelegate); *(delegate->mQDirFilter) = model->filter(); + delegate->mFileMode = fileMode; + [delegate->mSavePanel setTitle:qt_mac_QStringToNSString(q->windowTitle())]; + [delegate->mSavePanel setPrompt:[delegate strip:acceptLabel]]; + if (fileNameLabelExplicitlySat) + [delegate->mSavePanel setNameFieldLabel:[delegate strip:qFileDialogUi->fileNameLabel->text()]]; + [delegate updateProperties]; #endif } -- cgit v0.12 From f7767801f1d9455325351ec9bb590c6f7cd60e77 Mon Sep 17 00:00:00 2001 From: Peter Hartmann Date: Thu, 14 Jan 2010 11:18:35 +0100 Subject: network internals: fix uploading of data Reviewed-by: Markus Goetz --- src/network/access/qhttpnetworkconnectionchannel.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/network/access/qhttpnetworkconnectionchannel.cpp b/src/network/access/qhttpnetworkconnectionchannel.cpp index 39d09aa..1955dba 100644 --- a/src/network/access/qhttpnetworkconnectionchannel.cpp +++ b/src/network/access/qhttpnetworkconnectionchannel.cpp @@ -260,7 +260,7 @@ bool QHttpNetworkConnectionChannel::sendRequest() // ensure we try to receive a reply in all cases, even if _q_readyRead_ hat not been called // this is needed if the sends an reply before we have finished sending the request. In that // case receiveReply had been called before but ignored the server reply - QMetaObject::invokeMethod(connection, "_q_receiveReply", Qt::QueuedConnection); + QMetaObject::invokeMethod(this, "_q_receiveReply", Qt::QueuedConnection); break; } case QHttpNetworkConnectionChannel::ReadingState: -- cgit v0.12 From a299057a351b0aff2c961e920839451b67e50f4e Mon Sep 17 00:00:00 2001 From: Alan Alpert Date: Wed, 13 Jan 2010 18:29:15 +0100 Subject: Make input mask cursor blink Task-number: QTBUG-7174 Reviewed-by: Leo --- src/gui/widgets/qlinecontrol.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/gui/widgets/qlinecontrol.cpp b/src/gui/widgets/qlinecontrol.cpp index 117c550..12b4268 100644 --- a/src/gui/widgets/qlinecontrol.cpp +++ b/src/gui/widgets/qlinecontrol.cpp @@ -510,10 +510,12 @@ void QLineControl::draw(QPainter *painter, const QPoint &offset, const QRect &cl o.format.setForeground(m_palette.brush(QPalette::HighlightedText)); } else { // mask selection - o.start = m_cursor; - o.length = 1; - o.format.setBackground(m_palette.brush(QPalette::Text)); - o.format.setForeground(m_palette.brush(QPalette::Window)); + if(!m_blinkPeriod || m_blinkStatus){ + o.start = m_cursor; + o.length = 1; + o.format.setBackground(m_palette.brush(QPalette::Text)); + o.format.setForeground(m_palette.brush(QPalette::Window)); + } } selections.append(o); } -- cgit v0.12 From b6b3f7b60ac3a59bc083e38e78b087b20f003bb6 Mon Sep 17 00:00:00 2001 From: Thomas Zander Date: Thu, 14 Jan 2010 11:48:01 +0100 Subject: Better fix for build!=src Makefile generation Make sure we always use the absolute path to the pro file so it will just work from either source or build dir. This fixes the usecase where qmake generated a relative path starting with '..' --- qmake/generators/makefile.cpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/qmake/generators/makefile.cpp b/qmake/generators/makefile.cpp index c1ab60b..7424d1d 100644 --- a/qmake/generators/makefile.cpp +++ b/qmake/generators/makefile.cpp @@ -2412,16 +2412,14 @@ MakefileGenerator::writeSubTargets(QTextStream &t, QListprofile.isEmpty()) { QString out = subtarget->makefile; - QString in = fileFixify(in_directory + subtarget->profile, in_directory); - if(in.startsWith(in_directory)) - in = in.mid(in_directory.length()); + QString in = fileFixify(in_directory + subtarget->profile, out_directory, QString(), FileFixifyAbsolute); if(out.startsWith(in_directory)) out = out.mid(in_directory.length()); t << mkfile << ": " << "\n\t"; if(!in_directory.isEmpty()) { t << mkdir_p_asstring(out_directory) << out_directory_cdin - << "$(QMAKE) " << subtarget->in_directory << QDir::separator() << in << buildArgs(in_directory) << " -o " << out + << "$(QMAKE) " << in << buildArgs(in_directory) << " -o " << out << in_directory_cdout << endl; } else { t << "$(QMAKE) " << in << buildArgs(in_directory) << " -o " << out << endl; @@ -2433,7 +2431,7 @@ MakefileGenerator::writeSubTargets(QTextStream &t, QListin_directory << QDir::separator() << in << buildArgs(in_directory) << " -o " << out + << "$(QMAKE) " << in << buildArgs(in_directory) << " -o " << out << in_directory_cdout << endl; } else { t << "$(QMAKE) " << in << buildArgs(in_directory) << " -o " << out << endl; -- cgit v0.12 From 1ca42be0498744dd1270241d2ccfe3d578d82a98 Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Thu, 14 Jan 2010 13:14:12 +0100 Subject: Updated WebKit from /home/shausman/src/webkit/trunk to qtwebkit/qtwebkit-4.6 ( 8f6992f4e8f027818429d428393b08068eca9ffa ) Changes in WebKit/qt since the last update: ++ b/WebKit/qt/ChangeLog 2010-01-14 Simon Hausmann Reviewed by Kenneth Rohde Christiansen. [Qt] Update Symbian .def symbol export files after private API additions. * symbian/bwins/QtWebKitu.def: * symbian/eabi/QtWebKitu.def: --- src/3rdparty/webkit/VERSION | 2 +- src/3rdparty/webkit/WebKit/qt/ChangeLog | 9 +++++++++ src/3rdparty/webkit/WebKit/qt/symbian/bwins/QtWebKitu.def | 4 ++++ src/3rdparty/webkit/WebKit/qt/symbian/eabi/QtWebKitu.def | 4 ++++ 4 files changed, 18 insertions(+), 1 deletion(-) diff --git a/src/3rdparty/webkit/VERSION b/src/3rdparty/webkit/VERSION index bc6d661..4f33e22 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 - 8b9165d3bc84d1c8cc7df49a191cc3857b5530d4 + 8f6992f4e8f027818429d428393b08068eca9ffa diff --git a/src/3rdparty/webkit/WebKit/qt/ChangeLog b/src/3rdparty/webkit/WebKit/qt/ChangeLog index 357b787..cd47982 100644 --- a/src/3rdparty/webkit/WebKit/qt/ChangeLog +++ b/src/3rdparty/webkit/WebKit/qt/ChangeLog @@ -1,3 +1,12 @@ +2010-01-14 Simon Hausmann + + Reviewed by Kenneth Rohde Christiansen. + + [Qt] Update Symbian .def symbol export files after private API additions. + + * symbian/bwins/QtWebKitu.def: + * symbian/eabi/QtWebKitu.def: + 2009-12-18 Joe Ligman Reviewed by Kenneth Rohde Christiansen. diff --git a/src/3rdparty/webkit/WebKit/qt/symbian/bwins/QtWebKitu.def b/src/3rdparty/webkit/WebKit/qt/symbian/bwins/QtWebKitu.def index e5631f8..086e986 100644 --- a/src/3rdparty/webkit/WebKit/qt/symbian/bwins/QtWebKitu.def +++ b/src/3rdparty/webkit/WebKit/qt/symbian/bwins/QtWebKitu.def @@ -620,4 +620,8 @@ EXPORTS ?staticMetaObject@QWebPage@@2UQMetaObject@@B @ 619 NONAME ; struct QMetaObject const QWebPage::staticMetaObject ?staticMetaObject@QWebView@@2UQMetaObject@@B @ 620 NONAME ; struct QMetaObject const QWebView::staticMetaObject ?attributeNames@QWebElement@@QBE?AVQStringList@@ABVQString@@@Z @ 621 NONAME ; class QStringList QWebElement::attributeNames(class QString const &) const + ?qt_networkAccessAllowed@@YAX_N@Z @ 622 NONAME ; void qt_networkAccessAllowed(bool) + ?qt_resumeActiveDOMObjects@@YAXPAVQWebFrame@@@Z @ 623 NONAME ; void qt_resumeActiveDOMObjects(class QWebFrame *) + ?qt_suspendActiveDOMObjects@@YAXPAVQWebFrame@@@Z @ 624 NONAME ; void qt_suspendActiveDOMObjects(class QWebFrame *) + ?qtwebkit_webframe_scrollRecursively@@YA_NPAVQWebFrame@@HH@Z @ 625 NONAME ; bool qtwebkit_webframe_scrollRecursively(class QWebFrame *, int, int) diff --git a/src/3rdparty/webkit/WebKit/qt/symbian/eabi/QtWebKitu.def b/src/3rdparty/webkit/WebKit/qt/symbian/eabi/QtWebKitu.def index 4aad884..5dd2e20 100644 --- a/src/3rdparty/webkit/WebKit/qt/symbian/eabi/QtWebKitu.def +++ b/src/3rdparty/webkit/WebKit/qt/symbian/eabi/QtWebKitu.def @@ -690,4 +690,8 @@ EXPORTS _ZThn8_N16QGraphicsWebView10itemChangeEN13QGraphicsItem18GraphicsItemChangeERK8QVariant @ 689 NONAME _ZThn8_NK16QGraphicsWebView16inputMethodQueryEN2Qt16InputMethodQueryE @ 690 NONAME _ZNK11QWebElement14attributeNamesERK7QString @ 691 NONAME + _Z23qt_networkAccessAllowedb @ 692 NONAME + _Z25qt_resumeActiveDOMObjectsP9QWebFrame @ 693 NONAME + _Z26qt_suspendActiveDOMObjectsP9QWebFrame @ 694 NONAME + _Z35qtwebkit_webframe_scrollRecursivelyP9QWebFrameii @ 695 NONAME -- cgit v0.12 From f894fb8228e35a43b2baf80666ca5bca6e987064 Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Thu, 14 Jan 2010 13:14:12 +0100 Subject: Updated WebKit from /home/shausman/src/webkit/trunk to qtwebkit/qtwebkit-4.6 ( 8f6992f4e8f027818429d428393b08068eca9ffa ) Changes in WebKit/qt since the last update: ++ b/WebKit/qt/ChangeLog 2010-01-14 Simon Hausmann Reviewed by Kenneth Rohde Christiansen. [Qt] Update Symbian .def symbol export files after private API additions. * symbian/bwins/QtWebKitu.def: * symbian/eabi/QtWebKitu.def: --- src/3rdparty/webkit/VERSION | 2 +- src/3rdparty/webkit/WebKit/qt/ChangeLog | 9 +++++++++ src/3rdparty/webkit/WebKit/qt/symbian/bwins/QtWebKitu.def | 4 ++++ src/3rdparty/webkit/WebKit/qt/symbian/eabi/QtWebKitu.def | 4 ++++ 4 files changed, 18 insertions(+), 1 deletion(-) diff --git a/src/3rdparty/webkit/VERSION b/src/3rdparty/webkit/VERSION index bc6d661..4f33e22 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 - 8b9165d3bc84d1c8cc7df49a191cc3857b5530d4 + 8f6992f4e8f027818429d428393b08068eca9ffa diff --git a/src/3rdparty/webkit/WebKit/qt/ChangeLog b/src/3rdparty/webkit/WebKit/qt/ChangeLog index 357b787..cd47982 100644 --- a/src/3rdparty/webkit/WebKit/qt/ChangeLog +++ b/src/3rdparty/webkit/WebKit/qt/ChangeLog @@ -1,3 +1,12 @@ +2010-01-14 Simon Hausmann + + Reviewed by Kenneth Rohde Christiansen. + + [Qt] Update Symbian .def symbol export files after private API additions. + + * symbian/bwins/QtWebKitu.def: + * symbian/eabi/QtWebKitu.def: + 2009-12-18 Joe Ligman Reviewed by Kenneth Rohde Christiansen. diff --git a/src/3rdparty/webkit/WebKit/qt/symbian/bwins/QtWebKitu.def b/src/3rdparty/webkit/WebKit/qt/symbian/bwins/QtWebKitu.def index e5631f8..086e986 100644 --- a/src/3rdparty/webkit/WebKit/qt/symbian/bwins/QtWebKitu.def +++ b/src/3rdparty/webkit/WebKit/qt/symbian/bwins/QtWebKitu.def @@ -620,4 +620,8 @@ EXPORTS ?staticMetaObject@QWebPage@@2UQMetaObject@@B @ 619 NONAME ; struct QMetaObject const QWebPage::staticMetaObject ?staticMetaObject@QWebView@@2UQMetaObject@@B @ 620 NONAME ; struct QMetaObject const QWebView::staticMetaObject ?attributeNames@QWebElement@@QBE?AVQStringList@@ABVQString@@@Z @ 621 NONAME ; class QStringList QWebElement::attributeNames(class QString const &) const + ?qt_networkAccessAllowed@@YAX_N@Z @ 622 NONAME ; void qt_networkAccessAllowed(bool) + ?qt_resumeActiveDOMObjects@@YAXPAVQWebFrame@@@Z @ 623 NONAME ; void qt_resumeActiveDOMObjects(class QWebFrame *) + ?qt_suspendActiveDOMObjects@@YAXPAVQWebFrame@@@Z @ 624 NONAME ; void qt_suspendActiveDOMObjects(class QWebFrame *) + ?qtwebkit_webframe_scrollRecursively@@YA_NPAVQWebFrame@@HH@Z @ 625 NONAME ; bool qtwebkit_webframe_scrollRecursively(class QWebFrame *, int, int) diff --git a/src/3rdparty/webkit/WebKit/qt/symbian/eabi/QtWebKitu.def b/src/3rdparty/webkit/WebKit/qt/symbian/eabi/QtWebKitu.def index 4aad884..5dd2e20 100644 --- a/src/3rdparty/webkit/WebKit/qt/symbian/eabi/QtWebKitu.def +++ b/src/3rdparty/webkit/WebKit/qt/symbian/eabi/QtWebKitu.def @@ -690,4 +690,8 @@ EXPORTS _ZThn8_N16QGraphicsWebView10itemChangeEN13QGraphicsItem18GraphicsItemChangeERK8QVariant @ 689 NONAME _ZThn8_NK16QGraphicsWebView16inputMethodQueryEN2Qt16InputMethodQueryE @ 690 NONAME _ZNK11QWebElement14attributeNamesERK7QString @ 691 NONAME + _Z23qt_networkAccessAllowedb @ 692 NONAME + _Z25qt_resumeActiveDOMObjectsP9QWebFrame @ 693 NONAME + _Z26qt_suspendActiveDOMObjectsP9QWebFrame @ 694 NONAME + _Z35qtwebkit_webframe_scrollRecursivelyP9QWebFrameii @ 695 NONAME -- cgit v0.12 From 5baf1a9ba0388109685539384d6f4e674ad252d6 Mon Sep 17 00:00:00 2001 From: Yoann Lopes Date: Thu, 14 Jan 2010 15:18:45 +0100 Subject: Fixes wrong stroke clipping with the raster engine. The problem was that the clip rect was only updated when the QPen had changed. Task-number: QTBUG-7253 Reviewed-by: gunnar --- src/gui/painting/qpaintengineex.cpp | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/gui/painting/qpaintengineex.cpp b/src/gui/painting/qpaintengineex.cpp index 058f226..4f2fffa 100644 --- a/src/gui/painting/qpaintengineex.cpp +++ b/src/gui/painting/qpaintengineex.cpp @@ -417,13 +417,6 @@ void QPaintEngineEx::stroke(const QVectorPath &path, const QPen &pen) } else if (style == Qt::NoPen) { d->activeStroker = 0; } else { - // ### re-enable... - if (pen.isCosmetic()) { - d->dasher.setClipRect(d->exDeviceRect); - } else { - QRectF clipRect = state()->matrix.inverted().mapRect(QRectF(d->exDeviceRect)); - d->dasher.setClipRect(clipRect); - } d->dasher.setDashPattern(pen.dashPattern()); d->dasher.setDashOffset(pen.dashOffset()); d->activeStroker = &d->dasher; @@ -434,6 +427,15 @@ void QPaintEngineEx::stroke(const QVectorPath &path, const QPen &pen) return; } + if (pen.style() > Qt::SolidLine) { + if (pen.isCosmetic()) { + d->activeStroker->setClipRect(d->exDeviceRect); + } else { + QRectF clipRect = state()->matrix.inverted().mapRect(QRectF(d->exDeviceRect)); + d->activeStroker->setClipRect(clipRect); + } + } + const QPainterPath::ElementType *types = path.elements(); const qreal *points = path.points(); int pointCount = path.elementCount(); -- cgit v0.12 From bc82db4d08860735bbae584a54d1b591c760e38b Mon Sep 17 00:00:00 2001 From: Jason Barron Date: Thu, 14 Jan 2010 10:44:24 +0100 Subject: Improve the behavior of expose events on Symbian. Previously when an expose was received from WSERV, we simply called BitBlt (for raster) or called flush on the window surface (for anything else). This behavior differs from other platforms which call syncBackingStore(). This difference means that we flush the backing store without actually updating the content first. This works for most cases because if there actually was new content, it would be updated when the widget's UpdateRequest event was handled. The problem arises when the backing store does not have the correct content. This can happen if the backing store was deleted, but only partially restored (see Task below). Another problem is with the OpenVG graphics system which assumes that beginPaint() is called before endPaint() is order to initialize the context and the surface size. The fix is to call syncBackingStore() like the other platforms, but introduce a bit field to prevent infinite recursion in the painting pipeline. Task-number: QTBUG-4921 Reviewed-by: axis Reviewed-by: Gareth Stockwell --- src/gui/kernel/qapplication_s60.cpp | 11 +++++++++-- src/gui/kernel/qwidget_p.h | 1 + src/gui/kernel/qwidget_s60.cpp | 1 + src/gui/painting/qwindowsurface_s60.cpp | 8 +++++--- 4 files changed, 16 insertions(+), 5 deletions(-) diff --git a/src/gui/kernel/qapplication_s60.cpp b/src/gui/kernel/qapplication_s60.cpp index 3ee0a71..8c77728 100644 --- a/src/gui/kernel/qapplication_s60.cpp +++ b/src/gui/kernel/qapplication_s60.cpp @@ -807,6 +807,15 @@ TCoeInputCapabilities QSymbianControl::InputCapabilities() const void QSymbianControl::Draw(const TRect& controlRect) const { + // Set flag to avoid calling DrawNow in window surface + QWExtra *extra = qwidget->d_func()->extraData(); + if (extra && !extra->inExpose) { + extra->inExpose = true; + QRect exposeRect = qt_TRect2QRect(controlRect); + qwidget->d_func()->syncBackingStore(exposeRect); + extra->inExpose = false; + } + QWindowSurface *surface = qwidget->windowSurface(); QPaintEngine *engine = surface ? surface->paintDevice()->paintEngine() : NULL; @@ -855,8 +864,6 @@ void QSymbianControl::Draw(const TRect& controlRect) const default: Q_ASSERT(false); } - } else { - surface->flush(qwidget, QRegion(qt_TRect2QRect(backingStoreRect)), QPoint()); } if (sendNativePaintEvents) { diff --git a/src/gui/kernel/qwidget_p.h b/src/gui/kernel/qwidget_p.h index ec8d20f..b1eb3c3 100644 --- a/src/gui/kernel/qwidget_p.h +++ b/src/gui/kernel/qwidget_p.h @@ -229,6 +229,7 @@ struct QWExtra { #endif #elif defined(Q_OS_SYMBIAN) // <----------------------------------------------------- Symbian uint activated : 1; // RWindowBase::Activated has been called + uint inExpose : 1; // Prevents drawing recursion /** * Defines the behaviour of QSymbianControl::Draw. diff --git a/src/gui/kernel/qwidget_s60.cpp b/src/gui/kernel/qwidget_s60.cpp index c65a162..4c0e21e 100644 --- a/src/gui/kernel/qwidget_s60.cpp +++ b/src/gui/kernel/qwidget_s60.cpp @@ -883,6 +883,7 @@ void QWidgetPrivate::createSysExtra() extra->activated = 0; extra->nativePaintMode = QWExtra::Default; extra->receiveNativePaintEvents = 0; + extra->inExpose = 0; } void QWidgetPrivate::deleteSysExtra() diff --git a/src/gui/painting/qwindowsurface_s60.cpp b/src/gui/painting/qwindowsurface_s60.cpp index b8eaead..b41dc2c 100644 --- a/src/gui/painting/qwindowsurface_s60.cpp +++ b/src/gui/painting/qwindowsurface_s60.cpp @@ -145,10 +145,12 @@ QImage* QS60WindowSurface::buffer(const QWidget *widget) void QS60WindowSurface::flush(QWidget *widget, const QRegion ®ion, const QPoint &) { - const QVector subRects = region.rects(); - for (int i = 0; i < subRects.count(); ++i) { - TRect tr = qt_QRect2TRect(subRects[i]); + QWExtra *extra = widget->d_func()->extraData(); + if (extra && !extra->inExpose) { + extra->inExpose = true; // Prevent DrawNow() from calling syncBackingStore() again + TRect tr = qt_QRect2TRect(region.boundingRect()); widget->winId()->DrawNow(tr); + extra->inExpose = false; } } -- cgit v0.12 From c6f1e91c114eaf331fd40c909553b173136ffe99 Mon Sep 17 00:00:00 2001 From: Gabriel de Dietrich Date: Wed, 13 Jan 2010 17:08:12 +0100 Subject: QListView in icon view mode, drop enabled items wouldn't receive anything QIconModeViewBase::filterDropEvent() was only moving the items around in the view without ever checking whether the cursor was over a drop enabled item. Now it does and returns false if it's the case. As a consequence, QAbstractItemView::dropEvent() gets called. No auto-test since it's a drag & drop related task. Reviewed-by: janarve Task-number: QTBUG-6848 --- src/gui/itemviews/qlistview.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/gui/itemviews/qlistview.cpp b/src/gui/itemviews/qlistview.cpp index f289c7d..19b1e8c 100644 --- a/src/gui/itemviews/qlistview.cpp +++ b/src/gui/itemviews/qlistview.cpp @@ -2621,6 +2621,13 @@ bool QIconModeViewBase::filterDropEvent(QDropEvent *e) const QSize contents = contentsSize; QPoint offset(horizontalOffset(), verticalOffset()); QPoint end = e->pos() + offset; + if (qq->acceptDrops()) { + const Qt::ItemFlags dropableFlags = Qt::ItemIsDropEnabled|Qt::ItemIsEnabled; + const QVector &dropIndices = intersectingSet(QRect(end, QSize(1, 1))); + foreach (const QModelIndex &index, dropIndices) + if ((index.flags() & dropableFlags) == dropableFlags) + return false; + } QPoint start = dd->pressedPosition; QPoint delta = (dd->movement == QListView::Snap ? snapToGrid(end) - snapToGrid(start) : end - start); QList indexes = dd->selectionModel->selectedIndexes(); -- cgit v0.12 From 0047fd3703fcec3afbbaff13e7a2d96d60f3f8f4 Mon Sep 17 00:00:00 2001 From: Jason Barron Date: Thu, 14 Jan 2010 14:20:24 +0100 Subject: Enable surface transparency support on Symbian^4. On Symbian^4 systems where the window supports surface transparency, we use this for the Qt::WA_TranslucentBackground flag instead of the previous method. Task-number: QT-2026 Reviewed-by: Iain --- src/corelib/global/qglobal.h | 4 ++++ src/gui/kernel/qwidget_s60.cpp | 8 ++++++++ 2 files changed, 12 insertions(+) diff --git a/src/corelib/global/qglobal.h b/src/corelib/global/qglobal.h index 52e9845..f350d1a 100644 --- a/src/corelib/global/qglobal.h +++ b/src/corelib/global/qglobal.h @@ -2419,6 +2419,10 @@ QT3_SUPPORT Q_CORE_EXPORT const char *qInstallPathSysconf(); //enabling new graphics resources #define QT_SYMBIAN_SUPPORTS_SGIMAGE #define QT_SYMBIAN_SUPPORTS_ADVANCED_POINTER + +#ifdef SYMBIAN_GRAPHICS_WSERV_QT_EFFECTS +#define Q_SYMBIAN_SEMITRANSPARENT_BG_SURFACE +#endif #endif diff --git a/src/gui/kernel/qwidget_s60.cpp b/src/gui/kernel/qwidget_s60.cpp index 4c0e21e..00f2213 100644 --- a/src/gui/kernel/qwidget_s60.cpp +++ b/src/gui/kernel/qwidget_s60.cpp @@ -389,9 +389,13 @@ void QWidgetPrivate::create_sys(WId window, bool /* initializeWindow */, bool de if (!isOpaque) { RWindow *const window = static_cast(drawableWindow); +#ifdef Q_SYMBIAN_SEMITRANSPARENT_BG_SURFACE + window->SetSurfaceTransparency(true); +#else const TDisplayMode displayMode = static_cast(window->SetRequiredDisplayMode(EColor16MA)); if (window->SetTransparencyAlphaChannel() == KErrNone) window->SetBackgroundColor(TRgb(255, 255, 255, 0)); +#endif } } @@ -707,12 +711,16 @@ void QWidgetPrivate::s60UpdateIsOpaque() RWindow *const window = static_cast(q->effectiveWinId()->DrawableWindow()); +#ifdef Q_SYMBIAN_SEMITRANSPARENT_BG_SURFACE + window->SetSurfaceTransparency(!isOpaque); +#else if (!isOpaque) { const TDisplayMode displayMode = static_cast(window->SetRequiredDisplayMode(EColor16MA)); if (window->SetTransparencyAlphaChannel() == KErrNone) window->SetBackgroundColor(TRgb(255, 255, 255, 0)); } else window->SetTransparentRegion(TRegionFix<1>()); +#endif } void QWidgetPrivate::setWindowIcon_sys(bool forceReset) -- cgit v0.12 From e4953b7262d8122747569efee194b6eb46d40749 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Thu, 14 Jan 2010 16:46:57 +0100 Subject: fix qm generation under windows Reviewed-by: Daniel Molkentin --- translations/translations.pro | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/translations/translations.pro b/translations/translations.pro index ef09dc3..05dd968 100644 --- a/translations/translations.pro +++ b/translations/translations.pro @@ -14,7 +14,7 @@ LIBS = updateqm.input = TRANSLATIONS updateqm.output = ${QMAKE_FILE_BASE}.qm isEmpty(vcproj):updateqm.variable_out = PRE_TARGETDEPS -updateqm.commands = @echo lrelease ${QMAKE_FILE_IN}; $$LRELEASE ${QMAKE_FILE_IN} -qm ${QMAKE_FILE_OUT} +updateqm.commands = @echo lrelease ${QMAKE_FILE_IN} && $$LRELEASE ${QMAKE_FILE_IN} -qm ${QMAKE_FILE_OUT} updateqm.name = LRELEASE ${QMAKE_FILE_IN} updateqm.CONFIG += no_link QMAKE_EXTRA_COMPILERS += updateqm -- cgit v0.12 From 88a07b4c0a3a87eeb47750640cb71a5a64e0573c Mon Sep 17 00:00:00 2001 From: Warwick Allison Date: Thu, 14 Jan 2010 16:13:10 +1000 Subject: Fix tst_qmlgraphicstext::letterSpacing tst_qmlgraphicstext::wordSpacing Sent for review into 4.6. Task-number: QTBUG-7326 Signed-off-by: Simon Hausmann --- src/gui/text/qfont.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/gui/text/qfont.cpp b/src/gui/text/qfont.cpp index 4c57dff..bbd35f1 100644 --- a/src/gui/text/qfont.cpp +++ b/src/gui/text/qfont.cpp @@ -1614,7 +1614,11 @@ bool QFont::operator==(const QFont &f) const && f.d->overline == d->overline && f.d->strikeOut == d->strikeOut && f.d->kerning == d->kerning - && f.d->capital == d->capital)); + && f.d->capital == d->capital + && f.d->letterSpacingIsAbsolute == d->letterSpacingIsAbsolute + && f.d->letterSpacing == d->letterSpacing + && f.d->wordSpacing == d->wordSpacing + )); } @@ -1648,6 +1652,10 @@ bool QFont::operator<(const QFont &f) const #endif // Q_WS_X11 if (f.d->capital != d->capital) return f.d->capital < d->capital; + if (f.d->letterSpacingIsAbsolute != d->letterSpacingIsAbsolute) return f.d->letterSpacingIsAbsolute < d->letterSpacingIsAbsolute; + if (f.d->letterSpacing != d->letterSpacing) return f.d->letterSpacing < d->letterSpacing; + if (f.d->wordSpacing != d->wordSpacing) return f.d->wordSpacing < d->wordSpacing; + int f1attrs = (f.d->underline << 3) + (f.d->overline << 2) + (f.d->strikeOut<<1) + f.d->kerning; int f2attrs = (d->underline << 3) + (d->overline << 2) + (d->strikeOut<<1) + d->kerning; return f1attrs < f2attrs; -- cgit v0.12 From 2d0bd1a13328d5a5ed6c4d1e768937a6627f1086 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Abecasis?= Date: Tue, 12 Jan 2010 19:14:56 +0100 Subject: QFile::remove: don't fail for unrelated errors remove was checking for errors from close, but without clearing the error state beforehand it ended picking unrelated errors. Task-number: QTBUG-7285 Reviewed-by: qCaro --- src/corelib/io/qfile.cpp | 1 + tests/auto/qtemporaryfile/tst_qtemporaryfile.cpp | 36 ++++++++++++++++++++++++ 2 files changed, 37 insertions(+) diff --git a/src/corelib/io/qfile.cpp b/src/corelib/io/qfile.cpp index 6395cc7..4c7f3f0 100644 --- a/src/corelib/io/qfile.cpp +++ b/src/corelib/io/qfile.cpp @@ -643,6 +643,7 @@ QFile::remove() qWarning("QFile::remove: Empty or null file name"); return false; } + unsetError(); close(); if(error() == QFile::NoError) { if(fileEngine()->remove()) { diff --git a/tests/auto/qtemporaryfile/tst_qtemporaryfile.cpp b/tests/auto/qtemporaryfile/tst_qtemporaryfile.cpp index c781108..1304f4e 100644 --- a/tests/auto/qtemporaryfile/tst_qtemporaryfile.cpp +++ b/tests/auto/qtemporaryfile/tst_qtemporaryfile.cpp @@ -95,6 +95,7 @@ private slots: void keepOpenMode(); void resetTemplateAfterError(); void setTemplateAfterOpen(); + void autoRemoveAfterFailedRename(); public: }; @@ -558,5 +559,40 @@ void tst_QTemporaryFile::setTemplateAfterOpen() QCOMPARE( temp.fileTemplate(), newTemplate ); } +void tst_QTemporaryFile::autoRemoveAfterFailedRename() +{ + struct CleanOnReturn + { + ~CleanOnReturn() + { + if (!tempName.isEmpty()) + QFile::remove(tempName); + } + + void reset() + { + tempName.clear(); + } + + QString tempName; + }; + + CleanOnReturn cleaner; + + { + QTemporaryFile file; + QVERIFY( file.open() ); + cleaner.tempName = file.fileName(); + + QVERIFY( QFile::exists(cleaner.tempName) ); + QVERIFY( !QFileInfo("i-do-not-exist").isDir() ); + QVERIFY( !file.rename("i-do-not-exist/file.txt") ); + QVERIFY( QFile::exists(cleaner.tempName) ); + } + + QVERIFY( !QFile::exists(cleaner.tempName) ); + cleaner.reset(); +} + QTEST_MAIN(tst_QTemporaryFile) #include "tst_qtemporaryfile.moc" -- cgit v0.12 From 24a7ea490394d5a1df0dfb323c8733d3ee76b539 Mon Sep 17 00:00:00 2001 From: Kurt Korbatits Date: Fri, 15 Jan 2010 13:45:37 +1000 Subject: Fixed error in unit test xml file. Entry was qaudiodeviceid instead of qaudiodeviceinfo. Reviewed-by:Justin McPherson --- tests/auto/tests.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/auto/tests.xml b/tests/auto/tests.xml index f197de0..efbc4b0 100644 --- a/tests/auto/tests.xml +++ b/tests/auto/tests.xml @@ -272,7 +272,7 @@ - + -- cgit v0.12 From 4021faeaea0b6d0b35724c91b56b074c4a7c4410 Mon Sep 17 00:00:00 2001 From: Rohan McGovern Date: Fri, 15 Jan 2010 14:23:00 +1000 Subject: Remove unused file. --- tests/auto/tests.xml | 821 --------------------------------------------------- 1 file changed, 821 deletions(-) delete mode 100644 tests/auto/tests.xml diff --git a/tests/auto/tests.xml b/tests/auto/tests.xml deleted file mode 100644 index f197de0..0000000 --- a/tests/auto/tests.xml +++ /dev/null @@ -1,821 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -- cgit v0.12 From 9ba9308a997bac90c30b766a48f44451e86e14d9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Trond=20Kjern=C3=A5sen?= Date: Fri, 15 Jan 2010 10:28:34 +0100 Subject: Fixed the encoding of the Tile and Creator tags in the PDF engine. Task-number: QTBUG-7249 Reviewed-by: Kim --- src/gui/painting/qprintengine_pdf.cpp | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/src/gui/painting/qprintengine_pdf.cpp b/src/gui/painting/qprintengine_pdf.cpp index e3a2461..b8bf15e 100644 --- a/src/gui/painting/qprintengine_pdf.cpp +++ b/src/gui/painting/qprintengine_pdf.cpp @@ -931,14 +931,24 @@ void QPdfEnginePrivate::writeHeader() void QPdfEnginePrivate::writeInfo() { info = addXrefEntry(-1); - xprintf("<<\n" - "/Title (%s)\n" -// "/Author (%s)\n" - "/Creator (%s)\n" - "/Producer (Qt " QT_VERSION_STR " (C) 2009 Nokia Corporation and/or its subsidiary(-ies))\n", - title.toUtf8().constData(), -// author.toUtf8().constData(), - creator.toUtf8().constData()); + + // The 'text string' type in PDF is encoded either as PDFDocEncoding, or + // Unicode UTF-16 with a Unicode byte order mark as the first character + // (0xfeff), with the high-order byte first. + QByteArray array("<<\n/Title (\xfe\xff"); + const ushort *utf16Title = title.utf16(); + for (int i=0; i < title.size(); ++i) { + array.append((*(utf16Title + i)) >> 8); + array.append((*(utf16Title + i)) & 0xff); + } + array.append(")\n/Creator (\xfe\xff"); + const ushort *utf16Creator = creator.utf16(); + for (int i=0; i < creator.size(); ++i) { + array.append((*(utf16Creator + i)) >> 8); + array.append((*(utf16Creator + i)) & 0xff); + } + array.append(")\n/Producer (Qt " QT_VERSION_STR " (C) 2010 Nokia Corporation and/or its subsidiary(-ies))\n"); + write(array); QDateTime now = QDateTime::currentDateTime().toUTC(); QTime t = now.time(); -- cgit v0.12 From 3f396bdd8736014957ff2491d01ec495034c5c88 Mon Sep 17 00:00:00 2001 From: Adrian Constantin Date: Tue, 12 Jan 2010 16:10:34 +0200 Subject: Adding texture glyph cache default. In maemo mkspec added the definition QT_DEFAULT_TEXTURE_GLYPH_CACHE_WIDTH=1024. When sgx fix will be delivered remove from maemo mkspec that definition. Reviewed-by: Stefano Pironato Reviewed-by: Tom Cooksey --- mkspecs/linux-g++-maemo/qmake.conf | 2 ++ 1 file changed, 2 insertions(+) diff --git a/mkspecs/linux-g++-maemo/qmake.conf b/mkspecs/linux-g++-maemo/qmake.conf index b0f3ca3..38c26a6 100644 --- a/mkspecs/linux-g++-maemo/qmake.conf +++ b/mkspecs/linux-g++-maemo/qmake.conf @@ -29,5 +29,7 @@ QMAKE_CXXFLAGS_RELEASE += -g -fno-omit-frame-pointer -fno-optimize-sibling-call # Work round PowerVR SGX 1.3 driver bug with glScissor & FBOs: DEFINES += QT_GL_NO_SCISSOR_TEST +# Work round SGX 1.4 driver bug (text corrupted), modify glyph cache width: +DEFINES += QT_DEFAULT_TEXTURE_GLYPH_CACHE_WIDTH=1024 load(qt_config) -- cgit v0.12 From 001ebdf49623641048122189d81cdbfe70652a52 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Trond=20Kjern=C3=A5sen?= Date: Fri, 15 Jan 2010 13:28:17 +0100 Subject: Clarify the docs slightly for QPainter::beginNativePainting(). Some complain that we don't reset every GL state in the GL engine in endNativePainting(). We simply can't do that as it would be a performance bump. The user is responsible for setting states they themselves change in a begin/endNativePainting() block, back to their default state. --- src/gui/painting/qpainter.cpp | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/src/gui/painting/qpainter.cpp b/src/gui/painting/qpainter.cpp index a98ac10..a9dcea0 100644 --- a/src/gui/painting/qpainter.cpp +++ b/src/gui/painting/qpainter.cpp @@ -1984,9 +1984,14 @@ QPaintEngine *QPainter::paintEngine() const /*! \since 4.6 - Flushes the painting pipeline and prepares for the user issuing - commands directly to the underlying graphics context. Must be - followed by a call to endNativePainting(). + Flushes the painting pipeline and prepares for the user issuing commands + directly to the underlying graphics context. Must be followed by a call to + endNativePainting(). + + Note that only the states the underlying paint engine changes will be reset + to their respective default states. If, for example, the OpenGL polygon + mode is changed by the user inside a beginNativePaint()/endNativePainting() + block, it will not be reset to the default state by endNativePainting(). Here is an example that shows intermixing of painter commands and raw OpenGL commands: @@ -2010,9 +2015,9 @@ void QPainter::beginNativePainting() /*! \since 4.6 - Restores the painter after manually issuing native painting commands. - Lets the painter restore any native state that it relies on before - calling any other painter commands. + Restores the painter after manually issuing native painting commands. Lets + the painter restore any native state that it relies on before calling any + other painter commands. \sa beginNativePainting() */ -- cgit v0.12 From 13d9af283210acf4e8e46075fda2104c20aceb7a Mon Sep 17 00:00:00 2001 From: Harald Fernengel Date: Fri, 15 Jan 2010 14:16:48 +0100 Subject: use same small color dialog on S60 and Maemo 5 Reviewed-By: Jason Barron --- src/gui/dialogs/qcolordialog.cpp | 45 +++++++++++++++++++++++++--------------- 1 file changed, 28 insertions(+), 17 deletions(-) diff --git a/src/gui/dialogs/qcolordialog.cpp b/src/gui/dialogs/qcolordialog.cpp index e9031ac..83ecc30 100644 --- a/src/gui/dialogs/qcolordialog.cpp +++ b/src/gui/dialogs/qcolordialog.cpp @@ -68,6 +68,10 @@ #include "private/qt_s60_p.h" #endif +#if defined(Q_WS_S60) || defined(Q_WS_MAEMO_5) +# define QT_SMALL_COLORDIALOG +#endif + QT_BEGIN_NAMESPACE //////////// QWellArray BEGIN @@ -1072,14 +1076,17 @@ QColorShower::QColorShower(QColorDialog *parent) gl->setMargin(gl->spacing()); lab = new QColorShowLabel(this); -#ifdef Q_WS_S60 +#ifdef QT_SMALL_COLORDIALOG +# ifdef Q_WS_S60 QS60Data s60Data = QS60Data(); const bool nonTouchUI = !s60Data.hasTouchscreen; +# elif defined Q_WS_MAEMO_5 + const bool nonTouchUI = false; +# endif #endif - #ifndef Q_WS_WINCE -#ifdef Q_WS_S60 +#ifdef QT_SMALL_COLORDIALOG lab->setMinimumHeight(60); #endif lab->setMinimumWidth(60); @@ -1090,7 +1097,7 @@ QColorShower::QColorShower(QColorDialog *parent) // In S60, due to small screen and different screen layouts need to re-arrange the widgets. // For QVGA screens only the comboboxes and color label are visible. // For nHD screens only color and luminence pickers and color label are visible. -#ifndef Q_WS_S60 +#if !defined(QT_SMALL_COLORDIALOG) gl->addWidget(lab, 0, 0, -1, 1); #else if (nonTouchUI) @@ -1108,7 +1115,7 @@ QColorShower::QColorShower(QColorDialog *parent) lblHue->setBuddy(hEd); #endif lblHue->setAlignment(Qt::AlignRight|Qt::AlignVCenter); -#ifndef Q_WS_S60 +#if !defined(QT_SMALL_COLORDIALOG) gl->addWidget(lblHue, 0, 1); gl->addWidget(hEd, 0, 2); #else @@ -1127,7 +1134,7 @@ QColorShower::QColorShower(QColorDialog *parent) lblSat->setBuddy(sEd); #endif lblSat->setAlignment(Qt::AlignRight|Qt::AlignVCenter); -#ifndef Q_WS_S60 +#if !defined(QT_SMALL_COLORDIALOG) gl->addWidget(lblSat, 1, 1); gl->addWidget(sEd, 1, 2); #else @@ -1146,7 +1153,7 @@ QColorShower::QColorShower(QColorDialog *parent) lblVal->setBuddy(vEd); #endif lblVal->setAlignment(Qt::AlignRight|Qt::AlignVCenter); -#ifndef Q_WS_S60 +#if !defined(QT_SMALL_COLORDIALOG) gl->addWidget(lblVal, 2, 1); gl->addWidget(vEd, 2, 2); #else @@ -1165,7 +1172,7 @@ QColorShower::QColorShower(QColorDialog *parent) lblRed->setBuddy(rEd); #endif lblRed->setAlignment(Qt::AlignRight|Qt::AlignVCenter); -#ifndef Q_WS_S60 +#if !defined(QT_SMALL_COLORDIALOG) gl->addWidget(lblRed, 0, 3); gl->addWidget(rEd, 0, 4); #else @@ -1184,7 +1191,7 @@ QColorShower::QColorShower(QColorDialog *parent) lblGreen->setBuddy(gEd); #endif lblGreen->setAlignment(Qt::AlignRight|Qt::AlignVCenter); -#ifndef Q_WS_S60 +#if !defined(QT_SMALL_COLORDIALOG) gl->addWidget(lblGreen, 1, 3); gl->addWidget(gEd, 1, 4); #else @@ -1203,7 +1210,7 @@ QColorShower::QColorShower(QColorDialog *parent) lblBlue->setBuddy(bEd); #endif lblBlue->setAlignment(Qt::AlignRight|Qt::AlignVCenter); -#ifndef Q_WS_S60 +#if !defined(QT_SMALL_COLORDIALOG) gl->addWidget(lblBlue, 2, 3); gl->addWidget(bEd, 2, 4); #else @@ -1222,7 +1229,7 @@ QColorShower::QColorShower(QColorDialog *parent) alphaLab->setBuddy(alphaEd); #endif alphaLab->setAlignment(Qt::AlignRight|Qt::AlignVCenter); -#ifndef Q_WS_S60 +#if !defined(QT_SMALL_COLORDIALOG) gl->addWidget(alphaLab, 3, 1, 1, 3); gl->addWidget(alphaEd, 3, 4); #else @@ -1467,7 +1474,7 @@ void QColorDialogPrivate::init(const QColor &initial) leftLay = 0; -#if (defined(Q_WS_WINCE) || defined(Q_WS_S60)) +#if defined(Q_WS_WINCE) || defined(QT_SMALL_COLORDIALOG) smallDisplay = true; const int lumSpace = 20; #else @@ -1497,9 +1504,13 @@ void QColorDialogPrivate::init(const QColor &initial) } #endif -#if defined(Q_WS_S60) +#if defined(QT_SMALL_COLORDIALOG) +# if defined(Q_WS_S60) QS60Data s60Data = QS60Data(); const bool nonTouchUI = !s60Data.hasTouchscreen; +# elif defined(Q_WS_MAEMO_5) + const bool nonTouchUI = false; +# endif #endif if (!smallDisplay) { @@ -1532,7 +1543,7 @@ void QColorDialogPrivate::init(const QColor &initial) leftLay->addWidget(addCusBt); } else { // better color picker size for small displays -#ifdef Q_WS_S60 +#if defined(QT_SMALL_COLORDIALOG) QSize screenSize = QApplication::desktop()->availableGeometry(QCursor::pos()).size(); pWidth = pHeight = qMin(screenSize.width(), screenSize.height()); pHeight -= 20; @@ -1558,7 +1569,7 @@ void QColorDialogPrivate::init(const QColor &initial) cp->setFrameStyle(QFrame::Panel + QFrame::Sunken); -#if defined(Q_WS_S60) +#if defined(QT_SMALL_COLORDIALOG) if (!nonTouchUI) { pickLay->addWidget(cp); cLay->addSpacing(lumSpace); @@ -1572,7 +1583,7 @@ void QColorDialogPrivate::init(const QColor &initial) cLay->addSpacing(lumSpace); lp = new QColorLuminancePicker(q); -#if defined(Q_WS_S60) +#if defined(QT_SMALL_COLORDIALOG) QSize screenSize = QApplication::desktop()->availableGeometry(QCursor::pos()).size(); const int minDimension = qMin(screenSize.height(), screenSize.width()); //set picker to be finger-usable @@ -1596,7 +1607,7 @@ void QColorDialogPrivate::init(const QColor &initial) QObject::connect(cs, SIGNAL(newCol(QRgb)), q, SLOT(_q_newColorTypedIn(QRgb))); QObject::connect(cs, SIGNAL(currentColorChanged(QColor)), q, SIGNAL(currentColorChanged(QColor))); -#if defined(Q_WS_S60) +#if defined(QT_SMALL_COLORDIALOG) if (!nonTouchUI) pWidth -= cp->size().width(); topLay->addWidget(cs); -- cgit v0.12 From 7e22fb22acffe1d0f101a8ab3ef05a4ef7ad9b83 Mon Sep 17 00:00:00 2001 From: Jens Bache-Wiig Date: Fri, 15 Jan 2010 15:10:08 +0100 Subject: Fixes: Cosmetic fix for maemo spin box Reviewed-by: rgriebl Description: We pass the wrong gtk style the the background. For most desktop styles this has no affect, but it breaks on Hildon. --- src/gui/styles/qgtkstyle.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/styles/qgtkstyle.cpp b/src/gui/styles/qgtkstyle.cpp index abb9e1e..211f4ce 100644 --- a/src/gui/styles/qgtkstyle.cpp +++ b/src/gui/styles/qgtkstyle.cpp @@ -1377,7 +1377,7 @@ void QGtkStyle::drawComplexControl(ComplexControl control, const QStyleOptionCom else { gtkCachedPainter.paintFlatBox(gtkEntry, "entry_bg", contentRect, option->state & State_Enabled ? GTK_STATE_NORMAL : GTK_STATE_INSENSITIVE, - GTK_SHADOW_NONE, gtkCombo->style, entryPath + QString::number(focus)); + GTK_SHADOW_NONE, gtkEntry->style, entryPath + QString::number(focus)); } gtkCachedPainter.paintShadow(gtkEntry, comboBox->editable ? "entry" : "frame", frameRect, frameState, -- cgit v0.12 From fdf827381a5e27c1c4ff6e075196befe88440fb2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Trond=20Kjern=C3=A5sen?= Date: Fri, 15 Jan 2010 16:50:54 +0100 Subject: Avoid an unnecessary copy in QImage::scaled(). This comes from the dark ages of Qt 3.x, where QImage was an explicitly shared class. Task-number: QTBUG-7231 Reviewed-by: Kim --- src/gui/image/qimage.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/image/qimage.cpp b/src/gui/image/qimage.cpp index 4e10b5b..4f5efa1 100644 --- a/src/gui/image/qimage.cpp +++ b/src/gui/image/qimage.cpp @@ -3992,7 +3992,7 @@ QImage QImage::scaled(const QSize& s, Qt::AspectRatioMode aspectMode, Qt::Transf QSize newSize = size(); newSize.scale(s, aspectMode); if (newSize == size()) - return copy(); + return *this; QTransform wm = QTransform::fromScale((qreal)newSize.width() / width(), (qreal)newSize.height() / height()); QImage img = transformed(wm, mode); -- cgit v0.12 From 51fe84689320f9443117196fec2ee25c6353b79b Mon Sep 17 00:00:00 2001 From: David Boddie Date: Fri, 15 Jan 2010 17:10:37 +0100 Subject: Doc: Added placeholder pages for new examples and updated the overviews. Reviewed-by: Trust Me --- doc/src/examples/graphicsview-anchorlayout.qdoc | 48 +++ doc/src/examples/graphicsview-flowlayout.qdoc | 50 +++ .../examples/graphicsview-simpleanchorlayout.qdoc | 48 +++ .../examples/graphicsview-weatheranchorlayout.qdoc | 48 +++ doc/src/examples/network-download.qdoc | 53 +++ doc/src/examples/network-downloadmanager.qdoc | 53 +++ doc/src/examples/script-marshal.qdoc | 48 +++ doc/src/examples/script-qscript.qdoc | 48 +++ doc/src/examples/script-qsdbg.qdoc | 48 +++ doc/src/examples/webkit-framecapture.qdoc | 51 +++ doc/src/examples/widgets-softkeys.qdoc | 47 +++ doc/src/examples/widgets-validators.qdoc | 47 +++ doc/src/getting-started/examples.qdoc | 377 ++++++++++++++------- tools/qdoc3/test/macros.qdocconf | 2 +- 14 files changed, 836 insertions(+), 132 deletions(-) create mode 100644 doc/src/examples/graphicsview-anchorlayout.qdoc create mode 100644 doc/src/examples/graphicsview-flowlayout.qdoc create mode 100644 doc/src/examples/graphicsview-simpleanchorlayout.qdoc create mode 100644 doc/src/examples/graphicsview-weatheranchorlayout.qdoc create mode 100644 doc/src/examples/network-download.qdoc create mode 100644 doc/src/examples/network-downloadmanager.qdoc create mode 100644 doc/src/examples/script-marshal.qdoc create mode 100644 doc/src/examples/script-qscript.qdoc create mode 100644 doc/src/examples/script-qsdbg.qdoc create mode 100644 doc/src/examples/webkit-framecapture.qdoc create mode 100644 doc/src/examples/widgets-softkeys.qdoc create mode 100644 doc/src/examples/widgets-validators.qdoc diff --git a/doc/src/examples/graphicsview-anchorlayout.qdoc b/doc/src/examples/graphicsview-anchorlayout.qdoc new file mode 100644 index 0000000..96a255c --- /dev/null +++ b/doc/src/examples/graphicsview-anchorlayout.qdoc @@ -0,0 +1,48 @@ +/**************************************************************************** +** +** 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 documentation 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$ +** +****************************************************************************/ + +/*! + \example graphicsview/anchorlayout + \title Anchor Layout Example + + The Anchor Layout example demonstrates the use of the QGraphicsAnchorLayout + class. +*/ diff --git a/doc/src/examples/graphicsview-flowlayout.qdoc b/doc/src/examples/graphicsview-flowlayout.qdoc new file mode 100644 index 0000000..5b73069 --- /dev/null +++ b/doc/src/examples/graphicsview-flowlayout.qdoc @@ -0,0 +1,50 @@ +/**************************************************************************** +** +** 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 documentation 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$ +** +****************************************************************************/ + +/*! + \example graphicsview/flowlayout + \title Graphics View Flow Layout Example + + The Graphics View Flow Layout example shows the use of a flow layout + in a Graphics View widget. + + See the \l{Flow Layout Example} for a corresponding widget-based example. +*/ diff --git a/doc/src/examples/graphicsview-simpleanchorlayout.qdoc b/doc/src/examples/graphicsview-simpleanchorlayout.qdoc new file mode 100644 index 0000000..ddfc854 --- /dev/null +++ b/doc/src/examples/graphicsview-simpleanchorlayout.qdoc @@ -0,0 +1,48 @@ +/**************************************************************************** +** +** 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 documentation 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$ +** +****************************************************************************/ + +/*! + \example graphicsview/simpleanchorlayout + \title Simple Anchor Layout Example + + The Simple Anchor Layout example shows the basic use of the + QGraphicsAnchorLayout class. +*/ diff --git a/doc/src/examples/graphicsview-weatheranchorlayout.qdoc b/doc/src/examples/graphicsview-weatheranchorlayout.qdoc new file mode 100644 index 0000000..930c5c0 --- /dev/null +++ b/doc/src/examples/graphicsview-weatheranchorlayout.qdoc @@ -0,0 +1,48 @@ +/**************************************************************************** +** +** 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 documentation 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$ +** +****************************************************************************/ + +/*! + \example graphicsview/weatheranchorlayout + \title Weather Anchor Layout Example + + The Weather Anchor Layout example shows more complex use of the + QGraphicsAnchorLayout class to create a real-world window layout. +*/ diff --git a/doc/src/examples/network-download.qdoc b/doc/src/examples/network-download.qdoc new file mode 100644 index 0000000..3481cad --- /dev/null +++ b/doc/src/examples/network-download.qdoc @@ -0,0 +1,53 @@ +/**************************************************************************** +** +** 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 documentation 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$ +** +****************************************************************************/ + +/*! + \example network/download + \title Network Download Example + + The Network Download example shows how to perform multiple downloads in + parallel using the QNetworkAccessManager class. + + This example is designed to be run from the command line. + + The \l{Network Download Manager Example} implements a more complex system + that places files in a queue for sequential downloading. +*/ diff --git a/doc/src/examples/network-downloadmanager.qdoc b/doc/src/examples/network-downloadmanager.qdoc new file mode 100644 index 0000000..8040c24 --- /dev/null +++ b/doc/src/examples/network-downloadmanager.qdoc @@ -0,0 +1,53 @@ +/**************************************************************************** +** +** 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 documentation 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$ +** +****************************************************************************/ + +/*! + \example network/downloadmanager + \title Network Download Manager Example + + The Network Download example shows how to implement a queue for multiple + downloads using the QNetworkAccessManager class. + + This example is designed to be run from the command line. + + See the \l{Network Download Example} for a simpler version of this example + that obtains multiple files in parallel. +*/ diff --git a/doc/src/examples/script-marshal.qdoc b/doc/src/examples/script-marshal.qdoc new file mode 100644 index 0000000..30c8f97 --- /dev/null +++ b/doc/src/examples/script-marshal.qdoc @@ -0,0 +1,48 @@ +/**************************************************************************** +** +** 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 documentation 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$ +** +****************************************************************************/ + +/*! + \example script/marshal + \title Qt Script Marshalling Example + + The Qt Script Marshalling example demonstrates the marshalling of value + types between C++ and Qt Script. +*/ diff --git a/doc/src/examples/script-qscript.qdoc b/doc/src/examples/script-qscript.qdoc new file mode 100644 index 0000000..1d0d12c --- /dev/null +++ b/doc/src/examples/script-qscript.qdoc @@ -0,0 +1,48 @@ +/**************************************************************************** +** +** 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 documentation 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$ +** +****************************************************************************/ + +/*! + \example script/qscript + \title Qt Script Interpreter Example + + The Qt Script Interpreter example shows how to create an interactive + interpreter for Qt Script. +*/ diff --git a/doc/src/examples/script-qsdbg.qdoc b/doc/src/examples/script-qsdbg.qdoc new file mode 100644 index 0000000..332740f --- /dev/null +++ b/doc/src/examples/script-qsdbg.qdoc @@ -0,0 +1,48 @@ +/**************************************************************************** +** +** 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 documentation 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$ +** +****************************************************************************/ + +/*! + \example script/qsdbg + \title Qt Script Debugger Example + + The Qt Script Debugger example shows how to enable the Qt Script debugger + for command line debugging. +*/ diff --git a/doc/src/examples/webkit-framecapture.qdoc b/doc/src/examples/webkit-framecapture.qdoc new file mode 100644 index 0000000..cf4e3da --- /dev/null +++ b/doc/src/examples/webkit-framecapture.qdoc @@ -0,0 +1,51 @@ +/**************************************************************************** +** +** 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 documentation 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$ +** +****************************************************************************/ + +/*! + \example webkit/framecapture + \title WebKit Frame Capture Example + + The Frame Capture example shows how to use the WebKit browser engine to + obtain images of frames in a Web page. + + This example is designed to be run from the command line. Run the + example without arguments to obtain usage information. +*/ diff --git a/doc/src/examples/widgets-softkeys.qdoc b/doc/src/examples/widgets-softkeys.qdoc new file mode 100644 index 0000000..3afb930 --- /dev/null +++ b/doc/src/examples/widgets-softkeys.qdoc @@ -0,0 +1,47 @@ +/**************************************************************************** +** +** 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 documentation 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$ +** +****************************************************************************/ + +/*! + \example widgets/softkeys + \title Soft Keys Example + + The Soft Keys example shows how to use soft key input on the Symbian platform. +*/ diff --git a/doc/src/examples/widgets-validators.qdoc b/doc/src/examples/widgets-validators.qdoc new file mode 100644 index 0000000..0bdd6e6 --- /dev/null +++ b/doc/src/examples/widgets-validators.qdoc @@ -0,0 +1,47 @@ +/**************************************************************************** +** +** 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 documentation 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$ +** +****************************************************************************/ + +/*! + \example widgets/validators + \title Validators Example + + The Validators example shows the signal emission behavior of input validators. +*/ diff --git a/doc/src/getting-started/examples.qdoc b/doc/src/getting-started/examples.qdoc index 1477829..2582c4f 100644 --- a/doc/src/getting-started/examples.qdoc +++ b/doc/src/getting-started/examples.qdoc @@ -74,13 +74,12 @@ \l{Qt Demonstrations}{selection of demos} that deliberately show off Qt's features. You might want to look at these as well. - \table - \row - \o{2,1} \l{Widgets Examples}{\bold Widgets} - \o{2,1} \l{Dialog Examples}{\bold Dialogs} - \row - \o \image widget-examples.png - \o + \section1 \l{Widgets Examples}{Widgets} + \beginfloatleft + \l{Widgets Examples}{\inlineimage widget-examples.png + } + + \endfloat Qt comes with a large range of standard widgets that users of modern applications have come to expect. You can also develop your own custom widgets and controls, and use them alongside standard widgets. @@ -89,28 +88,39 @@ be used to change the appearance of standard widgets and appropriately written custom widgets. - \o \image dialog-examples.png Dialogs - \o + \clearfloat + \section1 \l{Dialog Examples}{Dialogs} + \beginfloatleft + \l{Dialog Examples}{\inlineimage dialog-examples.png + } + + \endfloat Qt includes standard dialogs for many common operations, such as file selection, printing, and color selection. Custom dialogs can also be created for specialized modal or modeless interactions with users. - \row - \o{2,1} \l{Main Window Examples}{\bold{Main Windows}} - \o{2,1} \l{Layout Examples}{\bold Layouts} + \clearfloat + \section1 \l{Main Window Examples}{Main Windows} + \beginfloatleft + \l{Main Window Examples}{\inlineimage mainwindow-examples.png + } - \row - \o \image mainwindow-examples.png MainWindows - \o All the standard features of application main windows are provided by Qt. + \endfloat + All the standard features of application main windows are provided by Qt. Main windows can have pull down menus, tool bars, and dock windows. These separate forms of user input are unified in an integrated action system that also supports keyboard shortcuts and accelerator keys in menu items. - \o \image layout-examples.png Layouts - \o + \clearfloat + \section1 \l{Layout Examples}{Layouts} + \beginfloatleft + \l{Layout Examples}{\inlineimage layout-examples.png + } + + \endfloat Qt uses a layout-based approach to widget management. Widgets are arranged in the optimal positions in windows based on simple layout rules, leading to a consistent look and feel. @@ -118,45 +128,58 @@ Custom layouts can be used to provide more control over the positions and sizes of child widgets. - \row - \o{2,1} \l{Item Views Examples}{\bold{Item Views}} - \o{2,1} \l{Graphics View Examples}{\bold{Graphics View}} - \row - \o \image itemview-examples.png ItemViews - \o + \clearfloat + \section1 \l{Item Views Examples}{Item Views} + \beginfloatleft + \l{Item Views Examples}{\inlineimage itemview-examples.png + } + + \endfloat Item views are widgets that typically display data sets. Qt 4's model/view framework lets you handle large data sets by separating the underlying data from the way it is represented to the user, and provides support for customized rendering through the use of delegates. - \o \image graphicsview-examples.png GraphicsView - \o + \clearfloat + \section1 \l{Graphics View Examples}{Graphics View} + \beginfloatleft + \l{Graphics View Examples}{\inlineimage graphicsview-examples.png + } + + \endfloat Qt is provided with a comprehensive canvas through the GraphicsView classes. - \row - \o{2,1} \l{Painting Examples}{\bold{Painting}} - \o{2,1} \l{Rich Text Examples}{\bold{Rich Text}} - \row - \o \image painting-examples.png Painting - \o + \clearfloat + \section1 \l{Painting Examples}{Painting} + \beginfloatleft + \l{Painting Examples}{\inlineimage painting-examples.png + } + + \endfloat Qt's painting system is able to render vector graphics, images, and outline font-based text with sub-pixel accuracy accuracy using anti-aliasing to improve rendering quality. - \o \image richtext-examples.png RichText - \o + \clearfloat + \section1 \l{Rich Text Examples}{Rich Text} + \beginfloatleft + \l{Rich Text Examples}{\inlineimage richtext-examples.png + } + + \endfloat Qt provides powerful document-oriented rich text engine that supports Unicode and right-to-left scripts. Documents can be manipulated using a cursor-based API, and their contents can be imported and exported as both HTML and in a custom XML format. - \row - \o{2,1} \l{Desktop Examples}{\bold Desktop} - \o{2,1} \l{Drag and Drop Examples}{\bold{Drag and Drop}} - \row - \o \image desktop-examples.png - \o + \clearfloat + \section1 \l{Desktop Examples}{Desktop} + \beginfloatleft + \l{Desktop Examples}{\inlineimage desktop-examples.png + } + + \endfloat Qt provides features to enable applications to integrate with the user's preferred desktop environment. @@ -164,20 +187,26 @@ support for desktop services can be used to improve the appearance of applications and take advantage of underlying desktop facilities. - \o \image draganddrop-examples.png DragAndDrop - \o + \clearfloat + \section1 \l{Drag and Drop Examples}{Drag and Drop} + \beginfloatleft + \l{Drag and Drop Examples}{\inlineimage draganddrop-examples.png + } + + \endfloat Qt supports native drag and drop on all platforms via an extensible MIME-based system that enables applications to send data to each other in the most appropriate formats. Drag and drop can also be implemented for internal use by applications. - \row - \o{2,1} \l{Threading and Concurrent Programming Examples}{\bold{Threading and Concurrent Programming}} - \o{2,1} \l{Tools Examples}{\bold{Tools}} - \row - \o \image thread-examples.png - \o + \clearfloat + \section1 \l{Threading and Concurrent Programming Examples}{Threading and Concurrent Programming} + \beginfloatleft + \l{Threading and Concurrent Programming Examples}{\inlineimage thread-examples.png + } + + \endfloat Qt 4 makes it easier than ever to write multithreaded applications. More classes have been made usable from non-GUI threads, and the signals and slots mechanism can now be used to communicate between threads. @@ -185,32 +214,46 @@ The QtConcurrent namespace includes a collection of classes and functions for straightforward concurrent programming. - \o \image tool-examples.png Tools - \o + \clearfloat + \section1 \l{Tools Examples}{Tools} + \beginfloatleft + \l{Tools Examples}{\inlineimage tool-examples.png + } + + \endfloat Qt is equipped with a range of capable tool classes, from containers and iterators to classes for string handling and manipulation. Other classes provide application infrastructure support, handling plugin loading and managing configuration files. - \row - \o{2,1} \l{Network Examples}{\bold{Network}} - \o{2,1} \l{Inter-Process Communication Examples}{\bold{Inter-Process Communication}} - \row - \o \image network-examples.png Network - \o + \clearfloat + \section1 \l{Network Examples}{Network} + \beginfloatleft + \l{Network Examples}{\inlineimage network-examples.png + } + + \endfloat Qt is provided with an extensive set of network classes to support both client-based and server side network programming. - \o \image ipc-examples.png IPC - \o + \clearfloat + \section1 \l{Inter-Process Communication Examples}{Inter-Process Communication} + \beginfloatleft + \l{Inter-Process Communication Examples}{\inlineimage ipc-examples.png + } - \row - \o{2,1} \l{OpenGL Examples}{\bold{OpenGL}}\bold{ and }\l{OpenVG Examples}{\bold{OpenVG}}\bold{ Examples} - \o{2,1} \l{Multimedia Examples}{\bold{Multimedia Framework}} - \row - \o \image opengl-examples.png OpenGL - \o + \endfloat + Simple, lightweight inter-process communication can be performed using shared + memory and local sockets. + + \clearfloat + \section1 \l{OpenGL Examples}{OpenGL} and \l{OpenVG Examples}{OpenVG} Examples + \beginfloatleft + \l{OpenGL Examples}{\inlineimage opengl-examples.png + } + + \endfloat Qt provides support for integration with OpenGL implementations on all platforms, giving developers the opportunity to display hardware accelerated 3D graphics alongside a more conventional user interface. @@ -218,137 +261,191 @@ Qt provides support for integration with OpenVG implementations on platforms with suitable drivers. - \o \image phonon-examples.png - \o + \clearfloat + \section1 \l{Multimedia Examples}{Multimedia Framework} + \beginfloatleft + \l{Multimedia Examples}{\inlineimage phonon-examples.png + } + + \endfloat Qt provides low-level audio support on linux,windows and mac platforms by default and an audio plugin API to allow developers to implement there own audio support for custom devices and platforms. The Phonon Multimedia Framework brings multimedia support to Qt applications. - \row - \o{2,1} \l{SQL Examples}{\bold{SQL}} - \o{2,1} \l{XML Examples}{\bold{XML}} - \row - \o \image sql-examples.png SQL - \o + \clearfloat + \section1 \l{SQL Examples}{SQL} + \beginfloatleft + \l{SQL Examples}{\inlineimage sql-examples.png + } + + \endfloat Qt provides extensive database interoperability, with support for products from both open source and proprietary vendors. SQL support is integrated with Qt's model/view architecture, making it easier to provide GUI integration for your database applications. - \o \image xml-examples.png XML - \o + \clearfloat + \section1 \l{XML Examples}{XML} + \beginfloatleft + \l{XML Examples}{\inlineimage xml-examples.png + } + + \endfloat XML parsing and handling is supported through SAX and DOM compliant APIs as well as streaming classes. The XQuery/XPath and XML Schema engines in the QtXmlPatterns modules provide classes for querying XML files and custom data models. - \row - \o{2,1} \l{Qt Designer Examples}{\bold{Qt Designer}} - \o{2,1} \l{UiTools Examples}{\bold UiTools} - \row - \o \image designer-examples.png Designer - \o + \clearfloat + \section1 \l{Qt Designer Examples}{Qt Designer} + \beginfloatleft + \l{Qt Designer Examples}{\inlineimage designer-examples.png + } + + \endfloat Qt Designer is a capable graphical user interface designer that lets you create and configure forms without writing code. GUIs created with Qt Designer can be compiled into an application or created at run-time. - \o \image uitools-examples.png UiTools - \o + \clearfloat + \section1 \l{UiTools Examples}{UiTools} + \beginfloatleft + \l{UiTools Examples}{\inlineimage uitools-examples.png + } + + \endfloat + User interfaces created with Qt Designer can be loaded and displayed at + run-time using the facilities of the QtUiTools module without the need + to generate code in advance. - \row - \o{2,1} \l{Qt Linguist Examples}{\bold{Qt Linguist}} - \o{2,1} \l{Qt Script Examples}{\bold{Qt Script}} - \row - \o \image linguist-examples.png QtLinguist - \o + \clearfloat + \section1 \l{Qt Linguist Examples}{Qt Linguist} + \beginfloatleft + \l{Qt Linguist Examples}{\inlineimage linguist-examples.png + } + + \endfloat Internationalization is a core feature of Qt. - \o \image qtscript-examples.png - \o + \clearfloat + \section1 \l{Qt Script Examples}{Qt Script} + \beginfloatleft + \l{Qt Script Examples}{\inlineimage qtscript-examples.png + } + + \endfloat Qt is provided with a powerful embedded scripting environment through the QtScript classes. - \row - \o{2,1} \l{WebKit Examples}{\bold WebKit} - \o{2,1} \l{Help System Examples}{\bold{Help System}} - \row - \o \image webkit-examples.png - \o + \clearfloat + \section1 \l{WebKit Examples}{WebKit} + \beginfloatleft + \l{WebKit Examples}{\inlineimage webkit-examples.png + } + + \endfloat Qt provides an integrated Web browser component based on WebKit, the popular open source browser engine. - \o \image assistant-examples.png HelpSystem - \o + \clearfloat + \section1 \l{Help System Examples}{Help System} + \beginfloatleft + \l{Help System Examples}{\inlineimage assistant-examples.png + } + + \endfloat Support for interactive help is provided by the Qt Assistant application. Developers can take advantages of the facilities it offers to display specially-prepared documentation to users of their applications. - \row - \o{2,1} \l{State Machine Examples}{\bold{State Machine}} - \o{2,1} \l{Animation Framework Examples}{\bold{Animation Framework}} - \row - \o \image statemachine-examples.png - \o + \clearfloat + \section1 \l{State Machine Examples}{State Machine} + \beginfloatleft + \l{State Machine Examples}{\inlineimage statemachine-examples.png + } + + \endfloat Qt provides a powerful hierarchical finite state machine through the Qt State Machine classes. - \o \image animation-examples.png - \o + \clearfloat + \section1 \l{Animation Framework Examples}{Animation Framework} + \beginfloatleft + \l{Animation Framework Examples}{\inlineimage animation-examples.png + } + + \endfloat These examples show to to use the \l{The Animation Framework}{animation framework} to build highly animated, high-performance GUIs. - \row - \o{2,1} \l{Multi-Touch Examples}{\bold{Multi-Touch Framework}} - \o{2,1} \l{Gestures Examples}{\bold{Gestures}} + \clearfloat + \section1 \l{Multi-Touch Examples}{Multi-Touch Framework} + \beginfloatleft + \l{Multi-Touch Examples}{\inlineimage multitouch-examples.png + } - \row - \o \image multitouch-examples.png - \o + \endfloat Support for multi-touch input makes it possible for developers to create extensible and intuitive user interfaces. - \o \image gestures-examples.png - \o + \clearfloat + \section1 \l{Gestures Examples}{Gestures} + \beginfloatleft + \l{Gestures Examples}{\inlineimage gestures-examples.png + } + + \endfloat Applications can be written to respond to gestures as a natural input method. These examples show how to enable support for standard and custom gestures in applications. - \row - \o{2,1} \l{D-Bus Examples}{\bold{D-Bus}} - \o{2,1} \l{Qt for Embedded Linux Examples}{\bold{Qt for Embedded Linux}} + \clearfloat + \section1 \l{D-Bus Examples}{D-Bus} + \beginfloatleft + \l{D-Bus Examples}{\inlineimage qt-embedded-examples.png + } - \row - \o \image qt-embedded-examples.png - \o + \endfloat Systems with limited resources, specialized hardware, and small screens require special attention. - \o \image dbus-examples.png D-Bus - \o + \clearfloat + \section1 \l{Qt for Embedded Linux Examples}{Qt for Embedded Linux} + \beginfloatleft + \l{Qt for Embedded Linux Examples}{\inlineimage dbus-examples.png + } + + \endfloat D-Bus is an inter-process communication protocol for Unix/Linux systems. These examples demonstrate how to write application that communicate with each other. - \row - \o{2,1} \l{ActiveQt Examples}{\bold ActiveQt} - \o{2,1} \l{Qt Quarterly}{\bold{Qt Quarterly}} + \clearfloat + \section1 \l{ActiveQt Examples}{ActiveQt} + \beginfloatleft + \l{ActiveQt Examples}{\inlineimage activeqt-examples.png + } - \row - \o \image activeqt-examples.png ActiveQt - \o + \endfloat These examples demonstrate how to write ActiveX controls and control servers with Qt, and how to use ActiveX controls and COM objects in a Qt application. - \o \image qq-thumbnail.png QtQuarterly - \o + \clearfloat + \section1 \l{Qt Quarterly}{Qt Quarterly} + \beginfloatleft + \l{Qt Quarterly}{\inlineimage qq-thumbnail.png + } + + \endfloat One more valuable source for examples and explanations of Qt - features is the archive of the \l {Qt Quarterly}. + features is the archive of \l{Qt Quarterly}, a newsletter for + Qt developers. - \endtable + \clearfloat */ /*! @@ -385,12 +482,14 @@ \o \l{widgets/scribble}{Scribble}\raisedaster \o \l{widgets/shapedclock}{Shaped Clock}\raisedaster \o \l{widgets/sliders}{Sliders}\raisedaster + \o \l{widgets/softkeys}{Soft Keys} \o \l{widgets/spinboxes}{Spin Boxes}\raisedaster \o \l{widgets/styles}{Styles}\raisedaster \o \l{widgets/stylesheet}{Style Sheet}\raisedaster \o \l{widgets/tablet}{Tablet}\raisedaster \o \l{widgets/tetrix}{Tetrix}\raisedaster \o \l{widgets/tooltips}{Tooltips}\raisedaster + \o \l{widgets/validators}{Validators} \o \l{widgets/wiggly}{Wiggly}\raisedaster \o \l{widgets/windowflags}{Window Flags}\raisedaster \endlist @@ -546,6 +645,15 @@ \o \l{graphicsview/portedcanvas}{Ported Canvas} \endlist + These examples show the use of graphics widgets and layouts. + + \list + \o \l{graphicsview/anchorlayouts}{Anchor Layouts} + \o \l{graphicsview/flowlayout}{Flow Layout} + \o \l{graphicsview/simpleanchorlayouts}{Simple Anchor Layouts} + \o \l{graphicsview/weatheranchorlayouts}{Weather Anchor Layouts} + \endlist + Some examples demonstrate the use of graphics effects with canvas items. \list @@ -761,6 +869,8 @@ \o \l{network/blockingfortuneclient}{Blocking Fortune Client}\raisedaster \o \l{network/broadcastreceiver}{Broadcast Receiver} \o \l{network/broadcastsender}{Broadcast Sender} + \o \l{network/download}{Download} + \o \l{network/downloadmanager}{Download Manager} \o \l{network/network-chat}{Network Chat} \o \l{network/fortuneclient}{Fortune Client}\raisedaster \o \l{network/fortuneserver}{Fortune Server}\raisedaster @@ -1043,6 +1153,9 @@ \o \l{script/context2d}{Context2D}\raisedaster \o \l{script/defaultprototypes}{Default Prototypes}\raisedaster \o \l{script/helloscript}{Hello Script}\raisedaster + \o \l{script/marshal}{Qt Script Marshalling} + \o \l{script/qscript}{Qt Script Interpreter} + \o \l{script/qsdbg}{Qt Script Debugging} \o \l{script/qstetrix}{Qt Script Tetrix}\raisedaster \o \l{script/customclass}{Custom Script Class}\raisedaster \endlist @@ -1073,6 +1186,8 @@ \o A more advanced browser example, showing the use of jQuery to perform effects. \row \o \l{webkit/formextractor}{Form Extractor} \o How to use JavaScript and C++ together to read page content. + \row \o \l{webkit/framecapture}{Frame Capture} + \o How to use the WebKit browser engine to obtain images of Web pages. \row \o \l{webkit/googlechat}{Google Chat} \o A real-world example that shows how an existing Web-based service can be accessed using QtWebKit. diff --git a/tools/qdoc3/test/macros.qdocconf b/tools/qdoc3/test/macros.qdocconf index dbb8ab8..22db23e 100644 --- a/tools/qdoc3/test/macros.qdocconf +++ b/tools/qdoc3/test/macros.qdocconf @@ -32,4 +32,4 @@ macro.mdash.HTML = "—" macro.beginfloatleft.HTML = "
" macro.beginfloatright.HTML = "
" macro.endfloat.HTML = "
" -macro.clearfloat.HTML = "
" +macro.clearfloat.HTML = "
" -- cgit v0.12 From d59eaf1c550d45ff1009ccceaea6298b9e3d8e2b Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Sat, 16 Jan 2010 11:40:09 +0100 Subject: Fix compilation on IA-64 with the Intel compiler: cast properly. Error was: ../../include/QtCore/../../src/corelib/arch/qatomic_ia64.h(208): error: argument of type "QMutexPool *volatile *" is incompatible with parameter of type "void *volatile *" return (T *)_InterlockedExchangePointer(&_q_value, newValue); ^ detected during instantiation of "T *QBasicAtomicPointer::fetchAndStoreAcquire(T *) [with T=QMutexPool]" Patch by Intel Yolanda Chen (relayed by reporter Richard Fleck). Task-number: QTBUG-7356 --- src/corelib/arch/qatomic_ia64.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/corelib/arch/qatomic_ia64.h b/src/corelib/arch/qatomic_ia64.h index e015863..8c824f3 100644 --- a/src/corelib/arch/qatomic_ia64.h +++ b/src/corelib/arch/qatomic_ia64.h @@ -205,7 +205,7 @@ inline bool QBasicAtomicInt::deref() template Q_INLINE_TEMPLATE T *QBasicAtomicPointer::fetchAndStoreAcquire(T *newValue) { - return (T *)_InterlockedExchangePointer(&_q_value, newValue); + return (T *)_InterlockedExchangePointer(reinterpret_cast(&_q_value), newValue); } template -- cgit v0.12 From c8e54ce41201b38b9b3017c9b941129a924fe852 Mon Sep 17 00:00:00 2001 From: Norbert Leser Date: Mon, 18 Jan 2010 08:51:10 +0100 Subject: Symbian RnD SDK version pf_5250, wk48 and later (e.g., for ivalo target) has changed /epoc32/include layout, including a subdirectory called "platform". Since that particular directory is used as test for detecting SDKs with "New SF structure", the test returns with false result in case of pf_5250 (which has old SF structure). Change was made to test for a more obscure directory "mw" that appears the be present in new structure only. Merge-request: 2281 Signed-off-by: axis --- mkspecs/features/symbian/platform_paths.prf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mkspecs/features/symbian/platform_paths.prf b/mkspecs/features/symbian/platform_paths.prf index f5caae0..c723d8c 100644 --- a/mkspecs/features/symbian/platform_paths.prf +++ b/mkspecs/features/symbian/platform_paths.prf @@ -59,7 +59,7 @@ exists($${EPOCROOT}epoc32/include/platform_paths.prf) { # No platform specific paths provided, use default paths - exists($${EPOCROOT}epoc32/include/platform) { # New SF structure + exists($${EPOCROOT}epoc32/include/mw) { # New SF structure # --------------------------------------- # Location, where the applications layer specific public headers are exported -- cgit v0.12 From 67652ce2f2bd378862338daa3ebd9d7c43b4f91a Mon Sep 17 00:00:00 2001 From: axis Date: Mon, 18 Jan 2010 09:15:34 +0100 Subject: Remove qmake warning by using appropriate variable. RevBy: Miikka Heikkinen --- src/3rdparty/webkit/WebCore/WebCore.pro | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/3rdparty/webkit/WebCore/WebCore.pro b/src/3rdparty/webkit/WebCore/WebCore.pro index 9432217..1489fa0 100644 --- a/src/3rdparty/webkit/WebCore/WebCore.pro +++ b/src/3rdparty/webkit/WebCore/WebCore.pro @@ -23,7 +23,7 @@ symbian: { TARGET.UID3 = 0x200267C2 # RO text (code) section in qtwebkit.dll exceeds allocated space for gcce udeb target. # Move RW-section base address to start from 0xE00000 instead of the toolchain default 0x400000. - MMP_RULES += "LINKEROPTION armcc --rw-base 0xE00000" + QMAKE_LFLAGS.ARMCC += --rw-base 0xE00000 } include($$PWD/../WebKit.pri) -- cgit v0.12 From 94ceaf333074a0f64aab4d1bbb2825591e3f147e Mon Sep 17 00:00:00 2001 From: Shane Kearns Date: Mon, 18 Jan 2010 09:46:21 +0100 Subject: Describe patch-capabilities in the install instructions. Task-number:QTBUG-7294 Reviewed-by:Gareth Stockwell --- doc/src/getting-started/installation.qdoc | 33 ++++++++++++++++++++----- doc/src/snippets/code/doc_src_installation.qdoc | 18 ++++++++++++++ 2 files changed, 45 insertions(+), 6 deletions(-) diff --git a/doc/src/getting-started/installation.qdoc b/doc/src/getting-started/installation.qdoc index 3867b3b..5f95c5a 100644 --- a/doc/src/getting-started/installation.qdoc +++ b/doc/src/getting-started/installation.qdoc @@ -640,17 +640,38 @@ If you are using pre-built binaries, follow the instructions given in the Congratulations, Qt is now ready to use. - \o Running Qt demos + \o Installing Qt libraries on the device - We've included a subset of the Qt demos in this package for you - to try out. An excellent starting point is the "fluidlauncher" - demo. To run the demo on a real device, you first have to install + To run the demo on a real device, you first have to install the Qt libraries on the device: \snippet doc/src/snippets/code/doc_src_installation.qdoc 29 - \note You will need to supply certificate that allows installation - of binaries with "All -Tcb" capability to your device. + The Qt libraries are built with "All -Tcb" capability, so that + they can support all types of application. + If you don't have a suitable certificate, it is possible to patch + the binaries as follows: + + \list A + \o Installing Qt without a certificate + + If you have no certificate, build a self signed Qt: + + \snippet doc/src/snippets/code/doc_src_installation.qdoc 34 + + \o Installing Qt with a Symbian developer certificate + + If you have a symbian-signed developer certificate, specify the + capabilities you can sign for, for example: + + \snippet doc/src/snippets/code/doc_src_installation.qdoc 35 + \endlist + + \o Running Qt demos + + We've included a subset of the Qt demos in this package for you + to try out. An excellent starting point is the "fluidlauncher" + demo. Similarly, install fluidlauncher to the device: diff --git a/doc/src/snippets/code/doc_src_installation.qdoc b/doc/src/snippets/code/doc_src_installation.qdoc index 7680ec8..b3c9903 100644 --- a/doc/src/snippets/code/doc_src_installation.qdoc +++ b/doc/src/snippets/code/doc_src_installation.qdoc @@ -222,3 +222,21 @@ abld build gcce urel //! [33] SYMBIANBUILD_DEPENDENCYOFF=1 //! [33] + +//! [34] +cd src\s60installs +patch_capabilities.pl Qt_template.pkg release-armv5 +make sis QT_SIS_OPTIONS=-i +cd ..\3rdparty\webkit\WebCore +patch_capabilities.pl QtWebkit_template.pkg release-armv5 +make sis QT_SIS_OPTIONS=-i +//! [34] + +//! [35] +cd src\s60installs +patch_capabilities.pl Qt_template.pkg release-armv5 "ALL -Tcb -AllFiles -DRM" +make sis QT_SIS_OPTIONS=-i QT_SIS_CERTIFICATE= QT_SIS_KEY= +cd ..\3rdparty\webkit\WebCore +patch_capabilities.pl QtWebKit_template.pkg release-armv5 "ALL -Tcb -AllFiles -DRM" +make sis QT_SIS_OPTIONS=-i QT_SIS_CERTIFICATE= QT_SIS_KEY= +//! [35] -- cgit v0.12 From 7e76201808549c0837d1a5154ed8737fb0296c00 Mon Sep 17 00:00:00 2001 From: Andy Shaw Date: Mon, 18 Jan 2010 10:05:46 +0100 Subject: Fixes: When calling QDesktopWidget::screenGeometry() with a null pointer then it should not crash but warn instead. Task: - RevBy: Andreas AutoTest: Included Details: This also fixes availableGeometry() as well to warn under the same circumstances. --- src/gui/kernel/qdesktopwidget.cpp | 10 ++++++++++ tests/auto/qdesktopwidget/tst_qdesktopwidget.cpp | 25 ++++++++++++++++++++++++ 2 files changed, 35 insertions(+) diff --git a/src/gui/kernel/qdesktopwidget.cpp b/src/gui/kernel/qdesktopwidget.cpp index c8a4373..24b4e57 100644 --- a/src/gui/kernel/qdesktopwidget.cpp +++ b/src/gui/kernel/qdesktopwidget.cpp @@ -47,6 +47,11 @@ QT_BEGIN_NAMESPACE const QRect QDesktopWidget::screenGeometry(const QWidget *widget) const { + if (!widget) { + qWarning("QDesktopWidget::screenGeometry(): Attempt " + "to get the screen geometry of a null widget"); + return QRect(); + } QRect rect = QWidgetPrivate::screenGeometry(widget); if (rect.isNull()) return screenGeometry(screenNumber(widget)); @@ -55,6 +60,11 @@ const QRect QDesktopWidget::screenGeometry(const QWidget *widget) const const QRect QDesktopWidget::availableGeometry(const QWidget *widget) const { + if (!widget) { + qWarning("QDesktopWidget::availableGeometry(): Attempt " + "to get the available geometry of a null widget"); + return QRect(); + } QRect rect = QWidgetPrivate::screenGeometry(widget); if (rect.isNull()) return availableGeometry(screenNumber(widget)); diff --git a/tests/auto/qdesktopwidget/tst_qdesktopwidget.cpp b/tests/auto/qdesktopwidget/tst_qdesktopwidget.cpp index b9d9d7e..d846615 100644 --- a/tests/auto/qdesktopwidget/tst_qdesktopwidget.cpp +++ b/tests/auto/qdesktopwidget/tst_qdesktopwidget.cpp @@ -64,6 +64,7 @@ private slots: void screenNumberForQWidget(); void screenNumberForQPoint(); void availableGeometry(); + void screenGeometry(); }; tst_QDesktopWidget::tst_QDesktopWidget() @@ -98,6 +99,9 @@ void tst_QDesktopWidget::primaryScreen() void tst_QDesktopWidget::availableGeometry() { QDesktopWidget desktop; + QTest::ignoreMessage(QtWarningMsg, "QDesktopWidget::availableGeometry(): Attempt " + "to get the available geometry of a null widget"); + desktop.availableGeometry((QWidget *)0); QRect total; QRect available; @@ -158,6 +162,27 @@ void tst_QDesktopWidget::screenNumberForQPoint() QVERIFY(screen >= 0 && screen < desktopWidget->numScreens()); } +void tst_QDesktopWidget::screenGeometry() +{ + QDesktopWidget *desktopWidget = QApplication::desktop(); + QTest::ignoreMessage(QtWarningMsg, "QDesktopWidget::screenGeometry(): Attempt " + "to get the screen geometry of a null widget"); + QRect r = desktopWidget->screenGeometry((QWidget *)0); + QVERIFY(r.isNull()); + QWidget widget; + widget.show(); + QTest::qWaitForWindowShown(&widget); + r = desktopWidget->screenGeometry(&widget); + + QRect total; + QRect available; + for (int i = 0; i < desktopWidget->screenCount(); ++i) { + total = desktopWidget->screenGeometry(i); + available = desktopWidget->availableGeometry(i); + } + QVERIFY(total.contains(r)); +} + QTEST_MAIN(tst_QDesktopWidget) #include "tst_qdesktopwidget.moc" -- cgit v0.12 From 4e23d00dabc3465bd683d38ee147b3a9897b226f Mon Sep 17 00:00:00 2001 From: Shane Kearns Date: Mon, 18 Jan 2010 13:16:55 +0100 Subject: Workaround for compiler error with MWCC (Symbian emulator) Recent changes to phonon and syncqt cause problems with the default search path for #include with this compiler. Reviewed-by: Gareth Stockwell --- src/3rdparty/phonon/mmf/abstractaudioeffect.h | 2 +- src/3rdparty/phonon/mmf/abstractplayer.h | 4 ++-- src/3rdparty/phonon/mmf/backend.h | 4 ++-- src/3rdparty/phonon/mmf/effectparameter.h | 2 +- src/3rdparty/phonon/mmf/mediaobject.h | 4 ++-- src/3rdparty/phonon/mmf/mmf_medianode.h | 2 +- src/3rdparty/phonon/mmf/videooutput.h | 2 +- src/3rdparty/phonon/mmf/videowidget.h | 4 ++-- 8 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/3rdparty/phonon/mmf/abstractaudioeffect.h b/src/3rdparty/phonon/mmf/abstractaudioeffect.h index 9878472..436e8e4 100644 --- a/src/3rdparty/phonon/mmf/abstractaudioeffect.h +++ b/src/3rdparty/phonon/mmf/abstractaudioeffect.h @@ -23,7 +23,7 @@ along with this library. If not, see . #include -#include +#include #include "audioplayer.h" #include "effectparameter.h" diff --git a/src/3rdparty/phonon/mmf/abstractplayer.h b/src/3rdparty/phonon/mmf/abstractplayer.h index dbcbe63..cec5568 100644 --- a/src/3rdparty/phonon/mmf/abstractplayer.h +++ b/src/3rdparty/phonon/mmf/abstractplayer.h @@ -19,8 +19,8 @@ along with this library. If not, see . #ifndef PHONON_MMF_ABSTRACTPLAYER_H #define PHONON_MMF_ABSTRACTPLAYER_H -#include -#include +#include +#include #include diff --git a/src/3rdparty/phonon/mmf/backend.h b/src/3rdparty/phonon/mmf/backend.h index 6b85625..9361544 100644 --- a/src/3rdparty/phonon/mmf/backend.h +++ b/src/3rdparty/phonon/mmf/backend.h @@ -22,8 +22,8 @@ along with this library. If not, see . #include "ancestormovemonitor.h" #include "effectfactory.h" -#include -#include +#include +#include #include QT_BEGIN_NAMESPACE diff --git a/src/3rdparty/phonon/mmf/effectparameter.h b/src/3rdparty/phonon/mmf/effectparameter.h index 27cc018..892ed4d 100644 --- a/src/3rdparty/phonon/mmf/effectparameter.h +++ b/src/3rdparty/phonon/mmf/effectparameter.h @@ -19,7 +19,7 @@ along with this library. If not, see . #ifndef PHONON_MMF_EFFECTPARAMETER_H #define PHONON_MMF_EFFECTPARAMETER_H -#include +#include QT_BEGIN_NAMESPACE diff --git a/src/3rdparty/phonon/mmf/mediaobject.h b/src/3rdparty/phonon/mmf/mediaobject.h index c87d755..d6248e2 100644 --- a/src/3rdparty/phonon/mmf/mediaobject.h +++ b/src/3rdparty/phonon/mmf/mediaobject.h @@ -19,8 +19,8 @@ along with this library. If not, see . #ifndef PHONON_MMF_MEDIAOBJECT_H #define PHONON_MMF_MEDIAOBJECT_H -#include -#include +#include +#include #include #include diff --git a/src/3rdparty/phonon/mmf/mmf_medianode.h b/src/3rdparty/phonon/mmf/mmf_medianode.h index 0ed21c4..f2f64e0 100644 --- a/src/3rdparty/phonon/mmf/mmf_medianode.h +++ b/src/3rdparty/phonon/mmf/mmf_medianode.h @@ -20,7 +20,7 @@ along with this library. If not, see . #define PHONON_MMF_MEDIANODE_H #include -#include +#include #include "audioplayer.h" QT_BEGIN_NAMESPACE diff --git a/src/3rdparty/phonon/mmf/videooutput.h b/src/3rdparty/phonon/mmf/videooutput.h index 2788401..3e9c036 100644 --- a/src/3rdparty/phonon/mmf/videooutput.h +++ b/src/3rdparty/phonon/mmf/videooutput.h @@ -24,7 +24,7 @@ along with this library. If not, see . #include #include "defs.h" -#include +#include #include class RWindowBase; diff --git a/src/3rdparty/phonon/mmf/videowidget.h b/src/3rdparty/phonon/mmf/videowidget.h index a876748..899dca6 100644 --- a/src/3rdparty/phonon/mmf/videowidget.h +++ b/src/3rdparty/phonon/mmf/videowidget.h @@ -23,8 +23,8 @@ along with this library. If not, see . #include "videooutput.h" #include -#include -#include +#include +#include QT_BEGIN_NAMESPACE -- cgit v0.12 From 2f6459ff25a59e913b5695dcd8919ead8d58947c Mon Sep 17 00:00:00 2001 From: Kent Hansen Date: Mon, 18 Jan 2010 14:56:22 +0100 Subject: don't assert when calling QtScript-wrapped method of deleted QObject Make it behave the same as the old (4.5) back-end. Reviewed-by: Jedrzej Nowacki --- src/script/bridge/qscriptqobject.cpp | 3 ++- tests/auto/qscriptextqobject/tst_qscriptextqobject.cpp | 11 ++++++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/script/bridge/qscriptqobject.cpp b/src/script/bridge/qscriptqobject.cpp index fb0dddb..3f4f6bb 100644 --- a/src/script/bridge/qscriptqobject.cpp +++ b/src/script/bridge/qscriptqobject.cpp @@ -978,7 +978,8 @@ JSC::JSValue QtFunction::execute(JSC::ExecState *exec, JSC::JSValue thisValue, QScriptObjectDelegate *delegate = scriptObject->delegate(); Q_ASSERT(delegate && (delegate->type() == QScriptObjectDelegate::QtObject)); QObject *qobj = static_cast(delegate)->value(); - Q_ASSERT_X(qobj != 0, "QtFunction::call", "handle the case when QObject has been deleted"); + if (!qobj) + return JSC::throwError(exec, JSC::GeneralError, QString::fromLatin1("cannot call function of deleted QObject")); QScriptEnginePrivate *engine = scriptEngineFromExec(exec); const QMetaObject *meta = qobj->metaObject(); diff --git a/tests/auto/qscriptextqobject/tst_qscriptextqobject.cpp b/tests/auto/qscriptextqobject/tst_qscriptextqobject.cpp index 3415163..de9d37e 100644 --- a/tests/auto/qscriptextqobject/tst_qscriptextqobject.cpp +++ b/tests/auto/qscriptextqobject/tst_qscriptextqobject.cpp @@ -2913,7 +2913,8 @@ void tst_QScriptExtQObject::objectDeleted() v.setProperty("intProperty", QScriptValue(&eng, 123)); QCOMPARE(qobj->intProperty(), 123); qobj->resetQtFunctionInvoked(); - v.property("myInvokable").call(v); + QScriptValue invokable = v.property("myInvokable"); + invokable.call(v); QCOMPARE(qobj->qtFunctionInvoked(), 0); // now delete the object @@ -2951,6 +2952,14 @@ void tst_QScriptExtQObject::objectDeleted() QCOMPARE(ret.toString(), QLatin1String("Error: cannot access member `myInvokableWithIntArg' of deleted QObject")); } + // Meta-method wrappers are still valid, but throw error when called + QVERIFY(invokable.isFunction()); + { + QScriptValue ret = invokable.call(v); + QVERIFY(ret.isError()); + QCOMPARE(ret.toString(), QString::fromLatin1("Error: cannot call function of deleted QObject")); + } + // access from script eng.globalObject().setProperty("o", v); { -- cgit v0.12 From c7b3f408f772d565666910cb4495a7057796b648 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Abecasis?= Date: Wed, 13 Jan 2010 18:03:52 +0100 Subject: QFile: Fix a pre-mature pessimization Don't repeatedly call the fileEngine virtual function. Instead re-use the private data member if we know it has been filled. Reviewed-by: Markus Goetz --- src/corelib/io/qfile.cpp | 86 +++++++++++++++++++++++------------------------- 1 file changed, 42 insertions(+), 44 deletions(-) diff --git a/src/corelib/io/qfile.cpp b/src/corelib/io/qfile.cpp index 4c7f3f0..7405339 100644 --- a/src/corelib/io/qfile.cpp +++ b/src/corelib/io/qfile.cpp @@ -650,7 +650,7 @@ QFile::remove() unsetError(); return true; } - d->setError(QFile::RemoveError, fileEngine()->errorString()); + d->setError(QFile::RemoveError, d->fileEngine->errorString()); } return false; } @@ -704,7 +704,7 @@ QFile::rename(const QString &newName) if (fileEngine()->rename(newName)) { unsetError(); // engine was able to handle the new name so we just reset it - fileEngine()->setFileName(newName); + d->fileEngine->setFileName(newName); d->fileName = newName; return true; } @@ -740,7 +740,7 @@ QFile::rename(const QString &newName) if (error) { out.remove(); } else { - fileEngine()->setFileName(newName); + d->fileEngine->setFileName(newName); setPermissions(permissions()); unsetError(); setFileName(newName); @@ -805,7 +805,7 @@ QFile::link(const QString &linkName) unsetError(); return true; } - d->setError(QFile::RenameError, fileEngine()->errorString()); + d->setError(QFile::RenameError, d->fileEngine->errorString()); return false; } @@ -994,10 +994,10 @@ bool QFile::open(OpenMode mode) seek(size()); return true; } - QFile::FileError err = fileEngine()->error(); + QFile::FileError err = d->fileEngine->error(); if(err == QFile::UnspecifiedError) err = QFile::OpenError; - d->setError(err, fileEngine()->errorString()); + d->setError(err, d->fileEngine->errorString()); return false; } @@ -1155,8 +1155,8 @@ QFile::handle() const if (!isOpen()) return -1; - if (QAbstractFileEngine *engine = fileEngine()) - return engine->handle(); + if (fileEngine()) + return d->fileEngine->handle(); return -1; } @@ -1189,13 +1189,12 @@ QFile::handle() const uchar *QFile::map(qint64 offset, qint64 size, MemoryMapFlags flags) { Q_D(QFile); - QAbstractFileEngine *engine = fileEngine(); - if (engine - && engine->supportsExtension(QAbstractFileEngine::MapExtension)) { + if (fileEngine() + && d->fileEngine->supportsExtension(QAbstractFileEngine::MapExtension)) { unsetError(); - uchar *address = engine->map(offset, size, flags); + uchar *address = d->fileEngine->map(offset, size, flags); if (address == 0) - d->setError(engine->error(), engine->errorString()); + d->setError(d->fileEngine->error(), d->fileEngine->errorString()); return address; } return 0; @@ -1212,13 +1211,12 @@ uchar *QFile::map(qint64 offset, qint64 size, MemoryMapFlags flags) bool QFile::unmap(uchar *address) { Q_D(QFile); - QAbstractFileEngine *engine = fileEngine(); - if (engine - && engine->supportsExtension(QAbstractFileEngine::UnMapExtension)) { + if (fileEngine() + && d->fileEngine->supportsExtension(QAbstractFileEngine::UnMapExtension)) { unsetError(); - bool success = engine->unmap(address); + bool success = d->fileEngine->unmap(address); if (!success) - d->setError(engine->error(), engine->errorString()); + d->setError(d->fileEngine->error(), d->fileEngine->errorString()); return success; } return false; @@ -1251,13 +1249,14 @@ QFile::resize(qint64 sz) Q_D(QFile); if (!d->ensureFlushed()) return false; - if (isOpen() && fileEngine()->pos() > sz) + fileEngine(); + if (isOpen() && d->fileEngine->pos() > sz) seek(sz); - if(fileEngine()->setSize(sz)) { + if(d->fileEngine->setSize(sz)) { unsetError(); return true; } - d->setError(QFile::ResizeError, fileEngine()->errorString()); + d->setError(QFile::ResizeError, d->fileEngine->errorString()); return false; } @@ -1321,7 +1320,7 @@ QFile::setPermissions(Permissions permissions) unsetError(); return true; } - d->setError(QFile::PermissionsError, fileEngine()->errorString()); + d->setError(QFile::PermissionsError, d->fileEngine->errorString()); return false; } @@ -1354,23 +1353,23 @@ bool QFile::flush() { Q_D(QFile); + fileEngine(); if (!d->writeBuffer.isEmpty()) { qint64 size = d->writeBuffer.size(); - if (_qfile_writeData(d->fileEngine ? d->fileEngine : fileEngine(), - &d->writeBuffer) != size) { - QFile::FileError err = fileEngine()->error(); + if (_qfile_writeData(d->fileEngine, &d->writeBuffer) != size) { + QFile::FileError err = d->fileEngine->error(); if(err == QFile::UnspecifiedError) err = QFile::WriteError; - d->setError(err, fileEngine()->errorString()); + d->setError(err, d->fileEngine->errorString()); return false; } } - if (!fileEngine()->flush()) { - QFile::FileError err = fileEngine()->error(); + if (!d->fileEngine->flush()) { + QFile::FileError err = d->fileEngine->error(); if(err == QFile::UnspecifiedError) err = QFile::WriteError; - d->setError(err, fileEngine()->errorString()); + d->setError(err, d->fileEngine->errorString()); return false; } return true; @@ -1398,7 +1397,7 @@ QFile::close() if (fileEngine()->close() && flushed) unsetError(); else if (flushed) - d->setError(fileEngine()->error(), fileEngine()->errorString()); + d->setError(d->fileEngine->error(), d->fileEngine->errorString()); } /*! @@ -1451,10 +1450,10 @@ bool QFile::atEnd() const return false; // If the file engine knows best, say what it says. - if (fileEngine()->supportsExtension(QAbstractFileEngine::AtEndExtension)) { + if (d->fileEngine->supportsExtension(QAbstractFileEngine::AtEndExtension)) { // Check if the file engine supports AtEndExtension, and if it does, // check if the file engine claims to be at the end. - return fileEngine()->atEnd(); + return d->fileEngine->atEnd(); } // Fall back to checking how much is available (will stat files). @@ -1476,11 +1475,11 @@ bool QFile::seek(qint64 off) if (!d->ensureFlushed()) return false; - if (!fileEngine()->seek(off) || !QIODevice::seek(off)) { - QFile::FileError err = fileEngine()->error(); + if (!d->fileEngine->seek(off) || !QIODevice::seek(off)) { + QFile::FileError err = d->fileEngine->error(); if(err == QFile::UnspecifiedError) err = QFile::PositionError; - d->setError(err, fileEngine()->errorString()); + d->setError(err, d->fileEngine->errorString()); return false; } unsetError(); @@ -1496,8 +1495,8 @@ qint64 QFile::readLineData(char *data, qint64 maxlen) if (!d->ensureFlushed()) return -1; - if (fileEngine()->supportsExtension(QAbstractFileEngine::FastReadLineExtension)) - return fileEngine()->readLine(data, maxlen); + if (d->fileEngine->supportsExtension(QAbstractFileEngine::FastReadLineExtension)) + return d->fileEngine->readLine(data, maxlen); // Fall back to QIODevice's readLine implementation if the engine // cannot do it faster. @@ -1516,15 +1515,15 @@ qint64 QFile::readData(char *data, qint64 len) return -1; qint64 ret = -1; - qint64 read = fileEngine()->read(data, len); + qint64 read = d->fileEngine->read(data, len); if (read != -1) ret = read; if(ret < 0) { - QFile::FileError err = fileEngine()->error(); + QFile::FileError err = d->fileEngine->error(); if(err == QFile::UnspecifiedError) err = QFile::ReadError; - d->setError(err, fileEngine()->errorString()); + d->setError(err, d->fileEngine->errorString()); } return ret; } @@ -1606,13 +1605,12 @@ QFile::writeData(const char *data, qint64 len) // Write directly to the engine if the block size is larger than // the write buffer size. if (!buffered || len > QFILE_WRITEBUFFER_SIZE) { - QAbstractFileEngine *fe = d->fileEngine ? d->fileEngine : fileEngine(); - qint64 ret = fe->write(data, len); + qint64 ret = d->fileEngine->write(data, len); if(ret < 0) { - QFile::FileError err = fileEngine()->error(); + QFile::FileError err = d->fileEngine->error(); if(err == QFile::UnspecifiedError) err = QFile::WriteError; - d->setError(err, fileEngine()->errorString()); + d->setError(err, d->fileEngine->errorString()); } return ret; } -- cgit v0.12 From 54069f7c2c235dc9e302f96a6111bf6cd34a766b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Abecasis?= Date: Wed, 13 Jan 2010 18:09:18 +0100 Subject: If the file is open, there must be an engine. Don't try to allocate one for QFile::handle and QFile::flush since they'll be useless there. Reviewed-by: Markus Goetz --- src/corelib/io/qfile.cpp | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/corelib/io/qfile.cpp b/src/corelib/io/qfile.cpp index 7405339..df470b9 100644 --- a/src/corelib/io/qfile.cpp +++ b/src/corelib/io/qfile.cpp @@ -1152,12 +1152,11 @@ bool QFile::open(int fd, OpenMode mode) int QFile::handle() const { - if (!isOpen()) + Q_D(const QFile); + if (!isOpen() || !d->fileEngine) return -1; - if (fileEngine()) - return d->fileEngine->handle(); - return -1; + return d->fileEngine->handle(); } /*! @@ -1353,7 +1352,11 @@ bool QFile::flush() { Q_D(QFile); - fileEngine(); + if (!d->fileEngine) { + qWarning("QFile::flush: No file engine. Is IODevice open?"); + return false; + } + if (!d->writeBuffer.isEmpty()) { qint64 size = d->writeBuffer.size(); if (_qfile_writeData(d->fileEngine, &d->writeBuffer) != size) { @@ -1394,7 +1397,7 @@ QFile::close() d->writeBuffer.clear(); // keep earlier error from flush - if (fileEngine()->close() && flushed) + if (d->fileEngine->close() && flushed) unsetError(); else if (flushed) d->setError(d->fileEngine->error(), d->fileEngine->errorString()); -- cgit v0.12 From 4974742bb85b5f22ade3e1a59c2b5fe7ac84e684 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Abecasis?= Date: Wed, 13 Jan 2010 18:13:11 +0100 Subject: QFile::readData: Simplify code Reviewed-by: Markus Goetz --- src/corelib/io/qfile.cpp | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/corelib/io/qfile.cpp b/src/corelib/io/qfile.cpp index df470b9..728c316 100644 --- a/src/corelib/io/qfile.cpp +++ b/src/corelib/io/qfile.cpp @@ -1517,18 +1517,14 @@ qint64 QFile::readData(char *data, qint64 len) if (!d->ensureFlushed()) return -1; - qint64 ret = -1; qint64 read = d->fileEngine->read(data, len); - if (read != -1) - ret = read; - - if(ret < 0) { + if(read < 0) { QFile::FileError err = d->fileEngine->error(); if(err == QFile::UnspecifiedError) err = QFile::ReadError; d->setError(err, d->fileEngine->errorString()); } - return ret; + return read; } /*! -- cgit v0.12 From ee889d2404f6a55a8fae812dc5809dc805905d2b Mon Sep 17 00:00:00 2001 From: Benjamin Poulain Date: Mon, 18 Jan 2010 16:10:24 +0100 Subject: Avoid painting while loading in the anomaly demo browser At load time, loading, layouting and painting are fighting for the CPU. By skipping painting and layouting, we achieve a better loading time, and the experience is better. --- demos/embedded/anomaly/anomaly.pro | 6 +++-- demos/embedded/anomaly/src/BrowserView.cpp | 5 ++-- demos/embedded/anomaly/src/BrowserView.h | 4 +++- demos/embedded/anomaly/src/webview.cpp | 37 ++++++++++++++++++++++++++++++ demos/embedded/anomaly/src/webview.h | 25 ++++++++++++++++++++ 5 files changed, 72 insertions(+), 5 deletions(-) create mode 100644 demos/embedded/anomaly/src/webview.cpp create mode 100644 demos/embedded/anomaly/src/webview.h diff --git a/demos/embedded/anomaly/anomaly.pro b/demos/embedded/anomaly/anomaly.pro index 2871ba7..165ce89 100644 --- a/demos/embedded/anomaly/anomaly.pro +++ b/demos/embedded/anomaly/anomaly.pro @@ -8,7 +8,8 @@ HEADERS += src/BrowserWindow.h \ src/BookmarksView.h \ src/flickcharm.h \ src/ZoomStrip.h \ - src/ControlStrip.h + src/ControlStrip.h \ + src/webview.h SOURCES += src/Main.cpp \ src/BrowserWindow.cpp \ src/BrowserView.cpp \ @@ -18,7 +19,8 @@ SOURCES += src/Main.cpp \ src/BookmarksView.cpp \ src/flickcharm.cpp \ src/ZoomStrip.cpp \ - src/ControlStrip.cpp + src/ControlStrip.cpp \ + src/webview.cpp RESOURCES += src/anomaly.qrc symbian { diff --git a/demos/embedded/anomaly/src/BrowserView.cpp b/demos/embedded/anomaly/src/BrowserView.cpp index ab52e81..0945b89 100644 --- a/demos/embedded/anomaly/src/BrowserView.cpp +++ b/demos/embedded/anomaly/src/BrowserView.cpp @@ -48,6 +48,7 @@ #include "ControlStrip.h" #include "TitleBar.h" #include "flickcharm.h" +#include "webview.h" #include "ZoomStrip.h" #if defined (Q_OS_SYMBIAN) @@ -62,7 +63,7 @@ BrowserView::BrowserView(QWidget *parent) , m_currentZoom(100) { m_titleBar = new TitleBar(this); - m_webView = new QWebView(this); + m_webView = new WebView(this); m_zoomStrip = new ZoomStrip(this); m_controlStrip = new ControlStrip(this); @@ -95,7 +96,7 @@ void BrowserView::initialize() connect(m_webView, SIGNAL(loadFinished(bool)), SLOT(finish(bool))); connect(m_webView, SIGNAL(urlChanged(QUrl)), SLOT(updateTitleBar())); - m_webView->setHtml("Will try to load page soon!"); + m_webView->setHtml("about:blank"); m_webView->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); m_webView->setFocus(); #ifdef Q_OS_SYMBIAN diff --git a/demos/embedded/anomaly/src/BrowserView.h b/demos/embedded/anomaly/src/BrowserView.h index fdc126d..5ab1dd7 100644 --- a/demos/embedded/anomaly/src/BrowserView.h +++ b/demos/embedded/anomaly/src/BrowserView.h @@ -49,6 +49,7 @@ class QUrl; class QWebView; class TitleBar; class ControlStrip; +class WebView; class ZoomStrip; class BrowserView : public QWidget @@ -81,7 +82,7 @@ protected: private: TitleBar *m_titleBar; - QWebView *m_webView; + WebView *m_webView; ZoomStrip *m_zoomStrip; ControlStrip *m_controlStrip; int m_progress; @@ -90,3 +91,4 @@ private: }; #endif // BROWSERVIEW_H + diff --git a/demos/embedded/anomaly/src/webview.cpp b/demos/embedded/anomaly/src/webview.cpp new file mode 100644 index 0000000..d55c68e --- /dev/null +++ b/demos/embedded/anomaly/src/webview.cpp @@ -0,0 +1,37 @@ +#include "webview.h" + +#include + +WebView::WebView(QWidget *parent) + : QWebView(parent) + , inLoading(false) +{ + connect(this, SIGNAL(loadStarted()), this, SLOT(newPageLoading())); + connect(this, SIGNAL(loadFinished(bool)), this, SLOT(pageLoaded(bool))); +} + +void WebView::paintEvent(QPaintEvent *event) +{ + if (inLoading && loadingTime.elapsed() < 750) { + QPainter painter(this); + painter.setBrush(Qt::white); + painter.setPen(Qt::NoPen); + foreach (const QRect &rect, event->region().rects()) { + painter.drawRect(rect); + } + } else { + QWebView::paintEvent(event); + } +} + +void WebView::newPageLoading() +{ + inLoading = true; + loadingTime.start(); +} + +void WebView::pageLoaded(bool) +{ + inLoading = false; + update(); +} diff --git a/demos/embedded/anomaly/src/webview.h b/demos/embedded/anomaly/src/webview.h new file mode 100644 index 0000000..a7426c6 --- /dev/null +++ b/demos/embedded/anomaly/src/webview.h @@ -0,0 +1,25 @@ +#ifndef WEBVIEW_H +#define WEBVIEW_H + +#include +#include + +class WebView : public QWebView +{ + Q_OBJECT +public: + WebView(QWidget *parent = 0); + +protected: + void paintEvent(QPaintEvent *event); + +private slots: + void newPageLoading(); + void pageLoaded(bool ok); + +private: + QTime loadingTime; + bool inLoading; +}; + +#endif // WEBVIEW_H -- cgit v0.12 From 74a3dc292d3e48e74836fb953fe793b65e652c54 Mon Sep 17 00:00:00 2001 From: Benjamin Poulain Date: Mon, 18 Jan 2010 16:13:19 +0100 Subject: Change the prefered content size of the anomaly browser Having the prefered content size equals to the screen size gives some bad layout on devices. --- demos/embedded/anomaly/src/webview.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/demos/embedded/anomaly/src/webview.cpp b/demos/embedded/anomaly/src/webview.cpp index d55c68e..ffcb6bc 100644 --- a/demos/embedded/anomaly/src/webview.cpp +++ b/demos/embedded/anomaly/src/webview.cpp @@ -1,6 +1,7 @@ #include "webview.h" #include +#include WebView::WebView(QWidget *parent) : QWebView(parent) @@ -8,6 +9,7 @@ WebView::WebView(QWidget *parent) { connect(this, SIGNAL(loadStarted()), this, SLOT(newPageLoading())); connect(this, SIGNAL(loadFinished(bool)), this, SLOT(pageLoaded(bool))); + page()->setPreferredContentsSize(QSize(1024, 768)); } void WebView::paintEvent(QPaintEvent *event) -- cgit v0.12 From 102f415e39772086e9066f2e9954c0c22725a23e Mon Sep 17 00:00:00 2001 From: Markus Goetz Date: Mon, 18 Jan 2010 16:01:14 +0100 Subject: Fix QSslCertificate issues Thank you Matthew Cattell for the fix! Task-number: QTBUG-6466 Reviewed-by: joao --- src/network/ssl/qsslcertificate.cpp | 14 ++++++++++++-- tests/auto/qsslcertificate/tst_qsslcertificate.cpp | 13 +++++++++++++ 2 files changed, 25 insertions(+), 2 deletions(-) diff --git a/src/network/ssl/qsslcertificate.cpp b/src/network/ssl/qsslcertificate.cpp index dd50c38..8993e72 100644 --- a/src/network/ssl/qsslcertificate.cpp +++ b/src/network/ssl/qsslcertificate.cpp @@ -304,6 +304,7 @@ static QString _q_SubjectInfoToString(QSslCertificate::SubjectInfo info) */ QString QSslCertificate::issuerInfo(SubjectInfo info) const { + // lazy init if (d->issuerInfo.isEmpty() && d->x509) d->issuerInfo = _q_mapFromOnelineName(q_X509_NAME_oneline(q_X509_get_issuer_name(d->x509), 0, 0)); @@ -320,7 +321,11 @@ QString QSslCertificate::issuerInfo(SubjectInfo info) const */ QString QSslCertificate::issuerInfo(const QByteArray &tag) const { - // ### Use a QByteArray for the keys in the map + // lazy init + if (d->issuerInfo.isEmpty() && d->x509) + d->issuerInfo = + _q_mapFromOnelineName(q_X509_NAME_oneline(q_X509_get_issuer_name(d->x509), 0, 0)); + return d->issuerInfo.value(QString::fromLatin1(tag)); } @@ -335,6 +340,7 @@ QString QSslCertificate::issuerInfo(const QByteArray &tag) const */ QString QSslCertificate::subjectInfo(SubjectInfo info) const { + // lazy init if (d->subjectInfo.isEmpty() && d->x509) d->subjectInfo = _q_mapFromOnelineName(q_X509_NAME_oneline(q_X509_get_subject_name(d->x509), 0, 0)); @@ -350,7 +356,11 @@ QString QSslCertificate::subjectInfo(SubjectInfo info) const */ QString QSslCertificate::subjectInfo(const QByteArray &tag) const { - // ### Use a QByteArray for the keys in the map + // lazy init + if (d->subjectInfo.isEmpty() && d->x509) + d->subjectInfo = + _q_mapFromOnelineName(q_X509_NAME_oneline(q_X509_get_subject_name(d->x509), 0, 0)); + return d->subjectInfo.value(QString::fromLatin1(tag)); } diff --git a/tests/auto/qsslcertificate/tst_qsslcertificate.cpp b/tests/auto/qsslcertificate/tst_qsslcertificate.cpp index 892d745..44f8522 100644 --- a/tests/auto/qsslcertificate/tst_qsslcertificate.cpp +++ b/tests/auto/qsslcertificate/tst_qsslcertificate.cpp @@ -105,6 +105,7 @@ private slots: void fromPath_data(); void fromPath(); void certInfo(); + void certInfoQByteArray(); void task256066toPem(); void nulInCN(); void nulInSan(); @@ -697,6 +698,18 @@ void tst_QSslCertificate::certInfo() QCOMPARE(cert, QSslCertificate(QByteArray::fromHex(der), QSsl::Der)); } +void tst_QSslCertificate::certInfoQByteArray() +{ + QSslCertificate cert = QSslCertificate::fromPath("certificates/cert.pem", QSsl::Pem, + QRegExp::FixedString).first(); + QVERIFY(!cert.isNull()); + + // in this test, check the bytearray variants before the enum variants to see if + // we fixed a bug we had with lazy initialization of the values. + QCOMPARE(cert.issuerInfo("CN"), QString("Test CA (1024 bit)")); + QCOMPARE(cert.subjectInfo("CN"), QString("name/with/slashes")); +} + void tst_QSslCertificate::task256066toPem() { // a certificate whose PEM encoding's length is a multiple of 64 -- cgit v0.12 From b5d3b999fa9c52246c8d4e4c1389df105d96cced Mon Sep 17 00:00:00 2001 From: Markus Goetz Date: Mon, 18 Jan 2010 14:57:21 +0100 Subject: Enhance QFileNetworkReply It is now considered as finished immediatly after creation to avoid an event loop spin. Had to change the auto tests a bit to account for the new behaviour. Reviewed-by: Peter Hartmann --- src/network/access/qfilenetworkreply.cpp | 94 +++++++++++--------------- src/network/access/qfilenetworkreply_p.h | 10 +-- src/network/access/qnetworkaccessmanager.cpp | 4 +- src/network/access/qnetworkreply.cpp | 5 +- tests/auto/qnetworkreply/tst_qnetworkreply.cpp | 21 ++++-- 5 files changed, 64 insertions(+), 70 deletions(-) diff --git a/src/network/access/qfilenetworkreply.cpp b/src/network/access/qfilenetworkreply.cpp index 44dd9e7..8c5065c 100644 --- a/src/network/access/qfilenetworkreply.cpp +++ b/src/network/access/qfilenetworkreply.cpp @@ -44,35 +44,32 @@ #include "QtCore/qdatetime.h" #include #include +#include QT_BEGIN_NAMESPACE QFileNetworkReplyPrivate::QFileNetworkReplyPrivate() - : QNetworkReplyPrivate(), realFileSize(0), finished(false) + : QNetworkReplyPrivate(), realFileSize(0) { } -QFileNetworkReply::QFileNetworkReply(QObject *parent, const QNetworkRequest &req) +QFileNetworkReply::~QFileNetworkReply() +{ +} + +QFileNetworkReply::QFileNetworkReply(QObject *parent, const QNetworkRequest &req, const QNetworkAccessManager::Operation op) : QNetworkReply(*new QFileNetworkReplyPrivate(), parent) { setRequest(req); setUrl(req.url()); - setOperation(QNetworkAccessManager::GetOperation); - QMetaObject::invokeMethod(this, "_q_startOperation", Qt::QueuedConnection); + setOperation(op); QNetworkReply::open(QIODevice::ReadOnly); -} -QFileNetworkReply::~QFileNetworkReply() -{ -} + qRegisterMetaType("QNetworkReply::NetworkError"); -// This code is mostly inspired by QNetworkAccessFileBackend -// We also use its translation context for error messages -void QFileNetworkReplyPrivate::_q_startOperation() -{ - Q_Q(QFileNetworkReply); + QFileNetworkReplyPrivate *d = (QFileNetworkReplyPrivate*) d_func(); - QUrl url = q->url(); + QUrl url = req.url(); if (url.host() == QLatin1String("localhost")) url.setHost(QString()); @@ -81,81 +78,75 @@ void QFileNetworkReplyPrivate::_q_startOperation() if (!url.host().isEmpty()) { // we handle only local files QString msg = QCoreApplication::translate("QNetworkAccessFileBackend", "Request for opening non-local file %1").arg(url.toString()); - q->setError(QNetworkReply::ProtocolInvalidOperationError, msg); - emit q->error(QNetworkReply::ProtocolInvalidOperationError); - doFinished(); + setError(QNetworkReply::ProtocolInvalidOperationError, msg); + QMetaObject::invokeMethod(this, "error", Qt::QueuedConnection, + Q_ARG(QNetworkReply::NetworkError, QNetworkReply::ProtocolInvalidOperationError)); + QMetaObject::invokeMethod(this, "finished", Qt::QueuedConnection); return; } #endif if (url.path().isEmpty()) url.setPath(QLatin1String("/")); - q->setUrl(url); + setUrl(url); QString fileName = url.toLocalFile(); if (fileName.isEmpty()) { fileName = url.toString(QUrl::RemoveAuthority | QUrl::RemoveFragment | QUrl::RemoveQuery); } - realFile.setFileName(fileName); + d->realFile.setFileName(fileName); - QFileInfo fi(realFile); + QFileInfo fi(d->realFile); if (fi.isDir()) { QString msg = QCoreApplication::translate("QNetworkAccessFileBackend", "Cannot open %1: Path is a directory").arg(url.toString()); - q->setError(QNetworkReply::ContentOperationNotPermittedError, msg); - emit q->error(QNetworkReply::ContentOperationNotPermittedError); - doFinished(); + setError(QNetworkReply::ContentOperationNotPermittedError, msg); + QMetaObject::invokeMethod(this, "error", Qt::QueuedConnection, + Q_ARG(QNetworkReply::NetworkError, QNetworkReply::ContentOperationNotPermittedError)); + QMetaObject::invokeMethod(this, "finished", Qt::QueuedConnection); return; } - bool opened = realFile.open(QIODevice::ReadOnly | QIODevice::Unbuffered); + bool opened = d->realFile.open(QIODevice::ReadOnly | QIODevice::Unbuffered); // could we open the file? if (!opened) { QString msg = QCoreApplication::translate("QNetworkAccessFileBackend", "Error opening %1: %2") - .arg(realFile.fileName(), realFile.errorString()); + .arg(d->realFile.fileName(), d->realFile.errorString()); - if (realFile.exists()) { - q->setError(QNetworkReply::ContentAccessDenied, msg); - emit q->error(QNetworkReply::ContentAccessDenied); + if (d->realFile.exists()) { + setError(QNetworkReply::ContentAccessDenied, msg); + QMetaObject::invokeMethod(this, "error", Qt::QueuedConnection, + Q_ARG(QNetworkReply::NetworkError, QNetworkReply::ContentAccessDenied)); } else { - q->setError(QNetworkReply::ContentNotFoundError, msg); - emit q->error(QNetworkReply::ContentNotFoundError); + setError(QNetworkReply::ContentNotFoundError, msg); + QMetaObject::invokeMethod(this, "error", Qt::QueuedConnection, + Q_ARG(QNetworkReply::NetworkError, QNetworkReply::ContentNotFoundError)); } - doFinished(); + QMetaObject::invokeMethod(this, "finished", Qt::QueuedConnection); return; } - realFileSize = fi.size(); - q->setHeader(QNetworkRequest::LastModifiedHeader, fi.lastModified()); - q->setHeader(QNetworkRequest::ContentLengthHeader, realFileSize); + d->realFileSize = fi.size(); + setHeader(QNetworkRequest::LastModifiedHeader, fi.lastModified()); + setHeader(QNetworkRequest::ContentLengthHeader, d->realFileSize); - emit q->metaDataChanged(); - emit q->downloadProgress(realFileSize, realFileSize); - emit q->readyRead(); - doFinished(); + QMetaObject::invokeMethod(this, "metaDataChanged", Qt::QueuedConnection); + QMetaObject::invokeMethod(this, "downloadProgress", Qt::QueuedConnection, + Q_ARG(qint64, d->realFileSize), Q_ARG(qint64, d->realFileSize)); + QMetaObject::invokeMethod(this, "readyRead", Qt::QueuedConnection); + QMetaObject::invokeMethod(this, "finished", Qt::QueuedConnection); } bool QFileNetworkReplyPrivate::isFinished() const { - return finished; -} - -void QFileNetworkReplyPrivate::doFinished() -{ - Q_Q(QFileNetworkReply); - finished = true; - emit q->finished(); + return true; } - void QFileNetworkReply::close() { Q_D(QFileNetworkReply); QNetworkReply::close(); d->realFile.close(); - - if (!d->finished) - d->doFinished(); } void QFileNetworkReply::abort() @@ -163,9 +154,6 @@ void QFileNetworkReply::abort() Q_D(QFileNetworkReply); QNetworkReply::close(); d->realFile.close(); - - if (!d->finished) - d->doFinished(); } qint64 QFileNetworkReply::bytesAvailable() const diff --git a/src/network/access/qfilenetworkreply_p.h b/src/network/access/qfilenetworkreply_p.h index 6f10672..125fa2e 100644 --- a/src/network/access/qfilenetworkreply_p.h +++ b/src/network/access/qfilenetworkreply_p.h @@ -66,7 +66,7 @@ class QFileNetworkReply: public QNetworkReply { Q_OBJECT public: - QFileNetworkReply(QObject *parent, const QNetworkRequest &req); + QFileNetworkReply(QObject *parent, const QNetworkRequest &req, const QNetworkAccessManager::Operation op); ~QFileNetworkReply(); virtual void abort(); @@ -76,12 +76,9 @@ public: virtual bool isSequential () const; qint64 size() const; - virtual qint64 readData(char *data, qint64 maxlen); Q_DECLARE_PRIVATE(QFileNetworkReply) - Q_PRIVATE_SLOT(d_func(), void _q_startOperation()) - }; class QFileNetworkReplyPrivate: public QNetworkReplyPrivate @@ -92,12 +89,7 @@ public: QFile realFile; qint64 realFileSize; - void _q_startOperation(); - virtual bool isFinished() const; - void doFinished(); - bool finished; - Q_DECLARE_PUBLIC(QFileNetworkReply) }; diff --git a/src/network/access/qnetworkaccessmanager.cpp b/src/network/access/qnetworkaccessmanager.cpp index d27fbe7..e16aedc 100644 --- a/src/network/access/qnetworkaccessmanager.cpp +++ b/src/network/access/qnetworkaccessmanager.cpp @@ -687,10 +687,10 @@ QNetworkReply *QNetworkAccessManager::createRequest(QNetworkAccessManager::Opera // Also if the scheme is empty we consider it a file. // The QNetworkAccessFileBackend will right now only be used // for PUT or qrc:// - if (op == QNetworkAccessManager::GetOperation + if ((op == QNetworkAccessManager::GetOperation || op == QNetworkAccessManager::HeadOperation) && (req.url().scheme() == QLatin1String("file") || req.url().scheme().isEmpty())) { - return new QFileNetworkReply(this, req); + return new QFileNetworkReply(this, req, op); } QNetworkRequest request = req; diff --git a/src/network/access/qnetworkreply.cpp b/src/network/access/qnetworkreply.cpp index 49a287f..0a8ea5d 100644 --- a/src/network/access/qnetworkreply.cpp +++ b/src/network/access/qnetworkreply.cpp @@ -239,7 +239,10 @@ QNetworkReplyPrivate::QNetworkReplyPrivate() \note Do not delete the object in the slot connected to this signal. Use deleteLater(). - \sa QNetworkAccessManager::finished() + You can also use isFinished() to check if a QNetworkReply + has finished even before you receive the finished() signal. + + \sa QNetworkAccessManager::finished(), isFinished() */ /*! diff --git a/tests/auto/qnetworkreply/tst_qnetworkreply.cpp b/tests/auto/qnetworkreply/tst_qnetworkreply.cpp index 33753f1..3bf06d7 100644 --- a/tests/auto/qnetworkreply/tst_qnetworkreply.cpp +++ b/tests/auto/qnetworkreply/tst_qnetworkreply.cpp @@ -838,13 +838,20 @@ void tst_QNetworkReply::stateChecking() QVERIFY(reply->isOpen()); QVERIFY(reply->isReadable()); QVERIFY(!reply->isWritable()); - QCOMPARE(reply->errorString(), QString("Unknown error")); + + // both behaviours are OK since we might change underlying behaviour again + if (!reply->isFinished()) + QCOMPARE(reply->errorString(), QString("Unknown error")); + else + QVERIFY(!reply->errorString().isEmpty()); + QCOMPARE(reply->manager(), &manager); QCOMPARE(reply->request(), req); QCOMPARE(int(reply->operation()), int(QNetworkAccessManager::GetOperation)); - QCOMPARE(reply->error(), QNetworkReply::NoError); - QCOMPARE(reply->isFinished(), false); + // error and not error are OK since we might change underlying behaviour again + if (!reply->isFinished()) + QCOMPARE(reply->error(), QNetworkReply::NoError); QCOMPARE(reply->url(), url); reply->abort(); @@ -1151,7 +1158,8 @@ void tst_QNetworkReply::getErrors() QNetworkReplyPtr reply = manager.get(request); reply->setParent(this); // we have expect-fails - QCOMPARE(reply->error(), QNetworkReply::NoError); + if (!reply->isFinished()) + QCOMPARE(reply->error(), QNetworkReply::NoError); // now run the request: connect(reply, SIGNAL(finished()), @@ -1512,6 +1520,7 @@ void tst_QNetworkReply::ioGetFromFile() QNetworkRequest request(QUrl::fromLocalFile(file.fileName())); QNetworkReplyPtr reply = manager.get(request); + QVERIFY(reply->isFinished()); // a file should immediatly be done DataReader reader(reply); connect(reply, SIGNAL(finished()), &QTestEventLoop::instance(), SLOT(exitLoop())); @@ -3170,7 +3179,9 @@ void tst_QNetworkReply::ioPostToHttpEmptyUploadProgress() void tst_QNetworkReply::lastModifiedHeaderForFile() { - QFileInfo fileInfo(SRCDIR "./bigfile"); + QFileInfo fileInfo(SRCDIR "/bigfile"); + QVERIFY(fileInfo.exists()); + QUrl url = QUrl::fromLocalFile(fileInfo.filePath()); QNetworkRequest request(url); -- cgit v0.12 From 330e852641121c0dddf2e9ac7dc6a7bafb5432dd Mon Sep 17 00:00:00 2001 From: Markus Goetz Date: Mon, 18 Jan 2010 15:46:29 +0100 Subject: Extend qfile_vs_qnetworkaccessmanager benchmark We need a third one to benchmark the without-event-loop use case that we now provide. Reviewed-by: TrustMe --- .../qfile_vs_qnetworkaccessmanager/main.cpp | 35 ++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/tests/benchmarks/qfile_vs_qnetworkaccessmanager/main.cpp b/tests/benchmarks/qfile_vs_qnetworkaccessmanager/main.cpp index 907ffb7..23e07db 100644 --- a/tests/benchmarks/qfile_vs_qnetworkaccessmanager/main.cpp +++ b/tests/benchmarks/qfile_vs_qnetworkaccessmanager/main.cpp @@ -55,11 +55,13 @@ class qfile_vs_qnetworkaccessmanager : public QObject // but.. this is a manual test anyway, so :) protected: void qnamFileRead_iteration(QNetworkAccessManager &manager, QNetworkRequest &request); + void qnamImmediateFileRead_iteration(QNetworkAccessManager &manager, QNetworkRequest &request); void qfileFileRead_iteration(); static const int iterations = 10; private slots: void qnamFileRead(); + void qnamImmediateFileRead(); void qfileFileRead(); void initTestCase(); @@ -124,6 +126,39 @@ void qfile_vs_qnetworkaccessmanager::qnamFileRead() qDebug() << "Speed:" << (qreal(size*iterations) / 1024.0) / (qreal(elapsed) / 1000.0) << "KB/sec"; } +void qfile_vs_qnetworkaccessmanager::qnamImmediateFileRead_iteration(QNetworkAccessManager &manager, QNetworkRequest &request) +{ + QNetworkReply* reply = manager.get(request); + QVERIFY(reply->isFinished()); // should be like that! + QByteArray qba = reply->readAll(); + delete reply; +} + +void qfile_vs_qnetworkaccessmanager::qnamImmediateFileRead() +{ + QNetworkAccessManager manager; + QTime t; + QNetworkRequest request(QUrl(testFile.fileName())); + + // do 3 dry runs for cache warmup + qnamImmediateFileRead_iteration(manager, request); + qnamImmediateFileRead_iteration(manager, request); + qnamImmediateFileRead_iteration(manager, request); + + t.start(); + // 10 real runs + QBENCHMARK_ONCE { + for (int i = 0; i < iterations; i++) { + qnamImmediateFileRead_iteration(manager, request); + } + } + + qint64 elapsed = t.elapsed(); + qDebug() << endl << "Finished!"; + qDebug() << "Bytes:" << size; + qDebug() << "Speed:" << (qreal(size*iterations) / 1024.0) / (qreal(elapsed) / 1000.0) << "KB/sec"; +} + void qfile_vs_qnetworkaccessmanager::qfileFileRead_iteration() { testFile.reset(); -- cgit v0.12 From ef14a38247f2a8b8a6094e7edeba0aef6e9f9c80 Mon Sep 17 00:00:00 2001 From: Markus Goetz Date: Mon, 18 Jan 2010 16:52:34 +0100 Subject: tst_qnetworkreply: There were 2 unneeded QSignalSpy Was a cut n paste error probably. Reviewed-by: TrustMe --- tests/auto/qnetworkreply/tst_qnetworkreply.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/tests/auto/qnetworkreply/tst_qnetworkreply.cpp b/tests/auto/qnetworkreply/tst_qnetworkreply.cpp index 3bf06d7..eec4797 100644 --- a/tests/auto/qnetworkreply/tst_qnetworkreply.cpp +++ b/tests/auto/qnetworkreply/tst_qnetworkreply.cpp @@ -3186,7 +3186,6 @@ void tst_QNetworkReply::lastModifiedHeaderForFile() QNetworkRequest request(url); QNetworkReplyPtr reply = manager.head(request); - QSignalSpy spy(reply, SIGNAL(uploadProgress(qint64,qint64))); connect(reply, SIGNAL(finished()), &QTestEventLoop::instance(), SLOT(exitLoop())); QTestEventLoop::instance().enterLoop(10); QVERIFY(!QTestEventLoop::instance().timeout()); @@ -3202,7 +3201,6 @@ void tst_QNetworkReply::lastModifiedHeaderForHttp() QNetworkRequest request(url); QNetworkReplyPtr reply = manager.head(request); - QSignalSpy spy(reply, SIGNAL(uploadProgress(qint64,qint64))); connect(reply, SIGNAL(finished()), &QTestEventLoop::instance(), SLOT(exitLoop())); QTestEventLoop::instance().enterLoop(10); QVERIFY(!QTestEventLoop::instance().timeout()); -- cgit v0.12 From 3214e477ccc3eae5c61b357696095f1f460fafbb Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Mon, 18 Jan 2010 20:01:00 +0100 Subject: Add proper license headers to new files. Reviewed-by: Trust Me --- demos/embedded/anomaly/src/webview.cpp | 41 ++++++++++++++++++++++++++++++++++ demos/embedded/anomaly/src/webview.h | 41 ++++++++++++++++++++++++++++++++++ 2 files changed, 82 insertions(+) diff --git a/demos/embedded/anomaly/src/webview.cpp b/demos/embedded/anomaly/src/webview.cpp index ffcb6bc..5cb913b 100644 --- a/demos/embedded/anomaly/src/webview.cpp +++ b/demos/embedded/anomaly/src/webview.cpp @@ -1,3 +1,44 @@ +/**************************************************************************** +** +** 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 demos 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 "webview.h" #include diff --git a/demos/embedded/anomaly/src/webview.h b/demos/embedded/anomaly/src/webview.h index a7426c6..ecd9f5a 100644 --- a/demos/embedded/anomaly/src/webview.h +++ b/demos/embedded/anomaly/src/webview.h @@ -1,3 +1,44 @@ +/**************************************************************************** +** +** 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 demos 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 WEBVIEW_H #define WEBVIEW_H -- cgit v0.12 From 7d8c3cb2e531ce6df8d14096b0b3d31f517e767a Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Tue, 19 Jan 2010 10:43:43 +0100 Subject: another attempt at fixing the translations build make qmake generate proper dependencies on lrelease in vcproj/sln files --- translations/translations.pri | 8 ++++++-- translations/translations.pro | 8 ++++++-- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/translations/translations.pri b/translations/translations.pri index 7a24a4f..8896654 100644 --- a/translations/translations.pri +++ b/translations/translations.pri @@ -8,8 +8,12 @@ defineReplace(prependAll) { return ($$result) } -LUPDATE = $$QT_BUILD_TREE/bin/lupdate -locations relative -no-ui-lines -LUPDATE ~= s,/,$$QMAKE_DIR_SEP, +LUPDATE = $$QT_BUILD_TREE/bin/lupdate +win32 { + LUPDATE ~= s,/,$$QMAKE_DIR_SEP, + LUPDATE = $${LUPDATE}.exe +} +LUPDATE += -locations relative -no-ui-lines ###### Qt Libraries diff --git a/translations/translations.pro b/translations/translations.pro index 05dd968..f1b9c99 100644 --- a/translations/translations.pro +++ b/translations/translations.pro @@ -1,7 +1,10 @@ TRANSLATIONS = $$files(*.ts) LRELEASE = $$QT_BUILD_TREE/bin/lrelease -LRELEASE ~= s,/,$$QMAKE_DIR_SEP, +win32 { + LRELEASE ~= s,/,$$QMAKE_DIR_SEP, + LRELEASE = $${LRELEASE}.exe +} contains(TEMPLATE_PREFIX, vc):vcproj = 1 @@ -14,7 +17,8 @@ LIBS = updateqm.input = TRANSLATIONS updateqm.output = ${QMAKE_FILE_BASE}.qm isEmpty(vcproj):updateqm.variable_out = PRE_TARGETDEPS -updateqm.commands = @echo lrelease ${QMAKE_FILE_IN} && $$LRELEASE ${QMAKE_FILE_IN} -qm ${QMAKE_FILE_OUT} +updateqm.commands = $$LRELEASE ${QMAKE_FILE_IN} -qm ${QMAKE_FILE_OUT} +silent:updateqm.commands = @echo lrelease ${QMAKE_FILE_IN} && $$updateqm.commands updateqm.name = LRELEASE ${QMAKE_FILE_IN} updateqm.CONFIG += no_link QMAKE_EXTRA_COMPILERS += updateqm -- cgit v0.12 From ed5fed36f38b9de0452cc427db679266d249f216 Mon Sep 17 00:00:00 2001 From: Kent Hansen Date: Tue, 19 Jan 2010 11:16:36 +0100 Subject: Remove QtScript connection when receiver QObject has been deleted We don't want to have to listen to the destroyed() signal for every receiver object of a connection, and likewise we don't want to create a QObject to handle each connection; instead, remove the connection lazily at signal emission time after we've detected that the receiver has been deleted. Task-number: QTBUG-7313 Reviewed-by: Simon Hausmann --- src/script/bridge/qscriptqobject.cpp | 9 ++++++++- .../qscriptextqobject/tst_qscriptextqobject.cpp | 23 ++++++++++++++++++++++ 2 files changed, 31 insertions(+), 1 deletion(-) diff --git a/src/script/bridge/qscriptqobject.cpp b/src/script/bridge/qscriptqobject.cpp index 3f4f6bb..db312bc 100644 --- a/src/script/bridge/qscriptqobject.cpp +++ b/src/script/bridge/qscriptqobject.cpp @@ -2220,7 +2220,14 @@ void QObjectConnectionManager::execute(int slotIndex, void **argv) JSC::call(exec, slot, callType, callData, thisObject, jscArgs); if (exec->hadException()) { - engine->emitSignalHandlerException(); + if (slot.inherits(&QtFunction::info) && !static_cast(JSC::asObject(slot))->qobject()) { + // The function threw an error because the target QObject has been deleted. + // The connections list is stale; remove the signal handler and ignore the exception. + removeSignalHandler(sender(), signalIndex, receiver, slot); + exec->clearException(); + } else { + engine->emitSignalHandlerException(); + } } } diff --git a/tests/auto/qscriptextqobject/tst_qscriptextqobject.cpp b/tests/auto/qscriptextqobject/tst_qscriptextqobject.cpp index de9d37e..b4ce561 100644 --- a/tests/auto/qscriptextqobject/tst_qscriptextqobject.cpp +++ b/tests/auto/qscriptextqobject/tst_qscriptextqobject.cpp @@ -532,6 +532,7 @@ private slots: void prototypes(); void objectDeleted(); void connectToDestroyedSignal(); + void emitAfterReceiverDeleted(); private: QScriptEngine *m_engine; @@ -3020,5 +3021,27 @@ void tst_QScriptExtQObject::connectToDestroyedSignal() #endif } +void tst_QScriptExtQObject::emitAfterReceiverDeleted() +{ + for (int x = 0; x < 2; ++x) { + MyQObject *obj = new MyQObject; + QScriptValue scriptObj = m_engine->newQObject(obj); + if (x == 0) { + // Connecting from JS + m_engine->globalObject().setProperty("obj", scriptObj); + QVERIFY(m_engine->evaluate("myObject.mySignal.connect(obj, 'mySlot()')").isUndefined()); + } else { + // Connecting from C++ + qScriptConnect(m_myObject, SIGNAL(mySignal()), scriptObj, scriptObj.property("mySlot")); + } + delete obj; + QSignalSpy signalHandlerExceptionSpy(m_engine, SIGNAL(signalHandlerException(QScriptValue))); + QVERIFY(!m_engine->hasUncaughtException()); + m_myObject->emitMySignal(); + QCOMPARE(signalHandlerExceptionSpy.count(), 0); + QVERIFY(!m_engine->hasUncaughtException()); + } +} + QTEST_MAIN(tst_QScriptExtQObject) #include "tst_qscriptextqobject.moc" -- cgit v0.12 From 26a0d799cd6e987666228afa9cfe017d226c4fdd Mon Sep 17 00:00:00 2001 From: Markus Goetz Date: Tue, 19 Jan 2010 10:25:53 +0100 Subject: QNativeSocketEngine windows: Fix performance degredation in write() We had an hack in the code that chunked writes. Try to avoid this since the hack is probably only needed for older windows versions. Task-number: QTBUG-7344 Reviewed-by: Peter Hartmann --- src/network/socket/qnativesocketengine_win.cpp | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/network/socket/qnativesocketengine_win.cpp b/src/network/socket/qnativesocketengine_win.cpp index 81bffd9..8257545 100644 --- a/src/network/socket/qnativesocketengine_win.cpp +++ b/src/network/socket/qnativesocketengine_win.cpp @@ -994,9 +994,9 @@ qint64 QNativeSocketEnginePrivate::nativeWrite(const char *data, qint64 len) { Q_Q(QNativeSocketEngine); qint64 ret = 0; - // don't send more than 49152 per call to WSASendTo to avoid getting a WSAENOBUFS + qint64 bytesToSend = len; + for (;;) { - qint64 bytesToSend = qMin(49152, len - ret); WSABUF buf; buf.buf = (char*)data + ret; buf.len = bytesToSend; @@ -1014,6 +1014,12 @@ qint64 QNativeSocketEnginePrivate::nativeWrite(const char *data, qint64 len) continue; } else if (WSAGetLastError() == WSAEWOULDBLOCK) { break; + } else if (WSAGetLastError() == WSAENOBUFS) { + // this function used to not send more than 49152 per call to WSASendTo + // to avoid getting a WSAENOBUFS. However this is a performance regression + // and we think it only appears with old windows versions. We now handle the + // WSAENOBUFS and hope it never appears anyway. + // just go on, the next loop run we will try a smaller number } else { int err = WSAGetLastError(); WS_ERROR_DEBUG(err); @@ -1029,6 +1035,9 @@ qint64 QNativeSocketEnginePrivate::nativeWrite(const char *data, qint64 len) } break; } + + // for next send: + bytesToSend = qMin(49152, len - ret); } #if defined (QNATIVESOCKETENGINE_DEBUG) -- cgit v0.12 From 001549276ac554e57d90c0c30130b7796ae69419 Mon Sep 17 00:00:00 2001 From: Thomas Zander Date: Tue, 19 Jan 2010 11:54:00 +0100 Subject: Fix Typo Reviewed-by: Alan Alpert --- doc/src/snippets/qstring/main.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/src/snippets/qstring/main.cpp b/doc/src/snippets/qstring/main.cpp index 629586e..3be504c 100644 --- a/doc/src/snippets/qstring/main.cpp +++ b/doc/src/snippets/qstring/main.cpp @@ -802,7 +802,7 @@ void Widget::toLowerFunction() { //! [75] QString str = "Qt by NOKIA"; - str = str.toLower(); // str == "qy by nokia" + str = str.toLower(); // str == "qt by nokia" //! [75] } -- cgit v0.12 From 5f81705a5db458d944f22d1162c0e9a772d75c19 Mon Sep 17 00:00:00 2001 From: Tom Cooksey Date: Tue, 19 Jan 2010 12:56:49 +0100 Subject: Fix X11/EGL builds using OpenGL ES 1.1 Task-number: QTBUG-7399 Reviewed-By: TrustMe --- src/opengl/qpixmapdata_x11gl_egl.cpp | 51 +++++++++++++++++++++++++++++++----- 1 file changed, 45 insertions(+), 6 deletions(-) diff --git a/src/opengl/qpixmapdata_x11gl_egl.cpp b/src/opengl/qpixmapdata_x11gl_egl.cpp index a5e0239..55aa1d0 100644 --- a/src/opengl/qpixmapdata_x11gl_egl.cpp +++ b/src/opengl/qpixmapdata_x11gl_egl.cpp @@ -39,10 +39,19 @@ ** ****************************************************************************/ +#include + #include #include #include + +#if !defined(QT_OPENGL_ES_1) && !defined(QT_OPENGL_ES_1_CL) #include +#endif + +#ifndef QT_OPENGL_ES_2 +#include +#endif #include "qpixmapdata_x11gl_p.h" @@ -187,7 +196,14 @@ QX11GLPixmapData::~QX11GLPixmapData() { } -static QGL2PaintEngineEx* qt_gl2_engine_for_pixmaps = 0; +#if !defined(QT_OPENGL_ES_1) && !defined(QT_OPENGL_ES_1_CL) +Q_GLOBAL_STATIC(QGL2PaintEngineEx, qt_gl_pixmap_2_engine) +#endif + +#ifndef QT_OPENGL_ES_2 +Q_GLOBAL_STATIC(QOpenGLPaintEngine, qt_gl_pixmap_engine) +#endif + QPaintEngine* QX11GLPixmapData::paintEngine() const { @@ -202,18 +218,41 @@ QPaintEngine* QX11GLPixmapData::paintEngine() const : qPixmapRGBSharedEglContext); } - if (!qt_gl2_engine_for_pixmaps) - qt_gl2_engine_for_pixmaps = new QGL2PaintEngineEx(); + QPaintEngine* engine; + +#if defined(QT_OPENGL_ES_1) || defined(QT_OPENGL_ES_1_CL) + engine = qt_gl_pixmap_engine(); +#elif defined(QT_OPENGL_ES_2) + engine = qt_gl_pixmap_2_engine(); +#else + if (qt_gl_preferGL2Engine()) + engine = qt_gl_pixmap_2_engine(); + else + engine = qt_gl_pixmap_engine(); +#endif + + // Support multiple painters on multiple pixmaps simultaniously - if (qt_gl2_engine_for_pixmaps->isActive()) { + if (engine->isActive()) { qWarning("Pixmap paint engine already active"); - QPaintEngine* engine = new QGL2PaintEngineEx(); + +#if defined(QT_OPENGL_ES_1) || defined(QT_OPENGL_ES_1_CL) + engine = new QOpenGLPaintEngine; +#elif defined(QT_OPENGL_ES_2) + engine = new QGL2PaintEngineEx; +#else + if (qt_gl_preferGL2Engine()) + engine = new QGL2PaintEngineEx; + else + engine = new QOpenGLPaintEngine; +#endif + engine->setAutoDestruct(true); return engine; } - return qt_gl2_engine_for_pixmaps; + return engine; } void QX11GLPixmapData::beginPaint() -- cgit v0.12 From 00b3098906dd7d4cfe7be3448e4eb90506d27012 Mon Sep 17 00:00:00 2001 From: Prasanth Ullattil Date: Tue, 19 Jan 2010 12:49:12 +0100 Subject: Designer crashes when previewing QMainWindow with native Toolbar on Mac The crash happens when a QMainWindow with a native toolbar is reparented. While re-parenting, the QToolBar triggers a new setParent() with the MacWindowToolBarButtonHint. This messes up the internal state, hence the crash. To avoid re-entering setParent() for the QMainWindow, this hint is set depending on the unifiedTitleAndToolBarOnMac property. This patch also fixes a related issue in Cocoa, we need to remove the reused NSToolbar from the old window while recreating the QMainWindow. Task-number: QTBUG-7162 Reviewed-by: Richard Moe Gustavsen --- src/gui/kernel/qwidget_mac.mm | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/gui/kernel/qwidget_mac.mm b/src/gui/kernel/qwidget_mac.mm index 354a666..b18830f 100644 --- a/src/gui/kernel/qwidget_mac.mm +++ b/src/gui/kernel/qwidget_mac.mm @@ -110,6 +110,7 @@ #include "qevent_p.h" #include "qdnd_p.h" #include +#include "qmainwindow.h" QT_BEGIN_NAMESPACE @@ -1721,6 +1722,15 @@ bool QWidgetPrivate::qt_widget_rgn(QWidget *widget, short wcode, RgnHandle rgn, void QWidgetPrivate::determineWindowClass() { Q_Q(QWidget); +#if !defined(QT_NO_MAINWINDOW) && !defined(QT_NO_TOOLBAR) + // Make sure that QMainWindow has the MacWindowToolBarButtonHint when the + // unifiedTitleAndToolBarOnMac property is ON. This is to avoid reentry of + // setParent() triggered by the QToolBar::event(QEvent::ParentChange). + QMainWindow *mainWindow = qobject_cast(q); + if (mainWindow && mainWindow->unifiedTitleAndToolBarOnMac()) { + data.window_flags |= Qt::MacWindowToolBarButtonHint; + } +#endif #ifndef QT_MAC_USE_COCOA // ### COCOA:Interleave these better! @@ -2743,7 +2753,9 @@ void QWidgetPrivate::setParent_sys(QWidget *parent, Qt::WindowFlags f) } if (wasWindow) { oldToolbar = [oldWindow toolbar]; + [oldToolbar retain]; oldToolbarVisible = [oldToolbar isVisible]; + [oldWindow setToolbar:nil]; } #endif } @@ -2787,6 +2799,7 @@ void QWidgetPrivate::setParent_sys(QWidget *parent, Qt::WindowFlags f) if (oldToolbar && !(f & Qt::FramelessWindowHint)) { OSWindowRef newWindow = qt_mac_window_for(q); [newWindow setToolbar:oldToolbar]; + [oldToolbar release]; [oldToolbar setVisible:oldToolbarVisible]; } #endif -- cgit v0.12 From 57473d5d2a7bd6ae3117f61ff29264a1b790bb01 Mon Sep 17 00:00:00 2001 From: Gunnar Sletta Date: Tue, 19 Jan 2010 15:08:01 +0100 Subject: Fixed y-inverted pixmaps on N900. The QGLPixmapData used default bind options, which means that the pixmap is always flipped up-side-down and rendered with flipping. The opaque pixmaps were uploaded unflipped which caused the bug. Ideally we do not want pixmap flipping so change the default in gl pixmaps and tag it accordingly. Reviewed-by: Samuel --- src/opengl/qpixmapdata_gl.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/opengl/qpixmapdata_gl.cpp b/src/opengl/qpixmapdata_gl.cpp index 1bfb6e3..6d47687 100644 --- a/src/opengl/qpixmapdata_gl.cpp +++ b/src/opengl/qpixmapdata_gl.cpp @@ -252,6 +252,10 @@ QGLPixmapData::QGLPixmapData(PixelType type) { setSerialNumber(++qt_gl_pixmap_serial); m_glDevice.setPixmapData(this); + + // Set InteralBindOptions minus the memory managed, since this + // QGLTexture is not managed as part of the internal texture cache + m_texture.options = QGLContext::PremultipliedAlphaBindOption; } QGLPixmapData::~QGLPixmapData() @@ -340,18 +344,18 @@ void QGLPixmapData::ensureCreated() const } if (!m_source.isNull()) { + glBindTexture(target, m_texture.id); if (external_format == GL_RGB) { const QImage tx = m_source.convertToFormat(QImage::Format_RGB888); - - glBindTexture(target, m_texture.id); glTexSubImage2D(target, 0, 0, 0, w, h, external_format, GL_UNSIGNED_BYTE, tx.bits()); } else { const QImage tx = ctx->d_func()->convertToGLFormat(m_source, true, external_format); - - glBindTexture(target, m_texture.id); glTexSubImage2D(target, 0, 0, 0, w, h, external_format, GL_UNSIGNED_BYTE, tx.bits()); + // convertToGLFormat will flip the Y axis, so it needs to + // be drawn upside down + m_texture.options |= QGLContext::InvertedYBindOption; } if (useFramebufferObjects()) -- cgit v0.12 From 417cc9c0724bd9f2170648175dd9461813c9bfe5 Mon Sep 17 00:00:00 2001 From: Jason McDonald Date: Wed, 20 Jan 2010 00:19:29 +1000 Subject: Add released version of 4.6.1 changes file for posterity. Reviewed-by: Trust Me --- dist/changes-4.6.1 | 261 +++++++++++++++++++++-------------------------------- 1 file changed, 104 insertions(+), 157 deletions(-) diff --git a/dist/changes-4.6.1 b/dist/changes-4.6.1 index 6e95fd5..3df6887 100644 --- a/dist/changes-4.6.1 +++ b/dist/changes-4.6.1 @@ -20,12 +20,6 @@ Merge Request: http://qt.gitorious.org * General * **************************************************************************** -New features ------------- - - - SomeClass, SomeOtherClass - * New classes for foo, bar and baz - Optimizations ------------- @@ -44,8 +38,8 @@ QtCore - QFile * Improve performance of getting the canonical filename on Linux - and Symbian by using realpath() system call - * Avoid stat() when opening a file + 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' @@ -60,7 +54,7 @@ QtCore - QXmlStreamreader * [merge request 1926] Fix parsing of DTDs that contain empty markup - declarations + declarations. QtGui ----- @@ -68,32 +62,21 @@ QtGui - QApplication * [QTBUG-6654] Fix crashes when deleting QWidgets in touch event handlers. - - 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 - 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. - * [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 - * '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. - * [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. + - 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. + - QGraphicsObject + * 'id' property was removed. Use the 'objectName' property instead. + - QGraphicsScene + * [QTBUG-6654] Fix crashes when deleting QGraphicsItems in touch + event handlers. - QGraphicsView * [QTBUG-6935] When using CacheBackground, the background is now correctly repainted after the QGraphicsView is shown after being @@ -101,29 +84,37 @@ QtGui * [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. + * [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). - * [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. - QGraphicsWidget - * [QTBUG-6272] Only call updateFont if the font have changed. + * [QTBUG-6272] Only call updateFont if the font has changed. + - 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. + - QPixmap + * load() and loadFromData() can now support compressed GL textures + 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. + * [QTBUG-6116] Fixed memory leak where a global object was not destroyed + at program exit. + - QPixmapCache + * Fixed a small leak when using the new QPixmapCache::Key based API. + - QPrinter + * [QTBUG-3412] QGraphicsProxyWidgets are now rendered correctly when + printing a QGraphicsScene to PDF format. + - QRasterPixmapData + * [QTBUG-6985] Fixed metric() to return the correct height in mm. - QTextDocument * [QTBUG-5397] Fixed printing of QTextDocuments not including custom text objects. - - - QTextDocument * [QTBUG-6051] Fixed an endless loop when printing a QTextDocument. - - QGraphicsScene - * [QTBUG-6654] Fix crashes when deleting QGraphicsItems in touch - event handlers. - - QtDBus ------ @@ -132,49 +123,54 @@ QtDBus 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 - + signals. - QDBusPendingReply and QDBusReply * [QTBUG-6571] Fixed a crash that would happen if you tried to - make a call with a disconnected QDBusConnection + make a call with a disconnected QDBusConnection. QtMultimedia ------------ - QAudioOutput * [Merge request 418] Fixed compilation the example provided for - QAudioOutput::start + QAudioOutput::start. QtNetwork --------- - QNetworkAccessManager - * 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 + * 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 + * [QTBUG-5799] Fix waitForConnected() on Windows. - QNetworkProxyFactory * Fixed systemProxyForQuery(), it could sometimes return invalid empty list - on Windows + on Windows. - QNetworkCookieJar - * [QTBUG-5815] do not check paths when accepting cookies + * [QTBUG-5815] Do not check paths when accepting cookies. - QHostInfo - * Use 5 parallel threads for host lookup instead of 1 + * Use five parallel threads for host lookup instead of one. QtOpenGL -------- + - 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 attrib arrays. + * Performance: Track the glVertexAttribPointer and only update it if it's + changed. + * [QTBUG-7094] Introduce new "snapToPixelGrid" flag for drawText. - QGLContext * bindTexture(QString) now supports DDS, ETC1, PVRTC2, and PVRTC4 compressed textures if the appropriate extensions are present @@ -187,31 +183,24 @@ QtOpenGL * 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. + - QGLPaintDevice + * [QTBUG-6204] Rebind window surface FBO after native GL rendering. + - QGLPixmapData + * [QTBUG-6902] Align GL_RGB data on a 4-byte line boundary. - 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 + * Fixed WA_TranslucentBackground for QGLWidgets on X11/EGL. + * Fix EGL surface leaks when re-parenting on X11/EGL. + - QTriangulatingStroker + * [QTBUG-6045] Crash in dashed line handling in the GL stroker. QtOpenVG -------- @@ -227,32 +216,29 @@ QtOpenVG 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) - - Fixed crash with ACID3 test on Symbian - - Fixed security issue XSL stylesheets and security origins. - - Added the framecapture example to the default build (merge request 2235) - -QtScript --------- - - - foo - * bar + - 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). + - Added the framecapture example to the default build (merge request 2235) + - Fixed crash with ACID3 test on Symbian + - Fixed security issue XSL stylesheets and security origins. QtSql ----- - - [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 + - [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 ----- @@ -262,13 +248,6 @@ QtSvg offsets. * [QTBUG-6899] Fixed crash when parsing invalid coordinate list. - -QtXml ------ - - - foo - * bar - Qt Plugins ---------- @@ -283,13 +262,6 @@ Qt Plugins - PNG plugin * [QTBUG-7161] Avoid a deep copy of QImage::bits() in the png writer. -Third party components ----------------------- - - - Updated foo to version 2.3.9. - - - Updated bar to the latest version from baz.org. - **************************************************************************** * Platform Specific Changes * @@ -300,89 +272,70 @@ 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 + - [QTBUG-6576] Fixed compilation on HP-UX 11.11. + - [QTBUG-6961] Fixed compilation on HURD. Qt for Linux/X11 ---------------- - [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++) - + - Added new mkspec for Maemo targets (linux-g++-maemo). + - Added new mkspec for Scratchbox host compiler (unsupported/linux-host-g++). - 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. - - 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 -------------- - - [QTBUG-5145] Compile fixes for win32-icc. + - [QTBUG-5145] Compile fixes for win32-icc. - 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). - Vista/XP styles * [QTBUG-6271] Fixed a compatibility issue with MDI windows in - certain non-standard themes. + certain non-standard themes. 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. - - [QTBUG-6973] Fixed a memory leak when using QWidget::setWindowIcon() in carbon. + pixmaps of different sizes into the same QPixmap object. + - [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-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 ---------------------- - - - - -DirectFB --------- - - - - -Qt for Windows CE ------------------ - - - + - [QTBUG-6636] Fixed a crash when calling removeToolBar on Mac native toolbars + using Cocoa. + - [QTBUG-5613] Fixed a bug where the application refused 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 Symbian -------------- - QApplication * [QTBUG-6098] Added a flag to avoid construction of application panes. - - Other: * [QTBUG-4990] Rewrote most of the regular pointer handling. + **************************************************************************** * Tools * **************************************************************************** @@ -397,12 +350,6 @@ Qt for Symbian * [QTBUG-5824] Fixed code generation to generate a call to QMainWindow::setCentralWidget() for promoted widgets as well. - - qdoc3 - * bar - - - Linguist - * baz - **************************************************************************** * Important Behavior Changes * **************************************************************************** -- cgit v0.12 From e318e3985247e0be91ae4f94afef7a39ea9928c6 Mon Sep 17 00:00:00 2001 From: Alexis Menard Date: Tue, 19 Jan 2010 15:22:49 +0100 Subject: Make the qWarnings in the animation API more useful. Task-number:QTBUG-6895 Reviewed-by:Thierry --- src/corelib/animation/qpropertyanimation.cpp | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/src/corelib/animation/qpropertyanimation.cpp b/src/corelib/animation/qpropertyanimation.cpp index eec5b30..cfd7cc2 100644 --- a/src/corelib/animation/qpropertyanimation.cpp +++ b/src/corelib/animation/qpropertyanimation.cpp @@ -256,7 +256,8 @@ void QPropertyAnimation::updateState(QAbstractAnimation::State newState, Q_D(QPropertyAnimation); if (!d->target && oldState == Stopped) { - qWarning("QPropertyAnimation::updateState: Changing state of an animation without target"); + qWarning("QPropertyAnimation::updateState (%s): Changing state of an animation without target", + d->propertyName.constData()); return; } @@ -279,10 +280,16 @@ void QPropertyAnimation::updateState(QAbstractAnimation::State newState, if (oldState == Stopped) { d->setDefaultStartEndValue(d->targetValue->property(d->propertyName.constData())); //let's check if we have a start value and an end value - if (!startValue().isValid() && (d->direction == Backward || !d->defaultStartEndValue.isValid())) - qWarning("QPropertyAnimation::updateState: starting an animation without start value"); - if (!endValue().isValid() && (d->direction == Forward || !d->defaultStartEndValue.isValid())) - qWarning("QPropertyAnimation::updateState: starting an animation without end value"); + if (!startValue().isValid() && (d->direction == Backward || !d->defaultStartEndValue.isValid())) { + qWarning("QPropertyAnimation::updateState (%s, %s, %s): starting an animation without start value", + d->propertyName.constData(), d->target.data()->metaObject()->className(), + qPrintable(d->target.data()->objectName())); + } + if (!endValue().isValid() && (d->direction == Forward || !d->defaultStartEndValue.isValid())) { + qWarning("QPropertyAnimation::updateState (%s, %s, %s): starting an animation without end value", + d->propertyName.constData(), d->target.data()->metaObject()->className(), + qPrintable(d->target.data()->objectName())); + } } } else if (hash.value(key) == this) { hash.remove(key); -- cgit v0.12 From beab6d886504c011af9b973d1d0a81ce8e700e30 Mon Sep 17 00:00:00 2001 From: kh1 Date: Tue, 19 Jan 2010 15:27:13 +0100 Subject: Return some fake data if we can't handle the network request. Since we are the only handler for network request and cannot forward the request to our parent (e.g. unwanted net access), we work arround the case we can't handle it. We do create a reply with dummy data which will prevent some blocking and allows further processing of requested data. Task-number: QTBUG-7427 Reviewed-by: kh --- tools/assistant/tools/assistant/helpviewer.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tools/assistant/tools/assistant/helpviewer.cpp b/tools/assistant/tools/assistant/helpviewer.cpp index a9abda5..1900c7e 100644 --- a/tools/assistant/tools/assistant/helpviewer.cpp +++ b/tools/assistant/tools/assistant/helpviewer.cpp @@ -151,7 +151,8 @@ QNetworkReply *HelpNetworkAccessManager::createRequest(Operation /*op*/, mimeType = QLatin1String("text/html"); } - return new HelpNetworkReply(request, helpEngine->fileData(url), mimeType); + const QByteArray &ba = helpEngine->fileData(url); + return new HelpNetworkReply(request, ba.isEmpty() ? " " : ba, mimeType); } class HelpPage : public QWebPage -- cgit v0.12 From 0586f10054b681492b23db85a31b10fc2b6c301e Mon Sep 17 00:00:00 2001 From: Jason McDonald Date: Wed, 20 Jan 2010 01:25:53 +1000 Subject: Add skeleton changes file for 4.6.2. Reviewed-by: Trust Me --- dist/changes-4.6.2 | 159 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 159 insertions(+) create mode 100644 dist/changes-4.6.2 diff --git a/dist/changes-4.6.2 b/dist/changes-4.6.2 new file mode 100644 index 0000000..d35f945 --- /dev/null +++ b/dist/changes-4.6.2 @@ -0,0 +1,159 @@ +Qt 4.6.2 is a bug-fix release. It maintains both forward and backward +compatibility (source and binary) with Qt 4.6.0. For more details, +refer to the online documentation included in this distribution. The +documentation is also available online: + + http://qt.nokia.com/doc/4.6 + +The Qt version 4.6 series is binary compatible with the 4.5.x series. +Applications compiled for 4.5 will continue to run with 4.6. + +Some of the changes listed in this file include issue tracking numbers +corresponding to tasks in the Qt Bug Tracker, the (now obsolete) Task +Tracker, or the Merge Request queue of the public source repository. + +Qt Bug Tracker: http://bugreports.qt.nokia.com +Task Tracker: http://qt.nokia.com/developer/task-tracker +Merge Request: http://qt.gitorious.org + +**************************************************************************** +* General * +**************************************************************************** + +New features +------------ + + - SomeClass, SomeOtherClass + * New classes for foo, bar and baz + +Optimizations +------------- + + - Optimized foo in QSomeClass + * See list of Important Behavior Changes below + + +**************************************************************************** +* Library * +**************************************************************************** + +QtCore +------ + + - foo + * bar + +QtGui +----- + + - foo + * bar + +QtDBus +------ + + - foo + * bar + +QtNetwork +--------- + + - foo + * bar + +QtOpenGL +-------- + + - foo + * bar + +QtScript +-------- + + - foo + * bar + +QtSql +----- + + - foo + * bar + +QtXml +----- + + - foo + * bar + +Qt Plugins +---------- + + - foo + * bar + +Third party components +---------------------- + + - Updated foo to version 2.3.9. + + - Updated bar to the latest version from baz.org. + + +**************************************************************************** +* Platform Specific Changes * +**************************************************************************** + +Qt for Unix (X11 and Mac OS X) +------------------------------ + + - + +Qt for Linux/X11 +---------------- + + - + +Qt for Windows +-------------- + + - + +Qt for Mac OS X +--------------- + + - + +Qt for Embedded Linux +--------------------- + + - + +DirectFB +-------- + + - + +Qt for Windows CE +----------------- + + - + +**************************************************************************** +* Tools * +**************************************************************************** + + - Designer + * foo + + - qdoc3 + * bar + + - Linguist + * baz + +**************************************************************************** +* Important Behavior Changes * +**************************************************************************** + + - + -- cgit v0.12 From 71a8c4ea5049767a2a83c689fd89a4b685e62aa4 Mon Sep 17 00:00:00 2001 From: Jason McDonald Date: Wed, 20 Jan 2010 01:45:46 +1000 Subject: Bump version to 4.6.2. Reviewed-by: Trust Me --- src/corelib/global/qglobal.h | 4 ++-- src/plugins/qpluginbase.pri | 2 +- src/qbase.pri | 2 +- tests/auto/mediaobject/dummy/dummy.pro | 2 +- tests/auto/selftests/expected_cmptest.txt | 2 +- tests/auto/selftests/expected_crashes_3.txt | 2 +- tests/auto/selftests/expected_longstring.txt | 2 +- tests/auto/selftests/expected_maxwarnings.txt | 2 +- tests/auto/selftests/expected_skip.txt | 2 +- tests/auto/selftests/expected_xunit.txt | 4 ++-- tests/auto/uic/baseline/config_fromuic3.ui.h | 2 +- tools/assistant/tools/assistant/doc/assistant.qdocconf | 2 +- tools/qdoc3/test/assistant.qdocconf | 2 +- tools/qdoc3/test/designer.qdocconf | 2 +- tools/qdoc3/test/linguist.qdocconf | 2 +- tools/qdoc3/test/qmake.qdocconf | 2 +- tools/qdoc3/test/qt-build-docs.qdocconf | 6 +++--- tools/qdoc3/test/qt.qdocconf | 6 +++--- 18 files changed, 24 insertions(+), 24 deletions(-) diff --git a/src/corelib/global/qglobal.h b/src/corelib/global/qglobal.h index f350d1a..abdafc3 100644 --- a/src/corelib/global/qglobal.h +++ b/src/corelib/global/qglobal.h @@ -44,11 +44,11 @@ #include -#define QT_VERSION_STR "4.6.1" +#define QT_VERSION_STR "4.6.2" /* QT_VERSION is (major << 16) + (minor << 8) + patch. */ -#define QT_VERSION 0x040601 +#define QT_VERSION 0x040602 /* can be used like #if (QT_VERSION >= QT_VERSION_CHECK(4, 4, 0)) */ diff --git a/src/plugins/qpluginbase.pri b/src/plugins/qpluginbase.pri index b66f8f9..3af8b40 100644 --- a/src/plugins/qpluginbase.pri +++ b/src/plugins/qpluginbase.pri @@ -1,6 +1,6 @@ TEMPLATE = lib isEmpty(QT_MAJOR_VERSION) { - VERSION=4.6.1 + VERSION=4.6.2 } else { VERSION=$${QT_MAJOR_VERSION}.$${QT_MINOR_VERSION}.$${QT_PATCH_VERSION} } diff --git a/src/qbase.pri b/src/qbase.pri index d1a2a75..d9832a1 100644 --- a/src/qbase.pri +++ b/src/qbase.pri @@ -4,7 +4,7 @@ INCLUDEPATH *= $$QMAKE_INCDIR_QT/$$TARGET #just for today to have some compat isEmpty(QT_ARCH):!isEmpty(ARCH):QT_ARCH=$$ARCH #another compat that will rot for change #215700 TEMPLATE = lib isEmpty(QT_MAJOR_VERSION) { - VERSION=4.6.1 + VERSION=4.6.2 } else { VERSION=$${QT_MAJOR_VERSION}.$${QT_MINOR_VERSION}.$${QT_PATCH_VERSION} } diff --git a/tests/auto/mediaobject/dummy/dummy.pro b/tests/auto/mediaobject/dummy/dummy.pro index 5417b50..2f27c4a 100644 --- a/tests/auto/mediaobject/dummy/dummy.pro +++ b/tests/auto/mediaobject/dummy/dummy.pro @@ -1,7 +1,7 @@ TEMPLATE = lib isEmpty(QT_MAJOR_VERSION) { - VERSION=4.6.1 + VERSION=4.6.2 } else { VERSION=$${QT_MAJOR_VERSION}.$${QT_MINOR_VERSION}.$${QT_PATCH_VERSION} } diff --git a/tests/auto/selftests/expected_cmptest.txt b/tests/auto/selftests/expected_cmptest.txt index a941f21..1b65adf 100644 --- a/tests/auto/selftests/expected_cmptest.txt +++ b/tests/auto/selftests/expected_cmptest.txt @@ -1,5 +1,5 @@ ********* Start testing of tst_Cmptest ********* -Config: Using QTest library 4.6.1, Qt 4.6.1 +Config: Using QTest library 4.6.2, Qt 4.6.2 PASS : tst_Cmptest::initTestCase() PASS : tst_Cmptest::compare_boolfuncs() PASS : tst_Cmptest::compare_pointerfuncs() diff --git a/tests/auto/selftests/expected_crashes_3.txt b/tests/auto/selftests/expected_crashes_3.txt index 692fddb..aabe83d 100644 --- a/tests/auto/selftests/expected_crashes_3.txt +++ b/tests/auto/selftests/expected_crashes_3.txt @@ -1,5 +1,5 @@ ********* Start testing of tst_Crashes ********* -Config: Using QTest library 4.6.1, Qt 4.6.1 +Config: Using QTest library 4.6.2, Qt 4.6.2 PASS : tst_Crashes::initTestCase() QFATAL : tst_Crashes::crash() Received signal 11 FAIL! : tst_Crashes::crash() Received a fatal error. diff --git a/tests/auto/selftests/expected_longstring.txt b/tests/auto/selftests/expected_longstring.txt index 5755c97..3fe237a 100644 --- a/tests/auto/selftests/expected_longstring.txt +++ b/tests/auto/selftests/expected_longstring.txt @@ -1,5 +1,5 @@ ********* Start testing of tst_LongString ********* -Config: Using QTest library 4.6.1, Qt 4.6.1 +Config: Using QTest library 4.6.2, Qt 4.6.2 PASS : tst_LongString::initTestCase() FAIL! : tst_LongString::failWithLongString() Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Donec quam felis, ultricies nec, pellentesque eu, pretium quis, sem. Nulla consequat massa quis enim. Donec pede justo, fringilla vel, aliquet nec, vulputate eget, arcu. In enim justo, rhoncus ut, imperdiet a, venenatis vitae, justo. Nullam dictum felis eu pede mollis pretium. Integer tincidunt. Cras dapibus. Vivamus elementum semper nisi. Aenean vulputate eleifend tellus. Aenean leo ligula, porttitor eu, consequat vitae, eleifend ac, enim. Aliquam lorem ante, dapibus in, viverra quis, feugiat a, tellus. Phasellus viverra nulla ut metus varius laoreet. Quisque rutrum. Aenean imperdiet. Etiam ultricies nisi vel augue. Curabitur ullamcorper ultricies nisi. Nam eget dui. diff --git a/tests/auto/selftests/expected_maxwarnings.txt b/tests/auto/selftests/expected_maxwarnings.txt index 032a3e8..8bafeff 100644 --- a/tests/auto/selftests/expected_maxwarnings.txt +++ b/tests/auto/selftests/expected_maxwarnings.txt @@ -1,5 +1,5 @@ ********* Start testing of MaxWarnings ********* -Config: Using QTest library 4.6.1, Qt 4.6.1 +Config: Using QTest library 4.6.2, Qt 4.6.2 PASS : MaxWarnings::initTestCase() QWARN : MaxWarnings::warn() 0 QWARN : MaxWarnings::warn() 1 diff --git a/tests/auto/selftests/expected_skip.txt b/tests/auto/selftests/expected_skip.txt index e687759..c4ef92d 100644 --- a/tests/auto/selftests/expected_skip.txt +++ b/tests/auto/selftests/expected_skip.txt @@ -1,5 +1,5 @@ ********* Start testing of tst_Skip ********* -Config: Using QTest library 4.6.1, Qt 4.6.1 +Config: Using QTest library 4.6.2, Qt 4.6.2 PASS : tst_Skip::initTestCase() SKIP : tst_Skip::test() skipping all Loc: [/home/rmcgover/depot/qt-git/mainline/tests/auto/selftests/skip/tst_skip.cpp(68)] diff --git a/tests/auto/selftests/expected_xunit.txt b/tests/auto/selftests/expected_xunit.txt index d5cd531..5ec4668 100644 --- a/tests/auto/selftests/expected_xunit.txt +++ b/tests/auto/selftests/expected_xunit.txt @@ -1,8 +1,8 @@ - - + + diff --git a/tests/auto/uic/baseline/config_fromuic3.ui.h b/tests/auto/uic/baseline/config_fromuic3.ui.h index ec20d05..93dcfb5 100644 --- a/tests/auto/uic/baseline/config_fromuic3.ui.h +++ b/tests/auto/uic/baseline/config_fromuic3.ui.h @@ -45,7 +45,7 @@ ** Form generated from reading UI file 'config_fromuic3.ui' ** ** Created: Thu Dec 17 12:48:42 2009 -** by: Qt User Interface Compiler version 4.6.1 +** by: Qt User Interface Compiler version 4.6.2 ** ** WARNING! All changes made in this file will be lost when recompiling UI file! ********************************************************************************/ diff --git a/tools/assistant/tools/assistant/doc/assistant.qdocconf b/tools/assistant/tools/assistant/doc/assistant.qdocconf index 584c3ce..b8726a4 100644 --- a/tools/assistant/tools/assistant/doc/assistant.qdocconf +++ b/tools/assistant/tools/assistant/doc/assistant.qdocconf @@ -12,5 +12,5 @@ HTML.footer = "


\n" \ "\n" \ "\n" \ "\n" \ - "\n" \ + "\n" \ "
Copyright © 2010 Nokia Corporation and/or its subsidiary(-ies)Trademarks
Qt 4.6.1
Qt 4.6.2
" diff --git a/tools/qdoc3/test/assistant.qdocconf b/tools/qdoc3/test/assistant.qdocconf index adca7b4..38da552 100644 --- a/tools/qdoc3/test/assistant.qdocconf +++ b/tools/qdoc3/test/assistant.qdocconf @@ -17,7 +17,7 @@ qhp.Assistant.namespace = com.trolltech.assistant.460 qhp.Assistant.virtualFolder = qdoc qhp.Assistant.indexTitle = Qt Assistant Manual qhp.Assistant.extraFiles = classic.css images/qt-logo.png images/trolltech-logo.png -qhp.Assistant.filterAttributes = qt 4.6.1 tools assistant +qhp.Assistant.filterAttributes = qt 4.6.2 tools assistant qhp.Assistant.customFilters.Assistant.name = Qt Assistant Manual qhp.Assistant.customFilters.Assistant.filterAttributes = qt tools assistant qhp.Assistant.subprojects = manual examples diff --git a/tools/qdoc3/test/designer.qdocconf b/tools/qdoc3/test/designer.qdocconf index d30ade9..57d21a9 100644 --- a/tools/qdoc3/test/designer.qdocconf +++ b/tools/qdoc3/test/designer.qdocconf @@ -17,7 +17,7 @@ qhp.Designer.namespace = com.trolltech.designer.460 qhp.Designer.virtualFolder = qdoc qhp.Designer.indexTitle = Qt Designer Manual qhp.Designer.extraFiles = classic.css images/qt-logo.png images/trolltech-logo.png -qhp.Designer.filterAttributes = qt 4.6.1 tools designer +qhp.Designer.filterAttributes = qt 4.6.2 tools designer qhp.Designer.customFilters.Designer.name = Qt Designer Manual qhp.Designer.customFilters.Designer.filterAttributes = qt tools designer qhp.Designer.subprojects = manual examples diff --git a/tools/qdoc3/test/linguist.qdocconf b/tools/qdoc3/test/linguist.qdocconf index f06671b..5860b33 100644 --- a/tools/qdoc3/test/linguist.qdocconf +++ b/tools/qdoc3/test/linguist.qdocconf @@ -17,7 +17,7 @@ qhp.Linguist.namespace = com.trolltech.linguist.460 qhp.Linguist.virtualFolder = qdoc qhp.Linguist.indexTitle = Qt Linguist Manual qhp.Linguist.extraFiles = classic.css images/qt-logo.png images/trolltech-logo.png -qhp.Linguist.filterAttributes = qt 4.6.1 tools linguist +qhp.Linguist.filterAttributes = qt 4.6.2 tools linguist qhp.Linguist.customFilters.Linguist.name = Qt Linguist Manual qhp.Linguist.customFilters.Linguist.filterAttributes = qt tools linguist qhp.Linguist.subprojects = manual examples diff --git a/tools/qdoc3/test/qmake.qdocconf b/tools/qdoc3/test/qmake.qdocconf index ad27d75..0e7d960 100644 --- a/tools/qdoc3/test/qmake.qdocconf +++ b/tools/qdoc3/test/qmake.qdocconf @@ -17,7 +17,7 @@ qhp.qmake.namespace = com.trolltech.qmake.460 qhp.qmake.virtualFolder = qdoc qhp.qmake.indexTitle = QMake Manual qhp.qmake.extraFiles = classic.css images/qt-logo.png images/trolltech-logo.png -qhp.qmake.filterAttributes = qt 4.6.1 tools qmake +qhp.qmake.filterAttributes = qt 4.6.2 tools qmake qhp.qmake.customFilters.qmake.name = qmake Manual qhp.qmake.customFilters.qmake.filterAttributes = qt tools qmake qhp.qmake.subprojects = manual diff --git a/tools/qdoc3/test/qt-build-docs.qdocconf b/tools/qdoc3/test/qt-build-docs.qdocconf index e9b9eb8..def4e67 100644 --- a/tools/qdoc3/test/qt-build-docs.qdocconf +++ b/tools/qdoc3/test/qt-build-docs.qdocconf @@ -32,9 +32,9 @@ qhp.Qt.extraFiles = classic.css \ images/dynamiclayouts-example.png \ images/stylesheet-coffee-plastique.png -qhp.Qt.filterAttributes = qt 4.6.1 qtrefdoc -qhp.Qt.customFilters.Qt.name = Qt 4.6.1 -qhp.Qt.customFilters.Qt.filterAttributes = qt 4.6.1 +qhp.Qt.filterAttributes = qt 4.6.2 qtrefdoc +qhp.Qt.customFilters.Qt.name = Qt 4.6.2 +qhp.Qt.customFilters.Qt.filterAttributes = qt 4.6.2 qhp.Qt.subprojects = classes overviews examples qhp.Qt.subprojects.classes.title = Classes qhp.Qt.subprojects.classes.indexTitle = Qt's Classes diff --git a/tools/qdoc3/test/qt.qdocconf b/tools/qdoc3/test/qt.qdocconf index a99f73e..1aefa98 100644 --- a/tools/qdoc3/test/qt.qdocconf +++ b/tools/qdoc3/test/qt.qdocconf @@ -34,9 +34,9 @@ qhp.Qt.extraFiles = classic.css \ images/dynamiclayouts-example.png \ images/stylesheet-coffee-plastique.png -qhp.Qt.filterAttributes = qt 4.6.1 qtrefdoc -qhp.Qt.customFilters.Qt.name = Qt 4.6.1 -qhp.Qt.customFilters.Qt.filterAttributes = qt 4.6.1 +qhp.Qt.filterAttributes = qt 4.6.2 qtrefdoc +qhp.Qt.customFilters.Qt.name = Qt 4.6.2 +qhp.Qt.customFilters.Qt.filterAttributes = qt 4.6.2 qhp.Qt.subprojects = classes overviews examples qhp.Qt.subprojects.classes.title = Classes qhp.Qt.subprojects.classes.indexTitle = Qt's Classes -- cgit v0.12 From 83a97dd0f2473a5c9cc1b6b0eba93de657d66ed4 Mon Sep 17 00:00:00 2001 From: Jason McDonald Date: Wed, 20 Jan 2010 02:03:45 +1000 Subject: Fix copyright year. Reviewed-by: Trust Me --- doc/src/modules.qdoc | 2 +- src/opengl/gl2paintengineex/qtextureglyphcache_gl.cpp | 2 +- src/opengl/gl2paintengineex/qtextureglyphcache_gl_p.h | 2 +- src/xmlpatterns/parser/qquerytransformparser.cpp | 2 +- src/xmlpatterns/parser/qquerytransformparser_p.h | 2 +- src/xmlpatterns/parser/qxslttokenlookup.cpp | 2 +- src/xmlpatterns/parser/qxslttokenlookup_p.h | 2 +- tests/auto/maketestselftest/tst_maketestselftest.cpp | 2 +- tests/auto/uic/baseline/config_fromuic3.ui | 2 +- tests/auto/uic/baseline/config_fromuic3.ui.h | 2 +- util/qlalr/doc/qlalr.qdocconf | 2 +- 11 files changed, 11 insertions(+), 11 deletions(-) diff --git a/doc/src/modules.qdoc b/doc/src/modules.qdoc index 298e0be..44d6ed6 100644 --- a/doc/src/modules.qdoc +++ b/doc/src/modules.qdoc @@ -1046,7 +1046,7 @@ distributed under the following license. \legalese - Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).\br + Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).\br All rights reserved.\br Contact: Nokia Corporation (qt-info@nokia.com) diff --git a/src/opengl/gl2paintengineex/qtextureglyphcache_gl.cpp b/src/opengl/gl2paintengineex/qtextureglyphcache_gl.cpp index 0720170..fed1658 100644 --- a/src/opengl/gl2paintengineex/qtextureglyphcache_gl.cpp +++ b/src/opengl/gl2paintengineex/qtextureglyphcache_gl.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/opengl/gl2paintengineex/qtextureglyphcache_gl_p.h b/src/opengl/gl2paintengineex/qtextureglyphcache_gl_p.h index 393893c..2a8a782 100644 --- a/src/opengl/gl2paintengineex/qtextureglyphcache_gl_p.h +++ b/src/opengl/gl2paintengineex/qtextureglyphcache_gl_p.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/xmlpatterns/parser/qquerytransformparser.cpp b/src/xmlpatterns/parser/qquerytransformparser.cpp index c250d0c..6daa470 100644 --- a/src/xmlpatterns/parser/qquerytransformparser.cpp +++ b/src/xmlpatterns/parser/qquerytransformparser.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/xmlpatterns/parser/qquerytransformparser_p.h b/src/xmlpatterns/parser/qquerytransformparser_p.h index 204b6f8..0b316ec 100644 --- a/src/xmlpatterns/parser/qquerytransformparser_p.h +++ b/src/xmlpatterns/parser/qquerytransformparser_p.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/xmlpatterns/parser/qxslttokenlookup.cpp b/src/xmlpatterns/parser/qxslttokenlookup.cpp index a46ec8a..781ba0d 100644 --- a/src/xmlpatterns/parser/qxslttokenlookup.cpp +++ b/src/xmlpatterns/parser/qxslttokenlookup.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/xmlpatterns/parser/qxslttokenlookup_p.h b/src/xmlpatterns/parser/qxslttokenlookup_p.h index b45407d..6d004b0 100644 --- a/src/xmlpatterns/parser/qxslttokenlookup_p.h +++ b/src/xmlpatterns/parser/qxslttokenlookup_p.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/tests/auto/maketestselftest/tst_maketestselftest.cpp b/tests/auto/maketestselftest/tst_maketestselftest.cpp index ea7f36c..c674202 100644 --- a/tests/auto/maketestselftest/tst_maketestselftest.cpp +++ b/tests/auto/maketestselftest/tst_maketestselftest.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/tests/auto/uic/baseline/config_fromuic3.ui b/tests/auto/uic/baseline/config_fromuic3.ui index 0bd6256..2e7addb 100644 --- a/tests/auto/uic/baseline/config_fromuic3.ui +++ b/tests/auto/uic/baseline/config_fromuic3.ui @@ -3,7 +3,7 @@ ********************************************************************* ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/tests/auto/uic/baseline/config_fromuic3.ui.h b/tests/auto/uic/baseline/config_fromuic3.ui.h index 93dcfb5..6e22dc7 100644 --- a/tests/auto/uic/baseline/config_fromuic3.ui.h +++ b/tests/auto/uic/baseline/config_fromuic3.ui.h @@ -1,7 +1,7 @@ /* ********************************************************************* ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/util/qlalr/doc/qlalr.qdocconf b/util/qlalr/doc/qlalr.qdocconf index 391844b..ea9eaa6 100644 --- a/util/qlalr/doc/qlalr.qdocconf +++ b/util/qlalr/doc/qlalr.qdocconf @@ -59,7 +59,7 @@ HTML.postheader = "\n" \ "
\n" \ - "\n" \ + "\n" \ "\n" \ "\n" \ "
Copyright © 2009 Nokia Corporation and/or its subsidiary(-ies)Copyright © 2010 Nokia Corporation and/or its subsidiary(-ies)Trademarks
Qt \\version
" -- cgit v0.12 From c5809ade611d93c165dbde8c6ee618da73b0ad48 Mon Sep 17 00:00:00 2001 From: Nils Jeisecke Date: Wed, 13 Jan 2010 11:14:42 +0100 Subject: Memory leak in native Toolbar cleanup in Cocoa The QCocoaToolBarDelegate is not released when destroying the QMainWindowLayout. Task-number: QTBUG-7307 Reviewed-by: Prasanth Ullattil --- src/gui/widgets/qmainwindowlayout_mac.mm | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/gui/widgets/qmainwindowlayout_mac.mm b/src/gui/widgets/qmainwindowlayout_mac.mm index e41c2be..ee79f5a 100644 --- a/src/gui/widgets/qmainwindowlayout_mac.mm +++ b/src/gui/widgets/qmainwindowlayout_mac.mm @@ -476,6 +476,17 @@ void QMainWindowLayout::cleanUpMacToolbarItems() CFRelease(toolbarItemsCopy.at(i)); toolbarItemsCopy.clear(); unifiedToolbarHash.clear(); + +#ifdef QT_MAC_USE_COCOA + QMacCocoaAutoReleasePool pool; + + OSWindowRef window = qt_mac_window_for(layoutState.mainWindow); + NSToolbar *macToolbar = [window toolbar]; + if (macToolbar) { + [[macToolbar delegate] release]; + [macToolbar setDelegate:nil]; + } +#endif } void QMainWindowLayout::fixSizeInUnifiedToolbar(QToolBar *tb) const -- cgit v0.12 From 5f92bc9dd9f05f4824711b03406bdbe222ff73e9 Mon Sep 17 00:00:00 2001 From: Aaron Kennedy Date: Mon, 11 Jan 2010 16:28:49 +1000 Subject: QMetaObject::disconnectOne() Adds a disconnectOne() method that allows a single signal/slot connection to be disconnected, as required by QTBUG-6781. Reviewed-by: Warwick Allison Reviewed-by: Olivier Goffart --- src/corelib/kernel/qmetaobject_p.h | 6 ++-- src/corelib/kernel/qobject.cpp | 28 ++++++++++++--- src/corelib/kernel/qobjectdefs.h | 2 ++ tests/auto/qobject/tst_qobject.cpp | 73 ++++++++++++++++++++++++++++++++++++++ 4 files changed, 102 insertions(+), 7 deletions(-) diff --git a/src/corelib/kernel/qmetaobject_p.h b/src/corelib/kernel/qmetaobject_p.h index 79a7304..3bbb050 100644 --- a/src/corelib/kernel/qmetaobject_p.h +++ b/src/corelib/kernel/qmetaobject_p.h @@ -124,14 +124,16 @@ struct QMetaObjectPrivate #ifndef QT_NO_QOBJECT //defined in qobject.cpp + enum DisconnectType { DisconnectAll, DisconnectOne }; static bool connect(const QObject *sender, int signal_index, const QObject *receiver, int method_index, int type = 0, int *types = 0); static bool disconnect(const QObject *sender, int signal_index, - const QObject *receiver, int method_index); + const QObject *receiver, int method_index, + DisconnectType = DisconnectAll); static inline bool disconnectHelper(QObjectPrivate::Connection *c, const QObject *receiver, int method_index, - QMutex *senderMutex); + QMutex *senderMutex, DisconnectType); #endif }; diff --git a/src/corelib/kernel/qobject.cpp b/src/corelib/kernel/qobject.cpp index 8346fe4..5298fff 100644 --- a/src/corelib/kernel/qobject.cpp +++ b/src/corelib/kernel/qobject.cpp @@ -2945,7 +2945,6 @@ bool QMetaObjectPrivate::connect(const QObject *sender, int signal_index, return true; } - /*!\internal */ bool QMetaObject::disconnect(const QObject *sender, int signal_index, @@ -2956,12 +2955,27 @@ bool QMetaObject::disconnect(const QObject *sender, int signal_index, receiver, method_index); } +/*!\internal + +Disconnect a single signal connection. If QMetaObject::connect() has been called +multiple times for the same sender, signal_index, receiver and method_index only +one of these connections will be removed. + */ +bool QMetaObject::disconnectOne(const QObject *sender, int signal_index, + const QObject *receiver, int method_index) +{ + signal_index = methodIndexToSignalIndex(sender->metaObject(), signal_index); + return QMetaObjectPrivate::disconnect(sender, signal_index, + receiver, method_index, + QMetaObjectPrivate::DisconnectOne); +} + /*! \internal Helper function to remove the connection from the senders list and setting the receivers to 0 */ bool QMetaObjectPrivate::disconnectHelper(QObjectPrivate::Connection *c, const QObject *receiver, int method_index, - QMutex *senderMutex) + QMutex *senderMutex, DisconnectType disconnectType) { bool success = false; while (c) { @@ -2987,6 +3001,9 @@ bool QMetaObjectPrivate::disconnectHelper(QObjectPrivate::Connection *c, c->receiver = 0; success = true; + + if (disconnectType == DisconnectOne) + return success; } c = c->nextConnectionList; } @@ -2997,7 +3014,8 @@ bool QMetaObjectPrivate::disconnectHelper(QObjectPrivate::Connection *c, Same as the QMetaObject::disconnect, but \a signal_index must be the result of QObjectPrivate::signalIndex */ bool QMetaObjectPrivate::disconnect(const QObject *sender, int signal_index, - const QObject *receiver, int method_index) + const QObject *receiver, int method_index, + DisconnectType disconnectType) { if (!sender) return false; @@ -3021,7 +3039,7 @@ bool QMetaObjectPrivate::disconnect(const QObject *sender, int signal_index, for (signal_index = -1; signal_index < connectionLists->count(); ++signal_index) { QObjectPrivate::Connection *c = (*connectionLists)[signal_index].first; - if (disconnectHelper(c, receiver, method_index, senderMutex)) { + if (disconnectHelper(c, receiver, method_index, senderMutex, disconnectType)) { success = true; connectionLists->dirty = true; } @@ -3029,7 +3047,7 @@ bool QMetaObjectPrivate::disconnect(const QObject *sender, int signal_index, } else if (signal_index < connectionLists->count()) { QObjectPrivate::Connection *c = (*connectionLists)[signal_index].first; - if (disconnectHelper(c, receiver, method_index, senderMutex)) { + if (disconnectHelper(c, receiver, method_index, senderMutex, disconnectType)) { success = true; connectionLists->dirty = true; } diff --git a/src/corelib/kernel/qobjectdefs.h b/src/corelib/kernel/qobjectdefs.h index a0d9cf3..8ed7f3f 100644 --- a/src/corelib/kernel/qobjectdefs.h +++ b/src/corelib/kernel/qobjectdefs.h @@ -334,6 +334,8 @@ struct Q_CORE_EXPORT QMetaObject // internal index-based disconnect static bool disconnect(const QObject *sender, int signal_index, const QObject *receiver, int method_index); + static bool disconnectOne(const QObject *sender, int signal_index, + const QObject *receiver, int method_index); // internal slot-name based connect static void connectSlotsByName(QObject *o); diff --git a/tests/auto/qobject/tst_qobject.cpp b/tests/auto/qobject/tst_qobject.cpp index d342581..4fa6aaa 100644 --- a/tests/auto/qobject/tst_qobject.cpp +++ b/tests/auto/qobject/tst_qobject.cpp @@ -127,6 +127,7 @@ private slots: void overloads(); void isSignalConnected(); void qMetaObjectConnect(); + void qMetaObjectDisconnectOne(); protected: }; @@ -3269,5 +3270,77 @@ void tst_QObject::qMetaObjectConnect() } +void tst_QObject::qMetaObjectDisconnectOne() +{ + SenderObject *s = new SenderObject; + ReceiverObject *r1 = new ReceiverObject; + + int signal1Index = s->metaObject()->indexOfSignal("signal1()"); + int signal3Index = s->metaObject()->indexOfSignal("signal3()"); + int slot1Index = r1->metaObject()->indexOfSlot("slot1()"); + int slot2Index = r1->metaObject()->indexOfSlot("slot2()"); + + QVERIFY(signal1Index > 0); + QVERIFY(signal3Index > 0); + QVERIFY(slot1Index > 0); + QVERIFY(slot2Index > 0); + + QVERIFY( QMetaObject::connect(s, signal1Index, r1, slot1Index) ); + QVERIFY( QMetaObject::connect(s, signal3Index, r1, slot2Index) ); + QVERIFY( QMetaObject::connect(s, signal3Index, r1, slot2Index) ); + QVERIFY( QMetaObject::connect(s, signal3Index, r1, slot2Index) ); + + r1->reset(); + QCOMPARE( r1->count_slot1, 0 ); + QCOMPARE( r1->count_slot2, 0 ); + + s->emitSignal1(); + QCOMPARE( r1->count_slot1, 1 ); + QCOMPARE( r1->count_slot2, 0 ); + + s->emitSignal3(); + QCOMPARE( r1->count_slot1, 1 ); + QCOMPARE( r1->count_slot2, 3 ); + + r1->reset(); + QVERIFY( QMetaObject::disconnectOne(s, signal1Index, r1, slot1Index) ); + QVERIFY( QMetaObject::disconnectOne(s, signal3Index, r1, slot2Index) ); + + s->emitSignal1(); + QCOMPARE( r1->count_slot1, 0 ); + QCOMPARE( r1->count_slot2, 0 ); + + s->emitSignal3(); + QCOMPARE( r1->count_slot1, 0 ); + QCOMPARE( r1->count_slot2, 2 ); + + r1->reset(); + QVERIFY( false == QMetaObject::disconnectOne(s, signal1Index, r1, slot1Index) ); + QVERIFY( QMetaObject::disconnectOne(s, signal3Index, r1, slot2Index) ); + + s->emitSignal1(); + QCOMPARE( r1->count_slot1, 0 ); + QCOMPARE( r1->count_slot2, 0 ); + + s->emitSignal3(); + QCOMPARE( r1->count_slot1, 0 ); + QCOMPARE( r1->count_slot2, 1 ); + + r1->reset(); + QVERIFY( false == QMetaObject::disconnectOne(s, signal1Index, r1, slot1Index) ); + QVERIFY( QMetaObject::disconnectOne(s, signal3Index, r1, slot2Index) ); + + s->emitSignal1(); + QCOMPARE( r1->count_slot1, 0 ); + QCOMPARE( r1->count_slot2, 0 ); + + s->emitSignal3(); + QCOMPARE( r1->count_slot1, 0 ); + QCOMPARE( r1->count_slot2, 0 ); + + delete s; + delete r1; +} + QTEST_MAIN(tst_QObject) #include "tst_qobject.moc" -- cgit v0.12 From b906feddf1593a837785bc41d65e837e64d31284 Mon Sep 17 00:00:00 2001 From: Mika Rautanen Date: Wed, 20 Jan 2010 10:23:45 +1000 Subject: Disabled some auto tests depending on private API. These auto tests are working only if developer build is defined, so exclude those otherwise. Reviewed-by: Rohan McGovern --- tests/auto/auto.pro | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/tests/auto/auto.pro b/tests/auto/auto.pro index 9b91c7d..3198a65 100644 --- a/tests/auto/auto.pro +++ b/tests/auto/auto.pro @@ -569,3 +569,21 @@ contains(QT_CONFIG, webkit): SUBDIRS += \ qwebhistory contains(QT_CONFIG, declarative): SUBDIRS += declarative + +# Following tests depends on private API +!contains(QT_CONFIG, private_tests): SUBDIRS -= \ + qcssparser \ + qgraphicssceneindex \ + qhttpnetworkconnection \ + qhttpnetworkreply \ + qnativesocketengine \ + qnetworkreply \ + qpathclipper \ + qsocketnotifier \ + qsocks5socketengine \ + qstylesheetstyle \ + qtextpiecetable \ + xmlpatternsdiagnosticsts \ + xmlpatternsview \ + xmlpatternsxqts \ + xmlpatternsxslts -- cgit v0.12