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

This commit is contained in:
The Qt Project
2021-09-30 08:32:51 +00: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
-------
* ...
* Moved launching of tools to external process
* Merged `CppTools` plugin into `CppEditor` plugin
Editing
-------
* Added support for multiple cursor editing (QTCREATORBUG-16013)
* Added import and export for font settings (QTCREATORBUG-6833)
### 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
### Language Client
### Beautifier
### Designer
* Improved wizards for Qt 6.2 (QTCREATORBUG-26170)
* Simplified wizards
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.
Python 3.6+ is required now.
* Removed separate `<Headers>` node from project tree (QTCREATORBUG-18206,
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
---------
### Windows
### macOS
* Changed prebuilt binaries to universal Intel + ARM
### 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
### MCU
### Docker
* Various improvements
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;
if (keyOnly) {
args << "-o" << "IdentitiesOnly=yes";
args << "-i" << connParams.privateKeyFile;
args << "-i" << connParams.privateKeyFile.path();
}
if (keyOnly || SshSettings::askpassFilePath().isEmpty())
args << "-o" << "BatchMode=yes";

View File

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

View File

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

View File

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

View File

@@ -30,7 +30,7 @@
#include <QApplication>
#include <QCompleter>
using namespace Utils;
namespace Utils {
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;
}
@@ -134,13 +134,13 @@ QWidget *PathChooserDelegate::createEditor(QWidget *parent, const QStyleOptionVi
Q_UNUSED(option)
Q_UNUSED(index)
auto editor = new Utils::PathChooser(parent);
auto editor = new PathChooser(parent);
editor->setHistoryCompleter(m_historyKey);
editor->setAutoFillBackground(true); // To hide the text beneath the editor widget
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);
});
@@ -149,20 +149,20 @@ QWidget *PathChooserDelegate::createEditor(QWidget *parent, const QStyleOptionVi
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->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
{
auto pathChooser = qobject_cast<Utils::PathChooser *>(editor);
auto pathChooser = qobject_cast<PathChooser *>(editor);
if (!pathChooser)
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
@@ -233,3 +233,5 @@ void CompleterDelegate::updateEditorGeometry(QWidget *editor,
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
/// 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
{
if (m_scheme.isEmpty())
return QDir::toNativeSeparators(m_data);
return toString();
FilePath tmp = *this;
if (osType() == OsTypeWindows)
tmp.m_data.replace('/', '\\');
return tmp.toString();
}
QString FilePath::fileName() const

View File

@@ -62,7 +62,7 @@ public:
bool m_complete = false;
QRegularExpressionValidator m_projectNameValidator;
bool m_forceSubProject = false;
QStringList m_projectDirectories;
FilePaths m_projectDirectories;
};
ProjectIntroPage::ProjectIntroPage(QWidget *parent) :
@@ -157,7 +157,7 @@ bool ProjectIntroPage::validate()
int index = d->m_ui.projectComboBox->currentIndex();
if (index == 0)
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
if (!d->m_ui.pathChooser->isValid()) {
@@ -230,7 +230,7 @@ void ProjectIntroPage::setProjectList(const QStringList &projectList)
d->m_ui.projectComboBox->addItems(projectList);
}
void ProjectIntroPage::setProjectDirectories(const QStringList &directoryList)
void ProjectIntroPage::setProjectDirectories(const FilePaths &directoryList)
{
d->m_projectDirectories = directoryList;
}

View File

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

View File

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

View File

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

View File

@@ -80,7 +80,7 @@ public:
// Shows a confirmation dialog, whether the files in the list should be
// 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);

View File

@@ -419,7 +419,7 @@ void CdbEngine::setupEngine()
}
break;
case AttachToCore:
debugger.addArgs({"-z", sp.coreFile});
debugger.addArgs({"-z", sp.coreFile.path()});
break;
default:
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())
str << "Debugger: " << sp.debugger.command.toUserOutput() << '\n';
if (!sp.coreFile.isEmpty())
str << "Core: " << QDir::toNativeSeparators(sp.coreFile) << '\n';
str << "Core: " << sp.coreFile.toUserOutput() << '\n';
if (sp.attachPID.isValid())
str << "PID: " << sp.attachPID.pid() << ' ' << sp.crashParameter << '\n';
if (!sp.projectSourceDirectory.isEmpty()) {

View File

@@ -158,7 +158,7 @@ public:
Utils::FilePath sysRoot;
// Used by general core file debugging. Public access requested in QTCREATORBUG-17158.
QString coreFile;
Utils::FilePath coreFile;
// Macro-expanded and passed to debugger startup.
QString additionalStartupCommands;
@@ -172,7 +172,7 @@ public:
bool runAsRoot = false;
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.
Utils::FilePath debugInfoLocation; // Gdb "set-debug-file-directory".
QStringList debugSourceLocation; // Gdb "directory"

View File

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

View File

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

View File

@@ -119,13 +119,13 @@ public:
void setQmlServer(const QUrl &qmlServer);
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 setDeviceSymbolsRoot(const QString &deviceSymbolsRoot);
void setTestCase(int testCase);
void setOverrideStartScript(const QString &script);
void setOverrideStartScript(const Utils::FilePath &script);
void setAbi(const ProjectExplorer::Abi &abi);

View File

@@ -245,7 +245,7 @@ QVariant EngineItem::data(int column, int role) const
return myName;
}
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();

