Utils: Rename most FilePath::{from,to}Variant uses to {from,to}Settings

Specifies the main purpose more clearly. The remaining ones a "true"
(internal) variants in models and as action data.

Change-Id: I8dd3c846e419f29d88283c2f48268ef6685b19fe
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
hjk
2023-01-03 12:31:52 +01:00
parent ca4af940b1
commit 66c08a824d
59 changed files with 154 additions and 139 deletions

View File

@@ -128,7 +128,7 @@ QWidget *PathChooserDelegate::createEditor(QWidget *parent, const QStyleOptionVi
void PathChooserDelegate::setEditorData(QWidget *editor, const QModelIndex &index) const
{
if (auto *pathChooser = qobject_cast<PathChooser *>(editor)) {
if (auto pathChooser = qobject_cast<PathChooser *>(editor)) {
pathChooser->setExpectedKind(m_kind);
pathChooser->setPromptDialogFilter(m_filter);
pathChooser->setFilePath(FilePath::fromVariant(index.model()->data(index, Qt::EditRole)));

View File

@@ -168,6 +168,11 @@ QFileInfo FilePath::toFileInfo() const
return QFileInfo(toFSPathString());
}
FilePath FilePath::fromVariant(const QVariant &variant)
{
return fromSettings(variant); // FIXME: Use variant.value<FilePath>()
}
FilePath FilePath::fromParts(const QStringView scheme, const QStringView host, const QStringView path)
{
FilePath result;
@@ -989,7 +994,7 @@ FilePath FilePath::fromUtf8(const char *filename, int filenameSize)
return FilePath::fromString(QString::fromUtf8(filename, filenameSize));
}
FilePath FilePath::fromVariant(const QVariant &variant)
FilePath FilePath::fromSettings(const QVariant &variant)
{
if (variant.type() == QVariant::Url) {
const QUrl url = variant.toUrl();
@@ -998,11 +1003,17 @@ FilePath FilePath::fromVariant(const QVariant &variant)
return FilePath::fromUserInput(variant.toString());
}
QVariant FilePath::toVariant() const
QVariant FilePath::toSettings() const
{
return toString();
}
QVariant FilePath::toVariant() const
{
// FIXME: Use qVariantFromValue
return toSettings();
}
/*!
\returns whether FilePath is a child of \a s
*/

View File

@@ -62,6 +62,7 @@ public:
[[nodiscard]] static FilePath fromStringWithExtension(const QString &filepath, const QString &defaultExtension);
[[nodiscard]] static FilePath fromUserInput(const QString &filepath);
[[nodiscard]] static FilePath fromUtf8(const char *filepath, int filepathSize = -1);
[[nodiscard]] static FilePath fromSettings(const QVariant &variant);
[[nodiscard]] static FilePath fromVariant(const QVariant &variant);
[[nodiscard]] static FilePath fromParts(const QStringView scheme, const QStringView host, const QStringView path);
[[nodiscard]] static FilePath fromPathPart(const QStringView path);
@@ -69,7 +70,7 @@ public:
[[nodiscard]] static FilePath currentWorkingPath();
QString toUserOutput() const;
QString toString() const;
QVariant toSettings() const;
QVariant toVariant() const;
QUrl toUrl() const;
@@ -236,6 +237,9 @@ public:
//! Returns a filepath the represents the same file on a local drive
expected_str<FilePath> localSource() const;
// FIXME: Avoid. See toSettings, toVariant, toUserOutput, toFSPathString, path, nativePath.
QString toString() const;
private:
// These are needed.
QTCREATOR_UTILS_EXPORT friend bool operator==(const FilePath &first, const FilePath &second);

View File

@@ -843,7 +843,7 @@ void AndroidBuildApkStep::reportWarningOrError(const QString &message, Task::Tas
bool AndroidBuildApkStep::fromMap(const QVariantMap &map)
{
m_keystorePath = FilePath::fromVariant(map.value(KeystoreLocationKey));
m_keystorePath = FilePath::fromSettings(map.value(KeystoreLocationKey));
m_signPackage = false; // don't restore this
m_buildTargetSdk = map.value(BuildTargetSdkKey).toString();
if (m_buildTargetSdk.isEmpty()) {
@@ -857,7 +857,7 @@ bool AndroidBuildApkStep::fromMap(const QVariantMap &map)
QVariantMap AndroidBuildApkStep::toMap() const
{
QVariantMap map = ProjectExplorer::AbstractProcessStep::toMap();
map.insert(KeystoreLocationKey, m_keystorePath.toVariant());
map.insert(KeystoreLocationKey, m_keystorePath.toSettings());
map.insert(BuildTargetSdkKey, m_buildTargetSdk);
map.insert(VerboseOutputKey, m_verbose);
return map;

View File

@@ -139,14 +139,14 @@ bool JLSSettings::isValid() const
QVariantMap JLSSettings::toMap() const
{
QVariantMap map = StdIOSettings::toMap();
map.insert(languageServerKey, m_languageServer.toVariant());
map.insert(languageServerKey, m_languageServer.toSettings());
return map;
}
void JLSSettings::fromMap(const QVariantMap &map)
{
StdIOSettings::fromMap(map);
m_languageServer = FilePath::fromVariant(map[languageServerKey]);
m_languageServer = FilePath::fromSettings(map[languageServerKey]);
}
LanguageClient::BaseSettings *JLSSettings::copy() const

View File

@@ -145,10 +145,10 @@ bool EBlinkGdbServerProvider::isValid() const
QVariantMap EBlinkGdbServerProvider::toMap() const
{
QVariantMap data = GdbServerProvider::toMap();
data.insert(executableFileKeyC, m_executableFile.toVariant());
data.insert(executableFileKeyC, m_executableFile.toSettings());
data.insert(verboseLevelKeyC, m_verboseLevel);
data.insert(interfaceTypeC, m_interfaceType);
data.insert(deviceScriptC, m_deviceScript.toVariant());
data.insert(deviceScriptC, m_deviceScript.toSettings());
data.insert(interfaceResetOnConnectC, m_interfaceResetOnConnect);
data.insert(interfaceSpeedC, m_interfaceSpeed);
data.insert(interfaceExplicidDeviceC, m_interfaceExplicidDevice);
@@ -165,12 +165,12 @@ bool EBlinkGdbServerProvider::fromMap(const QVariantMap &data)
if (!GdbServerProvider::fromMap(data))
return false;
m_executableFile = FilePath::fromVariant(data.value(executableFileKeyC));
m_executableFile = FilePath::fromSettings(data.value(executableFileKeyC));
m_verboseLevel = data.value(verboseLevelKeyC).toInt();
m_interfaceResetOnConnect = data.value(interfaceResetOnConnectC).toBool();
m_interfaceType = static_cast<InterfaceType>(
data.value(interfaceTypeC).toInt());
m_deviceScript = FilePath::fromVariant(data.value(deviceScriptC));
m_deviceScript = FilePath::fromSettings(data.value(deviceScriptC));
m_interfaceResetOnConnect = data.value(interfaceResetOnConnectC).toBool();
m_interfaceSpeed = data.value(interfaceSpeedC).toInt();
m_interfaceExplicidDevice = data.value(interfaceExplicidDeviceC).toString();

View File

@@ -122,7 +122,7 @@ QVariantMap GdbServerProvider::toMap() const
{
QVariantMap data = IDebugServerProvider::toMap();
data.insert(startupModeKeyC, m_startupMode);
data.insert(peripheralDescriptionFileKeyC, m_peripheralDescriptionFile.toVariant());
data.insert(peripheralDescriptionFileKeyC, m_peripheralDescriptionFile.toSettings());
data.insert(initCommandsKeyC, m_initCommands);
data.insert(resetCommandsKeyC, m_resetCommands);
data.insert(useExtendedRemoteKeyC, m_useExtendedRemote);
@@ -185,7 +185,7 @@ bool GdbServerProvider::fromMap(const QVariantMap &data)
return false;
m_startupMode = static_cast<StartupMode>(data.value(startupModeKeyC).toInt());
m_peripheralDescriptionFile = FilePath::fromVariant(data.value(peripheralDescriptionFileKeyC));
m_peripheralDescriptionFile = FilePath::fromSettings(data.value(peripheralDescriptionFileKeyC));
m_initCommands = data.value(initCommandsKeyC).toString();
m_resetCommands = data.value(resetCommandsKeyC).toString();
m_useExtendedRemote = data.value(useExtendedRemoteKeyC).toBool();

View File

@@ -121,7 +121,7 @@ bool JLinkGdbServerProvider::isValid() const
QVariantMap JLinkGdbServerProvider::toMap() const
{
QVariantMap data = GdbServerProvider::toMap();
data.insert(executableFileKeyC, m_executableFile.toVariant());
data.insert(executableFileKeyC, m_executableFile.toSettings());
data.insert(jlinkDeviceKeyC, m_jlinkDevice);
data.insert(jlinkHostInterfaceKeyC, m_jlinkHost);
data.insert(jlinkHostInterfaceIPAddressKeyC, m_jlinkHostAddr);
@@ -136,7 +136,7 @@ bool JLinkGdbServerProvider::fromMap(const QVariantMap &data)
if (!GdbServerProvider::fromMap(data))
return false;
m_executableFile = FilePath::fromVariant(data.value(executableFileKeyC));
m_executableFile = FilePath::fromSettings(data.value(executableFileKeyC));
m_jlinkDevice = data.value(jlinkDeviceKeyC).toString();
m_additionalArguments = data.value(additionalArgumentsKeyC).toString();
m_jlinkHost = data.value(jlinkHostInterfaceKeyC).toString();

View File

@@ -128,9 +128,9 @@ bool OpenOcdGdbServerProvider::isValid() const
QVariantMap OpenOcdGdbServerProvider::toMap() const
{
QVariantMap data = GdbServerProvider::toMap();
data.insert(executableFileKeyC, m_executableFile.toVariant());
data.insert(rootScriptsDirKeyC, m_rootScriptsDir.toVariant());
data.insert(configurationFileKeyC, m_configurationFile.toVariant());
data.insert(executableFileKeyC, m_executableFile.toSettings());
data.insert(rootScriptsDirKeyC, m_rootScriptsDir.toSettings());
data.insert(configurationFileKeyC, m_configurationFile.toSettings());
data.insert(additionalArgumentsKeyC, m_additionalArguments);
return data;
}
@@ -140,9 +140,9 @@ bool OpenOcdGdbServerProvider::fromMap(const QVariantMap &data)
if (!GdbServerProvider::fromMap(data))
return false;
m_executableFile = FilePath::fromVariant(data.value(executableFileKeyC));
m_rootScriptsDir = FilePath::fromVariant(data.value(rootScriptsDirKeyC));
m_configurationFile = FilePath::fromVariant(data.value(configurationFileKeyC));
m_executableFile = FilePath::fromSettings(data.value(executableFileKeyC));
m_rootScriptsDir = FilePath::fromSettings(data.value(rootScriptsDirKeyC));
m_configurationFile = FilePath::fromSettings(data.value(configurationFileKeyC));
m_additionalArguments = data.value(additionalArgumentsKeyC).toString();
return true;
}

View File

@@ -116,7 +116,7 @@ bool StLinkUtilGdbServerProvider::isValid() const
QVariantMap StLinkUtilGdbServerProvider::toMap() const
{
QVariantMap data = GdbServerProvider::toMap();
data.insert(executableFileKeyC, m_executableFile.toVariant());
data.insert(executableFileKeyC, m_executableFile.toSettings());
data.insert(verboseLevelKeyC, m_verboseLevel);
data.insert(extendedModeKeyC, m_extendedMode);
data.insert(resetBoardKeyC, m_resetBoard);
@@ -130,7 +130,7 @@ bool StLinkUtilGdbServerProvider::fromMap(const QVariantMap &data)
if (!GdbServerProvider::fromMap(data))
return false;
m_executableFile = FilePath::fromVariant(data.value(executableFileKeyC));
m_executableFile = FilePath::fromSettings(data.value(executableFileKeyC));
m_verboseLevel = data.value(verboseLevelKeyC).toInt();
m_extendedMode = data.value(extendedModeKeyC).toBool();
m_resetBoard = data.value(resetBoardKeyC).toBool();

View File

@@ -149,7 +149,7 @@ FilePath UvscServerProvider::buildOptionsFilePath(DebuggerRunTool *runTool) cons
QVariantMap UvscServerProvider::toMap() const
{
QVariantMap data = IDebugServerProvider::toMap();
data.insert(toolsIniKeyC, m_toolsIniFile.toVariant());
data.insert(toolsIniKeyC, m_toolsIniFile.toSettings());
data.insert(deviceSelectionKeyC, m_deviceSelection.toMap());
data.insert(driverSelectionKeyC, m_driverSelection.toMap());
return data;
@@ -223,7 +223,7 @@ bool UvscServerProvider::fromMap(const QVariantMap &data)
{
if (!IDebugServerProvider::fromMap(data))
return false;
m_toolsIniFile = FilePath::fromVariant(data.value(toolsIniKeyC));
m_toolsIniFile = FilePath::fromSettings(data.value(toolsIniKeyC));
m_deviceSelection.fromMap(data.value(deviceSelectionKeyC).toMap());
m_driverSelection.fromMap(data.value(driverSelectionKeyC).toMap());
return true;

View File

@@ -126,8 +126,8 @@ void ClangToolsSettings::readSettings()
QSettings *s = Core::ICore::settings();
s->beginGroup(Constants::SETTINGS_ID);
m_clangTidyExecutable = FilePath::fromVariant(s->value(clangTidyExecutableKey));
m_clazyStandaloneExecutable = FilePath::fromVariant(s->value(clazyStandaloneExecutableKey));
m_clangTidyExecutable = FilePath::fromSettings(s->value(clangTidyExecutableKey));
m_clazyStandaloneExecutable = FilePath::fromSettings(s->value(clazyStandaloneExecutableKey));
m_diagnosticConfigs.append(diagnosticConfigsFromSettings(s));
QVariantMap map;
@@ -159,8 +159,8 @@ void ClangToolsSettings::writeSettings()
QSettings *s = Core::ICore::settings();
s->beginGroup(Constants::SETTINGS_ID);
s->setValue(clangTidyExecutableKey, m_clangTidyExecutable.toVariant());
s->setValue(clazyStandaloneExecutableKey, m_clazyStandaloneExecutable.toVariant());
s->setValue(clangTidyExecutableKey, m_clangTidyExecutable.toSettings());
s->setValue(clazyStandaloneExecutableKey, m_clazyStandaloneExecutable.toSettings());
diagnosticConfigsToSettings(s, m_diagnosticConfigs);
QVariantMap map;

View File

@@ -766,7 +766,7 @@ const QList<BuildInfo> CMakeProjectImporter::buildInfoList(void *directoryData)
info.buildDirectory = data->buildDirectory;
QVariantMap config = info.extraInfo.toMap(); // new empty, or existing one from createBuildInfo
config.insert(Constants::CMAKE_HOME_DIR, data->cmakeHomeDirectory.toString());
config.insert(Constants::CMAKE_HOME_DIR, data->cmakeHomeDirectory.toVariant());
// Potentially overwrite the default QML Debugging settings for the build type as set by
// createBuildInfo, in case we are importing a "Debug" CMake configuration without QML Debugging
config.insert(Constants::QML_DEBUG_SETTING,

View File

@@ -122,7 +122,7 @@ CMakeTool::CMakeTool(const QVariantMap &map, bool fromSdk) :
setFilePath(FilePath::fromString(map.value(CMAKE_INFORMATION_COMMAND).toString()));
m_qchFilePath = FilePath::fromVariant(map.value(CMAKE_INFORMATION_QCH_FILE_PATH));
m_qchFilePath = FilePath::fromSettings(map.value(CMAKE_INFORMATION_QCH_FILE_PATH));
if (m_qchFilePath.isEmpty())
m_qchFilePath = searchQchFile(m_executable);

View File

@@ -1384,7 +1384,7 @@ void restoreRecentFiles(const QVariantList &recentFiles, const QStringList &rece
QString editorId;
if (i < recentEditorIds.size()) // guard against old or weird settings
editorId = recentEditorIds.at(i);
const Utils::FilePath &filePath = FilePath::fromVariant(recentFiles.at(i));
const Utils::FilePath &filePath = FilePath::fromSettings(recentFiles.at(i));
result.append({filePath, Id::fromString(editorId)});
}
@@ -1404,8 +1404,8 @@ void readSettings()
s->beginGroup(QLatin1String(directoryGroupC));
d->m_projectsDirectory = FilePath::fromVariant(
s->value(QLatin1String(projectDirectoryKeyC), PathChooser::homePath().toVariant()));
d->m_projectsDirectory = FilePath::fromSettings(
s->value(QLatin1String(projectDirectoryKeyC), PathChooser::homePath().toSettings()));
d->m_useProjectsDirectory
= s->value(QLatin1String(useProjectDirectoryKeyC), kUseProjectsDirectoryDefault).toBool();

View File

@@ -24,7 +24,7 @@ FilePath PatchTool::patchCommand()
QSettings *s = ICore::settings();
s->beginGroup(settingsGroupC);
const FilePath command = FilePath::fromVariant(s->value(patchCommandKeyC, patchCommandDefaultC));
const FilePath command = FilePath::fromSettings(s->value(patchCommandKeyC, patchCommandDefaultC));
s->endGroup();
return command;
@@ -34,7 +34,7 @@ void PatchTool::setPatchCommand(const FilePath &newCommand)
{
Utils::QtcSettings *s = ICore::settings();
s->beginGroup(settingsGroupC);
s->setValueWithDefault(patchCommandKeyC, newCommand.toVariant(), QVariant(QString(patchCommandDefaultC)));
s->setValueWithDefault(patchCommandKeyC, newCommand.toSettings(), QVariant(QString(patchCommandDefaultC)));
s->endGroup();
}

View File

@@ -2762,7 +2762,7 @@ void BreakpointManager::saveSessionData()
if (params.type != BreakpointByFileAndLine)
map.insert("type", params.type);
if (!params.fileName.isEmpty())
map.insert("filename", params.fileName.toVariant());
map.insert("filename", params.fileName.toSettings());
if (params.lineNumber)
map.insert("linenumber", params.lineNumber);
if (!params.functionName.isEmpty())
@@ -2807,7 +2807,7 @@ void BreakpointManager::loadSessionData()
BreakpointParameters params(BreakpointByFileAndLine);
QVariant v = map.value("filename");
if (v.isValid())
params.fileName = FilePath::fromVariant(v);
params.fileName = FilePath::fromSettings(v);
v = map.value("linenumber");
if (v.isValid())
params.lineNumber = v.toString().toInt();

View File

@@ -146,16 +146,16 @@ void StartApplicationParameters::toSettings(QSettings *settings) const
settings->setValue("LastKitId", kitId.toSetting());
settings->setValue("LastServerPort", serverPort);
settings->setValue("LastServerAddress", serverAddress);
settings->setValue("LastExternalExecutable", runnable.command.executable().toVariant());
settings->setValue("LastExternalExecutable", runnable.command.executable().toSettings());
settings->setValue("LastExternalExecutableArguments", runnable.command.arguments());
settings->setValue("LastExternalWorkingDirectory", runnable.workingDirectory.toVariant());
settings->setValue("LastExternalWorkingDirectory", runnable.workingDirectory.toSettings());
settings->setValue("LastExternalBreakAtMain", breakAtMain);
settings->setValue("LastExternalRunInTerminal", runInTerminal);
settings->setValue("LastExternalUseTargetExtended", useTargetExtendedRemote);
settings->setValue("LastServerInitCommands", serverInitCommands);
settings->setValue("LastServerResetCommands", serverResetCommands);
settings->setValue("LastDebugInfoLocation", debugInfoLocation.toVariant());
settings->setValue("LastSysRoot", sysRoot.toVariant());
settings->setValue("LastDebugInfoLocation", debugInfoLocation.toSettings());
settings->setValue("LastSysRoot", sysRoot.toSettings());
}
void StartApplicationParameters::fromSettings(const QSettings *settings)
@@ -163,16 +163,16 @@ void StartApplicationParameters::fromSettings(const QSettings *settings)
kitId = Id::fromSetting(settings->value("LastKitId"));
serverPort = settings->value("LastServerPort").toUInt();
serverAddress = settings->value("LastServerAddress").toString();
runnable.command.setExecutable(FilePath::fromVariant(settings->value("LastExternalExecutable")));
runnable.command.setExecutable(FilePath::fromSettings(settings->value("LastExternalExecutable")));
runnable.command.setArguments(settings->value("LastExternalExecutableArguments").toString());
runnable.workingDirectory = FilePath::fromVariant(settings->value("LastExternalWorkingDirectory"));
runnable.workingDirectory = FilePath::fromSettings(settings->value("LastExternalWorkingDirectory"));
breakAtMain = settings->value("LastExternalBreakAtMain").toBool();
runInTerminal = settings->value("LastExternalRunInTerminal").toBool();
useTargetExtendedRemote = settings->value("LastExternalUseTargetExtended").toBool();
serverInitCommands = settings->value("LastServerInitCommands").toString();
serverResetCommands = settings->value("LastServerResetCommands").toString();
debugInfoLocation = FilePath::fromVariant(settings->value("LastDebugInfoLocation"));
sysRoot = FilePath::fromVariant(settings->value("LastSysRoot"));
debugInfoLocation = FilePath::fromSettings(settings->value("LastDebugInfoLocation"));
sysRoot = FilePath::fromSettings(settings->value("LastSysRoot"));
}
///////////////////////////////////////////////////////////////////////

View File

@@ -81,8 +81,8 @@ DebuggerItem::DebuggerItem(const QVariant &id)
DebuggerItem::DebuggerItem(const QVariantMap &data)
{
m_id = data.value(DEBUGGER_INFORMATION_ID).toString();
m_command = FilePath::fromVariant(data.value(DEBUGGER_INFORMATION_COMMAND));
m_workingDirectory = FilePath::fromVariant(data.value(DEBUGGER_INFORMATION_WORKINGDIRECTORY));
m_command = FilePath::fromSettings(data.value(DEBUGGER_INFORMATION_COMMAND));
m_workingDirectory = FilePath::fromSettings(data.value(DEBUGGER_INFORMATION_WORKINGDIRECTORY));
m_unexpandedDisplayName = data.value(DEBUGGER_INFORMATION_DISPLAYNAME).toString();
m_isAutoDetected = data.value(DEBUGGER_INFORMATION_AUTODETECTED, false).toBool();
m_detectionSource = data.value(DEBUGGER_INFORMATION_DETECTION_SOURCE).toString();
@@ -328,8 +328,8 @@ QVariantMap DebuggerItem::toMap() const
QVariantMap data;
data.insert(DEBUGGER_INFORMATION_DISPLAYNAME, m_unexpandedDisplayName);
data.insert(DEBUGGER_INFORMATION_ID, m_id);
data.insert(DEBUGGER_INFORMATION_COMMAND, m_command.toVariant());
data.insert(DEBUGGER_INFORMATION_WORKINGDIRECTORY, m_workingDirectory.toVariant());
data.insert(DEBUGGER_INFORMATION_COMMAND, m_command.toSettings());
data.insert(DEBUGGER_INFORMATION_WORKINGDIRECTORY, m_workingDirectory.toSettings());
data.insert(DEBUGGER_INFORMATION_ENGINETYPE, int(m_engineType));
data.insert(DEBUGGER_INFORMATION_AUTODETECTED, m_isAutoDetected);
data.insert(DEBUGGER_INFORMATION_DETECTION_SOURCE, m_detectionSource);

View File

@@ -1528,22 +1528,22 @@ void DebuggerPluginPrivate::attachCore()
const QString lastExternalKit = configValue("LastExternalKit").toString();
if (!lastExternalKit.isEmpty())
dlg.setKitId(Id::fromString(lastExternalKit));
dlg.setSymbolFile(FilePath::fromVariant(configValue("LastExternalExecutableFile")));
dlg.setLocalCoreFile(FilePath::fromVariant(configValue("LastLocalCoreFile")));
dlg.setRemoteCoreFile(FilePath::fromVariant(configValue("LastRemoteCoreFile")));
dlg.setOverrideStartScript(FilePath::fromVariant(configValue("LastExternalStartScript")));
dlg.setSysRoot(FilePath::fromVariant(configValue("LastSysRoot")));
dlg.setSymbolFile(FilePath::fromSettings(configValue("LastExternalExecutableFile")));
dlg.setLocalCoreFile(FilePath::fromSettings(configValue("LastLocalCoreFile")));
dlg.setRemoteCoreFile(FilePath::fromSettings(configValue("LastRemoteCoreFile")));
dlg.setOverrideStartScript(FilePath::fromSettings(configValue("LastExternalStartScript")));
dlg.setSysRoot(FilePath::fromSettings(configValue("LastSysRoot")));
dlg.setForceLocalCoreFile(configValue("LastForceLocalCoreFile").toBool());
if (dlg.exec() != QDialog::Accepted)
return;
setConfigValue("LastExternalExecutableFile", dlg.symbolFile().toVariant());
setConfigValue("LastLocalCoreFile", dlg.localCoreFile().toVariant());
setConfigValue("LastRemoteCoreFile", dlg.remoteCoreFile().toVariant());
setConfigValue("LastExternalExecutableFile", dlg.symbolFile().toSettings());
setConfigValue("LastLocalCoreFile", dlg.localCoreFile().toSettings());
setConfigValue("LastRemoteCoreFile", dlg.remoteCoreFile().toSettings());
setConfigValue("LastExternalKit", dlg.kit()->id().toSetting());
setConfigValue("LastExternalStartScript", dlg.overrideStartScript().toVariant());
setConfigValue("LastSysRoot", dlg.sysRoot().toVariant());
setConfigValue("LastExternalStartScript", dlg.overrideStartScript().toSettings());
setConfigValue("LastSysRoot", dlg.sysRoot().toSettings());
setConfigValue("LastForceLocalCoreFile", dlg.forcesLocalCoreFile());
auto runControl = new RunControl(ProjectExplorer::Constants::DEBUG_RUN_MODE);

View File

@@ -721,7 +721,7 @@ void DockerDevice::fromMap(const QVariantMap &map)
data.mounts = map.value(DockerDeviceMappedPaths).toStringList();
data.keepEntryPoint = map.value(DockerDeviceKeepEntryPoint).toBool();
data.enableLldbFlags = map.value(DockerDeviceEnableLldbFlags).toBool();
data.clangdExecutable = FilePath::fromVariant(map.value(DockerDeviceClangDExecutable));
data.clangdExecutable = FilePath::fromSettings(map.value(DockerDeviceClangDExecutable));
d->setData(data);
}
@@ -738,7 +738,7 @@ QVariantMap DockerDevice::toMap() const
map.insert(DockerDeviceMappedPaths, data.mounts);
map.insert(DockerDeviceKeepEntryPoint, data.keepEntryPoint);
map.insert(DockerDeviceEnableLldbFlags, data.enableLldbFlags);
map.insert(DockerDeviceClangDExecutable, data.clangdExecutable.toVariant());
map.insert(DockerDeviceClangDExecutable, data.clangdExecutable.toSettings());
return map;
}

View File

@@ -93,8 +93,8 @@ void GerritParameters::toSettings(QSettings *s) const
s->setValue(userKeyC, server.user.userName);
s->setValue(portKeyC, server.port);
s->setValue(portFlagKeyC, portFlag);
s->setValue(sshKeyC, ssh.toVariant());
s->setValue(curlKeyC, curl.toVariant());
s->setValue(sshKeyC, ssh.toSettings());
s->setValue(curlKeyC, curl.toSettings());
s->setValue(httpsKeyC, https);
s->endGroup();
}
@@ -111,8 +111,8 @@ void GerritParameters::fromSettings(const QSettings *s)
const QString rootKey = QLatin1String(settingsGroupC) + '/';
server.host = s->value(rootKey + hostKeyC, GerritServer::defaultHost()).toString();
server.user.userName = s->value(rootKey + userKeyC, QString()).toString();
ssh = FilePath::fromVariant(s->value(rootKey + sshKeyC, QString()));
curl = FilePath::fromVariant(s->value(rootKey + curlKeyC));
ssh = FilePath::fromSettings(s->value(rootKey + sshKeyC, QString()));
curl = FilePath::fromSettings(s->value(rootKey + curlKeyC));
server.port = ushort(s->value(rootKey + portKeyC, QVariant(GerritServer::defaultPort)).toInt());
portFlag = s->value(rootKey + portFlagKeyC, defaultPortFlag).toString();
savedQueries = s->value(rootKey + savedQueriesKeyC, QString()).toString()

View File

@@ -157,7 +157,7 @@ void GitLabParameters::toSettings(QSettings *s) const
writeTokensFile(tokensFilePath(s), gitLabServers);
s->beginGroup(settingsGroupC);
s->setValue(curlKeyC, curl.toVariant());
s->setValue(curlKeyC, curl.toSettings());
s->setValue(defaultUuidKeyC, defaultGitLabServer.toSetting());
s->endGroup();
}
@@ -165,7 +165,7 @@ void GitLabParameters::toSettings(QSettings *s) const
void GitLabParameters::fromSettings(const QSettings *s)
{
const QString rootKey = QLatin1String(settingsGroupC) + '/';
curl = Utils::FilePath::fromVariant(s->value(rootKey + curlKeyC));
curl = Utils::FilePath::fromSettings(s->value(rootKey + curlKeyC));
defaultGitLabServer = Utils::Id::fromSetting(s->value(rootKey + defaultUuidKeyC));
gitLabServers = readTokensFile(tokensFilePath(s));

View File

@@ -13,13 +13,13 @@ const char CUSTOMCOMMANDBUILDER_ARGS[] = "IncrediBuild.BuildConsole.%1.Arguments
void CommandBuilder::fromMap(const QVariantMap &map)
{
m_command = FilePath::fromVariant(map.value(QString(CUSTOMCOMMANDBUILDER_COMMAND).arg(id())));
m_command = FilePath::fromSettings(map.value(QString(CUSTOMCOMMANDBUILDER_COMMAND).arg(id())));
m_args = map.value(QString(CUSTOMCOMMANDBUILDER_ARGS).arg(id())).toString();
}
void CommandBuilder::toMap(QVariantMap *map) const
{
(*map)[QString(CUSTOMCOMMANDBUILDER_COMMAND).arg(id())] = m_command.toVariant();
(*map)[QString(CUSTOMCOMMANDBUILDER_COMMAND).arg(id())] = m_command.toSettings();
(*map)[QString(CUSTOMCOMMANDBUILDER_ARGS).arg(id())] = QVariant(m_args);
}

View File

@@ -64,7 +64,7 @@ QVariantMap IosDsymBuildStep::toMap() const
map.insert(id().withSuffix(USE_DEFAULT_ARGS_PARTIAL_KEY).toString(),
isDefault());
map.insert(id().withSuffix(CLEAN_PARTIAL_KEY).toString(), m_clean);
map.insert(id().withSuffix(COMMAND_PARTIAL_KEY).toString(), command().toVariant());
map.insert(id().withSuffix(COMMAND_PARTIAL_KEY).toString(), command().toSettings());
return map;
}
@@ -75,7 +75,7 @@ bool IosDsymBuildStep::fromMap(const QVariantMap &map)
bool useDefaultArguments = map.value(
id().withSuffix(USE_DEFAULT_ARGS_PARTIAL_KEY).toString()).toBool();
m_clean = map.value(id().withSuffix(CLEAN_PARTIAL_KEY).toString(), m_clean).toBool();
m_command = FilePath::fromVariant(map.value(id().withSuffix(COMMAND_PARTIAL_KEY).toString()));
m_command = FilePath::fromSettings(map.value(id().withSuffix(COMMAND_PARTIAL_KEY).toString()));
if (useDefaultArguments) {
m_command = defaultCommand();
m_arguments = defaultArguments();

View File

@@ -737,7 +737,7 @@ bool StdIOSettings::isValid() const
QVariantMap StdIOSettings::toMap() const
{
QVariantMap map = BaseSettings::toMap();
map.insert(executableKey, m_executable.toVariant());
map.insert(executableKey, m_executable.toSettings());
map.insert(argumentsKey, m_arguments);
return map;
}
@@ -745,7 +745,7 @@ QVariantMap StdIOSettings::toMap() const
void StdIOSettings::fromMap(const QVariantMap &map)
{
BaseSettings::fromMap(map);
m_executable = Utils::FilePath::fromVariant(map[executableKey]);
m_executable = Utils::FilePath::fromSettings(map[executableKey]);
m_arguments = map[argumentsKey].toString();
}

View File

@@ -114,7 +114,8 @@ public:
if (mcuTarget->toolChainPackage()->isDesktopToolchain())
k->setDeviceTypeForIcon(DEVICE_TYPE);
k->setValue(QtSupport::SuppliesQtQuickImportPath::id(), true);
k->setValue(QtSupport::KitQmlImportPath::id(), (sdkPath / "include/qul").toVariant());
// FIXME: This is treated as a pathlist in CMakeBuildSystem::updateQmlJSCodeModel
k->setValue(QtSupport::KitQmlImportPath::id(), (sdkPath / "include/qul").toString());
k->setValue(QtSupport::KitHasMergedHeaderPathsWithQmlImportPaths::id(), true);
QSet<Id> irrelevant = {
SysRootKitAspect::id(),
@@ -679,6 +680,7 @@ void fixExistingKits(const SettingsHandler::Ptr &settingsHandler)
if (cfgItem.key == "QUL_GENERATORS") {
auto idx = cfgItem.value.indexOf("/lib/cmake/Qul");
auto qulDir = cfgItem.value.left(idx);
// FIXME: This is treated as a pathlist in CMakeBuildSystem::updateQmlJSCodeModel
kit->setValue(kitQmlImportPath, QVariant(qulDir + "/include/qul"));
break;
}

View File

@@ -91,7 +91,7 @@ inline QVariantMap toVariantMap<MesonWrapper>(const MesonWrapper &meson)
{
QVariantMap data;
data.insert(Constants::ToolsSettings::NAME_KEY, meson.m_name);
data.insert(Constants::ToolsSettings::EXE_KEY, meson.m_exe.toVariant());
data.insert(Constants::ToolsSettings::EXE_KEY, meson.m_exe.toSettings());
data.insert(Constants::ToolsSettings::AUTO_DETECTED_KEY, meson.m_autoDetected);
data.insert(Constants::ToolsSettings::ID_KEY, meson.m_id.toSetting());
data.insert(Constants::ToolsSettings::TOOL_TYPE_KEY, Constants::ToolsSettings::TOOL_TYPE_MESON);
@@ -101,7 +101,7 @@ template<>
inline MesonWrapper *fromVariantMap<MesonWrapper *>(const QVariantMap &data)
{
return new MesonWrapper(data[Constants::ToolsSettings::NAME_KEY].toString(),
Utils::FilePath::fromVariant(data[Constants::ToolsSettings::EXE_KEY]),
Utils::FilePath::fromSettings(data[Constants::ToolsSettings::EXE_KEY]),
Utils::Id::fromSetting(data[Constants::ToolsSettings::ID_KEY]),
data[Constants::ToolsSettings::AUTO_DETECTED_KEY].toBool());
}

View File

@@ -26,7 +26,7 @@ inline QVariantMap toVariantMap<NinjaWrapper>(const NinjaWrapper &meson)
{
QVariantMap data;
data.insert(Constants::ToolsSettings::NAME_KEY, meson.m_name);
data.insert(Constants::ToolsSettings::EXE_KEY, meson.m_exe.toVariant());
data.insert(Constants::ToolsSettings::EXE_KEY, meson.m_exe.toSettings());
data.insert(Constants::ToolsSettings::AUTO_DETECTED_KEY, meson.m_autoDetected);
data.insert(Constants::ToolsSettings::ID_KEY, meson.m_id.toSetting());
data.insert(Constants::ToolsSettings::TOOL_TYPE_KEY, Constants::ToolsSettings::TOOL_TYPE_NINJA);
@@ -36,7 +36,7 @@ template<>
inline NinjaWrapper *fromVariantMap<NinjaWrapper *>(const QVariantMap &data)
{
return new NinjaWrapper(data[Constants::ToolsSettings::NAME_KEY].toString(),
Utils::FilePath::fromVariant(data[Constants::ToolsSettings::EXE_KEY]),
Utils::FilePath::fromSettings(data[Constants::ToolsSettings::EXE_KEY]),
Utils::Id::fromSetting(data[Constants::ToolsSettings::ID_KEY]),
data[Constants::ToolsSettings::AUTO_DETECTED_KEY].toBool());
}

View File

@@ -52,7 +52,7 @@ public:
if (role != Qt::EditRole)
return false;
if (column == 0)
file = DeployableFile(FilePath::fromVariant(data), file.remoteDirectory());
file = DeployableFile(FilePath::fromSettings(data), file.remoteDirectory());
else if (column == 1)
file = DeployableFile(file.localFilePath(), data.toString());
return true;

View File

@@ -163,7 +163,7 @@ QVariant DeviceFileSystemModel::data(const QModelIndex &index, int role) const
return node->m_filePath.fileName();
}
if (role == PathRole)
return node->m_filePath.toString();
return node->m_filePath.toVariant();
}
return QVariant();
}

View File

@@ -443,7 +443,7 @@ void IDevice::fromMap(const QVariantMap &map)
: static_cast<AuthType>(storedAuthType);
d->sshParameters.privateKeyFile =
FilePath::fromVariant(map.value(QLatin1String(KeyFileKey), defaultPrivateKeyFilePath()));
FilePath::fromSettings(map.value(QLatin1String(KeyFileKey), defaultPrivateKeyFilePath()));
d->sshParameters.timeout = map.value(QLatin1String(TimeoutKey), DefaultTimeout).toInt();
d->sshParameters.hostKeyCheckingMode = static_cast<SshHostKeyCheckingMode>
(map.value(QLatin1String(HostKeyCheckingKey), SshHostKeyCheckingNone).toInt());
@@ -455,8 +455,8 @@ void IDevice::fromMap(const QVariantMap &map)
d->machineType = static_cast<MachineType>(map.value(QLatin1String(MachineTypeKey), DefaultMachineType).toInt());
d->version = map.value(QLatin1String(VersionKey), 0).toInt();
d->debugServerPath = FilePath::fromVariant(map.value(QLatin1String(DebugServerKey)));
d->qmlRunCommand = FilePath::fromVariant(map.value(QLatin1String(QmlRuntimeKey)));
d->debugServerPath = FilePath::fromSettings(map.value(QLatin1String(DebugServerKey)));
d->qmlRunCommand = FilePath::fromSettings(map.value(QLatin1String(QmlRuntimeKey)));
d->extraData = map.value(ExtraDataKey).toMap();
}
@@ -480,15 +480,15 @@ QVariantMap IDevice::toMap() const
map.insert(QLatin1String(SshPortKey), d->sshParameters.port());
map.insert(QLatin1String(UserNameKey), d->sshParameters.userName());
map.insert(QLatin1String(AuthKey), d->sshParameters.authenticationType);
map.insert(QLatin1String(KeyFileKey), d->sshParameters.privateKeyFile.toVariant());
map.insert(QLatin1String(KeyFileKey), d->sshParameters.privateKeyFile.toSettings());
map.insert(QLatin1String(TimeoutKey), d->sshParameters.timeout);
map.insert(QLatin1String(HostKeyCheckingKey), d->sshParameters.hostKeyCheckingMode);
map.insert(QLatin1String(PortsSpecKey), d->freePorts.toString());
map.insert(QLatin1String(VersionKey), d->version);
map.insert(QLatin1String(DebugServerKey), d->debugServerPath.toVariant());
map.insert(QLatin1String(QmlRuntimeKey), d->qmlRunCommand.toVariant());
map.insert(QLatin1String(DebugServerKey), d->debugServerPath.toSettings());
map.insert(QLatin1String(QmlRuntimeKey), d->qmlRunCommand.toSettings());
map.insert(ExtraDataKey, d->extraData);
return map;

View File

@@ -795,8 +795,8 @@ bool PathChooserField::parseData(const QVariant &data, QString *errorMessage)
QVariantMap tmp = data.toMap();
m_path = FilePath::fromVariant(consumeValue(tmp, "path"));
m_basePath = FilePath::fromVariant(consumeValue(tmp, "basePath"));
m_path = FilePath::fromSettings(consumeValue(tmp, "path"));
m_basePath = FilePath::fromSettings(consumeValue(tmp, "basePath"));
m_historyId = consumeValue(tmp, "historyId").toString();
QString kindStr = consumeValue(tmp, "kind", "existingDirectory").toString();
@@ -877,12 +877,12 @@ void PathChooserField::initializeData(MacroExpander *expander)
void PathChooserField::fromSettings(const QVariant &value)
{
m_path = FilePath::fromVariant(value);
m_path = FilePath::fromSettings(value);
}
QVariant PathChooserField::toSettings() const
{
return qobject_cast<PathChooser *>(widget())->filePath().toVariant();
return qobject_cast<PathChooser *>(widget())->filePath().toSettings();
}
// --------------------------------------------------------------------

View File

@@ -211,9 +211,9 @@ Node *JsonSummaryPage::findWizardContextNode(Node *contextNode) const
// Static cast from void * to avoid qobject_cast (which needs a valid object) in value().
auto project = static_cast<Project *>(m_wizard->value(Constants::PROJECT_POINTER).value<void *>());
if (SessionManager::projects().contains(project) && project->rootProjectNode()) {
const QString path = m_wizard->value(Constants::PREFERRED_PROJECT_NODE_PATH).toString();
const FilePath path = FilePath::fromVariant(m_wizard->value(Constants::PREFERRED_PROJECT_NODE_PATH));
contextNode = project->rootProjectNode()->findNode([path](const Node *n) {
return path == n->filePath().toString();
return path == n->filePath();
});
}
}

View File

@@ -41,8 +41,8 @@ bool JsonWizardFileGenerator::setup(const QVariant &data, QString *errorMessage)
File f;
const QVariantMap tmp = d.toMap();
f.source = Utils::FilePath::fromVariant(tmp.value(QLatin1String("source")));
f.target = Utils::FilePath::fromVariant(tmp.value(QLatin1String("target")));
f.source = Utils::FilePath::fromSettings(tmp.value(QLatin1String("source")));
f.target = Utils::FilePath::fromSettings(tmp.value(QLatin1String("target")));
f.condition = tmp.value(QLatin1String("condition"), true);
f.isBinary = tmp.value(QLatin1String("isBinary"), false);
f.overwrite = tmp.value(QLatin1String("overwrite"), false);

View File

@@ -2487,7 +2487,7 @@ void ProjectExplorerPluginPrivate::updateWelcomePage()
void ProjectExplorerPluginPrivate::loadSesssionTasks()
{
const FilePath filePath = FilePath::fromVariant(
const FilePath filePath = FilePath::fromSettings(
SessionManager::value(Constants::SESSION_TASKFILE_KEY));
if (!filePath.isEmpty())
TaskFile::openTasks(filePath);

View File

@@ -482,10 +482,8 @@ bool SessionManager::save()
}
} else {
// save the startup project
if (d->m_startupProject) {
data.insert(QLatin1String("StartupProject"),
d->m_startupProject->projectFilePath().toString());
}
if (d->m_startupProject)
data.insert("StartupProject", d->m_startupProject->projectFilePath().toSettings());
const QColor c = StyleHelper::requestedBaseColor();
if (c.isValid()) {
@@ -941,7 +939,7 @@ void SessionManagerPrivate::askUserAboutFailedProjects()
void SessionManagerPrivate::restoreStartupProject(const PersistentSettingsReader &reader)
{
const FilePath startupProject = FilePath::fromVariant(reader.restoreValue("StartupProject"));
const FilePath startupProject = FilePath::fromSettings(reader.restoreValue("StartupProject"));
if (!startupProject.isEmpty()) {
for (Project *pro : std::as_const(m_projects)) {
if (pro->projectFilePath() == startupProject) {

View File

@@ -174,7 +174,7 @@ bool TaskFile::load(QString *errorString, const FilePath &fileName)
bool result = parseTaskFile(errorString, fileName);
if (result) {
if (!SessionManager::isDefaultSession(SessionManager::activeSession()))
SessionManager::setValue(Constants::SESSION_TASKFILE_KEY, fileName.toVariant());
SessionManager::setValue(Constants::SESSION_TASKFILE_KEY, fileName.toSettings());
} else {
stopMonitoring();
}

View File

@@ -259,7 +259,7 @@ QVariantMap ToolChain::toMap() const
if (!d->m_targetAbiKey.isEmpty())
result.insert(d->m_targetAbiKey, d->m_targetAbi.toString());
if (!d->m_compilerCommandKey.isEmpty())
result.insert(d->m_compilerCommandKey, d->m_compilerCommand.toVariant());
result.insert(d->m_compilerCommandKey, d->m_compilerCommand.toSettings());
return result;
}
@@ -382,7 +382,7 @@ bool ToolChain::fromMap(const QVariantMap &data)
if (!d->m_targetAbiKey.isEmpty())
d->m_targetAbi = Abi::fromString(data.value(d->m_targetAbiKey).toString());
d->m_compilerCommand = FilePath::fromVariant(data.value(d->m_compilerCommandKey));
d->m_compilerCommand = FilePath::fromSettings(data.value(d->m_compilerCommandKey));
d->m_isValid.reset();
return true;
@@ -695,16 +695,16 @@ static QString badToolchainTimestampKey() { return {"Timestamp"}; }
QVariantMap BadToolchain::toMap() const
{
return {{badToolchainFilePathKey(), filePath.toVariant()},
{badToolchainSymlinkTargetKey(), symlinkTarget.toVariant()},
return {{badToolchainFilePathKey(), filePath.toSettings()},
{badToolchainSymlinkTargetKey(), symlinkTarget.toSettings()},
{badToolchainTimestampKey(), timestamp.toMSecsSinceEpoch()}};
}
BadToolchain BadToolchain::fromMap(const QVariantMap &map)
{
return {
FilePath::fromVariant(map.value(badToolchainFilePathKey())),
FilePath::fromVariant(map.value(badToolchainSymlinkTargetKey())),
FilePath::fromSettings(map.value(badToolchainFilePathKey())),
FilePath::fromSettings(map.value(badToolchainSymlinkTargetKey())),
QDateTime::fromMSecsSinceEpoch(map.value(badToolchainTimestampKey()).toLongLong())
};
}

View File

@@ -821,7 +821,7 @@ void PythonSettings::initFromSettings(QSettings *settings)
auto interpreterList = interpreterVar.toList();
const Interpreter interpreter{interpreterList.value(0).toString(),
interpreterList.value(1).toString(),
FilePath::fromVariant(interpreterList.value(2)),
FilePath::fromSettings(interpreterList.value(2)),
interpreterList.value(3, true).toBool()};
if (interpreterList.size() == 3)
oldSettings << interpreter;
@@ -865,7 +865,7 @@ void PythonSettings::writeToSettings(QSettings *settings)
for (const Interpreter &interpreter : m_interpreters) {
QVariantList interpreterVar{interpreter.id,
interpreter.name,
interpreter.command.toVariant()};
interpreter.command.toSettings()};
interpretersVar.append(QVariant(interpreterVar)); // old settings
interpreterVar.append(interpreter.autoDetected);
interpretersVar.append(QVariant(interpreterVar)); // new settings

View File

@@ -1152,7 +1152,7 @@ void QbsBuildSystem::updateDeploymentInfo()
const QJsonObject installData = artifact.value("install-data").toObject();
if (installData.value("is-installable").toBool()) {
deploymentData.addFile(
FilePath::fromVariant(artifact.value("file-path")),
FilePath::fromSettings(artifact.value("file-path")),
QFileInfo(installData.value("install-file-path").toString()).path(),
artifact.value("is-executable").toBool()
? DeployableFile::TypeExecutable : DeployableFile::TypeNormal);

View File

@@ -114,7 +114,7 @@ std::unique_ptr<QmlProjectItem> QmlProjectFileFormat::parseProjectFile(const Uti
const auto targetDirectoryPropery = rootNode->property("targetDirectory");
if (targetDirectoryPropery.isValid())
projectItem->setTargetDirectory(FilePath::fromVariant(targetDirectoryPropery.value));
projectItem->setTargetDirectory(FilePath::fromSettings(targetDirectoryPropery.value));
const auto qtForMCUProperty = rootNode->property("qtForMCUs");
if (qtForMCUProperty.isValid() && qtForMCUProperty.value.toBool())

View File

@@ -112,14 +112,14 @@ QString QnxQtVersion::cpuDir() const
QVariantMap QnxQtVersion::toMap() const
{
QVariantMap result = QtVersion::toMap();
result.insert(SDP_PATH_KEY, sdpPath().toVariant());
result.insert(SDP_PATH_KEY, sdpPath().toSettings());
return result;
}
void QnxQtVersion::fromMap(const QVariantMap &map)
{
QtVersion::fromMap(map);
setSdpPath(FilePath::fromVariant(map.value(SDP_PATH_KEY)));
setSdpPath(FilePath::fromSettings(map.value(SDP_PATH_KEY)));
}
Abis QnxQtVersion::detectQtAbis() const

View File

@@ -135,7 +135,7 @@ QStringList QnxToolChain::suggestedMkspecList() const
QVariantMap QnxToolChain::toMap() const
{
QVariantMap data = GccToolChain::toMap();
data.insert(QLatin1String(CompilerSdpPath), m_sdpPath.toVariant());
data.insert(QLatin1String(CompilerSdpPath), m_sdpPath.toSettings());
data.insert(QLatin1String(CpuDirKey), m_cpuDir);
return data;
}
@@ -145,7 +145,7 @@ bool QnxToolChain::fromMap(const QVariantMap &data)
if (!GccToolChain::fromMap(data))
return false;
m_sdpPath = FilePath::fromVariant(data.value(CompilerSdpPath));
m_sdpPath = FilePath::fromSettings(data.value(CompilerSdpPath));
m_cpuDir = data.value(QLatin1String(CpuDirKey)).toString();
// Make the ABIs QNX specific (if they aren't already).

View File

@@ -649,7 +649,7 @@ void QtVersion::fromMap(const QVariantMap &map)
d->m_isAutodetected = map.value(QTVERSIONAUTODETECTED).toBool();
d->m_detectionSource = map.value(QTVERSIONDETECTIONSOURCE).toString();
d->m_overrideFeatures = Utils::Id::fromStringList(map.value(QTVERSION_OVERRIDE_FEATURES).toStringList());
d->m_qmakeCommand = FilePath::fromVariant(map.value(QTVERSIONQMAKEPATH));
d->m_qmakeCommand = FilePath::fromSettings(map.value(QTVERSIONQMAKEPATH));
FilePath qmake = d->m_qmakeCommand;
// FIXME: Check this is still needed or whether ProcessArgs::splitArg handles it.
@@ -666,7 +666,7 @@ void QtVersion::fromMap(const QVariantMap &map)
}
}
d->m_data.qtSources = FilePath::fromVariant(map.value(QTVERSIONSOURCEPATH));
d->m_data.qtSources = FilePath::fromSettings(map.value(QTVERSIONSOURCEPATH));
// Handle ABIs provided by the SDKTool:
// Note: Creator does not write these settings itself, so it has to come from the SDKTool!
@@ -692,7 +692,7 @@ QVariantMap QtVersion::toMap() const
if (!d->m_overrideFeatures.isEmpty())
result.insert(QTVERSION_OVERRIDE_FEATURES, Utils::Id::toStringList(d->m_overrideFeatures));
result.insert(QTVERSIONQMAKEPATH, qmakeFilePath().toVariant());
result.insert(QTVERSIONQMAKEPATH, qmakeFilePath().toSettings());
return result;
}

View File

@@ -94,7 +94,7 @@ QString ExamplesWelcomePage::copyToAlternativeLocation(const QFileInfo& proFileI
chooser->setHistoryCompleter(QLatin1String("Qt.WritableExamplesDir.History"));
const QString defaultRootDirectory = DocumentManager::projectsDirectory().toString();
QtcSettings *settings = ICore::settings();
chooser->setFilePath(FilePath::fromVariant(settings->value(C_FALLBACK_ROOT, defaultRootDirectory)));
chooser->setFilePath(FilePath::fromSettings(settings->value(C_FALLBACK_ROOT, defaultRootDirectory)));
lay->addWidget(txt, 1, 0);
lay->addWidget(chooser, 1, 1);
enum { Copy = QDialog::Accepted + 1, Keep = QDialog::Accepted + 2 };

View File

@@ -826,7 +826,7 @@ static std::optional<FilePath> currentlyLinkedQtDir(bool *hasInstallSettings)
const QVariant value = QSettings(installSettingsFilePath, QSettings::IniFormat)
.value(kInstallSettingsKey);
if (value.isValid())
return FilePath::fromVariant(value);
return FilePath::fromSettings(value);
}
return {};
}

View File

@@ -155,7 +155,7 @@ void DeploymentTimeInfo::importDeployTimes(const QVariantMap &map)
sysrootList.size());
for (int i = 0; i < elemCount; ++i) {
const DeployableFile df(FilePath::fromVariant(fileList.at(i)),
const DeployableFile df(FilePath::fromSettings(fileList.at(i)),
remotePathList.at(i).toString());
const DeployParameters dp{df, hostList.at(i).toString(), sysrootList.at(i).toString()};
d->lastDeployed.insert(dp, { localTimesList.at(i).toDateTime(),

View File

@@ -450,7 +450,7 @@ void MainWidget::saveScreenShot()
QSettings *s = Core::ICore::settings();
const QString documentsLocation = QStandardPaths::writableLocation(QStandardPaths::DocumentsLocation);
const FilePath lastFolder = FilePath::fromVariant(
const FilePath lastFolder = FilePath::fromSettings(
s->value(Constants::C_SETTINGS_LASTSAVESCREENSHOTFOLDER, documentsLocation));
const FilePath filePath = FileUtils::getSaveFilePath(this,
Tr::tr("Save Screenshot"),
@@ -460,7 +460,7 @@ void MainWidget::saveScreenShot()
const QImage image = view->view()->grabView();
if (image.save(filePath.toString())) {
s->setValue(Constants::C_SETTINGS_LASTSAVESCREENSHOTFOLDER, filePath.parentDir().toVariant());
s->setValue(Constants::C_SETTINGS_LASTSAVESCREENSHOTFOLDER, filePath.parentDir().toSettings());
} else {
QMessageBox::warning(this, Tr::tr("Saving Failed"), Tr::tr("Could not save the screenshot."));
}

View File

@@ -79,7 +79,7 @@ void FontSettings::toSettings(QSettings *s) const
auto schemeFileNames = s->value(QLatin1String(schemeFileNamesKey)).toMap();
if (m_schemeFileName != defaultSchemeFileName() || schemeFileNames.contains(Utils::creatorTheme()->id())) {
schemeFileNames.insert(Utils::creatorTheme()->id(), m_schemeFileName.toVariant());
schemeFileNames.insert(Utils::creatorTheme()->id(), m_schemeFileName.toSettings());
s->setValue(QLatin1String(schemeFileNamesKey), schemeFileNames);
}
@@ -106,7 +106,7 @@ bool FontSettings::fromSettings(const FormatDescriptions &descriptions, const QS
// Load the selected color scheme for the current theme
auto schemeFileNames = s->value(group + QLatin1String(schemeFileNamesKey)).toMap();
if (schemeFileNames.contains(Utils::creatorTheme()->id())) {
const FilePath scheme = FilePath::fromVariant(schemeFileNames.value(Utils::creatorTheme()->id()));
const FilePath scheme = FilePath::fromSettings(schemeFileNames.value(Utils::creatorTheme()->id()));
loadColorScheme(scheme, descriptions);
}
}

View File

@@ -27,7 +27,7 @@ void HighlighterSettings::toSettings(const QString &category, QSettings *s) cons
{
const QString &group = groupSpecifier(Constants::HIGHLIGHTER_SETTINGS_CATEGORY, category);
s->beginGroup(group);
s->setValue(kDefinitionFilesPath, m_definitionFilesPath.toVariant());
s->setValue(kDefinitionFilesPath, m_definitionFilesPath.toSettings());
s->setValue(kIgnoredFilesPatterns, ignoredFilesPatterns());
s->endGroup();
}
@@ -36,11 +36,11 @@ void HighlighterSettings::fromSettings(const QString &category, QSettings *s)
{
const QString &group = groupSpecifier(Constants::HIGHLIGHTER_SETTINGS_CATEGORY, category);
s->beginGroup(group);
m_definitionFilesPath = FilePath::fromVariant(s->value(kDefinitionFilesPath));
m_definitionFilesPath = FilePath::fromSettings(s->value(kDefinitionFilesPath));
if (!s->contains(kDefinitionFilesPath))
assignDefaultDefinitionsPath();
else
m_definitionFilesPath = FilePath::fromVariant(s->value(kDefinitionFilesPath));
m_definitionFilesPath = FilePath::fromSettings(s->value(kDefinitionFilesPath));
if (!s->contains(kIgnoredFilesPatterns))
assignDefaultIgnoredPatterns();
else

View File

@@ -340,7 +340,7 @@ void UpdateInfoPlugin::loadSettings() const
UpdateInfoPluginPrivate::Settings def;
QSettings *settings = ICore::settings();
const QString updaterKey = QLatin1String(UpdaterGroup) + '/';
d->m_maintenanceTool = FilePath::fromVariant(settings->value(updaterKey + MaintenanceToolKey));
d->m_maintenanceTool = FilePath::fromSettings(settings->value(updaterKey + MaintenanceToolKey));
d->m_lastCheckDate = settings->value(updaterKey + LastCheckDateKey, QDate()).toDate();
d->m_settings.automaticCheck
= settings->value(updaterKey + AutomaticCheckKey, def.automaticCheck).toBool();

View File

@@ -1429,7 +1429,7 @@ void HeobDialog::updateProfile()
int leakRecording = settings->value(heobLeakRecordingC, 2).toInt();
bool attach = settings->value(heobAttachC, false).toBool();
const QString extraArgs = settings->value(heobExtraArgsC).toString();
FilePath path = FilePath::fromVariant(settings->value(heobPathC));
FilePath path = FilePath::fromSettings(settings->value(heobPathC));
settings->endGroup();
if (path.isEmpty()) {
@@ -1486,7 +1486,7 @@ void HeobDialog::saveOptions()
settings->setValue(heobLeakRecordingC, m_leakRecordingCombo->currentIndex());
settings->setValue(heobAttachC, m_attachCheck->isChecked());
settings->setValue(heobExtraArgsC, m_extraArgsEdit->text());
settings->setValue(heobPathC, m_pathChooser->filePath().toString());
settings->setValue(heobPathC, m_pathChooser->filePath().toSettings());
settings->endGroup();
}

View File

@@ -309,7 +309,7 @@ bool VcsBaseClient::synchronousPull(const FilePath &workingDir,
const bool ok = vcsSynchronousExec(workingDir, args, flags).result()
== ProcessResult::FinishedWithSuccess;
if (ok)
emit changed(workingDir.toString());
emit changed(workingDir.toVariant());
return ok;
}

View File

@@ -89,7 +89,7 @@ WizardPage *VcsCommandPageFactory::create(JsonWizard *wizard, Id typeId, const Q
for (const QVariant &value : values) {
const QVariantMap job = value.toMap();
const bool skipEmpty = job.value(QLatin1String(JOB_SKIP_EMPTY), true).toBool();
const FilePath workDir = FilePath::fromVariant(job.value(QLatin1String(JOB_WORK_DIRECTORY)));
const FilePath workDir = FilePath::fromSettings(job.value(QLatin1String(JOB_WORK_DIRECTORY)));
const QString cmdString = job.value(QLatin1String(JOB_COMMAND)).toString();
QTC_ASSERT(!cmdString.isEmpty(), continue);

View File

@@ -223,7 +223,7 @@ QVariantMap AddDebuggerData::addDebugger(const QVariantMap &map) const
data << KeyValuePair(QStringList() << debugger << QLatin1String(ABIS), QVariant(m_abis));
data << KeyValuePair(QStringList() << debugger << QLatin1String(ENGINE_TYPE), QVariant(m_engine));
data << KeyValuePair(QStringList() << debugger << QLatin1String(BINARY),
Utils::FilePath::fromUserInput(m_binary).toVariant());
Utils::FilePath::fromUserInput(m_binary).toSettings());
data << KeyValuePair(QStringList() << QLatin1String(COUNT), QVariant(count + 1));

View File

@@ -686,7 +686,7 @@ QVariantMap AddKitData::addKit(const QVariantMap &map,
data << KeyValuePair({kit, DATA, BUILDDEVICE_ID}, QVariant(m_buildDevice));
if (!m_sysRoot.isNull())
data << KeyValuePair({kit, DATA, SYSROOT},
Utils::FilePath::fromUserInput(m_sysRoot).toVariant());
Utils::FilePath::fromUserInput(m_sysRoot).toSettings());
for (auto i = m_tcs.constBegin(); i != m_tcs.constEnd(); ++i)
data << KeyValuePair({kit, DATA, TOOLCHAIN, i.key()}, QVariant(i.value()));
if (!qtId.isNull())

View File

@@ -291,7 +291,7 @@ QVariantMap AddQtData::addQt(const QVariantMap &map) const
data << KeyValuePair(QStringList() << qt << QLatin1String(AUTODETECTED), QVariant(true));
data << KeyValuePair(QStringList() << qt << QLatin1String(AUTODETECTION_SOURCE), QVariant(sdkId));
data << KeyValuePair(QStringList() << qt << QLatin1String(QMAKE), saneQmake.toVariant());
data << KeyValuePair(QStringList() << qt << QLatin1String(QMAKE), saneQmake.toSettings());
data << KeyValuePair(QStringList() << qt << QLatin1String(TYPE), QVariant(m_type));
data << KeyValuePair(QStringList() << qt << ABIS, QVariant(m_abis));

View File

@@ -283,7 +283,7 @@ QVariantMap AddToolChainData::addToolChain(const QVariantMap &map) const
data << KeyValuePair({tc, LANGUAGE_KEY_V2}, QVariant(newLang));
data << KeyValuePair({tc, DISPLAYNAME}, QVariant(m_displayName));
data << KeyValuePair({tc, AUTODETECTED}, QVariant(true));
data << KeyValuePair({tc, PATH}, Utils::FilePath::fromUserInput(m_path).toVariant());
data << KeyValuePair({tc, PATH}, Utils::FilePath::fromUserInput(m_path).toSettings());
data << KeyValuePair({tc, TARGET_ABI}, QVariant(m_targetAbi));
QVariantList abis;
const QStringList abiStrings = m_supportedAbis.split(',');