Merge remote-tracking branch 'origin/3.2'

Conflicts:
	qtcreator.pri
	qtcreator.qbs
	src/plugins/coreplugin/editormanager/editormanager.cpp
	src/plugins/projectexplorer/editorconfiguration.cpp
	src/plugins/projectexplorer/projectfilewizardextension.cpp
	src/plugins/qmakeandroidsupport/createandroidmanifestwizard.cpp

Change-Id: I8de0f6fcdd8d214fbc14e79f74cb0206e6e2c6c1
This commit is contained in:
Eike Ziller
2014-08-15 14:42:30 +02:00
103 changed files with 8606 additions and 4414 deletions

View File

@@ -6,8 +6,8 @@ headerdirs =
sourcedirs = $SRCDIR/src sourcedirs = $SRCDIR/src
imagedirs = $SRCDIR/images $SRCDIR/templates/images imagedirs = $SRCDIR/images $SRCDIR/templates/images
outputdir = $OUTDIR outputdir = $OUTDIR
exampledirs = $SRCDIR/examples \ exampledirs = $SRCDIR/examples
$SRCDIR/snippets
indexes += $QDOC_INDEX_DIR/qtwidgets/qtwidgets.index \ indexes += $QDOC_INDEX_DIR/qtwidgets/qtwidgets.index \
$QDOC_INDEX_DIR/qtcore/qtcore.index \ $QDOC_INDEX_DIR/qtcore/qtcore.index \
$QDOC_INDEX_DIR/qtqml/qtqml.index \ $QDOC_INDEX_DIR/qtqml/qtqml.index \

Binary file not shown.

Before

Width:  |  Height:  |  Size: 52 KiB

After

Width:  |  Height:  |  Size: 46 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 273 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 255 B

View File

@@ -51,6 +51,15 @@
indicates lines that contain added text (painted a darker green) in the indicates lines that contain added text (painted a darker green) in the
right pane. right pane.
To view the differences in a unified view where changed rows are placed
below each other, select
\inlineimage qtcreator-switchto-unified-diffeditor.png
(\gui {Switch to Unified Diff Editor}).
To switch back to the side-by-side view, select
\inlineimage qtcreator-switchto-sidebyside-diffeditor.png
(\gui {Switch to Side by Side Diff Editor}).
To change the default colors, select \gui Tools > \gui Options > To change the default colors, select \gui Tools > \gui Options >
\gui {Text Editor} > \gui {Font & Colors}. Create your own color scheme and \gui {Text Editor} > \gui {Font & Colors}. Create your own color scheme and
select new colors for the following options: select new colors for the following options:
@@ -86,4 +95,8 @@
synchronized. To use them independently of each other, select the synchronized. To use them independently of each other, select the
\inlineimage qtcreator-synchronizefocus.png \inlineimage qtcreator-synchronizefocus.png
(\gui {Synchronize Horizontal Scroll Bars}) button. (\gui {Synchronize Horizontal Scroll Bars}) button.
If the files change outside \QC, select
\inlineimage qtcreator-regenerate-index.png
(\gui {Reload Editor}) to compare them again and to show the results.
*/ */

View File

@@ -2217,7 +2217,8 @@
locator. For example, to open main.cpp to line 41, enter: \c {main.cpp:41}. locator. For example, to open main.cpp to line 41, enter: \c {main.cpp:41}.
If the path to a file is very long, it might not fit into the locator If the path to a file is very long, it might not fit into the locator
window. To view the full path, press \key Alt when the filename is selected. window. To view the full path, press \key Alt when the filename is selected
or use the handle next to the locator window to increase the window width.
It is also possible to enter only a part of a search string. As you type, It is also possible to enter only a part of a search string. As you type,
the locator shows the occurrences of that string regardless of where in the the locator shows the occurrences of that string regardless of where in the

View File

@@ -45,6 +45,15 @@
parsed .pro files. For more information on how the commands are constructed, parsed .pro files. For more information on how the commands are constructed,
see \l{Starting External Processes}. see \l{Starting External Processes}.
\section2 Creating Run Configurations for Subprojects
To prevent \QC from automatically creating run configurations for SUBDIRS
projects, specify the following variable in the .pro file of the SUBDIRS
project: \c {CONFIG += qtc_runnable}.
\QC creates run configurations only for subprojects that also have
\c {CONFIG += qtc_runnable} set in their .pro files.
\include projects/creator-projects-settings-run-desktop.qdocinc \include projects/creator-projects-settings-run-desktop.qdocinc
\include projects/creator-projects-settings-run-analyze.qdocinc \include projects/creator-projects-settings-run-analyze.qdocinc
\include projects/creator-projects-settings-run-debug.qdocinc \include projects/creator-projects-settings-run-debug.qdocinc

View File