View File

@@ -4018,17 +4018,17 @@ void GdbEngine::handleGdbStartFailed()
void GdbEngine::loadInitScript()
{
const QString script = runParameters().overrideStartScript;
const FilePath script = runParameters().overrideStartScript;
if (!script.isEmpty()) {
if (QFileInfo(script).isReadable()) {
runCommand({"source " + script});
if (script.isReadableFile()) {
runCommand({"source " + script.path()});
} else {
AsynchronousMessageBox::warning(
tr("Cannot Find Debugger Initialization Script"),
tr("The debugger settings point to a script file at \"%1\", "
"which is not accessible. If a script file is not needed, "
"consider clearing that entry to avoid this warning."
).arg(script));
).arg(script.toUserOutput()));
}
} else {
const QString commands = nativeStartupCommands().trimmed();
@@ -4537,7 +4537,7 @@ void GdbEngine::runEngine()
} else if (isCoreEngine()) {
claimInitialBreakpoints();
runCommand({"target core " + runParameters().coreFile, CB(handleTargetCore)});
runCommand({"target core " + runParameters().coreFile.path(), CB(handleTargetCore)});
} else if (isTermEngine()) {
@@ -4714,12 +4714,12 @@ void GdbEngine::handleFileExecAndSymbols(const DebuggerResponse &response)
} else if (isCoreEngine()) {
QString core = runParameters().coreFile;
const FilePath core = runParameters().coreFile;
if (response.resultClass == ResultDone) {
showMessage(tr("Symbols found."), StatusBar);
handleInferiorPrepared();
} 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 "
"in the core file.")
+ ' ' + 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())
return fileNameFromCore;
QFileInfo fi(fileNameFromCore);
if (fi.isFile())
return fileNameFromCore;
return {};
FilePath filePathFromCore = FilePath::fromUserInput(fileNameFromCore);
if (filePathFromCore.isFile())
return filePathFromCore;
// turn the filename into an absolute path, using the location of the core as a hint
QString absPath;
if (fi.isAbsolute()) {
absPath = fileNameFromCore;
} else {
QFileInfo coreInfo(coreFile);
FilePath coreDir = FilePath::fromString(coreInfo.dir().absolutePath());
absPath = coreDir.resolvePath(fileNameFromCore).toString();
}
if (QFileInfo(absPath).isFile() || absPath.isEmpty())
const FilePath coreDir = coreFile.absoluteFilePath().parentDir();
const FilePath absPath = coreDir.resolvePath(fileNameFromCore);
if (absPath.isFile() || absPath.isEmpty())
return absPath;
// remove possible trailing arguments
QChar sep(' ');
QStringList pathFragments = absPath.split(sep);
QStringList pathFragments = absPath.path().split(' ');
while (pathFragments.size() > 0) {
QString joined_path = pathFragments.join(sep);
if (QFileInfo(joined_path).isFile()) {
const FilePath joined_path = FilePath::fromString(pathFragments.join(' '));
if (joined_path.isFile())
return joined_path;
}
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;
#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.
if (HostOsInfo::isWindowsHost())
args += {"-ex", "set osabi GNU/Linux"};
args += {"-ex", "core " + coreFile};
args += {"-ex", "core " + coreFile.toUserOutput()};
QtcProcess proc;
Environment envLang(Environment::systemEnvironment());
@@ -5022,8 +5016,7 @@ CoreInfo CoreInfo::readExecutableNameFromCore(const Runnable &debugger, const QS
if (pos2 != -1) {
cinfo.isCore = true;
cinfo.rawStringFromCore = output.mid(pos1, pos2 - pos1);
cinfo.foundExecutableName =
FilePath::fromString(findExecutableFromName(cinfo.rawStringFromCore, coreFile));
cinfo.foundExecutableName = 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"
// Even without the stack, the user can find interesting stuff by exploring
// 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' + tr("Continuing nevertheless."));
}

View File

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

View File

@@ -73,8 +73,8 @@ public:
explicit SelectRemoteFileDialog(QWidget *parent);
void attachToDevice(Kit *k);
QString localFile() const { return m_localFile; }
QString remoteFile() const { return m_remoteFile; }
FilePath localFile() const { return m_localFile; }
FilePath remoteFile() const { return m_remoteFile; }
private:
void handleSftpOperationFinished(SftpJobId, const QString &error);
@@ -88,8 +88,8 @@ private:
QTreeView *m_fileSystemView;
QTextBrowser *m_textBrowser;
QDialogButtonBox *m_buttonBox;
QString m_localFile;
QString m_remoteFile;
FilePath m_localFile;
FilePath m_remoteFile;
SftpJobId m_sftpJobId;
};
@@ -185,12 +185,12 @@ void SelectRemoteFileDialog::selectFile()
{
Utils::TemporaryFile localFile("remotecore-XXXXXX");
localFile.open();
m_localFile = localFile.fileName();
m_localFile = FilePath::fromString(localFile.fileName());
}
idx = idx.sibling(idx.row(), 1);
m_remoteFile = m_fileSystemModel.data(idx, SftpFileSystemModel::PathRole).toString();
m_sftpJobId = m_fileSystemModel.downloadFile(idx, m_localFile);
m_remoteFile = FilePath::fromVariant(m_fileSystemModel.data(idx, SftpFileSystemModel::PathRole));
m_sftpJobId = m_fileSystemModel.downloadFile(idx, m_localFile.toString());
}
///////////////////////////////////////////////////////////////////////
@@ -372,11 +372,12 @@ bool AttachCoreDialog::useLocalCoreFile() const
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();
QTC_ASSERT(k, return);
Runnable debugger = DebuggerKitAspect::runnable(k);
CoreInfo cinfo = CoreInfo::readExecutableNameFromCore(debugger, core);
CoreInfo cinfo = CoreInfo::readExecutableNameFromCore(debugger, coreFile);
if (!cinfo.foundExecutableName.isEmpty())
d->symbolFileName->setFilePath(cinfo.foundExecutableName);
else if (!d->symbolFileName->isValid() && !cinfo.rawStringFromCore.isEmpty())
@@ -413,14 +414,14 @@ void AttachCoreDialog::selectRemoteCoreFile()
dlg.attachToDevice(d->kitChooser->currentKit());
if (dlg.exec() == QDialog::Rejected)
return;
d->localCoreFileName->setPath(dlg.localFile());
d->remoteCoreFileName->setText(dlg.remoteFile());
d->localCoreFileName->setFilePath(dlg.localFile());
d->remoteCoreFileName->setText(dlg.remoteFile().toUserOutput());
changed();
}
QString AttachCoreDialog::localCoreFile() const
FilePath AttachCoreDialog::localCoreFile() const
{
return d->localCoreFileName->filePath().toString();
return d->localCoreFileName->filePath();
}
FilePath AttachCoreDialog::symbolFile() const
@@ -428,24 +429,24 @@ FilePath AttachCoreDialog::symbolFile() const
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)
@@ -468,14 +469,14 @@ Kit *AttachCoreDialog::kit() const
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
@@ -483,9 +484,9 @@ FilePath AttachCoreDialog::sysRoot() const
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

