forked from qt-creator/qt-creator
Utils: Remove FilePath::fromUrl()
Even though the concepts are similar, direct conversion is usually neither desired (lossy) nor needed. Change-Id: Id5c9e69d0597ed867cbda25f3fc4619a9fe90966 Reviewed-by: David Schulz <david.schulz@qt.io> Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
This commit is contained in:
@@ -149,11 +149,6 @@ QFileInfo FilePath::toFileInfo() const
|
||||
return QFileInfo(toFSPathString());
|
||||
}
|
||||
|
||||
FilePath FilePath::fromUrl(const QUrl &url)
|
||||
{
|
||||
return FilePath::fromParts(url.scheme(), url.host(), url.path());
|
||||
}
|
||||
|
||||
FilePath FilePath::fromParts(const QStringView scheme, const QStringView host, const QStringView path)
|
||||
{
|
||||
FilePath result;
|
||||
@@ -920,8 +915,10 @@ FilePath FilePath::fromUtf8(const char *filename, int filenameSize)
|
||||
|
||||
FilePath FilePath::fromVariant(const QVariant &variant)
|
||||
{
|
||||
if (variant.type() == QVariant::Url)
|
||||
return FilePath::fromUrl(variant.toUrl());
|
||||
if (variant.type() == QVariant::Url) {
|
||||
const QUrl url = variant.toUrl();
|
||||
return FilePath::fromParts(url.scheme(), url.host(), url.path());
|
||||
}
|
||||
return FilePath::fromUserInput(variant.toString());
|
||||
}
|
||||
|
||||
|
@@ -62,7 +62,6 @@ public:
|
||||
[[nodiscard]] static FilePath fromUserInput(const QString &filepath);
|
||||
[[nodiscard]] static FilePath fromUtf8(const char *filepath, int filepathSize = -1);
|
||||
[[nodiscard]] static FilePath fromVariant(const QVariant &variant);
|
||||
[[nodiscard]] static FilePath fromUrl(const QUrl &url);
|
||||
[[nodiscard]] static FilePath fromParts(const QStringView scheme, const QStringView host, const QStringView path);
|
||||
[[nodiscard]] static FilePath fromPathPart(const QStringView path);
|
||||
|
||||
|
@@ -405,15 +405,14 @@ static QWidget *dialogParent(QWidget *parent)
|
||||
return parent ? parent : s_dialogParentGetter ? s_dialogParentGetter() : nullptr;
|
||||
}
|
||||
|
||||
|
||||
FilePath qUrlToFilePath(const QUrl &url)
|
||||
static FilePath qUrlToFilePath(const QUrl &url)
|
||||
{
|
||||
if (url.isLocalFile())
|
||||
return FilePath::fromString(url.toLocalFile());
|
||||
return FilePath::fromUrl(url);
|
||||
return FilePath::fromParts(url.scheme(), url.host(), url.path());
|
||||
}
|
||||
|
||||
QUrl filePathToQUrl(const FilePath &filePath)
|
||||
static QUrl filePathToQUrl(const FilePath &filePath)
|
||||
{
|
||||
return QUrl::fromLocalFile(filePath.toFSPathString());
|
||||
}
|
||||
|
Reference in New Issue
Block a user