@@ -73,7 +73,7 @@ Module {
Artifact { Artifact {
fileTags: ["qt_plugin_metadata"] fileTags: ["qt_plugin_metadata"]
filePath: { filePath: {
var destdir = FileInfo.joinPaths(product.moduleProperty("Qt/core", "generatedFilesDir"), var destdir = FileInfo.joinPaths(product.moduleProperty("Qt.core", "generatedFilesDir"),
input.fileName); input.fileName);
return destdir.replace(/\.[^\.]*$/, '.json'); return destdir.replace(/\.[^\.]*$/, '.json');
} }
@@ -81,7 +81,7 @@ Module {
prepare: { prepare: {
var xslFile = project.path + "/../qtcreatorplugin2json.xsl"; // project is "Plugins" var xslFile = project.path + "/../qtcreatorplugin2json.xsl"; // project is "Plugins"
var xmlPatternsPath = product.moduleProperty("Qt/core", "binPath") + "/xmlpatterns"; var xmlPatternsPath = product.moduleProperty("Qt.core", "binPath") + "/xmlpatterns";
var args = [ var args = [
"-no-format", "-no-format",
"-output", "-output",

View File

@@ -49,7 +49,7 @@ minQtVersion(5, 0, 0):exists(src/shared/qbs/qbs.pro) {
QBS_APPS_RPATH_DIR = @loader_path/../PlugIns QBS_APPS_RPATH_DIR = @loader_path/../PlugIns
} else { } else {
QBS_PLUGINS_BUILD_DIR = $${IDE_BUILD_TREE}/$${IDE_LIBRARY_BASENAME}/qtcreator QBS_PLUGINS_BUILD_DIR = $${IDE_BUILD_TREE}/$${IDE_LIBRARY_BASENAME}/qtcreator
QBS_APPS_RPATH_DIR = \\\$\\\$ORIGIN/../$$IDE_LIBRARY_BASENAME/qtcreator QBS_APPS_RPATH_DIR = \$\$ORIGIN/../$$IDE_LIBRARY_BASENAME/qtcreator
} }
cache(QBS_PLUGINS_BUILD_DIR) cache(QBS_PLUGINS_BUILD_DIR)
cache(QBS_APPS_RPATH_DIR) cache(QBS_APPS_RPATH_DIR)
@@ -65,8 +65,10 @@ minQtVersion(5, 0, 0):exists(src/shared/qbs/qbs.pro) {
cache(QBS_RELATIVE_PLUGINS_PATH) cache(QBS_RELATIVE_PLUGINS_PATH)
QBS_RELATIVE_SEARCH_PATH = $$relative_path($$QBS_RESOURCES_BUILD_DIR, $$QBS_APPS_DESTDIR) QBS_RELATIVE_SEARCH_PATH = $$relative_path($$QBS_RESOURCES_BUILD_DIR, $$QBS_APPS_DESTDIR)
cache(QBS_RELATIVE_SEARCH_PATH) cache(QBS_RELATIVE_SEARCH_PATH)
QBS_CONFIG_ADDITION = qbs_no_dev_install qbs_enable_project_file_updates !qbs_no_dev_install {
cache(CONFIG, add, QBS_CONFIG_ADDITION) QBS_CONFIG_ADDITION = qbs_no_dev_install qbs_enable_project_file_updates
cache(CONFIG, add, QBS_CONFIG_ADDITION)
}
} }
contains(QT_ARCH, i386): ARCHITECTURE = x86 contains(QT_ARCH, i386): ARCHITECTURE = x86

View File

@@ -37,7 +37,9 @@
namespace QmlDesigner { namespace QmlDesigner {
static QCache<qint32, SharedMemory> globalSharedMemoryCache(10000); // using cache as a container which deletes sharedmemory pointers at process exit
typedef QCache<qint32, SharedMemory> GlobalSharedMemoryContainer;
Q_GLOBAL_STATIC_WITH_ARGS(GlobalSharedMemoryContainer, globalSharedMemoryContainer, (10000))
ValuesChangedCommand::ValuesChangedCommand() ValuesChangedCommand::ValuesChangedCommand()
: m_keyNumber(0) : m_keyNumber(0)
@@ -63,7 +65,7 @@ quint32 ValuesChangedCommand::keyNumber() const
void ValuesChangedCommand::removeSharedMemorys(const QVector<qint32> &keyNumberVector) void ValuesChangedCommand::removeSharedMemorys(const QVector<qint32> &keyNumberVector)
{ {
foreach (qint32 keyNumber, keyNumberVector) { foreach (qint32 keyNumber, keyNumberVector) {
SharedMemory *sharedMemory = globalSharedMemoryCache.take(keyNumber); SharedMemory *sharedMemory = globalSharedMemoryContainer()->take(keyNumber);
delete sharedMemory; delete sharedMemory;
} }
} }
@@ -82,8 +84,10 @@ static SharedMemory *createSharedMemory(qint32 key, int byteCount)
bool sharedMemoryIsCreated = sharedMemory->create(byteCount); bool sharedMemoryIsCreated = sharedMemory->create(byteCount);
if (sharedMemoryIsCreated) { if (sharedMemoryIsCreated) {
globalSharedMemoryCache.insert(key, sharedMemory); globalSharedMemoryContainer()->insert(key, sharedMemory);
return sharedMemory; return sharedMemory;
} else {
delete sharedMemory;
} }
return 0; return 0;

View File

@@ -42,7 +42,9 @@
namespace QmlDesigner { namespace QmlDesigner {
static QCache<qint32, SharedMemory> globalSharedMemoryCache(10000); // using cache as a container which deletes sharedmemory pointers at process exit
typedef QCache<qint32, SharedMemory> GlobalSharedMemoryContainer;
Q_GLOBAL_STATIC_WITH_ARGS(GlobalSharedMemoryContainer, globalSharedMemoryContainer, (10000))
ImageContainer::ImageContainer() ImageContainer::ImageContainer()
: m_instanceId(-1), : m_instanceId(-1),
@@ -82,7 +84,7 @@ void ImageContainer::setImage(const QImage &image)
void ImageContainer::removeSharedMemorys(const QVector<qint32> &keyNumberVector) void ImageContainer::removeSharedMemorys(const QVector<qint32> &keyNumberVector)
{ {
foreach (qint32 keyNumber, keyNumberVector) { foreach (qint32 keyNumber, keyNumberVector) {
SharedMemory *sharedMemory = globalSharedMemoryCache.take(keyNumber); SharedMemory *sharedMemory = globalSharedMemoryContainer()->take(keyNumber);
delete sharedMemory; delete sharedMemory;
} }
} }
@@ -91,13 +93,13 @@ static const QLatin1String imageKeyTemplateString("Image-%1");
static SharedMemory *createSharedMemory(qint32 key, int byteCount) static SharedMemory *createSharedMemory(qint32 key, int byteCount)
{ {
SharedMemory *sharedMemory = globalSharedMemoryCache.take(key); SharedMemory *sharedMemory = (*globalSharedMemoryContainer())[key];
if (sharedMemory == 0) { if (sharedMemory == 0) {
sharedMemory = new SharedMemory(QString(imageKeyTemplateString).arg(key)); sharedMemory = new SharedMemory(QString(imageKeyTemplateString).arg(key));
bool sharedMemoryIsCreated = sharedMemory->create(byteCount); bool sharedMemoryIsCreated = sharedMemory->create(byteCount);
if (sharedMemoryIsCreated) { if (sharedMemoryIsCreated) {
globalSharedMemoryCache.insert(key, sharedMemory); globalSharedMemoryContainer()->insert(key, sharedMemory);
} else { } else {
delete sharedMemory; delete sharedMemory;
sharedMemory = 0; sharedMemory = 0;
@@ -118,8 +120,7 @@ static SharedMemory *createSharedMemory(qint32 key, int byteCount)
} }
if (!sharedMemory->isAttached()) { if (!sharedMemory->isAttached()) {
globalSharedMemoryCache.remove(key); globalSharedMemoryContainer()->remove(key);
delete sharedMemory;
sharedMemory = 0; sharedMemory = 0;
} }
} }

View File

@@ -49,16 +49,10 @@
#include <private/qcore_unix_p.h> #include <private/qcore_unix_p.h>
#ifdef Q_OS_OSX #if (QT_VERSION < QT_VERSION_CHECK(5, 0, 0))
#define NAME_MAX PSHMNAMLEN #define QStringLiteral(str) QString::fromLatin1(str)
#endif #endif
#ifndef QStringLiteral
#define QStringLiteral(str) QString::fromUtf8(str)
#endif
#include <QRegExp>
namespace QmlDesigner { namespace QmlDesigner {
class SharedMemoryLocker class SharedMemoryLocker

View File

@@ -1,5 +1,44 @@
import QtQuick 2.2 import QtQuick 2.1
import QtQuick.Controls 1.0
Rectangle { Rectangle {
property string title property string title
property Item toolBar
property Item statusBar
property alias contentItem : contentArea
default property alias data: contentArea.data
onStatusBarChanged: { if (statusBar) { statusBar.parent = statusBarArea } }
onToolBarChanged: { if (toolBar) { toolBar.parent = toolBarArea } }
Item {
id: contentArea
anchors.top: toolBarArea.bottom
anchors.left: parent.left
anchors.right: parent.right
anchors.bottom: statusBarArea.top
}
Item {
id: toolBarArea
anchors.top: parent.top
anchors.left: parent.left
anchors.right: parent.right
implicitHeight: childrenRect.height
height: visibleChildren.length > 0 ? implicitHeight: 0
}
Item {
id: statusBarArea
anchors.bottom: parent.bottom
anchors.left: parent.left
anchors.right: parent.right
implicitHeight: childrenRect.height
height: 0
//The status bar is not visible for now
//height: visibleChildren.length > 0 ? implicitHeight: 0
}
} }

View File

@@ -91,6 +91,14 @@ static bool isPropertyBlackListed(const QmlDesigner::PropertyName &propertyName)
return false; return false;
} }
static bool isSimpleExpression(const QString &expression)
{
if (expression.startsWith(QStringLiteral("{")))
return false;
return true;
}
namespace QmlDesigner { namespace QmlDesigner {
namespace Internal { namespace Internal {
@@ -512,6 +520,9 @@ void ObjectNodeInstance::setPropertyBinding(const PropertyName &name, const QStr
if (ignoredProperties().contains(name)) if (ignoredProperties().contains(name))
return; return;
if (!isSimpleExpression(expression))
return;
QQmlProperty property(object(), name, context()); QQmlProperty property(object(), name, context());
if (!property.isValid()) if (!property.isValid())
@@ -1084,6 +1095,15 @@ static bool isCrashingType(QQmlType *type)
if (type->qmlTypeName() == QStringLiteral("QtMultimedia/Audio")) if (type->qmlTypeName() == QStringLiteral("QtMultimedia/Audio"))
return true; return true;
if (type->qmlTypeName() == QStringLiteral("QtQuick.Controls/MenuItem"))
return true;
if (type->qmlTypeName() == QStringLiteral("QtQuick.Controls/Menu"))
return true;
if (type->qmlTypeName() == QStringLiteral("QtQuick/Timer"))
return true;
} }
return false; return false;

View File

@@ -38,11 +38,26 @@
#include <designersupport.h> #include <designersupport.h>
#if defined(Q_OS_UNIX)
#include <unistd.h>
#elif defined(Q_OS_WIN)
#include <windows.h>
#endif
namespace QmlDesigner { namespace QmlDesigner {
static void prioritizeDown()
{
#if defined(Q_OS_UNIX)
nice(19);
#elif defined(Q_OS_WIN)
SetPriorityClass(GetCurrentProcess(), BELOW_NORMAL_PRIORITY_CLASS);
#endif
}
Qt5NodeInstanceClientProxy::Qt5NodeInstanceClientProxy(QObject *parent) : Qt5NodeInstanceClientProxy::Qt5NodeInstanceClientProxy(QObject *parent) :
NodeInstanceClientProxy(parent) NodeInstanceClientProxy(parent)
{ {
prioritizeDown();
DesignerSupport::activateDesignerWindowManager(); DesignerSupport::activateDesignerWindowManager();
if (QCoreApplication::arguments().at(1) == QLatin1String("--readcapturedstream")) { if (QCoreApplication::arguments().at(1) == QLatin1String("--readcapturedstream")) {
qputenv("DESIGNER_DONT_USE_SHARED_MEMORY", "1"); qputenv("DESIGNER_DONT_USE_SHARED_MEMORY", "1");

View File

@@ -39,10 +39,7 @@ Controls.CheckBox {
property color highlightColor: "orange" property color highlightColor: "orange"
property color textColor: colorLogic.textColor property color textColor: colorLogic.textColor
onTextChanged: { opacity: enabled ? 1 : 0.5
if (text.charAt(0) !== " ")
text = " " + text
}
property variant backendValue property variant backendValue

View File

@@ -66,8 +66,11 @@ Controls.ComboBox {
var index = comboBox.find(enumString) var index = comboBox.find(enumString)
if (index < 0)
index = 0
if (index !== comboBox.currentIndex) if (index !== comboBox.currentIndex)
comboBox.currentIndex = comboBox.find(enumString) comboBox.currentIndex = index
} else { } else {
if (comboBox.currentIndex !== backendValue.value) if (comboBox.currentIndex !== backendValue.value)

View File

@@ -32,7 +32,7 @@ import QtQuick.Controls 1.1 as Controls
import QtQuick.Controls.Styles 1.1 import QtQuick.Controls.Styles 1.1
CheckBoxStyle { CheckBoxStyle {
spacing: 8 spacing: 24
label: Controls.Label { text: control.text ; color: checkBox.textColor } label: Controls.Label { text: control.text ; color: checkBox.textColor }
indicator: Item { indicator: Item {
implicitWidth: 16 implicitWidth: 16

View File

@@ -1,41 +1,40 @@
GroupBox 2.0 GroupBox.qml
LineEdit 2.0 LineEdit.qml
SpinBox 2.0 SpinBox.qml
Button 2.0 Button.qml
Label 2.0 Label.qml
Section 2.0 Section.qml
CheckBox 2.0 CheckBox.qml
TabView 2.0 TabView.qml
Tab 2.0 Tab.qml
ScrollView 2.0 ScrollView.qml
ComboBox 2.0 ComboBox.qml
CustomComboBoxStyle 2.0 CustomComboBoxStyle.qml
SectionLayout 2.0 SectionLayout.qml
SecondColumnLayout 2.0 SecondColumnLayout.qml
ExpandingSpacer 2.0 ExpandingSpacer.qml
ColorButton 2.0 ColorButton.qml
ColorCheckButton 2.0 ColorCheckButton.qml
HueSlider 2.0 HueSlider.qml
GradientLine 2.0 GradientLine.qml
SliderSpinBox 2.0 SliderSpinBox.qml
ColorEditor 2.0 ColorEditor.qml
IconLabel 2.0 IconLabel.qml
ExtendedFunctionButton 2.0 ExtendedFunctionButton.qml
ButtonRow 2.0 ButtonRow.qml
ButtonRowButton 2.0 ButtonRowButton.qml
BoolButtonRowButton 2.0 BoolButtonRowButton.qml
FontStyleButtons 2.0 FontStyleButtons.qml
AnchorButtons 2.0 AnchorButtons.qml
AligmentHorizontalButtons 2.0 AligmentHorizontalButtons.qml AligmentHorizontalButtons 2.0 AligmentHorizontalButtons.qml
AligmentVerticalButtons 2.0 AligmentVerticalButtons.qml AligmentVerticalButtons 2.0 AligmentVerticalButtons.qml
StandardTextSection 2.0 StandardTextSection.qml AnchorButtons 2.0 AnchorButtons.qml
FontSection 2.0 FontSection.qml BoolButtonRowButton 2.0 BoolButtonRowButton.qml
FlickableSection 2.0 FlickableSection.qml Button 2.0 Button.qml
UrlChooser 2.0 UrlChooser.qml ButtonRow 2.0 ButtonRow.qml
FontComboBox 2.0 FontComboBox.qml ButtonRowButton 2.0 ButtonRowButton.qml
OriginControl 2.0 OriginControl.qml CheckBox 2.0 CheckBox.qml
ColorButton 2.0 ColorButton.qml
ColorCheckButton 2.0 ColorCheckButton.qml
ColorEditor 2.0 ColorEditor.qml
ColorLogic 2.0 ColorLogic.qml
ComboBox 2.0 ComboBox.qml
CustomCheckBoxStyle 2.0 CustomCheckBoxStyle.qml
CustomComboBoxStyle 2.0 CustomComboBoxStyle.qml CustomComboBoxStyle 2.0 CustomComboBoxStyle.qml
CustomSpinBoxStyle 2.0 CustomSpinBoxStyle.qml CustomSpinBoxStyle 2.0 CustomSpinBoxStyle.qml
CustomCheckBoxStyle 2.0 CustomCheckBoxStyle.qml ExpandingSpacer 2.0 ExpandingSpacer.qml
ColorLogic 2.0 ColorLogic.qml ExtendedFunctionButton 2.0 ExtendedFunctionButton.qml
FlickableSection 2.0 FlickableSection.qml
FontComboBox 2.0 FontComboBox.qml
FontSection 2.0 FontSection.qml
FontStyleButtons 2.0 FontStyleButtons.qml
GradientLine 2.0 GradientLine.qml
GroupBox 2.0 GroupBox.qml
HueSlider 2.0 HueSlider.qml
IconLabel 2.0 IconLabel.qml
Label 2.0 Label.qml
LineEdit 2.0 LineEdit.qml
OriginControl 2.0 OriginControl.qml
ScrollView 2.0 ScrollView.qml
SecondColumnLayout 2.0 SecondColumnLayout.qml
Section 2.0 Section.qml
SectionLayout 2.0 SectionLayout.qml
SliderSpinBox 2.0 SliderSpinBox.qml
SpinBox 2.0 SpinBox.qml
StandardTextSection 2.0 StandardTextSection.qml
Tab 2.0 Tab.qml
TabView 2.0 TabView.qml
ToolTipArea 2.0 ToolTipArea.qml ToolTipArea 2.0 ToolTipArea.qml
UrlChooser 2.0 UrlChooser.qml

View File

@@ -4,4 +4,6 @@ Label {
} }
LineEdit { LineEdit {
backendValue: backendValues.%2 backendValue: backendValues.%2
Layout.fillWidth: true
showTranslateCheckBox: false
} }

View File

@@ -75,17 +75,14 @@ Rectangle {
placeholderText: qsTr("id") placeholderText: qsTr("id")
text: backendValues.id.value text: backendValues.id.value
Layout.fillWidth: true Layout.fillWidth: true
Layout.maximumWidth: 320
showTranslateCheckBox: false showTranslateCheckBox: false
showExtendedFunctionButton: false showExtendedFunctionButton: false
} }
// workaround: without this item the lineedit does not shrink to the
ExpandingSpacer { // right size after resizing to a wider width
}
Item { Item {
width: 16 width: 0
height: 16 height: 1
} }
} }
} }

View File

@@ -75,15 +75,14 @@ Rectangle {
placeholderText: qsTr("id") placeholderText: qsTr("id")
text: backendValues.id.value text: backendValues.id.value
Layout.fillWidth: true Layout.fillWidth: true
Layout.maximumWidth: 320 showTranslateCheckBox: false
showExtendedFunctionButton: false
} }
// workaround: without this item the lineedit does not shrink to the
ExpandingSpacer { // right size after resizing to a wider width
}
Item { Item {
width: 16 width: 0
height: 16 height: 1
} }
} }
} }

View File

@@ -30,7 +30,7 @@
****************************************************************************/ ****************************************************************************/
Custom class wizard example configuration file. --> Custom class wizard example configuration file. -->
<wizard version="1" class="qt4project" firstpage="10" kind="project" id="A.ScriptGeneratedProject" category="B.CustomProjects"> <wizard version="1" class="qmakeproject" firstpage="10" kind="project" id="A.ScriptGeneratedProject" category="B.CustomProjects">
<description>Creates a simple project using a generator script</description> <description>Creates a simple project using a generator script</description>
<displayname>Simple Script-Generated Project</displayname>; <displayname>Simple Script-Generated Project</displayname>;
<displaycategory>Custom Projects</displaycategory> <displaycategory>Custom Projects</displaycategory>

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -25,6 +25,7 @@ QtcLibrary {
files: [ files: [
"QtConcurrentTools", "QtConcurrentTools",
"algorithm.h",
"annotateditemdelegate.cpp", "annotateditemdelegate.cpp",
"annotateditemdelegate.h", "annotateditemdelegate.h",
"ansiescapecodehandler.cpp", "ansiescapecodehandler.cpp",

View File

@@ -37,8 +37,10 @@
#include <debugger/debuggerrunconfigurationaspect.h> #include <debugger/debuggerrunconfigurationaspect.h>
#include <projectexplorer/target.h> #include <projectexplorer/target.h>
#include <qtsupport/qtkitinformation.h>
#include <utils/qtcassert.h> #include <utils/qtcassert.h>
#include <QDir>
#include <QTime> #include <QTime>
#include <QtConcurrentRun> #include <QtConcurrentRun>
#include <QTemporaryFile> #include <QTemporaryFile>
@@ -93,6 +95,10 @@ AndroidRunner::AndroidRunner(QObject *parent,
m_pongFile = _("/data/local/tmp/qt/debug-pong-") + m_packageName; m_pongFile = _("/data/local/tmp/qt/debug-pong-") + m_packageName;
m_gdbserverSocket = packageDir + _("/debug-socket"); m_gdbserverSocket = packageDir + _("/debug-socket");
m_gdbserverPath = packageDir + _("/lib/gdbserver"); m_gdbserverPath = packageDir + _("/lib/gdbserver");
const QtSupport::BaseQtVersion *version = QtSupport::QtKitInformation::qtVersion(target->kit());
if (version && version->qtVersion() >= QtSupport::QtVersionNumber(5, 4, 0))
m_gdbserverPath += _(".so");
m_gdbserverCommand = m_gdbserverPath + _(" --multi +") + m_gdbserverSocket; m_gdbserverCommand = m_gdbserverPath + _(" --multi +") + m_gdbserverSocket;
// Detect busybox, as we need to pass -w to ps to get wide output. // Detect busybox, as we need to pass -w to ps to get wide output.
QProcess psProc; QProcess psProc;
@@ -292,7 +298,7 @@ void AndroidRunner::asyncStart()
// Handling ping. // Handling ping.
for (int i = 0; ; ++i) { for (int i = 0; ; ++i) {
QTemporaryFile tmp(_("pingpong")); QTemporaryFile tmp(QDir::tempPath() + _("/pingpong"));
tmp.open(); tmp.open();
tmp.close(); tmp.close();
@@ -324,7 +330,7 @@ void AndroidRunner::asyncStart()
void AndroidRunner::handleRemoteDebuggerRunning() void AndroidRunner::handleRemoteDebuggerRunning()
{ {
if (m_useCppDebugger) { if (m_useCppDebugger) {
QTemporaryFile tmp(_("pingpong")); QTemporaryFile tmp(QDir::tempPath() + _("/pingpong"));
tmp.open(); tmp.open();
QProcess process; QProcess process;

View File

@@ -592,8 +592,8 @@ void AndroidSettingsWidget::showGdbWarningDialog()
tr("Unsupported GDB"), tr("Unsupported GDB"),
tr("The GDB inside this NDK seems to not support Python. " tr("The GDB inside this NDK seems to not support Python. "
"The Qt Project offers fixed GDB builds at: " "The Qt Project offers fixed GDB builds at: "
"<a href=\"http://download.qt-project.org/official_releases/gdb/osx/\">" "<a href=\"http://download.qt-project.org/official_releases/gdb/\">"
"http://download.qt-project.org/official_releases/gdb/osx/</a>")); "http://download.qt-project.org/official_releases/gdb/</a>"));
} }
void AndroidSettingsWidget::manageAVD() void AndroidSettingsWidget::manageAVD()

View File

@@ -1629,6 +1629,8 @@ bool EditorManagerPrivate::saveDocumentAs(IDocument *document)
const QString filter = MimeDatabase::allFiltersString(); const QString filter = MimeDatabase::allFiltersString();
QString selectedFilter = QString selectedFilter =
MimeDatabase::findByFile(QFileInfo(document->filePath())).filterString(); MimeDatabase::findByFile(QFileInfo(document->filePath())).filterString();
if (selectedFilter.isEmpty())
selectedFilter = MimeDatabase::findByType(document->mimeType()).filterString();
const QString &absoluteFilePath = const QString &absoluteFilePath =
DocumentManager::getSaveAsFileName(document, filter, &selectedFilter); DocumentManager::getSaveAsFileName(document, filter, &selectedFilter);

View File

@@ -611,6 +611,7 @@ void DiffEditor::showDiffEditor(QWidget *newEditor)
writeCurrentDiffEditorSetting(m_currentEditor); writeCurrentDiffEditorSetting(m_currentEditor);
updateDiffEditorSwitcher(); updateDiffEditorSwitcher();
widget()->setFocusProxy(m_currentEditor);
} }
QWidget *DiffEditor::readLegacyCurrentDiffEditorSetting() QWidget *DiffEditor::readLegacyCurrentDiffEditorSetting()

View File

@@ -272,4 +272,14 @@ void DiffEditorController::requestChunkActions(QMenu *menu,
emit chunkActionsRequested(menu, diffFileIndex, chunkIndex); emit chunkActionsRequested(menu, diffFileIndex, chunkIndex);
} }
void DiffEditorController::requestSaveState()
{
emit saveStateRequested();
}
void DiffEditorController::requestRestoreState()
{
emit restoreStateRequested();
}
} // namespace DiffEditor } // namespace DiffEditor

View File

@@ -73,6 +73,8 @@ public slots:
void requestChunkActions(QMenu *menu, void requestChunkActions(QMenu *menu,
int diffFileIndex, int diffFileIndex,
int chunkIndex); int chunkIndex);
void requestSaveState();
void requestRestoreState();
void branchesForCommitReceived(const QString &output); void branchesForCommitReceived(const QString &output);
void expandBranchesRequested(); void expandBranchesRequested();
@@ -87,6 +89,8 @@ signals:
void chunkActionsRequested(QMenu *menu, void chunkActionsRequested(QMenu *menu,
int diffFileIndex, int diffFileIndex,
int chunkIndex); int chunkIndex);
void saveStateRequested();
void restoreStateRequested();
void expandBranchesRequested(const QString &revision); void expandBranchesRequested(const QString &revision);
void reloaderChanged(DiffEditorReloader *reloader); void reloaderChanged(DiffEditorReloader *reloader);

View File

@@ -46,6 +46,7 @@ DiffEditorDocument::DiffEditorDocument() :
m_controller(new DiffEditorController(this)) m_controller(new DiffEditorController(this))
{ {
setId(Constants::DIFF_EDITOR_ID); setId(Constants::DIFF_EDITOR_ID);
setMimeType(QLatin1String(Constants::DIFF_EDITOR_MIMETYPE));
setTemporary(true); setTemporary(true);
} }

View File

@@ -132,7 +132,9 @@ void SimpleDiffEditorReloader::reload()
QList<FileData> fileDataList; QList<FileData> fileDataList;
fileDataList << fileData; fileDataList << fileData;
controller()->requestSaveState();
controller()->setDiffFiles(fileDataList); controller()->setDiffFiles(fileDataList);
controller()->requestRestoreState();
reloadFinished(); reloadFinished();
} }
@@ -297,6 +299,25 @@ void DiffEditor::Internal::DiffEditorPlugin::testMakePatch_data()
/////////// ///////////
rows.clear();
rows << RowData(_("ABCD"));
rows << RowData(_(""), TextLineData::Separator);
rows << RowData(_(""), TextLineData::Separator);
chunk.rows = rows;
patchText = header + _("@@ -1,2 +1,1 @@\n"
"-ABCD\n"
"-\n"
"+ABCD\n"
"\\ No newline at end of file\n");
QTest::newRow("Two last EOLs removed") << chunk
<< fileName
<< fileName
<< true
<< patchText;
///////////
rows.clear(); rows.clear();
rows << RowData(_("ABCD")); rows << RowData(_("ABCD"));
rows << RowData(TextLineData::Separator, _("")); rows << RowData(TextLineData::Separator, _(""));
@@ -418,6 +439,26 @@ void DiffEditor::Internal::DiffEditorPlugin::testMakePatch_data()
<< fileName << fileName
<< false << false
<< patchText; << patchText;
///////////
rows.clear();
rows << RowData(_("ABCD"));
rows << RowData(TextLineData::Separator, _(""));
rows << RowData(_(""), _("EFGH"));
chunk.rows = rows;
patchText = header + _("@@ -1,1 +1,3 @@\n"
" ABCD\n"
"+\n"
"+EFGH\n"
"\\ No newline at end of file\n");
QTest::newRow("Blank line followed by No newline")
<< chunk
<< fileName
<< fileName
<< true
<< patchText;
} }
void DiffEditor::Internal::DiffEditorPlugin::testMakePatch() void DiffEditor::Internal::DiffEditorPlugin::testMakePatch()
@@ -748,6 +789,37 @@ void DiffEditor::Internal::DiffEditorPlugin::testReadPatch_data()
QTest::newRow("2 chunks - first ends with blank line") << patch QTest::newRow("2 chunks - first ends with blank line") << patch
<< fileDataList4; << fileDataList4;
//////////////
patch = _("diff --git a/file foo.txt b/file foo.txt\n"
"index 1234567..9876543 100644\n"
"--- a/file foo.txt\n"
"+++ b/file foo.txt\n"
"@@ -1,1 +1,3 @@ void DiffEditor::ctor()\n"
" ABCD\n"
"+\n"
"+EFGH\n"
"\\ No newline at end of file\n");
fileData1.leftFileInfo = DiffFileInfo(_("file foo.txt"), _("1234567"));
fileData1.rightFileInfo = DiffFileInfo(_("file foo.txt"), _("9876543"));
fileData1.fileOperation = FileData::ChangeFile;
chunkData1.leftStartingLineNumber = 0;
chunkData1.rightStartingLineNumber = 0;
rows1.clear();
rows1 << RowData(_("ABCD"));
rows1 << RowData(TextLineData::Separator, _(""));
rows1 << RowData(_(""), _("EFGH"));
chunkData1.rows = rows1;
fileData1.chunks.clear();
fileData1.chunks << chunkData1;
QList<FileData> fileDataList5;
fileDataList5 << fileData1;
QTest::newRow("Blank line followed by No newline") << patch
<< fileDataList5;
} }
void DiffEditor::Internal::DiffEditorPlugin::testReadPatch() void DiffEditor::Internal::DiffEditorPlugin::testReadPatch()

View File

@@ -362,15 +362,33 @@ QString DiffUtils::makePatch(const ChunkData &chunkData,
int rightLineCount = 0; int rightLineCount = 0;
QList<TextLineData> leftBuffer, rightBuffer; QList<TextLineData> leftBuffer, rightBuffer;
int lastEqualRow = -1; int rowToBeSplit = -1;
if (lastChunk) { if (lastChunk) {
for (int i = chunkData.rows.count(); i > 0; i--) { // Detect the case when the last equal line is followed by
if (chunkData.rows.at(i - 1).equal) { // only separators on left or on right. In that case
if (i != chunkData.rows.count()) // the last equal line needs to be split.
lastEqualRow = i - 1; const int rowCount = chunkData.rows.count();
int i = 0;
for (i = rowCount; i > 0; i--) {
const RowData &rowData = chunkData.rows.at(i - 1);
if (rowData.leftLine.textLineType != TextLineData::Separator
|| rowData.rightLine.textLineType != TextLineData::TextLine)
break; break;
}
} }
const int leftSeparator = i;
for (i = rowCount; i > 0; i--) {
const RowData &rowData = chunkData.rows.at(i - 1);
if (rowData.rightLine.textLineType != TextLineData::Separator
|| rowData.leftLine.textLineType != TextLineData::TextLine)
break;
}
const int rightSeparator = i;
const int commonSeparator = qMin(leftSeparator, rightSeparator);
if (commonSeparator > 0
&& commonSeparator < rowCount
&& chunkData.rows.at(commonSeparator - 1).equal)
rowToBeSplit = commonSeparator - 1;
} }
for (int i = 0; i <= chunkData.rows.count(); i++) { for (int i = 0; i <= chunkData.rows.count(); i++) {
@@ -379,7 +397,7 @@ QString DiffUtils::makePatch(const ChunkData &chunkData,
: RowData(TextLineData(TextLineData::Separator)); // dummy, : RowData(TextLineData(TextLineData::Separator)); // dummy,
// ensure we process buffers to the end. // ensure we process buffers to the end.
// rowData will be equal // rowData will be equal
if (rowData.equal && i != lastEqualRow) { if (rowData.equal && i != rowToBeSplit) {
if (leftBuffer.count()) { if (leftBuffer.count()) {
for (int j = 0; j < leftBuffer.count(); j++) { for (int j = 0; j < leftBuffer.count(); j++) {
const QString line = makePatchLine(QLatin1Char('-'), const QString line = makePatchLine(QLatin1Char('-'),
@@ -439,7 +457,9 @@ QString DiffUtils::makePatch(const ChunkData &chunkData,
+ QString::number(chunkData.rightStartingLineNumber + 1) + QString::number(chunkData.rightStartingLineNumber + 1)
+ QLatin1Char(',') + QLatin1Char(',')
+ QString::number(rightLineCount) + QString::number(rightLineCount)
+ QLatin1String(" @@\n"); + QLatin1String(" @@")
+ chunkData.contextInfo
+ QLatin1Char('\n');
diffText.prepend(chunkLine); diffText.prepend(chunkLine);
@@ -530,8 +550,6 @@ static QList<RowData> readLines(const QString &patch,
Diff &last = diffList.last(); Diff &last = diffList.last();
if (last.text.isEmpty()) if (last.text.isEmpty())
break; break;
if (last.text.at(0) == newLine) // there is a new line
break;
if (last.command == Diff::Equal) { if (last.command == Diff::Equal) {
if (noNewLineInEqual >= 0) if (noNewLineInEqual >= 0)
@@ -690,7 +708,7 @@ static QList<ChunkData> readChunks(const QString &patch,
// @@ -leftPos[,leftCount] +rightPos[,rightCount] @@ // @@ -leftPos[,leftCount] +rightPos[,rightCount] @@
"@@ -(\\d+)(?:,\\d+)? \\+(\\d+)(?:,\\d+)? @@" "@@ -(\\d+)(?:,\\d+)? \\+(\\d+)(?:,\\d+)? @@"
// optional hint (e.g. function name) // optional hint (e.g. function name)
"(?:\\ +[^\\n]*)?" "(\\ +[^\\n]*)?"
// end of line (need to be followed by text line) // end of line (need to be followed by text line)
"(?:\\n))")); "(?:\\n))"));
@@ -706,6 +724,7 @@ static QList<ChunkData> readChunks(const QString &patch,
const QString captured = capturedTexts.at(1); const QString captured = capturedTexts.at(1);
const int leftStartingPos = capturedTexts.at(2).toInt(); const int leftStartingPos = capturedTexts.at(2).toInt();
const int rightStartingPos = capturedTexts.at(3).toInt(); const int rightStartingPos = capturedTexts.at(3).toInt();
const QString contextInfo = capturedTexts.at(4);
if (endOfLastChunk > 0) { if (endOfLastChunk > 0) {
const QString lines = patch.mid(endOfLastChunk, const QString lines = patch.mid(endOfLastChunk,
pos - endOfLastChunk); pos - endOfLastChunk);
@@ -722,6 +741,7 @@ static QList<ChunkData> readChunks(const QString &patch,
ChunkData chunkData; ChunkData chunkData;
chunkData.leftStartingLineNumber = leftStartingPos - 1; chunkData.leftStartingLineNumber = leftStartingPos - 1;
chunkData.rightStartingLineNumber = rightStartingPos - 1; chunkData.rightStartingLineNumber = rightStartingPos - 1;
chunkData.contextInfo = contextInfo;
chunkDataList.append(chunkData); chunkDataList.append(chunkData);
} while ((pos = chunkRegExp.indexIn(patch, pos)) != -1); } while ((pos = chunkRegExp.indexIn(patch, pos)) != -1);

View File

@@ -95,6 +95,7 @@ public:
bool contextChunk; bool contextChunk;
int leftStartingLineNumber; int leftStartingLineNumber;
int rightStartingLineNumber; int rightStartingLineNumber;
QString contextInfo;
}; };
class DIFFEDITOR_EXPORT FileData { class DIFFEDITOR_EXPORT FileData {

View File

@@ -154,6 +154,8 @@ public:
public slots: public slots:
void setDisplaySettings(const DisplaySettings &ds); void setDisplaySettings(const DisplaySettings &ds);
void saveStateRequested();
void restoreStateRequested();
signals: signals:
void jumpToOriginalFileRequested(int diffFileIndex, void jumpToOriginalFileRequested(int diffFileIndex,
@@ -205,6 +207,7 @@ private:
QColor m_fileLineForeground; QColor m_fileLineForeground;
QColor m_chunkLineForeground; QColor m_chunkLineForeground;
QColor m_textForeground; QColor m_textForeground;
QByteArray m_state;
// MultiHighlighter *m_highlighter; // MultiHighlighter *m_highlighter;
}; };
@@ -338,6 +341,23 @@ SideDiffEditorWidget::SideDiffEditorWidget(QWidget *parent)
// baseTextDocument()->setSyntaxHighlighter(m_highlighter); // baseTextDocument()->setSyntaxHighlighter(m_highlighter);
} }
void SideDiffEditorWidget::saveStateRequested()
{
if (!m_state.isNull())
return;
m_state = saveState();
}
void SideDiffEditorWidget::restoreStateRequested()
{
if (m_state.isNull())
return;
restoreState(m_state);
m_state.clear();
}
void SideDiffEditorWidget::setDisplaySettings(const DisplaySettings &ds) void SideDiffEditorWidget::setDisplaySettings(const DisplaySettings &ds)
{ {
DisplaySettings settings = displaySettings(); DisplaySettings settings = displaySettings();
@@ -836,6 +856,7 @@ SideBySideDiffEditorWidget::SideBySideDiffEditorWidget(QWidget *parent)
QVBoxLayout *l = new QVBoxLayout(this); QVBoxLayout *l = new QVBoxLayout(this);
l->setMargin(0); l->setMargin(0);
l->addWidget(m_splitter); l->addWidget(m_splitter);
setFocusProxy(m_rightEditor);
clear(tr("No controller")); clear(tr("No controller"));
} }
@@ -856,6 +877,14 @@ void SideBySideDiffEditorWidget::setDiffEditorGuiController(
this, SLOT(clearAll(QString))); this, SLOT(clearAll(QString)));
disconnect(m_controller, SIGNAL(diffFilesChanged(QList<FileData>,QString)), disconnect(m_controller, SIGNAL(diffFilesChanged(QList<FileData>,QString)),
this, SLOT(setDiff(QList<FileData>,QString))); this, SLOT(setDiff(QList<FileData>,QString)));
disconnect(m_controller, SIGNAL(saveStateRequested()),
m_leftEditor, SLOT(saveStateRequested()));
disconnect(m_controller, SIGNAL(saveStateRequested()),
m_rightEditor, SLOT(saveStateRequested()));
disconnect(m_controller, SIGNAL(restoreStateRequested()),
m_leftEditor, SLOT(restoreStateRequested()));
disconnect(m_controller, SIGNAL(restoreStateRequested()),
m_rightEditor, SLOT(restoreStateRequested()));
disconnect(m_guiController, SIGNAL(currentDiffFileIndexChanged(int)), disconnect(m_guiController, SIGNAL(currentDiffFileIndexChanged(int)),
this, SLOT(setCurrentDiffFileIndex(int))); this, SLOT(setCurrentDiffFileIndex(int)));
@@ -871,6 +900,14 @@ void SideBySideDiffEditorWidget::setDiffEditorGuiController(
this, SLOT(clearAll(QString))); this, SLOT(clearAll(QString)));
connect(m_controller, SIGNAL(diffFilesChanged(QList<FileData>,QString)), connect(m_controller, SIGNAL(diffFilesChanged(QList<FileData>,QString)),
this, SLOT(setDiff(QList<FileData>,QString))); this, SLOT(setDiff(QList<FileData>,QString)));
connect(m_controller, SIGNAL(saveStateRequested()),
m_leftEditor, SLOT(saveStateRequested()));
connect(m_controller, SIGNAL(saveStateRequested()),
m_rightEditor, SLOT(saveStateRequested()));
connect(m_controller, SIGNAL(restoreStateRequested()),
m_leftEditor, SLOT(restoreStateRequested()));
connect(m_controller, SIGNAL(restoreStateRequested()),
m_rightEditor, SLOT(restoreStateRequested()));
connect(m_guiController, SIGNAL(currentDiffFileIndexChanged(int)), connect(m_guiController, SIGNAL(currentDiffFileIndexChanged(int)),
this, SLOT(setCurrentDiffFileIndex(int))); this, SLOT(setCurrentDiffFileIndex(int)));
@@ -936,11 +973,6 @@ void SideBySideDiffEditorWidget::setCurrentDiffFileIndex(int diffFileIndex)
void SideBySideDiffEditorWidget::showDiff() void SideBySideDiffEditorWidget::showDiff()
{ {
// TODO: remember the line number of the line in the middle
const int verticalValue = m_leftEditor->verticalScrollBar()->value();
const int leftHorizontalValue = m_leftEditor->horizontalScrollBar()->value();
const int rightHorizontalValue = m_rightEditor->horizontalScrollBar()->value();
clear(tr("No difference")); clear(tr("No difference"));
QMap<int, QList<DiffSelection> > leftFormats; QMap<int, QList<DiffSelection> > leftFormats;
@@ -1151,11 +1183,6 @@ void SideBySideDiffEditorWidget::showDiff()
} }
m_foldingBlocker = false; m_foldingBlocker = false;
*/ */
m_leftEditor->verticalScrollBar()->setValue(verticalValue);
m_rightEditor->verticalScrollBar()->setValue(verticalValue);
m_leftEditor->horizontalScrollBar()->setValue(leftHorizontalValue);
m_rightEditor->horizontalScrollBar()->setValue(rightHorizontalValue);
// m_leftEditor->updateFoldingHighlight(QPoint(-1, -1)); // m_leftEditor->updateFoldingHighlight(QPoint(-1, -1));
// m_rightEditor->updateFoldingHighlight(QPoint(-1, -1)); // m_rightEditor->updateFoldingHighlight(QPoint(-1, -1));
} }

View File

@@ -134,6 +134,10 @@ void UnifiedDiffEditorWidget::setDiffEditorGuiController(
this, SLOT(clearAll(QString))); this, SLOT(clearAll(QString)));
disconnect(m_controller, SIGNAL(diffFilesChanged(QList<FileData>,QString)), disconnect(m_controller, SIGNAL(diffFilesChanged(QList<FileData>,QString)),
this, SLOT(setDiff(QList<FileData>,QString))); this, SLOT(setDiff(QList<FileData>,QString)));
disconnect(m_controller, SIGNAL(saveStateRequested()),
this, SLOT(saveStateRequested()));
disconnect(m_controller, SIGNAL(restoreStateRequested()),
this, SLOT(restoreStateRequested()));
disconnect(m_guiController, SIGNAL(currentDiffFileIndexChanged(int)), disconnect(m_guiController, SIGNAL(currentDiffFileIndexChanged(int)),
this, SLOT(setCurrentDiffFileIndex(int))); this, SLOT(setCurrentDiffFileIndex(int)));
@@ -149,6 +153,10 @@ void UnifiedDiffEditorWidget::setDiffEditorGuiController(
this, SLOT(clearAll(QString))); this, SLOT(clearAll(QString)));
connect(m_controller, SIGNAL(diffFilesChanged(QList<FileData>,QString)), connect(m_controller, SIGNAL(diffFilesChanged(QList<FileData>,QString)),
this, SLOT(setDiff(QList<FileData>,QString))); this, SLOT(setDiff(QList<FileData>,QString)));
connect(m_controller, SIGNAL(saveStateRequested()),
this, SLOT(saveStateRequested()));
connect(m_controller, SIGNAL(restoreStateRequested()),
this, SLOT(restoreStateRequested()));
connect(m_guiController, SIGNAL(currentDiffFileIndexChanged(int)), connect(m_guiController, SIGNAL(currentDiffFileIndexChanged(int)),
this, SLOT(setCurrentDiffFileIndex(int))); this, SLOT(setCurrentDiffFileIndex(int)));
@@ -158,6 +166,23 @@ void UnifiedDiffEditorWidget::setDiffEditorGuiController(
} }
} }
void UnifiedDiffEditorWidget::saveStateRequested()
{
if (!m_state.isNull())
return;
m_state = saveState();
}
void UnifiedDiffEditorWidget::restoreStateRequested()
{
if (m_state.isNull())
return;
restoreState(m_state);
m_state.clear();
}
DiffEditorGuiController *UnifiedDiffEditorWidget::diffEditorGuiController() const DiffEditorGuiController *UnifiedDiffEditorWidget::diffEditorGuiController() const
{ {
return m_guiController; return m_guiController;
@@ -613,7 +638,9 @@ QString UnifiedDiffEditorWidget::showChunk(const ChunkData &chunkData,
+ QString::number(chunkData.rightStartingLineNumber+ 1) + QString::number(chunkData.rightStartingLineNumber+ 1)
+ QLatin1Char(',') + QLatin1Char(',')
+ QString::number(rightLineCount) + QString::number(rightLineCount)
+ QLatin1String(" @@\n"); + QLatin1String(" @@")
+ chunkData.contextInfo
+ QLatin1Char('\n');
diffText.prepend(chunkLine); diffText.prepend(chunkLine);

View File

@@ -87,6 +87,8 @@ private slots:
void slotSendChunkToCodePaster(); void slotSendChunkToCodePaster();
void slotApplyChunk(); void slotApplyChunk();
void slotRevertChunk(); void slotRevertChunk();
void saveStateRequested();
void restoreStateRequested();
private: private:
void setLeftLineNumber(int blockNumber, int lineNumber); void setLeftLineNumber(int blockNumber, int lineNumber);
@@ -139,6 +141,7 @@ private:
QTextCharFormat m_rightLineFormat; QTextCharFormat m_rightLineFormat;
QTextCharFormat m_leftCharFormat; QTextCharFormat m_leftCharFormat;
QTextCharFormat m_rightCharFormat; QTextCharFormat m_rightCharFormat;
QByteArray m_state;
}; };
} // namespace DiffEditor } // namespace DiffEditor

View File

@@ -160,9 +160,10 @@ GerritPushDialog::GerritPushDialog(const QString &workingDir, const QString &rev
updateCommits(m_ui->localBranchComboBox->currentIndex()); updateCommits(m_ui->localBranchComboBox->currentIndex());
setRemoteBranches(); setRemoteBranches();
QRegExpValidator *noSpaceValidator = new QRegExpValidator(QRegExp(QLatin1String("^\\S+$")), this);
m_ui->reviewersLineEdit->setText(reviewerList); m_ui->reviewersLineEdit->setText(reviewerList);
m_ui->reviewersLineEdit->setValidator(noSpaceValidator);
m_ui->topicLineEdit->setValidator(new QRegExpValidator(QRegExp(QLatin1String("^\\S+$")), this)); m_ui->topicLineEdit->setValidator(noSpaceValidator);
m_valid = true; m_valid = true;
} }

View File

@@ -124,13 +124,19 @@ public:
private slots: private slots:
void slotShowDescriptionReceived(const QString &data); void slotShowDescriptionReceived(const QString &data);
void slotDiffOutputReceived(const QString &contents); void slotTextualDiffOutputReceived(const QString &contents);
private: private:
void postCollectShowDescription(const QString &id); void postCollectShowDescription(const QString &id);
void postCollectDiffOutput(const QStringList &arguments); void postCollectTextualDiffOutputUsingDiffCommand(const QStringList &arguments);
void postCollectDiffOutput(const QList<QStringList> &argumentsList); void postCollectTextualDiffOutputUsingDiffCommand(const QList<QStringList> &argumentsList);
void addJob(VcsBase::Command *command, const QStringList &arguments); void postCollectTextualDiffOutputUsingShowCommand(const QStringList &arguments);
void postCollectTextualDiffOutput(const QString &gitCommand,
const QList<QStringList> &argumentsList);
void addJob(VcsBase::Command *command,
const QString &gitCommand,
const QStringList &arguments);
QStringList addHeadWhenCommandInProgress() const;
int timeout() const; int timeout() const;
QProcessEnvironment processEnvironment() const; QProcessEnvironment processEnvironment() const;
Utils::FileName gitPath() const; Utils::FileName gitPath() const;
@@ -154,7 +160,9 @@ GitDiffHandler::GitDiffHandler(DiffEditor::DiffEditorController *controller,
void GitDiffHandler::diffFile(const QString &fileName) void GitDiffHandler::diffFile(const QString &fileName)
{ {
postCollectDiffOutput(QStringList() << QLatin1String("--") << fileName); postCollectTextualDiffOutputUsingDiffCommand(addHeadWhenCommandInProgress()
<< QLatin1String("--")
<< fileName);
} }
void GitDiffHandler::diffFiles(const QStringList &stagedFileNames, void GitDiffHandler::diffFiles(const QStringList &stagedFileNames,
@@ -169,28 +177,31 @@ void GitDiffHandler::diffFiles(const QStringList &stagedFileNames,
arguments << stagedArguments; arguments << stagedArguments;
if (!unstagedFileNames.isEmpty()) { if (!unstagedFileNames.isEmpty()) {
QStringList unstagedArguments; QStringList unstagedArguments = addHeadWhenCommandInProgress();
unstagedArguments << QLatin1String("--"); unstagedArguments << QLatin1String("--");
unstagedArguments << unstagedFileNames; unstagedArguments << unstagedFileNames;
arguments << unstagedArguments; arguments << unstagedArguments;
} }
postCollectDiffOutput(arguments); postCollectTextualDiffOutputUsingDiffCommand(arguments);
} }
void GitDiffHandler::diffProjects(const QStringList &projectPaths) void GitDiffHandler::diffProjects(const QStringList &projectPaths)
{ {
postCollectDiffOutput(QStringList() << QLatin1String("--") << projectPaths); postCollectTextualDiffOutputUsingDiffCommand(addHeadWhenCommandInProgress()
<< QLatin1String("--")
<< projectPaths);
} }
void GitDiffHandler::diffRepository() void GitDiffHandler::diffRepository()
{ {
postCollectDiffOutput(QStringList()); postCollectTextualDiffOutputUsingDiffCommand(addHeadWhenCommandInProgress());
} }
void GitDiffHandler::diffBranch(const QString &branchName) void GitDiffHandler::diffBranch(const QString &branchName)
{ {
postCollectDiffOutput(QStringList() << branchName); postCollectTextualDiffOutputUsingDiffCommand(addHeadWhenCommandInProgress()
<< branchName);
} }
void GitDiffHandler::show(const QString &id) void GitDiffHandler::show(const QString &id)
@@ -206,6 +217,7 @@ void GitDiffHandler::postCollectShowDescription(const QString &id)
return; return;
} }
m_controller->requestSaveState();
m_controller->clear(m_waitMessage); m_controller->clear(m_waitMessage);
VcsBase::Command *command = new VcsBase::Command(gitPath(), VcsBase::Command *command = new VcsBase::Command(gitPath(),
m_workingDirectory, m_workingDirectory,
@@ -231,7 +243,11 @@ void GitDiffHandler::slotShowDescriptionReceived(const QString &description)
return; return;
} }
postCollectDiffOutput(QStringList() << m_id + QLatin1Char('^') << m_id); postCollectTextualDiffOutputUsingShowCommand(QStringList()
<< QLatin1String("--format=format:") // omit header, already generated
<< QLatin1String(noColorOption)
<< QLatin1String(decorateOption)
<< m_id);
// need to be called after postCollectDiffOutput(), since it clears the description // need to be called after postCollectDiffOutput(), since it clears the description
m_controller->setDescription( m_controller->setDescription(
@@ -239,10 +255,14 @@ void GitDiffHandler::slotShowDescriptionReceived(const QString &description)
description)); description));
} }
void GitDiffHandler::addJob(VcsBase::Command *command, const QStringList &arguments) void GitDiffHandler::addJob(VcsBase::Command *command,
const QString &gitCommand,
const QStringList &arguments)
{ {
QStringList args; QStringList args;
args << QLatin1String("diff"); args << gitCommand;
args << QLatin1String("-m"); // show diff agains parents instead of merge commits
args << QLatin1String("--first-parent"); // show only first parent
if (m_controller->isIgnoreWhitespace()) if (m_controller->isIgnoreWhitespace())
args << QLatin1String("--ignore-space-change"); args << QLatin1String("--ignore-space-change");
args << QLatin1String("--unified=") + QString::number( args << QLatin1String("--unified=") + QString::number(
@@ -251,34 +271,57 @@ void GitDiffHandler::addJob(VcsBase::Command *command, const QStringList &argume
command->addJob(args, timeout()); command->addJob(args, timeout());
} }
void GitDiffHandler::postCollectDiffOutput(const QStringList &arguments) QStringList GitDiffHandler::addHeadWhenCommandInProgress() const
{ {
postCollectDiffOutput(QList<QStringList>() << arguments); QStringList args;
// This is workaround for lack of support for merge commits and resolving conflicts,
// we compare the current state of working tree to the HEAD of current branch
// instead of showing unsupported combined diff format.
GitClient::CommandInProgress commandInProgress = m_gitClient->checkCommandInProgress(m_workingDirectory);
if (commandInProgress != GitClient::NoCommand)
args << QLatin1String(HEAD);
return args;
} }
void GitDiffHandler::postCollectDiffOutput(const QList<QStringList> &argumentsList) void GitDiffHandler::postCollectTextualDiffOutputUsingDiffCommand(const QStringList &arguments)
{
postCollectTextualDiffOutputUsingDiffCommand(QList<QStringList>() << arguments);
}
void GitDiffHandler::postCollectTextualDiffOutputUsingDiffCommand(const QList<QStringList> &argumentsList)
{
postCollectTextualDiffOutput(QLatin1String("diff"), argumentsList);
}
void GitDiffHandler::postCollectTextualDiffOutputUsingShowCommand(const QStringList &arguments)
{
postCollectTextualDiffOutput(QLatin1String("show"), QList<QStringList>() << arguments);
}
void GitDiffHandler::postCollectTextualDiffOutput(const QString &gitCommand, const QList<QStringList> &argumentsList)
{ {
if (m_controller.isNull()) { if (m_controller.isNull()) {
deleteLater(); deleteLater();
return; return;
} }
m_controller->requestSaveState();
m_controller->clear(m_waitMessage); m_controller->clear(m_waitMessage);
VcsBase::Command *command = new VcsBase::Command(gitPath(), VcsBase::Command *command = new VcsBase::Command(gitPath(),
m_workingDirectory, m_workingDirectory,
processEnvironment()); processEnvironment());
command->setCodec(EditorManager::defaultTextCodec()); command->setCodec(EditorManager::defaultTextCodec());
connect(command, SIGNAL(output(QString)), connect(command, SIGNAL(output(QString)),
this, SLOT(slotDiffOutputReceived(QString))); this, SLOT(slotTextualDiffOutputReceived(QString)));
command->addFlags(diffExecutionFlags()); command->addFlags(diffExecutionFlags());
for (int i = 0; i < argumentsList.count(); i++) for (int i = 0; i < argumentsList.count(); i++)
addJob(command, argumentsList.at(i)); addJob(command, gitCommand, argumentsList.at(i));
command->execute(); command->execute();
} }
void GitDiffHandler::slotDiffOutputReceived(const QString &contents) void GitDiffHandler::slotTextualDiffOutputReceived(const QString &contents)
{ {
if (m_controller.isNull()) { if (m_controller.isNull()) {
deleteLater(); deleteLater();
@@ -290,6 +333,7 @@ void GitDiffHandler::slotDiffOutputReceived(const QString &contents)
= DiffEditor::DiffUtils::readPatch( = DiffEditor::DiffUtils::readPatch(
contents, m_controller->isIgnoreWhitespace(), &ok); contents, m_controller->isIgnoreWhitespace(), &ok);
m_controller->setDiffFiles(fileDataList, m_workingDirectory); m_controller->setDiffFiles(fileDataList, m_workingDirectory);
m_controller->requestRestoreState();
deleteLater(); deleteLater();
} }
@@ -713,7 +757,7 @@ GitClient::~GitClient()
{ {
} }
QString GitClient::findRepositoryForDirectory(const QString &dir) QString GitClient::findRepositoryForDirectory(const QString &dir) const
{ {
if (dir.isEmpty() || dir.endsWith(QLatin1String("/.git")) if (dir.isEmpty() || dir.endsWith(QLatin1String("/.git"))
|| dir.contains(QLatin1String("/.git/"))) { || dir.contains(QLatin1String("/.git/"))) {
@@ -937,7 +981,7 @@ VcsBase::VcsBaseEditorWidget *GitClient::createVcsEditor(
void GitClient::diff(const QString &workingDirectory, void GitClient::diff(const QString &workingDirectory,
const QStringList &unstagedFileNames, const QStringList &unstagedFileNames,
const QStringList &stagedFileNames) const QStringList &stagedFileNames) const
{ {
GitDiffEditorReloader::DiffType diffType = GitDiffEditorReloader::DiffProjectList; GitDiffEditorReloader::DiffType diffType = GitDiffEditorReloader::DiffProjectList;
@@ -968,19 +1012,24 @@ void GitClient::diff(const QString &workingDirectory,
controller->setReloader(reloader); controller->setReloader(reloader);
reloader->setWorkingDirectory(workingDirectory); reloader->setWorkingDirectory(workingDirectory);
reloader->setDiffType(diffType);
if (diffType == GitDiffEditorReloader::DiffFileList)
reloader->setFileList(stagedFileNames, unstagedFileNames);
else if (diffType == GitDiffEditorReloader::DiffProjectList)
reloader->setProjectList(unstagedFileNames);
} }
DiffEditor::DiffEditorController *controller = diffEditorDocument->controller();
GitDiffEditorReloader *reloader = static_cast<GitDiffEditorReloader *>(controller->reloader());
reloader->setDiffType(diffType);
// we force setFileList, since the lists can be different
// e.g. when double click for the second time on different file inside commit editor
if (diffType == GitDiffEditorReloader::DiffFileList)
reloader->setFileList(stagedFileNames, unstagedFileNames);
else if (diffType == GitDiffEditorReloader::DiffProjectList) // the same when unstaged file was clicked
reloader->setProjectList(unstagedFileNames);
diffEditorDocument->controller()->requestReload(); diffEditorDocument->controller()->requestReload();
EditorManager::activateEditorForDocument(diffEditorDocument); EditorManager::activateEditorForDocument(diffEditorDocument);
} }
void GitClient::diff(const QString &workingDirectory, const QString &fileName) void GitClient::diff(const QString &workingDirectory, const QString &fileName) const
{ {
const QString title = tr("Git Diff \"%1\"").arg(fileName); const QString title = tr("Git Diff \"%1\"").arg(fileName);
const QString sourceFile = VcsBase::VcsBaseEditorWidget::getSource( const QString sourceFile = VcsBase::VcsBaseEditorWidget::getSource(
@@ -1006,7 +1055,7 @@ void GitClient::diff(const QString &workingDirectory, const QString &fileName)
} }
void GitClient::diffBranch(const QString &workingDirectory, void GitClient::diffBranch(const QString &workingDirectory,
const QString &branchName) const QString &branchName) const
{ {
const QString title = tr("Git Diff Branch \"%1\"").arg(branchName); const QString title = tr("Git Diff Branch \"%1\"").arg(branchName);
const QString documentId = QLatin1String("Branch:") + branchName; const QString documentId = QLatin1String("Branch:") + branchName;
@@ -1521,7 +1570,7 @@ static inline bool splitCommitParents(const QString &line,
} }
bool GitClient::synchronousRevListCmd(const QString &workingDirectory, const QStringList &arguments, bool GitClient::synchronousRevListCmd(const QString &workingDirectory, const QStringList &arguments,
QString *output, QString *errorMessage) QString *output, QString *errorMessage) const
{ {
QByteArray outputTextData; QByteArray outputTextData;
QByteArray errorText; QByteArray errorText;
@@ -1545,7 +1594,7 @@ bool GitClient::synchronousParentRevisions(const QString &workingDirectory,
const QStringList &files /* = QStringList() */, const QStringList &files /* = QStringList() */,
const QString &revision, const QString &revision,
QStringList *parents, QStringList *parents,
QString *errorMessage) QString *errorMessage) const
{ {
QString outputText; QString outputText;
QString errorText; QString errorText;
@@ -1578,7 +1627,7 @@ bool GitClient::synchronousParentRevisions(const QString &workingDirectory,
static const char defaultShortLogFormatC[] = "%h (%an \"%s"; static const char defaultShortLogFormatC[] = "%h (%an \"%s";
static const int maxShortLogLength = 120; static const int maxShortLogLength = 120;
QString GitClient::synchronousShortDescription(const QString &workingDirectory, const QString &revision) QString GitClient::synchronousShortDescription(const QString &workingDirectory, const QString &revision) const
{ {
// Short SHA 1, author, subject // Short SHA 1, author, subject
QString output = synchronousShortDescription(workingDirectory, revision, QString output = synchronousShortDescription(workingDirectory, revision,
@@ -1593,7 +1642,7 @@ QString GitClient::synchronousShortDescription(const QString &workingDirectory,
return output; return output;
} }
QString GitClient::synchronousCurrentLocalBranch(const QString &workingDirectory) QString GitClient::synchronousCurrentLocalBranch(const QString &workingDirectory) const
{ {
QByteArray outputTextData; QByteArray outputTextData;
QStringList arguments; QStringList arguments;
@@ -1611,7 +1660,7 @@ QString GitClient::synchronousCurrentLocalBranch(const QString &workingDirectory
} }
bool GitClient::synchronousHeadRefs(const QString &workingDirectory, QStringList *output, bool GitClient::synchronousHeadRefs(const QString &workingDirectory, QStringList *output,
QString *errorMessage) QString *errorMessage) const
{ {
QStringList args; QStringList args;
args << QLatin1String("show-ref") << QLatin1String("--head") args << QLatin1String("show-ref") << QLatin1String("--head")
@@ -1643,7 +1692,7 @@ bool GitClient::synchronousHeadRefs(const QString &workingDirectory, QStringList
} }
// Retrieve topic (branch, tag or HEAD hash) // Retrieve topic (branch, tag or HEAD hash)
QString GitClient::synchronousTopic(const QString &workingDirectory) QString GitClient::synchronousTopic(const QString &workingDirectory) const
{ {
// First try to find branch // First try to find branch
QString branch = synchronousCurrentLocalBranch(workingDirectory); QString branch = synchronousCurrentLocalBranch(workingDirectory);
@@ -1711,7 +1760,7 @@ QString GitClient::synchronousTopRevision(const QString &workingDirectory, QStri
} }
void GitClient::synchronousTagsForCommit(const QString &workingDirectory, const QString &revision, void GitClient::synchronousTagsForCommit(const QString &workingDirectory, const QString &revision,
QString &precedes, QString &follows) QString &precedes, QString &follows) const
{ {
QByteArray pr; QByteArray pr;
QStringList arguments; QStringList arguments;
@@ -1789,7 +1838,7 @@ bool GitClient::isFastForwardMerge(const QString &workingDirectory, const QStrin
// Format an entry in a one-liner for selection list using git log. // Format an entry in a one-liner for selection list using git log.
QString GitClient::synchronousShortDescription(const QString &workingDirectory, const QString &revision, QString GitClient::synchronousShortDescription(const QString &workingDirectory, const QString &revision,
const QString &format) const QString &format) const
{ {
QString description; QString description;
QByteArray outputTextData; QByteArray outputTextData;
@@ -1831,7 +1880,7 @@ static inline QString creatorStashMessage(const QString &keyword = QString())
* StashIgnoreUnchanged: Be quiet about unchanged repositories (used for IVersionControl's snapshots). */ * StashIgnoreUnchanged: Be quiet about unchanged repositories (used for IVersionControl's snapshots). */
QString GitClient::synchronousStash(const QString &workingDirectory, const QString &messageKeyword, QString GitClient::synchronousStash(const QString &workingDirectory, const QString &messageKeyword,
unsigned flags, bool *unchanged) unsigned flags, bool *unchanged) const
{ {
if (unchanged) if (unchanged)
*unchanged = false; *unchanged = false;
@@ -1874,7 +1923,7 @@ QString GitClient::synchronousStash(const QString &workingDirectory, const QStri
bool GitClient::executeSynchronousStash(const QString &workingDirectory, bool GitClient::executeSynchronousStash(const QString &workingDirectory,
const QString &message, const QString &message,
QString *errorMessage) QString *errorMessage) const
{ {
QByteArray outputText; QByteArray outputText;
QByteArray errorText; QByteArray errorText;
@@ -1893,7 +1942,7 @@ bool GitClient::executeSynchronousStash(const QString &workingDirectory,
// Resolve a stash name from message // Resolve a stash name from message
bool GitClient::stashNameFromMessage(const QString &workingDirectory, bool GitClient::stashNameFromMessage(const QString &workingDirectory,
const QString &message, QString *name, const QString &message, QString *name,
QString *errorMessage) QString *errorMessage) const
{ {
// All happy // All happy
if (message.startsWith(QLatin1String(stashNamePrefix))) { if (message.startsWith(QLatin1String(stashNamePrefix))) {
@@ -1917,7 +1966,7 @@ bool GitClient::stashNameFromMessage(const QString &workingDirectory,
} }
bool GitClient::synchronousBranchCmd(const QString &workingDirectory, QStringList branchArgs, bool GitClient::synchronousBranchCmd(const QString &workingDirectory, QStringList branchArgs,
QString *output, QString *errorMessage) QString *output, QString *errorMessage) const
{ {
branchArgs.push_front(QLatin1String("branch")); branchArgs.push_front(QLatin1String("branch"));
QByteArray outputText; QByteArray outputText;
@@ -1931,7 +1980,7 @@ bool GitClient::synchronousBranchCmd(const QString &workingDirectory, QStringLis
} }
bool GitClient::synchronousTagCmd(const QString &workingDirectory, QStringList tagArgs, bool GitClient::synchronousTagCmd(const QString &workingDirectory, QStringList tagArgs,
QString *output, QString *errorMessage) QString *output, QString *errorMessage) const
{ {
tagArgs.push_front(QLatin1String("tag")); tagArgs.push_front(QLatin1String("tag"));
QByteArray outputText; QByteArray outputText;
@@ -1945,7 +1994,7 @@ bool GitClient::synchronousTagCmd(const QString &workingDirectory, QStringList t
} }
bool GitClient::synchronousForEachRefCmd(const QString &workingDirectory, QStringList args, bool GitClient::synchronousForEachRefCmd(const QString &workingDirectory, QStringList args,
QString *output, QString *errorMessage) QString *output, QString *errorMessage) const
{ {
args.push_front(QLatin1String("for-each-ref")); args.push_front(QLatin1String("for-each-ref"));
QByteArray outputText; QByteArray outputText;
@@ -1960,7 +2009,7 @@ bool GitClient::synchronousForEachRefCmd(const QString &workingDirectory, QStrin
} }
bool GitClient::synchronousRemoteCmd(const QString &workingDirectory, QStringList remoteArgs, bool GitClient::synchronousRemoteCmd(const QString &workingDirectory, QStringList remoteArgs,
QString *output, QString *errorMessage, bool silent) QString *output, QString *errorMessage, bool silent) const
{ {
remoteArgs.push_front(QLatin1String("remote")); remoteArgs.push_front(QLatin1String("remote"));
QByteArray outputText; QByteArray outputText;
@@ -1975,7 +2024,7 @@ bool GitClient::synchronousRemoteCmd(const QString &workingDirectory, QStringLis
} }
QMap<QString,QString> GitClient::synchronousRemotesList(const QString &workingDirectory, QMap<QString,QString> GitClient::synchronousRemotesList(const QString &workingDirectory,
QString *errorMessage) QString *errorMessage) const
{ {
QMap<QString,QString> result; QMap<QString,QString> result;
QString output; QString output;
@@ -2001,7 +2050,7 @@ QMap<QString,QString> GitClient::synchronousRemotesList(const QString &workingDi
} }
QStringList GitClient::synchronousSubmoduleStatus(const QString &workingDirectory, QStringList GitClient::synchronousSubmoduleStatus(const QString &workingDirectory,
QString *errorMessage) QString *errorMessage) const
{ {
QByteArray outputTextData; QByteArray outputTextData;
QByteArray errorText; QByteArray errorText;
@@ -2018,7 +2067,7 @@ QStringList GitClient::synchronousSubmoduleStatus(const QString &workingDirector
return commandOutputLinesFromLocal8Bit(outputTextData); return commandOutputLinesFromLocal8Bit(outputTextData);
} }
SubmoduleDataMap GitClient::submoduleList(const QString &workingDirectory) SubmoduleDataMap GitClient::submoduleList(const QString &workingDirectory) const
{ {
SubmoduleDataMap result; SubmoduleDataMap result;
QString gitmodulesFileName = workingDirectory + QLatin1String("/.gitmodules"); QString gitmodulesFileName = workingDirectory + QLatin1String("/.gitmodules");
@@ -2076,7 +2125,7 @@ SubmoduleDataMap GitClient::submoduleList(const QString &workingDirectory)
} }
bool GitClient::synchronousShow(const QString &workingDirectory, const QString &id, bool GitClient::synchronousShow(const QString &workingDirectory, const QString &id,
QString *output, QString *errorMessage) QString *output, QString *errorMessage) const
{ {
if (!canShow(id)) { if (!canShow(id)) {
*errorMessage = msgCannotShow(id); *errorMessage = msgCannotShow(id);
@@ -2253,7 +2302,7 @@ bool GitClient::isValidRevision(const QString &revision) const
Utils::SynchronousProcessResponse GitClient::synchronousGit(const QString &workingDirectory, Utils::SynchronousProcessResponse GitClient::synchronousGit(const QString &workingDirectory,
const QStringList &gitArguments, const QStringList &gitArguments,
unsigned flags, unsigned flags,
QTextCodec *outputCodec) QTextCodec *outputCodec) const
{ {
return VcsBasePlugin::runVcs(workingDirectory, gitExecutable(), gitArguments, return VcsBasePlugin::runVcs(workingDirectory, gitExecutable(), gitArguments,
settings()->intValue(GitSettings::timeoutKey) * 1000, settings()->intValue(GitSettings::timeoutKey) * 1000,
@@ -2339,7 +2388,7 @@ void GitClient::fetchFinished(const QVariant &cookie)
} }
GitClient::StatusResult GitClient::gitStatus(const QString &workingDirectory, StatusMode mode, GitClient::StatusResult GitClient::gitStatus(const QString &workingDirectory, StatusMode mode,
QString *output, QString *errorMessage) QString *output, QString *errorMessage) const
{ {
// Run 'status'. Note that git returns exitcode 1 if there are no added files. // Run 'status'. Note that git returns exitcode 1 if there are no added files.
QByteArray outputText; QByteArray outputText;
@@ -2378,7 +2427,7 @@ GitClient::StatusResult GitClient::gitStatus(const QString &workingDirectory, St
return StatusUnchanged; return StatusUnchanged;
} }
QString GitClient::commandInProgressDescription(const QString &workingDirectory) QString GitClient::commandInProgressDescription(const QString &workingDirectory) const
{ {
switch (checkCommandInProgress(workingDirectory)) { switch (checkCommandInProgress(workingDirectory)) {
case NoCommand: case NoCommand:
@@ -2396,7 +2445,7 @@ QString GitClient::commandInProgressDescription(const QString &workingDirectory)
return QString(); return QString();
} }
GitClient::CommandInProgress GitClient::checkCommandInProgress(const QString &workingDirectory) GitClient::CommandInProgress GitClient::checkCommandInProgress(const QString &workingDirectory) const
{ {
const QString gitDir = findGitDirForRepository(workingDirectory); const QString gitDir = findGitDirForRepository(workingDirectory);
if (QFile::exists(gitDir + QLatin1String("/MERGE_HEAD"))) if (QFile::exists(gitDir + QLatin1String("/MERGE_HEAD")))
@@ -2490,7 +2539,7 @@ void GitClient::continuePreviousGitCommand(const QString &workingDirectory,
} }
} }
QString GitClient::extendedShowDescription(const QString &workingDirectory, const QString &text) QString GitClient::extendedShowDescription(const QString &workingDirectory, const QString &text) const
{ {
if (!text.startsWith(QLatin1String("commit "))) if (!text.startsWith(QLatin1String("commit ")))
return text; return text;
@@ -2509,7 +2558,7 @@ QString GitClient::extendedShowDescription(const QString &workingDirectory, cons
// Quietly retrieve branch list of remote repository URL // Quietly retrieve branch list of remote repository URL
// //
// The branch HEAD is pointing to is always returned first. // The branch HEAD is pointing to is always returned first.
QStringList GitClient::synchronousRepositoryBranches(const QString &repositoryURL) QStringList GitClient::synchronousRepositoryBranches(const QString &repositoryURL) const
{ {
QStringList arguments(QLatin1String("ls-remote")); QStringList arguments(QLatin1String("ls-remote"));
arguments << repositoryURL << QLatin1String(HEAD) << QLatin1String("refs/heads/*"); arguments << repositoryURL << QLatin1String(HEAD) << QLatin1String("refs/heads/*");
@@ -3071,7 +3120,7 @@ void GitClient::fetch(const QString &workingDirectory, const QString &remote)
bool GitClient::executeAndHandleConflicts(const QString &workingDirectory, bool GitClient::executeAndHandleConflicts(const QString &workingDirectory,
const QStringList &arguments, const QStringList &arguments,
const QString &abortCommand) const QString &abortCommand) const
{ {
// Disable UNIX terminals to suppress SSH prompting. // Disable UNIX terminals to suppress SSH prompting.
const unsigned flags = VcsBasePlugin::SshPasswordPrompt const unsigned flags = VcsBasePlugin::SshPasswordPrompt
@@ -3374,7 +3423,7 @@ void GitClient::stashPop(const QString &workingDirectory)
bool GitClient::synchronousStashRestore(const QString &workingDirectory, bool GitClient::synchronousStashRestore(const QString &workingDirectory,
const QString &stash, const QString &stash,
bool pop, bool pop,
const QString &branch /* = QString()*/) const QString &branch /* = QString()*/) const
{ {
QStringList arguments(QLatin1String("stash")); QStringList arguments(QLatin1String("stash"));
if (branch.isEmpty()) if (branch.isEmpty())
@@ -3386,7 +3435,7 @@ bool GitClient::synchronousStashRestore(const QString &workingDirectory,
bool GitClient::synchronousStashRemove(const QString &workingDirectory, bool GitClient::synchronousStashRemove(const QString &workingDirectory,
const QString &stash /* = QString() */, const QString &stash /* = QString() */,
QString *errorMessage /* = 0 */) QString *errorMessage /* = 0 */) const
{ {
QStringList arguments(QLatin1String("stash")); QStringList arguments(QLatin1String("stash"));
if (stash.isEmpty()) if (stash.isEmpty())
@@ -3408,7 +3457,7 @@ bool GitClient::synchronousStashRemove(const QString &workingDirectory,
bool GitClient::synchronousStashList(const QString &workingDirectory, bool GitClient::synchronousStashList(const QString &workingDirectory,
QList<Stash> *stashes, QList<Stash> *stashes,
QString *errorMessage /* = 0 */) QString *errorMessage /* = 0 */) const
{ {
stashes->clear(); stashes->clear();
QStringList arguments(QLatin1String("stash")); QStringList arguments(QLatin1String("stash"));

View File

@@ -139,16 +139,16 @@ public:
Utils::FileName gitExecutable(bool *ok = 0, QString *errorMessage = 0) const; Utils::FileName gitExecutable(bool *ok = 0, QString *errorMessage = 0) const;
unsigned gitVersion(QString *errorMessage = 0) const; unsigned gitVersion(QString *errorMessage = 0) const;
QString findRepositoryForDirectory(const QString &dir); QString findRepositoryForDirectory(const QString &dir) const;
QString findGitDirForRepository(const QString &repositoryDir) const; QString findGitDirForRepository(const QString &repositoryDir) const;
bool managesFile(const QString &workingDirectory, const QString &fileName) const; bool managesFile(const QString &workingDirectory, const QString &fileName) const;
void diff(const QString &workingDirectory, const QString &fileName); void diff(const QString &workingDirectory, const QString &fileName) const;
void diff(const QString &workingDirectory, void diff(const QString &workingDirectory,
const QStringList &unstagedFileNames, const QStringList &unstagedFileNames,
const QStringList &stagedFileNames = QStringList()); const QStringList &stagedFileNames = QStringList()) const;
void diffBranch(const QString &workingDirectory, void diffBranch(const QString &workingDirectory,
const QString &branchName); const QString &branchName) const;
void merge(const QString &workingDirectory, const QStringList &unmergedFileNames = QStringList()); void merge(const QString &workingDirectory, const QStringList &unmergedFileNames = QStringList());
void status(const QString &workingDirectory); void status(const QString &workingDirectory);
@@ -193,57 +193,57 @@ public:
enum { StashPromptDescription = 0x1, StashImmediateRestore = 0x2, StashIgnoreUnchanged = 0x4 }; enum { StashPromptDescription = 0x1, StashImmediateRestore = 0x2, StashIgnoreUnchanged = 0x4 };
QString synchronousStash(const QString &workingDirectory, QString synchronousStash(const QString &workingDirectory,
const QString &messageKeyword = QString(), const QString &messageKeyword = QString(),
unsigned flags = 0, bool *unchanged = 0); unsigned flags = 0, bool *unchanged = 0) const;
bool executeSynchronousStash(const QString &workingDirectory, bool executeSynchronousStash(const QString &workingDirectory,
const QString &message = QString(), const QString &message = QString(),
QString *errorMessage = 0); QString *errorMessage = 0) const;
bool synchronousStashRestore(const QString &workingDirectory, bool synchronousStashRestore(const QString &workingDirectory,
const QString &stash, const QString &stash,
bool pop = false, bool pop = false,
const QString &branch = QString()); const QString &branch = QString()) const;
bool synchronousStashRemove(const QString &workingDirectory, bool synchronousStashRemove(const QString &workingDirectory,
const QString &stash = QString(), const QString &stash = QString(),
QString *errorMessage = 0); QString *errorMessage = 0) const;
bool synchronousBranchCmd(const QString &workingDirectory, QStringList branchArgs, bool synchronousBranchCmd(const QString &workingDirectory, QStringList branchArgs,
QString *output, QString *errorMessage); QString *output, QString *errorMessage) const;
bool synchronousTagCmd(const QString &workingDirectory, QStringList tagArgs, bool synchronousTagCmd(const QString &workingDirectory, QStringList tagArgs,
QString *output, QString *errorMessage); QString *output, QString *errorMessage) const;
bool synchronousForEachRefCmd(const QString &workingDirectory, QStringList args, bool synchronousForEachRefCmd(const QString &workingDirectory, QStringList args,
QString *output, QString *errorMessage = 0); QString *output, QString *errorMessage = 0) const;
bool synchronousRemoteCmd(const QString &workingDirectory, QStringList remoteArgs, bool synchronousRemoteCmd(const QString &workingDirectory, QStringList remoteArgs,
QString *output, QString *errorMessage, bool silent = false); QString *output, QString *errorMessage, bool silent = false) const;
QMap<QString,QString> synchronousRemotesList(const QString &workingDirectory, QMap<QString,QString> synchronousRemotesList(const QString &workingDirectory,
QString *errorMessage = 0); QString *errorMessage = 0) const;
QStringList synchronousSubmoduleStatus(const QString &workingDirectory, QStringList synchronousSubmoduleStatus(const QString &workingDirectory,
QString *errorMessage = 0); QString *errorMessage = 0) const;
SubmoduleDataMap submoduleList(const QString &workingDirectory); SubmoduleDataMap submoduleList(const QString &workingDirectory) const;
bool synchronousShow(const QString &workingDirectory, const QString &id, bool synchronousShow(const QString &workingDirectory, const QString &id,
QString *output, QString *errorMessage); QString *output, QString *errorMessage) const;
bool synchronousRevListCmd(const QString &workingDirectory, const QStringList &arguments, bool synchronousRevListCmd(const QString &workingDirectory, const QStringList &arguments,
QString *output, QString *errorMessage = 0); QString *output, QString *errorMessage = 0) const;
bool synchronousParentRevisions(const QString &workingDirectory, bool synchronousParentRevisions(const QString &workingDirectory,
const QStringList &files /* = QStringList() */, const QStringList &files /* = QStringList() */,
const QString &revision, const QString &revision,
QStringList *parents, QStringList *parents,
QString *errorMessage); QString *errorMessage) const;
QString synchronousShortDescription(const QString &workingDirectory, const QString &revision); QString synchronousShortDescription(const QString &workingDirectory, const QString &revision) const;
QString synchronousShortDescription(const QString &workingDirectory, const QString &revision, QString synchronousShortDescription(const QString &workingDirectory, const QString &revision,
const QString &format); const QString &format) const;
QString synchronousCurrentLocalBranch(const QString &workingDirectory); QString synchronousCurrentLocalBranch(const QString &workingDirectory) const;
bool synchronousHeadRefs(const QString &workingDirectory, QStringList *output, bool synchronousHeadRefs(const QString &workingDirectory, QStringList *output,
QString *errorMessage = 0); QString *errorMessage = 0) const;
QString synchronousTopic(const QString &workingDirectory); QString synchronousTopic(const QString &workingDirectory) const;
bool synchronousRevParseCmd(const QString &workingDirectory, const QString &ref, bool synchronousRevParseCmd(const QString &workingDirectory, const QString &ref,
QString *output, QString *errorMessage = 0) const; QString *output, QString *errorMessage = 0) const;
QString synchronousTopRevision(const QString &workingDirectory, QString *errorMessage = 0); QString synchronousTopRevision(const QString &workingDirectory, QString *errorMessage = 0);
void synchronousTagsForCommit(const QString &workingDirectory, const QString &revision, void synchronousTagsForCommit(const QString &workingDirectory, const QString &revision,
QString &precedes, QString &follows); QString &precedes, QString &follows) const;
bool isRemoteCommit(const QString &workingDirectory, const QString &commit); bool isRemoteCommit(const QString &workingDirectory, const QString &commit);
bool isFastForwardMerge(const QString &workingDirectory, const QString &branch); bool isFastForwardMerge(const QString &workingDirectory, const QString &branch);
@@ -279,11 +279,11 @@ public:
void revert(const QStringList &files, bool revertStaging); void revert(const QStringList &files, bool revertStaging);
bool synchronousStashList(const QString &workingDirectory, bool synchronousStashList(const QString &workingDirectory,
QList<Stash> *stashes, QList<Stash> *stashes,
QString *errorMessage = 0); QString *errorMessage = 0) const;
// Resolve a stash name from message (for IVersionControl's names). // Resolve a stash name from message (for IVersionControl's names).
bool stashNameFromMessage(const QString &workingDirectory, bool stashNameFromMessage(const QString &workingDirectory,
const QString &messge, QString *name, const QString &messge, QString *name,
QString *errorMessage = 0); QString *errorMessage = 0) const;
QString readConfigValue(const QString &workingDirectory, const QString &configVar) const; QString readConfigValue(const QString &workingDirectory, const QString &configVar) const;
@@ -305,14 +305,14 @@ public:
StatusResult gitStatus(const QString &workingDirectory, StatusResult gitStatus(const QString &workingDirectory,
StatusMode mode, StatusMode mode,
QString *output = 0, QString *output = 0,
QString *errorMessage = 0); QString *errorMessage = 0) const;
CommandInProgress checkCommandInProgress(const QString &workingDirectory); CommandInProgress checkCommandInProgress(const QString &workingDirectory) const;
QString commandInProgressDescription(const QString &workingDirectory); QString commandInProgressDescription(const QString &workingDirectory) const;
void continueCommandIfNeeded(const QString &workingDirectory, bool allowContinue = true); void continueCommandIfNeeded(const QString &workingDirectory, bool allowContinue = true);
QString extendedShowDescription(const QString &workingDirectory, const QString &text); QString extendedShowDescription(const QString &workingDirectory, const QString &text) const;
void launchGitK(const QString &workingDirectory, const QString &fileName); void launchGitK(const QString &workingDirectory, const QString &fileName);
void launchGitK(const QString &workingDirectory) { launchGitK(workingDirectory, QString()); } void launchGitK(const QString &workingDirectory) { launchGitK(workingDirectory, QString()); }
@@ -321,7 +321,7 @@ public:
void launchRepositoryBrowser(const QString &workingDirectory); void launchRepositoryBrowser(const QString &workingDirectory);
QStringList synchronousRepositoryBranches(const QString &repositoryURL); QStringList synchronousRepositoryBranches(const QString &repositoryURL) const;
GitSettings *settings() const; GitSettings *settings() const;
@@ -397,7 +397,7 @@ private:
// log windows updating (using VcsBasePlugin::runVcs with flags). // log windows updating (using VcsBasePlugin::runVcs with flags).
inline Utils::SynchronousProcessResponse inline Utils::SynchronousProcessResponse
synchronousGit(const QString &workingDirectory, const QStringList &arguments, synchronousGit(const QString &workingDirectory, const QStringList &arguments,
unsigned flags = 0, QTextCodec *outputCodec = 0); unsigned flags = 0, QTextCodec *outputCodec = 0) const;
// determine version as '(major << 16) + (minor << 8) + patch' or 0. // determine version as '(major << 16) + (minor << 8) + patch' or 0.
unsigned synchronousGitVersion(QString *errorMessage = 0) const; unsigned synchronousGitVersion(QString *errorMessage = 0) const;
@@ -409,7 +409,7 @@ private:
bool revertStaging); bool revertStaging);
void connectRepositoryChanged(const QString & repository, VcsBase::Command *cmd); void connectRepositoryChanged(const QString & repository, VcsBase::Command *cmd);
bool executeAndHandleConflicts(const QString &workingDirectory, const QStringList &arguments, bool executeAndHandleConflicts(const QString &workingDirectory, const QStringList &arguments,
const QString &abortCommand = QString()); const QString &abortCommand = QString()) const;
bool tryLauchingGitK(const QProcessEnvironment &env, bool tryLauchingGitK(const QProcessEnvironment &env,
const QString &workingDirectory, const QString &workingDirectory,
const QString &fileName, const QString &fileName,

View File

@@ -63,7 +63,7 @@ static int compareVersions(const QString &v1, const QString &v2)
QStringList v1L = v1.split(QLatin1Char('.')); QStringList v1L = v1.split(QLatin1Char('.'));
QStringList v2L = v2.split(QLatin1Char('.')); QStringList v2L = v2.split(QLatin1Char('.'));
int i = 0; int i = 0;
while (v1.length() > i && v1.length() > i) { while (v1L.length() > i && v2L.length() > i) {
bool n1Ok, n2Ok; bool n1Ok, n2Ok;
int n1 = v1L.value(i).toInt(&n1Ok); int n1 = v1L.value(i).toInt(&n1Ok);
int n2 = v2L.value(i).toInt(&n2Ok); int n2 = v2L.value(i).toInt(&n2Ok);
@@ -77,9 +77,9 @@ static int compareVersions(const QString &v1, const QString &v2)
return 1; return 1;
++i; ++i;
} }
if (v1.length() > v2.length()) if (v1L.length() > v2L.length())
return -1; return -1;
if (v1.length() < v2.length()) if (v1L.length() < v2L.length())
return 1; return 1;
return 0; return 0;
} }

View File

@@ -32,8 +32,11 @@
#include "projectexplorer.h" #include "projectexplorer.h"
#include "project.h" #include "project.h"
#include <utils/algorithm.h>
#include <coreplugin/id.h> #include <coreplugin/id.h>
#include <coreplugin/icore.h> #include <coreplugin/icore.h>
#include <coreplugin/editormanager/editormanager.h>
#include <texteditor/basetexteditor.h> #include <texteditor/basetexteditor.h>
#include <texteditor/texteditorsettings.h> #include <texteditor/texteditorsettings.h>
#include <texteditor/simplecodestylepreferences.h> #include <texteditor/simplecodestylepreferences.h>
@@ -82,6 +85,7 @@ struct EditorConfigurationPrivate
QTextCodec *m_textCodec; QTextCodec *m_textCodec;
QMap<Core::Id, ICodeStylePreferences *> m_languageCodeStylePreferences; QMap<Core::Id, ICodeStylePreferences *> m_languageCodeStylePreferences;
QList<BaseTextEditor *> m_editors;
}; };
EditorConfiguration::EditorConfiguration() : d(new EditorConfigurationPrivate) EditorConfiguration::EditorConfiguration() : d(new EditorConfigurationPrivate)
@@ -116,6 +120,8 @@ EditorConfiguration::EditorConfiguration() : d(new EditorConfigurationPrivate)
connect(SessionManager::instance(), SIGNAL(aboutToRemoveProject(ProjectExplorer::Project*)), connect(SessionManager::instance(), SIGNAL(aboutToRemoveProject(ProjectExplorer::Project*)),
this, SLOT(slotAboutToRemoveProject(ProjectExplorer::Project*))); this, SLOT(slotAboutToRemoveProject(ProjectExplorer::Project*)));
connect(Core::EditorManager::instance(), SIGNAL(editorsClosed(QList<Core::IEditor*>)),
this, SLOT(editorsClosed(QList<Core::IEditor*>)));
} }
EditorConfiguration::~EditorConfiguration() EditorConfiguration::~EditorConfiguration()
@@ -256,6 +262,7 @@ void EditorConfiguration::configureEditor(BaseTextEditor *textEditor) const
if (widget) if (widget)
switchSettings(widget); switchSettings(widget);
} }
d->m_editors.append(textEditor);
} }
void EditorConfiguration::deconfigureEditor(BaseTextEditor *textEditor) const void EditorConfiguration::deconfigureEditor(BaseTextEditor *textEditor) const
@@ -264,6 +271,8 @@ void EditorConfiguration::deconfigureEditor(BaseTextEditor *textEditor) const
if (widget) if (widget)
widget->setCodeStyle(TextEditorSettings::codeStyle(widget->languageSettingsId())); widget->setCodeStyle(TextEditorSettings::codeStyle(widget->languageSettingsId()));
d->m_editors.removeOne(textEditor);
// TODO: what about text codec and switching settings? // TODO: what about text codec and switching settings?
} }
@@ -384,16 +393,15 @@ void EditorConfiguration::slotAboutToRemoveProject(ProjectExplorer::Project *pro
if (project->editorConfiguration() != this) if (project->editorConfiguration() != this)
return; return;
foreach (Core::IEditor *editor, Core::DocumentModel::editorsForOpenedDocuments()) { foreach (TextEditor::BaseTextEditor *editor, d->m_editors)
if (TextEditor::BaseTextEditor *textEditor = qobject_cast<TextEditor::BaseTextEditor*>(editor)) { deconfigureEditor(editor);
Core::IDocument *document = editor->document(); }
if (document) {
Project *editorProject = SessionManager::projectForFile(document->filePath()); void EditorConfiguration::editorsClosed(const QList<Core::IEditor*> &closedEditors)
if (project == editorProject) {
deconfigureEditor(textEditor); Utils::erase(d->m_editors, [&closedEditors](Core::IEditor *editor) {
} return closedEditors.contains(editor);
} });
}
} }
TabSettings actualTabSettings(const QString &fileName, TabSettings actualTabSettings(const QString &fileName,

View File

@@ -35,7 +35,10 @@
#include <QObject> #include <QObject>
#include <QVariantMap> #include <QVariantMap>
namespace Core { class Id; } namespace Core {
class IEditor;
class Id;
}
namespace TextEditor { namespace TextEditor {
class BaseTextEditor; class BaseTextEditor;
@@ -107,6 +110,7 @@ private slots:
void setTextCodec(QTextCodec *textCodec); void setTextCodec(QTextCodec *textCodec);
void slotAboutToRemoveProject(ProjectExplorer::Project *project); void slotAboutToRemoveProject(ProjectExplorer::Project *project);
void editorsClosed(const QList<Core::IEditor*> &closedEditors);
private: private:
void switchSettings(TextEditor::BaseTextEditorWidget *baseTextEditor) const; void switchSettings(TextEditor::BaseTextEditorWidget *baseTextEditor) const;

View File

@@ -115,8 +115,10 @@ void BestNodeSelector::inspect(AddNewTree *tree)
const int projectDirectorySize = projectDirectory.size(); const int projectDirectorySize = projectDirectory.size();
if (!m_commonDirectory.startsWith(projectDirectory)) if (!m_commonDirectory.startsWith(projectDirectory))
return; return;
bool betterMatch = projectDirectorySize > m_bestMatchLength bool betterMatch = tree->priority() > 0
|| (projectDirectorySize == m_bestMatchLength && tree->priority() > m_bestMatchPriority); && (projectDirectorySize > m_bestMatchLength
|| (projectDirectorySize == m_bestMatchLength && tree->priority() > m_bestMatchPriority));
if (betterMatch) { if (betterMatch) {
m_bestMatchPriority = tree->priority(); m_bestMatchPriority = tree->priority();
m_bestMatchLength = projectDirectorySize; m_bestMatchLength = projectDirectorySize;

View File

@@ -163,6 +163,10 @@ QVariantMap DefaultPropertyProvider::properties(const ProjectExplorer::Kit *k, c
if (!toolchainPrefix.isEmpty()) if (!toolchainPrefix.isEmpty())
data.insert(QLatin1String(CPP_TOOLCHAINPREFIX), toolchainPrefix); data.insert(QLatin1String(CPP_TOOLCHAINPREFIX), toolchainPrefix);
data.insert(QLatin1String(CPP_COMPILERNAME), compilerName); data.insert(QLatin1String(CPP_COMPILERNAME), compilerName);
if (targetAbi.os() != ProjectExplorer::Abi::WindowsOS
|| targetAbi.osFlavor() == ProjectExplorer::Abi::WindowsMSysFlavor) {
data.insert(QLatin1String(CPP_LINKERNAME), compilerName);
}
data.insert(QLatin1String(CPP_TOOLCHAINPATH), cxxFileInfo.absolutePath()); data.insert(QLatin1String(CPP_TOOLCHAINPATH), cxxFileInfo.absolutePath());
if (targetAbi.osFlavor() == ProjectExplorer::Abi::WindowsMsvc2013Flavor) { if (targetAbi.osFlavor() == ProjectExplorer::Abi::WindowsMsvc2013Flavor) {
const QLatin1String flags("/FS"); const QLatin1String flags("/FS");

View File

@@ -42,6 +42,7 @@ const char QBS_TOOLCHAIN[] = "qbs.toolchain";
const char CPP_TOOLCHAINPATH[] = "cpp.toolchainInstallPath"; const char CPP_TOOLCHAINPATH[] = "cpp.toolchainInstallPath";
const char CPP_TOOLCHAINPREFIX[] = "cpp.toolchainPrefix"; const char CPP_TOOLCHAINPREFIX[] = "cpp.toolchainPrefix";
const char CPP_COMPILERNAME[] = "cpp.compilerName"; const char CPP_COMPILERNAME[] = "cpp.compilerName";
const char CPP_LINKERNAME[] = "cpp.linkerName";
const char CPP_PLATFORMCFLAGS[] = "cpp.platformCFlags"; const char CPP_PLATFORMCFLAGS[] = "cpp.platformCFlags";
const char CPP_PLATFORMCXXFLAGS[] = "cpp.platformCxxFlags"; const char CPP_PLATFORMCXXFLAGS[] = "cpp.platformCxxFlags";
const char CPP_XCODESDKNAME[] = "cpp.xcodeSdkName"; const char CPP_XCODESDKNAME[] = "cpp.xcodeSdkName";

View File

@@ -749,6 +749,13 @@ void QbsProject::updateApplicationTargets(const qbs::ProjectData &projectData)
{ {
ProjectExplorer::BuildTargetInfoList applications; ProjectExplorer::BuildTargetInfoList applications;
foreach (const qbs::ProductData &productData, projectData.allProducts()) { foreach (const qbs::ProductData &productData, projectData.allProducts()) {
if (!productData.isEnabled() || !productData.isRunnable())
continue;
if (productData.targetArtifacts().isEmpty()) { // No build yet.
applications.list << ProjectExplorer::BuildTargetInfo(Utils::FileName(),
Utils::FileName::fromString(productData.location().fileName()));
continue;
}
foreach (const qbs::TargetArtifact &ta, productData.targetArtifacts()) { foreach (const qbs::TargetArtifact &ta, productData.targetArtifacts()) {
QTC_ASSERT(ta.isValid(), continue); QTC_ASSERT(ta.isValid(), continue);
if (!ta.isExecutable()) if (!ta.isExecutable())

View File

@@ -76,6 +76,7 @@ QtcPlugin {
"qbscleanstep.cpp", "qbscleanstep.cpp",
"qbscleanstep.h", "qbscleanstep.h",
"qbscleanstepconfigwidget.ui", "qbscleanstepconfigwidget.ui",
"qbsconstants.h",
"qbsdeployconfigurationfactory.cpp", "qbsdeployconfigurationfactory.cpp",
"qbsdeployconfigurationfactory.h", "qbsdeployconfigurationfactory.h",
"qbsinstallstep.cpp", "qbsinstallstep.cpp",

View File

@@ -228,8 +228,11 @@ QString CreateAndroidManifestWizard::sourceFileName() const
return srcFolder; return srcFolder;
Utils::FileName srcPath Utils::FileName srcPath
= Utils::FileName::fromString(srcFolder) = Utils::FileName::fromString(srcFolder)
.appendPath(QLatin1String("src/android/java")); .appendPath(QLatin1String("src/android"));
srcPath.appendPath(QLatin1String("AndroidManifest.xml")); if (QFile::exists(srcPath.toString() + QLatin1String("/templates/AndroidManifest.xml")))
srcPath.appendPath(QLatin1String("/templates/AndroidManifest.xml"));
else
srcPath.appendPath(QLatin1String("/java/AndroidManifest.xml"));
return srcPath.toString(); return srcPath.toString();
} }

View File

@@ -597,7 +597,7 @@ static QString generatePreTargetDepsSnippet(AddLibraryWizard::Platforms platform
generatedPlatforms |= windowsPlatforms; generatedPlatforms |= windowsPlatforms;
} else { } else {
if (windowsPlatforms & AddLibraryWizard::WindowsMSVCPlatform) { if (windowsPlatforms & AddLibraryWizard::WindowsMSVCPlatform) {
str << "win32:!win32-g++ " << preTargetDepsSnippet << libName << ".lib\n"; str << "win32:!win32-g++: " << preTargetDepsSnippet << libName << ".lib\n";
generatedPlatforms |= AddLibraryWizard::WindowsMSVCPlatform; // mingw will be handled with common scopes generatedPlatforms |= AddLibraryWizard::WindowsMSVCPlatform; // mingw will be handled with common scopes
} }
// mingw not generated yet, will be joined with unix like // mingw not generated yet, will be joined with unix like

View File

@@ -1289,10 +1289,13 @@ QStringList QmakePriFileNode::varNames(ProjectExplorer::FileType type, QtSupport
break; break;
case ProjectExplorer::QMLType: case ProjectExplorer::QMLType:
vars << QLatin1String("OTHER_FILES"); vars << QLatin1String("OTHER_FILES");
vars << QLatin1String("DISTFILES");
break; break;
default: default:
vars << QLatin1String("OTHER_FILES"); vars << QLatin1String("OTHER_FILES");
vars << QLatin1String("DISTFILES");
vars << QLatin1String("ICON"); vars << QLatin1String("ICON");
vars << QLatin1String("QMAKE_INFO_PLIST");
break; break;
} }
return vars; return vars;
@@ -1353,6 +1356,7 @@ QStringList QmakePriFileNode::varNamesForRemoving()
vars << QLatin1String("SUBDIRS"); vars << QLatin1String("SUBDIRS");
vars << QLatin1String("OTHER_FILES"); vars << QLatin1String("OTHER_FILES");
vars << QLatin1String("ICON"); vars << QLatin1String("ICON");
vars << QLatin1String("QMAKE_INFO_PLIST");
return vars; return vars;
} }

View File

@@ -31,6 +31,8 @@
#include <utils/qtcassert.h> #include <utils/qtcassert.h>
#include <utils/fileutils.h> #include <utils/fileutils.h>
#include <extensionsystem/pluginmanager.h>
#include <extensionsystem/pluginspec.h>
#include <QDebug> #include <QDebug>
#include <QDir> #include <QDir>
@@ -173,6 +175,12 @@ class TemplateInfoList
public: public:
TemplateInfoList() TemplateInfoList()
{ {
QSet<QString> availablePlugins;
foreach (ExtensionSystem::PluginSpec *s, ExtensionSystem::PluginManager::plugins()) {
if (s->state() == ExtensionSystem::PluginSpec::Running && !s->hasError())
availablePlugins += s->name();
}
QMultiMap<QString, TemplateInfo> multiMap; QMultiMap<QString, TemplateInfo> multiMap;
foreach (const QString &templateName, templateNames()) { foreach (const QString &templateName, templateNames()) {
const QString templatePath = templateRootDirectory() + templateName; const QString templatePath = templateRootDirectory() + templateName;
@@ -185,7 +193,17 @@ public:
info.templateName = templateName; info.templateName = templateName;
info.templatePath = templatePath; info.templatePath = templatePath;
QXmlStreamReader reader(&xmlFile); QXmlStreamReader reader(&xmlFile);
if (parseTemplateXml(reader, &info)) if (!parseTemplateXml(reader, &info))
continue;
bool ok = true;
foreach (const QString &neededPlugin, info.requiredPlugins) {
if (!availablePlugins.contains(neededPlugin)) {
ok = false;
break;
}
}
if (ok)
multiMap.insert(info.priority, info); multiMap.insert(info.priority, info);
} }
m_templateInfoList = multiMap.values(); m_templateInfoList = multiMap.values();

View File

@@ -71,6 +71,8 @@ QtQuickAppWizardDialog::QtQuickAppWizardDialog(QWidget *parent,
addPage(m_componentSetPage); addPage(m_componentSetPage);
addKitsPage(); addKitsPage();
setRequiredFeatures(Core::Feature(QtSupport::Constants::FEATURE_QT_QUICK));
} }
void QtQuickAppWizardDialog::initializePage(int id) void QtQuickAppWizardDialog::initializePage(int id)

View File

@@ -30,8 +30,6 @@
#include "qtquickappwizardpages.h" #include "qtquickappwizardpages.h"
#include <utils/wizard.h> #include <utils/wizard.h>
#include <extensionsystem/pluginmanager.h>
#include <extensionsystem/pluginspec.h>
#include <QComboBox> #include <QComboBox>
#include <QLabel> #include <QLabel>
@@ -58,23 +56,8 @@ QtQuickComponentSetPage::QtQuickComponentSetPage(QWidget *parent)
QLabel *label = new QLabel(tr("Qt Quick component set:"), this); QLabel *label = new QLabel(tr("Qt Quick component set:"), this);
d->m_versionComboBox = new QComboBox(this); d->m_versionComboBox = new QComboBox(this);
QSet<QString> availablePlugins; foreach (const TemplateInfo &templateInfo, QtQuickApp::templateInfos())
foreach (ExtensionSystem::PluginSpec *s, ExtensionSystem::PluginManager::plugins()) { d->m_versionComboBox->addItem(templateInfo.displayName);
if (s->state() == ExtensionSystem::PluginSpec::Running && !s->hasError())
availablePlugins += s->name();
}
foreach (const TemplateInfo &templateInfo, QtQuickApp::templateInfos()) {
bool ok = true;
foreach (const QString &neededPlugin, templateInfo.requiredPlugins) {
if (!availablePlugins.contains(neededPlugin)) {
ok = false;
break;
}
}
if (ok)
d->m_versionComboBox->addItem(templateInfo.displayName);
}
l->addWidget(label); l->addWidget(label);
l->addWidget(d->m_versionComboBox); l->addWidget(d->m_versionComboBox);

View File

@@ -212,9 +212,19 @@ void DebugView::rootNodeTypeChanged(const QString &type, int majorVersion, int m
} }
} }
void DebugView::selectedNodesChanged(const QList<ModelNode> & /*selectedNodeList*/, void DebugView::selectedNodesChanged(const QList<ModelNode> &selectedNodes /*selectedNodeList*/,
const QList<ModelNode> & /*lastSelectedNodeList*/) const QList<ModelNode> & /*lastSelectedNodeList*/)
{ {
foreach (const ModelNode &selectedNode, selectedNodes) {
QTextStream message;
QString string;
message.setString(&string);
message << selectedNode;
foreach (const VariantProperty &property, selectedNode.variantProperties()) {
message << property;
}
log(tr("Node selected:"), string);
}
} }
void DebugView::scriptFunctionsChanged(const ModelNode & /*node*/, const QStringList & /*scriptFunctionList*/) void DebugView::scriptFunctionsChanged(const ModelNode & /*node*/, const QStringList & /*scriptFunctionList*/)

View File

@@ -31,6 +31,7 @@
#include "nodemetainfo.h" #include "nodemetainfo.h"
#include <QSet> #include <QSet>
#include <QPen>
namespace QmlDesigner { namespace QmlDesigner {
@@ -95,13 +96,14 @@ void ContentNotEditableIndicator::addAddiationEntries(const QList<FormEditorItem
if (!m_entryList.contains(EntryPair(formEditorItem, 0))) { if (!m_entryList.contains(EntryPair(formEditorItem, 0))) {
QGraphicsRectItem *indicatorShape = new QGraphicsRectItem(m_layerItem); QGraphicsRectItem *indicatorShape = new QGraphicsRectItem(m_layerItem);
QPen linePen;
linePen.setColor("#a0a0a0");
indicatorShape->setPen(linePen);
QRectF boundingRectangleInSceneSpace = formEditorItem->qmlItemNode().instanceSceneTransform().mapRect(formEditorItem->qmlItemNode().instanceBoundingRect()); QRectF boundingRectangleInSceneSpace = formEditorItem->qmlItemNode().instanceSceneTransform().mapRect(formEditorItem->qmlItemNode().instanceBoundingRect());
indicatorShape->setRect(boundingRectangleInSceneSpace); indicatorShape->setRect(boundingRectangleInSceneSpace);
static QBrush brush(QColor(0, 0, 0, 130), Qt::BDiagPattern); static QBrush brush(QColor(0, 0, 0, 10), Qt::BDiagPattern);
indicatorShape->setBrush(brush); indicatorShape->setBrush(brush);
formEditorItem->blurContent(true);
m_entryList.append(EntryPair(formEditorItem, indicatorShape)); m_entryList.append(EntryPair(formEditorItem, indicatorShape));
} }

View File

@@ -81,7 +81,7 @@ void DragTool::keyPressEvent(QKeyEvent *event)
if (event->key() == Qt::Key_Escape) { if (event->key() == Qt::Key_Escape) {
abort(); abort();
event->accept(); event->accept();
m_rewriterTransaction.commit(); commitTransaction();
view()->changeToSelectionTool(); view()->changeToSelectionTool();
} }
} }
@@ -232,7 +232,7 @@ void DragTool::dropEvent(const QList<QGraphicsItem*> &/*itemList*/, QGraphicsSce
event->accept(); event->accept();
end(generateUseSnapping(event->modifiers())); end(generateUseSnapping(event->modifiers()));
m_rewriterTransaction.commit(); commitTransaction();
if (m_dragNode.isValid()) if (m_dragNode.isValid())
view()->setSelectedModelNode(m_dragNode); view()->setSelectedModelNode(m_dragNode);
@@ -282,7 +282,7 @@ void DragTool::dragLeaveEvent(const QList<QGraphicsItem*> &/*itemList*/, QGraphi
if (m_dragNode.isValid()) if (m_dragNode.isValid())
m_dragNode.destroy(); m_dragNode.destroy();
m_rewriterTransaction.commit(); commitTransaction();
view()->changeToSelectionTool(); view()->changeToSelectionTool();
} }
@@ -361,4 +361,13 @@ void DragTool::move(const QPointF &scenePosition, const QList<QGraphicsItem*> &
} }
} }
void DragTool::commitTransaction()
{
try {
m_rewriterTransaction.commit();
} catch (RewritingException &e) {
e.showException();
}
}
} }

View File

@@ -91,6 +91,7 @@ protected:
void end(Snapper::Snapping useSnapping); void end(Snapper::Snapping useSnapping);
void move(const QPointF &scenePos, const QList<QGraphicsItem *> &itemList); void move(const QPointF &scenePos, const QList<QGraphicsItem *> &itemList);
void createDragNode(const QMimeData *mimeData, const QPointF &scenePosition, const QList<QGraphicsItem *> &itemList); void createDragNode(const QMimeData *mimeData, const QPointF &scenePosition, const QList<QGraphicsItem *> &itemList);
void commitTransaction();
private: private:
MoveManipulator m_moveManipulator; MoveManipulator m_moveManipulator;

View File

@@ -646,7 +646,7 @@ void FormEditorView::delayedReset()
m_resizeTool->clear(); m_resizeTool->clear();
m_dragTool->clear(); m_dragTool->clear();
m_scene->clearFormEditorItems(); m_scene->clearFormEditorItems();
if (QmlItemNode::isValidQmlItemNode(rootModelNode())) if (isAttached() && QmlItemNode::isValidQmlItemNode(rootModelNode()))
setupFormEditorItemTree(rootModelNode()); setupFormEditorItemTree(rootModelNode());
} }

View File

@@ -92,6 +92,9 @@ void ImportsWidget::removeUsedImports()
static bool importLess(const Import &firstImport, const Import &secondImport) static bool importLess(const Import &firstImport, const Import &secondImport)
{ {
if (firstImport.url() == secondImport.url())
return firstImport.toString() < secondImport.toString();
if (firstImport.url() == "QtQuick") if (firstImport.url() == "QtQuick")
return true; return true;

View File

@@ -422,6 +422,8 @@ void DesignDocument::cutSelected()
static void scatterItem(const ModelNode &pastedNode, const ModelNode &targetNode, int offset = -2000) static void scatterItem(const ModelNode &pastedNode, const ModelNode &targetNode, int offset = -2000)
{ {
if (targetNode.metaInfo().isValid() && targetNode.metaInfo().isLayoutable())
return;
bool scatter = false; bool scatter = false;
foreach (const ModelNode &childNode, targetNode.directSubModelNodes()) { foreach (const ModelNode &childNode, targetNode.directSubModelNodes()) {

View File

@@ -50,8 +50,11 @@
#include <QtDebug> #include <QtDebug>
#define DISABLE_VISIBLE_PROPERTIES
namespace QmlDesigner { namespace QmlDesigner {
#ifndef DISABLE_VISIBLE_PROPERTIES
static PropertyNameList visibleProperties(const ModelNode &node) static PropertyNameList visibleProperties(const ModelNode &node)
{ {
PropertyNameList propertyList; PropertyNameList propertyList;
@@ -75,6 +78,7 @@ static PropertyNameList visibleProperties(const ModelNode &node)
return propertyList; return propertyList;
} }
#endif
static QList<ModelNode> acceptedModelNodeChildren(const ModelNode &parentNode) static QList<ModelNode> acceptedModelNodeChildren(const ModelNode &parentNode)
{ {
@@ -84,7 +88,9 @@ static QList<ModelNode> acceptedModelNodeChildren(const ModelNode &parentNode)
if (parentNode.metaInfo().hasDefaultProperty()) if (parentNode.metaInfo().hasDefaultProperty())
properties.append(parentNode.metaInfo().defaultPropertyName()); properties.append(parentNode.metaInfo().defaultPropertyName());
#ifndef DISABLE_VISIBLE_PROPERTIES
properties.append(visibleProperties(parentNode)); properties.append(visibleProperties(parentNode));
#endif
foreach (const PropertyName &propertyName, properties) { foreach (const PropertyName &propertyName, properties) {
AbstractProperty property(parentNode.property(propertyName)); AbstractProperty property(parentNode.property(propertyName));
@@ -201,7 +207,9 @@ static bool computeTarget(const QModelIndex &rowModelIndex,
ModelNode targetNode = navigatorTreeModel->nodeForIndex(targetItemIndex); ModelNode targetNode = navigatorTreeModel->nodeForIndex(targetItemIndex);
if (!targetNode.metaInfo().hasDefaultProperty()) if (!targetNode.metaInfo().hasDefaultProperty())
return false; return false;
#ifndef DISABLE_VISIBLE_PROPERTIES
*targetRowNumber -= visibleProperties(targetNode).count(); *targetRowNumber -= visibleProperties(targetNode).count();
#endif
targetPropertyName = targetNode.metaInfo().defaultPropertyName(); targetPropertyName = targetNode.metaInfo().defaultPropertyName();
} else { } else {
targetItemIndex = rowModelIndex.parent(); targetItemIndex = rowModelIndex.parent();
@@ -280,6 +288,7 @@ ItemRow NavigatorTreeModel::createItemRow(const ModelNode &node)
visibilityItem->setCheckable(false); visibilityItem->setCheckable(false);
QMap<QString, QStandardItem *> propertyItems; QMap<QString, QStandardItem *> propertyItems;
#ifndef DISABLE_VISIBLE_PROPERTIES
foreach (const QString &propertyName, visibleProperties(node)) { foreach (const QString &propertyName, visibleProperties(node)) {
QStandardItem *propertyItem = new QStandardItem; QStandardItem *propertyItem = new QStandardItem;
propertyItem->setSelectable(false); propertyItem->setSelectable(false);
@@ -290,6 +299,7 @@ ItemRow NavigatorTreeModel::createItemRow(const ModelNode &node)
propertyItems.insert(propertyName, propertyItem); propertyItems.insert(propertyName, propertyItem);
idItem->appendRow(propertyItem); idItem->appendRow(propertyItem);
} }
#endif
# ifdef _LOCK_ITEMS_ # ifdef _LOCK_ITEMS_
ItemRow newRow = ItemRow(idItem, lockItem, visibilityItem, propertyItems); ItemRow newRow = ItemRow(idItem, lockItem, visibilityItem, propertyItems);
@@ -334,13 +344,16 @@ static void findTargetItem(const NodeListProperty &listProperty,
int *newRowNumber, int *newRowNumber,
QStandardItem **targetItem) QStandardItem **targetItem)
{ {
Q_UNUSED(newRowNumber);
if (navigatorTreeModel->isInTree(listProperty.parentModelNode())) { if (navigatorTreeModel->isInTree(listProperty.parentModelNode())) {
ItemRow parentRow = navigatorTreeModel->itemRowForNode(listProperty.parentModelNode()); ItemRow parentRow = navigatorTreeModel->itemRowForNode(listProperty.parentModelNode());
if (parentRow.propertyItems.contains(listProperty.name())) { if (parentRow.propertyItems.contains(listProperty.name())) {
*targetItem = parentRow.propertyItems.value(listProperty.name()); *targetItem = parentRow.propertyItems.value(listProperty.name());
} else { // default property } else { // default property
*targetItem = parentRow.idItem; *targetItem = parentRow.idItem;
#ifndef DISABLE_VISIBLE_PROPERTIES
newRowNumber += visibleProperties(listProperty.parentModelNode()).count(); newRowNumber += visibleProperties(listProperty.parentModelNode()).count();
#endif
} }
} else { } else {
*targetItem = currentItemRow.idItem->parent(); *targetItem = currentItemRow.idItem->parent();

View File

@@ -47,9 +47,15 @@ static inline void setScenePos(const QmlDesigner::ModelNode &modelNode,const QPo
{ {
if (modelNode.hasParentProperty() && QmlDesigner::QmlItemNode::isValidQmlItemNode(modelNode.parentProperty().parentModelNode())) { if (modelNode.hasParentProperty() && QmlDesigner::QmlItemNode::isValidQmlItemNode(modelNode.parentProperty().parentModelNode())) {
QmlDesigner::QmlItemNode parentNode = modelNode.parentProperty().parentQmlObjectNode().toQmlItemNode(); QmlDesigner::QmlItemNode parentNode = modelNode.parentProperty().parentQmlObjectNode().toQmlItemNode();
QPointF localPos = parentNode.instanceSceneTransform().inverted().map(pos);
modelNode.variantProperty("x").setValue(localPos.toPoint().x()); if (!parentNode.modelNode().metaInfo().isLayoutable()) {
modelNode.variantProperty("y").setValue(localPos.toPoint().y()); QPointF localPos = parentNode.instanceSceneTransform().inverted().map(pos);
modelNode.variantProperty("x").setValue(localPos.toPoint().x());
modelNode.variantProperty("y").setValue(localPos.toPoint().y());
} else { //Items in Layouts do not have a position
modelNode.removeProperty("x");
modelNode.removeProperty("y");
}
} }
} }

View File

@@ -114,7 +114,13 @@ void QmlAnchorBindingProxy::invalidate(const QmlItemNode &fxItemNode)
m_ignoreQml = true; m_ignoreQml = true;
m_verticalTarget = m_horizontalTarget = m_topTarget = m_bottomTarget = m_leftTarget = m_rightTarget = m_qmlItemNode.modelNode().parentProperty().parentModelNode(); m_verticalTarget =
m_horizontalTarget =
m_topTarget =
m_bottomTarget =
m_leftTarget =
m_rightTarget =
m_qmlItemNode.modelNode().parentProperty().parentModelNode();
setupAnchorTargets(); setupAnchorTargets();
@@ -247,6 +253,47 @@ void QmlAnchorBindingProxy::emitAnchorSignals()
emit relativeAnchorTargetRightChanged(); emit relativeAnchorTargetRightChanged();
} }
void QmlAnchorBindingProxy::setDefaultRelativeTopTarget()
{
if (m_topTarget.modelNode() == m_qmlItemNode.modelNode().parentProperty().parentModelNode()) {
m_relativeTopTarget = SameEdge;
} else {
m_relativeTopTarget = OppositeEdge;
}
}
void QmlAnchorBindingProxy::setDefaultRelativeBottomTarget()
{
if (m_bottomTarget.modelNode() == m_qmlItemNode.modelNode().parentProperty().parentModelNode()) {
m_relativeBottomTarget = SameEdge;
} else {
m_relativeBottomTarget = OppositeEdge;
}
}
void QmlAnchorBindingProxy::setDefaultRelativeLeftTarget()
{
if (m_leftTarget.modelNode() == m_qmlItemNode.modelNode().parentProperty().parentModelNode()) {
m_relativeLeftTarget = SameEdge;
} else {
m_relativeLeftTarget = OppositeEdge;
}
}
void QmlAnchorBindingProxy::setDefaultRelativeRightTarget()
{
if (m_rightTarget.modelNode() == m_qmlItemNode.modelNode().parentProperty().parentModelNode()) {
m_relativeRightTarget = SameEdge;
} else {
m_relativeRightTarget = OppositeEdge;
}
}
RewriterTransaction QmlAnchorBindingProxy::beginRewriterTransaction(const QByteArray &identifier)
{
return m_qmlItemNode.modelNode().view()->beginRewriterTransaction(identifier);
}
bool QmlAnchorBindingProxy::hasParent() bool QmlAnchorBindingProxy::hasParent()
{ {
return m_qmlItemNode.isValid() && m_qmlItemNode.hasNodeParent(); return m_qmlItemNode.isValid() && m_qmlItemNode.hasNodeParent();
@@ -254,7 +301,12 @@ bool QmlAnchorBindingProxy::hasParent()
bool QmlAnchorBindingProxy::isFilled() bool QmlAnchorBindingProxy::isFilled()
{ {
return m_qmlItemNode.isValid() && hasAnchors() && topAnchored() && bottomAnchored() && leftAnchored() && rightAnchored() return m_qmlItemNode.isValid()
&& hasAnchors()
&& topAnchored()
&& bottomAnchored()
&& leftAnchored()
&& rightAnchored()
&& (m_qmlItemNode.instanceValue("anchors.topMargin").toInt() == 0) && (m_qmlItemNode.instanceValue("anchors.topMargin").toInt() == 0)
&& (m_qmlItemNode.instanceValue("anchors.bottomMargin").toInt() == 0) && (m_qmlItemNode.instanceValue("anchors.bottomMargin").toInt() == 0)
&& (m_qmlItemNode.instanceValue("anchors.leftMargin").toInt() == 0) && (m_qmlItemNode.instanceValue("anchors.leftMargin").toInt() == 0)
@@ -301,9 +353,13 @@ void QmlAnchorBindingProxy::setTopTarget(const QString &target)
if (!newTarget.isValid()) if (!newTarget.isValid())
return; return;
RewriterTransaction transaction = m_qmlItemNode.modelNode().view()->beginRewriterTransaction(QByteArrayLiteral("QmlAnchorBindingProxy::setTopTarget")); RewriterTransaction transaction = beginRewriterTransaction(
QByteArrayLiteral("QmlAnchorBindingProxy::setTopTarget"));
m_topTarget = newTarget; m_topTarget = newTarget;
setDefaultRelativeTopTarget();
anchorTop(); anchorTop();
emit topTargetChanged(); emit topTargetChanged();
@@ -323,9 +379,11 @@ void QmlAnchorBindingProxy::setBottomTarget(const QString &target)
if (!newTarget.isValid()) if (!newTarget.isValid())
return; return;
RewriterTransaction transaction = m_qmlItemNode.modelNode().view()->beginRewriterTransaction(QByteArrayLiteral("QmlAnchorBindingProxy::setBottomTarget")); RewriterTransaction transaction = beginRewriterTransaction(
QByteArrayLiteral("QmlAnchorBindingProxy::setBottomTarget"));
m_bottomTarget = newTarget; m_bottomTarget = newTarget;
setDefaultRelativeBottomTarget();
anchorBottom(); anchorBottom();
emit bottomTargetChanged(); emit bottomTargetChanged();
@@ -344,9 +402,11 @@ void QmlAnchorBindingProxy::setLeftTarget(const QString &target)
if (!newTarget.isValid()) if (!newTarget.isValid())
return; return;
RewriterTransaction transaction = m_qmlItemNode.modelNode().view()->beginRewriterTransaction(QByteArrayLiteral("QmlAnchorBindingProxy::setLeftTarget")); RewriterTransaction transaction = beginRewriterTransaction(
QByteArrayLiteral("QmlAnchorBindingProxy::setLeftTarget"));
m_leftTarget = newTarget; m_leftTarget = newTarget;
setDefaultRelativeLeftTarget();
anchorLeft(); anchorLeft();
emit leftTargetChanged(); emit leftTargetChanged();
@@ -365,9 +425,11 @@ void QmlAnchorBindingProxy::setRightTarget(const QString &target)
if (!newTarget.isValid()) if (!newTarget.isValid())
return; return;
RewriterTransaction transaction = m_qmlItemNode.modelNode().view()->beginRewriterTransaction(QByteArrayLiteral("QmlAnchorBindingProxy::setRightTarget")); RewriterTransaction transaction = beginRewriterTransaction(
QByteArrayLiteral("QmlAnchorBindingProxy::setRightTarget"));
m_rightTarget = newTarget; m_rightTarget = newTarget;
setDefaultRelativeRightTarget();
anchorRight(); anchorRight();
emit rightTargetChanged(); emit rightTargetChanged();
@@ -386,7 +448,8 @@ void QmlAnchorBindingProxy::setVerticalTarget(const QString &target)
if (!newTarget.isValid()) if (!newTarget.isValid())
return; return;
RewriterTransaction transaction = m_qmlItemNode.modelNode().view()->beginRewriterTransaction(QByteArrayLiteral("QmlAnchorBindingProxy::setVerticalTarget")); RewriterTransaction transaction = beginRewriterTransaction(
QByteArrayLiteral("QmlAnchorBindingProxy::setVerticalTarget"));
m_verticalTarget = newTarget; m_verticalTarget = newTarget;
anchorVertical(); anchorVertical();
@@ -407,7 +470,8 @@ void QmlAnchorBindingProxy::setHorizontalTarget(const QString &target)
if (!newTarget.isValid()) if (!newTarget.isValid())
return; return;
RewriterTransaction transaction = m_qmlItemNode.modelNode().view()->beginRewriterTransaction(QByteArrayLiteral("QmlAnchorBindingProxy::setHorizontalTarget")); RewriterTransaction transaction = beginRewriterTransaction(
QByteArrayLiteral("QmlAnchorBindingProxy::setHorizontalTarget"));
m_horizontalTarget = newTarget; m_horizontalTarget = newTarget;
anchorHorizontal(); anchorHorizontal();
@@ -423,7 +487,8 @@ void QmlAnchorBindingProxy::setRelativeAnchorTargetTop(QmlAnchorBindingProxy::Re
if (target == m_relativeTopTarget) if (target == m_relativeTopTarget)
return; return;
RewriterTransaction transaction = m_qmlItemNode.modelNode().view()->beginRewriterTransaction(QByteArrayLiteral("QmlAnchorBindingProxy::setRelativeAnchorTargetTop")); RewriterTransaction transaction = beginRewriterTransaction(
QByteArrayLiteral("QmlAnchorBindingProxy::setRelativeAnchorTargetTop"));
m_relativeTopTarget = target; m_relativeTopTarget = target;
@@ -440,7 +505,8 @@ void QmlAnchorBindingProxy::setRelativeAnchorTargetBottom(QmlAnchorBindingProxy:
if (target == m_relativeBottomTarget) if (target == m_relativeBottomTarget)
return; return;
RewriterTransaction transaction = m_qmlItemNode.modelNode().view()->beginRewriterTransaction(QByteArrayLiteral("QmlAnchorBindingProxy::setRelativeAnchorTargetBottom")); RewriterTransaction transaction = beginRewriterTransaction(
QByteArrayLiteral("QmlAnchorBindingProxy::setRelativeAnchorTargetBottom"));
m_relativeBottomTarget = target; m_relativeBottomTarget = target;
@@ -457,7 +523,8 @@ void QmlAnchorBindingProxy::setRelativeAnchorTargetLeft(QmlAnchorBindingProxy::R
if (target == m_relativeLeftTarget) if (target == m_relativeLeftTarget)
return; return;
RewriterTransaction transaction = m_qmlItemNode.modelNode().view()->beginRewriterTransaction(QByteArrayLiteral("QmlAnchorBindingProxy::setRelativeAnchorTargetLeft")); RewriterTransaction transaction = beginRewriterTransaction(
QByteArrayLiteral("QmlAnchorBindingProxy::setRelativeAnchorTargetLeft"));
m_relativeLeftTarget = target; m_relativeLeftTarget = target;
@@ -474,7 +541,8 @@ void QmlAnchorBindingProxy::setRelativeAnchorTargetRight(QmlAnchorBindingProxy::
if (target == m_relativeRightTarget) if (target == m_relativeRightTarget)
return; return;
RewriterTransaction transaction = m_qmlItemNode.modelNode().view()->beginRewriterTransaction(QByteArrayLiteral("QmlAnchorBindingProxy::setRelativeAnchorTargetRight")); RewriterTransaction transaction = beginRewriterTransaction(
QByteArrayLiteral("QmlAnchorBindingProxy::setRelativeAnchorTargetRight"));
m_relativeRightTarget = target; m_relativeRightTarget = target;
@@ -492,7 +560,8 @@ void QmlAnchorBindingProxy::setRelativeAnchorTargetVertical(QmlAnchorBindingProx
if (target == m_relativeVerticalTarget) if (target == m_relativeVerticalTarget)
return; return;
RewriterTransaction transaction = m_qmlItemNode.modelNode().view()->beginRewriterTransaction(QByteArrayLiteral("QmlAnchorBindingProxy::setRelativeAnchorTargetVertical")); RewriterTransaction transaction = beginRewriterTransaction(
QByteArrayLiteral("QmlAnchorBindingProxy::setRelativeAnchorTargetVertical"));
m_relativeVerticalTarget = target; m_relativeVerticalTarget = target;
@@ -509,7 +578,8 @@ void QmlAnchorBindingProxy::setRelativeAnchorTargetHorizontal(QmlAnchorBindingPr
if (target == m_relativeHorizontalTarget) if (target == m_relativeHorizontalTarget)
return; return;
RewriterTransaction transaction = m_qmlItemNode.modelNode().view()->beginRewriterTransaction(QByteArrayLiteral("QmlAnchorBindingProxy::setRelativeAnchorTargetHorizontal")); RewriterTransaction transaction = beginRewriterTransaction(
QByteArrayLiteral("QmlAnchorBindingProxy::setRelativeAnchorTargetHorizontal"));
m_relativeHorizontalTarget = target; m_relativeHorizontalTarget = target;
@@ -559,7 +629,8 @@ int QmlAnchorBindingProxy::indexOfPossibleTargetItem(const QString &targetName)
} }
void QmlAnchorBindingProxy::resetLayout() { void QmlAnchorBindingProxy::resetLayout() {
RewriterTransaction transaction = m_qmlItemNode.modelNode().view()->beginRewriterTransaction(QByteArrayLiteral("QmlAnchorBindingProxy::resetLayout")); RewriterTransaction transaction = beginRewriterTransaction(
QByteArrayLiteral("QmlAnchorBindingProxy::resetLayout"));
m_qmlItemNode.anchors().removeAnchors(); m_qmlItemNode.anchors().removeAnchors();
m_qmlItemNode.anchors().removeMargins(); m_qmlItemNode.anchors().removeMargins();
@@ -584,18 +655,13 @@ void QmlAnchorBindingProxy::setBottomAnchor(bool anchor)
if (bottomAnchored() == anchor) if (bottomAnchored() == anchor)
return; return;
RewriterTransaction transaction = m_qmlItemNode.modelNode().view()->beginRewriterTransaction(QByteArrayLiteral("QmlAnchorBindingProxy::setBottomAnchor")); RewriterTransaction transaction = beginRewriterTransaction(
QByteArrayLiteral("QmlAnchorBindingProxy::setBottomAnchor"));
if (!anchor) { if (!anchor) {
removeBottomAnchor(); removeBottomAnchor();
} else { } else {
setDefaultRelativeBottomTarget();
if (m_bottomTarget.modelNode() == m_qmlItemNode.modelNode().parentProperty().parentModelNode()) {
m_relativeBottomTarget = SameEdge;
} else {
m_relativeBottomTarget = OppositeEdge;
}
anchorBottom(); anchorBottom();
if (topAnchored()) if (topAnchored())
backupPropertyAndRemove(modelNode(), "height"); backupPropertyAndRemove(modelNode(), "height");
@@ -616,17 +682,13 @@ void QmlAnchorBindingProxy::setLeftAnchor(bool anchor)
if (leftAnchored() == anchor) if (leftAnchored() == anchor)
return; return;
RewriterTransaction transaction = m_qmlItemNode.modelNode().view()->beginRewriterTransaction(QByteArrayLiteral("QmlAnchorBindingProxy::setLeftAnchor")); RewriterTransaction transaction = beginRewriterTransaction(
QByteArrayLiteral("QmlAnchorBindingProxy::setLeftAnchor"));
if (!anchor) { if (!anchor) {
removeLeftAnchor(); removeLeftAnchor();
} else { } else {
setDefaultRelativeLeftTarget();
if (m_leftTarget.modelNode() == m_qmlItemNode.modelNode().parentProperty().parentModelNode()) {
m_relativeLeftTarget = SameEdge;
} else {
m_relativeLeftTarget = OppositeEdge;
}
anchorLeft(); anchorLeft();
backupPropertyAndRemove(modelNode(), "x"); backupPropertyAndRemove(modelNode(), "x");
@@ -648,17 +710,13 @@ void QmlAnchorBindingProxy::setRightAnchor(bool anchor)
if (rightAnchored() == anchor) if (rightAnchored() == anchor)
return; return;
RewriterTransaction transaction = m_qmlItemNode.modelNode().view()->beginRewriterTransaction(QByteArrayLiteral("QmlAnchorBindingProxy::setRightAnchor")); RewriterTransaction transaction = beginRewriterTransaction(
QByteArrayLiteral("QmlAnchorBindingProxy::setRightAnchor"));
if (!anchor) { if (!anchor) {
removeRightAnchor(); removeRightAnchor();
} else { } else {
setDefaultRelativeRightTarget();
if (m_rightTarget.modelNode() == m_qmlItemNode.modelNode().parentProperty().parentModelNode()) {
m_relativeRightTarget = SameEdge;
} else {
m_relativeRightTarget = OppositeEdge;
}
anchorRight(); anchorRight();
if (leftAnchored()) if (leftAnchored())
@@ -842,17 +900,13 @@ void QmlAnchorBindingProxy::setTopAnchor(bool anchor)
if (topAnchored() == anchor) if (topAnchored() == anchor)
return; return;
RewriterTransaction transaction = m_qmlItemNode.modelNode().view()->beginRewriterTransaction(QByteArrayLiteral("QmlAnchorBindingProxy::setTopAnchor")); RewriterTransaction transaction = beginRewriterTransaction(
QByteArrayLiteral("QmlAnchorBindingProxy::setTopAnchor"));
if (!anchor) { if (!anchor) {
removeTopAnchor(); removeTopAnchor();
} else { } else {
setDefaultRelativeTopTarget();
if (m_topTarget.modelNode() == m_qmlItemNode.modelNode().parentProperty().parentModelNode()) {
m_relativeTopTarget = SameEdge;
} else {
m_relativeTopTarget = OppositeEdge;
}
anchorTop(); anchorTop();
backupPropertyAndRemove(modelNode(), "y"); backupPropertyAndRemove(modelNode(), "y");
@@ -867,7 +921,8 @@ void QmlAnchorBindingProxy::setTopAnchor(bool anchor)
} }
void QmlAnchorBindingProxy::removeTopAnchor() { void QmlAnchorBindingProxy::removeTopAnchor() {
RewriterTransaction transaction = m_qmlItemNode.modelNode().view()->beginRewriterTransaction(QByteArrayLiteral("QmlAnchorBindingProxy::removeTopAnchor")); RewriterTransaction transaction = beginRewriterTransaction(
QByteArrayLiteral("QmlAnchorBindingProxy::removeTopAnchor"));
m_qmlItemNode.anchors().removeAnchor(AnchorLineTop); m_qmlItemNode.anchors().removeAnchor(AnchorLineTop);
m_qmlItemNode.anchors().removeMargin(AnchorLineTop); m_qmlItemNode.anchors().removeMargin(AnchorLineTop);
@@ -878,7 +933,8 @@ void QmlAnchorBindingProxy::removeTopAnchor() {
} }
void QmlAnchorBindingProxy::removeBottomAnchor() { void QmlAnchorBindingProxy::removeBottomAnchor() {
RewriterTransaction transaction = m_qmlItemNode.modelNode().view()->beginRewriterTransaction(QByteArrayLiteral("QmlAnchorBindingProxy::removeBottomAnchor")); RewriterTransaction transaction = beginRewriterTransaction(
QByteArrayLiteral("QmlAnchorBindingProxy::removeBottomAnchor"));
m_qmlItemNode.anchors().removeAnchor(AnchorLineBottom); m_qmlItemNode.anchors().removeAnchor(AnchorLineBottom);
m_qmlItemNode.anchors().removeMargin(AnchorLineBottom); m_qmlItemNode.anchors().removeMargin(AnchorLineBottom);
@@ -888,7 +944,8 @@ void QmlAnchorBindingProxy::removeBottomAnchor() {
} }
void QmlAnchorBindingProxy::removeLeftAnchor() { void QmlAnchorBindingProxy::removeLeftAnchor() {
RewriterTransaction transaction = m_qmlItemNode.modelNode().view()->beginRewriterTransaction(QByteArrayLiteral("QmlAnchorBindingProxy::removeLeftAnchor")); RewriterTransaction transaction = beginRewriterTransaction(
QByteArrayLiteral("QmlAnchorBindingProxy::removeLeftAnchor"));
m_qmlItemNode.anchors().removeAnchor(AnchorLineLeft); m_qmlItemNode.anchors().removeAnchor(AnchorLineLeft);
m_qmlItemNode.anchors().removeMargin(AnchorLineLeft); m_qmlItemNode.anchors().removeMargin(AnchorLineLeft);
@@ -898,7 +955,8 @@ void QmlAnchorBindingProxy::removeLeftAnchor() {
} }
void QmlAnchorBindingProxy::removeRightAnchor() { void QmlAnchorBindingProxy::removeRightAnchor() {
RewriterTransaction transaction = m_qmlItemNode.modelNode().view()->beginRewriterTransaction(QByteArrayLiteral("QmlAnchorBindingProxy::removeRightAnchor")); RewriterTransaction transaction = beginRewriterTransaction(
QByteArrayLiteral("QmlAnchorBindingProxy::removeRightAnchor"));
m_qmlItemNode.anchors().removeAnchor(AnchorLineRight); m_qmlItemNode.anchors().removeAnchor(AnchorLineRight);
m_qmlItemNode.anchors().removeMargin(AnchorLineRight); m_qmlItemNode.anchors().removeMargin(AnchorLineRight);
@@ -916,7 +974,8 @@ void QmlAnchorBindingProxy::setVerticalCentered(bool centered)
m_locked = true; m_locked = true;
RewriterTransaction transaction = m_qmlItemNode.modelNode().view()->beginRewriterTransaction(QByteArrayLiteral("QmlAnchorBindingProxy::setVerticalCentered")); RewriterTransaction transaction = beginRewriterTransaction(
QByteArrayLiteral("QmlAnchorBindingProxy::setVerticalCentered"));
if (!centered) { if (!centered) {
m_qmlItemNode.anchors().removeAnchor(AnchorLineVerticalCenter); m_qmlItemNode.anchors().removeAnchor(AnchorLineVerticalCenter);
@@ -943,7 +1002,8 @@ void QmlAnchorBindingProxy::setHorizontalCentered(bool centered)
m_locked = true; m_locked = true;
RewriterTransaction transaction = m_qmlItemNode.modelNode().view()->beginRewriterTransaction(QByteArrayLiteral("QmlAnchorBindingProxy::setHorizontalCentered")); RewriterTransaction transaction = beginRewriterTransaction(
QByteArrayLiteral("QmlAnchorBindingProxy::setHorizontalCentered"));
if (!centered) { if (!centered) {
m_qmlItemNode.anchors().removeAnchor(AnchorLineHorizontalCenter); m_qmlItemNode.anchors().removeAnchor(AnchorLineHorizontalCenter);
@@ -1033,7 +1093,8 @@ bool QmlAnchorBindingProxy::horizontalCentered()
void QmlAnchorBindingProxy::fill() void QmlAnchorBindingProxy::fill()
{ {
RewriterTransaction transaction = m_qmlItemNode.modelNode().view()->beginRewriterTransaction(QByteArrayLiteral("QmlAnchorBindingProxy::fill")); RewriterTransaction transaction = beginRewriterTransaction(
QByteArrayLiteral("QmlAnchorBindingProxy::fill"));
backupPropertyAndRemove(modelNode(), "x"); backupPropertyAndRemove(modelNode(), "x");

View File

@@ -205,6 +205,12 @@ private:
void setupAnchorTargets(); void setupAnchorTargets();
void emitAnchorSignals(); void emitAnchorSignals();
void setDefaultRelativeTopTarget();
void setDefaultRelativeBottomTarget();
void setDefaultRelativeLeftTarget();
void setDefaultRelativeRightTarget();
RewriterTransaction beginRewriterTransaction(const QByteArray &identifier);
QmlItemNode targetIdToNode(const QString &id) const; QmlItemNode targetIdToNode(const QString &id) const;
QString idForNode(const QmlItemNode &qmlItemNode) const; QString idForNode(const QmlItemNode &qmlItemNode) const;

View File

@@ -41,11 +41,8 @@ namespace QmlDesigner {
void Quick2PropertyEditorView::execute() void Quick2PropertyEditorView::execute()
{ {
m_view.setSource(m_source); m_view.setSource(m_source);
if (!m_source.isEmpty())
if (!m_source.isEmpty()) {
m_view.setSource(m_source);
connect(&m_view, SIGNAL(statusChanged(QQuickView::Status)), this, SLOT(continueExecute())); connect(&m_view, SIGNAL(statusChanged(QQuickView::Status)), this, SLOT(continueExecute()));
}
} }
Quick2PropertyEditorView::Quick2PropertyEditorView(QWidget *parent) : Quick2PropertyEditorView::Quick2PropertyEditorView(QWidget *parent) :

View File

@@ -50,10 +50,7 @@ Column {
SecondColumnLayout { SecondColumnLayout {
LineEdit { LineEdit {
backendValue: backendValues.text backendValue: backendValues.text
implicitWidth: 180 Layout.fillWidth: true
}
ExpandingSpacer {
} }
} }
@@ -64,6 +61,7 @@ Column {
SecondColumnLayout { SecondColumnLayout {
CheckBox { CheckBox {
enabled: backendValues.checkable.value
text: backendValues.checked.valueToString text: backendValues.checked.valueToString
backendValue: backendValues.checked backendValue: backendValues.checked
implicitWidth: 180 implicitWidth: 180
@@ -82,6 +80,13 @@ Column {
CheckBox { CheckBox {
text: backendValues.checkable.valueToString text: backendValues.checkable.valueToString
backendValue: backendValues.checkable backendValue: backendValues.checkable
property bool backEndValueValue: backendValues.checkable.value
onTextChanged: {
if (!backendValues.checkable.value) {
backendValues.checked.resetValue()
}
}
implicitWidth: 180 implicitWidth: 180
} }
ExpandingSpacer { ExpandingSpacer {
@@ -130,10 +135,7 @@ Column {
SecondColumnLayout { SecondColumnLayout {
LineEdit { LineEdit {
backendValue: backendValues.tooltip backendValue: backendValues.tooltip
implicitWidth: 180 Layout.fillWidth: true
}
ExpandingSpacer {
} }
} }
@@ -162,10 +164,7 @@ Column {
SecondColumnLayout { SecondColumnLayout {
LineEdit { LineEdit {
backendValue: backendValues.iconSource backendValue: backendValues.iconSource
implicitWidth: 180 Layout.fillWidth: true
}
ExpandingSpacer {
} }
} }

View File

@@ -50,10 +50,7 @@ Column {
SecondColumnLayout { SecondColumnLayout {
LineEdit { LineEdit {
backendValue: backendValues.text backendValue: backendValues.text
implicitWidth: 180 Layout.fillWidth: true
}
ExpandingSpacer {
} }
} }

View File

@@ -50,10 +50,7 @@ Column {
SecondColumnLayout { SecondColumnLayout {
LineEdit { LineEdit {
backendValue: backendValues.text backendValue: backendValues.text
implicitWidth: 180 Layout.fillWidth: true
}
ExpandingSpacer {
} }
} }

View File

@@ -64,11 +64,9 @@ Column {
SecondColumnLayout { SecondColumnLayout {
LineEdit { LineEdit {
backendValue: backendValues.text backendValue: backendValues.text
implicitWidth: 180 Layout.fillWidth: true
} }
ExpandingSpacer {
}
} }
Label { Label {

View File

@@ -51,8 +51,7 @@ Column {
LineEdit { LineEdit {
backendValue: backendValues.text backendValue: backendValues.text
implicitWidth: 180 implicitWidth: 180
} Layout.fillWidth: true
ExpandingSpacer {
} }
} }
@@ -65,10 +64,7 @@ Column {
SecondColumnLayout { SecondColumnLayout {
LineEdit { LineEdit {
backendValue: backendValues.placeholderText backendValue: backendValues.placeholderText
implicitWidth: 180 Layout.fillWidth: true
}
ExpandingSpacer {
} }
} }
@@ -96,10 +92,7 @@ Column {
SecondColumnLayout { SecondColumnLayout {
LineEdit { LineEdit {
backendValue: backendValues.inputMask backendValue: backendValues.inputMask
implicitWidth: 180 Layout.fillWidth: true
}
ExpandingSpacer {
} }
} }

View File

@@ -213,22 +213,6 @@ MetaInfo {
} }
} }
Type {
name: "QtQuick.Controls.TabView"
icon: ":/componentsplugin/images/window16.png"
ItemLibraryEntry {
name: "Tab View"
category: "Qt Quick - Controls"
libraryIcon: ":/componentsplugin/images/window.png"
version: "1.0"
requiredImport: "QtQuick.Controls"
Property { name: "width"; type: "int"; value: 360; }
Property { name: "height"; type: "int"; value: 300; }
}
}
Type { Type {
name: "QtQuick.Controls.GroupBox" name: "QtQuick.Controls.GroupBox"
icon: ":/componentsplugin/images/window16.png" icon: ":/componentsplugin/images/window16.png"

View File

@@ -128,7 +128,7 @@ public:
NodeListProperty defaultNodeListProperty() const; NodeListProperty defaultNodeListProperty() const;
NodeProperty defaultNodeProperty() const; NodeProperty defaultNodeProperty() const;
void removeProperty(const PropertyName &name); //### also implement in AbstractProperty void removeProperty(const PropertyName &name) const; //### also implement in AbstractProperty
QList<AbstractProperty> properties() const; QList<AbstractProperty> properties() const;
QList<VariantProperty> variantProperties() const; QList<VariantProperty> variantProperties() const;
QList<NodeAbstractProperty> nodeAbstractProperties() const; QList<NodeAbstractProperty> nodeAbstractProperties() const;

View File

@@ -379,7 +379,7 @@ void NodeInstanceServerProxy::writeCommand(const QVariant &command)
void NodeInstanceServerProxy::processFinished(int exitCode, QProcess::ExitStatus exitStatus) void NodeInstanceServerProxy::processFinished(int exitCode, QProcess::ExitStatus exitStatus)
{ {
qWarning() << "Process finished:" << sender() << exitCode; qWarning() << "Process" << (exitStatus == QProcess::CrashExit ? "crashed:" : "finished:") << sender() << "exitCode:" << exitCode;
if (m_captureFileForTest.isOpen()) { if (m_captureFileForTest.isOpen()) {
m_captureFileForTest.close(); m_captureFileForTest.close();

View File

@@ -47,12 +47,13 @@
#include <coreplugin/icore.h> #include <coreplugin/icore.h>
#include <qmldesignerwarning.h> #include <qmldesignerwarning.h>
#include <qmldesignerplugin.h>
#include <designersettings.h>
#include "puppetbuildprogressdialog.h" #include "puppetbuildprogressdialog.h"
namespace QmlDesigner { namespace QmlDesigner {
bool PuppetCreator::m_useOnlyFallbackPuppet = !qgetenv("USE_ONLY_FALLBACK_PUPPET").isEmpty();
QHash<Core::Id, PuppetCreator::PuppetType> PuppetCreator::m_qml1PuppetForKitPuppetHash; QHash<Core::Id, PuppetCreator::PuppetType> PuppetCreator::m_qml1PuppetForKitPuppetHash;
QHash<Core::Id, PuppetCreator::PuppetType> PuppetCreator::m_qml2PuppetForKitPuppetHash; QHash<Core::Id, PuppetCreator::PuppetType> PuppetCreator::m_qml2PuppetForKitPuppetHash;
@@ -105,6 +106,13 @@ QDateTime PuppetCreator::puppetSourceLastModified() const
return lastModified; return lastModified;
} }
bool PuppetCreator::useOnlyFallbackPuppet() const
{
DesignerSettings settings = QmlDesignerPlugin::instance()->settings();
return settings.useOnlyFallbackPuppet
|| !qgetenv("USE_ONLY_FALLBACK_PUPPET").isEmpty();
}
PuppetCreator::PuppetCreator(ProjectExplorer::Kit *kit, const QString &qtCreatorVersion) PuppetCreator::PuppetCreator(ProjectExplorer::Kit *kit, const QString &qtCreatorVersion)
: m_qtCreatorVersion(qtCreatorVersion), : m_qtCreatorVersion(qtCreatorVersion),
m_kit(kit), m_kit(kit),
@@ -157,7 +165,7 @@ QProcess *PuppetCreator::puppetProcess(const QString &puppetPath,
puppetProcess->setProcessEnvironment(processEnvironment()); puppetProcess->setProcessEnvironment(processEnvironment());
QObject::connect(QCoreApplication::instance(), SIGNAL(aboutToQuit()), puppetProcess, SLOT(kill())); QObject::connect(QCoreApplication::instance(), SIGNAL(aboutToQuit()), puppetProcess, SLOT(kill()));
QObject::connect(puppetProcess, SIGNAL(finished(int,QProcess::ExitStatus)), handlerObject, finishSlot); QObject::connect(puppetProcess, SIGNAL(finished(int,QProcess::ExitStatus)), handlerObject, finishSlot);
bool fowardQmlpuppetOutput = !qgetenv("FORWARD_QMLPUPPET_OUTPUT").isEmpty(); bool fowardQmlpuppetOutput = !qgetenv("FORWARD_QML_PUPPET_OUTPUT").isEmpty();
if (fowardQmlpuppetOutput) { if (fowardQmlpuppetOutput) {
puppetProcess->setProcessChannelMode(QProcess::MergedChannels); puppetProcess->setProcessChannelMode(QProcess::MergedChannels);
QObject::connect(puppetProcess, SIGNAL(readyRead()), handlerObject, outputSlot); QObject::connect(puppetProcess, SIGNAL(readyRead()), handlerObject, outputSlot);
@@ -252,7 +260,7 @@ void PuppetCreator::createQml1PuppetExecutableIfMissing()
{ {
m_availablePuppetType = FallbackPuppet; m_availablePuppetType = FallbackPuppet;
if (!m_useOnlyFallbackPuppet && m_kit) { if (!useOnlyFallbackPuppet() && m_kit) {
if (m_qml1PuppetForKitPuppetHash.contains(m_kit->id())) { if (m_qml1PuppetForKitPuppetHash.contains(m_kit->id())) {
m_availablePuppetType = m_qml1PuppetForKitPuppetHash.value(m_kit->id()); m_availablePuppetType = m_qml1PuppetForKitPuppetHash.value(m_kit->id());
} else if (checkQmlpuppetIsReady()) { } else if (checkQmlpuppetIsReady()) {
@@ -274,7 +282,7 @@ void PuppetCreator::createQml2PuppetExecutableIfMissing()
{ {
m_availablePuppetType = FallbackPuppet; m_availablePuppetType = FallbackPuppet;
if (!m_useOnlyFallbackPuppet && m_kit) { if (!useOnlyFallbackPuppet() && m_kit) {
if (m_qml2PuppetForKitPuppetHash.contains(m_kit->id())) { if (m_qml2PuppetForKitPuppetHash.contains(m_kit->id())) {
m_availablePuppetType = m_qml2PuppetForKitPuppetHash.value(m_kit->id()); m_availablePuppetType = m_qml2PuppetForKitPuppetHash.value(m_kit->id());
} else if (checkQml2PuppetIsReady()) { } else if (checkQml2PuppetIsReady()) {

View File

@@ -110,12 +110,13 @@ protected:
QDateTime qtLastModified() const; QDateTime qtLastModified() const;
QDateTime puppetSourceLastModified() const; QDateTime puppetSourceLastModified() const;
bool useOnlyFallbackPuppet() const;
private: private:
QString m_qtCreatorVersion; QString m_qtCreatorVersion;
mutable QString m_compileLog; mutable QString m_compileLog;
ProjectExplorer::Kit *m_kit; ProjectExplorer::Kit *m_kit;
PuppetType m_availablePuppetType; PuppetType m_availablePuppetType;
static bool m_useOnlyFallbackPuppet;
static QHash<Core::Id, PuppetType> m_qml1PuppetForKitPuppetHash; static QHash<Core::Id, PuppetType> m_qml1PuppetForKitPuppetHash;
static QHash<Core::Id, PuppetType> m_qml2PuppetForKitPuppetHash; static QHash<Core::Id, PuppetType> m_qml2PuppetForKitPuppetHash;
}; };

View File

@@ -31,6 +31,7 @@
#include "model.h" #include "model.h"
#include "metainfo.h" #include "metainfo.h"
#include <enumeration.h>
#include <rewriterview.h> #include <rewriterview.h>
#include <propertyparser.h> #include <propertyparser.h>
@@ -1358,7 +1359,8 @@ QVariant NodeMetaInfo::propertyCastedValue(const PropertyName &propertyName, con
const QVariant variant = value; const QVariant variant = value;
QVariant copyVariant = variant; QVariant copyVariant = variant;
if (propertyIsEnumType(propertyName)) if (propertyIsEnumType(propertyName)
|| variant.canConvert<Enumeration>())
return variant; return variant;
const QString typeName = propertyTypeName(propertyName); const QString typeName = propertyTypeName(propertyName);
@@ -1512,7 +1514,9 @@ bool NodeMetaInfo::isLayoutable() const
if (isSubclassOf("<cpp>.QDeclarativeBasePositioner", -1, -1)) if (isSubclassOf("<cpp>.QDeclarativeBasePositioner", -1, -1))
return true; //QtQuick 1 return true; //QtQuick 1
return isSubclassOf("QtQuick.Positioner", -1, -1) || isSubclassOf("QtQuick.Layouts.Layout", -1, -1); return isSubclassOf("QtQuick.Positioner", -1, -1)
|| isSubclassOf("QtQuick.Layouts.Layout", -1, -1)
|| isSubclassOf("QtQuick.Controls.SplitView", -1, -1);
} }
bool NodeMetaInfo::isView() const bool NodeMetaInfo::isView() const

View File

@@ -583,7 +583,7 @@ Does nothing if the node state does not set this property.
\see addProperty property properties hasProperties \see addProperty property properties hasProperties
*/ */
void ModelNode::removeProperty(const PropertyName &name) void ModelNode::removeProperty(const PropertyName &name) const
{ {
if (!isValid()) if (!isValid())
throw InvalidModelNodeException(__LINE__, __FUNCTION__, __FILE__); throw InvalidModelNodeException(__LINE__, __FUNCTION__, __FILE__);

View File

@@ -369,6 +369,13 @@ bool itemIsMovable(const ModelNode &modelNode)
if (modelNode.metaInfo().isSubclassOf("QtQuick.Controls.Tab", -1, -1)) if (modelNode.metaInfo().isSubclassOf("QtQuick.Controls.Tab", -1, -1))
return false; return false;
if (modelNode.hasParentProperty()) {
ModelNode parentModelNode = modelNode.parentProperty().parentModelNode();
if (QmlItemNode::isValidQmlItemNode(parentModelNode)
&& parentModelNode.metaInfo().isLayoutable())
return false;
}
return true; return true;
} }

View File

@@ -247,6 +247,11 @@ static inline QVariant convertDynamicPropertyValueToVariant(const QString &astVa
} }
} }
static bool isListElementType(const QmlDesigner::TypeName &type)
{
return type == "ListElement" || type == "QtQuick.ListElement" || type == "Qt.ListElement";
}
static bool isComponentType(const QmlDesigner::TypeName &type) static bool isComponentType(const QmlDesigner::TypeName &type)
{ {
return type == "Component" || type == "Qt.Component" || type == "QtQuick.Component" || type == "<cpp>.QQmlComponent"; return type == "Component" || type == "Qt.Component" || type == "QtQuick.Component" || type == "<cpp>.QQmlComponent";
@@ -1225,7 +1230,8 @@ QmlDesigner::PropertyName TextToModelMerger::syncScriptBinding(ModelNode &modelN
if (isLiteralValue(script)) { if (isLiteralValue(script)) {
if (isPropertyChangesType(modelNode.type()) if (isPropertyChangesType(modelNode.type())
|| isConnectionsType(modelNode.type())) { || isConnectionsType(modelNode.type())
|| isListElementType(modelNode.type())) {
AbstractProperty modelProperty = modelNode.property(astPropertyName.toUtf8()); AbstractProperty modelProperty = modelNode.property(astPropertyName.toUtf8());
QVariant variantValue = parsePropertyScriptBinding(script); QVariant variantValue = parsePropertyScriptBinding(script);
if (!variantValue.isValid()) if (!variantValue.isValid())

View File

@@ -43,7 +43,8 @@ DesignerSettings::DesignerSettings()
designerWarningsInEditor(false), designerWarningsInEditor(false),
showDebugView(false), showDebugView(false),
enableDebugView(false), enableDebugView(false),
alwaysSaveInCrumbleBar(false) alwaysSaveInCrumbleBar(false),
useOnlyFallbackPuppet(false)
{} {}
void DesignerSettings::fromSettings(QSettings *settings) void DesignerSettings::fromSettings(QSettings *settings)
@@ -66,6 +67,8 @@ void DesignerSettings::fromSettings(QSettings *settings)
QLatin1String(QmlDesigner::Constants::QML_ENABLE_DEBUGVIEW), QVariant(false)).toBool(); QLatin1String(QmlDesigner::Constants::QML_ENABLE_DEBUGVIEW), QVariant(false)).toBool();
alwaysSaveInCrumbleBar = settings->value( alwaysSaveInCrumbleBar = settings->value(
QLatin1String(QmlDesigner::Constants::QML_ALWAYS_SAFE_IN_CRUMBLEBAR), QVariant(false)).toBool(); QLatin1String(QmlDesigner::Constants::QML_ALWAYS_SAFE_IN_CRUMBLEBAR), QVariant(false)).toBool();
useOnlyFallbackPuppet = settings->value(
QLatin1String(QmlDesigner::Constants::QML_USE_ONLY_FALLBACK_PUPPET), QVariant(false)).toBool();
settings->endGroup(); settings->endGroup();
settings->endGroup(); settings->endGroup();
@@ -84,6 +87,7 @@ void DesignerSettings::toSettings(QSettings *settings) const
settings->setValue(QLatin1String(QmlDesigner::Constants::QML_SHOW_DEBUGVIEW), showDebugView); settings->setValue(QLatin1String(QmlDesigner::Constants::QML_SHOW_DEBUGVIEW), showDebugView);
settings->setValue(QLatin1String(QmlDesigner::Constants::QML_ENABLE_DEBUGVIEW), enableDebugView); settings->setValue(QLatin1String(QmlDesigner::Constants::QML_ENABLE_DEBUGVIEW), enableDebugView);
settings->setValue(QLatin1String(QmlDesigner::Constants::QML_ALWAYS_SAFE_IN_CRUMBLEBAR), alwaysSaveInCrumbleBar); settings->setValue(QLatin1String(QmlDesigner::Constants::QML_ALWAYS_SAFE_IN_CRUMBLEBAR), alwaysSaveInCrumbleBar);
settings->setValue(QLatin1String(QmlDesigner::Constants::QML_USE_ONLY_FALLBACK_PUPPET), useOnlyFallbackPuppet);
settings->endGroup(); settings->endGroup();
settings->endGroup(); settings->endGroup();
@@ -98,5 +102,6 @@ bool DesignerSettings::equals(const DesignerSettings &other) const
&& designerWarningsInEditor == other.designerWarningsInEditor && designerWarningsInEditor == other.designerWarningsInEditor
&& showDebugView == other.showDebugView && showDebugView == other.showDebugView
&& enableDebugView == other.enableDebugView && enableDebugView == other.enableDebugView
&& alwaysSaveInCrumbleBar == other.alwaysSaveInCrumbleBar; && alwaysSaveInCrumbleBar == other.alwaysSaveInCrumbleBar
&& useOnlyFallbackPuppet == other.useOnlyFallbackPuppet;
} }

View File

@@ -56,6 +56,7 @@ public:
bool showDebugView; bool showDebugView;
bool enableDebugView; bool enableDebugView;
bool alwaysSaveInCrumbleBar; bool alwaysSaveInCrumbleBar;
bool useOnlyFallbackPuppet;
}; };
inline bool operator==(const DesignerSettings &s1, const DesignerSettings &s2) inline bool operator==(const DesignerSettings &s1, const DesignerSettings &s2)

View File

@@ -65,6 +65,7 @@ const char QML_WARNIN_FOR_DESIGNER_FEATURES_IN_EDITOR_KEY[] = "WarnAboutQtQuickD
const char QML_SHOW_DEBUGVIEW[] = "ShowQtQuickDesignerDebugView"; const char QML_SHOW_DEBUGVIEW[] = "ShowQtQuickDesignerDebugView";
const char QML_ENABLE_DEBUGVIEW[] = "EnableQtQuickDesignerDebugView"; const char QML_ENABLE_DEBUGVIEW[] = "EnableQtQuickDesignerDebugView";
const char QML_ALWAYS_SAFE_IN_CRUMBLEBAR[] = "AlwaysSafeInCrumbleBar"; const char QML_ALWAYS_SAFE_IN_CRUMBLEBAR[] = "AlwaysSafeInCrumbleBar";
const char QML_USE_ONLY_FALLBACK_PUPPET[] = "AseOnlyFallbackPuppet";
const char QML_DESIGNER_SUBFOLDER[] = "/designer/"; const char QML_DESIGNER_SUBFOLDER[] = "/designer/";

View File

@@ -48,7 +48,7 @@ RangeMover {
target: zoomControl target: zoomControl
onRangeChanged: { onRangeChanged: {
var oldTimePerPixel = selectionRange.viewTimePerPixel; var oldTimePerPixel = selectionRange.viewTimePerPixel;
selectionRange.viewTimePerPixel = Math.abs(zoomControl.endTime() - zoomControl.startTime()) / flick.width; selectionRange.viewTimePerPixel = Math.abs(zoomControl.endTime() - zoomControl.startTime()) / view.intWidth;
if (creationState === 3 && oldTimePerPixel != selectionRange.viewTimePerPixel) { if (creationState === 3 && oldTimePerPixel != selectionRange.viewTimePerPixel) {
var newWidth = getWidth() * oldTimePerPixel / viewTimePerPixel; var newWidth = getWidth() * oldTimePerPixel / viewTimePerPixel;
setLeft(getLeft() * oldTimePerPixel / viewTimePerPixel); setLeft(getLeft() * oldTimePerPixel / viewTimePerPixel);

View File

@@ -38,6 +38,7 @@
#include <qmakeprojectmanager/qmakeproject.h> #include <qmakeprojectmanager/qmakeproject.h>
#include <qmakeprojectmanager/qmakeprojectmanagerconstants.h> #include <qmakeprojectmanager/qmakeprojectmanagerconstants.h>
#include <qtsupport/qtkitinformation.h> #include <qtsupport/qtkitinformation.h>
#include <qtsupport/qtsupportconstants.h>
#include "qmlprojectmanager.h" #include "qmlprojectmanager.h"
#include "qmlproject.h" #include "qmlproject.h"
@@ -79,6 +80,8 @@ QmlApplicationWizard::QmlApplicationWizard()
QLatin1String(ProjectExplorer::Constants::QT_APPLICATION_WIZARD_CATEGORY_DISPLAY)); QLatin1String(ProjectExplorer::Constants::QT_APPLICATION_WIZARD_CATEGORY_DISPLAY));
setDisplayName(tr("Qt Quick UI")); setDisplayName(tr("Qt Quick UI"));
setDescription(tr("Creates a Qt Quick UI project.")); setDescription(tr("Creates a Qt Quick UI project."));
setRequiredFeatures(Core::Feature(QtSupport::Constants::FEATURE_QMLPROJECT)
| Core::Feature(QtSupport::Constants::FEATURE_QT_QUICK));
} }
Core::BaseFileWizard *QmlApplicationWizard::create(QWidget *parent, const WizardDialogParameters &parameters) const Core::BaseFileWizard *QmlApplicationWizard::create(QWidget *parent, const WizardDialogParameters &parameters) const

View File

@@ -128,13 +128,11 @@ private:
QDialogButtonBox *m_dialogButtonBox; QDialogButtonBox *m_dialogButtonBox;
CustomExecutableConfigurationWidget *m_widget; CustomExecutableConfigurationWidget *m_widget;
CustomExecutableRunConfiguration *m_runConfiguration;
}; };
CustomExecutableDialog::CustomExecutableDialog(CustomExecutableRunConfiguration *rc, QWidget *parent) CustomExecutableDialog::CustomExecutableDialog(CustomExecutableRunConfiguration *rc, QWidget *parent)
: QDialog(parent) : QDialog(parent)
, m_dialogButtonBox(new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel)) , m_dialogButtonBox(new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel))
, m_runConfiguration(rc)
{ {
setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint); setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
QVBoxLayout *layout = new QVBoxLayout(this); QVBoxLayout *layout = new QVBoxLayout(this);

View File

@@ -256,10 +256,11 @@ ProjectExplorer::FolderNode::AddNewInformation ResourceTopLevelNode::addNewInfor
.arg(QFileInfo(path()).fileName()) .arg(QFileInfo(path()).fileName())
.arg(QLatin1String("/")); .arg(QLatin1String("/"));
int p = 80; int p = -1;
if (priority(files)) { if (priority(files)) { // images/* and qml/js mimetypes
if (context == 0 || context == this) p = 110;
p = 125; if (context == this)
p = 120;
else if (projectNode() == context) else if (projectNode() == context)
p = 150; // steal from our project node p = 150; // steal from our project node
// The ResourceFolderNode '/' defers to us, as otherwise // The ResourceFolderNode '/' defers to us, as otherwise
@@ -267,7 +268,7 @@ ProjectExplorer::FolderNode::AddNewInformation ResourceTopLevelNode::addNewInfor
// Thus also return a high priority for it // Thus also return a high priority for it
if (ResourceFolderNode *rfn = qobject_cast<ResourceFolderNode *>(context)) if (ResourceFolderNode *rfn = qobject_cast<ResourceFolderNode *>(context))
if (rfn->prefix() == QLatin1String("/") && rfn->parentFolderNode() == this) if (rfn->prefix() == QLatin1String("/") && rfn->parentFolderNode() == this)
p = 150; p = 120;
} }
return AddNewInformation(name, p); return AddNewInformation(name, p);
@@ -389,9 +390,10 @@ ProjectExplorer::FolderNode::AddNewInformation ResourceFolderNode::addNewInforma
.arg(QFileInfo(m_topLevelNode->path()).fileName()) .arg(QFileInfo(m_topLevelNode->path()).fileName())
.arg(displayName()); .arg(displayName());
int p = 80; int p = -1; // never the default
if (priority(files)) { if (priority(files)) { // image/* and qml/js mimetypes
if (context == 0 || context == this) p = 105; // prefer against .pro and .pri files
if (context == this)
p = 120; p = 120;
} }

View File

@@ -250,22 +250,15 @@ QPainterPath TextEditorOverlay::createSelectionPath(const QTextCursor &begin, co
points += firstSelection.topRight() + QPointF(margin+1, -margin); points += firstSelection.topRight() + QPointF(margin+1, -margin);
points += firstSelection.bottomRight() + QPointF(margin+1, 0); points += firstSelection.bottomRight() + QPointF(margin+1, 0);
const int count = selection.count(); const int count = selection.count();
if (count > 2) { for (int i = 1; i < count-1; ++i) {
const QRectF *prev = &selection.at(0); #define MAX3(a,b,c) qMax(a, qMax(b,c))
const QRectF *current = &selection.at(1); qreal x = MAX3(selection.at(i-1).right(),
const QRectF *next = &selection.at(2); selection.at(i).right(),
for (int i = 0; i < count; ++i) { selection.at(i+1).right()) + margin;
#define MAX3(a,b,c) qMax(a, qMax(b,c))
qreal x = MAX3(prev->right(), current->right(), next->right()) + margin; points += QPointF(x+1, selection.at(i).top());
points += QPointF(x+1, current->top()); points += QPointF(x+1, selection.at(i).bottom());
points += QPointF(x+1, current->bottom());
prev = current;
current = next;
if (i < count-1)
next = &selection.at(i+1);
}
} }
const QRectF &lastSelection = selection.at(count-1); const QRectF &lastSelection = selection.at(count-1);
@@ -274,20 +267,14 @@ QPainterPath TextEditorOverlay::createSelectionPath(const QTextCursor &begin, co
points += lastSelection.bottomLeft() + QPointF(-margin, margin+extra); points += lastSelection.bottomLeft() + QPointF(-margin, margin+extra);
points += lastSelection.topLeft() + QPointF(-margin, 0); points += lastSelection.topLeft() + QPointF(-margin, 0);
if (count > 2) { for (int i = count-2; i > 0; --i) {
const QRectF *prev = &selection.at(count-3);
const QRectF *current = &selection.at(count-2);
const QRectF *next = &selection.at(count-1);
for (int i = count-1; i >= 0; --i) {
#define MIN3(a,b,c) qMin(a, qMin(b,c)) #define MIN3(a,b,c) qMin(a, qMin(b,c))
qreal x = MIN3(prev->left(), current->left(), next->left()) - margin; qreal x = MIN3(selection.at(i-1).left(),
points += QPointF(x, current->bottom()+extra); selection.at(i).left(),
points += QPointF(x, current->top()); selection.at(i+1).left()) - margin;
next = current;
current = prev; points += QPointF(x, selection.at(i).bottom()+extra);
if (i > 0) points += QPointF(x, selection.at(i).top());
prev = &selection.at(i);
}
} }
points += firstSelection.bottomLeft() + QPointF(-margin, extra); points += firstSelection.bottomLeft() + QPointF(-margin, extra);

View File

@@ -58,7 +58,7 @@ WinRtDeviceFactory::WinRtDeviceFactory()
} else { } else {
connect(DeviceManager::instance(), &DeviceManager::devicesLoaded, connect(DeviceManager::instance(), &DeviceManager::devicesLoaded,
this, &WinRtDeviceFactory::onPrerequisitesLoaded, Qt::QueuedConnection); this, &WinRtDeviceFactory::onPrerequisitesLoaded, Qt::QueuedConnection);
connect(static_cast<QtVersionManager *>(QtVersionManager::instance()), connect(QtVersionManager::instance(),
&QtVersionManager::qtVersionsLoaded, &QtVersionManager::qtVersionsLoaded,
this, &WinRtDeviceFactory::onPrerequisitesLoaded, Qt::QueuedConnection); this, &WinRtDeviceFactory::onPrerequisitesLoaded, Qt::QueuedConnection);
} }
@@ -125,12 +125,10 @@ void WinRtDeviceFactory::onPrerequisitesLoaded()
m_initialized = true; m_initialized = true;
disconnect(DeviceManager::instance(), &DeviceManager::devicesLoaded, disconnect(DeviceManager::instance(), &DeviceManager::devicesLoaded,
this, &WinRtDeviceFactory::onPrerequisitesLoaded); this, &WinRtDeviceFactory::onPrerequisitesLoaded);
QtVersionManager *qtVersionManager disconnect(QtVersionManager::instance(), &QtVersionManager::qtVersionsLoaded,
= static_cast<QtVersionManager *>(QtVersionManager::instance());
disconnect(qtVersionManager, &QtVersionManager::qtVersionsLoaded,
this, &WinRtDeviceFactory::onPrerequisitesLoaded); this, &WinRtDeviceFactory::onPrerequisitesLoaded);
autoDetect(); autoDetect();
connect(qtVersionManager, &QtVersionManager::qtVersionsChanged, connect(QtVersionManager::instance(), &QtVersionManager::qtVersionsChanged,
this, &WinRtDeviceFactory::autoDetect); this, &WinRtDeviceFactory::autoDetect);
} }

View File

@@ -28,8 +28,10 @@
****************************************************************************/ ****************************************************************************/
#include "winrtpackagedeploymentstep.h" #include "winrtpackagedeploymentstep.h"
#include "winrtpackagedeploymentstepwidget.h"
#include "winrtconstants.h" #include "winrtconstants.h"
#include "winrtpackagedeploymentstepwidget.h"
#include "winrtrunconfiguration.h"
#include <projectexplorer/project.h> #include <projectexplorer/project.h>
#include <projectexplorer/target.h> #include <projectexplorer/target.h>
@@ -39,6 +41,7 @@
#include <projectexplorer/deploymentdata.h> #include <projectexplorer/deploymentdata.h>
#include <projectexplorer/projectexplorerconstants.h> #include <projectexplorer/projectexplorerconstants.h>
#include <qtsupport/qtkitinformation.h> #include <qtsupport/qtkitinformation.h>
#include <utils/qtcassert.h>
#include <utils/qtcprocess.h> #include <utils/qtcprocess.h>
#include <QRegularExpression> #include <QRegularExpression>
@@ -59,19 +62,38 @@ WinRtPackageDeploymentStep::WinRtPackageDeploymentStep(BuildStepList *bsl)
bool WinRtPackageDeploymentStep::init() bool WinRtPackageDeploymentStep::init()
{ {
Utils::FileName proFile = project()->projectFilePath(); WinRtRunConfiguration *rc = qobject_cast<WinRtRunConfiguration *>(
const QString targetPath target()->activeRunConfiguration());
= target()->applicationTargets().targetForProject(proFile).toString() QTC_ASSERT(rc, return false);
+ QLatin1String(".exe");
QString targetDir = targetPath.left(targetPath.lastIndexOf(QLatin1Char('/')) + 1); const Utils::FileName activeProjectFilePath = Utils::FileName::fromString(rc->proFilePath());
// ### Actually, targetForProject is supposed to return the file path including the file Utils::FileName appTargetFilePath;
// extension. Whenever this will eventually work, we have to remove the .exe suffix here. foreach (const BuildTargetInfo &buildTarget, target()->applicationTargets().list) {
if (buildTarget.projectFilePath == activeProjectFilePath) {
appTargetFilePath = buildTarget.targetFilePath;
break;
}
}
m_targetFilePath = appTargetFilePath.toString();
if (m_targetFilePath.isEmpty()) {
// ### raise error in 3.3
// raiseError(tr("No executable to deploy found in %1.").arg(rc->proFilePath()));
return false;
}
// ### Ideally, the file paths in applicationTargets() should already have the .exe suffix.
// Whenever this will eventually work, we can drop appending the .exe suffix here.
if (!m_targetFilePath.endsWith(QLatin1String(".exe"), Qt::CaseInsensitive))
m_targetFilePath.append(QLatin1String(".exe"));
m_targetDirPath = appTargetFilePath.parentDir().toString();
const QtSupport::BaseQtVersion *qt = QtSupport::QtKitInformation::qtVersion(target()->kit()); const QtSupport::BaseQtVersion *qt = QtSupport::QtKitInformation::qtVersion(target()->kit());
if (!qt) if (!qt)
return false; return false;
QString args = QtcProcess::quoteArg(QDir::toNativeSeparators(targetPath)); QString args = QtcProcess::quoteArg(QDir::toNativeSeparators(m_targetFilePath));
args += QLatin1Char(' ') + m_args; args += QLatin1Char(' ') + m_args;
m_manifestFileName = QStringLiteral("AppxManifest"); m_manifestFileName = QStringLiteral("AppxManifest");
@@ -84,13 +106,16 @@ bool WinRtPackageDeploymentStep::init()
if (m_createMappingFile) { if (m_createMappingFile) {
args += QLatin1String(" -list mapping"); args += QLatin1String(" -list mapping");
m_mappingFileContent = QLatin1String("[Files]\n\"") + QDir::toNativeSeparators(targetDir) m_mappingFileContent = QLatin1String("[Files]\n\"")
+ m_manifestFileName + QLatin1String(".xml\" \"") + m_manifestFileName + QLatin1String(".xml\"\n"); + QDir::toNativeSeparators(m_targetDirPath)
+ m_manifestFileName + QLatin1String(".xml\" \"") + m_manifestFileName
+ QLatin1String(".xml\"\n");
QDir assetDirectory(targetDir + QLatin1String("assets")); QDir assetDirectory(m_targetDirPath + QLatin1String("assets"));
if (assetDirectory.exists()) { if (assetDirectory.exists()) {
QStringList iconsToDeploy; QStringList iconsToDeploy;
const QString fullManifestPath = targetDir + m_manifestFileName + QLatin1String(".xml"); const QString fullManifestPath = m_targetDirPath + m_manifestFileName
+ QLatin1String(".xml");
if (!parseIconsAndExecutableFromManifest(fullManifestPath, &iconsToDeploy, if (!parseIconsAndExecutableFromManifest(fullManifestPath, &iconsToDeploy,
&m_executablePathInManifest)) { &m_executablePathInManifest)) {
raiseError(tr("Cannot parse manifest file %1.").arg(fullManifestPath)); raiseError(tr("Cannot parse manifest file %1.").arg(fullManifestPath));
@@ -98,7 +123,7 @@ bool WinRtPackageDeploymentStep::init()
} }
foreach (const QString &icon, iconsToDeploy) { foreach (const QString &icon, iconsToDeploy) {
m_mappingFileContent += QLatin1Char('"') m_mappingFileContent += QLatin1Char('"')
+ QDir::toNativeSeparators(targetDir + icon) + QLatin1String("\" \"") + QDir::toNativeSeparators(m_targetDirPath + icon) + QLatin1String("\" \"")
+ QDir::toNativeSeparators(icon) + QLatin1String("\"\n"); + QDir::toNativeSeparators(icon) + QLatin1String("\"\n");
} }
} }
@@ -115,18 +140,14 @@ bool WinRtPackageDeploymentStep::init()
bool WinRtPackageDeploymentStep::processSucceeded(int exitCode, QProcess::ExitStatus status) bool WinRtPackageDeploymentStep::processSucceeded(int exitCode, QProcess::ExitStatus status)
{ {
if (m_createMappingFile) { if (m_createMappingFile) {
Utils::FileName proFile = project()->projectFilePath();
QString targetPath
= target()->applicationTargets().targetForProject(proFile).toString();
QString targetDir = targetPath.left(targetPath.lastIndexOf(QLatin1Char('/')) + 1);
QString targetInstallationPath; QString targetInstallationPath;
// The list holds the local file paths and the "remote" file paths // The list holds the local file paths and the "remote" file paths
QList<QPair<QString, QString> > installableFilesList; QList<QPair<QString, QString> > installableFilesList;
foreach (DeployableFile file, target()->deploymentData().allFiles()) { foreach (DeployableFile file, target()->deploymentData().allFiles()) {
QString remoteFilePath = file.remoteFilePath(); QString remoteFilePath = file.remoteFilePath();
QString localFilePath = file.localFilePath().toString(); QString localFilePath = file.localFilePath().toString();
if (localFilePath == targetPath) { if (localFilePath == m_targetFilePath) {
if (!targetPath.endsWith(QLatin1String(".exe"))) { if (!m_targetFilePath.endsWith(QLatin1String(".exe"))) {
remoteFilePath += QLatin1String(".exe"); remoteFilePath += QLatin1String(".exe");
localFilePath += QLatin1String(".exe"); localFilePath += QLatin1String(".exe");
} }
@@ -139,11 +160,12 @@ bool WinRtPackageDeploymentStep::processSucceeded(int exitCode, QProcess::ExitSt
// and the icons referenced in there and the actual build target // and the icons referenced in there and the actual build target
QString baseDir; QString baseDir;
if (targetInstallationPath.isEmpty()) { if (targetInstallationPath.isEmpty()) {
targetPath += QLatin1String(".exe"); m_targetFilePath += QLatin1String(".exe");
m_mappingFileContent m_mappingFileContent
+= QLatin1Char('"') + QDir::toNativeSeparators(targetPath) + QLatin1String("\" \"") += QLatin1Char('"') + QDir::toNativeSeparators(m_targetFilePath)
+ QLatin1String("\" \"")
+ QDir::toNativeSeparators(m_executablePathInManifest) + QLatin1String("\"\n"); + QDir::toNativeSeparators(m_executablePathInManifest) + QLatin1String("\"\n");
baseDir = targetDir; baseDir = m_targetDirPath;
} else { } else {
baseDir = targetInstallationPath.left(targetInstallationPath.lastIndexOf(QLatin1Char('/')) + 1); baseDir = targetInstallationPath.left(targetInstallationPath.lastIndexOf(QLatin1Char('/')) + 1);
} }
@@ -161,7 +183,8 @@ bool WinRtPackageDeploymentStep::processSucceeded(int exitCode, QProcess::ExitSt
+ QLatin1String("\"\n"); + QLatin1String("\"\n");
} }
const QString mappingFilePath = targetDir + m_manifestFileName + QLatin1String(".map"); const QString mappingFilePath = m_targetDirPath + m_manifestFileName
+ QLatin1String(".map");
QFile mappingFile(mappingFilePath); QFile mappingFile(mappingFilePath);
if (!mappingFile.open(QFile::WriteOnly | QFile::Text)) { if (!mappingFile.open(QFile::WriteOnly | QFile::Text)) {
raiseError(tr("Cannot open mapping file %1 for writing.").arg(mappingFilePath)); raiseError(tr("Cannot open mapping file %1 for writing.").arg(mappingFilePath));

View File

@@ -58,6 +58,8 @@ private:
bool parseIconsAndExecutableFromManifest(QString manifestFileName, QStringList *items, QString *executable); bool parseIconsAndExecutableFromManifest(QString manifestFileName, QStringList *items, QString *executable);
QString m_args; QString m_args;
QString m_targetFilePath;
QString m_targetDirPath;
QString m_executablePathInManifest; QString m_executablePathInManifest;
QString m_mappingFileContent; QString m_mappingFileContent;
QString m_manifestFileName; QString m_manifestFileName;

View File

@@ -20,11 +20,11 @@ QtcTool {
"dvtiphonesimulatorremoteclient/dvtiphonesimulatorremoteclient.h" "dvtiphonesimulatorremoteclient/dvtiphonesimulatorremoteclient.h"
] ]
cpp.includePaths: ["."] cpp.includePaths: ["."]
cpp.linkerFlags: base.concat(["-sectcreate", "__TEXT", "__info_plist", path + "/Info.plist", cpp.linkerFlags: base.concat(["-fobjc-link-runtime"])
"-fobjc-link-runtime"])
cpp.frameworks: base.concat(["Foundation", "CoreServices", "ApplicationServices", "IOKit", cpp.frameworks: base.concat(["Foundation", "CoreServices", "ApplicationServices", "IOKit",
"AppKit"]) "AppKit"])
cpp.frameworkPaths: base.concat("/System/Library/PrivateFrameworks") cpp.frameworkPaths: base.concat("/System/Library/PrivateFrameworks")
cpp.infoPlistFile: "Info.plist"
installDir: project.ide_libexec_path + "/ios" installDir: project.ide_libexec_path + "/ios"
} }

View File

@@ -20,11 +20,11 @@ QtcTool {
"version.h", "version.h",
"iphonesimulatorremoteclient/iphonesimulatorremoteclient.h" "iphonesimulatorremoteclient/iphonesimulatorremoteclient.h"
] ]
cpp.linkerFlags: base.concat(["-sectcreate", "__TEXT", "__info_plist", path + "/Info.plist", cpp.linkerFlags: base.concat(["-fobjc-link-runtime"])
"-fobjc-link-runtime"])
cpp.frameworks: base.concat(["Foundation", "CoreServices", "ApplicationServices", "IOKit", cpp.frameworks: base.concat(["Foundation", "CoreServices", "ApplicationServices", "IOKit",
"AppKit"]) "AppKit"])
cpp.frameworkPaths: base.concat("/System/Library/PrivateFrameworks") cpp.frameworkPaths: base.concat("/System/Library/PrivateFrameworks")
cpp.infoPlistFile: "Info.plist"
toolInstallDir: project.ide_libexec_path + "/ios" toolInstallDir: project.ide_libexec_path + "/ios"
} }

View File

@@ -15,10 +15,10 @@ QtcTool {
"iosdevicemanager.cpp", "iosdevicemanager.cpp",
"iosdevicemanager.h" "iosdevicemanager.h"
] ]
cpp.linkerFlags: base.concat(["-sectcreate", "__TEXT", "__info_plist", path + "/Info.plist"])
cpp.frameworks: base.concat(["CoreFoundation", "CoreServices", "IOKit", "Security", cpp.frameworks: base.concat(["CoreFoundation", "CoreServices", "IOKit", "Security",
"SystemConfiguration"]) "SystemConfiguration"])
cpp.dynamicLibraries: base.concat(["ssl", "bz2"]) cpp.dynamicLibraries: base.concat(["ssl", "bz2"])
cpp.infoPlistFile: "Info.plist"
installDir: project.ide_libexec_path + "/ios" installDir: project.ide_libexec_path + "/ios"
} }

View File

@@ -99,6 +99,7 @@
:Go to slot.OK_QPushButton {text='OK' type='QPushButton' unnamed='1' visible='1' window=':Go to slot_QDialog'} :Go to slot.OK_QPushButton {text='OK' type='QPushButton' unnamed='1' visible='1' window=':Go to slot_QDialog'}
:Go to slot.Select signal_QGroupBox {name='groupBox' title='Select signal' type='QGroupBox' visible='1' window=':Go to slot_QDialog'} :Go to slot.Select signal_QGroupBox {name='groupBox' title='Select signal' type='QGroupBox' visible='1' window=':Go to slot_QDialog'}
:Go to slot_QDialog {name='SelectSignalDialog' type='QDialog' visible='1' windowTitle='Go to slot'} :Go to slot_QDialog {name='SelectSignalDialog' type='QDialog' visible='1' windowTitle='Go to slot'}
:Help Widget_Help::Internal::HelpWidget {type='Help::Internal::HelpWidget' unnamed='1' visible='1' windowTitle?='Help -*'}
:Hits_QCLuceneResultWidget {aboveWidget=':Hits_QLabel' type='QCLuceneResultWidget' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'} :Hits_QCLuceneResultWidget {aboveWidget=':Hits_QLabel' type='QCLuceneResultWidget' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'}
:Hits_QLabel {text~='\\\\d+ - \\\\d+ of \\\\d+ Hits' type='QLabel' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'} :Hits_QLabel {text~='\\\\d+ - \\\\d+ of \\\\d+ Hits' type='QLabel' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'}
:JavaScript.QmlProfilerEventsTable_QmlProfiler::Internal::QV8ProfilerEventsMainView {container=':*Qt Creator.JavaScript_QDockWidget' name='QmlProfilerEventsTable' type='QmlProfiler::Internal::QV8ProfilerEventsMainView' visible='1'} :JavaScript.QmlProfilerEventsTable_QmlProfiler::Internal::QV8ProfilerEventsMainView {container=':*Qt Creator.JavaScript_QDockWidget' name='QmlProfilerEventsTable' type='QmlProfiler::Internal::QV8ProfilerEventsMainView' visible='1'}

View File

@@ -34,8 +34,6 @@ def openQmakeProject(projectPath, targets=Targets.desktopTargetClasses(), fromWe
cleanUpUserFiles(projectPath) cleanUpUserFiles(projectPath)
if fromWelcome: if fromWelcome:
mouseClick(waitForObject(":OpenProject_QStyleItem"), 5, 5, 0, Qt.LeftButton) mouseClick(waitForObject(":OpenProject_QStyleItem"), 5, 5, 0, Qt.LeftButton)
if not platform.system() == "Darwin":
waitFor("waitForObject(':fileNameEdit_QLineEdit', 1000).focus == True", 3000)
else: else:
invokeMenuItem("File", "Open File or Project...") invokeMenuItem("File", "Open File or Project...")
selectFromFileDialog(projectPath) selectFromFileDialog(projectPath)
@@ -737,13 +735,3 @@ def addCPlusPlusFileToCurrentProject(name, template, forceOverwrite=False, addTo
buttonToClick = 'Cancel' buttonToClick = 'Cancel'
clickButton("{text='%s' type='QPushButton' unnamed='1' visible='1' window=%s}" clickButton("{text='%s' type='QPushButton' unnamed='1' visible='1' window=%s}"
% (buttonToClick, overwriteDialog)) % (buttonToClick, overwriteDialog))
def qt5SDKPath():
if platform.system() in ('Microsoft', 'Windows'):
return os.path.abspath("C:/Qt/Qt5.0.1/5.0.1/msvc2010")
elif platform.system() == 'Linux':
if __is64BitOS__():
return os.path.expanduser("~/Qt5.0.1/5.0.1/gcc_64")
return os.path.expanduser("~/Qt5.0.1/5.0.1/gcc")
else:
return os.path.expanduser("~/Qt5.0.1/5.0.1/clang_64")

View File

@@ -102,6 +102,7 @@ def selectFromCombo(objectSpec, itemName):
return False return False
else: else:
mouseClick(object, 5, 5, 0, Qt.LeftButton) mouseClick(object, 5, 5, 0, Qt.LeftButton)
snooze(1)
mouseClick(waitForObjectItem(object, itemName.replace(".", "\\.")), 5, 5, 0, Qt.LeftButton) mouseClick(waitForObjectItem(object, itemName.replace(".", "\\.")), 5, 5, 0, Qt.LeftButton)
test.verify(waitFor("str(object.currentText)==itemName", 5000), test.verify(waitFor("str(object.currentText)==itemName", 5000),
"Switched combo item to '%s'" % itemName) "Switched combo item to '%s'" % itemName)
@@ -252,15 +253,23 @@ def selectFromFileDialog(fileName, waitForFile=False):
else: else:
fName = os.path.basename(os.path.abspath(fileName)) fName = os.path.basename(os.path.abspath(fileName))
pName = os.path.dirname(os.path.abspath(fileName)) + os.sep pName = os.path.dirname(os.path.abspath(fileName)) + os.sep
waitForObject("{name='QFileDialog' type='QFileDialog' visible='1'}") try:
pathLine = waitForObject("{name='fileNameEdit' type='QLineEdit' visible='1'}") waitForObject("{name='QFileDialog' type='QFileDialog' visible='1'}", 5000)
snooze(1) pathLine = waitForObject("{name='fileNameEdit' type='QLineEdit' visible='1'}")
replaceEditorContent(pathLine, pName) snooze(1)
clickButton(waitForObject("{text='Open' type='QPushButton'}")) replaceEditorContent(pathLine, pName)
waitFor("str(pathLine.text)==''") clickButton(waitForObject("{text='Open' type='QPushButton'}"))
snooze(1) waitFor("str(pathLine.text)==''")
replaceEditorContent(pathLine, fName) snooze(1)
clickButton(waitForObject("{text='Open' type='QPushButton'}")) replaceEditorContent(pathLine, fName)
clickButton(waitForObject("{text='Open' type='QPushButton'}"))
except:
nativeType("<Ctrl+a>")
nativeType("<Delete>")
nativeType(pName + fName)
snooze(1)
nativeType("<Return>")
snooze(3)
if waitForFile: if waitForFile:
fileCombo = waitForObject(":Qt Creator_FilenameQComboBox") fileCombo = waitForObject(":Qt Creator_FilenameQComboBox")
if not waitFor("str(fileCombo.currentText) in fileName", 5000): if not waitFor("str(fileCombo.currentText) in fileName", 5000):

Some files were not shown because too many files have changed in this diff Show More