forked from qt-creator/qt-creator
Merge remote-tracking branch 'origin/5.0'
Change-Id: I9aa7b7a6490e8fb592a0e785a57128d438fdbab5
This commit is contained in:
@@ -150,7 +150,7 @@ ScrollView {
|
||||
maximumDepth: 128
|
||||
y: flickable.height > height ? flickable.height - height : 0
|
||||
|
||||
onSelectedTypeIdChanged: {
|
||||
onSelectedTypeIdChanged: (selectedTypeId) => {
|
||||
if (selectedTypeId !== root.selectedTypeId) {
|
||||
// Change originates from inside. Send typeSelected().
|
||||
root.selectedTypeId = selectedTypeId;
|
||||
|
||||
@@ -134,7 +134,9 @@ Rectangle {
|
||||
|
||||
focus: true
|
||||
property bool shiftPressed: false;
|
||||
Keys.onPressed: shiftPressed = (event.key === Qt.Key_Shift);
|
||||
Keys.onPressed: (event) => {
|
||||
shiftPressed = (event.key === Qt.Key_Shift);
|
||||
}
|
||||
Keys.onReleased: shiftPressed = false;
|
||||
|
||||
TimelineLabels {
|
||||
@@ -385,7 +387,7 @@ Rectangle {
|
||||
content.propagateSelection(-1, -1);
|
||||
}
|
||||
|
||||
onUpdateNote: {
|
||||
onUpdateNote: (text) => {
|
||||
if (timelineModelAggregator.notes && selectedModel != -1 && selectedItem != -1) {
|
||||
timelineModelAggregator.notes.setText(
|
||||
timelineModelAggregator.models[selectedModel].modelId,
|
||||
|
||||
@@ -106,12 +106,12 @@ Flickable {
|
||||
height: parent.height
|
||||
dragOffset: loader.y
|
||||
|
||||
onDropped: {
|
||||
onDropped: (sourceIndex, targetIndex) => {
|
||||
categories.moveCategories(sourceIndex, targetIndex);
|
||||
labelsModel.items.move(sourceIndex, targetIndex);
|
||||
}
|
||||
|
||||
onSelectById: {
|
||||
onSelectById: (eventId) => {
|
||||
categories.selectItem(index, eventId)
|
||||
}
|
||||
|
||||
|
||||
@@ -1010,6 +1010,8 @@ void StringAspect::setValidationFunction(const FancyLineEdit::ValidationFunction
|
||||
d->m_validator = validator;
|
||||
if (d->m_lineEditDisplay)
|
||||
d->m_lineEditDisplay->setValidationFunction(d->m_validator);
|
||||
else if (d->m_pathChooserDisplay)
|
||||
d->m_pathChooserDisplay->setValidationFunction(d->m_validator);
|
||||
}
|
||||
|
||||
void StringAspect::setOpenTerminalHandler(const std::function<void ()> &openTerminal)
|
||||
@@ -1060,6 +1062,8 @@ void StringAspect::addToLayout(LayoutBuilder &builder)
|
||||
d->m_pathChooserDisplay->setExpectedKind(d->m_expectedKind);
|
||||
if (!d->m_historyCompleterKey.isEmpty())
|
||||
d->m_pathChooserDisplay->setHistoryCompleter(d->m_historyCompleterKey);
|
||||
if (d->m_validator)
|
||||
d->m_pathChooserDisplay->setValidationFunction(d->m_validator);
|
||||
d->m_pathChooserDisplay->setEnvironment(d->m_environment);
|
||||
d->m_pathChooserDisplay->setBaseDirectory(d->m_baseFileName);
|
||||
d->m_pathChooserDisplay->setOpenTerminalHandler(d->m_openTerminal);
|
||||
|
||||
@@ -183,6 +183,8 @@ bool Environment::isSameExecutable(const QString &exe1, const QString &exe2) con
|
||||
const FilePath f2 = FilePath::fromString(i2);
|
||||
if (f1 == f2)
|
||||
return true;
|
||||
if (f1.needsDevice() != f2.needsDevice() || f1.scheme() != f2.scheme())
|
||||
return false;
|
||||
if (f1.resolveSymlinks() == f2.resolveSymlinks())
|
||||
return true;
|
||||
if (FileUtils::fileId(f1) == FileUtils::fileId(f2))
|
||||
|
||||
@@ -496,6 +496,12 @@ void QtcProcess::setEnvironment(const Environment &env)
|
||||
d->m_haveEnv = true;
|
||||
}
|
||||
|
||||
void QtcProcess::unsetEnvironment()
|
||||
{
|
||||
d->m_environment = Environment();
|
||||
d->m_haveEnv = false;
|
||||
}
|
||||
|
||||
const Environment &QtcProcess::environment() const
|
||||
{
|
||||
return d->m_environment;
|
||||
|
||||
@@ -86,6 +86,7 @@ public:
|
||||
};
|
||||
|
||||
void setEnvironment(const Environment &env);
|
||||
void unsetEnvironment();
|
||||
const Environment &environment() const;
|
||||
|
||||
void setCommand(const CommandLine &cmdLine);
|
||||
|
||||
@@ -489,6 +489,7 @@ void SplashScreenContainerWidget::setSticky(bool sticky)
|
||||
void SplashScreenContainerWidget::setBackgroundColor(const QColor &color)
|
||||
{
|
||||
if (color != m_splashScreenBackgroundColor) {
|
||||
m_splashScreenBackgroundColor = color;
|
||||
m_backgroundColor->setStyleSheet(QString("QToolButton {background-color: %1; border: 1px solid gray;}").arg(color.name()));
|
||||
|
||||
for (auto &&imageWidget : m_imageWidgets)
|
||||
@@ -497,8 +498,6 @@ void SplashScreenContainerWidget::setBackgroundColor(const QColor &color)
|
||||
imageWidget->setBackgroundColor(color);
|
||||
for (auto &&imageWidget : m_landscapeImageWidgets)
|
||||
imageWidget->setBackgroundColor(color);
|
||||
|
||||
m_splashScreenBackgroundColor = color;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1410,12 +1410,24 @@ void DockerDevice::runProcess(QtcProcess &process) const
|
||||
|
||||
const FilePath workingDir = process.workingDirectory();
|
||||
const CommandLine origCmd = process.commandLine();
|
||||
const Environment env = process.environment();
|
||||
|
||||
CommandLine cmd{"docker", {"exec"}};
|
||||
if (!workingDir.isEmpty())
|
||||
cmd.addArgs({"-w", workingDir.path()});
|
||||
if (process.keepsWriteChannelOpen())
|
||||
cmd.addArg("-i");
|
||||
if (env.size() != 0 && d->m_accessible != DockerDevicePrivate::Accessible) {
|
||||
process.unsetEnvironment();
|
||||
// FIXME the below would be probably correct if the respective tools would use correct
|
||||
// environment already, but most are using the host environment which usually makes
|
||||
// no sense on the device and may degrade performance
|
||||
// const QStringList envList = env.toStringList();
|
||||
// for (const QString &keyValue : envList) {
|
||||
// cmd.addArg("-e");
|
||||
// cmd.addArg(keyValue);
|
||||
// }
|
||||
}
|
||||
cmd.addArg(d->m_container);
|
||||
cmd.addArg(origCmd.executable().path()); // Cut off the docker://.../ bits.
|
||||
cmd.addArgs(origCmd.splitArguments(osType()));
|
||||
|
||||
@@ -34,6 +34,7 @@
|
||||
#include <utils/fileutils.h>
|
||||
#include <utils/infolabel.h>
|
||||
#include <utils/layoutbuilder.h>
|
||||
#include <utils/pathchooser.h>
|
||||
|
||||
#include <QLayout>
|
||||
|
||||
@@ -56,6 +57,12 @@ BuildDirectoryAspect::BuildDirectoryAspect(const BuildConfiguration *bc) : d(new
|
||||
setLabelText(tr("Build directory:"));
|
||||
setDisplayStyle(PathChooserDisplay);
|
||||
setExpectedKind(Utils::PathChooser::Directory);
|
||||
setValidationFunction([this](FancyLineEdit *edit, QString *error) {
|
||||
const FilePath fixedDir = fixupDir(FilePath::fromString(edit->text()));
|
||||
if (!fixedDir.isEmpty())
|
||||
edit->setText(fixedDir.toUserOutput());
|
||||
return pathChooser() ? pathChooser()->defaultValidationFunction()(edit, error) : true;
|
||||
});
|
||||
setOpenTerminalHandler([this, bc] {
|
||||
Core::FileUtils::openTerminal(value(), bc->environment());
|
||||
});
|
||||
@@ -123,6 +130,28 @@ void BuildDirectoryAspect::addToLayout(LayoutBuilder &builder)
|
||||
}
|
||||
}
|
||||
|
||||
FilePath BuildDirectoryAspect::fixupDir(const FilePath &dir)
|
||||
{
|
||||
if (dir.needsDevice() || !HostOsInfo::isWindowsHost())
|
||||
return {};
|
||||
const QString dirString = dir.toString().toLower();
|
||||
if (dirString.length() < 2)
|
||||
return {};
|
||||
if (!dirString.at(0).isLetter())
|
||||
return {};
|
||||
const QStringList drives = Utils::transform(QDir::drives(), [](const QFileInfo &fi) {
|
||||
return fi.absoluteFilePath().toLower().chopped(1);
|
||||
});
|
||||
if (!Utils::contains(drives, [&dirString](const QString &drive) {
|
||||
return dirString.startsWith(drive);
|
||||
}) && !drives.isEmpty()) {
|
||||
QString newDir = dirString;
|
||||
newDir.replace(0, 2, drives.first());
|
||||
return FilePath::fromString(newDir);
|
||||
}
|
||||
return {};
|
||||
}
|
||||
|
||||
void BuildDirectoryAspect::updateProblemLabel()
|
||||
{
|
||||
if (!d->problemLabel)
|
||||
|
||||
@@ -47,6 +47,8 @@ public:
|
||||
|
||||
void addToLayout(Utils::LayoutBuilder &builder) override;
|
||||
|
||||
static Utils::FilePath fixupDir(const Utils::FilePath &dir);
|
||||
|
||||
private:
|
||||
void toMap(QVariantMap &map) const override;
|
||||
void fromMap(const QVariantMap &map) override;
|
||||
|
||||
@@ -257,6 +257,9 @@ void BuildConfiguration::setBuildDirectory(const FilePath &dir)
|
||||
if (dir == d->m_buildDirectoryAspect->filePath())
|
||||
return;
|
||||
d->m_buildDirectoryAspect->setFilePath(dir);
|
||||
const FilePath fixedDir = BuildDirectoryAspect::fixupDir(buildDirectory());
|
||||
if (!fixedDir.isEmpty())
|
||||
d->m_buildDirectoryAspect->setFilePath(fixedDir);
|
||||
emitBuildDirectoryChanged();
|
||||
}
|
||||
|
||||
|
||||
@@ -43,6 +43,16 @@
|
||||
|
||||
#include <enumeration.h>
|
||||
|
||||
#ifndef QMLDESIGNER_TEST
|
||||
#include <projectexplorer/kit.h>
|
||||
#include <projectexplorer/session.h>
|
||||
#include <projectexplorer/target.h>
|
||||
|
||||
#include <qtsupport/baseqtversion.h>
|
||||
#include <qtsupport/qtkitinformation.h>
|
||||
|
||||
#endif
|
||||
|
||||
#include <qmljs/qmljsevaluate.h>
|
||||
#include <qmljs/qmljslink.h>
|
||||
#include <qmljs/parser/qmljsast_p.h>
|
||||
@@ -793,6 +803,8 @@ void TextToModelMerger::setupImports(const Document::Ptr &doc,
|
||||
{
|
||||
QList<Import> existingImports = m_rewriterView->model()->imports();
|
||||
|
||||
m_hasVersionlessImport = false;
|
||||
|
||||
for (AST::UiHeaderItemList *iter = doc->qmlProgram()->headers; iter; iter = iter->next) {
|
||||
auto import = AST::cast<AST::UiImport *>(iter->headerItem);
|
||||
if (!import)
|
||||
@@ -812,8 +824,10 @@ void TextToModelMerger::setupImports(const Document::Ptr &doc,
|
||||
differenceHandler.modelMissesImport(newImport);
|
||||
} else {
|
||||
QString importUri = toString(import->importUri);
|
||||
if (version.isEmpty())
|
||||
if (version.isEmpty()) {
|
||||
version = getHighestPossibleImport(importUri);
|
||||
m_hasVersionlessImport = true;
|
||||
}
|
||||
const Import newImport = Import::createLibraryImport(importUri,
|
||||
version,
|
||||
as,
|
||||
@@ -2099,10 +2113,49 @@ void TextToModelMerger::collectImportErrors(QList<DocumentMessage> *errors)
|
||||
|
||||
if (supportedQtQuickVersion(import.version())) {
|
||||
hasQtQuick = true;
|
||||
|
||||
#ifndef QMLDESIGNER_TEST
|
||||
auto target = ProjectExplorer::SessionManager::startupTarget();
|
||||
if (target) {
|
||||
QtSupport::BaseQtVersion *currentQtVersion = QtSupport::QtKitAspect::qtVersion(
|
||||
target->kit());
|
||||
if (currentQtVersion && currentQtVersion->isValid()) {
|
||||
const bool qt6import = import.version().startsWith("6");
|
||||
|
||||
if (currentQtVersion->qtVersion().majorVersion == 5
|
||||
&& (m_hasVersionlessImport || qt6import)) {
|
||||
const QmlJS::DiagnosticMessage diagnosticMessage(
|
||||
QmlJS::Severity::Error,
|
||||
SourceLocation(0, 0, 0, 0),
|
||||
QCoreApplication::translate(
|
||||
"QmlDesigner::TextToModelMerger",
|
||||
"QtQuick 6 is not supported with a Qt 5 kit."));
|
||||
errors->prepend(
|
||||
DocumentMessage(diagnosticMessage,
|
||||
QUrl::fromLocalFile(m_document->fileName())));
|
||||
}
|
||||
} else {
|
||||
const QmlJS::DiagnosticMessage
|
||||
diagnosticMessage(QmlJS::Severity::Error,
|
||||
SourceLocation(0, 0, 0, 0),
|
||||
QCoreApplication::translate(
|
||||
"QmlDesigner::TextToModelMerger",
|
||||
"The Design Mode requires a valid Qt kit."));
|
||||
errors->prepend(
|
||||
DocumentMessage(diagnosticMessage,
|
||||
QUrl::fromLocalFile(m_document->fileName())));
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
} else {
|
||||
const QmlJS::DiagnosticMessage diagnosticMessage(QmlJS::Severity::Error, SourceLocation(0, 0, 0, 0),
|
||||
QCoreApplication::translate("QmlDesigner::TextToModelMerger", "Unsupported QtQuick version"));
|
||||
errors->append(DocumentMessage(diagnosticMessage, QUrl::fromLocalFile(m_document->fileName())));
|
||||
const QmlJS::DiagnosticMessage
|
||||
diagnosticMessage(QmlJS::Severity::Error,
|
||||
SourceLocation(0, 0, 0, 0),
|
||||
QCoreApplication::translate("QmlDesigner::TextToModelMerger",
|
||||
"Unsupported QtQuick version"));
|
||||
errors->append(DocumentMessage(diagnosticMessage,
|
||||
QUrl::fromLocalFile(m_document->fileName())));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -166,6 +166,7 @@ private:
|
||||
QmlJS::ViewerContext m_vContext;
|
||||
QSet<QPair<QString, QString> > m_qrcMapping;
|
||||
QSet<QmlJS::ImportKey> m_possibleImportKeys;
|
||||
bool m_hasVersionlessImport = false;
|
||||
};
|
||||
|
||||
class DifferenceHandler
|
||||
|
||||
@@ -1901,7 +1901,8 @@ FilePath BaseQtVersionPrivate::mkspecFromVersionInfo(const QHash<ProKey, ProStri
|
||||
|
||||
// qDebug() << "default mkspec is located at" << mkspecFullPath;
|
||||
|
||||
if (HostOsInfo::isWindowsHost()) {
|
||||
OsType osInfo = mkspecFullPath.osType();
|
||||
if (osInfo == OsTypeWindows) {
|
||||
if (!qt5) {
|
||||
QFile f2(mkspecFullPath.toString() + "/qmake.conf");
|
||||
if (f2.exists() && f2.open(QIODevice::ReadOnly)) {
|
||||
@@ -1931,7 +1932,7 @@ FilePath BaseQtVersionPrivate::mkspecFromVersionInfo(const QHash<ProKey, ProStri
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (HostOsInfo::isMacHost()) {
|
||||
if (osInfo == OsTypeMac) {
|
||||
QFile f2(mkspecFullPath.toString() + "/qmake.conf");
|
||||
if (f2.exists() && f2.open(QIODevice::ReadOnly)) {
|
||||
while (!f2.atEnd()) {
|
||||
|
||||
@@ -60,6 +60,9 @@ IoUtils::FileType IoUtils::fileType(const QString &fileName)
|
||||
return fileType(fileName.mid(pos));
|
||||
}
|
||||
|
||||
if (!QFileInfo::exists(fileName)) // FIXME make pro parser work with non-local
|
||||
return FileNotFound;
|
||||
|
||||
Q_ASSERT(fileName.isEmpty() || isAbsolutePath(fileName));
|
||||
#ifdef Q_OS_WIN
|
||||
DWORD attr = GetFileAttributesW((WCHAR*)fileName.utf16());
|
||||
|
||||
@@ -18,6 +18,7 @@ msvc {
|
||||
SOURCES += \
|
||||
$$IDE_SOURCE_TREE/src/libs/utils/commandline.cpp \
|
||||
$$IDE_SOURCE_TREE/src/libs/utils/environment.cpp \
|
||||
$$IDE_SOURCE_TREE/src/libs/utils/filepath.cpp \
|
||||
$$IDE_SOURCE_TREE/src/libs/utils/fileutils.cpp \
|
||||
$$IDE_SOURCE_TREE/src/libs/utils/hostosinfo.cpp \
|
||||
$$IDE_SOURCE_TREE/src/libs/utils/launcherinterface.cpp \
|
||||
@@ -34,6 +35,7 @@ msvc {
|
||||
HEADERS += \
|
||||
$$IDE_SOURCE_TREE/src/libs/utils/commandline.h \
|
||||
$$IDE_SOURCE_TREE/src/libs/utils/environment.h \
|
||||
$$IDE_SOURCE_TREE/src/libs/utils/filepath.h \
|
||||
$$IDE_SOURCE_TREE/src/libs/utils/fileutils.h \
|
||||
$$IDE_SOURCE_TREE/src/libs/utils/hostosinfo.h \
|
||||
$$IDE_SOURCE_TREE/src/libs/utils/launcherinterface.h \
|
||||
|
||||
@@ -19,6 +19,7 @@ HEADERS += \
|
||||
SOURCES += \
|
||||
$$UTILSDIR/commandline.cpp \
|
||||
$$UTILSDIR/environment.cpp \
|
||||
$$UTILSDIR/filepath.cpp \
|
||||
$$UTILSDIR/fileutils.cpp \
|
||||
$$UTILSDIR/hostosinfo.cpp \
|
||||
$$UTILSDIR/launcherinterface.cpp \
|
||||
@@ -34,6 +35,7 @@ HEADERS += \
|
||||
HEADERS += \
|
||||
$$UTILSDIR/commandline.h \
|
||||
$$UTILSDIR/environment.h \
|
||||
$$UTILSDIR/filepath.h \
|
||||
$$UTILSDIR/fileutils.h \
|
||||
$$UTILSDIR/hostosinfo.h \
|
||||
$$UTILSDIR/launcherinterface.h \
|
||||
|
||||
Reference in New Issue
Block a user