summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--examples/declarative/webview/content/Mapping/Map.qml40
-rwxr-xr-xexamples/declarative/webview/content/Mapping/map.html94
-rw-r--r--examples/declarative/webview/googleMaps.qml62
-rw-r--r--mkspecs/common/symbian/symbian.conf33
-rw-r--r--mkspecs/win32-icc/qmake.conf2
-rw-r--r--mkspecs/win32-msvc.net/qmake.conf89
-rw-r--r--mkspecs/win32-msvc.net/qplatformdefs.h140
-rw-r--r--mkspecs/win32-msvc/features/incremental.prf2
-rw-r--r--mkspecs/win32-msvc/features/incremental_off.prf2
-rw-r--r--mkspecs/win32-msvc/qmake.conf86
-rw-r--r--mkspecs/win32-msvc/qplatformdefs.h138
-rw-r--r--mkspecs/win32-msvc2002/qmake.conf88
-rw-r--r--qmake/Makefile.unix5
-rw-r--r--qmake/Makefile.win326
-rw-r--r--qmake/Makefile.win32-g++5
-rw-r--r--qmake/Makefile.win32-g++-sh5
-rw-r--r--qmake/generators/makefile.cpp22
-rw-r--r--qmake/generators/metamakefile.cpp10
-rw-r--r--qmake/generators/symbian/symmake_abld.cpp17
-rw-r--r--qmake/generators/unix/unixmake.cpp6
-rw-r--r--qmake/generators/win32/msvc_dsp.cpp1207
-rw-r--r--qmake/generators/win32/msvc_dsp.h122
-rw-r--r--qmake/generators/win32/msvc_vcproj.cpp3
-rw-r--r--qmake/option.cpp7
-rw-r--r--qmake/option.h2
-rw-r--r--qmake/project.cpp20
-rw-r--r--qmake/property.cpp2
-rw-r--r--qmake/qmake.pri4
-rw-r--r--src/corelib/tools/qstring.h2
-rw-r--r--src/declarative/graphicsitems/qmlgraphicsanchors.cpp26
-rw-r--r--src/declarative/graphicsitems/qmlgraphicspathview.cpp9
-rw-r--r--src/declarative/qml/qmlcompiler.cpp12
-rw-r--r--src/declarative/qml/qmlobjectscriptclass.cpp6
-rw-r--r--src/declarative/util/qmlanimation.cpp14
-rw-r--r--src/declarative/util/qmlbehavior.cpp2
-rw-r--r--src/declarative/util/qmlpropertychanges.cpp2
-rw-r--r--src/declarative/util/qmlstateoperations.cpp8
-rw-r--r--src/declarative/util/qmlxmllistmodel.cpp4
-rw-r--r--src/gui/widgets/qplaintextedit.cpp2
-rw-r--r--tests/auto/declarative/qmlanimations/tst_qmlanimations.cpp6
-rw-r--r--tests/auto/declarative/qmlbehaviors/tst_qmlbehaviors.cpp2
-rw-r--r--tests/auto/declarative/qmldom/tst_qmldom.cpp2
-rw-r--r--tests/auto/declarative/qmlecmascript/tst_qmlecmascript.cpp12
-rw-r--r--tests/auto/declarative/qmlgraphicsanchors/tst_qmlgraphicsanchors.cpp24
-rw-r--r--tests/auto/declarative/qmlgraphicsloader/data/NoResizeGraphicsWidget.qml16
-rw-r--r--tests/auto/declarative/qmlgraphicsloader/data/SizeGraphicsWidgetToLoader.qml16
-rw-r--r--tests/auto/declarative/qmlgraphicsloader/data/SizeLoaderToGraphicsWidget.qml12
-rw-r--r--tests/auto/declarative/qmllanguage/data/invalidAttachedProperty.1.errors.txt2
-rw-r--r--tests/auto/declarative/qmllanguage/data/invalidAttachedProperty.10.errors.txt2
-rw-r--r--tests/auto/declarative/qmllanguage/data/invalidAttachedProperty.2.errors.txt2
-rw-r--r--tests/auto/declarative/qmllanguage/data/invalidAttachedProperty.6.errors.txt2
-rw-r--r--tests/auto/declarative/qmllanguage/data/invalidAttachedProperty.7.errors.txt2
-rw-r--r--tests/auto/declarative/qmllanguage/data/invalidAttachedProperty.8.errors.txt2
-rw-r--r--tests/auto/declarative/qmllanguage/data/invalidAttachedProperty.9.errors.txt2
-rw-r--r--tests/auto/declarative/qmllanguage/data/invalidGroupedProperty.4.errors.txt2
-rw-r--r--tests/auto/declarative/qmllanguage/data/missingSignal.errors.txt2
-rw-r--r--tests/auto/declarative/qmllanguage/data/missingValueTypeProperty.errors.txt2
-rw-r--r--tests/auto/declarative/qmllanguage/data/nonexistantProperty.1.errors.txt2
-rw-r--r--tests/auto/declarative/qmllanguage/data/nonexistantProperty.2.errors.txt2
-rw-r--r--tests/auto/declarative/qmllanguage/data/nonexistantProperty.3.errors.txt2
-rw-r--r--tests/auto/declarative/qmllanguage/data/nonexistantProperty.4.errors.txt2
-rw-r--r--tests/auto/declarative/qmllanguage/data/nonexistantProperty.6.errors.txt2
-rw-r--r--tests/auto/declarative/qmlstates/tst_qmlstates.cpp4
-rw-r--r--tests/auto/headers/tst_headers.cpp9
-rw-r--r--tools/assistant/tools/assistant/aboutdialog.cpp31
-rw-r--r--tools/assistant/tools/assistant/assistant.pro4
-rw-r--r--tools/assistant/tools/assistant/bookmarkdialog.cpp8
-rw-r--r--tools/assistant/tools/assistant/centralwidget.cpp104
-rw-r--r--tools/assistant/tools/assistant/centralwidget.h5
-rw-r--r--tools/assistant/tools/assistant/contentwindow.cpp4
-rw-r--r--tools/assistant/tools/assistant/helpenginewrapper.cpp28
-rw-r--r--tools/assistant/tools/assistant/helpenginewrapper.h6
-rw-r--r--tools/assistant/tools/assistant/helpviewer.cpp601
-rw-r--r--tools/assistant/tools/assistant/helpviewer.h137
-rw-r--r--tools/assistant/tools/assistant/helpviewer_qtb.cpp331
-rw-r--r--tools/assistant/tools/assistant/helpviewer_qtb.h116
-rw-r--r--tools/assistant/tools/assistant/helpviewer_qwv.cpp413
-rw-r--r--tools/assistant/tools/assistant/helpviewer_qwv.h122
-rw-r--r--tools/assistant/tools/assistant/indexwindow.cpp2
-rw-r--r--tools/assistant/tools/assistant/mainwindow.cpp10
-rw-r--r--tools/assistant/tools/assistant/preferencesdialog.cpp26
-rw-r--r--tools/designer/src/components/formeditor/formeditor.pri2
-rw-r--r--tools/designer/src/components/formeditor/formwindow.cpp219
-rw-r--r--tools/designer/src/components/formeditor/formwindow.h15
-rw-r--r--tools/designer/src/components/formeditor/qdesignerundostack.cpp112
-rw-r--r--tools/designer/src/components/formeditor/qdesignerundostack.h (renamed from mkspecs/win32-msvc2002/qplatformdefs.h)52
-rw-r--r--tools/designer/src/lib/shared/qdesigner_formwindowcommand.cpp6
-rw-r--r--tools/designer/src/lib/shared/qdesigner_formwindowcommand_p.h4
-rw-r--r--tools/designer/src/lib/shared/qdesigner_propertycommand.cpp54
-rw-r--r--tools/designer/src/lib/shared/qdesigner_propertycommand_p.h28
-rw-r--r--translations/translations.pri1
91 files changed, 1741 insertions, 3139 deletions
diff --git a/examples/declarative/webview/content/Mapping/Map.qml b/examples/declarative/webview/content/Mapping/Map.qml
index aae6b5d..2e98940 100644
--- a/examples/declarative/webview/content/Mapping/Map.qml
+++ b/examples/declarative/webview/content/Mapping/Map.qml
@@ -1,20 +1,20 @@
-import Qt 4.6
-
-Item {
- id: page
- property real latitude: -34.397
- property real longitude: 150.644
- property string address: ""
- WebView {
- id: map
- anchors.fill: parent
- url: "map.html"
- javaScriptWindowObjects: QtObject {
- WebView.windowObjectName: "qml"
- property real lat: page.latitude
- property real lng: page.longitude
- property string address: page.address
- onAddressChanged: {map.evaluateJavaScript("goToAddress()")}
- }
- }
-}
+import Qt 4.6
+
+Item {
+ id: page
+ property real latitude: -34.397
+ property real longitude: 150.644
+ property string address: ""
+ WebView {
+ id: map
+ anchors.fill: parent
+ url: "map.html"
+ javaScriptWindowObjects: QtObject {
+ WebView.windowObjectName: "qml"
+ property real lat: page.latitude
+ property real lng: page.longitude
+ property string address: page.address
+ onAddressChanged: {map.evaluateJavaScript("goToAddress()")}
+ }
+ }
+}
diff --git a/examples/declarative/webview/content/Mapping/map.html b/examples/declarative/webview/content/Mapping/map.html
index 8afa21c..72f426a 100755
--- a/examples/declarative/webview/content/Mapping/map.html
+++ b/examples/declarative/webview/content/Mapping/map.html
@@ -1,47 +1,47 @@
-<html>
-<head>
-<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
-<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script>
-<script type="text/javascript">
- var geocoder
- var map
- function goToLatLng(latlng,bounds) {
- if (map) {
- map.setCenter(latlng)
- map.fitBounds(bounds)
- } else {
- var myOptions = {
- zoom: 8,
- center: latlng,
- mapTypeId: google.maps.MapTypeId.ROADMAP
- };
- map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);
- }
- }
- function initialize() {
- geocoder = new google.maps.Geocoder();
- if (window.qml.address) {
- goToAddress()
- } else {
- goToLatLng(new google.maps.LatLng(window.qml.lat,window.qml.lng));
- }
- }
- function goToAddress() {
- if (geocoder) {
- var req = {
- address: window.qml.address,
- }
- if (map)
- req.bounds = map.getBounds()
- geocoder.geocode(req, function(results, status) {
- if (status == google.maps.GeocoderStatus.OK)
- goToLatLng(results[0].geometry.location,results[0].geometry.bounds);
- });
- }
- }
-</script>
-</head>
-<body onload="initialize()" leftmargin="0px" topmargin="0px" marginwidth="0px" marginheight="0px">
- <div id="map_canvas" style="width:100%; height:100%"></div>
-</body>
-</html>
+<html>
+<head>
+<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
+<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script>
+<script type="text/javascript">
+ var geocoder
+ var map
+ function goToLatLng(latlng,bounds) {
+ if (map) {
+ map.setCenter(latlng)
+ map.fitBounds(bounds)
+ } else {
+ var myOptions = {
+ zoom: 8,
+ center: latlng,
+ mapTypeId: google.maps.MapTypeId.ROADMAP
+ };
+ map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);
+ }
+ }
+ function initialize() {
+ geocoder = new google.maps.Geocoder();
+ if (window.qml.address) {
+ goToAddress()
+ } else {
+ goToLatLng(new google.maps.LatLng(window.qml.lat,window.qml.lng));
+ }
+ }
+ function goToAddress() {
+ if (geocoder) {
+ var req = {
+ address: window.qml.address,
+ }
+ if (map)
+ req.bounds = map.getBounds()
+ geocoder.geocode(req, function(results, status) {
+ if (status == google.maps.GeocoderStatus.OK)
+ goToLatLng(results[0].geometry.location,results[0].geometry.bounds);
+ });
+ }
+ }
+</script>
+</head>
+<body onload="initialize()" leftmargin="0px" topmargin="0px" marginwidth="0px" marginheight="0px">
+ <div id="map_canvas" style="width:100%; height:100%"></div>
+</body>
+</html>
diff --git a/examples/declarative/webview/googleMaps.qml b/examples/declarative/webview/googleMaps.qml
index b5b13bb..1886961 100644
--- a/examples/declarative/webview/googleMaps.qml
+++ b/examples/declarative/webview/googleMaps.qml
@@ -1,31 +1,31 @@
-// This example demonstrates how Web services such as Google Maps can be
-// abstracted as QML types. Here we have a "Mapping" module with a "Map"
-// type. The Map type has an address property. Setting that property moves
-// the map. The underlying implementation uses WebView and the Google Maps
-// API, but users from QML don't need to understand the implementation in
-// order to create a Map.
-
-import Qt 4.6
-import "content/Mapping"
-
-Map {
- id: map
- width: 300
- height: 300
- address: "Paris"
- Rectangle {
- color: "white"
- width: input.width + 20
- height: input.height + 4
- radius: 5
- anchors.bottom: parent.bottom
- anchors.bottomMargin: 5
- x: 70
- TextInput {
- id: input
- text: map.address
- anchors.centerIn: parent
- Keys.onReturnPressed: map.address = input.text
- }
- }
-}
+// This example demonstrates how Web services such as Google Maps can be
+// abstracted as QML types. Here we have a "Mapping" module with a "Map"
+// type. The Map type has an address property. Setting that property moves
+// the map. The underlying implementation uses WebView and the Google Maps
+// API, but users from QML don't need to understand the implementation in
+// order to create a Map.
+
+import Qt 4.6
+import "content/Mapping"
+
+Map {
+ id: map
+ width: 300
+ height: 300
+ address: "Paris"
+ Rectangle {
+ color: "white"
+ width: input.width + 20
+ height: input.height + 4
+ radius: 5
+ anchors.bottom: parent.bottom
+ anchors.bottomMargin: 5
+ x: 70
+ TextInput {
+ id: input
+ text: map.address
+ anchors.centerIn: parent
+ Keys.onReturnPressed: map.address = input.text
+ }
+ }
+}
diff --git a/mkspecs/common/symbian/symbian.conf b/mkspecs/common/symbian/symbian.conf
index cfe3c24..a11f011 100644
--- a/mkspecs/common/symbian/symbian.conf
+++ b/mkspecs/common/symbian/symbian.conf
@@ -68,23 +68,24 @@ QMAKE_LIBS_COMPAT =
QMAKE_LIBS_QT_ENTRY = -llibcrt0.lib
QMAKE_LIBS_S60 = -lavkon
-!isEmpty(QMAKE_SH) {
- QMAKE_COPY = cp -f
- QMAKE_COPY_FILE = $(COPY)
- QMAKE_COPY_DIR = $(COPY) -r
- QMAKE_MOVE = mv -f
- QMAKE_DEL_FILE = rm -f
- QMAKE_DEL_DIR = rmdir
- QMAKE_CHK_DIR_EXISTS = test -d
- QMAKE_MKDIR = mkdir -p
+!contains(QMAKE_HOST.os, "Windows")|!isEmpty(QMAKE_SH) {
+ QMAKE_COPY = cp
+ QMAKE_COPY_DIR = cp -r
+ QMAKE_MOVE = mv
+ QMAKE_DEL_FILE = rm -f
+ QMAKE_MKDIR = mkdir
+ QMAKE_DEL_DIR = rmdir
+ QMAKE_DEL_TREE = rmdir /s /q
+ QMAKE_CHK_DIR_EXISTS = test -d
} else {
- QMAKE_COPY = copy /y
- QMAKE_COPY_DIR = xcopy /s /q /y /i
- QMAKE_MOVE = move
- QMAKE_DEL_FILE = del
- QMAKE_MKDIR = mkdir
- QMAKE_DEL_DIR = rmdir
- QMAKE_CHK_DIR_EXISTS = if not exist
+ QMAKE_COPY = copy /y
+ QMAKE_COPY_DIR = xcopy /s /q /y /i
+ QMAKE_MOVE = move
+ QMAKE_DEL_FILE = del 2> NUL
+ QMAKE_MKDIR = mkdir
+ QMAKE_DEL_DIR = rmdir
+ QMAKE_DEL_TREE = rm -rf
+ QMAKE_CHK_DIR_EXISTS = if not exist
}
QMAKE_IDL = midl
diff --git a/mkspecs/win32-icc/qmake.conf b/mkspecs/win32-icc/qmake.conf
index 78c947d..fcc7691 100644
--- a/mkspecs/win32-icc/qmake.conf
+++ b/mkspecs/win32-icc/qmake.conf
@@ -4,7 +4,7 @@
# Written for Intel C++
#
-MAKEFILE_GENERATOR = MSVC
+MAKEFILE_GENERATOR = MSVC.NET
TEMPLATE = app
CONFIG += qt warn_on release incremental flat link_prl copy_dir_files debug_and_release debug_and_release_target
QT += core gui
diff --git a/mkspecs/win32-msvc.net/qmake.conf b/mkspecs/win32-msvc.net/qmake.conf
deleted file mode 100644
index 89fa00d..0000000
--- a/mkspecs/win32-msvc.net/qmake.conf
+++ /dev/null
@@ -1,89 +0,0 @@
-#
-# qmake configuration for win32-msvc.net (used by 2002 & 2003 before, but now deprecated. Use win32-msvc2002 or win32-msvc2003 instead)
-#
-# Written for Microsoft C++.NET
-#
-!build_pass:message("The mkspec/win32-msvc.net is now deprecated, use win32-msvc2002 or win32-msvc2003")
-
-MAKEFILE_GENERATOR = MSVC.NET
-TEMPLATE = app
-CONFIG += qt warn_on release incremental flat link_prl precompile_header autogen_precompile_source copy_dir_files debug_and_release debug_and_release_target
-QT += core gui
-DEFINES += UNICODE WIN32 QT_LARGEFILE_SUPPORT
-QMAKE_COMPILER_DEFINES += _MSC_VER=1300 WIN32
-
-QMAKE_CC = cl
-QMAKE_LEX = flex
-QMAKE_LEXFLAGS =
-QMAKE_YACC = byacc
-QMAKE_YACCFLAGS = -d
-QMAKE_CFLAGS = -nologo -Zm300
-QMAKE_CFLAGS_WARN_ON = -W3
-QMAKE_CFLAGS_WARN_OFF = -W0
-QMAKE_CFLAGS_RELEASE = -O2 -MD
-QMAKE_CFLAGS_DEBUG = -Zi -MDd
-QMAKE_CFLAGS_YACC =
-
-QMAKE_CXX = $$QMAKE_CC
-QMAKE_CXXFLAGS = $$QMAKE_CFLAGS
-QMAKE_CXXFLAGS_WARN_ON = $$QMAKE_CFLAGS_WARN_ON -w34100 -w34189
-QMAKE_CXXFLAGS_WARN_OFF = $$QMAKE_CFLAGS_WARN_OFF
-QMAKE_CXXFLAGS_RELEASE = $$QMAKE_CFLAGS_RELEASE
-QMAKE_CXXFLAGS_DEBUG = $$QMAKE_CFLAGS_DEBUG
-QMAKE_CXXFLAGS_YACC = $$QMAKE_CFLAGS_YACC
-QMAKE_CXXFLAGS_STL_ON = -EHsc
-QMAKE_CXXFLAGS_STL_OFF =
-QMAKE_CXXFLAGS_RTTI_ON = -GR
-QMAKE_CXXFLAGS_RTTI_OFF =
-QMAKE_CXXFLAGS_EXCEPTIONS_ON = -EHsc
-QMAKE_CXXFLAGS_EXCEPTIONS_OFF =
-
-QMAKE_INCDIR =
-QMAKE_INCDIR_QT = $$[QT_INSTALL_HEADERS]
-QMAKE_LIBDIR_QT = $$[QT_INSTALL_LIBS]
-
-QMAKE_RUN_CC = $(CC) -c $(CFLAGS) $(INCPATH) -Fo$obj $src
-QMAKE_RUN_CC_IMP = $(CC) -c $(CFLAGS) $(INCPATH) -Fo$@ $<
-QMAKE_RUN_CC_IMP_BATCH = $(CC) -c $(CFLAGS) $(INCPATH) -Fo$@ @<<
-QMAKE_RUN_CXX = $(CXX) -c $(CXXFLAGS) $(INCPATH) -Fo$obj $src
-QMAKE_RUN_CXX_IMP = $(CXX) -c $(CXXFLAGS) $(INCPATH) -Fo$@ $<
-QMAKE_RUN_CXX_IMP_BATCH = $(CXX) -c $(CXXFLAGS) $(INCPATH) -Fo$@ @<<
-
-QMAKE_LINK = link
-QMAKE_LFLAGS = /NOLOGO
-QMAKE_LFLAGS_RELEASE = /INCREMENTAL:NO
-QMAKE_LFLAGS_DEBUG = /DEBUG
-QMAKE_LFLAGS_CONSOLE = /SUBSYSTEM:CONSOLE
-QMAKE_LFLAGS_WINDOWS = /SUBSYSTEM:WINDOWS
-QMAKE_LFLAGS_DLL = /DLL
-
-QMAKE_LIBS_CORE = kernel32.lib user32.lib shell32.lib uuid.lib ole32.lib advapi32.lib ws2_32.lib
-QMAKE_LIBS_GUI = gdi32.lib comdlg32.lib oleaut32.lib imm32.lib winmm.lib winspool.lib ws2_32.lib ole32.lib user32.lib advapi32.lib
-QMAKE_LIBS_NETWORK = ws2_32.lib
-QMAKE_LIBS_OPENGL = opengl32.lib glu32.lib gdi32.lib user32.lib
-QMAKE_LIBS_COMPAT = advapi32.lib shell32.lib comdlg32.lib user32.lib gdi32.lib ws2_32.lib
-
-QMAKE_LIBS_QT_ENTRY = -lqtmain
-
-QMAKE_MOC = $$[QT_INSTALL_BINS]\moc.exe
-QMAKE_UIC = $$[QT_INSTALL_BINS]\uic.exe
-QMAKE_IDC = $$[QT_INSTALL_BINS]\idc.exe
-
-QMAKE_IDL = midl
-QMAKE_LIB = lib /NOLOGO
-QMAKE_RC = rc
-
-QMAKE_ZIP = zip -r -9
-
-QMAKE_COPY = copy /y
-QMAKE_COPY_DIR = xcopy /s /q /y /i
-QMAKE_MOVE = move
-QMAKE_DEL_FILE = del
-QMAKE_DEL_DIR = rmdir
-QMAKE_CHK_DIR_EXISTS = if not exist
-QMAKE_MKDIR = mkdir
-
-VCPROJ_EXTENSION = .vcproj
-VCSOLUTION_EXTENSION = .sln
-VCPROJ_KEYWORD = Qt4VSv1.0
-load(qt_config)
diff --git a/mkspecs/win32-msvc.net/qplatformdefs.h b/mkspecs/win32-msvc.net/qplatformdefs.h
deleted file mode 100644
index 05584c9..0000000
--- a/mkspecs/win32-msvc.net/qplatformdefs.h
+++ /dev/null
@@ -1,140 +0,0 @@
-/****************************************************************************
-**
-** 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 qmake spec of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the 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 QPLATFORMDEFS_H
-#define QPLATFORMDEFS_H
-
-#ifdef UNICODE
-#ifndef _UNICODE
-#define _UNICODE
-#endif
-#endif
-
-// Get Qt defines/settings
-
-#include "qglobal.h"
-
-#define _POSIX_
-#include <limits.h>
-#undef _POSIX_
-
-#include <tchar.h>
-#include <io.h>
-#include <direct.h>
-#include <stdio.h>
-#include <fcntl.h>
-#include <errno.h>
-#include <sys/stat.h>
-#include <stdlib.h>
-#include <windows.h>
-
-#define Q_FS_FAT
-#ifdef QT_LARGEFILE_SUPPORT
-#define QT_STATBUF struct _stati64 // non-ANSI defs
-#define QT_STATBUF4TSTAT struct _stati64 // non-ANSI defs
-#define QT_STAT ::_stati64
-#define QT_FSTAT ::_fstati64
-#else
-#define QT_STATBUF struct _stat // non-ANSI defs
-#define QT_STATBUF4TSTAT struct _stat // non-ANSI defs
-#define QT_STAT ::_stat
-#define QT_FSTAT ::_fstat
-#endif
-#define QT_STAT_REG _S_IFREG
-#define QT_STAT_DIR _S_IFDIR
-#define QT_STAT_MASK _S_IFMT
-#if defined(_S_IFLNK)
-# define QT_STAT_LNK _S_IFLNK
-#endif
-#define QT_FILENO _fileno
-#define QT_OPEN ::_open
-#define QT_CLOSE ::_close
-#ifdef QT_LARGEFILE_SUPPORT
-#define QT_LSEEK ::_lseeki64
-#define QT_TSTAT ::_tstati64
-#else
-#define QT_LSEEK ::_lseek
-#define QT_TSTAT ::_tstat
-#endif
-#define QT_READ ::_read
-#define QT_WRITE ::_write
-#define QT_ACCESS ::_access
-#define QT_GETCWD ::_getcwd
-#define QT_CHDIR ::_chdir
-#define QT_MKDIR ::_mkdir
-#define QT_RMDIR ::_rmdir
-#define QT_OPEN_LARGEFILE 0
-#define QT_OPEN_RDONLY _O_RDONLY
-#define QT_OPEN_WRONLY _O_WRONLY
-#define QT_OPEN_RDWR _O_RDWR
-#define QT_OPEN_CREAT _O_CREAT
-#define QT_OPEN_TRUNC _O_TRUNC
-#define QT_OPEN_APPEND _O_APPEND
-#if defined(O_TEXT)
-# define QT_OPEN_TEXT _O_TEXT
-# define QT_OPEN_BINARY _O_BINARY
-#endif
-
-#include "../common/c89/qplatformdefs.h"
-
-#ifdef QT_LARGEFILE_SUPPORT
-#undef QT_FTELL
-#undef QT_OFF_T
-
-// 64-bit versions of fseek/ftell not always available. E.g., when linking
-// dynamically to CRT (/MT)
-#define QT_FTELL (QT_OFF_T)::ftell
-#define QT_OFF_T __int64
-#endif
-
-#define QT_SIGNAL_ARGS int
-
-#define QT_VSNPRINTF ::_vsnprintf
-#define QT_SNPRINTF ::_snprintf
-
-# define F_OK 0
-# define X_OK 1
-# define W_OK 2
-# define R_OK 4
-
-typedef int mode_t;
-
-#endif // QPLATFORMDEFS_H
diff --git a/mkspecs/win32-msvc/features/incremental.prf b/mkspecs/win32-msvc/features/incremental.prf
deleted file mode 100644
index 67596ca..0000000
--- a/mkspecs/win32-msvc/features/incremental.prf
+++ /dev/null
@@ -1,2 +0,0 @@
-CONFIG -= incremental_off
-QMAKE_LFLAGS_DEBUG += /incremental:yes
diff --git a/mkspecs/win32-msvc/features/incremental_off.prf b/mkspecs/win32-msvc/features/incremental_off.prf
deleted file mode 100644
index 9b6d19e..0000000
--- a/mkspecs/win32-msvc/features/incremental_off.prf
+++ /dev/null
@@ -1,2 +0,0 @@
-CONFIG -= incremental
-QMAKE_LFLAGS += /incremental:no
diff --git a/mkspecs/win32-msvc/qmake.conf b/mkspecs/win32-msvc/qmake.conf
deleted file mode 100644
index 64ab84a..0000000
--- a/mkspecs/win32-msvc/qmake.conf
+++ /dev/null
@@ -1,86 +0,0 @@
-#
-# qmake configuration for win32-msvc
-#
-# Written for Microsoft C++
-#
-
-MAKEFILE_GENERATOR = MSVC
-TEMPLATE = app
-CONFIG += qt warn_on release incremental flat link_prl precompile_header copy_dir_files no_delete_multiple_files debug_and_release debug_and_release_target
-QT += core gui
-DEFINES += UNICODE QT_LARGEFILE_SUPPORT
-QMAKE_COMPILER_DEFINES += _MSC_VER=1200 WIN32
-
-QMAKE_CC = cl
-QMAKE_LEX = flex
-QMAKE_LEXFLAGS =
-QMAKE_YACC = byacc
-QMAKE_YACCFLAGS = -d
-QMAKE_CFLAGS = -nologo -Zm200
-QMAKE_CFLAGS_WARN_ON = -W3
-QMAKE_CFLAGS_WARN_OFF = -W0
-QMAKE_CFLAGS_RELEASE = -O1 -MD
-QMAKE_CFLAGS_DEBUG = -Zi -MDd
-QMAKE_CFLAGS_YACC =
-
-QMAKE_CXX = $$QMAKE_CC
-QMAKE_CXXFLAGS = $$QMAKE_CFLAGS
-QMAKE_CXXFLAGS_WARN_ON = $$QMAKE_CFLAGS_WARN_ON
-QMAKE_CXXFLAGS_WARN_OFF = $$QMAKE_CFLAGS_WARN_OFF
-QMAKE_CXXFLAGS_RELEASE = $$QMAKE_CFLAGS_RELEASE
-QMAKE_CXXFLAGS_DEBUG = $$QMAKE_CFLAGS_DEBUG
-QMAKE_CXXFLAGS_YACC = $$QMAKE_CFLAGS_YACC
-QMAKE_CXXFLAGS_STL_ON = -GX
-QMAKE_CXXFLAGS_STL_OFF =
-QMAKE_CXXFLAGS_RTTI_ON = -GR
-QMAKE_CXXFLAGS_RTTI_OFF =
-QMAKE_CXXFLAGS_EXCEPTIONS_ON = -GX
-QMAKE_CXXFLAGS_EXCEPTIONS_OFF =
-
-QMAKE_INCDIR =
-QMAKE_INCDIR_QT = $$[QT_INSTALL_HEADERS]
-QMAKE_LIBDIR_QT = $$[QT_INSTALL_LIBS]
-
-QMAKE_RUN_CC = $(CC) -c $(CFLAGS) $(INCPATH) -Fo$obj $src
-QMAKE_RUN_CC_IMP = $(CC) -c $(CFLAGS) $(INCPATH) -Fo$@ $<
-QMAKE_RUN_CC_IMP_BATCH = $(CC) -c $(CFLAGS) $(INCPATH) -Fo$@ @<<
-QMAKE_RUN_CXX = $(CXX) -c $(CXXFLAGS) $(INCPATH) -Fo$obj $src
-QMAKE_RUN_CXX_IMP = $(CXX) -c $(CXXFLAGS) $(INCPATH) -Fo$@ $<
-QMAKE_RUN_CXX_IMP_BATCH = $(CXX) -c $(CXXFLAGS) $(INCPATH) -Fo$@ @<<
-
-QMAKE_LINK = link
-QMAKE_LFLAGS = /NOLOGO
-QMAKE_LFLAGS_RELEASE = /INCREMENTAL:NO
-QMAKE_LFLAGS_DEBUG = /DEBUG
-QMAKE_LFLAGS_CONSOLE = /SUBSYSTEM:console
-QMAKE_LFLAGS_WINDOWS = /SUBSYSTEM:windows
-QMAKE_LFLAGS_DLL = /DLL
-
-QMAKE_LIBS =
-QMAKE_LIBS_CORE = kernel32.lib user32.lib shell32.lib uuid.lib ole32.lib advapi32.lib ws2_32.lib
-QMAKE_LIBS_GUI = gdi32.lib comdlg32.lib oleaut32.lib imm32.lib winmm.lib winspool.lib ws2_32.lib ole32.lib user32.lib advapi32.lib
-QMAKE_LIBS_NETWORK = ws2_32.lib
-QMAKE_LIBS_OPENGL = opengl32.lib glu32.lib gdi32.lib user32.lib delayimp.lib
-QMAKE_LIBS_COMPAT = advapi32.lib shell32.lib comdlg32.lib user32.lib gdi32.lib ws2_32.lib
-QMAKE_LIBS_QT_ENTRY = -lqtmain
-
-QMAKE_MOC = $$[QT_INSTALL_BINS]\moc.exe
-QMAKE_UIC = $$[QT_INSTALL_BINS]\uic.exe
-QMAKE_IDC = $$[QT_INSTALL_BINS]\idc.exe
-
-QMAKE_IDL = midl
-QMAKE_LIB = lib /NOLOGO
-QMAKE_RC = rc
-
-QMAKE_ZIP = zip -r -9
-
-QMAKE_COPY = copy /y
-QMAKE_COPY_DIR = xcopy /s /q /y /i
-QMAKE_MOVE = move
-QMAKE_DEL_FILE = del
-QMAKE_DEL_DIR = rmdir
-QMAKE_CHK_DIR_EXISTS = if not exist
-QMAKE_MKDIR = mkdir
-
-DSP_EXTENSION = .dsp
-load(qt_config)
diff --git a/mkspecs/win32-msvc/qplatformdefs.h b/mkspecs/win32-msvc/qplatformdefs.h
deleted file mode 100644
index abb5894..0000000
--- a/mkspecs/win32-msvc/qplatformdefs.h
+++ /dev/null
@@ -1,138 +0,0 @@
-/****************************************************************************
-**
-** 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 qmake spec of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the 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 QPLATFORMDEFS_H
-#define QPLATFORMDEFS_H
-
-#ifdef UNICODE
-#ifndef _UNICODE
-#define _UNICODE
-#endif
-#endif
-
-// Get Qt defines/settings
-
-#include "qglobal.h"
-
-#define _POSIX_
-#include <limits.h>
-#undef _POSIX_
-
-#include <tchar.h>
-#include <io.h>
-#include <direct.h>
-#include <stdio.h>
-#include <fcntl.h>
-#include <errno.h>
-#include <sys/stat.h>
-#include <stdlib.h>
-#include <windows.h>
-
-#define Q_FS_FAT
-#ifdef QT_LARGEFILE_SUPPORT
-#define QT_STATBUF struct _stati64 // non-ANSI defs
-#define QT_STATBUF4TSTAT struct _stati64 // non-ANSI defs
-#define QT_STAT ::_stati64
-#define QT_FSTAT ::_fstati64
-#else
-#define QT_STATBUF struct _stat // non-ANSI defs
-#define QT_STATBUF4TSTAT struct _stat // non-ANSI defs
-#define QT_STAT ::_stat
-#define QT_FSTAT ::_fstat
-#endif
-#define QT_STAT_REG _S_IFREG
-#define QT_STAT_DIR _S_IFDIR
-#define QT_STAT_MASK _S_IFMT
-#if defined(_S_IFLNK)
-# define QT_STAT_LNK _S_IFLNK
-#endif
-#define QT_FILENO _fileno
-#define QT_OPEN ::_open
-#define QT_CLOSE ::_close
-#ifdef QT_LARGEFILE_SUPPORT
-#define QT_LSEEK ::_lseeki64
-#define QT_TSTAT ::_tstati64
-#else
-#define QT_LSEEK ::_lseek
-#define QT_TSTAT ::_tstat
-#endif
-#define QT_READ ::_read
-#define QT_WRITE ::_write
-#define QT_ACCESS ::_access
-#define QT_GETCWD ::_getcwd
-#define QT_CHDIR ::_chdir
-#define QT_MKDIR ::_mkdir
-#define QT_RMDIR ::_rmdir
-#define QT_OPEN_LARGEFILE 0
-#define QT_OPEN_RDONLY _O_RDONLY
-#define QT_OPEN_WRONLY _O_WRONLY
-#define QT_OPEN_RDWR _O_RDWR
-#define QT_OPEN_CREAT _O_CREAT
-#define QT_OPEN_TRUNC _O_TRUNC
-#define QT_OPEN_APPEND _O_APPEND
-#if defined(O_TEXT)
-# define QT_OPEN_TEXT _O_TEXT
-# define QT_OPEN_BINARY _O_BINARY
-#endif
-
-#include "../common/c89/qplatformdefs.h"
-
-#ifdef QT_LARGEFILE_SUPPORT
-#undef QT_OFF_T
-#define QT_OFF_T __int64
-#endif
-
-#define QT_SIGNAL_ARGS int
-
-#if defined(_MSC_VER) && _MSC_VER < 1400
-# define QT_VSNPRINTF ::_vsnprintf
-#endif
-#define QT_SNPRINTF ::_snprintf
-
-# define F_OK 0
-# define X_OK 1
-# define W_OK 2
-# define R_OK 4
-
-typedef int mode_t;
-
-
-#endif // QPLATFORMDEFS_H
diff --git a/mkspecs/win32-msvc2002/qmake.conf b/mkspecs/win32-msvc2002/qmake.conf
deleted file mode 100644
index 13fbfb0..0000000
--- a/mkspecs/win32-msvc2002/qmake.conf
+++ /dev/null
@@ -1,88 +0,0 @@
-#
-# qmake configuration for win32-msvc2002
-#
-# Written for Microsoft C++.NET
-#
-
-MAKEFILE_GENERATOR = MSVC.NET
-TEMPLATE = app
-CONFIG += qt warn_on release incremental flat link_prl precompile_header autogen_precompile_source copy_dir_files debug_and_release debug_and_release_target
-QT += core gui
-DEFINES += UNICODE WIN32 QT_LARGEFILE_SUPPORT
-QMAKE_COMPILER_DEFINES += _MSC_VER=1300 WIN32
-
-QMAKE_CC = cl
-QMAKE_LEX = flex
-QMAKE_LEXFLAGS =
-QMAKE_YACC = byacc
-QMAKE_YACCFLAGS = -d
-QMAKE_CFLAGS = -nologo -Zm300
-QMAKE_CFLAGS_WARN_ON = -W3
-QMAKE_CFLAGS_WARN_OFF = -W0
-QMAKE_CFLAGS_RELEASE = -O2 -MD
-QMAKE_CFLAGS_DEBUG = -Zi -MDd
-QMAKE_CFLAGS_YACC =
-
-QMAKE_CXX = $$QMAKE_CC
-QMAKE_CXXFLAGS = $$QMAKE_CFLAGS
-QMAKE_CXXFLAGS_WARN_ON = $$QMAKE_CFLAGS_WARN_ON -w34100 -w34189
-QMAKE_CXXFLAGS_WARN_OFF = $$QMAKE_CFLAGS_WARN_OFF
-QMAKE_CXXFLAGS_RELEASE = $$QMAKE_CFLAGS_RELEASE
-QMAKE_CXXFLAGS_DEBUG = $$QMAKE_CFLAGS_DEBUG
-QMAKE_CXXFLAGS_YACC = $$QMAKE_CFLAGS_YACC
-QMAKE_CXXFLAGS_STL_ON = -EHsc
-QMAKE_CXXFLAGS_STL_OFF =
-QMAKE_CXXFLAGS_RTTI_ON = -GR
-QMAKE_CXXFLAGS_RTTI_OFF =
-QMAKE_CXXFLAGS_EXCEPTIONS_ON = -EHsc
-QMAKE_CXXFLAGS_EXCEPTIONS_OFF =
-
-QMAKE_INCDIR =
-QMAKE_INCDIR_QT = $$[QT_INSTALL_HEADERS]
-QMAKE_LIBDIR_QT = $$[QT_INSTALL_LIBS]
-
-QMAKE_RUN_CC = $(CC) -c $(CFLAGS) $(INCPATH) -Fo$obj $src
-QMAKE_RUN_CC_IMP = $(CC) -c $(CFLAGS) $(INCPATH) -Fo$@ $<
-QMAKE_RUN_CC_IMP_BATCH = $(CC) -c $(CFLAGS) $(INCPATH) -Fo$@ @<<
-QMAKE_RUN_CXX = $(CXX) -c $(CXXFLAGS) $(INCPATH) -Fo$obj $src
-QMAKE_RUN_CXX_IMP = $(CXX) -c $(CXXFLAGS) $(INCPATH) -Fo$@ $<
-QMAKE_RUN_CXX_IMP_BATCH = $(CXX) -c $(CXXFLAGS) $(INCPATH) -Fo$@ @<<
-
-QMAKE_LINK = link
-QMAKE_LFLAGS = /NOLOGO
-QMAKE_LFLAGS_RELEASE = /INCREMENTAL:NO
-QMAKE_LFLAGS_DEBUG = /DEBUG
-QMAKE_LFLAGS_CONSOLE = /SUBSYSTEM:CONSOLE
-QMAKE_LFLAGS_WINDOWS = /SUBSYSTEM:WINDOWS
-QMAKE_LFLAGS_DLL = /DLL
-
-QMAKE_LIBS_CORE = kernel32.lib user32.lib shell32.lib uuid.lib ole32.lib advapi32.lib ws2_32.lib
-QMAKE_LIBS_GUI = gdi32.lib comdlg32.lib oleaut32.lib imm32.lib winmm.lib winspool.lib ws2_32.lib ole32.lib user32.lib advapi32.lib
-QMAKE_LIBS_NETWORK = ws2_32.lib
-QMAKE_LIBS_OPENGL = opengl32.lib glu32.lib gdi32.lib user32.lib
-QMAKE_LIBS_COMPAT = advapi32.lib shell32.lib comdlg32.lib user32.lib gdi32.lib ws2_32.lib
-
-QMAKE_LIBS_QT_ENTRY = -lqtmain
-
-QMAKE_MOC = $$[QT_INSTALL_BINS]\moc.exe
-QMAKE_UIC = $$[QT_INSTALL_BINS]\uic.exe
-QMAKE_IDC = $$[QT_INSTALL_BINS]\idc.exe
-
-QMAKE_IDL = midl
-QMAKE_LIB = lib /NOLOGO
-QMAKE_RC = rc
-
-QMAKE_ZIP = zip -r -9
-
-QMAKE_COPY = copy /y
-QMAKE_COPY_DIR = xcopy /s /q /y /i
-QMAKE_MOVE = move
-QMAKE_DEL_FILE = del
-QMAKE_DEL_DIR = rmdir
-QMAKE_CHK_DIR_EXISTS = if not exist
-QMAKE_MKDIR = mkdir
-
-VCPROJ_EXTENSION = .vcproj
-VCSOLUTION_EXTENSION = .sln
-VCPROJ_KEYWORD = Qt4VSv1.0
-load(qt_config)
diff --git a/qmake/Makefile.unix b/qmake/Makefile.unix
index 0ff5b38..f4df43d 100644
--- a/qmake/Makefile.unix
+++ b/qmake/Makefile.unix
@@ -9,7 +9,7 @@ LFLAGS = @QMAKE_LFLAGS@
OBJS=project.o property.o main.o makefile.o unixmake2.o unixmake.o \
mingw_make.o option.o winmakefile.o projectgenerator.o \
meta.o makefiledeps.o metamakefile.o xmloutput.o pbuilder_pbx.o \
- borland_bmake.o msvc_dsp.o msvc_vcproj.o msvc_nmake.o msvc_objectmodel.o \
+ borland_bmake.o msvc_vcproj.o msvc_nmake.o msvc_objectmodel.o \
symmake.o initprojectdeploy_symbian.o symmake_abld.o symmake_sbsv2.o \
symbiancommon.o
@@ -268,9 +268,6 @@ msvc_nmake.o: generators/win32/msvc_nmake.cpp
pbuilder_pbx.o: generators/mac/pbuilder_pbx.cpp
$(CXX) -c -o $@ $(CXXFLAGS) generators/mac/pbuilder_pbx.cpp
-msvc_dsp.o: generators/win32/msvc_dsp.cpp
- $(CXX) -c -o $@ $(CXXFLAGS) generators/win32/msvc_dsp.cpp
-
symmake.o: generators/symbian/symmake.cpp
$(CXX) -c -o $@ $(CXXFLAGS) generators/symbian/symmake.cpp
diff --git a/qmake/Makefile.win32 b/qmake/Makefile.win32
index 9ecce24..eaa1fae 100644
--- a/qmake/Makefile.win32
+++ b/qmake/Makefile.win32
@@ -73,7 +73,7 @@ ADDCLEAN = qmake.tds
OBJS = project.obj main.obj makefile.obj unixmake.obj unixmake2.obj mingw_make.obj \
option.obj winmakefile.obj projectgenerator.obj property.obj meta.obj \
makefiledeps.obj metamakefile.obj xmloutput.obj pbuilder_pbx.obj \
- borland_bmake.obj msvc_nmake.obj msvc_dsp.obj msvc_vcproj.obj \
+ borland_bmake.obj msvc_nmake.obj msvc_vcproj.obj \
msvc_objectmodel.obj symmake.obj initprojectdeploy_symbian.obj \
symmake_abld.obj symmake_sbsv2.obj symbiancommon.obj
@@ -191,7 +191,6 @@ clean::
-del xmloutput.obj
-del borland_bmake.obj
-del msvc_nmake.obj
- -del msvc_dsp.obj
-del msvc_vcproj.obj
-del msvc_objectmodel.obj
-del symmake.obj
@@ -377,9 +376,6 @@ mingw_make.obj: $(SOURCE_PATH)/qmake/generators/win32/mingw_make.cpp
msvc_nmake.obj: $(SOURCE_PATH)/qmake/generators/win32/msvc_nmake.cpp
$(CXX) $(CXXFLAGS) generators/win32/msvc_nmake.cpp
-msvc_dsp.obj: $(SOURCE_PATH)/qmake/generators/win32/msvc_dsp.cpp
- $(CXX) $(CXXFLAGS) generators/win32/msvc_dsp.cpp
-
msvc_vcproj.obj: $(SOURCE_PATH)/qmake/generators/win32/msvc_vcproj.cpp
$(CXX) $(CXXFLAGS) generators/win32/msvc_vcproj.cpp
diff --git a/qmake/Makefile.win32-g++ b/qmake/Makefile.win32-g++
index 1dacb68..7ed32be 100644
--- a/qmake/Makefile.win32-g++
+++ b/qmake/Makefile.win32-g++
@@ -36,7 +36,7 @@ ADDCLEAN =
OBJS = project.o main.o makefile.o unixmake.o unixmake2.o mingw_make.o \
option.o winmakefile.o projectgenerator.o property.o meta.o \
makefiledeps.o metamakefile.o xmloutput.o pbuilder_pbx.o \
- borland_bmake.o msvc_nmake.o msvc_dsp.o msvc_vcproj.o \
+ borland_bmake.o msvc_nmake.o msvc_vcproj.o \
msvc_objectmodel.o symmake.o initprojectdeploy_symbian.o \
symmake_abld.o symmake_sbsv2.o symbiancommon.o
@@ -257,9 +257,6 @@ mingw_make.o: $(SOURCE_PATH)/qmake/generators/win32/mingw_make.cpp
msvc_nmake.o: $(SOURCE_PATH)/qmake/generators/win32/msvc_nmake.cpp
$(CXX) $(CXXFLAGS) generators/win32/msvc_nmake.cpp
-msvc_dsp.o: $(SOURCE_PATH)/qmake/generators/win32/msvc_dsp.cpp
- $(CXX) $(CXXFLAGS) generators/win32/msvc_dsp.cpp
-
msvc_vcproj.o: $(SOURCE_PATH)/qmake/generators/win32/msvc_vcproj.cpp
$(CXX) $(CXXFLAGS) generators/win32/msvc_vcproj.cpp
diff --git a/qmake/Makefile.win32-g++-sh b/qmake/Makefile.win32-g++-sh
index bce414e..7f33b0f 100644
--- a/qmake/Makefile.win32-g++-sh
+++ b/qmake/Makefile.win32-g++-sh
@@ -36,7 +36,7 @@ ADDCLEAN =
OBJS = project.o main.o makefile.o unixmake.o unixmake2.o mingw_make.o \
option.o winmakefile.o projectgenerator.o property.o meta.o \
makefiledeps.o metamakefile.o xmloutput.o pbuilder_pbx.o \
- borland_bmake.o msvc_nmake.o msvc_dsp.o msvc_vcproj.o \
+ borland_bmake.o msvc_nmake.o msvc_vcproj.o \
msvc_objectmodel.o symmake.o initprojectdeploy_symbian.o \
symmake_abld.o symmake_sbsv2.o symbiancommon.o
@@ -256,9 +256,6 @@ mingw_make.o: $(SOURCE_PATH)/qmake/generators/win32/mingw_make.cpp
msvc_nmake.o: $(SOURCE_PATH)/qmake/generators/win32/msvc_nmake.cpp
$(CXX) $(CXXFLAGS) generators/win32/msvc_nmake.cpp
-msvc_dsp.o: $(SOURCE_PATH)/qmake/generators/win32/msvc_dsp.cpp
- $(CXX) $(CXXFLAGS) generators/win32/msvc_dsp.cpp
-
msvc_vcproj.o: $(SOURCE_PATH)/qmake/generators/win32/msvc_vcproj.cpp
$(CXX) $(CXXFLAGS) generators/win32/msvc_vcproj.cpp
diff --git a/qmake/generators/makefile.cpp b/qmake/generators/makefile.cpp
index cac23cd..ec712a0 100644
--- a/qmake/generators/makefile.cpp
+++ b/qmake/generators/makefile.cpp
@@ -65,12 +65,6 @@
#include <sys/types.h>
#include <sys/stat.h>
-#ifdef Q_OS_WIN32
-#define NO_STDERR "2> NUL"
-#else
-#define NO_STDERR "2>/dev/null"
-#endif
-
QT_BEGIN_NAMESPACE
// Well, Windows doesn't have this, so here's the macro
@@ -1814,8 +1808,6 @@ MakefileGenerator::writeExtraCompilerTargets(QTextStream &t)
tmp_clean = tmp_out;
if(tmp_clean.indexOf("${QMAKE_") == -1) {
t << "\n\t" << "-$(DEL_FILE) " << tmp_clean;
- if (Option::shellPath.isEmpty())
- t << " " << NO_STDERR; // Eliminate unnecessary warnings
wrote_clean = true;
}
if(!wrote_clean_cmds || !wrote_clean) {
@@ -1843,12 +1835,8 @@ MakefileGenerator::writeExtraCompilerTargets(QTextStream &t)
cleans.append(files);
}
}
- if(!cleans.isEmpty()) {
- if (Option::shellPath.isEmpty())
- t << valGlue(cleans, "\n\t" + del_statement, " " NO_STDERR "\n\t" + del_statement, " " NO_STDERR);
- else
- t << valGlue(cleans, "\n\t" + del_statement, "\n\t" + del_statement, "");
- }
+ if(!cleans.isEmpty())
+ t << valGlue(cleans, "\n\t" + del_statement, "\n\t" + del_statement, "");
if(!wrote_clean_cmds) {
for(QStringList::ConstIterator input = tmp_inputs.begin(); input != tmp_inputs.end(); ++input) {
t << "\n\t" << replaceExtraCompilerVariables(tmp_clean_cmds, (*input),
@@ -2164,9 +2152,7 @@ QString MakefileGenerator::buildArgs(const QString &outdir)
ret += " -nodependheuristics";
if(!Option::mkfile::qmakespec_commandline.isEmpty())
ret += " -spec " + specdir(outdir);
- if(Option::target_mode == Option::TARG_MAC9_MODE)
- ret += " -mac9";
- else if(Option::target_mode == Option::TARG_MACX_MODE)
+ if(Option::target_mode == Option::TARG_MACX_MODE)
ret += " -macx";
else if(Option::target_mode == Option::TARG_UNIX_MODE)
ret += " -unix";
@@ -2681,8 +2667,6 @@ MakefileGenerator::writeMakeQmake(QTextStream &t)
if(!specdir().isEmpty()) {
if(exists(Option::fixPathToLocalOS(specdir()+QDir::separator()+"qmake.conf")))
t << escapeDependencyPath(specdir() + Option::dir_sep + "qmake.conf") << " ";
- else if(exists(Option::fixPathToLocalOS(specdir()+QDir::separator()+"tmake.conf")))
- t << escapeDependencyPath(specdir() + Option::dir_sep + "tmake.conf") << " ";
}
const QStringList &included = project->values("QMAKE_INTERNAL_INCLUDED_FILES");
t << escapeDependencyPaths(included).join(" \\\n\t\t") << "\n\t"
diff --git a/qmake/generators/metamakefile.cpp b/qmake/generators/metamakefile.cpp
index d4d1d43..dc3bbc7 100644
--- a/qmake/generators/metamakefile.cpp
+++ b/qmake/generators/metamakefile.cpp
@@ -432,7 +432,6 @@ QT_BEGIN_INCLUDE_NAMESPACE
#include "pbuilder_pbx.h"
#include "msvc_nmake.h"
#include "borland_bmake.h"
-#include "msvc_dsp.h"
#include "msvc_vcproj.h"
#include "symmake_abld.h"
#include "symmake_sbsv2.h"
@@ -459,15 +458,8 @@ MetaMakefileGenerator::createMakefileGenerator(QMakeProject *proj, bool noIO)
mkfile = new MingwMakefileGenerator;
} else if(gen == "PROJECTBUILDER" || gen == "XCODE") {
mkfile = new ProjectBuilderMakefileGenerator;
- } else if(gen == "MSVC") {
- // Visual Studio =< v6.0
- if(proj->first("TEMPLATE").indexOf(QRegExp("^vc.*")) != -1)
- mkfile = new DspMakefileGenerator;
- else
- mkfile = new NmakeMakefileGenerator;
} else if(gen == "MSVC.NET") {
- // Visual Studio >= v7.0
- if(proj->first("TEMPLATE").indexOf(QRegExp("^vc.*")) != -1 || proj->first("TEMPLATE").indexOf(QRegExp("^ce.*")) != -1)
+ if(proj->first("TEMPLATE").indexOf(QRegExp("^vc.*")) != -1)
mkfile = new VcprojGenerator;
else
mkfile = new NmakeMakefileGenerator;
diff --git a/qmake/generators/symbian/symmake_abld.cpp b/qmake/generators/symbian/symmake_abld.cpp
index 00c05b7..10c201c 100644
--- a/qmake/generators/symbian/symmake_abld.cpp
+++ b/qmake/generators/symbian/symmake_abld.cpp
@@ -303,19 +303,16 @@ void SymbianAbldMakefileGenerator::writeWrapperMakefile(QFile& wrapperFile, bool
// generate command lines like this ...
// -@ if NOT EXIST ".\somedir" mkdir ".\somedir"
QStringList dirsToClean;
+ QString dirExists = var("QMAKE_CHK_DIR_EXISTS");
+ QString mkdir = var("QMAKE_MKDIR");
for (QMap<QString, QStringList>::iterator it = systeminclude.begin(); it != systeminclude.end(); ++it) {
QStringList values = it.value();
for (int i = 0; i < values.size(); ++i) {
if (values.at(i).endsWith("/" QT_EXTRA_INCLUDE_DIR)) {
QString fixedValue(QDir::toNativeSeparators(values.at(i)));
dirsToClean << fixedValue;
-#ifdef Q_OS_WIN32
- t << "\t-@ if NOT EXIST \"" << fixedValue << "\" mkdir \""
- << fixedValue << "\"" << endl;
-#else
- t << "\t-@ if test ! -d \"" << fixedValue << "\"; then mkdir \""
- << fixedValue << "\"" << "; fi" <<endl;
-#endif
+ t << "\t-@ " << dirExists << " \"" << fixedValue << "\" "
+ << mkdir << " \"" << fixedValue << "\"" << endl;
}
}
}
@@ -324,11 +321,7 @@ void SymbianAbldMakefileGenerator::writeWrapperMakefile(QFile& wrapperFile, bool
// Note: EXTENSION_CLEAN will get called many times when doing reallyclean
// This is why the "2> NUL" gets appended to generated clean targets in makefile.cpp.
t << EXTENSION_CLEAN ": " COMPILER_CLEAN_TARGET << endl;
-#ifdef Q_OS_WIN32
- generateCleanCommands(t, dirsToClean, var("QMAKE_DEL_DIR"), " /S /Q ", "", "");
-#else
- generateCleanCommands(t, dirsToClean, "rm", " -rf ", "", "");
-#endif
+ generateCleanCommands(t, dirsToClean, var("QMAKE_DEL_TREE"), "", "", "");
t << endl;
t << PRE_TARGETDEPS_TARGET ":"
diff --git a/qmake/generators/unix/unixmake.cpp b/qmake/generators/unix/unixmake.cpp
index 3f92993..346663a 100644
--- a/qmake/generators/unix/unixmake.cpp
+++ b/qmake/generators/unix/unixmake.cpp
@@ -787,10 +787,8 @@ UnixMakefileGenerator::defaultInstall(const QString &t)
uninst.append("-$(DEL_FILE) \"" + dst_targ + "\"");
if(!links.isEmpty()) {
for(int i = 0; i < links.size(); ++i) {
- if(Option::target_mode == Option::TARG_WIN_MODE ||
- Option::target_mode == Option::TARG_MAC9_MODE) {
- } else if(Option::target_mode == Option::TARG_UNIX_MODE ||
- Option::target_mode == Option::TARG_MACX_MODE) {
+ if(Option::target_mode == Option::TARG_UNIX_MODE ||
+ Option::target_mode == Option::TARG_MACX_MODE) {
QString link = Option::fixPathToTargetOS(destdir + links[i], false);
int lslash = link.lastIndexOf(Option::dir_sep);
if(lslash != -1)
diff --git a/qmake/generators/win32/msvc_dsp.cpp b/qmake/generators/win32/msvc_dsp.cpp
deleted file mode 100644
index 9c8dd1d..0000000
--- a/qmake/generators/win32/msvc_dsp.cpp
+++ /dev/null
@@ -1,1207 +0,0 @@
-/****************************************************************************
-**
-** 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 qmake application 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 "msvc_dsp.h"
-#include "option.h"
-
-#include <qdir.h>
-#include <qset.h>
-
-#include <stdlib.h>
-
-QT_BEGIN_NAMESPACE
-
-DspMakefileGenerator::DspMakefileGenerator() : Win32MakefileGenerator(), init_flag(false)
-{
-}
-
-bool DspMakefileGenerator::writeMakefile(QTextStream &t)
-{
- if(!project->values("QMAKE_FAILED_REQUIREMENTS").isEmpty()) {
- /* for now just dump, I need to generated an empty dsp or something.. */
- fprintf(stderr, "Project file not generated because all requirements not met:\n\t%s\n",
- var("QMAKE_FAILED_REQUIREMENTS").toLatin1().constData());
- return true;
- }
-
- // Generate workspace file
- if(project->first("TEMPLATE") == "vcsubdirs") {
- if (!project->isActiveConfig("build_pass")) {
- debug_msg(1, "Generator: MSVC: Writing workspave file");
- writeSubDirs(t);
- } else {
- debug_msg(1, "Generator: MSVC: Not writing workspace file for build_pass configs");
- }
- return true;
- } else if (project->first("TEMPLATE") == "vcapp" || project->first("TEMPLATE") == "vclib") {
- if(!project->isActiveConfig("build_pass"))
- return writeDspParts(t);
- return true;
- }
- return project->isActiveConfig("build_pass");
-}
-
-bool DspMakefileGenerator::hasBuiltinCompiler(const QString &filename) const
-{
- for (int i = 0; i < Option::cpp_ext.count(); ++i)
- if (filename.endsWith(Option::cpp_ext.at(i)))
- return true;
- for (int i = 0; i < Option::c_ext.count(); ++i)
- if (filename.endsWith(Option::c_ext.at(i)))
- return true;
- return false;
-}
-
-QString DspMakefileGenerator::replaceExtraCompilerVariables(const QString &var, const QStringList &in, const QStringList &out)
-{
- QString ret = MakefileGenerator::replaceExtraCompilerVariables(var, in, out);
- ret.replace("$(DEFINES)", varGlue("PRL_EXPORT_DEFINES"," -D"," -D","") +
- varGlue("DEFINES"," -D"," -D",""));
-
- QString incpath = this->var("MSVCDSP_INCPATH");
- incpath.replace("/I", "-I");
- ret.replace("$(INCPATH)", incpath);
- return ret;
-}
-
-
-// if config is part of a multibuild thenthe gule (this) has the correct MSVCDSP_PROJECT
-QString DspMakefileGenerator::configName(DspMakefileGenerator * config)
-{
- return var("MSVCDSP_PROJECT") + config->var("MSVCDSP_CONFIG_NAME");
-}
-
-bool DspMakefileGenerator::writeDspHeader(QTextStream &t)
-{
- DspMakefileGenerator * config = this;
- if (mergedProjects.count())
- config = mergedProjects.at(0);
-
- t << "# Microsoft Developer Studio Project File - Name=\"" << var("MSVCDSP_PROJECT") << "\" - Package Owner=<4>" << endl;
- t << "# Microsoft Developer Studio Generated Build File, Format Version 6.00" << endl;
- t << "# ** DO NOT EDIT **" << endl;
- t << endl;
- t << "# TARGTYPE \"Win32 (x86) " << var("MSVCDSP_TARGETTYPE") << "\" " << var("MSVCDSP_DSPTYPE") << endl;
- t << endl;
- t << "CFG=\"" << configName(config) << "\"" << endl;
- t << "!MESSAGE This is not a valid makefile. To build this project using NMAKE," << endl;
- t << "!MESSAGE use the Export Makefile command and run" << endl;
- t << "!MESSAGE " << endl;
- t << "!MESSAGE NMAKE /f " << escapeFilePath(var("TARGET")) << ".mak." << endl;
- t << "!MESSAGE " << endl;
- t << "!MESSAGE You can specify a configuration when running NMAKE" << endl;
- t << "!MESSAGE by defining the macro CFG on the command line. For example:" << endl;
- t << "!MESSAGE " << endl;
- t << "!MESSAGE NMAKE /f " << escapeFilePath(var("TARGET")) << ".mak CFG=\"" << configName(config) << "\"" << endl;
- t << "!MESSAGE " << endl;
- t << "!MESSAGE Possible choices for configuration are:" << endl;
- t << "!MESSAGE " << endl;
- if (mergedProjects.count()) {
- for (int i = 0; i < mergedProjects.count(); ++i) {
- DspMakefileGenerator * config = mergedProjects.at(i);
- t << "!MESSAGE \"" << configName(config) << "\" (based on \"Win32 (x86) " << config->var("MSVCDSP_TARGETTYPE") << "\")" << endl;
- }
- } else {
- t << "!MESSAGE \"" << configName(config) << "\" (based on \"Win32 (x86) " << config->var("MSVCDSP_TARGETTYPE") << "\")" << endl;
- }
- t << "!MESSAGE " << endl;
- t << endl;
- t << "# Begin Project" << endl;
- t << "# PROP AllowPerConfigDependencies 0" << endl;
- t << "# PROP Scc_ProjName \"\"" << endl;
- t << "# PROP Scc_LocalPath \"\"" << endl;
- t << "CPP=" << config->var("QMAKE_CC") << endl;
- t << "MTL=" << config->var("QMAKE_IDL") << endl;
- t << "RSC=" << config->var("QMAKE_RC") << endl;
- t << "BSC32=bscmake.exe" << endl;
-
- return true;
-}
-
-
-bool DspMakefileGenerator::writeDspParts(QTextStream &t)
-{
- //bool staticLibTarget = var("MSVCDSP_DSPTYPE") == "0x0104";
-
- writeDspHeader(t);
- writeDspConfig(t, this);
- t << endl;
- t << "# Begin Target" << endl;
- t << endl;
- t << "# Name \"" << configName(this) << "\"" << endl;
- t << endl;
-
-
- QStringList listNames = QString("SOURCES|DEF_FILE").split("|");
- QStringList allListNames = listNames;
- writeFileGroup(t, listNames, "Source Files", "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat");
- listNames = QStringList("HEADERS");
- allListNames += listNames;
- writeFileGroup(t, QStringList("HEADERS"), "Header Files", "h;hpp;hxx;hm;inl");
- listNames = QString("FORMS|INTERFACES|FORMS3").split("|");
- allListNames += listNames;
- writeFileGroup(t, listNames, "Form Files", "ui");
- listNames = QStringList("IMAGES");
- allListNames += listNames;
- writeFileGroup(t, QStringList("IMAGES"), "Image Files", "");
- listNames = QString("RC_FILE|RESOURCES").split("|");
- allListNames += listNames;
- writeFileGroup(t, listNames, "Resources", "rc;qrc");
- listNames = QStringList("TRANSLATIONS");
- allListNames += listNames;
- writeFileGroup(t, listNames, "Translations", "ts;xlf");
- listNames = QStringList("LEXSOURCES");
- allListNames += listNames;
- writeFileGroup(t, listNames, "Lexables", "l");
- listNames = QStringList("YACCSOURCES");
- allListNames += listNames;
- writeFileGroup(t, listNames, "Yaccables", "y");
- listNames = QStringList("TYPELIBS");
- allListNames += listNames;
- writeFileGroup(t, listNames, "Type Libraries", "tlb;olb");
-
- if (!project->isEmpty("QMAKE_EXTRA_COMPILERS")) {
- const QStringList &quc = project->values("QMAKE_EXTRA_COMPILERS");
- for (QStringList::ConstIterator it = quc.begin(); it != quc.end(); ++it) {
- const QStringList &inputs = project->values((*it)+".input");
- for (QStringList::ConstIterator input = inputs.begin(); input != inputs.end(); ++input) {
- if (!allListNames.contains((*input)) && *input != "UIC3_HEADERS")
- writeFileGroup(t, QStringList((*input)), (*input) + " Files", "");
- }
- }
- }
-
- project->values("SWAPPED_BUILD_STEPS") = swappedBuildSteps.keys();
-
- writeFileGroup(t, QString("GENERATED_SOURCES|GENERATED_FILES|SWAPPED_BUILD_STEPS").split("|"), "Generated", "");
-
- t << "# End Target" << endl;
- t << "# End Project" << endl;
- return true;
-}
-
-void
-DspMakefileGenerator::init()
-{
- if(init_flag)
- return;
- QStringList::Iterator it;
- init_flag = true;
-
- platform = "Win32";
- if(!project->values("QMAKE_PLATFORM").isEmpty())
- platform = varGlue("QMAKE_PLATFORM", "", " ", "");
-
- // this should probably not be here, but I'm using it to wrap the .t files
- if(project->first("TEMPLATE") == "vcapp")
- project->values("QMAKE_APP_FLAG").append("1");
- else if(project->first("TEMPLATE") == "vclib")
- project->values("QMAKE_LIB_FLAG").append("1");
-
- if(project->values("QMAKESPEC").isEmpty())
- project->values("QMAKESPEC").append(qgetenv("QMAKESPEC"));
-
- project->values("QMAKE_LIBS") += escapeFilePaths(project->values("LIBS"));
- processVars();
-
- if(!project->values("VERSION").isEmpty()) {
- QString version = project->values("VERSION").first();
- int firstDot = version.indexOf(".");
- QString major = version.left(firstDot);
- QString minor = version.right(version.length() - firstDot - 1);
- minor.replace(".", "");
- project->values("MSVCDSP_LFLAGS").append("/VERSION:" + major + "." + minor);
- }
-
- QString msvcdsp_project;
- if(!project->isEmpty("TARGET")) {
- project->values("TARGET") = unescapeFilePaths(project->values("TARGET"));
- msvcdsp_project = project->first("TARGET");
- }
-
- MakefileGenerator::init();
-
- if(msvcdsp_project.isEmpty())
- msvcdsp_project = Option::output.fileName();
-
- msvcdsp_project = msvcdsp_project.right(msvcdsp_project.length() - msvcdsp_project.lastIndexOf("\\") - 1);
- int dotFind = msvcdsp_project.lastIndexOf(".");
- if(dotFind != -1)
- msvcdsp_project = msvcdsp_project.left(dotFind);
- msvcdsp_project.replace("-", "");
-
- project->values("MSVCDSP_PROJECT").append(msvcdsp_project);
-
- QStringList &proj = project->values("MSVCDSP_PROJECT");
-
- for(QStringList::Iterator it = proj.begin(); it != proj.end(); ++it)
- (*it).replace(QRegExp("\\.[a-zA-Z0-9_]*$"), "");
-
- if(!project->values("QMAKE_APP_FLAG").isEmpty()) {
- if(project->isActiveConfig("console")) {
- project->values("MSVCDSP_TARGETTYPE").append("Console Application");
- project->values("MSVCDSP_DSPTYPE").append("0x0103");
- project->values("MSVCDSP_DEFINES").append(" /D \"_CONSOLE\" ");
- } else {
- project->values("MSVCDSP_TARGETTYPE").append("Application");
- project->values("MSVCDSP_DSPTYPE").append("0x0101");
- project->values("MSVCDSP_DEFINES").append(" /D \"_WINDOWS\" ");
- }
- } else {
- if(project->isActiveConfig("dll")) {
- project->values("MSVCDSP_TARGETTYPE").append("Dynamic-Link Library");
- project->values("MSVCDSP_DSPTYPE").append("0x0102");
- project->values("MSVCDSP_DEFINES").append(" /D \"_USRDLL\" ");
- } else {
- project->values("MSVCDSP_TARGETTYPE").append("Static Library");
- project->values("MSVCDSP_DSPTYPE").append("0x0104");
- project->values("MSVCDSP_DEFINES").append(" /D \"_LIB\" ");
- }
- }
-
- project->values("MSVCDSP_LFLAGS") += project->values("QMAKE_LFLAGS");
-
- if(!project->values("QMAKE_LIBDIR").isEmpty())
- project->values("MSVCDSP_LFLAGS").append(valGlue(
- escapeFilePaths(project->values("QMAKE_LIBDIR")),
- "/LIBPATH:"," /LIBPATH:",""));
-
- project->values("MSVCDSP_DEFINES").append(varGlue("DEFINES","/D ","" " /D ",""));
- project->values("MSVCDSP_DEFINES").append(varGlue("PRL_EXPORT_DEFINES","/D ","" " /D ",""));
- project->values("MSVCDSP_DEFINES").append(" /D \"WIN32\" ");
-
- QStringList &libs = project->values("QMAKE_LIBS");
- for(QStringList::Iterator libit = libs.begin(); libit != libs.end(); ++libit) {
- project->values("MSVCDSP_LIBS").append(" " + escapeFilePath(*libit));
- }
-
- QStringList &incs = project->values("INCLUDEPATH");
- for(QStringList::Iterator incit = incs.begin(); incit != incs.end(); ++incit) {
- QString inc = (*incit);
- project->values("MSVCDSP_INCPATH").append("/I" + escapeFilePath(inc));
- }
- project->values("MSVCDSP_INCPATH").append("/I" + escapeFilePath(specdir()));
-
- QString dest;
- QString preLinkStep;
- QString postLinkStep;
- QString copyDllStep;
-
- if(!project->values("QMAKE_PRE_LINK").isEmpty())
- preLinkStep += var("QMAKE_PRE_LINK");
-
- if(!project->values("QMAKE_POST_LINK").isEmpty())
- postLinkStep += var("QMAKE_POST_LINK");
-
- // don't destroy the target, it is used by prl writer.
- if(!project->values("DESTDIR").isEmpty()) {
- dest = project->first("DESTDIR");
- project->values("DESTDIR").first() = dest;
- dest = project->values("TARGET").first() + project->first("TARGET_EXT");
- dest.prepend(project->first("DESTDIR"));
- Option::fixPathToTargetOS(dest);
- dest = escapeFilePath(dest);
-
- project->values("MSVCDSP_TARGET").append(
- QString("/out:") + dest);
- if(project->isActiveConfig("dll")) {
- QString imp = dest;
- imp.replace(".dll", ".lib");
- project->values("MSVCDSP_TARGET").append(QString(" /implib:") + escapeFilePath(imp));
- }
- }
-
- if(project->isActiveConfig("dll") && !project->values("DLLDESTDIR").isEmpty()) {
- QStringList dlldirs = project->values("DLLDESTDIR");
- if(dlldirs.count())
- copyDllStep += "\t";
- for(QStringList::Iterator dlldir = dlldirs.begin(); dlldir != dlldirs.end(); ++dlldir) {
- copyDllStep += "copy \"$(TargetPath)\" " + escapeFilePath(Option::fixPathToTargetOS(*dlldir)) + "\t";
- }
- }
-
- if(!preLinkStep.isEmpty()) {
- project->values("MSVCDSP_PRE_LINK").append(
- "# Begin Special Build Tool\n"
- "SOURCE=$(InputPath)\n"
- "PreLink_Desc=Post Build Step\n"
- "PreLink_Cmds=" + preLinkStep + "\n"
- "# End Special Build Tool\n");
- }
-
- if(!postLinkStep.isEmpty() || !copyDllStep.isEmpty()) {
- project->values("MSVCDSP_POST_LINK").append(
- "# Begin Special Build Tool\n"
- "SOURCE=$(InputPath)\n"
- "PostBuild_Desc=Post Build Step\n"
- "PostBuild_Cmds=" + postLinkStep + copyDllStep + "\n"
- "# End Special Build Tool\n");
- }
-
- QStringList &formList = project->values("FORMS");
- for(QStringList::ConstIterator hit = formList.begin(); hit != formList.end(); ++hit) {
- if(exists(*hit + ".h"))
- project->values("SOURCES").append(*hit + ".h");
- }
- QStringList &form3List = project->values("FORMS3");
- for(QStringList::ConstIterator hit = form3List.begin(); hit != form3List.end(); ++hit) {
- if(exists(*hit + ".h"))
- project->values("SOURCES").append(*hit + ".h");
- }
-
- project->values("QMAKE_INTERNAL_PRL_LIBS") << "MSVCDSP_LIBS";
-
- // Move some files around //### is this compat?
- if (!project->values("IMAGES").isEmpty()) {
- QString imageFactory(project->first("QMAKE_IMAGE_COLLECTION"));
- project->values("GENERATED_SOURCES") += imageFactory;
- project->values("SOURCES").removeAll(imageFactory);
- }
-
- // Setup PCH variables
- precompH = project->first("PRECOMPILED_HEADER");
- namePCH = fileInfo(precompH).fileName();
- usePCH = !precompH.isEmpty() && project->isActiveConfig("precompile_header");
- if (usePCH) {
- // Created files
- precompObj = var("PRECOMPILED_DIR") + project->first("TARGET") + "_pch" + Option::obj_ext;
- precompPch = var("PRECOMPILED_DIR") + project->first("TARGET") + "_pch.pch";
-
- // Add PRECOMPILED_HEADER to HEADERS
- if (!project->values("HEADERS").contains(precompH))
- project->values("HEADERS") += precompH;
- // Add precompile compiler options
- project->values("PRECOMPILED_FLAGS") = QStringList("/Fp" + precompPch + " /Yu" + escapeFilePath(namePCH) + " /FI" + escapeFilePath(namePCH) + " ");
- // Return to variable pool
- project->values("PRECOMPILED_OBJECT") = QStringList(precompObj);
- project->values("PRECOMPILED_PCH") = QStringList(precompPch);
- }
-
- QString buildName;
- if (!var("BUILD_NAME").isEmpty())
- buildName = var("BUILD_NAME");
- else if (project->isActiveConfig("debug"))
- buildName = "Debug";
- else
- buildName = "Release";
-
- project->values("MSVCDSP_CONFIG_NAME") = QStringList(" - " + platform + " " + buildName);
-}
-
-void DspMakefileGenerator::processPrlVariable(const QString &var, const QStringList &l)
-{
- if(var == "QMAKE_PRL_DEFINES") {
- QStringList &out = project->values("MSVCDSP_DEFINES");
- for(QStringList::ConstIterator it = l.begin(); it != l.end(); ++it) {
- if(out.indexOf((*it)) == -1)
- out.append((" /D \"" + *it + "\""));
- }
- } else {
- MakefileGenerator::processPrlVariable(var, l);
- }
-}
-
-bool DspMakefileGenerator::openOutput(QFile &file, const QString &build) const
-{
- QString outdir;
- if(!file.fileName().isEmpty()) {
- if(QDir::isRelativePath(file.fileName()))
- file.setFileName(Option::output_dir + "/" + file.fileName()); //pwd when qmake was run
- QFileInfo fi(fileInfo(file.fileName()));
- if(fi.isDir())
- outdir = file.fileName() + QDir::separator();
- }
-
- if(!outdir.isEmpty() || file.fileName().isEmpty()) {
- QString ext = project->first("DSP_EXTENSION");
- if(project->first("TEMPLATE") == "vcsubdirs") {
- if (!project->first("DSW_EXTENSION").isEmpty())
- ext = project->first("DSW_EXTENSION");
- else
- ext = ".dsw";
- }
- QString outputName = unescapeFilePath(project->first("QMAKE_DSP_PROJECT_NAME"));
- if (!project->first("MAKEFILE").isEmpty())
- outputName = unescapeFilePath(project->first("MAKEFILE"));
- if (outputName.isEmpty())
- outputName = unescapeFilePath(project->first("QMAKE_ORIG_TARGET"));
- file.setFileName(outdir + outputName + ext);
- }
-
- if(QDir::isRelativePath(file.fileName())) {
- QString ofile = Option::fixPathToLocalOS(file.fileName());
- int slashfind = ofile.lastIndexOf(Option::dir_sep);
- if(slashfind == -1) {
- ofile = ofile.replace(QRegExp("-"), "_");
- } else {
- int hypenfind = ofile.indexOf('-', slashfind);
- while (hypenfind != -1 && slashfind < hypenfind) {
- ofile = ofile.replace(hypenfind, 1, "_");
- hypenfind = ofile.indexOf('-', hypenfind + 1);
- }
- }
- file.setFileName(Option::fixPathToLocalOS(qmake_getpwd() + Option::dir_sep + ofile));
- }
- return Win32MakefileGenerator::openOutput(file, build);
-}
-
-bool DspMakefileGenerator::mergeBuildProject(MakefileGenerator *other)
-{
-
- mergedProjects.prepend(static_cast<DspMakefileGenerator*>(other));
- return true;
-}
-
-bool DspMakefileGenerator::writeProjectMakefile()
-{
- bool ret = true;
-
- QTextStream t(&Option::output);
- // Check if all requirements are fulfilled
- if(!project->values("QMAKE_FAILED_REQUIREMENTS").isEmpty()) {
- fprintf(stderr, "Project file not generated because all requirements not met:\n\t%s\n",
- var("QMAKE_FAILED_REQUIREMENTS").toLatin1().constData());
- return true;
- }
-
- // Generate project file
- if(project->first("TEMPLATE") == "vcapp" ||
- project->first("TEMPLATE") == "vclib") {
- if (!mergedProjects.count()) {
- warn_msg(WarnLogic, "Generator: MSVC DSP: no single configuration created, cannot output project!");
- return false;
- }
- debug_msg(1, "Generator: MSVC 6: Writing project file");
-
- writeDspHeader(t);
- for (int i = 0; i < mergedProjects.count(); ++i) {
- DspMakefileGenerator* config = mergedProjects.at(i);
- t << endl;
- if (i == 0)
- t << "!IF";
- else
- t << "!ELSEIF";
- t << " \"$(CFG)\" == \"" << configName(config) << "\"" << endl;
- t << endl;
- writeDspConfig(t, config);
- }
- t << endl;
- t << "!ENDIF " << endl;
- t << endl;
- t << "# Begin Target" << endl;
- t << endl;
- for (int i = 0; i < mergedProjects.count(); ++i)
- t << "# Name \"" << configName(mergedProjects.at(i)) << "\"" << endl;
- t << endl;
-
- QMap< QString, QSet<QString> > files;
-
- // merge source files
- for (int i = 0; i < mergedProjects.count(); ++i) {
-
- DspMakefileGenerator* config = mergedProjects.at(i);
-
- files["DEF_FILE"] += config->project->values("DEF_FILE").toSet();
- files["SOURCES"] += config->project->values("SOURCES").toSet();
- files["HEADERS"] += config->project->values("HEADERS").toSet();
- files["INTERFACES"] += config->project->values("INTERFACES").toSet();
- files["FORMS"] += config->project->values("FORMS").toSet();
- files["FORMS"] += config->project->values("FORMS3").toSet();
- files["IMAGES"] += config->project->values("IMAGES").toSet();
- files["RC_FILE"] += config->project->values("RC_FILE").toSet();
- files["RESOURCES"] += config->project->values("RESOURCES").toSet();
- files["TRANSLATIONS"] += config->project->values("TRANSLATIONS").toSet();
- files["LEXSOURCES"] += config->project->values("LEXSOURCES").toSet();
- files["YACCSOURCES"] += config->project->values("YACCSOURCES").toSet();
- files["TYPELIBS"] += config->project->values("TYPELIBS").toSet();
-
- if (!config->project->isEmpty("QMAKE_EXTRA_COMPILERS")) {
- const QStringList &quc = config->project->values("QMAKE_EXTRA_COMPILERS");
- for (QStringList::ConstIterator it = quc.begin(); it != quc.end(); ++it) {
- const QStringList &inputs = project->values((*it)+".input");
- for (QStringList::ConstIterator input = inputs.begin(); input != inputs.end(); ++input) {
- if (*input != "UIC3_HEADERS")
- files[(*input)] += config->project->values((*input)).toSet();
- }
- }
- }
- }
-
- QStringList keys = files.keys();
- for (int k = 0; k < keys.size(); ++k)
- project->values(keys.at(k)) = QList<QString>::fromSet(files[keys.at(k)]);
-
- QStringList listNames = QString("SOURCES|DEF_FILE").split("|");
- QStringList allListNames = listNames;
- writeFileGroup(t, listNames, "Source Files", "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat");
- listNames = QStringList("HEADERS");
- allListNames += listNames;
- writeFileGroup(t, listNames, "Header Files", "h;hpp;hxx;hm;inl");
- listNames = QString("FORMS|INTERFACES|FORMS3").split("|");
- allListNames += listNames;
- writeFileGroup(t, listNames, "Form Files", "ui");
- listNames = QStringList("IMAGES");
- allListNames += listNames;
- writeFileGroup(t, listNames, "Image Files", "");
- listNames = QString("RC_FILE|RESOURCES").split("|");
- allListNames += listNames;
- writeFileGroup(t, listNames, "Resources", "rc;qrc");
- listNames = QStringList("TRANSLATIONS");
- allListNames += listNames;
- writeFileGroup(t, listNames, "Translations", "ts;xlf");
- listNames = QStringList("LEXSOURCES");
- allListNames += listNames;
- writeFileGroup(t, listNames, "Lexables", "l");
- listNames = QStringList("YACCSOURCES");
- allListNames += listNames;
- writeFileGroup(t, listNames, "Yaccables", "y");
- listNames = QStringList("TYPELIBS");
- allListNames += listNames;
- writeFileGroup(t, listNames, "Type Libraries", "tlb;olb");
-
- for (int l = 0; l < allListNames.size(); ++l)
- keys.removeAll(allListNames.at(l));
-
- for (int k = 0; k < keys.size(); ++k)
- writeFileGroup(t, QStringList(keys.at(k)), keys.at(k) + " Files", "");
-
- // done last as generated may have changed when creating build rules for the above
- for (int i = 0; i < mergedProjects.count(); ++i) {
-
- DspMakefileGenerator* config = mergedProjects.at(i);
-
- config->project->values("SWAPPED_BUILD_STEPS") = config->swappedBuildSteps.keys();
- files["SWAPPED_BUILD_STEPS"] += config->project->values("SWAPPED_BUILD_STEPS").toSet();
-
- files["GENERATED_SOURCES"] += config->project->values("GENERATED_SOURCES").toSet();
- files["GENERATED_FILES"] += config->project->values("GENERATED_FILES").toSet();
- }
-
- project->values("SWAPPED_BUILD_STEPS") = QList<QString>::fromSet(files["SWAPPED_BUILD_STEPS"]);
- project->values("GENERATED_SOURCES") = QList<QString>::fromSet(files["GENERATED_SOURCES"]);
- project->values("GENERATED_FILES") = QList<QString>::fromSet(files["GENERATED_FILES"]);
-
- writeFileGroup(t, QString("GENERATED_SOURCES|GENERATED_FILES|SWAPPED_BUILD_STEPS").split("|"), "Generated", "");
- t << endl;
- t << "# End Target" << endl;
- t << "# End Project" << endl;
- }else if(project->first("TEMPLATE") == "vcsubdirs") {
- ret = writeMakefile(t);
- }
-
- return ret;
-}
-
-const char _dswHeader60[] = "Microsoft Developer Studio Workspace File, Format Version 6.00\n";
-const char _dswWarning[] = "# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!\n";
-const char _dswDevider[] = "###############################################################################\n";
-const char _dswProjectName[] = "Project: \"%1\"=%2 - Package Owner=<4>\n"; // %1 = project name, %2 = project path
-const char _dswPackage5Start[] = "Package=<5>\n{{{\n";
-const char _dswPackage5Stop[] = "}}}\n";
-const char _dswPackage4Start[] = "Package=<4>\n{{{\n";
-const char _dswPackage4Stop[] = "}}}\n";
-const char _dswProjectDep[] = " Begin Project Dependency\n Project_Dep_Name %1\n End Project Dependency\n"; // %1 = project name
-const char _dswGlobal[] = "Global:\n\nPackage=<5>\n{{{\n}}}\n\nPackage=<3>\n{{{\n}}}\n\n";
-
-
-struct WorkspaceDepend {
- QString dspProjectFile, orig_target, target;
- QStringList dependencies;
-};
-
-void DspMakefileGenerator::writeSubDirs(QTextStream &t)
-{
- // Output headers
- t << _dswHeader60;
- t << _dswWarning;
- t << endl;
-
- QHash<QString, WorkspaceDepend*> workspace_depends;
- QList<WorkspaceDepend*> workspace_cleanup;
- QStringList subdirs = project->values("SUBDIRS");
- QString oldpwd = qmake_getpwd();
-
- // Make sure that all temp projects are configured
- // for release so that the depends are created
- // without the debug <lib>dxxx.lib name mangling
- QStringList old_after_vars = Option::after_user_vars;
- Option::after_user_vars.append("CONFIG+=release");
-
- for(int i = 0; i < subdirs.size(); ++i) {
- QString tmp = subdirs.at(i);
- if(!project->isEmpty(tmp + ".file")) {
- if(!project->isEmpty(tmp + ".subdir"))
- warn_msg(WarnLogic, "Cannot assign both file and subdir for subdir %s",
- tmp.toLatin1().constData());
- tmp = project->first(tmp + ".file");
- } else if(!project->isEmpty(tmp + ".subdir")) {
- tmp = project->first(tmp + ".subdir");
- }
-
- QFileInfo fi(fileInfo(Option::fixPathToLocalOS(tmp, true)));
- if(fi.exists()) {
- if(fi.isDir()) {
- QString profile = tmp;
- if(!profile.endsWith(Option::dir_sep))
- profile += Option::dir_sep;
- profile += fi.baseName() + Option::pro_ext;
- subdirs.append(profile);
- } else {
- QMakeProject tmp_proj;
- QString dir = fi.path(), fn = fi.fileName();
- if(!dir.isEmpty()) {
- if(!qmake_setpwd(dir))
- fprintf(stderr, "Cannot find directory: %s\n", dir.toLatin1().constData());
- }
- if(tmp_proj.read(fn)) {
- // Check if all requirements are fulfilled
- if(!tmp_proj.variables()["QMAKE_FAILED_REQUIREMENTS"].isEmpty()) {
- fprintf(stderr, "Project file(%s) not added to Workspace because all requirements not met:\n\t%s\n",
- fn.toLatin1().constData(), tmp_proj.values("QMAKE_FAILED_REQUIREMENTS").join(" ").toLatin1().constData());
- continue;
- }
- if(tmp_proj.first("TEMPLATE") == "vcsubdirs") {
- QStringList tmp_proj_subdirs = tmp_proj.variables()["SUBDIRS"];
- for(int x = 0; x < tmp_proj_subdirs.size(); ++x) {
- QString tmpdir = tmp_proj_subdirs.at(x);
- if(!tmp_proj.isEmpty(tmpdir + ".file")) {
- if(!tmp_proj.isEmpty(tmpdir + ".subdir"))
- warn_msg(WarnLogic, "Cannot assign both file and subdir for subdir %s",
- tmpdir.toLatin1().constData());
- tmpdir = tmp_proj.first(tmpdir + ".file");
- } else if(!tmp_proj.isEmpty(tmpdir + ".subdir")) {
- tmpdir = tmp_proj.first(tmpdir + ".subdir");
- }
- subdirs += fileFixify(tmpdir);
- }
- } else if(tmp_proj.first("TEMPLATE") == "vcapp" || tmp_proj.first("TEMPLATE") == "vclib") {
- // Initialize a 'fake' project to get the correct variables
- // and to be able to extract all the dependencies
- DspMakefileGenerator tmp_dsp;
- tmp_dsp.setNoIO(true);
- tmp_dsp.setProjectFile(&tmp_proj);
- if(Option::debug_level) {
- QMap<QString, QStringList> &vars = tmp_proj.variables();
- for(QMap<QString, QStringList>::Iterator it = vars.begin();
- it != vars.end(); ++it) {
- if(it.key().left(1) != "." && !it.value().isEmpty())
- debug_msg(1, "%s: %s === %s", fn.toLatin1().constData(), it.key().toLatin1().constData(),
- it.value().join(" :: ").toLatin1().constData());
- }
- }
-
- // We assume project filename is [QMAKE_ORIG_TARGET].vcproj
- QString dsp = unescapeFilePath(tmp_dsp.project->first("MSVCDSP_PROJECT") + project->first("DSP_EXTENSION"));
-
- // If file doesn't exsist, then maybe the users configuration
- // doesn't allow it to be created. Skip to next...
- if(!exists(qmake_getpwd() + Option::dir_sep + dsp)) {
- warn_msg(WarnLogic, "Ignored (not found) '%s'", QString(qmake_getpwd() + Option::dir_sep + dsp).toLatin1().constData());
- goto nextfile; // # Dirty!
- }
-
- WorkspaceDepend *newDep = new WorkspaceDepend;
- newDep->dspProjectFile = fileFixify(dsp);
- newDep->orig_target = unescapeFilePath(tmp_proj.first("QMAKE_ORIG_TARGET"));
- newDep->target = tmp_proj.first("MSVCDSP_PROJECT").section(Option::dir_sep, -1) + tmp_proj.first("TARGET_EXT");
-
- // We want to store it as the .lib name.
- if(newDep->target.endsWith(".dll"))
- newDep->target = newDep->target.left(newDep->target.length()-3) + "lib";
-
- // All projects having mocable sourcefiles are dependent on moc.exe
- if(tmp_proj.variables()["CONFIG"].contains("moc"))
- newDep->dependencies << "moc.exe";
-
- // All extra compilers which has valid input are considered dependencies
- const QStringList &quc = tmp_proj.variables()["QMAKE_EXTRA_COMPILERS"];
- for(QStringList::ConstIterator it = quc.constBegin(); it != quc.constEnd(); ++it) {
- const QStringList &invar = tmp_proj.variables().value((*it) + ".input");
- for(QStringList::ConstIterator iit = invar.constBegin(); iit != invar.constEnd(); ++iit) {
- const QStringList fileList = tmp_proj.variables().value(*iit);
- if (!fileList.isEmpty()) {
- QString dep = tmp_proj.first((*it) + ".commands").section('/', -1).section('\\', -1);
- if (!newDep->dependencies.contains(dep))
- newDep->dependencies << dep;
- }
- }
- }
-
- // Add all unknown libs to the deps
- QStringList where("QMAKE_LIBS");
- if(!tmp_proj.isEmpty("QMAKE_INTERNAL_PRL_LIBS"))
- where = tmp_proj.variables()["QMAKE_INTERNAL_PRL_LIBS"];
-
- for(QStringList::iterator wit = where.begin();
- wit != where.end(); ++wit) {
- QStringList &l = tmp_proj.variables()[(*wit)];
- for(QStringList::Iterator it = l.begin(); it != l.end(); ++it) {
- QString opt = (*it).trimmed();
- if(!opt.startsWith("/") && // Not a switch
- opt != newDep->target && // Not self
- opt != "opengl32.lib" && // We don't care about these libs
- opt != "glu32.lib" && // to make depgen alittle faster
- opt != "kernel32.lib" &&
- opt != "user32.lib" &&
- opt != "gdi32.lib" &&
- opt != "comdlg32.lib" &&
- opt != "advapi32.lib" &&
- opt != "shell32.lib" &&
- opt != "ole32.lib" &&
- opt != "oleaut32.lib" &&
- opt != "uuid.lib" &&
- opt != "imm32.lib" &&
- opt != "winmm.lib" &&
- opt != "wsock32.lib" &&
- opt != "ws2_32.lib" &&
- opt != "winspool.lib" &&
- opt != "delayimp.lib")
- {
- newDep->dependencies << opt.section(Option::dir_sep, -1);
- }
- }
- }
- workspace_cleanup.append(newDep);
- workspace_depends.insert(newDep->target, newDep);
-
- debug_msg(1, "Generator: MSVC: Added project (name:'%s' path:'%s' deps:'%s')",
- qPrintable(newDep->target) , qPrintable(newDep->dspProjectFile),
- qPrintable(newDep->dependencies.join(";")));
- }
- }
-nextfile:
- qmake_setpwd(oldpwd);
- }
- }
- }
-
- // Restore previous after_user_var options
- Option::after_user_vars = old_after_vars;
-
- // Output all projects
- QString dswProjectName = QLatin1String(_dswProjectName);
- QString dswProjectDep = QLatin1String(_dswProjectDep);
- for(QList<WorkspaceDepend*>::Iterator it = workspace_cleanup.begin(); it != workspace_cleanup.end(); ++it) {
- t << _dswDevider;
- t << endl;
- t << dswProjectName.arg((*it)->orig_target).arg((*it)->dspProjectFile);
- t << endl;
- t << _dswPackage5Start;
- t << _dswPackage5Stop;
- t << endl;
- t << _dswPackage4Start;
-
- // Output project dependencies
- for(QStringList::iterator dit = (*it)->dependencies.begin(); dit != (*it)->dependencies.end(); ++dit) {
- if(WorkspaceDepend *vc = workspace_depends[*dit])
- t << dswProjectDep.arg(vc->orig_target);
- }
-
- t << _dswPackage4Stop;
- }
-
- // Output global part
- t << _dswDevider << endl;
- t << _dswGlobal;
- t << _dswDevider;
- t << endl << endl;
-}
-
-class FolderGroup
-{
-public:
- QString name;
- QString filter;
- QMap<QString, FolderGroup *> subFolders;
- QMap<QString, QString> files;
-
- void insertStructured(const QString &file, const QString &fileListName)
- {
- QStringList path = QFileInfo(file).path().split("/");
- if (!path.isEmpty() && path.at(0) == ".")
- path.takeAt(0);
- FolderGroup *currentFolder = this;
- for (int i = 0; i < path.size(); i++) {
- if (currentFolder->subFolders.contains(path.at(i))) {
- currentFolder = currentFolder->subFolders.value(path.at(i));
- } else {
- FolderGroup *newFolder = new FolderGroup;
- newFolder->name = path.at(i);
- currentFolder->subFolders.insert(path.at(i), newFolder);
- currentFolder = newFolder;
- }
- }
- currentFolder->files.insert(file, fileListName);
- }
-
- void insertFlat(const QString &file, const QString &fileListName)
- {
- files.insert(file, fileListName);
- }
-
- ~FolderGroup()
- {
- qDeleteAll(subFolders.values());
- }
-};
-
-bool DspMakefileGenerator::writeFileGroup(QTextStream &t, const QStringList &listNames, const QString &group, const QString &filter)
-{
- FolderGroup root;
- root.name = group;
- root.filter = filter;
-
- for (int i = 0; i < listNames.count(); ++i) {
- QStringList list = project->values(listNames.at(i));
- for (int j = 0; j < list.count(); ++j) {
- const QString name = list.at(j);
- if (name.isEmpty())
- continue;
- if (project->isActiveConfig("flat"))
- root.insertFlat(name, listNames.at(i));
- else
- root.insertStructured(name, listNames.at(i));
- }
- }
-
- if (root.files.isEmpty() && root.subFolders.isEmpty())
- return true;
-
- writeSubFileGroup(t, &root);
-
- return true;
-}
-
-void DspMakefileGenerator::writeSubFileGroup(QTextStream &t, FolderGroup *folder)
-{
- t << "# Begin Group \"" << folder->name << "\"" << endl;
- t << "# PROP Default_Filter \"" << folder->filter << "\"" << endl;
- QMap<QString, FolderGroup *>::const_iterator folderIt = folder->subFolders.begin();
- while (folderIt != folder->subFolders.end()) {
- writeSubFileGroup(t, folderIt.value());
- ++folderIt;
- }
- QMap<QString, QString>::const_iterator it = folder->files.begin();
- while (it != folder->files.end()) {
- t << "# Begin Source File" << endl;
- t << "SOURCE=" << escapeFilePath(it.key()) << endl;
- writeBuildstepForFile(t, it.key(), it.value());
- t << "# End Source File" << endl;
- t << endl;
- ++it;
- }
- t << "# End Group" << endl;
- t << endl;
-}
-
-bool DspMakefileGenerator::writeBuildstepForFile(QTextStream &t, const QString &file, const QString &listName)
-{
-
- if (!mergedProjects.count()) {
- t << writeBuildstepForFileForConfig(file, listName, this);
- return true;
- }
-
- //only add special build rules when needed
-
- QStringList specialBuilds;
- int i = 0;
- for (i = 0; i < mergedProjects.count(); ++i)
- specialBuilds += writeBuildstepForFileForConfig(file, listName, mergedProjects.at(i));
-
- // no special build just return
- if (specialBuilds.join("").isEmpty())
- return true;
-
- for (i = 0; i < mergedProjects.count(); ++i) {
- if (i == 0)
- t << "!IF";
- else
- t << "!ELSEIF";
- t << " \"$(CFG)\" == \"" << configName(mergedProjects.at(i)) << "\"" << endl;
- t << endl;
- t << specialBuilds.at(i);
- t << endl;
- }
-
- t << "!ENDIF" << endl;
-
- return true;
-}
-
-bool DspMakefileGenerator::writeDspConfig(QTextStream &t, DspMakefileGenerator *config)
-{
-
- bool isDebug = config->project->isActiveConfig("debug");
- bool staticLibTarget = config->var("MSVCDSP_DSPTYPE") == "0x0104";
-
- QString outDir = Option::fixPathToTargetOS(config->project->first("DESTDIR"));
- while (outDir.endsWith(Option::dir_sep))
- outDir.chop(1);
- outDir = config->escapeFilePath(outDir);
-
- QString intDir = config->project->first("OBJECTS_DIR");
- while (intDir.endsWith(Option::dir_sep))
- intDir.chop(1);
- intDir = config->escapeFilePath(intDir);
-
- t << "# PROP BASE Use_MFC 0" << endl;
- t << "# PROP BASE Use_Debug_Libraries " << (isDebug ? "1" : "0") << endl;
- t << "# PROP BASE Output_Dir " << outDir << endl;
- t << "# PROP BASE Intermediate_Dir " << intDir << endl;
- t << "# PROP BASE Target_Dir \"\"" << endl;
- t << "# PROP Use_MFC 0" << endl;
- t << "# PROP Use_Debug_Libraries " << (isDebug ? "1" : "0") << endl;
-
- t << "# PROP Output_Dir " << outDir << endl;
- t << "# PROP Intermediate_Dir " << intDir << endl;
- if (config->project->isActiveConfig("dll") || config->project->isActiveConfig("plugin"))
- t << "# PROP Ignore_Export_Lib 1" << endl;
- t << "# PROP Target_Dir \"\"" << endl;
- t << "# ADD CPP " << config->var("MSVCDSP_INCPATH") << " /c /FD " << config->var("QMAKE_CXXFLAGS") << " " << config->var("MSVCDSP_DEFINES") << " " << config->var("PRECOMPILED_FLAGS") << endl;
- t << "# ADD MTL /nologo /mktyplib203 /win32 /D " << (isDebug ? "\"_DEBUG\"" : "\"NDEBUG\"") << endl;
- t << "# ADD RSC /l 0x409 /d " << (isDebug ? "\"_DEBUG\"" : "\"NDEBUG\"") << endl;
- t << "# ADD BSC32 /nologo" << endl;
- if (staticLibTarget) {
- t << "LIB32=" << config->var("QMAKE_LIB") << endl;
- t << "# ADD LIB32 " << config->var("MSVCDSP_TARGET") << " " << config->var("PRECOMPILED_OBJECT") << endl;
- } else {
- t << "LINK32=" << config->var("QMAKE_LINK") << endl;
- t << "# ADD LINK32 " << config->var("MSVCDSP_LFLAGS") << " " << config->var("MSVCDSP_LIBS") << " " << config->var("MSVCDSP_TARGET") << " " << config->var("PRECOMPILED_OBJECT") << endl;
- }
-
- if (!config->project->values("MSVCDSP_PRE_LINK").isEmpty())
- t << config->project->values("MSVCDSP_PRE_LINK").first();
-
- if (!config->project->values("MSVCDSP_POST_LINK").isEmpty())
- t << config->project->values("MSVCDSP_POST_LINK").first();
-
- return true;
-}
-
-QString DspMakefileGenerator::writeBuildstepForFileForConfig(const QString &file, const QString &listName, DspMakefileGenerator *config)
-{
- QString ret;
- QTextStream t(&ret);
-
- // exclude from build
- if (!config->project->values(listName).contains(file)) {
- t << "# PROP Exclude_From_Build 1" << endl;
- return ret;
- }
-
- if (config->usePCH) {
- bool c_file = false;
- for (QStringList::Iterator it = Option::c_ext.begin(); it != Option::c_ext.end(); ++it) {
- if (file.endsWith(*it)) {
- c_file = true;
- break;
- }
- }
- if(c_file) {
- t << "# SUBTRACT CPP /FI" << config->escapeFilePath(config->namePCH) << " /Yu" << config->escapeFilePath(config->namePCH) << " /Fp" << endl;
- return ret;
- } else if (config->precompH.endsWith(file)) {
- // ### dependency list quickly becomes too long for VS to grok...
- t << "USERDEP_" << file << "=" << config->valGlue(config->escapeFilePaths(config->findDependencies(config->precompH)), "", "\t", "") << endl;
- t << endl;
- t << "# Begin Custom Build - Creating precompiled header from " << file << "..." << endl;
- t << "InputPath=.\\" << config->escapeFilePath(file) << endl << endl;
- t << config->precompPch + ": $(SOURCE) \"$(IntDir)\" \"$(OUTDIR)\"" << endl;
- t << "\t" << config->var("QMAKE_CC") << " /TP /W3 /FD /c /Yc /Fp" << config->precompPch << " /Fo" << config->precompObj << " /Fd\"$(IntDir)\\\\\" " << file << " ";
- t << config->var("MSVCDSP_INCPATH") << " " << config->var("MSVCDSP_DEFINES") << " " << config->var("QMAKE_CXXFLAGS") << endl;
- t << "# End Custom Build" << endl << endl;
- return ret;
- }
- }
-
- QString fileBase = QFileInfo(file).completeBaseName();
-
- bool hasBuiltin = config->hasBuiltinCompiler(file);
- BuildStep allSteps;
-
- if (!config->swappedBuildSteps.contains(file)) {
- QStringList compilers = config->project->values("QMAKE_EXTRA_COMPILERS");
- for (int i = 0; i < compilers.count(); ++i) {
- QString compiler = compilers.at(i);
- if (config->project->values(compiler + ".input").isEmpty())
- continue;
- QString input = config->project->values(compiler + ".input").first();
- QStringList inputList = config->project->values(input);
- if (!inputList.contains(file))
- continue;
-
- QStringList compilerCommands = config->project->values(compiler + ".commands");
- QStringList compilerOutput = config->project->values(compiler + ".output");
- if (compilerCommands.isEmpty() || compilerOutput.isEmpty())
- continue;
-
- QStringList compilerName = config->project->values(compiler + ".name");
- if (compilerName.isEmpty())
- compilerName << compiler;
- QStringList compilerDepends = config->project->values(compiler + ".depends");
- QString compilerDependsCommand = config->project->values(compiler + ".depend_command").join(" ");
- if (!compilerDependsCommand.isEmpty()) {
- if(!config->canExecute(compilerDependsCommand))
- compilerDependsCommand = QString();
- }
- QStringList compilerConfig = config->project->values(compiler + ".CONFIG");
-
- if (!config->verifyExtraCompiler(compiler, file))
- continue;
-
- bool combineAll = compilerConfig.contains("combine");
- if (combineAll && inputList.first() != file)
- continue;
-
- QString fileIn("$(InputPath)");
-
- if (combineAll && !inputList.isEmpty()) {
- fileIn = inputList.join(" ");
- compilerDepends += inputList;
- }
-
- QString fileOut = compilerOutput.first();
- QString fileOutBase = QFileInfo(fileOut).completeBaseName();
- fileOut.replace("${QMAKE_FILE_IN}", fileIn);
- fileOut.replace("${QMAKE_FILE_BASE}", fileBase);
- fileOut.replace("${QMAKE_FILE_OUT_BASE}", fileOutBase);
- fileOut.replace('/', '\\');
-
- BuildStep step;
- for (int i2 = 0; i2 < compilerDepends.count(); ++i2) {
- QString dependency = compilerDepends.at(i2);
- dependency.replace("${QMAKE_FILE_IN}", fileIn);
- dependency.replace("${QMAKE_FILE_BASE}", fileBase);
- dependency.replace("${QMAKE_FILE_OUT_BASE}", fileOutBase);
- dependency.replace('/', '\\');
- if (!step.deps.contains(dependency, Qt::CaseInsensitive))
- step.deps << dependency;
- }
- // depends command
- if (!compilerDependsCommand.isEmpty() && config->doDepends()) {
- char buff[256];
- QString dep_cmd = config->replaceExtraCompilerVariables(compilerDependsCommand, file,
- fileOut);
- dep_cmd = Option::fixPathToLocalOS(dep_cmd, true, false);
- if(config->canExecute(dep_cmd)) {
- if(FILE *proc = QT_POPEN(dep_cmd.toLatin1().constData(), "r")) {
- QString indeps;
- while(!feof(proc)) {
- int read_in = (int)fread(buff, 1, 255, proc);
- if(!read_in)
- break;
- indeps += QByteArray(buff, read_in);
- }
- QT_PCLOSE(proc);
- if(!indeps.isEmpty())
- step.deps += config->fileFixify(indeps.replace('\n', ' ').simplified().split(' '));
- }
- }
- }
-
-
- QString mappedFile;
- if (hasBuiltin) {
- mappedFile = fileOut;
- fileOut = fileIn;
- fileIn = file;
- }
-
- step.buildStep += " \\\n\t";
- QString command(compilerCommands.join(" "));
- // Replace any newlines with proper line-continuance
- command.replace("\n", " \\\n\t");
- // Might be a macro, and not a valid filename, so the replaceExtraCompilerVariables() would eat it
- command.replace("${QMAKE_FILE_IN}", config->escapeFilePath(fileIn));
- command.replace("${QMAKE_FILE_BASE}", config->escapeFilePath(fileBase));
- command.replace("${QMAKE_FILE_OUT_BASE}", config->escapeFilePath(fileOutBase));
- command.replace("${QMAKE_FILE_OUT}", config->escapeFilePath(fileOut));
-
- command = config->replaceExtraCompilerVariables(command, fileIn, fileOut);
-
- step.buildName = compilerName.first();
- step.buildStep += command;
- step.buildOutputs += fileOut;
-
- if (hasBuiltin) {
- step.deps << fileIn;
- config->swappedBuildSteps[mappedFile] = step;
- } else {
- allSteps << step;
- }
- }
- } else {
- allSteps << config->swappedBuildSteps.value(file);
- }
-
- if (allSteps.buildStep.isEmpty())
- return ret;
-
- int i;
- QStringList dependencyList;
- // remove dependencies that are also output
- for (i = 0; i < 1; ++i) {
- QStringList buildOutput(allSteps.buildOutputs.at(i));
-
- for (int i2 = 0; i2 < allSteps.deps.count(); ++i2) {
- QString dependency = allSteps.deps.at(i2);
- if (!buildOutput.contains(dependency) && !dependencyList.contains(dependency))
- dependencyList << dependency;
- }
- }
- QString allDependencies = config->valGlue(dependencyList, "", "\t", "");
- t << "USERDEP_" << file << "=" << allDependencies << endl;
- t << "# PROP Ignore_Default_Tool 1" << endl;
- t << "# Begin Custom Build - Running " << allSteps.buildName << " on " << file << endl;
- t << "InputPath=" << file << endl;
- t << "BuildCmds= " << allSteps.buildStep << endl;
- for (i = 0; i < allSteps.buildOutputs.count(); ++i) {
- t << config->escapeFilePath(allSteps.buildOutputs.at(i))
- << " : $(SOURCE) $(INTDIR) $(OUTDIR)\n\t$(BuildCmds)\n";
- }
- t << endl;
- t << "# End Custom Build" << endl;
-
- return ret;
-}
-
-QT_END_NAMESPACE
diff --git a/qmake/generators/win32/msvc_dsp.h b/qmake/generators/win32/msvc_dsp.h
deleted file mode 100644
index f3e2435..0000000
--- a/qmake/generators/win32/msvc_dsp.h
+++ /dev/null
@@ -1,122 +0,0 @@
-/****************************************************************************
-**
-** 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 qmake application 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 MSVC_DSP_H
-#define MSVC_DSP_H
-
-#include "winmakefile.h"
-
-QT_BEGIN_NAMESPACE
-
-class FolderGroup;
-
-class DspMakefileGenerator : public Win32MakefileGenerator
-{
- bool init_flag;
- bool writeDspHeader(QTextStream &);
- bool writeDspParts(QTextStream &);
- bool writeFileGroup(QTextStream &t, const QStringList &listNames, const QString &group, const QString &filter);
- void writeSubFileGroup(QTextStream &t, FolderGroup *folder);
- bool writeBuildstepForFile(QTextStream &t, const QString &file, const QString &listName);
- static bool writeDspConfig(QTextStream &t, DspMakefileGenerator *config);
- static QString writeBuildstepForFileForConfig(const QString &file, const QString &listName, DspMakefileGenerator *config);
- QString configName(DspMakefileGenerator * config);
-
- bool writeMakefile(QTextStream &);
- bool writeProjectMakefile();
- void writeSubDirs(QTextStream &t);
- void init();
-
-public:
- DspMakefileGenerator();
- ~DspMakefileGenerator();
-
- bool openOutput(QFile &file, const QString &build) const;
- bool hasBuiltinCompiler(const QString &filename) const;
-
-protected:
- virtual bool doDepends() const { return false; } //never necesary
- virtual void processSources() { filterIncludedFiles("SOURCES"); filterIncludedFiles("GENERATED_SOURCES"); }
- virtual QString replaceExtraCompilerVariables(const QString &, const QStringList &, const QStringList &);
- inline QString replaceExtraCompilerVariables(const QString &val, const QString &in, const QString &out)
- { return MakefileGenerator::replaceExtraCompilerVariables(val, in, out); }
- virtual bool supportsMetaBuild() { return true; }
- virtual bool supportsMergedBuilds() { return true; }
- virtual bool mergeBuildProject(MakefileGenerator *other);
- virtual void processPrlVariable(const QString &, const QStringList &);
- virtual bool findLibraries();
-
- bool usePCH;
- QString precompH, namePCH,
- precompObj, precompPch;
-
- QString platform;
-
- struct BuildStep {
- BuildStep() {}
- BuildStep &operator<<(const BuildStep &other) {
- deps << other.deps;
- buildStep += other.buildStep;
- buildName += other.buildName;
- buildOutputs += other.buildOutputs;
- return *this;
- }
-
- QStringList deps;
- QString buildStep;
- QString buildName;
- QStringList buildOutputs;
- };
- QMap<QString, BuildStep> swappedBuildSteps;
-
- // Holds all configurations for glue (merged) project
- QList<DspMakefileGenerator*> mergedProjects;
-};
-
-inline DspMakefileGenerator::~DspMakefileGenerator()
-{ }
-
-inline bool DspMakefileGenerator::findLibraries()
-{ return Win32MakefileGenerator::findLibraries("MSVCDSP_LIBS"); }
-
-QT_END_NAMESPACE
-
-#endif // MSVC_DSP_H
diff --git a/qmake/generators/win32/msvc_vcproj.cpp b/qmake/generators/win32/msvc_vcproj.cpp
index 47986f5..3536a02 100644
--- a/qmake/generators/win32/msvc_vcproj.cpp
+++ b/qmake/generators/win32/msvc_vcproj.cpp
@@ -1721,8 +1721,7 @@ QString VcprojGenerator::findTemplate(QString file)
!exists((ret = QString(QLibraryInfo::location(QLibraryInfo::DataPath) + "/win32-msvc2002/" + file))) &&
!exists((ret = QString(QLibraryInfo::location(QLibraryInfo::DataPath) + "/win32-msvc2003/" + file))) &&
!exists((ret = QString(QLibraryInfo::location(QLibraryInfo::DataPath) + "/win32-msvc2005/" + file))) &&
- !exists((ret = QString(QLibraryInfo::location(QLibraryInfo::DataPath) + "/win32-msvc2008/" + file))) &&
- !exists((ret = (QString(qgetenv("HOME")) + "/.tmake/" + file))))
+ !exists((ret = QString(QLibraryInfo::location(QLibraryInfo::DataPath) + "/win32-msvc2008/" + file))))
return "";
debug_msg(1, "Generator: MSVC.NET: Found template \'%s\'", ret.toLatin1().constData());
return ret;
diff --git a/qmake/option.cpp b/qmake/option.cpp
index ec3fea2..f775617 100644
--- a/qmake/option.cpp
+++ b/qmake/option.cpp
@@ -250,8 +250,6 @@ Option::parseCommandLine(int argc, char **argv, int skip)
Option::user_template = argv[++x];
} else if(opt == "tp" || opt == "template_prefix") {
Option::user_template_prefix = argv[++x];
- } else if(opt == "mac9") {
- Option::target_mode = TARG_MAC9_MODE;
} else if(opt == "macx") {
Option::target_mode = TARG_MACX_MODE;
} else if(opt == "unix") {
@@ -533,10 +531,7 @@ Option::init(int argc, char **argv)
Option::obj_ext = ".obj";
Option::res_ext = ".res";
} else {
- if(Option::target_mode == Option::TARG_MAC9_MODE)
- Option::dir_sep = ":";
- else
- Option::dir_sep = "/";
+ Option::dir_sep = "/";
Option::obj_ext = ".o";
}
Option::qmake_abslocation = Option::fixPathToTargetOS(Option::qmake_abslocation);
diff --git a/qmake/option.h b/qmake/option.h
index fe9a4ef..514e442 100644
--- a/qmake/option.h
+++ b/qmake/option.h
@@ -150,7 +150,7 @@ struct Option
static int warn_level;
static bool recursive;
static QStringList before_user_vars, after_user_vars, user_configs, after_user_configs;
- enum TARG_MODE { TARG_UNIX_MODE, TARG_WIN_MODE, TARG_MACX_MODE, TARG_MAC9_MODE };
+ enum TARG_MODE { TARG_UNIX_MODE, TARG_WIN_MODE, TARG_MACX_MODE };
static TARG_MODE target_mode;
static QString user_template, user_template_prefix;
static QStringList shellPath;
diff --git a/qmake/project.cpp b/qmake/project.cpp
index b232865..b28ed9c 100644
--- a/qmake/project.cpp
+++ b/qmake/project.cpp
@@ -183,9 +183,7 @@ static QString remove_quotes(const QString &arg)
static QString varMap(const QString &x)
{
QString ret(x);
- if(ret.startsWith("TMAKE")) //tmake no more!
- ret = "QMAKE" + ret.mid(5);
- else if(ret == "INTERFACES")
+ if(ret == "INTERFACES")
ret = "FORMS";
else if(ret == "QMAKE_POST_BUILD")
ret = "QMAKE_POST_LINK";
@@ -619,10 +617,6 @@ QStringList qmake_feature_paths(QMakeProperty *prop=0)
concat << base_concat + QDir::separator() + "win32";
break;
}
- case Option::TARG_MAC9_MODE:
- concat << base_concat + QDir::separator() + "mac";
- concat << base_concat + QDir::separator() + "mac9";
- break;
}
concat << base_concat;
}
@@ -1463,9 +1457,6 @@ QMakeProject::read(uchar cmd)
while(qmakespec.endsWith(QString(QChar(QDir::separator()))))
qmakespec.truncate(qmakespec.length()-1);
QString spec = qmakespec + QDir::separator() + "qmake.conf";
- if(!QFile::exists(spec) &&
- QFile::exists(qmakespec + QDir::separator() + "tmake.conf"))
- spec = qmakespec + QDir::separator() + "tmake.conf";
debug_msg(1, "QMAKESPEC conf: reading %s", spec.toLatin1().constData());
if(!read(spec, base_vars)) {
fprintf(stderr, "Failure to read QMAKESPEC conf file %s.\n", spec.toLatin1().constData());
@@ -1624,12 +1615,7 @@ QMakeProject::isActiveConfig(const QString &x, bool regex, QMap<QString, QString
if((Option::target_mode == Option::TARG_MACX_MODE ||
Option::target_mode == Option::TARG_UNIX_MODE) && x == "unix")
return !isForSymbian();
- else if(Option::target_mode == Option::TARG_MACX_MODE && x == "macx")
- return !isForSymbian();
- else if(Option::target_mode == Option::TARG_MAC9_MODE && x == "mac9")
- return !isForSymbian();
- else if((Option::target_mode == Option::TARG_MAC9_MODE || Option::target_mode == Option::TARG_MACX_MODE) &&
- x == "mac")
+ else if(Option::target_mode == Option::TARG_MACX_MODE && (x == "macx" || x == "mac"))
return !isForSymbian();
else if(Option::target_mode == Option::TARG_WIN_MODE && x == "win32")
return !isForSymbian();
@@ -3087,8 +3073,6 @@ QStringList &QMakeProject::values(const QString &_var, QMap<QString, QStringList
QString orig_template = place["TEMPLATE"].first(), real_template;
if(!Option::user_template_prefix.isEmpty() && !orig_template.startsWith(Option::user_template_prefix))
real_template = Option::user_template_prefix + orig_template;
- if(real_template.endsWith(".t"))
- real_template = real_template.left(real_template.length()-2);
if(!real_template.isEmpty()) {
var = ".BUILTIN." + var;
place[var] = QStringList(real_template);
diff --git a/qmake/property.cpp b/qmake/property.cpp
index 34368cd..cab034f 100644
--- a/qmake/property.cpp
+++ b/qmake/property.cpp
@@ -104,7 +104,7 @@ QMakeProperty::value(QString v, bool just_check)
else if(v == "QT_INSTALL_DEMOS")
return QLibraryInfo::location(QLibraryInfo::DemosPath);
else if(v == "QMAKE_MKSPECS")
- return qmake_mkspec_paths().join(Option::target_mode == Option::TARG_WIN_MODE ? ";" : ":");
+ return qmake_mkspec_paths().join(Option::dirlist_sep);
else if(v == "QMAKE_VERSION")
return qmake_version();
#ifdef QT_VERSION_STR
diff --git a/qmake/qmake.pri b/qmake/qmake.pri
index efe4f36..17d9518 100644
--- a/qmake/qmake.pri
+++ b/qmake/qmake.pri
@@ -12,7 +12,7 @@ SOURCES += project.cpp property.cpp main.cpp generators/makefile.cpp \
generators/makefiledeps.cpp generators/metamakefile.cpp generators/mac/pbuilder_pbx.cpp \
generators/xmloutput.cpp generators/win32/borland_bmake.cpp \
generators/win32/msvc_nmake.cpp generators/projectgenerator.cpp \
- generators/win32/msvc_dsp.cpp generators/win32/msvc_vcproj.cpp \
+ generators/win32/msvc_vcproj.cpp \
generators/win32/msvc_objectmodel.cpp \
generators/symbian/symmake.cpp \
generators/symbian/symmake_abld.cpp \
@@ -24,7 +24,7 @@ HEADERS += project.h property.h generators/makefile.h \
generators/win32/winmakefile.h generators/projectgenerator.h \
generators/makefiledeps.h generators/metamakefile.h generators/mac/pbuilder_pbx.h \
generators/xmloutput.h generators/win32/borland_bmake.h generators/win32/msvc_nmake.h \
- generators/win32/msvc_dsp.h generators/win32/msvc_vcproj.h \
+ generators/win32/msvc_vcproj.h \
generators/win32/mingw_make.h generators/win32/msvc_objectmodel.h \
generators/symbian/symmake.h \
generators/symbian/symmake_abld.h \
diff --git a/src/corelib/tools/qstring.h b/src/corelib/tools/qstring.h
index 5e3b0fd..702a21a 100644
--- a/src/corelib/tools/qstring.h
+++ b/src/corelib/tools/qstring.h
@@ -595,7 +595,7 @@ private:
struct Data {
QBasicAtomicInt ref;
int alloc, size;
- ushort *data;
+ ushort *data; // QT5: put that after the bit field to fill alignment gap; don't use sizeof any more then
ushort clean : 1;
ushort simpletext : 1;
ushort righttoleft : 1;
diff --git a/src/declarative/graphicsitems/qmlgraphicsanchors.cpp b/src/declarative/graphicsitems/qmlgraphicsanchors.cpp
index 93055fc..945e7d3 100644
--- a/src/declarative/graphicsitems/qmlgraphicsanchors.cpp
+++ b/src/declarative/graphicsitems/qmlgraphicsanchors.cpp
@@ -366,7 +366,7 @@ void QmlGraphicsAnchors::setFill(QmlGraphicsItem *f)
return;
}
if (f != d->item->parentItem() && f->parentItem() != d->item->parentItem()){
- qmlInfo(d->item) << tr("Can't anchor to an item that isn't a parent or sibling.");
+ qmlInfo(d->item) << tr("Cannot anchor to an item that isn't a parent or sibling.");
return;
}
d->remDepend(d->fill);
@@ -400,7 +400,7 @@ void QmlGraphicsAnchors::setCenterIn(QmlGraphicsItem* c)
return;
}
if (c != d->item->parentItem() && c->parentItem() != d->item->parentItem()){
- qmlInfo(d->item) << tr("Can't anchor to an item that isn't a parent or sibling.");
+ qmlInfo(d->item) << tr("Cannot anchor to an item that isn't a parent or sibling.");
return;
}
@@ -991,7 +991,7 @@ bool QmlGraphicsAnchorsPrivate::checkHValid() const
if (usedAnchors & QmlGraphicsAnchors::HasLeftAnchor &&
usedAnchors & QmlGraphicsAnchors::HasRightAnchor &&
usedAnchors & QmlGraphicsAnchors::HasHCenterAnchor) {
- qmlInfo(item) << QmlGraphicsAnchors::tr("Can't specify left, right, and hcenter anchors.");
+ qmlInfo(item) << QmlGraphicsAnchors::tr("Cannot specify left, right, and hcenter anchors.");
return false;
}
@@ -1001,16 +1001,16 @@ bool QmlGraphicsAnchorsPrivate::checkHValid() const
bool QmlGraphicsAnchorsPrivate::checkHAnchorValid(QmlGraphicsAnchorLine anchor) const
{
if (!anchor.item) {
- qmlInfo(item) << QmlGraphicsAnchors::tr("Can't anchor to a null item.");
+ qmlInfo(item) << QmlGraphicsAnchors::tr("Cannot anchor to a null item.");
return false;
} else if (anchor.anchorLine & QmlGraphicsAnchorLine::Vertical_Mask) {
- qmlInfo(item) << QmlGraphicsAnchors::tr("Can't anchor a horizontal edge to a vertical edge.");
+ qmlInfo(item) << QmlGraphicsAnchors::tr("Cannot anchor a horizontal edge to a vertical edge.");
return false;
} else if (anchor.item != item->parentItem() && anchor.item->parentItem() != item->parentItem()){
- qmlInfo(item) << QmlGraphicsAnchors::tr("Can't anchor to an item that isn't a parent or sibling.");
+ qmlInfo(item) << QmlGraphicsAnchors::tr("Cannot anchor to an item that isn't a parent or sibling.");
return false;
} else if (anchor.item == item) {
- qmlInfo(item) << QmlGraphicsAnchors::tr("Can't anchor item to self.");
+ qmlInfo(item) << QmlGraphicsAnchors::tr("Cannot anchor item to self.");
return false;
}
@@ -1022,13 +1022,13 @@ bool QmlGraphicsAnchorsPrivate::checkVValid() const
if (usedAnchors & QmlGraphicsAnchors::HasTopAnchor &&
usedAnchors & QmlGraphicsAnchors::HasBottomAnchor &&
usedAnchors & QmlGraphicsAnchors::HasVCenterAnchor) {
- qmlInfo(item) << QmlGraphicsAnchors::tr("Can't specify top, bottom, and vcenter anchors.");
+ qmlInfo(item) << QmlGraphicsAnchors::tr("Cannot specify top, bottom, and vcenter anchors.");
return false;
} else if (usedAnchors & QmlGraphicsAnchors::HasBaselineAnchor &&
(usedAnchors & QmlGraphicsAnchors::HasTopAnchor ||
usedAnchors & QmlGraphicsAnchors::HasBottomAnchor ||
usedAnchors & QmlGraphicsAnchors::HasVCenterAnchor)) {
- qmlInfo(item) << QmlGraphicsAnchors::tr("Baseline anchor can't be used in conjunction with top, bottom, or vcenter anchors.");
+ qmlInfo(item) << QmlGraphicsAnchors::tr("Baseline anchor cannot be used in conjunction with top, bottom, or vcenter anchors.");
return false;
}
@@ -1038,16 +1038,16 @@ bool QmlGraphicsAnchorsPrivate::checkVValid() const
bool QmlGraphicsAnchorsPrivate::checkVAnchorValid(QmlGraphicsAnchorLine anchor) const
{
if (!anchor.item) {
- qmlInfo(item) << QmlGraphicsAnchors::tr("Can't anchor to a null item.");
+ qmlInfo(item) << QmlGraphicsAnchors::tr("Cannot anchor to a null item.");
return false;
} else if (anchor.anchorLine & QmlGraphicsAnchorLine::Horizontal_Mask) {
- qmlInfo(item) << QmlGraphicsAnchors::tr("Can't anchor a vertical edge to a horizontal edge.");
+ qmlInfo(item) << QmlGraphicsAnchors::tr("Cannot anchor a vertical edge to a horizontal edge.");
return false;
} else if (anchor.item != item->parentItem() && anchor.item->parentItem() != item->parentItem()){
- qmlInfo(item) << QmlGraphicsAnchors::tr("Can't anchor to an item that isn't a parent or sibling.");
+ qmlInfo(item) << QmlGraphicsAnchors::tr("Cannot anchor to an item that isn't a parent or sibling.");
return false;
} else if (anchor.item == item){
- qmlInfo(item) << QmlGraphicsAnchors::tr("Can't anchor item to self.");
+ qmlInfo(item) << QmlGraphicsAnchors::tr("Cannot anchor item to self.");
return false;
}
diff --git a/src/declarative/graphicsitems/qmlgraphicspathview.cpp b/src/declarative/graphicsitems/qmlgraphicspathview.cpp
index 85e87eb..6718d25 100644
--- a/src/declarative/graphicsitems/qmlgraphicspathview.cpp
+++ b/src/declarative/graphicsitems/qmlgraphicspathview.cpp
@@ -910,11 +910,16 @@ void QmlGraphicsPathViewPrivate::snapToCurrent()
//Rounds is the number of times round to make the current item visible
int rounds = itemIndex / items.count();
- int otherWayRounds = (model->count() - (itemIndex)) / items.count() + 1;
+ int otherWayRounds = (model->count() - (itemIndex)) / items.count();
if (otherWayRounds < rounds)
rounds = -otherWayRounds;
itemIndex += pathOffset;
+ if(model->count() % items.count() && itemIndex - model->count() + items.count() > 0){
+ //When model.count() is not a multiple of pathItemCount we need to manually
+ //fix the index so that going backwards one step works correctly.
+ itemIndex = itemIndex - model->count() + items.count();
+ }
itemIndex %= items.count();
qreal targetOffset = qmlMod(100 + (snapPos*100) - 100.0 * itemIndex / items.count(), qreal(100.0));
@@ -928,7 +933,7 @@ void QmlGraphicsPathViewPrivate::snapToCurrent()
moveOffset.setValue(_offset);
if (rounds!=0){
- //Compensate if the targetOffset would bring the target it from off the screen
+ //Compensate if the targetOffset would bring the target in from off the screen
qreal distance = targetOffset - _offset;
if (distance <= -50)
rounds--;
diff --git a/src/declarative/qml/qmlcompiler.cpp b/src/declarative/qml/qmlcompiler.cpp
index 10150de..9990c06 100644
--- a/src/declarative/qml/qmlcompiler.cpp
+++ b/src/declarative/qml/qmlcompiler.cpp
@@ -730,7 +730,7 @@ bool QmlCompiler::buildObject(Object *obj, const BindingContext &ctxt)
compileState.parserStatusCount++;
// Check if this is a custom parser type. Custom parser types allow
- // assignments to non-existant properties. These assignments are then
+ // assignments to non-existent properties. These assignments are then
// compiled by the type.
bool isCustomParser = output->types.at(obj->type).type &&
output->types.at(obj->type).type->customParser() != 0;
@@ -1429,7 +1429,7 @@ bool QmlCompiler::buildProperty(QmlParser::Property *prop,
ctxt));
return true;
} else if (!type || !type->attachedPropertiesType()) {
- COMPILE_EXCEPTION(prop, QCoreApplication::translate("QmlCompiler","Non-existant attached object"));
+ COMPILE_EXCEPTION(prop, QCoreApplication::translate("QmlCompiler","Non-existent attached object"));
}
if (!prop->value)
@@ -1486,9 +1486,9 @@ bool QmlCompiler::buildProperty(QmlParser::Property *prop,
} else if (prop->index == -1) {
if (prop->isDefault) {
- COMPILE_EXCEPTION(prop->values.first(), QCoreApplication::translate("QmlCompiler","Cannot assign to non-existant default property"));
+ COMPILE_EXCEPTION(prop->values.first(), QCoreApplication::translate("QmlCompiler","Cannot assign to non-existent default property"));
} else {
- COMPILE_EXCEPTION(prop, QCoreApplication::translate("QmlCompiler","Cannot assign to non-existant property \"%1\"").arg(QString::fromUtf8(prop->name)));
+ COMPILE_EXCEPTION(prop, QCoreApplication::translate("QmlCompiler","Cannot assign to non-existent property \"%1\"").arg(QString::fromUtf8(prop->name)));
}
} else if (prop->value) {
@@ -1534,7 +1534,7 @@ QmlCompiler::buildPropertyInNamespace(QmlEnginePrivate::ImportedNamespace *ns,
&type, 0, 0, 0);
if (!type || !type->attachedPropertiesType())
- COMPILE_EXCEPTION(prop, QCoreApplication::translate("QmlCompiler","Non-existant attached object"));
+ COMPILE_EXCEPTION(prop, QCoreApplication::translate("QmlCompiler","Non-existent attached object"));
if (!prop->value)
COMPILE_EXCEPTION(prop, QCoreApplication::translate("QmlCompiler","Invalid attached object assignment"));
@@ -1841,7 +1841,7 @@ bool QmlCompiler::buildValueTypeProperty(QObject *type,
foreach (Property *prop, obj->properties) {
int idx = type->metaObject()->indexOfProperty(prop->name.constData());
if (idx == -1)
- COMPILE_EXCEPTION(prop, QCoreApplication::translate("QmlCompiler","Cannot assign to non-existant property \"%1\"").arg(QString::fromUtf8(prop->name)));
+ COMPILE_EXCEPTION(prop, QCoreApplication::translate("QmlCompiler","Cannot assign to non-existent property \"%1\"").arg(QString::fromUtf8(prop->name)));
QMetaProperty p = type->metaObject()->property(idx);
prop->index = idx;
prop->type = p.userType();
diff --git a/src/declarative/qml/qmlobjectscriptclass.cpp b/src/declarative/qml/qmlobjectscriptclass.cpp
index 1c41d46..c373a8e 100644
--- a/src/declarative/qml/qmlobjectscriptclass.cpp
+++ b/src/declarative/qml/qmlobjectscriptclass.cpp
@@ -313,7 +313,7 @@ void QmlObjectScriptClass::setProperty(QObject *obj,
Q_ASSERT(lastData);
if (!lastData->isValid()) {
- QString error = QLatin1String("Cannot assign to non-existant property \"") +
+ QString error = QLatin1String("Cannot assign to non-existent property \"") +
toString(name) + QLatin1Char('\"');
if (context())
context()->throwError(error);
@@ -628,11 +628,11 @@ QmlObjectMethodScriptClass::Value QmlObjectMethodScriptClass::call(Object *o, QS
for (int ii = 0; ii < argTypeNames.count(); ++ii) {
argTypes[ii] = QMetaType::type(argTypeNames.at(ii));
if (argTypes[ii] == QVariant::Invalid)
- return Value(ctxt, ctxt->throwError(QString(QLatin1String("Unknown method parameter type: %1")).arg(QLatin1String(argTypeNames.at(ii)))));
+ return Value(ctxt, ctxt->throwError(QString::fromLatin1("Unknown method parameter type: %1").arg(QLatin1String(argTypeNames.at(ii)))));
}
if (argTypes.count() > ctxt->argumentCount())
- return Value(ctxt, ctxt->throwError("Insufficient arguments"));
+ return Value(ctxt, ctxt->throwError(QLatin1String("Insufficient arguments")));
QVarLengthArray<MetaCallArgument, 9> args(argTypes.count() + 1);
args[0].initAsType(method->data.propType, engine);
diff --git a/src/declarative/util/qmlanimation.cpp b/src/declarative/util/qmlanimation.cpp
index abffefe..6609c73 100644
--- a/src/declarative/util/qmlanimation.cpp
+++ b/src/declarative/util/qmlanimation.cpp
@@ -77,7 +77,7 @@ static QEasingCurve stringToCurve(const QString &curve, QObject *obj)
if (hasParams) {
QString easeName = curve.trimmed();
if (!easeName.endsWith(QLatin1Char(')'))) {
- qmlInfo(obj) << obj->tr("Unmatched parenthesis in easing function \"%1\"").arg(curve);
+ qmlInfo(obj) << QmlPropertyAnimation::tr("Unmatched parenthesis in easing function \"%1\"").arg(curve);
return easingCurve;
}
@@ -86,7 +86,7 @@ static QEasingCurve stringToCurve(const QString &curve, QObject *obj)
easeName.mid(idx + 1, easeName.length() - 1 - idx - 1);
normalizedCurve = easeName.left(idx);
if (!normalizedCurve.startsWith(QLatin1String("ease"))) {
- qmlInfo(obj) << obj->tr("Easing function \"%1\" must start with \"ease\"").arg(curve);
+ qmlInfo(obj) << QmlPropertyAnimation::tr("Easing function \"%1\" must start with \"ease\"").arg(curve);
return easingCurve;
}
@@ -101,7 +101,7 @@ static QEasingCurve stringToCurve(const QString &curve, QObject *obj)
int value = me.keyToValue(normalizedCurve.toUtf8().constData());
if (value < 0) {
- qmlInfo(obj) << obj->tr("Unknown easing curve \"%1\"").arg(curve);
+ qmlInfo(obj) << QmlPropertyAnimation::tr("Unknown easing curve \"%1\"").arg(curve);
return easingCurve;
}
easingCurve.setType((QEasingCurve::Type)value);
@@ -111,7 +111,7 @@ static QEasingCurve stringToCurve(const QString &curve, QObject *obj)
int sep = str.indexOf(QLatin1Char(':'));
if (sep == -1) {
- qmlInfo(obj) << obj->tr("Improperly specified parameter in easing function \"%1\"").arg(curve);
+ qmlInfo(obj) << QmlPropertyAnimation::tr("Improperly specified parameter in easing function \"%1\"").arg(curve);
continue;
}
@@ -120,7 +120,7 @@ static QEasingCurve stringToCurve(const QString &curve, QObject *obj)
qreal propValue = str.mid(sep + 1).trimmed().toDouble(&isOk);
if (propName.isEmpty() || !isOk) {
- qmlInfo(obj) << obj->tr("Improperly specified parameter in easing function \"%1\"").arg(curve);
+ qmlInfo(obj) << QmlPropertyAnimation::tr("Improperly specified parameter in easing function \"%1\"").arg(curve);
continue;
}
@@ -131,7 +131,7 @@ static QEasingCurve stringToCurve(const QString &curve, QObject *obj)
} else if (propName == QLatin1String("overshoot")) {
easingCurve.setOvershoot(propValue);
} else {
- qmlInfo(obj) << obj->tr("Unknown easing parameter \"%1\"").arg(propName);
+ qmlInfo(obj) << QmlPropertyAnimation::tr("Unknown easing parameter \"%1\"").arg(propName);
continue;
}
}
@@ -226,7 +226,7 @@ QmlMetaProperty QmlAbstractAnimationPrivate::createProperty(QObject *obj, const
{
QmlMetaProperty prop = QmlMetaProperty::createProperty(obj, str, qmlContext(infoObj));
if (!prop.isValid()) {
- qmlInfo(infoObj) << QmlAbstractAnimation::tr("Cannot animate non-existant property \"%1\"").arg(str);
+ qmlInfo(infoObj) << QmlAbstractAnimation::tr("Cannot animate non-existent property \"%1\"").arg(str);
return QmlMetaProperty();
} else if (!prop.isWritable()) {
qmlInfo(infoObj) << QmlAbstractAnimation::tr("Cannot animate read-only property \"%1\"").arg(str);
diff --git a/src/declarative/util/qmlbehavior.cpp b/src/declarative/util/qmlbehavior.cpp
index b9c77f5..e8feeaa 100644
--- a/src/declarative/util/qmlbehavior.cpp
+++ b/src/declarative/util/qmlbehavior.cpp
@@ -119,7 +119,7 @@ void QmlBehavior::setAnimation(QmlAbstractAnimation *animation)
{
Q_D(QmlBehavior);
if (d->animation) {
- qmlInfo(this) << tr("Can't change the animation assigned to a Behavior.");
+ qmlInfo(this) << tr("Cannot change the animation assigned to a Behavior.");
return;
}
diff --git a/src/declarative/util/qmlpropertychanges.cpp b/src/declarative/util/qmlpropertychanges.cpp
index 68fc5cc..f1f39da 100644
--- a/src/declarative/util/qmlpropertychanges.cpp
+++ b/src/declarative/util/qmlpropertychanges.cpp
@@ -357,7 +357,7 @@ QmlPropertyChangesPrivate::property(const QByteArray &property)
Q_Q(QmlPropertyChanges);
QmlMetaProperty prop = QmlMetaProperty::createProperty(object, QString::fromUtf8(property));
if (!prop.isValid()) {
- qmlInfo(q) << QmlPropertyChanges::tr("Cannot assign to non-existant property \"%1\"").arg(QString::fromUtf8(property));
+ qmlInfo(q) << QmlPropertyChanges::tr("Cannot assign to non-existent property \"%1\"").arg(QString::fromUtf8(property));
return QmlMetaProperty();
} else if (!(prop.type() & QmlMetaProperty::SignalProperty) && !prop.isWritable()) {
qmlInfo(q) << QmlPropertyChanges::tr("Cannot assign to read-only property \"%1\"").arg(QString::fromUtf8(property));
diff --git a/src/declarative/util/qmlstateoperations.cpp b/src/declarative/util/qmlstateoperations.cpp
index 35c8f7d..cefe2bc 100644
--- a/src/declarative/util/qmlstateoperations.cpp
+++ b/src/declarative/util/qmlstateoperations.cpp
@@ -82,7 +82,7 @@ void QmlParentChangePrivate::doChange(QmlGraphicsItem *targetParent, QmlGraphics
bool ok;
const QTransform &transform = target->itemTransform(targetParent, &ok);
if (transform.type() >= QTransform::TxShear || !ok) {
- qmlInfo(q) << QObject::tr("Unable to preserve appearance under complex transform");
+ qmlInfo(q) << QmlParentChange::tr("Unable to preserve appearance under complex transform");
ok = false;
}
@@ -92,21 +92,21 @@ void QmlParentChangePrivate::doChange(QmlGraphicsItem *targetParent, QmlGraphics
if (transform.m11() == transform.m22())
scale = transform.m11();
else {
- qmlInfo(q) << QObject::tr("Unable to preserve appearance under non-uniform scale");
+ qmlInfo(q) << QmlParentChange::tr("Unable to preserve appearance under non-uniform scale");
ok = false;
}
} else if (ok && transform.type() == QTransform::TxRotate) {
if (transform.m11() == transform.m22())
scale = qSqrt(transform.m11()*transform.m11() + transform.m12()*transform.m12());
else {
- qmlInfo(q) << QObject::tr("Unable to preserve appearance under non-uniform scale");
+ qmlInfo(q) << QmlParentChange::tr("Unable to preserve appearance under non-uniform scale");
ok = false;
}
if (scale != 0)
rotation = atan2(transform.m12()/scale, transform.m11()/scale) * 180/M_PI;
else {
- qmlInfo(q) << QObject::tr("Unable to preserve appearance under scale of 0");
+ qmlInfo(q) << QmlParentChange::tr("Unable to preserve appearance under scale of 0");
ok = false;
}
}
diff --git a/src/declarative/util/qmlxmllistmodel.cpp b/src/declarative/util/qmlxmllistmodel.cpp
index d31fadf..d586792 100644
--- a/src/declarative/util/qmlxmllistmodel.cpp
+++ b/src/declarative/util/qmlxmllistmodel.cpp
@@ -391,7 +391,7 @@ void QmlXmlRoleList::insert(int i, QmlXmlListModelRole *role)
{
QmlConcreteList<QmlXmlListModelRole *>::insert(i, role);
if (model->roleNames.contains(role->name())) {
- qmlInfo(role) << QObject::tr("\"%1\" duplicates a previous role name and will be disabled.").arg(role->name());
+ qmlInfo(role) << QCoreApplication::translate("QmlXmlRoleList", "\"%1\" duplicates a previous role name and will be disabled.").arg(role->name());
return;
}
model->roles.insert(i, model->highestRole);
@@ -551,7 +551,7 @@ void QmlXmlListModel::setQuery(const QString &query)
{
Q_D(QmlXmlListModel);
if (!query.startsWith(QLatin1Char('/'))) {
- qmlInfo(this) << tr("An XmlListModel query must start with '/' or \"//\"");
+ qmlInfo(this) << QCoreApplication::translate("QmlXmlRoleList", "An XmlListModel query must start with '/' or \"//\"");
return;
}
diff --git a/src/gui/widgets/qplaintextedit.cpp b/src/gui/widgets/qplaintextedit.cpp
index 02ffe13..0d798b7 100644
--- a/src/gui/widgets/qplaintextedit.cpp
+++ b/src/gui/widgets/qplaintextedit.cpp
@@ -2394,7 +2394,7 @@ void QPlainTextEdit::setReadOnly(bool ro)
then the focus policy is also automatically set to Qt::ClickFocus.
The default value depends on whether the QPlainTextEdit is read-only
- or editable, and whether it is a QTextBrowser or not.
+ or editable.
*/
void QPlainTextEdit::setTextInteractionFlags(Qt::TextInteractionFlags flags)
diff --git a/tests/auto/declarative/qmlanimations/tst_qmlanimations.cpp b/tests/auto/declarative/qmlanimations/tst_qmlanimations.cpp
index 17a1453..a00e911 100644
--- a/tests/auto/declarative/qmlanimations/tst_qmlanimations.cpp
+++ b/tests/auto/declarative/qmlanimations/tst_qmlanimations.cpp
@@ -308,7 +308,7 @@ void tst_animations::badProperties()
QmlEngine engine;
QmlComponent c1(&engine, QUrl::fromLocalFile(SRCDIR "/data/badproperty1.qml"));
- QByteArray message = "QML ColorAnimation (" + QUrl::fromLocalFile(SRCDIR "/data/badproperty1.qml").toString().toUtf8() + ":18:9) Cannot animate non-existant property \"border.colr\"";
+ QByteArray message = "QML ColorAnimation (" + QUrl::fromLocalFile(SRCDIR "/data/badproperty1.qml").toString().toUtf8() + ":18:9) Cannot animate non-existent property \"border.colr\"";
QTest::ignoreMessage(QtWarningMsg, message);
QTest::ignoreMessage(QtWarningMsg, message); // why twice?
QmlGraphicsRectangle *rect = qobject_cast<QmlGraphicsRectangle*>(c1.create());
@@ -546,8 +546,8 @@ void tst_animations::easingStringConversion()
QCOMPARE(static_cast<QVariantAnimation*>(((QmlAbstractAnimation*)animation)->qtAnimation())->easingCurve().type(), QEasingCurve::InOutElastic);
QVERIFY(static_cast<QVariantAnimation*>(((QmlAbstractAnimation*)animation)->qtAnimation())->easingCurve().amplitude() != qreal(5));
- QTest::ignoreMessage(QtWarningMsg, "QML NumberAnimation (unknown location) Unknown easing parameter \"nonexistantproperty\"");
- animation->setEasing("easeOutQuad(nonexistantproperty: 12)");
+ QTest::ignoreMessage(QtWarningMsg, "QML NumberAnimation (unknown location) Unknown easing parameter \"nonexistentproperty\"");
+ animation->setEasing("easeOutQuad(nonexistentproperty: 12)");
QCOMPARE(static_cast<QVariantAnimation*>(((QmlAbstractAnimation*)animation)->qtAnimation())->easingCurve().type(), QEasingCurve::OutQuad);
delete animation;
diff --git a/tests/auto/declarative/qmlbehaviors/tst_qmlbehaviors.cpp b/tests/auto/declarative/qmlbehaviors/tst_qmlbehaviors.cpp
index 61023a2..73ab35e 100644
--- a/tests/auto/declarative/qmlbehaviors/tst_qmlbehaviors.cpp
+++ b/tests/auto/declarative/qmlbehaviors/tst_qmlbehaviors.cpp
@@ -254,7 +254,7 @@ void tst_behaviors::reassignedAnimation()
{
QmlEngine engine;
QmlComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/reassignedAnimation.qml"));
- QTest::ignoreMessage(QtWarningMsg, QString("QML Behavior (" + QUrl::fromLocalFile(SRCDIR "/data/reassignedAnimation.qml").toString() + ":9:12) Can't change the animation assigned to a Behavior.").toUtf8().constData());
+ QTest::ignoreMessage(QtWarningMsg, QString("QML Behavior (" + QUrl::fromLocalFile(SRCDIR "/data/reassignedAnimation.qml").toString() + ":9:12) Cannot change the animation assigned to a Behavior.").toUtf8().constData());
QmlGraphicsRectangle *rect = qobject_cast<QmlGraphicsRectangle*>(c.create());
QVERIFY(rect);
QCOMPARE(qobject_cast<QmlNumberAnimation*>(
diff --git a/tests/auto/declarative/qmldom/tst_qmldom.cpp b/tests/auto/declarative/qmldom/tst_qmldom.cpp
index ce35130..eb4d419 100644
--- a/tests/auto/declarative/qmldom/tst_qmldom.cpp
+++ b/tests/auto/declarative/qmldom/tst_qmldom.cpp
@@ -394,7 +394,7 @@ void tst_qmldom::loadErrors()
QCOMPARE(error.url(), QUrl());
QCOMPARE(error.line(), 3);
QCOMPARE(error.column(), 3);
- QCOMPARE(error.description(), QString("Cannot assign to non-existant property \"foo\""));
+ QCOMPARE(error.description(), QString("Cannot assign to non-existent property \"foo\""));
}
// Test loading a file with syntax errors
diff --git a/tests/auto/declarative/qmlecmascript/tst_qmlecmascript.cpp b/tests/auto/declarative/qmlecmascript/tst_qmlecmascript.cpp
index e5472bb..a6baf10 100644
--- a/tests/auto/declarative/qmlecmascript/tst_qmlecmascript.cpp
+++ b/tests/auto/declarative/qmlecmascript/tst_qmlecmascript.cpp
@@ -572,7 +572,7 @@ void tst_qmlecmascript::enums()
QCOMPARE(object->property("i").toInt(), 19);
QCOMPARE(object->property("j").toInt(), 19);
}
- // Non-existant enums
+ // Non-existent enums
{
QmlComponent component(&engine, TEST_FILE("enums.2.qml"));
@@ -680,7 +680,7 @@ void tst_qmlecmascript::outerBindingOverridesInnerBinding()
}
/*
-Access a non-existant attached object.
+Access a non-existent attached object.
Tests for a regression where this used to crash.
*/
@@ -928,7 +928,7 @@ void tst_qmlecmascript::scriptErrors()
QString warning5 = url + ":10: TypeError: Result of expression 'a' [undefined] is not an object.";
QString warning6 = url + ":9: Unable to assign [undefined] to int";
QString warning7 = url + ":14: Error: Cannot assign to read-only property \"trueProperty\"";
- QString warning8 = url + ":15: Error: Cannot assign to non-existant property \"fakeProperty\"";
+ QString warning8 = url + ":15: Error: Cannot assign to non-existent property \"fakeProperty\"";
QTest::ignoreMessage(QtWarningMsg, warning1.toLatin1().constData());
QTest::ignoreMessage(QtWarningMsg, warning2.toLatin1().constData());
@@ -1207,15 +1207,15 @@ void tst_qmlecmascript::callQtInvokables()
QScriptEngine *engine = &ep->scriptEngine;
ep->globalClass->explicitSetProperty("object", ep->objectClass->newQObject(&o));
- // Non-existant methods
+ // Non-existent methods
o.reset();
- QCOMPARE(engine->evaluate("object.method_nonexistant()").isError(), true);
+ QCOMPARE(engine->evaluate("object.method_nonexistent()").isError(), true);
QCOMPARE(o.error(), false);
QCOMPARE(o.invoked(), -1);
QCOMPARE(o.actuals().count(), 0);
o.reset();
- QCOMPARE(engine->evaluate("object.method_nonexistant(10, 11)").isError(), true);
+ QCOMPARE(engine->evaluate("object.method_nonexistent(10, 11)").isError(), true);
QCOMPARE(o.error(), false);
QCOMPARE(o.invoked(), -1);
QCOMPARE(o.actuals().count(), 0);
diff --git a/tests/auto/declarative/qmlgraphicsanchors/tst_qmlgraphicsanchors.cpp b/tests/auto/declarative/qmlgraphicsanchors/tst_qmlgraphicsanchors.cpp
index 5850cf0..70e70d0 100644
--- a/tests/auto/declarative/qmlgraphicsanchors/tst_qmlgraphicsanchors.cpp
+++ b/tests/auto/declarative/qmlgraphicsanchors/tst_qmlgraphicsanchors.cpp
@@ -223,55 +223,55 @@ void tst_anchors::illegalSets_data()
QTest::newRow("H - too many anchors")
<< "Rectangle { id: rect; Rectangle { anchors.left: rect.left; anchors.right: rect.right; anchors.horizontalCenter: rect.horizontalCenter } }"
- << "QML Rectangle (file::2:23) Can't specify left, right, and hcenter anchors.";
+ << "QML Rectangle (file::2:23) Cannot specify left, right, and hcenter anchors.";
foreach (const QString &side, QStringList() << "left" << "right") {
QTest::newRow("H - anchor to V")
<< QString("Rectangle { Rectangle { anchors.%1: parent.top } }").arg(side)
- << "QML Rectangle (file::2:13) Can't anchor a horizontal edge to a vertical edge.";
+ << "QML Rectangle (file::2:13) Cannot anchor a horizontal edge to a vertical edge.";
QTest::newRow("H - anchor to non parent/sibling")
<< QString("Rectangle { Item { Rectangle { id: rect } } Rectangle { anchors.%1: rect.%1 } }").arg(side)
- << "QML Rectangle (file::2:45) Can't anchor to an item that isn't a parent or sibling.";
+ << "QML Rectangle (file::2:45) Cannot anchor to an item that isn't a parent or sibling.";
QTest::newRow("H - anchor to self")
<< QString("Rectangle { id: rect; anchors.%1: rect.%1 }").arg(side)
- << "QML Rectangle (file::2:1) Can't anchor item to self.";
+ << "QML Rectangle (file::2:1) Cannot anchor item to self.";
}
QTest::newRow("V - too many anchors")
<< "Rectangle { id: rect; Rectangle { anchors.top: rect.top; anchors.bottom: rect.bottom; anchors.verticalCenter: rect.verticalCenter } }"
- << "QML Rectangle (file::2:23) Can't specify top, bottom, and vcenter anchors.";
+ << "QML Rectangle (file::2:23) Cannot specify top, bottom, and vcenter anchors.";
QTest::newRow("V - too many anchors with baseline")
<< "Rectangle { Text { id: text1; text: \"Hello\" } Text { anchors.baseline: text1.baseline; anchors.top: text1.top; } }"
- << "QML Text (file::2:47) Baseline anchor can't be used in conjunction with top, bottom, or vcenter anchors.";
+ << "QML Text (file::2:47) Baseline anchor cannot be used in conjunction with top, bottom, or vcenter anchors.";
foreach (const QString &side, QStringList() << "top" << "bottom" << "baseline") {
QTest::newRow("V - anchor to H")
<< QString("Rectangle { Rectangle { anchors.%1: parent.left } }").arg(side)
- << "QML Rectangle (file::2:13) Can't anchor a vertical edge to a horizontal edge.";
+ << "QML Rectangle (file::2:13) Cannot anchor a vertical edge to a horizontal edge.";
QTest::newRow("V - anchor to non parent/sibling")
<< QString("Rectangle { Item { Rectangle { id: rect } } Rectangle { anchors.%1: rect.%1 } }").arg(side)
- << "QML Rectangle (file::2:45) Can't anchor to an item that isn't a parent or sibling.";
+ << "QML Rectangle (file::2:45) Cannot anchor to an item that isn't a parent or sibling.";
QTest::newRow("V - anchor to self")
<< QString("Rectangle { id: rect; anchors.%1: rect.%1 }").arg(side)
- << "QML Rectangle (file::2:1) Can't anchor item to self.";
+ << "QML Rectangle (file::2:1) Cannot anchor item to self.";
}
QTest::newRow("centerIn - anchor to non parent/sibling")
<< "Rectangle { Item { Rectangle { id: rect } } Rectangle { anchors.centerIn: rect} }"
- << "QML Rectangle (file::2:45) Can't anchor to an item that isn't a parent or sibling.";
+ << "QML Rectangle (file::2:45) Cannot anchor to an item that isn't a parent or sibling.";
QTest::newRow("fill - anchor to non parent/sibling")
<< "Rectangle { Item { Rectangle { id: rect } } Rectangle { anchors.fill: rect} }"
- << "QML Rectangle (file::2:45) Can't anchor to an item that isn't a parent or sibling.";
+ << "QML Rectangle (file::2:45) Cannot anchor to an item that isn't a parent or sibling.";
}
void tst_anchors::reset()
@@ -348,7 +348,7 @@ void tst_anchors::nullItem()
const QMetaObject *meta = item->anchors()->metaObject();
QMetaProperty p = meta->property(meta->indexOfProperty(side.toUtf8().constData()));
- QTest::ignoreMessage(QtWarningMsg, "QML Item (unknown location) Can't anchor to a null item.");
+ QTest::ignoreMessage(QtWarningMsg, "QML Item (unknown location) Cannot anchor to a null item.");
QVERIFY(p.write(item->anchors(), qVariantFromValue(anchor)));
delete item;
diff --git a/tests/auto/declarative/qmlgraphicsloader/data/NoResizeGraphicsWidget.qml b/tests/auto/declarative/qmlgraphicsloader/data/NoResizeGraphicsWidget.qml
index 0704e18..5eab965 100644
--- a/tests/auto/declarative/qmlgraphicsloader/data/NoResizeGraphicsWidget.qml
+++ b/tests/auto/declarative/qmlgraphicsloader/data/NoResizeGraphicsWidget.qml
@@ -1,8 +1,8 @@
-import Qt 4.6
-
-Loader {
- resizeMode: Loader.NoResize
- source: "GraphicsWidget250x250.qml"
- width: 200
- height: 80
-}
+import Qt 4.6
+
+Loader {
+ resizeMode: Loader.NoResize
+ source: "GraphicsWidget250x250.qml"
+ width: 200
+ height: 80
+}
diff --git a/tests/auto/declarative/qmlgraphicsloader/data/SizeGraphicsWidgetToLoader.qml b/tests/auto/declarative/qmlgraphicsloader/data/SizeGraphicsWidgetToLoader.qml
index 97c72f4..568a136 100644
--- a/tests/auto/declarative/qmlgraphicsloader/data/SizeGraphicsWidgetToLoader.qml
+++ b/tests/auto/declarative/qmlgraphicsloader/data/SizeGraphicsWidgetToLoader.qml
@@ -1,8 +1,8 @@
-import Qt 4.6
-
-Loader {
- resizeMode: Loader.SizeItemToLoader
- width: 200
- height: 80
- source: "GraphicsWidget250x250.qml"
-}
+import Qt 4.6
+
+Loader {
+ resizeMode: Loader.SizeItemToLoader
+ width: 200
+ height: 80
+ source: "GraphicsWidget250x250.qml"
+}
diff --git a/tests/auto/declarative/qmlgraphicsloader/data/SizeLoaderToGraphicsWidget.qml b/tests/auto/declarative/qmlgraphicsloader/data/SizeLoaderToGraphicsWidget.qml
index cb72f05..a710803 100644
--- a/tests/auto/declarative/qmlgraphicsloader/data/SizeLoaderToGraphicsWidget.qml
+++ b/tests/auto/declarative/qmlgraphicsloader/data/SizeLoaderToGraphicsWidget.qml
@@ -1,6 +1,6 @@
-import Qt 4.6
-
-Loader {
- resizeMode: Loader.SizeLoaderToItem
- source: "GraphicsWidget250x250.qml"
-}
+import Qt 4.6
+
+Loader {
+ resizeMode: Loader.SizeLoaderToItem
+ source: "GraphicsWidget250x250.qml"
+}
diff --git a/tests/auto/declarative/qmllanguage/data/invalidAttachedProperty.1.errors.txt b/tests/auto/declarative/qmllanguage/data/invalidAttachedProperty.1.errors.txt
index 68fe671..492bbb4 100644
--- a/tests/auto/declarative/qmllanguage/data/invalidAttachedProperty.1.errors.txt
+++ b/tests/auto/declarative/qmllanguage/data/invalidAttachedProperty.1.errors.txt
@@ -1 +1 @@
-5:17:Cannot assign to non-existant property "foo"
+5:17:Cannot assign to non-existent property "foo"
diff --git a/tests/auto/declarative/qmllanguage/data/invalidAttachedProperty.10.errors.txt b/tests/auto/declarative/qmllanguage/data/invalidAttachedProperty.10.errors.txt
index 7f630f4..ff2409b 100644
--- a/tests/auto/declarative/qmllanguage/data/invalidAttachedProperty.10.errors.txt
+++ b/tests/auto/declarative/qmllanguage/data/invalidAttachedProperty.10.errors.txt
@@ -1 +1 @@
-5:15:Non-existant attached object
+5:15:Non-existent attached object
diff --git a/tests/auto/declarative/qmllanguage/data/invalidAttachedProperty.2.errors.txt b/tests/auto/declarative/qmllanguage/data/invalidAttachedProperty.2.errors.txt
index 9f06e07..34de769 100644
--- a/tests/auto/declarative/qmllanguage/data/invalidAttachedProperty.2.errors.txt
+++ b/tests/auto/declarative/qmllanguage/data/invalidAttachedProperty.2.errors.txt
@@ -1 +1 @@
-5:27:Cannot assign to non-existant property "foo"
+5:27:Cannot assign to non-existent property "foo"
diff --git a/tests/auto/declarative/qmllanguage/data/invalidAttachedProperty.6.errors.txt b/tests/auto/declarative/qmllanguage/data/invalidAttachedProperty.6.errors.txt
index e232b23..6770e1f 100644
--- a/tests/auto/declarative/qmllanguage/data/invalidAttachedProperty.6.errors.txt
+++ b/tests/auto/declarative/qmllanguage/data/invalidAttachedProperty.6.errors.txt
@@ -1 +1 @@
-5:5:Non-existant attached object
+5:5:Non-existent attached object
diff --git a/tests/auto/declarative/qmllanguage/data/invalidAttachedProperty.7.errors.txt b/tests/auto/declarative/qmllanguage/data/invalidAttachedProperty.7.errors.txt
index e232b23..6770e1f 100644
--- a/tests/auto/declarative/qmllanguage/data/invalidAttachedProperty.7.errors.txt
+++ b/tests/auto/declarative/qmllanguage/data/invalidAttachedProperty.7.errors.txt
@@ -1 +1 @@
-5:5:Non-existant attached object
+5:5:Non-existent attached object
diff --git a/tests/auto/declarative/qmllanguage/data/invalidAttachedProperty.8.errors.txt b/tests/auto/declarative/qmllanguage/data/invalidAttachedProperty.8.errors.txt
index 7f630f4..ff2409b 100644
--- a/tests/auto/declarative/qmllanguage/data/invalidAttachedProperty.8.errors.txt
+++ b/tests/auto/declarative/qmllanguage/data/invalidAttachedProperty.8.errors.txt
@@ -1 +1 @@
-5:15:Non-existant attached object
+5:15:Non-existent attached object
diff --git a/tests/auto/declarative/qmllanguage/data/invalidAttachedProperty.9.errors.txt b/tests/auto/declarative/qmllanguage/data/invalidAttachedProperty.9.errors.txt
index e232b23..6770e1f 100644
--- a/tests/auto/declarative/qmllanguage/data/invalidAttachedProperty.9.errors.txt
+++ b/tests/auto/declarative/qmllanguage/data/invalidAttachedProperty.9.errors.txt
@@ -1 +1 @@
-5:5:Non-existant attached object
+5:5:Non-existent attached object
diff --git a/tests/auto/declarative/qmllanguage/data/invalidGroupedProperty.4.errors.txt b/tests/auto/declarative/qmllanguage/data/invalidGroupedProperty.4.errors.txt
index 19934fa..69c6871 100644
--- a/tests/auto/declarative/qmllanguage/data/invalidGroupedProperty.4.errors.txt
+++ b/tests/auto/declarative/qmllanguage/data/invalidGroupedProperty.4.errors.txt
@@ -1 +1 @@
-4:5:Cannot assign to non-existant property "foo"
+4:5:Cannot assign to non-existent property "foo"
diff --git a/tests/auto/declarative/qmllanguage/data/missingSignal.errors.txt b/tests/auto/declarative/qmllanguage/data/missingSignal.errors.txt
index e243ae5..f562246 100644
--- a/tests/auto/declarative/qmllanguage/data/missingSignal.errors.txt
+++ b/tests/auto/declarative/qmllanguage/data/missingSignal.errors.txt
@@ -1 +1 @@
-4:5:Cannot assign to non-existant property "onClicked"
+4:5:Cannot assign to non-existent property "onClicked"
diff --git a/tests/auto/declarative/qmllanguage/data/missingValueTypeProperty.errors.txt b/tests/auto/declarative/qmllanguage/data/missingValueTypeProperty.errors.txt
index dfaa218..caf7e55 100644
--- a/tests/auto/declarative/qmllanguage/data/missingValueTypeProperty.errors.txt
+++ b/tests/auto/declarative/qmllanguage/data/missingValueTypeProperty.errors.txt
@@ -1 +1 @@
-4:18:Cannot assign to non-existant property "foo"
+4:18:Cannot assign to non-existent property "foo"
diff --git a/tests/auto/declarative/qmllanguage/data/nonexistantProperty.1.errors.txt b/tests/auto/declarative/qmllanguage/data/nonexistantProperty.1.errors.txt
index cfc6fc8..6bfce9a 100644
--- a/tests/auto/declarative/qmllanguage/data/nonexistantProperty.1.errors.txt
+++ b/tests/auto/declarative/qmllanguage/data/nonexistantProperty.1.errors.txt
@@ -1 +1 @@
-2:15:Cannot assign to non-existant property "something"
+2:15:Cannot assign to non-existent property "something"
diff --git a/tests/auto/declarative/qmllanguage/data/nonexistantProperty.2.errors.txt b/tests/auto/declarative/qmllanguage/data/nonexistantProperty.2.errors.txt
index 8b13585..4b30056 100644
--- a/tests/auto/declarative/qmllanguage/data/nonexistantProperty.2.errors.txt
+++ b/tests/auto/declarative/qmllanguage/data/nonexistantProperty.2.errors.txt
@@ -1 +1 @@
-3:5:Cannot assign to non-existant property "something"
+3:5:Cannot assign to non-existent property "something"
diff --git a/tests/auto/declarative/qmllanguage/data/nonexistantProperty.3.errors.txt b/tests/auto/declarative/qmllanguage/data/nonexistantProperty.3.errors.txt
index 8b13585..4b30056 100644
--- a/tests/auto/declarative/qmllanguage/data/nonexistantProperty.3.errors.txt
+++ b/tests/auto/declarative/qmllanguage/data/nonexistantProperty.3.errors.txt
@@ -1 +1 @@
-3:5:Cannot assign to non-existant property "something"
+3:5:Cannot assign to non-existent property "something"
diff --git a/tests/auto/declarative/qmllanguage/data/nonexistantProperty.4.errors.txt b/tests/auto/declarative/qmllanguage/data/nonexistantProperty.4.errors.txt
index 8b13585..4b30056 100644
--- a/tests/auto/declarative/qmllanguage/data/nonexistantProperty.4.errors.txt
+++ b/tests/auto/declarative/qmllanguage/data/nonexistantProperty.4.errors.txt
@@ -1 +1 @@
-3:5:Cannot assign to non-existant property "something"
+3:5:Cannot assign to non-existent property "something"
diff --git a/tests/auto/declarative/qmllanguage/data/nonexistantProperty.6.errors.txt b/tests/auto/declarative/qmllanguage/data/nonexistantProperty.6.errors.txt
index c02d7bd..89925b7 100644
--- a/tests/auto/declarative/qmllanguage/data/nonexistantProperty.6.errors.txt
+++ b/tests/auto/declarative/qmllanguage/data/nonexistantProperty.6.errors.txt
@@ -1 +1 @@
-3:5:Cannot assign to non-existant default property
+3:5:Cannot assign to non-existent default property
diff --git a/tests/auto/declarative/qmlstates/tst_qmlstates.cpp b/tests/auto/declarative/qmlstates/tst_qmlstates.cpp
index fc348a5..4e4f3fb 100644
--- a/tests/auto/declarative/qmlstates/tst_qmlstates.cpp
+++ b/tests/auto/declarative/qmlstates/tst_qmlstates.cpp
@@ -731,7 +731,7 @@ void tst_states::propertyErrors()
QCOMPARE(rect->color(),QColor("red"));
- QTest::ignoreMessage(QtWarningMsg, QByteArray("QML PropertyChanges (" + fullDataPath("/data/propertyErrors.qml") + ":8:9) Cannot assign to non-existant property \"colr\"").constData());
+ QTest::ignoreMessage(QtWarningMsg, QByteArray("QML PropertyChanges (" + fullDataPath("/data/propertyErrors.qml") + ":8:9) Cannot assign to non-existent property \"colr\"").constData());
QTest::ignoreMessage(QtWarningMsg, QByteArray("QML PropertyChanges (" + fullDataPath("/data/propertyErrors.qml") + ":8:9) Cannot assign to read-only property \"wantsFocus\"").constData());
rect->setState("blue");
}
@@ -877,7 +877,7 @@ void tst_states::nonExistantProperty()
QmlGraphicsRectangle *rect = qobject_cast<QmlGraphicsRectangle*>(rectComponent.create());
QVERIFY(rect != 0);
- QTest::ignoreMessage(QtWarningMsg, QByteArray("QML PropertyChanges (" + fullDataPath("/data/nonExistantProp.qml") + ":9:9) Cannot assign to non-existant property \"colr\"").constData());
+ QTest::ignoreMessage(QtWarningMsg, QByteArray("QML PropertyChanges (" + fullDataPath("/data/nonExistantProp.qml") + ":9:9) Cannot assign to non-existent property \"colr\"").constData());
rect->setState("blue");
QCOMPARE(rect->state(), QLatin1String("blue"));
}
diff --git a/tests/auto/headers/tst_headers.cpp b/tests/auto/headers/tst_headers.cpp
index 5f79923..bf7ec3f 100644
--- a/tests/auto/headers/tst_headers.cpp
+++ b/tests/auto/headers/tst_headers.cpp
@@ -192,19 +192,20 @@ void tst_Headers::licenseCheck()
QByteArray data = f.readAll();
data.replace("\r\n", "\n"); // Windows
data.replace('\r', '\n'); // Mac OS9
- QStringList content = QString::fromLocal8Bit(data).split("\n");
+ QStringList content = QString::fromLocal8Bit(data).split("\n", QString::SkipEmptyParts);
+
+ if (content.count() <= 2) // likely a #include line and empty line only. Not a copyright issue.
+ return;
if (content.first().contains("generated")) {
content.takeFirst();
- if (content.first().isEmpty())
- content.takeFirst();
}
if (sourceFile.endsWith("/tests/auto/linguist/lupdate/testdata/good/merge_ordering/foo.cpp")
|| sourceFile.endsWith("/tests/auto/linguist/lupdate/testdata/good/mergecpp/finddialog.cpp"))
{
// These files are meant to start with empty lines.
- while (content.first().isEmpty() || content.first().startsWith("//"))
+ while (content.first().startsWith("//"))
content.takeFirst();
}
diff --git a/tools/assistant/tools/assistant/aboutdialog.cpp b/tools/assistant/tools/assistant/aboutdialog.cpp
index 26d488d..a9bc352 100644
--- a/tools/assistant/tools/assistant/aboutdialog.cpp
+++ b/tools/assistant/tools/assistant/aboutdialog.cpp
@@ -70,7 +70,7 @@ void AboutLabel::setText(const QString &text, const QByteArray &resources)
TRACE_OBJ
QDataStream in(resources);
in >> m_resourceMap;
-
+
QTextBrowser::setText(text);
}
@@ -96,34 +96,34 @@ QVariant AboutLabel::loadResource(int type, const QUrl &name)
void AboutLabel::setSource(const QUrl &url)
{
TRACE_OBJ
- if (url.isValid() && (!HelpViewer::isLocalUrl(url)
- || !HelpViewer::canOpenPage(url.path()))) {
+ if (url.isValid() && (!AbstractHelpViewer::isLocalUrl(url)
+ || !AbstractHelpViewer::canOpenPage(url.path()))) {
if (!QDesktopServices::openUrl(url)) {
QMessageBox::warning(this, tr("Warning"),
- tr("Unable to launch external application.\n"),
- tr("OK"));
+ tr("Unable to launch external application.\n"), tr("OK"));
}
}
}
AboutDialog::AboutDialog(QWidget *parent)
- : QDialog(parent, Qt::MSWindowsFixedSizeDialogHint|Qt::WindowTitleHint|Qt::WindowSystemMenuHint)
+ : QDialog(parent, Qt::MSWindowsFixedSizeDialogHint |
+ Qt::WindowTitleHint|Qt::WindowSystemMenuHint)
{
TRACE_OBJ
m_pixmapLabel = 0;
m_aboutLabel = new AboutLabel();
-
+
m_closeButton = new QPushButton();
m_closeButton->setText(tr("&Close"));
- connect(m_closeButton, SIGNAL(clicked()),
- this, SLOT(close()));
+ connect(m_closeButton, SIGNAL(clicked()), this, SLOT(close()));
m_layout = new QGridLayout(this);
m_layout->addWidget(m_aboutLabel, 1, 0, 1, -1);
- m_layout->addItem(new QSpacerItem(20, 10, QSizePolicy::Minimum, QSizePolicy::Fixed), 2, 1, 1, 1);
+ m_layout->addItem(new QSpacerItem(20, 10, QSizePolicy::Minimum,
+ QSizePolicy::Fixed), 2, 1, 1, 1);
m_layout->addItem(new QSpacerItem(20, 20, QSizePolicy::Expanding), 3, 0, 1, 1);
m_layout->addWidget(m_closeButton, 3, 1, 1, 1);
- m_layout->addItem(new QSpacerItem(20, 20, QSizePolicy::Expanding), 3, 2, 1, 1);
+ m_layout->addItem(new QSpacerItem(20, 20, QSizePolicy::Expanding), 3, 2, 1, 1);
}
void AboutDialog::setText(const QString &text, const QByteArray &resources)
@@ -153,7 +153,8 @@ QString AboutDialog::documentTitle() const
void AboutDialog::updateSize()
{
TRACE_OBJ
- QSize screenSize = QApplication::desktop()->availableGeometry(QCursor::pos()).size();
+ QSize screenSize = QApplication::desktop()->availableGeometry(QCursor::pos())
+ .size();
int limit = qMin(screenSize.width()/2, 500);
#ifdef Q_WS_MAC
@@ -165,7 +166,7 @@ void AboutDialog::updateSize()
if (width > limit)
width = limit;
-
+
QFontMetrics fm(qApp->font("QWorkspaceTitleBar"));
int windowTitleWidth = qMin(fm.width(windowTitle()) + 50, limit);
if (windowTitleWidth > width)
@@ -173,8 +174,8 @@ void AboutDialog::updateSize()
layout()->activate();
int height = (layout()->hasHeightForWidth())
- ? layout()->totalHeightForWidth(width)
- : layout()->totalMinimumSize().height();
+ ? layout()->totalHeightForWidth(width)
+ : layout()->totalMinimumSize().height();
setFixedSize(width, height);
QCoreApplication::removePostedEvents(this, QEvent::LayoutRequest);
}
diff --git a/tools/assistant/tools/assistant/assistant.pro b/tools/assistant/tools/assistant/assistant.pro
index d57aa99..4677458 100644
--- a/tools/assistant/tools/assistant/assistant.pro
+++ b/tools/assistant/tools/assistant/assistant.pro
@@ -29,6 +29,8 @@ HEADERS += aboutdialog.h \
filternamedialog.h \
helpenginewrapper.h \
helpviewer.h \
+ helpviewer_qtb.h \
+ helpviewer_qwv.h \
indexwindow.h \
installdialog.h \
mainwindow.h \
@@ -55,6 +57,8 @@ SOURCES += aboutdialog.cpp \
filternamedialog.cpp \
helpenginewrapper.cpp \
helpviewer.cpp \
+ helpviewer_qtb.cpp \
+ helpviewer_qwv.cpp \
indexwindow.cpp \
installdialog.cpp \
main.cpp \
diff --git a/tools/assistant/tools/assistant/bookmarkdialog.cpp b/tools/assistant/tools/assistant/bookmarkdialog.cpp
index f081c15..c053b62 100644
--- a/tools/assistant/tools/assistant/bookmarkdialog.cpp
+++ b/tools/assistant/tools/assistant/bookmarkdialog.cpp
@@ -38,12 +38,12 @@
** $QT_END_LICENSE$
**
****************************************************************************/
-#include "tracer.h"
-
#include "bookmarkdialog.h"
#include "bookmarkfiltermodel.h"
#include "bookmarkitem.h"
#include "bookmarkmodel.h"
+#include "helpenginewrapper.h"
+#include "tracer.h"
#include <QtGui/QKeyEvent>
#include <QtGui/QMenu>
@@ -94,6 +94,10 @@ BookmarkDialog::BookmarkDialog(BookmarkModel *sourceModel, const QString &title,
ui.bookmarkFolders->setCurrentIndex(0);
ui.treeView->setCurrentIndex(ui.treeView->indexAt(QPoint(2, 2)));
+
+ const HelpEngineWrapper &helpEngine = HelpEngineWrapper::instance();
+ if (helpEngine.usesAppFont())
+ setFont(helpEngine.appFont());
}
BookmarkDialog::~BookmarkDialog()
diff --git a/tools/assistant/tools/assistant/centralwidget.cpp b/tools/assistant/tools/assistant/centralwidget.cpp
index 03af06c..dd91326 100644
--- a/tools/assistant/tools/assistant/centralwidget.cpp
+++ b/tools/assistant/tools/assistant/centralwidget.cpp
@@ -43,7 +43,8 @@
#include "centralwidget.h"
#include "findwidget.h"
#include "helpenginewrapper.h"
-#include "helpviewer.h"
+#include "helpviewer_qtb.h"
+#include "helpviewer_qwv.h"
#include "searchwidget.h"
#include "mainwindow.h"
#include "../shared/collectionconfiguration.h"
@@ -57,6 +58,7 @@
#include <QtGui/QPrinter>
#include <QtGui/QTabBar>
#include <QtGui/QTabWidget>
+#include <QtGui/QTextBrowser>
#include <QtGui/QToolButton>
#include <QtGui/QPageSetupDialog>
#include <QtGui/QPrintDialog>
@@ -70,6 +72,7 @@ namespace {
HelpViewer* helpViewerFromTabPosition(const QTabWidget *widget,
const QPoint &point)
{
+ TRACE_OBJ
QTabBar *tabBar = qFindChild<QTabBar*>(widget);
for (int i = 0; i < tabBar->count(); ++i) {
if (tabBar->tabRect(i).contains(point))
@@ -80,10 +83,8 @@ namespace {
CentralWidget *staticCentralWidget = 0;
}
-
// -- CentralWidget
-
CentralWidget::CentralWidget(MainWindow *parent)
: QWidget(parent)
, lastTabPage(0)
@@ -174,7 +175,7 @@ CentralWidget::~CentralWidget()
HelpViewer *viewer = qobject_cast<HelpViewer*>(tabWidget->widget(i));
if (viewer && viewer->source().isValid()) {
currentPages << viewer->source().toString();
- zoomFactors << QString::number(viewer->zoom());
+ zoomFactors << QString::number(viewer->scale());
}
}
@@ -208,7 +209,7 @@ void CentralWidget::zoomIn()
TRACE_OBJ
HelpViewer *viewer = currentHelpViewer();
if (viewer)
- viewer->zoomIn();
+ viewer->scaleUp();
if (tabWidget->currentWidget() == m_searchWidget)
m_searchWidget->zoomIn();
@@ -219,7 +220,7 @@ void CentralWidget::zoomOut()
TRACE_OBJ
HelpViewer *viewer = currentHelpViewer();
if (viewer)
- viewer->zoomOut();
+ viewer->scaleDown();
if (tabWidget->currentWidget() == m_searchWidget)
m_searchWidget->zoomOut();
@@ -237,9 +238,8 @@ void CentralWidget::nextPage()
void CentralWidget::resetZoom()
{
TRACE_OBJ
- HelpViewer *viewer = currentHelpViewer();
- if (viewer)
- viewer->resetZoom();
+ if (HelpViewer *viewer = currentHelpViewer())
+ viewer->resetScale();
if (tabWidget->currentWidget() == m_searchWidget)
m_searchWidget->resetZoom();
@@ -522,25 +522,12 @@ void CentralWidget::setSourceInNewTab(const QUrl &url, qreal zoom)
return;
#endif
- viewer = new HelpViewer(this);
+ viewer = new HelpViewer(this, zoom);
viewer->installEventFilter(this);
viewer->setSource(url);
viewer->setFocus(Qt::OtherFocusReason);
tabWidget->setCurrentIndex(tabWidget->addTab(viewer,
quoteTabTitle(viewer->documentTitle())));
-
- QFont font;
- getBrowserFontFor(viewer, &font);
-
-#if defined(QT_NO_WEBKIT)
- font.setPointSize((int)(font.pointSize() + zoom));
- setBrowserFontFor(viewer, font);
- viewer->setZoom((int)zoom);
-#else
- setBrowserFontFor(viewer, font);
- viewer->setTextSizeMultiplier(zoom == 0.0 ? 1.0 : zoom);
-#endif
-
connectSignals();
}
@@ -579,7 +566,13 @@ void CentralWidget::connectSignals()
}
}
-HelpViewer *CentralWidget::currentHelpViewer() const
+HelpViewer* CentralWidget::viewerAt(int index) const
+{
+ TRACE_OBJ
+ return qobject_cast<HelpViewer*>(tabWidget->widget(index));
+}
+
+HelpViewer* CentralWidget::currentHelpViewer() const
{
TRACE_OBJ
return qobject_cast<HelpViewer*>(tabWidget->currentWidget());
@@ -755,6 +748,7 @@ void CentralWidget::keyPressEvent(QKeyEvent *e)
void CentralWidget::findNext()
{
+ TRACE_OBJ
find(findWidget->text(), true);
}
@@ -876,21 +870,24 @@ bool CentralWidget::findInTextBrowser(const QString &ttf, bool forward)
void CentralWidget::updateBrowserFont()
{
TRACE_OBJ
- QFont font;
- bool searchAttached = searchWidgetAttached();
+ const bool searchAttached = searchWidgetAttached();
if (searchAttached) {
- getBrowserFontFor(m_searchWidget, &font);
- setBrowserFontFor(m_searchWidget, font);
+ HelpEngineWrapper &helpEngine = HelpEngineWrapper::instance();
+ m_searchWidget->setFont(helpEngine.usesBrowserFont()
+ ? helpEngine.browserFont() : qApp->font());
}
- int i = searchAttached ? 1 : 0;
- getBrowserFontFor(tabWidget->widget(i), &font);
- for ( ; i < tabWidget->count(); ++i)
- setBrowserFontFor(tabWidget->widget(i), font);
+ const int count = tabWidget->count();
+ if (HelpViewer* viewer = viewerAt(count - 1)) {
+ const QFont &font = viewer->viewerFont();
+ for (int i = searchAttached ? 1 : 0; i < count; ++i)
+ viewerAt(i)->setViewerFont(font);
+ }
}
bool CentralWidget::searchWidgetAttached() const
{
+ TRACE_OBJ
return m_searchWidget && m_searchWidget->isAttached();
}
@@ -906,9 +903,9 @@ void CentralWidget::createSearchWidget(QHelpSearchEngine *searchEngine)
connect(m_searchWidget, SIGNAL(requestShowLinkInNewTab(QUrl)), this,
SLOT(setSourceFromSearchInNewTab(QUrl)));
- QFont font;
- getBrowserFontFor(m_searchWidget, &font);
- setBrowserFontFor(m_searchWidget, font);
+ HelpEngineWrapper &helpEngine = HelpEngineWrapper::instance();
+ m_searchWidget->setFont(!helpEngine.usesBrowserFont() ? qApp->font()
+ : helpEngine.browserFont());
}
void CentralWidget::activateSearchWidget(bool updateLastTabPage)
@@ -1103,41 +1100,4 @@ QMap<int, QString> CentralWidget::currentSourceFileList() const
return sourceList;
}
-void CentralWidget::getBrowserFontFor(QWidget *viewer, QFont *font)
-{
- TRACE_OBJ
- HelpEngineWrapper &helpEngine = HelpEngineWrapper::instance();
- if (!helpEngine.usesBrowserFont()) {
- *font = qApp->font(); // case for QTextBrowser and SearchWidget
-#if !defined(QT_NO_WEBKIT)
- QWebView *view = qobject_cast<QWebView*> (viewer);
- if (view) {
- QWebSettings *settings = QWebSettings::globalSettings();
- *font = QFont(settings->fontFamily(QWebSettings::StandardFont),
- settings->fontSize(QWebSettings::DefaultFontSize));
- }
-#endif
- } else {
- *font = helpEngine.browserFont();
- }
-}
-
-void CentralWidget::setBrowserFontFor(QWidget *widget, const QFont &font)
-{
- TRACE_OBJ
-#if !defined(QT_NO_WEBKIT)
- QWebView *view = qobject_cast<QWebView*> (widget);
- if (view) {
- QWebSettings *settings = view->settings();
- settings->setFontFamily(QWebSettings::StandardFont, font.family());
- settings->setFontSize(QWebSettings::DefaultFontSize, font.pointSize());
- } else if (widget && widget->font() != font) {
- widget->setFont(font);
- }
-#else
- if (widget && widget->font() != font)
- widget->setFont(font);
-#endif
-}
-
QT_END_NAMESPACE
diff --git a/tools/assistant/tools/assistant/centralwidget.h b/tools/assistant/tools/assistant/centralwidget.h
index 6c3e93c..f286ff7 100644
--- a/tools/assistant/tools/assistant/centralwidget.h
+++ b/tools/assistant/tools/assistant/centralwidget.h
@@ -70,6 +70,8 @@ public:
bool isBackwardAvailable() const;
QList<QAction*> globalActions() const;
void setGlobalActions(const QList<QAction*> &actions);
+
+ HelpViewer *viewerAt(int index) const;
HelpViewer *currentHelpViewer() const;
bool searchWidgetAttached() const;
@@ -143,9 +145,6 @@ private:
QString quoteTabTitle(const QString &title) const;
void setLastShownPages();
- void getBrowserFontFor(QWidget* viewer, QFont *font);
- void setBrowserFontFor(QWidget *widget, const QFont &font);
-
private:
int lastTabPage;
QList<QAction*> globalActionList;
diff --git a/tools/assistant/tools/assistant/contentwindow.cpp b/tools/assistant/tools/assistant/contentwindow.cpp
index 976ed7a..e0347c8 100644
--- a/tools/assistant/tools/assistant/contentwindow.cpp
+++ b/tools/assistant/tools/assistant/contentwindow.cpp
@@ -144,7 +144,7 @@ bool ContentWindow::eventFilter(QObject *o, QEvent *e)
qobject_cast<QHelpContentModel*>(m_contentWidget->model());
if (contentModel) {
QHelpContentItem *itm = contentModel->contentItemAt(index);
- if (itm && HelpViewer::canOpenPage(itm->url().path()))
+ if (itm && AbstractHelpViewer::canOpenPage(itm->url().path()))
CentralWidget::instance()->setSourceInNewTab(itm->url());
}
} else if (button == Qt::LeftButton) {
@@ -170,7 +170,7 @@ void ContentWindow::showContextMenu(const QPoint &pos)
QMenu menu;
QAction *curTab = menu.addAction(tr("Open Link"));
QAction *newTab = menu.addAction(tr("Open Link in New Tab"));
- if (!HelpViewer::canOpenPage(itm->url().path()))
+ if (!AbstractHelpViewer::canOpenPage(itm->url().path()))
newTab->setEnabled(false);
menu.move(m_contentWidget->mapToGlobal(pos));
diff --git a/tools/assistant/tools/assistant/helpenginewrapper.cpp b/tools/assistant/tools/assistant/helpenginewrapper.cpp
index 76211c5..a181c71 100644
--- a/tools/assistant/tools/assistant/helpenginewrapper.cpp
+++ b/tools/assistant/tools/assistant/helpenginewrapper.cpp
@@ -112,6 +112,7 @@ private:
QFileSystemWatcher * const m_qchWatcher;
typedef QPair<QDateTime, QSharedPointer<TimeoutForwarder> > RecentSignal;
QMap<QString, RecentSignal> m_recentQchUpdates;
+ bool m_initialReindexingNeeded;
};
const QString HelpEngineWrapper::TrUnfiltered = tr("Unfiltered");
@@ -141,6 +142,18 @@ HelpEngineWrapper::HelpEngineWrapper(const QString &collectionFile)
: d(new HelpEngineWrapperPrivate(collectionFile))
{
TRACE_OBJ
+
+ /*
+ * Otherwise we will waste time if several new docs are found,
+ * because we will start to index them, only to be interupted
+ * by the next request. Also, there is a nasty SQLITE bug that will
+ * cause the application to hang for minutes in that case.
+ * This call is reverted by initalDocSetupDone(), which must be
+ * called after the new docs have been installed.
+ */
+ disconnect(d->m_helpEngine, SIGNAL(setupFinished()),
+ searchEngine(), SLOT(indexDocumentation()));
+
connect(d, SIGNAL(documentationRemoved(QString)),
this, SIGNAL(documentationRemoved(QString)));
connect(d, SIGNAL(documentationUpdated(QString)),
@@ -157,6 +170,15 @@ HelpEngineWrapper::~HelpEngineWrapper()
delete d;
}
+void HelpEngineWrapper::initialDocSetupDone()
+{
+ TRACE_OBJ
+ connect(d->m_helpEngine, SIGNAL(setupFinished()),
+ searchEngine(), SLOT(indexDocumentation()));
+ if (d->m_initialReindexingNeeded)
+ setupData();
+}
+
QHelpSearchEngine *HelpEngineWrapper::searchEngine() const
{
TRACE_OBJ
@@ -207,6 +229,7 @@ bool HelpEngineWrapper::registerDocumentation(const QString &docFile)
return false;
d->m_qchWatcher->addPath(docFile);
d->checkDocFilesWatched();
+ d->m_initialReindexingNeeded = true;
return true;
}
@@ -219,6 +242,7 @@ bool HelpEngineWrapper::unregisterDocumentation(const QString &namespaceName)
return false;
d->m_qchWatcher->removePath(file);
d->checkDocFilesWatched();
+ d->m_initialReindexingNeeded = true;
return true;
}
@@ -698,7 +722,8 @@ void TimeoutForwarder::forward()
HelpEngineWrapperPrivate::HelpEngineWrapperPrivate(const QString &collectionFile)
: m_helpEngine(new QHelpEngine(collectionFile, this)),
- m_qchWatcher(new QFileSystemWatcher(this))
+ m_qchWatcher(new QFileSystemWatcher(this)),
+ m_initialReindexingNeeded(false)
{
TRACE_OBJ
if (!m_helpEngine->customFilters().contains(Unfiltered))
@@ -797,6 +822,7 @@ void HelpEngineWrapperPrivate::qchFileChanged(const QString &fileName,
} else {
emit documentationUpdated(ns);
}
+ m_initialReindexingNeeded = true;
m_helpEngine->setupData();
}
m_recentQchUpdates.erase(it);
diff --git a/tools/assistant/tools/assistant/helpenginewrapper.h b/tools/assistant/tools/assistant/helpenginewrapper.h
index a30fab8..8d95273 100644
--- a/tools/assistant/tools/assistant/helpenginewrapper.h
+++ b/tools/assistant/tools/assistant/helpenginewrapper.h
@@ -101,6 +101,12 @@ public:
const QStringList filterAttributes(const QString &filterName) const;
QString error() const;
+ /*
+ * To be called after assistant has finished looking for new documentation.
+ * This will mainly cause the search index to be updated, if necessary.
+ */
+ void initialDocSetupDone();
+
const QStringList qtDocInfo(const QString &component) const;
void setQtDocInfo(const QString &component, const QStringList &doc);
diff --git a/tools/assistant/tools/assistant/helpviewer.cpp b/tools/assistant/tools/assistant/helpviewer.cpp
index 8e4d3ed..8597f6b 100644
--- a/tools/assistant/tools/assistant/helpviewer.cpp
+++ b/tools/assistant/tools/assistant/helpviewer.cpp
@@ -38,603 +38,31 @@
** $QT_END_LICENSE$
**
****************************************************************************/
-#include "tracer.h"
-
#include "helpviewer.h"
-#include "centralwidget.h"
-#include "helpenginewrapper.h"
-
-#include <QtCore/QDir>
-#include <QtCore/QEvent>
-#include <QtCore/QVariant>
-#include <QtCore/QByteArray>
-#include <QtCore/QStringBuilder>
-#include <QtCore/QTemporaryFile>
-#include <QtCore/QTimer>
-
-#include <QtGui/QMenu>
-#include <QtGui/QKeyEvent>
-#include <QtGui/QClipboard>
-#include <QtGui/QApplication>
-#include <QtGui/QMessageBox>
-#include <QtGui/QDesktopServices>
+#include "tracer.h"
-#include <QNetworkAccessManager>
-#include <QNetworkReply>
-#include <QNetworkRequest>
+#include <QtCore/QCoreApplication>
+#include <QtCore/QUrl>
QT_BEGIN_NAMESPACE
-namespace {
- const QString PageNotFoundMessage =
- QCoreApplication::translate("HelpViewer",
- "<title>Error 404...</title><div align=\"center\"><br><br>"
- "<h1>The page could not be found</h1><br><h3>'%1'</h3></div>");
-}
-
-#if !defined(QT_NO_WEBKIT)
-
-class HelpNetworkReply : public QNetworkReply
-{
-public:
- HelpNetworkReply(const QNetworkRequest &request, const QByteArray &fileData,
- const QString &mimeType);
-
- virtual void abort();
-
- virtual qint64 bytesAvailable() const
- { return data.length() + QNetworkReply::bytesAvailable(); }
-
-protected:
- virtual qint64 readData(char *data, qint64 maxlen);
-
-private:
- QByteArray data;
- qint64 origLen;
-};
-
-HelpNetworkReply::HelpNetworkReply(const QNetworkRequest &request,
- const QByteArray &fileData, const QString& mimeType)
- : data(fileData), origLen(fileData.length())
-{
- TRACE_OBJ
- setRequest(request);
- setOpenMode(QIODevice::ReadOnly);
-
- setHeader(QNetworkRequest::ContentTypeHeader, mimeType);
- setHeader(QNetworkRequest::ContentLengthHeader, QByteArray::number(origLen));
- QTimer::singleShot(0, this, SIGNAL(metaDataChanged()));
- QTimer::singleShot(0, this, SIGNAL(readyRead()));
-}
-
-void HelpNetworkReply::abort()
-{
- TRACE_OBJ
- // nothing to do
-}
-
-qint64 HelpNetworkReply::readData(char *buffer, qint64 maxlen)
-{
- TRACE_OBJ
- qint64 len = qMin(qint64(data.length()), maxlen);
- if (len) {
- qMemCopy(buffer, data.constData(), len);
- data.remove(0, len);
- }
- if (!data.length())
- QTimer::singleShot(0, this, SIGNAL(finished()));
- return len;
-}
-
-class HelpNetworkAccessManager : public QNetworkAccessManager
-{
-public:
- HelpNetworkAccessManager(QObject *parent);
-
-protected:
- virtual QNetworkReply *createRequest(Operation op,
- const QNetworkRequest &request, QIODevice *outgoingData = 0);
-};
-
-HelpNetworkAccessManager::HelpNetworkAccessManager(QObject *parent)
- : QNetworkAccessManager(parent)
-{
- TRACE_OBJ
-}
-
-QNetworkReply *HelpNetworkAccessManager::createRequest(Operation /*op*/,
- const QNetworkRequest &request, QIODevice* /*outgoingData*/)
-{
- TRACE_OBJ
- const QUrl& url = request.url();
- QString mimeType = url.toString();
- if (mimeType.endsWith(QLatin1String(".svg"))
- || mimeType.endsWith(QLatin1String(".svgz"))) {
- mimeType = QLatin1String("image/svg+xml");
- } else if (mimeType.endsWith(QLatin1String(".css"))) {
- mimeType = QLatin1String("text/css");
- } else if (mimeType.endsWith(QLatin1String(".js"))) {
- mimeType = QLatin1String("text/javascript");
- } else if (mimeType.endsWith(QLatin1String(".txt"))) {
- mimeType = QLatin1String("text/plain");
- } else {
- mimeType = QLatin1String("text/html");
- }
-
- HelpEngineWrapper &helpEngine = HelpEngineWrapper::instance();
- const QByteArray &data = helpEngine.findFile(url).isValid()
- ? helpEngine.fileData(url)
- : PageNotFoundMessage.arg(url.toString()).toUtf8();
- return new HelpNetworkReply(request, data, mimeType);
-}
-
-class HelpPage : public QWebPage
-{
-public:
- HelpPage(CentralWidget *central, QObject *parent);
-
-protected:
- virtual QWebPage *createWindow(QWebPage::WebWindowType);
- virtual void triggerAction(WebAction action, bool checked = false);
-
- virtual bool acceptNavigationRequest(QWebFrame *frame,
- const QNetworkRequest &request, NavigationType type);
-
-private:
- CentralWidget *centralWidget;
- bool closeNewTabIfNeeded;
-
- friend class HelpViewer;
- Qt::MouseButtons m_pressedButtons;
- Qt::KeyboardModifiers m_keyboardModifiers;
-};
-
-HelpPage::HelpPage(CentralWidget *central, QObject *parent)
- : QWebPage(parent)
- , centralWidget(central)
- , closeNewTabIfNeeded(false)
- , m_pressedButtons(Qt::NoButton)
- , m_keyboardModifiers(Qt::NoModifier)
-{
- TRACE_OBJ
-}
-
-QWebPage *HelpPage::createWindow(QWebPage::WebWindowType)
-{
- TRACE_OBJ
- HelpPage* newPage = static_cast<HelpPage*>(centralWidget->newEmptyTab()->page());
- if (newPage)
- newPage->closeNewTabIfNeeded = closeNewTabIfNeeded;
- closeNewTabIfNeeded = false;
- return newPage;
-}
+QString AbstractHelpViewer::PageNotFoundMessage =
+ QCoreApplication::translate("HelpViewer", "<title>Error 404...</title><div "
+ "align=\"center\"><br><br><h1>The page could not be found</h1><br><h3>'%1'"
+ "</h3></div>");
-void HelpPage::triggerAction(WebAction action, bool checked)
+AbstractHelpViewer::AbstractHelpViewer()
{
- TRACE_OBJ
- switch (action) {
- case OpenLinkInNewWindow:
- closeNewTabIfNeeded = true;
- default: // fall through
- QWebPage::triggerAction(action, checked);
- break;
- }
}
-bool HelpPage::acceptNavigationRequest(QWebFrame *,
- const QNetworkRequest &request, QWebPage::NavigationType type)
+AbstractHelpViewer::~AbstractHelpViewer()
{
- TRACE_OBJ
- const QUrl &url = request.url();
- const bool closeNewTab = closeNewTabIfNeeded;
- closeNewTabIfNeeded = false;
-
- if (HelpViewer::isLocalUrl(url)) {
- const QString& path = url.path();
- if (!HelpViewer::canOpenPage(path)) {
- QTemporaryFile tmpTmpFile;
- if (!tmpTmpFile.open())
- return false;
- const QString extension = QFileInfo(path).completeSuffix();
- QFile actualTmpFile(tmpTmpFile.fileName() % QLatin1String(".")
- % extension);
- if (actualTmpFile.open(QIODevice::ReadWrite | QIODevice::Truncate)) {
- actualTmpFile.write(HelpEngineWrapper::instance().fileData(url));
- actualTmpFile.close();
- QDesktopServices::openUrl(QUrl(actualTmpFile.fileName()));
- }
-
- if (closeNewTab)
- QMetaObject::invokeMethod(CentralWidget::instance(), "closeTab");
- return false;
- }
-
- if (type == QWebPage::NavigationTypeLinkClicked
- && (m_keyboardModifiers & Qt::ControlModifier
- || m_pressedButtons == Qt::MidButton)) {
- HelpViewer* viewer = centralWidget->newEmptyTab();
- if (viewer)
- CentralWidget::instance()->setSource(url);
- m_pressedButtons = Qt::NoButton;
- m_keyboardModifiers = Qt::NoModifier;
- return false;
- }
- return true;
- }
-
- QDesktopServices::openUrl(url);
- return false;
}
-HelpViewer::HelpViewer(CentralWidget *parent)
- : QWebView(parent)
- , parentWidget(parent)
- , loadFinished(false)
- , helpEngine(HelpEngineWrapper::instance())
+bool AbstractHelpViewer::isLocalUrl(const QUrl &url)
{
TRACE_OBJ
- setAcceptDrops(false);
-
- setPage(new HelpPage(parent, this));
-
- page()->setNetworkAccessManager(new HelpNetworkAccessManager(this));
-
- QAction* action = pageAction(QWebPage::OpenLinkInNewWindow);
- action->setText(tr("Open Link in New Tab"));
- if (!parent)
- action->setVisible(false);
-
- pageAction(QWebPage::DownloadLinkToDisk)->setVisible(false);
- pageAction(QWebPage::DownloadImageToDisk)->setVisible(false);
- pageAction(QWebPage::OpenImageInNewWindow)->setVisible(false);
-
- connect(pageAction(QWebPage::Copy), SIGNAL(changed()), this,
- SLOT(actionChanged()));
- connect(pageAction(QWebPage::Back), SIGNAL(changed()), this,
- SLOT(actionChanged()));
- connect(pageAction(QWebPage::Forward), SIGNAL(changed()), this,
- SLOT(actionChanged()));
- connect(page(), SIGNAL(linkHovered(QString,QString,QString)), this,
- SIGNAL(highlighted(QString)));
- connect(this, SIGNAL(urlChanged(QUrl)), this, SIGNAL(sourceChanged(QUrl)));
- connect(this, SIGNAL(loadFinished(bool)), this, SLOT(setLoadFinished(bool)));
-}
-
-void HelpViewer::setSource(const QUrl &url)
-{
- TRACE_OBJ
- loadFinished = false;
- if (url.toString() == QLatin1String("help")) {
- load(QUrl(QLatin1String("qthelp://com.trolltech.com."
- "assistantinternal-1.0.0/assistant/assistant.html")));
- } else {
- load(url);
- }
-}
-
-void HelpViewer::resetZoom()
-{
- TRACE_OBJ
- setTextSizeMultiplier(1.0);
-}
-
-void HelpViewer::zoomIn(qreal range)
-{
- TRACE_OBJ
- setTextSizeMultiplier(textSizeMultiplier() + range / 10.0);
-}
-
-void HelpViewer::zoomOut(qreal range)
-{
- TRACE_OBJ
- setTextSizeMultiplier(qMax(0.0, textSizeMultiplier() - range / 10.0));
-}
-
-void HelpViewer::wheelEvent(QWheelEvent *e)
-{
- TRACE_OBJ
- if (e->modifiers() & Qt::ControlModifier) {
- const int delta = e->delta();
- if (delta > 0)
- zoomIn(delta / 120);
- else if (delta < 0)
- zoomOut(-delta / 120);
- e->accept();
- return;
- }
- QWebView::wheelEvent(e);
-}
-
-void HelpViewer::mouseReleaseEvent(QMouseEvent *e)
-{
- TRACE_OBJ
- if (e->button() == Qt::XButton1) {
- triggerPageAction(QWebPage::Back);
- return;
- }
-
- if (e->button() == Qt::XButton2) {
- triggerPageAction(QWebPage::Forward);
- return;
- }
-
- QWebView::mouseReleaseEvent(e);
-}
-
-void HelpViewer::actionChanged()
-{
- TRACE_OBJ
- QAction *a = qobject_cast<QAction *>(sender());
- if (a == pageAction(QWebPage::Copy))
- emit copyAvailable(a->isEnabled());
- else if (a == pageAction(QWebPage::Back))
- emit backwardAvailable(a->isEnabled());
- else if (a == pageAction(QWebPage::Forward))
- emit forwardAvailable(a->isEnabled());
-}
-
-void HelpViewer::mousePressEvent(QMouseEvent *event)
-{
- TRACE_OBJ
- HelpPage *currentPage = static_cast<HelpPage*>(page());
- if (currentPage) {
- currentPage->m_pressedButtons = event->buttons();
- currentPage->m_keyboardModifiers = event->modifiers();
- }
- QWebView::mousePressEvent(event);
-}
-
-void HelpViewer::setLoadFinished(bool ok)
-{
- TRACE_OBJ
- loadFinished = ok;
- emit sourceChanged(url());
-}
-
-#else // !defined(QT_NO_WEBKIT)
-
-HelpViewer::HelpViewer(CentralWidget *parent)
- : QTextBrowser(parent)
- , zoomCount(0)
- , controlPressed(false)
- , lastAnchor(QString())
- , parentWidget(parent)
- , helpEngine(HelpEngineWrapper::instance())
-{
- TRACE_OBJ
- document()->setDocumentMargin(8);
-}
-
-void HelpViewer::setSource(const QUrl &url)
-{
- TRACE_OBJ
- bool help = url.toString() == QLatin1String("help");
- if (url.isValid() && !help) {
- if (launchedWithExternalApp(url))
- return;
-
- QUrl u = helpEngine.findFile(url);
- if (u.isValid()) {
- QTextBrowser::setSource(u);
- return;
- }
- }
-
- if (help) {
- QTextBrowser::setSource(QUrl(QLatin1String("qthelp://com.trolltech.com."
- "assistantinternal-1.0.0/assistant/assistant.html")));
- } else {
- QTextBrowser::setSource(url);
- setHtml(PageNotFoundMessage.arg(url.toString()));
- emit sourceChanged(url);
- }
-}
-
-void HelpViewer::resetZoom()
-{
- TRACE_OBJ
- if (zoomCount == 0)
- return;
-
- QTextBrowser::zoomOut(zoomCount);
- zoomCount = 0;
-}
-
-void HelpViewer::zoomIn(int range)
-{
- TRACE_OBJ
- if (zoomCount == 10)
- return;
-
- QTextBrowser::zoomIn(range);
- zoomCount++;
-}
-
-void HelpViewer::zoomOut(int range)
-{
- TRACE_OBJ
- if (zoomCount == -5)
- return;
-
- QTextBrowser::zoomOut(range);
- zoomCount--;
-}
-
-bool HelpViewer::launchedWithExternalApp(const QUrl &url)
-{
- TRACE_OBJ
- const bool canOpen = canOpenPage(url.path());
- if (!isLocalUrl(url) || !canOpen) {
- bool launched = false;
- if (!canOpen && url.scheme() == QLatin1String("qthelp")) {
- const QString& path = url.path();
- const int lastDash = path.lastIndexOf(QChar('/'));
- QString fileName = QDir::tempPath() + QDir::separator();
- if (lastDash < 0)
- fileName += path;
- else
- fileName += path.mid(lastDash + 1, path.length());
-
- QFile tmpFile(QDir::cleanPath(fileName));
- if (tmpFile.open(QIODevice::ReadWrite)) {
- tmpFile.write(helpEngine.fileData(url));
- tmpFile.close();
- }
- launched = QDesktopServices::openUrl(QUrl(tmpFile.fileName()));
- } else {
- launched = QDesktopServices::openUrl(url);
- }
-
- if (!launched) {
- QMessageBox::information(this, tr("Help"),
- tr("Unable to launch external application.\n"), tr("OK"));
- }
- return true;
- }
- return false;
-}
-
-QVariant HelpViewer::loadResource(int type, const QUrl &name)
-{
- TRACE_OBJ
- QByteArray ba;
- if (type < 4) {
- ba = helpEngine.fileData(name);
- if (name.toString().endsWith(QLatin1String(".svg"), Qt::CaseInsensitive)) {
- QImage image;
- image.loadFromData(ba, "svg");
- if (!image.isNull())
- return image;
- }
- }
- return ba;
-}
-
-void HelpViewer::openLinkInNewTab()
-{
- TRACE_OBJ
- if(lastAnchor.isEmpty())
- return;
-
- parentWidget->setSourceInNewTab(QUrl(lastAnchor));
- lastAnchor.clear();
-}
-
-void HelpViewer::openLinkInNewTab(const QString &link)
-{
- TRACE_OBJ
- lastAnchor = link;
- openLinkInNewTab();
-}
-
-bool HelpViewer::hasAnchorAt(const QPoint& pos)
-{
- TRACE_OBJ
- lastAnchor = anchorAt(pos);
- if (lastAnchor.isEmpty())
- return false;
-
- lastAnchor = source().resolved(lastAnchor).toString();
- if (lastAnchor.at(0) == QLatin1Char('#')) {
- QString src = source().toString();
- int hsh = src.indexOf(QLatin1Char('#'));
- lastAnchor = (hsh>=0 ? src.left(hsh) : src) + lastAnchor;
- }
-
- return true;
-}
-
-void HelpViewer::contextMenuEvent(QContextMenuEvent *e)
-{
- TRACE_OBJ
- QMenu menu(QLatin1String(""), 0);
-
- QUrl link;
- QAction *copyAnchorAction = 0;
- if (hasAnchorAt(e->pos())) {
- link = anchorAt(e->pos());
- if (link.isRelative())
- link = source().resolved(link);
- copyAnchorAction = menu.addAction(tr("Copy &Link Location"));
- copyAnchorAction->setEnabled(!link.isEmpty() && link.isValid());
-
- menu.addAction(tr("Open Link in New Tab\tCtrl+LMB"), this,
- SLOT(openLinkInNewTab()));
- menu.addSeparator();
- }
- menu.addActions(parentWidget->globalActions());
- QAction *action = menu.exec(e->globalPos());
- if (action == copyAnchorAction)
- QApplication::clipboard()->setText(link.toString());
-}
-
-void HelpViewer::mouseReleaseEvent(QMouseEvent *e)
-{
- TRACE_OBJ
- if (e->button() == Qt::XButton1) {
- QTextBrowser::backward();
- return;
- }
-
- if (e->button() == Qt::XButton2) {
- QTextBrowser::forward();
- return;
- }
-
- controlPressed = e->modifiers() & Qt::ControlModifier;
- if ((controlPressed && hasAnchorAt(e->pos())) ||
- (e->button() == Qt::MidButton && hasAnchorAt(e->pos()))) {
- openLinkInNewTab();
- return;
- }
-
- QTextBrowser::mouseReleaseEvent(e);
-}
-
-void HelpViewer::keyPressEvent(QKeyEvent *e)
-{
- TRACE_OBJ
- if ((e->key() == Qt::Key_Home && e->modifiers() != Qt::NoModifier)
- || (e->key() == Qt::Key_End && e->modifiers() != Qt::NoModifier)) {
- QKeyEvent* event = new QKeyEvent(e->type(), e->key(), Qt::NoModifier,
- e->text(), e->isAutoRepeat(), e->count());
- e = event;
- }
- QTextBrowser::keyPressEvent(e);
-}
-
-void HelpViewer::wheelEvent(QWheelEvent *e)
-{
- TRACE_OBJ
- if (e->modifiers() == Qt::CTRL) {
- e->accept();
- (e->delta() > 0) ? zoomIn() : zoomOut();
- } else {
- e->ignore();
- QTextBrowser::wheelEvent(e);
- }
-}
-
-#endif // !defined(QT_NO_WEBKIT)
-
-void HelpViewer::home()
-{
- TRACE_OBJ
- setSource(helpEngine.homePage());
-}
-
-bool HelpViewer::canOpenPage(const QString &url)
-{
- TRACE_OBJ
- return url.endsWith(QLatin1String(".html"), Qt::CaseInsensitive)
- || url.endsWith(QLatin1String(".htm"), Qt::CaseInsensitive)
- || url == QLatin1String("blank");
-}
-
-bool HelpViewer::isLocalUrl(const QUrl &url)
-{
- TRACE_OBJ
- const QString scheme = url.scheme();
+ const QString &scheme = url.scheme();
return scheme.isEmpty()
|| scheme == QLatin1String("file")
|| scheme == QLatin1String("qrc")
@@ -643,5 +71,12 @@ bool HelpViewer::isLocalUrl(const QUrl &url)
|| scheme == QLatin1String("about");
}
+bool AbstractHelpViewer::canOpenPage(const QString &url)
+{
+ TRACE_OBJ
+ return url.endsWith(QLatin1String(".html"), Qt::CaseInsensitive)
+ || url.endsWith(QLatin1String(".htm"), Qt::CaseInsensitive)
+ || url == QLatin1String("blank");
+}
QT_END_NAMESPACE
diff --git a/tools/assistant/tools/assistant/helpviewer.h b/tools/assistant/tools/assistant/helpviewer.h
index 4dd8064..fe860fd 100644
--- a/tools/assistant/tools/assistant/helpviewer.h
+++ b/tools/assistant/tools/assistant/helpviewer.h
@@ -38,144 +38,37 @@
** $QT_END_LICENSE$
**
****************************************************************************/
-
#ifndef HELPVIEWER_H
#define HELPVIEWER_H
-#include <QtCore/QUrl>
-#include <QtCore/QVariant>
-#include <QtGui/QTextBrowser>
-#include <QtGui/QAction>
+#include <QtCore/QString>
-#if !defined(QT_NO_WEBKIT)
-#include <QWebView>
-#endif
+#include <QtGui/QFont>
QT_BEGIN_NAMESPACE
-class CentralWidget;
-class HelpEngineWrapper;
-
-class QPoint;
-class QString;
-class QKeyEvent;
-class QMouseEvent;
-class QContextMenuEvent;
+class QUrl;
-#if !defined(QT_NO_WEBKIT)
-
-class HelpViewer : public QWebView
+class AbstractHelpViewer
{
- Q_OBJECT
-
public:
- HelpViewer(CentralWidget *parent);
- void setSource(const QUrl &url);
-
- inline QUrl source() const
- { return url(); }
-
- inline QString documentTitle() const
- { return title(); }
-
- inline bool hasSelection() const
- { return !selectedText().isEmpty(); } // ### this is suboptimal
-
- void resetZoom();
- void zoomIn(qreal range = 1);
- void zoomOut(qreal range = 1);
+ AbstractHelpViewer();
+ ~AbstractHelpViewer();
- inline void copy()
- { return triggerPageAction(QWebPage::Copy); }
+ virtual QFont viewerFont() const = 0;
+ virtual void setViewerFont(const QFont &font) = 0;
- inline bool isForwardAvailable() const
- { return pageAction(QWebPage::Forward)->isEnabled(); }
- inline bool isBackwardAvailable() const
- { return pageAction(QWebPage::Back)->isEnabled(); }
- inline bool hasLoadFinished() const
- { return loadFinished; }
- inline qreal zoom() const
- { return textSizeMultiplier(); }
+ virtual void scaleUp() = 0;
+ virtual void scaleDown() = 0;
+
+ virtual void resetScale() = 0;
+ virtual qreal scale() const = 0;
- static bool canOpenPage(const QString &url);
+ static QString PageNotFoundMessage;
static bool isLocalUrl(const QUrl &url);
-
-public Q_SLOTS:
- void home();
- void backward() { back(); }
-
-Q_SIGNALS:
- void copyAvailable(bool enabled);
- void forwardAvailable(bool enabled);
- void backwardAvailable(bool enabled);
- void highlighted(const QString &);
- void sourceChanged(const QUrl &);
-
-protected:
- virtual void wheelEvent(QWheelEvent *);
- void mouseReleaseEvent(QMouseEvent *e);
- void mousePressEvent(QMouseEvent *event);
-
-private Q_SLOTS:
- void actionChanged();
- void setLoadFinished(bool ok);
-
-private:
- CentralWidget* parentWidget;
- bool loadFinished;
- HelpEngineWrapper &helpEngine;
-};
-
-#else
-
-class HelpViewer : public QTextBrowser
-{
- Q_OBJECT
-
-public:
- HelpViewer(CentralWidget *parent);
- void setSource(const QUrl &url);
-
- void resetZoom();
- void zoomIn(int range = 1);
- void zoomOut(int range = 1);
- int zoom() const { return zoomCount; }
- void setZoom(int zoom) { zoomCount = zoom; }
-
- inline bool hasSelection() const
- { return textCursor().hasSelection(); }
-
- bool launchedWithExternalApp(const QUrl &url);
static bool canOpenPage(const QString &url);
- static bool isLocalUrl(const QUrl &url);
-
-public Q_SLOTS:
- void home();
-
-protected:
- void wheelEvent(QWheelEvent *e);
-
-private:
- QVariant loadResource(int type, const QUrl &name);
- void openLinkInNewTab(const QString &link);
- bool hasAnchorAt(const QPoint& pos);
- void contextMenuEvent(QContextMenuEvent *e);
- void mouseReleaseEvent(QMouseEvent *e);
- void keyPressEvent(QKeyEvent *e);
-
-private slots:
- void openLinkInNewTab();
-
-private:
- int zoomCount;
- bool controlPressed;
- QString lastAnchor;
- CentralWidget* parentWidget;
- HelpEngineWrapper &helpEngine;
};
-#endif
-
QT_END_NAMESPACE
-#endif
+#endif // HELPVIEWER_H
diff --git a/tools/assistant/tools/assistant/helpviewer_qtb.cpp b/tools/assistant/tools/assistant/helpviewer_qtb.cpp
new file mode 100644
index 0000000..3aafe67
--- /dev/null
+++ b/tools/assistant/tools/assistant/helpviewer_qtb.cpp
@@ -0,0 +1,331 @@
+/****************************************************************************
+**
+** 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 Qt Assistant 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$
+**
+****************************************************************************/
+#if defined(QT_NO_WEBKIT)
+
+#include "helpviewer_qtb.h"
+#include "helpviewer_qwv.h"
+
+#include "centralwidget.h"
+#include "helpenginewrapper.h"
+#include "tracer.h"
+
+#include <QtCore/QDir>
+#include <QtCore/QStringBuilder>
+
+#include <QtGui/QContextMenuEvent>
+#include <QtGui/QMenu>
+#include <QtGui/QClipboard>
+#include <QtGui/QApplication>
+#include <QtGui/QMessageBox>
+#include <QtGui/QDesktopServices>
+
+QT_BEGIN_NAMESPACE
+
+HelpViewer::HelpViewer(CentralWidget *parent, qreal zoom)
+ : QTextBrowser(parent)
+ , zoomCount(zoom)
+ , controlPressed(false)
+ , lastAnchor(QString())
+ , parentWidget(parent)
+ , helpEngine(HelpEngineWrapper::instance())
+ , forceFont(false)
+{
+ TRACE_OBJ
+ installEventFilter(this);
+ document()->setDocumentMargin(8);
+
+ QFont font = viewerFont();
+ font.setPointSize(int(font.pointSize() + zoom));
+ setViewerFont(font);
+}
+
+HelpViewer::~HelpViewer()
+{
+ TRACE_OBJ
+}
+
+QFont HelpViewer::viewerFont() const
+{
+ TRACE_OBJ
+ if (HelpEngineWrapper::instance().usesBrowserFont())
+ return helpEngine.browserFont();
+ return qApp->font();
+}
+
+void HelpViewer::setViewerFont(const QFont &newFont)
+{
+ TRACE_OBJ
+ if (font() != newFont) {
+ forceFont = true;
+ setFont(newFont);
+ forceFont = false;
+ }
+}
+
+void HelpViewer::scaleUp()
+{
+ TRACE_OBJ
+ if (zoomCount < 10) {
+ ++zoomCount;
+ forceFont = true;
+ zoomIn();
+ forceFont = false;
+ }
+}
+
+void HelpViewer::scaleDown()
+{
+ TRACE_OBJ
+ if (zoomCount > -5) {
+ --zoomCount;
+ forceFont = true;
+ zoomOut();
+ forceFont = false;
+ }
+}
+
+void HelpViewer::resetScale()
+{
+ TRACE_OBJ
+ if (zoomCount != 0) {
+ forceFont = true;
+ zoomOut(zoomCount);
+ forceFont = false;
+ }
+ zoomCount = 0;
+}
+
+void HelpViewer::setSource(const QUrl &url)
+{
+ TRACE_OBJ
+ bool help = url.toString() == QLatin1String("help");
+ if (url.isValid() && !help) {
+ if (launchedWithExternalApp(url))
+ return;
+
+ QUrl u = helpEngine.findFile(url);
+ if (u.isValid()) {
+ QTextBrowser::setSource(u);
+ return;
+ }
+ }
+
+ if (help) {
+ QTextBrowser::setSource(QUrl(QLatin1String("qthelp://com.trolltech.com."
+ "assistantinternal-1.0.0/assistant/assistant.html")));
+ } else {
+ QTextBrowser::setSource(url);
+ setHtml(PageNotFoundMessage.arg(url.toString()));
+ emit sourceChanged(url);
+ }
+}
+
+bool HelpViewer::launchedWithExternalApp(const QUrl &url)
+{
+ TRACE_OBJ
+ const bool canOpen = canOpenPage(url.path());
+ if (!isLocalUrl(url) || !canOpen) {
+ bool launched = false;
+ if (!canOpen && url.scheme() == QLatin1String("qthelp")) {
+ const QString& path = url.path();
+ const int lastDash = path.lastIndexOf(QChar('/'));
+ QString fileName = QDir::tempPath() + QDir::separator();
+ if (lastDash < 0)
+ fileName += path;
+ else
+ fileName += path.mid(lastDash + 1, path.length());
+
+ QFile tmpFile(QDir::cleanPath(fileName));
+ if (tmpFile.open(QIODevice::ReadWrite)) {
+ tmpFile.write(helpEngine.fileData(url));
+ tmpFile.close();
+ }
+ launched = QDesktopServices::openUrl(QUrl(tmpFile.fileName()));
+ } else {
+ launched = QDesktopServices::openUrl(url);
+ }
+
+ if (!launched) {
+ QMessageBox::information(this, tr("Help"),
+ tr("Unable to launch external application.\n"), tr("OK"));
+ }
+ return true;
+ }
+ return false;
+}
+
+QVariant HelpViewer::loadResource(int type, const QUrl &name)
+{
+ TRACE_OBJ
+ QByteArray ba;
+ if (type < 4) {
+ ba = helpEngine.fileData(name);
+ if (name.toString().endsWith(QLatin1String(".svg"), Qt::CaseInsensitive)) {
+ QImage image;
+ image.loadFromData(ba, "svg");
+ if (!image.isNull())
+ return image;
+ }
+ }
+ return ba;
+}
+
+void HelpViewer::openLinkInNewTab()
+{
+ TRACE_OBJ
+ if(lastAnchor.isEmpty())
+ return;
+
+ parentWidget->setSourceInNewTab(QUrl(lastAnchor));
+ lastAnchor.clear();
+}
+
+void HelpViewer::openLinkInNewTab(const QString &link)
+{
+ TRACE_OBJ
+ lastAnchor = link;
+ openLinkInNewTab();
+}
+
+bool HelpViewer::hasAnchorAt(const QPoint& pos)
+{
+ TRACE_OBJ
+ lastAnchor = anchorAt(pos);
+ if (lastAnchor.isEmpty())
+ return false;
+
+ lastAnchor = source().resolved(lastAnchor).toString();
+ if (lastAnchor.at(0) == QLatin1Char('#')) {
+ QString src = source().toString();
+ int hsh = src.indexOf(QLatin1Char('#'));
+ lastAnchor = (hsh>=0 ? src.left(hsh) : src) + lastAnchor;
+ }
+
+ return true;
+}
+
+void HelpViewer::contextMenuEvent(QContextMenuEvent *e)
+{
+ TRACE_OBJ
+ QMenu menu(QLatin1String(""), 0);
+
+ QUrl link;
+ QAction *copyAnchorAction = 0;
+ if (hasAnchorAt(e->pos())) {
+ link = anchorAt(e->pos());
+ if (link.isRelative())
+ link = source().resolved(link);
+ copyAnchorAction = menu.addAction(tr("Copy &Link Location"));
+ copyAnchorAction->setEnabled(!link.isEmpty() && link.isValid());
+
+ menu.addAction(tr("Open Link in New Tab\tCtrl+LMB"), this,
+ SLOT(openLinkInNewTab()));
+ menu.addSeparator();
+ }
+ menu.addActions(parentWidget->globalActions());
+ QAction *action = menu.exec(e->globalPos());
+ if (action == copyAnchorAction)
+ QApplication::clipboard()->setText(link.toString());
+}
+
+void HelpViewer::mouseReleaseEvent(QMouseEvent *e)
+{
+ TRACE_OBJ
+ if (e->button() == Qt::XButton1) {
+ QTextBrowser::backward();
+ return;
+ }
+
+ if (e->button() == Qt::XButton2) {
+ QTextBrowser::forward();
+ return;
+ }
+
+ controlPressed = e->modifiers() & Qt::ControlModifier;
+ if ((controlPressed && hasAnchorAt(e->pos())) ||
+ (e->button() == Qt::MidButton && hasAnchorAt(e->pos()))) {
+ openLinkInNewTab();
+ return;
+ }
+
+ QTextBrowser::mouseReleaseEvent(e);
+}
+
+void HelpViewer::keyPressEvent(QKeyEvent *e)
+{
+ TRACE_OBJ
+ if ((e->key() == Qt::Key_Home && e->modifiers() != Qt::NoModifier)
+ || (e->key() == Qt::Key_End && e->modifiers() != Qt::NoModifier)) {
+ QKeyEvent* event = new QKeyEvent(e->type(), e->key(), Qt::NoModifier,
+ e->text(), e->isAutoRepeat(), e->count());
+ e = event;
+ }
+ QTextBrowser::keyPressEvent(e);
+}
+
+void HelpViewer::home()
+{
+ TRACE_OBJ
+ setSource(helpEngine.homePage());
+}
+
+void HelpViewer::wheelEvent(QWheelEvent *e)
+{
+ TRACE_OBJ
+ if (e->modifiers() == Qt::ControlModifier) {
+ e->accept();
+ e->delta() > 0 ? scaleUp() : scaleDown();
+ } else {
+ QTextBrowser::wheelEvent(e);
+ }
+}
+
+bool HelpViewer::eventFilter(QObject *obj, QEvent *event)
+{
+ TRACE_OBJ
+ if (event->type() == QEvent::FontChange && !forceFont)
+ return true;
+ return QTextBrowser::eventFilter(obj, event);
+}
+
+QT_END_NAMESPACE
+
+#endif // QT_NO_WEBKIT
diff --git a/tools/assistant/tools/assistant/helpviewer_qtb.h b/tools/assistant/tools/assistant/helpviewer_qtb.h
new file mode 100644
index 0000000..e927b34
--- /dev/null
+++ b/tools/assistant/tools/assistant/helpviewer_qtb.h
@@ -0,0 +1,116 @@
+/****************************************************************************
+**
+** 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 Qt Assistant 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$
+**
+****************************************************************************/
+#if defined(QT_NO_WEBKIT)
+
+#ifndef HELPVIEWERQTB_H
+#define HELPVIEWERQTB_H
+
+#include "helpviewer.h"
+
+#include <QtCore/QUrl>
+#include <QtCore/QVariant>
+
+#include <QtGui/QTextBrowser>
+
+QT_BEGIN_NAMESPACE
+
+class CentralWidget;
+class HelpEngineWrapper;
+class QContextMenuEvent;
+class QKeyEvent;
+class QMouseEvent;
+
+class HelpViewer : public QTextBrowser, public AbstractHelpViewer
+{
+ Q_OBJECT
+
+public:
+ HelpViewer(CentralWidget *parent, qreal zoom = 0.0);
+ ~HelpViewer();
+
+ QFont viewerFont() const;
+ void setViewerFont(const QFont &font);
+
+ void scaleUp();
+ void scaleDown();
+ void resetScale();
+ qreal scale() const { return zoomCount; }
+
+ void setSource(const QUrl &url);
+
+ inline bool hasSelection() const
+ { return textCursor().hasSelection(); }
+
+ bool launchedWithExternalApp(const QUrl &url);
+
+public Q_SLOTS:
+ void home();
+
+protected:
+ void wheelEvent(QWheelEvent *e);
+ bool eventFilter(QObject *obj, QEvent *event);
+
+private:
+ QVariant loadResource(int type, const QUrl &name);
+ void openLinkInNewTab(const QString &link);
+ bool hasAnchorAt(const QPoint& pos);
+ void contextMenuEvent(QContextMenuEvent *e);
+ void mouseReleaseEvent(QMouseEvent *e);
+ void keyPressEvent(QKeyEvent *e);
+
+private slots:
+ void openLinkInNewTab();
+
+private:
+ int zoomCount;
+ bool controlPressed;
+ QString lastAnchor;
+ CentralWidget* parentWidget;
+ HelpEngineWrapper &helpEngine;
+
+ bool forceFont;
+};
+
+QT_END_NAMESPACE
+
+#endif // HELPVIEWERQTB_H
+
+#endif // QT_NO_WEBKIT
diff --git a/tools/assistant/tools/assistant/helpviewer_qwv.cpp b/tools/assistant/tools/assistant/helpviewer_qwv.cpp
new file mode 100644
index 0000000..4857e00
--- /dev/null
+++ b/tools/assistant/tools/assistant/helpviewer_qwv.cpp
@@ -0,0 +1,413 @@
+/****************************************************************************
+**
+** 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 Qt Assistant 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$
+**
+****************************************************************************/
+#if !defined(QT_NO_WEBKIT)
+
+#include "helpviewer_qwv.h"
+
+#include "centralwidget.h"
+#include "helpenginewrapper.h"
+#include "tracer.h"
+
+#include <QtCore/QFileInfo>
+#include <QtCore/QString>
+#include <QtCore/QStringBuilder>
+#include <QtCore/QTemporaryFile>
+#include <QtCore/QTimer>
+
+#include <QtGui/QDesktopServices>
+#include <QtGui/QWheelEvent>
+
+#include <QtNetwork/QNetworkAccessManager>
+#include <QtNetwork/QNetworkReply>
+#include <QtNetwork/QNetworkRequest>
+
+QT_BEGIN_NAMESPACE
+
+class HelpNetworkReply : public QNetworkReply
+{
+public:
+ HelpNetworkReply(const QNetworkRequest &request, const QByteArray &fileData,
+ const QString &mimeType);
+
+ virtual void abort();
+
+ virtual qint64 bytesAvailable() const
+ { return data.length() + QNetworkReply::bytesAvailable(); }
+
+protected:
+ virtual qint64 readData(char *data, qint64 maxlen);
+
+private:
+ QByteArray data;
+ qint64 origLen;
+};
+
+HelpNetworkReply::HelpNetworkReply(const QNetworkRequest &request,
+ const QByteArray &fileData, const QString& mimeType)
+ : data(fileData), origLen(fileData.length())
+{
+ TRACE_OBJ
+ setRequest(request);
+ setOpenMode(QIODevice::ReadOnly);
+
+ setHeader(QNetworkRequest::ContentTypeHeader, mimeType);
+ setHeader(QNetworkRequest::ContentLengthHeader, QByteArray::number(origLen));
+ QTimer::singleShot(0, this, SIGNAL(metaDataChanged()));
+ QTimer::singleShot(0, this, SIGNAL(readyRead()));
+}
+
+void HelpNetworkReply::abort()
+{
+ TRACE_OBJ
+}
+
+qint64 HelpNetworkReply::readData(char *buffer, qint64 maxlen)
+{
+ TRACE_OBJ
+ qint64 len = qMin(qint64(data.length()), maxlen);
+ if (len) {
+ qMemCopy(buffer, data.constData(), len);
+ data.remove(0, len);
+ }
+ if (!data.length())
+ QTimer::singleShot(0, this, SIGNAL(finished()));
+ return len;
+}
+
+class HelpNetworkAccessManager : public QNetworkAccessManager
+{
+public:
+ HelpNetworkAccessManager(QObject *parent);
+
+protected:
+ virtual QNetworkReply *createRequest(Operation op,
+ const QNetworkRequest &request, QIODevice *outgoingData = 0);
+};
+
+HelpNetworkAccessManager::HelpNetworkAccessManager(QObject *parent)
+ : QNetworkAccessManager(parent)
+{
+ TRACE_OBJ
+}
+
+QNetworkReply *HelpNetworkAccessManager::createRequest(Operation /*op*/,
+ const QNetworkRequest &request, QIODevice* /*outgoingData*/)
+{
+ TRACE_OBJ
+ const QUrl& url = request.url();
+ QString mimeType = url.toString();
+ if (mimeType.endsWith(QLatin1String(".svg"))
+ || mimeType.endsWith(QLatin1String(".svgz"))) {
+ mimeType = QLatin1String("image/svg+xml");
+ } else if (mimeType.endsWith(QLatin1String(".css"))) {
+ mimeType = QLatin1String("text/css");
+ } else if (mimeType.endsWith(QLatin1String(".js"))) {
+ mimeType = QLatin1String("text/javascript");
+ } else if (mimeType.endsWith(QLatin1String(".txt"))) {
+ mimeType = QLatin1String("text/plain");
+ } else {
+ mimeType = QLatin1String("text/html");
+ }
+
+ HelpEngineWrapper &helpEngine = HelpEngineWrapper::instance();
+ const QByteArray &data = helpEngine.findFile(url).isValid()
+ ? helpEngine.fileData(url)
+ : AbstractHelpViewer::PageNotFoundMessage.arg(url.toString()).toUtf8();
+ return new HelpNetworkReply(request, data, mimeType);
+}
+
+class HelpPage : public QWebPage
+{
+public:
+ HelpPage(CentralWidget *central, QObject *parent);
+
+protected:
+ virtual QWebPage *createWindow(QWebPage::WebWindowType);
+ virtual void triggerAction(WebAction action, bool checked = false);
+
+ virtual bool acceptNavigationRequest(QWebFrame *frame,
+ const QNetworkRequest &request, NavigationType type);
+
+private:
+ CentralWidget *centralWidget;
+ bool closeNewTabIfNeeded;
+
+ friend class HelpViewer;
+ Qt::MouseButtons m_pressedButtons;
+ Qt::KeyboardModifiers m_keyboardModifiers;
+};
+
+HelpPage::HelpPage(CentralWidget *central, QObject *parent)
+ : QWebPage(parent)
+ , centralWidget(central)
+ , closeNewTabIfNeeded(false)
+ , m_pressedButtons(Qt::NoButton)
+ , m_keyboardModifiers(Qt::NoModifier)
+{
+ TRACE_OBJ
+}
+
+QWebPage *HelpPage::createWindow(QWebPage::WebWindowType)
+{
+ TRACE_OBJ
+ HelpPage* newPage = static_cast<HelpPage*>(centralWidget->newEmptyTab()->page());
+ if (newPage)
+ newPage->closeNewTabIfNeeded = closeNewTabIfNeeded;
+ closeNewTabIfNeeded = false;
+ return newPage;
+}
+
+void HelpPage::triggerAction(WebAction action, bool checked)
+{
+ TRACE_OBJ
+ switch (action) {
+ case OpenLinkInNewWindow:
+ closeNewTabIfNeeded = true;
+ default: // fall through
+ QWebPage::triggerAction(action, checked);
+ break;
+ }
+}
+
+bool HelpPage::acceptNavigationRequest(QWebFrame *,
+ const QNetworkRequest &request, QWebPage::NavigationType type)
+{
+ TRACE_OBJ
+ const QUrl &url = request.url();
+ const bool closeNewTab = closeNewTabIfNeeded;
+ closeNewTabIfNeeded = false;
+
+ if (AbstractHelpViewer::isLocalUrl(url)) {
+ const QString& path = url.path();
+ if (!AbstractHelpViewer::canOpenPage(path)) {
+ QTemporaryFile tmpTmpFile;
+ if (!tmpTmpFile.open())
+ return false;
+ const QString &extension = QFileInfo(path).completeSuffix();
+ QFile actualTmpFile(tmpTmpFile.fileName() % QLatin1String(".")
+ % extension);
+ if (actualTmpFile.open(QIODevice::ReadWrite | QIODevice::Truncate)) {
+ actualTmpFile.write(HelpEngineWrapper::instance().fileData(url));
+ actualTmpFile.close();
+ QDesktopServices::openUrl(QUrl(actualTmpFile.fileName()));
+ }
+
+ if (closeNewTab)
+ QMetaObject::invokeMethod(CentralWidget::instance(), "closeTab");
+ return false;
+ }
+
+ if (type == QWebPage::NavigationTypeLinkClicked
+ && (m_keyboardModifiers & Qt::ControlModifier
+ || m_pressedButtons == Qt::MidButton)) {
+ HelpViewer* viewer = centralWidget->newEmptyTab();
+ if (viewer)
+ CentralWidget::instance()->setSource(url);
+ m_pressedButtons = Qt::NoButton;
+ m_keyboardModifiers = Qt::NoModifier;
+ return false;
+ }
+ return true;
+ }
+
+ QDesktopServices::openUrl(url);
+ return false;
+}
+
+// -- HelpViewer
+
+HelpViewer::HelpViewer(CentralWidget *parent, qreal zoom)
+ : QWebView(parent)
+ , parentWidget(parent)
+ , loadFinished(false)
+ , helpEngine(HelpEngineWrapper::instance())
+{
+ TRACE_OBJ
+ setAcceptDrops(false);
+
+ setPage(new HelpPage(parent, this));
+
+ page()->setNetworkAccessManager(new HelpNetworkAccessManager(this));
+
+ QAction* action = pageAction(QWebPage::OpenLinkInNewWindow);
+ action->setText(tr("Open Link in New Tab"));
+ if (!parent)
+ action->setVisible(false);
+
+ pageAction(QWebPage::DownloadLinkToDisk)->setVisible(false);
+ pageAction(QWebPage::DownloadImageToDisk)->setVisible(false);
+ pageAction(QWebPage::OpenImageInNewWindow)->setVisible(false);
+
+ connect(pageAction(QWebPage::Copy), SIGNAL(changed()), this,
+ SLOT(actionChanged()));
+ connect(pageAction(QWebPage::Back), SIGNAL(changed()), this,
+ SLOT(actionChanged()));
+ connect(pageAction(QWebPage::Forward), SIGNAL(changed()), this,
+ SLOT(actionChanged()));
+ connect(page(), SIGNAL(linkHovered(QString,QString,QString)), this,
+ SIGNAL(highlighted(QString)));
+ connect(this, SIGNAL(urlChanged(QUrl)), this, SIGNAL(sourceChanged(QUrl)));
+ connect(this, SIGNAL(loadFinished(bool)), this, SLOT(setLoadFinished(bool)));
+
+ setFont(viewerFont());
+ setTextSizeMultiplier(zoom == 0.0 ? 1.0 : zoom);
+}
+
+HelpViewer::~HelpViewer()
+{
+ TRACE_OBJ
+}
+
+QFont HelpViewer::viewerFont() const
+{
+ TRACE_OBJ
+ if (helpEngine.usesBrowserFont())
+ return helpEngine.browserFont();
+
+ QWebSettings *webSettings = QWebSettings::globalSettings();
+ return QFont(webSettings->fontFamily(QWebSettings::StandardFont),
+ webSettings->fontSize(QWebSettings::DefaultFontSize));
+}
+
+void HelpViewer::setViewerFont(const QFont &font)
+{
+ TRACE_OBJ
+ QWebSettings *webSettings = settings();
+ webSettings->setFontFamily(QWebSettings::StandardFont, font.family());
+ webSettings->setFontSize(QWebSettings::DefaultFontSize, font.pointSize());
+}
+
+void HelpViewer::scaleUp()
+{
+ TRACE_OBJ
+ setTextSizeMultiplier(textSizeMultiplier() + 0.1);
+}
+
+void HelpViewer::scaleDown()
+{
+ TRACE_OBJ
+ setTextSizeMultiplier(qMax(0.0, textSizeMultiplier() - 0.1));
+}
+
+void HelpViewer::resetScale()
+{
+ TRACE_OBJ
+ setTextSizeMultiplier(1.0);
+}
+
+void HelpViewer::setSource(const QUrl &url)
+{
+ TRACE_OBJ
+ loadFinished = false;
+ if (url.toString() == QLatin1String("help")) {
+ load(QUrl(QLatin1String("qthelp://com.trolltech.com."
+ "assistantinternal-1.0.0/assistant/assistant.html")));
+ } else {
+ load(url);
+ }
+}
+
+void HelpViewer::home()
+{
+ TRACE_OBJ
+ setSource(helpEngine.homePage());
+}
+
+void HelpViewer::wheelEvent(QWheelEvent *e)
+{
+ TRACE_OBJ
+ if (e->modifiers()& Qt::ControlModifier) {
+ e->accept();
+ e->delta() > 0 ? scaleUp() : scaleDown();
+ } else {
+ QWebView::wheelEvent(e);
+ }
+}
+
+void HelpViewer::mouseReleaseEvent(QMouseEvent *e)
+{
+ TRACE_OBJ
+ if (e->button() == Qt::XButton1) {
+ triggerPageAction(QWebPage::Back);
+ return;
+ }
+
+ if (e->button() == Qt::XButton2) {
+ triggerPageAction(QWebPage::Forward);
+ return;
+ }
+
+ QWebView::mouseReleaseEvent(e);
+}
+
+void HelpViewer::actionChanged()
+{
+ TRACE_OBJ
+ QAction *a = qobject_cast<QAction *>(sender());
+ if (a == pageAction(QWebPage::Copy))
+ emit copyAvailable(a->isEnabled());
+ else if (a == pageAction(QWebPage::Back))
+ emit backwardAvailable(a->isEnabled());
+ else if (a == pageAction(QWebPage::Forward))
+ emit forwardAvailable(a->isEnabled());
+}
+
+void HelpViewer::mousePressEvent(QMouseEvent *event)
+{
+ TRACE_OBJ
+ HelpPage *currentPage = static_cast<HelpPage*>(page());
+ if (currentPage) {
+ currentPage->m_pressedButtons = event->buttons();
+ currentPage->m_keyboardModifiers = event->modifiers();
+ }
+ QWebView::mousePressEvent(event);
+}
+
+void HelpViewer::setLoadFinished(bool ok)
+{
+ TRACE_OBJ
+ loadFinished = ok;
+ emit sourceChanged(url());
+}
+
+QT_END_NAMESPACE
+
+#endif // !QT_NO_WEBKIT
diff --git a/tools/assistant/tools/assistant/helpviewer_qwv.h b/tools/assistant/tools/assistant/helpviewer_qwv.h
new file mode 100644
index 0000000..3f2e537
--- /dev/null
+++ b/tools/assistant/tools/assistant/helpviewer_qwv.h
@@ -0,0 +1,122 @@
+/****************************************************************************
+**
+** 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 Qt Assistant 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$
+**
+****************************************************************************/
+#if !defined(QT_NO_WEBKIT)
+
+#ifndef HELPVIEWERQWV_H
+#define HELPVIEWERQWV_H
+
+#include "helpviewer.h"
+
+#include <QtGui/QAction>
+#include <QtWebKit/QWebView>
+
+QT_BEGIN_NAMESPACE
+
+class CentralWidget;
+class HelpEngineWrapper;
+class QMouseEvent;
+
+class HelpViewer : public QWebView, public AbstractHelpViewer
+{
+ Q_OBJECT
+
+public:
+ HelpViewer(CentralWidget *parent, qreal zoom = 0.0);
+ ~HelpViewer();
+
+ QFont viewerFont() const;
+ void setViewerFont(const QFont &font);
+
+ void scaleUp();
+ void scaleDown();
+ void resetScale();
+ qreal scale() const { return textSizeMultiplier(); }
+
+ void setSource(const QUrl &url);
+ inline QUrl source() const { return url(); }
+
+ inline QString documentTitle() const
+ { return title(); }
+
+ inline bool hasSelection() const
+ { return !selectedText().isEmpty(); } // ### this is suboptimal
+
+ inline void copy()
+ { return triggerPageAction(QWebPage::Copy); }
+
+ inline bool isForwardAvailable() const
+ { return pageAction(QWebPage::Forward)->isEnabled(); }
+ inline bool isBackwardAvailable() const
+ { return pageAction(QWebPage::Back)->isEnabled(); }
+ inline bool hasLoadFinished() const
+ { return loadFinished; }
+
+public Q_SLOTS:
+ void home();
+ void backward() { back(); }
+
+Q_SIGNALS:
+ void copyAvailable(bool enabled);
+ void forwardAvailable(bool enabled);
+ void backwardAvailable(bool enabled);
+ void highlighted(const QString &);
+ void sourceChanged(const QUrl &);
+
+protected:
+ virtual void wheelEvent(QWheelEvent *);
+ void mouseReleaseEvent(QMouseEvent *e);
+ void mousePressEvent(QMouseEvent *event);
+
+private Q_SLOTS:
+ void actionChanged();
+ void setLoadFinished(bool ok);
+
+private:
+ CentralWidget* parentWidget;
+ bool loadFinished;
+ HelpEngineWrapper &helpEngine;
+};
+
+QT_END_NAMESPACE
+
+#endif // HELPVIEWERQWV_H
+
+#endif // !QT_NO_WEBKIT
diff --git a/tools/assistant/tools/assistant/indexwindow.cpp b/tools/assistant/tools/assistant/indexwindow.cpp
index 82242e5..63ddbe4 100644
--- a/tools/assistant/tools/assistant/indexwindow.cpp
+++ b/tools/assistant/tools/assistant/indexwindow.cpp
@@ -219,7 +219,7 @@ void IndexWindow::open(QHelpIndexWidget* indexWidget, const QModelIndex &index)
return;
}
- if (!HelpViewer::canOpenPage(url.path()))
+ if (!AbstractHelpViewer::canOpenPage(url.path()))
CentralWidget::instance()->setSource(url);
else
CentralWidget::instance()->setSourceInNewTab(url);
diff --git a/tools/assistant/tools/assistant/mainwindow.cpp b/tools/assistant/tools/assistant/mainwindow.cpp
index 2ff6b5e..8096218 100644
--- a/tools/assistant/tools/assistant/mainwindow.cpp
+++ b/tools/assistant/tools/assistant/mainwindow.cpp
@@ -44,7 +44,6 @@
#include "bookmarkmanager.h"
#include "centralwidget.h"
-#include "helpviewer.h"
#include "indexwindow.h"
#include "topicchooser.h"
#include "contentwindow.h"
@@ -355,8 +354,6 @@ void MainWindow::lookForNewQtDocumentation()
void MainWindow::qtDocumentationInstalled(bool newDocsInstalled)
{
TRACE_OBJ
- if (newDocsInstalled)
- HelpEngineWrapper::instance().setupData();
statusBar()->clearMessage();
checkInitState();
}
@@ -384,6 +381,7 @@ void MainWindow::checkInitState()
}
emit initDone();
}
+ HelpEngineWrapper::instance().initialDocSetupDone();
}
void MainWindow::insertLastPages()
@@ -760,12 +758,10 @@ void MainWindow::showPreferences()
{
TRACE_OBJ
PreferencesDialog dia(this);
-
connect(&dia, SIGNAL(updateApplicationFont()), this,
SLOT(updateApplicationFont()));
connect(&dia, SIGNAL(updateBrowserFont()), m_centralWidget,
SLOT(updateBrowserFont()));
-
dia.showDialog();
}
@@ -970,7 +966,9 @@ void MainWindow::updateApplicationFont()
if (helpEngine.usesAppFont())
font = helpEngine.appFont();
- qApp->setFont(font, "QWidget");
+ const QWidgetList &widgets = qApp->allWidgets();
+ foreach (QWidget* widget, widgets)
+ widget->setFont(font);
}
void MainWindow::setupFilterCombo()
diff --git a/tools/assistant/tools/assistant/preferencesdialog.cpp b/tools/assistant/tools/assistant/preferencesdialog.cpp
index f0ef054..0e1d719 100644
--- a/tools/assistant/tools/assistant/preferencesdialog.cpp
+++ b/tools/assistant/tools/assistant/preferencesdialog.cpp
@@ -38,26 +38,24 @@
** $QT_END_LICENSE$
**
****************************************************************************/
-#include "tracer.h"
-
#include "preferencesdialog.h"
+
+#include "centralwidget.h"
#include "filternamedialog.h"
-#include "installdialog.h"
#include "fontpanel.h"
-#include "centralwidget.h"
-#include "aboutdialog.h"
#include "helpenginewrapper.h"
+#include "installdialog.h"
+#include "tracer.h"
#include <QtCore/QtAlgorithms>
#include <QtCore/QFileSystemWatcher>
-#include <QtGui/QHeaderView>
+#include <QtGui/QDesktopWidget>
#include <QtGui/QFileDialog>
-#include <QtGui/QMessageBox>
-#include <QtGui/QMenu>
#include <QtGui/QFontDatabase>
-#include <QtGui/QApplication>
-#include <QtGui/QDesktopWidget>
+#include <QtGui/QHeaderView>
+#include <QtGui/QMenu>
+#include <QtGui/QMessageBox>
#include <QtHelp/QHelpEngineCore>
@@ -115,6 +113,9 @@ PreferencesDialog::PreferencesDialog(QWidget *parent)
updateFontSettingsPage();
updateOptionsPage();
+
+ if (helpEngine.usesAppFont())
+ setFont(helpEngine.appFont());
}
PreferencesDialog::~PreferencesDialog()
@@ -124,16 +125,13 @@ PreferencesDialog::~PreferencesDialog()
helpEngine.setAppFont(m_appFontPanel->selectedFont());
helpEngine.setUseAppFont(m_appFontPanel->isChecked());
helpEngine.setAppWritingSystem(m_appFontPanel->writingSystem());
+ emit updateApplicationFont();
}
if (m_browserFontChanged) {
helpEngine.setBrowserFont(m_browserFontPanel->selectedFont());
helpEngine.setUseBrowserFont(m_browserFontPanel->isChecked());
helpEngine.setBrowserWritingSystem(m_browserFontPanel->writingSystem());
- }
-
- if (m_appFontChanged || m_browserFontChanged) {
- emit updateApplicationFont();
emit updateBrowserFont();
}
diff --git a/tools/designer/src/components/formeditor/formeditor.pri b/tools/designer/src/components/formeditor/formeditor.pri
index bbe96d5..b1a9318 100644
--- a/tools/designer/src/components/formeditor/formeditor.pri
+++ b/tools/designer/src/components/formeditor/formeditor.pri
@@ -8,6 +8,7 @@ FORMS += $$PWD/deviceprofiledialog.ui \
$$PWD/templateoptionspage.ui
HEADERS += $$PWD/qdesigner_resource.h \
+ $$PWD/qdesignerundostack.h \
$$PWD/formwindow.h \
$$PWD/formwindow_widgetstack.h \
$$PWD/formwindow_dnditem.h \
@@ -41,6 +42,7 @@ HEADERS += $$PWD/qdesigner_resource.h \
$$PWD/templateoptionspage.h
SOURCES += $$PWD/qdesigner_resource.cpp \
+ $$PWD/qdesignerundostack.cpp \
$$PWD/formwindow.cpp \
$$PWD/formwindow_widgetstack.cpp \
$$PWD/formwindow_dnditem.cpp \
diff --git a/tools/designer/src/components/formeditor/formwindow.cpp b/tools/designer/src/components/formeditor/formwindow.cpp
index 3a7cd83..631ca7c 100644
--- a/tools/designer/src/components/formeditor/formwindow.cpp
+++ b/tools/designer/src/components/formeditor/formwindow.cpp
@@ -399,8 +399,7 @@ void FormWindow::setCursorToAll(const QCursor &c, QWidget *start)
void FormWindow::init()
{
if (FormWindowManager *manager = qobject_cast<FormWindowManager*> (core()->formWindowManager())) {
- m_commandHistory = new QUndoStack(this);
- manager->undoGroup()->addStack(m_commandHistory);
+ manager->undoGroup()->addStack(m_undoStack.qundoStack());
}
m_blockSelectionChanged = false;
@@ -429,9 +428,8 @@ void FormWindow::init()
m_mainContainer = 0;
m_currentWidget = 0;
- connect(m_commandHistory, SIGNAL(indexChanged(int)), this, SLOT(updateDirty()));
- connect(m_commandHistory, SIGNAL(indexChanged(int)), this, SIGNAL(changed()));
- connect(m_commandHistory, SIGNAL(indexChanged(int)), this, SLOT(checkSelection()));
+ connect(&m_undoStack, SIGNAL(changed()), this, SIGNAL(changed()));
+ connect(&m_undoStack, SIGNAL(changed()), this, SLOT(checkSelection()));
core()->metaDataBase()->add(this);
@@ -1227,14 +1225,14 @@ void FormWindow::insertWidget(QWidget *w, const QRect &rect, QWidget *container,
if (w->parentWidget() != container) {
ReparentWidgetCommand *cmd = new ReparentWidgetCommand(this);
cmd->init(w, container);
- m_commandHistory->push(cmd);
+ m_undoStack.push(cmd);
}
- m_commandHistory->push(geom_cmd);
+ m_undoStack.push(geom_cmd);
InsertWidgetCommand *cmd = new InsertWidgetCommand(this);
cmd->init(w, already_in_form);
- m_commandHistory->push(cmd);
+ m_undoStack.push(cmd);
endCommand();
@@ -1277,12 +1275,10 @@ void FormWindow::resizeWidget(QWidget *widget, const QRect &geometry)
Q_ASSERT(isDescendant(this, widget));
QRect r = geometry;
- if (m_lastIndex > m_commandHistory->index())
- m_lastIndex = -1;
SetPropertyCommand *cmd = new SetPropertyCommand(this);
cmd->init(widget, QLatin1String("geometry"), r);
cmd->setText(tr("Resize"));
- m_commandHistory->push(cmd);
+ m_undoStack.push(cmd);
}
void FormWindow::raiseChildSelections(QWidget *w)
@@ -1428,26 +1424,117 @@ int FormWindow::calcValue(int val, bool forward, bool snap, int snapOffset) cons
return (forward ? val + 1 : val - 1);
}
-QRect FormWindow::applyValue(const QRect &rect, int val, int key, bool size) const
+// ArrowKeyOperation: Stores a keyboard move or resize (Shift pressed)
+// operation.
+struct ArrowKeyOperation {
+ ArrowKeyOperation() : resize(false), distance(0), arrowKey(Qt::Key_Left) {}
+
+ QRect apply(const QRect &in) const;
+
+ bool resize; // Resize: Shift-Key->drag bottom/right corner, else just move
+ int distance;
+ int arrowKey;
+};
+
+QRect ArrowKeyOperation::apply(const QRect &rect) const
{
QRect r = rect;
- if (size) {
- if (key == Qt::Key_Left || key == Qt::Key_Right)
- r.setWidth(val);
+ if (resize) {
+ if (arrowKey == Qt::Key_Left || arrowKey == Qt::Key_Right)
+ r.setWidth(r.width() + distance);
else
- r.setHeight(val);
+ r.setHeight(r.height() + distance);
} else {
- if (key == Qt::Key_Left || key == Qt::Key_Right)
- r.moveLeft(val);
+ if (arrowKey == Qt::Key_Left || arrowKey == Qt::Key_Right)
+ r.moveLeft(r.x() + distance);
else
- r.moveTop(val);
+ r.moveTop(r.y() + distance);
}
return r;
}
+QDebug operator<<(QDebug in, const ArrowKeyOperation &op)
+{
+ in.nospace() << "Resize=" << op.resize << " dist=" << op.distance << " Key=" << op.arrowKey << ' ';
+ return in;
+}
+
+// ArrowKeyPropertyHelper: Applies a struct ArrowKeyOperation
+// (stored as new value) to a list of widgets using to calculate the
+// changed geometry of the widget in setValue(). Thus, the 'newValue'
+// of the property command is the relative move distance, which is the same
+// for all widgets (although resulting in different geometries for the widgets).
+// The command merging can then work as it would when applying the same text
+// to all QLabels.
+
+class ArrowKeyPropertyHelper : public PropertyHelper {
+public:
+ ArrowKeyPropertyHelper(QObject* o, SpecialProperty sp,
+ QDesignerPropertySheetExtension *s, int i) :
+ PropertyHelper(o, sp, s, i) {}
+
+ virtual Value setValue(QDesignerFormWindowInterface *fw, const QVariant &value, bool changed, unsigned subPropertyMask);
+};
+
+PropertyHelper::Value ArrowKeyPropertyHelper::setValue(QDesignerFormWindowInterface *fw, const QVariant &value, bool changed, unsigned subPropertyMask)
+{
+ // Apply operation to obtain the new geometry value.
+ QWidget *w = qobject_cast<QWidget*>(object());
+ const ArrowKeyOperation operation = qvariant_cast<ArrowKeyOperation>(value);
+ const QRect newGeom = operation.apply(w->geometry());
+ return PropertyHelper::setValue(fw, QVariant(newGeom), changed, subPropertyMask);
+}
+
+// ArrowKeyPropertyCommand: Helper factory overwritten to create
+// ArrowKeyPropertyHelper and a merge operation that merges values of
+// the same direction.
+class ArrowKeyPropertyCommand: public SetPropertyCommand {
+public:
+ explicit ArrowKeyPropertyCommand(QDesignerFormWindowInterface *fw,
+ QUndoCommand *p = 0);
+
+ void init(QWidgetList &l, const ArrowKeyOperation &op);
+
+protected:
+ virtual PropertyHelper *createPropertyHelper(QObject *o, SpecialProperty sp,
+ QDesignerPropertySheetExtension *s, int i) const
+ { return new ArrowKeyPropertyHelper(o, sp, s, i); }
+ virtual QVariant mergeValue(const QVariant &newValue);
+};
+
+ArrowKeyPropertyCommand::ArrowKeyPropertyCommand(QDesignerFormWindowInterface *fw,
+ QUndoCommand *p) :
+ SetPropertyCommand(fw, p)
+{
+ static const int mid = qRegisterMetaType<qdesigner_internal::ArrowKeyOperation>();
+ Q_UNUSED(mid)
+}
+
+void ArrowKeyPropertyCommand::init(QWidgetList &l, const ArrowKeyOperation &op)
+{
+ QObjectList ol;
+ foreach(QWidget *w, l)
+ ol.push_back(w);
+ SetPropertyCommand::init(ol, QLatin1String("geometry"), qVariantFromValue(op));
+
+ setText(op.resize ? FormWindow::tr("Key Resize") : FormWindow::tr("Key Move"));
+}
+
+QVariant ArrowKeyPropertyCommand::mergeValue(const QVariant &newMergeValue)
+{
+ // Merge move operations of the same arrow key
+ if (!qVariantCanConvert<ArrowKeyOperation>(newMergeValue))
+ return QVariant();
+ ArrowKeyOperation mergedOperation = qvariant_cast<ArrowKeyOperation>(newValue());
+ const ArrowKeyOperation newMergeOperation = qvariant_cast<ArrowKeyOperation>(newMergeValue);
+ if (mergedOperation.resize != newMergeOperation.resize || mergedOperation.arrowKey != newMergeOperation.arrowKey)
+ return QVariant();
+ mergedOperation.distance += newMergeOperation.distance;
+ return qVariantFromValue(mergedOperation);
+}
+
void FormWindow::handleArrowKeyEvent(int key, Qt::KeyboardModifiers modifiers)
{
- bool startMacro = false;
const QDesignerFormWindowCursorInterface *c = cursor();
if (!c->hasSelection())
return;
@@ -1480,57 +1567,14 @@ void FormWindow::handleArrowKeyEvent(int key, Qt::KeyboardModifiers modifiers)
const int newValue = calcValue(oldValue, forward, snap, snapPoint);
- const int offset = newValue - oldValue;
-
- const int selCount = selection.count();
- // check if selection is the same as last time
- if (selCount != m_moveSelection.count() ||
- m_lastUndoIndex != m_commandHistory->index()) {
- m_moveSelection.clear();
- startMacro = true;
- } else {
- for (int index = 0; index < selCount; ++index) {
- if (m_moveSelection[index]->object() != selection.at(index)) {
- m_moveSelection.clear();
- startMacro = true;
- break;
- }
- }
- }
-
- if (startMacro)
- beginCommand(tr("Key Move"));
-
- for (int index = 0; index < selCount; ++index) {
- QWidget *w = selection.at(index);
- const QRect oldGeom = w->geometry();
- const QRect geom = applyValue(oldGeom, getValue(oldGeom, key, size) + offset, key, size);
-
- SetPropertyCommand *cmd = 0;
-
- if (m_moveSelection.count() > index)
- cmd = m_moveSelection[index];
-
- if (!cmd) {
- cmd = new SetPropertyCommand(this);
- cmd->init(w, QLatin1String("geometry"), geom);
- cmd->setText(tr("Key Move"));
- m_commandHistory->push(cmd);
+ ArrowKeyOperation operation;
+ operation.resize = modifiers & Qt::ShiftModifier;
+ operation.distance = newValue - oldValue;
+ operation.arrowKey = key;
- if (m_moveSelection.count() > index)
- m_moveSelection.replace(index, cmd);
- else
- m_moveSelection.append(cmd);
- } else {
- cmd->setNewValue(geom);
- cmd->redo();
- }
- }
-
- if (startMacro) {
- endCommand();
- m_lastUndoIndex = m_commandHistory->index();
- }
+ ArrowKeyPropertyCommand *cmd = new ArrowKeyPropertyCommand(this);
+ cmd->init(selection, operation);
+ m_undoStack.push(cmd);
}
bool FormWindow::handleKeyReleaseEvent(QWidget *, QWidget *, QKeyEvent *e)
@@ -1809,7 +1853,7 @@ void FormWindow::paste(PasteMode pasteMode)
foreach (QWidget *w, clipboard.m_widgets) {
InsertWidgetCommand *cmd = new InsertWidgetCommand(this);
cmd->init(w);
- m_commandHistory->push(cmd);
+ m_undoStack.push(cmd);
selectWidget(w);
}
}
@@ -1819,7 +1863,7 @@ void FormWindow::paste(PasteMode pasteMode)
ensureUniqueObjectName(a);
AddActionCommand *cmd = new AddActionCommand(this);
cmd->init(a);
- m_commandHistory->push(cmd);
+ m_undoStack.push(cmd);
}
endCommand();
} while (false);
@@ -1955,14 +1999,12 @@ void FormWindow::breakLayout(QWidget *w)
void FormWindow::beginCommand(const QString &description)
{
- if (m_lastIndex > m_commandHistory->index())
- m_lastIndex = -1;
- m_commandHistory->beginMacro(description);
+ m_undoStack.beginMacro(description);
}
void FormWindow::endCommand()
{
- m_commandHistory->endMacro();
+ m_undoStack.endMacro();
}
void FormWindow::raiseWidgets()
@@ -1977,7 +2019,7 @@ void FormWindow::raiseWidgets()
foreach (QWidget *widget, widgets) {
RaiseWidgetCommand *cmd = new RaiseWidgetCommand(this);
cmd->init(widget);
- m_commandHistory->push(cmd);
+ m_undoStack.push(cmd);
}
endCommand();
}
@@ -1994,7 +2036,7 @@ void FormWindow::lowerWidgets()
foreach (QWidget *widget, widgets) {
LowerWidgetCommand *cmd = new LowerWidgetCommand(this);
cmd->init(widget);
- m_commandHistory->push(cmd);
+ m_undoStack.push(cmd);
}
endCommand();
}
@@ -2375,20 +2417,12 @@ FormWindow *FormWindow::findFormWindow(QWidget *w)
bool FormWindow::isDirty() const
{
- return m_dirty;
+ return m_undoStack.isDirty();
}
void FormWindow::setDirty(bool dirty)
{
- m_dirty = dirty;
-
- if (!m_dirty)
- m_lastIndex = m_commandHistory->index();
-}
-
-void FormWindow::updateDirty()
-{
- m_dirty = m_commandHistory->index() != m_lastIndex;
+ m_undoStack.setDirty(dirty);
}
QWidget *FormWindow::containerAt(const QPoint &pos)
@@ -2757,7 +2791,7 @@ bool FormWindow::dropDockWidget(QDesignerDnDItemInterface *item, const QPoint &g
qVariantSetValue(v, e);
SetPropertyCommand *cmd = new SetPropertyCommand(this);
cmd->init(widget, dockWidgetAreaName, v);
- m_commandHistory->push(cmd);
+ m_undoStack.push(cmd);
}
endCommand();
@@ -2921,6 +2955,13 @@ QWidget *FormWindow::formContainer() const
return m_widgetStack->formContainer();
}
+QUndoStack *FormWindow::commandHistory() const
+{
+ return const_cast<QDesignerUndoStack &>(m_undoStack).qundoStack();
+}
+
} // namespace
QT_END_NAMESPACE
+
+Q_DECLARE_METATYPE(qdesigner_internal::ArrowKeyOperation)
diff --git a/tools/designer/src/components/formeditor/formwindow.h b/tools/designer/src/components/formeditor/formwindow.h
index 3eee476..dc0026f 100644
--- a/tools/designer/src/components/formeditor/formwindow.h
+++ b/tools/designer/src/components/formeditor/formwindow.h
@@ -43,6 +43,7 @@
#define FORMWINDOW_H
#include "formeditor_global.h"
+#include "qdesignerundostack.h"
#include <formwindowbase_p.h>
// Qt
@@ -64,7 +65,6 @@ class QLabel;
class QTimer;
class QAction;
class QMenu;
-class QUndoStack;
class QRubberBand;
namespace qdesigner_internal {
@@ -165,9 +165,7 @@ public:
void manageWidget(QWidget *w);
void unmanageWidget(QWidget *w);
- inline QUndoStack *commandHistory() const
- { return m_commandHistory; }
-
+ virtual QUndoStack *commandHistory() const;
void beginCommand(const QString &description);
void endCommand();
@@ -238,7 +236,6 @@ protected:
private slots:
void selectionChangedTimerDone();
- void updateDirty();
void checkSelection();
void checkSelectionNow();
void slotSelectWidget(QAction *);
@@ -263,7 +260,6 @@ private:
int getValue(const QRect &rect, int key, bool size) const;
int calcValue(int val, bool forward, bool snap, int snapOffset) const;
- QRect applyValue(const QRect &rect, int val, int key, bool size) const;
void handleClickSelection(QWidget *managedWidget, unsigned mouseFlags);
bool frameNeeded(QWidget *w) const;
@@ -338,7 +334,7 @@ private:
QPoint m_startPos;
- QUndoStack *m_commandHistory;
+ QDesignerUndoStack m_undoStack;
QString m_fileName;
@@ -352,9 +348,6 @@ private:
QTimer *m_checkSelectionTimer;
QTimer *m_geometryChangedTimer;
- int m_dirty;
- int m_lastIndex;
-
FormWindowWidgetStack *m_widgetStack;
WidgetEditorTool *m_widgetEditor;
@@ -368,8 +361,6 @@ private:
QString m_exportMacro;
QStringList m_includeHints;
- QList<SetPropertyCommand*> m_moveSelection;
- int m_lastUndoIndex;
QPoint m_contextMenuPosition;
private:
diff --git a/tools/designer/src/components/formeditor/qdesignerundostack.cpp b/tools/designer/src/components/formeditor/qdesignerundostack.cpp
new file mode 100644
index 0000000..007031d
--- /dev/null
+++ b/tools/designer/src/components/formeditor/qdesignerundostack.cpp
@@ -0,0 +1,112 @@
+/****************************************************************************
+**
+** 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 Qt Designer 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 "qdesignerundostack.h"
+
+#include <QtGui/QUndoStack>
+#include <QtGui/QUndoCommand>
+
+QT_BEGIN_NAMESPACE
+
+namespace qdesigner_internal {
+
+QDesignerUndoStack::QDesignerUndoStack(QObject *parent) :
+ QObject(parent),
+ m_undoStack(new QUndoStack),
+ m_fakeDirty(false)
+{
+ connect(m_undoStack, SIGNAL(indexChanged(int)), this, SIGNAL(changed()));
+}
+
+QDesignerUndoStack::~QDesignerUndoStack()
+{ // QUndoStack is managed by the QUndoGroup
+}
+
+void QDesignerUndoStack::push(QUndoCommand * cmd)
+{
+ m_undoStack->push(cmd);
+}
+
+void QDesignerUndoStack::beginMacro(const QString &text)
+{
+ m_undoStack->beginMacro(text);
+}
+
+void QDesignerUndoStack::endMacro()
+{
+ m_undoStack->endMacro();
+}
+
+int QDesignerUndoStack::index() const
+{
+ return m_undoStack->index();
+}
+
+const QUndoStack *QDesignerUndoStack::qundoStack() const
+{
+ return m_undoStack;
+}
+QUndoStack *QDesignerUndoStack::qundoStack()
+{
+ return m_undoStack;
+}
+
+bool QDesignerUndoStack::isDirty() const
+{
+ return m_fakeDirty || !m_undoStack->isClean();
+}
+
+void QDesignerUndoStack::setDirty(bool v)
+{
+ if (isDirty() == v)
+ return;
+ if (v) {
+ m_fakeDirty = true;
+ emit changed();
+ } else {
+ m_fakeDirty = false;
+ m_undoStack->setClean();
+ }
+}
+
+} // namespace qdesigner_internal
+
+QT_END_NAMESPACE
diff --git a/mkspecs/win32-msvc2002/qplatformdefs.h b/tools/designer/src/components/formeditor/qdesignerundostack.h
index 6d71abf..5451ad8 100644
--- a/mkspecs/win32-msvc2002/qplatformdefs.h
+++ b/tools/designer/src/components/formeditor/qdesignerundostack.h
@@ -4,7 +4,7 @@
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
-** This file is part of the qmake spec of the Qt Toolkit.
+** This file is part of the Qt Designer of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** No Commercial Usage
@@ -39,4 +39,52 @@
**
****************************************************************************/
-#include "../win32-msvc.net/qplatformdefs.h"
+#ifndef QDESIGNERUNDOSTACK_H
+#define QDESIGNERUNDOSTACK_H
+
+#include <QtCore/QObject>
+
+QT_BEGIN_NAMESPACE
+class QUndoStack;
+class QUndoCommand;
+
+namespace qdesigner_internal {
+
+/* QDesignerUndoStack: A QUndoStack extended by a way of setting it to
+ * "dirty" indepently of commands (by modifications without commands
+ * such as resizing). Accomplished via bool m_fakeDirty flag. The
+ * lifecycle of the QUndoStack is managed by the QUndoGroup. */
+class QDesignerUndoStack : public QObject
+{
+ Q_DISABLE_COPY(QDesignerUndoStack)
+ Q_OBJECT
+public:
+ explicit QDesignerUndoStack(QObject *parent = 0);
+ virtual ~QDesignerUndoStack();
+
+ void push(QUndoCommand * cmd);
+ void beginMacro(const QString &text);
+ void endMacro();
+ int index() const;
+
+ const QUndoStack *qundoStack() const;
+ QUndoStack *qundoStack();
+
+ bool isDirty() const;
+
+signals:
+ void changed();
+
+public slots:
+ void setDirty(bool);
+
+private:
+ QUndoStack *m_undoStack;
+ bool m_fakeDirty;
+};
+
+} // namespace qdesigner_internal
+
+QT_END_NAMESPACE
+
+#endif // QDESIGNERUNDOSTACK_H
diff --git a/tools/designer/src/lib/shared/qdesigner_formwindowcommand.cpp b/tools/designer/src/lib/shared/qdesigner_formwindowcommand.cpp
index 8c55d26..490373e 100644
--- a/tools/designer/src/lib/shared/qdesigner_formwindowcommand.cpp
+++ b/tools/designer/src/lib/shared/qdesigner_formwindowcommand.cpp
@@ -62,8 +62,10 @@ QT_BEGIN_NAMESPACE
namespace qdesigner_internal {
// ---- QDesignerFormWindowCommand ----
-QDesignerFormWindowCommand::QDesignerFormWindowCommand(const QString &description, QDesignerFormWindowInterface *formWindow)
- : QUndoCommand(description),
+QDesignerFormWindowCommand::QDesignerFormWindowCommand(const QString &description,
+ QDesignerFormWindowInterface *formWindow,
+ QUndoCommand *parent)
+ : QUndoCommand(description, parent),
m_formWindow(formWindow)
{
}
diff --git a/tools/designer/src/lib/shared/qdesigner_formwindowcommand_p.h b/tools/designer/src/lib/shared/qdesigner_formwindowcommand_p.h
index d8cd018..d73d70c 100644
--- a/tools/designer/src/lib/shared/qdesigner_formwindowcommand_p.h
+++ b/tools/designer/src/lib/shared/qdesigner_formwindowcommand_p.h
@@ -70,7 +70,9 @@ class QDESIGNER_SHARED_EXPORT QDesignerFormWindowCommand: public QUndoCommand
{
public:
- QDesignerFormWindowCommand(const QString &description, QDesignerFormWindowInterface *formWindow);
+ QDesignerFormWindowCommand(const QString &description,
+ QDesignerFormWindowInterface *formWindow,
+ QUndoCommand *parent = 0);
virtual void undo();
virtual void redo();
diff --git a/tools/designer/src/lib/shared/qdesigner_propertycommand.cpp b/tools/designer/src/lib/shared/qdesigner_propertycommand.cpp
index 822c14b..6cc054c 100644
--- a/tools/designer/src/lib/shared/qdesigner_propertycommand.cpp
+++ b/tools/designer/src/lib/shared/qdesigner_propertycommand.cpp
@@ -926,8 +926,9 @@ bool PropertyListCommand::PropertyDescription::equals(const PropertyDescription
// ---- PropertyListCommand
-PropertyListCommand::PropertyListCommand(QDesignerFormWindowInterface *formWindow) :
- QDesignerFormWindowCommand(QString(), formWindow)
+PropertyListCommand::PropertyListCommand(QDesignerFormWindowInterface *formWindow,
+ QUndoCommand *parent) :
+ QDesignerFormWindowCommand(QString(), formWindow, parent)
{
}
@@ -966,10 +967,17 @@ bool PropertyListCommand::add(QObject *object, const QString &propertyName)
if (!match || m_propertyDescription.m_specialProperty == SP_ObjectName)
return false;
}
- m_propertyHelperList.push_back(PropertyHelper(object, m_propertyDescription.m_specialProperty, sheet, index));
+
+ const PropertyHelperPtr ph(createPropertyHelper(object, m_propertyDescription.m_specialProperty, sheet, index));
+ m_propertyHelperList.push_back(ph);
return true;
}
+PropertyHelper *PropertyListCommand::createPropertyHelper(QObject *object, SpecialProperty sp,
+ QDesignerPropertySheetExtension *sheet, int sheetIndex) const
+{
+ return new PropertyHelper(object, sp, sheet, sheetIndex);
+}
// Init from a list and make sure referenceObject is added first to obtain the right property group
bool PropertyListCommand::initList(const ObjectList &list, const QString &apropertyName, QObject *referenceObject)
@@ -993,19 +1001,19 @@ bool PropertyListCommand::initList(const ObjectList &list, const QString &aprope
QObject* PropertyListCommand::object(int index) const
{
Q_ASSERT(index < m_propertyHelperList.size());
- return m_propertyHelperList[index].object();
+ return m_propertyHelperList.at(index)->object();
}
QVariant PropertyListCommand::oldValue(int index) const
{
Q_ASSERT(index < m_propertyHelperList.size());
- return m_propertyHelperList[index].oldValue();
+ return m_propertyHelperList.at(index)->oldValue();
}
void PropertyListCommand::setOldValue(const QVariant &oldValue, int index)
{
Q_ASSERT(index < m_propertyHelperList.size());
- m_propertyHelperList[index].setOldValue(oldValue);
+ m_propertyHelperList.at(index)->setOldValue(oldValue);
}
// ----- SetValueFunction: Set a new value when applied to a PropertyHelper.
class SetValueFunction {
@@ -1065,9 +1073,10 @@ template <class PropertyListIterator, class Function>
bool updatedPropertyEditor = false;
for (PropertyListIterator it = begin; it != end; ++it) {
- if (QObject* object = it->object()) { // Might have been deleted in the meantime
- const PropertyHelper::Value newValue = function(*it);
- updateMask |= it->updateMask();
+ PropertyHelper *ph = it->data();
+ if (QObject* object = ph->object()) { // Might have been deleted in the meantime
+ const PropertyHelper::Value newValue = function( *ph );
+ updateMask |= ph->updateMask();
// Update property editor if it is the current object
if (!updatedPropertyEditor && propertyEditor && object == propertyEditor->object()) {
propertyEditor->setPropertyValue(propertyName, newValue.first, newValue.second);
@@ -1084,9 +1093,11 @@ template <class PropertyListIterator, class Function>
unsigned PropertyListCommand::setValue(QVariant value, bool changed, unsigned subPropertyMask)
{
if(debugPropertyCommands)
- qDebug() << "PropertyListCommand::setValue(" << value << changed << subPropertyMask << ')';
+ qDebug() << "PropertyListCommand::setValue(" << value
+ << changed << subPropertyMask << ')';
return changePropertyList(formWindow()->core(),
- m_propertyDescription.m_propertyName, m_propertyHelperList.begin(), m_propertyHelperList.end(),
+ m_propertyDescription.m_propertyName,
+ m_propertyHelperList.begin(), m_propertyHelperList.end(),
SetValueFunction(formWindow(), PropertyHelper::Value(value, changed), subPropertyMask));
}
@@ -1146,15 +1157,16 @@ bool PropertyListCommand::canMergeLists(const PropertyHelperList& other) const
if (m_propertyHelperList.size() != other.size())
return false;
for (int i = 0; i < m_propertyHelperList.size(); i++) {
- if (!m_propertyHelperList[i].canMerge(other[i]))
+ if (!m_propertyHelperList.at(i)->canMerge(*other.at(i)))
return false;
}
return true;
}
// ---- SetPropertyCommand ----
-SetPropertyCommand::SetPropertyCommand(QDesignerFormWindowInterface *formWindow)
- : PropertyListCommand(formWindow),
+SetPropertyCommand::SetPropertyCommand(QDesignerFormWindowInterface *formWindow,
+ QUndoCommand *parent)
+ : PropertyListCommand(formWindow, parent),
m_subPropertyMask(SubPropertyAll)
{
}
@@ -1210,7 +1222,7 @@ unsigned SetPropertyCommand::subPropertyMask(const QVariant &newValue, QObject *
void SetPropertyCommand::setDescription()
{
if (propertyHelperList().size() == 1) {
- setText(QApplication::translate("Command", "Changed '%1' of '%2'").arg(propertyName()).arg(propertyHelperList()[0].object()->objectName()));
+ setText(QApplication::translate("Command", "Changed '%1' of '%2'").arg(propertyName()).arg(propertyHelperList().at(0)->object()->objectName()));
} else {
int count = propertyHelperList().size();
setText(QApplication::translate("Command", "Changed '%1' of %n objects", "", QCoreApplication::UnicodeUTF8, count).arg(propertyName()));
@@ -1231,6 +1243,11 @@ int SetPropertyCommand::id() const
return 1976;
}
+QVariant SetPropertyCommand::mergeValue(const QVariant &newValue)
+{
+ return newValue;
+}
+
bool SetPropertyCommand::mergeWith(const QUndoCommand *other)
{
if (id() != other->id() || !formWindow()->isDirty())
@@ -1248,7 +1265,10 @@ bool SetPropertyCommand::mergeWith(const QUndoCommand *other)
!canMergeLists(cmd->propertyHelperList()))
return false;
- m_newValue = cmd->newValue();
+ const QVariant newValue = mergeValue(cmd->newValue());
+ if (!newValue.isValid())
+ return false;
+ m_newValue = newValue;
m_subPropertyMask |= cmd->m_subPropertyMask;
if(debugPropertyCommands)
qDebug() << "SetPropertyCommand::mergeWith() succeeded " << propertyName();
@@ -1289,7 +1309,7 @@ bool ResetPropertyCommand::init(const ObjectList &list, const QString &aproperty
void ResetPropertyCommand::setDescription()
{
if (propertyHelperList().size() == 1) {
- setText(QApplication::translate("Command", "Reset '%1' of '%2'").arg(propertyName()).arg(propertyHelperList()[0].object()->objectName()));
+ setText(QApplication::translate("Command", "Reset '%1' of '%2'").arg(propertyName()).arg(propertyHelperList().at(0)->object()->objectName()));
} else {
int count = propertyHelperList().size();
setText(QApplication::translate("Command", "Reset '%1' of %n objects", "", QCoreApplication::UnicodeUTF8, count).arg(propertyName()));
diff --git a/tools/designer/src/lib/shared/qdesigner_propertycommand_p.h b/tools/designer/src/lib/shared/qdesigner_propertycommand_p.h
index f6b7262..75b23ca 100644
--- a/tools/designer/src/lib/shared/qdesigner_propertycommand_p.h
+++ b/tools/designer/src/lib/shared/qdesigner_propertycommand_p.h
@@ -58,6 +58,7 @@
#include <QtCore/QVariant>
#include <QtCore/QList>
#include <QtCore/QPair>
+#include <QtCore/QSharedPointer>
QT_BEGIN_NAMESPACE
@@ -77,11 +78,12 @@ enum SpecialProperty {
//Determine special property
enum SpecialProperty getSpecialProperty(const QString& propertyName);
-
// A helper class for applying properties to objects.
// Can be used for Set commands (setValue(), restoreOldValue()) or
// Reset Commands restoreDefaultValue(), restoreOldValue()).
-class PropertyHelper {
+//
+class QDESIGNER_SHARED_EXPORT PropertyHelper {
+ Q_DISABLE_COPY(PropertyHelper)
public:
// A pair of Value and changed flag
typedef QPair<QVariant, bool> Value;
@@ -92,11 +94,13 @@ public:
SpecialProperty specialProperty,
QDesignerPropertySheetExtension *sheet,
int index);
+ virtual ~PropertyHelper() {}
QObject *object() const { return m_object; }
SpecialProperty specialProperty() const { return m_specialProperty; }
- // set a new value
- Value setValue(QDesignerFormWindowInterface *fw, const QVariant &value, bool changed, unsigned subPropertyMask);
+ // set a new value. Can be overwritten to perform a transformation (see
+ // handling of Arrow key move in FormWindow class).
+ virtual Value setValue(QDesignerFormWindowInterface *fw, const QVariant &value, bool changed, unsigned subPropertyMask);
// restore old value
Value restoreOldValue(QDesignerFormWindowInterface *fw);
@@ -147,7 +151,7 @@ class QDESIGNER_SHARED_EXPORT PropertyListCommand : public QDesignerFormWindowCo
public:
typedef QList<QObject *> ObjectList;
- explicit PropertyListCommand(QDesignerFormWindowInterface *formWindow);
+ explicit PropertyListCommand(QDesignerFormWindowInterface *formWindow, QUndoCommand *parent = 0);
QObject* object(int index = 0) const;
@@ -159,8 +163,8 @@ public:
virtual void undo();
protected:
- typedef QList<PropertyHelper> PropertyHelperList;
-
+ typedef QSharedPointer<PropertyHelper> PropertyHelperPtr;
+ typedef QList<PropertyHelperPtr> PropertyHelperList;
// add an object
bool add(QObject *object, const QString &propertyName);
@@ -204,6 +208,10 @@ protected:
};
const PropertyDescription &propertyDescription() const { return m_propertyDescription; }
+protected:
+ virtual PropertyHelper *createPropertyHelper(QObject *o, SpecialProperty sp,
+ QDesignerPropertySheetExtension *sheet, int sheetIndex) const;
+
private:
PropertyDescription m_propertyDescription;
PropertyHelperList m_propertyHelperList;
@@ -215,7 +223,7 @@ class QDESIGNER_SHARED_EXPORT SetPropertyCommand: public PropertyListCommand
public:
typedef QList<QObject *> ObjectList;
- explicit SetPropertyCommand(QDesignerFormWindowInterface *formWindow);
+ explicit SetPropertyCommand(QDesignerFormWindowInterface *formWindow, QUndoCommand *parent = 0);
bool init(QObject *object, const QString &propertyName, const QVariant &newValue);
bool init(const ObjectList &list, const QString &propertyName, const QVariant &newValue,
@@ -232,6 +240,10 @@ public:
bool mergeWith(const QUndoCommand *other);
virtual void redo();
+
+protected:
+ virtual QVariant mergeValue(const QVariant &newValue);
+
private:
unsigned subPropertyMask(const QVariant &newValue, QObject *referenceObject);
void setDescription();
diff --git a/translations/translations.pri b/translations/translations.pri
index 808dc4f..a8fb7ee 100644
--- a/translations/translations.pri
+++ b/translations/translations.pri
@@ -25,6 +25,7 @@ ts-qt.commands = (cd $$QT_SOURCE_TREE/src && $$LUPDATE \
3rdparty/webkit \
activeqt \
corelib \
+ declarative \
gui \
multimedia \
network \