Merge origin/2.6

Conflicts:
	src/libs/utils/fileutils.cpp
	src/plugins/cmakeprojectmanager/cmakebuildconfiguration.cpp
	src/plugins/cmakeprojectmanager/cmakeopenprojectwizard.cpp
	src/plugins/cmakeprojectmanager/cmakeopenprojectwizard.h
	src/plugins/cmakeprojectmanager/cmakeproject.cpp
	src/plugins/cmakeprojectmanager/cmakeprojectmanager.cpp
	src/plugins/cmakeprojectmanager/makestep.cpp
	src/plugins/qtsupport/baseqtversion.cpp

Change-Id: I153295bad2d97609d96d28945e9f942c5b46b2da
This commit is contained in:
Eike Ziller
2012-10-05 20:51:31 +02:00
69 changed files with 903 additions and 437 deletions

View File

@@ -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

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 33 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.6 KiB

After

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.6 KiB

After

Width:  |  Height:  |  Size: 37 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 13 KiB

After

Width:  |  Height:  |  Size: 38 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.5 KiB

After

Width:  |  Height:  |  Size: 49 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.8 KiB

After

Width:  |  Height:  |  Size: 47 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.2 KiB

After

Width:  |  Height:  |  Size: 44 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.5 KiB

After

Width:  |  Height:  |  Size: 46 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 17 KiB

After

Width:  |  Height:  |  Size: 41 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.0 KiB

After

Width:  |  Height:  |  Size: 22 KiB

View File

@@ -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

View File

@@ -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}.

View File

@@ -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

122
scripts/hasCopyright.pl Executable file
View File

@@ -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;

View File

@@ -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

View File

@@ -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)

View File

@@ -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)
try:
objectName = d_ptr["objectName"]
except: # Qt 5
objectName = d_ptr["extraData"].dereference()["objectName"]
except:
d.putPlainChildren(value)
return

View File

@@ -14,8 +14,8 @@
<publisher>PUBLISHER</publisher>
<copyright>COPYRIGHT</copyright>
<env var="QML_IMPORT_PATH" value="app/native/imports"/>
<env var="QT_PLUGIN_PATH" value="app/native/plugins"/>
<env var="LD_LIBRARY_PATH" value="app/native/lib"/>
<env var="QT_PLUGIN_PATH" value="app/native/plugins:/usr/lib/qt4/plugins"/>
<env var="LD_LIBRARY_PATH" value="app/native/lib:/usr/lib/qt4/lib/"/>
<arg>-platform</arg>
<arg>blackberry</arg>
<arg>-style</arg>
@@ -25,9 +25,4 @@
<!-- PROJECTPATH should point to the project binary, path can be relative -->
<asset entry="true" path="PROJECTPATH" type="Qnx/Elf">PROJECTNAME</asset>
<!-- These values will be replaced when deploying in Qt Creator -->
<asset path="%QT_INSTALL_LIBS%">lib</asset>
<asset path="%QT_INSTALL_PLUGINS%">plugins</asset>
<asset path="%QT_INSTALL_IMPORTS%">imports</asset>
</qnx>

View File

@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<qnx xmlns="http://www.qnx.com/schemas/application/1.0">
<id>ID</id>
<id>com.example.%ProjectName%</id>
<name>%ProjectName%</name>
<versionNumber>1.0.0</versionNumber>
<description>DESCRIPTION</description>
@@ -13,16 +13,11 @@
</initialWindow>
<env var="QML_IMPORT_PATH" value="app/native/imports"/>
<env var="QT_PLUGIN_PATH" value="app/native/plugins"/>
<env var="LD_LIBRARY_PATH" value="app/native/lib"/>
<env var="QT_PLUGIN_PATH" value="app/native/plugins:/usr/lib/qt4/plugins"/>
<env var="LD_LIBRARY_PATH" value="app/native/lib:/usr/lib/qt4/lib/"/>
<arg>-platform</arg>
<arg>blackberry</arg>
<action system="true">run_native</action>
<asset entry="true" path="%ProjectName%" type="Qnx/Elf">%ProjectName%</asset>
<!-- These values will be replaced when deploying in Qt Creator -->
<asset path="%QT_INSTALL_LIBS%">lib</asset>
<asset path="%QT_INSTALL_PLUGINS%">plugins</asset>
<asset path="%QT_INSTALL_IMPORTS%">imports</asset>
</qnx>

