mirror of
https://github.com/qbittorrent/qBittorrent
synced 2025-07-12 08:16:16 -07:00
Update Main UI
This commit is contained in:
parent
ae8356aae5
commit
4390530cbe
5 changed files with 16 additions and 14 deletions
|
@ -943,9 +943,9 @@ void MainWindow::on_actionOpen_triggered() {
|
||||||
QBtSession::instance()->addTorrent(pathsList.at(i));
|
QBtSession::instance()->addTorrent(pathsList.at(i));
|
||||||
}
|
}
|
||||||
// Save last dir to remember it
|
// 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();
|
top_dir.removeLast();
|
||||||
settings.setValue(QString::fromUtf8("MainWindowLastDir"), top_dir.join(QDir::separator()));
|
settings.setValue(QString::fromUtf8("MainWindowLastDir"), fsutils::fromNativePath(top_dir.join("/")));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -220,7 +220,7 @@ QTorrentHandle PropertiesWidget::getCurrentTorrent() const {
|
||||||
|
|
||||||
void PropertiesWidget::updateSavePath(const QTorrentHandle& _h) {
|
void PropertiesWidget::updateSavePath(const QTorrentHandle& _h) {
|
||||||
if (h.is_valid() && h == _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);
|
int i = PropListModel->getFileIndex(index);
|
||||||
const QDir saveDir(h.save_path());
|
const QDir saveDir(h.save_path());
|
||||||
const QString filename = h.filepath_at(i);
|
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));
|
qDebug("Trying to open file at %s", qPrintable(file_path));
|
||||||
// Flush data
|
// Flush data
|
||||||
h.flush_cache();
|
h.flush_cache();
|
||||||
|
@ -433,8 +433,8 @@ void PropertiesWidget::openDoubleClickedFile(QModelIndex index) {
|
||||||
parent = PropListModel->parent(parent);
|
parent = PropListModel->parent(parent);
|
||||||
}
|
}
|
||||||
const QDir saveDir(h.save_path());
|
const QDir saveDir(h.save_path());
|
||||||
const QString filename = path_items.join(QDir::separator());
|
const QString filename = path_items.join("/");
|
||||||
const QString file_path = QDir::cleanPath(saveDir.absoluteFilePath(filename));
|
const QString file_path = fsutils::expandPath(saveDir.absoluteFilePath(filename));
|
||||||
qDebug("Trying to open folder at %s", qPrintable(file_path));
|
qDebug("Trying to open folder at %s", qPrintable(file_path));
|
||||||
// Flush data
|
// Flush data
|
||||||
h.flush_cache();
|
h.flush_cache();
|
||||||
|
@ -541,7 +541,7 @@ void PropertiesWidget::renameSelectedFile() {
|
||||||
// File renaming
|
// File renaming
|
||||||
const int file_index = PropListModel->getFileIndex(index);
|
const int file_index = PropListModel->getFileIndex(index);
|
||||||
if (!h.is_valid() || !h.has_metadata()) return;
|
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")) {
|
if (old_name.endsWith(".!qB") && !new_name_last.endsWith(".!qB")) {
|
||||||
new_name_last += ".!qB";
|
new_name_last += ".!qB";
|
||||||
}
|
}
|
||||||
|
@ -553,7 +553,7 @@ void PropertiesWidget::renameSelectedFile() {
|
||||||
qDebug("Name did not change");
|
qDebug("Name did not change");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
new_name = QDir::cleanPath(new_name);
|
new_name = fsutils::expandPathAbs(new_name);
|
||||||
// Check if that name is already used
|
// Check if that name is already used
|
||||||
for (int i=0; i<h.num_files(); ++i) {
|
for (int i=0; i<h.num_files(); ++i) {
|
||||||
if (i == file_index) continue;
|
if (i == file_index) continue;
|
||||||
|
@ -569,7 +569,7 @@ void PropertiesWidget::renameSelectedFile() {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const bool force_recheck = QFile::exists(h.save_path()+QDir::separator()+new_name);
|
const bool force_recheck = QFile::exists(h.save_path()+"/"+new_name);
|
||||||
qDebug("Renaming %s to %s", qPrintable(old_name), qPrintable(new_name));
|
qDebug("Renaming %s to %s", qPrintable(old_name), qPrintable(new_name));
|
||||||
h.rename_file(file_index, new_name);
|
h.rename_file(file_index, new_name);
|
||||||
// Force recheck
|
// Force recheck
|
||||||
|
@ -616,7 +616,7 @@ void PropertiesWidget::renameSelectedFile() {
|
||||||
new_name.replace(0, old_path.length(), new_path);
|
new_name.replace(0, old_path.length(), new_path);
|
||||||
if (!force_recheck && QDir(h.save_path()).exists(new_name))
|
if (!force_recheck && QDir(h.save_path()).exists(new_name))
|
||||||
force_recheck = true;
|
force_recheck = true;
|
||||||
new_name = QDir::cleanPath(new_name);
|
new_name = fsutils::expandPathAbs(new_name);
|
||||||
qDebug("Rename %s to %s", qPrintable(current_name), qPrintable(new_name));
|
qDebug("Rename %s to %s", qPrintable(current_name), qPrintable(new_name));
|
||||||
h.rename_file(i, new_name);
|
h.rename_file(i, new_name);
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,6 +33,7 @@
|
||||||
#include "torrentmodel.h"
|
#include "torrentmodel.h"
|
||||||
#include "torrentpersistentdata.h"
|
#include "torrentpersistentdata.h"
|
||||||
#include "qbtsession.h"
|
#include "qbtsession.h"
|
||||||
|
#include "fs_utils.h"
|
||||||
|
|
||||||
using namespace libtorrent;
|
using namespace libtorrent;
|
||||||
|
|
||||||
|
@ -215,7 +216,7 @@ QVariant TorrentModelItem::data(int column, int role) const
|
||||||
case TR_TIME_ELAPSED:
|
case TR_TIME_ELAPSED:
|
||||||
return (role == Qt::DisplayRole) ? m_torrent.active_time() : m_torrent.seeding_time();
|
return (role == Qt::DisplayRole) ? m_torrent.active_time() : m_torrent.seeding_time();
|
||||||
case TR_SAVE_PATH:
|
case TR_SAVE_PATH:
|
||||||
return m_torrent.save_path_parsed();
|
return fsutils::toNativePath(m_torrent.save_path_parsed());
|
||||||
default:
|
default:
|
||||||
return QVariant();
|
return QVariant();
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,6 +30,7 @@
|
||||||
|
|
||||||
#include "iconprovider.h"
|
#include "iconprovider.h"
|
||||||
#include "misc.h"
|
#include "misc.h"
|
||||||
|
#include "fs_utils.h"
|
||||||
#include "torrentcontentmodel.h"
|
#include "torrentcontentmodel.h"
|
||||||
#include "torrentcontentmodelitem.h"
|
#include "torrentcontentmodelitem.h"
|
||||||
#include "torrentcontentmodelfolder.h"
|
#include "torrentcontentmodelfolder.h"
|
||||||
|
@ -283,9 +284,9 @@ void TorrentContentModel::setupModelData(const libtorrent::torrent_info& t)
|
||||||
for (int i = 0; i < t.num_files(); ++i) {
|
for (int i = 0; i < t.num_files(); ++i) {
|
||||||
const libtorrent::file_entry& fentry = t.file_at(i);
|
const libtorrent::file_entry& fentry = t.file_at(i);
|
||||||
current_parent = m_rootItem;
|
current_parent = m_rootItem;
|
||||||
QString path = misc::toQStringU(fentry.path);
|
QString path = fsutils::fromNativePath(misc::toQStringU(fentry.path));
|
||||||
// Iterate of parts of the path to create necessary folders
|
// Iterate of parts of the path to create necessary folders
|
||||||
QStringList pathFolders = path.split(QRegExp("[/\\\\]"), QString::SkipEmptyParts);
|
QStringList pathFolders = path.split("/", QString::SkipEmptyParts);
|
||||||
pathFolders.removeLast();
|
pathFolders.removeLast();
|
||||||
foreach (const QString& pathPart, pathFolders) {
|
foreach (const QString& pathPart, pathFolders) {
|
||||||
if (pathPart == ".unwanted")
|
if (pathPart == ".unwanted")
|
||||||
|
|
|
@ -260,7 +260,7 @@ void TransferListWidget::setSelectedTorrentsLocation() {
|
||||||
if (!dir.isNull()) {
|
if (!dir.isNull()) {
|
||||||
qDebug("New path is %s", qPrintable(dir));
|
qDebug("New path is %s", qPrintable(dir));
|
||||||
// Check if savePath exists
|
// Check if savePath exists
|
||||||
QDir savePath(fsutils::expandPath(dir));
|
QDir savePath(fsutils::expandPathAbs(dir));
|
||||||
qDebug("New path after clean up is %s", qPrintable(savePath.absolutePath()));
|
qDebug("New path after clean up is %s", qPrintable(savePath.absolutePath()));
|
||||||
foreach (const QString & hash, hashes) {
|
foreach (const QString & hash, hashes) {
|
||||||
// Actually move storage
|
// Actually move storage
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue