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
imagedirs = $SRCDIR/images $SRCDIR/templates/images
outputdir = $OUTDIR
exampledirs = $SRCDIR/examples \
$SRCDIR/snippets
exampledirs = $SRCDIR/examples
indexes += $QDOC_INDEX_DIR/qtwidgets/qtwidgets.index \
$QDOC_INDEX_DIR/qtcore/qtcore.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
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 >
\gui {Text Editor} > \gui {Font & Colors}. Create your own color scheme and
select new colors for the following options:
@@ -86,4 +95,8 @@
synchronized. To use them independently of each other, select the
\inlineimage qtcreator-synchronizefocus.png
(\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}.
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,
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,
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-analyze.qdocinc
\include projects/creator-projects-settings-run-debug.qdocinc

View File

@@ -73,7 +73,7 @@ Module {
Artifact {
fileTags: ["qt_plugin_metadata"]
filePath: {
var destdir = FileInfo.joinPaths(product.moduleProperty("Qt/core", "generatedFilesDir"),
var destdir = FileInfo.joinPaths(product.moduleProperty("Qt.core", "generatedFilesDir"),
input.fileName);
return destdir.replace(/\.[^\.]*$/, '.json');
}
@@ -81,7 +81,7 @@ Module {
prepare: {
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 = [
"-no-format",
"-output",

View File

@@ -49,7 +49,7 @@ minQtVersion(5, 0, 0):exists(src/shared/qbs/qbs.pro) {
QBS_APPS_RPATH_DIR = @loader_path/../PlugIns
} else {
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_APPS_RPATH_DIR)
@@ -65,8 +65,10 @@ minQtVersion(5, 0, 0):exists(src/shared/qbs/qbs.pro) {
cache(QBS_RELATIVE_PLUGINS_PATH)
QBS_RELATIVE_SEARCH_PATH = $$relative_path($$QBS_RESOURCES_BUILD_DIR, $$QBS_APPS_DESTDIR)
cache(QBS_RELATIVE_SEARCH_PATH)
!qbs_no_dev_install {
QBS_CONFIG_ADDITION = qbs_no_dev_install qbs_enable_project_file_updates
cache(CONFIG, add, QBS_CONFIG_ADDITION)
}
}
contains(QT_ARCH, i386): ARCHITECTURE = x86

View File

@@ -37,7 +37,9 @@
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()
: m_keyNumber(0)
@@ -63,7 +65,7 @@ quint32 ValuesChangedCommand::keyNumber() const
void ValuesChangedCommand::removeSharedMemorys(const QVector<qint32> &keyNumberVector)
{
foreach (qint32 keyNumber, keyNumberVector) {
SharedMemory *sharedMemory = globalSharedMemoryCache.take(keyNumber);
SharedMemory *sharedMemory = globalSharedMemoryContainer()->take(keyNumber);
delete sharedMemory;
}
}
@@ -82,8 +84,10 @@ static SharedMemory *createSharedMemory(qint32 key, int byteCount)
bool sharedMemoryIsCreated = sharedMemory->create(byteCount);
if (sharedMemoryIsCreated) {
globalSharedMemoryCache.insert(key, sharedMemory);
globalSharedMemoryContainer()->insert(key, sharedMemory);
return sharedMemory;
} else {
delete sharedMemory;
}
return 0;

View File

@@ -42,7 +42,9 @@
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()
: m_instanceId(-1),
@@ -82,7 +84,7 @@ void ImageContainer::setImage(const QImage &image)
void ImageContainer::removeSharedMemorys(const QVector<qint32> &keyNumberVector)
{
foreach (qint32 keyNumber, keyNumberVector) {
SharedMemory *sharedMemory = globalSharedMemoryCache.take(keyNumber);
SharedMemory *sharedMemory = globalSharedMemoryContainer()->take(keyNumber);
delete sharedMemory;
}
}
@@ -91,13 +93,13 @@ static const QLatin1String imageKeyTemplateString("Image-%1");
static SharedMemory *createSharedMemory(qint32 key, int byteCount)
{
SharedMemory *sharedMemory = globalSharedMemoryCache.take(key);
SharedMemory *sharedMemory = (*globalSharedMemoryContainer())[key];
if (sharedMemory == 0) {
sharedMemory = new SharedMemory(QString(imageKeyTemplateString).arg(key));
bool sharedMemoryIsCreated = sharedMemory->create(byteCount);
if (sharedMemoryIsCreated) {
globalSharedMemoryCache.insert(key, sharedMemory);
globalSharedMemoryContainer()->insert(key, sharedMemory);
} else {
delete sharedMemory;
sharedMemory = 0;
@@ -118,8 +120,7 @@ static SharedMemory *createSharedMemory(qint32 key, int byteCount)
}
if (!sharedMemory->isAttached()) {
globalSharedMemoryCache.remove(key);
delete sharedMemory;
globalSharedMemoryContainer()->remove(key);
sharedMemory = 0;
}
}

View File

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

View File

@@ -1,5 +1,44 @@
import QtQuick 2.2
import QtQuick 2.1
import QtQuick.Controls 1.0
Rectangle {
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;
}
static bool isSimpleExpression(const QString &expression)
{
if (expression.startsWith(QStringLiteral("{")))
return false;
return true;
}
namespace QmlDesigner {
namespace Internal {
@@ -512,6 +520,9 @@ void ObjectNodeInstance::setPropertyBinding(const PropertyName &name, const QStr
if (ignoredProperties().contains(name))
return;
if (!isSimpleExpression(expression))
return;
QQmlProperty property(object(), name, context());
if (!property.isValid())
@@ -1084,6 +1095,15 @@ static bool isCrashingType(QQmlType *type)
if (type->qmlTypeName() == QStringLiteral("QtMultimedia/Audio"))
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;

View File

@@ -38,11 +38,26 @@
#include <designersupport.h>
#if defined(Q_OS_UNIX)
#include <unistd.h>
#elif defined(Q_OS_WIN)
#include <windows.h>
#endif
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) :
NodeInstanceClientProxy(parent)
{
prioritizeDown();
DesignerSupport::activateDesignerWindowManager();
if (QCoreApplication::arguments().at(1) == QLatin1String("--readcapturedstream")) {
qputenv("DESIGNER_DONT_USE_SHARED_MEMORY", "1");

View File

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

View File

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

View File

@@ -32,7 +32,7 @@ import QtQuick.Controls 1.1 as Controls
import QtQuick.Controls.Styles 1.1
CheckBoxStyle {
spacing: 8
spacing: 24
label: Controls.Label { text: control.text ; color: checkBox.textColor }
indicator: Item {
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
AligmentVerticalButtons 2.0 AligmentVerticalButtons.qml
StandardTextSection 2.0 StandardTextSection.qml
FontSection 2.0 FontSection.qml
FlickableSection 2.0 FlickableSection.qml
UrlChooser 2.0 UrlChooser.qml
FontComboBox 2.0 FontComboBox.qml
OriginControl 2.0 OriginControl.qml
AnchorButtons 2.0 AnchorButtons.qml
BoolButtonRowButton 2.0 BoolButtonRowButton.qml
Button 2.0 Button.qml
ButtonRow 2.0 ButtonRow.qml
ButtonRowButton 2.0 ButtonRowButton.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
CustomSpinBoxStyle 2.0 CustomSpinBoxStyle.qml
CustomCheckBoxStyle 2.0 CustomCheckBoxStyle.qml
ColorLogic 2.0 ColorLogic.qml
ExpandingSpacer 2.0 ExpandingSpacer.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
UrlChooser 2.0 UrlChooser.qml

View File

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

View File

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

View File

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

View File

@@ -30,7 +30,7 @@
****************************************************************************/
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>
<displayname>Simple Script-Generated Project</displayname>;
<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: [
"QtConcurrentTools",
"algorithm.h",
"annotateditemdelegate.cpp",
"annotateditemdelegate.h",
"ansiescapecodehandler.cpp",

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -132,7 +132,9 @@ void SimpleDiffEditorReloader::reload()
QList<FileData> fileDataList;
fileDataList << fileData;
controller()->requestSaveState();
controller()->setDiffFiles(fileDataList);
controller()->requestRestoreState();
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 << RowData(_("ABCD"));
rows << RowData(TextLineData::Separator, _(""));
@@ -418,6 +439,26 @@ void DiffEditor::Internal::DiffEditorPlugin::testMakePatch_data()
<< fileName
<< false
<< 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()
@@ -748,6 +789,37 @@ void DiffEditor::Internal::DiffEditorPlugin::testReadPatch_data()
QTest::newRow("2 chunks - first ends with blank line") << patch
<< 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()

View File

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

View File

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

View File

@@ -154,6 +154,8 @@ public:
public slots:
void setDisplaySettings(const DisplaySettings &ds);
void saveStateRequested();
void restoreStateRequested();
signals:
void jumpToOriginalFileRequested(int diffFileIndex,
@@ -205,6 +207,7 @@ private:
QColor m_fileLineForeground;
QColor m_chunkLineForeground;
QColor m_textForeground;
QByteArray m_state;
// MultiHighlighter *m_highlighter;
};
@@ -338,6 +341,23 @@ SideDiffEditorWidget::SideDiffEditorWidget(QWidget *parent)
// 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)
{
DisplaySettings settings = displaySettings();
@@ -836,6 +856,7 @@ SideBySideDiffEditorWidget::SideBySideDiffEditorWidget(QWidget *parent)
QVBoxLayout *l = new QVBoxLayout(this);
l->setMargin(0);
l->addWidget(m_splitter);
setFocusProxy(m_rightEditor);
clear(tr("No controller"));
}
@@ -856,6 +877,14 @@ void SideBySideDiffEditorWidget::setDiffEditorGuiController(
this, SLOT(clearAll(QString)));
disconnect(m_controller, SIGNAL(diffFilesChanged(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)),
this, SLOT(setCurrentDiffFileIndex(int)));
@@ -871,6 +900,14 @@ void SideBySideDiffEditorWidget::setDiffEditorGuiController(
this, SLOT(clearAll(QString)));
connect(m_controller, SIGNAL(diffFilesChanged(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)),
this, SLOT(setCurrentDiffFileIndex(int)));
@@ -936,11 +973,6 @@ void SideBySideDiffEditorWidget::setCurrentDiffFileIndex(int diffFileIndex)
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"));
QMap<int, QList<DiffSelection> > leftFormats;
@@ -1151,11 +1183,6 @@ void SideBySideDiffEditorWidget::showDiff()
}
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_rightEditor->updateFoldingHighlight(QPoint(-1, -1));
}

View File

@@ -134,6 +134,10 @@ void UnifiedDiffEditorWidget::setDiffEditorGuiController(
this, SLOT(clearAll(QString)));
disconnect(m_controller, SIGNAL(diffFilesChanged(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)),
this, SLOT(setCurrentDiffFileIndex(int)));
@@ -149,6 +153,10 @@ void UnifiedDiffEditorWidget::setDiffEditorGuiController(
this, SLOT(clearAll(QString)));
connect(m_controller, SIGNAL(diffFilesChanged(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)),
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
{
return m_guiController;
@@ -613,7 +638,9 @@ QString UnifiedDiffEditorWidget::showChunk(const ChunkData &chunkData,
+ QString::number(chunkData.rightStartingLineNumber+ 1)
+ QLatin1Char(',')
+ QString::number(rightLineCount)
+ QLatin1String(" @@\n");
+ QLatin1String(" @@")
+ chunkData.contextInfo
+ QLatin1Char('\n');
diffText.prepend(chunkLine);

View File

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

View File

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

View File

@@ -124,13 +124,19 @@ public:
private slots:
void slotShowDescriptionReceived(const QString &data);
void slotDiffOutputReceived(const QString &contents);
void slotTextualDiffOutputReceived(const QString &contents);
private:
void postCollectShowDescription(const QString &id);
void postCollectDiffOutput(const QStringList &arguments);
void postCollectDiffOutput(const QList<QStringList> &argumentsList);
void addJob(VcsBase::Command *command, const QStringList &arguments);
void postCollectTextualDiffOutputUsingDiffCommand(const QStringList &arguments);
void postCollectTextualDiffOutputUsingDiffCommand(const QList<QStringList> &argumentsList);
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;
QProcessEnvironment processEnvironment() const;
Utils::FileName gitPath() const;
@@ -154,7 +160,9 @@ GitDiffHandler::GitDiffHandler(DiffEditor::DiffEditorController *controller,
void GitDiffHandler::diffFile(const QString &fileName)
{
postCollectDiffOutput(QStringList() << QLatin1String("--") << fileName);
postCollectTextualDiffOutputUsingDiffCommand(addHeadWhenCommandInProgress()
<< QLatin1String("--")
<< fileName);
}
void GitDiffHandler::diffFiles(const QStringList &stagedFileNames,
@@ -169,28 +177,31 @@ void GitDiffHandler::diffFiles(const QStringList &stagedFileNames,
arguments << stagedArguments;
if (!unstagedFileNames.isEmpty()) {
QStringList unstagedArguments;
QStringList unstagedArguments = addHeadWhenCommandInProgress();
unstagedArguments << QLatin1String("--");
unstagedArguments << unstagedFileNames;
arguments << unstagedArguments;
}
postCollectDiffOutput(arguments);
postCollectTextualDiffOutputUsingDiffCommand(arguments);
}
void GitDiffHandler::diffProjects(const QStringList &projectPaths)
{
postCollectDiffOutput(QStringList() << QLatin1String("--") << projectPaths);
postCollectTextualDiffOutputUsingDiffCommand(addHeadWhenCommandInProgress()
<< QLatin1String("--")
<< projectPaths);
}
void GitDiffHandler::diffRepository()
{
postCollectDiffOutput(QStringList());
postCollectTextualDiffOutputUsingDiffCommand(addHeadWhenCommandInProgress());
}
void GitDiffHandler::diffBranch(const QString &branchName)
{
postCollectDiffOutput(QStringList() << branchName);
postCollectTextualDiffOutputUsingDiffCommand(addHeadWhenCommandInProgress()
<< branchName);
}
void GitDiffHandler::show(const QString &id)
@@ -206,6 +217,7 @@ void GitDiffHandler::postCollectShowDescription(const QString &id)
return;
}
m_controller->requestSaveState();
m_controller->clear(m_waitMessage);
VcsBase::Command *command = new VcsBase::Command(gitPath(),
m_workingDirectory,
@@ -231,7 +243,11 @@ void GitDiffHandler::slotShowDescriptionReceived(const QString &description)
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
m_controller->setDescription(
@@ -239,10 +255,14 @@ void GitDiffHandler::slotShowDescriptionReceived(const QString &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;
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())
args << QLatin1String("--ignore-space-change");
args << QLatin1String("--unified=") + QString::number(
@@ -251,34 +271,57 @@ void GitDiffHandler::addJob(VcsBase::Command *command, const QStringList &argume
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()) {
deleteLater();
return;
}
m_controller->requestSaveState();
m_controller->clear(m_waitMessage);
VcsBase::Command *command = new VcsBase::Command(gitPath(),
m_workingDirectory,
processEnvironment());
command->setCodec(EditorManager::defaultTextCodec());
connect(command, SIGNAL(output(QString)),
this, SLOT(slotDiffOutputReceived(QString)));
this, SLOT(slotTextualDiffOutputReceived(QString)));
command->addFlags(diffExecutionFlags());
for (int i = 0; i < argumentsList.count(); i++)
addJob(command, argumentsList.at(i));
addJob(command, gitCommand, argumentsList.at(i));
command->execute();
}
void GitDiffHandler::slotDiffOutputReceived(const QString &contents)
void GitDiffHandler::slotTextualDiffOutputReceived(const QString &contents)
{
if (m_controller.isNull()) {
deleteLater();
@@ -290,6 +333,7 @@ void GitDiffHandler::slotDiffOutputReceived(const QString &contents)
= DiffEditor::DiffUtils::readPatch(
contents, m_controller->isIgnoreWhitespace(), &ok);
m_controller->setDiffFiles(fileDataList, m_workingDirectory);
m_controller->requestRestoreState();
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"))
|| dir.contains(QLatin1String("/.git/"))) {
@@ -937,7 +981,7 @@ VcsBase::VcsBaseEditorWidget *GitClient::createVcsEditor(
void GitClient::diff(const QString &workingDirectory,
const QStringList &unstagedFileNames,
const QStringList &stagedFileNames)
const QStringList &stagedFileNames) const
{
GitDiffEditorReloader::DiffType diffType = GitDiffEditorReloader::DiffProjectList;
@@ -968,19 +1012,24 @@ void GitClient::diff(const QString &workingDirectory,
controller->setReloader(reloader);
reloader->setWorkingDirectory(workingDirectory);
}
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)
else if (diffType == GitDiffEditorReloader::DiffProjectList) // the same when unstaged file was clicked
reloader->setProjectList(unstagedFileNames);
}
diffEditorDocument->controller()->requestReload();
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 sourceFile = VcsBase::VcsBaseEditorWidget::getSource(
@@ -1006,7 +1055,7 @@ void GitClient::diff(const QString &workingDirectory, const QString &fileName)
}
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 documentId = QLatin1String("Branch:") + branchName;
@@ -1521,7 +1570,7 @@ static inline bool splitCommitParents(const QString &line,
}
bool GitClient::synchronousRevListCmd(const QString &workingDirectory, const QStringList &arguments,
QString *output, QString *errorMessage)
QString *output, QString *errorMessage) const
{
QByteArray outputTextData;
QByteArray errorText;
@@ -1545,7 +1594,7 @@ bool GitClient::synchronousParentRevisions(const QString &workingDirectory,
const QStringList &files /* = QStringList() */,
const QString &revision,
QStringList *parents,
QString *errorMessage)
QString *errorMessage) const
{
QString outputText;
QString errorText;
@@ -1578,7 +1627,7 @@ bool GitClient::synchronousParentRevisions(const QString &workingDirectory,
static const char defaultShortLogFormatC[] = "%h (%an \"%s";
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
QString output = synchronousShortDescription(workingDirectory, revision,
@@ -1593,7 +1642,7 @@ QString GitClient::synchronousShortDescription(const QString &workingDirectory,
return output;
}
QString GitClient::synchronousCurrentLocalBranch(const QString &workingDirectory)
QString GitClient::synchronousCurrentLocalBranch(const QString &workingDirectory) const
{
QByteArray outputTextData;
QStringList arguments;
@@ -1611,7 +1660,7 @@ QString GitClient::synchronousCurrentLocalBranch(const QString &workingDirectory
}
bool GitClient::synchronousHeadRefs(const QString &workingDirectory, QStringList *output,
QString *errorMessage)
QString *errorMessage) const
{
QStringList args;
args << QLatin1String("show-ref") << QLatin1String("--head")
@@ -1643,7 +1692,7 @@ bool GitClient::synchronousHeadRefs(const QString &workingDirectory, QStringList
}
// 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
QString branch = synchronousCurrentLocalBranch(workingDirectory);
@@ -1711,7 +1760,7 @@ QString GitClient::synchronousTopRevision(const QString &workingDirectory, QStri
}
void GitClient::synchronousTagsForCommit(const QString &workingDirectory, const QString &revision,
QString &precedes, QString &follows)
QString &precedes, QString &follows) const
{
QByteArray pr;
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.
QString GitClient::synchronousShortDescription(const QString &workingDirectory, const QString &revision,
const QString &format)
const QString &format) const
{
QString description;
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). */
QString GitClient::synchronousStash(const QString &workingDirectory, const QString &messageKeyword,
unsigned flags, bool *unchanged)
unsigned flags, bool *unchanged) const
{
if (unchanged)
*unchanged = false;
@@ -1874,7 +1923,7 @@ QString GitClient::synchronousStash(const QString &workingDirectory, const QStri
bool GitClient::executeSynchronousStash(const QString &workingDirectory,
const QString &message,
QString *errorMessage)
QString *errorMessage) const
{
QByteArray outputText;
QByteArray errorText;
@@ -1893,7 +1942,7 @@ bool GitClient::executeSynchronousStash(const QString &workingDirectory,
// Resolve a stash name from message
bool GitClient::stashNameFromMessage(const QString &workingDirectory,
const QString &message, QString *name,
QString *errorMessage)
QString *errorMessage) const
{
// All happy
if (message.startsWith(QLatin1String(stashNamePrefix))) {
@@ -1917,7 +1966,7 @@ bool GitClient::stashNameFromMessage(const QString &workingDirectory,
}
bool GitClient::synchronousBranchCmd(const QString &workingDirectory, QStringList branchArgs,
QString *output, QString *errorMessage)
QString *output, QString *errorMessage) const
{
branchArgs.push_front(QLatin1String("branch"));
QByteArray outputText;
@@ -1931,7 +1980,7 @@ bool GitClient::synchronousBranchCmd(const QString &workingDirectory, QStringLis
}
bool GitClient::synchronousTagCmd(const QString &workingDirectory, QStringList tagArgs,
QString *output, QString *errorMessage)
QString *output, QString *errorMessage) const
{
tagArgs.push_front(QLatin1String("tag"));
QByteArray outputText;
@@ -1945,7 +1994,7 @@ bool GitClient::synchronousTagCmd(const QString &workingDirectory, QStringList t
}
bool GitClient::synchronousForEachRefCmd(const QString &workingDirectory, QStringList args,
QString *output, QString *errorMessage)
QString *output, QString *errorMessage) const
{
args.push_front(QLatin1String("for-each-ref"));
QByteArray outputText;
@@ -1960,7 +2009,7 @@ bool GitClient::synchronousForEachRefCmd(const QString &workingDirectory, QStrin
}
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"));
QByteArray outputText;
@@ -1975,7 +2024,7 @@ bool GitClient::synchronousRemoteCmd(const QString &workingDirectory, QStringLis
}
QMap<QString,QString> GitClient::synchronousRemotesList(const QString &workingDirectory,
QString *errorMessage)
QString *errorMessage) const
{
QMap<QString,QString> result;
QString output;
@@ -2001,7 +2050,7 @@ QMap<QString,QString> GitClient::synchronousRemotesList(const QString &workingDi
}
QStringList GitClient::synchronousSubmoduleStatus(const QString &workingDirectory,
QString *errorMessage)
QString *errorMessage) const
{
QByteArray outputTextData;
QByteArray errorText;
@@ -2018,7 +2067,7 @@ QStringList GitClient::synchronousSubmoduleStatus(const QString &workingDirector
return commandOutputLinesFromLocal8Bit(outputTextData);
}
SubmoduleDataMap GitClient::submoduleList(const QString &workingDirectory)
SubmoduleDataMap GitClient::submoduleList(const QString &workingDirectory) const
{
SubmoduleDataMap result;
QString gitmodulesFileName = workingDirectory + QLatin1String("/.gitmodules");
@@ -2076,7 +2125,7 @@ SubmoduleDataMap GitClient::submoduleList(const QString &workingDirectory)
}
bool GitClient::synchronousShow(const QString &workingDirectory, const QString &id,
QString *output, QString *errorMessage)
QString *output, QString *errorMessage) const
{
if (!canShow(id)) {
*errorMessage = msgCannotShow(id);
@@ -2253,7 +2302,7 @@ bool GitClient::isValidRevision(const QString &revision) const
Utils::SynchronousProcessResponse GitClient::synchronousGit(const QString &workingDirectory,
const QStringList &gitArguments,
unsigned flags,
QTextCodec *outputCodec)
QTextCodec *outputCodec) const
{
return VcsBasePlugin::runVcs(workingDirectory, gitExecutable(), gitArguments,
settings()->intValue(GitSettings::timeoutKey) * 1000,
@@ -2339,7 +2388,7 @@ void GitClient::fetchFinished(const QVariant &cookie)
}
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.
QByteArray outputText;
@@ -2378,7 +2427,7 @@ GitClient::StatusResult GitClient::gitStatus(const QString &workingDirectory, St
return StatusUnchanged;
}
QString GitClient::commandInProgressDescription(const QString &workingDirectory)
QString GitClient::commandInProgressDescription(const QString &workingDirectory) const
{
switch (checkCommandInProgress(workingDirectory)) {
case NoCommand:
@@ -2396,7 +2445,7 @@ QString GitClient::commandInProgressDescription(const QString &workingDirectory)
return QString();
}
GitClient::CommandInProgress GitClient::checkCommandInProgress(const QString &workingDirectory)
GitClient::CommandInProgress GitClient::checkCommandInProgress(const QString &workingDirectory) const
{
const QString gitDir = findGitDirForRepository(workingDirectory);
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 ")))
return text;
@@ -2509,7 +2558,7 @@ QString GitClient::extendedShowDescription(const QString &workingDirectory, cons
// Quietly retrieve branch list of remote repository URL
//
// 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"));
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,
const QStringList &arguments,
const QString &abortCommand)
const QString &abortCommand) const
{
// Disable UNIX terminals to suppress SSH prompting.
const unsigned flags = VcsBasePlugin::SshPasswordPrompt
@@ -3374,7 +3423,7 @@ void GitClient::stashPop(const QString &workingDirectory)
bool GitClient::synchronousStashRestore(const QString &workingDirectory,
const QString &stash,
bool pop,
const QString &branch /* = QString()*/)
const QString &branch /* = QString()*/) const
{
QStringList arguments(QLatin1String("stash"));
if (branch.isEmpty())
@@ -3386,7 +3435,7 @@ bool GitClient::synchronousStashRestore(const QString &workingDirectory,
bool GitClient::synchronousStashRemove(const QString &workingDirectory,
const QString &stash /* = QString() */,
QString *errorMessage /* = 0 */)
QString *errorMessage /* = 0 */) const
{
QStringList arguments(QLatin1String("stash"));
if (stash.isEmpty())
@@ -3408,7 +3457,7 @@ bool GitClient::synchronousStashRemove(const QString &workingDirectory,
bool GitClient::synchronousStashList(const QString &workingDirectory,
QList<Stash> *stashes,
QString *errorMessage /* = 0 */)
QString *errorMessage /* = 0 */) const
{
stashes->clear();
QStringList arguments(QLatin1String("stash"));

View File

@@ -139,16 +139,16 @@ public:
Utils::FileName gitExecutable(bool *ok = 0, 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;
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,
const QStringList &unstagedFileNames,
const QStringList &stagedFileNames = QStringList());
const QStringList &stagedFileNames = QStringList()) const;
void diffBranch(const QString &workingDirectory,
const QString &branchName);
const QString &branchName) const;
void merge(const QString &workingDirectory, const QStringList &unmergedFileNames = QStringList());
void status(const QString &workingDirectory);
@@ -193,57 +193,57 @@ public:
enum { StashPromptDescription = 0x1, StashImmediateRestore = 0x2, StashIgnoreUnchanged = 0x4 };
QString synchronousStash(const QString &workingDirectory,
const QString &messageKeyword = QString(),
unsigned flags = 0, bool *unchanged = 0);
unsigned flags = 0, bool *unchanged = 0) const;
bool executeSynchronousStash(const QString &workingDirectory,
const QString &message = QString(),
QString *errorMessage = 0);
QString *errorMessage = 0) const;
bool synchronousStashRestore(const QString &workingDirectory,
const QString &stash,
bool pop = false,
const QString &branch = QString());
const QString &branch = QString()) const;
bool synchronousStashRemove(const QString &workingDirectory,
const QString &stash = QString(),
QString *errorMessage = 0);
QString *errorMessage = 0) const;
bool synchronousBranchCmd(const QString &workingDirectory, QStringList branchArgs,
QString *output, QString *errorMessage);
QString *output, QString *errorMessage) const;
bool synchronousTagCmd(const QString &workingDirectory, QStringList tagArgs,
QString *output, QString *errorMessage);
QString *output, QString *errorMessage) const;
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,
QString *output, QString *errorMessage, bool silent = false);
QString *output, QString *errorMessage, bool silent = false) const;
QMap<QString,QString> synchronousRemotesList(const QString &workingDirectory,
QString *errorMessage = 0);
QString *errorMessage = 0) const;
QStringList synchronousSubmoduleStatus(const QString &workingDirectory,
QString *errorMessage = 0);
SubmoduleDataMap submoduleList(const QString &workingDirectory);
QString *errorMessage = 0) const;
SubmoduleDataMap submoduleList(const QString &workingDirectory) const;
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,
QString *output, QString *errorMessage = 0);
QString *output, QString *errorMessage = 0) const;
bool synchronousParentRevisions(const QString &workingDirectory,
const QStringList &files /* = QStringList() */,
const QString &revision,
QStringList *parents,
QString *errorMessage);
QString synchronousShortDescription(const QString &workingDirectory, const QString &revision);
QString *errorMessage) const;
QString synchronousShortDescription(const QString &workingDirectory, const QString &revision) const;
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,
QString *errorMessage = 0);
QString synchronousTopic(const QString &workingDirectory);
QString *errorMessage = 0) const;
QString synchronousTopic(const QString &workingDirectory) const;
bool synchronousRevParseCmd(const QString &workingDirectory, const QString &ref,
QString *output, QString *errorMessage = 0) const;
QString synchronousTopRevision(const QString &workingDirectory, QString *errorMessage = 0);
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 isFastForwardMerge(const QString &workingDirectory, const QString &branch);
@@ -279,11 +279,11 @@ public:
void revert(const QStringList &files, bool revertStaging);
bool synchronousStashList(const QString &workingDirectory,
QList<Stash> *stashes,
QString *errorMessage = 0);
QString *errorMessage = 0) const;
// Resolve a stash name from message (for IVersionControl's names).
bool stashNameFromMessage(const QString &workingDirectory,
const QString &messge, QString *name,
QString *errorMessage = 0);
QString *errorMessage = 0) const;
QString readConfigValue(const QString &workingDirectory, const QString &configVar) const;
@@ -305,14 +305,14 @@ public:
StatusResult gitStatus(const QString &workingDirectory,
StatusMode mode,
QString *output = 0,
QString *errorMessage = 0);
QString *errorMessage = 0) const;
CommandInProgress checkCommandInProgress(const QString &workingDirectory);
QString commandInProgressDescription(const QString &workingDirectory);
CommandInProgress checkCommandInProgress(const QString &workingDirectory) const;
QString commandInProgressDescription(const QString &workingDirectory) const;
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) { launchGitK(workingDirectory, QString()); }
@@ -321,7 +321,7 @@ public:
void launchRepositoryBrowser(const QString &workingDirectory);
QStringList synchronousRepositoryBranches(const QString &repositoryURL);
QStringList synchronousRepositoryBranches(const QString &repositoryURL) const;
GitSettings *settings() const;
@@ -397,7 +397,7 @@ private:
// log windows updating (using VcsBasePlugin::runVcs with flags).
inline Utils::SynchronousProcessResponse
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.
unsigned synchronousGitVersion(QString *errorMessage = 0) const;
@@ -409,7 +409,7 @@ private:
bool revertStaging);
void connectRepositoryChanged(const QString & repository, VcsBase::Command *cmd);
bool executeAndHandleConflicts(const QString &workingDirectory, const QStringList &arguments,
const QString &abortCommand = QString());
const QString &abortCommand = QString()) const;
bool tryLauchingGitK(const QProcessEnvironment &env,
const QString &workingDirectory,
const QString &fileName,

View File

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

View File

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

View File

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

View File

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

View File

@@ -163,6 +163,10 @@ QVariantMap DefaultPropertyProvider::properties(const ProjectExplorer::Kit *k, c
if (!toolchainPrefix.isEmpty())
data.insert(QLatin1String(CPP_TOOLCHAINPREFIX), toolchainPrefix);
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());
if (targetAbi.osFlavor() == ProjectExplorer::Abi::WindowsMsvc2013Flavor) {
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_TOOLCHAINPREFIX[] = "cpp.toolchainPrefix";
const char CPP_COMPILERNAME[] = "cpp.compilerName";
const char CPP_LINKERNAME[] = "cpp.linkerName";
const char CPP_PLATFORMCFLAGS[] = "cpp.platformCFlags";
const char CPP_PLATFORMCXXFLAGS[] = "cpp.platformCxxFlags";
const char CPP_XCODESDKNAME[] = "cpp.xcodeSdkName";

View File

@@ -749,6 +749,13 @@ void QbsProject::updateApplicationTargets(const qbs::ProjectData &projectData)
{
ProjectExplorer::BuildTargetInfoList applications;
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()) {
QTC_ASSERT(ta.isValid(), continue);
if (!ta.isExecutable())

View File

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

View File

@@ -228,8 +228,11 @@ QString CreateAndroidManifestWizard::sourceFileName() const
return srcFolder;
Utils::FileName srcPath
= Utils::FileName::fromString(srcFolder)
.appendPath(QLatin1String("src/android/java"));
srcPath.appendPath(QLatin1String("AndroidManifest.xml"));
.appendPath(QLatin1String("src/android"));
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();
}

View File

@@ -597,7 +597,7 @@ static QString generatePreTargetDepsSnippet(AddLibraryWizard::Platforms platform
generatedPlatforms |= windowsPlatforms;
} else {
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
}
// mingw not generated yet, will be joined with unix like

View File

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

View File

@@ -31,6 +31,8 @@
#include <utils/qtcassert.h>
#include <utils/fileutils.h>
#include <extensionsystem/pluginmanager.h>
#include <extensionsystem/pluginspec.h>
#include <QDebug>
#include <QDir>
@@ -173,6 +175,12 @@ class TemplateInfoList
public:
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;
foreach (const QString &templateName, templateNames()) {
const QString templatePath = templateRootDirectory() + templateName;
@@ -185,7 +193,17 @@ public:
info.templateName = templateName;
info.templatePath = templatePath;
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);
}
m_templateInfoList = multiMap.values();

View File

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

View File

@@ -30,8 +30,6 @@
#include "qtquickappwizardpages.h"
#include <utils/wizard.h>
#include <extensionsystem/pluginmanager.h>
#include <extensionsystem/pluginspec.h>
#include <QComboBox>
#include <QLabel>
@@ -58,23 +56,8 @@ QtQuickComponentSetPage::QtQuickComponentSetPage(QWidget *parent)
QLabel *label = new QLabel(tr("Qt Quick component set:"), this);
d->m_versionComboBox = new QComboBox(this);
QSet<QString> availablePlugins;
foreach (ExtensionSystem::PluginSpec *s, ExtensionSystem::PluginManager::plugins()) {
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)
foreach (const TemplateInfo &templateInfo, QtQuickApp::templateInfos())
d->m_versionComboBox->addItem(templateInfo.displayName);
}
l->addWidget(label);
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*/)
{
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*/)

View File

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

View File

@@ -81,7 +81,7 @@ void DragTool::keyPressEvent(QKeyEvent *event)
if (event->key() == Qt::Key_Escape) {
abort();
event->accept();
m_rewriterTransaction.commit();
commitTransaction();
view()->changeToSelectionTool();
}
}
@@ -232,7 +232,7 @@ void DragTool::dropEvent(const QList<QGraphicsItem*> &/*itemList*/, QGraphicsSce
event->accept();
end(generateUseSnapping(event->modifiers()));
m_rewriterTransaction.commit();
commitTransaction();
if (m_dragNode.isValid())
view()->setSelectedModelNode(m_dragNode);
@@ -282,7 +282,7 @@ void DragTool::dragLeaveEvent(const QList<QGraphicsItem*> &/*itemList*/, QGraphi
if (m_dragNode.isValid())
m_dragNode.destroy();
m_rewriterTransaction.commit();
commitTransaction();
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 move(const QPointF &scenePos, const QList<QGraphicsItem *> &itemList);
void createDragNode(const QMimeData *mimeData, const QPointF &scenePosition, const QList<QGraphicsItem *> &itemList);
void commitTransaction();
private:
MoveManipulator m_moveManipulator;

View File

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

View File

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

View File

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

View File

@@ -50,8 +50,11 @@
#include <QtDebug>
#define DISABLE_VISIBLE_PROPERTIES
namespace QmlDesigner {
#ifndef DISABLE_VISIBLE_PROPERTIES
static PropertyNameList visibleProperties(const ModelNode &node)
{
PropertyNameList propertyList;
@@ -75,6 +78,7 @@ static PropertyNameList visibleProperties(const ModelNode &node)
return propertyList;
}
#endif
static QList<ModelNode> acceptedModelNodeChildren(const ModelNode &parentNode)
{
@@ -84,7 +88,9 @@ static QList<ModelNode> acceptedModelNodeChildren(const ModelNode &parentNode)
if (parentNode.metaInfo().hasDefaultProperty())
properties.append(parentNode.metaInfo().defaultPropertyName());
#ifndef DISABLE_VISIBLE_PROPERTIES
properties.append(visibleProperties(parentNode));
#endif
foreach (const PropertyName &propertyName, properties) {
AbstractProperty property(parentNode.property(propertyName));
@@ -201,7 +207,9 @@ static bool computeTarget(const QModelIndex &rowModelIndex,
ModelNode targetNode = navigatorTreeModel->nodeForIndex(targetItemIndex);
if (!targetNode.metaInfo().hasDefaultProperty())
return false;
#ifndef DISABLE_VISIBLE_PROPERTIES
*targetRowNumber -= visibleProperties(targetNode).count();
#endif
targetPropertyName = targetNode.metaInfo().defaultPropertyName();
} else {
targetItemIndex = rowModelIndex.parent();
@@ -280,6 +288,7 @@ ItemRow NavigatorTreeModel::createItemRow(const ModelNode &node)
visibilityItem->setCheckable(false);
QMap<QString, QStandardItem *> propertyItems;
#ifndef DISABLE_VISIBLE_PROPERTIES
foreach (const QString &propertyName, visibleProperties(node)) {
QStandardItem *propertyItem = new QStandardItem;
propertyItem->setSelectable(false);
@@ -290,6 +299,7 @@ ItemRow NavigatorTreeModel::createItemRow(const ModelNode &node)
propertyItems.insert(propertyName, propertyItem);
idItem->appendRow(propertyItem);
}
#endif
# ifdef _LOCK_ITEMS_
ItemRow newRow = ItemRow(idItem, lockItem, visibilityItem, propertyItems);
@@ -334,13 +344,16 @@ static void findTargetItem(const NodeListProperty &listProperty,
int *newRowNumber,
QStandardItem **targetItem)
{
Q_UNUSED(newRowNumber);
if (navigatorTreeModel->isInTree(listProperty.parentModelNode())) {
ItemRow parentRow = navigatorTreeModel->itemRowForNode(listProperty.parentModelNode());
if (parentRow.propertyItems.contains(listProperty.name())) {
*targetItem = parentRow.propertyItems.value(listProperty.name());
} else { // default property
*targetItem = parentRow.idItem;
#ifndef DISABLE_VISIBLE_PROPERTIES
newRowNumber += visibleProperties(listProperty.parentModelNode()).count();
#endif
}
} else {
*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())) {
QmlDesigner::QmlItemNode parentNode = modelNode.parentProperty().parentQmlObjectNode().toQmlItemNode();
if (!parentNode.modelNode().metaInfo().isLayoutable()) {
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_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();
@@ -247,6 +253,47 @@ void QmlAnchorBindingProxy::emitAnchorSignals()
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()
{
return m_qmlItemNode.isValid() && m_qmlItemNode.hasNodeParent();
@@ -254,7 +301,12 @@ bool QmlAnchorBindingProxy::hasParent()
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.bottomMargin").toInt() == 0)
&& (m_qmlItemNode.instanceValue("anchors.leftMargin").toInt() == 0)
@@ -301,9 +353,13 @@ void QmlAnchorBindingProxy::setTopTarget(const QString &target)
if (!newTarget.isValid())
return;
RewriterTransaction transaction = m_qmlItemNode.modelNode().view()->beginRewriterTransaction(QByteArrayLiteral("QmlAnchorBindingProxy::setTopTarget"));
RewriterTransaction transaction = beginRewriterTransaction(
QByteArrayLiteral("QmlAnchorBindingProxy::setTopTarget"));
m_topTarget = newTarget;
setDefaultRelativeTopTarget();
anchorTop();
emit topTargetChanged();
@@ -323,9 +379,11 @@ void QmlAnchorBindingProxy::setBottomTarget(const QString &target)
if (!newTarget.isValid())
return;
RewriterTransaction transaction = m_qmlItemNode.modelNode().view()->beginRewriterTransaction(QByteArrayLiteral("QmlAnchorBindingProxy::setBottomTarget"));
RewriterTransaction transaction = beginRewriterTransaction(
QByteArrayLiteral("QmlAnchorBindingProxy::setBottomTarget"));
m_bottomTarget = newTarget;
setDefaultRelativeBottomTarget();
anchorBottom();
emit bottomTargetChanged();
@@ -344,9 +402,11 @@ void QmlAnchorBindingProxy::setLeftTarget(const QString &target)
if (!newTarget.isValid())
return;
RewriterTransaction transaction = m_qmlItemNode.modelNode().view()->beginRewriterTransaction(QByteArrayLiteral("QmlAnchorBindingProxy::setLeftTarget"));
RewriterTransaction transaction = beginRewriterTransaction(
QByteArrayLiteral("QmlAnchorBindingProxy::setLeftTarget"));
m_leftTarget = newTarget;
setDefaultRelativeLeftTarget();
anchorLeft();
emit leftTargetChanged();
@@ -365,9 +425,11 @@ void QmlAnchorBindingProxy::setRightTarget(const QString &target)
if (!newTarget.isValid())
return;
RewriterTransaction transaction = m_qmlItemNode.modelNode().view()->beginRewriterTransaction(QByteArrayLiteral("QmlAnchorBindingProxy::setRightTarget"));
RewriterTransaction transaction = beginRewriterTransaction(
QByteArrayLiteral("QmlAnchorBindingProxy::setRightTarget"));
m_rightTarget = newTarget;
setDefaultRelativeRightTarget();
anchorRight();
emit rightTargetChanged();
@@ -386,7 +448,8 @@ void QmlAnchorBindingProxy::setVerticalTarget(const QString &target)
if (!newTarget.isValid())
return;
RewriterTransaction transaction = m_qmlItemNode.modelNode().view()->beginRewriterTransaction(QByteArrayLiteral("QmlAnchorBindingProxy::setVerticalTarget"));
RewriterTransaction transaction = beginRewriterTransaction(
QByteArrayLiteral("QmlAnchorBindingProxy::setVerticalTarget"));
m_verticalTarget = newTarget;
anchorVertical();
@@ -407,7 +470,8 @@ void QmlAnchorBindingProxy::setHorizontalTarget(const QString &target)
if (!newTarget.isValid())
return;
RewriterTransaction transaction = m_qmlItemNode.modelNode().view()->beginRewriterTransaction(QByteArrayLiteral("QmlAnchorBindingProxy::setHorizontalTarget"));
RewriterTransaction transaction = beginRewriterTransaction(
QByteArrayLiteral("QmlAnchorBindingProxy::setHorizontalTarget"));
m_horizontalTarget = newTarget;
anchorHorizontal();
@@ -423,7 +487,8 @@ void QmlAnchorBindingProxy::setRelativeAnchorTargetTop(QmlAnchorBindingProxy::Re
if (target == m_relativeTopTarget)
return;
RewriterTransaction transaction = m_qmlItemNode.modelNode().view()->beginRewriterTransaction(QByteArrayLiteral("QmlAnchorBindingProxy::setRelativeAnchorTargetTop"));
RewriterTransaction transaction = beginRewriterTransaction(
QByteArrayLiteral("QmlAnchorBindingProxy::setRelativeAnchorTargetTop"));
m_relativeTopTarget = target;
@@ -440,7 +505,8 @@ void QmlAnchorBindingProxy::setRelativeAnchorTargetBottom(QmlAnchorBindingProxy:
if (target == m_relativeBottomTarget)
return;
RewriterTransaction transaction = m_qmlItemNode.modelNode().view()->beginRewriterTransaction(QByteArrayLiteral("QmlAnchorBindingProxy::setRelativeAnchorTargetBottom"));
RewriterTransaction transaction = beginRewriterTransaction(
QByteArrayLiteral("QmlAnchorBindingProxy::setRelativeAnchorTargetBottom"));
m_relativeBottomTarget = target;
@@ -457,7 +523,8 @@ void QmlAnchorBindingProxy::setRelativeAnchorTargetLeft(QmlAnchorBindingProxy::R
if (target == m_relativeLeftTarget)
return;
RewriterTransaction transaction = m_qmlItemNode.modelNode().view()->beginRewriterTransaction(QByteArrayLiteral("QmlAnchorBindingProxy::setRelativeAnchorTargetLeft"));
RewriterTransaction transaction = beginRewriterTransaction(
QByteArrayLiteral("QmlAnchorBindingProxy::setRelativeAnchorTargetLeft"));
m_relativeLeftTarget = target;
@@ -474,7 +541,8 @@ void QmlAnchorBindingProxy::setRelativeAnchorTargetRight(QmlAnchorBindingProxy::
if (target == m_relativeRightTarget)
return;
RewriterTransaction transaction = m_qmlItemNode.modelNode().view()->beginRewriterTransaction(QByteArrayLiteral("QmlAnchorBindingProxy::setRelativeAnchorTargetRight"));
RewriterTransaction transaction = beginRewriterTransaction(
QByteArrayLiteral("QmlAnchorBindingProxy::setRelativeAnchorTargetRight"));
m_relativeRightTarget = target;
@@ -492,7 +560,8 @@ void QmlAnchorBindingProxy::setRelativeAnchorTargetVertical(QmlAnchorBindingProx
if (target == m_relativeVerticalTarget)
return;
RewriterTransaction transaction = m_qmlItemNode.modelNode().view()->beginRewriterTransaction(QByteArrayLiteral("QmlAnchorBindingProxy::setRelativeAnchorTargetVertical"));
RewriterTransaction transaction = beginRewriterTransaction(
QByteArrayLiteral("QmlAnchorBindingProxy::setRelativeAnchorTargetVertical"));
m_relativeVerticalTarget = target;
@@ -509,7 +578,8 @@ void QmlAnchorBindingProxy::setRelativeAnchorTargetHorizontal(QmlAnchorBindingPr
if (target == m_relativeHorizontalTarget)
return;
RewriterTransaction transaction = m_qmlItemNode.modelNode().view()->beginRewriterTransaction(QByteArrayLiteral("QmlAnchorBindingProxy::setRelativeAnchorTargetHorizontal"));
RewriterTransaction transaction = beginRewriterTransaction(
QByteArrayLiteral("QmlAnchorBindingProxy::setRelativeAnchorTargetHorizontal"));
m_relativeHorizontalTarget = target;
@@ -559,7 +629,8 @@ int QmlAnchorBindingProxy::indexOfPossibleTargetItem(const QString &targetName)
}
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().removeMargins();
@@ -584,18 +655,13 @@ void QmlAnchorBindingProxy::setBottomAnchor(bool anchor)
if (bottomAnchored() == anchor)
return;
RewriterTransaction transaction = m_qmlItemNode.modelNode().view()->beginRewriterTransaction(QByteArrayLiteral("QmlAnchorBindingProxy::setBottomAnchor"));
RewriterTransaction transaction = beginRewriterTransaction(
QByteArrayLiteral("QmlAnchorBindingProxy::setBottomAnchor"));
if (!anchor) {
removeBottomAnchor();
} else {
if (m_bottomTarget.modelNode() == m_qmlItemNode.modelNode().parentProperty().parentModelNode()) {
m_relativeBottomTarget = SameEdge;
} else {
m_relativeBottomTarget = OppositeEdge;
}
setDefaultRelativeBottomTarget();
anchorBottom();
if (topAnchored())
backupPropertyAndRemove(modelNode(), "height");
@@ -616,17 +682,13 @@ void QmlAnchorBindingProxy::setLeftAnchor(bool anchor)
if (leftAnchored() == anchor)
return;
RewriterTransaction transaction = m_qmlItemNode.modelNode().view()->beginRewriterTransaction(QByteArrayLiteral("QmlAnchorBindingProxy::setLeftAnchor"));
RewriterTransaction transaction = beginRewriterTransaction(
QByteArrayLiteral("QmlAnchorBindingProxy::setLeftAnchor"));
if (!anchor) {
removeLeftAnchor();
} else {
if (m_leftTarget.modelNode() == m_qmlItemNode.modelNode().parentProperty().parentModelNode()) {
m_relativeLeftTarget = SameEdge;
} else {
m_relativeLeftTarget = OppositeEdge;
}
setDefaultRelativeLeftTarget();
anchorLeft();
backupPropertyAndRemove(modelNode(), "x");
@@ -648,17 +710,13 @@ void QmlAnchorBindingProxy::setRightAnchor(bool anchor)
if (rightAnchored() == anchor)
return;
RewriterTransaction transaction = m_qmlItemNode.modelNode().view()->beginRewriterTransaction(QByteArrayLiteral("QmlAnchorBindingProxy::setRightAnchor"));
RewriterTransaction transaction = beginRewriterTransaction(
QByteArrayLiteral("QmlAnchorBindingProxy::setRightAnchor"));
if (!anchor) {
removeRightAnchor();
} else {
if (m_rightTarget.modelNode() == m_qmlItemNode.modelNode().parentProperty().parentModelNode()) {
m_relativeRightTarget = SameEdge;
} else {
m_relativeRightTarget = OppositeEdge;
}
setDefaultRelativeRightTarget();
anchorRight();
if (leftAnchored())
@@ -842,17 +900,13 @@ void QmlAnchorBindingProxy::setTopAnchor(bool anchor)
if (topAnchored() == anchor)
return;
RewriterTransaction transaction = m_qmlItemNode.modelNode().view()->beginRewriterTransaction(QByteArrayLiteral("QmlAnchorBindingProxy::setTopAnchor"));
RewriterTransaction transaction = beginRewriterTransaction(
QByteArrayLiteral("QmlAnchorBindingProxy::setTopAnchor"));
if (!anchor) {
removeTopAnchor();
} else {
if (m_topTarget.modelNode() == m_qmlItemNode.modelNode().parentProperty().parentModelNode()) {
m_relativeTopTarget = SameEdge;
} else {
m_relativeTopTarget = OppositeEdge;
}
setDefaultRelativeTopTarget();
anchorTop();
backupPropertyAndRemove(modelNode(), "y");
@@ -867,7 +921,8 @@ void QmlAnchorBindingProxy::setTopAnchor(bool anchor)
}
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().removeMargin(AnchorLineTop);
@@ -878,7 +933,8 @@ void QmlAnchorBindingProxy::removeTopAnchor() {
}
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().removeMargin(AnchorLineBottom);
@@ -888,7 +944,8 @@ void QmlAnchorBindingProxy::removeBottomAnchor() {
}
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().removeMargin(AnchorLineLeft);
@@ -898,7 +955,8 @@ void QmlAnchorBindingProxy::removeLeftAnchor() {
}
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().removeMargin(AnchorLineRight);
@@ -916,7 +974,8 @@ void QmlAnchorBindingProxy::setVerticalCentered(bool centered)
m_locked = true;
RewriterTransaction transaction = m_qmlItemNode.modelNode().view()->beginRewriterTransaction(QByteArrayLiteral("QmlAnchorBindingProxy::setVerticalCentered"));
RewriterTransaction transaction = beginRewriterTransaction(
QByteArrayLiteral("QmlAnchorBindingProxy::setVerticalCentered"));
if (!centered) {
m_qmlItemNode.anchors().removeAnchor(AnchorLineVerticalCenter);
@@ -943,7 +1002,8 @@ void QmlAnchorBindingProxy::setHorizontalCentered(bool centered)
m_locked = true;
RewriterTransaction transaction = m_qmlItemNode.modelNode().view()->beginRewriterTransaction(QByteArrayLiteral("QmlAnchorBindingProxy::setHorizontalCentered"));
RewriterTransaction transaction = beginRewriterTransaction(
QByteArrayLiteral("QmlAnchorBindingProxy::setHorizontalCentered"));
if (!centered) {
m_qmlItemNode.anchors().removeAnchor(AnchorLineHorizontalCenter);
@@ -1033,7 +1093,8 @@ bool QmlAnchorBindingProxy::horizontalCentered()
void QmlAnchorBindingProxy::fill()
{
RewriterTransaction transaction = m_qmlItemNode.modelNode().view()->beginRewriterTransaction(QByteArrayLiteral("QmlAnchorBindingProxy::fill"));
RewriterTransaction transaction = beginRewriterTransaction(
QByteArrayLiteral("QmlAnchorBindingProxy::fill"));
backupPropertyAndRemove(modelNode(), "x");

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -64,12 +64,10 @@ Column {
SecondColumnLayout {
LineEdit {
backendValue: backendValues.text
implicitWidth: 180
Layout.fillWidth: true
}
ExpandingSpacer {
}
}
Label {
text: qsTr("Read only")

View File

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

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 {
name: "QtQuick.Controls.GroupBox"
icon: ":/componentsplugin/images/window16.png"

View File

@@ -128,7 +128,7 @@ public:
NodeListProperty defaultNodeListProperty() 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<VariantProperty> variantProperties() 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)
{
qWarning() << "Process finished:" << sender() << exitCode;
qWarning() << "Process" << (exitStatus == QProcess::CrashExit ? "crashed:" : "finished:") << sender() << "exitCode:" << exitCode;
if (m_captureFileForTest.isOpen()) {
m_captureFileForTest.close();

View File

@@ -47,12 +47,13 @@
#include <coreplugin/icore.h>
#include <qmldesignerwarning.h>
#include <qmldesignerplugin.h>
#include <designersettings.h>
#include "puppetbuildprogressdialog.h"
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_qml2PuppetForKitPuppetHash;
@@ -105,6 +106,13 @@ QDateTime PuppetCreator::puppetSourceLastModified() const
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)
: m_qtCreatorVersion(qtCreatorVersion),
m_kit(kit),
@@ -157,7 +165,7 @@ QProcess *PuppetCreator::puppetProcess(const QString &puppetPath,
puppetProcess->setProcessEnvironment(processEnvironment());
QObject::connect(QCoreApplication::instance(), SIGNAL(aboutToQuit()), puppetProcess, SLOT(kill()));
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) {
puppetProcess->setProcessChannelMode(QProcess::MergedChannels);
QObject::connect(puppetProcess, SIGNAL(readyRead()), handlerObject, outputSlot);
@@ -252,7 +260,7 @@ void PuppetCreator::createQml1PuppetExecutableIfMissing()
{
m_availablePuppetType = FallbackPuppet;
if (!m_useOnlyFallbackPuppet && m_kit) {
if (!useOnlyFallbackPuppet() && m_kit) {
if (m_qml1PuppetForKitPuppetHash.contains(m_kit->id())) {
m_availablePuppetType = m_qml1PuppetForKitPuppetHash.value(m_kit->id());
} else if (checkQmlpuppetIsReady()) {
@@ -274,7 +282,7 @@ void PuppetCreator::createQml2PuppetExecutableIfMissing()
{
m_availablePuppetType = FallbackPuppet;
if (!m_useOnlyFallbackPuppet && m_kit) {
if (!useOnlyFallbackPuppet() && m_kit) {
if (m_qml2PuppetForKitPuppetHash.contains(m_kit->id())) {
m_availablePuppetType = m_qml2PuppetForKitPuppetHash.value(m_kit->id());
} else if (checkQml2PuppetIsReady()) {

View File

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

View File

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

View File

@@ -583,7 +583,7 @@ Does nothing if the node state does not set this property.
\see addProperty property properties hasProperties
*/
void ModelNode::removeProperty(const PropertyName &name)
void ModelNode::removeProperty(const PropertyName &name) const
{
if (!isValid())
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))
return false;
if (modelNode.hasParentProperty()) {
ModelNode parentModelNode = modelNode.parentProperty().parentModelNode();
if (QmlItemNode::isValidQmlItemNode(parentModelNode)
&& parentModelNode.metaInfo().isLayoutable())
return false;
}
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)
{
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 (isPropertyChangesType(modelNode.type())
|| isConnectionsType(modelNode.type())) {
|| isConnectionsType(modelNode.type())
|| isListElementType(modelNode.type())) {
AbstractProperty modelProperty = modelNode.property(astPropertyName.toUtf8());
QVariant variantValue = parsePropertyScriptBinding(script);
if (!variantValue.isValid())

View File

@@ -43,7 +43,8 @@ DesignerSettings::DesignerSettings()
designerWarningsInEditor(false),
showDebugView(false),
enableDebugView(false),
alwaysSaveInCrumbleBar(false)
alwaysSaveInCrumbleBar(false),
useOnlyFallbackPuppet(false)
{}
void DesignerSettings::fromSettings(QSettings *settings)
@@ -66,6 +67,8 @@ void DesignerSettings::fromSettings(QSettings *settings)
QLatin1String(QmlDesigner::Constants::QML_ENABLE_DEBUGVIEW), QVariant(false)).toBool();
alwaysSaveInCrumbleBar = settings->value(
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();
@@ -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_ENABLE_DEBUGVIEW), enableDebugView);
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();
@@ -98,5 +102,6 @@ bool DesignerSettings::equals(const DesignerSettings &other) const
&& designerWarningsInEditor == other.designerWarningsInEditor
&& showDebugView == other.showDebugView
&& enableDebugView == other.enableDebugView
&& alwaysSaveInCrumbleBar == other.alwaysSaveInCrumbleBar;
&& alwaysSaveInCrumbleBar == other.alwaysSaveInCrumbleBar
&& useOnlyFallbackPuppet == other.useOnlyFallbackPuppet;
}

View File

@@ -56,6 +56,7 @@ public:
bool showDebugView;
bool enableDebugView;
bool alwaysSaveInCrumbleBar;
bool useOnlyFallbackPuppet;
};
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_ENABLE_DEBUGVIEW[] = "EnableQtQuickDesignerDebugView";
const char QML_ALWAYS_SAFE_IN_CRUMBLEBAR[] = "AlwaysSafeInCrumbleBar";
const char QML_USE_ONLY_FALLBACK_PUPPET[] = "AseOnlyFallbackPuppet";
const char QML_DESIGNER_SUBFOLDER[] = "/designer/";

View File

@@ -48,7 +48,7 @@ RangeMover {
target: zoomControl
onRangeChanged: {
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) {
var newWidth = getWidth() * oldTimePerPixel / viewTimePerPixel;
setLeft(getLeft() * oldTimePerPixel / viewTimePerPixel);

View File

@@ -38,6 +38,7 @@
#include <qmakeprojectmanager/qmakeproject.h>
#include <qmakeprojectmanager/qmakeprojectmanagerconstants.h>
#include <qtsupport/qtkitinformation.h>
#include <qtsupport/qtsupportconstants.h>
#include "qmlprojectmanager.h"
#include "qmlproject.h"
@@ -79,6 +80,8 @@ QmlApplicationWizard::QmlApplicationWizard()
QLatin1String(ProjectExplorer::Constants::QT_APPLICATION_WIZARD_CATEGORY_DISPLAY));
setDisplayName(tr("Qt Quick UI"));
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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -15,10 +15,10 @@ QtcTool {
"iosdevicemanager.cpp",
"iosdevicemanager.h"
]
cpp.linkerFlags: base.concat(["-sectcreate", "__TEXT", "__info_plist", path + "/Info.plist"])
cpp.frameworks: base.concat(["CoreFoundation", "CoreServices", "IOKit", "Security",
"SystemConfiguration"])
cpp.dynamicLibraries: base.concat(["ssl", "bz2"])
cpp.infoPlistFile: "Info.plist"
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.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'}
: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_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'}

View File

@@ -34,8 +34,6 @@ def openQmakeProject(projectPath, targets=Targets.desktopTargetClasses(), fromWe
cleanUpUserFiles(projectPath)
if fromWelcome:
mouseClick(waitForObject(":OpenProject_QStyleItem"), 5, 5, 0, Qt.LeftButton)
if not platform.system() == "Darwin":
waitFor("waitForObject(':fileNameEdit_QLineEdit', 1000).focus == True", 3000)
else:
invokeMenuItem("File", "Open File or Project...")
selectFromFileDialog(projectPath)
@@ -737,13 +735,3 @@ def addCPlusPlusFileToCurrentProject(name, template, forceOverwrite=False, addTo
buttonToClick = 'Cancel'
clickButton("{text='%s' type='QPushButton' unnamed='1' visible='1' window=%s}"
% (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
else:
mouseClick(object, 5, 5, 0, Qt.LeftButton)
snooze(1)
mouseClick(waitForObjectItem(object, itemName.replace(".", "\\.")), 5, 5, 0, Qt.LeftButton)
test.verify(waitFor("str(object.currentText)==itemName", 5000),
"Switched combo item to '%s'" % itemName)
@@ -252,7 +253,8 @@ def selectFromFileDialog(fileName, waitForFile=False):
else:
fName = os.path.basename(os.path.abspath(fileName))
pName = os.path.dirname(os.path.abspath(fileName)) + os.sep
waitForObject("{name='QFileDialog' type='QFileDialog' visible='1'}")
try:
waitForObject("{name='QFileDialog' type='QFileDialog' visible='1'}", 5000)
pathLine = waitForObject("{name='fileNameEdit' type='QLineEdit' visible='1'}")
snooze(1)
replaceEditorContent(pathLine, pName)
@@ -261,6 +263,13 @@ def selectFromFileDialog(fileName, waitForFile=False):
snooze(1)
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:
fileCombo = waitForObject(":Qt Creator_FilenameQComboBox")
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