View File

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

View File

@@ -42,18 +42,44 @@
#include <QLabel>
#include <QPushButton>
using namespace Utils;
namespace Debugger {
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) :
QDialog(parent), m_chooser(new Utils::PathChooser),
QDialog(parent), m_chooser(new PathChooser),
m_buttonBox(new QDialogButtonBox(QDialogButtonBox::Ok|QDialogButtonBox::Cancel))
{
setWindowTitle(tr("Select Local Cache Folder"));
setModal(true);
auto formLayout = new QFormLayout;
m_chooser->setExpectedKind(Utils::PathChooser::ExistingDirectory);
m_chooser->setExpectedKind(PathChooser::ExistingDirectory);
m_chooser->setHistoryCompleter("Debugger.CdbCacheDir.History");
m_chooser->setMinimumWidth(400);
formLayout->addRow(tr("Path:"), m_chooser);
@@ -68,42 +94,30 @@ CacheDirectoryDialog::CacheDirectoryDialog(QWidget *parent) :
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()
{
QString cache = path();
FilePath cache = path();
// if cache is empty a default is used by the cdb
if (cache.isEmpty()) {
QDialog::accept();
return;
}
// Ensure path exists
QFileInfo fi(cache);
// Folder exists - all happy.
if (fi.isDir()) {
if (cache.isDir()) {
QDialog::accept();
return;
}
// Does a file of the same name exist?
if (fi.exists()) {
if (cache.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;
}
// Create
QDir root(QDir::root());
if (!root.mkpath(cache)) {
if (!cache.ensureWritableDir()) {
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;
}
QDialog::accept();
@@ -111,12 +125,13 @@ void CacheDirectoryDialog::accept()
// ---------------- CdbSymbolPathListEditor
const char *CdbSymbolPathListEditor::symbolServerPrefixC = "srv*";
const char *CdbSymbolPathListEditor::symbolServerPostfixC = "http://msdl.microsoft.com/download/symbols";
const char *CdbSymbolPathListEditor::symbolCachePrefixC = "cache*";
// Pre- and Postfix used to build a symbol server path specification
const char symbolServerPrefixC[] = "srv*";
const char symbolServerPostfixC[] = "http://msdl.microsoft.com/download/symbols";
const char symbolCachePrefixC[] = "cache*";
CdbSymbolPathListEditor::CdbSymbolPathListEditor(QWidget *parent) :
Utils::PathListEditor(parent)
PathListEditor(parent)
{
QPushButton *button = insertButton(lastInsertButtonIndex + 1,
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."));
}
bool CdbSymbolPathListEditor::promptCacheDirectory(QWidget *parent, QString *cacheDirectory)
bool CdbSymbolPathListEditor::promptCacheDirectory(QWidget *parent, FilePath *cacheDirectory)
{
CacheDirectoryDialog dialog(parent);
dialog.setPath(Utils::TemporaryDirectory::masterDirectoryPath() + "/symbolcache");
dialog.setPath(FilePath::fromString(TemporaryDirectory::masterDirectoryPath()) + "/symbolcache");
if (dialog.exec() != QDialog::Accepted)
return false;
*cacheDirectory = dialog.path();
@@ -148,9 +163,9 @@ bool CdbSymbolPathListEditor::promptCacheDirectory(QWidget *parent, QString *cac
void CdbSymbolPathListEditor::addSymbolPath(CdbSymbolPathListEditor::SymbolPathMode mode)
{
QString cacheDir;
FilePath cacheDir;
if (promptCacheDirectory(this, &cacheDir))
insertPathAtCursor(CdbSymbolPathListEditor::symbolPath(cacheDir, mode));
insertPathAtCursor(CdbSymbolPathListEditor::symbolPath(cacheDir.path(), mode));
}
void CdbSymbolPathListEditor::setupSymbolPaths()
@@ -165,7 +180,7 @@ void CdbSymbolPathListEditor::setupSymbolPaths()
if (path.isEmpty() && indexOfSymbolCache != -1)
path = currentPaths.at(indexOfSymbolCache);
if (path.isEmpty())
path = Utils::TemporaryDirectory::masterDirectoryPath() + "/symbolcache";
path = TemporaryDirectory::masterDirectoryPath() + "/symbolcache";
bool useSymbolServer = true;
bool useSymbolCache = true;

View File

@@ -27,13 +27,7 @@
#include <utils/pathlisteditor.h>
#include <QDialog>
namespace Utils { class PathChooser; }
QT_BEGIN_NAMESPACE
class QDialogButtonBox;
QT_END_NAMESPACE
namespace Utils { class FilePath; }
namespace Debugger {
namespace Internal {
@@ -45,21 +39,6 @@ namespace Internal {
// created. This is done here (suggest $TEMP\symbolcache
// 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
{
Q_OBJECT
@@ -71,12 +50,7 @@ public:
explicit CdbSymbolPathListEditor(QWidget *parent = nullptr);
static bool promptCacheDirectory(QWidget *parent, QString *cacheDirectory);
// Pre- and Postfix used to build a symbol server path specification
static const char *symbolServerPrefixC;
static const char *symbolServerPostfixC;
static const char *symbolCachePrefixC;
static bool promptCacheDirectory(QWidget *parent, Utils::FilePath *cacheDirectory);
// Format a symbol path specification
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);
m_shell->readAllStandardOutput(); // clean possible left-overs
m_shell->write(cmd.toUserOutput().toUtf8() + "\necho $?\n");
m_shell->waitForReadyRead();
QTC_ASSERT(m_shell->waitForReadyRead(), return false);
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);
QTC_ASSERT(ok, return false);
return result == 0;
}

View File

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

View File

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

View File

@@ -630,7 +630,8 @@ void IDevice::fromMap(const QVariantMap &map)
? QSsh::SshConnectionParameters::AuthenticationTypeAll
: 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.hostKeyCheckingMode = static_cast<QSsh::SshHostKeyCheckingMode>
(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(UserNameKey), d->sshParameters.userName());
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(HostKeyCheckingKey), d->sshParameters.hostKeyCheckingMode);

View File

@@ -62,6 +62,8 @@
using namespace Utils;
namespace ProjectExplorer {
const char NAME_KEY[] = "name";
const char DISPLAY_NAME_KEY[] = "trDisplayName";
const char TOOLTIP_KEY[] = "trToolTip";
@@ -75,8 +77,7 @@ const char DATA_KEY[] = "data";
const char IS_COMPLETE_KEY[] = "isComplete";
const char IS_COMPLETE_MESSAGE_KEY[] = "trIncompleteMessage";
namespace {
QVariant consumeValue(QVariantMap &map, const QString &key, const QVariant &defaultValue = QVariant())
static QVariant consumeValue(QVariantMap &map, const QString &key, const QVariant &defaultValue = {})
{
QVariantMap::iterator i = map.find(key);
if (i != map.end()) {
@@ -87,7 +88,7 @@ QVariant consumeValue(QVariantMap &map, const QString &key, const QVariant &defa
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()) {
@@ -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(", "));
}
}
} // namespace
namespace ProjectExplorer {
// --------------------------------------------------------------------
// Helper:
@@ -811,8 +810,8 @@ bool PathChooserField::parseData(const QVariant &data, QString *errorMessage)
QVariantMap tmp = data.toMap();
m_path = consumeValue(tmp, "path").toString();
m_basePath = consumeValue(tmp, "basePath").toString();
m_path = FilePath::fromVariant(consumeValue(tmp, "path"));
m_basePath = FilePath::fromVariant(consumeValue(tmp, "basePath"));
m_historyId = consumeValue(tmp, "historyId").toString();
QString kindStr = consumeValue(tmp, "kind", "existingDirectory").toString();
@@ -851,7 +850,7 @@ QWidget *PathChooserField::createWidget(const QString &displayName, JsonFieldPag
if (!m_historyId.isEmpty())
w->setHistoryCompleter(m_historyId);
QObject::connect(w, &PathChooser::pathChanged, [this, w] {
if (w->filePath().toString() != m_path)
if (w->filePath() != m_path)
setHasUserChanges();
});
return w;
@@ -887,23 +886,19 @@ void PathChooserField::initializeData(MacroExpander *expander)
{
auto w = qobject_cast<PathChooser *>(widget());
QTC_ASSERT(w, return);
w->setBaseDirectory(expander->expand(FilePath::fromString(m_basePath)));
w->setBaseDirectory(expander->expand(m_basePath));
w->setExpectedKind(m_kind);
if (m_currentPath.isNull())
w->setPath(expander->expand(m_path));
else
w->setPath(m_currentPath);
w->setFilePath(expander->expand(m_path));
}
void PathChooserField::fromSettings(const QVariant &value)
{
m_path = value.toString();
m_path = FilePath::fromVariant(value);
}
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;
QTextStream out(&result);
out << "PathChooser{path:" << m_path
out << "PathChooser{path:" << m_path.toString()
<< "; base:" << m_basePath
<< "; historyId:" << m_historyId
<< "; kind:" << (int)Utils::PathChooser::ExistingDirectory
<< "; currentPath:" << m_currentPath
<< "}";
return result;
}
QString m_path;
QString m_basePath;
Utils::FilePath m_path;
Utils::FilePath m_basePath;
QString m_historyId;
Utils::PathChooser::Kind m_kind = Utils::PathChooser::ExistingDirectory;
QString m_currentPath;
};
class CheckBoxField : public JsonFieldPage::Field

View File

@@ -1065,7 +1065,7 @@ void DeviceKitAspect::addToMacroExpander(Kit *kit, Utils::MacroExpander *expande
expander->registerVariable("Device:KeyFile", tr("Private key file"),
[kit]() -> QString {
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"),
[kit]() -> QString {
@@ -1292,7 +1292,7 @@ void BuildDeviceKitAspect::addToMacroExpander(Kit *kit, Utils::MacroExpander *ex
expander->registerVariable("BuildDevice:KeyFile", tr("Build private key file"),
[kit]() -> QString {
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"),
[kit]() -> QString {

View File

@@ -3619,10 +3619,10 @@ void ProjectExplorerPluginPrivate::addExistingProjects()
if (subProjectFilePaths.empty())
return;
FilePaths failedProjects;
QStringList addedProjects;
FilePaths addedProjects;
for (const FilePath &filePath : qAsConst(subProjectFilePaths)) {
if (projectNode->addSubProject(filePath))
addedProjects << filePath.toString();
addedProjects << filePath;
else
failedProjects << filePath;
}
@@ -3633,7 +3633,7 @@ void ProjectExplorerPluginPrivate::addExistingProjects()
message + "\n " + FilePath::formatFilePaths(failedProjects, "\n "));
return;
}
VcsManager::promptToAdd(dir.toString(), addedProjects);
VcsManager::promptToAdd(dir, addedProjects);
}
void ProjectExplorerPluginPrivate::handleAddExistingFiles()
@@ -3685,7 +3685,7 @@ void ProjectExplorerPlugin::addExistingFiles(FolderNode *folderNode, const FileP
[&notAdded](const FilePath &f) { return !notAdded.contains(f); });
}
VcsManager::promptToAdd(dir.toString(), Utils::transform(fileNames, &FilePath::toString));
VcsManager::promptToAdd(dir, fileNames);
}
void ProjectExplorerPluginPrivate::removeProject()
@@ -4209,6 +4209,10 @@ AllProjectFilesFilter::AllProjectFilesFilter()
setDefaultIncludedByDefault(false); // but not included in default
setFilters({});
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";

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 uint qHash(const AbstractProperty& property);
public:
AbstractProperty();
@@ -103,6 +102,11 @@ public:
Model *model() const;
AbstractView *view() const;
friend auto qHash(const AbstractProperty &property)
{
return ::qHash(property.m_internalNode.data()) ^ ::qHash(property.m_propertyName);
}
protected:
AbstractProperty(const PropertyName &propertyName, const Internal::InternalNodePointer &internalNode, 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 uint qHash(const AbstractProperty& property);
QMLDESIGNERCORE_EXPORT QTextStream& operator<<(QTextStream &stream, const AbstractProperty &property);
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 uint qHash(const ModelNode & node);
friend QMLDESIGNERCORE_EXPORT QDebug operator<<(QDebug debug, const ModelNode &modelNode);
friend QMLDESIGNERCORE_EXPORT bool operator <(const ModelNode &firstNode, const ModelNode &secondNode);
friend QMLDESIGNERCORE_EXPORT QList<Internal::InternalNodePointer> toInternalNodeList(const QList<ModelNode> &nodeList);
@@ -248,6 +247,8 @@ public:
swap(first.m_view, second.m_view);
}
friend auto qHash(const ModelNode &node) { return ::qHash(node.m_internalNode.data()); }
private: // functions
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 uint qHash(const ModelNode & node);
QMLDESIGNERCORE_EXPORT bool operator <(const ModelNode &firstNode, const ModelNode &secondNode);
QMLDESIGNERCORE_EXPORT QDebug operator<<(QDebug debug, 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 uint qHash(const NodeAbstractProperty& property);
public:
NodeAbstractProperty();
@@ -56,6 +55,8 @@ public:
QList<ModelNode> allSubNodes();
QList<ModelNode> directSubNodes() const;
friend auto qHash(const NodeAbstractProperty &property) { qHash(AbstractProperty(property)); }
protected:
NodeAbstractProperty(const PropertyName &propertyName, const Internal::InternalNodePointer &internalNode, 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 uint qHash(const NodeAbstractProperty& property);
QMLDESIGNERCORE_EXPORT QTextStream& operator<<(QTextStream &stream, 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;
bool isBlocked(const PropertyName &propName) const override;
friend auto qHash(const Qml3DNode &node) { return qHash(node.modelNode()); }
private:
void handleEulerRotationSet();
};
QMLDESIGNERCORE_EXPORT uint qHash(const Qml3DNode &node);
QMLDESIGNERCORE_EXPORT QList<ModelNode> toModelNodeList(const QList<Qml3DNode> &fxItemNodeList);
QMLDESIGNERCORE_EXPORT QList<Qml3DNode> toQml3DNodeList(const QList<ModelNode> &modelNodeList);

View File

@@ -147,6 +147,8 @@ public:
bool isFlowItem() const;
bool isFlowActionArea() const;
ModelNode rootModelNode() const;
friend auto qHash(const QmlItemNode &node) { return qHash(node.modelNode()); }
};
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<QmlItemNode> toQmlItemNodeList(const QList<ModelNode> &modelNodeList);
QMLDESIGNERCORE_EXPORT QList<QmlItemNode> toQmlItemNodeListKeppInvalid(const QList<ModelNode> &modelNodeList);

View File

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

View File

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

View File

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

View File

@@ -357,13 +357,6 @@ bool operator !=(const AbstractProperty &property1, const AbstractProperty &prop
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)
{
return debug.nospace() << "AbstractProperty(" << (property.isValid() ? property.name() : PropertyName("invalid")) << ')';

View File

@@ -768,12 +768,6 @@ Internal::InternalNodePointer ModelNode::internalNode() const
return m_internalNode;
}
uint qHash(const ModelNode &node)
{
return ::qHash(node.internalId());
}
/*!
\brief 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);
}
uint qHash(const NodeAbstractProperty &property)
{
return qHash(AbstractProperty(property));
}
QDebug operator<<(QDebug debug, const NodeAbstractProperty &property)
{
return debug.nospace() << "NodeAbstractProperty(" << (property.isValid() ? property.name() : PropertyName("invalid")) << ')';

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -49,17 +49,17 @@ using namespace Internal;
PublicKeyDeploymentDialog *PublicKeyDeploymentDialog::createDialog(
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,
tr("Choose Public Key File"), dir,
tr("Public Key Files (*.pub);;All Files (*)"));
if (publicKeyFileName.isEmpty())
return nullptr;
return new PublicKeyDeploymentDialog(deviceConfig, publicKeyFileName.toString(), parent);
return new PublicKeyDeploymentDialog(deviceConfig, publicKeyFileName, parent);
}
PublicKeyDeploymentDialog::PublicKeyDeploymentDialog(const IDevice::ConstPtr &deviceConfig,
const QString &publicKeyFileName, QWidget *parent)
const FilePath &publicKeyFileName, QWidget *parent)
: QProgressDialog(parent), d(new PublicKeyDeploymentDialogPrivate)
{
setAutoReset(false);

View File

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

View File

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

View File

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

View File

@@ -30,7 +30,9 @@
#include <coreplugin/icore.h>
#include <coreplugin/vcsmanager.h>
#include <projectexplorer/projectexplorerconstants.h>
#include <utils/fileutils.h>
#include <utils/algorithm.h>
#include <utils/filepath.h>
#include <utils/removefiledialog.h>
#include <utils/theme/theme.h>
@@ -995,7 +997,8 @@ void ResourceModel::addFiles(int prefixIndex, const QStringList &fileNames, int
firstFile = cnt;
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) {
MultiTextCursor multiCursor = multiTextCursor();
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) {
QTextCursor c = multiCursor.mainCursor();
c.setPosition(cursor.position(), QTextCursor::KeepAnchor);

View File

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

View File

@@ -474,3 +474,18 @@ extend_qtc_test(unittest
SOURCES
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