Merge remote-tracking branch 'origin/master' into 6.0

Change-Id: I966d964cd194d6422da92fa77a734247a02f9cd9
This commit is contained in:
Eike Ziller
2021-09-30 09:38:54 +02:00
60 changed files with 476 additions and 395 deletions

111
dist/changes-6.0.0.md vendored
View File

@@ -13,55 +13,122 @@ the public Git repository. For example:
General General
------- -------
* ... * Moved launching of tools to external process
* Merged `CppTools` plugin into `CppEditor` plugin
Editing Editing
------- -------
* Added support for multiple cursor editing (QTCREATORBUG-16013)
* Added import and export for font settings (QTCREATORBUG-6833)
### C++ ### C++
* Added completion and function hint to `clangd` support
* Added option for saving open files automatically after refactoring
(QTCREATORBUG-25924)
* Fixed `Insert Definition` for templates with value parameters
(QTCREATORBUG-26113)
* Fixed canceling of C++ parsing on configuration change (QTCREATORBUG-24890)
### QML ### QML
### Language Client * Improved wizards for Qt 6.2 (QTCREATORBUG-26170)
* Simplified wizards
### Beautifier
### Designer
Projects Projects
-------- --------
Debugging * Added option to close all projects except one to Projects' view context menu
--------- * Added option to cancel file renaming (QTCREATORBUG-26268)
* Added `Show in File System View` to project context menu
* Added `Advanced Find` scope for `Files in All Project Directories`
* Fixed stale directories in `Files in All Project Directories` locator filter
* Fixed redundant output on process crash (QTCREATORBUG-26049)
* Fixed duplicates in file rename dialog (QTCREATORBUG-26268)
* Fixed variable expansion for working directory (QTCREATORBUG-26274)
### GDB ### CMake
* Dropped support for GDB versions using Python version 2.x. * Removed separate `<Headers>` node from project tree (QTCREATORBUG-18206,
Python 3.6+ is required now. QTCREATORBUG-24609, QTCREATORBUG-25407)
* Fixed that CMake warnings and project loading errors were not added to
`Issues` pane (QTCREATORBUG-26231)
* Fixed header file handling when mentioned in target sources
(QTCREATORBUG-23783, QTCREATORBUG-23843, QTCREATORBUG-26201,
QTCREATORBUG-26238)
### QML Version Control Systems
-----------------------
Analyzer ### Git
--------
FakeVim * Added option to `Show HEAD` when amending commit (QTCREATORBUG-25004)
------- * Fixed wrong modified state of log viewer
Test Integration
----------------
* Added option to run tests without deployment
## CTest
* Added options page (QTCREATORBUG-26029)
Platforms Platforms
--------- ---------
### Windows
### macOS ### macOS
* Changed prebuilt binaries to universal Intel + ARM
### Android ### Android
### Remote Linux * Removed device selection dialog in favor of device selection in target
selector (QTCREATORBUG-23991)
* Added details to device settings (QTCREATORBUG-23991)
### QNX ### Docker
### MCU
* Various improvements
Credits for these changes go to: Credits for these changes go to:
-------------------------------- --------------------------------
Aleksei German
Alessandro Portale
Alex Richardson
Alp Öz
Andre Hartmann
André Pönitz
Artem Sokolovskii
Artur Shepilko
Assam Boudjelthia
Christian Kandeler
Christian Stenger
Cristian Adam
David Schulz
Eike Ziller
Fawzi Mohamed
Henning Gruendl
Ihor Dutchak
Jaroslaw Kobus
Jonas Karlsson
Kai Köhne
Kama Wójcik
Li Xi
Loren Burkholder
Mahmoud Badri
Marco Bubke
Martin Kampas
Miina Puuronen
Orgad Shaneh
Petar Perisin
Piotr Mikolajczyk
Samuel Ghinet
Shantanu Tushar
Tasuku Suzuki
Thiago Macieira
Thomas Hartmann
Tony Leinonen
Tor Arne Vestbø
Vladimir Serdyuk

View File

@@ -130,7 +130,7 @@ struct SshConnection::SshConnectionPrivate
SshConnectionParameters::AuthenticationTypeSpecificKey; SshConnectionParameters::AuthenticationTypeSpecificKey;
if (keyOnly) { if (keyOnly) {
args << "-o" << "IdentitiesOnly=yes"; args << "-o" << "IdentitiesOnly=yes";
args << "-i" << connParams.privateKeyFile; args << "-i" << connParams.privateKeyFile.path();
} }
if (keyOnly || SshSettings::askpassFilePath().isEmpty()) if (keyOnly || SshSettings::askpassFilePath().isEmpty())
args << "-o" << "BatchMode=yes"; args << "-o" << "BatchMode=yes";

View File

@@ -28,20 +28,19 @@
#include "sftpdefs.h" #include "sftpdefs.h"
#include "ssh_global.h" #include "ssh_global.h"
#include <utils/filepath.h>
#include <utils/processutils.h> #include <utils/processutils.h>
#include <QByteArray> #include <QByteArray>
#include <QFlags> #include <QFlags>
#include <QHostAddress>
#include <QMetaType> #include <QMetaType>
#include <QObject> #include <QObject>
#include <QString> #include <QString>
#include <QHostAddress>
#include <QUrl> #include <QUrl>
#include <memory> #include <memory>
namespace Utils { class FilePath; }
namespace QSsh { namespace QSsh {
class SshRemoteProcess; class SshRemoteProcess;
@@ -69,7 +68,7 @@ public:
void setUserName(const QString &name) { url.setUserName(name); } void setUserName(const QString &name) { url.setUserName(name); }
QUrl url; QUrl url;
QString privateKeyFile; Utils::FilePath privateKeyFile;
QString x11DisplayName; QString x11DisplayName;
int timeout = 0; // In seconds. int timeout = 0; // In seconds.
AuthenticationType authenticationType = AuthenticationTypeAll; AuthenticationType authenticationType = AuthenticationTypeAll;

View File

@@ -32,9 +32,6 @@
#include <utils/pathchooser.h> #include <utils/pathchooser.h>
#include <QApplication> #include <QApplication>
#include <QDir>
#include <QFile>
#include <QFileInfo>
#include <QMessageBox> #include <QMessageBox>
#include <QProcess> #include <QProcess>
#include <QStandardPaths> #include <QStandardPaths>
@@ -50,7 +47,7 @@ SshKeyCreationDialog::SshKeyCreationDialog(QWidget *parent)
m_ui->privateKeyFileButton->setText(Utils::PathChooser::browseButtonLabel()); m_ui->privateKeyFileButton->setText(Utils::PathChooser::browseButtonLabel());
const QString defaultPath = QStandardPaths::writableLocation(QStandardPaths::HomeLocation) const QString defaultPath = QStandardPaths::writableLocation(QStandardPaths::HomeLocation)
+ QLatin1String("/.ssh/qtc_id"); + QLatin1String("/.ssh/qtc_id");
setPrivateKeyFile(defaultPath); setPrivateKeyFile(FilePath::fromString(defaultPath));
connect(m_ui->rsa, &QRadioButton::toggled, connect(m_ui->rsa, &QRadioButton::toggled,
this, &SshKeyCreationDialog::keyTypeChanged); this, &SshKeyCreationDialog::keyTypeChanged);
@@ -86,16 +83,16 @@ void SshKeyCreationDialog::generateKeys()
showError(tr("The ssh-keygen tool was not found.")); showError(tr("The ssh-keygen tool was not found."));
return; return;
} }
if (QFileInfo::exists(privateKeyFilePath())) { if (privateKeyFilePath().exists()) {
showError(tr("Refusing to overwrite existing private key file \"%1\".") showError(tr("Refusing to overwrite existing private key file \"%1\".")
.arg(QDir::toNativeSeparators(privateKeyFilePath()))); .arg(privateKeyFilePath().toUserOutput()));
return; return;
} }
const QString keyTypeString = QLatin1String(m_ui->rsa->isChecked() ? "rsa": "ecdsa"); const QString keyTypeString = QLatin1String(m_ui->rsa->isChecked() ? "rsa": "ecdsa");
QApplication::setOverrideCursor(Qt::BusyCursor); QApplication::setOverrideCursor(Qt::BusyCursor);
QProcess keygen; QProcess keygen;
const QStringList args{"-t", keyTypeString, "-b", m_ui->comboBox->currentText(), const QStringList args{"-t", keyTypeString, "-b", m_ui->comboBox->currentText(),
"-N", QString(), "-f", privateKeyFilePath()}; "-N", QString(), "-f", privateKeyFilePath().path()};
QString errorMsg; QString errorMsg;
keygen.start(SshSettings::keygenFilePath().toString(), args); keygen.start(SshSettings::keygenFilePath().toString(), args);
keygen.closeWriteChannel(); keygen.closeWriteChannel();
@@ -115,14 +112,14 @@ void SshKeyCreationDialog::handleBrowseButtonClicked()
{ {
const FilePath filePath = FileUtils::getSaveFilePath(this, tr("Choose Private Key File Name")); const FilePath filePath = FileUtils::getSaveFilePath(this, tr("Choose Private Key File Name"));
if (!filePath.isEmpty()) if (!filePath.isEmpty())
setPrivateKeyFile(filePath.toString()); setPrivateKeyFile(filePath);
} }
void SshKeyCreationDialog::setPrivateKeyFile(const QString &filePath) void SshKeyCreationDialog::setPrivateKeyFile(const FilePath &filePath)
{ {
m_ui->privateKeyFileValueLabel->setText(filePath); m_ui->privateKeyFileValueLabel->setText(filePath.toUserOutput());
m_ui->generateButton->setEnabled(!privateKeyFilePath().isEmpty()); m_ui->generateButton->setEnabled(!privateKeyFilePath().isEmpty());
m_ui->publicKeyFileLabel->setText(filePath + QLatin1String(".pub")); m_ui->publicKeyFileLabel->setText(filePath.toUserOutput() + ".pub");
} }
void SshKeyCreationDialog::showError(const QString &details) void SshKeyCreationDialog::showError(const QString &details)
@@ -130,14 +127,14 @@ void SshKeyCreationDialog::showError(const QString &details)
QMessageBox::critical(this, tr("Key Generation Failed"), details); QMessageBox::critical(this, tr("Key Generation Failed"), details);
} }
QString SshKeyCreationDialog::privateKeyFilePath() const FilePath SshKeyCreationDialog::privateKeyFilePath() const
{ {
return m_ui->privateKeyFileValueLabel->text(); return FilePath::fromUserInput(m_ui->privateKeyFileValueLabel->text());
} }
QString SshKeyCreationDialog::publicKeyFilePath() const FilePath SshKeyCreationDialog::publicKeyFilePath() const
{ {
return m_ui->publicKeyFileLabel->text(); return FilePath::fromUserInput(m_ui->publicKeyFileLabel->text());
} }
} // namespace QSsh } // namespace QSsh

View File

@@ -27,6 +27,8 @@
#include "ssh_global.h" #include "ssh_global.h"
#include <utils/filepath.h>
#include <QDialog> #include <QDialog>
namespace QSsh { namespace QSsh {
@@ -40,14 +42,14 @@ public:
SshKeyCreationDialog(QWidget *parent = nullptr); SshKeyCreationDialog(QWidget *parent = nullptr);
~SshKeyCreationDialog(); ~SshKeyCreationDialog();
QString privateKeyFilePath() const; Utils::FilePath privateKeyFilePath() const;
QString publicKeyFilePath() const; Utils::FilePath publicKeyFilePath() const;
private: private:
void keyTypeChanged(); void keyTypeChanged();
void generateKeys(); void generateKeys();
void handleBrowseButtonClicked(); void handleBrowseButtonClicked();
void setPrivateKeyFile(const QString &filePath); void setPrivateKeyFile(const Utils::FilePath &filePath);
void showError(const QString &details); void showError(const QString &details);
private: private:

View File

@@ -30,7 +30,7 @@
#include <QApplication> #include <QApplication>
#include <QCompleter> #include <QCompleter>
using namespace Utils; namespace Utils {
AnnotatedItemDelegate::AnnotatedItemDelegate(QObject *parent) : QStyledItemDelegate(parent) AnnotatedItemDelegate::AnnotatedItemDelegate(QObject *parent) : QStyledItemDelegate(parent)
{} {}
@@ -119,7 +119,7 @@ PathChooserDelegate::PathChooserDelegate(QObject *parent)
{ {
} }
void PathChooserDelegate::setExpectedKind(Utils::PathChooser::Kind kind) void PathChooserDelegate::setExpectedKind(PathChooser::Kind kind)
{ {
m_kind = kind; m_kind = kind;
} }
@@ -134,13 +134,13 @@ QWidget *PathChooserDelegate::createEditor(QWidget *parent, const QStyleOptionVi
Q_UNUSED(option) Q_UNUSED(option)
Q_UNUSED(index) Q_UNUSED(index)
auto editor = new Utils::PathChooser(parent); auto editor = new PathChooser(parent);
editor->setHistoryCompleter(m_historyKey); editor->setHistoryCompleter(m_historyKey);
editor->setAutoFillBackground(true); // To hide the text beneath the editor widget editor->setAutoFillBackground(true); // To hide the text beneath the editor widget
editor->lineEdit()->setMinimumWidth(0); editor->lineEdit()->setMinimumWidth(0);
connect(editor, &Utils::PathChooser::browsingFinished, this, [this, editor]() { connect(editor, &PathChooser::browsingFinished, this, [this, editor]() {
emit const_cast<PathChooserDelegate*>(this)->commitData(editor); emit const_cast<PathChooserDelegate*>(this)->commitData(editor);
}); });
@@ -149,20 +149,20 @@ QWidget *PathChooserDelegate::createEditor(QWidget *parent, const QStyleOptionVi
void PathChooserDelegate::setEditorData(QWidget *editor, const QModelIndex &index) const void PathChooserDelegate::setEditorData(QWidget *editor, const QModelIndex &index) const
{ {
if (auto *pathChooser = qobject_cast<Utils::PathChooser *>(editor)) { if (auto *pathChooser = qobject_cast<PathChooser *>(editor)) {
pathChooser->setExpectedKind(m_kind); pathChooser->setExpectedKind(m_kind);
pathChooser->setPromptDialogFilter(m_filter); pathChooser->setPromptDialogFilter(m_filter);
pathChooser->setPath(index.model()->data(index, Qt::EditRole).toString()); pathChooser->setFilePath(FilePath::fromVariant(index.model()->data(index, Qt::EditRole)));
} }
} }
void PathChooserDelegate::setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const void PathChooserDelegate::setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const
{ {
auto pathChooser = qobject_cast<Utils::PathChooser *>(editor); auto pathChooser = qobject_cast<PathChooser *>(editor);
if (!pathChooser) if (!pathChooser)
return; return;
model->setData(index, pathChooser->filePath().toString(), Qt::EditRole); model->setData(index, pathChooser->filePath().toVariant(), Qt::EditRole);
} }
void PathChooserDelegate::updateEditorGeometry(QWidget *editor, const QStyleOptionViewItem &option, const QModelIndex &index) const void PathChooserDelegate::updateEditorGeometry(QWidget *editor, const QStyleOptionViewItem &option, const QModelIndex &index) const
@@ -233,3 +233,5 @@ void CompleterDelegate::updateEditorGeometry(QWidget *editor,
editor->setGeometry(option.rect); editor->setGeometry(option.rect);
} }
} // Utils

View File

@@ -477,12 +477,14 @@ void FileUtils::setDeviceFileHooks(const DeviceFileHooks &hooks)
} }
/// \returns a QString to display to the user /// \returns a QString to display to the user
/// Converts the separators to the native format /// Converts the separators to the native format of the system
/// this path belongs to.
QString FilePath::toUserOutput() const QString FilePath::toUserOutput() const
{ {
if (m_scheme.isEmpty()) FilePath tmp = *this;
return QDir::toNativeSeparators(m_data); if (osType() == OsTypeWindows)
return toString(); tmp.m_data.replace('/', '\\');
return tmp.toString();
} }
QString FilePath::fileName() const QString FilePath::fileName() const

View File

@@ -62,7 +62,7 @@ public:
bool m_complete = false; bool m_complete = false;
QRegularExpressionValidator m_projectNameValidator; QRegularExpressionValidator m_projectNameValidator;
bool m_forceSubProject = false; bool m_forceSubProject = false;
QStringList m_projectDirectories; FilePaths m_projectDirectories;
}; };
ProjectIntroPage::ProjectIntroPage(QWidget *parent) : ProjectIntroPage::ProjectIntroPage(QWidget *parent) :
@@ -157,7 +157,7 @@ bool ProjectIntroPage::validate()
int index = d->m_ui.projectComboBox->currentIndex(); int index = d->m_ui.projectComboBox->currentIndex();
if (index == 0) if (index == 0)
return false; return false;
d->m_ui.pathChooser->setPath(d->m_projectDirectories.at(index)); d->m_ui.pathChooser->setFilePath(d->m_projectDirectories.at(index));
} }
// Validate and display status // Validate and display status
if (!d->m_ui.pathChooser->isValid()) { if (!d->m_ui.pathChooser->isValid()) {
@@ -230,7 +230,7 @@ void ProjectIntroPage::setProjectList(const QStringList &projectList)
d->m_ui.projectComboBox->addItems(projectList); d->m_ui.projectComboBox->addItems(projectList);
} }
void ProjectIntroPage::setProjectDirectories(const QStringList &directoryList) void ProjectIntroPage::setProjectDirectories(const FilePaths &directoryList)
{ {
d->m_projectDirectories = directoryList; d->m_projectDirectories = directoryList;
} }