View File

@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<qnx xmlns="http://www.qnx.com/schemas/application/1.0">
<id>ID</id>
<id>com.example.%ProjectName%</id>
<name>%ProjectName%</name>
<versionNumber>1.0.0</versionNumber>
<description>DESCRIPTION</description>

View File

@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<qnx xmlns="http://www.qnx.com/schemas/application/1.0">
<id>ID</id>
<id>com.example.%ProjectName%</id>
<name>%ProjectName%</name>
<versionNumber>1.0.0</versionNumber>
<description>DESCRIPTION</description>

View File

@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<qnx xmlns="http://www.qnx.com/schemas/application/1.0">
<id>ID</id>
<id>com.example.%ProjectName%</id>
<name>%ProjectName%</name>
<versionNumber>1.0.0</versionNumber>
<description>DESCRIPTION</description>
@@ -13,8 +13,8 @@
</initialWindow>
<env var="QML_IMPORT_PATH" value="app/native/imports"/>
<env var="QT_PLUGIN_PATH" value="app/native/plugins"/>
<env var="LD_LIBRARY_PATH" value="app/native/lib"/>
<env var="QT_PLUGIN_PATH" value="app/native/plugins:/usr/lib/qt4/plugins"/>
<env var="LD_LIBRARY_PATH" value="app/native/lib:/usr/lib/qt4/lib/"/>
<arg>-platform</arg>
<arg>blackberry</arg>
@@ -22,9 +22,4 @@
<asset entry="true" path="%ProjectName%" type="Qnx/Elf">%ProjectName%</asset>
<asset path="%SRC_DIR%/qml">qml</asset>
<!-- These values will be replaced when deploying in Qt Creator -->
<asset path="%QT_INSTALL_LIBS%">lib</asset>
<asset path="%QT_INSTALL_PLUGINS%">plugins</asset>
<asset path="%QT_INSTALL_IMPORTS%">imports</asset>
</qnx>

View File

@@ -11020,7 +11020,7 @@ Außer Leerzeichen innerhalb von Kommentaren und Zeichenketten.</translation>
</message>
<message>
<source>&amp;Commit</source>
<translation>&amp;Abgeben</translation>
<translation>Ab&amp;geben</translation>
</message>
<message>
<source>Check All</source>
@@ -11038,7 +11038,7 @@ Außer Leerzeichen innerhalb von Kommentaren und Zeichenketten.</translation>
</message>
<message>
<source>Check a&amp;ll</source>
<translation>&amp;Alle markieren</translation>
<translation>A&amp;lle markieren</translation>
</message>
</context>
<context>

View File

@@ -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

View File

@@ -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()
}
}

View File

@@ -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));
}
}

View File

@@ -9,6 +9,7 @@
#define BOTAN_AMALGAMATION_H__
#include <QtGlobal>
#include <QSharedPointer>
#include <iosfwd>
#include <map>
@@ -16181,7 +16182,26 @@ class BOTAN_DLL ANSI_X919_MAC : public MessageAuthenticationCode
SecureVector<byte> state;
size_t position;
};
}
namespace Botan {
typedef QSharedPointer<Public_Key> PublicKeyPtr;
BOTAN_DLL PublicKeyPtr createRsaPublicKey(const BigInt &e, const BigInt &n);
BOTAN_DLL PublicKeyPtr createDsaPublicKey(const DL_Group& group, const BigInt& y);
typedef QSharedPointer<Private_Key> 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<DH_PrivateKey> DhPrivateKeyPtr;
BOTAN_DLL DhPrivateKeyPtr createDhPrivateKey(RandomNumberGenerator& rng, const DL_Group& grp,
const BigInt& x = 0);
}

