mirror of
https://github.com/d47081/qBittorrent.git
synced 2025-02-06 03:44:29 +00:00
Code clean up
This commit is contained in:
parent
b267ac169d
commit
b41aa38f39
27
src/misc.cpp
27
src/misc.cpp
@ -432,33 +432,6 @@ QString misc::updateLabelInSavePath(const QString& defaultSavePath, const QStrin
|
|||||||
return new_save_path;
|
return new_save_path;
|
||||||
}
|
}
|
||||||
|
|
||||||
void misc::moveToXDGFolders() {
|
|
||||||
QDir old_qBtPath(QDir::homePath().replace("\\","/")+"/"+".qbittorrent");
|
|
||||||
if(old_qBtPath.exists()) {
|
|
||||||
// Copy BT_backup folder
|
|
||||||
const QString old_BTBackupPath = old_qBtPath.absoluteFilePath("BT_backup");
|
|
||||||
if(QDir(old_BTBackupPath).exists()) {
|
|
||||||
copyDir(old_BTBackupPath, BTBackupLocation());
|
|
||||||
}
|
|
||||||
// Copy search engine folder
|
|
||||||
const QString old_searchPath = old_qBtPath.absoluteFilePath("nova");
|
|
||||||
if(QDir(old_searchPath).exists()) {
|
|
||||||
copyDir(old_searchPath, searchEngineLocation());
|
|
||||||
}
|
|
||||||
// Copy *_state files
|
|
||||||
if(QFile::exists(old_qBtPath.absoluteFilePath("dht_state"))) {
|
|
||||||
QFile::copy(old_qBtPath.absoluteFilePath("dht_state"), QDir(cacheLocation()).absoluteFilePath("dht_state"));
|
|
||||||
safeRemove(old_qBtPath.absoluteFilePath("dht_state"));
|
|
||||||
}
|
|
||||||
if(QFile::exists(old_qBtPath.absoluteFilePath("ses_state"))) {
|
|
||||||
QFile::copy(old_qBtPath.absoluteFilePath("ses_state"), QDir(cacheLocation()).absoluteFilePath("ses_state"));
|
|
||||||
safeRemove(old_qBtPath.absoluteFilePath("ses_state"));
|
|
||||||
}
|
|
||||||
// Remove .qbittorrent folder if empty
|
|
||||||
QDir::home().rmdir(".qbittorrent");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
QString misc::toValidFileSystemName(QString filename) {
|
QString misc::toValidFileSystemName(QString filename) {
|
||||||
qDebug("toValidFSName: %s", qPrintable(filename));
|
qDebug("toValidFSName: %s", qPrintable(filename));
|
||||||
filename = filename.replace("\\", "/").trimmed();
|
filename = filename.replace("\\", "/").trimmed();
|
||||||
|
@ -127,9 +127,6 @@ public:
|
|||||||
|
|
||||||
static bool sameFiles(const QString &path1, const QString &path2);
|
static bool sameFiles(const QString &path1, const QString &path2);
|
||||||
static void copyDir(QString src_path, QString dst_path);
|
static void copyDir(QString src_path, QString dst_path);
|
||||||
// Introduced in v2.1.0 for backward compatibility
|
|
||||||
// Remove after some releases
|
|
||||||
static void moveToXDGFolders();
|
|
||||||
static QString toValidFileSystemName(QString filename);
|
static QString toValidFileSystemName(QString filename);
|
||||||
static bool isValidFileSystemName(QString filename);
|
static bool isValidFileSystemName(QString filename);
|
||||||
|
|
||||||
|
@ -92,15 +92,11 @@ QBtSession::QBtSession()
|
|||||||
#ifndef DISABLE_GUI
|
#ifndef DISABLE_GUI
|
||||||
, geoipDBLoaded(false), resolve_countries(false)
|
, geoipDBLoaded(false), resolve_countries(false)
|
||||||
#endif
|
#endif
|
||||||
|
, m_tracker(0)
|
||||||
{
|
{
|
||||||
Preferences pref;
|
Preferences pref;
|
||||||
m_tracker = 0;
|
|
||||||
// To avoid some exceptions
|
// To avoid some exceptions
|
||||||
boost::filesystem::path::default_name_check(boost::filesystem::no_check);
|
boost::filesystem::path::default_name_check(boost::filesystem::no_check);
|
||||||
// For backward compatibility
|
|
||||||
// Move .qBittorrent content to XDG folder
|
|
||||||
// TODO: Remove after some releases (introduced in v2.1.0)
|
|
||||||
misc::moveToXDGFolders();
|
|
||||||
// Creating Bittorrent session
|
// Creating Bittorrent session
|
||||||
// Check if we should spoof utorrent
|
// Check if we should spoof utorrent
|
||||||
QList<int> version;
|
QList<int> version;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user