View File

@@ -61,7 +61,7 @@ public:
bool forceSubProject() const; bool forceSubProject() const;
void setForceSubProject(bool force); void setForceSubProject(bool force);
void setProjectList(const QStringList &projectList); void setProjectList(const QStringList &projectList);
void setProjectDirectories(const QStringList &directoryList); void setProjectDirectories(const Utils::FilePaths &directoryList);
int projectIndex() const; int projectIndex() const;
bool validateProjectName(const QString &name, QString *errorMessage); bool validateProjectName(const QString &name, QString *errorMessage);

View File

@@ -44,10 +44,11 @@
#include <QPushButton> #include <QPushButton>
#include <QRegularExpression> #include <QRegularExpression>
using namespace Core;
using namespace Core::Internal;
using namespace Utils; using namespace Utils;
namespace Core {
namespace Internal {
ILocatorFilter::MatchLevel FileSystemFilter::matchLevelFor(const QRegularExpressionMatch &match, ILocatorFilter::MatchLevel FileSystemFilter::matchLevelFor(const QRegularExpressionMatch &match,
const QString &matchText) const QString &matchText)
{ {
@@ -159,8 +160,7 @@ QList<LocatorFilterEntry> FileSystemFilter::matchesFor(QFutureInterface<LocatorF
tr("Create and Open \"%1\"").arg(entry), tr("Create and Open \"%1\"").arg(entry),
fullFilePath); fullFilePath);
createAndOpen.filePath = FilePath::fromString(fullFilePath); createAndOpen.filePath = FilePath::fromString(fullFilePath);
createAndOpen.extraInfo = Utils::FilePath::fromString(dirInfo.absolutePath()) createAndOpen.extraInfo = FilePath::fromString(dirInfo.absolutePath()).shortNativePath();
.shortNativePath();
entries[int(MatchLevel::Normal)].append(createAndOpen); entries[int(MatchLevel::Normal)].append(createAndOpen);
} }
@@ -175,24 +175,21 @@ void FileSystemFilter::accept(LocatorFilterEntry selection,
int *selectionLength) const int *selectionLength) const
{ {
Q_UNUSED(selectionLength) Q_UNUSED(selectionLength)
QFileInfo info = selection.filePath.toFileInfo(); if (selection.filePath.isDir()) {
if (info.isDir()) {
const QString value = shortcutString() + ' ' const QString value = shortcutString() + ' '
+ QDir::toNativeSeparators(info.absoluteFilePath() + '/'); + selection.filePath.absoluteFilePath().toUserOutput() + '/';
*newText = value; *newText = value;
*selectionStart = value.length(); *selectionStart = value.length();
} else { } else {
// Don't block locator filter execution with dialog // Don't block locator filter execution with dialog
QMetaObject::invokeMethod(EditorManager::instance(), [info, selection] { QMetaObject::invokeMethod(EditorManager::instance(), [selection] {
const QString targetFile = selection.internalData.toString(); const FilePath targetFile = FilePath::fromVariant(selection.internalData);
if (!info.exists()) { if (!selection.filePath.exists()) {
if (Utils::CheckableMessageBox::shouldAskAgain(ICore::settings(), kAlwaysCreate)) { if (CheckableMessageBox::shouldAskAgain(ICore::settings(), kAlwaysCreate)) {
Utils::CheckableMessageBox messageBox(ICore::dialogParent()); CheckableMessageBox messageBox(ICore::dialogParent());
messageBox.setWindowTitle(tr("Create File")); messageBox.setWindowTitle(tr("Create File"));
messageBox.setIcon(QMessageBox::Question); messageBox.setIcon(QMessageBox::Question);
messageBox.setText( messageBox.setText(tr("Create \"%1\"?").arg(targetFile.shortNativePath()));
tr("Create \"%1\"?")
.arg(Utils::FilePath::fromString(targetFile).shortNativePath()));
messageBox.setCheckBoxVisible(true); messageBox.setCheckBoxVisible(true);
messageBox.setCheckBoxText(tr("Always create")); messageBox.setCheckBoxText(tr("Always create"));
messageBox.setChecked(false); messageBox.setChecked(false);
@@ -204,12 +201,12 @@ void FileSystemFilter::accept(LocatorFilterEntry selection,
if (messageBox.clickedButton() != createButton) if (messageBox.clickedButton() != createButton)
return; return;
if (messageBox.isChecked()) if (messageBox.isChecked())
Utils::CheckableMessageBox::doNotAskAgain(ICore::settings(), kAlwaysCreate); CheckableMessageBox::doNotAskAgain(ICore::settings(), kAlwaysCreate);
} }
QFile file(targetFile); QFile file(targetFile.toString());
file.open(QFile::WriteOnly); file.open(QFile::WriteOnly);
file.close(); file.close();
VcsManager::promptToAdd(QFileInfo(targetFile).absolutePath(), { targetFile }); VcsManager::promptToAdd(targetFile.absolutePath(), {targetFile});
} }
BaseFileFilter::openEditorAt(selection); BaseFileFilter::openEditorAt(selection);
}, Qt::QueuedConnection); }, Qt::QueuedConnection);
@@ -273,3 +270,6 @@ void FileSystemFilter::restoreState(const QByteArray &state)
ILocatorFilter::restoreState(state); ILocatorFilter::restoreState(state);
} }
} }
} // Internal
} // Core

View File