View File

@@ -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<DSA_PrivateKey *>(key)) {
const PrivateKeyPtr authKey = loadPkcs8PrivateKey(pipe, m_rng, SshKeyPasswordRetriever());
if (DSA_PrivateKey * const dsaKey = dynamic_cast<DSA_PrivateKey *>(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<RSA_PrivateKey *>(key)) {
} else if (RSA_PrivateKey * const rsaKey = dynamic_cast<RSA_PrivateKey *>(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;
}

View File

@@ -117,7 +117,7 @@ private:
QByteArray m_authKeyAlgoName;
QByteArray m_authPubKeyBlob;
QByteArray m_cachedPrivKeyContents;
QScopedPointer<Botan::Private_Key> m_authKey;
QSharedPointer<Botan::Private_Key> m_authKey;
mutable Botan::AutoSeeded_RNG m_rng;
};

View File

@@ -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<Public_Key> sigKey;
QScopedPointer<PK_Verifier> verifier;
QSharedPointer<Public_Key> 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.");
}

View File

@@ -33,6 +33,7 @@
#include <QByteArray>
#include <QScopedPointer>
#include <QSharedPointer>
namespace Botan {
class DH_PrivateKey;
@@ -71,7 +72,7 @@ private:
QByteArray m_serverId;
QByteArray m_clientKexInitPayload;
QByteArray m_serverKexInitPayload;
QScopedPointer<Botan::DH_PrivateKey> m_dhKey;
QSharedPointer<Botan::DH_PrivateKey> m_dhKey;
QByteArray m_k;
QByteArray m_h;
QByteArray m_serverHostKeyAlgo;

View File

@@ -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);

View File

@@ -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('/');
}

View File

@@ -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;
}

View File

@@ -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);

View File

@@ -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) {

View File

@@ -32,6 +32,7 @@
#include "cmakeopenprojectwizard.h"
#include "cmakeproject.h"
#include "cmakeprojectconstants.h"
#include <projectexplorer/buildsteplist.h>
#include <projectexplorer/gnumakeparser.h>
@@ -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<CMakeProject *>(parent->project())->defaultBuildDirectory();
}
@@ -161,12 +161,12 @@ QList<Core::Id> CMakeBuildConfigurationFactory::availableCreationIds(const Proje
{
if (!canHandle(parent))
return QList<Core::Id>();
return QList<Core::Id>() << Core::Id(CMAKE_BC_ID);
return QList<Core::Id>() << 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"))

View File

@@ -50,6 +50,7 @@
#include <QDateTime>
#include <QSettings>
#include <QStringList>
#include <QApplication>
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<GeneratorInfo> 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> GeneratorInfo::generatorInfosFor(ProjectExplorer::Kit *k, Ninja n, bool hasCodeBlocks)
{
QList<GeneratorInfo> 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;
if (mode == CMakeOpenProjectWizard::ChangeDirectory) {
m_buildDirectory = info.buildDirectory;
addPage(new ShadowBuildPage(this, true));
addPage(new CMakeRunPage(this, CMakeRunPage::ChangeDirectory));
}
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,38 +551,17 @@ 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 hasCodeBlocksGenerator = m_cmakeWizard->cmakeManager()->hasCodeBlocksMsvcGenerator();
bool hasNinjaGenerator = m_cmakeWizard->cmakeManager()->hasCodeBlocksNinjaGenerator();
if (m_mode == Initial) {
// Try figuring out generator and toolchain from CMakeCache.txt
QString cachedGenerator = cachedGeneratorFromFile(m_buildDirectory + "/CMakeCache.txt");
m_generatorComboBox->show();
QList<ProjectExplorer::Kit *> kitList =
ProjectExplorer::KitManager::instance()->kits();
@@ -444,85 +569,87 @@ void CMakeRunPage::initializePage()
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)));
}
QList<GeneratorInfo> 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));
}
} else {
// Non windows
if (cachedGenerator.isEmpty() || cachedGenerator == "Unix Makefiles")
m_generatorComboBox->addItem(tr("Unix Generator (%1)").arg(k->displayName()), qVariantFromValue(GeneratorInfo(k)));
// 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;
}
if (m_cmakeWizard->cmakeManager()->hasCodeBlocksNinjaGenerator() &&
(cachedGenerator.isEmpty() || cachedGenerator == "Ninja"))
m_generatorComboBox->addItem(tr("Ninja (%1)").arg(k->displayName()), qVariantFromValue(GeneratorInfo(k, true)));
QList<GeneratorInfo> 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<GeneratorInfo>();
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<GeneratorInfo>();
k = generatorInfo.kit();
}
if (!k) {
if (index == -1) {
m_output->appendPlainText(tr("No generator selected."));
return;
}
GeneratorInfo generatorInfo = m_generatorComboBox->itemData(index).value<GeneratorInfo>();
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);

