diff --git a/doc/qtcreator/src/debugger/creator-debug-views.qdoc b/doc/qtcreator/src/debugger/creator-debug-views.qdoc
index 8880b64218b..ad8d948c753 100644
--- a/doc/qtcreator/src/debugger/creator-debug-views.qdoc
+++ b/doc/qtcreator/src/debugger/creator-debug-views.qdoc
@@ -146,7 +146,8 @@
\generatelist studio-how-to-debug
\else
- \sa {Debug}{How To: Debug}, {Debugging}, {Debuggers}, {Debugger}
+ \sa {Add breakpoints}, {Debug}{How To: Debug}, {Debugging}, {Debuggers},
+ {Debugger}
\endif
*/
diff --git a/qt_attributions.json b/qt_attributions.json
index 987502609df..008ff353943 100644
--- a/qt_attributions.json
+++ b/qt_attributions.json
@@ -612,11 +612,11 @@
"QDocModule": "qtcreator",
"QtParts": ["tools"],
"QtUsage": "Used for async/await support in Lua modules.",
- "Path": "src/plugins/lua/bindings",
+ "Path": "src/plugins/lua/scripts",
"Description": "lua-async-await implements the async/await pattern in Lua.",
"Homepage": "https://github.com/ms-jpq/lua-async-await",
"License": "MIT License",
- "LicenseFile": "src/plugins/lua/bindings/ASYNC-LICENSE.txt",
+ "LicenseFile": "src/plugins/lua/scripts/ASYNC-LICENSE.txt",
"Copyright": "Copyright (c) 2008 Paul Evans"
},
{
@@ -625,11 +625,11 @@
"QDocModule": "qtcreator",
"QtParts": ["tools"],
"QtUsage": "Used for pretty printing from Lua scripts.",
- "Path": "share/qtcreator/lua-plugins/luatests",
+ "Path": "src/plugins/lua/scripts",
"Description": "inspect.lua is a library for pretty printing complex objects in Lua.",
"Homepage": "https://github.com/kikito/inspect.lua",
"License": "MIT License",
- "LicenseFile": "share/qtcreator/lua-plugins/luatests/INSPECT-LICENSE.txt",
+ "LicenseFile": "src/plugins/lua/scripts/INSPECT-LICENSE.txt",
"Copyright": "Copyright (c) 2022 Enrique García Cota"
},
{
@@ -662,4 +662,3 @@
"Copyright": "Copyright 2011 The Apache Software Foundation"
}
]
-
diff --git a/share/qtcreator/templates/wizards/projects/consoleapp/CMakeLists-Qt6.txt b/share/qtcreator/templates/wizards/projects/consoleapp/CMakeLists-Qt6.txt
index a4161a01f5d..162310fb356 100644
--- a/share/qtcreator/templates/wizards/projects/consoleapp/CMakeLists-Qt6.txt
+++ b/share/qtcreator/templates/wizards/projects/consoleapp/CMakeLists-Qt6.txt
@@ -2,9 +2,9 @@ cmake_minimum_required(VERSION 3.19)
project(%{ProjectName} LANGUAGES CXX)
@if %{HasTranslation}
-find_package(Qt6 REQUIRED COMPONENTS Core LinguistTools)
+find_package(Qt6 6.5 REQUIRED COMPONENTS Core LinguistTools)
@else
-find_package(Qt6 REQUIRED COMPONENTS Core)
+find_package(Qt6 6.5 REQUIRED COMPONENTS Core)
@endif
qt_standard_project_setup()
@@ -25,6 +25,8 @@ target_link_libraries(%{ProjectName}
Qt::Core
)
+include(GNUInstallDirs)
+
install(TARGETS %{ProjectName}
BUNDLE DESTINATION .
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
diff --git a/share/qtcreator/templates/wizards/projects/consoleapp/wizard.json b/share/qtcreator/templates/wizards/projects/consoleapp/wizard.json
index 9e59d4d8c33..759ec220f85 100644
--- a/share/qtcreator/templates/wizards/projects/consoleapp/wizard.json
+++ b/share/qtcreator/templates/wizards/projects/consoleapp/wizard.json
@@ -58,7 +58,7 @@
"condition": "%{JS: value('Plugins').indexOf('CMakeProjectManager') >= 0}"
},
{
- "trKey": "CMake for Qt 6",
+ "trKey": "CMake for Qt 6.5 and Later",
"value": "cmake-qt6",
"condition": "%{JS: value('Plugins').indexOf('CMakeProjectManager') >= 0}"
},
diff --git a/share/qtcreator/templates/wizards/projects/qtquickuiprototype/wizard.json b/share/qtcreator/templates/wizards/projects/qtquickuiprototype/wizard.json
index 7ce0c621901..a1534182145 100644
--- a/share/qtcreator/templates/wizards/projects/qtquickuiprototype/wizard.json
+++ b/share/qtcreator/templates/wizards/projects/qtquickuiprototype/wizard.json
@@ -152,11 +152,6 @@
"target": "%{ProjectDirectory}/%{ImportModuleName}/Constants.qml",
"condition": "%{QdsProjectStyle}"
},
- {
- "source": "%{QdsWizardPath}/shared-plugin/name/DirectoryFontLoader.qml.tpl",
- "target": "%{ProjectDirectory}/%{ImportModuleName}/DirectoryFontLoader.qml",
- "condition": "%{QdsProjectStyle}"
- },
{
"source": "%{QdsWizardPath}/shared-plugin/name/EventListModel.qml.tpl",
"target": "%{ProjectDirectory}/%{ImportModuleName}/EventListModel.qml",
diff --git a/share/qtcreator/templates/wizards/projects/qtwidgetsapplication/CMakeLists-Qt6.txt b/share/qtcreator/templates/wizards/projects/qtwidgetsapplication/CMakeLists-Qt6.txt
index 7f63269cdd0..f2395d7a0b5 100644
--- a/share/qtcreator/templates/wizards/projects/qtwidgetsapplication/CMakeLists-Qt6.txt
+++ b/share/qtcreator/templates/wizards/projects/qtwidgetsapplication/CMakeLists-Qt6.txt
@@ -2,9 +2,9 @@ cmake_minimum_required(VERSION 3.19)
project(%{ProjectName} LANGUAGES CXX)
@if %{HasTranslation}
-find_package(Qt6 REQUIRED COMPONENTS Core Widgets LinguistTools)
+find_package(Qt6 6.5 REQUIRED COMPONENTS Core Widgets LinguistTools)
@else
-find_package(Qt6 REQUIRED COMPONENTS Core Widgets)
+find_package(Qt6 6.5 REQUIRED COMPONENTS Core Widgets)
@endif
qt_standard_project_setup()
@@ -32,6 +32,8 @@ target_link_libraries(%{ProjectName}
Qt::Widgets
)
+include(GNUInstallDirs)
+
install(TARGETS %{ProjectName}
BUNDLE DESTINATION .
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
diff --git a/share/qtcreator/templates/wizards/projects/qtwidgetsapplication/wizard.json b/share/qtcreator/templates/wizards/projects/qtwidgetsapplication/wizard.json
index 9e3fd48bca3..de20629065d 100644
--- a/share/qtcreator/templates/wizards/projects/qtwidgetsapplication/wizard.json
+++ b/share/qtcreator/templates/wizards/projects/qtwidgetsapplication/wizard.json
@@ -64,7 +64,7 @@
"condition": "%{JS: value('Plugins').indexOf('CMakeProjectManager') >= 0}"
},
{
- "trKey": "CMake for Qt 6",
+ "trKey": "CMake for Qt 6.5 and Later",
"value": "cmake-qt6",
"condition": "%{JS: value('Plugins').indexOf('CMakeProjectManager') >= 0}"
},
diff --git a/share/qtcreator/translations/qtcreator_de.ts b/share/qtcreator/translations/qtcreator_de.ts
index f645ae120b9..8bc892f3070 100644
--- a/share/qtcreator/translations/qtcreator_de.ts
+++ b/share/qtcreator/translations/qtcreator_de.ts
@@ -15239,12 +15239,12 @@ Zum Beispiel bewirkt die Angabe "Revision: 15" dass der Branch auf Rev
Fallback-Stil:
- Clang Format command:
- Ausführbare Datei von Clang Format:
+ ClangFormat command:
+ Ausführbare Datei von ClangFormat:
- Clang Format
- Clang Format
+ ClangFormat
+ ClangFormat
Use file uncrustify.cfg defined in project files
diff --git a/share/qtcreator/translations/qtcreator_fr.ts b/share/qtcreator/translations/qtcreator_fr.ts
index 7b728df9070..6014cf39f1d 100644
--- a/share/qtcreator/translations/qtcreator_fr.ts
+++ b/share/qtcreator/translations/qtcreator_fr.ts
@@ -15352,12 +15352,12 @@ Par exemple, « Revision : 15 » laissera la branche à la révis
Style de repli :
- Clang Format command:
- Commande de Clang Format :
+ ClangFormat command:
+ Commande de ClangFormat :
- Clang Format
- Clang Format
+ ClangFormat
+ ClangFormat
No description available.
diff --git a/src/app/main.cpp b/src/app/main.cpp
index 9da6030f5e5..755169fc8db 100644
--- a/src/app/main.cpp
+++ b/src/app/main.cpp
@@ -418,12 +418,11 @@ bool startCrashpad(const AppInfo &appInfo, bool crashReportingEnabled)
const QString databasePath = appInfo.crashReports.path();
const QString handlerPath = (appInfo.libexec / "crashpad_handler").path();
#ifdef Q_OS_WIN
- handlerPath += ".exe";
base::FilePath database(databasePath.toStdWString());
- base::FilePath handler(handlerPath.toStdWString());
+ base::FilePath handler(HostOsInfo::withExecutableSuffix(handlerPath).toStdWString());
#elif defined(Q_OS_MACOS) || defined(Q_OS_LINUX)
base::FilePath database(databasePath.toStdString());
- base::FilePath handler(handlerPath.toStdString());
+ base::FilePath handler(HostOsInfo::withExecutableSuffix(handlerPath).toStdString());
#endif
std::unique_ptr db = CrashReportDatabase::Initialize(database);
diff --git a/src/libs/advanceddockingsystem/dockmanager.cpp b/src/libs/advanceddockingsystem/dockmanager.cpp
index dc1f0085bec..e15c495f6ea 100644
--- a/src/libs/advanceddockingsystem/dockmanager.cpp
+++ b/src/libs/advanceddockingsystem/dockmanager.cpp
@@ -1311,7 +1311,7 @@ expected_str DockManager::cloneWorkspace(const QString &originalFileNam
const FilePath clonePath = workspaceNameToFilePath(cloneName);
- const expected_str copyResult = originalPath.copyFile(clonePath);
+ const Result copyResult = originalPath.copyFile(clonePath);
if (!copyResult)
return make_unexpected(Tr::tr("Could not clone \"%1\" due to: %2")
.arg(originalPath.toUserOutput(), copyResult.error()));
@@ -1337,21 +1337,21 @@ expected_str DockManager::renameWorkspace(const QString &originalFileNa
return originalFileName;
}
-expected_str DockManager::resetWorkspacePreset(const QString &fileName)
+Result DockManager::resetWorkspacePreset(const QString &fileName)
{
qCInfo(adsLog) << "Reset workspace" << fileName;
Workspace *w = workspace(fileName);
if (!w)
- return make_unexpected(Tr::tr("Workspace \"%1\" does not exist.").arg(fileName));
+ return Result::Error(Tr::tr("Workspace \"%1\" does not exist.").arg(fileName));
if (!w->isPreset())
- return make_unexpected(Tr::tr("Workspace \"%1\" is not a preset.").arg(fileName));
+ return Result::Error(Tr::tr("Workspace \"%1\" is not a preset.").arg(fileName));
const FilePath filePath = w->filePath();
if (!filePath.removeFile())
- return make_unexpected(Tr::tr("Cannot remove \"%1\".").arg(filePath.toUserOutput()));
+ return Result::Error(Tr::tr("Cannot remove \"%1\".").arg(filePath.toUserOutput()));
return presetDirectory().pathAppended(fileName).copyFile(filePath);
}
@@ -1400,7 +1400,7 @@ expected_str DockManager::importWorkspace(const QString &filePath)
const FilePath targetFilePath = userDirectory().pathAppended(fileName);
- const expected_str copyResult = sourceFilePath.copyFile(targetFilePath);
+ const Result copyResult = sourceFilePath.copyFile(targetFilePath);
if (!copyResult)
return make_unexpected(
Tr::tr("Could not copy \"%1\" to \"%2\" due to: %3")
@@ -1441,7 +1441,7 @@ expected_str DockManager::exportWorkspace(const QString &targetFilePath
Tr::tr("The workspace \"%1\" does not exist ").arg(workspaceFile.toUserOutput()));
// Finally copy the workspace to the target
- const expected_str copyResult = workspaceFile.copyFile(targetFile);
+ const Result copyResult = workspaceFile.copyFile(targetFile);
if (!copyResult)
return make_unexpected(
Tr::tr("Could not copy \"%1\" to \"%2\" due to: %3")
@@ -1675,7 +1675,7 @@ void DockManager::syncWorkspacePresets()
continue;
}
- const expected_str copyResult = filePath.copyFile(
+ const Result copyResult = filePath.copyFile(
userDirectory().pathAppended(filePath.fileName()));
if (!copyResult)
qWarning() << QString("Could not copy '%1' to '%2' due to %3")
diff --git a/src/libs/advanceddockingsystem/dockmanager.h b/src/libs/advanceddockingsystem/dockmanager.h
index f0e30a5418a..aa527be8861 100644
--- a/src/libs/advanceddockingsystem/dockmanager.h
+++ b/src/libs/advanceddockingsystem/dockmanager.h
@@ -739,7 +739,7 @@ public:
Utils::expected_str renameWorkspace(const QString &originalFileName,
const QString &newName);
- Utils::expected_str resetWorkspacePreset(const QString &fileName);
+ Utils::Result resetWorkspacePreset(const QString &fileName);
/**
* \brief Save the currently active workspace.
diff --git a/src/libs/gocmdbridge/client/bridgedfileaccess.cpp b/src/libs/gocmdbridge/client/bridgedfileaccess.cpp
index dcd17b23e30..67e864047c7 100644
--- a/src/libs/gocmdbridge/client/bridgedfileaccess.cpp
+++ b/src/libs/gocmdbridge/client/bridgedfileaccess.cpp
@@ -33,61 +33,60 @@ expected_str run(const CommandLine &cmdLine, const QByteArray &inputDat
return p.readAllStandardOutput().trimmed();
}
-Utils::expected_str FileAccess::init(const Utils::FilePath &pathToBridge)
+Result FileAccess::init(const FilePath &pathToBridge)
{
m_client = std::make_unique(pathToBridge);
auto startResult = m_client->start();
if (!startResult)
- return make_unexpected(QString("Could not start cmdbridge: %1").arg(startResult.error()));
+ return Result::Error(QString("Could not start cmdbridge: %1").arg(startResult.error()));
try {
if (!startResult->isValid())
startResult->waitForFinished();
m_environment = startResult->takeResult();
} catch (const std::exception &e) {
- return make_unexpected(
+ return Result::Error(
Tr::tr("Error starting cmdbridge: %1").arg(QString::fromLocal8Bit(e.what())));
}
- return {};
+ return Result::Ok;
}
-expected_str FileAccess::deployAndInit(
- const FilePath &libExecPath, const FilePath &remoteRootPath)
+Result FileAccess::deployAndInit(const FilePath &libExecPath, const FilePath &remoteRootPath)
{
if (remoteRootPath.isEmpty())
- return make_unexpected(Tr::tr("Remote root path is empty"));
+ return Result::Error(Tr::tr("Remote root path is empty"));
if (!remoteRootPath.isAbsolutePath())
- return make_unexpected(Tr::tr("Remote root path is not absolute"));
+ return Result::Error(Tr::tr("Remote root path is not absolute"));
const auto whichDD = run({remoteRootPath.withNewPath("which"), {"dd"}});
if (!whichDD) // TODO: Support Windows?
- return make_unexpected(Tr::tr("Could not find dd on remote host: %1").arg(whichDD.error()));
+ return Result::Error(Tr::tr("Could not find dd on remote host: %1").arg(whichDD.error()));
qCDebug(faLog) << "Found dd on remote host:" << *whichDD;
const expected_str unameOs = run({remoteRootPath.withNewPath("uname"), {"-s"}});
if (!unameOs) {
- return make_unexpected(
+ return Result::Error(
QString("Could not determine OS on remote host: %1").arg(unameOs.error()));
}
Utils::expected_str osType = osTypeFromString(*unameOs);
if (!osType)
- return make_unexpected(osType.error());
+ return Result::Error(osType.error());
qCDebug(faLog) << "Remote host OS:" << *unameOs;
const expected_str unameArch = run({remoteRootPath.withNewPath("uname"), {"-m"}});
if (!unameArch) {
- return make_unexpected(
+ return Result::Error(
QString("Could not determine architecture on remote host: %1").arg(unameArch.error()));
}
const Utils::expected_str osArch = osArchFromString(*unameArch);
if (!osArch)
- return make_unexpected(osArch.error());
+ return Result::Error(osArch.error());
qCDebug(faLog) << "Remote host architecture:" << *unameArch;
@@ -95,7 +94,7 @@ expected_str FileAccess::deployAndInit(
= Client::getCmdBridgePath(*osType, *osArch, libExecPath);
if (!cmdBridgePath) {
- return make_unexpected(
+ return Result::Error(
QString("Could not determine compatible cmdbridge for remote host: %1")
.arg(cmdBridgePath.error()));
}
@@ -106,7 +105,7 @@ expected_str FileAccess::deployAndInit(
const auto cmdBridgeFileData = cmdBridgePath->fileContents();
if (!cmdBridgeFileData) {
- return make_unexpected(
+ return Result::Error(
QString("Could not read cmdbridge file: %1").arg(cmdBridgeFileData.error()));
}
@@ -114,7 +113,7 @@ expected_str FileAccess::deployAndInit(
{remoteRootPath.withNewPath("mktemp"), {"-t", "cmdbridge.XXXXXXXXXX"}});
if (!tmpFile) {
- return make_unexpected(
+ return Result::Error(
QString("Could not create temporary file: %1").arg(tmpFile.error()));
}
@@ -125,7 +124,7 @@ expected_str FileAccess::deployAndInit(
const auto makeExecutable = run({remoteRootPath.withNewPath("chmod"), {"+x", *tmpFile}});
if (!makeExecutable) {
- return make_unexpected(
+ return Result::Error(
QString("Could not make temporary file executable: %1").arg(makeExecutable.error()));
}
@@ -468,26 +467,26 @@ expected_str FileAccess::writeFileContents(const FilePath &filePath,
}
}
-expected_str FileAccess::removeFile(const Utils::FilePath &filePath) const
+Result FileAccess::removeFile(const FilePath &filePath) const
{
try {
Utils::expected_str> f = m_client->removeFile(filePath.nativePath());
if (!f)
- return make_unexpected(f.error());
+ return Result::Error(f.error());
f->waitForFinished();
} catch (const std::system_error &e) {
if (e.code().value() == ENOENT)
- return make_unexpected(Tr::tr("File does not exist"));
+ return Result::Error(Tr::tr("File does not exist"));
qCWarning(faLog) << "Error removing file:" << e.what();
- return make_unexpected(
+ return Result::Error(
Tr::tr("Error removing file: %1").arg(QString::fromLocal8Bit(e.what())));
} catch (const std::exception &e) {
qCWarning(faLog) << "Error removing file:" << e.what();
- return make_unexpected(
+ return Result::Error(
Tr::tr("Error removing file: %1").arg(QString::fromLocal8Bit(e.what())));
}
- return {};
+ return Result::Ok;
}
bool FileAccess::removeRecursively(const Utils::FilePath &filePath, QString *error) const
@@ -530,37 +529,35 @@ bool FileAccess::createDirectory(const Utils::FilePath &filePath) const
}
}
-expected_str FileAccess::copyFile(const Utils::FilePath &filePath,
- const Utils::FilePath &target) const
+Result FileAccess::copyFile(const FilePath &filePath, const FilePath &target) const
{
try {
auto f = m_client->copyFile(filePath.nativePath(), target.nativePath());
- QTC_ASSERT_EXPECTED(f, return {});
+ QTC_ASSERT_EXPECTED(f, return Result::Ok);
f->waitForFinished();
- return {};
+ return Result::Ok;
} catch (const std::exception &e) {
- return make_unexpected(
+ return Result::Error(
Tr::tr("Error copying file: %1").arg(QString::fromLocal8Bit(e.what())));
}
}
-expected_str FileAccess::renameFile(
- const Utils::FilePath &filePath, const Utils::FilePath &target) const
+Result FileAccess::renameFile(const FilePath &filePath, const FilePath &target) const
{
try {
Utils::expected_str> f
= m_client->renameFile(filePath.nativePath(), target.nativePath());
if (!f)
- return make_unexpected(f.error());
+ return Result::Error(f.error());
f->waitForFinished();
if (!f)
- return make_unexpected(f.error());
+ return Result::Error(f.error());
} catch (const std::exception &e) {
- return make_unexpected(
+ return Result::Error(
Tr::tr("Error renaming file: %1").arg(QString::fromLocal8Bit(e.what())));
}
- return {};
+ return Result::Ok;
}
Environment FileAccess::deviceEnvironment() const
@@ -574,15 +571,15 @@ expected_str> FileAccess::watch(const FilePath
return m_client->watch(filePath.nativePath());
}
-Utils::expected_str FileAccess::signalProcess(int pid, ControlSignal signal) const
+Result FileAccess::signalProcess(int pid, ControlSignal signal) const
{
try {
auto f = m_client->signalProcess(pid, signal);
- QTC_ASSERT_EXPECTED(f, return {});
+ QTC_ASSERT_EXPECTED(f, return Result::Ok);
f->waitForFinished();
- return {};
+ return Result::Ok;
} catch (const std::exception &e) {
- return make_unexpected(
+ return Result::Error(
Tr::tr("Error killing process: %1").arg(QString::fromLocal8Bit(e.what())));
};
}
diff --git a/src/libs/gocmdbridge/client/bridgedfileaccess.h b/src/libs/gocmdbridge/client/bridgedfileaccess.h
index 2d6ffb72278..54fcbd58bc3 100644
--- a/src/libs/gocmdbridge/client/bridgedfileaccess.h
+++ b/src/libs/gocmdbridge/client/bridgedfileaccess.h
@@ -27,17 +27,17 @@ class QTCREATOR_CMDBRIDGE_EXPORT FileAccess : public Utils::DeviceFileAccess
public:
~FileAccess() override;
- Utils::expected_str deployAndInit(
+ Utils::Result deployAndInit(
const Utils::FilePath &libExecPath, const Utils::FilePath &remoteRootPath);
- Utils::expected_str init(const Utils::FilePath &pathToBridge);
+ Utils::Result init(const Utils::FilePath &pathToBridge);
- Utils::expected_str signalProcess(int pid, Utils::ControlSignal signal) const;
+ Utils::Result signalProcess(int pid, Utils::ControlSignal signal) const;
Utils::Environment deviceEnvironment() const override;
protected:
- Utils::expected_str reinit();
+ Utils::Result reinit();
void iterateDirectory(const Utils::FilePath &filePath,
const Utils::FilePath::IterateDirCallback &callBack,
@@ -69,16 +69,16 @@ protected:
Utils::expected_str writeFileContents(const Utils::FilePath &filePath,
const QByteArray &data) const override;
- Utils::expected_str removeFile(const Utils::FilePath &filePath) const override;
+ Utils::Result removeFile(const Utils::FilePath &filePath) const override;
bool removeRecursively(const Utils::FilePath &filePath, QString *error) const override;
bool ensureExistingFile(const Utils::FilePath &filePath) const override;
bool createDirectory(const Utils::FilePath &filePath) const override;
- Utils::expected_str copyFile(const Utils::FilePath &filePath,
- const Utils::FilePath &target) const override;
+ Utils::Result copyFile(const Utils::FilePath &filePath,
+ const Utils::FilePath &target) const override;
- Utils::expected_str renameFile(
+ Utils::Result renameFile(
const Utils::FilePath &filePath, const Utils::FilePath &target) const override;
Utils::expected_str createTempFile(const Utils::FilePath &filePath) override;
diff --git a/src/libs/utils/aspects.cpp b/src/libs/utils/aspects.cpp
index 07150b3d00a..0eeb083d877 100644
--- a/src/libs/utils/aspects.cpp
+++ b/src/libs/utils/aspects.cpp
@@ -294,6 +294,14 @@ void BaseAspect::addLabeledItem(Layout &parent, QWidget *widget)
}
}
+void BaseAspect::addLabeledItems(Layouting::Layout &parent, const QList &widgets)
+{
+ if (QLabel *l = createLabel())
+ parent.addItem(l);
+ for (auto widget : widgets)
+ parent.addItem(widget);
+}
+
/*!
Sets \a labelText as text for the separate label in the visual
representation of this aspect.
@@ -3162,6 +3170,7 @@ void AspectContainer::addToLayoutImpl(Layouting::Layout &parent)
void AspectContainer::registerAspect(BaseAspect *aspect, bool takeOwnership)
{
aspect->setAutoApply(isAutoApply());
+ aspect->setEnabled(isEnabled());
d->m_items.append(aspect);
if (takeOwnership)
d->m_ownedItems.append(aspect);
@@ -3316,6 +3325,14 @@ void AspectContainer::setUndoStack(QUndoStack *undoStack)
aspect->setUndoStack(undoStack);
}
+void AspectContainer::setEnabled(bool enabled)
+{
+ BaseAspect::setEnabled(enabled);
+
+ for (BaseAspect *aspect : std::as_const(d->m_items))
+ aspect->setEnabled(enabled);
+}
+
void AspectContainer::setMacroExpander(MacroExpander *expander)
{
BaseAspect::setMacroExpander(expander);
diff --git a/src/libs/utils/aspects.h b/src/libs/utils/aspects.h
index f1c59c908b2..6c3b62cdbe7 100644
--- a/src/libs/utils/aspects.h
+++ b/src/libs/utils/aspects.h
@@ -98,7 +98,7 @@ public:
QUndoStack *undoStack() const;
bool isEnabled() const;
- void setEnabled(bool enabled);
+ virtual void setEnabled(bool enabled);
void setEnabler(BoolAspect *checker);
bool isReadOnly() const;
@@ -237,6 +237,7 @@ protected:
QLabel *createLabel();
void addLabeledItem(Layouting::Layout &parent, QWidget *widget);
+ void addLabeledItems(Layouting::Layout &parent, const QList &widgets);
void setDataCreatorHelper(const DataCreator &creator) const;
void setDataClonerHelper(const DataCloner &cloner) const;
@@ -996,6 +997,7 @@ public:
void setAutoApply(bool on) override;
bool isDirty() override;
void setUndoStack(QUndoStack *undoStack) override;
+ void setEnabled(bool enabled) override;
void setMacroExpander(MacroExpander *expander);
diff --git a/src/libs/utils/devicefileaccess.cpp b/src/libs/utils/devicefileaccess.cpp
index ab07c83dee4..e318cc7df0a 100644
--- a/src/libs/utils/devicefileaccess.cpp
+++ b/src/libs/utils/devicefileaccess.cpp
@@ -117,22 +117,21 @@ bool DeviceFileAccess::hasHardLinks(const FilePath &filePath) const
return false;
}
-expected_str DeviceFileAccess::ensureWritableDirectory(const FilePath &filePath) const
+Result DeviceFileAccess::ensureWritableDirectory(const FilePath &filePath) const
{
if (isWritableDirectory(filePath))
- return {};
+ return Result::Ok;
if (exists(filePath)) {
- return make_unexpected(Tr::tr("Path \"%1\" exists but is not a writable directory.")
+ return Result::Error(Tr::tr("Path \"%1\" exists but is not a writable directory.")
.arg(filePath.toUserOutput()));
}
const bool result = createDirectory(filePath);
if (result)
- return {};
+ return Result::Ok;
- return make_unexpected(
- Tr::tr("Failed to create directory \"%1\".").arg(filePath.toUserOutput()));
+ return Result::Error(Tr::tr("Failed to create directory \"%1\".").arg(filePath.toUserOutput()));
}
bool DeviceFileAccess::ensureExistingFile(const FilePath &filePath) const
@@ -155,11 +154,10 @@ bool DeviceFileAccess::exists(const FilePath &filePath) const
return false;
}
-expected_str DeviceFileAccess::removeFile(const FilePath &filePath) const
+Result DeviceFileAccess::removeFile(const FilePath &filePath) const
{
- Q_UNUSED(filePath)
QTC_CHECK(false);
- return make_unexpected(
+ return Result::Error(
Tr::tr("removeFile is not implemented for \"%1\".").arg(filePath.toUserOutput()));
}
@@ -171,18 +169,17 @@ bool DeviceFileAccess::removeRecursively(const FilePath &filePath, QString *erro
return false;
}
-expected_str DeviceFileAccess::copyFile(const FilePath &filePath, const FilePath &target) const
+Result DeviceFileAccess::copyFile(const FilePath &filePath, const FilePath &target) const
{
- Q_UNUSED(filePath)
Q_UNUSED(target)
QTC_CHECK(false);
- return make_unexpected(
+ return Result::Error(
Tr::tr("copyFile is not implemented for \"%1\".").arg(filePath.toUserOutput()));
}
-expected_str copyRecursively_fallback(const FilePath &src, const FilePath &target)
+static Result copyRecursively_fallback(const FilePath &src, const FilePath &target)
{
- expected_str result;
+ Result result = Result::Ok;
src.iterateDirectory(
[&target, &src, &result](const FilePath &path) {
const FilePath relative = path.relativePathFrom(src);
@@ -202,16 +199,15 @@ expected_str copyRecursively_fallback(const FilePath &src, const FilePath
return result;
}
-expected_str DeviceFileAccess::copyRecursively(const FilePath &src,
- const FilePath &target) const
+Result DeviceFileAccess::copyRecursively(const FilePath &src, const FilePath &target) const
{
if (!src.isDir()) {
- return make_unexpected(
+ return Result::Error(
Tr::tr("Cannot copy from \"%1\", it is not a directory.").arg(src.toUserOutput()));
}
- const expected_str result = target.ensureWritableDir();
+ const Result result = target.ensureWritableDir();
if (!result) {
- return make_unexpected(Tr::tr("Cannot copy \"%1\" to \"%2\": %3")
+ return Result::Error(Tr::tr("Cannot copy \"%1\" to \"%2\": %3")
.arg(src.toUserOutput())
.arg(target.toUserOutput())
.arg(result.error()));
@@ -254,7 +250,7 @@ expected_str DeviceFileAccess::copyRecursively(const FilePath &src,
if (srcProcess.result() != ProcessResult::FinishedWithSuccess) {
targetProcess.kill();
- return make_unexpected(
+ return Result::Error(
Tr::tr("Failed to copy recursively from \"%1\" to \"%2\" while "
"trying to create tar archive from source: %3")
.arg(src.toUserOutput(), target.toUserOutput(), srcProcess.readAllStandardError()));
@@ -263,23 +259,22 @@ expected_str DeviceFileAccess::copyRecursively(const FilePath &src,
targetProcess.waitForFinished();
if (targetProcess.result() != ProcessResult::FinishedWithSuccess) {
- return make_unexpected(Tr::tr("Failed to copy recursively from \"%1\" to \"%2\" while "
+ return Result::Error(Tr::tr("Failed to copy recursively from \"%1\" to \"%2\" while "
"trying to extract tar archive to target: %3")
.arg(src.toUserOutput(),
target.toUserOutput(),
targetProcess.readAllStandardError()));
}
- return {};
+ return Result::Ok;
#endif
}
-expected_str DeviceFileAccess::renameFile(const FilePath &filePath, const FilePath &target) const
+Result DeviceFileAccess::renameFile(const FilePath &filePath, const FilePath &target) const
{
- Q_UNUSED(filePath)
Q_UNUSED(target)
QTC_CHECK(false);
- return make_unexpected(
+ return Result::Error(
Tr::tr("renameFile is not implemented for \"%1\".").arg(filePath.toUserOutput()));
}
@@ -684,22 +679,22 @@ bool DesktopDeviceFileAccess::hasHardLinks(const FilePath &filePath) const
return false;
}
-expected_str DesktopDeviceFileAccess::ensureWritableDirectory(const FilePath &filePath) const
+Result DesktopDeviceFileAccess::ensureWritableDirectory(const FilePath &filePath) const
{
const QFileInfo fi(filePath.path());
if (fi.isDir() && fi.isWritable())
- return {};
+ return Result::Ok;
if (fi.exists()) {
- return make_unexpected(Tr::tr("Path \"%1\" exists but is not a writable directory.")
+ return Result::Error(Tr::tr("Path \"%1\" exists but is not a writable directory.")
.arg(filePath.toUserOutput()));
}
const bool result = QDir().mkpath(filePath.path());
if (result)
- return {};
+ return Result::Ok;
- return make_unexpected(
+ return Result::Error(
Tr::tr("Failed to create directory \"%1\".").arg(filePath.toUserOutput()));
}
@@ -724,12 +719,12 @@ bool DesktopDeviceFileAccess::exists(const FilePath &filePath) const
return !filePath.isEmpty() && QFileInfo::exists(filePath.path());
}
-expected_str DesktopDeviceFileAccess::removeFile(const FilePath &filePath) const
+Result DesktopDeviceFileAccess::removeFile(const FilePath &filePath) const
{
QFile f(filePath.path());
if (!f.remove())
- return make_unexpected(f.errorString());
- return {};
+ return Result::Error(f.errorString());
+ return Result::Ok;
}
static bool checkToRefuseRemoveStandardLocationDirectory(const QString &dirPath,
@@ -806,26 +801,26 @@ bool DesktopDeviceFileAccess::removeRecursively(const FilePath &filePath, QStrin
return true;
}
-expected_str DesktopDeviceFileAccess::copyFile(const FilePath &filePath,
+Result DesktopDeviceFileAccess::copyFile(const FilePath &filePath,
const FilePath &target) const
{
QFile srcFile(filePath.path());
if (srcFile.copy(target.path()))
- return {};
- return make_unexpected(
+ return Result::Ok;
+ return Result::Error(
Tr::tr("Failed to copy file \"%1\" to \"%2\": %3")
.arg(filePath.toUserOutput(), target.toUserOutput(), srcFile.errorString()));
}
-expected_str DesktopDeviceFileAccess::renameFile(
+Result DesktopDeviceFileAccess::renameFile(
const FilePath &filePath, const FilePath &target) const
{
QFile f(filePath.path());
if (f.rename(target.path()))
- return {};
- return make_unexpected(
+ return Result::Ok;
+ return Result::Error(
Tr::tr("Failed to rename file \"%1\" to \"%2\": %3")
.arg(filePath.toUserOutput(), target.toUserOutput(), f.errorString()));
}
@@ -1060,9 +1055,14 @@ QByteArray DesktopDeviceFileAccess::fileId(const FilePath &filePath) const
// UnixDeviceAccess
+static QString disconnectedMessage()
+{
+ return Tr::tr("Device is not connected");
+}
+
static Utils::unexpected make_unexpected_disconnected()
{
- return make_unexpected(Tr::tr("Device is not connected"));
+ return make_unexpected(disconnectedMessage());
}
UnixDeviceFileAccess::~UnixDeviceFileAccess() = default;
@@ -1175,20 +1175,21 @@ bool UnixDeviceFileAccess::exists(const FilePath &filePath) const
return runInShellSuccess({"test", {"-e", path}, OsType::OsTypeLinux});
}
-expected_str UnixDeviceFileAccess::removeFile(const FilePath &filePath) const
+Result UnixDeviceFileAccess::removeFile(const FilePath &filePath) const
{
if (disconnected())
- return make_unexpected_disconnected();
+ return Result::Error(disconnectedMessage());
RunResult result = runInShell({"rm", {filePath.path()}, OsType::OsTypeLinux});
if (result.exitCode != 0)
- return make_unexpected(QString::fromUtf8(result.stdErr));
- return {};
+ return Result::Error(QString::fromUtf8(result.stdErr));
+ return Result::Ok;
}
bool UnixDeviceFileAccess::removeRecursively(const FilePath &filePath, QString *error) const
{
if (disconnected())
return false;
+
QTC_ASSERT(filePath.path().startsWith('/'), return false);
const QString path = filePath.cleanPath().path();
@@ -1206,36 +1207,35 @@ bool UnixDeviceFileAccess::removeRecursively(const FilePath &filePath, QString *
return result.exitCode == 0;
}
-expected_str UnixDeviceFileAccess::copyFile(const FilePath &filePath,
- const FilePath &target) const
+Result UnixDeviceFileAccess::copyFile(const FilePath &filePath, const FilePath &target) const
{
if (disconnected())
- return make_unexpected_disconnected();
+ return Result::Error(disconnectedMessage());
const RunResult result = runInShell(
{"cp", {filePath.path(), target.path()}, OsType::OsTypeLinux});
if (result.exitCode != 0) {
- return make_unexpected(Tr::tr("Failed to copy file \"%1\" to \"%2\": %3")
+ return Result::Error(Tr::tr("Failed to copy file \"%1\" to \"%2\": %3")
.arg(filePath.toUserOutput(),
target.toUserOutput(),
QString::fromUtf8(result.stdErr)));
}
- return {};
+ return Result::Ok;
}
-expected_str UnixDeviceFileAccess::renameFile(const FilePath &filePath, const FilePath &target) const
+Result UnixDeviceFileAccess::renameFile(const FilePath &filePath, const FilePath &target) const
{
if (disconnected())
- return make_unexpected_disconnected();
+ return Result::Error(disconnectedMessage());
- auto result = runInShell({"mv", {filePath.path(), target.path()}, OsType::OsTypeLinux});
+ RunResult result = runInShell({"mv", {filePath.path(), target.path()}, OsType::OsTypeLinux});
if (result.exitCode != 0) {
- return make_unexpected(Tr::tr("Failed to rename file \"%1\" to \"%2\": %3")
+ return Result::Error(Tr::tr("Failed to rename file \"%1\" to \"%2\": %3")
.arg(filePath.toUserOutput(),
target.toUserOutput(),
QString::fromUtf8(result.stdErr)));
}
- return {};
+ return Result::Ok;
}
FilePath UnixDeviceFileAccess::symLinkTarget(const FilePath &filePath) const
diff --git a/src/libs/utils/devicefileaccess.h b/src/libs/utils/devicefileaccess.h
index 97aa014ab21..d5c82a0076c 100644
--- a/src/libs/utils/devicefileaccess.h
+++ b/src/libs/utils/devicefileaccess.h
@@ -38,16 +38,15 @@ protected:
virtual bool isDirectory(const FilePath &filePath) const;
virtual bool isSymLink(const FilePath &filePath) const;
virtual bool hasHardLinks(const FilePath &filePath) const;
- virtual expected_str ensureWritableDirectory(const FilePath &filePath) const;
+ virtual Result ensureWritableDirectory(const FilePath &filePath) const;
virtual bool ensureExistingFile(const FilePath &filePath) const;
virtual bool createDirectory(const FilePath &filePath) const;
virtual bool exists(const FilePath &filePath) const;
- virtual expected_str removeFile(const FilePath &filePath) const;
+ virtual Result removeFile(const FilePath &filePath) const;
virtual bool removeRecursively(const FilePath &filePath, QString *error) const;
- virtual expected_str copyFile(const FilePath &filePath, const FilePath &target) const;
- virtual expected_str copyRecursively(const FilePath &filePath,
- const FilePath &target) const;
- virtual expected_str renameFile(const FilePath &filePath, const FilePath &target) const;
+ virtual Result copyFile(const FilePath &filePath, const FilePath &target) const;
+ virtual Result copyRecursively(const FilePath &filePath, const FilePath &target) const;
+ virtual Result renameFile(const FilePath &filePath, const FilePath &target) const;
virtual FilePath symLinkTarget(const FilePath &filePath) const;
virtual FilePathInfo filePathInfo(const FilePath &filePath) const;
@@ -97,14 +96,14 @@ protected:
bool isDirectory(const FilePath &filePath) const override;
bool isSymLink(const FilePath &filePath) const override;
bool hasHardLinks(const FilePath &filePath) const override;
- expected_str ensureWritableDirectory(const FilePath &filePath) const override;
+ Result ensureWritableDirectory(const FilePath &filePath) const override;
bool ensureExistingFile(const FilePath &filePath) const override;
bool createDirectory(const FilePath &filePath) const override;
bool exists(const FilePath &filePath) const override;
- expected_str removeFile(const FilePath &filePath) const override;
+ Result removeFile(const FilePath &filePath) const override;
bool removeRecursively(const FilePath &filePath, QString *error) const override;
- expected_str copyFile(const FilePath &filePath, const FilePath &target) const override;
- expected_str renameFile(const FilePath &filePath, const FilePath &target) const override;
+ Result copyFile(const FilePath &filePath, const FilePath &target) const override;
+ Result renameFile(const FilePath &filePath, const FilePath &target) const override;
FilePath symLinkTarget(const FilePath &filePath) const override;
FilePathInfo filePathInfo(const FilePath &filePath) const override;
@@ -159,10 +158,10 @@ protected:
bool ensureExistingFile(const FilePath &filePath) const override;
bool createDirectory(const FilePath &filePath) const override;
bool exists(const FilePath &filePath) const override;
- expected_str removeFile(const FilePath &filePath) const override;
+ Result removeFile(const FilePath &filePath) const override;
bool removeRecursively(const FilePath &filePath, QString *error) const override;
- expected_str copyFile(const FilePath &filePath, const FilePath &target) const override;
- expected_str renameFile(const FilePath &filePath, const FilePath &target) const override;
+ Result copyFile(const FilePath &filePath, const FilePath &target) const override;
+ Result renameFile(const FilePath &filePath, const FilePath &target) const override;
FilePathInfo filePathInfo(const FilePath &filePath) const override;
FilePath symLinkTarget(const FilePath &filePath) const override;
diff --git a/src/libs/utils/filepath.cpp b/src/libs/utils/filepath.cpp
index d52b6fea04c..c7231a9976a 100644
--- a/src/libs/utils/filepath.cpp
+++ b/src/libs/utils/filepath.cpp
@@ -551,7 +551,7 @@ void FilePath::setParts(const QStringView scheme, const QStringView host, QStrin
\sa createDir()
*/
-expected_str FilePath::ensureWritableDir() const
+Result FilePath::ensureWritableDir() const
{
return fileAccess()->ensureWritableDirectory(*this);
}
@@ -1980,7 +1980,7 @@ OsType FilePath::osType() const
return s_deviceHooks.osType(*this);
}
-expected_str FilePath::removeFile() const
+Result FilePath::removeFile() const
{
return fileAccess()->removeFile(*this);
}
@@ -1997,18 +1997,18 @@ bool FilePath::removeRecursively(QString *error) const
return fileAccess()->removeRecursively(*this, error);
}
-expected_str FilePath::copyRecursively(const FilePath &target) const
+Result FilePath::copyRecursively(const FilePath &target) const
{
return fileAccess()->copyRecursively(*this, target);
}
-expected_str FilePath::copyFile(const FilePath &target) const
+Result FilePath::copyFile(const FilePath &target) const
{
if (!isSameDevice(target)) {
// FIXME: This does not scale.
const expected_str contents = fileContents();
if (!contents) {
- return make_unexpected(
+ return Result::Error(
Tr::tr("Error while trying to copy file: %1").arg(contents.error()));
}
@@ -2016,38 +2016,41 @@ expected_str FilePath::copyFile(const FilePath &target) const
const expected_str copyResult = target.writeFileContents(*contents);
if (!copyResult)
- return make_unexpected(Tr::tr("Could not copy file: %1").arg(copyResult.error()));
+ return Result::Error(Tr::tr("Could not copy file: %1").arg(copyResult.error()));
if (!target.setPermissions(perms)) {
target.removeFile();
- return make_unexpected(
+ return Result::Error(
Tr::tr("Could not set permissions on \"%1\"").arg(target.toString()));
}
- return {};
+ return Result::Ok;
}
return fileAccess()->copyFile(*this, target);
}
-expected_str FilePath::renameFile(const FilePath &target) const
+Result FilePath::renameFile(const FilePath &target) const
{
if (isSameDevice(target))
return fileAccess()->renameFile(*this, target);
- return copyFile(target).and_then([this, &target] {
- return removeFile().or_else(
- [this, &target](const QString &removeError) -> expected_str {
- // If we fail to remove the source file, we remove the target file to return to the
- // original state.
- expected_str rmResult = target.removeFile();
- QTC_CHECK_EXPECTED(rmResult);
- return make_unexpected(
- Tr::tr("Failed to move %1 to %2. Removing the source file failed: %3")
- .arg(toUserOutput())
- .arg(target.toUserOutput())
- .arg(removeError));
- });
- });
+ const Result copyResult = copyFile(target);
+ if (!copyResult)
+ return copyResult;
+
+ const Result removeResult = removeFile();
+ if (removeResult)
+ return Result::Ok;
+
+ // If we fail to remove the source file, we remove the target file to return to the
+ // original state.
+ Result rmResult = target.removeFile();
+ QTC_CHECK_EXPECTED(rmResult);
+ return Result::Error(
+ Tr::tr("Failed to move %1 to %2. Removing the source file failed: %3")
+ .arg(toUserOutput())
+ .arg(target.toUserOutput())
+ .arg(rmResult.error()));
}
qint64 FilePath::fileSize() const
diff --git a/src/libs/utils/filepath.h b/src/libs/utils/filepath.h
index 982ec3ea94f..b79ef3c1d71 100644
--- a/src/libs/utils/filepath.h
+++ b/src/libs/utils/filepath.h
@@ -152,7 +152,7 @@ public:
bool isWritableDir() const;
bool isWritableFile() const;
- expected_str ensureWritableDir() const;
+ Result ensureWritableDir() const;
bool ensureExistingFile() const;
bool isExecutableFile() const;
bool isReadableFile() const;
@@ -170,11 +170,11 @@ public:
QFile::Permissions permissions() const;
bool setPermissions(QFile::Permissions permissions) const;
OsType osType() const;
- expected_str removeFile() const;
+ Result removeFile() const;
bool removeRecursively(QString *error = nullptr) const;
- expected_str copyRecursively(const FilePath &target) const;
- expected_str copyFile(const FilePath &target) const;
- expected_str renameFile(const FilePath &target) const;
+ Result copyRecursively(const FilePath &target) const;
+ Result copyFile(const FilePath &target) const;
+ Result renameFile(const FilePath &target) const;
qint64 fileSize() const;
qint64 bytesAvailable() const;
bool createDir() const;
diff --git a/src/libs/utils/fileutils.cpp b/src/libs/utils/fileutils.cpp
index 319235d7c49..d011cd5a4d8 100644
--- a/src/libs/utils/fileutils.cpp
+++ b/src/libs/utils/fileutils.cpp
@@ -735,7 +735,7 @@ bool FileUtils::copyIfDifferent(const FilePath &srcFilePath, const FilePath &tgt
tgtFilePath.removeFile();
}
- const expected_str copyResult = srcFilePath.copyFile(tgtFilePath);
+ const Result copyResult = srcFilePath.copyFile(tgtFilePath);
// TODO forward error to caller instead of assert, since IO errors can always be expected
QTC_ASSERT_EXPECTED(copyResult, return false);
diff --git a/src/libs/utils/fsengine/fsenginehandler.cpp b/src/libs/utils/fsengine/fsenginehandler.cpp
index 4580ebdcb57..2fbd853963f 100644
--- a/src/libs/utils/fsengine/fsenginehandler.cpp
+++ b/src/libs/utils/fsengine/fsenginehandler.cpp
@@ -220,18 +220,18 @@ bool FSEngineImpl::remove()
bool FSEngineImpl::copy(const QString &newName)
{
- expected_str result = m_filePath.copyFile(FilePath::fromString(newName));
+ Result result = m_filePath.copyFile(FilePath::fromString(newName));
if (!result)
setError(QFile::CopyError, result.error());
- return result.has_value();
+ return bool(result);
}
bool FSEngineImpl::rename(const QString &newName)
{
- auto result = m_filePath.renameFile(FilePath::fromString(newName));
+ Result result = m_filePath.renameFile(FilePath::fromString(newName));
if (!result)
setError(QFile::RenameError, result.error());
- return result.has_value();
+ return bool(result);
}
bool FSEngineImpl::renameOverwrite(const QString &newName)
diff --git a/src/libs/utils/layoutbuilder.cpp b/src/libs/utils/layoutbuilder.cpp
index 0ae96b90799..0a18c72ef79 100644
--- a/src/libs/utils/layoutbuilder.cpp
+++ b/src/libs/utils/layoutbuilder.cpp
@@ -740,6 +740,26 @@ void Widget::show()
access(this)->show();
}
+bool Widget::isVisible() const
+{
+ return access(this)->isVisible();
+}
+
+bool Widget::isEnabled() const
+{
+ return access(this)->isEnabled();
+}
+
+void Widget::setVisible(bool visible)
+{
+ access(this)-> setVisible(visible);
+}
+
+void Widget::setEnabled(bool enabled)
+{
+ access(this)->setEnabled(enabled);
+}
+
void Widget::setNoMargins(int)
{
setContentsMargins(0, 0, 0, 0);
diff --git a/src/libs/utils/layoutbuilder.h b/src/libs/utils/layoutbuilder.h
index cbe29b55d02..5019f2e8232 100644
--- a/src/libs/utils/layoutbuilder.h
+++ b/src/libs/utils/layoutbuilder.h
@@ -231,6 +231,12 @@ public:
QWidget *emerge() const;
void show();
+ bool isVisible() const;
+ bool isEnabled() const;
+
+ void setVisible(bool);
+ void setEnabled(bool);
+
void setAutoFillBackground(bool);
void setLayout(const Layout &layout);
void setSize(int, int);
diff --git a/src/libs/utils/savefile.cpp b/src/libs/utils/savefile.cpp
index 65f9fa41a41..9ccdf1cea52 100644
--- a/src/libs/utils/savefile.cpp
+++ b/src/libs/utils/savefile.cpp
@@ -197,7 +197,7 @@ bool SaveFile::commit()
}
}
- expected_str renameResult = m_tempFile->filePath().renameFile(finalFileName);
+ Result renameResult = m_tempFile->filePath().renameFile(finalFileName);
if (!renameResult) {
// The case when someone else was able to create finalFileName after we've renamed it.
// Higher level call may try to save this file again but here we do nothing and
diff --git a/src/libs/utils/stylehelper.cpp b/src/libs/utils/stylehelper.cpp
index 080bb8a3820..340f29d6f51 100644
--- a/src/libs/utils/stylehelper.cpp
+++ b/src/libs/utils/stylehelper.cpp
@@ -176,6 +176,10 @@ QColor StyleHelper::borderColor(bool lightColored)
QColor StyleHelper::toolBarBorderColor()
{
+ if (const QColor sepColor = creatorColor(Theme::FancyToolBarSeparatorColor);
+ sepColor == creatorColor(Theme::SplitterColor))
+ return sepColor; // QTCREATORBUG-31682: Unify all separating line colors if two are the same
+
const QColor base = baseColor();
return QColor::fromHsv(base.hue(),
base.saturation() ,
diff --git a/src/plugins/android/CMakeLists.txt b/src/plugins/android/CMakeLists.txt
index 94a52d5148e..60b549a7f2a 100644
--- a/src/plugins/android/CMakeLists.txt
+++ b/src/plugins/android/CMakeLists.txt
@@ -27,7 +27,6 @@ add_qtc_plugin(Android
androidqmltoolingsupport.cpp androidqmltoolingsupport.h
androidqtversion.cpp androidqtversion.h
androidrunconfiguration.cpp androidrunconfiguration.h
- androidruncontrol.cpp androidruncontrol.h
androidrunner.cpp androidrunner.h
androidrunnerworker.cpp androidrunnerworker.h
androidsdkdownloader.cpp androidsdkdownloader.h
diff --git a/src/plugins/android/android.qbs b/src/plugins/android/android.qbs
index de16bda375c..6618e7c9cfb 100644
--- a/src/plugins/android/android.qbs
+++ b/src/plugins/android/android.qbs
@@ -55,8 +55,6 @@ QtcPlugin {
"androidqtversion.h",
"androidrunconfiguration.cpp",
"androidrunconfiguration.h",
- "androidruncontrol.cpp",
- "androidruncontrol.h",
"androidrunner.cpp",
"androidrunner.h",
"androidrunnerworker.cpp",
diff --git a/src/plugins/android/androidbuildapkstep.cpp b/src/plugins/android/androidbuildapkstep.cpp
index 8ed611b19c4..ef1a93d7577 100644
--- a/src/plugins/android/androidbuildapkstep.cpp
+++ b/src/plugins/android/androidbuildapkstep.cpp
@@ -679,7 +679,7 @@ static bool copyFileIfNewer(const FilePath &sourceFilePath,
if (!destinationFilePath.parentDir().ensureWritableDir())
return false;
- expected_str result = sourceFilePath.copyFile(destinationFilePath);
+ Result result = sourceFilePath.copyFile(destinationFilePath);
QTC_ASSERT_EXPECTED(result, return false);
return true;
}
diff --git a/src/plugins/android/androidplugin.cpp b/src/plugins/android/androidplugin.cpp
index 5f860134f8f..232a3e5f590 100644
--- a/src/plugins/android/androidplugin.cpp
+++ b/src/plugins/android/androidplugin.cpp
@@ -13,7 +13,7 @@
#include "androidqmltoolingsupport.h"
#include "androidqtversion.h"
#include "androidrunconfiguration.h"
-#include "androidruncontrol.h"
+#include "androidrunner.h"
#include "androidsettingswidget.h"
#include "androidtoolchain.h"
#include "androidtr.h"
diff --git a/src/plugins/android/androidrunconfiguration.cpp b/src/plugins/android/androidrunconfiguration.cpp
index 33ce4caa9ed..3b7da499440 100644
--- a/src/plugins/android/androidrunconfiguration.cpp
+++ b/src/plugins/android/androidrunconfiguration.cpp
@@ -100,7 +100,7 @@ class AndroidRunConfigurationFactory : public RunConfigurationFactory
public:
AndroidRunConfigurationFactory()
{
- registerRunConfiguration("Qt4ProjectManager.AndroidRunConfiguration:");
+ registerRunConfiguration(Android::Constants::ANDROID_RUNCONFIG_ID);
addSupportedTargetDeviceType(Android::Constants::ANDROID_DEVICE_TYPE);
}
};
diff --git a/src/plugins/android/androidruncontrol.cpp b/src/plugins/android/androidruncontrol.cpp
deleted file mode 100644
index 023e14525c3..00000000000
--- a/src/plugins/android/androidruncontrol.cpp
+++ /dev/null
@@ -1,53 +0,0 @@
-// Copyright (C) 2016 BogDan Vatra
-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
-
-#include "androidruncontrol.h"
-
-#include "androidconstants.h"
-#include "androidglobal.h"
-#include "androidrunconfiguration.h"
-#include "androidrunner.h"
-
-#include
-
-#include
-
-using namespace ProjectExplorer;
-
-namespace Android::Internal {
-
-class AndroidRunSupport final : public AndroidRunner
-{
-public:
- explicit AndroidRunSupport(RunControl *runControl);
- ~AndroidRunSupport() override;
-};
-
-AndroidRunSupport::AndroidRunSupport(RunControl *runControl)
- : AndroidRunner(runControl)
-{
- runControl->setIcon(Utils::Icons::RUN_SMALL_TOOLBAR);
-}
-
-AndroidRunSupport::~AndroidRunSupport()
-{
- stop();
-}
-
-class AndroidRunWorkerFactory final : public RunWorkerFactory
-{
-public:
- AndroidRunWorkerFactory()
- {
- setProduct();
- addSupportedRunMode(ProjectExplorer::Constants::NORMAL_RUN_MODE);
- addSupportedRunConfig(Constants::ANDROID_RUNCONFIG_ID);
- }
-};
-
-void setupAndroidRunWorker()
-{
- static AndroidRunWorkerFactory theAndroidRunWorkerFactory;
-}
-
-} // Android::Internal
diff --git a/src/plugins/android/androidruncontrol.h b/src/plugins/android/androidruncontrol.h
deleted file mode 100644
index 9c6fee8f251..00000000000
--- a/src/plugins/android/androidruncontrol.h
+++ /dev/null
@@ -1,10 +0,0 @@
-// Copyright (C) 2016 BogDan Vatra
-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
-
-#pragma once
-
-namespace Android::Internal {
-
-void setupAndroidRunWorker();
-
-} // Android::Internal
diff --git a/src/plugins/android/androidrunner.cpp b/src/plugins/android/androidrunner.cpp
index fa6dc5a415f..b72ab54f477 100644
--- a/src/plugins/android/androidrunner.cpp
+++ b/src/plugins/android/androidrunner.cpp
@@ -5,6 +5,7 @@
#include "androidrunner.h"
#include "androidavdmanager.h"
+#include "androidconstants.h"
#include "androiddevice.h"
#include "androidmanager.h"
#include "androidrunnerworker.h"
@@ -12,8 +13,11 @@
#include
#include
+
#include
+
#include
+#include
#include
#include
@@ -31,6 +35,7 @@ namespace Android::Internal {
AndroidRunner::AndroidRunner(RunControl *runControl)
: RunWorker(runControl)
{
+ runControl->setIcon(Utils::Icons::RUN_SMALL_TOOLBAR);
setId("AndroidRunner");
static const int metaTypes[] = {
qRegisterMetaType>("QList"),
@@ -101,7 +106,6 @@ void AndroidRunner::start()
runnerRecipe(glueStorage)
};
m_taskTreeRunner.start(recipe);
- m_packageName = AndroidManager::packageName(target);
}
void AndroidRunner::stop()
@@ -110,8 +114,6 @@ void AndroidRunner::stop()
return;
emit canceled();
- appendMessage(Tr::tr("Android target \"%1\" terminated.").arg(m_packageName),
- Utils::NormalMessageFormat);
}
void AndroidRunner::qmlServerPortReady(Port port)
@@ -155,4 +157,20 @@ void AndroidRunner::remoteStdErr(const QString &output)
m_outputParser.processOutput(output);
}
+class AndroidRunWorkerFactory final : public RunWorkerFactory
+{
+public:
+ AndroidRunWorkerFactory()
+ {
+ setProduct();
+ addSupportedRunMode(ProjectExplorer::Constants::NORMAL_RUN_MODE);
+ addSupportedRunConfig(Constants::ANDROID_RUNCONFIG_ID);
+ }
+};
+
+void setupAndroidRunWorker()
+{
+ static AndroidRunWorkerFactory theAndroidRunWorkerFactory;
+}
+
} // namespace Android::Internal
diff --git a/src/plugins/android/androidrunner.h b/src/plugins/android/androidrunner.h
index 0a6d6a0fedf..748b3879d00 100644
--- a/src/plugins/android/androidrunner.h
+++ b/src/plugins/android/androidrunner.h
@@ -46,7 +46,8 @@ private:
Utils::ProcessHandle m_pid;
QmlDebug::QmlOutputParser m_outputParser;
Tasking::TaskTreeRunner m_taskTreeRunner;
- QString m_packageName;
};
+void setupAndroidRunWorker();
+
} // namespace Android::Internal
diff --git a/src/plugins/android/androidrunnerworker.cpp b/src/plugins/android/androidrunnerworker.cpp
index abc56ea13a1..4033a86d2ce 100644
--- a/src/plugins/android/androidrunnerworker.cpp
+++ b/src/plugins/android/androidrunnerworker.cpp
@@ -581,10 +581,11 @@ static ExecutableItem postDoneRecipe(const Storage &storage)
const auto onDone = [storage] {
storage->m_processPID = -1;
storage->m_processUser = -1;
- if (!storage->m_glue->wasCancelled()) {
- storage->m_glue->setFinished(Tr::tr("Android target \"%1\" died.")
- .arg(storage->m_packageName));
- }
+ const QString package = storage->m_packageName;
+ const QString message = storage->m_glue->wasCancelled()
+ ? Tr::tr("Android target \"%1\" terminated.").arg(package)
+ : Tr::tr("Android target \"%1\" died.").arg(package);
+ storage->m_glue->setFinished(message);
};
return Group {
diff --git a/src/plugins/android/androidsignaloperation.cpp b/src/plugins/android/androidsignaloperation.cpp
index 0b44f3d5f60..8f0fbd2a7e6 100644
--- a/src/plugins/android/androidsignaloperation.cpp
+++ b/src/plugins/android/androidsignaloperation.cpp
@@ -1,99 +1,73 @@
// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
-#include "androidconfigurations.h"
#include "androidsignaloperation.h"
+#include "androidconfigurations.h"
+
#include
-#include
+using namespace Tasking;
using namespace Utils;
+using namespace std::chrono_literals;
-namespace Android {
-namespace Internal {
+namespace Android::Internal {
-AndroidSignalOperation::AndroidSignalOperation()
- : m_adbPath(AndroidConfig::adbToolPath())
- , m_timeout(new QTimer(this))
-{
- m_timeout->setInterval(5000);
- connect(m_timeout, &QTimer::timeout, this, &AndroidSignalOperation::handleTimeout);
-}
-
-AndroidSignalOperation::~AndroidSignalOperation() = default;
-
-bool AndroidSignalOperation::handleCrashMessage()
-{
- if (m_adbProcess->exitStatus() == QProcess::NormalExit)
- return false;
- m_errorMessage = QLatin1String(" adb process exit code: ") + QString::number(m_adbProcess->exitCode());
- const QString adbError = m_adbProcess->errorString();
- if (!adbError.isEmpty())
- m_errorMessage += QLatin1String(" adb process error: ") + adbError;
- return true;
-}
-
-void AndroidSignalOperation::adbFindRunAsFinished()
-{
- QTC_ASSERT(m_state == RunAs, return);
- m_timeout->stop();
-
- handleCrashMessage();
- const QString runAs = QString::fromLatin1(m_adbProcess->readAllRawStandardOutput());
- m_adbProcess.release()->deleteLater();
- if (runAs.isEmpty() || !m_errorMessage.isEmpty()) {
- m_errorMessage.prepend(QLatin1String("Cannot find User for process: ")
- + QString::number(m_pid));
- m_state = Idle;
- emit finished(m_errorMessage);
- } else {
- startAdbProcess(Kill, {m_adbPath, {"shell", "run-as", runAs, "kill",
- QString("-%1").arg(m_signal), QString::number(m_pid)}},
- [this] { adbKillFinished(); });
- }
-}
-
-void AndroidSignalOperation::adbKillFinished()
-{
- QTC_ASSERT(m_state == Kill, return);
- m_timeout->stop();
-
- if (!handleCrashMessage())
- m_errorMessage = QString::fromLatin1(m_adbProcess->readAllRawStandardError());
- m_adbProcess.release()->deleteLater();
- if (!m_errorMessage.isEmpty())
- m_errorMessage.prepend(QLatin1String("Cannot kill process: ") + QString::number(m_pid));
- m_state = Idle;
- emit finished(m_errorMessage);
-}
-
-void AndroidSignalOperation::handleTimeout()
-{
- m_adbProcess.reset();
- m_timeout->stop();
- m_state = Idle;
- m_errorMessage = QLatin1String("adb process timed out");
- emit finished(m_errorMessage);
-}
+AndroidSignalOperation::AndroidSignalOperation() = default;
void AndroidSignalOperation::signalOperationViaADB(qint64 pid, int signal)
{
- QTC_ASSERT(m_state == Idle, return);
- m_pid = pid;
- m_signal = signal;
- startAdbProcess(RunAs, {m_adbPath, {"shell", "cat", QString("/proc/%1/cmdline").arg(m_pid)}},
- [this] { adbFindRunAsFinished(); });
-}
+ struct InternalStorage {
+ FilePath adbPath;
+ QString runAs = {};
+ QString errorMessage = {};
+ };
-void AndroidSignalOperation::startAdbProcess(State state, const Utils::CommandLine &commandLine,
- FinishHandler handler)
-{
- m_state = state;
- m_timeout->start();
- m_adbProcess.reset(new Process);
- connect(m_adbProcess.get(), &Process::done, this, handler);
- m_adbProcess->setCommand(commandLine);
- m_adbProcess->start();
+ const Storage storage({AndroidConfig::adbToolPath()});
+
+ const auto onCatSetup = [storage, pid](Process &process) {
+ process.setCommand({storage->adbPath, {"shell", "cat", QString("/proc/%1/cmdline").arg(pid)}});
+ };
+ const auto onCatDone = [storage, pid](const Process &process, DoneWith result) {
+ if (result == DoneWith::Success) {
+ storage->runAs = process.stdOut();
+ if (!storage->runAs.isEmpty())
+ return true;
+ storage->errorMessage = QLatin1String("Cannot find User for process: ")
+ + QString::number(pid);
+ } else if (result == DoneWith::Error) {
+ storage->errorMessage = QLatin1String(" adb process exit code: ")
+ + QString::number(process.exitCode());
+ const QString adbError = process.errorString();
+ if (!adbError.isEmpty())
+ storage->errorMessage += QLatin1String(" adb process error: ") + adbError;
+ } else {
+ storage->errorMessage = QLatin1String("adb process timed out");
+ }
+ return false;
+ };
+
+ const auto onKillSetup = [storage, pid, signal](Process &process) {
+ process.setCommand({storage->adbPath, {"shell", "run-as", storage->runAs, "kill",
+ QString("-%1").arg(signal), QString::number(pid)}});
+ };
+ const auto onKillDone = [storage, pid](const Process &process, DoneWith result) {
+ if (result == DoneWith::Error) {
+ storage->errorMessage = QLatin1String("Cannot kill process: ") + QString::number(pid)
+ + process.stdErr();
+ } else if (result == DoneWith::Cancel) {
+ storage->errorMessage = QLatin1String("adb process timed out");
+ }
+ };
+
+ const auto onDone = [this, storage] { emit finished(storage->errorMessage); };
+
+ const Group recipe {
+ ProcessTask(onCatSetup, onCatDone).withTimeout(5s),
+ ProcessTask(onKillSetup, onKillDone).withTimeout(5s),
+ onGroupDone(onDone)
+ };
+ m_taskTreeRunner.start(recipe);
}
void AndroidSignalOperation::killProcess(qint64 pid)
@@ -114,5 +88,4 @@ void AndroidSignalOperation::interruptProcess(qint64 pid)
signalOperationViaADB(pid, 2);
}
-} // Internal
-} // Android
+} // namespace Android::Internal
diff --git a/src/plugins/android/androidsignaloperation.h b/src/plugins/android/androidsignaloperation.h
index 53c1d61a899..6387bd77fe3 100644
--- a/src/plugins/android/androidsignaloperation.h
+++ b/src/plugins/android/androidsignaloperation.h
@@ -5,16 +5,13 @@
#include
-#include
-#include
+#include
-namespace Android {
-namespace Internal {
+namespace Android::Internal {
class AndroidSignalOperation : public ProjectExplorer::DeviceProcessSignalOperation
{
public:
- ~AndroidSignalOperation() override;
void killProcess(qint64 pid) override;
void killProcess(const QString &filePath) override;
void interruptProcess(qint64 pid) override;
@@ -23,32 +20,11 @@ protected:
explicit AndroidSignalOperation();
private:
- enum State {
- Idle,
- RunAs,
- Kill
- };
-
- using FinishHandler = std::function;
-
- bool handleCrashMessage();
- void adbFindRunAsFinished();
- void adbKillFinished();
- void handleTimeout();
-
void signalOperationViaADB(qint64 pid, int signal);
- void startAdbProcess(State state, const Utils::CommandLine &commandLine, FinishHandler handler);
- Utils::FilePath m_adbPath;
- std::unique_ptr m_adbProcess;
- QTimer *m_timeout;
-
- State m_state = Idle;
- qint64 m_pid = 0;
- int m_signal = 0;
+ Tasking::TaskTreeRunner m_taskTreeRunner;
friend class AndroidDevice;
};
-} // namespace Internal
-} // namespace Android
+} // namespace Android::Internal
diff --git a/src/plugins/appstatisticsmonitor/idataprovider.cpp b/src/plugins/appstatisticsmonitor/idataprovider.cpp
index 23d443c76e2..0d5d8a2fe8c 100644
--- a/src/plugins/appstatisticsmonitor/idataprovider.cpp
+++ b/src/plugins/appstatisticsmonitor/idataprovider.cpp
@@ -329,14 +329,36 @@ private:
};
#endif
+// ------------------------- NullDataProvider --------------------------------
+
+class NullDataProvider : public IDataProvider
+{
+public:
+ NullDataProvider(qint64 pid, QObject *parent = nullptr)
+ : IDataProvider(pid, parent)
+ {}
+
+ double getCpuConsumption()
+ {
+ return 0.0;
+ }
+
+ double getMemoryConsumption()
+ {
+ return 0.0;
+ }
+};
+
IDataProvider *createDataProvider(qint64 pid)
{
#ifdef Q_OS_WIN
return new WindowsDataProvider(pid);
#elif defined(Q_OS_MACOS)
return new MacDataProvider(pid);
-#else // Q_OS_LINUX
+#elif defined(Q_OS_LINUX)
return new LinuxDataProvider(pid);
+#else
+ return new NullDataProvider(pid);
#endif
}
diff --git a/src/plugins/autotest/qtest/datataglocatorfilter.cpp b/src/plugins/autotest/qtest/datataglocatorfilter.cpp
index e6a436666ce..54569efea43 100644
--- a/src/plugins/autotest/qtest/datataglocatorfilter.cpp
+++ b/src/plugins/autotest/qtest/datataglocatorfilter.cpp
@@ -15,34 +15,35 @@
#include
+using namespace Core;
+using namespace Tasking;
+using namespace Utils;
+
namespace Autotest::Internal {
-static void linkAcceptor(const Utils::Link &link)
+static void linkAcceptor(const Link &link)
{
if (link.hasValidTarget())
- Core::EditorManager::openEditorAt(link);
+ EditorManager::openEditorAt(link);
}
-using LinkAcceptor = std::function;
+using LinkAcceptor = std::function;
-static Core::LocatorMatcherTasks dataTagMatchers(const LinkAcceptor &acceptor)
+static LocatorMatcherTasks dataTagMatchers(const LinkAcceptor &acceptor)
{
- using namespace Tasking;
-
- Storage storage;
-
- const auto onSetup = [storage, acceptor] {
- const QString input = storage->input();
+ const auto onSetup = [acceptor] {
+ const LocatorStorage &storage = *LocatorStorage::storage();
+ const QString input = storage.input();
const TestTreeItem *qtTestRoot = theQtTestFramework().rootNode();
if (!qtTestRoot)
return;
- Core::LocatorFilterEntries entries;
+ LocatorFilterEntries entries;
qtTestRoot->forAllChildItems([&entries, &input, acceptor = acceptor](TestTreeItem *it) {
if (it->type() != TestTreeItem::TestDataTag)
return;
if (it->name().contains(input)) {
- Core::LocatorFilterEntry entry;
+ LocatorFilterEntry entry;
entry.displayName = it->data(0, Qt::DisplayRole).toString();
{
const TestTreeItem *parent = it->parentItem();
@@ -52,18 +53,18 @@ static Core::LocatorMatcherTasks dataTagMatchers(const LinkAcceptor &acceptor)
entry.displayExtra = grandParent->name() + "::" + parent->name();
}
}
- entry.linkForEditor = std::make_optional(it->data(0, LinkRole).value());
+ entry.linkForEditor = std::make_optional(it->data(0, LinkRole).value());
entry.acceptor = [link = entry.linkForEditor, acceptor = acceptor] {
if (link)
acceptor(*link);
- return Core::AcceptResult();
+ return AcceptResult();
};
entries.append(entry);
}
});
- storage->reportOutput(entries);
+ storage.reportOutput(entries);
};
- return {{Sync(onSetup), storage}};
+ return {Sync(onSetup)};
}
DataTagLocatorFilter::DataTagLocatorFilter()
@@ -79,7 +80,7 @@ DataTagLocatorFilter::DataTagLocatorFilter()
setEnabled(ProjectManager::startupProject());
}
-Core::LocatorMatcherTasks DataTagLocatorFilter::matchers()
+LocatorMatcherTasks DataTagLocatorFilter::matchers()
{
return dataTagMatchers(&linkAcceptor);
}
diff --git a/src/plugins/axivion/CMakeLists.txt b/src/plugins/axivion/CMakeLists.txt
index a08aa434284..e427a425c58 100644
--- a/src/plugins/axivion/CMakeLists.txt
+++ b/src/plugins/axivion/CMakeLists.txt
@@ -1,14 +1,13 @@
add_qtc_plugin(Axivion
PLUGIN_DEPENDS
Core Debugger ProjectExplorer TextEditor
- DEPENDS Qt::Network Qt::Widgets ExtensionSystem Utils qtkeychain
+ DEPENDS Qt::Network Qt::Widgets ExtensionSystem Utils
SOURCES
axivion.qrc
axivionperspective.cpp axivionperspective.h
axivionplugin.cpp axivionplugin.h
axivionsettings.cpp axivionsettings.h
axiviontr.h
- credentialquery.h credentialquery.cpp
dashboard/dto.cpp dashboard/dto.h
dashboard/concat.cpp dashboard/concat.h
dashboard/error.h dashboard/error.cpp
diff --git a/src/plugins/axivion/axivion.qbs b/src/plugins/axivion/axivion.qbs
index 671b292d9c5..f61fa928407 100644
--- a/src/plugins/axivion/axivion.qbs
+++ b/src/plugins/axivion/axivion.qbs
@@ -9,7 +9,6 @@ QtcPlugin {
Depends { name: "ProjectExplorer" }
Depends { name: "TextEditor" }
Depends { name: "Utils" }
- Depends { name: "qtkeychain" }
Depends { name: "Qt.widgets" }
Depends { name: "Qt.network" }
@@ -22,8 +21,6 @@ QtcPlugin {
"axivionsettings.cpp",
"axivionsettings.h",
"axiviontr.h",
- "credentialquery.cpp",
- "credentialquery.h",
"dynamiclistmodel.cpp",
"dynamiclistmodel.h",
"issueheaderview.cpp",
diff --git a/src/plugins/axivion/axivionplugin.cpp b/src/plugins/axivion/axivionplugin.cpp
index 79fe71c770f..6ec2eca29f0 100644
--- a/src/plugins/axivion/axivionplugin.cpp
+++ b/src/plugins/axivion/axivionplugin.cpp
@@ -6,10 +6,10 @@
#include "axivionperspective.h"
#include "axivionsettings.h"
#include "axiviontr.h"
-#include "credentialquery.h"
#include "dashboard/dto.h"
#include "dashboard/error.h"
+#include
#include
#include
#include
diff --git a/src/plugins/axivion/axivionsettings.cpp b/src/plugins/axivion/axivionsettings.cpp
index 9112c728497..1c15d4979d0 100644
--- a/src/plugins/axivion/axivionsettings.cpp
+++ b/src/plugins/axivion/axivionsettings.cpp
@@ -269,7 +269,7 @@ const QList AxivionSettings::validPathMappings() const
static bool hostValid(const QString &host)
{
static const QRegularExpression ip(R"(^(\d+).(\d+).(\d+).(\d+)$)");
- static const QRegularExpression dn(R"(^([a-zA-Z0-9][a-zA-Z0-9-]+\.)+[a-zA-Z0-9][a-zA-Z0-9-]+$)");
+ static const QRegularExpression dn(R"(^([a-zA-Z0-9][a-zA-Z0-9-]+\.)*[a-zA-Z0-9][a-zA-Z0-9-]+$)");
const QRegularExpressionMatch match = ip.match(host);
if (match.hasMatch()) {
for (int i = 1; i < 5; ++i) {
@@ -279,7 +279,7 @@ static bool hostValid(const QString &host)
}
return true;
}
- return (host == "localhost") || dn.match(host).hasMatch();
+ return dn.match(host).hasMatch();
}
static bool isUrlValid(const QString &in)
@@ -388,17 +388,17 @@ AxivionSettingsWidget::AxivionSettingsWidget()
auto addButton = new QPushButton(Tr::tr("Add..."), this);
m_edit = new QPushButton(Tr::tr("Edit..."), this);
m_remove = new QPushButton(Tr::tr("Remove"), this);
- Column{
- Row{
- Form{Tr::tr("Default dashboard server:"), m_dashboardServers, br},
+ Column {
+ Row {
+ Form { Tr::tr("Default dashboard server:"), m_dashboardServers, br },
st,
- Column{addButton, m_edit, st, m_remove},
+ Column { addButton, m_edit, st, m_remove },
},
Space(10),
br,
- Row{settings().highlightMarks},
- st}
- .attachTo(this);
+ Row {settings().highlightMarks },
+ st
+ }.attachTo(this);
connect(addButton, &QPushButton::clicked, this, [this] {
// add an empty item unconditionally
diff --git a/src/plugins/beautifier/beautifiertool.cpp b/src/plugins/beautifier/beautifiertool.cpp
index 2914b5c58c0..9e55cf18363 100644
--- a/src/plugins/beautifier/beautifiertool.cpp
+++ b/src/plugins/beautifier/beautifiertool.cpp
@@ -150,7 +150,7 @@ AbstractSettings::AbstractSettings(const QString &name, const QString &ending)
command.setSettingsKey("command");
command.setExpectedKind(PathChooser::ExistingCommand);
command.setCommandVersionArguments({"--version"});
- command.setPromptDialogTitle(BeautifierTool::msgCommandPromptDialogTitle("Clang Format"));
+ command.setPromptDialogTitle(BeautifierTool::msgCommandPromptDialogTitle("ClangFormat"));
command.setValidatePlaceHolder(true);
command.addOnChanged(this, [this] { m_version = {}; version(); });
diff --git a/src/plugins/beautifier/clangformat/clangformat.cpp b/src/plugins/beautifier/clangformat/clangformat.cpp
index 14c7313503f..7a250d6b94a 100644
--- a/src/plugins/beautifier/clangformat/clangformat.cpp
+++ b/src/plugins/beautifier/clangformat/clangformat.cpp
@@ -54,8 +54,8 @@ public:
: AbstractSettings(SETTINGS_NAME, ".clang-format")
{
command.setDefaultValue("clang-format");
- command.setPromptDialogTitle(BeautifierTool::msgCommandPromptDialogTitle("Clang Format"));
- command.setLabelText(Tr::tr("Clang Format command:"));
+ command.setPromptDialogTitle(BeautifierTool::msgCommandPromptDialogTitle("ClangFormat"));
+ command.setLabelText(Tr::tr("ClangFormat command:"));
usePredefinedStyle.setSettingsKey("usePredefinedStyle");
usePredefinedStyle.setDefaultValue(true);
@@ -530,7 +530,7 @@ public:
ClangFormatSettingsPage()
{
setId("ClangFormat");
- setDisplayName(Tr::tr("Clang Format"));
+ setDisplayName(Tr::tr("ClangFormat"));
setCategory(Constants::OPTION_CATEGORY);
setWidgetCreator([] { return new ClangFormatSettingsPageWidget; });
}
diff --git a/src/plugins/clangcodemodel/clangdlocatorfilters.cpp b/src/plugins/clangcodemodel/clangdlocatorfilters.cpp
index 18fd250a982..f2f66fa29e3 100644
--- a/src/plugins/clangcodemodel/clangdlocatorfilters.cpp
+++ b/src/plugins/clangcodemodel/clangdlocatorfilters.cpp
@@ -24,6 +24,7 @@ using namespace Core;
using namespace LanguageClient;
using namespace LanguageServerProtocol;
using namespace ProjectExplorer;
+using namespace Tasking;
using namespace TextEditor;
using namespace Utils;
@@ -171,31 +172,25 @@ static void filterCurrentResults(QPromise &promise, const LocatorStorage &
[](const Entry &entry) { return entry.entry; }));
}
-static LocatorMatcherTask currentDocumentMatcher()
+static ExecutableItem currentDocumentMatcher()
{
- using namespace Tasking;
-
- Storage storage;
Storage resultStorage;
- const auto onQuerySetup = [=](CurrentDocumentSymbolsRequest &request) {
- Q_UNUSED(request)
- };
const auto onQueryDone = [resultStorage](const CurrentDocumentSymbolsRequest &request) {
*resultStorage = request.currentDocumentSymbolsData();
};
- const auto onFilterSetup = [=](Async &async) {
- async.setConcurrentCallData(filterCurrentResults, *storage, *resultStorage,
+ const auto onFilterSetup = [resultStorage](Async &async) {
+ async.setConcurrentCallData(filterCurrentResults, *LocatorStorage::storage(), *resultStorage,
TextDocument::currentTextDocument()->plainText());
};
const Group root {
resultStorage,
- CurrentDocumentSymbolsRequestTask(onQuerySetup, onQueryDone, CallDoneIf::Success),
+ CurrentDocumentSymbolsRequestTask({}, onQueryDone, CallDoneIf::Success),
AsyncTask(onFilterSetup)
};
- return {root, storage};
+ return root;
}
LocatorMatcherTasks ClangdCurrentDocumentFilter::matchers()
diff --git a/src/plugins/clangformat/clangformatglobalconfigwidget.cpp b/src/plugins/clangformat/clangformatglobalconfigwidget.cpp
index 7134ecd2e37..86bca4e40d4 100644
--- a/src/plugins/clangformat/clangformatglobalconfigwidget.cpp
+++ b/src/plugins/clangformat/clangformatglobalconfigwidget.cpp
@@ -375,9 +375,11 @@ public:
private:
void slotImportClicked() final
{
- const FilePath filePath =
- FileUtils::getOpenFilePath(this, Tr::tr("Import Code Format"), {},
- Tr::tr("Clang Format (*clang-format*);;All files (*)"));
+ const FilePath filePath = FileUtils::getOpenFilePath(
+ this,
+ Tr::tr("Import Code Format"),
+ {},
+ Tr::tr("ClangFormat (*clang-format*);;All files (*)"));
if (!filePath.isEmpty()) {
QString name = QInputDialog::getText(
this,
@@ -407,7 +409,7 @@ private:
this,
Tr::tr("Export Code Format"),
FileUtils::homePath(),
- Tr::tr("Clang Format (*clang-format*);;All files (*)"));
+ Tr::tr("ClangFormat (*clang-format*);;All files (*)"));
if (!filePath.isEmpty()) {
FilePath clangFormatFile = filePathToCurrentSettings(currentPreferences);
clangFormatFile.copyFile(filePath);
diff --git a/src/plugins/cmakeprojectmanager/cmakebuildconfiguration.cpp b/src/plugins/cmakeprojectmanager/cmakebuildconfiguration.cpp
index cccc08d4b59..31d0a4bbc8d 100644
--- a/src/plugins/cmakeprojectmanager/cmakebuildconfiguration.cpp
+++ b/src/plugins/cmakeprojectmanager/cmakebuildconfiguration.cpp
@@ -1946,7 +1946,7 @@ void CMakeBuildConfiguration::setBuildPresetToBuildSteps(const ProjectExplorer::
// Leave only the first build step enabled
if (i > 0)
- cbs->setEnabled(false);
+ cbs->setStepEnabled(false);
}
}
diff --git a/src/plugins/cmakeprojectmanager/cmakekitaspect.cpp b/src/plugins/cmakeprojectmanager/cmakekitaspect.cpp
index a827190d185..2b5edbe7224 100644
--- a/src/plugins/cmakeprojectmanager/cmakekitaspect.cpp
+++ b/src/plugins/cmakeprojectmanager/cmakekitaspect.cpp
@@ -187,72 +187,31 @@ class CMakeKitAspectImpl final : public KitAspect
{
public:
CMakeKitAspectImpl(Kit *kit, const KitAspectFactory *factory)
- : KitAspect(kit, factory), m_comboBox(createSubWidget())
+ : KitAspect(kit, factory)
{
setManagingPage(Constants::Settings::TOOLS_ID);
- m_comboBox->setSizePolicy(QSizePolicy::Ignored, m_comboBox->sizePolicy().verticalPolicy());
- m_comboBox->setToolTip(factory->description());
+
const auto sortModel = new CMakeToolSortModel(this);
sortModel->setSourceModel(new CMakeToolListModel(*kit, this));
- m_comboBox->setModel(sortModel);
-
- refresh();
-
- connect(m_comboBox, &QComboBox::currentIndexChanged,
- this, &CMakeKitAspectImpl::currentCMakeToolChanged);
+ auto getter = [](const Kit &k) { return CMakeKitAspect::cmakeToolId(&k).toSetting(); };
+ auto setter = [](Kit &k, const QVariant &id) {
+ CMakeKitAspect::setCMakeTool(&k, Id::fromSetting(id));
+ };
+ auto resetModel = [](QAbstractItemModel &model) {
+ static_cast(model).reset();
+ };
+ setListAspectSpec(
+ {sortModel,
+ std::move(getter),
+ std::move(setter),
+ std::move(resetModel),
+ CMakeToolTreeItem::IdRole});
CMakeToolManager *cmakeMgr = CMakeToolManager::instance();
connect(cmakeMgr, &CMakeToolManager::cmakeAdded, this, &CMakeKitAspectImpl::refresh);
connect(cmakeMgr, &CMakeToolManager::cmakeRemoved, this, &CMakeKitAspectImpl::refresh);
connect(cmakeMgr, &CMakeToolManager::cmakeUpdated, this, &CMakeKitAspectImpl::refresh);
}
-
- ~CMakeKitAspectImpl() override
- {
- delete m_comboBox;
- }
-
-private:
- // KitAspectWidget interface
- void makeReadOnly() override { m_comboBox->setEnabled(false); }
-
- void addToInnerLayout(Layouting::Layout &builder) override
- {
- addMutableAction(m_comboBox);
- builder.addItem(m_comboBox);
- }
-
- void refresh() override
- {
- const GuardLocker locker(m_ignoreChanges);
-
- const auto sortModel = static_cast(m_comboBox->model());
- sortModel->reset();
- sortModel->sort(0);
- m_comboBox->setCurrentIndex(indexOf(CMakeKitAspect::cmakeToolId(m_kit)));
- }
-
- int indexOf(Id id)
- {
- for (int i = 0; i < m_comboBox->count(); ++i) {
- if (id == Id::fromSetting(m_comboBox->itemData(i, CMakeToolTreeItem::IdRole)))
- return i;
- }
-
- return m_comboBox->count() - 1;
- }
-
- void currentCMakeToolChanged(int index)
- {
- if (m_ignoreChanges.isLocked())
- return;
-
- const Id id = Id::fromSetting(m_comboBox->itemData(index, CMakeToolTreeItem::IdRole));
- CMakeKitAspect::setCMakeTool(m_kit, id);
- }
-
- Guard m_ignoreChanges;
- QComboBox *m_comboBox;
};
CMakeKitAspectFactory::CMakeKitAspectFactory()
@@ -434,7 +393,7 @@ private:
void refresh() override
{
- CMakeTool *const tool = CMakeKitAspect::cmakeTool(m_kit);
+ CMakeTool *const tool = CMakeKitAspect::cmakeTool(kit());
if (tool != m_currentTool)
m_currentTool = tool;
diff --git a/src/plugins/cmakeprojectmanager/cmakelocatorfilter.cpp b/src/plugins/cmakeprojectmanager/cmakelocatorfilter.cpp
index 9dc375d22c6..c3712e06979 100644
--- a/src/plugins/cmakeprojectmanager/cmakelocatorfilter.cpp
+++ b/src/plugins/cmakeprojectmanager/cmakelocatorfilter.cpp
@@ -19,6 +19,7 @@
using namespace Core;
using namespace ProjectExplorer;
+using namespace Tasking;
using namespace Utils;
namespace CMakeProjectManager::Internal {
@@ -29,12 +30,9 @@ using BuildAcceptor = std::function;
static LocatorMatcherTasks cmakeMatchers(const BuildAcceptor &acceptor)
{
- using namespace Tasking;
-
- Storage storage;
-
- const auto onSetup = [storage, acceptor] {
- const QString input = storage->input();
+ const auto onSetup = [acceptor] {
+ const LocatorStorage &storage = *LocatorStorage::storage();
+ const QString input = storage.input();
const QRegularExpression regexp
= ILocatorFilter::createRegExp(input, ILocatorFilter::caseSensitivity(input));
if (!regexp.isValid())
@@ -90,10 +88,10 @@ static LocatorMatcherTasks cmakeMatchers(const BuildAcceptor &acceptor)
}
}
}
- storage->reportOutput(
+ storage.reportOutput(
std::accumulate(std::begin(entries), std::end(entries), LocatorFilterEntries()));
};
- return {{Sync(onSetup), storage}};
+ return {Sync(onSetup)};
}
static void setupFilter(ILocatorFilter *filter)
diff --git a/src/plugins/coreplugin/CMakeLists.txt b/src/plugins/coreplugin/CMakeLists.txt
index eddbd316f37..5db7fb3362e 100644
--- a/src/plugins/coreplugin/CMakeLists.txt
+++ b/src/plugins/coreplugin/CMakeLists.txt
@@ -1,5 +1,5 @@
add_qtc_plugin(Core
- DEPENDS Qt::PrintSupport Qt::Qml Qt::Sql Qt::Gui Qt::GuiPrivate TerminalLib
+ DEPENDS Qt::PrintSupport Qt::Qml Qt::Sql Qt::Gui Qt::GuiPrivate TerminalLib qtkeychain
PUBLIC_DEPENDS Aggregation ExtensionSystem Utils
SOURCES
actionmanager/actioncontainer.cpp
@@ -29,6 +29,8 @@ add_qtc_plugin(Core
coreplugin.cpp
coreplugin.h
coreplugintr.h
+ credentialquery.cpp
+ credentialquery.h
designmode.cpp
designmode.h
dialogs/addtovcsdialog.cpp
diff --git a/src/plugins/coreplugin/actionsfilter.cpp b/src/plugins/coreplugin/actionsfilter.cpp
index 8b5f23df71f..a2b8e129866 100644
--- a/src/plugins/coreplugin/actionsfilter.cpp
+++ b/src/plugins/coreplugin/actionsfilter.cpp
@@ -24,6 +24,7 @@
#include
#include
+using namespace Tasking;
using namespace Utils;
static const char lastTriggeredC[] = "LastTriggeredActions";
@@ -174,11 +175,7 @@ static void matches(QPromise &promise, const LocatorStorage &storage,
LocatorMatcherTasks ActionsFilter::matchers()
{
- using namespace Tasking;
-
- Storage storage;
-
- const auto onSetup = [this, storage](Async &async) {
+ const auto onSetup = [this](Async &async) {
m_entries.clear();
m_indexes.clear();
QList processedMenus;
@@ -186,15 +183,16 @@ LocatorMatcherTasks ActionsFilter::matchers()
for (QAction* action : menuBarActions())
collectEntriesForAction(action, {}, processedMenus);
collectEntriesForCommands();
- if (storage->input().simplified().isEmpty()) {
- storage->reportOutput(m_entries);
+ const LocatorStorage &storage = *LocatorStorage::storage();
+ if (storage.input().simplified().isEmpty()) {
+ storage.reportOutput(m_entries);
return SetupResult::StopWithSuccess;
}
- async.setConcurrentCallData(matches, *storage, m_entries);
+ async.setConcurrentCallData(matches, storage, m_entries);
return SetupResult::Continue;
};
- return {{AsyncTask(onSetup), storage}};
+ return {AsyncTask(onSetup)};
}
LocatorFilterEntry::Acceptor ActionsFilter::acceptor(const ActionFilterEntryData &data) const
diff --git a/src/plugins/coreplugin/coreplugin.qbs b/src/plugins/coreplugin/coreplugin.qbs
index 41edaff0de7..96316a9c9df 100644
--- a/src/plugins/coreplugin/coreplugin.qbs
+++ b/src/plugins/coreplugin/coreplugin.qbs
@@ -16,6 +16,7 @@ QtcPlugin {
Depends { name: "Utils" }
Depends { name: "Aggregation" }
Depends { name: "TerminalLib" }
+ Depends { name: "qtkeychain" }
cpp.dynamicLibraries: {
if (qbs.targetOS.contains("windows"))
@@ -43,6 +44,8 @@ QtcPlugin {
"coreplugin.cpp",
"coreplugin.h",
"coreplugintr.h",
+ "credentialquery.cpp",
+ "credentialquery.h",
"designmode.cpp",
"designmode.h",
"diffservice.cpp",
diff --git a/src/plugins/axivion/credentialquery.cpp b/src/plugins/coreplugin/credentialquery.cpp
similarity index 96%
rename from src/plugins/axivion/credentialquery.cpp
rename to src/plugins/coreplugin/credentialquery.cpp
index f183c083736..92c1ddfa359 100644
--- a/src/plugins/axivion/credentialquery.cpp
+++ b/src/plugins/coreplugin/credentialquery.cpp
@@ -8,7 +8,7 @@
using namespace QKeychain;
using namespace Tasking;
-namespace Axivion::Internal {
+namespace Core {
CredentialQueryTaskAdapter::~CredentialQueryTaskAdapter() = default;
@@ -51,4 +51,4 @@ void CredentialQueryTaskAdapter::start()
job->start();
}
-} // Axivion::Internal
+} // Core
diff --git a/src/plugins/axivion/credentialquery.h b/src/plugins/coreplugin/credentialquery.h
similarity index 86%
rename from src/plugins/axivion/credentialquery.h
rename to src/plugins/coreplugin/credentialquery.h
index d8a958ab53e..22ec24921f5 100644
--- a/src/plugins/axivion/credentialquery.h
+++ b/src/plugins/coreplugin/credentialquery.h
@@ -3,13 +3,15 @@
#pragma once
+#include "core_global.h"
+
#include
-namespace Axivion::Internal {
+namespace Core {
enum class CredentialOperation { Get, Set, Delete };
-class CredentialQuery
+class CORE_EXPORT CredentialQuery
{
public:
void setOperation(CredentialOperation operation) { m_operation = operation; }
@@ -30,7 +32,7 @@ private:
friend class CredentialQueryTaskAdapter;
};
-class CredentialQueryTaskAdapter final : public Tasking::TaskAdapter
+class CORE_EXPORT CredentialQueryTaskAdapter final : public Tasking::TaskAdapter
{
private:
~CredentialQueryTaskAdapter();
@@ -40,4 +42,4 @@ private:
using CredentialQueryTask = Tasking::CustomTask;
-} // Axivion::Internal
+} // Core
diff --git a/src/plugins/coreplugin/dialogs/settingsdialog.cpp b/src/plugins/coreplugin/dialogs/settingsdialog.cpp
index dee9ebe6409..828f396433e 100644
--- a/src/plugins/coreplugin/dialogs/settingsdialog.cpp
+++ b/src/plugins/coreplugin/dialogs/settingsdialog.cpp
@@ -42,8 +42,8 @@
#include
-const int kInitialWidth = 750;
-const int kInitialHeight = 450;
+const int kInitialWidth = 800;
+const int kInitialHeight = 500;
const int kMaxMinimumWidth = 250;
const int kMaxMinimumHeight = 250;
diff --git a/src/plugins/coreplugin/fileutils.cpp b/src/plugins/coreplugin/fileutils.cpp
index b5f719f4a22..1b6af89db22 100644
--- a/src/plugins/coreplugin/fileutils.cpp
+++ b/src/plugins/coreplugin/fileutils.cpp
@@ -187,7 +187,7 @@ bool FileUtils::renameFile(const FilePath &orgFilePath, const FilePath &newFileP
if (vc && vc->supportsOperation(IVersionControl::MoveOperation))
result = vc->vcsMove(orgFilePath, newFilePath);
if (!result) // The moving via vcs failed or the vcs does not support moving, fall back
- result = orgFilePath.renameFile(newFilePath).has_value();
+ result = bool(orgFilePath.renameFile(newFilePath));
if (result) {
DocumentManager::renamedFile(orgFilePath, newFilePath);
updateHeaderFileGuardIfApplicable(orgFilePath, newFilePath, handleGuards);
diff --git a/src/plugins/coreplugin/locator/commandlocator.cpp b/src/plugins/coreplugin/locator/commandlocator.cpp
index 2d997dd020a..a1c8bcbc7fb 100644
--- a/src/plugins/coreplugin/locator/commandlocator.cpp
+++ b/src/plugins/coreplugin/locator/commandlocator.cpp
@@ -10,6 +10,7 @@
#include
#include
+using namespace Tasking;
using namespace Utils;
namespace Core {
@@ -25,12 +26,9 @@ CommandLocator::CommandLocator(Id id, const QString &displayName, const QString
LocatorMatcherTasks CommandLocator::matchers()
{
- using namespace Tasking;
-
- Storage storage;
-
- const auto onSetup = [storage, commands = m_commands] {
- const QString input = storage->input();
+ const auto onSetup = [commands = m_commands] {
+ const LocatorStorage &storage = *LocatorStorage::storage();
+ const QString input = storage.input();
const Qt::CaseSensitivity inputCaseSensitivity = caseSensitivity(input);
LocatorFilterEntries goodEntries;
LocatorFilterEntries betterEntries;
@@ -63,9 +61,9 @@ LocatorMatcherTasks CommandLocator::matchers()
goodEntries.append(entry);
}
}
- storage->reportOutput(betterEntries + goodEntries);
+ storage.reportOutput(betterEntries + goodEntries);
};
- return {{Sync(onSetup), storage}};
+ return {Sync(onSetup)};
}
} // namespace Core
diff --git a/src/plugins/coreplugin/locator/executefilter.cpp b/src/plugins/coreplugin/locator/executefilter.cpp
index 629099207ed..5feeae26592 100644
--- a/src/plugins/coreplugin/locator/executefilter.cpp
+++ b/src/plugins/coreplugin/locator/executefilter.cpp
@@ -18,6 +18,7 @@
#include
#include
+using namespace Tasking;
using namespace Utils;
namespace Core::Internal {
@@ -40,12 +41,9 @@ ExecuteFilter::~ExecuteFilter()
LocatorMatcherTasks ExecuteFilter::matchers()
{
- using namespace Tasking;
-
- Storage storage;
-
- const auto onSetup = [this, storage] {
- const QString input = storage->input();
+ const auto onSetup = [this] {
+ const LocatorStorage &storage = *LocatorStorage::storage();
+ const QString input = storage.input();
LocatorFilterEntries entries;
if (!input.isEmpty()) { // avoid empty entry
LocatorFilterEntry entry;
@@ -69,9 +67,9 @@ LocatorMatcherTasks ExecuteFilter::matchers()
others.append(entry);
}
}
- storage->reportOutput(entries + others);
+ storage.reportOutput(entries + others);
};
- return {{Sync(onSetup), storage}};
+ return {Sync(onSetup)};
}
void ExecuteFilter::acceptCommand(const QString &cmd)
diff --git a/src/plugins/coreplugin/locator/externaltoolsfilter.cpp b/src/plugins/coreplugin/locator/externaltoolsfilter.cpp
index 86811e55b0b..1389c9169bb 100644
--- a/src/plugins/coreplugin/locator/externaltoolsfilter.cpp
+++ b/src/plugins/coreplugin/locator/externaltoolsfilter.cpp
@@ -13,6 +13,8 @@
#include
+using namespace Tasking;
+
namespace Core::Internal {
ExternalToolsFilter::ExternalToolsFilter()
@@ -27,12 +29,9 @@ ExternalToolsFilter::ExternalToolsFilter()
LocatorMatcherTasks ExternalToolsFilter::matchers()
{
- using namespace Tasking;
-
- Storage storage;
-
- const auto onSetup = [storage] {
- const QString input = storage->input();
+ const auto onSetup = [] {
+ const LocatorStorage &storage = *LocatorStorage::storage();
+ const QString input = storage.input();
LocatorFilterEntries bestEntries;
LocatorFilterEntries betterEntries;
@@ -77,10 +76,10 @@ LocatorMatcherTasks ExternalToolsFilter::matchers()
return AcceptResult();
};
- storage->reportOutput(bestEntries + betterEntries + goodEntries
- + LocatorFilterEntries{configEntry});
+ storage.reportOutput(bestEntries + betterEntries + goodEntries
+ + LocatorFilterEntries{configEntry});
};
- return {{Sync(onSetup), storage}};
+ return {Sync(onSetup)};
}
} // Core::Internal
diff --git a/src/plugins/coreplugin/locator/filesystemfilter.cpp b/src/plugins/coreplugin/locator/filesystemfilter.cpp
index 6b484635e40..2bc451dcf70 100644
--- a/src/plugins/coreplugin/locator/filesystemfilter.cpp
+++ b/src/plugins/coreplugin/locator/filesystemfilter.cpp
@@ -31,6 +31,7 @@
#include
#include
+using namespace Tasking;
using namespace Utils;
namespace Core::Internal {
@@ -304,17 +305,13 @@ static void matches(QPromise &promise, const LocatorStorage &storage,
LocatorMatcherTasks FileSystemFilter::matchers()
{
- using namespace Tasking;
-
- Storage storage;
-
- const auto onSetup = [storage, includeHidden = m_includeHidden, shortcut = shortcutString()]
+ const auto onSetup = [includeHidden = m_includeHidden, shortcut = shortcutString()]
(Async &async) {
- async.setConcurrentCallData(matches, *storage, shortcut,
+ async.setConcurrentCallData(matches, *LocatorStorage::storage(), shortcut,
DocumentManager::fileDialogInitialDirectory(), includeHidden);
};
- return {{AsyncTask(onSetup), storage}};
+ return {AsyncTask(onSetup)};
}
class FileSystemFilterOptions : public QDialog
diff --git a/src/plugins/coreplugin/locator/ilocatorfilter.cpp b/src/plugins/coreplugin/locator/ilocatorfilter.cpp
index 371a679d030..ee5e88451e7 100644
--- a/src/plugins/coreplugin/locator/ilocatorfilter.cpp
+++ b/src/plugins/coreplugin/locator/ilocatorfilter.cpp
@@ -291,6 +291,14 @@ void LocatorStorage::reportOutput(const LocatorFilterEntries &outputData) const
d->reportOutput(outputData);
}
+// Please note the thread_local keyword below guarantees a separate instance per thread.
+static thread_local Storage s_locatorStorage = {};
+
+Storage &LocatorStorage::storage()
+{
+ return s_locatorStorage;
+}
+
void LocatorStorage::finalize() const
{
QTC_ASSERT(d, return);
@@ -366,16 +374,16 @@ void LocatorMatcher::start()
const auto onTaskTreeSetup = [iterator, input = d->m_input, collectorStorage](TaskTree &taskTree) {
const std::shared_ptr deduplicator = collectorStorage->m_deduplicator;
- const Storage storage = iterator->storage;
- const auto onSetup = [storage, input, index = iterator.iteration(), deduplicator] {
- *storage = std::make_shared(input, index, deduplicator);
+ const auto onSetup = [input, index = iterator.iteration(), deduplicator] {
+ *LocatorStorage::storage()
+ = std::make_shared(input, index, deduplicator);
};
taskTree.setRecipe({
finishAllAndSuccess,
- storage,
+ LocatorStorage::storage(),
onGroupSetup(onSetup),
- iterator->task,
- onGroupDone([storage] { storage->finalize(); })
+ *iterator,
+ onGroupDone([] { LocatorStorage::storage()->finalize(); })
});
};
@@ -1357,12 +1365,11 @@ static void filter(QPromise &promise, const LocatorStor
When this cache started a new search in meantime, the cache was invalidated or even deleted,
the update of the cache after a successful run of the task is ignored.
*/
-LocatorMatcherTask LocatorFileCache::matcher() const
+ExecutableItem LocatorFileCache::matcher() const
{
- Storage storage;
std::weak_ptr weak = d;
- const auto onSetup = [storage, weak](Async &async) {
+ const auto onSetup = [weak](Async &async) {
auto that = weak.lock();
if (!that) // LocatorMatcher is running after *this LocatorFileCache was destructed.
return SetupResult::StopWithSuccess;
@@ -1372,7 +1379,7 @@ LocatorMatcherTask LocatorFileCache::matcher() const
// no provider is set or it returned empty generator
that->bumpExecutionId();
- async.setConcurrentCallData(&filter, *storage, *that);
+ async.setConcurrentCallData(&filter, *LocatorStorage::storage(), *that);
return SetupResult::Continue;
};
const auto onDone = [weak](const Async &async) {
@@ -1392,7 +1399,7 @@ LocatorMatcherTask LocatorFileCache::matcher() const
that->update(async.result());
};
- return {AsyncTask(onSetup, onDone, CallDoneIf::Success), storage};
+ return AsyncTask(onSetup, onDone, CallDoneIf::Success);
}
} // Core
diff --git a/src/plugins/coreplugin/locator/ilocatorfilter.h b/src/plugins/coreplugin/locator/ilocatorfilter.h
index 368f0313814..399631873c7 100644
--- a/src/plugins/coreplugin/locator/ilocatorfilter.h
+++ b/src/plugins/coreplugin/locator/ilocatorfilter.h
@@ -126,6 +126,8 @@ public:
LocatorStorage() = default;
QString input() const;
void reportOutput(const LocatorFilterEntries &outputData) const;
+ // Only use it from inside the bodies of Task handlers.
+ static Tasking::Storage &storage();
private:
friend class LocatorMatcher;
@@ -134,18 +136,7 @@ private:
std::shared_ptr d;
};
-class CORE_EXPORT LocatorMatcherTask final
-{
-public:
- // The main task. Initial data (searchTerm) should be taken from storage.input().
- // Results reporting is done via the storage.reportOutput().
- Tasking::GroupItem task = Tasking::Group{};
-
- // When constructing the task, don't place the storage inside the task above.
- Tasking::Storage storage;
-};
-
-using LocatorMatcherTasks = QList;
+using LocatorMatcherTasks = QList;
using LocatorMatcherTaskCreator = std::function;
class LocatorMatcherPrivate;
@@ -315,7 +306,7 @@ public:
std::optional filePaths() const;
static FilePathsGenerator filePathsGenerator(const Utils::FilePaths &filePaths);
- LocatorMatcherTask matcher() const;
+ Tasking::ExecutableItem matcher() const;
using MatchedEntries = std::array;
static Utils::FilePaths processFilePaths(const QFuture &future,
diff --git a/src/plugins/coreplugin/locator/javascriptfilter.cpp b/src/plugins/coreplugin/locator/javascriptfilter.cpp
index c63271bb8df..c4c174d7822 100644
--- a/src/plugins/coreplugin/locator/javascriptfilter.cpp
+++ b/src/plugins/coreplugin/locator/javascriptfilter.cpp
@@ -366,15 +366,15 @@ JavaScriptFilter::~JavaScriptFilter() = default;
LocatorMatcherTasks JavaScriptFilter::matchers()
{
- Storage storage;
if (!m_javaScriptEngine)
m_javaScriptEngine.reset(new JavaScriptEngine);
QPointer engine = m_javaScriptEngine.get();
- const auto onSetup = [storage, engine] {
+ const auto onSetup = [engine] {
+ const LocatorStorage &storage = *LocatorStorage::storage();
if (!engine)
return SetupResult::StopWithError;
- if (storage->input().trimmed().isEmpty()) {
+ if (storage.input().trimmed().isEmpty()) {
LocatorFilterEntry entry;
entry.displayName = Tr::tr("Reset Engine");
entry.acceptor = [engine] {
@@ -385,21 +385,22 @@ LocatorMatcherTasks JavaScriptFilter::matchers()
}
return AcceptResult();
};
- storage->reportOutput({entry});
+ storage.reportOutput({entry});
return SetupResult::StopWithSuccess;
}
return SetupResult::Continue;
};
- const auto onJavaScriptSetup = [storage, engine](JavaScriptRequest &request) {
+ const auto onJavaScriptSetup = [engine](JavaScriptRequest &request) {
request.setEngine(engine);
- request.setEvaluateData(storage->input());
+ request.setEvaluateData(LocatorStorage::storage()->input());
};
- const auto onJavaScriptDone = [storage](const JavaScriptRequest &request, DoneWith result) {
+ const auto onJavaScriptDone = [](const JavaScriptRequest &request, DoneWith result) {
+ const LocatorStorage &storage = *LocatorStorage::storage();
if (result != DoneWith::Success) {
LocatorFilterEntry entry;
entry.displayName = request.output().m_output;
- storage->reportOutput({entry});
+ storage.reportOutput({entry});
return;
}
const auto acceptor = [](const QString &clipboardContents) {
@@ -408,7 +409,7 @@ LocatorMatcherTasks JavaScriptFilter::matchers()
return AcceptResult();
};
};
- const QString input = storage->input();
+ const QString input = storage.input();
const QString output = request.output().m_output;
const QString expression = input + " = " + output;
@@ -423,7 +424,7 @@ LocatorMatcherTasks JavaScriptFilter::matchers()
copyExpressionEntry.displayName = Tr::tr("Copy to clipboard: %1").arg(expression);
copyExpressionEntry.acceptor = acceptor(expression);
- storage->reportOutput({entry, copyResultEntry, copyExpressionEntry});
+ storage.reportOutput({entry, copyResultEntry, copyExpressionEntry});
};
const Group root {
@@ -431,7 +432,7 @@ LocatorMatcherTasks JavaScriptFilter::matchers()
JavaScriptRequestTask(onJavaScriptSetup, onJavaScriptDone)
};
- return {{root, storage}};
+ return {root};
}
} // namespace Core::Internal
diff --git a/src/plugins/coreplugin/locator/locatorfiltersfilter.cpp b/src/plugins/coreplugin/locator/locatorfiltersfilter.cpp
index fa44d967e67..ee24a262438 100644
--- a/src/plugins/coreplugin/locator/locatorfiltersfilter.cpp
+++ b/src/plugins/coreplugin/locator/locatorfiltersfilter.cpp
@@ -9,6 +9,7 @@
#include
+using namespace Tasking;
using namespace Utils;
namespace Core::Internal {
@@ -26,12 +27,9 @@ LocatorFiltersFilter::LocatorFiltersFilter():
LocatorMatcherTasks LocatorFiltersFilter::matchers()
{
- using namespace Tasking;
-
- Storage storage;
-
- const auto onSetup = [storage, icon = m_icon] {
- if (!storage->input().isEmpty())
+ const auto onSetup = [icon = m_icon] {
+ const LocatorStorage &storage = *LocatorStorage::storage();
+ if (!storage.input().isEmpty())
return;
QMap uniqueFilters;
@@ -60,9 +58,9 @@ LocatorMatcherTasks LocatorFiltersFilter::matchers()
entries.append(entry);
}
}
- storage->reportOutput(entries);
+ storage.reportOutput(entries);
};
- return {{Sync(onSetup), storage}};
+ return {Sync(onSetup)};
}
} // Core::Internal
diff --git a/src/plugins/coreplugin/locator/opendocumentsfilter.cpp b/src/plugins/coreplugin/locator/opendocumentsfilter.cpp
index ede24d5b892..b080894fcb2 100644
--- a/src/plugins/coreplugin/locator/opendocumentsfilter.cpp
+++ b/src/plugins/coreplugin/locator/opendocumentsfilter.cpp
@@ -70,15 +70,13 @@ static void matchEditors(QPromise &promise, const LocatorStorage &storage,
LocatorMatcherTasks OpenDocumentsFilter::matchers()
{
- Storage storage;
-
- const auto onSetup = [storage](Async &async) {
+ const auto onSetup = [](Async &async) {
const QList editorsData = Utils::transform(DocumentModel::entries(),
[](const DocumentModel::Entry *e) { return Entry{e->filePath(), e->displayName()}; });
- async.setConcurrentCallData(matchEditors, *storage, editorsData);
+ async.setConcurrentCallData(matchEditors, *LocatorStorage::storage(), editorsData);
};
- return {{AsyncTask(onSetup), storage}};
+ return {AsyncTask(onSetup)};
}
} // namespace Core::Internal
diff --git a/src/plugins/coreplugin/locator/spotlightlocatorfilter.cpp b/src/plugins/coreplugin/locator/spotlightlocatorfilter.cpp
index bcc685c9532..78fdf895fcf 100644
--- a/src/plugins/coreplugin/locator/spotlightlocatorfilter.cpp
+++ b/src/plugins/coreplugin/locator/spotlightlocatorfilter.cpp
@@ -24,6 +24,7 @@
#include
#include
+using namespace Tasking;
using namespace Utils;
namespace Core::Internal {
@@ -176,16 +177,12 @@ static void matches(QPromise &promise,
LocatorMatcherTasks SpotlightLocatorFilter::matchers()
{
- using namespace Tasking;
-
- Storage storage;
-
- const auto onSetup = [storage,
- command = m_command,
+ const auto onSetup = [command = m_command,
insensArgs = m_arguments,
sensArgs = m_caseSensitiveArguments,
sortResults = m_sortResults](Async &async) {
- const Link link = Link::fromString(storage->input(), true);
+ const LocatorStorage &storage = *LocatorStorage::storage();
+ const Link link = Link::fromString(storage.input(), true);
const FilePath input = link.targetFilePath;
if (input.isEmpty())
return SetupResult::StopWithSuccess;
@@ -196,11 +193,11 @@ LocatorMatcherTasks SpotlightLocatorFilter::matchers()
? insensArgs : sensArgs;
const CommandLine cmd(FilePath::fromString(command), expander->expand(args),
CommandLine::Raw);
- async.setConcurrentCallData(matches, *storage, cmd, sortResults);
+ async.setConcurrentCallData(matches, storage, cmd, sortResults);
return SetupResult::Continue;
};
- return {{AsyncTask(onSetup), storage}};
+ return {AsyncTask(onSetup)};
}
bool SpotlightLocatorFilter::openConfigDialog(QWidget *parent, bool &needsRefresh)
diff --git a/src/plugins/coreplugin/locator/urllocatorfilter.cpp b/src/plugins/coreplugin/locator/urllocatorfilter.cpp
index 7457f0907cc..d96b6411ed6 100644
--- a/src/plugins/coreplugin/locator/urllocatorfilter.cpp
+++ b/src/plugins/coreplugin/locator/urllocatorfilter.cpp
@@ -18,6 +18,7 @@
#include
#include
+using namespace Tasking;
using namespace Utils;
namespace Core {
@@ -163,12 +164,9 @@ UrlLocatorFilter::UrlLocatorFilter(const QString &displayName, Id id)
LocatorMatcherTasks UrlLocatorFilter::matchers()
{
- using namespace Tasking;
-
- Storage storage;
-
- const auto onSetup = [storage, urls = remoteUrls()] {
- const QString input = storage->input();
+ const auto onSetup = [urls = remoteUrls()] {
+ const LocatorStorage &storage = *LocatorStorage::storage();
+ const QString input = storage.input();
LocatorFilterEntries entries;
for (const QString &url : urls) {
const QString name = url.arg(input);
@@ -182,9 +180,9 @@ LocatorMatcherTasks UrlLocatorFilter::matchers()
entry.highlightInfo = {int(name.lastIndexOf(input)), int(input.length())};
entries.append(entry);
}
- storage->reportOutput(entries);
+ storage.reportOutput(entries);
};
- return {{Sync(onSetup), storage}};
+ return {Sync(onSetup)};
}
const char kDisplayNameKey[] = "displayName";
diff --git a/src/plugins/coreplugin/session.cpp b/src/plugins/coreplugin/session.cpp
index 5fa186e3e24..88e4749b51f 100644
--- a/src/plugins/coreplugin/session.cpp
+++ b/src/plugins/coreplugin/session.cpp
@@ -351,9 +351,9 @@ bool SessionManager::deleteSession(const QString &session)
FilePath sessionFile = sessionNameToFileName(session);
if (!sessionFile.exists())
return false;
- expected_str result = sessionFile.removeFile();
+ Result result = sessionFile.removeFile();
QTC_CHECK_EXPECTED(result);
- return result.has_value();
+ return bool(result);
}
void SessionManager::deleteSessions(const QStringList &sessions)
diff --git a/src/plugins/cppeditor/cpplocatorfilter.cpp b/src/plugins/cppeditor/cpplocatorfilter.cpp
index 7526d3dc9f9..b1e7c552e0a 100644
--- a/src/plugins/cppeditor/cpplocatorfilter.cpp
+++ b/src/plugins/cppeditor/cpplocatorfilter.cpp
@@ -19,13 +19,14 @@
using namespace Core;
using namespace CPlusPlus;
+using namespace Tasking;
using namespace Utils;
namespace CppEditor {
using EntryFromIndex = std::function;
-void matchesFor(QPromise &promise, const LocatorStorage &storage,
+static void matchesFor(QPromise &promise, const LocatorStorage &storage,
IndexItem::ItemType wantedType, const EntryFromIndex &converter)
{
const QString input = storage.input();
@@ -99,19 +100,15 @@ void matchesFor(QPromise &promise, const LocatorStorage &storage,
LocatorFilterEntries()));
}
-LocatorMatcherTask locatorMatcher(IndexItem::ItemType type, const EntryFromIndex &converter)
+static ExecutableItem locatorMatcher(IndexItem::ItemType type, const EntryFromIndex &converter)
{
- using namespace Tasking;
-
- Storage storage;
-
- const auto onSetup = [=](Async &async) {
- async.setConcurrentCallData(matchesFor, *storage, type, converter);
+ const auto onSetup = [type, converter](Async &async) {
+ async.setConcurrentCallData(matchesFor, *LocatorStorage::storage(), type, converter);
};
- return {AsyncTask(onSetup), storage};
+ return AsyncTask(onSetup);
}
-LocatorMatcherTask allSymbolsMatcher()
+static ExecutableItem allSymbolsMatcher()
{
const auto converter = [](const IndexItem::Ptr &info) {
LocatorFilterEntry filterEntry;
@@ -129,7 +126,7 @@ LocatorMatcherTask allSymbolsMatcher()
return locatorMatcher(IndexItem::All, converter);
}
-LocatorMatcherTask classMatcher()
+static ExecutableItem classMatcher()
{
const auto converter = [](const IndexItem::Ptr &info) {
LocatorFilterEntry filterEntry;
@@ -145,7 +142,7 @@ LocatorMatcherTask classMatcher()
return locatorMatcher(IndexItem::Class, converter);
}
-LocatorMatcherTask functionMatcher()
+static ExecutableItem functionMatcher()
{
const auto converter = [](const IndexItem::Ptr &info) {
QString name = info->symbolName();
@@ -166,7 +163,7 @@ LocatorMatcherTask functionMatcher()
return locatorMatcher(IndexItem::Function, converter);
}
-QList itemsOfCurrentDocument(const FilePath ¤tFileName)
+static QList itemsOfCurrentDocument(const FilePath ¤tFileName)
{
if (currentFileName.isEmpty())
return {};
@@ -188,7 +185,7 @@ QList itemsOfCurrentDocument(const FilePath ¤tFileName)
return results;
}
-LocatorFilterEntry::HighlightInfo highlightInfo(const QRegularExpressionMatch &match,
+static LocatorFilterEntry::HighlightInfo highlightInfo(const QRegularExpressionMatch &match,
LocatorFilterEntry::HighlightInfo::DataType dataType)
{
const FuzzyMatcher::HighlightingPositions positions =
@@ -197,7 +194,7 @@ LocatorFilterEntry::HighlightInfo highlightInfo(const QRegularExpressionMatch &m
return LocatorFilterEntry::HighlightInfo(positions.starts, positions.lengths, dataType);
}
-void matchesForCurrentDocument(QPromise &promise, const LocatorStorage &storage,
+static void matchesForCurrentDocument(QPromise &promise, const LocatorStorage &storage,
const FilePath ¤tFileName)
{
const QString input = storage.input();
@@ -290,25 +287,21 @@ void matchesForCurrentDocument(QPromise &promise, const LocatorStorage &st
[](const Entry &entry) { return entry.entry; }));
}
-FilePath currentFileName()
+static FilePath currentFileName()
{
IEditor *currentEditor = EditorManager::currentEditor();
return currentEditor ? currentEditor->document()->filePath() : FilePath();
}
-LocatorMatcherTask currentDocumentMatcher()
+static ExecutableItem currentDocumentMatcher()
{
- using namespace Tasking;
-
- Storage storage;
-
- const auto onSetup = [=](Async &async) {
- async.setConcurrentCallData(matchesForCurrentDocument, *storage, currentFileName());
+ const auto onSetup = [](Async &async) {
+ async.setConcurrentCallData(matchesForCurrentDocument, *LocatorStorage::storage(), currentFileName());
};
- return {AsyncTask(onSetup), storage};
+ return AsyncTask(onSetup);
}
-using MatcherCreator = std::function;
+using MatcherCreator = std::function;
static MatcherCreator creatorForType(MatcherType type)
{
diff --git a/src/plugins/cppeditor/cpplocatorfilter_test.cpp b/src/plugins/cppeditor/cpplocatorfilter_test.cpp
index a621d1c1103..ffb9eaa24f3 100644
--- a/src/plugins/cppeditor/cpplocatorfilter_test.cpp
+++ b/src/plugins/cppeditor/cpplocatorfilter_test.cpp
@@ -28,7 +28,7 @@ QTC_DECLARE_MYTESTDATADIR("../../../tests/cpplocators/")
class CppLocatorFilterTestCase : public CppEditor::Tests::TestCase
{
public:
- CppLocatorFilterTestCase(const QList &matchers,
+ CppLocatorFilterTestCase(const LocatorMatcherTasks &matchers,
const QString &fileName,
const QString &searchText,
const ResultDataList &expectedResults)
@@ -54,7 +54,7 @@ class CppCurrentDocumentFilterTestCase : public CppEditor::Tests::TestCase
{
public:
CppCurrentDocumentFilterTestCase(const FilePath &filePath,
- const QList &matchers,
+ const LocatorMatcherTasks &matchers,
const ResultDataList &expectedResults,
const QString &searchText = QString())
{
diff --git a/src/plugins/debugger/debuggerengine.cpp b/src/plugins/debugger/debuggerengine.cpp
index 00100592c5b..50ab3ba5d22 100644
--- a/src/plugins/debugger/debuggerengine.cpp
+++ b/src/plugins/debugger/debuggerengine.cpp
@@ -510,7 +510,7 @@ public:
QAction m_abortAction{Tr::tr("Abort Debugging")};
QAction m_stepIntoAction{Tr::tr("Step Into")};
QAction m_stepOutAction{Tr::tr("Step Out")};
- QAction m_toggleEnableBreakpointsAction{Tr::tr("Disable all Breakpoints")};
+ QAction m_toggleEnableBreakpointsAction{Tr::tr("Disable All Breakpoints")};
QAction m_runToLineAction{Tr::tr("Run to Line")}; // In the debug menu
QAction m_runToSelectedFunctionAction{Tr::tr("Run to Selected Function")};
QAction m_jumpToLineAction{Tr::tr("Jump to Line")};
diff --git a/src/plugins/debugger/debuggerkitaspect.cpp b/src/plugins/debugger/debuggerkitaspect.cpp
index e70ab1430cd..dc21b046062 100644
--- a/src/plugins/debugger/debuggerkitaspect.cpp
+++ b/src/plugins/debugger/debuggerkitaspect.cpp
@@ -20,8 +20,6 @@
#include
#include
-#include
-
#include
using namespace ProjectExplorer;
@@ -43,18 +41,6 @@ public:
, m_kit(kit)
{}
- QModelIndex indexForId(const QVariant &id) const
- {
- // The "None" item always comes last
- const auto noneIndex = [this] { return index(rowCount() - 1, 0); };
-
- if (id.isNull())
- return noneIndex();
- const TreeItem *const item = findItemAtLevel<1>(
- [id](TreeItem *item) { return item->data(0, DebuggerTreeItem::IdRole) == id; });
- return item ? indexForItem(item) : noneIndex();
- }
-
void reset()
{
clear();
@@ -83,12 +69,6 @@ class DebuggerItemSortModel : public SortModel
public:
DebuggerItemSortModel(QObject *parent) : SortModel(parent) {}
- QModelIndex indexForId(const QVariant &id) const
- {
- return mapFromSource(
- static_cast(sourceModel())->indexForId(id));
- }
-
void reset() { static_cast(sourceModel())->reset(); }
private:
@@ -135,58 +115,24 @@ public:
{
setManagingPage(ProjectExplorer::Constants::DEBUGGER_SETTINGS_PAGE_ID);
- m_comboBox = createSubWidget();
- m_comboBox->setSizePolicy(QSizePolicy::Ignored, m_comboBox->sizePolicy().verticalPolicy());
- m_comboBox->setEnabled(true);
const auto sortModel = new DebuggerItemSortModel(this);
sortModel->setSourceModel(new DebuggerItemListModel(*workingCopy, this));
- m_comboBox->setModel(sortModel);
-
- refresh();
- m_comboBox->setToolTip(factory->description());
- connect(m_comboBox, &QComboBox::currentIndexChanged, this, [this] {
- if (m_ignoreChanges.isLocked())
- return;
- m_kit->setValue(DebuggerKitAspect::id(), currentId());
- });
-
+ auto getter = [](const Kit &k) {
+ if (const DebuggerItem * const item = DebuggerKitAspect::debugger(&k))
+ return item->id();
+ return QVariant();
+ };
+ auto setter = [](Kit &k, const QVariant &id) { k.setValue(DebuggerKitAspect::id(), id); };
+ auto resetModel = [](QAbstractItemModel &model) {
+ static_cast(model).reset();
+ };
+ setListAspectSpec(
+ {sortModel,
+ std::move(getter),
+ std::move(setter),
+ std::move(resetModel),
+ DebuggerTreeItem::IdRole});
}
-
- ~DebuggerKitAspectImpl() override
- {
- delete m_comboBox;
- }
-
-private:
- void addToInnerLayout(Layouting::Layout &parent) override
- {
- addMutableAction(m_comboBox);
- parent.addItem(m_comboBox);
- }
-
- void makeReadOnly() override
- {
- KitAspect::makeReadOnly();
- m_comboBox->setEnabled(false);
- }
-
- void refresh() override
- {
- const GuardLocker locker(m_ignoreChanges);
- const auto sortModel = static_cast(m_comboBox->model());
- sortModel->reset();
- sortModel->sort(0);
- const DebuggerItem * const item = DebuggerKitAspect::debugger(m_kit);
- m_comboBox->setCurrentIndex(sortModel->indexForId(item ? item->id() : QVariant()).row());
- }
-
- QVariant currentId() const
- {
- return m_comboBox->itemData(m_comboBox->currentIndex(), DebuggerTreeItem::IdRole);
- }
-
- Guard m_ignoreChanges;
- QComboBox *m_comboBox;
};
} // namespace Internal
diff --git a/src/plugins/debugger/debuggerruncontrol.cpp b/src/plugins/debugger/debuggerruncontrol.cpp
index c1e70eeda7c..50c4428d8e1 100644
--- a/src/plugins/debugger/debuggerruncontrol.cpp
+++ b/src/plugins/debugger/debuggerruncontrol.cpp
@@ -83,92 +83,27 @@ static QString noDebuggerInKitMessage()
return Tr::tr("The kit does not have a debugger set.");
}
-class CoreUnpacker final : public RunWorker
-{
-public:
- CoreUnpacker(RunControl *runControl, const FilePath &coreFilePath)
- : RunWorker(runControl), m_coreFilePath(coreFilePath)
- {}
-
- FilePath coreFileName() const { return m_tempCoreFilePath; }
-
-private:
- ~CoreUnpacker() final
- {
- if (m_tempCoreFile.isOpen())
- m_tempCoreFile.close();
-
- m_tempCoreFilePath.removeFile();
- }
-
- void start() final
- {
- {
- Utils::TemporaryFile tmp("tmpcore-XXXXXX");
- tmp.open();
- m_tempCoreFilePath = FilePath::fromString(tmp.fileName());
- }
-
- m_coreUnpackProcess.setWorkingDirectory(TemporaryDirectory::masterDirectoryFilePath());
- connect(&m_coreUnpackProcess, &Process::done, this, [this] {
- if (m_coreUnpackProcess.error() == QProcess::UnknownError) {
- reportStopped();
- return;
- }
- reportFailure("Error unpacking " + m_coreFilePath.toUserOutput());
- });
-
- const QString msg = Tr::tr("Unpacking core file to %1");
- appendMessage(msg.arg(m_tempCoreFilePath.toUserOutput()), LogMessageFormat);
-
- if (m_coreFilePath.endsWith(".lzo")) {
- m_coreUnpackProcess.setCommand({"lzop", {"-o", m_tempCoreFilePath.path(),
- "-x", m_coreFilePath.path()}});
- reportStarted();
- m_coreUnpackProcess.start();
- return;
- }
-
- 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, &Process::readyReadStandardOutput, this, [this] {
- m_tempCoreFile.write(m_coreUnpackProcess.readAllRawStandardOutput());
- });
- m_coreUnpackProcess.setCommand({"gzip", {"-c", "-d", m_coreFilePath.path()}});
- reportStarted();
- m_coreUnpackProcess.start();
- return;
- }
-
- QTC_CHECK(false);
- reportFailure("Unknown file extension in " + m_coreFilePath.toUserOutput());
- }
-
- QFile m_tempCoreFile;
- FilePath m_coreFilePath;
- FilePath m_tempCoreFilePath;
- Process m_coreUnpackProcess;
-};
-
class DebuggerRunToolPrivate
{
public:
- QPointer coreUnpacker;
bool addQmlServerInferiorCommandLineArgumentIfNeeded = false;
int snapshotCounter = 0;
int engineStartsNeeded = 0;
int engineStopsNeeded = 0;
QString runId;
+ // Core unpacker
+ QFile m_tempCoreFile;
+ FilePath m_tempCoreFilePath;
+ Process m_coreUnpackProcess;
+
// Terminal
Process terminalProc;
DebuggerRunTool::AllowTerminal allowTerminal = DebuggerRunTool::DoAllowTerminal;
// DebugServer
Process debuggerServerProc;
- Utils::ProcessHandle serverAttachPid;
+ ProcessHandle serverAttachPid;
bool serverUseMulti = true;
bool serverEssential = true;
};
@@ -369,11 +304,6 @@ void DebuggerRunTool::setStartMessage(const QString &msg)
void DebuggerRunTool::setCoreFilePath(const FilePath &coreFile, bool isSnapshot)
{
- if (coreFile.endsWith(".gz") || coreFile.endsWith(".lzo")) {
- d->coreUnpacker = new CoreUnpacker(runControl(), coreFile);
- addStartDependency(d->coreUnpacker);
- }
-
m_runParameters.coreFile = coreFile;
m_runParameters.isSnapshot = isSnapshot;
}
@@ -405,6 +335,63 @@ void DebuggerRunTool::addSearchDirectory(const Utils::FilePath &dir)
void DebuggerRunTool::start()
{
+ startCoreFileSetupIfNeededAndContinueStartup();
+}
+
+void DebuggerRunTool::startCoreFileSetupIfNeededAndContinueStartup()
+{
+ const FilePath coreFile = m_runParameters.coreFile;
+ if (!coreFile.endsWith(".gz") && !coreFile.endsWith(".lzo")) {
+ continueAfterCoreFileSetup();
+ return;
+ }
+
+ {
+ TemporaryFile tmp("tmpcore-XXXXXX");
+ tmp.open();
+ d->m_tempCoreFilePath = FilePath::fromString(tmp.fileName());
+ }
+
+ d->m_coreUnpackProcess.setWorkingDirectory(TemporaryDirectory::masterDirectoryFilePath());
+ connect(&d->m_coreUnpackProcess, &Process::done, this, [this] {
+ if (d->m_coreUnpackProcess.error() == QProcess::UnknownError) {
+ m_runParameters.coreFile = d->m_tempCoreFilePath;
+ continueAfterCoreFileSetup();
+ return;
+ }
+ reportFailure("Error unpacking " + m_runParameters.coreFile.toUserOutput());
+ });
+
+ const QString msg = Tr::tr("Unpacking core file to %1");
+ appendMessage(msg.arg(d->m_tempCoreFilePath.toUserOutput()), LogMessageFormat);
+
+ if (coreFile.endsWith(".lzo")) {
+ d->m_coreUnpackProcess.setCommand({"lzop", {"-o", d->m_tempCoreFilePath.path(),
+ "-x", coreFile.path()}});
+ d->m_coreUnpackProcess.start();
+ return;
+ }
+
+ if (coreFile.endsWith(".gz")) {
+ d->m_tempCoreFile.setFileName(d->m_tempCoreFilePath.path());
+ d->m_tempCoreFile.open(QFile::WriteOnly);
+ connect(&d->m_coreUnpackProcess, &Process::readyReadStandardOutput, this, [this] {
+ d->m_tempCoreFile.write(d->m_coreUnpackProcess.readAllRawStandardOutput());
+ });
+ d->m_coreUnpackProcess.setCommand({"gzip", {"-c", "-d", coreFile.path()}});
+ d->m_coreUnpackProcess.start();
+ return;
+ }
+
+ QTC_CHECK(false);
+ reportFailure("Unknown file extension in " + coreFile.toUserOutput());
+}
+
+void DebuggerRunTool::continueAfterCoreFileSetup()
+{
+ if (d->m_tempCoreFile.isOpen())
+ d->m_tempCoreFile.close();
+
startTerminalIfNeededAndContinueStartup();
}
@@ -497,9 +484,6 @@ void DebuggerRunTool::continueAfterTerminalStart()
// return;
// }
- if (d->coreUnpacker)
- m_runParameters.coreFile = d->coreUnpacker->coreFileName();
-
if (!fixupParameters())
return;
@@ -978,6 +962,9 @@ void DebuggerRunTool::addSolibSearchDir(const QString &str)
DebuggerRunTool::~DebuggerRunTool()
{
+ if (d->m_tempCoreFilePath.exists())
+ d->m_tempCoreFilePath.removeFile();
+
if (m_runParameters.isSnapshot && !m_runParameters.coreFile.isEmpty())
m_runParameters.coreFile.removeFile();
diff --git a/src/plugins/debugger/debuggerruncontrol.h b/src/plugins/debugger/debuggerruncontrol.h
index 4caf61112d4..4a2898fc3cd 100644
--- a/src/plugins/debugger/debuggerruncontrol.h
+++ b/src/plugins/debugger/debuggerruncontrol.h
@@ -111,6 +111,9 @@ private:
void handleEngineStarted(Internal::DebuggerEngine *engine);
void handleEngineFinished(Internal::DebuggerEngine *engine);
+ void startCoreFileSetupIfNeededAndContinueStartup();
+ void continueAfterCoreFileSetup();
+
void startTerminalIfNeededAndContinueStartup();
void continueAfterTerminalStart();
diff --git a/src/plugins/debugger/loadcoredialog.cpp b/src/plugins/debugger/loadcoredialog.cpp
index 937c77b8e19..cc1b5ce3ebc 100644
--- a/src/plugins/debugger/loadcoredialog.cpp
+++ b/src/plugins/debugger/loadcoredialog.cpp
@@ -232,7 +232,7 @@ void AttachCoreDialog::accepted()
const expected_str resultPath = pattern.createTempFile();
if (!resultPath)
return make_unexpected(resultPath.error());
- const expected_str result = srcPath.copyFile(resultPath.value());
+ const Result result = srcPath.copyFile(resultPath.value());
if (!result)
return make_unexpected(result.error());
diff --git a/src/plugins/docker/dockerdevice.cpp b/src/plugins/docker/dockerdevice.cpp
index aecf3dd82ba..78cbfa32e55 100644
--- a/src/plugins/docker/dockerdevice.cpp
+++ b/src/plugins/docker/dockerdevice.cpp
@@ -582,7 +582,7 @@ DockerDevice::DockerDevice()
return make_unexpected(cmdBridgePath.error());
auto fAccess = std::make_unique(d);
- expected_str