@@ -431,13 +431,13 @@ QStringList VcsManager::additionalToolsPath()
return d->m_cachedAdditionalToolsPaths; return d->m_cachedAdditionalToolsPaths;
} }
void VcsManager::promptToAdd(const QString &directory, const QStringList &fileNames) void VcsManager::promptToAdd(const FilePath &directory, const FilePaths &filePaths)
{ {
IVersionControl *vc = findVersionControlForDirectory(FilePath::fromString(directory)); IVersionControl *vc = findVersionControlForDirectory(directory);
if (!vc || !vc->supportsOperation(IVersionControl::AddOperation)) if (!vc || !vc->supportsOperation(IVersionControl::AddOperation))
return; return;
const FilePaths unmanagedFiles = vc->unmanagedFiles(Utils::transform(fileNames, &FilePath::fromString)); const FilePaths unmanagedFiles = vc->unmanagedFiles(filePaths);
if (unmanagedFiles.isEmpty()) if (unmanagedFiles.isEmpty())
return; return;
@@ -446,7 +446,7 @@ void VcsManager::promptToAdd(const QString &directory, const QStringList &fileNa
if (dlg.exec() == QDialog::Accepted) { if (dlg.exec() == QDialog::Accepted) {
QStringList notAddedToVc; QStringList notAddedToVc;
for (const FilePath &file : unmanagedFiles) { for (const FilePath &file : unmanagedFiles) {
if (!vc->vcsAdd(FilePath::fromString(QDir(directory).filePath(file.path())))) if (!vc->vcsAdd(directory.resolvePath(file)))
notAddedToVc << file.toUserOutput(); notAddedToVc << file.toUserOutput();
} }

View File

@@ -80,7 +80,7 @@ public:
// Shows a confirmation dialog, whether the files in the list should be // Shows a confirmation dialog, whether the files in the list should be
// added to revision control. Calls vcsAdd for each file. // added to revision control. Calls vcsAdd for each file.
static void promptToAdd(const QString &directory, const QStringList &fileNames); static void promptToAdd(const Utils::FilePath &directory, const Utils::FilePaths &filePaths);
static void emitRepositoryChanged(const Utils::FilePath &repository); static void emitRepositoryChanged(const Utils::FilePath &repository);

View File

@@ -419,7 +419,7 @@ void CdbEngine::setupEngine()
} }
break; break;
case AttachToCore: case AttachToCore:
debugger.addArgs({"-z", sp.coreFile}); debugger.addArgs({"-z", sp.coreFile.path()});
break; break;
default: default:
handleSetupFailure(QString("Internal error: Unsupported start mode %1.").arg(sp.startMode)); handleSetupFailure(QString("Internal error: Unsupported start mode %1.").arg(sp.startMode));

View File

@@ -2632,7 +2632,7 @@ QString DebuggerEngine::formatStartParameters() const
if (!sp.debugger.command.isEmpty()) if (!sp.debugger.command.isEmpty())
str << "Debugger: " << sp.debugger.command.toUserOutput() << '\n'; str << "Debugger: " << sp.debugger.command.toUserOutput() << '\n';
if (!sp.coreFile.isEmpty()) if (!sp.coreFile.isEmpty())
str << "Core: " << QDir::toNativeSeparators(sp.coreFile) << '\n'; str << "Core: " << sp.coreFile.toUserOutput() << '\n';
if (sp.attachPID.isValid()) if (sp.attachPID.isValid())
str << "PID: " << sp.attachPID.pid() << ' ' << sp.crashParameter << '\n'; str << "PID: " << sp.attachPID.pid() << ' ' << sp.crashParameter << '\n';
if (!sp.projectSourceDirectory.isEmpty()) { if (!sp.projectSourceDirectory.isEmpty()) {

View File

@@ -158,7 +158,7 @@ public:
Utils::FilePath sysRoot; Utils::FilePath sysRoot;
// Used by general core file debugging. Public access requested in QTCREATORBUG-17158. // Used by general core file debugging. Public access requested in QTCREATORBUG-17158.
QString coreFile; Utils::FilePath coreFile;
// Macro-expanded and passed to debugger startup. // Macro-expanded and passed to debugger startup.
QString additionalStartupCommands; QString additionalStartupCommands;
@@ -172,7 +172,7 @@ public:
bool runAsRoot = false; bool runAsRoot = false;
ProjectExplorer::Runnable debugger; ProjectExplorer::Runnable debugger;
QString overrideStartScript; // Used in attach to core and remote debugging Utils::FilePath overrideStartScript; // Used in attach to core and remote debugging
QString startMessage; // First status message shown. QString startMessage; // First status message shown.
Utils::FilePath debugInfoLocation; // Gdb "set-debug-file-directory". Utils::FilePath debugInfoLocation; // Gdb "set-debug-file-directory".
QStringList debugSourceLocation; // Gdb "directory" QStringList debugSourceLocation; // Gdb "directory"

View File

@@ -1255,7 +1255,7 @@ bool DebuggerPluginPrivate::parseArgument(QStringList::const_iterator &it,
DebuggerStartMode startMode = StartExternal; DebuggerStartMode startMode = StartExternal;
FilePath executable; FilePath executable;
QString remoteChannel; QString remoteChannel;
QString coreFile; FilePath coreFile;
QString sysRoot; QString sysRoot;
bool useTerminal = false; bool useTerminal = false;
@@ -1281,7 +1281,7 @@ bool DebuggerPluginPrivate::parseArgument(QStringList::const_iterator &it,
remoteChannel = val; remoteChannel = val;
} else if (key == "core") { } else if (key == "core") {
startMode = AttachToCore; startMode = AttachToCore;
coreFile = val; coreFile = FilePath::fromUserInput(val);
} else if (key == "terminal") { } else if (key == "terminal") {
useTerminal = true; useTerminal = true;
} else if (key == "sysroot") { } else if (key == "sysroot") {
@@ -1312,9 +1312,9 @@ bool DebuggerPluginPrivate::parseArgument(QStringList::const_iterator &it,
} else if (startMode == AttachToCore) { } else if (startMode == AttachToCore) {
debugger->setStartMode(AttachToCore); debugger->setStartMode(AttachToCore);
debugger->setCloseMode(DetachAtClose); debugger->setCloseMode(DetachAtClose);
debugger->setCoreFileName(coreFile); debugger->setCoreFilePath(coreFile);
debugger->setRunControlName(tr("Core file \"%1\"").arg(coreFile)); debugger->setRunControlName(tr("Core file \"%1\"").arg(coreFile.toUserOutput()));
debugger->setStartMessage(tr("Attaching to core file %1.").arg(coreFile)); debugger->setStartMessage(tr("Attaching to core file %1.").arg(coreFile.toUserOutput()));
} else { } else {
debugger->setStartMode(StartExternal); debugger->setStartMode(StartExternal);
debugger->setRunControlName(tr("Executable file \"%1\"").arg(executable.toUserOutput())); debugger->setRunControlName(tr("Executable file \"%1\"").arg(executable.toUserOutput()));
@@ -1521,31 +1521,32 @@ void DebuggerPluginPrivate::attachCore()
const QString lastExternalKit = configValue("LastExternalKit").toString(); const QString lastExternalKit = configValue("LastExternalKit").toString();
if (!lastExternalKit.isEmpty()) if (!lastExternalKit.isEmpty())
dlg.setKitId(Id::fromString(lastExternalKit)); dlg.setKitId(Id::fromString(lastExternalKit));
dlg.setSymbolFile(configValue("LastExternalExecutableFile").toString()); dlg.setSymbolFile(FilePath::fromVariant(configValue("LastExternalExecutableFile")));
dlg.setLocalCoreFile(configValue("LastLocalCoreFile").toString()); dlg.setLocalCoreFile(FilePath::fromVariant(configValue("LastLocalCoreFile")));
dlg.setRemoteCoreFile(configValue("LastRemoteCoreFile").toString()); dlg.setRemoteCoreFile(FilePath::fromVariant(configValue("LastRemoteCoreFile")));
dlg.setOverrideStartScript(configValue("LastExternalStartScript").toString()); dlg.setOverrideStartScript(FilePath::fromVariant(configValue("LastExternalStartScript")));
dlg.setSysRoot(configValue("LastSysRoot").toString()); dlg.setSysRoot(FilePath::fromVariant(configValue("LastSysRoot")));
dlg.setForceLocalCoreFile(configValue("LastForceLocalCoreFile").toBool()); dlg.setForceLocalCoreFile(configValue("LastForceLocalCoreFile").toBool());
if (dlg.exec() != QDialog::Accepted) if (dlg.exec() != QDialog::Accepted)
return; return;
setConfigValue("LastExternalExecutableFile", dlg.symbolFile().toVariant()); setConfigValue("LastExternalExecutableFile", dlg.symbolFile().toVariant());
setConfigValue("LastLocalCoreFile", dlg.localCoreFile()); setConfigValue("LastLocalCoreFile", dlg.localCoreFile().toVariant());
setConfigValue("LastRemoteCoreFile", dlg.remoteCoreFile()); setConfigValue("LastRemoteCoreFile", dlg.remoteCoreFile().toVariant());
setConfigValue("LastExternalKit", dlg.kit()->id().toSetting()); setConfigValue("LastExternalKit", dlg.kit()->id().toSetting());
setConfigValue("LastExternalStartScript", dlg.overrideStartScript()); setConfigValue("LastExternalStartScript", dlg.overrideStartScript().toVariant());
setConfigValue("LastSysRoot", dlg.sysRoot().toString()); setConfigValue("LastSysRoot", dlg.sysRoot().toVariant());
setConfigValue("LastForceLocalCoreFile", dlg.forcesLocalCoreFile()); setConfigValue("LastForceLocalCoreFile", dlg.forcesLocalCoreFile());
auto runControl = new RunControl(ProjectExplorer::Constants::DEBUG_RUN_MODE); auto runControl = new RunControl(ProjectExplorer::Constants::DEBUG_RUN_MODE);
runControl->setKit(dlg.kit()); runControl->setKit(dlg.kit());
runControl->setDisplayName(tr("Core file \"%1\"") runControl->setDisplayName(tr("Core file \"%1\"")
.arg(dlg.useLocalCoreFile() ? dlg.localCoreFile() : dlg.remoteCoreFile())); .arg(dlg.useLocalCoreFile() ? dlg.localCoreFile().toUserOutput()
: dlg.remoteCoreFile().toUserOutput()));
auto debugger = new DebuggerRunTool(runControl); auto debugger = new DebuggerRunTool(runControl);
debugger->setInferiorExecutable(dlg.symbolFile()); debugger->setInferiorExecutable(dlg.symbolFile());
debugger->setCoreFileName(dlg.localCoreFile()); debugger->setCoreFilePath(dlg.localCoreFile());
debugger->setStartMode(AttachToCore); debugger->setStartMode(AttachToCore);
debugger->setCloseMode(DetachAtClose); debugger->setCloseMode(DetachAtClose);
debugger->setOverrideStartScript(dlg.overrideStartScript()); debugger->setOverrideStartScript(dlg.overrideStartScript());

View File

@@ -108,11 +108,11 @@ static QString noDebuggerInKitMessage()
class CoreUnpacker final : public RunWorker class CoreUnpacker final : public RunWorker
{ {
public: public:
CoreUnpacker(RunControl *runControl, const QString &coreFileName) CoreUnpacker(RunControl *runControl, const FilePath &coreFilePath)
: RunWorker(runControl), m_coreFileName(coreFileName) : RunWorker(runControl), m_coreFilePath(coreFilePath)
{} {}
QString coreFileName() const { return m_tempCoreFileName; } FilePath coreFileName() const { return m_tempCoreFilePath; }
private: private:
~CoreUnpacker() final ~CoreUnpacker() final
@@ -123,7 +123,7 @@ private:
if (m_tempCoreFile.isOpen()) if (m_tempCoreFile.isOpen())
m_tempCoreFile.close(); m_tempCoreFile.close();
QFile::remove(m_tempCoreFileName); m_tempCoreFilePath.removeFile();
} }
void start() final void start() final
@@ -131,40 +131,41 @@ private:
{ {
Utils::TemporaryFile tmp("tmpcore-XXXXXX"); Utils::TemporaryFile tmp("tmpcore-XXXXXX");
tmp.open(); tmp.open();
m_tempCoreFileName = tmp.fileName(); m_tempCoreFilePath = FilePath::fromString(tmp.fileName());
} }
m_coreUnpackProcess.setWorkingDirectory(FilePath::fromString(TemporaryDirectory::masterDirectoryPath())); m_coreUnpackProcess.setWorkingDirectory(FilePath::fromString(TemporaryDirectory::masterDirectoryPath()));
connect(&m_coreUnpackProcess, &QtcProcess::finished, this, &CoreUnpacker::reportStarted); connect(&m_coreUnpackProcess, &QtcProcess::finished, this, &CoreUnpacker::reportStarted);
const QString msg = DebuggerRunTool::tr("Unpacking core file to %1"); const QString msg = DebuggerRunTool::tr("Unpacking core file to %1");
appendMessage(msg.arg(m_tempCoreFileName), LogMessageFormat); appendMessage(msg.arg(m_tempCoreFilePath.toUserOutput()), LogMessageFormat);
if (m_coreFileName.endsWith(".lzo")) { if (m_coreFilePath.endsWith(".lzo")) {
m_coreUnpackProcess.setCommand({"lzop", {"-o", m_tempCoreFileName, "-x", m_coreFileName}}); m_coreUnpackProcess.setCommand({"lzop", {"-o", m_tempCoreFilePath.path(),
"-x", m_coreFilePath.path()}});
m_coreUnpackProcess.start(); m_coreUnpackProcess.start();
return; return;
} }
if (m_coreFileName.endsWith(".gz")) { if (m_coreFilePath.endsWith(".gz")) {
appendMessage(msg.arg(m_tempCoreFileName), LogMessageFormat); appendMessage(msg.arg(m_tempCoreFilePath.toUserOutput()), LogMessageFormat);
m_tempCoreFile.setFileName(m_tempCoreFileName); m_tempCoreFile.setFileName(m_tempCoreFilePath.path());
m_tempCoreFile.open(QFile::WriteOnly); m_tempCoreFile.open(QFile::WriteOnly);
connect(&m_coreUnpackProcess, &QtcProcess::readyReadStandardOutput, this, [this] { connect(&m_coreUnpackProcess, &QtcProcess::readyReadStandardOutput, this, [this] {
m_tempCoreFile.write(m_coreUnpackProcess.readAllStandardOutput()); m_tempCoreFile.write(m_coreUnpackProcess.readAllStandardOutput());
}); });
m_coreUnpackProcess.setCommand({"gzip", {"-c", "-d", m_coreFileName}}); m_coreUnpackProcess.setCommand({"gzip", {"-c", "-d", m_coreFilePath.path()}});
m_coreUnpackProcess.start(); m_coreUnpackProcess.start();
return; return;
} }
QTC_CHECK(false); QTC_CHECK(false);
reportFailure("Unknown file extension in " + m_coreFileName); reportFailure("Unknown file extension in " + m_coreFilePath.toUserOutput());
} }
QFile m_tempCoreFile; QFile m_tempCoreFile;
QString m_coreFileName; FilePath m_coreFilePath;
QString m_tempCoreFileName; FilePath m_tempCoreFilePath;
QtcProcess m_coreUnpackProcess; QtcProcess m_coreUnpackProcess;
}; };
@@ -369,7 +370,7 @@ void DebuggerRunTool::setTestCase(int testCase)
m_runParameters.testCase = testCase; m_runParameters.testCase = testCase;
} }
void DebuggerRunTool::setOverrideStartScript(const QString &script) void DebuggerRunTool::setOverrideStartScript(const FilePath &script)
{ {
m_runParameters.overrideStartScript = script; m_runParameters.overrideStartScript = script;
} }
@@ -409,7 +410,7 @@ void DebuggerRunTool::setStartMessage(const QString &msg)
m_runParameters.startMessage = msg; m_runParameters.startMessage = msg;
} }
void DebuggerRunTool::setCoreFileName(const QString &coreFile, bool isSnapshot) void DebuggerRunTool::setCoreFilePath(const FilePath &coreFile, bool isSnapshot)
{ {
if (coreFile.endsWith(".gz") || coreFile.endsWith(".lzo")) { if (coreFile.endsWith(".gz") || coreFile.endsWith(".lzo")) {
d->coreUnpacker = new CoreUnpacker(runControl(), coreFile); d->coreUnpacker = new CoreUnpacker(runControl(), coreFile);
@@ -588,7 +589,7 @@ void DebuggerRunTool::start()
auto debugger = new DebuggerRunTool(rc); auto debugger = new DebuggerRunTool(rc);
debugger->setStartMode(AttachToCore); debugger->setStartMode(AttachToCore);
debugger->setRunControlName(name); debugger->setRunControlName(name);
debugger->setCoreFileName(coreFile, true); debugger->setCoreFilePath(FilePath::fromString(coreFile), true);
debugger->startRunControl(); debugger->startRunControl();
}); });
@@ -962,7 +963,7 @@ void DebuggerRunTool::addSolibSearchDir(const QString &str)
DebuggerRunTool::~DebuggerRunTool() DebuggerRunTool::~DebuggerRunTool()
{ {
if (m_runParameters.isSnapshot && !m_runParameters.coreFile.isEmpty()) if (m_runParameters.isSnapshot && !m_runParameters.coreFile.isEmpty())
QFile::remove(m_runParameters.coreFile); m_runParameters.coreFile.removeFile();
delete m_engine2; delete m_engine2;
m_engine2 = nullptr; m_engine2 = nullptr;

View File

@@ -119,13 +119,13 @@ public:
void setQmlServer(const QUrl &qmlServer); void setQmlServer(const QUrl &qmlServer);
QUrl qmlServer() const; // Used in GammaRay integration. QUrl qmlServer() const; // Used in GammaRay integration.
void setCoreFileName(const QString &core, bool isSnapshot = false); void setCoreFilePath(const Utils::FilePath &core, bool isSnapshot = false);
void setIosPlatform(const QString &platform); void setIosPlatform(const QString &platform);
void setDeviceSymbolsRoot(const QString &deviceSymbolsRoot); void setDeviceSymbolsRoot(const QString &deviceSymbolsRoot);
void setTestCase(int testCase); void setTestCase(int testCase);
void setOverrideStartScript(const QString &script); void setOverrideStartScript(const Utils::FilePath &script);
void setAbi(const ProjectExplorer::Abi &abi); void setAbi(const ProjectExplorer::Abi &abi);

View File

@@ -245,7 +245,7 @@ QVariant EngineItem::data(int column, int role) const
return myName; return myName;
} }
case 1: case 1:
return rp.coreFile.isEmpty() ? rp.inferior.command.executable().toUserOutput() : rp.coreFile; return (rp.coreFile.isEmpty() ? rp.inferior.command.executable() : rp.coreFile).toUserOutput();
} }
return QVariant(); return QVariant();

View File

