Utils: Rename PathChooser::rawFilePath() to unxepandedFilePath()

That's what the implementation does, and judging from the using code
wasn't quite clear.

Change-Id: I4ca776ba4da83a36162adad2dd595eb39eb0f43d
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
hjk
2024-06-13 11:24:01 +02:00
parent 282960528e
commit 39570fb675
18 changed files with 26 additions and 26 deletions

View File

@@ -342,14 +342,14 @@ void PathChooser::setEnvironment(const Environment &env)
} }
} }
FilePath PathChooser::rawFilePath() const FilePath PathChooser::unexpandedFilePath() const
{ {
return FilePath::fromUserInput(d->m_lineEdit->text()); return FilePath::fromUserInput(d->m_lineEdit->text());
} }
FilePath PathChooser::filePath() const FilePath PathChooser::filePath() const
{ {
return d->expandedPath(rawFilePath()); return d->expandedPath(unexpandedFilePath());
} }
FilePath PathChooser::absoluteFilePath() const FilePath PathChooser::absoluteFilePath() const

View File

@@ -67,10 +67,10 @@ public:
bool isValid() const; bool isValid() const;
QString errorMessage() const; QString errorMessage() const;
FilePath filePath() const; // Close to what's in the line edit. FilePath filePath() const; // Close to what's in the line edit. Expands macros.
FilePath absoluteFilePath() const; // Relative paths resolved wrt the specified base dir. FilePath absoluteFilePath() const; // Relative paths resolved wrt the specified base dir.
FilePath rawFilePath() const; // The raw unexpanded input as FilePath. FilePath unexpandedFilePath() const; // The raw unexpanded input as FilePath.
FilePath baseDirectory() const; FilePath baseDirectory() const;
void setBaseDirectory(const FilePath &base); void setBaseDirectory(const FilePath &base);

View File

