From 4390530cbe0b8cf9f578811cc1afb50fc7b2391d Mon Sep 17 00:00:00 2001 From: Nick Tiskov Date: Sun, 10 Nov 2013 23:25:16 +0400 Subject: [PATCH] Update Main UI --- src/mainwindow.cpp | 4 ++-- src/properties/propertieswidget.cpp | 16 ++++++++-------- src/qtlibtorrent/torrentmodel.cpp | 3 ++- src/torrentcontentmodel.cpp | 5 +++-- src/transferlistwidget.cpp | 2 +- 5 files changed, 16 insertions(+), 14 deletions(-) diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 80fe32852..f699fa5d7 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -943,9 +943,9 @@ void MainWindow::on_actionOpen_triggered() { QBtSession::instance()->addTorrent(pathsList.at(i)); } // Save last dir to remember it - QStringList top_dir = pathsList.at(0).split(QDir::separator()); + QStringList top_dir = fsutils::fromNativePath(pathsList.at(0)).split("/"); top_dir.removeLast(); - settings.setValue(QString::fromUtf8("MainWindowLastDir"), top_dir.join(QDir::separator())); + settings.setValue(QString::fromUtf8("MainWindowLastDir"), fsutils::fromNativePath(top_dir.join("/"))); } } diff --git a/src/properties/propertieswidget.cpp b/src/properties/propertieswidget.cpp index 91ebdf91d..c98c23bdd 100644 --- a/src/properties/propertieswidget.cpp +++ b/src/properties/propertieswidget.cpp @@ -220,7 +220,7 @@ QTorrentHandle PropertiesWidget::getCurrentTorrent() const { void PropertiesWidget::updateSavePath(const QTorrentHandle& _h) { if (h.is_valid() && h == _h) { - save_path->setText(h.save_path_parsed()); + save_path->setText(fsutils::toNativePath(h.save_path_parsed())); } } @@ -414,7 +414,7 @@ void PropertiesWidget::openDoubleClickedFile(QModelIndex index) { int i = PropListModel->getFileIndex(index); const QDir saveDir(h.save_path()); const QString filename = h.filepath_at(i); - const QString file_path = QDir::cleanPath(saveDir.absoluteFilePath(filename)); + const QString file_path = fsutils::expandPath(saveDir.absoluteFilePath(filename)); qDebug("Trying to open file at %s", qPrintable(file_path)); // Flush data h.flush_cache(); @@ -433,8 +433,8 @@ void PropertiesWidget::openDoubleClickedFile(QModelIndex index) { parent = PropListModel->parent(parent); } const QDir saveDir(h.save_path()); - const QString filename = path_items.join(QDir::separator()); - const QString file_path = QDir::cleanPath(saveDir.absoluteFilePath(filename)); + const QString filename = path_items.join("/"); + const QString file_path = fsutils::expandPath(saveDir.absoluteFilePath(filename)); qDebug("Trying to open folder at %s", qPrintable(file_path)); // Flush data h.flush_cache(); @@ -541,7 +541,7 @@ void PropertiesWidget::renameSelectedFile() { // File renaming const int file_index = PropListModel->getFileIndex(index); if (!h.is_valid() || !h.has_metadata()) return; - QString old_name = h.filepath_at(file_index).replace("\\", "/"); + QString old_name = h.filepath_at(file_index); if (old_name.endsWith(".!qB") && !new_name_last.endsWith(".!qB")) { new_name_last += ".!qB"; } @@ -553,7 +553,7 @@ void PropertiesWidget::renameSelectedFile() { qDebug("Name did not change"); return; } - new_name = QDir::cleanPath(new_name); + new_name = fsutils::expandPathAbs(new_name); // Check if that name is already used for (int i=0; i