View File

@@ -31,9 +31,13 @@
#ifndef CMAKEOPENPROJECTWIZARD_H
#define CMAKEOPENPROJECTWIZARD_H
#include "cmakebuildconfiguration.h"
#include <utils/environment.h>
#include <utils/wizard.h>
#include <utils/qtcprocess.h>
#include <projectexplorer/target.h>
#include <projectexplorer/project.h>
#include <QPushButton>
#include <QComboBox>
@@ -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;
};

View File

@@ -49,6 +49,7 @@
#include <projectexplorer/kitmanager.h>
#include <projectexplorer/toolchain.h>
#include <projectexplorer/target.h>
#include <projectexplorer/deployconfiguration.h>
#include <qtsupport/customexecutablerunconfiguration.h>
#include <cpptools/ModelManagerInterface.h>
#include <extensionsystem/pluginmanager.h>
@@ -145,8 +146,6 @@ void CMakeProject::changeActiveBuildConfiguration(ProjectExplorer::BuildConfigur
CMakeBuildConfiguration *cmakebc = static_cast<CMakeBuildConfiguration *>(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,10 +529,36 @@ bool CMakeProject::fromMap(const QVariantMap &map)
if (!Project::fromMap(map))
return false;
Kit *defaultKit = KitManager::instance()->defaultKit();
if (!activeTarget() && defaultKit)
addTarget(createTarget(defaultKit));
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<DeployConfigurationFactory>();
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);
@@ -551,13 +575,13 @@ bool CMakeProject::fromMap(const QVariantMap &map)
mode = CMakeOpenProjectWizard::NeedToUpdate;
if (mode != CMakeOpenProjectWizard::Nothing) {
CMakeOpenProjectWizard copw(m_manager,
sourceFileInfo.absolutePath(),
activeBC->buildDirectory(),
mode,
activeBC);
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<MakeStep *>(
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<CMakeBuildConfigurationFactory>();
CMakeBuildConfiguration *bc = factory->create(t, Constants::CMAKE_BC_ID, QLatin1String("all"));
if (!bc)
return false;
t->addBuildConfiguration(bc);
DeployConfigurationFactory *fac = ExtensionSystem::PluginManager::instance()->getObject<DeployConfigurationFactory>();
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<CMakeProject *>(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<CMakeProject *>(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();
}

View File

@@ -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);

View File

@@ -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";

View File

@@ -119,11 +119,8 @@ void CMakeManager::runCMake(ProjectExplorer::Project *project)
CMakeBuildConfiguration *bc
= static_cast<CMakeBuildConfiguration *>(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();
}

View File

@@ -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();

View File

@@ -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

View File

@@ -65,6 +65,7 @@
#include <QDir>
#include <QApplication>
#include <utils/runextensions.h>
#include <utils/textfileformat.h>
#include <functional>
@@ -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;
}
}

View File

@@ -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;
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<WatchData> 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<WatchData> QmlInspectorAgent::buildWatchData(const ObjectReference &obj,
propertyWatch.setHasChildren(false);
list.append(propertyWatch);
}
m_debugIdToIname.insert(objDebugId, objIname);
}
// recurse

