Utils: Rename FileName to FilePath

More in line with QFileInfo terminonlogy which appears to be
best-of-breed within Qt.

Change-Id: I1d051ff1c8363ebd4ee56376451df45216c4c9ab
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
hjk
2019-05-28 13:49:26 +02:00
parent 4704f49fbb
commit 473a741c9f
688 changed files with 3487 additions and 3484 deletions

View File

@@ -169,12 +169,12 @@ void ClangFormatConfigWidget::initChecksAndPreview()
m_preview->textDocument()->setFontSettings(TextEditor::TextEditorSettings::fontSettings());
m_preview->textDocument()->setSyntaxHighlighter(new CppEditor::CppHighlighter);
Utils::FileName fileName;
Utils::FilePath fileName;
if (m_project) {
connect(m_ui->applyButton, &QPushButton::clicked, this, &ClangFormatConfigWidget::apply);
fileName = m_project->projectFilePath().pathAppended("snippet.cpp");
} else {
fileName = Utils::FileName::fromString(Core::ICore::userResourcePath())
fileName = Utils::FilePath::fromString(Core::ICore::userResourcePath())
.pathAppended("snippet.cpp");
}
m_preview->textDocument()->indenter()->setFileName(fileName);
@@ -241,7 +241,7 @@ void ClangFormatConfigWidget::showGlobalCheckboxes()
static bool projectConfigExists()
{
return Utils::FileName::fromString(Core::ICore::userResourcePath())
return Utils::FilePath::fromString(Core::ICore::userResourcePath())
.pathAppended("clang-format")
.pathAppended(currentProjectUniqueId())
.pathAppended((Constants::SETTINGS_FILE_NAME))

View File

@@ -165,21 +165,21 @@ static bool useProjectOverriddenSettings()
return project ? project->namedSettings(Constants::OVERRIDE_FILE_ID).toBool() : false;
}
static Utils::FileName globalPath()
static Utils::FilePath globalPath()
{
return Utils::FileName::fromString(Core::ICore::userResourcePath());
return Utils::FilePath::fromString(Core::ICore::userResourcePath());
}
static Utils::FileName projectPath()
static Utils::FilePath projectPath()
{
const Project *project = SessionManager::startupProject();
if (project)
return globalPath().pathAppended("clang-format/" + currentProjectUniqueId());
return Utils::FileName();
return Utils::FilePath();
}
static QString findConfig(Utils::FileName fileName)
static QString findConfig(Utils::FilePath fileName)
{
QDir parentDir(fileName.parentDir().toString());
while (!parentDir.exists(Constants::SETTINGS_FILE_NAME)
@@ -193,7 +193,7 @@ static QString findConfig(Utils::FileName fileName)
return parentDir.filePath(Constants::SETTINGS_FILE_ALT_NAME);
}
static QString configForFile(Utils::FileName fileName, bool checkForSettings)
static QString configForFile(Utils::FilePath fileName, bool checkForSettings)
{
QDir overrideDir;
if (!checkForSettings || useProjectOverriddenSettings()) {
@@ -211,14 +211,14 @@ static QString configForFile(Utils::FileName fileName, bool checkForSettings)
return findConfig(fileName);
}
QString configForFile(Utils::FileName fileName)
QString configForFile(Utils::FilePath fileName)
{
return configForFile(fileName, true);
}
Utils::FileName assumedPathForConfig(const QString &configFile)
Utils::FilePath assumedPathForConfig(const QString &configFile)
{
Utils::FileName fileName = Utils::FileName::fromString(configFile);
Utils::FilePath fileName = Utils::FilePath::fromString(configFile);
return fileName.parentDir().pathAppended("test.cpp");
}
@@ -243,7 +243,7 @@ static clang::format::FormatStyle constructStyle(const QByteArray &baseStyle = Q
void createStyleFileIfNeeded(bool isGlobal)
{
const Utils::FileName path = isGlobal ? globalPath() : projectPath();
const Utils::FilePath path = isGlobal ? globalPath() : projectPath();
const QString configFile = path.pathAppended(Constants::SETTINGS_FILE_NAME).toString();
if (QFile::exists(configFile))
@@ -252,7 +252,7 @@ void createStyleFileIfNeeded(bool isGlobal)
QDir().mkpath(path.toString());
if (!isGlobal) {
const Project *project = SessionManager::startupProject();
Utils::FileName possibleProjectConfig = project->rootProjectDirectory().pathAppended(
Utils::FilePath possibleProjectConfig = project->rootProjectDirectory().pathAppended(
Constants::SETTINGS_FILE_NAME);
if (possibleProjectConfig.exists()) {
// Just copy th .clang-format if current project has one.
@@ -290,7 +290,7 @@ static QByteArray configBaseStyleName(const QString &configFile)
.trimmed();
}
static clang::format::FormatStyle styleForFile(Utils::FileName fileName, bool checkForSettings)
static clang::format::FormatStyle styleForFile(Utils::FilePath fileName, bool checkForSettings)
{
QString configFile = configForFile(fileName, checkForSettings);
if (configFile.isEmpty()) {
@@ -313,7 +313,7 @@ static clang::format::FormatStyle styleForFile(Utils::FileName fileName, bool ch
return constructStyle(configBaseStyleName(configFile));
}
clang::format::FormatStyle styleForFile(Utils::FileName fileName)
clang::format::FormatStyle styleForFile(Utils::FilePath fileName)
{
return styleForFile(fileName, true);
}

View File

@@ -47,7 +47,7 @@ clang::format::FormatStyle currentProjectStyle();
clang::format::FormatStyle currentGlobalStyle();
// Is the style from the matching .clang-format file or global one if it's not found.
QString configForFile(Utils::FileName fileName);
clang::format::FormatStyle styleForFile(Utils::FileName fileName);
QString configForFile(Utils::FilePath fileName);
clang::format::FormatStyle styleForFile(Utils::FilePath fileName);
}