diff --git a/dist/installer/ifw/packages/org.qtproject.qtcreator.application/meta/license.txt b/dist/installer/ifw/packages/org.qtproject.qtcreator.application/meta/license.txt index 602bfc94635..84f55233150 100644 --- a/dist/installer/ifw/packages/org.qtproject.qtcreator.application/meta/license.txt +++ b/dist/installer/ifw/packages/org.qtproject.qtcreator.application/meta/license.txt @@ -55,7 +55,7 @@ modified by someone else and passed on, the recipients should know that what they have is not the original version, so that the original author's reputation will not be affected by problems that might be introduced by others. - + Finally, software patents pose a constant threat to the existence of any free program. We wish to make sure that a company cannot effectively restrict the users of a free program by obtaining a @@ -111,7 +111,7 @@ modification follow. Pay close attention to the difference between a "work based on the library" and a "work that uses the library". The former contains code derived from the library, whereas the latter must be combined with the library in order to run. - + GNU LESSER GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION @@ -158,7 +158,7 @@ Library. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. - + 2. You may modify your copy or copies of the Library or any portion of it, thus forming a work based on the Library, and copy and distribute such modifications or work under the terms of Section 1 @@ -216,7 +216,7 @@ instead of to this License. (If a newer version than version 2 of the ordinary GNU General Public License has appeared, then you can specify that version instead if you wish.) Do not make any other change in these notices. - + Once this change is made in a given copy, it is irreversible for that copy, so the ordinary GNU General Public License applies to all subsequent copies and derivative works made from that copy. @@ -267,7 +267,7 @@ Library will still fall under Section 6.) distribute the object code for the work under the terms of Section 6. Any executables containing that work also fall under Section 6, whether or not they are linked directly with the Library itself. - + 6. As an exception to the Sections above, you may also combine or link a "work that uses the Library" with the Library to produce a work containing portions of the Library, and distribute that work @@ -329,7 +329,7 @@ restrictions of other proprietary libraries that do not normally accompany the operating system. Such a contradiction means you cannot use both them and the Library together in an executable that you distribute. - + 7. You may place library facilities that are a work based on the Library side-by-side in a single library together with other library facilities not covered by this License, and distribute such a combined @@ -370,7 +370,7 @@ subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties with this License. - + 11. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or @@ -422,7 +422,7 @@ conditions either of that version or of any later version published by the Free Software Foundation. If the Library does not specify a license version number, you may choose any version ever published by the Free Software Foundation. - + 14. If you wish to incorporate parts of the Library into other free programs whose distribution conditions are incompatible with these, write to the author to ask for permission. For software which is @@ -456,7 +456,7 @@ SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS - + How to Apply These Terms to Your New Libraries If you develop a new library, and you want it to be of the greatest diff --git a/doc/images/qtcreator-add-resource-wizard.png b/doc/images/qtcreator-add-resource-wizard.png index cd5a5983fbc..77517dee364 100644 Binary files a/doc/images/qtcreator-add-resource-wizard.png and b/doc/images/qtcreator-add-resource-wizard.png differ diff --git a/doc/images/qtcreator-add-resource-wizard2.png b/doc/images/qtcreator-add-resource-wizard2.png index a6c09a49fb6..a0c2614b02f 100644 Binary files a/doc/images/qtcreator-add-resource-wizard2.png and b/doc/images/qtcreator-add-resource-wizard2.png differ diff --git a/doc/images/qtcreator-add-resource-wizard3.png b/doc/images/qtcreator-add-resource-wizard3.png index 8de6129624d..cd9e6eb7c2f 100644 Binary files a/doc/images/qtcreator-add-resource-wizard3.png and b/doc/images/qtcreator-add-resource-wizard3.png differ diff --git a/doc/images/qtcreator-add-resource.png b/doc/images/qtcreator-add-resource.png index 9d11d0eef16..eb63e964c08 100644 Binary files a/doc/images/qtcreator-add-resource.png and b/doc/images/qtcreator-add-resource.png differ diff --git a/doc/images/qtcreator-class-info-qt-gui.png b/doc/images/qtcreator-class-info-qt-gui.png index 169c6bc5c8a..f3207eeb729 100644 Binary files a/doc/images/qtcreator-class-info-qt-gui.png and b/doc/images/qtcreator-class-info-qt-gui.png differ diff --git a/doc/images/qtcreator-gs-build-example-select-qs.png b/doc/images/qtcreator-gs-build-example-select-qs.png deleted file mode 100644 index 8f0ec3caf4f..00000000000 Binary files a/doc/images/qtcreator-gs-build-example-select-qs.png and /dev/null differ diff --git a/doc/images/qtcreator-intro-and-location-qt-gui.png b/doc/images/qtcreator-intro-and-location-qt-gui.png index 489ba889423..dec4933a916 100644 Binary files a/doc/images/qtcreator-intro-and-location-qt-gui.png and b/doc/images/qtcreator-intro-and-location-qt-gui.png differ diff --git a/doc/images/qtcreator-new-project-qt-versions-qt-gui.png b/doc/images/qtcreator-new-project-qt-versions-qt-gui.png index 659db2a8e6c..8a1015afde2 100644 Binary files a/doc/images/qtcreator-new-project-qt-versions-qt-gui.png and b/doc/images/qtcreator-new-project-qt-versions-qt-gui.png differ diff --git a/doc/images/qtcreator-new-project-summary-qt-gui.png b/doc/images/qtcreator-new-project-summary-qt-gui.png index 4a84523a8f6..e484cad0d51 100644 Binary files a/doc/images/qtcreator-new-project-summary-qt-gui.png and b/doc/images/qtcreator-new-project-summary-qt-gui.png differ diff --git a/doc/images/qtcreator-new-qt-gui-application.png b/doc/images/qtcreator-new-qt-gui-application.png index 690ab5ddaff..4ef92654880 100644 Binary files a/doc/images/qtcreator-new-qt-gui-application.png and b/doc/images/qtcreator-new-qt-gui-application.png differ diff --git a/doc/images/qtcreator-textfinder-contents.png b/doc/images/qtcreator-textfinder-contents.png index 30aea0ec08e..241fc04fc97 100644 Binary files a/doc/images/qtcreator-textfinder-contents.png and b/doc/images/qtcreator-textfinder-contents.png differ diff --git a/doc/src/projects/creator-projects-build-run-tutorial.qdoc b/doc/src/projects/creator-projects-build-run-tutorial.qdoc index b26c108c27d..bd5b1256f4d 100644 --- a/doc/src/projects/creator-projects-build-run-tutorial.qdoc +++ b/doc/src/projects/creator-projects-build-run-tutorial.qdoc @@ -31,7 +31,7 @@ \title Building and Running an Example - You can test that your installation is successful by opening an existing + You can test that your \QSDK installation is successful by opening an existing example application project. \list 1 @@ -54,37 +54,28 @@ \list 1 - \o Select at least \QS and one of the mobile - \l{glossary-buildandrun-kit}{kits} (1), Maemo 5 or - MeeGo Harmattan, depending on the device you develop for. + \o Select the kits \l{glossary-buildandrun-kit}{kits} (1) that + specify the devices you develop for. \o Select \gui {Configure Project} (2). \endlist - \o To test the application in \QS, click the \gui {Kit - Selector} and select \gui {\QS}. + \o To check that the application code can be compiled and linked for a + device, click the \gui {Kit Selector} and select a kit for the + device. - \image qtcreator-gs-build-example-select-qs.png "Selecting Qt Simulator to run on" + \image qtcreator-kit-selector.png "Selecting a kit to build with" \o Click \inlineimage qtcreator-run.png - (\gui Run) to build the application and run it in \QS. + (\gui Run) to build and run the application. \o To see the compilation progress, press \key{Alt+4} to open the \gui {Compile Output} pane. The \gui Build progress bar on the toolbar turns green when the - project is successfully built. The application opens in - \QS. - - \image qt-simulator.png "Qt Simulator" - - \o Change the settings in the \gui Model view. For example, rotate the - device by clicking the \gui {Orientation} buttons or choose from the - various mobile devices in the \gui {Device} field. You - can also simulate various mobile functions and create your own - scripts. + project is successfully built. The application opens on the device. \endlist diff --git a/doc/src/widgets/qtdesigner-app-tutorial.qdoc b/doc/src/widgets/qtdesigner-app-tutorial.qdoc index 9e917d52c84..1256bbee0a2 100644 --- a/doc/src/widgets/qtdesigner-app-tutorial.qdoc +++ b/doc/src/widgets/qtdesigner-app-tutorial.qdoc @@ -55,14 +55,15 @@ \o In the \gui{Name} field, type \bold {TextFinder}. \o In the \gui {Create in} field, enter the path for the project files. - For example, \c {C:\Qt\examples}, and then click \gui{Next}. + For example, \c {C:\Qt\examples}, and then click \gui{Next} (on + Windows and Linux) or \gui Continue (on Mac OS). The \gui {Kit Selection} dialog opens. \image qtcreator-new-project-qt-versions-qt-gui.png "Kit Selection dialog" \o Select build and run \l{glossary-buildandrun-kit}{kits} for your project, - and click \gui{Next}. + and click \gui Next or \gui Continue. \note If only one kit is specified in \gui Tools > \gui Options > \gui {Build & Run} > \gui Kits, this dialog is @@ -81,14 +82,14 @@ \note The \gui{Header file}, \gui{Source file} and \gui{Form file} fields are automatically updated to match the name of the class. - \o Click \gui{Next}. + \o Click \gui Next or \gui Continue. The \gui{Project Management} dialog opens. \image qtcreator-new-project-summary-qt-gui.png "Project Management dialog" - \o Review the project settings, and click \gui{Finish} to create the - project. + \o Review the project settings, and click \gui{Finish} (on Windows and + Linux) or \gui Done (on Mac OS) to create the project. \endlist @@ -155,9 +156,10 @@ \image qtcreator-textfinder-objectname.png "Changing object names" - \o Press \key {Ctrl+A} to select the widgets and click - \gui{Lay out Horizontally} (or press \gui{Ctrl+H}) to apply a - horizontal layout (QHBoxLayout). + \o Press \key {Ctrl+A} (or \key {Cmd+A}) to select the widgets and + click \gui{Lay out Horizontally} (or press \gui{Ctrl+H} on Linux or + Windows or \key {Ctrl+Shift+H} on Mac OS) to apply a horizontal + layout (QHBoxLayout). \image qtcreator-texfinder-ui-horizontal-layout.png "Applying horizontal layout" @@ -192,7 +194,7 @@ \endlist - \o Press \gui{Ctrl+S} to save your changes. + \o Press \gui{Ctrl+S} (or \key {Cmd+S}) to save your changes. \endlist @@ -289,7 +291,7 @@ \o In the \gui{Name} field, enter \bold{textfinder}. \o In the \gui{Path} field, enter \c{C:\Qt\examples\TextFinder}, - and click \gui{Next}. + and click \gui Next or \gui Continue. The \gui{Project Management} dialog opens. @@ -297,7 +299,8 @@ \o In the \gui{Add to project} field, select \bold{TextFinder.pro} - and click \gui{Finish} to open the file in the code editor. + and click \gui{Finish} or \gui Done to open the file in the code + editor. \o Select \gui{Add > Add Prefix}. diff --git a/scripts/fixCopyright.sh b/scripts/fixCopyright.sh index cdc3a57a70c..706a0f2c2bb 100755 --- a/scripts/fixCopyright.sh +++ b/scripts/fixCopyright.sh @@ -3,8 +3,8 @@ # Prepend a copyright header to all files given on the command line. # Sample usage: # find . -type f -name \*.cpp -o -name \*.h | \ -# xargs ~/bin/hasCopyright.sh | grep ": NO COPYRIGHT" | grep "^./src/" | \ -# cut -d ':' -f1 | xargs ~/bin/fixCopyright.sh /tmp/copyright.txt +# xargs ~/bin/hasCopyright.pl | grep ": No copyright, NOK" | grep "^./src/" | \ +# cut -d ':' -f1 | xargs ~/bin/fixCopyright.sh dist/copyright_template.txt COPYRIGHT_HEADER=$1 diff --git a/scripts/hasCopyright.pl b/scripts/hasCopyright.pl new file mode 100755 index 00000000000..c80135a7916 --- /dev/null +++ b/scripts/hasCopyright.pl @@ -0,0 +1,122 @@ +#!/usr/bin/perl -w + +# Report possible problems with copy right headers +# +# Sample usage: +# find . -type f | xargs ./scripts/hasCopyright.pl + +use strict; + +shift; # remove script + +sub canIgnoreNoCopyright { + my $file = shift; + return 1 if ($file =~ /\.png$/ or + $file =~ /\.ico$/ or + $file =~ /\.svg$/ or + $file =~ /\.xpm$/ or + $file =~ /\.dia$/ or + $file =~ /\/Doxyfile$/ or + $file =~ /\.qmlproject$/ or + $file =~ /\.pr[oi]$/ or + $file =~ /\.qbs$/ or + $file =~ /\.qrc$/ or + $file =~ /\.txt$/i or + $file =~ /\/README[^\/]*$/i or + $file =~ /\/LICENSE.LGPL$/i or + $file =~ /\.ui$/i or + $file =~ /\.xml$/ or + $file =~ /\.css$/ or + $file =~ /\.metainfo$/ or + $file =~ /\.json$/ or + $file =~ /\.pl$/ or + $file =~ /\.py$/ or + $file =~ /\.sh$/ or + $file =~ /\.bat$/ or + $file =~ /\.patch$/ or + $file =~ /\.sed$/ or + $file =~ /\.pro\.user$/ or + $file =~ /\.plist$/ or + $file =~ /\.qdocconf$/i or + $file =~ /\.qdocinc/); + return 0; +} + +while (1) { + my $file = shift; + last unless $file; + + my $hasCopyright = 0; + my $hasCurrent = 0; + my $hasContact = 0; + my $hasCommercial = 0; + my $hasLGPL = 0; + my $hasGPL = 0; + my $hasDigia = 0; + my $linecount = 0; + + if ($file !~ /\.png$/) { + open(my $fh, "<", $file) or die "Could not open $file.\n"; + + while (<$fh>) { + $linecount++; + last if ($linecount > 50); + + $hasCopyright = 1 if $_ =~ /Copyright/i; + $hasCurrent = 1 if $_ =~ /\(c\).*\s2012/i; + + $hasContact = 1 if $_ =~ /Contact: http:\/\/www.qt-project.org\/legal/; + $hasCommercial = 1 if $_ =~ /Commercial License Usage/; + $hasDigia = 1 if $_ =~ /Digia Plc/; + $hasLGPL = 1 if $_ =~ /GNU Lesser General Public License Usage/; + $hasGPL = 1 if $_ =~ /GNU General Public License Usage/; + } + close $fh; + } + + unless ($hasCopyright) { + print "$file\t"; + if (canIgnoreNoCopyright($file)) { + print "Warning\t"; + } else { + print "ERROR\t"; + } + print "No copyright\n"; + next; + } + + unless ($hasCurrent) { + print "$file\tERROR\tcopyright outdated\n"; + next; + } + + unless ($hasDigia) { + print "$file\tERROR\tNo digia\n"; + next; + } + + unless ($hasContact) { + print "$file\tERROR\tWrong contact\n"; + next; + } + + unless ($hasCommercial) { + print "$file\tERROR\tNo commercial license\n"; + next; + } + + unless ($hasLGPL) { + print "$file\tERROR\tNo LGPL license\n"; + next; + } + + if ($hasGPL) { + print "$file\tERROR\tHas GPL license\n"; + next; + } + + print "$file\tinfo\tCopyright OK\n"; + +} # loop over files + +exit 0; diff --git a/scripts/hasCopyright.sh b/scripts/hasCopyright.sh deleted file mode 100755 index fb86c93ae59..00000000000 --- a/scripts/hasCopyright.sh +++ /dev/null @@ -1,25 +0,0 @@ -#!/bin/sh - -# Scan files given on the command line for a copyright header. -# Only the first 15 lines will be examined and must contain the -# string 'Copyright'. -# -# Sample usage: -# find . -type f -name \*.cpp -o -name \*.h | xargs ./scripts/hasCopyright.sh - -for i in "$@" ; do - if test -f "$i" && test -s "$i" ; then - if head -n 35 "$1" | grep "info@qt.nokia.com" > /dev/null 2>&1 ; then - echo "$i: OLD EMAIL IN USE!" - elif head -n 35 "$i" | grep Copyright > /dev/null 2>&1 ; then - if head -n 35 "$i" | grep "GNU Lesser General Public License" > /dev/null 2>&1 && - head -n 35 "$i" | grep "Other Usage" > /dev/null 2>&1 ; then - echo "$i: Copyright ok" - else - echo "$i: WRONG COPYRIGHT" - fi - else - echo "$i: NO COPYRIGHT" - fi - fi -done diff --git a/share/qtcreator/dumper/dumper.py b/share/qtcreator/dumper/dumper.py index b8456c694da..d2dcf158be8 100644 --- a/share/qtcreator/dumper/dumper.py +++ b/share/qtcreator/dumper/dumper.py @@ -1670,7 +1670,7 @@ class Dumper: self.putNumChild(0) return - if (typeName.replace("(anonymous namespace)", "").find("(") != -1): + if innerType.code == MethodCode or innerType.code == FunctionCode: # A function pointer with format None. self.putValue(str(value)) self.putAddress(value.address) diff --git a/share/qtcreator/dumper/qttypes.py b/share/qtcreator/dumper/qttypes.py index b5a55822c1f..9f1aec2be11 100644 --- a/share/qtcreator/dumper/qttypes.py +++ b/share/qtcreator/dumper/qttypes.py @@ -657,7 +657,7 @@ def qdump__QMapNode(d, value): d.putSubItem("value", value["value"]) -def qdumpHelper__QMap(d, value, forceLong): +def qdumpHelper__Qt4_QMap(d, value, forceLong): d_ptr = value["d"].dereference() e_ptr = value["e"].dereference() n = d_ptr["size"] @@ -667,8 +667,8 @@ def qdumpHelper__QMap(d, value, forceLong): d.putItemCount(n) d.putNumChild(n) if d.isExpanded(): - if n > 1000: - n = 1000 + if n > 10000: + n = 10000 keyType = templateArgument(value.type, 0) valueType = templateArgument(value.type, 1) @@ -706,6 +706,66 @@ def qdumpHelper__QMap(d, value, forceLong): it = it.dereference()["forward"].dereference() +def qdumpHelper__Qt5_QMap(d, value, forceLong): + d_ptr = value["d"].dereference() + n = d_ptr["size"] + check(0 <= n and n <= 100*1000*1000) + checkRef(d_ptr["ref"]) + + d.putItemCount(n) + d.putNumChild(n) + if d.isExpanded(): + if n > 10000: + n = 10000 + + keyType = templateArgument(value.type, 0) + valueType = templateArgument(value.type, 1) + isCompact = mapCompact(d.currentItemFormat(), keyType, valueType) + nodeType = lookupType(d.ns + "QMapNode<%s, %s>" % (keyType, valueType)) + if isCompact: + innerType = valueType + else: + innerType = nodeType + + with Children(d, n, childType=innerType): + toDo = [] + i = -1 + node = d_ptr["header"] + left = node["left"] + if not isNull(left): + toDo.append(left.dereference()) + right = node["right"] + if not isNull(right): + toDo.append(right.dereference()) + + while len(toDo): + node = toDo[0].cast(nodeType) + toDo = toDo[1:] + left = node["left"] + if not isNull(left): + toDo.append(left.dereference()) + right = node["right"] + if not isNull(right): + toDo.append(right.dereference()) + i += 1 + + with SubItem(d, i): + if isCompact: + if forceLong: + d.putName("[%s] %s" % (i, node["key"])) + else: + d.putMapName(node["key"]) + d.putItem(node["value"]) + else: + qdump__QMapNode(d, node) + + +def qdumpHelper__QMap(d, value, forceLong): + if value["d"].dereference().type.fields()[0].name == "backward": + qdumpHelper__Qt4_QMap(d, value, forceLong) + else: + qdumpHelper__Qt5_QMap(d, value, forceLong) + def qform__QMap(): return mapForms() @@ -738,7 +798,10 @@ def qdump__QObject(d, value): staticMetaObject = value["staticMetaObject"] d_ptr = value["d_ptr"]["d"].cast(privateType.pointer()).dereference() #warn("D_PTR: %s " % d_ptr) - objectName = d_ptr["objectName"] + try: + objectName = d_ptr["objectName"] + except: # Qt 5 + objectName = d_ptr["extraData"].dereference()["objectName"] except: d.putPlainChildren(value) return diff --git a/share/qtcreator/templates/wizards/bb-bardescriptor/bar-descriptor.xml b/share/qtcreator/templates/wizards/bb-bardescriptor/bar-descriptor.xml index b8fe696b5e9..c5cc31166bb 100644 --- a/share/qtcreator/templates/wizards/bb-bardescriptor/bar-descriptor.xml +++ b/share/qtcreator/templates/wizards/bb-bardescriptor/bar-descriptor.xml @@ -14,8 +14,8 @@ PUBLISHER COPYRIGHT - - + + -platform blackberry -style @@ -25,9 +25,4 @@ PROJECTNAME - - - lib - plugins - imports diff --git a/share/qtcreator/templates/wizards/bb-guiapp/bar-descriptor.xml b/share/qtcreator/templates/wizards/bb-guiapp/bar-descriptor.xml index 09fe868ef03..5727904396c 100644 --- a/share/qtcreator/templates/wizards/bb-guiapp/bar-descriptor.xml +++ b/share/qtcreator/templates/wizards/bb-guiapp/bar-descriptor.xml @@ -1,6 +1,6 @@ - ID + com.example.%ProjectName% %ProjectName% 1.0.0 DESCRIPTION @@ -13,16 +13,11 @@ - - + + -platform blackberry run_native %ProjectName% - - - lib - plugins - imports diff --git a/share/qtcreator/templates/wizards/bb-qt5-guiapp/bar-descriptor.xml b/share/qtcreator/templates/wizards/bb-qt5-guiapp/bar-descriptor.xml index d1de8450190..e88f7c0d9b5 100644 --- a/share/qtcreator/templates/wizards/bb-qt5-guiapp/bar-descriptor.xml +++ b/share/qtcreator/templates/wizards/bb-qt5-guiapp/bar-descriptor.xml @@ -1,6 +1,6 @@ - ID + com.example.%ProjectName% %ProjectName% 1.0.0 DESCRIPTION diff --git a/share/qtcreator/templates/wizards/bb-qt5-quick2app/bar-descriptor.xml b/share/qtcreator/templates/wizards/bb-qt5-quick2app/bar-descriptor.xml index 0acc8145a03..4e191478d23 100644 --- a/share/qtcreator/templates/wizards/bb-qt5-quick2app/bar-descriptor.xml +++ b/share/qtcreator/templates/wizards/bb-qt5-quick2app/bar-descriptor.xml @@ -1,6 +1,6 @@ - ID + com.example.%ProjectName% %ProjectName% 1.0.0 DESCRIPTION diff --git a/share/qtcreator/templates/wizards/bb-quickapp/bar-descriptor.xml b/share/qtcreator/templates/wizards/bb-quickapp/bar-descriptor.xml index f1059b31d5a..8f0a09e6115 100644 --- a/share/qtcreator/templates/wizards/bb-quickapp/bar-descriptor.xml +++ b/share/qtcreator/templates/wizards/bb-quickapp/bar-descriptor.xml @@ -1,6 +1,6 @@ - ID + com.example.%ProjectName% %ProjectName% 1.0.0 DESCRIPTION @@ -13,8 +13,8 @@ - - + + -platform blackberry @@ -22,9 +22,4 @@ %ProjectName% qml - - - lib - plugins - imports diff --git a/share/qtcreator/translations/qtcreator_de.ts b/share/qtcreator/translations/qtcreator_de.ts index 91a1e313f35..90385f8c91f 100644 --- a/share/qtcreator/translations/qtcreator_de.ts +++ b/share/qtcreator/translations/qtcreator_de.ts @@ -11020,7 +11020,7 @@ Außer Leerzeichen innerhalb von Kommentaren und Zeichenketten. &Commit - &Abgeben + Ab&geben Check All @@ -11038,7 +11038,7 @@ Außer Leerzeichen innerhalb von Kommentaren und Zeichenketten. Check a&ll - &Alle markieren + A&lle markieren diff --git a/share/qtcreator/welcomescreen/gettingstarted.qml b/share/qtcreator/welcomescreen/gettingstarted.qml index fbf27e051dc..6b6d124d7e6 100644 --- a/share/qtcreator/welcomescreen/gettingstarted.qml +++ b/share/qtcreator/welcomescreen/gettingstarted.qml @@ -60,16 +60,6 @@ Rectangle { anchors.top: parent.top anchors.topMargin: 0 - Feedback { - id: feedback - - x: 851 - y: 424 - anchors.right: parent.right - anchors.rightMargin: 22 - - } - GettingStartedItem { x: 688 y: 83 diff --git a/share/qtcreator/welcomescreen/widgets/Feedback.qml b/share/qtcreator/welcomescreen/widgets/Feedback.qml deleted file mode 100644 index 63a88f872b6..00000000000 --- a/share/qtcreator/welcomescreen/widgets/Feedback.qml +++ /dev/null @@ -1,21 +0,0 @@ -import QtQuick 1.1 - -Row { - id: feedback - spacing: 4 - Image { - y: 10 - visible: false - source: "images/icons/userguideIcon.png" - } - - LinkedText { - x: 19 - y: 5 - text: qsTr("Feedback") - height: 38 - - verticalAlignment: Text.AlignBottom - onClicked: welcomeMode.sendFeedback() - } -} diff --git a/src/libs/3rdparty/botan/botan.cpp b/src/libs/3rdparty/botan/botan.cpp index 000c3ea823c..4431ce17fbd 100644 --- a/src/libs/3rdparty/botan/botan.cpp +++ b/src/libs/3rdparty/botan/botan.cpp @@ -47182,3 +47182,44 @@ u32bit version_minor() { return BOTAN_VERSION_MINOR; } u32bit version_patch() { return BOTAN_VERSION_PATCH; } } + +namespace Botan { +PublicKeyPtr createRsaPublicKey(const BigInt &e, const BigInt &n) +{ + return PublicKeyPtr(new RSA_PublicKey(e, n)); +} + +PublicKeyPtr createDsaPublicKey(const DL_Group &group, const BigInt &y) +{ + return PublicKeyPtr(new DSA_PublicKey(group, y)); +} + +PrivateKeyPtr createRsaPrivateKey(RandomNumberGenerator &rng, const BigInt &p, const BigInt &q, + const BigInt &e, const BigInt &d, const BigInt &n) +{ + return PrivateKeyPtr(new RSA_PrivateKey(rng, p, q, e, d, n)); +} + +PrivateKeyPtr createRsaPrivateKey(RandomNumberGenerator &rng, size_t bits, size_t exp) +{ + return PrivateKeyPtr(new RSA_PrivateKey(rng, bits, exp)); +} + +PrivateKeyPtr createDsaPrivateKey(RandomNumberGenerator &rng, const DL_Group &group, + const BigInt &private_key) +{ + return PrivateKeyPtr(new DSA_PrivateKey(rng, group, private_key)); +} + +PrivateKeyPtr loadPkcs8PrivateKey(DataSource& source, RandomNumberGenerator& rng, + const User_Interface& ui) +{ + return PrivateKeyPtr(PKCS8::load_key(source, rng, ui)); +} + +DhPrivateKeyPtr createDhPrivateKey(RandomNumberGenerator &rng, const DL_Group &grp, const BigInt &x) +{ + return DhPrivateKeyPtr(new DH_PrivateKey(rng, grp, x)); +} + +} diff --git a/src/libs/3rdparty/botan/botan.h b/src/libs/3rdparty/botan/botan.h index a073890986c..13ec9fd00b6 100644 --- a/src/libs/3rdparty/botan/botan.h +++ b/src/libs/3rdparty/botan/botan.h @@ -9,6 +9,7 @@ #define BOTAN_AMALGAMATION_H__ #include +#include #include #include @@ -16181,7 +16182,26 @@ class BOTAN_DLL ANSI_X919_MAC : public MessageAuthenticationCode SecureVector state; size_t position; }; +} +namespace Botan { +typedef QSharedPointer PublicKeyPtr; +BOTAN_DLL PublicKeyPtr createRsaPublicKey(const BigInt &e, const BigInt &n); +BOTAN_DLL PublicKeyPtr createDsaPublicKey(const DL_Group& group, const BigInt& y); + +typedef QSharedPointer PrivateKeyPtr; +BOTAN_DLL PrivateKeyPtr createRsaPrivateKey(RandomNumberGenerator& rng, const BigInt& p, + const BigInt& q, const BigInt& e, const BigInt& d = 0, const BigInt& n = 0); +BOTAN_DLL PrivateKeyPtr createRsaPrivateKey(RandomNumberGenerator& rng, size_t bits, + size_t exp = 65537); +BOTAN_DLL PrivateKeyPtr createDsaPrivateKey(RandomNumberGenerator& rng, const DL_Group& group, + const BigInt& private_key = 0); +BOTAN_DLL PrivateKeyPtr loadPkcs8PrivateKey(DataSource& source, RandomNumberGenerator& rng, + const User_Interface& ui); + +typedef QSharedPointer DhPrivateKeyPtr; +BOTAN_DLL DhPrivateKeyPtr createDhPrivateKey(RandomNumberGenerator& rng, const DL_Group& grp, + const BigInt& x = 0); } diff --git a/src/libs/ssh/sshcryptofacility.cpp b/src/libs/ssh/sshcryptofacility.cpp index 3e1b6970154..868a64b4b94 100644 --- a/src/libs/ssh/sshcryptofacility.cpp +++ b/src/libs/ssh/sshcryptofacility.cpp @@ -218,16 +218,14 @@ bool SshEncryptionFacility::createAuthenticationKeyFromPKCS8(const QByteArray &p try { Pipe pipe; pipe.process_msg(convertByteArray(privKeyFileContents), privKeyFileContents.size()); - Private_Key * const key = PKCS8::load_key(pipe, m_rng, SshKeyPasswordRetriever()); - if (DSA_PrivateKey * const dsaKey = dynamic_cast(key)) { + const PrivateKeyPtr authKey = loadPkcs8PrivateKey(pipe, m_rng, SshKeyPasswordRetriever()); + if (DSA_PrivateKey * const dsaKey = dynamic_cast(authKey.data())) { m_authKeyAlgoName = SshCapabilities::PubKeyDss; - m_authKey.reset(dsaKey); pubKeyParams << dsaKey->group_p() << dsaKey->group_q() << dsaKey->group_g() << dsaKey->get_y(); allKeyParams << pubKeyParams << dsaKey->get_x(); - } else if (RSA_PrivateKey * const rsaKey = dynamic_cast(key)) { + } else if (RSA_PrivateKey * const rsaKey = dynamic_cast(authKey.data())) { m_authKeyAlgoName = SshCapabilities::PubKeyRsa; - m_authKey.reset(rsaKey); pubKeyParams << rsaKey->get_e() << rsaKey->get_n(); allKeyParams << pubKeyParams << rsaKey->get_p() << rsaKey->get_q() << rsaKey->get_d(); @@ -235,6 +233,7 @@ bool SshEncryptionFacility::createAuthenticationKeyFromPKCS8(const QByteArray &p qWarning("%s: Unexpected code flow, expected success or exception.", Q_FUNC_INFO); return false; } + m_authKey = authKey; } catch (const Botan::Exception &ex) { error = QLatin1String(ex.what()); return false; @@ -291,15 +290,13 @@ bool SshEncryptionFacility::createAuthenticationKeyFromOpenSSL(const QByteArray if (m_authKeyAlgoName == SshCapabilities::PubKeyDss) { BigInt p, q, g, y, x; sequence.decode (p).decode (q).decode (g).decode (y).decode (x); - DSA_PrivateKey * const dsaKey = new DSA_PrivateKey(m_rng, DL_Group(p, q, g), x); - m_authKey.reset(dsaKey); + m_authKey = createDsaPrivateKey(m_rng, DL_Group(p, q, g), x); pubKeyParams << p << q << g << y; allKeyParams << pubKeyParams << x; } else { BigInt p, q, e, d, n; sequence.decode(n).decode(e).decode(d).decode(p).decode(q); - RSA_PrivateKey * const rsaKey = new RSA_PrivateKey(m_rng, p, q, e, d, n); - m_authKey.reset(rsaKey); + m_authKey = createRsaPrivateKey(m_rng, p, q, e, d, n); pubKeyParams << e << n; allKeyParams << pubKeyParams << p << q << d; } diff --git a/src/libs/ssh/sshcryptofacility_p.h b/src/libs/ssh/sshcryptofacility_p.h index 5b22429fe4b..afd85fbcd03 100644 --- a/src/libs/ssh/sshcryptofacility_p.h +++ b/src/libs/ssh/sshcryptofacility_p.h @@ -117,7 +117,7 @@ private: QByteArray m_authKeyAlgoName; QByteArray m_authPubKeyBlob; QByteArray m_cachedPrivKeyContents; - QScopedPointer m_authKey; + QSharedPointer m_authKey; mutable Botan::AutoSeeded_RNG m_rng; }; diff --git a/src/libs/ssh/sshkeyexchange.cpp b/src/libs/ssh/sshkeyexchange.cpp index c11201c47c3..0c0fea62158 100644 --- a/src/libs/ssh/sshkeyexchange.cpp +++ b/src/libs/ssh/sshkeyexchange.cpp @@ -136,8 +136,7 @@ bool SshKeyExchange::sendDhInitPacket(const SshIncomingPacket &serverKexInit) kexInitParams.compressionAlgorithmsServerToClient.names); AutoSeeded_RNG rng; - m_dhKey.reset(new DH_PrivateKey(rng, - DL_Group(botanKeyExchangeAlgoName(keyAlgo)))); + m_dhKey = createDhPrivateKey(rng, DL_Group(botanKeyExchangeAlgoName(keyAlgo))); m_serverKexInitPayload = serverKexInit.payLoad(); m_sendFacility.sendKeyDhInitPacket(m_dhKey->get_y()); @@ -184,28 +183,24 @@ void SshKeyExchange::sendNewKeysPacket(const SshIncomingPacket &dhReply, printData("H", m_h); #endif // CREATOR_SSH_DEBUG - QScopedPointer sigKey; - QScopedPointer verifier; + QSharedPointer publicKey; + QByteArray algorithm; if (m_serverHostKeyAlgo == SshCapabilities::PubKeyDss) { const DL_Group group(reply.parameters.at(0), reply.parameters.at(1), reply.parameters.at(2)); - DSA_PublicKey * const dsaKey - = new DSA_PublicKey(group, reply.parameters.at(3)); - sigKey.reset(dsaKey); - verifier.reset(new PK_Verifier(*dsaKey, botanEmsaAlgoName(SshCapabilities::PubKeyDss))); + publicKey = createDsaPublicKey(group, reply.parameters.at(3)); + algorithm = SshCapabilities::PubKeyDss; } else if (m_serverHostKeyAlgo == SshCapabilities::PubKeyRsa) { - RSA_PublicKey * const rsaKey - = new RSA_PublicKey(reply.parameters.at(1), reply.parameters.at(0)); - sigKey.reset(rsaKey); - verifier.reset(new PK_Verifier(*rsaKey, botanEmsaAlgoName(SshCapabilities::PubKeyRsa))); + publicKey = createRsaPublicKey(reply.parameters.at(1), reply.parameters.at(0)); + algorithm = SshCapabilities::PubKeyRsa; } else { Q_ASSERT(!"Impossible: Neither DSS nor RSA!"); } const byte * const botanH = convertByteArray(m_h); const Botan::byte * const botanSig = convertByteArray(reply.signatureBlob); - if (!verifier->verify_message(botanH, m_h.size(), botanSig, - reply.signatureBlob.size())) { + if (!PK_Verifier(*publicKey, botanEmsaAlgoName(algorithm)).verify_message(botanH, m_h.size(), + botanSig, reply.signatureBlob.size())) { throw SSH_SERVER_EXCEPTION(SSH_DISCONNECT_KEY_EXCHANGE_FAILED, "Invalid signature in SSH_MSG_KEXDH_REPLY packet."); } diff --git a/src/libs/ssh/sshkeyexchange_p.h b/src/libs/ssh/sshkeyexchange_p.h index ea3e599a9ee..e8d27b662b2 100644 --- a/src/libs/ssh/sshkeyexchange_p.h +++ b/src/libs/ssh/sshkeyexchange_p.h @@ -33,6 +33,7 @@ #include #include +#include namespace Botan { class DH_PrivateKey; @@ -71,7 +72,7 @@ private: QByteArray m_serverId; QByteArray m_clientKexInitPayload; QByteArray m_serverKexInitPayload; - QScopedPointer m_dhKey; + QSharedPointer m_dhKey; QByteArray m_k; QByteArray m_h; QByteArray m_serverHostKeyAlgo; diff --git a/src/libs/ssh/sshkeygenerator.cpp b/src/libs/ssh/sshkeygenerator.cpp index 242cf085f7b..c8a57a58044 100644 --- a/src/libs/ssh/sshkeygenerator.cpp +++ b/src/libs/ssh/sshkeygenerator.cpp @@ -60,9 +60,9 @@ bool SshKeyGenerator::generateKeys(KeyType type, PrivateKeyFormat format, int ke AutoSeeded_RNG rng; KeyPtr key; if (m_type == Rsa) - key = KeyPtr(new RSA_PrivateKey(rng, keySize)); + key = createRsaPrivateKey(rng, keySize); else - key = KeyPtr(new DSA_PrivateKey(rng, DL_Group(rng, DL_Group::DSA_Kosherizer, keySize))); + key = createDsaPrivateKey(rng, DL_Group(rng, DL_Group::DSA_Kosherizer, keySize)); switch (format) { case Pkcs8: generatePkcs8KeyStrings(key, rng); diff --git a/src/libs/utils/fileutils.cpp b/src/libs/utils/fileutils.cpp index d252f5f1067..ca012c77d38 100644 --- a/src/libs/utils/fileutils.cpp +++ b/src/libs/utils/fileutils.cpp @@ -535,10 +535,16 @@ bool FileName::operator>=(const FileName &other) const /// \returns whether FileName is a child of \a s bool FileName::isChildOf(const FileName &s) const { + if (s.isEmpty()) + return false; if (!QString::startsWith(s, HostOsInfo::fileNameCaseSensitivity())) return false; if (size() <= s.size()) return false; + // s is root, '/' was already tested in startsWith + if (s.QString::endsWith(QLatin1Char('/'))) + return true; + // s is a directory, next character should be '/' (/tmpdir is NOT a child of /tmp) return at(s.size()) == QLatin1Char('/'); } diff --git a/src/libs/utils/reloadpromptutils.cpp b/src/libs/utils/reloadpromptutils.cpp index cbbe1dde5ab..794213c2899 100644 --- a/src/libs/utils/reloadpromptutils.cpp +++ b/src/libs/utils/reloadpromptutils.cpp @@ -59,7 +59,7 @@ QTCREATOR_UTILS_EXPORT Utils::ReloadPromptAnswer Utils::reloadPrompt(const QString &title, const QString &prompt, const QString &details, QWidget *parent) { QMessageBox msg(parent); - msg.setStandardButtons(QMessageBox::Yes|QMessageBox::YesToAll|QMessageBox::No|QMessageBox::NoToAll); + msg.setStandardButtons(QMessageBox::Yes|QMessageBox::YesToAll|QMessageBox::Close|QMessageBox::No|QMessageBox::NoToAll); msg.setDefaultButton(QMessageBox::YesToAll); msg.setWindowTitle(title); msg.setText(prompt); @@ -72,6 +72,8 @@ QTCREATOR_UTILS_EXPORT Utils::ReloadPromptAnswer return ReloadAll; case QMessageBox::No: return ReloadSkipCurrent; + case QMessageBox::Close: + return CloseCurrent; default: break; } diff --git a/src/libs/utils/reloadpromptutils.h b/src/libs/utils/reloadpromptutils.h index b7cb73ff515..edfde0172c1 100644 --- a/src/libs/utils/reloadpromptutils.h +++ b/src/libs/utils/reloadpromptutils.h @@ -40,7 +40,7 @@ QT_END_NAMESPACE namespace Utils { -enum ReloadPromptAnswer { ReloadCurrent, ReloadAll, ReloadSkipCurrent, ReloadNone }; +enum ReloadPromptAnswer { ReloadCurrent, ReloadAll, ReloadSkipCurrent, ReloadNone, CloseCurrent }; QTCREATOR_UTILS_EXPORT ReloadPromptAnswer reloadPrompt(const QString &fileName, bool modified, QWidget *parent); QTCREATOR_UTILS_EXPORT ReloadPromptAnswer reloadPrompt(const QString &title, const QString &prompt, const QString &details, QWidget *parent); diff --git a/src/plugins/clearcase/clearcaseplugin.cpp b/src/plugins/clearcase/clearcaseplugin.cpp index 65169666ab4..b1d5410e6fa 100644 --- a/src/plugins/clearcase/clearcaseplugin.cpp +++ b/src/plugins/clearcase/clearcaseplugin.cpp @@ -225,6 +225,10 @@ bool ClearCasePlugin::isCheckInEditorOpen() const */ QString ClearCasePlugin::findTopLevel(const QString &directory) const { + if ((directory == m_topLevel) || + Utils::FileName::fromString(directory).isChildOf(Utils::FileName::fromString(m_topLevel))) + return m_topLevel; + // Snapshot view QString topLevel = findRepositoryForDirectory(directory, QLatin1String(ClearCase::Constants::CLEARCASE_ROOT_FILE)); @@ -232,8 +236,6 @@ QString ClearCasePlugin::findTopLevel(const QString &directory) const return topLevel; // Dynamic view - if (directory.startsWith(m_topLevel) && directory.at(m_topLevel.size()) == QLatin1Char('/')) - return m_topLevel; bool isDynamic; ccGetView(directory, &isDynamic); if (isDynamic) { diff --git a/src/plugins/cmakeprojectmanager/cmakebuildconfiguration.cpp b/src/plugins/cmakeprojectmanager/cmakebuildconfiguration.cpp index d18e3e8fd35..9080f440c3b 100644 --- a/src/plugins/cmakeprojectmanager/cmakebuildconfiguration.cpp +++ b/src/plugins/cmakeprojectmanager/cmakebuildconfiguration.cpp @@ -32,6 +32,7 @@ #include "cmakeopenprojectwizard.h" #include "cmakeproject.h" +#include "cmakeprojectconstants.h" #include #include @@ -50,12 +51,11 @@ using namespace CMakeProjectManager; using namespace Internal; namespace { -const char CMAKE_BC_ID[] = "CMakeProjectManager.CMakeBuildConfiguration"; const char BUILD_DIRECTORY_KEY[] = "CMakeProjectManager.CMakeBuildConfiguration.BuildDirectory"; } // namespace CMakeBuildConfiguration::CMakeBuildConfiguration(ProjectExplorer::Target *parent) : - BuildConfiguration(parent, Core::Id(CMAKE_BC_ID)), m_useNinja(false) + BuildConfiguration(parent, Core::Id(Constants::CMAKE_BC_ID)), m_useNinja(false) { m_buildDirectory = static_cast(parent->project())->defaultBuildDirectory(); } @@ -161,12 +161,12 @@ QList CMakeBuildConfigurationFactory::availableCreationIds(const Proje { if (!canHandle(parent)) return QList(); - return QList() << Core::Id(CMAKE_BC_ID); + return QList() << Core::Id(Constants::CMAKE_BC_ID); } QString CMakeBuildConfigurationFactory::displayNameForId(const Core::Id id) const { - if (id == CMAKE_BC_ID) + if (id == Constants::CMAKE_BC_ID) return tr("Build"); return QString(); } @@ -175,7 +175,7 @@ bool CMakeBuildConfigurationFactory::canCreate(const ProjectExplorer::Target *pa { if (!canHandle(parent)) return false; - if (id == CMAKE_BC_ID) + if (id == Constants::CMAKE_BC_ID) return true; return false; } @@ -199,6 +199,17 @@ CMakeBuildConfiguration *CMakeBuildConfigurationFactory::create(ProjectExplorer: if (!ok || buildConfigurationName.isEmpty()) return 0; + CMakeOpenProjectWizard::BuildInfo info; + info.sourceDirectory = project->projectDirectory(); + info.environment = Utils::Environment::systemEnvironment(); + info.buildDirectory = project->defaultBuildDirectory(); + info.kit = parent->kit(); + info.useNinja = false; // This is ignored anyway + + CMakeOpenProjectWizard copw(project->projectManager(), CMakeOpenProjectWizard::ChangeDirectory, info); + if (copw.exec() != QDialog::Accepted) + return 0; + CMakeBuildConfiguration *bc = new CMakeBuildConfiguration(parent); bc->setDisplayName(buildConfigurationName); @@ -213,16 +224,8 @@ CMakeBuildConfiguration *CMakeBuildConfigurationFactory::create(ProjectExplorer: cleanMakeStep->setAdditionalArguments("clean"); cleanMakeStep->setClean(true); - CMakeOpenProjectWizard copw(project->projectManager(), - project->projectDirectory(), - bc->buildDirectory(), - bc); - if (copw.exec() != QDialog::Accepted) { - delete bc; - return 0; - } - bc->setBuildDirectory(copw.buildDirectory()); + bc->setUseNinja(copw.useNinja()); // Default to all if (project->hasBuildTarget("all")) diff --git a/src/plugins/cmakeprojectmanager/cmakeopenprojectwizard.cpp b/src/plugins/cmakeprojectmanager/cmakeopenprojectwizard.cpp index cb7b81bc7cb..2c5d52215ae 100644 --- a/src/plugins/cmakeprojectmanager/cmakeopenprojectwizard.cpp +++ b/src/plugins/cmakeprojectmanager/cmakeopenprojectwizard.cpp @@ -50,6 +50,7 @@ #include #include #include +#include using namespace CMakeProjectManager; using namespace CMakeProjectManager::Internal; @@ -68,17 +69,21 @@ using namespace CMakeProjectManager::Internal; namespace CMakeProjectManager { namespace Internal { - class GeneratorInfo { public: - GeneratorInfo() - : m_kit(0), m_isNinja(false) {} - explicit GeneratorInfo(ProjectExplorer::Kit *kit, bool ninja = false) - : m_kit(kit), m_isNinja(ninja) {} + enum Ninja { NoNinja, OfferNinja, ForceNinja }; + static QList generatorInfosFor(ProjectExplorer::Kit *k, Ninja n, bool hasCodeBlocks); - ProjectExplorer::Kit *kit() const { return m_kit; } - bool isNinja() const { return m_isNinja; } + GeneratorInfo(); + explicit GeneratorInfo(ProjectExplorer::Kit *kit, bool ninja = false); + + ProjectExplorer::Kit *kit() const; + bool isNinja() const; + + QString displayName() const; + QString generatorArgument() const; + QString generator() const; private: ProjectExplorer::Kit *m_kit; @@ -90,12 +95,119 @@ namespace Internal { Q_DECLARE_METATYPE(CMakeProjectManager::Internal::GeneratorInfo); +GeneratorInfo::GeneratorInfo() + : m_kit(0), m_isNinja(false) +{} -CMakeOpenProjectWizard::CMakeOpenProjectWizard(CMakeManager *cmakeManager, const QString &sourceDirectory, CMakeBuildConfiguration *bc) +GeneratorInfo::GeneratorInfo(ProjectExplorer::Kit *kit, bool ninja) + : m_kit(kit), m_isNinja(ninja) +{} + +ProjectExplorer::Kit *GeneratorInfo::kit() const +{ + return m_kit; +} + +bool GeneratorInfo::isNinja() const { + return m_isNinja; +} + +QString GeneratorInfo::generator() const +{ + if (!m_kit) + return QString(); + ProjectExplorer::ToolChain *tc = ProjectExplorer::ToolChainKitInformation::toolChain(m_kit); + ProjectExplorer::Abi targetAbi = tc->targetAbi(); + if (m_isNinja) { + return QLatin1String("Ninja"); + } else if (targetAbi.os() == ProjectExplorer::Abi::WindowsOS) { + if (targetAbi.osFlavor() == ProjectExplorer::Abi::WindowsMsvc2005Flavor + || targetAbi.osFlavor() == ProjectExplorer::Abi::WindowsMsvc2008Flavor + || targetAbi.osFlavor() == ProjectExplorer::Abi::WindowsMsvc2010Flavor + || targetAbi.osFlavor() == ProjectExplorer::Abi::WindowsMsvc2012Flavor) { + return QLatin1String("NMake Makefiles"); + } else if (targetAbi.osFlavor() == ProjectExplorer::Abi::WindowsMSysFlavor) { + if (Utils::HostOsInfo::isWindowsHost()) + return QLatin1String("MinGW Makefiles"); + else + return QLatin1String("Unix Makefiles"); + } + } + return QLatin1String("Unix Makefiles"); +} + +QString GeneratorInfo::generatorArgument() const +{ + QString tmp = generator(); + if (tmp.isEmpty()) + return tmp; + return QLatin1String("-GCodeBlocks - ") + tmp; +} + +QString GeneratorInfo::displayName() const +{ + if (!m_kit) + return QString(); + if (m_isNinja) + return QApplication::tr("Ninja (%1)").arg(m_kit->displayName()); + ProjectExplorer::ToolChain *tc = ProjectExplorer::ToolChainKitInformation::toolChain(m_kit); + ProjectExplorer::Abi targetAbi = tc->targetAbi(); + if (targetAbi.os() == ProjectExplorer::Abi::WindowsOS) { + if (targetAbi.osFlavor() == ProjectExplorer::Abi::WindowsMsvc2005Flavor + || targetAbi.osFlavor() == ProjectExplorer::Abi::WindowsMsvc2008Flavor + || targetAbi.osFlavor() == ProjectExplorer::Abi::WindowsMsvc2010Flavor + || targetAbi.osFlavor() == ProjectExplorer::Abi::WindowsMsvc2012Flavor) { + return QApplication::tr("NMake Generator (%1)").arg(m_kit->displayName()); + } else if (targetAbi.osFlavor() == ProjectExplorer::Abi::WindowsMSysFlavor) { + if (Utils::HostOsInfo::isWindowsHost()) + return QApplication::tr("MinGW Generator (%1)").arg(m_kit->displayName()); + else + return QApplication::tr("Unix Generator (%1)").arg(m_kit->displayName()); + } + } else { + // Non windows + return QApplication::tr("Unix Generator (%1)").arg(m_kit->displayName()); + } + return QString(); +} + +QList GeneratorInfo::generatorInfosFor(ProjectExplorer::Kit *k, Ninja n, bool hasCodeBlocks) +{ + QList results; + ProjectExplorer::ToolChain *tc = ProjectExplorer::ToolChainKitInformation::toolChain(k); + ProjectExplorer::Abi targetAbi = tc->targetAbi(); + if (n != ForceNinja) { + if (targetAbi.os() == ProjectExplorer::Abi::WindowsOS) { + if (targetAbi.osFlavor() == ProjectExplorer::Abi::WindowsMsvc2005Flavor + || targetAbi.osFlavor() == ProjectExplorer::Abi::WindowsMsvc2008Flavor + || targetAbi.osFlavor() == ProjectExplorer::Abi::WindowsMsvc2010Flavor + || targetAbi.osFlavor() == ProjectExplorer::Abi::WindowsMsvc2012Flavor) { + if (hasCodeBlocks) + results << GeneratorInfo(k); + } else if (targetAbi.osFlavor() == ProjectExplorer::Abi::WindowsMSysFlavor) { + results << GeneratorInfo(k); + } + } else { + // Non windows + results << GeneratorInfo(k); + } + } + if (n != NoNinja) + results << GeneratorInfo(k, true); + return results; +} + +////////////// +/// CMakeOpenProjectWizard +////////////// + +CMakeOpenProjectWizard::CMakeOpenProjectWizard(CMakeManager *cmakeManager, const QString &sourceDirectory, Utils::Environment env) : m_cmakeManager(cmakeManager), m_sourceDirectory(sourceDirectory), m_creatingCbpFiles(false), - m_buildConfiguration(bc) + m_environment(env), + m_useNinja(false), + m_kit(0) { int startid; if (hasInSourceBuild()) { @@ -121,37 +233,31 @@ CMakeOpenProjectWizard::CMakeOpenProjectWizard(CMakeManager *cmakeManager, const init(); } -CMakeOpenProjectWizard::CMakeOpenProjectWizard(CMakeManager *cmakeManager, const QString &sourceDirectory, - const QString &buildDirectory, CMakeOpenProjectWizard::Mode mode, - CMakeBuildConfiguration *bc) +CMakeOpenProjectWizard::CMakeOpenProjectWizard(CMakeManager *cmakeManager, CMakeOpenProjectWizard::Mode mode, + const BuildInfo &info) : m_cmakeManager(cmakeManager), - m_sourceDirectory(sourceDirectory), + m_sourceDirectory(info.sourceDirectory), m_creatingCbpFiles(true), - m_buildConfiguration(bc) + m_environment(info.environment), + m_useNinja(info.useNinja), + m_kit(info.kit) { - CMakeRunPage::Mode rmode; if (mode == CMakeOpenProjectWizard::NeedToCreate) rmode = CMakeRunPage::Recreate; else if (mode == CMakeOpenProjectWizard::WantToUpdate) rmode = CMakeRunPage::WantToUpdate; - else + else if (mode == CMakeOpenProjectWizard::NeedToUpdate) rmode = CMakeRunPage::NeedToUpdate; - addPage(new CMakeRunPage(this, rmode, buildDirectory)); - init(); -} + else + rmode = CMakeRunPage::ChangeDirectory; -CMakeOpenProjectWizard::CMakeOpenProjectWizard(CMakeManager *cmakeManager, const QString &sourceDirectory, - const QString &oldBuildDirectory, - CMakeBuildConfiguration *bc) - : m_cmakeManager(cmakeManager), - m_sourceDirectory(sourceDirectory), - m_creatingCbpFiles(true), - m_buildConfiguration(bc) -{ - m_buildDirectory = oldBuildDirectory; - addPage(new ShadowBuildPage(this, true)); - addPage(new CMakeRunPage(this, CMakeRunPage::ChangeDirectory)); + if (mode == CMakeOpenProjectWizard::ChangeDirectory) { + m_buildDirectory = info.buildDirectory; + addPage(new ShadowBuildPage(this, true)); + } + + addPage(new CMakeRunPage(this, rmode, info.buildDirectory)); init(); } @@ -217,6 +323,16 @@ void CMakeOpenProjectWizard::setBuildDirectory(const QString &directory) m_buildDirectory = directory; } +bool CMakeOpenProjectWizard::useNinja() const +{ + return m_useNinja; +} + +void CMakeOpenProjectWizard::setUseNinja(bool b) +{ + m_useNinja = b; +} + QString CMakeOpenProjectWizard::arguments() const { return m_arguments; @@ -229,12 +345,17 @@ void CMakeOpenProjectWizard::setArguments(const QString &args) Utils::Environment CMakeOpenProjectWizard::environment() const { - return m_buildConfiguration->environment(); + return m_environment; } -CMakeBuildConfiguration *CMakeOpenProjectWizard::buildConfiguration() const +ProjectExplorer::Kit *CMakeOpenProjectWizard::kit() const { - return m_buildConfiguration; + return m_kit; +} + +void CMakeOpenProjectWizard::setKit(ProjectExplorer::Kit *kit) +{ + m_kit = kit; } InSourceBuildPage::InSourceBuildPage(CMakeOpenProjectWizard *cmakeWizard) @@ -285,6 +406,7 @@ CMakeRunPage::CMakeRunPage(CMakeOpenProjectWizard *cmakeWizard, Mode mode, const : QWizardPage(cmakeWizard), m_cmakeWizard(cmakeWizard), m_complete(false), + m_optionalCMake(false), m_mode(mode), m_buildDirectory(buildDirectory) { @@ -367,17 +489,41 @@ void CMakeRunPage::initWidgets() setMinimumSize(600, 400); } +QString CMakeRunPage::cachedGeneratorFromFile(const QString &cache) +{ + QFile fi(cache); + if (fi.exists()) { + // Cache exists, then read it... + if (fi.open(QIODevice::ReadOnly | QIODevice::Text)) { + while (!fi.atEnd()) { + QString line = fi.readLine(); + if (line.startsWith("CMAKE_GENERATOR:INTERNAL=")) { + int splitpos = line.indexOf('='); + if (splitpos != -1) { + QString cachedGenerator = line.mid(splitpos + 1).trimmed(); + if (!cachedGenerator.isEmpty()) + return cachedGenerator; + } + } + } + } + } + return QString(); +} + void CMakeRunPage::initializePage() { if (m_mode == Initial) { - m_complete = m_cmakeWizard->existsUpToDateXmlFile(); + bool upToDateXmlFile = m_cmakeWizard->existsUpToDateXmlFile();; m_buildDirectory = m_cmakeWizard->buildDirectory(); - if (m_cmakeWizard->existsUpToDateXmlFile()) { + if (upToDateXmlFile) { m_descriptionLabel->setText( tr("The directory %1 already contains a cbp file, which is recent enough. " - "You can pass special arguments or change the used tool chain here and rerun CMake. " + "You can pass special arguments and rerun CMake. " "Or simply finish the wizard directly.").arg(m_buildDirectory)); + m_optionalCMake = true; + m_complete = true; } else { m_descriptionLabel->setText( tr("The directory %1 does not contain a cbp file. Qt Creator needs to create this file by running CMake. " @@ -405,124 +551,105 @@ void CMakeRunPage::initializePage() m_descriptionLabel->setText(tr("Refreshing cbp file in %1.").arg(m_buildDirectory)); } - - // Try figuring out generator and toolchain from CMakeCache.txt - QString cachedGenerator; - QString cmakeCxxCompiler; - QFile fi(m_buildDirectory + "/CMakeCache.txt"); - if (fi.exists()) { - // Cache exists, then read it... - if (fi.open(QIODevice::ReadOnly | QIODevice::Text)) { - while (!fi.atEnd()) { - QString line = fi.readLine(); - if (line.startsWith("CMAKE_GENERATOR:INTERNAL=")) { - int splitpos = line.indexOf('='); - if (splitpos != -1) - cachedGenerator = line.mid(splitpos + 1).trimmed(); - } - if (line.startsWith("CMAKE_CXX_COMPILER:FILEPATH=")) { - int splitpos = line.indexOf("="); - if (splitpos != -1) - cmakeCxxCompiler = line.mid(splitpos +1).trimmed(); - } - if (!cachedGenerator.isEmpty() && !cmakeCxxCompiler.isEmpty()) - break; - } - } - } - // Build the list of generators/toolchains we want to offer - // restrict toolchains based on CMAKE_CXX_COMPILER ? - Q_UNUSED(cmakeCxxCompiler); m_generatorComboBox->clear(); + bool hasCodeBlocksGenerator = m_cmakeWizard->cmakeManager()->hasCodeBlocksMsvcGenerator(); + bool hasNinjaGenerator = m_cmakeWizard->cmakeManager()->hasCodeBlocksNinjaGenerator(); - QList kitList = - ProjectExplorer::KitManager::instance()->kits(); + if (m_mode == Initial) { + // Try figuring out generator and toolchain from CMakeCache.txt + QString cachedGenerator = cachedGeneratorFromFile(m_buildDirectory + "/CMakeCache.txt"); - foreach (ProjectExplorer::Kit *k, kitList) { - ProjectExplorer::ToolChain *tc = ProjectExplorer::ToolChainKitInformation::toolChain(k); - if (!tc) - continue; - ProjectExplorer::Abi targetAbi = tc->targetAbi(); - if (targetAbi.os() == ProjectExplorer::Abi::WindowsOS) { - if (targetAbi.osFlavor() == ProjectExplorer::Abi::WindowsMsvc2005Flavor - || targetAbi.osFlavor() == ProjectExplorer::Abi::WindowsMsvc2008Flavor - || targetAbi.osFlavor() == ProjectExplorer::Abi::WindowsMsvc2010Flavor - || targetAbi.osFlavor() == ProjectExplorer::Abi::WindowsMsvc2012Flavor) { - if (hasCodeBlocksGenerator && (cachedGenerator.isEmpty() || cachedGenerator == "NMake Makefiles")) - m_generatorComboBox->addItem(tr("NMake Generator (%1)").arg(k->displayName()), qVariantFromValue(GeneratorInfo(k))); - } else if (targetAbi.osFlavor() == ProjectExplorer::Abi::WindowsMSysFlavor) { - if (Utils::HostOsInfo::isWindowsHost()) { - if (cachedGenerator.isEmpty() || cachedGenerator == "MinGW Makefiles") - m_generatorComboBox->addItem(tr("MinGW Generator (%1)").arg(k->displayName()), qVariantFromValue(GeneratorInfo(k))); - } else if (cachedGenerator.isEmpty() || cachedGenerator == "Unix Makefiles") { - m_generatorComboBox->addItem(tr("Unix Generator (%1)").arg(k->displayName()), qVariantFromValue(GeneratorInfo(k))); - } - } - } else { - // Non windows - if (cachedGenerator.isEmpty() || cachedGenerator == "Unix Makefiles") - m_generatorComboBox->addItem(tr("Unix Generator (%1)").arg(k->displayName()), qVariantFromValue(GeneratorInfo(k))); + m_generatorComboBox->show(); + QList kitList = + ProjectExplorer::KitManager::instance()->kits(); + + foreach (ProjectExplorer::Kit *k, kitList) { + ProjectExplorer::ToolChain *tc = ProjectExplorer::ToolChainKitInformation::toolChain(k); + if (!tc) + continue; + QList infos = GeneratorInfo::generatorInfosFor(k, + hasNinjaGenerator ? GeneratorInfo::OfferNinja : GeneratorInfo::NoNinja, + hasCodeBlocksGenerator); + + foreach (const GeneratorInfo &info, infos) + if (cachedGenerator.isEmpty() || info.generator() == cachedGenerator) + m_generatorComboBox->addItem(info.displayName(), qVariantFromValue(info)); } - if (m_cmakeWizard->cmakeManager()->hasCodeBlocksNinjaGenerator() && - (cachedGenerator.isEmpty() || cachedGenerator == "Ninja")) - m_generatorComboBox->addItem(tr("Ninja (%1)").arg(k->displayName()), qVariantFromValue(GeneratorInfo(k, true))); + } else { + // Note: We don't compare the actually cached generator to what is set in the buildconfiguration + // We assume that the buildconfiguration is correct + GeneratorInfo::Ninja ninja; + if (m_mode == CMakeRunPage::NeedToUpdate || m_mode == CMakeRunPage::WantToUpdate) { + ninja = m_cmakeWizard->useNinja() ? GeneratorInfo::ForceNinja : GeneratorInfo::NoNinja; + } else { // Recreate, ChangeDirectory + // Note: ReCreate is technically just a removed .cbp file, we assume the cache + // got removed too. If the cache still exists the error message from cmake should + // be a good hint to change the generator + ninja = hasNinjaGenerator ? GeneratorInfo::OfferNinja : GeneratorInfo::NoNinja; + } + + QList infos = GeneratorInfo::generatorInfosFor(m_cmakeWizard->kit(), + ninja, + true); + foreach (const GeneratorInfo &info, infos) + m_generatorComboBox->addItem(info.displayName(), qVariantFromValue(info)); } } +bool CMakeRunPage::validatePage() +{ + if (m_optionalCMake) { + int index = m_generatorComboBox->currentIndex(); + if (index == -1) + return false; + GeneratorInfo generatorInfo = m_generatorComboBox->itemData(index).value(); + m_cmakeWizard->setKit(generatorInfo.kit()); + m_cmakeWizard->setUseNinja(generatorInfo.isNinja()); + } + return QWizardPage::validatePage(); +} + void CMakeRunPage::runCMake() { if (m_cmakeExecutable) // We asked the user for the cmake executable m_cmakeWizard->cmakeManager()->setCMakeExecutable(m_cmakeExecutable->path()); + m_optionalCMake = false; + m_complete = false; + + Utils::Environment env = m_cmakeWizard->environment(); int index = m_generatorComboBox->currentIndex(); - ProjectExplorer::Kit *k = 0; - GeneratorInfo generatorInfo; - if (index >= 0) { - generatorInfo = m_generatorComboBox->itemData(index).value(); - k = generatorInfo.kit(); - } - if (!k) { + if (index == -1) { m_output->appendPlainText(tr("No generator selected.")); return; } + GeneratorInfo generatorInfo = m_generatorComboBox->itemData(index).value(); + m_cmakeWizard->setKit(generatorInfo.kit()); + m_cmakeWizard->setUseNinja(generatorInfo.isNinja()); - ProjectExplorer::ToolChain *tc = ProjectExplorer::ToolChainKitInformation::toolChain(k); + // If mode is initial the user chooses the kit, otherwise it's already choosen + // and the environment already contains the kit + if (m_mode == Initial) + generatorInfo.kit()->addToEnvironment(env); m_runCMake->setEnabled(false); m_argumentsLineEdit->setEnabled(false); m_generatorComboBox->setEnabled(false); - CMakeManager *cmakeManager = m_cmakeWizard->cmakeManager(); - - QString generator = QLatin1String("-GCodeBlocks - Unix Makefiles"); - if (generatorInfo.isNinja()) { - m_cmakeWizard->buildConfiguration()->setUseNinja(true); - generator = "-GCodeBlocks - Ninja"; - } else if (tc->targetAbi().os() == ProjectExplorer::Abi::WindowsOS) { - m_cmakeWizard->buildConfiguration()->setUseNinja(false); - if (tc->targetAbi().osFlavor() == ProjectExplorer::Abi::WindowsMSysFlavor) { - generator = Utils::HostOsInfo::isWindowsHost() - ? QLatin1String("-GCodeBlocks - MinGW Makefiles") - : QLatin1String("-GCodeBlocks - Unix Makefiles"); - } else { - generator = QLatin1String("-GCodeBlocks - NMake Makefiles"); - } - } - - Utils::Environment env = m_cmakeWizard->environment(); - tc->addToEnvironment(env); m_output->clear(); + CMakeManager *cmakeManager = m_cmakeWizard->cmakeManager(); if (m_cmakeWizard->cmakeManager()->isCMakeExecutableValid()) { m_cmakeProcess = new Utils::QtcProcess(); connect(m_cmakeProcess, SIGNAL(readyReadStandardOutput()), this, SLOT(cmakeReadyReadStandardOutput())); connect(m_cmakeProcess, SIGNAL(readyReadStandardError()), this, SLOT(cmakeReadyReadStandardError())); connect(m_cmakeProcess, SIGNAL(finished(int)), this, SLOT(cmakeFinished())); - cmakeManager->createXmlFile(m_cmakeProcess, m_argumentsLineEdit->text(), m_cmakeWizard->sourceDirectory(), m_buildDirectory, env, generator); + cmakeManager->createXmlFile(m_cmakeProcess, m_argumentsLineEdit->text(), m_cmakeWizard->sourceDirectory(), + m_buildDirectory, env, generatorInfo.generatorArgument()); } else { m_runCMake->setEnabled(true); m_argumentsLineEdit->setEnabled(true); diff --git a/src/plugins/cmakeprojectmanager/cmakeopenprojectwizard.h b/src/plugins/cmakeprojectmanager/cmakeopenprojectwizard.h index 9b2c629259a..dd013da7bcb 100644 --- a/src/plugins/cmakeprojectmanager/cmakeopenprojectwizard.h +++ b/src/plugins/cmakeprojectmanager/cmakeopenprojectwizard.h @@ -31,9 +31,13 @@ #ifndef CMAKEOPENPROJECTWIZARD_H #define CMAKEOPENPROJECTWIZARD_H +#include "cmakebuildconfiguration.h" + #include #include #include +#include +#include #include #include @@ -47,14 +51,13 @@ class PathChooser; } namespace ProjectExplorer { -class ToolChain; +class Kit; } namespace CMakeProjectManager { namespace Internal { class CMakeManager; -class CMakeBuildConfiguration; class CMakeOpenProjectWizard : public Utils::Wizard { @@ -70,28 +73,52 @@ public: Nothing, NeedToCreate, NeedToUpdate, - WantToUpdate + WantToUpdate, + ChangeDirectory }; - // used at importing a project without a .user file - CMakeOpenProjectWizard(CMakeManager *cmakeManager, const QString &sourceDirectory, CMakeBuildConfiguration *bc); + class BuildInfo + { + public: + BuildInfo() + {} + + BuildInfo(CMakeBuildConfiguration *bc) + : sourceDirectory(bc->target()->project()->projectDirectory()) + , buildDirectory(bc->buildDirectory()) + , environment(bc->environment()) + , useNinja(bc->useNinja()) + , kit(bc->target()->kit()) + {} + + QString sourceDirectory; + QString buildDirectory; + Utils::Environment environment; + bool useNinja; + ProjectExplorer::Kit *kit; + }; + + /// used at importing a project without a .user file + CMakeOpenProjectWizard(CMakeManager *cmakeManager, const QString &sourceDirectory, Utils::Environment env); + /// used to update if we have already a .user file /// recreates or updates the cbp file - CMakeOpenProjectWizard(CMakeManager *cmakeManager, const QString &sourceDirectory, const QString &buildDirectory, Mode mode, CMakeBuildConfiguration *bc); - /// used to change the build directory of one buildconfiguration - /// shows a page for selecting a directory - /// then the run cmake page - CMakeOpenProjectWizard(CMakeManager *cmakeManager, const QString &sourceDirectory, const QString &oldBuildDirectory, CMakeBuildConfiguration *bc); + /// Also used to change the build directory of one buildconfiguration or create a new buildconfiguration + CMakeOpenProjectWizard(CMakeManager *cmakeManager, Mode mode, const BuildInfo &info); + virtual int nextId() const; QString buildDirectory() const; QString sourceDirectory() const; void setBuildDirectory(const QString &directory); + bool useNinja() const; + void setUseNinja(bool b); CMakeManager *cmakeManager() const; QString arguments() const; void setArguments(const QString &args); Utils::Environment environment() const; - CMakeBuildConfiguration *buildConfiguration() const; + ProjectExplorer::Kit *kit() const; + void setKit(ProjectExplorer::Kit *kit); bool existsUpToDateXmlFile() const; private: @@ -102,7 +129,9 @@ private: QString m_sourceDirectory; QString m_arguments; bool m_creatingCbpFiles; - CMakeBuildConfiguration *m_buildConfiguration; + Utils::Environment m_environment; + bool m_useNinja; + ProjectExplorer::Kit *m_kit; }; class InSourceBuildPage : public QWizardPage @@ -134,6 +163,7 @@ public: explicit CMakeRunPage(CMakeOpenProjectWizard *cmakeWizard, Mode mode = Initial, const QString &buildDirectory = QString()); virtual void initializePage(); + virtual bool validatePage(); virtual void cleanupPage(); virtual bool isComplete() const; private slots: @@ -143,6 +173,7 @@ private slots: void cmakeReadyReadStandardError(); private: void initWidgets(); + QString cachedGeneratorFromFile(const QString &cache); CMakeOpenProjectWizard *m_cmakeWizard; QPlainTextEdit *m_output; QPushButton *m_runCMake; @@ -153,6 +184,7 @@ private: QLabel *m_descriptionLabel; QLabel *m_exitCodeLabel; bool m_complete; + bool m_optionalCMake; Mode m_mode; QString m_buildDirectory; }; diff --git a/src/plugins/cmakeprojectmanager/cmakeproject.cpp b/src/plugins/cmakeprojectmanager/cmakeproject.cpp index 0c8c6dbbc12..e6f9c83a435 100644 --- a/src/plugins/cmakeprojectmanager/cmakeproject.cpp +++ b/src/plugins/cmakeprojectmanager/cmakeproject.cpp @@ -49,6 +49,7 @@ #include #include #include +#include #include #include #include @@ -145,8 +146,6 @@ void CMakeProject::changeActiveBuildConfiguration(ProjectExplorer::BuildConfigur CMakeBuildConfiguration *cmakebc = static_cast(bc); // Pop up a dialog asking the user to rerun cmake - QFileInfo sourceFileInfo(m_fileName); - QString cbpFile = CMakeManager::findCbpFile(QDir(bc->buildDirectory())); QFileInfo cbpFileFi(cbpFile); CMakeOpenProjectWizard::Mode mode = CMakeOpenProjectWizard::Nothing; @@ -162,13 +161,12 @@ void CMakeProject::changeActiveBuildConfiguration(ProjectExplorer::BuildConfigur } if (mode != CMakeOpenProjectWizard::Nothing) { - CMakeOpenProjectWizard copw(m_manager, - sourceFileInfo.absolutePath(), - cmakebc->buildDirectory(), - mode, - cmakebc); - copw.exec(); + CMakeOpenProjectWizard copw(m_manager, mode, + CMakeOpenProjectWizard::BuildInfo(cmakebc)); + if (copw.exec() == QDialog::Accepted) + cmakebc->setUseNinja(copw.useNinja()); // NeedToCreate can change the Ninja setting } + // reparse parseCMakeLists(); } @@ -190,7 +188,7 @@ void CMakeProject::changeBuildDirectory(CMakeBuildConfiguration *bc, const QStri QString CMakeProject::defaultBuildDirectory() const { - return projectDirectory() + QLatin1String("/qtcreator-build"); + return projectDirectory() + QLatin1String("-build"); } bool CMakeProject::parseCMakeLists() @@ -531,33 +529,59 @@ bool CMakeProject::fromMap(const QVariantMap &map) if (!Project::fromMap(map)) return false; - Kit *defaultKit = KitManager::instance()->defaultKit(); - if (!activeTarget() && defaultKit) - addTarget(createTarget(defaultKit)); - - // We have a user file, but we could still be missing the cbp file - // or simply run createXml with the saved settings - QFileInfo sourceFileInfo(m_fileName); - CMakeBuildConfiguration *activeBC = qobject_cast(activeTarget()->activeBuildConfiguration()); - if (!activeBC) - return false; - QString cbpFile = CMakeManager::findCbpFile(QDir(activeBC->buildDirectory())); - QFileInfo cbpFileFi(cbpFile); - - CMakeOpenProjectWizard::Mode mode = CMakeOpenProjectWizard::Nothing; - if (!cbpFileFi.exists()) - mode = CMakeOpenProjectWizard::NeedToCreate; - else if (cbpFileFi.lastModified() < sourceFileInfo.lastModified()) - mode = CMakeOpenProjectWizard::NeedToUpdate; - - if (mode != CMakeOpenProjectWizard::Nothing) { - CMakeOpenProjectWizard copw(m_manager, - sourceFileInfo.absolutePath(), - activeBC->buildDirectory(), - mode, - activeBC); + bool hasUserFile = activeTarget(); + if (!hasUserFile) { + CMakeOpenProjectWizard copw(m_manager, projectDirectory(), Utils::Environment::systemEnvironment()); if (copw.exec() != QDialog::Accepted) return false; + Kit *k = copw.kit(); + Target *t = new Target(this, k); + CMakeBuildConfiguration *bc(new CMakeBuildConfiguration(t)); + bc->setDefaultDisplayName("all"); + bc->setUseNinja(copw.useNinja()); + bc->setBuildDirectory(copw.buildDirectory()); + ProjectExplorer::BuildStepList *buildSteps = bc->stepList(ProjectExplorer::Constants::BUILDSTEPS_BUILD); + ProjectExplorer::BuildStepList *cleanSteps = bc->stepList(ProjectExplorer::Constants::BUILDSTEPS_CLEAN); + + // Now create a standard build configuration + buildSteps->insertStep(0, new MakeStep(buildSteps)); + + MakeStep *cleanMakeStep = new MakeStep(cleanSteps); + cleanSteps->insertStep(0, cleanMakeStep); + cleanMakeStep->setAdditionalArguments("clean"); + cleanMakeStep->setClean(true); + + t->addBuildConfiguration(bc); + + DeployConfigurationFactory *fac = ExtensionSystem::PluginManager::instance()->getObject(); + ProjectExplorer::DeployConfiguration *dc = fac->create(t, ProjectExplorer::Constants::DEFAULT_DEPLOYCONFIGURATION_ID); + t->addDeployConfiguration(dc); + + addTarget(t); + } else { + // We have a user file, but we could still be missing the cbp file + // or simply run createXml with the saved settings + QFileInfo sourceFileInfo(m_fileName); + CMakeBuildConfiguration *activeBC = qobject_cast(activeTarget()->activeBuildConfiguration()); + if (!activeBC) + return false; + QString cbpFile = CMakeManager::findCbpFile(QDir(activeBC->buildDirectory())); + QFileInfo cbpFileFi(cbpFile); + + CMakeOpenProjectWizard::Mode mode = CMakeOpenProjectWizard::Nothing; + if (!cbpFileFi.exists()) + mode = CMakeOpenProjectWizard::NeedToCreate; + else if (cbpFileFi.lastModified() < sourceFileInfo.lastModified()) + mode = CMakeOpenProjectWizard::NeedToUpdate; + + if (mode != CMakeOpenProjectWizard::Nothing) { + CMakeOpenProjectWizard copw(m_manager, mode, + CMakeOpenProjectWizard::BuildInfo(activeBC)); + if (copw.exec() != QDialog::Accepted) + return false; + else + activeBC->setUseNinja(copw.useNinja()); + } } m_watcher = new QFileSystemWatcher(this); @@ -565,17 +589,13 @@ bool CMakeProject::fromMap(const QVariantMap &map) parseCMakeLists(); - if (hasBuildTarget("all")) { + if (!hasUserFile && hasBuildTarget("all")) { MakeStep *makeStep = qobject_cast( activeTarget()->activeBuildConfiguration()->stepList(ProjectExplorer::Constants::BUILDSTEPS_BUILD)->at(0)); Q_ASSERT(makeStep); makeStep->setBuildTarget("all", true); } - foreach (Target *t, targets()) - connect(t, SIGNAL(activeBuildConfigurationChanged(ProjectExplorer::BuildConfiguration*)), - this, SLOT(changeActiveBuildConfiguration(ProjectExplorer::BuildConfiguration*))); - connect(Core::EditorManager::instance(), SIGNAL(editorAboutToClose(Core::IEditor*)), this, SLOT(editorAboutToClose(Core::IEditor*))); @@ -588,6 +608,22 @@ bool CMakeProject::fromMap(const QVariantMap &map) return true; } +bool CMakeProject::setupTarget(Target *t) +{ + CMakeBuildConfigurationFactory *factory + = ExtensionSystem::PluginManager::instance()->getObject(); + CMakeBuildConfiguration *bc = factory->create(t, Constants::CMAKE_BC_ID, QLatin1String("all")); + if (!bc) + return false; + + t->addBuildConfiguration(bc); + + DeployConfigurationFactory *fac = ExtensionSystem::PluginManager::instance()->getObject(); + ProjectExplorer::DeployConfiguration *dc = fac->create(t, ProjectExplorer::Constants::DEFAULT_DEPLOYCONFIGURATION_ID); + t->addDeployConfiguration(dc); + return true; +} + CMakeBuildTarget CMakeProject::buildTargetForTitle(const QString &title) { foreach (const CMakeBuildTarget &ct, m_buildTargets) @@ -903,25 +939,21 @@ void CMakeBuildSettingsWidget::init(BuildConfiguration *bc) void CMakeBuildSettingsWidget::openChangeBuildDirectoryDialog() { CMakeProject *project = static_cast(m_buildConfiguration->target()->project()); - CMakeOpenProjectWizard copw(project->projectManager(), - project->projectDirectory(), - m_buildConfiguration->buildDirectory(), - m_buildConfiguration); + CMakeOpenProjectWizard copw(project->projectManager(), CMakeOpenProjectWizard::ChangeDirectory, + CMakeOpenProjectWizard::BuildInfo(m_buildConfiguration)); if (copw.exec() == QDialog::Accepted) { project->changeBuildDirectory(m_buildConfiguration, copw.buildDirectory()); + m_buildConfiguration->setUseNinja(copw.useNinja()); m_pathLineEdit->setText(m_buildConfiguration->buildDirectory()); } } void CMakeBuildSettingsWidget::runCMake() { - // TODO skip build directory CMakeProject *project = static_cast(m_buildConfiguration->target()->project()); CMakeOpenProjectWizard copw(project->projectManager(), - project->projectDirectory(), - m_buildConfiguration->buildDirectory(), CMakeOpenProjectWizard::WantToUpdate, - m_buildConfiguration); + CMakeOpenProjectWizard::BuildInfo(m_buildConfiguration)); if (copw.exec() == QDialog::Accepted) project->parseCMakeLists(); } diff --git a/src/plugins/cmakeprojectmanager/cmakeproject.h b/src/plugins/cmakeprojectmanager/cmakeproject.h index 717d577b07c..bebb747ebf8 100644 --- a/src/plugins/cmakeprojectmanager/cmakeproject.h +++ b/src/plugins/cmakeprojectmanager/cmakeproject.h @@ -110,6 +110,7 @@ signals: protected: bool fromMap(const QVariantMap &map); + bool setupTarget(ProjectExplorer::Target *t); // called by CMakeBuildSettingsWidget void changeBuildDirectory(CMakeBuildConfiguration *bc, const QString &newBuildDirectory); diff --git a/src/plugins/cmakeprojectmanager/cmakeprojectconstants.h b/src/plugins/cmakeprojectmanager/cmakeprojectconstants.h index 2e6db191d19..8ce6c946fa8 100644 --- a/src/plugins/cmakeprojectmanager/cmakeprojectconstants.h +++ b/src/plugins/cmakeprojectmanager/cmakeprojectconstants.h @@ -45,6 +45,9 @@ const char RUNCMAKECONTEXTMENU[] = "CMakeProject.RunCMakeContextMenu"; // Project const char CMAKEPROJECT_ID[] = "CMakeProjectManager.CMakeProject"; +// Buildconfiguration +const char CMAKE_BC_ID[] = "CMakeProjectManager.CMakeBuildConfiguration"; + // Menu const char M_CONTEXT[] = "CMakeEditor.ContextMenu"; diff --git a/src/plugins/cmakeprojectmanager/cmakeprojectmanager.cpp b/src/plugins/cmakeprojectmanager/cmakeprojectmanager.cpp index 98ee2ea3822..8e562737443 100644 --- a/src/plugins/cmakeprojectmanager/cmakeprojectmanager.cpp +++ b/src/plugins/cmakeprojectmanager/cmakeprojectmanager.cpp @@ -119,11 +119,8 @@ void CMakeManager::runCMake(ProjectExplorer::Project *project) CMakeBuildConfiguration *bc = static_cast(cmakeProject->activeTarget()->activeBuildConfiguration()); - CMakeOpenProjectWizard copw(this, - cmakeProject->projectDirectory(), - bc->buildDirectory(), - CMakeOpenProjectWizard::WantToUpdate, - bc); + CMakeOpenProjectWizard copw(this, CMakeOpenProjectWizard::WantToUpdate, + CMakeOpenProjectWizard::BuildInfo(bc)); if (copw.exec() == QDialog::Accepted) cmakeProject->parseCMakeLists(); } diff --git a/src/plugins/cmakeprojectmanager/makestep.cpp b/src/plugins/cmakeprojectmanager/makestep.cpp index 7c9bcd4b40f..cd173e298bf 100644 --- a/src/plugins/cmakeprojectmanager/makestep.cpp +++ b/src/plugins/cmakeprojectmanager/makestep.cpp @@ -93,20 +93,21 @@ MakeStep::MakeStep(BuildStepList *bsl, MakeStep *bs) : void MakeStep::ctor() { m_percentProgress = QRegExp("^\\[\\s*(\\d*)%\\]"); - m_useNinja = false; m_ninjaProgress = QRegExp ("^\\[\\s*(\\d*)/\\s*(\\d*)"); m_ninjaProgressString = QLatin1String("[%s/%t "); // ninja: [33/100 //: Default display name for the cmake make step. setDefaultDisplayName(tr("Make")); - BuildConfiguration *bc = cmakeBuildConfiguration(); + CMakeBuildConfiguration *bc = cmakeBuildConfiguration(); if (bc) { + m_useNinja = bc->useNinja(); m_activeConfiguration = 0; connect(bc, SIGNAL(useNinjaChanged(bool)), this, SLOT(setUseNinja(bool))); } else { // That means the step is in the deploylist, so we listen to the active build config // changed signal and react to the activeBuildConfigurationChanged() signal of the buildconfiguration m_activeConfiguration = targetsActiveBuildConfiguration(); + m_useNinja = m_activeConfiguration->useNinja(); connect (target(), SIGNAL(activeBuildConfigurationChanged(ProjectExplorer::BuildConfiguration*)), this, SLOT(activeBuildConfigurationChanged())); activeBuildConfigurationChanged(); diff --git a/src/plugins/coreplugin/documentmanager.cpp b/src/plugins/coreplugin/documentmanager.cpp index e1b0a1608fe..33f770ece87 100644 --- a/src/plugins/coreplugin/documentmanager.cpp +++ b/src/plugins/coreplugin/documentmanager.cpp @@ -1030,6 +1030,9 @@ void DocumentManager::checkForReload() case Utils::ReloadNone: success = document->reload(&errorString, IDocument::FlagIgnore, IDocument::TypeContents); break; + case Utils::CloseCurrent: + editorsToClose << EditorManager::instance()->editorsForDocument(document); + break; } } // IDocument wants us to ask, and it's the TypeRemoved case diff --git a/src/plugins/cpptools/cppfindreferences.cpp b/src/plugins/cpptools/cppfindreferences.cpp index 5d5b6795a7e..2fa5ed2ed7e 100644 --- a/src/plugins/cpptools/cppfindreferences.cpp +++ b/src/plugins/cpptools/cppfindreferences.cpp @@ -65,6 +65,7 @@ #include #include #include +#include #include @@ -77,11 +78,16 @@ static QString getSource(const QString &fileName, if (workingCopy.contains(fileName)) { return workingCopy.source(fileName); } else { - Utils::FileReader reader; - if (!reader.fetch(fileName, QFile::Text)) // ### FIXME error reporting - return QString(); + QString fileContents; + Utils::TextFileFormat format; + QString error; + QTextCodec *defaultCodec = Core::EditorManager::instance()->defaultTextCodec(); + Utils::TextFileFormat::ReadResult result = Utils::TextFileFormat::readFile( + fileName, defaultCodec, &fileContents, &format, &error); + if (result != Utils::TextFileFormat::ReadSuccess) + qWarning() << "Could not read " << fileName << ". Error: " << error; - return QString::fromLocal8Bit(reader.data()); // ### FIXME encoding + return fileContents; } } diff --git a/src/plugins/debugger/qml/qmlinspectoragent.cpp b/src/plugins/debugger/qml/qmlinspectoragent.cpp index 314aae360f3..f5a76c1f8e8 100644 --- a/src/plugins/debugger/qml/qmlinspectoragent.cpp +++ b/src/plugins/debugger/qml/qmlinspectoragent.cpp @@ -147,9 +147,16 @@ bool QmlInspectorAgent::selectObjectInTree(int debugId) m_objectToSelect = 0; return true; } else { - // we've to fetch it + // we may have to fetch it m_objectToSelect = debugId; - fetchObject(debugId); + using namespace QmlDebug::Constants; + if (m_engineClient->objectName() == QLatin1String(QDECLARATIVE_ENGINE)) { + // reset current Selection + QByteArray root = m_debuggerEngine->watchHandler()->watchData(QModelIndex())->iname; + m_debuggerEngine->watchHandler()->setCurrentItem(root); + } else { + fetchObject(debugId); + } return false; } } @@ -708,9 +715,9 @@ void QmlInspectorAgent::insertObjectInTree(const ObjectReference &object) emit objectTreeUpdated(); emit objectFetched(last); - if (m_objectToSelect == last.debugId()) { + if (m_objectToSelect == last.debugId() || m_debugIdToIname.keys().contains(m_objectToSelect)) { // select item in view - QByteArray iname = m_debugIdToIname.value(last.debugId()); + QByteArray iname = m_debugIdToIname.value(m_objectToSelect); if (debug) qDebug() << " selecting" << iname << "in tree"; watchHandler->setCurrentItem(iname); @@ -808,6 +815,7 @@ QList QmlInspectorAgent::buildWatchData(const ObjectReference &obj, list.append(objWatch); addObjectWatch(objWatch.id); + m_debugIdToIname.insert(objDebugId, objIname); } if (!m_debuggerEngine->watchHandler()->isExpandedIName(objIname)) { @@ -848,7 +856,6 @@ QList QmlInspectorAgent::buildWatchData(const ObjectReference &obj, propertyWatch.setHasChildren(false); list.append(propertyWatch); } - m_debugIdToIname.insert(objDebugId, objIname); } // recurse diff --git a/src/plugins/help/helpplugin.cpp b/src/plugins/help/helpplugin.cpp index d03c84a0c7c..65c1ebeff80 100644 --- a/src/plugins/help/helpplugin.cpp +++ b/src/plugins/help/helpplugin.cpp @@ -1172,7 +1172,7 @@ void HelpPlugin::handleHelpRequest(const QUrl &url) if (address.startsWith(HelpViewer::NsNokia) || address.startsWith(HelpViewer::NsTrolltech)) { // local help not installed, resort to external web help - QString urlPrefix = QLatin1String("http://doc.qt.nokia.com/"); + QString urlPrefix = QLatin1String("http://doc.qt.digia.com/"); if (url.authority() == QLatin1String("com.nokia.qtcreator")) { urlPrefix.append(QString::fromLatin1("qtcreator")); } else { diff --git a/src/plugins/projectexplorer/kitinformation.cpp b/src/plugins/projectexplorer/kitinformation.cpp index 331cc0af776..bff9985ed67 100644 --- a/src/plugins/projectexplorer/kitinformation.cpp +++ b/src/plugins/projectexplorer/kitinformation.cpp @@ -165,6 +165,7 @@ QList ToolChainKitInformation::validate(Kit *k) const { QList result; if (!toolChain(k)) { + qWarning() << "Tool chain is no longer know, removing from kit %1." << k->displayName(); setToolChain(k, 0); // make sure to clear out no longer known tool chains result << Task(Task::Error, ToolChainKitInformation::msgNoToolChainInTarget(), Utils::FileName(), -1, Core::Id(Constants::TASK_CATEGORY_BUILDSYSTEM)); diff --git a/src/plugins/projectexplorer/kitmanager.cpp b/src/plugins/projectexplorer/kitmanager.cpp index b5093acc26f..ef174b7b9cc 100644 --- a/src/plugins/projectexplorer/kitmanager.cpp +++ b/src/plugins/projectexplorer/kitmanager.cpp @@ -221,6 +221,7 @@ void KitManager::restoreKits() KitManager::~KitManager() { + saveKits(); // Make sure we save the current state on exit! // Clean out kit information to avoid calling them during deregistration: delete d; m_instance = 0; diff --git a/src/plugins/projectexplorer/project.cpp b/src/plugins/projectexplorer/project.cpp index 8eb13f4812f..ebf91afd6ae 100644 --- a/src/plugins/projectexplorer/project.cpp +++ b/src/plugins/projectexplorer/project.cpp @@ -250,11 +250,21 @@ Target *Project::createTarget(Kit *k) return 0; Target *t = new Target(this, k); - t->createDefaultSetup(); - + if (!setupTarget(t)) { + delete t; + return 0; + } return t; } +bool Project::setupTarget(Target *t) +{ + t->updateDefaultBuildConfigurations(); + t->updateDefaultDeployConfigurations(); + t->updateDefaultRunConfigurations(); + return true; +} + Target *Project::restoreTarget(const QVariantMap &data) { Core::Id id = idFromMap(data); diff --git a/src/plugins/projectexplorer/project.h b/src/plugins/projectexplorer/project.h index 34652a21fad..82310ce0519 100644 --- a/src/plugins/projectexplorer/project.h +++ b/src/plugins/projectexplorer/project.h @@ -147,6 +147,7 @@ signals: protected: virtual bool fromMap(const QVariantMap &map); + virtual bool setupTarget(Target *t); virtual void setProjectContext(Core::Context context); virtual void setProjectLanguage(Core::Context language); diff --git a/src/plugins/projectexplorer/settingsaccessor.cpp b/src/plugins/projectexplorer/settingsaccessor.cpp index e39ac2384b3..ac989109749 100644 --- a/src/plugins/projectexplorer/settingsaccessor.cpp +++ b/src/plugins/projectexplorer/settingsaccessor.cpp @@ -623,7 +623,12 @@ QVariantMap SettingsAccessor::restoreSettings() const } // Verify environment. - if (!verifyEnvironmentId(settings.m_map.value(QLatin1String(ENVIRONMENT_ID_KEY)).toString())) { + const QString fileId = settings.m_map.value(QLatin1String(ENVIRONMENT_ID_KEY)).toString(); + const QString creatorId = ProjectExplorerPlugin::instance()->projectExplorerSettings().environmentId.toString(); + if (fileId.isEmpty() || fileId != creatorId) { + QString backup = fn + QLatin1Char('.') + fileId.mid(1, 7); + QFile::copy(fn, backup); + // TODO tr, casing check QMessageBox msgBox( QMessageBox::Question, @@ -778,17 +783,6 @@ void SettingsAccessor::addVersionHandler(UserFileVersionHandler *handler) Q_ASSERT(m_handlers.contains(i)); } -bool SettingsAccessor::verifyEnvironmentId(const QString &id) -{ - QUuid fileEnvironmentId(id); - if (!fileEnvironmentId.isNull() - && fileEnvironmentId - != ProjectExplorerPlugin::instance()->projectExplorerSettings().environmentId) { - return false; - } - return true; -} - // ------------------------------------------------------------------------- // SettingsData // ------------------------------------------------------------------------- diff --git a/src/plugins/projectexplorer/target.cpp b/src/plugins/projectexplorer/target.cpp index 5c3d702b591..660944d90f0 100644 --- a/src/plugins/projectexplorer/target.cpp +++ b/src/plugins/projectexplorer/target.cpp @@ -521,13 +521,6 @@ QVariantMap Target::toMap() const return map; } -void Target::createDefaultSetup() -{ - updateDefaultBuildConfigurations(); - updateDefaultDeployConfigurations(); - updateDefaultRunConfigurations(); -} - void Target::updateDefaultBuildConfigurations() { IBuildConfigurationFactory *bcFactory = IBuildConfigurationFactory::find(this); diff --git a/src/plugins/projectexplorer/target.h b/src/plugins/projectexplorer/target.h index f35c5d1d1e1..b93fb83dedb 100644 --- a/src/plugins/projectexplorer/target.h +++ b/src/plugins/projectexplorer/target.h @@ -113,7 +113,6 @@ public: QVariantMap toMap() const; - void createDefaultSetup(); void updateDefaultBuildConfigurations(); void updateDefaultDeployConfigurations(); void updateDefaultRunConfigurations(); diff --git a/src/plugins/projectexplorer/toolchainmanager.cpp b/src/plugins/projectexplorer/toolchainmanager.cpp index 158c7401acb..a40ab26ab76 100644 --- a/src/plugins/projectexplorer/toolchainmanager.cpp +++ b/src/plugins/projectexplorer/toolchainmanager.cpp @@ -190,7 +190,11 @@ void ToolChainManager::restoreToolChains() } // Delete all loaded autodetected tool chains that were not rediscovered: - qDeleteAll(tcsToCheck); + foreach (ToolChain *tc, tcsToCheck) { + qWarning() << QString::fromLatin1("ToolChain \"%1\" (%2) dropped since it was not auto-detected again") + .arg(tc->displayName()).arg(tc->id()); + delete tc; + } // Store manual tool chains foreach (ToolChain *tc, tcsToRegister) @@ -199,6 +203,8 @@ void ToolChainManager::restoreToolChains() ToolChainManager::~ToolChainManager() { + saveToolChains(); // Make sure to save tool chains when closing + // Deregister tool chains QList copy = d->toolChains(); foreach (ToolChain *tc, copy) diff --git a/src/plugins/qmldesigner/components/formeditor/selectionrectangle.cpp b/src/plugins/qmldesigner/components/formeditor/selectionrectangle.cpp index fb8b324e7e3..586fc1421dd 100644 --- a/src/plugins/qmldesigner/components/formeditor/selectionrectangle.cpp +++ b/src/plugins/qmldesigner/components/formeditor/selectionrectangle.cpp @@ -48,8 +48,9 @@ SelectionRectangle::SelectionRectangle(LayerItem *layerItem) SelectionRectangle::~SelectionRectangle() { - if (m_layerItem) { - m_layerItem->scene()->removeItem(m_controlShape); + if (m_controlShape) { + if (m_controlShape->scene()) + m_controlShape->scene()->removeItem(m_controlShape); delete m_controlShape; } } diff --git a/src/plugins/qmldesigner/components/propertyeditor/propertyeditor.cpp b/src/plugins/qmldesigner/components/propertyeditor/propertyeditor.cpp index 275506ff7f9..94334e713d6 100644 --- a/src/plugins/qmldesigner/components/propertyeditor/propertyeditor.cpp +++ b/src/plugins/qmldesigner/components/propertyeditor/propertyeditor.cpp @@ -825,7 +825,7 @@ void PropertyEditor::modelAttached(Model *model) resetView(); if (!m_setupCompleted) { m_singleShotTimer->setSingleShot(true); - m_singleShotTimer->setInterval(1000); + m_singleShotTimer->setInterval(100); connect(m_singleShotTimer, SIGNAL(timeout()), this, SLOT(setupPanes())); m_singleShotTimer->start(); } diff --git a/src/plugins/qnx/bardescriptorfileimagewizardpage.cpp b/src/plugins/qnx/bardescriptorfileimagewizardpage.cpp index a915372b15e..b2e6e47fd7f 100644 --- a/src/plugins/qnx/bardescriptorfileimagewizardpage.cpp +++ b/src/plugins/qnx/bardescriptorfileimagewizardpage.cpp @@ -37,6 +37,30 @@ using namespace Qnx; using namespace Qnx::Internal; +namespace { + // image sizes are likely device specific. + // those are the ones for the upcoming BB10 devices which this plugin is mainly targetted at. + enum { + // Application icon sizes. + AppIconMinWidth = 1, + AppIconMinHeight = 1, + AppIconMaxWidth = 150, + AppIconMaxHeight = 150, + + // Landscape splashscreen sizes + LandscapeSplashMinWidth = 1, + LandscapeSplashMinHeight = 1, + LandscapeSplashMaxWidth = 1280, + LandscapeSplashMaxHeight = 768, + + // Portrait splashscreen sizes + PortraitSplashMinWidth = 1, + PortraitSplashMinHeight = 1, + PortraitSplashMaxWidth = 768, + PortraitSplashMaxHeight = 1280 + }; +} + BarDescriptorFileImageWizardPage::BarDescriptorFileImageWizardPage(QWidget *parent) : QWizardPage(parent) , m_ui(new Ui::BarDescriptorFileImageWizardPage) @@ -92,7 +116,7 @@ QString BarDescriptorFileImageWizardPage::portraitSplashScreen() const void BarDescriptorFileImageWizardPage::validateIcon(const QString &path) { - m_iconValidationResult = validateImage(path, QSize(1, 1), QSize(90, 90)); + m_iconValidationResult = validateImage(path, QSize(AppIconMinWidth, AppIconMinHeight), QSize(AppIconMaxWidth, AppIconMaxHeight)); switch (m_iconValidationResult) { case Valid: @@ -103,8 +127,10 @@ void BarDescriptorFileImageWizardPage::validateIcon(const QString &path) break; case IncorrectSize: { const QSize size = imageSize(path); - m_ui->iconValidationLabel->setText(tr("Incorrect icon size (%1x%2). The recommended size is " - "86x86 pixels with a maximum size of 90x90 pixels.").arg(size.width()).arg(size.height())); + m_ui->iconValidationLabel->setText(tr("Incorrect icon size (%1x%2). The maximum size is " + "%3x%4 pixels.") + .arg(size.width()).arg(size.height()) + .arg(AppIconMaxWidth).arg(AppIconMaxHeight)); break; } default: @@ -116,14 +142,14 @@ void BarDescriptorFileImageWizardPage::validateIcon(const QString &path) void BarDescriptorFileImageWizardPage::validateLandscapeSplashScreen(const QString &path) { - m_landscapeSplashScreenValidationResult = validateImage(path, QSize(1024, 600), QSize(1024, 600)); + m_landscapeSplashScreenValidationResult = validateImage(path, QSize(LandscapeSplashMinWidth, LandscapeSplashMinHeight), QSize(LandscapeSplashMaxWidth, LandscapeSplashMaxHeight)); updateSplashScreenValidationLabel(); emit completeChanged(); } void BarDescriptorFileImageWizardPage::validatePortraitSplashScreen(const QString &path) { - m_portraitSplashScreenValidationResult = validateImage(path, QSize(600, 1024), QSize(600, 1024)); + m_portraitSplashScreenValidationResult = validateImage(path, QSize(PortraitSplashMinWidth, PortraitSplashMinHeight), QSize(PortraitSplashMaxWidth, PortraitSplashMaxHeight)); updateSplashScreenValidationLabel(); emit completeChanged(); } @@ -143,8 +169,10 @@ void BarDescriptorFileImageWizardPage::updateSplashScreenValidationLabel() break; case IncorrectSize: { const QSize size = imageSize(m_ui->landscapeSplashScreen->fileName().toString()); - m_ui->splashScreenValidationLabel->setText(tr("Incorrect landscape splash screen size (%1x%2). The required " - "size is 1024x600 pixels.").arg(size.width()).arg(size.height())); + m_ui->splashScreenValidationLabel->setText(tr("Incorrect landscape splash screen size (%1x%2). The maximum " + "size is %3x%4 pixels.") + .arg(size.width()).arg(size.height()) + .arg(LandscapeSplashMaxWidth).arg(LandscapeSplashMaxHeight)); break; } case Valid: @@ -159,8 +187,10 @@ void BarDescriptorFileImageWizardPage::updateSplashScreenValidationLabel() break; case IncorrectSize: { const QSize size = imageSize(m_ui->portraitSplashScreen->fileName().toString()); - m_ui->splashScreenValidationLabel->setText(tr("Incorrect portrait splash screen size (%1x%2). The required " - "size is 600x1024 pixels.").arg(size.width()).arg(size.height())); + m_ui->splashScreenValidationLabel->setText(tr("Incorrect portrait splash screen size (%1x%2). The maximum " + "size is %3x%4 pixels.") + .arg(size.width()).arg(size.height()) + .arg(PortraitSplashMaxWidth).arg(PortraitSplashMaxHeight)); break; } case Valid: diff --git a/src/plugins/qt4projectmanager/qt4buildconfiguration.cpp b/src/plugins/qt4projectmanager/qt4buildconfiguration.cpp index c4373fa2464..ea84a0843da 100644 --- a/src/plugins/qt4projectmanager/qt4buildconfiguration.cpp +++ b/src/plugins/qt4projectmanager/qt4buildconfiguration.cpp @@ -488,6 +488,7 @@ FileName Qt4BuildConfiguration::extractSpecFromArguments(QString *args, FileName baseMkspecDir = FileName::fromUserInput( version->qmakeProperty("QT_HOST_DATA") + QLatin1String("/mkspecs")); + baseMkspecDir = Utils::FileName::fromString(baseMkspecDir.toFileInfo().canonicalFilePath()); // if the path is relative it can be // relative to the working directory (as found in the Makefiles) diff --git a/src/plugins/qt4projectmanager/wizards/targetsetuppage.cpp b/src/plugins/qt4projectmanager/wizards/targetsetuppage.cpp index d8d5abb3b90..b8cbd290f8a 100644 --- a/src/plugins/qt4projectmanager/wizards/targetsetuppage.cpp +++ b/src/plugins/qt4projectmanager/wizards/targetsetuppage.cpp @@ -260,10 +260,8 @@ void TargetSetupPage::setImportSearch(bool b) void TargetSetupPage::setupWidgets() { // Known profiles: - foreach (ProjectExplorer::Kit *k, ProjectExplorer::KitManager::instance()->kits(m_requiredMatcher)) { - cleanKit(k); // clean up broken kit added by some development versions of QtC + foreach (ProjectExplorer::Kit *k, ProjectExplorer::KitManager::instance()->kits(m_requiredMatcher)) addWidget(k); - } // Setup import widget: m_baseLayout->addWidget(m_importWidget); @@ -338,11 +336,13 @@ void TargetSetupPage::addProject(ProjectExplorer::Kit *k, const QString &path) if (!k->hasValue(KIT_IS_TEMPORARY)) return; - QStringList profiles = k->value(TEMPORARY_OF_PROJECTS, QStringList()).toStringList(); - profiles.append(path); - m_ignoreUpdates = true; - k->setValue(KIT_IS_TEMPORARY, profiles); - m_ignoreUpdates = false; + QStringList projects = k->value(TEMPORARY_OF_PROJECTS, QStringList()).toStringList(); + if (!projects.contains(path)) { + projects.append(path); + m_ignoreUpdates = true; + k->setValue(TEMPORARY_OF_PROJECTS, projects); + m_ignoreUpdates = false; + } } void TargetSetupPage::removeProject(ProjectExplorer::Kit *k, const QString &path) @@ -354,9 +354,10 @@ void TargetSetupPage::removeProject(ProjectExplorer::Kit *k, const QString &path if (projects.contains(path)) { projects.removeOne(path); m_ignoreUpdates = true; - k->setValue(TEMPORARY_OF_PROJECTS, projects); if (projects.isEmpty()) ProjectExplorer::KitManager::instance()->deregisterKit(k); + else + k->setValue(TEMPORARY_OF_PROJECTS, projects); m_ignoreUpdates = false; } } @@ -412,14 +413,26 @@ void TargetSetupPage::import(const Utils::FileName &path, const bool silent) // find interesting makefiles QString makefile = path.toString() + QLatin1Char('/') + file; Utils::FileName qmakeBinary = QtSupport::QtVersionManager::findQMakeBinaryFromMakefile(makefile); - if (qmakeBinary.isEmpty()) + QFileInfo fi = qmakeBinary.toFileInfo(); + Utils::FileName canonicalQmakeBinary = Utils::FileName::fromString(fi.canonicalFilePath()); + if (canonicalQmakeBinary.isEmpty()) continue; if (QtSupport::QtVersionManager::makefileIsFor(makefile, m_proFilePath) != QtSupport::QtVersionManager::SameProject) continue; // Find version: - version = vm->qtVersionForQMakeBinary(qmakeBinary); + foreach (QtSupport::BaseQtVersion *v, vm->versions()) { + QFileInfo vfi = v->qmakeCommand().toFileInfo(); + Utils::FileName current = Utils::FileName::fromString(vfi.canonicalFilePath()); + if (current == canonicalQmakeBinary) { + version = v; + break; + } + } + + // Create a new version if not found: if (!version) { + // Do not use the canonical path here... version = QtSupport::QtVersionFactory::createQtVersionFromQMakePath(qmakeBinary); if (!version) continue; @@ -544,14 +557,14 @@ void TargetSetupPage::handleKitAddition(ProjectExplorer::Kit *k) void TargetSetupPage::handleKitRemoval(ProjectExplorer::Kit *k) { - if (m_ignoreUpdates) - return; - QtSupport::QtVersionManager *vm = QtSupport::QtVersionManager::instance(); QtSupport::BaseQtVersion *version = vm->version(k->value(QT_IS_TEMPORARY, -1).toInt()); if (version) vm->removeVersion(version); + if (m_ignoreUpdates) + return; + removeWidget(k); updateVisibility(); } diff --git a/src/plugins/qtsupport/baseqtversion.cpp b/src/plugins/qtsupport/baseqtversion.cpp index 5885946fed3..f89a4bf7652 100644 --- a/src/plugins/qtsupport/baseqtversion.cpp +++ b/src/plugins/qtsupport/baseqtversion.cpp @@ -349,8 +349,7 @@ void BaseQtVersion::fromMap(const QVariantMap &map) QString string = map.value(QLatin1String(QTVERSIONQMAKEPATH)).toString(); if (string.startsWith(QLatin1Char('~'))) string.remove(0, 1).prepend(QDir::homePath()); - const QString canonical = QFileInfo(string).canonicalFilePath(); - ctor(FileName::fromString(canonical.isEmpty() ? string : canonical)); + ctor(FileName::fromString(string)); } QVariantMap BaseQtVersion::toMap() const diff --git a/src/plugins/qtsupport/qtoptionspage.cpp b/src/plugins/qtsupport/qtoptionspage.cpp index e533246d0f4..3dadaf8c8e8 100644 --- a/src/plugins/qtsupport/qtoptionspage.cpp +++ b/src/plugins/qtsupport/qtoptionspage.cpp @@ -634,18 +634,18 @@ static QString filterForQmakeFileDialog() void QtOptionsPageWidget::addQtDir() { Utils::FileName qtVersion = Utils::FileName::fromString( - QFileInfo(QFileDialog::getOpenFileName(this, - tr("Select a qmake Executable"), - QString(), - filterForQmakeFileDialog(), - 0, - QFileDialog::DontResolveSymlinks)).canonicalFilePath()); + QFileDialog::getOpenFileName(this, + tr("Select a qmake executable"), + QString(), + filterForQmakeFileDialog(), + 0, + QFileDialog::DontResolveSymlinks)); if (qtVersion.isNull()) return; BaseQtVersion *version = QtVersionManager::instance()->qtVersionForQMakeBinary(qtVersion); if (version) { // Already exist - QMessageBox::warning(this, tr("Qt Version Already Registered"), + QMessageBox::warning(this, tr("Qt known"), tr("This Qt version was already registered as \"%1\".") .arg(version->displayName())); return; diff --git a/src/plugins/qtsupport/qtversionmanager.cpp b/src/plugins/qtsupport/qtversionmanager.cpp index c4db1ff07d7..736cb0be30d 100644 --- a/src/plugins/qtsupport/qtversionmanager.cpp +++ b/src/plugins/qtsupport/qtversionmanager.cpp @@ -629,7 +629,7 @@ Utils::FileName QtVersionManager::findQMakeBinaryFromMakefile(const QString &mak // Is qmake still installed? QFileInfo fi(qmakePath); if (fi.exists()) - return Utils::FileName::fromString(fi.canonicalFilePath()); + return Utils::FileName(fi); } } } diff --git a/src/plugins/welcome/welcomeplugin.cpp b/src/plugins/welcome/welcomeplugin.cpp index 87ec480e4b0..f93e359eb99 100644 --- a/src/plugins/welcome/welcomeplugin.cpp +++ b/src/plugins/welcome/welcomeplugin.cpp @@ -102,7 +102,6 @@ public: bool eventFilter(QObject *, QEvent *); public slots: - void sendFeedback(); void newProject(); void openProject(); @@ -305,12 +304,6 @@ void WelcomeMode::welcomePluginAdded(QObject *obj) } } -void WelcomeMode::sendFeedback() -{ - QDesktopServices::openUrl(QUrl(QLatin1String( - "http://qt.nokia.com/forms/feedback-forms/qt-creator-user-feedback/view"))); -} - void WelcomeMode::newProject() { Core::ICore::showNewItemDialog(tr("New Project"), diff --git a/tests/auto/utils/fileutils/tst_fileutils.cpp b/tests/auto/utils/fileutils/tst_fileutils.cpp index db8cc6274f4..211ad166eac 100644 --- a/tests/auto/utils/fileutils/tst_fileutils.cpp +++ b/tests/auto/utils/fileutils/tst_fileutils.cpp @@ -45,6 +45,8 @@ public: private slots: void parentDir_data(); void parentDir(); + void isChildOf_data(); + void isChildOf(); }; void tst_fileutils::parentDir_data() @@ -92,5 +94,43 @@ void tst_fileutils::parentDir() QCOMPARE(result.toString(), parentPath); } +void tst_fileutils::isChildOf_data() +{ + QTest::addColumn("path"); + QTest::addColumn("childPath"); + QTest::addColumn("result"); + + QTest::newRow("empty path") << QString() << QString::fromLatin1("/tmp") << false; + QTest::newRow("root only") << QString::fromLatin1("/") << QString::fromLatin1("/tmp") << true; + QTest::newRow("/tmp/dir") << QString::fromLatin1("/tmp") << QString::fromLatin1("/tmp/dir") << true; + QTest::newRow("relative/path") << QString::fromLatin1("relative") << QString::fromLatin1("relative/path") << true; + QTest::newRow("/tmpdir") << QString::fromLatin1("/tmp") << QString::fromLatin1("/tmpdir") << false; + QTest::newRow("same") << QString::fromLatin1("/tmp/dir") << QString::fromLatin1("/tmp/dir") << false; + + // Windows stuff: +#ifdef Q_OS_WIN + QTest::newRow("C:/data") << QString::fromLatin1("C:/") << QString::fromLatin1("C:/data") << true; + QTest::newRow("C:/") << QString() << QString::fromLatin1("C:/") << false; + QTest::newRow("//./com1") << QString::fromLatin1("/") << QString::fromLatin1("//./com1") << true; + QTest::newRow("//?/path") << QString::fromLatin1("/") << QString::fromLatin1("//?/path") << true; + QTest::newRow("/Global??/UNC/host") << QString::fromLatin1("/Global??/UNC/host") + << QString::fromLatin1("/Global??/UNC/host/file") << true; + QTest::newRow("//server/directory/file") + << QString::fromLatin1("//server/directory") << QString::fromLatin1("//server/directory/file") << true; + QTest::newRow("//server/directory") + << QString::fromLatin1("//server") << QString::fromLatin1("//server/directory") << true; +#endif +} + +void tst_fileutils::isChildOf() +{ + QFETCH(QString, path); + QFETCH(QString, childPath); + QFETCH(bool, result); + + bool res = FileName::fromString(childPath).isChildOf(FileName::fromString(path)); + QCOMPARE(res, result); +} + QTEST_APPLESS_MAIN(tst_fileutils) #include "tst_fileutils.moc" diff --git a/tests/manual/debugger/simple/simple_test_app.cpp b/tests/manual/debugger/simple/simple_test_app.cpp index 0d946aad460..8c360aec6d5 100644 --- a/tests/manual/debugger/simple/simple_test_app.cpp +++ b/tests/manual/debugger/simple/simple_test_app.cpp @@ -4106,7 +4106,7 @@ namespace qvariant { // Check variant.data.2 3 int. // Continue. list.clear(); - list = qVariantValue >(variant); + list = variant.value >(); BREAK_HERE; // Expand list. // Check list <3 items> QList.