View File

@@ -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 {

View File

@@ -165,6 +165,7 @@ QList<Task> ToolChainKitInformation::validate(Kit *k) const
{
QList<Task> 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));

View File

@@ -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;

View File

@@ -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);

View File

@@ -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);

View File

@@ -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
// -------------------------------------------------------------------------

View File

@@ -521,13 +521,6 @@ QVariantMap Target::toMap() const
return map;
}
void Target::createDefaultSetup()
{
updateDefaultBuildConfigurations();
updateDefaultDeployConfigurations();
updateDefaultRunConfigurations();
}
void Target::updateDefaultBuildConfigurations()
{
IBuildConfigurationFactory *bcFactory = IBuildConfigurationFactory::find(this);

View File

@@ -113,7 +113,6 @@ public:
QVariantMap toMap() const;
void createDefaultSetup();
void updateDefaultBuildConfigurations();
void updateDefaultDeployConfigurations();
void updateDefaultRunConfigurations();

View File

@@ -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<ToolChain *> copy = d->toolChains();
foreach (ToolChain *tc, copy)

View File

@@ -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;
}
}

View File

@@ -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();
}

View File

@@ -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("<font color=\"red\">Incorrect icon size (%1x%2). The recommended size is "
"86x86 pixels with a maximum size of 90x90 pixels.</font>").arg(size.width()).arg(size.height()));
m_ui->iconValidationLabel->setText(tr("<font color=\"red\">Incorrect icon size (%1x%2). The maximum size is "
"%3x%4 pixels.</font>")
.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("<font color=\"red\">Incorrect landscape splash screen size (%1x%2). The required "
"size is 1024x600 pixels.</font>").arg(size.width()).arg(size.height()));
m_ui->splashScreenValidationLabel->setText(tr("<font color=\"red\">Incorrect landscape splash screen size (%1x%2). The maximum "
"size is %3x%4 pixels.</font>")
.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("<font color=\"red\">Incorrect portrait splash screen size (%1x%2). The required "
"size is 600x1024 pixels.</font>").arg(size.width()).arg(size.height()));
m_ui->splashScreenValidationLabel->setText(tr("<font color=\"red\">Incorrect portrait splash screen size (%1x%2). The maximum "
"size is %3x%4 pixels.</font>")
.arg(size.width()).arg(size.height())
.arg(PortraitSplashMaxWidth).arg(PortraitSplashMaxHeight));
break;
}
case Valid:

View File

@@ -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)

View File

@@ -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);
QStringList projects = k->value(TEMPORARY_OF_PROJECTS, QStringList()).toStringList();
if (!projects.contains(path)) {
projects.append(path);
m_ignoreUpdates = true;
k->setValue(KIT_IS_TEMPORARY, profiles);
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();
}

View File

@@ -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

View File

@@ -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"),
QFileDialog::getOpenFileName(this,
tr("Select a qmake executable"),
QString(),
filterForQmakeFileDialog(),
0,
QFileDialog::DontResolveSymlinks)).canonicalFilePath());
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;

View File

@@ -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);
}
}
}

View File

@@ -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"),

View File

@@ -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<QString>("path");
QTest::addColumn<QString>("childPath");
QTest::addColumn<bool>("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"

View File

@@ -4106,7 +4106,7 @@ namespace qvariant {
// Check variant.data.2 3 int.
// Continue.
list.clear();
list = qVariantValue<QList<int> >(variant);
list = variant.value<QList<int> >();
BREAK_HERE;
// Expand list.
// Check list <3 items> QList<int>.