diff options
84 files changed, 941 insertions, 588 deletions
diff --git a/doc/config/qt-html-templates-online.qdocconf b/doc/config/qt-html-templates-online.qdocconf index b6ff0509fe..874a2c7229 100644 --- a/doc/config/qt-html-templates-online.qdocconf +++ b/doc/config/qt-html-templates-online.qdocconf @@ -96,8 +96,6 @@ HTML.postpostheader = \ " <div class=\"content mainContent\">\n" HTML.footer = \ - " <div class=\"feedback t_button\">\n" \ - " [+] Documentation Feedback</div>\n" \ " </div>\n" \ " </div>\n" \ " </div> \n" \ @@ -123,17 +121,6 @@ HTML.footer = \ " Free Documentation License version 1.3</a>\n" \ " as published by the Free Software Foundation.</p>\n" \ " </div>\n" \ - " <div id=\"feedbackBox\">\n" \ - " <div id=\"feedcloseX\" class=\"feedclose t_button\">X</div>\n" \ - " <form id=\"feedform\" action=\"http://doc.qt.nokia.com/docFeedbck/feedback.php\" method=\"get\">\n" \ - " <p id=\"noteHead\">Thank you for giving your feedback.</p> <p class=\"note\">Make sure it is related to this specific page. For more general bugs and \n" \ - " requests, please use the <a href=\"https://bugreports.qt.nokia.com/secure/Dashboard.jspa\">Qt Bug Tracker</a>.</p>\n" \ - " <p><textarea id=\"feedbox\" name=\"feedText\" rows=\"5\" cols=\"40\"></textarea></p>\n" \ - " <p><input id=\"feedsubmit\" class=\"feedclose\" type=\"submit\" name=\"feedback\" /></p>\n" \ - " </form>\n" \ - " </div>\n" \ - " <div id=\"blurpage\">\n" \ - " </div>\n" \ "\n" \ " <script src=\"scripts/functions.js\" type=\"text/javascript\"></script>\n" \ " <script type=\"text/javascript\">\n" \ diff --git a/doc/examples/batterystatus/BatteryStatus.pro b/doc/examples/batterystatus/BatteryStatus.pro index a5a6df68f1..c3c7792f57 100644 --- a/doc/examples/batterystatus/BatteryStatus.pro +++ b/doc/examples/batterystatus/BatteryStatus.pro @@ -1,40 +1,37 @@ -/*************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (info@qt.nokia.com) -** -** This file is part of the documentation of Qt Creator. -** -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor -** the names of its contributors may be used to endorse or promote -** products derived from this software without specific prior written -** permission. -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -****************************************************************************/ + +# Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +# All rights reserved. +# Contact: Nokia Corporation (info@qt.nokia.com) +# +# This file is part of the documentation of Qt Creator. +# +# You may use this file under the terms of the BSD license as follows: +# +# "Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +# the names of its contributors may be used to endorse or promote +# products derived from this software without specific prior written +# permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." # Add more folders to ship with the application, here folder_01.source = qml/BatteryStatus diff --git a/doc/examples/batterystatus/qml/BatteryStatus/MainPage.qml b/doc/examples/batterystatus/qml/BatteryStatus/MainPage.qml index 2959ad190a..df02829d0a 100644 --- a/doc/examples/batterystatus/qml/BatteryStatus/MainPage.qml +++ b/doc/examples/batterystatus/qml/BatteryStatus/MainPage.qml @@ -35,10 +35,14 @@ ** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." ** ****************************************************************************/ +//! [3] +import QtQuick 1.1 +import com.nokia.symbian 1.1 +//! [3] -import QtQuick 1.0 -import com.nokia.symbian 1.0 -import QtMobility.systeminfo 1.1 +//! [4] +import QtMobility.systeminfo 1.2 +//! [4] //! [0] Page { @@ -46,13 +50,7 @@ Page { DeviceInfo { id: deviceinfo - - Component.onCompleted: { - deviceinfo.startBatteryLevelChanged(); - } - onBatteryLevelChanged: { - progressbar1.value = batteryLevel - } + monitorBatteryLevelChanges: true } //! [0] diff --git a/doc/images/qtcreator-maemo-deb-package.png b/doc/images/qtcreator-maemo-deb-package.png Binary files differindex 8c4095a984..3e6c084b09 100644 --- a/doc/images/qtcreator-maemo-deb-package.png +++ b/doc/images/qtcreator-maemo-deb-package.png diff --git a/doc/images/qtcreator-maemo-deployment.png b/doc/images/qtcreator-maemo-deployment.png Binary files differindex ac3365fd16..9987311632 100644 --- a/doc/images/qtcreator-maemo-deployment.png +++ b/doc/images/qtcreator-maemo-deployment.png diff --git a/doc/images/qtcreator-screenshot-run-settings-maemo.png b/doc/images/qtcreator-screenshot-run-settings-maemo.png Binary files differindex 8290e96979..8fe3559da2 100644 --- a/doc/images/qtcreator-screenshot-run-settings-maemo.png +++ b/doc/images/qtcreator-screenshot-run-settings-maemo.png diff --git a/doc/src/linux-mobile/creator-deployment-madde.qdoc b/doc/src/linux-mobile/creator-deployment-madde.qdoc index f41c65fac4..de68233737 100644 --- a/doc/src/linux-mobile/creator-deployment-madde.qdoc +++ b/doc/src/linux-mobile/creator-deployment-madde.qdoc @@ -44,7 +44,9 @@ field displays the location of the file on the development PC. The \gui {Remote Directory} field displays the folder where the file is installed on the device. Text in red color indicates that the information is - missing. Select the red text to edit it and add the missing information. + missing. Edit the qmake + \l{http://doc.qt.nokia.com/4.8/qmake-variable-reference.html#installs} + {INSTALLS variable} in the project .pro file to add the missing files. You can use desktop files to display icons on the home screen of the device. To add desktop files to the project file, select \gui {Add Desktop @@ -55,8 +57,8 @@ If you develop your own libraries, \QC needs to be able to find them when you compile projects depending on them. When you install MADDE, an instance of the device file system, called sysroot, is installed to the development - PC. Libraries are copied to sysroot if the \gui {Also deploy to sysroot} - check box is selected. + PC. Libraries are copied to sysroot during the \gui {Install Debian package + to sysroot} step. \section1 Creating Debian Installation Packages diff --git a/doc/src/linux-mobile/meegodev.qdoc b/doc/src/linux-mobile/meegodev.qdoc index b3c0916c4c..19049a2261 100644 --- a/doc/src/linux-mobile/meegodev.qdoc +++ b/doc/src/linux-mobile/meegodev.qdoc @@ -23,7 +23,7 @@ \contentspage index.html \if defined(qcmanual) - \previouspage creator-build-dependencies.html + \previouspage creator-sharing-project-settings.html \else \previouspage creator-developing-symbian.html \endif diff --git a/doc/src/overview/creator-tech-support.qdoc b/doc/src/overview/creator-tech-support.qdoc index 36ab6e690f..73095bb7e3 100644 --- a/doc/src/overview/creator-tech-support.qdoc +++ b/doc/src/overview/creator-tech-support.qdoc @@ -35,6 +35,8 @@ The following table lists Qt support sites and other useful links. + + \table \header \o What Do You Want to Do @@ -62,6 +64,9 @@ \o Find free Qt-based applications \o \l{http://qt-apps.org/}{Qt Apps} + \note The \QC help browser does not allow you to download files, + and therefore, you must copy the following link to a browser: + http://qt-apps.org/ \row \o Buy commercial Qt support from Digia \o \l{http://qt.digia.com/}{Qt Commercial} diff --git a/doc/src/projects/creator-projects-settings-dependencies.qdoc b/doc/src/projects/creator-projects-settings-dependencies.qdoc index 58cf1b4338..e220fb72ee 100644 --- a/doc/src/projects/creator-projects-settings-dependencies.qdoc +++ b/doc/src/projects/creator-projects-settings-dependencies.qdoc @@ -29,7 +29,7 @@ \contentspage index.html \previouspage creator-code-style-settings.html \page creator-build-dependencies.html - \nextpage creator-developing-meego.html + \nextpage creator-sharing-project-settings.html \title Specifying Dependencies diff --git a/doc/src/projects/creator-projects-settings-sharing.qdoc b/doc/src/projects/creator-projects-settings-sharing.qdoc new file mode 100644 index 0000000000..d74446e568 --- /dev/null +++ b/doc/src/projects/creator-projects-settings-sharing.qdoc @@ -0,0 +1,91 @@ +/**************************************************************************** +** +** This file is part of Qt Creator +** +** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). +** +** Contact: Nokia Corporation (info@qt.nokia.com) +** +** +** GNU Free Documentation License +** +** Alternatively, this file may be used under the terms of the GNU Free +** Documentation License version 1.3 as published by the Free Software +** Foundation and appearing in the file included in the packaging of this +** file. +** +** If you have questions regarding the use of this file, please contact +** Nokia at info@qt.nokia.com. +** +****************************************************************************/ + +// ********************************************************************** +// NOTE: the sections are not ordered by their logical order to avoid +// reshuffling the file each time the index order changes (i.e., often). +// Run the fixnavi.pl script to adjust the links to the index order. +// ********************************************************************** + +/*! + \contentspage index.html + \previouspage creator-build-dependencies.html + \page creator-sharing-project-settings.html + \nextpage creator-developing-meego.html + + \title Sharing Project Settings + + \QC stores user-specific project settings in a .pro.user file. You can + share these settings between several projects as a .pro.shared file. It + has the same XML structure as a .pro.user file, but only contains the + settings to share. + + \section1 Creating Shared Settings File + + The easiest way to create a .pro.shared file is to copy settings from the + .pro.user file. Typically, you would share some of the values in the + \c ProjectExplorer.Project.EditorSettings section. + + \note You must always specify the + \c ProjectExplorer.Project.Updater.FileVersion variable and use the same + value for it as in the .pro.user file. + + You can then deliver the .pro.shared file to other developers or copy it to + other development PCs. + + The following is an example of a pro.shared file: + + \code + <?xml version="1.0" encoding="UTF-8"?> + <!DOCTYPE QtCreatorProject> + <qtcreator> + <data> + <variable>ProjectExplorer.Project.EditorSettings</variable> + <valuemap type="QVariantMap"> + <value type="bool" key="EditorConfiguration.SpacesForTabs">true</value> + <value type="bool" key="EditorConfiguration.AutoSpacesForTabs">false</value> + <value type="int" key="EditorConfiguration.TabSize">14</value> + <value type="int" key="EditorConfiguration.IndentSize">4</value> + </valuemap> + </data> + <data> + <variable>ProjectExplorer.Project.Updater.FileVersion</variable> + <value type="int">10</value> + </data> + </qtcreator> + \endcode + + \section1 Updating Shared Settings + + The first time \QC loads the project after you added pro.shared settings, + it overwrites the pro.user settings with them. If you open the project for + the first time and \QC has not created a .pro.user file, the settings in the + .pro.shared file take effect immediately. + + If you receive a .pro.shared file and do not want to use a particular + setting in it, you can change it. \QC marks it a \e sticky setting. The next + time you open a project, the setting is not updated. \QC tracks sticky + settings in the .pro.user file and removes the mark if the values in the + pro.user and pro.shared files eventually become identical. This is to avoid + a permanent sticky setting that was created just because you wanted to try + something out. + +*/ diff --git a/doc/src/projects/creator-projects-tool-chains.qdoc b/doc/src/projects/creator-projects-tool-chains.qdoc index 7d181a0563..5836cec2f2 100644 --- a/doc/src/projects/creator-projects-tool-chains.qdoc +++ b/doc/src/projects/creator-projects-tool-chains.qdoc @@ -104,7 +104,7 @@ \if defined(qcmanual) \o For RVCT, select the ARM version to use in the \gui {ARM version} - field. RVCT 2.2 is supported on Symbian^3 and earlier. RVCT 4.0 b902 + field. RVCT 2.2 is supported on Symbian Anna and earlier. RVCT 4.0 b902 or later is required for Symbian Belle. \endif diff --git a/doc/src/qtcreator.qdoc b/doc/src/qtcreator.qdoc index b057c39d85..602f6df918 100644 --- a/doc/src/qtcreator.qdoc +++ b/doc/src/qtcreator.qdoc @@ -78,6 +78,7 @@ \o \l{Specifying Editor Settings} \o \l{Specifying Code Style Settings} \o \l{Specifying Dependencies} + \o \l{Sharing Project Settings} \endlist \o \l{Connecting MeeGo Harmattan Devices} \o \l{Connecting Generic Linux Devices} diff --git a/doc/src/symbian/qtquick-components-symbian.qdoc b/doc/src/symbian/qtquick-components-symbian.qdoc index 93356939ec..bd0d9f7b5d 100644 --- a/doc/src/symbian/qtquick-components-symbian.qdoc +++ b/doc/src/symbian/qtquick-components-symbian.qdoc @@ -34,7 +34,7 @@ \title Creating a Qt Quick Application Using Qt Quick Components \note To complete this tutorial, you must install the Qt Quick Components - for Symbian and the Symbian^3 tool chain as part of the \QSDK. In addition, + for Symbian and the Symbian Anna target as part of the \QSDK. In addition, you must install the Qt Quick Components on the test device. This tutorial describes how to use Qt Creator to create a small Qt @@ -44,7 +44,7 @@ \image qtcreator-symbian-components-example.png "Mobile example" The user interface for the application is designed using Qt Quick Components - for Symbian. This enforces a platform look and feel for Symbian^3 devices. + for Symbian. This enforces a platform look and feel for Symbian Anna devices. \section1 Creating the Project @@ -59,7 +59,7 @@ For example, \c {C:\Qt\examples}, and then click \gui{Next}. \o In the \gui {Application Type} dialog, select \gui {Qt Quick - Components (Symbian Applications)}, and then click \gui{Next}. + Components for Symbian}, and then click \gui{Next}. \o Select \gui {Symbian Device} and \gui {Qt Simulator} targets, and then click \gui{Next}. @@ -83,7 +83,7 @@ Qt Creator generates the necessary files that contain boiler plate code. The wizard creates an application that uses - \l{http://doc.qt.nokia.com/qt-components-symbian-1.0/qt-components-pages-and-navigation-overview.html} + \l{http://doc.qt.nokia.com/qt-components-symbian/qt-components-pages-and-navigation-overview.html} {page-based application navigation}. Modify the files as described in the following sections. @@ -113,18 +113,13 @@ The wizard adds the import statements for Qt Quick and the Qt Quick Components for Symbian to the MainPage.qml file: - \code - import QtQuick 1.0 - import com.nokia.symbian 1.0 - \endcode + \snippet examples/batterystatus/qml/BatteryStatus/MainPage.qml 3 To use the Qt Mobility APIs, you must add the import statements for the Qt Mobility APIs that you use. This example uses the System Info API, so you must import it, as illustrated by the following code snippet: - \code - import QtMobility.systeminfo 1.1 - \endcode + \snippet examples/batterystatus/qml/BatteryStatus/MainPage.qml 4 Use the values as you can assign to MOBILITY also to construct import statements. @@ -182,13 +177,11 @@ \o Add an invisible \l{http://doc.qt.nokia.com/qtmobility/qml-deviceinfo.html} - {DeviceInfo element} that contains two signals. The - \l{http://doc.qt.nokia.com/4.7/qml-component.html#onCompleted-signal} - {onCompleted} signal starts battery level notification when the - component is initialized. The - \l{http://doc.qt.nokia.com/qtmobility/qml-deviceinfo.html#batteryLevelChanged-signal} - {batteryLevelChanged} signal is called when the battery level - changes. + {DeviceInfo element} that sets the + \l{http://doc.qt.nokia.com/qtmobility/qml-deviceinfo.html} + {monitorBatteryLevelChanges} property to true. It uses the + \c monitorBatteryLevelChanges signal to keep up with changes in the + battery level. \snippet examples/batterystatus/qml/BatteryStatus/MainPage.qml 0 diff --git a/doc/src/symbian/symbiandev.qdoc b/doc/src/symbian/symbiandev.qdoc index b62777923a..267f85b3ca 100644 --- a/doc/src/symbian/symbiandev.qdoc +++ b/doc/src/symbian/symbiandev.qdoc @@ -37,20 +37,25 @@ When you install \QSDK, the build and run settings for Symbian devices are set up automatically in \QC. You only need to install and launch - the CODA on-device debugging agent on the devices and connect the devices - to the development PC. + the \l{Using On-device Debugging Agents}{CODA on-device debugging agent} + on the devices and connect the devices to the development PC. - Make sure that PC Suite or Ovi Suite are installed on the development PC. + Make sure that \l{http://www.nokia.com/ovisuite}{Ovi Suite} or + \l{http://www.nokia.com/pcsuite}{PC Suite} is installed on the development PC. Connect the device to the development PC with an USB cable in - PC Suite or Ovi Suite Mode. If you have not previously used the device with - Ovi Suite + Ovi Suite or PC Suite Mode. This setting is in the device USB settings. + If you have not previously used the device with Ovi Suite or PC Suite, all the necessary drivers are installed automatically. This takes approximately one minute. You can run Qt applications on Symbian devices if the software that Qt applications require (typically Qt, Qt Mobility, QtWebkit, and Open C) is - installed on the device. On Symbian^3 and later devices, some version of Qt - is pre-installed. To deploy applications to earlier devices, you can package + installed on the device. On Symbian Anna and later devices, some version of Qt + is pre-installed. For more information, see + \l{http://developer.qt.nokia.com/wiki/Support_for_Symbian#4ebe3e7733f9c23c76ac25559fc814a1} + {Device Configurations}. + + To deploy applications to earlier devices, you can package the application with Nokia Smart Installer for Symbian to automatically install the modules that Qt applications require. For more information about which Qt modules are supported on-demand for different Symbian device @@ -58,19 +63,6 @@ \l{http://www.developer.nokia.com/Community/Wiki/Nokia_Smart_Installer_for_Symbian} {Nokia Smart Installer for Symbian}. - - - To run and debug applications on Symbian devices from \QC, you must - install the CODA on-device debugging agent on the device. For more - information, see - \if defined(qcmanual) - \l{Using On-device Debugging Agents}. - \else - \l{http://doc.qt.nokia.com/qtcreator/creator-developing-symbian.html#using-on-device-debugging-agents} - {Using On-device Debugging Agents}. - \endif - - The tool chain for building applications locally on the development PC for the \gui {Symbian Device} target is only supported on Windows. If you develop on Linux or Mac OS, you must use the Remote Compiler @@ -87,17 +79,17 @@ For more information about developing applications for the Symbian platform, select \gui {Help > Index} and look for \gui {Platform Notes}, or see - \l{http://doc.qt.nokia.com/4.7/platform-notes-symbian.html}{Platform Notes - Symbian}. - - \if defined(qcmanual) - To run your applications in the Symbian emulator, you also need - to install Carbide.c++ v2.0.0 or higher. - \endif + \l{http://doc.qt.nokia.com/4.8/platform-notes-symbian.html} + {Platform Notes - Symbian}. \section1 Using On-device Debugging Agents + To run and debug applications on Symbian devices from \QC, you must + install the CODA on-device debugging agent on the device. + Support for the App TRK on-device debugging agent has been removed from - \QC 2.3. Only CODA is supported. It offers the following benefits: + \QC 2.3. Only CODA is supported Qt SDK 1.1.3 onward. It offers the following + benefits: \list @@ -113,12 +105,10 @@ \section2 Installing Debugging Agents - CODA installation packages are delivered together with the \QSDK. On - Windows, you can use \gui Start menu commands to install CODA on Symbian - devices. - - You can also download CODA from the - \l{http://tools.ext.nokia.com/coda/}{CODA download server}. + The CODA installation package is delivered together with \QSDK. You can + find it in the \QSDK installation folder in the + \c{\Symbian\sis\<target>\CODA} folder. On Windows, you can use \gui Start + menu commands to install CODA on Symbian devices. \section1 Setting Up Qt Creator @@ -126,13 +116,21 @@ Symbian, the installed SDKs and their corresponding Qt versions are automatically detected. For each detected Symbian SDK with Qt, a special entry is made in the Qt version management settings in \gui{Tools} > - \gui{Options} > \gui{Qt4} > \gui{Qt Versions}. + \gui{Options} > \gui{Build & Run} > \gui{Qt Versions}. If you manually add a Qt version for Symbian, you must also manually specify the Symbian SDK to use for this version. For more information about adding Qt versions and tool chains, see + \if defined(qcmanual) \l{Setting Up Qt for Symbian Versions} and \l{Adding Tool Chains}. + \else + \l{http://doc.qt.nokia.com/qtcreator/creator-project-qmake.html#setting-up-qt-for-symbian-versions} + {Setting Up Qt for Symbian Versions} and + \l{http://doc.qt.nokia.com/qtcreator/creator-tool-chains.html} + {Adding Tool Chains}. + \endif + \section1 Building and Running Applications @@ -171,20 +169,25 @@ that applications that are built against Qt 4.6.3 also run on Qt 4.7.3. Similarly, applications that are supported on S60 5th Edition are also supported - on Symbian^3. However, dependencies, such as Qt Quick or Qt Mobility API + on Symbian Anna and Belle. However, dependencies, such as Qt Quick or Qt Mobility API versions might restrict the choice of Qt versions that you have. - In general, if you use only Qt 4.6 APIs in the application, you - can use \gui {Qt 4.6.3 for Symbian^1} to build it. - The application is supported on both Symbian^1 and Symbian^3 devices. + If you use Qt Quick in the application, you can use \gui {S60 5th Edition + Qt 4.7.3} to build it. The application is supported on both S60 5th Edition + and Symbian Anna and Belle devices. However, if you only target Symbian + Anna and Belle, you can use the state of art Qt in the \gui {Symbian Anna + Qt 4.7.4} target to build the application. This allows you to re-use the + application for MeeGo Harmattan devices. - If you use Qt Quick in the application, you can use \gui {Qt 4.7.3 for - Symbian^1} to build it. The application is supported on both Symbian^1 and - Symbian^3 devices. + If you want to use the native Symbian Belle APIs and make sure that the + application created for earlier Symbian platforms work on Belle as well, + use \gui {Symbian Belle Qt 4.7.4} to build them. You cannot run such + applications on Symbian Anna or earlier Symbian platforms. - \note The tool chains for developing applications for S60 3rd Edition - devices have been removed from \QSDK 1.1. To develop for these early - devices, use an earlier version of \QSDK. + \note The \QSDK only contains the latest tool chains available for + developing applications for a particular Symbian platform. The Qt 4.6.3 for + Symbian and Qt 4.7.3 for Symbian^3 and Symbian Anna targets have been + removed from \QSDK 1.1.4. To develop for those targets, use \QSDK 1.1.2. If you use native Symbian APIs, you must check that they are available on the target devices. For more information about the API differences between @@ -193,12 +196,10 @@ and which you can view in the \gui Help mode. You can use a set of ready-made UI components called Qt Quick Components - for Symbian that enforce a Nokia UI look and feel. - \omit - \note We recomment that you use Qt Quick Components version 1.1, because - they contain usability and other improvements. The same set of devices - supports both 1.0 and 1.1. - \endomit + for Symbian that enforce a Nokia UI look and feel. \QSDK updates the Qt + Quick Components to version 1.1 that contains usability and other + improvements. All devices that support Qt Quick Components for Symbian + support version 1.1. The following table summarizes the supported configurations for each Qt version available in \QC build settings: @@ -210,42 +211,102 @@ \i Qt Quick Components \i Qt Mobility Version \i Native Symbian C++ APIs - \i OpenGL + \i Qt OpenGL Support \row - \i Qt 4.6.3 for Symbian^1 (S60 5th Edition) - \i No + \i S60 5th Edition Qt 4.7.3 (online installer only) + \i 1.0 \i No - \i 1.0.2 + \i 1.1.3 \i No \i No \row - \i Qt 4.6.3 for Symbian^3 + \i Symbian Anna Qt 4.7.4 + \i 1.1 + \i 1.1 + \i 1.2 + \i Yes (Symbian Anna APIs) + \i Yes + \row + \i Symbian Belle Qt 4.7.4 + \i 1.1 + \i 1.1 + \i 1.2 + \i Yes (Symbian Belle APIs) + \i Yes + \endtable + + \section2 Developing Applications Using Qt 4.6.3 or Qt 4.7.3 for Symbian + + S60 3rd Edition devices support only Qt 4.6.3, not Qt 4.7 or later. Further, + support for the App TRK on-device debugging agent has been removed from + \QC 2.3. Only CODA is supported from Qt SDK 1.1.3 onward, and CODA does not + support S60 3rd Edition. Therefore, you can no longer run and debug + applications from \QC on S60 3rd Edition devices. + + The tool chains for developing applications using Qt 4.6.3 for Symbian + and Qt 4.7.3 for Symbian^ 3 and Symbian Anna have been removed from \QSDK + 1.1.4. To develop such applications, + \l{http://qt.nokia.com/downloads/downloads} + {download and use \QSDK version 1.1.2} instead. It contains Qt 4.6.3 for + Symbian and Qt 4.7.4 for Symbian support for Symbian devices with + the Application TRK debug agent. + + \note The \QSDK 1.1.2 and \QSDK 1.1.4 do not play well together. On Windows + and Linux, you must use separate user accounts to install them or install + them on separate development PCs. + + \note Do not update \QSDK 1.1.2 with the \QSDK update tool, because + the updater removes App TRK support and the older targets. + + In general, if you use only Qt 4.6 APIs in the application, you + can use \gui {S60 5th Edition Qt 4.6.3} to build it. The application is + supported on both S60 5th Edition and later devices. + + The following table summarizes the supported configurations for each Qt + version available in \QC build settings if you installed \QSDK 1.1.2. + + \table + \header + \i Qt Version + \i Qt Quick + \i Qt Quick Components + \i Qt Mobility Version + \i Native Symbian C++ APIs + \i Qt OpenGL Support + \row + \i Qt 4.6.3 for Symbian^1 (S60 5th Edition) \i No \i No \i 1.0.2 - \i Yes + \i No \i No \row - \i Qt 4.7.3 for Symbian^1 - \i 1.0 + \i Qt 4.6.3 for Symbian^3 \i No - \i 1.1.3 \i No + \i 1.0.2 + \i Yes (Symbian^3 APIs) \i No \row \i Qt 4.7.3 for Symbian^3 and Symbian Anna \i 1.0 - \i Yes \omit 1.0 \endomit + \i 1.0 \i 1.1.3 - \i Yes - \i Yes - \row - \i Qt 4.7.4 for Symbian Belle - \i 1.1 - \i Yes \omit 1.1 \endomit - \i 1.2 - \i Yes + \i Yes (Symbian Anna APIs) \i Yes \endtable + \section1 Advanced Development with Symbian SDK + + For normal Qt application development, \QSDK provides all you need even if + the application needs native Symbian OS API access. + + However, for more advanced Symbian application development, Nokia provides + the \l{http://www.developer.nokia.com/carbide_cpp}{Carbide C++ IDE} and + \l{http://www.developer.nokia.com/Resources/Tools_and_downloads/Other/Symbian_SDKs/} + {Symbian C++ SDKs}. You can use them also for Qt application development. + For example, these SDKs provide Symbian device emulators that are built + mostly from the software that the actual devices are running. Therefore, + they provide much closer emulation of the device than Qt Simulator. + */ diff --git a/doc/templates/scripts/functions.js b/doc/templates/scripts/functions.js index faa4ca4937..32cc901fe9 100644 --- a/doc/templates/scripts/functions.js +++ b/doc/templates/scripts/functions.js @@ -117,13 +117,8 @@ function processNokiaData(response){ var blankRE=/^\s*$/; function CheckEmptyAndLoadList() { - var pageUrl = window.location.href; - var pageVal = $('title').html(); $('#feedUrl').remove(); - $('#pageVal').remove(); $('.menuAlert').remove(); - $('#feedform').append('<input id="feedUrl" name="feedUrl" value="'+pageUrl+'" style="display:none;">'); - $('#feedform').append('<input id="pageVal" name="pageVal" value="'+pageVal+'" style="display:none;">'); $('.liveResult').remove(); $('.defaultLink').css('display','block'); var value = document.getElementById('pageType').value; diff --git a/src/libs/cplusplus/CppDocument.cpp b/src/libs/cplusplus/CppDocument.cpp index 0df7704e09..f8ff42ca9c 100644 --- a/src/libs/cplusplus/CppDocument.cpp +++ b/src/libs/cplusplus/CppDocument.cpp @@ -918,11 +918,11 @@ void CPlusPlus::findMatchingDeclaration(const LookupContext &context, return; foreach (Symbol *s, binding->symbols()) { - Class *matchingClass = s->asClass(); - if (!matchingClass) + Scope *scope = s->asScope(); + if (!scope) continue; - for (Symbol *s = matchingClass->find(funcId); s; s = s->next()) { + for (Symbol *s = scope->find(funcId); s; s = s->next()) { if (! s->name()) continue; else if (! funcId->isEqualTo(s->identifier())) diff --git a/src/libs/cplusplus/CppRewriter.cpp b/src/libs/cplusplus/CppRewriter.cpp index 8948b9297e..432f6bcbe4 100644 --- a/src/libs/cplusplus/CppRewriter.cpp +++ b/src/libs/cplusplus/CppRewriter.cpp @@ -387,18 +387,6 @@ UseMinimalNames::~UseMinimalNames() } -static bool symbolIdentical(Symbol *s1, Symbol *s2) -{ - if (!s1 || !s2) - return false; - if (s1->line() != s2->line()) - return false; - if (s1->column() != s2->column()) - return false; - - return QByteArray(s1->fileName()) == QByteArray(s2->fileName()); -} - FullySpecifiedType UseMinimalNames::apply(const Name *name, Rewrite *rewrite) const { SubstitutionEnvironment *env = rewrite->env; @@ -416,26 +404,7 @@ FullySpecifiedType UseMinimalNames::apply(const Name *name, Rewrite *rewrite) co const QList<LookupItem> results = context.lookup(name, scope); foreach (const LookupItem &r, results) { if (Symbol *d = r.declaration()) { - const Name *n = 0; - QList<const Name *> names = LookupContext::fullyQualifiedName(d); - for (int i = names.size() - 1; i >= 0; --i) { - if (! n) - n = names.at(i); - else - n = control->qualifiedNameId(names.at(i), n); - if (_target) { - // minimize the qualifications - const QList<LookupItem> tresults = _target->lookup(n); - foreach (const LookupItem &tr, tresults) { - if (symbolIdentical(tr.declaration(), d)) { - i = 0; // break outer - break; - } - } - } - } - - return control->namedType(n); + return control->namedType(LookupContext::minimalName(d, _target, control)); } return r.type(); diff --git a/src/libs/cplusplus/LookupContext.cpp b/src/libs/cplusplus/LookupContext.cpp index f4089d1bec..88110c5da2 100644 --- a/src/libs/cplusplus/LookupContext.cpp +++ b/src/libs/cplusplus/LookupContext.cpp @@ -157,50 +157,40 @@ QList<const Name *> LookupContext::path(Symbol *symbol) return names; } - -const Name *LookupContext::minimalName(const Name *name, - Scope *scope, - ClassOrNamespace *target) const +static bool symbolIdentical(Symbol *s1, Symbol *s2) { - Q_UNUSED(name); - Q_UNUSED(scope); - Q_UNUSED(target); - - qWarning() << "TODO:" << Q_FUNC_INFO; - return name; + if (!s1 || !s2) + return false; + if (s1->line() != s2->line()) + return false; + if (s1->column() != s2->column()) + return false; -#if 0 - Q_ASSERT(name); - Q_ASSERT(source); - Q_ASSERT(target); + return QByteArray(s1->fileName()) == QByteArray(s2->fileName()); +} - QList<Symbol *> symbols = lookup(name, source); - if (symbols.isEmpty()) - return 0; +const Name *LookupContext::minimalName(Symbol *symbol, ClassOrNamespace *target, Control *control) +{ + const Name *n = 0; + QList<const Name *> names = LookupContext::fullyQualifiedName(symbol); - Symbol *canonicalSymbol = symbols.first(); - std::vector<const Name *> fqNames = fullyQualifiedName(canonicalSymbol).toVector().toStdVector(); - if (const QualifiedNameId *qId = name->asQualifiedNameId()) - fqNames.push_back(qId->name()); - else - fqNames.push_back(name); - - const QualifiedNameId *lastWorking = 0; - for (unsigned i = 0; i < fqNames.size(); ++i) { - const QualifiedNameId *newName = control()->qualifiedNameId(&fqNames[i], - fqNames.size() - i); - QList<Symbol *> candidates = target->lookup(newName); - if (candidates.contains(canonicalSymbol)) - lastWorking = newName; + for (int i = names.size() - 1; i >= 0; --i) { + if (! n) + n = names.at(i); else - break; + n = control->qualifiedNameId(names.at(i), n); + + // once we're qualified enough to get the same symbol, break + if (target) { + const QList<LookupItem> tresults = target->lookup(n); + foreach (const LookupItem &tr, tresults) { + if (symbolIdentical(tr.declaration(), symbol)) + return n; + } + } } - if (lastWorking && lastWorking->nameCount() == 1) - return lastWorking->nameAt(0); - else - return lastWorking; -#endif + return n; } diff --git a/src/libs/cplusplus/LookupContext.h b/src/libs/cplusplus/LookupContext.h index 578e19b094..2fa9655cd5 100644 --- a/src/libs/cplusplus/LookupContext.h +++ b/src/libs/cplusplus/LookupContext.h @@ -235,8 +235,7 @@ public: static QList<const Name *> fullyQualifiedName(Symbol *symbol); static QList<const Name *> path(Symbol *symbol); - const Name *minimalName(const Name *name, Scope *source, - ClassOrNamespace *target) const; + static const Name *minimalName(Symbol *symbol, ClassOrNamespace *target, Control *control); private: // The current expression. diff --git a/src/libs/qmljs/qmljscodeformatter.cpp b/src/libs/qmljs/qmljscodeformatter.cpp index fa5ef50eea..9d2ceb69f3 100644 --- a/src/libs/qmljs/qmljscodeformatter.cpp +++ b/src/libs/qmljs/qmljscodeformatter.cpp @@ -523,10 +523,10 @@ int CodeFormatter::indentForNewLineAfter(const QTextBlock &block) { restoreCurrentState(block); - int lexerState = loadLexerState(block); m_tokens.clear(); m_currentLine.clear(); - adjustIndent(m_tokens, lexerState, &m_indentDepth); + const int startLexerState = loadLexerState(block.previous()); + adjustIndent(m_tokens, startLexerState, &m_indentDepth); return m_indentDepth; } @@ -671,10 +671,11 @@ void CodeFormatter::leave(bool statementDone) void CodeFormatter::correctIndentation(const QTextBlock &block) { - const int lexerState = tokenizeBlock(block); + tokenizeBlock(block); Q_ASSERT(m_currentState.size() >= 1); - adjustIndent(m_tokens, lexerState, &m_indentDepth); + const int startLexerState = loadLexerState(block.previous()); + adjustIndent(m_tokens, startLexerState, &m_indentDepth); } bool CodeFormatter::tryInsideExpression(bool alsoExpression) @@ -1211,10 +1212,8 @@ void QtStyleCodeFormatter::onEnter(int newState, int *indentDepth, int *savedInd } } -void QtStyleCodeFormatter::adjustIndent(const QList<Token> &tokens, int lexerState, int *indentDepth) const +void QtStyleCodeFormatter::adjustIndent(const QList<Token> &tokens, int startLexerState, int *indentDepth) const { - Q_UNUSED(lexerState) - State topState = state(); State previousState = state(1); @@ -1226,6 +1225,12 @@ void QtStyleCodeFormatter::adjustIndent(const QList<Token> &tokens, int lexerSta return; } } + // don't touch multi-line strings at all + if ((startLexerState & Scanner::MultiLineMask) == Scanner::MultiLineStringDQuote + || (startLexerState & Scanner::MultiLineMask) == Scanner::MultiLineStringSQuote) { + *indentDepth = -1; + return; + } const int kind = extendedTokenKind(tokenAt(0)); switch (kind) { diff --git a/src/libs/qmljs/qmljscodeformatter.h b/src/libs/qmljs/qmljscodeformatter.h index 7b5865f0e8..b3e2498d4d 100644 --- a/src/libs/qmljs/qmljscodeformatter.h +++ b/src/libs/qmljs/qmljscodeformatter.h @@ -71,7 +71,7 @@ public: protected: virtual void onEnter(int newState, int *indentDepth, int *savedIndentDepth) const = 0; - virtual void adjustIndent(const QList<Token> &tokens, int lexerState, int *indentDepth) const = 0; + virtual void adjustIndent(const QList<Token> &tokens, int startLexerState, int *indentDepth) const = 0; struct State; class QMLJS_EXPORT BlockData diff --git a/src/libs/qmljs/qmljsinterpreter.cpp b/src/libs/qmljs/qmljsinterpreter.cpp index 3a1ff62e8c..8d52e137d4 100644 --- a/src/libs/qmljs/qmljsinterpreter.cpp +++ b/src/libs/qmljs/qmljsinterpreter.cpp @@ -337,6 +337,22 @@ const CppComponentValue *CppComponentValue::prototype() const return static_cast<const CppComponentValue *>(_prototype); } +/*! + \returns a list started by this object and followed by all its prototypes + + Prefer to use this over calling prototype() in a loop, as it avoids cycles. +*/ +QList<const CppComponentValue *> CppComponentValue::prototypes() const +{ + QList<const CppComponentValue *> protos; + for (const CppComponentValue *it = this; it; it = it->prototype()) { + if (protos.contains(it)) + break; + protos += it; + } + return protos; +} + const CppComponentValue *CppComponentValue::attachedType() const { return _attachedType; @@ -366,7 +382,7 @@ QString CppComponentValue::defaultPropertyName() const QString CppComponentValue::propertyType(const QString &propertyName) const { - for (const CppComponentValue *it = this; it; it = it->prototype()) { + foreach (const CppComponentValue *it, prototypes()) { FakeMetaObject::ConstPtr iter = it->_metaObject; int propIdx = iter->propertyIndex(propertyName); if (propIdx != -1) { @@ -378,7 +394,7 @@ QString CppComponentValue::propertyType(const QString &propertyName) const bool CppComponentValue::isListProperty(const QString &propertyName) const { - for (const CppComponentValue *it = this; it; it = it->prototype()) { + foreach (const CppComponentValue *it, prototypes()) { FakeMetaObject::ConstPtr iter = it->_metaObject; int propIdx = iter->propertyIndex(propertyName); if (propIdx != -1) { @@ -390,7 +406,7 @@ bool CppComponentValue::isListProperty(const QString &propertyName) const FakeMetaEnum CppComponentValue::getEnum(const QString &typeName, const CppComponentValue **foundInScope) const { - for (const CppComponentValue *it = this; it; it = it->prototype()) { + foreach (const CppComponentValue *it, prototypes()) { FakeMetaObject::ConstPtr iter = it->_metaObject; const int index = iter->enumeratorIndex(typeName); if (index != -1) { @@ -406,7 +422,7 @@ FakeMetaEnum CppComponentValue::getEnum(const QString &typeName, const CppCompon const QmlEnumValue *CppComponentValue::getEnumValue(const QString &typeName, const CppComponentValue **foundInScope) const { - for (const CppComponentValue *it = this; it; it = it->prototype()) { + foreach (const CppComponentValue *it, prototypes()) { if (const QmlEnumValue *e = it->_enums.value(typeName)) { if (foundInScope) *foundInScope = it; @@ -455,7 +471,7 @@ const ObjectValue *CppComponentValue::signalScope(const QString &signalName) con bool CppComponentValue::isWritable(const QString &propertyName) const { - for (const CppComponentValue *it = this; it; it = it->prototype()) { + foreach (const CppComponentValue *it, prototypes()) { FakeMetaObject::ConstPtr iter = it->_metaObject; int propIdx = iter->propertyIndex(propertyName); if (propIdx != -1) { @@ -467,7 +483,7 @@ bool CppComponentValue::isWritable(const QString &propertyName) const bool CppComponentValue::isPointer(const QString &propertyName) const { - for (const CppComponentValue *it = this; it; it = it->prototype()) { + foreach (const CppComponentValue *it, prototypes()) { FakeMetaObject::ConstPtr iter = it->_metaObject; int propIdx = iter->propertyIndex(propertyName); if (propIdx != -1) { @@ -487,7 +503,7 @@ bool CppComponentValue::hasLocalProperty(const QString &typeName) const bool CppComponentValue::hasProperty(const QString &propertyName) const { - for (const CppComponentValue *it = this; it; it = it->prototype()) { + foreach (const CppComponentValue *it, prototypes()) { FakeMetaObject::ConstPtr iter = it->_metaObject; int propIdx = iter->propertyIndex(propertyName); if (propIdx != -1) { @@ -499,7 +515,7 @@ bool CppComponentValue::hasProperty(const QString &propertyName) const bool CppComponentValue::isDerivedFrom(FakeMetaObject::ConstPtr base) const { - for (const CppComponentValue *it = this; it; it = it->prototype()) { + foreach (const CppComponentValue *it, prototypes()) { FakeMetaObject::ConstPtr iter = it->_metaObject; if (iter == base) return true; diff --git a/src/libs/qmljs/qmljsinterpreter.h b/src/libs/qmljs/qmljsinterpreter.h index 7b95f2d31f..50da224cc7 100644 --- a/src/libs/qmljs/qmljsinterpreter.h +++ b/src/libs/qmljs/qmljsinterpreter.h @@ -499,6 +499,7 @@ public: using ObjectValue::prototype; const CppComponentValue *prototype() const; + QList<const CppComponentValue *> prototypes() const; const CppComponentValue *attachedType() const; void setAttachedType(CppComponentValue *value); diff --git a/src/libs/utils/filesearch.cpp b/src/libs/utils/filesearch.cpp index 98386def46..d43fe8d0a1 100644 --- a/src/libs/utils/filesearch.cpp +++ b/src/libs/utils/filesearch.cpp @@ -70,6 +70,15 @@ static inline QString msgFound(const QString &searchTerm, int numMatches, int nu namespace { +const int MAX_LINE_SIZE = 400; + +QString clippedText(const QString &text, int maxLength) +{ + if (text.length() > maxLength) + return text.left(maxLength) + QChar(0x2026); // '...' + return text; +} + void runFileSearch(QFutureInterface<FileSearchResultList> &future, QString searchTerm, FileIterator *files, @@ -123,6 +132,7 @@ void runFileSearch(QFutureInterface<FileSearchResultList> &future, while (!stream.atEnd()) { ++lineNr; const QString chunk = stream.readLine(); + const QString resultItemText = clippedText(chunk, MAX_LINE_SIZE); int chunkLength = chunk.length(); const QChar *chunkPtr = chunk.constData(); const QChar *chunkEnd = chunkPtr + chunkLength - 1; @@ -166,7 +176,7 @@ void runFileSearch(QFutureInterface<FileSearchResultList> &future, } } if (equal) { - results << FileSearchResult(s, lineNr, chunk, + results << FileSearchResult(s, lineNr, resultItemText, regionPtr - chunkPtr, termLength, QStringList()); ++numMatches; @@ -244,10 +254,11 @@ void runFileSearchRegExp(QFutureInterface<FileSearchResultList> &future, QString line; while (!stream.atEnd()) { line = stream.readLine(); + const QString resultItemText = clippedText(line, MAX_LINE_SIZE); int lengthOfLine = line.size(); int pos = 0; while ((pos = expression.indexIn(line, pos)) != -1) { - results << FileSearchResult(s, lineNr, line, + results << FileSearchResult(s, lineNr, resultItemText, pos, expression.matchedLength(), expression.capturedTexts()); ++numMatches; diff --git a/src/plugins/cmakeprojectmanager/cmakerunconfiguration.cpp b/src/plugins/cmakeprojectmanager/cmakerunconfiguration.cpp index 485ce0652d..dac370a6e6 100644 --- a/src/plugins/cmakeprojectmanager/cmakerunconfiguration.cpp +++ b/src/plugins/cmakeprojectmanager/cmakerunconfiguration.cpp @@ -251,7 +251,7 @@ QStringList CMakeRunConfiguration::dumperLibraryLocations() const { QString qmakePath = ProjectExplorer::DebuggingHelperLibrary::findSystemQt(environment()); QString qtInstallData = ProjectExplorer::DebuggingHelperLibrary::qtInstallDataDir(qmakePath); - return ProjectExplorer::DebuggingHelperLibrary::locationsByInstallData(qtInstallData); + return ProjectExplorer::DebuggingHelperLibrary::debuggingHelperLibraryDirectories(qtInstallData); } Utils::Environment CMakeRunConfiguration::baseEnvironment() const diff --git a/src/plugins/cppeditor/cppinsertdecldef.cpp b/src/plugins/cppeditor/cppinsertdecldef.cpp index 5ea7e3e696..6847a4d672 100644 --- a/src/plugins/cppeditor/cppinsertdecldef.cpp +++ b/src/plugins/cppeditor/cppinsertdecldef.cpp @@ -261,13 +261,7 @@ public: FullySpecifiedType tn = rewriteType(m_decl->type(), &env, control); // rewrite the function name - QString name; - const FullySpecifiedType nametype = rewriteType(control->namedType(m_decl->name()), &env, control); - if (NamedType *nt = nametype.type()->asNamedType()) { - name = oo(nt->name()); - } else { - name = oo(LookupContext::fullyQualifiedName(m_decl)); - } + QString name = oo(LookupContext::minimalName(m_decl, targetCoN, control)); QString defText = oo.prettyType(tn, name) + "\n{\n}"; diff --git a/src/plugins/debugger/debuggerdialogs.cpp b/src/plugins/debugger/debuggerdialogs.cpp index 4d69e61631..f4c03fe84a 100644 --- a/src/plugins/debugger/debuggerdialogs.cpp +++ b/src/plugins/debugger/debuggerdialogs.cpp @@ -1050,6 +1050,7 @@ StartRemoteEngineDialog::StartRemoteEngineDialog(QWidget *parent) : StartRemoteEngineDialog::~StartRemoteEngineDialog() { + delete m_ui; } QString StartRemoteEngineDialog::host() const diff --git a/src/plugins/debugger/debuggerplugin.cpp b/src/plugins/debugger/debuggerplugin.cpp index dc0bd2c356..a6270314f1 100644 --- a/src/plugins/debugger/debuggerplugin.cpp +++ b/src/plugins/debugger/debuggerplugin.cpp @@ -2544,7 +2544,7 @@ void DebuggerPluginPrivate::showMessage(const QString &msg, int channel, int tim void DebuggerPluginPrivate::showQtDumperLibraryWarning(const QString &details) { QMessageBox dialog(mainWindow()); - QPushButton *qtPref = dialog.addButton(tr("Open Qt4 Options"), + QPushButton *qtPref = dialog.addButton(tr("Open Qt Options"), QMessageBox::ActionRole); QPushButton *helperOff = dialog.addButton(tr("Turn off Helper Usage"), QMessageBox::ActionRole); diff --git a/src/plugins/debugger/moduleswindow.cpp b/src/plugins/debugger/moduleswindow.cpp index 900cc28e0b..b089b2aa25 100644 --- a/src/plugins/debugger/moduleswindow.cpp +++ b/src/plugins/debugger/moduleswindow.cpp @@ -61,6 +61,7 @@ ModulesWindow::ModulesWindow(QWidget *parent) : BaseWindow(parent) { setWindowTitle(tr("Modules")); + setSortingEnabled(true); setAlwaysAdjustColumnsAction(debuggerCore()->action(AlwaysAdjustModulesColumnWidths)); connect(this, SIGNAL(activated(QModelIndex)), diff --git a/src/plugins/debugger/sourcefileswindow.cpp b/src/plugins/debugger/sourcefileswindow.cpp index ffbc5abf69..fc3a67436e 100644 --- a/src/plugins/debugger/sourcefileswindow.cpp +++ b/src/plugins/debugger/sourcefileswindow.cpp @@ -60,6 +60,7 @@ SourceFilesWindow::SourceFilesWindow(QWidget *parent) : BaseWindow(parent) { setWindowTitle(tr("Source Files")); + setSortingEnabled(true); } void SourceFilesWindow::rowActivated(const QModelIndex &index) diff --git a/src/plugins/debugger/threadswindow.cpp b/src/plugins/debugger/threadswindow.cpp index 55924f6ea0..7be6b8b14b 100644 --- a/src/plugins/debugger/threadswindow.cpp +++ b/src/plugins/debugger/threadswindow.cpp @@ -52,6 +52,7 @@ ThreadsWindow::ThreadsWindow(QWidget *parent) : BaseWindow(parent) { setWindowTitle(tr("Thread")); + setSortingEnabled(true); setAlwaysAdjustColumnsAction(debuggerCore()->action(AlwaysAdjustThreadsColumnWidths)); setObjectName(QLatin1String("ThreadsWindow")); } diff --git a/src/plugins/fakevim/fakevimhandler.cpp b/src/plugins/fakevim/fakevimhandler.cpp index 2be355a9b3..fc3159eba5 100644 --- a/src/plugins/fakevim/fakevimhandler.cpp +++ b/src/plugins/fakevim/fakevimhandler.cpp @@ -3296,6 +3296,7 @@ bool FakeVimHandler::Private::handleExSubstituteCommand(const ExCommand &cmd) i += caps.at(0).size(); } } + repl.replace("\\&", "&"); text = text.left(pos) + repl + text.mid(pos + matched.size()); pos += repl.size(); if (!global) diff --git a/src/plugins/find/searchresulttreeitemdelegate.cpp b/src/plugins/find/searchresulttreeitemdelegate.cpp index 4e9780c841..7560f1d8fa 100644 --- a/src/plugins/find/searchresulttreeitemdelegate.cpp +++ b/src/plugins/find/searchresulttreeitemdelegate.cpp @@ -162,8 +162,10 @@ void SearchResultTreeItemDelegate::drawMarker(QPainter *painter, const QModelInd { int searchTermStart = index.model()->data(index, ItemDataRoles::SearchTermStartRole).toInt(); int searchTermLength = index.model()->data(index, ItemDataRoles::SearchTermLengthRole).toInt(); - if (searchTermStart < 0 || searchTermLength < 1) + if (searchTermStart < 0 || searchTermStart >= text.length() || searchTermLength < 1) return; + // clip searchTermLength to end of line + searchTermLength = qMin(searchTermLength, text.length() - searchTermStart); const int textMargin = QApplication::style()->pixelMetric(QStyle::PM_FocusFrameHMargin) + 1; int searchTermStartPixels = painter->fontMetrics().width(text.left(searchTermStart)); int searchTermLengthPixels = painter->fontMetrics().width(text.mid(searchTermStart, searchTermLength)); diff --git a/src/plugins/find/searchresultwindow.cpp b/src/plugins/find/searchresultwindow.cpp index 9e3aa9c962..45c7b692ee 100644 --- a/src/plugins/find/searchresultwindow.cpp +++ b/src/plugins/find/searchresultwindow.cpp @@ -74,6 +74,7 @@ namespace Internal { QStackedWidget *m_widget; QList<SearchResult *> m_searchResults; int m_currentIndex; + QFont m_font; public slots: void setCurrentIndex(int index); @@ -317,6 +318,7 @@ SearchResult *SearchResultWindow::startNewSearch(const QString &label, d->m_searchResultWidgets.prepend(widget); d->m_widget->insertWidget(1, widget); connect(widget, SIGNAL(navigateStateChanged()), this, SLOT(navigateStateChanged())); + widget->setTextEditorFont(d->m_font); widget->setShowReplaceUI(searchOrSearchAndReplace != SearchOnly); widget->setAutoExpandResults(d->m_expandCollapseAction->isChecked()); widget->setInfo(label, toolTip, searchTerm); @@ -390,6 +392,7 @@ void SearchResultWindow::setFocus() */ void SearchResultWindow::setTextEditorFont(const QFont &font) { + d->m_font = font; foreach (Internal::SearchResultWidget *widget, d->m_searchResultWidgets) widget->setTextEditorFont(font); } diff --git a/src/plugins/git/remotedialog.cpp b/src/plugins/git/remotedialog.cpp index 1c388305f7..06d02cb500 100644 --- a/src/plugins/git/remotedialog.cpp +++ b/src/plugins/git/remotedialog.cpp @@ -60,6 +60,11 @@ RemoteAdditionDialog::RemoteAdditionDialog(QWidget *parent) : setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint); } +RemoteAdditionDialog::~RemoteAdditionDialog() +{ + delete m_ui; +} + QString RemoteAdditionDialog::remoteName() const { return m_ui->nameEdit->text(); diff --git a/src/plugins/git/remotedialog.h b/src/plugins/git/remotedialog.h index 4458bf544c..12e367b9bc 100644 --- a/src/plugins/git/remotedialog.h +++ b/src/plugins/git/remotedialog.h @@ -56,6 +56,7 @@ class RemoteAdditionDialog : public QDialog public: explicit RemoteAdditionDialog(QWidget *parent = 0); + ~RemoteAdditionDialog(); QString remoteName() const; QString remoteUrl() const; diff --git a/src/plugins/madde/maemopackagecreationstep.cpp b/src/plugins/madde/maemopackagecreationstep.cpp index 8542aa9c4f..ddde4c8fce 100644 --- a/src/plugins/madde/maemopackagecreationstep.cpp +++ b/src/plugins/madde/maemopackagecreationstep.cpp @@ -339,11 +339,8 @@ bool MaemoDebianPackageCreationStep::createPackage(QProcess *buildProc, } } - if (inSourceBuild) { - buildProc->start(packagingCommand(m_maddeRoot, QLatin1String("dh_clean"))); - buildProc->waitForFinished(); - buildProc->terminate(); - } + if (inSourceBuild) + callPackagingCommand(buildProc, QStringList() << QLatin1String("dh_clean")); return true; } diff --git a/src/plugins/projectexplorer/buildmanager.cpp b/src/plugins/projectexplorer/buildmanager.cpp index c4b7a277b8..0e669458ea 100644 --- a/src/plugins/projectexplorer/buildmanager.cpp +++ b/src/plugins/projectexplorer/buildmanager.cpp @@ -51,6 +51,7 @@ #include <utils/qtcassert.h> #include <QtCore/QDir> +#include <QtCore/QTime> #include <QtCore/QTimer> #include <QtCore/QMetaType> #include <QtCore/QList> @@ -88,6 +89,8 @@ struct BuildManagerPrivate { QString m_currentConfiguration; // used to decide if we are building a project to decide when to emit buildStateChanged(Project *) QHash<Project *, int> m_activeBuildSteps; + QHash<Target *, int> m_activeBuildStepsPerTarget; + QHash<ProjectConfiguration *, int> m_activeBuildStepsPerProjectConfiguration; Project *m_previousBuildStepProject; // is set to true while canceling, so that nextBuildStep knows that the BuildStep finished because of canceling bool m_canceling; @@ -228,7 +231,7 @@ void BuildManager::cancel() QTimer::singleShot(0, this, SLOT(emitCancelMessage())); disconnectOutput(d->m_currentBuildStep); - decrementActiveBuildSteps(d->m_currentBuildStep->project()); + decrementActiveBuildSteps(d->m_currentBuildStep); d->m_progressFutureInterface->setProgressValueAndText(d->m_progress*100, tr("Build/Deployment canceled")); //TODO NBS fix in qtconcurrent clearBuildQueue(); @@ -261,7 +264,7 @@ void BuildManager::emitCancelMessage() void BuildManager::clearBuildQueue() { foreach (BuildStep *bs, d->m_buildQueue) { - decrementActiveBuildSteps(bs->project()); + decrementActiveBuildSteps(bs); disconnectOutput(bs); } @@ -358,7 +361,12 @@ void BuildManager::addToTaskWindow(const ProjectExplorer::Task &task) void BuildManager::addToOutputWindow(const QString &string, BuildStep::OutputFormat format, BuildStep::OutputNewlineSetting newLineSetting) { - QString stringToWrite = string; + QString stringToWrite; + if (format == BuildStep::MessageOutput || format == BuildStep::ErrorMessageOutput) { + stringToWrite = QTime::currentTime().toString(); + stringToWrite += QLatin1String(": "); + } + stringToWrite += string; if (newLineSetting == BuildStep::DoAppendNewline) stringToWrite += QLatin1Char('\n'); d->m_outputWindow->appendText(stringToWrite, format); @@ -387,7 +395,7 @@ void BuildManager::nextBuildQueue() disconnectOutput(d->m_currentBuildStep); ++d->m_progress; d->m_progressFutureInterface->setProgressValueAndText(d->m_progress*100, msgProgress(d->m_progress, d->m_maxProgress)); - decrementActiveBuildSteps(d->m_currentBuildStep->project()); + decrementActiveBuildSteps(d->m_currentBuildStep); bool result = d->m_watcher.result(); if (!result) { @@ -496,7 +504,7 @@ bool BuildManager::buildQueueAppend(QList<BuildStep *> steps) for (i = 0; i < count; ++i) { ++d->m_maxProgress; d->m_buildQueue.append(steps.at(i)); - incrementActiveBuildSteps(steps.at(i)->target()->project()); + incrementActiveBuildSteps(steps.at(i)); } return true; } @@ -536,14 +544,29 @@ void BuildManager::appendStep(BuildStep *step) startBuildQueue(); } +template <class T> +int count(const QHash<T *, int> &hash, T *key) +{ + typename QHash<T *, int>::const_iterator it = hash.find(key); + typename QHash<T *, int>::const_iterator end = hash.end(); + if (it != end) + return *it; + return 0; +} + bool BuildManager::isBuilding(Project *pro) { - QHash<Project *, int>::iterator it = d->m_activeBuildSteps.find(pro); - QHash<Project *, int>::iterator end = d->m_activeBuildSteps.end(); - if (it == end || *it == 0) - return false; - else - return true; + return count(d->m_activeBuildSteps, pro) > 0; +} + +bool BuildManager::isBuilding(Target *t) +{ + return count(d->m_activeBuildStepsPerTarget, t) > 0; +} + +bool BuildManager::isBuilding(ProjectConfiguration *p) +{ + return count(d->m_activeBuildStepsPerProjectConfiguration, p) > 0; } bool BuildManager::isBuilding(BuildStep *step) @@ -551,33 +574,51 @@ bool BuildManager::isBuilding(BuildStep *step) return (d->m_currentBuildStep == step) || d->m_buildQueue.contains(step); } -void BuildManager::incrementActiveBuildSteps(Project *pro) +template <class T> bool increment(QHash<T *, int> &hash, T *key) { - QHash<Project *, int>::iterator it = d->m_activeBuildSteps.find(pro); - QHash<Project *, int>::iterator end = d->m_activeBuildSteps.end(); + typename QHash<T *, int>::iterator it = hash.find(key); + typename QHash<T *, int>::iterator end = hash.end(); if (it == end) { - d->m_activeBuildSteps.insert(pro, 1); - emit buildStateChanged(pro); + hash.insert(key, 1); + return true; } else if (*it == 0) { ++*it; - emit buildStateChanged(pro); + return true; } else { ++*it; } + return false; } -void BuildManager::decrementActiveBuildSteps(Project *pro) +template <class T> bool decrement(QHash<T *, int> &hash, T *key) { - QHash<Project *, int>::iterator it = d->m_activeBuildSteps.find(pro); - QHash<Project *, int>::iterator end = d->m_activeBuildSteps.end(); + typename QHash<T *, int>::iterator it = hash.find(key); + typename QHash<T *, int>::iterator end = hash.end(); if (it == end) { - Q_ASSERT(false && "BuildManager d->m_activeBuildSteps says project is not building, but apparently a build step was still in the queue."); + // Can't happen } else if (*it == 1) { --*it; - emit buildStateChanged(pro); + return true; } else { --*it; } + return false; +} + +void BuildManager::incrementActiveBuildSteps(BuildStep *bs) +{ + increment<ProjectConfiguration>(d->m_activeBuildStepsPerProjectConfiguration, bs->projectConfiguration()); + increment<Target>(d->m_activeBuildStepsPerTarget, bs->target()); + if (increment<Project>(d->m_activeBuildSteps, bs->project())) + emit buildStateChanged(bs->project()); +} + +void BuildManager::decrementActiveBuildSteps(BuildStep *bs) +{ + decrement<ProjectConfiguration>(d->m_activeBuildStepsPerProjectConfiguration, bs->projectConfiguration()); + decrement<Target>(d->m_activeBuildStepsPerTarget, bs->target()); + if (decrement<Project>(d->m_activeBuildSteps, bs->project())) + emit buildStateChanged(bs->project()); } void BuildManager::disconnectOutput(BuildStep *bs) diff --git a/src/plugins/projectexplorer/buildmanager.h b/src/plugins/projectexplorer/buildmanager.h index 4d4c7326d4..053b6091b6 100644 --- a/src/plugins/projectexplorer/buildmanager.h +++ b/src/plugins/projectexplorer/buildmanager.h @@ -63,6 +63,8 @@ public: bool buildLists(QList<BuildStepList *> bsls); bool buildList(BuildStepList *bsl); bool isBuilding(Project *p); + bool isBuilding(Target *t); + bool isBuilding(ProjectConfiguration *p); bool isBuilding(BuildStep *step); // Append any build step to the list of build steps (currently only used to add the QMakeStep) @@ -104,8 +106,8 @@ private: void nextStep(); void clearBuildQueue(); bool buildQueueAppend(QList<BuildStep *> steps); - void incrementActiveBuildSteps(Project *pro); - void decrementActiveBuildSteps(Project *pro); + void incrementActiveBuildSteps(BuildStep *bs); + void decrementActiveBuildSteps(BuildStep *bs); void disconnectOutput(BuildStep *bs); BuildManagerPrivate *d; diff --git a/src/plugins/projectexplorer/buildsettingspropertiespage.cpp b/src/plugins/projectexplorer/buildsettingspropertiespage.cpp index 74db6361c5..917033174f 100644 --- a/src/plugins/projectexplorer/buildsettingspropertiespage.cpp +++ b/src/plugins/projectexplorer/buildsettingspropertiespage.cpp @@ -42,6 +42,8 @@ #include <coreplugin/coreconstants.h> #include <extensionsystem/pluginmanager.h> #include <utils/qtcassert.h> +#include <projectexplorer/projectexplorer.h> +#include <projectexplorer/buildmanager.h> #include <QtCore/QMargins> #include <QtCore/QTimer> @@ -370,6 +372,29 @@ void BuildSettingsWidget::deleteConfiguration(BuildConfiguration *deleteConfigur m_target->buildConfigurations().size() <= 1) return; + ProjectExplorer::BuildManager *bm = ProjectExplorerPlugin::instance()->buildManager(); + if (bm->isBuilding(deleteConfiguration)) { + QMessageBox box; + QPushButton *closeAnyway = box.addButton(tr("Cancel Build && Remove Build Configuration"), QMessageBox::AcceptRole); + QPushButton *cancelClose = box.addButton(tr("Do Not Remove"), QMessageBox::RejectRole); + box.setDefaultButton(cancelClose); + box.setWindowTitle(tr("Remove Build Configuration %1?").arg(deleteConfiguration->displayName())); + box.setText(tr("The build configuration <b>%1</b> is currently being built.").arg(deleteConfiguration->displayName())); + box.setInformativeText(tr("Do you want to cancel the build process and remove the Build Configuration anyway?")); + box.exec(); + if (box.clickedButton() != closeAnyway) + return; + bm->cancel(); + } else { + QMessageBox msgBox(QMessageBox::Question, tr("Remove Build Configuration?"), + tr("Do you really want to delete build configuration <b>%1</b>?").arg(deleteConfiguration->displayName()), + QMessageBox::Yes|QMessageBox::No, this); + msgBox.setDefaultButton(QMessageBox::No); + msgBox.setEscapeButton(QMessageBox::No); + if (msgBox.exec() == QMessageBox::No) + return; + } + m_target->removeBuildConfiguration(deleteConfiguration); updateBuildSettings(); diff --git a/src/plugins/projectexplorer/buildstep.cpp b/src/plugins/projectexplorer/buildstep.cpp index 6316be37b3..c4df1aeb98 100644 --- a/src/plugins/projectexplorer/buildstep.cpp +++ b/src/plugins/projectexplorer/buildstep.cpp @@ -150,6 +150,11 @@ DeployConfiguration *BuildStep::deployConfiguration() const return qobject_cast<DeployConfiguration *>(parent()->parent()); } +ProjectConfiguration *BuildStep::projectConfiguration() const +{ + return static_cast<ProjectConfiguration *>(parent()->parent()); +} + Target *BuildStep::target() const { return qobject_cast<Target *>(parent()->parent()->parent()); diff --git a/src/plugins/projectexplorer/buildstep.h b/src/plugins/projectexplorer/buildstep.h index f253534ffa..b43ef00510 100644 --- a/src/plugins/projectexplorer/buildstep.h +++ b/src/plugins/projectexplorer/buildstep.h @@ -72,12 +72,13 @@ public: BuildConfiguration *buildConfiguration() const; DeployConfiguration *deployConfiguration() const; + ProjectConfiguration *projectConfiguration() const; Target *target() const; + Project *project() const; enum OutputFormat { NormalOutput, ErrorOutput, MessageOutput, ErrorMessageOutput }; enum OutputNewlineSetting { DoAppendNewline, DontAppendNewline }; - Project *project() const; signals: void addTask(const ProjectExplorer::Task &task); diff --git a/src/plugins/projectexplorer/customexecutablerunconfiguration.cpp b/src/plugins/projectexplorer/customexecutablerunconfiguration.cpp index 345f3ffa7c..a470539075 100644 --- a/src/plugins/projectexplorer/customexecutablerunconfiguration.cpp +++ b/src/plugins/projectexplorer/customexecutablerunconfiguration.cpp @@ -332,7 +332,7 @@ QStringList CustomExecutableRunConfiguration::dumperLibraryLocations() const { QString qmakePath = ProjectExplorer::DebuggingHelperLibrary::findSystemQt(environment()); QString qtInstallData = ProjectExplorer::DebuggingHelperLibrary::qtInstallDataDir(qmakePath); - return ProjectExplorer::DebuggingHelperLibrary::locationsByInstallData(qtInstallData); + return ProjectExplorer::DebuggingHelperLibrary::debuggingHelperLibraryDirectories(qtInstallData); } ProjectExplorer::Abi CustomExecutableRunConfiguration::abi() const diff --git a/src/plugins/projectexplorer/debugginghelper.cpp b/src/plugins/projectexplorer/debugginghelper.cpp index f7cd47b072..7b0561145c 100644 --- a/src/plugins/projectexplorer/debugginghelper.cpp +++ b/src/plugins/projectexplorer/debugginghelper.cpp @@ -68,18 +68,6 @@ QStringList DebuggingHelperLibrary::debuggingHelperLibraryDirectories(const QStr return directories; } -QStringList DebuggingHelperLibrary::locationsByInstallData(const QString &qtInstallData) -{ - QStringList result; - QFileInfo fileInfo; - const QStringList binFilenames = validBinaryFilenames(); - foreach(const QString &directory, debuggingHelperLibraryDirectories(qtInstallData)) { - if (getHelperFileInfoFor(binFilenames, directory, &fileInfo)) - result << fileInfo.filePath(); - } - return result; -} - static QString sourcePath() { return Core::ICore::instance()->resourcePath() + QLatin1String("/dumper/"); diff --git a/src/plugins/projectexplorer/debugginghelper.h b/src/plugins/projectexplorer/debugginghelper.h index 2f5f764978..94edb1d4e5 100644 --- a/src/plugins/projectexplorer/debugginghelper.h +++ b/src/plugins/projectexplorer/debugginghelper.h @@ -47,7 +47,7 @@ class PROJECTEXPLORER_EXPORT DebuggingHelperLibrary : public Utils::BuildableHel { public: static QString debuggingHelperLibraryByInstallData(const QString &qtInstallData); - static QStringList locationsByInstallData(const QString &qtInstallData); + static QStringList debuggingHelperLibraryDirectories(const QString &qtInstallData); // Build the helpers and return the output log/errormessage. static bool build(BuildHelperArguments arguments, QString *log, QString *errorMessage); @@ -55,8 +55,6 @@ public: // Copy the source files to a target location and return the chosen target location. static QString copy(const QString &qtInstallData, QString *errorMessage); -private: - static QStringList debuggingHelperLibraryDirectories(const QString &qtInstallData); }; } // namespace ProjectExplorer diff --git a/src/plugins/projectexplorer/gcctoolchain.cpp b/src/plugins/projectexplorer/gcctoolchain.cpp index 1b8364bec1..01f5df32b9 100644 --- a/src/plugins/projectexplorer/gcctoolchain.cpp +++ b/src/plugins/projectexplorer/gcctoolchain.cpp @@ -582,7 +582,13 @@ QList<ToolChain *> Internal::GccToolChainFactory::autoDetect() // Fixme Prefer lldb once it is implemented: debuggers.push_back(QLatin1String("lldb")); #endif debuggers.push_back(QLatin1String("gdb")); - return autoDetectToolchains(QLatin1String("g++"), debuggers, Abi::hostAbi()); + QList<ToolChain *> tcs = autoDetectToolchains(QLatin1String("g++"), debuggers, Abi::hostAbi()); + + // Old mac compilers needed to support macx-gccXY mkspecs: + tcs.append(autoDetectToolchains(QLatin1String("g++-4.0"), debuggers, Abi::hostAbi())); + tcs.append(autoDetectToolchains(QLatin1String("g++-4.2"), debuggers, Abi::hostAbi())); + + return tcs; } // Used by the ToolChainManager to restore user-generated tool chains diff --git a/src/plugins/projectexplorer/project.cpp b/src/plugins/projectexplorer/project.cpp index 7677381796..28f42d6cdc 100644 --- a/src/plugins/projectexplorer/project.cpp +++ b/src/plugins/projectexplorer/project.cpp @@ -43,6 +43,7 @@ #include <coreplugin/ifile.h> #include <coreplugin/icontext.h> #include <extensionsystem/pluginmanager.h> +#include <projectexplorer/buildmanager.h> #include <limits> #include <utils/qtcassert.h> @@ -166,9 +167,15 @@ void Project::addTarget(Target *t) setActiveTarget(t); } -void Project::removeTarget(Target *target) +bool Project::removeTarget(Target *target) { - QTC_ASSERT(target && d->m_targets.contains(target), return); + if (!target || !d->m_targets.contains(target)) + return false; + + ProjectExplorer::BuildManager *bm = + ProjectExplorer::ProjectExplorerPlugin::instance()->buildManager(); + if (bm->isBuilding(target)) + return false; emit aboutToRemoveTarget(target); diff --git a/src/plugins/projectexplorer/project.h b/src/plugins/projectexplorer/project.h index cf3d67f354..b87d96f6f1 100644 --- a/src/plugins/projectexplorer/project.h +++ b/src/plugins/projectexplorer/project.h @@ -83,7 +83,7 @@ public: // Target: void addTarget(Target *target); - void removeTarget(Target *target); + bool removeTarget(Target *target); QList<Target *> targets() const; // Note: activeTarget can be 0 (if no targets are defined). diff --git a/src/plugins/projectexplorer/projectexplorer.cpp b/src/plugins/projectexplorer/projectexplorer.cpp index 374b13c5bd..3b966f0159 100644 --- a/src/plugins/projectexplorer/projectexplorer.cpp +++ b/src/plugins/projectexplorer/projectexplorer.cpp @@ -1039,6 +1039,20 @@ void ProjectExplorerPlugin::unloadProject() if (debug) qDebug() << "ProjectExplorerPlugin::unloadProject"; + if (buildManager()->isBuilding(d->m_currentProject)) { + QMessageBox box; + QPushButton *closeAnyway = box.addButton(tr("Cancel Build && Unload"), QMessageBox::AcceptRole); + QPushButton *cancelClose = box.addButton(tr("Do Not Unload"), QMessageBox::RejectRole); + box.setDefaultButton(cancelClose); + box.setWindowTitle(tr("Unload Project %1?").arg(d->m_currentProject->displayName())); + box.setText(tr("The project %1 is currently being built.").arg(d->m_currentProject->displayName())); + box.setInformativeText(tr("Do you want to cancel the build process and unload the project anyway?")); + box.exec(); + if (box.clickedButton() != closeAnyway) + return; + buildManager()->cancel(); + } + Core::IFile *fi = d->m_currentProject->file(); if (!fi || fi->fileName().isEmpty()) //nothing to save? diff --git a/src/plugins/projectexplorer/runsettingspropertiespage.cpp b/src/plugins/projectexplorer/runsettingspropertiespage.cpp index e1016ca460..e0497ca72e 100644 --- a/src/plugins/projectexplorer/runsettingspropertiespage.cpp +++ b/src/plugins/projectexplorer/runsettingspropertiespage.cpp @@ -42,6 +42,8 @@ #include <coreplugin/coreconstants.h> #include <extensionsystem/pluginmanager.h> +#include <projectexplorer/projectexplorer.h> +#include <projectexplorer/buildmanager.h> #include <utils/qtcassert.h> #include <QtCore/QPair> @@ -389,15 +391,31 @@ void RunSettingsWidget::addDeployConfiguration() void RunSettingsWidget::removeDeployConfiguration() { DeployConfiguration *dc = m_target->activeDeployConfiguration(); - QMessageBox msgBox(QMessageBox::Question, tr("Remove Deploy Configuration?"), - tr("Do you really want to delete deploy configuration <b>%1</b>?").arg(dc->displayName()), - QMessageBox::Yes|QMessageBox::No, this); - msgBox.setDefaultButton(QMessageBox::No); - msgBox.setEscapeButton(QMessageBox::No); - if (msgBox.exec() == QMessageBox::No) - return; + ProjectExplorer::BuildManager *bm = ProjectExplorerPlugin::instance()->buildManager(); + if (bm->isBuilding(dc)) { + QMessageBox box; + QPushButton *closeAnyway = box.addButton(tr("Cancel Build && Remove Deploy Configuration"), QMessageBox::AcceptRole); + QPushButton *cancelClose = box.addButton(tr("Do Not Remove"), QMessageBox::RejectRole); + box.setDefaultButton(cancelClose); + box.setWindowTitle(tr("Remove Deploy Configuration %1?").arg(dc->displayName())); + box.setText(tr("The deploy configuration <b>%1</b> is currently being built.").arg(dc->displayName())); + box.setInformativeText(tr("Do you want to cancel the build process and remove the Deploy Configuration anyway?")); + box.exec(); + if (box.clickedButton() != closeAnyway) + return; + bm->cancel(); + } else { + QMessageBox msgBox(QMessageBox::Question, tr("Remove Deploy Configuration?"), + tr("Do you really want to delete deploy configuration <b>%1</b>?").arg(dc->displayName()), + QMessageBox::Yes|QMessageBox::No, this); + msgBox.setDefaultButton(QMessageBox::No); + msgBox.setEscapeButton(QMessageBox::No); + if (msgBox.exec() == QMessageBox::No) + return; + } m_target->removeDeployConfiguration(dc); + m_removeDeployToolButton->setEnabled(m_target->deployConfigurations().size() > 1); } diff --git a/src/plugins/projectexplorer/target.cpp b/src/plugins/projectexplorer/target.cpp index ec5c57b39d..54f194606f 100644 --- a/src/plugins/projectexplorer/target.cpp +++ b/src/plugins/projectexplorer/target.cpp @@ -42,6 +42,8 @@ #include <limits> #include <extensionsystem/pluginmanager.h> +#include <projectexplorer/buildmanager.h> +#include <projectexplorer/projectexplorer.h> #include <utils/qtcassert.h> #include <QtGui/QIcon> @@ -174,11 +176,16 @@ void Target::addBuildConfiguration(BuildConfiguration *configuration) setActiveBuildConfiguration(configuration); } -void Target::removeBuildConfiguration(BuildConfiguration *configuration) +bool Target::removeBuildConfiguration(BuildConfiguration *configuration) { //todo: this might be error prone if (!d->m_buildConfigurations.contains(configuration)) - return; + return false; + + ProjectExplorer::BuildManager *bm = + ProjectExplorer::ProjectExplorerPlugin::instance()->buildManager(); + if (bm->isBuilding(configuration)) + return false; d->m_buildConfigurations.removeOne(configuration); @@ -192,6 +199,7 @@ void Target::removeBuildConfiguration(BuildConfiguration *configuration) } delete configuration; + return true; } QList<BuildConfiguration *> Target::buildConfigurations() const @@ -242,11 +250,16 @@ void Target::addDeployConfiguration(DeployConfiguration *dc) Q_ASSERT(activeDeployConfiguration()); } -void Target::removeDeployConfiguration(DeployConfiguration *dc) +bool Target::removeDeployConfiguration(DeployConfiguration *dc) { //todo: this might be error prone if (!d->m_deployConfigurations.contains(dc)) - return; + return false; + + ProjectExplorer::BuildManager *bm = + ProjectExplorer::ProjectExplorerPlugin::instance()->buildManager(); + if (bm->isBuilding(dc)) + return false; d->m_deployConfigurations.removeOne(dc); @@ -260,6 +273,7 @@ void Target::removeDeployConfiguration(DeployConfiguration *dc) } delete dc; + return true; } QList<DeployConfiguration *> Target::deployConfigurations() const diff --git a/src/plugins/projectexplorer/target.h b/src/plugins/projectexplorer/target.h index 1a2f3bf88a..f5e10d0bd2 100644 --- a/src/plugins/projectexplorer/target.h +++ b/src/plugins/projectexplorer/target.h @@ -67,7 +67,7 @@ public: // Build configuration void addBuildConfiguration(BuildConfiguration *configuration); - void removeBuildConfiguration(BuildConfiguration *configuration); + bool removeBuildConfiguration(BuildConfiguration *configuration); QList<BuildConfiguration *> buildConfigurations() const; BuildConfiguration *activeBuildConfiguration() const; @@ -77,7 +77,7 @@ public: // DeployConfiguration void addDeployConfiguration(DeployConfiguration *dc); - void removeDeployConfiguration(DeployConfiguration *dc); + bool removeDeployConfiguration(DeployConfiguration *dc); QList<DeployConfiguration *> deployConfigurations() const; DeployConfiguration *activeDeployConfiguration() const; diff --git a/src/plugins/projectexplorer/targetsettingspanel.cpp b/src/plugins/projectexplorer/targetsettingspanel.cpp index 3a68ffa1c2..d7e2fc63e6 100644 --- a/src/plugins/projectexplorer/targetsettingspanel.cpp +++ b/src/plugins/projectexplorer/targetsettingspanel.cpp @@ -40,6 +40,8 @@ #include "targetsettingswidget.h" #include <extensionsystem/pluginmanager.h> +#include <projectexplorer/projectexplorer.h> +#include <projectexplorer/buildmanager.h> #include <QtCore/QCoreApplication> #include <QtGui/QLabel> @@ -47,6 +49,7 @@ #include <QtGui/QMessageBox> #include <QtGui/QVBoxLayout> #include <QtGui/QStackedWidget> +#include <QtGui/QPushButton> using namespace ProjectExplorer; using namespace ProjectExplorer::Internal; @@ -230,13 +233,33 @@ void TargetSettingsPanelWidget::removeTarget() { int index = m_selector->currentIndex(); Target *t = m_targets.at(index); - int ret = QMessageBox::warning(this, tr("Qt Creator"), - tr("Do you really want to remove the\n" - "\"%1\" target?").arg(t->displayName()), - QMessageBox::Yes | QMessageBox::No, - QMessageBox::No); - if (ret == QMessageBox::Yes) - m_project->removeTarget(t); + + ProjectExplorer::BuildManager *bm = ProjectExplorerPlugin::instance()->buildManager(); + if (bm->isBuilding(t)) { + QMessageBox box; + QPushButton *closeAnyway = box.addButton(tr("Cancel Build && Remove Target"), QMessageBox::AcceptRole); + QPushButton *cancelClose = box.addButton(tr("Do Not Remove"), QMessageBox::RejectRole); + box.setDefaultButton(cancelClose); + box.setWindowTitle(tr("Remove Target %1?").arg(t->displayName())); + box.setText(tr("The target <b>%1</b> is currently being built.").arg(t->displayName())); + box.setInformativeText(tr("Do you want to cancel the build process and remove the Target anyway?")); + box.exec(); + if (box.clickedButton() != closeAnyway) + return; + bm->cancel(); + } else { + // We don't show the generic message box on removing the target, if we showed the still building one + int ret = QMessageBox::warning(this, tr("Qt Creator"), + tr("Do you really want to remove the\n" + "\"%1\" target?").arg(t->displayName()), + QMessageBox::Yes | QMessageBox::No, + QMessageBox::No); + if (ret != QMessageBox::Yes) + return; + } + + m_project->removeTarget(t); + } void TargetSettingsPanelWidget::targetAdded(ProjectExplorer::Target *target) diff --git a/src/plugins/qmldesigner/components/integration/designdocumentcontroller.cpp b/src/plugins/qmldesigner/components/integration/designdocumentcontroller.cpp index a24210b0d1..57a23677fa 100644 --- a/src/plugins/qmldesigner/components/integration/designdocumentcontroller.cpp +++ b/src/plugins/qmldesigner/components/integration/designdocumentcontroller.cpp @@ -448,9 +448,10 @@ void DesignDocumentController::changeCurrentModelTo(const ModelNode &node) if (Internal::DesignModeWidget::instance()->currentDesignDocumentController() != this) return; DesignDocumentControllerPrivate::clearCrumblePath = false; - while (!d->formEditorView->crumblePath()->dataForLastIndex().value<CrumbleBarInfo>().modelNode.isRootNode()) + while (d->formEditorView->crumblePath()->dataForLastIndex().value<CrumbleBarInfo>().modelNode.isValid() && + !d->formEditorView->crumblePath()->dataForLastIndex().value<CrumbleBarInfo>().modelNode.isRootNode()) d->formEditorView->crumblePath()->popElement(); - if (node.isRootNode()) + if (node.isRootNode() && d->formEditorView->crumblePath()->dataForLastIndex().isValid()) d->formEditorView->crumblePath()->popElement(); changeToSubComponent(node); DesignDocumentControllerPrivate::clearCrumblePath = true; @@ -537,8 +538,10 @@ void DesignDocumentController::goIntoComponent() if (d->formEditorView) selectedNodes = d->formEditorView->selectedModelNodes(); + DesignDocumentControllerPrivate::clearCrumblePath = false; if (selectedNodes.count() == 1) ModelNodeAction::goIntoComponent(selectedNodes.first()); + DesignDocumentControllerPrivate::clearCrumblePath = true; } void DesignDocumentController::loadCurrentModel() diff --git a/src/plugins/qmljseditor/qmljseditorfactory.cpp b/src/plugins/qmljseditor/qmljseditorfactory.cpp index 5945e0d23c..d7ca6d6bb3 100644 --- a/src/plugins/qmljseditor/qmljseditorfactory.cpp +++ b/src/plugins/qmljseditor/qmljseditorfactory.cpp @@ -53,37 +53,6 @@ #include <QtGui/QPushButton> #include <QtGui/QMainWindow> -namespace { - const char * const QMLDESIGNER_INFO_BAR = "QmlJSEditor.QmlDesignerInfoBar"; - const char * const KEY_QMLGROUP = "QML"; - const char * const KEY_NAGABOUTDESIGNER = "AskAboutVisualDesigner"; - - bool isQmlDesignerExperimentallyDisabled() - { - ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance(); - foreach (const ExtensionSystem::PluginSpec *spec, pm->plugins()) { - if (spec->name() == QLatin1String("QmlDesigner")) { - if (spec->isExperimental() && !spec->isEnabled()) - return true; - return false; - } - } - return false; - } - - bool isNaggingAboutExperimentalDesignerEnabled() - { - if (!isQmlDesignerExperimentallyDisabled()) { - return false; - } - QSettings *settings = Core::ICore::instance()->settings(); - settings->beginGroup(QLatin1String(KEY_QMLGROUP)); - bool nag = settings->value(QLatin1String(KEY_NAGABOUTDESIGNER), true).toBool(); - settings->endGroup(); - return nag; - } -} - using namespace QmlJSEditor; using namespace QmlJSEditor::Internal; using namespace QmlJSEditor::Constants; @@ -123,13 +92,6 @@ Core::IEditor *QmlJSEditorFactory::createEditor(QWidget *parent) { QmlJSEditor::QmlJSTextEditorWidget *rc = new QmlJSEditor::QmlJSTextEditorWidget(parent); QmlJSEditorPlugin::instance()->initializeEditor(rc); - if (isNaggingAboutExperimentalDesignerEnabled()) { - Core::InfoBarEntry info(QMLDESIGNER_INFO_BAR, - tr("Do you want to enable the experimental Qt Quick Designer?")); - info.setCustomButtonInfo(tr("Enable Qt Quick Designer"), this, SLOT(activateQmlDesigner())); - info.setCancelButtonInfo(this, SLOT(neverAskAgainAboutQmlDesigner())); - rc->file()->infoBar()->addInfo(info); - } return rc->editor(); } @@ -137,50 +99,3 @@ QStringList QmlJSEditorFactory::mimeTypes() const { return m_mimeTypes; } - -void QmlJSEditorFactory::activateQmlDesigner() -{ - QString menu; -#ifdef Q_WS_MAC - menu = tr("Qt Creator -> About Plugins..."); -#else - menu = tr("Help -> About Plugins..."); -#endif - QMessageBox message(Core::ICore::instance()->mainWindow()); - message.setWindowTitle(tr("Enable experimental Qt Quick Designer?")); - message.setText(tr("Do you want to enable the experimental Qt Quick Designer? " - "After enabling it, you can access the visual design capabilities by switching to Design Mode. " - "This can affect the overall stability of Qt Creator. " - "To disable Qt Quick Designer again, visit the menu '%1' and disable 'QmlDesigner'.").arg(menu)); - message.setIcon(QMessageBox::Question); - QPushButton *enable = message.addButton(tr("Enable Qt Quick Designer"), QMessageBox::AcceptRole); - message.addButton(tr("Cancel"), QMessageBox::RejectRole); - message.exec(); - if (message.clickedButton() == enable) { - ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance(); - foreach (ExtensionSystem::PluginSpec *spec, pm->plugins()) { - if (spec->name() == QLatin1String("QmlDesigner")) { - spec->setEnabled(true); - pm->writeSettings(); - QMessageBox::information(Core::ICore::instance()->mainWindow(), tr("Please restart Qt Creator"), - tr("Please restart Qt Creator to make the change effective.")); - foreach (Core::IEditor *editor, Core::EditorManager::instance()->openedEditors()) - if (qobject_cast<QmlJSEditorEditable *>(editor)) - editor->file()->infoBar()->removeInfo(QMLDESIGNER_INFO_BAR); - neverAskAgainAboutQmlDesigner(); - return; - } - } - } -} - -void QmlJSEditorFactory::neverAskAgainAboutQmlDesigner() -{ - QSettings *settings = Core::ICore::instance()->settings(); - settings->beginGroup(QLatin1String(KEY_QMLGROUP)); - settings->setValue(QLatin1String(KEY_NAGABOUTDESIGNER), false); - settings->endGroup(); - settings->sync(); - disconnect(Core::EditorManager::instance(), SIGNAL(currentEditorChanged(Core::IEditor*)), - this, SLOT(updateEditorInfoBar(Core::IEditor*))); -} diff --git a/src/plugins/qmljseditor/qmljseditorfactory.h b/src/plugins/qmljseditor/qmljseditorfactory.h index ee9047e7a2..adbea9ab47 100644 --- a/src/plugins/qmljseditor/qmljseditorfactory.h +++ b/src/plugins/qmljseditor/qmljseditorfactory.h @@ -54,10 +54,6 @@ public: Core::IFile *open(const QString &fileName); Core::IEditor *createEditor(QWidget *parent); -private slots: - void activateQmlDesigner(); - void neverAskAgainAboutQmlDesigner(); - private: QStringList m_mimeTypes; }; diff --git a/src/plugins/qmljstools/qmljsindenter.cpp b/src/plugins/qmljstools/qmljsindenter.cpp index 3c08e61490..69cf555c26 100644 --- a/src/plugins/qmljstools/qmljsindenter.cpp +++ b/src/plugins/qmljstools/qmljsindenter.cpp @@ -70,6 +70,8 @@ void Indenter::indentBlock(QTextDocument *doc, codeFormatter.updateStateUntil(block); const int depth = codeFormatter.indentFor(block); + if (depth == -1) + return; if (isElectricCharacter(typedChar)) { // only reindent the current line when typing electric characters if the diff --git a/src/plugins/qmljstools/qmljsrefactoringchanges.cpp b/src/plugins/qmljstools/qmljsrefactoringchanges.cpp index d30f8fd932..c86f51a482 100644 --- a/src/plugins/qmljstools/qmljsrefactoringchanges.cpp +++ b/src/plugins/qmljstools/qmljsrefactoringchanges.cpp @@ -69,7 +69,9 @@ public: codeFormatter.updateStateUntil(block); do { - tabSettings.indentLine(block, codeFormatter.indentFor(block)); + const int depth = codeFormatter.indentFor(block); + if (depth != -1) + tabSettings.indentLine(block, depth); codeFormatter.updateLineStateChange(block); block = block.next(); } while (block.isValid() && block != end); diff --git a/src/plugins/qt4projectmanager/qt-s60/rvcttoolchain.cpp b/src/plugins/qt4projectmanager/qt-s60/rvcttoolchain.cpp index 52083b859c..60468138dc 100644 --- a/src/plugins/qt4projectmanager/qt-s60/rvcttoolchain.cpp +++ b/src/plugins/qt4projectmanager/qt-s60/rvcttoolchain.cpp @@ -409,6 +409,11 @@ RvctToolChainConfigWidget::RvctToolChainConfigWidget(RvctToolChain *tc) : setFromToolChain(); } +RvctToolChainConfigWidget::~RvctToolChainConfigWidget() +{ + delete m_ui; +} + void RvctToolChainConfigWidget::apply() { RvctToolChain *tc = static_cast<RvctToolChain *>(toolChain()); diff --git a/src/plugins/qt4projectmanager/qt-s60/rvcttoolchain.h b/src/plugins/qt4projectmanager/qt-s60/rvcttoolchain.h index 6580afe5d4..b134f721d4 100644 --- a/src/plugins/qt4projectmanager/qt-s60/rvcttoolchain.h +++ b/src/plugins/qt4projectmanager/qt-s60/rvcttoolchain.h @@ -143,6 +143,7 @@ class RvctToolChainConfigWidget : public ProjectExplorer::ToolChainConfigWidget public: RvctToolChainConfigWidget(RvctToolChain *tc); + ~RvctToolChainConfigWidget(); void apply(); void discard() { setFromToolChain(); } diff --git a/src/plugins/qt4projectmanager/qt-s60/winscwtoolchain.cpp b/src/plugins/qt4projectmanager/qt-s60/winscwtoolchain.cpp index 367d6f52c0..0d93c8a4ac 100644 --- a/src/plugins/qt4projectmanager/qt-s60/winscwtoolchain.cpp +++ b/src/plugins/qt4projectmanager/qt-s60/winscwtoolchain.cpp @@ -319,6 +319,11 @@ WinscwToolChainConfigWidget::WinscwToolChainConfigWidget(WinscwToolChain *tc) : discard(); } +WinscwToolChainConfigWidget::~WinscwToolChainConfigWidget() +{ + delete m_ui; +} + void WinscwToolChainConfigWidget::apply() { WinscwToolChain *tc = static_cast<WinscwToolChain *>(toolChain()); diff --git a/src/plugins/qt4projectmanager/qt-s60/winscwtoolchain.h b/src/plugins/qt4projectmanager/qt-s60/winscwtoolchain.h index 198b36bacf..aa8c13818a 100644 --- a/src/plugins/qt4projectmanager/qt-s60/winscwtoolchain.h +++ b/src/plugins/qt4projectmanager/qt-s60/winscwtoolchain.h @@ -105,6 +105,7 @@ class WinscwToolChainConfigWidget : public ProjectExplorer::ToolChainConfigWidge public: WinscwToolChainConfigWidget(WinscwToolChain *); + ~WinscwToolChainConfigWidget(); void apply(); void discard(); diff --git a/src/plugins/qt4projectmanager/qt4target.cpp b/src/plugins/qt4projectmanager/qt4target.cpp index dcc9246ac8..f50145771c 100644 --- a/src/plugins/qt4projectmanager/qt4target.cpp +++ b/src/plugins/qt4projectmanager/qt4target.cpp @@ -296,6 +296,20 @@ QList<ProjectExplorer::ToolChain *> Qt4BaseTarget::possibleToolChains(ProjectExp return result; } +ProjectExplorer::ToolChain *Qt4BaseTarget::preferredToolChain(ProjectExplorer::BuildConfiguration *bc) const +{ + Qt4BuildConfiguration *qtBc = qobject_cast<Qt4BuildConfiguration *>(bc); + if (!qtBc || !qtBc->qtVersion()) + return Target::preferredToolChain(bc); + + QList<ProjectExplorer::ToolChain *> tcs = possibleToolChains(bc); + const QString mkspec = qtBc->qtVersion()->mkspec(); + foreach (ProjectExplorer::ToolChain *tc, tcs) + if (tc->mkspec() == mkspec) + return tc; + return tcs.isEmpty() ? 0 : tcs.at(0); +} + void Qt4BaseTarget::removeUnconfiguredCustomExectutableRunConfigurations() { if (runConfigurations().count()) { diff --git a/src/plugins/qt4projectmanager/qt4target.h b/src/plugins/qt4projectmanager/qt4target.h index e79af16fe6..9f25795aee 100644 --- a/src/plugins/qt4projectmanager/qt4target.h +++ b/src/plugins/qt4projectmanager/qt4target.h @@ -90,6 +90,7 @@ public: virtual QList<ProjectExplorer::RunConfiguration *> runConfigurationsForNode(ProjectExplorer::Node *n) = 0; QList<ProjectExplorer::ToolChain *> possibleToolChains(ProjectExplorer::BuildConfiguration *bc) const; + ProjectExplorer::ToolChain *preferredToolChain(ProjectExplorer::BuildConfiguration *) const; signals: void buildDirectoryInitialized(); diff --git a/src/plugins/qtsupport/baseqtversion.cpp b/src/plugins/qtsupport/baseqtversion.cpp index bba4f9a0a7..9e1a1bb4cd 100644 --- a/src/plugins/qtsupport/baseqtversion.cpp +++ b/src/plugins/qtsupport/baseqtversion.cpp @@ -955,7 +955,7 @@ QStringList BaseQtVersion::debuggingHelperLibraryLocations() const QString qtInstallData = versionInfo().value("QT_INSTALL_DATA"); if (qtInstallData.isEmpty()) return QStringList(); - return ProjectExplorer::DebuggingHelperLibrary::locationsByInstallData(qtInstallData); + return ProjectExplorer::DebuggingHelperLibrary::debuggingHelperLibraryDirectories(qtInstallData); } bool BaseQtVersion::supportsBinaryDebuggingHelper() const diff --git a/src/plugins/qtsupport/exampleslistmodel.cpp b/src/plugins/qtsupport/exampleslistmodel.cpp index ee143ea0b7..4a19d0d06d 100644 --- a/src/plugins/qtsupport/exampleslistmodel.cpp +++ b/src/plugins/qtsupport/exampleslistmodel.cpp @@ -275,6 +275,9 @@ QStringList ExamplesListModel::exampleSources() const // Try to get dir from first Qt Version QtVersionManager *versionManager = QtVersionManager::instance(); foreach (BaseQtVersion *version, versionManager->validVersions()) { + // There is no good solution for Qt 5 yet + if (version->qtVersion().majorVersion != 4) + continue; QDir examplesDir(version->examplesPath()); if (examplesDir.exists()) { diff --git a/src/plugins/texteditor/basetexteditor.cpp b/src/plugins/texteditor/basetexteditor.cpp index 3b2b3ceb0f..f53131e767 100644 --- a/src/plugins/texteditor/basetexteditor.cpp +++ b/src/plugins/texteditor/basetexteditor.cpp @@ -5538,8 +5538,13 @@ void BaseTextEditorWidget::setFontSettings(const TextEditor::FontSettings &fs) void BaseTextEditorWidget::setTabSettings(const TabSettings &ts) { d->m_document->setTabSettings(ts); - int charWidth = QFontMetrics(font()).width(QChar(' ')); - setTabStopWidth(charWidth * ts.m_tabSize); + + // Although the tab stop is stored as qreal the API from QPlainTextEdit only allows it + // to be set as an int. A work around is to access directly the QTextOption. + qreal charWidth = QFontMetricsF(font()).width(QChar(' ')); + QTextOption option = document()->defaultTextOption(); + option.setTabStop(charWidth * ts.m_tabSize); + document()->setDefaultTextOption(option); } void BaseTextEditorWidget::setDisplaySettings(const DisplaySettings &ds) diff --git a/src/plugins/texteditor/codestyleeditor.cpp b/src/plugins/texteditor/codestyleeditor.cpp index bdad029b47..976eef229d 100644 --- a/src/plugins/texteditor/codestyleeditor.cpp +++ b/src/plugins/texteditor/codestyleeditor.cpp @@ -69,6 +69,9 @@ CodeStyleEditor::CodeStyleEditor(ICodeStylePreferencesFactory *factory, tr("Edit preview contents to see how the current settings " "are applied to custom code snippets. Changes in the preview " "do not affect the current settings."), this); + QFont font = label->font(); + font.setItalic(true); + label->setFont(font); label->setWordWrap(true); m_layout->addWidget(selector); m_layout->addWidget(m_preview); diff --git a/src/plugins/texteditor/codestyleselectorwidget.cpp b/src/plugins/texteditor/codestyleselectorwidget.cpp index b291e4e2a4..b76d4f4025 100644 --- a/src/plugins/texteditor/codestyleselectorwidget.cpp +++ b/src/plugins/texteditor/codestyleselectorwidget.cpp @@ -31,6 +31,7 @@ **************************************************************************/ #include "codestyleselectorwidget.h" +#include "ui_codestyleselectorwidget.h" #include "icodestylepreferences.h" #include "icodestylepreferencesfactory.h" #include "codestylepool.h" @@ -67,15 +68,23 @@ public: ICodeStylePreferences *codeStyle, QWidget *parent = 0); ~CodeStyleDialog(); ICodeStylePreferences *codeStyle() const; - QString displayName() const; +private slots: + void slotCopyClicked(); + void slotDisplayNameChanged(); private: ICodeStylePreferences *m_codeStyle; QLineEdit *m_lineEdit; + QDialogButtonBox *m_buttons; + QLabel *m_warningLabel; + QPushButton *m_copyButton; + QString m_originalDisplayName; }; CodeStyleDialog::CodeStyleDialog(ICodeStylePreferencesFactory *factory, ICodeStylePreferences *codeStyle, QWidget *parent) - : QDialog(parent) + : QDialog(parent), + m_warningLabel(0), + m_copyButton(0) { setWindowTitle(tr("Edit Code Style")); QVBoxLayout *layout = new QVBoxLayout(this); @@ -85,17 +94,46 @@ CodeStyleDialog::CodeStyleDialog(ICodeStylePreferencesFactory *factory, nameLayout->addWidget(label); nameLayout->addWidget(m_lineEdit); layout->addLayout(nameLayout); + + if (codeStyle->isReadOnly()) { + QHBoxLayout *warningLayout = new QHBoxLayout(); + m_warningLabel = new QLabel( + tr("You cannot save changes to a built-in code style. " + "Copy it first to create your own version."), this); + QFont font = m_warningLabel->font(); + font.setItalic(true); + m_warningLabel->setFont(font); + m_warningLabel->setWordWrap(true); + m_copyButton = new QPushButton(tr("Copy Built-in Code Style"), this); + m_copyButton->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); + connect(m_copyButton, SIGNAL(clicked()), + this, SLOT(slotCopyClicked())); + warningLayout->addWidget(m_warningLabel); + warningLayout->addWidget(m_copyButton); + layout->addLayout(warningLayout); + } + + m_originalDisplayName = codeStyle->displayName(); m_codeStyle = factory->createCodeStyle(); m_codeStyle->setTabSettings(codeStyle->tabSettings()); m_codeStyle->setValue(codeStyle->value()); + m_codeStyle->setDisplayName(m_originalDisplayName); QWidget *editor = factory->createEditor(m_codeStyle, this); - QDialogButtonBox *buttons = new QDialogButtonBox( + + m_buttons = new QDialogButtonBox( QDialogButtonBox::Ok | QDialogButtonBox::Cancel, Qt::Horizontal, this); + if (codeStyle->isReadOnly()) { + QPushButton *okButton = m_buttons->button(QDialogButtonBox::Ok); + okButton->setEnabled(false); + } + if (editor) layout->addWidget(editor); - layout->addWidget(buttons); - connect(buttons, SIGNAL(accepted()), this, SLOT(accept())); - connect(buttons, SIGNAL(rejected()), this, SLOT(reject())); + layout->addWidget(m_buttons); + + connect(m_lineEdit, SIGNAL(textChanged(QString)), this, SLOT(slotDisplayNameChanged())); + connect(m_buttons, SIGNAL(accepted()), this, SLOT(accept())); + connect(m_buttons, SIGNAL(rejected()), this, SLOT(reject())); } ICodeStylePreferences *CodeStyleDialog::codeStyle() const @@ -103,9 +141,22 @@ ICodeStylePreferences *CodeStyleDialog::codeStyle() const return m_codeStyle; } -QString CodeStyleDialog::displayName() const +void CodeStyleDialog::slotCopyClicked() +{ + if (m_warningLabel) + m_warningLabel->hide(); + if (m_copyButton) + m_copyButton->hide(); + QPushButton *okButton = m_buttons->button(QDialogButtonBox::Ok); + okButton->setEnabled(true); + if (m_lineEdit->text() == m_originalDisplayName) + m_lineEdit->setText(tr("%1 (Copy)").arg(m_lineEdit->text())); + m_lineEdit->selectAll(); +} + +void CodeStyleDialog::slotDisplayNameChanged() { - return m_lineEdit->text(); + m_codeStyle->setDisplayName(m_lineEdit->text()); } CodeStyleDialog::~CodeStyleDialog() @@ -120,48 +171,32 @@ CodeStyleSelectorWidget::CodeStyleSelectorWidget(ICodeStylePreferencesFactory *f QWidget(parent), m_factory(factory), m_codeStyle(0), - m_layout(0), - m_comboBox(0), - m_comboBoxLabel(0), + m_ui(new Ui::CodeStyleSelectorWidget), m_ignoreGuiSignals(false) { - m_layout = new QHBoxLayout(this); - m_layout->setContentsMargins(QMargins()); - m_copyButton = new QPushButton(tr("Copy..."), this); - m_editButton = new QPushButton(tr("Edit..."), this); - m_removeButton = new QPushButton(tr("Remove"), this); - m_importButton = new QPushButton(tr("Import..."), this); - m_exportButton = new QPushButton(tr("Export..."), this); - m_importButton->setEnabled(false); - m_exportButton->setEnabled(false); - - m_comboBoxLabel = new QLabel(tr("Current settings:"), this); - m_comboBoxLabel->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); - m_layout->addWidget(m_comboBoxLabel); - m_comboBox = new QComboBox(this); - m_comboBox->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); - m_layout->addWidget(m_comboBox); - connect(m_comboBox, SIGNAL(activated(int)), - this, SLOT(slotComboBoxActivated(int))); - - m_layout->addWidget(m_copyButton); - m_layout->addWidget(m_editButton); - m_layout->addWidget(m_removeButton); - m_layout->addWidget(m_importButton); - m_layout->addWidget(m_exportButton); + m_ui->setupUi(this); + m_ui->importButton->setEnabled(false); + m_ui->exportButton->setEnabled(false); - connect(m_copyButton, SIGNAL(clicked()), + connect(m_ui->delegateComboBox, SIGNAL(activated(int)), + this, SLOT(slotComboBoxActivated(int))); + connect(m_ui->copyButton, SIGNAL(clicked()), this, SLOT(slotCopyClicked())); - connect(m_editButton, SIGNAL(clicked()), + connect(m_ui->editButton, SIGNAL(clicked()), this, SLOT(slotEditClicked())); - connect(m_removeButton, SIGNAL(clicked()), + connect(m_ui->removeButton, SIGNAL(clicked()), this, SLOT(slotRemoveClicked())); - connect(m_importButton, SIGNAL(clicked()), + connect(m_ui->importButton, SIGNAL(clicked()), this, SLOT(slotImportClicked())); - connect(m_exportButton, SIGNAL(clicked()), + connect(m_ui->exportButton, SIGNAL(clicked()), this, SLOT(slotExportClicked())); } +CodeStyleSelectorWidget::~CodeStyleSelectorWidget() +{ + delete m_ui; +} + void CodeStyleSelectorWidget::setCodeStyle(TextEditor::ICodeStylePreferences *codeStyle) { if (m_codeStyle == codeStyle) @@ -179,9 +214,9 @@ void CodeStyleSelectorWidget::setCodeStyle(TextEditor::ICodeStylePreferences *co disconnect(m_codeStyle, SIGNAL(currentDelegateChanged(ICodeStylePreferences*)), this, SLOT(slotCurrentDelegateChanged(ICodeStylePreferences*))); - m_exportButton->setEnabled(false); - m_importButton->setEnabled(false); - m_comboBox->clear(); + m_ui->exportButton->setEnabled(false); + m_ui->importButton->setEnabled(false); + m_ui->delegateComboBox->clear(); } m_codeStyle = codeStyle; // fillup new @@ -195,8 +230,8 @@ void CodeStyleSelectorWidget::setCodeStyle(TextEditor::ICodeStylePreferences *co this, SLOT(slotCodeStyleAdded(ICodeStylePreferences*))); connect(codeStylePool, SIGNAL(codeStyleRemoved(ICodeStylePreferences*)), this, SLOT(slotCodeStyleRemoved(ICodeStylePreferences*))); - m_exportButton->setEnabled(true); - m_importButton->setEnabled(true); + m_ui->exportButton->setEnabled(true); + m_ui->importButton->setEnabled(true); } for (int i = 0; i < delegates.count(); i++) @@ -214,10 +249,10 @@ void CodeStyleSelectorWidget::slotComboBoxActivated(int index) if (m_ignoreGuiSignals) return; - if (!m_comboBox || index < 0 || index >= m_comboBox->count()) + if (index < 0 || index >= m_ui->delegateComboBox->count()) return; TextEditor::ICodeStylePreferences *delegate = - m_comboBox->itemData(index).value<TextEditor::ICodeStylePreferences *>(); + m_ui->delegateComboBox->itemData(index).value<TextEditor::ICodeStylePreferences *>(); const bool wasBlocked = blockSignals(true); m_codeStyle->setCurrentDelegate(delegate); @@ -227,15 +262,12 @@ void CodeStyleSelectorWidget::slotComboBoxActivated(int index) void CodeStyleSelectorWidget::slotCurrentDelegateChanged(TextEditor::ICodeStylePreferences *delegate) { m_ignoreGuiSignals = true; - if (m_comboBox) { - m_comboBox->setCurrentIndex(m_comboBox->findData(QVariant::fromValue(delegate))); - m_comboBox->setToolTip(m_comboBox->currentText()); - } + m_ui->delegateComboBox->setCurrentIndex(m_ui->delegateComboBox->findData(QVariant::fromValue(delegate))); + m_ui->delegateComboBox->setToolTip(m_ui->delegateComboBox->currentText()); m_ignoreGuiSignals = false; - const bool enableEdit = delegate && !delegate->isReadOnly() && !delegate->currentDelegate(); - m_editButton->setEnabled(enableEdit); - m_removeButton->setEnabled(enableEdit); + const bool removeEnabled = delegate && !delegate->isReadOnly() && !delegate->currentDelegate(); + m_ui->removeButton->setEnabled(removeEnabled); } void CodeStyleSelectorWidget::slotCopyClicked() @@ -271,9 +303,16 @@ void CodeStyleSelectorWidget::slotEditClicked() Internal::CodeStyleDialog dialog(m_factory, codeStyle, this); if (dialog.exec() == QDialog::Accepted) { ICodeStylePreferences *dialogCodeStyle = dialog.codeStyle(); + if (codeStyle->isReadOnly()) { + CodeStylePool *codeStylePool = m_codeStyle->delegatingPool(); + codeStyle = codeStylePool->cloneCodeStyle(dialogCodeStyle); + if (codeStyle) + m_codeStyle->setCurrentDelegate(codeStyle); + return; + } codeStyle->setTabSettings(dialogCodeStyle->tabSettings()); codeStyle->setValue(dialogCodeStyle->value()); - codeStyle->setDisplayName(dialog.displayName()); + codeStyle->setDisplayName(dialogCodeStyle->displayName()); } } @@ -337,8 +376,8 @@ void CodeStyleSelectorWidget::slotCodeStyleAdded(ICodeStylePreferences *codeStyl const QVariant data = QVariant::fromValue(codeStylePreferences); const QString name = displayName(codeStylePreferences); - m_comboBox->addItem(name, data); - m_comboBox->setItemData(m_comboBox->count() - 1, name, Qt::ToolTipRole); + m_ui->delegateComboBox->addItem(name, data); + m_ui->delegateComboBox->setItemData(m_ui->delegateComboBox->count() - 1, name, Qt::ToolTipRole); connect(codeStylePreferences, SIGNAL(displayNameChanged(QString)), this, SLOT(slotUpdateName())); if (codeStylePreferences->delegatingPool()) { @@ -350,7 +389,7 @@ void CodeStyleSelectorWidget::slotCodeStyleAdded(ICodeStylePreferences *codeStyl void CodeStyleSelectorWidget::slotCodeStyleRemoved(ICodeStylePreferences *codeStylePreferences) { m_ignoreGuiSignals = true; - m_comboBox->removeItem(m_comboBox->findData(QVariant::fromValue(codeStylePreferences))); + m_ui->delegateComboBox->removeItem(m_ui->delegateComboBox->findData(QVariant::fromValue(codeStylePreferences))); disconnect(codeStylePreferences, SIGNAL(displayNameChanged(QString)), this, SLOT(slotUpdateName())); if (codeStylePreferences->delegatingPool()) { @@ -375,18 +414,18 @@ void CodeStyleSelectorWidget::slotUpdateName() updateName(codeStyle); } - m_comboBox->setToolTip(m_comboBox->currentText()); + m_ui->delegateComboBox->setToolTip(m_ui->delegateComboBox->currentText()); } void CodeStyleSelectorWidget::updateName(ICodeStylePreferences *codeStyle) { - const int idx = m_comboBox->findData(QVariant::fromValue(codeStyle)); + const int idx = m_ui->delegateComboBox->findData(QVariant::fromValue(codeStyle)); if (idx < 0) return; const QString name = displayName(codeStyle); - m_comboBox->setItemText(idx, name); - m_comboBox->setItemData(idx, name, Qt::ToolTipRole); + m_ui->delegateComboBox->setItemText(idx, name); + m_ui->delegateComboBox->setItemData(idx, name, Qt::ToolTipRole); } QString CodeStyleSelectorWidget::displayName(ICodeStylePreferences *codeStyle) const diff --git a/src/plugins/texteditor/codestyleselectorwidget.h b/src/plugins/texteditor/codestyleselectorwidget.h index a8cd5fa421..0759a916b4 100644 --- a/src/plugins/texteditor/codestyleselectorwidget.h +++ b/src/plugins/texteditor/codestyleselectorwidget.h @@ -50,11 +50,16 @@ namespace TextEditor { class ICodeStylePreferences; class ICodeStylePreferencesFactory; +namespace Ui { +class CodeStyleSelectorWidget; +} + class TEXTEDITOR_EXPORT CodeStyleSelectorWidget : public QWidget { Q_OBJECT public: explicit CodeStyleSelectorWidget(ICodeStylePreferencesFactory *factory, QWidget *parent = 0); + ~CodeStyleSelectorWidget(); void setCodeStyle(TextEditor::ICodeStylePreferences *codeStyle); QString searchKeywords() const; @@ -80,15 +85,7 @@ private: QString displayName(ICodeStylePreferences *codeStyle) const; - QHBoxLayout *m_layout; - - QComboBox *m_comboBox; - QLabel *m_comboBoxLabel; - QPushButton *m_copyButton; - QPushButton *m_editButton; - QPushButton *m_removeButton; - QPushButton *m_importButton; - QPushButton *m_exportButton; + Ui::CodeStyleSelectorWidget *m_ui; bool m_ignoreGuiSignals; }; diff --git a/src/plugins/texteditor/codestyleselectorwidget.ui b/src/plugins/texteditor/codestyleselectorwidget.ui new file mode 100644 index 0000000000..462062cd94 --- /dev/null +++ b/src/plugins/texteditor/codestyleselectorwidget.ui @@ -0,0 +1,87 @@ +<?xml version="1.0" encoding="UTF-8"?> +<ui version="4.0"> + <class>TextEditor::CodeStyleSelectorWidget</class> + <widget class="QWidget" name="TextEditor::CodeStyleSelectorWidget"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>523</width> + <height>58</height> + </rect> + </property> + <property name="windowTitle"> + <string>Form</string> + </property> + <layout class="QGridLayout" name="gridLayout"> + <property name="margin"> + <number>0</number> + </property> + <item row="0" column="0"> + <layout class="QHBoxLayout" name="horizontalLayout"> + <item> + <widget class="QLabel" name="label"> + <property name="text"> + <string>Current settings:</string> + </property> + </widget> + </item> + <item> + <widget class="QComboBox" name="delegateComboBox"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Expanding" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + </widget> + </item> + </layout> + </item> + <item row="0" column="1"> + <widget class="QPushButton" name="copyButton"> + <property name="text"> + <string>Copy...</string> + </property> + </widget> + </item> + <item row="0" column="2"> + <widget class="QPushButton" name="editButton"> + <property name="text"> + <string>Edit...</string> + </property> + </widget> + </item> + <item row="0" column="3"> + <widget class="QPushButton" name="removeButton"> + <property name="text"> + <string>Remove</string> + </property> + </widget> + </item> + <item row="0" column="4"> + <widget class="QPushButton" name="exportButton"> + <property name="text"> + <string>Export...</string> + </property> + </widget> + </item> + <item row="1" column="4"> + <widget class="QPushButton" name="importButton"> + <property name="text"> + <string>Import...</string> + </property> + </widget> + </item> + </layout> + </widget> + <tabstops> + <tabstop>delegateComboBox</tabstop> + <tabstop>copyButton</tabstop> + <tabstop>editButton</tabstop> + <tabstop>removeButton</tabstop> + <tabstop>exportButton</tabstop> + </tabstops> + <resources/> + <connections/> +</ui> diff --git a/src/plugins/texteditor/texteditor.pro b/src/plugins/texteditor/texteditor.pro index d5b418533f..afe8095614 100644 --- a/src/plugins/texteditor/texteditor.pro +++ b/src/plugins/texteditor/texteditor.pro @@ -234,7 +234,8 @@ FORMS += \ snippets/snippetssettingspage.ui \ behaviorsettingswidget.ui \ behaviorsettingspage.ui \ - tabsettingswidget.ui + tabsettingswidget.ui \ + codestyleselectorwidget.ui RESOURCES += texteditor.qrc OTHER_FILES += TextEditor.mimetypes.xml @@ -246,3 +247,4 @@ OTHER_FILES += TextEditor.mimetypes.xml + diff --git a/src/plugins/valgrind/suppressiondialog.cpp b/src/plugins/valgrind/suppressiondialog.cpp index e5e3470534..cdd78e45e6 100644 --- a/src/plugins/valgrind/suppressiondialog.cpp +++ b/src/plugins/valgrind/suppressiondialog.cpp @@ -170,6 +170,11 @@ SuppressionDialog::SuppressionDialog(MemcheckErrorView *view) setWindowTitle(tr("Save Suppression")); } +SuppressionDialog::~SuppressionDialog() +{ + delete m_ui; +} + bool SuppressionDialog::shouldShow() const { return !m_errors.isEmpty(); diff --git a/src/plugins/valgrind/suppressiondialog.h b/src/plugins/valgrind/suppressiondialog.h index 3dc6ff7013..f5d65c0584 100644 --- a/src/plugins/valgrind/suppressiondialog.h +++ b/src/plugins/valgrind/suppressiondialog.h @@ -58,6 +58,7 @@ class SuppressionDialog : public QDialog public: SuppressionDialog(MemcheckErrorView *view); + ~SuppressionDialog(); virtual void accept(); virtual void reject(); diff --git a/src/tools/qmlprofilertool/qmlprofilertool.pro b/src/tools/qmlprofilertool/qmlprofilertool.pro index ff3cadb929..875c6ce1ed 100644 --- a/src/tools/qmlprofilertool/qmlprofilertool.pro +++ b/src/tools/qmlprofilertool/qmlprofilertool.pro @@ -3,7 +3,7 @@ include(../../rpath.pri) TEMPLATE = app TARGET = qmlprofiler -DESTDIR = $$IDE_APP_PATH +DESTDIR = $$IDE_BIN_PATH QT = core CONFIG += console diff --git a/tests/auto/qml/qmleditor/qmlcodeformatter/tst_qmlcodeformatter.cpp b/tests/auto/qml/qmleditor/qmlcodeformatter/tst_qmlcodeformatter.cpp index 938f20df71..df504ad738 100644 --- a/tests/auto/qml/qmleditor/qmlcodeformatter/tst_qmlcodeformatter.cpp +++ b/tests/auto/qml/qmleditor/qmlcodeformatter/tst_qmlcodeformatter.cpp @@ -98,8 +98,11 @@ private Q_SLOTS: void json1(); void multilineTernaryInProperty(); void bug1(); + void multilineString(); }; +enum { DontCheck = -2, DontIndent = -1 }; + struct Line { Line(QString l) : line(l) @@ -142,7 +145,7 @@ void checkIndent(QList<Line> data, int style = 0) int i = 0; foreach (const Line &l, data) { QTextBlock b = document.findBlockByLineNumber(i); - if (l.expectedIndent != -1) { + if (l.expectedIndent != DontCheck) { int actualIndent = formatter.indentFor(b); if (actualIndent != l.expectedIndent) { QFAIL(QString("Wrong indent in line %1 with text '%2', expected indent %3, got %4").arg( @@ -756,9 +759,9 @@ void tst_QMLCodeFormatter::strayElse() data << Line("Rectangle {") << Line("onClicked: {", 4) << Line(" while ( true ) {}") - << Line(" else", -1) - << Line(" else {", -1) - << Line(" }", -1) + << Line(" else", DontCheck) + << Line(" else {", DontCheck) + << Line(" }", DontCheck) << Line("}"); checkIndent(data); } @@ -1292,6 +1295,23 @@ void tst_QMLCodeFormatter::bug1() checkIndent(data); } +void tst_QMLCodeFormatter::multilineString() +{ + QList<Line> data; + data << Line("Item {") + << Line(" a: 'foo") + << Line(" bar", DontIndent) + << Line(" boo boo", DontIndent) + << Line(" end'", DontIndent) + << Line(" a: \"foo") + << Line(" bar", DontIndent) + << Line(" boo boo", DontIndent) + << Line(" end\"", DontIndent) + << Line("}") + ; + checkIndent(data); +} + QTEST_APPLESS_MAIN(tst_QMLCodeFormatter) #include "tst_qmlcodeformatter.moc" diff --git a/tests/system/objects.map b/tests/system/objects.map index 467640fa8b..c2f01bf078 100644 --- a/tests/system/objects.map +++ b/tests/system/objects.map @@ -14,10 +14,10 @@ :CMake Wizard_CMakeProjectManager::Internal::CMakeOpenProjectWizard {type='CMakeProjectManager::Internal::CMakeOpenProjectWizard' unnamed='1' visible='1' windowTitle='CMake Wizard'} :Desktop_QLabel {container=':QtCreator.MenuBar_ProjectExplorer::Internal::ProjectListWidget' name='target' text='Desktop' type='QLabel' visible='1'} :Generator:_QComboBox {buddy=':CMake Wizard.Generator:_QLabel' type='QComboBox' unnamed='1' visible='1'} -:New.Choose..._QPushButton {text='Choose...' type='QPushButton' unnamed='1' visible='1' window=':New_Core::Internal::NewDialog'} :New.templateCategoryView_QTreeView {name='templateCategoryView' type='QTreeView' visible='1' window=':New_Core::Internal::NewDialog'} :New.templatesView_QListView {name='templatesView' type='QListView' visible='1' window=':New_Core::Internal::NewDialog'} :New_Core::Internal::NewDialog {name='Core__Internal__NewDialog' type='Core::Internal::NewDialog' visible='1' windowTitle='New'} +:Next_QPushButton {text~='(Next.*|Continue)' type='QPushButton' visible='1'} :Project Setup.scrollArea_QScrollArea {name='scrollArea' type='QScrollArea' visible='1' window=':Project Setup_Qt4ProjectManager::Internal::ProjectLoadWizard'} :Project Setup_Qt4ProjectManager::Internal::ProjectLoadWizard {type='Qt4ProjectManager::Internal::ProjectLoadWizard' unnamed='1' visible='1' windowTitle='Project Setup'} :Qt Creator.QtCreator.MenuBar_QMenuBar {name='QtCreator.MenuBar' type='QMenuBar' visible='1' window=':Qt Creator_Core::Internal::MainWindow'} @@ -30,7 +30,6 @@ :Qt Creator_Utils::NavigationTreeView {type='Utils::NavigationTreeView' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'} :Qt Gui Application.Form file:_QLabel {name='formLabel' text='Form file:' type='QLabel' visible='1' window=':Qt Gui Application_Qt4ProjectManager::Internal::GuiAppWizardDialog'} :Qt Gui Application.Header file:_QLabel {name='headerLabel' text='Header file:' type='QLabel' visible='1' window=':Qt Gui Application_Qt4ProjectManager::Internal::GuiAppWizardDialog'} -:Qt Gui Application.Next_QPushButton {name='__qt__passive_wizardbutton1' text~='(Next.*|Continue)' type='QPushButton' visible='1' window=':Qt Gui Application_Qt4ProjectManager::Internal::GuiAppWizardDialog'} :Qt Gui Application.Source file:_QLabel {name='sourceLabel' text='Source file:' type='QLabel' visible='1' window=':Qt Gui Application_Qt4ProjectManager::Internal::GuiAppWizardDialog'} :Qt Gui Application.frame_QFrame {name='frame' type='QFrame' visible='1' window=':Qt Gui Application_Qt4ProjectManager::Internal::GuiAppWizardDialog'} :Qt Gui Application.scrollArea_QScrollArea {name='scrollArea' type='QScrollArea' visible='1' window=':Qt Gui Application_Qt4ProjectManager::Internal::GuiAppWizardDialog'} @@ -39,8 +38,6 @@ :QtCreator.MenuBar_ProjectExplorer::Internal::ProjectListWidget {type='ProjectExplorer::Internal::ProjectListWidget' window=':QtCreator.MenuBar_ProjectExplorer::Internal::MiniProjectTargetSelector'} :addToVersionControlComboBox_QComboBox {name='addToVersionControlComboBox' type='QComboBox' visible='1'} :formFileLineEdit_Utils::FileNameValidatingLineEdit {buddy=':Qt Gui Application.Form file:_QLabel' name='formFileLineEdit' type='Utils::FileNameValidatingLineEdit' visible='1'} -:frame.nameLineEdit_Utils::ProjectNameValidatingLineEdit {container=':Qt Gui Application.frame_QFrame' name='nameLineEdit' type='Utils::ProjectNameValidatingLineEdit' visible='1'} -:frame_Utils::BaseValidatingLineEdit {container=':Qt Gui Application.frame_QFrame' type='Utils::BaseValidatingLineEdit' unnamed='1' visible='1'} :headerFileLineEdit_Utils::FileNameValidatingLineEdit {buddy=':Qt Gui Application.Header file:_QLabel' name='headerFileLineEdit' type='Utils::FileNameValidatingLineEdit' visible='1'} :projects.projects.pro_QModelIndex {column='0' container=':projects_QModelIndex' text='projects.pro' type='QModelIndex'} :projects_QModelIndex {column='0' container=':Qt Creator_Utils::NavigationTreeView' text='projects' type='QModelIndex'} diff --git a/tests/system/shared/project.py b/tests/system/shared/project.py index 387f775ca0..cf2850efac 100644 --- a/tests/system/shared/project.py +++ b/tests/system/shared/project.py @@ -53,6 +53,34 @@ def shadowBuildDir(path, project, qtVersion, debugVersion): else: return buildDir + "_Release" +def __createProjectSelectType__(category, template): + invokeMenuItem("File", "New File or Project...") + categoriesView = waitForObject("{type='QTreeView' name='templateCategoryView'}", 20000) + clickItem(categoriesView, "Projects." + category, 5, 5, 0, Qt.LeftButton) + templatesView = waitForObject("{name='templatesView' type='QListView'}", 20000) + clickItem(templatesView, template, 5, 5, 0, Qt.LeftButton) + clickButton(waitForObject("{text='Choose...' type='QPushButton' unnamed='1' visible='1'}", 20000)) + +def createProjectSetNameAndPath(path, projectName = None, checks = True): + directoryEdit = waitForObject("{type='Utils::BaseValidatingLineEdit' unnamed='1' visible='1'}", 20000) + replaceEditorContent(directoryEdit, path) + projectNameEdit = waitForObject("{name='nameLineEdit' visible='1' " + "type='Utils::ProjectNameValidatingLineEdit'}", 20000) + if projectName == None: + projectName = projectNameEdit.text + else: + replaceEditorContent(projectNameEdit, projectName) + if checks: + stateLabel = findObject("{type='QLabel' name='stateLabel'}") + labelCheck = stateLabel.text=="" and stateLabel.styleSheet == "" + test.verify(labelCheck, "Project name and base directory without warning or error") + # make sure this is not set as default location + cbDefaultLocation = waitForObject("{type='QCheckBox' name='projectsDirectoryCheckBox' visible='1'}", 20000) + if cbDefaultLocation.checked: + clickButton(cbDefaultLocation) + clickButton(waitForObject(":Next_QPushButton")) + return projectName + def createProjectHandleLastPage(expectedFiles = None): if expectedFiles != None: summary = str(waitForObject(":scrollArea.Files to be added").text) @@ -65,17 +93,8 @@ def createProjectHandleLastPage(expectedFiles = None): clickButton(waitForObject("{type='QPushButton' text~='(Finish|Done)' visible='1'}", 20000)) def createProject_Qt_GUI(path, projectName, qtVersion, checks): - invokeMenuItem("File", "New File or Project...") - waitForObjectItem(":New.templateCategoryView_QTreeView", "Projects.Qt Widget Project") - clickItem(":New.templateCategoryView_QTreeView", "Projects.Qt Widget Project", 125, 16, 0, Qt.LeftButton) - waitForObjectItem(":New.templatesView_QListView", "Qt Gui Application") - clickItem(":New.templatesView_QListView", "Qt Gui Application", 35, 12, 0, Qt.LeftButton) - clickButton(waitForObject(":New.Choose..._QPushButton")) - directoryEdit = waitForObject(":frame_Utils::BaseValidatingLineEdit") - replaceEditorContent(directoryEdit, path) - projectNameEdit = waitForObject(":frame.nameLineEdit_Utils::ProjectNameValidatingLineEdit") - replaceEditorContent(projectNameEdit, projectName) - clickButton(waitForObject(":Qt Gui Application.Next_QPushButton")) + __createProjectSelectType__("Qt Widget Project", "Qt Gui Application") + createProjectSetNameAndPath(path, projectName, checks) desktopCheckbox = waitForObject(":scrollArea.Desktop_QCheckBox", 20000) if checks: @@ -89,7 +108,8 @@ def createProject_Qt_GUI(path, projectName, qtVersion, checks): path = os.path.abspath(path) verifyChecked(":scrollArea.Qt 4 for Desktop - (Qt SDK) debug_QCheckBox") verifyChecked(":scrollArea.Qt 4 for Desktop - (Qt SDK) release_QCheckBox") - clickButton(waitForObject(":Qt Gui Application.Next_QPushButton")) + nextButton = waitForObject(":Next_QPushButton") + clickButton(nextButton) if checks: exp_filename = "mainwindow" @@ -106,7 +126,7 @@ def createProject_Qt_GUI(path, projectName, qtVersion, checks): test.compare(findObject(":sourceFileLineEdit_Utils::FileNameValidatingLineEdit").text, cpp_file) test.compare(findObject(":formFileLineEdit_Utils::FileNameValidatingLineEdit").text, ui_file) - clickButton(verifyEnabled(":Qt Gui Application.Next_QPushButton")) + clickButton(nextButton) expectedFiles = None if checks: @@ -128,25 +148,8 @@ def createProject_Qt_GUI(path, projectName, qtVersion, checks): test.verify(os.path.exists(pro_path), "Checking if '" + pro_path + "' was created") def createNewQtQuickApplication(workingDir, projectName = None, templateFile = None, targets = QtQuickConstants.Targets.DESKTOP): - invokeMenuItem("File", "New File or Project...") - clickItem(waitForObject("{type='QTreeView' name='templateCategoryView'}", 20000), "Projects.Qt Quick Project", 5, 5, 0, Qt.LeftButton) - clickItem(waitForObject("{name='templatesView' type='QListView'}", 20000), "Qt Quick Application", 5, 5, 0, Qt.LeftButton) - clickButton(waitForObject("{text='Choose...' type='QPushButton' unnamed='1' visible='1'}", 20000)) - if projectName!=None: - baseLineEd = waitForObject("{name='nameLineEdit' visible='1' " - "type='Utils::ProjectNameValidatingLineEdit'}", 20000) - replaceEditorContent(baseLineEd, projectName) - baseLineEd = waitForObject("{type='Utils::BaseValidatingLineEdit' unnamed='1' visible='1'}", 20000) - replaceEditorContent(baseLineEd, workingDir) - stateLabel = findObject("{type='QLabel' name='stateLabel'}") - labelCheck = stateLabel.text=="" and stateLabel.styleSheet == "" - test.verify(labelCheck, "Project name and base directory without warning or error") - # make sure this is not set as default location - cbDefaultLocation = waitForObject("{type='QCheckBox' name='projectsDirectoryCheckBox' visible='1'}", 20000) - if cbDefaultLocation.checked: - clickButton(cbDefaultLocation) - nextButton = waitForObject("{text~='(Next.*|Continue)' type='QPushButton' visible='1'}", 20000) - clickButton(nextButton) + __createProjectSelectType__("Qt Quick Project", "Qt Quick Application") + projectName = createProjectSetNameAndPath(workingDir, projectName) if (templateFile==None): chooseComponents() else: @@ -154,6 +157,7 @@ def createNewQtQuickApplication(workingDir, projectName = None, templateFile = N # define the existing qml file to import baseLineEd = waitForObject("{type='Utils::BaseValidatingLineEdit' unnamed='1' visible='1'}", 20000) type(baseLineEd, templateFile) + nextButton = waitForObject(":Next_QPushButton", 20000) clickButton(nextButton) chooseTargets(targets) snooze(1) @@ -161,45 +165,19 @@ def createNewQtQuickApplication(workingDir, projectName = None, templateFile = N createProjectHandleLastPage() def createNewQtQuickUI(workingDir): - invokeMenuItem("File", "New File or Project...") - clickItem(waitForObject("{type='QTreeView' name='templateCategoryView'}", 20000), "Projects.Qt Quick Project", 5, 5, 0, Qt.LeftButton) - clickItem(waitForObject("{name='templatesView' type='QListView'}", 20000), "Qt Quick UI", 5, 5, 0, Qt.LeftButton) - clickButton(waitForObject("{text='Choose...' type='QPushButton' unnamed='1' visible='1'}", 20000)) - baseLineEd = waitForObject("{type='Utils::BaseValidatingLineEdit' unnamed='1' visible='1'}", 20000) + __createProjectSelectType__("Qt Quick Project", "Qt Quick UI") if workingDir == None: workingDir = tempDir() - replaceEditorContent(baseLineEd, workingDir) - stateLabel = findObject("{type='QLabel' name='stateLabel'}") - labelCheck = stateLabel.text=="" and stateLabel.styleSheet == "" - test.verify(labelCheck, "Project name and base directory without warning or error") - # make sure this is not set as default location - cbDefaultLocation = waitForObject("{type='QCheckBox' name='projectsDirectoryCheckBox' visible='1'}", 20000) - if cbDefaultLocation.checked: - clickButton(cbDefaultLocation) - # now there's the 'untitled' project inside a temporary directory - step forward...! - clickButton(waitForObject("{text~='(Next.*|Continue)' type='QPushButton' visible='1'}", 20000)) + createProjectSetNameAndPath(workingDir) createProjectHandleLastPage() def createNewQmlExtension(workingDir): - invokeMenuItem("File", "New File or Project...") - clickItem(waitForObject("{type='QTreeView' name='templateCategoryView'}", 20000), "Projects.Qt Quick Project", 5, 5, 0, Qt.LeftButton) - clickItem(waitForObject("{name='templatesView' type='QListView'}", 20000), "Custom QML Extension Plugin", 5, 5, 0, Qt.LeftButton) - clickButton(waitForObject("{text='Choose...' type='QPushButton' unnamed='1' visible='1'}", 20000)) - baseLineEd = waitForObject("{type='Utils::BaseValidatingLineEdit' unnamed='1' visible='1'}", 20000) + __createProjectSelectType__("Qt Quick Project", "Custom QML Extension Plugin") if workingDir == None: workingDir = tempDir() - replaceEditorContent(baseLineEd, workingDir) - stateLabel = findObject("{type='QLabel' name='stateLabel'}") - labelCheck = stateLabel.text=="" and stateLabel.styleSheet == "" - test.verify(labelCheck, "Project name and base directory without warning or error") - # make sure this is not set as default location - cbDefaultLocation = waitForObject("{type='QCheckBox' name='projectsDirectoryCheckBox' visible='1'}", 20000) - if cbDefaultLocation.checked: - clickButton(cbDefaultLocation) - # now there's the 'untitled' project inside a temporary directory - step forward...! - nextButton = waitForObject("{text~='(Next.*|Continue)' type='QPushButton' visible='1'}", 20000) - clickButton(nextButton) + createProjectSetNameAndPath(workingDir) chooseTargets() + nextButton = waitForObject(":Next_QPushButton") clickButton(nextButton) nameLineEd = waitForObject("{buddy={type='QLabel' text='Object Class-name:' unnamed='1' visible='1'} " "type='QLineEdit' unnamed='1' visible='1'}", 20000) diff --git a/tests/system/shared/utils.py b/tests/system/shared/utils.py index 98e1b05387..218df28131 100644 --- a/tests/system/shared/utils.py +++ b/tests/system/shared/utils.py @@ -31,6 +31,19 @@ def selectFromCombo(objectName, itemName): mouseClick(object, 5, 5, 0, Qt.LeftButton) mouseClick(waitForObjectItem(object, itemName), 5, 5, 0, Qt.LeftButton) +def selectFromLocator(filter, itemName = None): + if itemName == None: + itemName = filter + itemName = itemName.replace(".", "\\.") + locator = waitForObject(":*Qt Creator_Utils::FilterLineEdit", 20000) + mouseClick(locator, 5, 5, 0, Qt.LeftButton) + replaceEditorContent(locator, filter) + # clicking the wanted item + # if you replace this by pressing ENTER, be sure that something is selected + # otherwise you will run into unwanted behavior + wantedItem = waitForObjectItem("{type='QTreeView' unnamed='1' visible='1'}", itemName) + doubleClick(wantedItem, 5, 5, 0, Qt.LeftButton) + def wordUnderCursor(window): cursor = window.textCursor() oldposition = cursor.position() diff --git a/tests/system/suite_general/tst_basic_cpp_support/test.py b/tests/system/suite_general/tst_basic_cpp_support/test.py index 423fba7dce..d775f09165 100644 --- a/tests/system/suite_general/tst_basic_cpp_support/test.py +++ b/tests/system/suite_general/tst_basic_cpp_support/test.py @@ -9,12 +9,7 @@ def main(): prepareForSignal("{type='CppTools::Internal::CppModelManager' unnamed='1'}", "sourceFilesRefreshed(QStringList)") openQmakeProject(srcPath + "/creator/tests/manual/cplusplus-tools/cplusplus-tools.pro") waitForSignal("{type='CppTools::Internal::CppModelManager' unnamed='1'}", "sourceFilesRefreshed(QStringList)", 20000) - - mouseClick(waitForObject(":*Qt Creator_Utils::FilterLineEdit", 20000), 5, 5, 0, Qt.LeftButton) - type(waitForObject(":*Qt Creator_Utils::FilterLineEdit"), "dummy.cpp") - # pause to wait for results to populate - snooze(1) - type(waitForObject(":*Qt Creator_Utils::FilterLineEdit"), "<Return>") + selectFromLocator("dummy.cpp") ## Waiting for a solution from Froglogic to make the below work. ## There is an issue with slots that return a class type that wasn't running previously... @@ -24,7 +19,7 @@ def main(): # t3 = t2.file() # t4 = t3.fileName # test.compare(editorManager.currentEditor().file().fileName, "base.cpp") - cppwindow = findObject(":Qt Creator_CppEditor::Internal::CPPEditorWidget") + cppwindow = waitForObject(":Qt Creator_CppEditor::Internal::CPPEditorWidget") # - Move the cursor to the usage of a variable. # - Press F2 or select from the menu: Tools / C++ / Follow Symbol under Cursor @@ -51,13 +46,9 @@ def main(): # Creator should show the definition of this function # - Press Shift+F2 or select from menu: Tools / C++ / Switch Between Method Declaration/Definition again # Creator should show the declaration of the function again. - mouseClick(waitForObject(":*Qt Creator_Utils::FilterLineEdit", 20000), 5, 5, 0, Qt.LeftButton) - clickButton(waitForObject(":Qt Creator_Utils::IconButton")) - type(waitForObject(":*Qt Creator_Utils::FilterLineEdit"), "dummy.cpp") - # pause to wait for results to populate - snooze(1) - type(waitForObject(":*Qt Creator_Utils::FilterLineEdit"), "<Return>") - + selectFromLocator("dummy.cpp") + mainWin = findObject(":Qt Creator_Core::Internal::MainWindow") + waitFor("mainWin.windowTitle == 'dummy.cpp - cplusplus-tools - Qt Creator'") # Reset cursor to the start of the document cursor = findObject(":Qt Creator_CppEditor::Internal::CPPEditorWidget").textCursor() cursor.movePosition(QTextCursor.Start) diff --git a/tests/system/suite_general/tst_build_speedcrunch/test.py b/tests/system/suite_general/tst_build_speedcrunch/test.py index defebf07ed..bc068bc61c 100644 --- a/tests/system/suite_general/tst_build_speedcrunch/test.py +++ b/tests/system/suite_general/tst_build_speedcrunch/test.py @@ -20,7 +20,7 @@ def main(): buildCombo = waitForObject(":Build:_QComboBox") sendEvent("QMouseEvent", waitForObject(":QtCreator.MenuBar_ProjectExplorer::Internal::MiniProjectTargetSelector"), QEvent.MouseButtonPress, -5, 5, Qt.LeftButton, 0) - prog = re.compile("Qt.*Release") + prog = re.compile("(Desktop )?Qt.*Release") for row in range(buildCombo.count): if prog.match(str(buildCombo.itemText(row))): clickButton(waitForObject(":*Qt Creator_Core::Internal::FancyToolButton")) diff --git a/tests/system/suite_general/tst_openqt_creator/test.py b/tests/system/suite_general/tst_openqt_creator/test.py index 00f145f5d5..191f634c0b 100644 --- a/tests/system/suite_general/tst_openqt_creator/test.py +++ b/tests/system/suite_general/tst_openqt_creator/test.py @@ -27,11 +27,7 @@ def main(): test.compare(waitForObject(node).text, value) # Now check some basic lookups in the search box - - mouseClick(waitForObject(":*Qt Creator_Utils::FilterLineEdit", 20000), 5, 5, 0, Qt.LeftButton) - replaceEditorContent(waitForObject(":*Qt Creator_Utils::FilterLineEdit", 20000), ": Qlist::QList") - type(waitForObject(":*Qt Creator_Utils::FilterLineEdit", 20000), "<Return>") - + selectFromLocator(": Qlist::QList", "QList::QList") test.compare(wordUnderCursor(waitForObject(":Qt Creator_CppEditor::Internal::CPPEditorWidget")), "QList") invokeMenuItem("File", "Exit") diff --git a/tests/system/suite_qtquick/tst_qml_editor/test.py b/tests/system/suite_qtquick/tst_qml_editor/test.py index f2bf98e3c9..13c0f3394e 100644 --- a/tests/system/suite_qtquick/tst_qml_editor/test.py +++ b/tests/system/suite_qtquick/tst_qml_editor/test.py @@ -12,6 +12,7 @@ def main(): # using a temporary directory won't mess up an eventually exisiting workingDir = tempDir() prepareTemplate(sourceExample) + prepareForSignal("{type='CppTools::Internal::CppModelManager' unnamed='1'}", "sourceFilesRefreshed(QStringList)") createNewQtQuickApplication(workingDir, "untitled", templateDir + "/qml/focus.qml") # wait for parsing to complete waitForSignal("{type='CppTools::Internal::CppModelManager' unnamed='1'}", "sourceFilesRefreshed(QStringList)", 30000) |