@@ -4018,17 +4018,17 @@ void GdbEngine::handleGdbStartFailed()
void GdbEngine::loadInitScript() void GdbEngine::loadInitScript()
{ {
const QString script = runParameters().overrideStartScript; const FilePath script = runParameters().overrideStartScript;
if (!script.isEmpty()) { if (!script.isEmpty()) {
if (QFileInfo(script).isReadable()) { if (script.isReadableFile()) {
runCommand({"source " + script}); runCommand({"source " + script.path()});
} else { } else {
AsynchronousMessageBox::warning( AsynchronousMessageBox::warning(
tr("Cannot Find Debugger Initialization Script"), tr("Cannot Find Debugger Initialization Script"),
tr("The debugger settings point to a script file at \"%1\", " tr("The debugger settings point to a script file at \"%1\", "
"which is not accessible. If a script file is not needed, " "which is not accessible. If a script file is not needed, "
"consider clearing that entry to avoid this warning." "consider clearing that entry to avoid this warning."
).arg(script)); ).arg(script.toUserOutput()));
} }
} else { } else {
const QString commands = nativeStartupCommands().trimmed(); const QString commands = nativeStartupCommands().trimmed();
@@ -4537,7 +4537,7 @@ void GdbEngine::runEngine()
} else if (isCoreEngine()) { } else if (isCoreEngine()) {
claimInitialBreakpoints(); claimInitialBreakpoints();
runCommand({"target core " + runParameters().coreFile, CB(handleTargetCore)}); runCommand({"target core " + runParameters().coreFile.path(), CB(handleTargetCore)});
} else if (isTermEngine()) { } else if (isTermEngine()) {
@@ -4714,12 +4714,12 @@ void GdbEngine::handleFileExecAndSymbols(const DebuggerResponse &response)
} else if (isCoreEngine()) { } else if (isCoreEngine()) {
QString core = runParameters().coreFile; const FilePath core = runParameters().coreFile;
if (response.resultClass == ResultDone) { if (response.resultClass == ResultDone) {
showMessage(tr("Symbols found."), StatusBar); showMessage(tr("Symbols found."), StatusBar);
handleInferiorPrepared(); handleInferiorPrepared();
} else { } else {
QString msg = tr("No symbols found in the core file \"%1\".").arg(core) QString msg = tr("No symbols found in the core file \"%1\".").arg(core.toUserOutput())
+ ' ' + tr("This can be caused by a path length limitation " + ' ' + tr("This can be caused by a path length limitation "
"in the core file.") "in the core file.")
+ ' ' + tr("Try to specify the binary in " + ' ' + tr("Try to specify the binary in "
@@ -4956,41 +4956,35 @@ void GdbEngine::handleStubAttached(const DebuggerResponse &response, qint64 main
} }
} }
static QString findExecutableFromName(const QString &fileNameFromCore, const QString &coreFile) static FilePath findExecutableFromName(const QString &fileNameFromCore, const FilePath &coreFile)
{ {
if (fileNameFromCore.isEmpty()) if (fileNameFromCore.isEmpty())
return fileNameFromCore; return {};
QFileInfo fi(fileNameFromCore);
if (fi.isFile()) FilePath filePathFromCore = FilePath::fromUserInput(fileNameFromCore);
return fileNameFromCore; if (filePathFromCore.isFile())
return filePathFromCore;
// turn the filename into an absolute path, using the location of the core as a hint // turn the filename into an absolute path, using the location of the core as a hint
QString absPath; const FilePath coreDir = coreFile.absoluteFilePath().parentDir();
if (fi.isAbsolute()) { const FilePath absPath = coreDir.resolvePath(fileNameFromCore);
absPath = fileNameFromCore;
} else { if (absPath.isFile() || absPath.isEmpty())
QFileInfo coreInfo(coreFile);
FilePath coreDir = FilePath::fromString(coreInfo.dir().absolutePath());
absPath = coreDir.resolvePath(fileNameFromCore).toString();
}
if (QFileInfo(absPath).isFile() || absPath.isEmpty())
return absPath; return absPath;
// remove possible trailing arguments // remove possible trailing arguments
QChar sep(' '); QStringList pathFragments = absPath.path().split(' ');
QStringList pathFragments = absPath.split(sep);
while (pathFragments.size() > 0) { while (pathFragments.size() > 0) {
QString joined_path = pathFragments.join(sep); const FilePath joined_path = FilePath::fromString(pathFragments.join(' '));
if (QFileInfo(joined_path).isFile()) { if (joined_path.isFile())
return joined_path; return joined_path;
}
pathFragments.pop_back(); pathFragments.pop_back();
} }
return QString(); return {};
} }
CoreInfo CoreInfo::readExecutableNameFromCore(const Runnable &debugger, const QString &coreFile) CoreInfo CoreInfo::readExecutableNameFromCore(const Runnable &debugger, const FilePath &coreFile)
{ {
CoreInfo cinfo; CoreInfo cinfo;
#if 0 #if 0
@@ -5002,7 +4996,7 @@ CoreInfo CoreInfo::readExecutableNameFromCore(const Runnable &debugger, const QS
// Multiarch GDB on Windows crashes if osabi is cygwin (the default) when opening a core dump. // Multiarch GDB on Windows crashes if osabi is cygwin (the default) when opening a core dump.
if (HostOsInfo::isWindowsHost()) if (HostOsInfo::isWindowsHost())
args += {"-ex", "set osabi GNU/Linux"}; args += {"-ex", "set osabi GNU/Linux"};
args += {"-ex", "core " + coreFile}; args += {"-ex", "core " + coreFile.toUserOutput()};
QtcProcess proc; QtcProcess proc;
Environment envLang(Environment::systemEnvironment()); Environment envLang(Environment::systemEnvironment());
@@ -5022,8 +5016,7 @@ CoreInfo CoreInfo::readExecutableNameFromCore(const Runnable &debugger, const QS
if (pos2 != -1) { if (pos2 != -1) {
cinfo.isCore = true; cinfo.isCore = true;
cinfo.rawStringFromCore = output.mid(pos1, pos2 - pos1); cinfo.rawStringFromCore = output.mid(pos1, pos2 - pos1);
cinfo.foundExecutableName = cinfo.foundExecutableName = findExecutableFromName(cinfo.rawStringFromCore, coreFile);
FilePath::fromString(findExecutableFromName(cinfo.rawStringFromCore, coreFile));
} }
} }
} }
@@ -5040,7 +5033,7 @@ void GdbEngine::handleTargetCore(const DebuggerResponse &response)
// We'll accept any kind of error e.g. &"Cannot access memory at address 0x2abc2a24\n" // We'll accept any kind of error e.g. &"Cannot access memory at address 0x2abc2a24\n"
// Even without the stack, the user can find interesting stuff by exploring // Even without the stack, the user can find interesting stuff by exploring
// the memory, globals etc. // the memory, globals etc.
showStatusMessage(tr("Attach to core \"%1\" failed:").arg(runParameters().coreFile) showStatusMessage(tr("Attach to core \"%1\" failed:").arg(runParameters().coreFile.toUserOutput())
+ '\n' + response.data["msg"].data() + '\n' + response.data["msg"].data()
+ '\n' + tr("Continuing nevertheless.")); + '\n' + tr("Continuing nevertheless."));
} }

View File

@@ -61,7 +61,7 @@ struct CoreInfo
bool isCore = false; bool isCore = false;
static CoreInfo readExecutableNameFromCore(const ProjectExplorer::Runnable &debugger, static CoreInfo readExecutableNameFromCore(const ProjectExplorer::Runnable &debugger,
const QString &coreFile); const Utils::FilePath &coreFile);
}; };
class GdbEngine final : public CppDebuggerEngine class GdbEngine final : public CppDebuggerEngine

View File

@@ -73,8 +73,8 @@ public:
explicit SelectRemoteFileDialog(QWidget *parent); explicit SelectRemoteFileDialog(QWidget *parent);
void attachToDevice(Kit *k); void attachToDevice(Kit *k);
QString localFile() const { return m_localFile; } FilePath localFile() const { return m_localFile; }
QString remoteFile() const { return m_remoteFile; } FilePath remoteFile() const { return m_remoteFile; }
private: private:
void handleSftpOperationFinished(SftpJobId, const QString &error); void handleSftpOperationFinished(SftpJobId, const QString &error);
@@ -88,8 +88,8 @@ private:
QTreeView *m_fileSystemView; QTreeView *m_fileSystemView;
QTextBrowser *m_textBrowser; QTextBrowser *m_textBrowser;
QDialogButtonBox *m_buttonBox; QDialogButtonBox *m_buttonBox;
QString m_localFile; FilePath m_localFile;
QString m_remoteFile; FilePath m_remoteFile;
SftpJobId m_sftpJobId; SftpJobId m_sftpJobId;
}; };
@@ -185,12 +185,12 @@ void SelectRemoteFileDialog::selectFile()
{ {
Utils::TemporaryFile localFile("remotecore-XXXXXX"); Utils::TemporaryFile localFile("remotecore-XXXXXX");
localFile.open(); localFile.open();
m_localFile = localFile.fileName(); m_localFile = FilePath::fromString(localFile.fileName());
} }
idx = idx.sibling(idx.row(), 1); idx = idx.sibling(idx.row(), 1);
m_remoteFile = m_fileSystemModel.data(idx, SftpFileSystemModel::PathRole).toString(); m_remoteFile = FilePath::fromVariant(m_fileSystemModel.data(idx, SftpFileSystemModel::PathRole));
m_sftpJobId = m_fileSystemModel.downloadFile(idx, m_localFile); m_sftpJobId = m_fileSystemModel.downloadFile(idx, m_localFile.toString());
} }
/////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////
@@ -372,11 +372,12 @@ bool AttachCoreDialog::useLocalCoreFile() const
void AttachCoreDialog::coreFileChanged(const QString &core) void AttachCoreDialog::coreFileChanged(const QString &core)
{ {
if (!HostOsInfo::isWindowsHost() && QFile::exists(core)) { const FilePath coreFile = FilePath::fromUserInput(core);
if (coreFile.osType() != OsType::OsTypeWindows && coreFile.exists()) {
Kit *k = d->kitChooser->currentKit(); Kit *k = d->kitChooser->currentKit();
QTC_ASSERT(k, return); QTC_ASSERT(k, return);
Runnable debugger = DebuggerKitAspect::runnable(k); Runnable debugger = DebuggerKitAspect::runnable(k);
CoreInfo cinfo = CoreInfo::readExecutableNameFromCore(debugger, core); CoreInfo cinfo = CoreInfo::readExecutableNameFromCore(debugger, coreFile);
if (!cinfo.foundExecutableName.isEmpty()) if (!cinfo.foundExecutableName.isEmpty())
d->symbolFileName->setFilePath(cinfo.foundExecutableName); d->symbolFileName->setFilePath(cinfo.foundExecutableName);
else if (!d->symbolFileName->isValid() && !cinfo.rawStringFromCore.isEmpty()) else if (!d->symbolFileName->isValid() && !cinfo.rawStringFromCore.isEmpty())
@@ -413,14 +414,14 @@ void AttachCoreDialog::selectRemoteCoreFile()
dlg.attachToDevice(d->kitChooser->currentKit()); dlg.attachToDevice(d->kitChooser->currentKit());
if (dlg.exec() == QDialog::Rejected) if (dlg.exec() == QDialog::Rejected)
return; return;
d->localCoreFileName->setPath(dlg.localFile()); d->localCoreFileName->setFilePath(dlg.localFile());
d->remoteCoreFileName->setText(dlg.remoteFile()); d->remoteCoreFileName->setText(dlg.remoteFile().toUserOutput());
changed(); changed();
} }
QString AttachCoreDialog::localCoreFile() const FilePath AttachCoreDialog::localCoreFile() const
{ {
return d->localCoreFileName->filePath().toString(); return d->localCoreFileName->filePath();
} }
FilePath AttachCoreDialog::symbolFile() const FilePath AttachCoreDialog::symbolFile() const
@@ -428,24 +429,24 @@ FilePath AttachCoreDialog::symbolFile() const
return d->symbolFileName->filePath(); return d->symbolFileName->filePath();
} }
void AttachCoreDialog::setSymbolFile(const QString &symbolFileName) void AttachCoreDialog::setSymbolFile(const FilePath &symbolFilePath)
{ {
d->symbolFileName->setPath(symbolFileName); d->symbolFileName->setFilePath(symbolFilePath);
} }
void AttachCoreDialog::setLocalCoreFile(const QString &fileName) void AttachCoreDialog::setLocalCoreFile(const FilePath &coreFilePath)
{ {
d->localCoreFileName->setPath(fileName); d->localCoreFileName->setFilePath(coreFilePath);
} }
void AttachCoreDialog::setRemoteCoreFile(const QString &fileName) void AttachCoreDialog::setRemoteCoreFile(const FilePath &coreFilePath)
{ {
d->remoteCoreFileName->setText(fileName); d->remoteCoreFileName->setText(coreFilePath.toUserOutput());
} }
QString AttachCoreDialog::remoteCoreFile() const FilePath AttachCoreDialog::remoteCoreFile() const
{ {
return d->remoteCoreFileName->text(); return FilePath::fromUserInput(d->remoteCoreFileName->text());
} }
void AttachCoreDialog::setKitId(Id id) void AttachCoreDialog::setKitId(Id id)
@@ -468,14 +469,14 @@ Kit *AttachCoreDialog::kit() const
return d->kitChooser->currentKit(); return d->kitChooser->currentKit();
} }
QString AttachCoreDialog::overrideStartScript() const FilePath AttachCoreDialog::overrideStartScript() const
{ {
return d->overrideStartScriptFileName->filePath().toString(); return d->overrideStartScriptFileName->filePath();
} }
void AttachCoreDialog::setOverrideStartScript(const QString &scriptName) void AttachCoreDialog::setOverrideStartScript(const FilePath &scriptName)
{ {
d->overrideStartScriptFileName->setPath(scriptName); d->overrideStartScriptFileName->setFilePath(scriptName);
} }
FilePath AttachCoreDialog::sysRoot() const FilePath AttachCoreDialog::sysRoot() const
@@ -483,9 +484,9 @@ FilePath AttachCoreDialog::sysRoot() const
return d->sysRootDirectory->filePath(); return d->sysRootDirectory->filePath();
} }
void AttachCoreDialog::setSysRoot(const QString &sysRoot) void AttachCoreDialog::setSysRoot(const FilePath &sysRoot)
{ {
d->sysRootDirectory->setPath(sysRoot); d->sysRootDirectory->setFilePath(sysRoot);
} }
} // namespace Internal } // namespace Internal

View File

@@ -48,9 +48,9 @@ public:
int exec() override; int exec() override;
Utils::FilePath symbolFile() const; Utils::FilePath symbolFile() const;
QString localCoreFile() const; Utils::FilePath localCoreFile() const;
QString remoteCoreFile() const; Utils::FilePath remoteCoreFile() const;
QString overrideStartScript() const; Utils::FilePath overrideStartScript() const;
Utils::FilePath sysRoot() const; Utils::FilePath sysRoot() const;
bool useLocalCoreFile() const; bool useLocalCoreFile() const;
bool forcesLocalCoreFile() const; bool forcesLocalCoreFile() const;
@@ -58,11 +58,11 @@ public:
// For persistance. // For persistance.
ProjectExplorer::Kit *kit() const; ProjectExplorer::Kit *kit() const;
void setSymbolFile(const QString &symbolFileName); void setSymbolFile(const Utils::FilePath &symbolFilePath);
void setLocalCoreFile(const QString &core); void setLocalCoreFile(const Utils::FilePath &coreFilePath);
void setRemoteCoreFile(const QString &core); void setRemoteCoreFile(const Utils::FilePath &coreFilePath);
void setOverrideStartScript(const QString &scriptName); void setOverrideStartScript(const Utils::FilePath &scriptName);
void setSysRoot(const QString &sysRoot); void setSysRoot(const Utils::FilePath &sysRoot);
void setKitId(Utils::Id id); void setKitId(Utils::Id id);
void setForceLocalCoreFile(bool on); void setForceLocalCoreFile(bool on);

View File