@@ -140,7 +140,7 @@ AndroidBuildApkWidget::AndroidBuildApkWidget(AndroidBuildApkStep *step)
keystoreLocationChooser->setPromptDialogFilter(Tr::tr("Keystore files (*.keystore *.jks)")); keystoreLocationChooser->setPromptDialogFilter(Tr::tr("Keystore files (*.keystore *.jks)"));
keystoreLocationChooser->setPromptDialogTitle(Tr::tr("Select Keystore File")); keystoreLocationChooser->setPromptDialogTitle(Tr::tr("Select Keystore File"));
connect(keystoreLocationChooser, &PathChooser::textChanged, this, [this, keystoreLocationChooser] { connect(keystoreLocationChooser, &PathChooser::textChanged, this, [this, keystoreLocationChooser] {
const FilePath file = keystoreLocationChooser->rawFilePath(); const FilePath file = keystoreLocationChooser->unexpandedFilePath();
m_step->setKeystorePath(file); m_step->setKeystorePath(file);
m_signPackageCheckBox->setChecked(!file.isEmpty()); m_signPackageCheckBox->setChecked(!file.isEmpty());
if (!file.isEmpty()) if (!file.isEmpty())

View File

@@ -151,7 +151,7 @@ ChooseDirectoryPage::ChooseDirectoryPage(CreateAndroidManifestWizard *wizard)
m_layout->addRow(m_sourceDirectoryWarning); m_layout->addRow(m_sourceDirectoryWarning);
connect(m_androidPackageSourceDir, &PathChooser::textChanged, m_wizard, [this] { connect(m_androidPackageSourceDir, &PathChooser::textChanged, m_wizard, [this] {
m_wizard->setDirectory(m_androidPackageSourceDir->rawFilePath()); m_wizard->setDirectory(m_androidPackageSourceDir->unexpandedFilePath());
}); });
if (wizard->copyGradle()) { if (wizard->copyGradle()) {

View File

@@ -99,12 +99,12 @@ SettingsWidget::~SettingsWidget()
FilePath SettingsWidget::clangTidyPath() const FilePath SettingsWidget::clangTidyPath() const
{ {
return m_clangTidyPathChooser->rawFilePath(); return m_clangTidyPathChooser->unexpandedFilePath();
} }
FilePath SettingsWidget::clazyStandalonePath() const FilePath SettingsWidget::clazyStandalonePath() const
{ {
return m_clazyStandalonePathChooser->rawFilePath(); return m_clazyStandalonePathChooser->unexpandedFilePath();
} }
// ClangToolsOptionsPage // ClangToolsOptionsPage

View File

@@ -177,7 +177,7 @@ SettingsPageWidget::SettingsPageWidget()
void SettingsPageWidget::apply() void SettingsPageWidget::apply()
{ {
ClearCaseSettings rc; ClearCaseSettings rc;
rc.ccCommand = commandPathChooser->rawFilePath().toString(); rc.ccCommand = commandPathChooser->unexpandedFilePath().toString();
rc.ccBinaryPath = commandPathChooser->filePath(); rc.ccBinaryPath = commandPathChooser->filePath();
rc.timeOutS = timeOutSpinBox->value(); rc.timeOutS = timeOutSpinBox->value();
rc.autoCheckOut = autoCheckOutCheckBox->isChecked(); rc.autoCheckOut = autoCheckOutCheckBox->isChecked();

View File

@@ -94,8 +94,8 @@ void ConfigModelItemDelegate::setModelData(QWidget *editor, QAbstractItemModel *
ConfigModel::DataItem data = ConfigModel::dataItemFromIndex(index); ConfigModel::DataItem data = ConfigModel::dataItemFromIndex(index);
if (data.type == ConfigModel::DataItem::FILE || data.type == ConfigModel::DataItem::DIRECTORY) { if (data.type == ConfigModel::DataItem::FILE || data.type == ConfigModel::DataItem::DIRECTORY) {
auto edit = static_cast<PathChooser *>(editor); auto edit = static_cast<PathChooser *>(editor);
if (edit->rawFilePath().toString() != data.value) if (edit->unexpandedFilePath().toString() != data.value)
model->setData(index, edit->rawFilePath().toString(), Qt::EditRole); model->setData(index, edit->unexpandedFilePath().toString(), Qt::EditRole);
return; return;
} else if (!data.values.isEmpty()) { } else if (!data.values.isEmpty()) {
auto edit = static_cast<QComboBox *>(editor); auto edit = static_cast<QComboBox *>(editor);

View File

@@ -700,12 +700,12 @@ void ExternalToolConfig::updateItem(const QModelIndex &index)
tool->setDescription(m_description->text()); tool->setDescription(m_description->text());
FilePaths executables = tool->executables(); FilePaths executables = tool->executables();
if (executables.size() > 0) if (executables.size() > 0)
executables[0] = m_executable->rawFilePath(); executables[0] = m_executable->unexpandedFilePath();
else else
executables << m_executable->rawFilePath(); executables << m_executable->unexpandedFilePath();
tool->setExecutables(executables); tool->setExecutables(executables);
tool->setArguments(m_arguments->text()); tool->setArguments(m_arguments->text());
tool->setWorkingDirectory(m_workingDirectory->rawFilePath()); tool->setWorkingDirectory(m_workingDirectory->unexpandedFilePath());
tool->setBaseEnvironmentProviderId(Id::fromSetting(m_baseEnvironment->currentData())); tool->setBaseEnvironmentProviderId(Id::fromSetting(m_baseEnvironment->currentData()));
tool->setEnvironmentUserChanges(m_environment); tool->setEnvironmentUserChanges(m_environment);
tool->setOutputHandling(ExternalTool::OutputHandling(m_outputBehavior->currentIndex())); tool->setOutputHandling(ExternalTool::OutputHandling(m_outputBehavior->currentIndex()));

View File

@@ -231,7 +231,7 @@ bool SpotlightLocatorFilter::openConfigDialog(QWidget *parent, bool &needsRefres
chooser->addSupportedWidget(caseSensitiveArgumentsEdit); chooser->addSupportedWidget(caseSensitiveArgumentsEdit);
const bool accepted = ILocatorFilter::openConfigDialog(parent, &configWidget); const bool accepted = ILocatorFilter::openConfigDialog(parent, &configWidget);
if (accepted) { if (accepted) {
m_command = commandEdit->rawFilePath().toString(); m_command = commandEdit->unexpandedFilePath().toString();
m_arguments = argumentsEdit->text(); m_arguments = argumentsEdit->text();
m_caseSensitiveArguments = caseSensitiveArgumentsEdit->text(); m_caseSensitiveArguments = caseSensitiveArgumentsEdit->text();
m_sortResults = sortResults->isChecked(); m_sortResults = sortResults->isChecked();

View File

@@ -309,7 +309,7 @@ QString DebuggerSourcePathMappingWidget::editSourceField() const
QString DebuggerSourcePathMappingWidget::editTargetField() const QString DebuggerSourcePathMappingWidget::editTargetField() const
{ {
return m_targetChooser->rawFilePath().toString(); return m_targetChooser->unexpandedFilePath().toString();
} }
void DebuggerSourcePathMappingWidget::setEditFieldMapping(const Mapping &m) void DebuggerSourcePathMappingWidget::setEditFieldMapping(const Mapping &m)

View File

@@ -163,10 +163,10 @@ int AttachCoreDialog::exec()
{ {
connect(d->symbolFileName, &PathChooser::validChanged, this, &AttachCoreDialog::changed); connect(d->symbolFileName, &PathChooser::validChanged, this, &AttachCoreDialog::changed);
connect(d->coreFileName, &PathChooser::validChanged, this, [this] { connect(d->coreFileName, &PathChooser::validChanged, this, [this] {
coreFileChanged(d->coreFileName->rawFilePath()); coreFileChanged(d->coreFileName->unexpandedFilePath());
}); });
connect(d->coreFileName, &PathChooser::textChanged, this, [this] { connect(d->coreFileName, &PathChooser::textChanged, this, [this] {
coreFileChanged(d->coreFileName->rawFilePath()); coreFileChanged(d->coreFileName->unexpandedFilePath());
}); });
connect(d->kitChooser, &KitChooser::currentIndexChanged, this, &AttachCoreDialog::changed); connect(d->kitChooser, &KitChooser::currentIndexChanged, this, &AttachCoreDialog::changed);
connect(d->buttonBox, &QDialogButtonBox::rejected, this, &QDialog::reject); connect(d->buttonBox, &QDialogButtonBox::rejected, this, &QDialog::reject);

View File

@@ -90,7 +90,7 @@ public:
&Utils::PathChooser::textChanged, &Utils::PathChooser::textChanged,
bc, bc,
[bc, buildDirectoryInput](const QString &) { [bc, buildDirectoryInput](const QString &) {
bc->setBuildDirectory(buildDirectoryInput->rawFilePath()); bc->setBuildDirectory(buildDirectoryInput->unexpandedFilePath());
}); });
} }
}; };

View File

@@ -132,7 +132,7 @@ void CommandBuilderAspect::addToLayout(Layouting::Layout &parent)
d->makePathChooser->setBaseDirectory(PathChooser::homePath()); d->makePathChooser->setBaseDirectory(PathChooser::homePath());
d->makePathChooser->setHistoryCompleter("IncrediBuild.BuildConsole.MakeCommand.History"); d->makePathChooser->setHistoryCompleter("IncrediBuild.BuildConsole.MakeCommand.History");
connect(d->makePathChooser, &PathChooser::rawPathChanged, this, [this] { connect(d->makePathChooser, &PathChooser::rawPathChanged, this, [this] {
d->m_activeCommandBuilder->setCommand(d->makePathChooser->rawFilePath()); d->m_activeCommandBuilder->setCommand(d->makePathChooser->unexpandedFilePath());
updateGui(); updateGui();
}); });
} }

View File

@@ -314,7 +314,7 @@ QWidget *McuPackage::widget()
QObject::connect(this, &McuPackage::statusChanged, widget, [this] { updateStatusUi(); }); QObject::connect(this, &McuPackage::statusChanged, widget, [this] { updateStatusUi(); });
QObject::connect(m_fileChooser, &PathChooser::textChanged, this, [this] { QObject::connect(m_fileChooser, &PathChooser::textChanged, this, [this] {
setPath(m_fileChooser->rawFilePath()); setPath(m_fileChooser->unexpandedFilePath());
}); });
connect(this, &McuPackage::changed, m_fileChooser, [this] { connect(this, &McuPackage::changed, m_fileChooser, [this] {

View File

@@ -141,7 +141,7 @@ public:
// Connect // Connect
connect(m_compilerCommand, &PathChooser::validChanged, this, [this] { connect(m_compilerCommand, &PathChooser::validChanged, this, [this] {
const FilePath path = m_compilerCommand->rawFilePath(); const FilePath path = m_compilerCommand->unexpandedFilePath();
auto tc = static_cast<NimToolchain *>(toolchain()); auto tc = static_cast<NimToolchain *>(toolchain());
QTC_ASSERT(tc, return); QTC_ASSERT(tc, return);
tc->setCompilerCommand(path); tc->setCompilerCommand(path);

View File

@@ -186,7 +186,7 @@ void WorkingDirectoryAspect::addToLayout(Layout &builder)
m_chooser->setBaseDirectory(m_defaultWorkingDirectory); m_chooser->setBaseDirectory(m_defaultWorkingDirectory);
m_chooser->setFilePath(m_workingDirectory.isEmpty() ? m_defaultWorkingDirectory : m_workingDirectory); m_chooser->setFilePath(m_workingDirectory.isEmpty() ? m_defaultWorkingDirectory : m_workingDirectory);
connect(m_chooser.data(), &PathChooser::textChanged, this, [this] { connect(m_chooser.data(), &PathChooser::textChanged, this, [this] {
m_workingDirectory = m_chooser->rawFilePath(); m_workingDirectory = m_chooser->unexpandedFilePath();
m_resetButton->setEnabled(m_workingDirectory != m_defaultWorkingDirectory); m_resetButton->setEnabled(m_workingDirectory != m_defaultWorkingDirectory);
}); });

View File

@@ -610,7 +610,7 @@ void QbsBuildStepConfigWidget::changeUseDefaultInstallDir(bool useDefault)
if (useDefault) if (useDefault)
config.remove(Constants::QBS_INSTALL_ROOT_KEY); config.remove(Constants::QBS_INSTALL_ROOT_KEY);
else else
config.insert(Constants::QBS_INSTALL_ROOT_KEY, installDirChooser->rawFilePath().toString()); config.insert(Constants::QBS_INSTALL_ROOT_KEY, installDirChooser->unexpandedFilePath().toString());
m_qbsStep->setQbsConfiguration(config); m_qbsStep->setQbsConfiguration(config);
} }
@@ -620,7 +620,7 @@ void QbsBuildStepConfigWidget::changeInstallDir()
return; return;
const GuardLocker locker(m_ignoreChanges); const GuardLocker locker(m_ignoreChanges);
Store config = m_qbsStep->qbsConfiguration(QbsBuildStep::PreserveVariables); Store config = m_qbsStep->qbsConfiguration(QbsBuildStep::PreserveVariables);
config.insert(Constants::QBS_INSTALL_ROOT_KEY, installDirChooser->rawFilePath().toString()); config.insert(Constants::QBS_INSTALL_ROOT_KEY, installDirChooser->unexpandedFilePath().toString());
m_qbsStep->setQbsConfiguration(config); m_qbsStep->setQbsConfiguration(config);
} }

View File

@@ -1036,7 +1036,7 @@ void QtSettingsPageWidget::linkWithQt()
dialog.exec(); dialog.exec();
if (dialog.result() == QDialog::Accepted) { if (dialog.result() == QDialog::Accepted) {
const std::optional<FilePath> settingsDir = settingsDirForQtDir(pathInput->baseDirectory(), const std::optional<FilePath> settingsDir = settingsDirForQtDir(pathInput->baseDirectory(),
pathInput->rawFilePath()); pathInput->unexpandedFilePath());
if (QTC_GUARD(settingsDir)) { if (QTC_GUARD(settingsDir)) {
const QString settingsFilePath = settingsFile(ICore::resourcePath().toString()); const QString settingsFilePath = settingsFile(ICore::resourcePath().toString());
QSettings settings(settingsFilePath, QSettings::IniFormat); QSettings settings(settingsFilePath, QSettings::IniFormat);