Rename "fromNativePath" to "toUniformPath"

Unlike "toNativePath" which name clearly reflects the function result
"fromNativePath" has no such clear meaning.
Since this function converts path into uniform format "toUniformPath"
is better name.
This commit is contained in:
Vladimir Golovnev (Glassez)
2019-06-16 20:14:15 +03:00
parent 206bb018dd
commit 8e65317d61
17 changed files with 54 additions and 47 deletions

View File

@@ -201,7 +201,7 @@ FileSystemPathEdit::~FileSystemPathEdit()
QString FileSystemPathEdit::selectedPath() const
{
return Utils::Fs::fromNativePath(editWidgetText());
return Utils::Fs::toUniformPath(editWidgetText());
}
void FileSystemPathEdit::setSelectedPath(const QString &val)
@@ -347,7 +347,7 @@ int FileSystemPathComboEdit::count() const
QString FileSystemPathComboEdit::item(int index) const
{
return Utils::Fs::fromNativePath(editWidget<WidgetType>()->itemText(index));
return Utils::Fs::toUniformPath(editWidget<WidgetType>()->itemText(index));
}
void FileSystemPathComboEdit::addItem(const QString &text)

View File

@@ -1368,9 +1368,9 @@ void MainWindow::on_actionOpen_triggered()
}
// Save last dir to remember it
QStringList topDir = Utils::Fs::fromNativePath(pathsList.at(0)).split('/');
QStringList topDir = Utils::Fs::toUniformPath(pathsList.at(0)).split('/');
topDir.removeLast();
pref->setMainLastDir(Utils::Fs::fromNativePath(topDir.join('/')));
pref->setMainLastDir(Utils::Fs::toUniformPath(topDir.join('/')));
}
}

View File

@@ -373,7 +373,7 @@ void PluginSelectDialog::iconDownloadFinished(const Net::DownloadResult &result)
return;
}
const QString filePath = Utils::Fs::fromNativePath(result.filePath);
const QString filePath = Utils::Fs::toUniformPath(result.filePath);
// Icon downloaded
QIcon icon(filePath);

View File

@@ -469,7 +469,7 @@ void TorrentContentModel::setupModelData(const BitTorrent::TorrentInfo &info)
// Iterate over files
for (int i = 0; i < filesCount; ++i) {
currentParent = m_rootItem;
QString path = Utils::Fs::fromNativePath(info.filePath(i));
QString path = Utils::Fs::toUniformPath(info.filePath(i));
// Iterate of parts of the path to create necessary folders
QStringList pathFolders = path.split('/', QString::SkipEmptyParts);
pathFolders.removeLast();

View File

@@ -139,7 +139,7 @@ void TorrentCreatorDialog::dragEnterEvent(QDragEnterEvent *event)
// Main function that create a .torrent file
void TorrentCreatorDialog::onCreateButtonClicked()
{
QString input = Utils::Fs::fromNativePath(m_ui->textInputPath->text()).trimmed();
QString input = Utils::Fs::toUniformPath(m_ui->textInputPath->text()).trimmed();
// test if readable
const QFileInfo fi(input);

View File

@@ -154,7 +154,7 @@ QPoint Utils::Gui::screenCenter(const QWidget *w)
// Open the given path with an appropriate application
void Utils::Gui::openPath(const QString &absolutePath)
{
const QString path = Utils::Fs::fromNativePath(absolutePath);
const QString path = Utils::Fs::toUniformPath(absolutePath);
// Hack to access samba shares with QDesktopServices::openUrl
if (path.startsWith("//"))
QDesktopServices::openUrl(Utils::Fs::toNativePath("file:" + path));
@@ -166,7 +166,7 @@ void Utils::Gui::openPath(const QString &absolutePath)
// (if possible) the item at the given path
void Utils::Gui::openFolderSelect(const QString &absolutePath)
{
const QString path = Utils::Fs::fromNativePath(absolutePath);
const QString path = Utils::Fs::toUniformPath(absolutePath);
// If the item to select doesn't exist, try to open its parent
if (!QFileInfo::exists(path)) {
openPath(path.left(path.lastIndexOf('/')));