@@ -42,18 +42,44 @@
#include <QLabel> #include <QLabel>
#include <QPushButton> #include <QPushButton>
using namespace Utils;
namespace Debugger { namespace Debugger {
namespace Internal { namespace Internal {
// Internal helper dialog prompting for a cache directory using a PathChooser.
//
// Note that QFileDialog does not offer a way of suggesting
// a non-existent folder, which is in turn automatically
// created. This is done here (suggest $TEMP\symbolcache
// regardless of its existence).
class CacheDirectoryDialog : public QDialog
{
Q_DECLARE_TR_FUNCTIONS(Debugger::Internal::CaheDirectoryDialog)
public:
explicit CacheDirectoryDialog(QWidget *parent);
void setPath(const FilePath &p) { m_chooser->setFilePath(p); }
FilePath path() const { return m_chooser->filePath(); }
void accept() override;
private:
PathChooser *m_chooser;
QDialogButtonBox *m_buttonBox;
};
CacheDirectoryDialog::CacheDirectoryDialog(QWidget *parent) : CacheDirectoryDialog::CacheDirectoryDialog(QWidget *parent) :
QDialog(parent), m_chooser(new Utils::PathChooser), QDialog(parent), m_chooser(new PathChooser),
m_buttonBox(new QDialogButtonBox(QDialogButtonBox::Ok|QDialogButtonBox::Cancel)) m_buttonBox(new QDialogButtonBox(QDialogButtonBox::Ok|QDialogButtonBox::Cancel))
{ {
setWindowTitle(tr("Select Local Cache Folder")); setWindowTitle(tr("Select Local Cache Folder"));
setModal(true); setModal(true);
auto formLayout = new QFormLayout; auto formLayout = new QFormLayout;
m_chooser->setExpectedKind(Utils::PathChooser::ExistingDirectory); m_chooser->setExpectedKind(PathChooser::ExistingDirectory);
m_chooser->setHistoryCompleter("Debugger.CdbCacheDir.History"); m_chooser->setHistoryCompleter("Debugger.CdbCacheDir.History");
m_chooser->setMinimumWidth(400); m_chooser->setMinimumWidth(400);
formLayout->addRow(tr("Path:"), m_chooser); formLayout->addRow(tr("Path:"), m_chooser);
@@ -68,42 +94,30 @@ CacheDirectoryDialog::CacheDirectoryDialog(QWidget *parent) :
connect(m_buttonBox, &QDialogButtonBox::rejected, this, &CacheDirectoryDialog::reject); connect(m_buttonBox, &QDialogButtonBox::rejected, this, &CacheDirectoryDialog::reject);
} }
void CacheDirectoryDialog::setPath(const QString &p)
{
m_chooser->setPath(p);
}
QString CacheDirectoryDialog::path() const
{
return m_chooser->filePath().toString();
}
void CacheDirectoryDialog::accept() void CacheDirectoryDialog::accept()
{ {
QString cache = path(); FilePath cache = path();
// if cache is empty a default is used by the cdb // if cache is empty a default is used by the cdb
if (cache.isEmpty()) { if (cache.isEmpty()) {
QDialog::accept(); QDialog::accept();
return; return;
} }
// Ensure path exists // Ensure path exists
QFileInfo fi(cache);
// Folder exists - all happy. // Folder exists - all happy.
if (fi.isDir()) { if (cache.isDir()) {
QDialog::accept(); QDialog::accept();
return; return;
} }
// Does a file of the same name exist? // Does a file of the same name exist?
if (fi.exists()) { if (cache.exists()) {
Core::AsynchronousMessageBox::warning(tr("Already Exists"), Core::AsynchronousMessageBox::warning(tr("Already Exists"),
tr("A file named \"%1\" already exists.").arg(cache)); tr("A file named \"%1\" already exists.").arg(cache.toUserOutput()));
return; return;
} }
// Create // Create
QDir root(QDir::root()); if (!cache.ensureWritableDir()) {
if (!root.mkpath(cache)) {
Core::AsynchronousMessageBox::warning(tr("Cannot Create"), Core::AsynchronousMessageBox::warning(tr("Cannot Create"),
tr("The folder \"%1\" could not be created.").arg(cache)); tr("The folder \"%1\" could not be created.").arg(cache.toUserOutput()));
return; return;
} }
QDialog::accept(); QDialog::accept();
@@ -111,12 +125,13 @@ void CacheDirectoryDialog::accept()
// ---------------- CdbSymbolPathListEditor // ---------------- CdbSymbolPathListEditor
const char *CdbSymbolPathListEditor::symbolServerPrefixC = "srv*"; // Pre- and Postfix used to build a symbol server path specification
const char *CdbSymbolPathListEditor::symbolServerPostfixC = "http://msdl.microsoft.com/download/symbols"; const char symbolServerPrefixC[] = "srv*";
const char *CdbSymbolPathListEditor::symbolCachePrefixC = "cache*"; const char symbolServerPostfixC[] = "http://msdl.microsoft.com/download/symbols";
const char symbolCachePrefixC[] = "cache*";
CdbSymbolPathListEditor::CdbSymbolPathListEditor(QWidget *parent) : CdbSymbolPathListEditor::CdbSymbolPathListEditor(QWidget *parent) :
Utils::PathListEditor(parent) PathListEditor(parent)
{ {
QPushButton *button = insertButton(lastInsertButtonIndex + 1, QPushButton *button = insertButton(lastInsertButtonIndex + 1,
tr("Insert Symbol Server..."), this, [this](){ tr("Insert Symbol Server..."), this, [this](){
@@ -136,10 +151,10 @@ CdbSymbolPathListEditor::CdbSymbolPathListEditor(QWidget *parent) :
button->setToolTip(tr("Configure Symbol paths that are used to locate debug symbol files.")); button->setToolTip(tr("Configure Symbol paths that are used to locate debug symbol files."));
} }
bool CdbSymbolPathListEditor::promptCacheDirectory(QWidget *parent, QString *cacheDirectory) bool CdbSymbolPathListEditor::promptCacheDirectory(QWidget *parent, FilePath *cacheDirectory)
{ {
CacheDirectoryDialog dialog(parent); CacheDirectoryDialog dialog(parent);
dialog.setPath(Utils::TemporaryDirectory::masterDirectoryPath() + "/symbolcache"); dialog.setPath(FilePath::fromString(TemporaryDirectory::masterDirectoryPath()) + "/symbolcache");
if (dialog.exec() != QDialog::Accepted) if (dialog.exec() != QDialog::Accepted)
return false; return false;
*cacheDirectory = dialog.path(); *cacheDirectory = dialog.path();
@@ -148,9 +163,9 @@ bool CdbSymbolPathListEditor::promptCacheDirectory(QWidget *parent, QString *cac
void CdbSymbolPathListEditor::addSymbolPath(CdbSymbolPathListEditor::SymbolPathMode mode) void CdbSymbolPathListEditor::addSymbolPath(CdbSymbolPathListEditor::SymbolPathMode mode)
{ {
QString cacheDir; FilePath cacheDir;
if (promptCacheDirectory(this, &cacheDir)) if (promptCacheDirectory(this, &cacheDir))
insertPathAtCursor(CdbSymbolPathListEditor::symbolPath(cacheDir, mode)); insertPathAtCursor(CdbSymbolPathListEditor::symbolPath(cacheDir.path(), mode));
} }
void CdbSymbolPathListEditor::setupSymbolPaths() void CdbSymbolPathListEditor::setupSymbolPaths()
@@ -165,7 +180,7 @@ void CdbSymbolPathListEditor::setupSymbolPaths()
if (path.isEmpty() && indexOfSymbolCache != -1) if (path.isEmpty() && indexOfSymbolCache != -1)
path = currentPaths.at(indexOfSymbolCache); path = currentPaths.at(indexOfSymbolCache);
if (path.isEmpty()) if (path.isEmpty())
path = Utils::TemporaryDirectory::masterDirectoryPath() + "/symbolcache"; path = TemporaryDirectory::masterDirectoryPath() + "/symbolcache";
bool useSymbolServer = true; bool useSymbolServer = true;
bool useSymbolCache = true; bool useSymbolCache = true;

View File

@@ -27,13 +27,7 @@
#include <utils/pathlisteditor.h> #include <utils/pathlisteditor.h>
#include <QDialog> namespace Utils { class FilePath; }
namespace Utils { class PathChooser; }
QT_BEGIN_NAMESPACE
class QDialogButtonBox;
QT_END_NAMESPACE
namespace Debugger { namespace Debugger {
namespace Internal { namespace Internal {
@@ -45,21 +39,6 @@ namespace Internal {
// created. This is done here (suggest $TEMP\symbolcache // created. This is done here (suggest $TEMP\symbolcache
// regardless of its existence). // regardless of its existence).
class CacheDirectoryDialog : public QDialog {
Q_OBJECT
public:
explicit CacheDirectoryDialog(QWidget *parent = nullptr);
void setPath(const QString &p);
QString path() const;
void accept() override;
private:
Utils::PathChooser *m_chooser;
QDialogButtonBox *m_buttonBox;
};
class CdbSymbolPathListEditor : public Utils::PathListEditor class CdbSymbolPathListEditor : public Utils::PathListEditor
{ {
Q_OBJECT Q_OBJECT
@@ -71,12 +50,7 @@ public:
explicit CdbSymbolPathListEditor(QWidget *parent = nullptr); explicit CdbSymbolPathListEditor(QWidget *parent = nullptr);
static bool promptCacheDirectory(QWidget *parent, QString *cacheDirectory); static bool promptCacheDirectory(QWidget *parent, Utils::FilePath *cacheDirectory);
// Pre- and Postfix used to build a symbol server path specification
static const char *symbolServerPrefixC;
static const char *symbolServerPostfixC;
static const char *symbolCachePrefixC;
// Format a symbol path specification // Format a symbol path specification
static QString symbolPath(const QString &cacheDir, SymbolPathMode mode); static QString symbolPath(const QString &cacheDir, SymbolPathMode mode);

View File

@@ -1654,10 +1654,12 @@ bool DockerDevicePrivate::runInShell(const CommandLine &cmd) const
QMutexLocker l(&m_shellMutex); QMutexLocker l(&m_shellMutex);
m_shell->readAllStandardOutput(); // clean possible left-overs m_shell->readAllStandardOutput(); // clean possible left-overs
m_shell->write(cmd.toUserOutput().toUtf8() + "\necho $?\n"); m_shell->write(cmd.toUserOutput().toUtf8() + "\necho $?\n");
m_shell->waitForReadyRead(); QTC_ASSERT(m_shell->waitForReadyRead(), return false);
QByteArray output = m_shell->readAllStandardOutput(); QByteArray output = m_shell->readAllStandardOutput();
int result = output.toInt(); bool ok;
int result = output.toInt(&ok);
LOG("Run command in shell:" << cmd.toUserOutput() << "result: " << output << " ==>" << result); LOG("Run command in shell:" << cmd.toUserOutput() << "result: " << output << " ==>" << result);
QTC_ASSERT(ok, return false);
return result == 0; return result == 0;
} }

View File

@@ -26,7 +26,6 @@
#include "baseprojectwizarddialog.h" #include "baseprojectwizarddialog.h"
#include <coreplugin/documentmanager.h> #include <coreplugin/documentmanager.h>
#include <utils/fileutils.h>
#include <utils/projectintropage.h> #include <utils/projectintropage.h>
#include <QDir> #include <QDir>
@@ -45,28 +44,25 @@ using namespace Utils;
namespace ProjectExplorer { namespace ProjectExplorer {
struct BaseProjectWizardDialogPrivate { struct BaseProjectWizardDialogPrivate
explicit BaseProjectWizardDialogPrivate(Utils::ProjectIntroPage *page, int id = -1); {
explicit BaseProjectWizardDialogPrivate(ProjectIntroPage *page, int id = -1)
: desiredIntroPageId(id), introPage(page)
{}
const int desiredIntroPageId; const int desiredIntroPageId;
Utils::ProjectIntroPage *introPage; ProjectIntroPage *introPage;
int introPageId; int introPageId = -1;
Utils::Id selectedPlatform; Id selectedPlatform;
QSet<Utils::Id> requiredFeatureSet; QSet<Id> requiredFeatureSet;
}; };
BaseProjectWizardDialogPrivate::BaseProjectWizardDialogPrivate(Utils::ProjectIntroPage *page, int id) :
desiredIntroPageId(id),
introPage(page),
introPageId(-1)
{
}
BaseProjectWizardDialog::BaseProjectWizardDialog(const Core::BaseFileWizardFactory *factory, BaseProjectWizardDialog::BaseProjectWizardDialog(const Core::BaseFileWizardFactory *factory,
QWidget *parent, QWidget *parent,
const Core::WizardDialogParameters &parameters) : const Core::WizardDialogParameters &parameters) :
Core::BaseFileWizard(factory, parameters.extraValues(), parent), Core::BaseFileWizard(factory, parameters.extraValues(), parent),
d(std::make_unique<BaseProjectWizardDialogPrivate>(new Utils::ProjectIntroPage)) d(std::make_unique<BaseProjectWizardDialogPrivate>(new ProjectIntroPage))
{ {
setFilePath(parameters.defaultPath()); setFilePath(parameters.defaultPath());
setSelectedPlatform(parameters.selectedPlatform()); setSelectedPlatform(parameters.selectedPlatform());
@@ -130,7 +126,7 @@ void BaseProjectWizardDialog::setProjectList(const QStringList &projectList)
d->introPage->setProjectList(projectList); d->introPage->setProjectList(projectList);
} }
void BaseProjectWizardDialog::setProjectDirectories(const QStringList &directories) void BaseProjectWizardDialog::setProjectDirectories(const FilePaths &directories)
{ {
d->introPage->setProjectDirectories(directories); d->introPage->setProjectDirectories(directories);
} }
@@ -156,7 +152,7 @@ bool BaseProjectWizardDialog::validateCurrentPage()
return Core::BaseFileWizard::validateCurrentPage(); return Core::BaseFileWizard::validateCurrentPage();
} }
Utils::ProjectIntroPage *BaseProjectWizardDialog::introPage() const ProjectIntroPage *BaseProjectWizardDialog::introPage() const
{ {
return d->introPage; return d->introPage;
} }
@@ -180,26 +176,26 @@ QString BaseProjectWizardDialog::uniqueProjectName(const FilePath &path)
void BaseProjectWizardDialog::addExtensionPages(const QList<QWizardPage *> &wizardPageList) void BaseProjectWizardDialog::addExtensionPages(const QList<QWizardPage *> &wizardPageList)
{ {
foreach (QWizardPage *p,wizardPageList) for (QWizardPage *p : wizardPageList)
addPage(p); addPage(p);
} }
Utils::Id BaseProjectWizardDialog::selectedPlatform() const Id BaseProjectWizardDialog::selectedPlatform() const
{ {
return d->selectedPlatform; return d->selectedPlatform;
} }
void BaseProjectWizardDialog::setSelectedPlatform(Utils::Id platform) void BaseProjectWizardDialog::setSelectedPlatform(Id platform)
{ {
d->selectedPlatform = platform; d->selectedPlatform = platform;
} }
QSet<Utils::Id> BaseProjectWizardDialog::requiredFeatures() const QSet<Id> BaseProjectWizardDialog::requiredFeatures() const
{ {
return d->requiredFeatureSet; return d->requiredFeatureSet;
} }
void BaseProjectWizardDialog::setRequiredFeatures(const QSet<Utils::Id> &featureSet) void BaseProjectWizardDialog::setRequiredFeatures(const QSet<Id> &featureSet)
{ {
d->requiredFeatureSet = featureSet; d->requiredFeatureSet = featureSet;
} }

View File

@@ -30,12 +30,11 @@
#include <coreplugin/basefilewizard.h> #include <coreplugin/basefilewizard.h>
#include <coreplugin/basefilewizardfactory.h> #include <coreplugin/basefilewizardfactory.h>
#include <utils/filepath.h>
#include <memory> #include <memory>
namespace Utils { namespace Utils { class ProjectIntroPage; }
class FilePath;
class ProjectIntroPage;
} // Utils
namespace ProjectExplorer { namespace ProjectExplorer {
@@ -68,7 +67,7 @@ public:
void setFilePath(const Utils::FilePath &path); void setFilePath(const Utils::FilePath &path);
void setProjectName(const QString &name); void setProjectName(const QString &name);
void setProjectList(const QStringList &projectList); void setProjectList(const QStringList &projectList);
void setProjectDirectories(const QStringList &directories); void setProjectDirectories(const Utils::FilePaths &directories);
void setForceSubProject(bool force); void setForceSubProject(bool force);
signals: signals:

View File

@@ -630,7 +630,8 @@ void IDevice::fromMap(const QVariantMap &map)
? QSsh::SshConnectionParameters::AuthenticationTypeAll ? QSsh::SshConnectionParameters::AuthenticationTypeAll
: static_cast<AuthType>(storedAuthType); : static_cast<AuthType>(storedAuthType);
d->sshParameters.privateKeyFile = map.value(QLatin1String(KeyFileKey), defaultPrivateKeyFilePath()).toString(); d->sshParameters.privateKeyFile =
FilePath::fromVariant(map.value(QLatin1String(KeyFileKey), defaultPrivateKeyFilePath()));
d->sshParameters.timeout = map.value(QLatin1String(TimeoutKey), DefaultTimeout).toInt(); d->sshParameters.timeout = map.value(QLatin1String(TimeoutKey), DefaultTimeout).toInt();
d->sshParameters.hostKeyCheckingMode = static_cast<QSsh::SshHostKeyCheckingMode> d->sshParameters.hostKeyCheckingMode = static_cast<QSsh::SshHostKeyCheckingMode>
(map.value(QLatin1String(HostKeyCheckingKey), QSsh::SshHostKeyCheckingNone).toInt()); (map.value(QLatin1String(HostKeyCheckingKey), QSsh::SshHostKeyCheckingNone).toInt());
@@ -666,7 +667,7 @@ QVariantMap IDevice::toMap() const
map.insert(QLatin1String(SshPortKey), d->sshParameters.port()); map.insert(QLatin1String(SshPortKey), d->sshParameters.port());
map.insert(QLatin1String(UserNameKey), d->sshParameters.userName()); map.insert(QLatin1String(UserNameKey), d->sshParameters.userName());
map.insert(QLatin1String(AuthKey), d->sshParameters.authenticationType); map.insert(QLatin1String(AuthKey), d->sshParameters.authenticationType);
map.insert(QLatin1String(KeyFileKey), d->sshParameters.privateKeyFile); map.insert(QLatin1String(KeyFileKey), d->sshParameters.privateKeyFile.toVariant());
map.insert(QLatin1String(TimeoutKey), d->sshParameters.timeout); map.insert(QLatin1String(TimeoutKey), d->sshParameters.timeout);
map.insert(QLatin1String(HostKeyCheckingKey), d->sshParameters.hostKeyCheckingMode); map.insert(QLatin1String(HostKeyCheckingKey), d->sshParameters.hostKeyCheckingMode);

View File

@@ -62,6 +62,8 @@
using namespace Utils; using namespace Utils;
namespace ProjectExplorer {
const char NAME_KEY[] = "name"; const char NAME_KEY[] = "name";
const char DISPLAY_NAME_KEY[] = "trDisplayName"; const char DISPLAY_NAME_KEY[] = "trDisplayName";
const char TOOLTIP_KEY[] = "trToolTip"; const char TOOLTIP_KEY[] = "trToolTip";
@@ -75,8 +77,7 @@ const char DATA_KEY[] = "data";
const char IS_COMPLETE_KEY[] = "isComplete"; const char IS_COMPLETE_KEY[] = "isComplete";
const char IS_COMPLETE_MESSAGE_KEY[] = "trIncompleteMessage"; const char IS_COMPLETE_MESSAGE_KEY[] = "trIncompleteMessage";
namespace { static QVariant consumeValue(QVariantMap &map, const QString &key, const QVariant &defaultValue = {})
QVariant consumeValue(QVariantMap &map, const QString &key, const QVariant &defaultValue = QVariant())
{ {
QVariantMap::iterator i = map.find(key); QVariantMap::iterator i = map.find(key);
if (i != map.end()) { if (i != map.end()) {
@@ -87,7 +88,7 @@ QVariant consumeValue(QVariantMap &map, const QString &key, const QVariant &defa
return defaultValue; return defaultValue;
} }
void warnAboutUnsupportedKeys(const QVariantMap &map, const QString &name, const QString &type = QString()) static void warnAboutUnsupportedKeys(const QVariantMap &map, const QString &name, const QString &type = {})
{ {
if (!map.isEmpty()) { if (!map.isEmpty()) {
@@ -98,9 +99,7 @@ void warnAboutUnsupportedKeys(const QVariantMap &map, const QString &name, const
qWarning().noquote() << QString("Field %1 has unsupported keys: %2").arg(typeAndName, map.keys().join(", ")); qWarning().noquote() << QString("Field %1 has unsupported keys: %2").arg(typeAndName, map.keys().join(", "));
} }
} }
} // namespace
namespace ProjectExplorer {
// -------------------------------------------------------------------- // --------------------------------------------------------------------
// Helper: // Helper:
@@ -811,8 +810,8 @@ bool PathChooserField::parseData(const QVariant &data, QString *errorMessage)
QVariantMap tmp = data.toMap(); QVariantMap tmp = data.toMap();
m_path = consumeValue(tmp, "path").toString(); m_path = FilePath::fromVariant(consumeValue(tmp, "path"));
m_basePath = consumeValue(tmp, "basePath").toString(); m_basePath = FilePath::fromVariant(consumeValue(tmp, "basePath"));
m_historyId = consumeValue(tmp, "historyId").toString(); m_historyId = consumeValue(tmp, "historyId").toString();
QString kindStr = consumeValue(tmp, "kind", "existingDirectory").toString(); QString kindStr = consumeValue(tmp, "kind", "existingDirectory").toString();
@@ -851,7 +850,7 @@ QWidget *PathChooserField::createWidget(const QString &displayName, JsonFieldPag
if (!m_historyId.isEmpty()) if (!m_historyId.isEmpty())
w->setHistoryCompleter(m_historyId); w->setHistoryCompleter(m_historyId);
QObject::connect(w, &PathChooser::pathChanged, [this, w] { QObject::connect(w, &PathChooser::pathChanged, [this, w] {
if (w->filePath().toString() != m_path) if (w->filePath() != m_path)
setHasUserChanges(); setHasUserChanges();
}); });
return w; return w;
@@ -887,23 +886,19 @@ void PathChooserField::initializeData(MacroExpander *expander)
{ {
auto w = qobject_cast<PathChooser *>(widget()); auto w = qobject_cast<PathChooser *>(widget());
QTC_ASSERT(w, return); QTC_ASSERT(w, return);
w->setBaseDirectory(expander->expand(FilePath::fromString(m_basePath))); w->setBaseDirectory(expander->expand(m_basePath));
w->setExpectedKind(m_kind); w->setExpectedKind(m_kind);
w->setFilePath(expander->expand(m_path));
if (m_currentPath.isNull())
w->setPath(expander->expand(m_path));
else
w->setPath(m_currentPath);
} }
void PathChooserField::fromSettings(const QVariant &value) void PathChooserField::fromSettings(const QVariant &value)
{ {
m_path = value.toString(); m_path = FilePath::fromVariant(value);
} }
QVariant PathChooserField::toSettings() const QVariant PathChooserField::toSettings() const
{ {
return qobject_cast<PathChooser *>(widget())->filePath().toString(); return qobject_cast<PathChooser *>(widget())->filePath().toVariant();
} }
// -------------------------------------------------------------------- // --------------------------------------------------------------------

View File

@@ -216,21 +216,18 @@ private:
{ {
QString result; QString result;
QTextStream out(&result); QTextStream out(&result);
out << "PathChooser{path:" << m_path out << "PathChooser{path:" << m_path.toString()
<< "; base:" << m_basePath << "; base:" << m_basePath
<< "; historyId:" << m_historyId << "; historyId:" << m_historyId
<< "; kind:" << (int)Utils::PathChooser::ExistingDirectory << "; kind:" << (int)Utils::PathChooser::ExistingDirectory
<< "; currentPath:" << m_currentPath
<< "}"; << "}";
return result; return result;
} }
QString m_path; Utils::FilePath m_path;
QString m_basePath; Utils::FilePath m_basePath;
QString m_historyId; QString m_historyId;
Utils::PathChooser::Kind m_kind = Utils::PathChooser::ExistingDirectory; Utils::PathChooser::Kind m_kind = Utils::PathChooser::ExistingDirectory;
QString m_currentPath;
}; };
class CheckBoxField : public JsonFieldPage::Field class CheckBoxField : public JsonFieldPage::Field

View File

@@ -1070,7 +1070,7 @@ void DeviceKitAspect::addToMacroExpander(Kit *kit, Utils::MacroExpander *expande
expander->registerVariable("Device:KeyFile", tr("Private key file"), expander->registerVariable("Device:KeyFile", tr("Private key file"),
[kit]() -> QString { [kit]() -> QString {
const IDevice::ConstPtr device = DeviceKitAspect::device(kit); const IDevice::ConstPtr device = DeviceKitAspect::device(kit);
return device ? device->sshParameters().privateKeyFile : QString(); return device ? device->sshParameters().privateKeyFile.toString() : QString();
}); });
expander->registerVariable("Device:Name", tr("Device name"), expander->registerVariable("Device:Name", tr("Device name"),
[kit]() -> QString { [kit]() -> QString {
@@ -1297,7 +1297,7 @@ void BuildDeviceKitAspect::addToMacroExpander(Kit *kit, Utils::MacroExpander *ex
expander->registerVariable("BuildDevice:KeyFile", tr("Build private key file"), expander->registerVariable("BuildDevice:KeyFile", tr("Build private key file"),
[kit]() -> QString { [kit]() -> QString {
const IDevice::ConstPtr device = BuildDeviceKitAspect::device(kit); const IDevice::ConstPtr device = BuildDeviceKitAspect::device(kit);
return device ? device->sshParameters().privateKeyFile : QString(); return device ? device->sshParameters().privateKeyFile.toString() : QString();
}); });
expander->registerVariable("BuildDevice:Name", tr("Build device name"), expander->registerVariable("BuildDevice:Name", tr("Build device name"),
[kit]() -> QString { [kit]() -> QString {

View File

@@ -3619,10 +3619,10 @@ void ProjectExplorerPluginPrivate::addExistingProjects()
if (subProjectFilePaths.empty()) if (subProjectFilePaths.empty())
return; return;
FilePaths failedProjects; FilePaths failedProjects;
QStringList addedProjects; FilePaths addedProjects;
for (const FilePath &filePath : qAsConst(subProjectFilePaths)) { for (const FilePath &filePath : qAsConst(subProjectFilePaths)) {
if (projectNode->addSubProject(filePath)) if (projectNode->addSubProject(filePath))
addedProjects << filePath.toString(); addedProjects << filePath;
else else
failedProjects << filePath; failedProjects << filePath;
} }
@@ -3633,7 +3633,7 @@ void ProjectExplorerPluginPrivate::addExistingProjects()
message + "\n " + FilePath::formatFilePaths(failedProjects, "\n ")); message + "\n " + FilePath::formatFilePaths(failedProjects, "\n "));
return; return;
} }
VcsManager::promptToAdd(dir.toString(), addedProjects); VcsManager::promptToAdd(dir, addedProjects);
} }
void ProjectExplorerPluginPrivate::handleAddExistingFiles() void ProjectExplorerPluginPrivate::handleAddExistingFiles()
@@ -3685,7 +3685,7 @@ void ProjectExplorerPlugin::addExistingFiles(FolderNode *folderNode, const FileP
[&notAdded](const FilePath &f) { return !notAdded.contains(f); }); [&notAdded](const FilePath &f) { return !notAdded.contains(f); });
} }
VcsManager::promptToAdd(dir.toString(), Utils::transform(fileNames, &FilePath::toString)); VcsManager::promptToAdd(dir, fileNames);
} }
void ProjectExplorerPluginPrivate::removeProject() void ProjectExplorerPluginPrivate::removeProject()
@@ -4209,6 +4209,10 @@ AllProjectFilesFilter::AllProjectFilesFilter()
setDefaultIncludedByDefault(false); // but not included in default setDefaultIncludedByDefault(false); // but not included in default
setFilters({}); setFilters({});
setIsCustomFilter(false); setIsCustomFilter(false);
setDescription(ProjectExplorerPluginPrivate::tr(
"Matches all files from all project directories. Append \"+<number>\" or "
"\":<number>\" to jump to the given line number. Append another "
"\"+<number>\" or \":<number>\" to jump to the column number as well."));
} }
const char kDirectoriesKey[] = "directories"; const char kDirectoriesKey[] = "directories";

View File

@@ -66,7 +66,6 @@ class QMLDESIGNERCORE_EXPORT AbstractProperty
friend QMLDESIGNERCORE_EXPORT bool operator ==(const AbstractProperty &property1, const AbstractProperty &property2); friend QMLDESIGNERCORE_EXPORT bool operator ==(const AbstractProperty &property1, const AbstractProperty &property2);
friend QMLDESIGNERCORE_EXPORT bool operator !=(const AbstractProperty &property1, const AbstractProperty &property2); friend QMLDESIGNERCORE_EXPORT bool operator !=(const AbstractProperty &property1, const AbstractProperty &property2);
friend QMLDESIGNERCORE_EXPORT uint qHash(const AbstractProperty& property);
public: public:
AbstractProperty(); AbstractProperty();
@@ -103,6 +102,11 @@ public:
Model *model() const; Model *model() const;
AbstractView *view() const; AbstractView *view() const;
friend auto qHash(const AbstractProperty &property)
{
return ::qHash(property.m_internalNode.data()) ^ ::qHash(property.m_propertyName);
}
protected: protected:
AbstractProperty(const PropertyName &propertyName, const Internal::InternalNodePointer &internalNode, Model* model, AbstractView *view); AbstractProperty(const PropertyName &propertyName, const Internal::InternalNodePointer &internalNode, Model* model, AbstractView *view);
AbstractProperty(const Internal::InternalPropertyPointer &property, Model* model, AbstractView *view); AbstractProperty(const Internal::InternalPropertyPointer &property, Model* model, AbstractView *view);
@@ -118,7 +122,6 @@ private:
QMLDESIGNERCORE_EXPORT bool operator ==(const AbstractProperty &property1, const AbstractProperty &property2); QMLDESIGNERCORE_EXPORT bool operator ==(const AbstractProperty &property1, const AbstractProperty &property2);
QMLDESIGNERCORE_EXPORT bool operator !=(const AbstractProperty &property1, const AbstractProperty &property2); QMLDESIGNERCORE_EXPORT bool operator !=(const AbstractProperty &property1, const AbstractProperty &property2);
QMLDESIGNERCORE_EXPORT uint qHash(const AbstractProperty& property);
QMLDESIGNERCORE_EXPORT QTextStream& operator<<(QTextStream &stream, const AbstractProperty &property); QMLDESIGNERCORE_EXPORT QTextStream& operator<<(QTextStream &stream, const AbstractProperty &property);
QMLDESIGNERCORE_EXPORT QDebug operator<<(QDebug debug, const AbstractProperty &AbstractProperty); QMLDESIGNERCORE_EXPORT QDebug operator<<(QDebug debug, const AbstractProperty &AbstractProperty);
} }

View File

@@ -71,7 +71,6 @@ class QMLDESIGNERCORE_EXPORT ModelNode
{ {
friend QMLDESIGNERCORE_EXPORT bool operator ==(const ModelNode &firstNode, const ModelNode &secondNode); friend QMLDESIGNERCORE_EXPORT bool operator ==(const ModelNode &firstNode, const ModelNode &secondNode);
friend QMLDESIGNERCORE_EXPORT bool operator !=(const ModelNode &firstNode, const ModelNode &secondNode); friend QMLDESIGNERCORE_EXPORT bool operator !=(const ModelNode &firstNode, const ModelNode &secondNode);
friend QMLDESIGNERCORE_EXPORT uint qHash(const ModelNode & node);
friend QMLDESIGNERCORE_EXPORT QDebug operator<<(QDebug debug, const ModelNode &modelNode); friend QMLDESIGNERCORE_EXPORT QDebug operator<<(QDebug debug, const ModelNode &modelNode);
friend QMLDESIGNERCORE_EXPORT bool operator <(const ModelNode &firstNode, const ModelNode &secondNode); friend QMLDESIGNERCORE_EXPORT bool operator <(const ModelNode &firstNode, const ModelNode &secondNode);
friend QMLDESIGNERCORE_EXPORT QList<Internal::InternalNodePointer> toInternalNodeList(const QList<ModelNode> &nodeList); friend QMLDESIGNERCORE_EXPORT QList<Internal::InternalNodePointer> toInternalNodeList(const QList<ModelNode> &nodeList);
@@ -248,6 +247,8 @@ public:
swap(first.m_view, second.m_view); swap(first.m_view, second.m_view);
} }
friend auto qHash(const ModelNode &node) { return ::qHash(node.m_internalNode.data()); }
private: // functions private: // functions
Internal::InternalNodePointer internalNode() const; Internal::InternalNodePointer internalNode() const;
@@ -261,7 +262,6 @@ private: // variables
QMLDESIGNERCORE_EXPORT bool operator ==(const ModelNode &firstNode, const ModelNode &secondNode); QMLDESIGNERCORE_EXPORT bool operator ==(const ModelNode &firstNode, const ModelNode &secondNode);
QMLDESIGNERCORE_EXPORT bool operator !=(const ModelNode &firstNode, const ModelNode &secondNode); QMLDESIGNERCORE_EXPORT bool operator !=(const ModelNode &firstNode, const ModelNode &secondNode);
QMLDESIGNERCORE_EXPORT uint qHash(const ModelNode & node);
QMLDESIGNERCORE_EXPORT bool operator <(const ModelNode &firstNode, const ModelNode &secondNode); QMLDESIGNERCORE_EXPORT bool operator <(const ModelNode &firstNode, const ModelNode &secondNode);
QMLDESIGNERCORE_EXPORT QDebug operator<<(QDebug debug, const ModelNode &modelNode); QMLDESIGNERCORE_EXPORT QDebug operator<<(QDebug debug, const ModelNode &modelNode);
QMLDESIGNERCORE_EXPORT QTextStream& operator<<(QTextStream &stream, const ModelNode &modelNode); QMLDESIGNERCORE_EXPORT QTextStream& operator<<(QTextStream &stream, const ModelNode &modelNode);

View File

@@ -42,7 +42,6 @@ class QMLDESIGNERCORE_EXPORT NodeAbstractProperty : public AbstractProperty
friend QMLDESIGNERCORE_EXPORT bool operator ==(const NodeAbstractProperty &property1, const NodeAbstractProperty &property2); friend QMLDESIGNERCORE_EXPORT bool operator ==(const NodeAbstractProperty &property1, const NodeAbstractProperty &property2);
friend QMLDESIGNERCORE_EXPORT bool operator !=(const NodeAbstractProperty &property1, const NodeAbstractProperty &property2); friend QMLDESIGNERCORE_EXPORT bool operator !=(const NodeAbstractProperty &property1, const NodeAbstractProperty &property2);
friend QMLDESIGNERCORE_EXPORT uint qHash(const NodeAbstractProperty& property);
public: public:
NodeAbstractProperty(); NodeAbstractProperty();
@@ -56,6 +55,8 @@ public:
QList<ModelNode> allSubNodes(); QList<ModelNode> allSubNodes();
QList<ModelNode> directSubNodes() const; QList<ModelNode> directSubNodes() const;
friend auto qHash(const NodeAbstractProperty &property) { qHash(AbstractProperty(property)); }
protected: protected:
NodeAbstractProperty(const PropertyName &propertyName, const Internal::InternalNodePointer &internalNode, Model *model, AbstractView *view); NodeAbstractProperty(const PropertyName &propertyName, const Internal::InternalNodePointer &internalNode, Model *model, AbstractView *view);
NodeAbstractProperty(const Internal::InternalNodeAbstractPropertyPointer &property, Model *model, AbstractView *view); NodeAbstractProperty(const Internal::InternalNodeAbstractPropertyPointer &property, Model *model, AbstractView *view);
@@ -65,7 +66,6 @@ protected:
QMLDESIGNERCORE_EXPORT bool operator ==(const NodeAbstractProperty &property1, const NodeAbstractProperty &property2); QMLDESIGNERCORE_EXPORT bool operator ==(const NodeAbstractProperty &property1, const NodeAbstractProperty &property2);
QMLDESIGNERCORE_EXPORT bool operator !=(const NodeAbstractProperty &property1, const NodeAbstractProperty &property2); QMLDESIGNERCORE_EXPORT bool operator !=(const NodeAbstractProperty &property1, const NodeAbstractProperty &property2);
QMLDESIGNERCORE_EXPORT uint qHash(const NodeAbstractProperty& property);
QMLDESIGNERCORE_EXPORT QTextStream& operator<<(QTextStream &stream, const NodeAbstractProperty &property); QMLDESIGNERCORE_EXPORT QTextStream& operator<<(QTextStream &stream, const NodeAbstractProperty &property);
QMLDESIGNERCORE_EXPORT QDebug operator<<(QDebug debug, const NodeAbstractProperty &property); QMLDESIGNERCORE_EXPORT QDebug operator<<(QDebug debug, const NodeAbstractProperty &property);

View File

@@ -55,12 +55,12 @@ public:
void setBindingProperty(const PropertyName &name, const QString &expression) override; void setBindingProperty(const PropertyName &name, const QString &expression) override;
bool isBlocked(const PropertyName &propName) const override; bool isBlocked(const PropertyName &propName) const override;
friend auto qHash(const Qml3DNode &node) { return qHash(node.modelNode()); }
private: private:
void handleEulerRotationSet(); void handleEulerRotationSet();
}; };
QMLDESIGNERCORE_EXPORT uint qHash(const Qml3DNode &node);
QMLDESIGNERCORE_EXPORT QList<ModelNode> toModelNodeList(const QList<Qml3DNode> &fxItemNodeList); QMLDESIGNERCORE_EXPORT QList<ModelNode> toModelNodeList(const QList<Qml3DNode> &fxItemNodeList);
QMLDESIGNERCORE_EXPORT QList<Qml3DNode> toQml3DNodeList(const QList<ModelNode> &modelNodeList); QMLDESIGNERCORE_EXPORT QList<Qml3DNode> toQml3DNodeList(const QList<ModelNode> &modelNodeList);

View File

@@ -147,6 +147,8 @@ public:
bool isFlowItem() const; bool isFlowItem() const;
bool isFlowActionArea() const; bool isFlowActionArea() const;
ModelNode rootModelNode() const; ModelNode rootModelNode() const;
friend auto qHash(const QmlItemNode &node) { return qHash(node.modelNode()); }
}; };
class QmlFlowItemNode; class QmlFlowItemNode;
@@ -218,8 +220,6 @@ protected:
}; };
QMLDESIGNERCORE_EXPORT uint qHash(const QmlItemNode &node);
QMLDESIGNERCORE_EXPORT QList<ModelNode> toModelNodeList(const QList<QmlItemNode> &fxItemNodeList); QMLDESIGNERCORE_EXPORT QList<ModelNode> toModelNodeList(const QList<QmlItemNode> &fxItemNodeList);
QMLDESIGNERCORE_EXPORT QList<QmlItemNode> toQmlItemNodeList(const QList<ModelNode> &modelNodeList); QMLDESIGNERCORE_EXPORT QList<QmlItemNode> toQmlItemNodeList(const QList<ModelNode> &modelNodeList);
QMLDESIGNERCORE_EXPORT QList<QmlItemNode> toQmlItemNodeListKeppInvalid(const QList<ModelNode> &modelNodeList); QMLDESIGNERCORE_EXPORT QList<QmlItemNode> toQmlItemNodeListKeppInvalid(const QList<ModelNode> &modelNodeList);

View File

@@ -37,8 +37,7 @@ class QMLDESIGNERCORE_EXPORT QmlModelNodeFacade
{ {
public: public:
operator ModelNode() const; operator ModelNode() const;
ModelNode modelNode(); ModelNode modelNode() const { return m_modelNode; }
const ModelNode modelNode() const;
bool hasModelNode() const; bool hasModelNode() const;
static bool isValidQmlModelNodeFacade(const ModelNode &modelNode); static bool isValidQmlModelNodeFacade(const ModelNode &modelNode);
virtual bool isValid() const; virtual bool isValid() const;

View File

@@ -127,6 +127,8 @@ public:
virtual bool isBlocked(const PropertyName &propName) const; virtual bool isBlocked(const PropertyName &propName) const;
friend auto qHash(const QmlObjectNode &node) { return qHash(node.modelNode()); }
protected: protected:
NodeInstance nodeInstance() const; NodeInstance nodeInstance() const;
QmlObjectNode nodeForInstance(const NodeInstance &instance) const; QmlObjectNode nodeForInstance(const NodeInstance &instance) const;
@@ -136,7 +138,6 @@ protected:
QList<QmlModelState> allDefinedStates() const; QList<QmlModelState> allDefinedStates() const;
}; };
QMLDESIGNERCORE_EXPORT uint qHash(const QmlObjectNode &node);
QMLDESIGNERCORE_EXPORT QList<ModelNode> toModelNodeList(const QList<QmlObjectNode> &fxObjectNodeList); QMLDESIGNERCORE_EXPORT QList<ModelNode> toModelNodeList(const QList<QmlObjectNode> &fxObjectNodeList);
QMLDESIGNERCORE_EXPORT QList<QmlObjectNode> toQmlObjectNodeList(const QList<ModelNode> &modelNodeList); QMLDESIGNERCORE_EXPORT QList<QmlObjectNode> toQmlObjectNodeList(const QList<ModelNode> &modelNodeList);
}// QmlDesigner }// QmlDesigner

View File

@@ -118,8 +118,6 @@ private:
void setDoubleProperty(const PropertyName &name, double value); void setDoubleProperty(const PropertyName &name, double value);
}; };
QMLDESIGNERCORE_EXPORT uint qHash(const QmlItemNode &node);
class QMLDESIGNERCORE_EXPORT QmlModelStateGroup class QMLDESIGNERCORE_EXPORT QmlModelStateGroup
{ {
friend class QmlVisualNode; friend class QmlVisualNode;

View File

@@ -357,13 +357,6 @@ bool operator !=(const AbstractProperty &property1, const AbstractProperty &prop
return !(property1 == property2); return !(property1 == property2);
} }
uint qHash(const AbstractProperty &property)
{
//### to do
return ::qHash(property.m_internalNode.data())
^ ::qHash(property.m_propertyName);
}
QDebug operator<<(QDebug debug, const AbstractProperty &property) QDebug operator<<(QDebug debug, const AbstractProperty &property)
{ {
return debug.nospace() << "AbstractProperty(" << (property.isValid() ? property.name() : PropertyName("invalid")) << ')'; return debug.nospace() << "AbstractProperty(" << (property.isValid() ? property.name() : PropertyName("invalid")) << ')';

View File

@@ -768,12 +768,6 @@ Internal::InternalNodePointer ModelNode::internalNode() const
return m_internalNode; return m_internalNode;
} }
uint qHash(const ModelNode &node)
{
return ::qHash(node.internalId());
}
/*! /*!
\brief returns the model of the node \brief returns the model of the node
\return returns the model of the node \return returns the model of the node

View File

@@ -183,11 +183,6 @@ bool operator !=(const NodeAbstractProperty &property1, const NodeAbstractProper
return !(property1 == property2); return !(property1 == property2);
} }
uint qHash(const NodeAbstractProperty &property)
{
return qHash(AbstractProperty(property));
}
QDebug operator<<(QDebug debug, const NodeAbstractProperty &property) QDebug operator<<(QDebug debug, const NodeAbstractProperty &property)
{ {
return debug.nospace() << "NodeAbstractProperty(" << (property.isValid() ? property.name() : PropertyName("invalid")) << ')'; return debug.nospace() << "NodeAbstractProperty(" << (property.isValid() ? property.name() : PropertyName("invalid")) << ')';

View File

@@ -480,11 +480,6 @@ QPixmap QmlItemNode::instanceBlurredRenderPixmap() const
return nodeInstance().blurredRenderPixmap(); return nodeInstance().blurredRenderPixmap();
} }
uint qHash(const QmlItemNode &node)
{
return qHash(node.modelNode());
}
QList<ModelNode> toModelNodeList(const QList<QmlItemNode> &qmlItemNodeList) QList<ModelNode> toModelNodeList(const QList<QmlItemNode> &qmlItemNodeList)
{ {
QList<ModelNode> modelNodeList; QList<ModelNode> modelNodeList;

View File

@@ -60,16 +60,6 @@ QmlModelNodeFacade::operator ModelNode() const
return m_modelNode; return m_modelNode;
} }
ModelNode QmlModelNodeFacade::modelNode()
{
return m_modelNode;
}
const ModelNode QmlModelNodeFacade::modelNode() const
{
return m_modelNode;
}
bool QmlModelNodeFacade::hasModelNode() const bool QmlModelNodeFacade::hasModelNode() const
{ {
return m_modelNode.isValid(); return m_modelNode.isValid();

View File

@@ -737,11 +737,6 @@ QmlVisualNode QmlObjectNode::toQmlVisualNode() const
return QmlVisualNode(modelNode()); return QmlVisualNode(modelNode());
} }
uint qHash(const QmlObjectNode &node)
{
return qHash(node.modelNode());
}
QString QmlObjectNode::simplifiedTypeName() const QString QmlObjectNode::simplifiedTypeName() const
{ {
return modelNode().simplifiedTypeName(); return modelNode().simplifiedTypeName();

View File

@@ -123,7 +123,7 @@ void GenericLinuxDeviceConfigurationWidget::userNameEditingFinished()
void GenericLinuxDeviceConfigurationWidget::keyFileEditingFinished() void GenericLinuxDeviceConfigurationWidget::keyFileEditingFinished()
{ {
SshConnectionParameters sshParams = device()->sshParameters(); SshConnectionParameters sshParams = device()->sshParameters();
sshParams.privateKeyFile = m_ui->keyFileLineEdit->filePath().toString(); sshParams.privateKeyFile = m_ui->keyFileLineEdit->filePath();
device()->setSshParameters(sshParams); device()->setSshParameters(sshParams);
} }
@@ -138,9 +138,9 @@ void GenericLinuxDeviceConfigurationWidget::handleFreePortsChanged()
updatePortsWarningLabel(); updatePortsWarningLabel();
} }
void GenericLinuxDeviceConfigurationWidget::setPrivateKey(const QString &path) void GenericLinuxDeviceConfigurationWidget::setPrivateKey(const FilePath &path)
{ {
m_ui->keyFileLineEdit->setPath(path); m_ui->keyFileLineEdit->setFilePath(path);
keyFileEditingFinished(); keyFileEditingFinished();
} }
@@ -211,7 +211,7 @@ void GenericLinuxDeviceConfigurationWidget::initGui()
m_ui->portsLineEdit->setText(device()->freePorts().toString()); m_ui->portsLineEdit->setText(device()->freePorts().toString());
m_ui->timeoutSpinBox->setValue(sshParams.timeout); m_ui->timeoutSpinBox->setValue(sshParams.timeout);
m_ui->userLineEdit->setText(sshParams.userName()); m_ui->userLineEdit->setText(sshParams.userName());
m_ui->keyFileLineEdit->setPath(sshParams.privateKeyFile); m_ui->keyFileLineEdit->setFilePath(sshParams.privateKeyFile);
m_ui->gdbServerLineEdit->setText(device()->debugServerPath().toString()); m_ui->gdbServerLineEdit->setText(device()->debugServerPath().toString());
updatePortsWarningLabel(); updatePortsWarningLabel();
} }

View File

@@ -52,7 +52,7 @@ private:
void keyFileEditingFinished(); void keyFileEditingFinished();
void gdbServerEditingFinished(); void gdbServerEditingFinished();
void handleFreePortsChanged(); void handleFreePortsChanged();
void setPrivateKey(const QString &path); void setPrivateKey(const Utils::FilePath &path);
void createNewKey(); void createNewKey();
void hostKeyCheckingChanged(bool doCheck); void hostKeyCheckingChanged(bool doCheck);

View File

@@ -33,7 +33,6 @@
#include <utils/utilsicons.h> #include <utils/utilsicons.h>
#include <utils/pathchooser.h> #include <utils/pathchooser.h>
#include <QDir>
#include <QHBoxLayout> #include <QHBoxLayout>
#include <QLabel> #include <QLabel>
#include <QPushButton> #include <QPushButton>
@@ -149,10 +148,10 @@ QString GenericLinuxDeviceConfigurationWizardFinalPage::infoText() const
struct GenericLinuxDeviceConfigurationWizardKeyDeploymentPage::Private struct GenericLinuxDeviceConfigurationWizardKeyDeploymentPage::Private
{ {
QStringList defaultKeys() const FilePaths defaultKeys() const
{ {
const QString baseDir = QDir::homePath() + "/.ssh"; const FilePath baseDir = FileUtils::homePath() / ".ssh";
return QStringList{baseDir + "/id_rsa", baseDir + "/id_ecdsa", baseDir + "/id_ed25519"}; return {baseDir / "id_rsa", baseDir / "id_ecdsa", baseDir / "id_ed25519"};
} }
PathChooser keyFileChooser; PathChooser keyFileChooser;
@@ -200,9 +199,9 @@ GenericLinuxDeviceConfigurationWizardKeyDeploymentPage::GenericLinuxDeviceConfig
d->iconLabel.clear(); d->iconLabel.clear();
emit completeChanged(); emit completeChanged();
}); });
for (const QString &defaultKey : d->defaultKeys()) { for (const FilePath &defaultKey : d->defaultKeys()) {
if (QFileInfo::exists(defaultKey)) { if (defaultKey.exists()) {
d->keyFileChooser.setPath(defaultKey); d->keyFileChooser.setFilePath(defaultKey);
break; break;
} }
} }
@@ -221,7 +220,7 @@ void GenericLinuxDeviceConfigurationWizardKeyDeploymentPage::setDevice(const Lin
void GenericLinuxDeviceConfigurationWizardKeyDeploymentPage::initializePage() void GenericLinuxDeviceConfigurationWizardKeyDeploymentPage::initializePage()
{ {
if (!d->device->sshParameters().privateKeyFile.isEmpty()) if (!d->device->sshParameters().privateKeyFile.isEmpty())
d->keyFileChooser.setPath(privateKeyFilePath()); d->keyFileChooser.setFilePath(privateKeyFilePath());
d->iconLabel.clear(); d->iconLabel.clear();
} }
@@ -232,25 +231,25 @@ bool GenericLinuxDeviceConfigurationWizardKeyDeploymentPage::isComplete() const
bool GenericLinuxDeviceConfigurationWizardKeyDeploymentPage::validatePage() bool GenericLinuxDeviceConfigurationWizardKeyDeploymentPage::validatePage()
{ {
if (!d->defaultKeys().contains(d->keyFileChooser.filePath().toString())) { if (!d->defaultKeys().contains(d->keyFileChooser.filePath())) {
SshConnectionParameters sshParams = d->device->sshParameters(); SshConnectionParameters sshParams = d->device->sshParameters();
sshParams.authenticationType = SshConnectionParameters::AuthenticationTypeSpecificKey; sshParams.authenticationType = SshConnectionParameters::AuthenticationTypeSpecificKey;
sshParams.privateKeyFile = d->keyFileChooser.filePath().toString(); sshParams.privateKeyFile = d->keyFileChooser.filePath();
d->device->setSshParameters(sshParams); d->device->setSshParameters(sshParams);
} }
return true; return true;
} }
QString GenericLinuxDeviceConfigurationWizardKeyDeploymentPage::privateKeyFilePath() const FilePath GenericLinuxDeviceConfigurationWizardKeyDeploymentPage::privateKeyFilePath() const
{ {
return d->keyFileChooser.filePath().toString(); return d->keyFileChooser.filePath();
} }
void GenericLinuxDeviceConfigurationWizardKeyDeploymentPage::createKey() void GenericLinuxDeviceConfigurationWizardKeyDeploymentPage::createKey()
{ {
SshKeyCreationDialog dlg(this); SshKeyCreationDialog dlg(this);
if (dlg.exec() == QDialog::Accepted) if (dlg.exec() == QDialog::Accepted)
d->keyFileChooser.setPath(dlg.privateKeyFilePath()); d->keyFileChooser.setFilePath(dlg.privateKeyFilePath());
} }
void GenericLinuxDeviceConfigurationWizardKeyDeploymentPage::deployKey() void GenericLinuxDeviceConfigurationWizardKeyDeploymentPage::deployKey()

View File

@@ -75,7 +75,7 @@ private:
bool isComplete() const override; bool isComplete() const override;
bool validatePage() override; bool validatePage() override;
QString privateKeyFilePath() const; Utils::FilePath privateKeyFilePath() const;
void createKey(); void createKey();
void deployKey(); void deployKey();

View File

@@ -49,17 +49,17 @@ using namespace Internal;
PublicKeyDeploymentDialog *PublicKeyDeploymentDialog::createDialog( PublicKeyDeploymentDialog *PublicKeyDeploymentDialog::createDialog(
const IDevice::ConstPtr &deviceConfig, QWidget *parent) const IDevice::ConstPtr &deviceConfig, QWidget *parent)
{ {
const FilePath dir = FilePath::fromString(deviceConfig->sshParameters().privateKeyFile).parentDir(); const FilePath dir = deviceConfig->sshParameters().privateKeyFile.parentDir();
const FilePath publicKeyFileName = FileUtils::getOpenFilePath(nullptr, const FilePath publicKeyFileName = FileUtils::getOpenFilePath(nullptr,
tr("Choose Public Key File"), dir, tr("Choose Public Key File"), dir,
tr("Public Key Files (*.pub);;All Files (*)")); tr("Public Key Files (*.pub);;All Files (*)"));
if (publicKeyFileName.isEmpty()) if (publicKeyFileName.isEmpty())
return nullptr; return nullptr;
return new PublicKeyDeploymentDialog(deviceConfig, publicKeyFileName.toString(), parent); return new PublicKeyDeploymentDialog(deviceConfig, publicKeyFileName, parent);
} }
PublicKeyDeploymentDialog::PublicKeyDeploymentDialog(const IDevice::ConstPtr &deviceConfig, PublicKeyDeploymentDialog::PublicKeyDeploymentDialog(const IDevice::ConstPtr &deviceConfig,
const QString &publicKeyFileName, QWidget *parent) const FilePath &publicKeyFileName, QWidget *parent)
: QProgressDialog(parent), d(new PublicKeyDeploymentDialogPrivate) : QProgressDialog(parent), d(new PublicKeyDeploymentDialogPrivate)
{ {
setAutoReset(false); setAutoReset(false);

View File

@@ -43,7 +43,7 @@ public:
QWidget *parent = nullptr); QWidget *parent = nullptr);
PublicKeyDeploymentDialog(const ProjectExplorer::IDevice::ConstPtr &deviceConfig, PublicKeyDeploymentDialog(const ProjectExplorer::IDevice::ConstPtr &deviceConfig,
const QString &publicKeyFileName, QWidget *parent = nullptr); const Utils::FilePath &publicKeyFileName, QWidget *parent = nullptr);
~PublicKeyDeploymentDialog() override; ~PublicKeyDeploymentDialog() override;

View File

@@ -26,9 +26,10 @@
#include "sshkeydeployer.h" #include "sshkeydeployer.h"
#include <ssh/sshremoteprocessrunner.h> #include <ssh/sshremoteprocessrunner.h>
#include <utils/fileutils.h> #include <utils/filepath.h>
using namespace QSsh; using namespace QSsh;
using namespace Utils;
namespace RemoteLinux { namespace RemoteLinux {
namespace Internal { namespace Internal {
@@ -53,12 +54,12 @@ SshKeyDeployer::~SshKeyDeployer()
} }
void SshKeyDeployer::deployPublicKey(const SshConnectionParameters &sshParams, void SshKeyDeployer::deployPublicKey(const SshConnectionParameters &sshParams,
const QString &keyFilePath) const FilePath &keyFilePath)
{ {
cleanup(); cleanup();
Utils::FileReader reader; FileReader reader;
if (!reader.fetch(Utils::FilePath::fromString(keyFilePath))) { if (!reader.fetch(keyFilePath)) {
emit error(tr("Public key error: %1").arg(reader.errorString())); emit error(tr("Public key error: %1").arg(reader.errorString()));
return; return;
} }

View File

@@ -30,6 +30,7 @@
#include <QObject> #include <QObject>
namespace QSsh { class SshConnectionParameters; } namespace QSsh { class SshConnectionParameters; }
namespace Utils { class FilePath; }
namespace RemoteLinux { namespace RemoteLinux {
namespace Internal { class SshKeyDeployerPrivate; } namespace Internal { class SshKeyDeployerPrivate; }
@@ -43,7 +44,7 @@ public:
~SshKeyDeployer() override; ~SshKeyDeployer() override;
void deployPublicKey(const QSsh::SshConnectionParameters &sshParams, void deployPublicKey(const QSsh::SshConnectionParameters &sshParams,
const QString &keyFilePath); const Utils::FilePath &keyFilePath);
void stopDeployment(); void stopDeployment();
signals: signals:

View File

@@ -30,7 +30,9 @@
#include <coreplugin/icore.h> #include <coreplugin/icore.h>
#include <coreplugin/vcsmanager.h> #include <coreplugin/vcsmanager.h>
#include <projectexplorer/projectexplorerconstants.h> #include <projectexplorer/projectexplorerconstants.h>
#include <utils/fileutils.h>
#include <utils/algorithm.h>
#include <utils/filepath.h>
#include <utils/removefiledialog.h> #include <utils/removefiledialog.h>
#include <utils/theme/theme.h> #include <utils/theme/theme.h>
@@ -995,7 +997,8 @@ void ResourceModel::addFiles(int prefixIndex, const QStringList &fileNames, int
firstFile = cnt; firstFile = cnt;
lastFile = cnt + unique_list.count() - 1; lastFile = cnt + unique_list.count() - 1;
Core::VcsManager::promptToAdd(m_resource_file.filePath().absolutePath().toString(), fileNames); Core::VcsManager::promptToAdd(m_resource_file.filePath().absolutePath(),
Utils::transform(fileNames, &FilePath::fromString));
} }

View File

@@ -5173,7 +5173,7 @@ void TextEditorWidget::mousePressEvent(QMouseEvent *e)
if (e->button() == Qt::LeftButton) { if (e->button() == Qt::LeftButton) {
MultiTextCursor multiCursor = multiTextCursor(); MultiTextCursor multiCursor = multiTextCursor();
const QTextCursor &cursor = cursorForPosition(e->pos()); const QTextCursor &cursor = cursorForPosition(e->pos());
if (e->modifiers() & Qt::AltModifier) { if (e->modifiers() & Qt::AltModifier && !(e->modifiers() & Qt::ControlModifier)) {
if (e->modifiers() & Qt::ShiftModifier) { if (e->modifiers() & Qt::ShiftModifier) {
QTextCursor c = multiCursor.mainCursor(); QTextCursor c = multiCursor.mainCursor();
c.setPosition(cursor.position(), QTextCursor::KeepAnchor); c.setPosition(cursor.position(), QTextCursor::KeepAnchor);

View File

@@ -94,7 +94,7 @@ static SshConnectionParameters getParameters()
params.setPort(getPortFromEnvironment()); params.setPort(getPortFromEnvironment());
params.setUserName(getUserFromEnvironment()); params.setUserName(getUserFromEnvironment());
params.timeout = 10; params.timeout = 10;
params.privateKeyFile = getKeyFileFromEnvironment(); params.privateKeyFile = Utils::FilePath::fromUserInput(getKeyFileFromEnvironment());
params.authenticationType = !params.privateKeyFile.isEmpty() params.authenticationType = !params.privateKeyFile.isEmpty()
? SshConnectionParameters::AuthenticationTypeSpecificKey ? SshConnectionParameters::AuthenticationTypeSpecificKey
: SshConnectionParameters::AuthenticationTypeAll; : SshConnectionParameters::AuthenticationTypeAll;
@@ -179,7 +179,7 @@ void tst_Ssh::errorHandling()
params.setUserName(user); params.setUserName(user);
params.timeout = 3; params.timeout = 3;
params.authenticationType = authType; params.authenticationType = authType;
params.privateKeyFile = keyFile; params.privateKeyFile = Utils::FilePath::fromString(keyFile);
SshConnection connection(params); SshConnection connection(params);
QEventLoop loop; QEventLoop loop;
bool disconnected = false; bool disconnected = false;

View File

@@ -474,3 +474,18 @@ extend_qtc_test(unittest
SOURCES SOURCES
clangformat-test.cpp clangformat-test.cpp
) )
get_filename_component(
QMLDOM_STANDALONE_CMAKELISTS
"${CMAKE_CURRENT_SOURCE_DIR}/../../../../qmldom_standalone/src/qmldom/standalone/"
ABSOLUTE
)
if(EXISTS ${QMLDOM_STANDALONE_CMAKELISTS})
add_subdirectory(${QMLDOM_STANDALONE_CMAKELISTS} qmldom_standalone)
extend_qtc_test(unittest
DEPENDS qmldomlib
SOURCES
qmldom-test.cpp
)
endif()

View File

@@ -0,0 +1,51 @@
/****************************************************************************
**
** Copyright (C) 2017 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qt Creator.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3 as published by the Free Software
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
** included in the packaging of this file. Please review the following
** information to ensure the GNU General Public License requirements will
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
****************************************************************************/
#include "googletest.h"
// cast of the top level items (DomEnvironments,...)
#include <qmldom/qqmldomtop_p.h>
// everything is in the QQmlJS::Dom namespace
using namespace QQmlJS::Dom;
namespace {
class QmlDom : public ::testing::Test
{
public:
// static void SetUpTestCase();
// static void TearDownTestCase();
protected:
};
TEST_F(QmlDom, First)
{
DomItem env = DomEnvironment::create({}, DomEnvironment::Option::SingleThreaded
| DomEnvironment::Option::NoDependencies);
}
} // anonymous