mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2025-12-31 12:48:04 -06:00
Move utilities to core/utils folder.
Also move the names to Utils namespace.
This commit is contained in:
@@ -29,8 +29,8 @@
|
||||
*/
|
||||
|
||||
#include "btjson.h"
|
||||
#include "core/misc.h"
|
||||
#include "core/fs_utils.h"
|
||||
#include "core/utils/misc.h"
|
||||
#include "core/utils/fs.h"
|
||||
#include "core/preferences.h"
|
||||
#include "core/bittorrent/session.h"
|
||||
#include "core/bittorrent/sessionstatus.h"
|
||||
@@ -411,7 +411,7 @@ QByteArray btjson::getPropertiesForTorrent(const QString& hash)
|
||||
if (!torrent->hasMetadata())
|
||||
return QByteArray();
|
||||
|
||||
data[KEY_PROP_SAVE_PATH] = fsutils::toNativePath(torrent->savePath());
|
||||
data[KEY_PROP_SAVE_PATH] = Utils::Fs::toNativePath(torrent->savePath());
|
||||
data[KEY_PROP_CREATION_DATE] = torrent->creationDate().toTime_t();
|
||||
data[KEY_PROP_PIECE_SIZE] = torrent->pieceLength();
|
||||
data[KEY_PROP_COMMENT] = torrent->comment();
|
||||
@@ -462,7 +462,7 @@ QByteArray btjson::getFilesForTorrent(const QString& hash)
|
||||
QString fileName = torrent->filePath(i);
|
||||
if (fileName.endsWith(".!qB", Qt::CaseInsensitive))
|
||||
fileName.chop(4);
|
||||
file_dict[KEY_FILE_NAME] = fsutils::toNativePath(fileName);
|
||||
file_dict[KEY_FILE_NAME] = Utils::Fs::toNativePath(fileName);
|
||||
const qlonglong size = torrent->fileSize(i);
|
||||
file_dict[KEY_FILE_SIZE] = size;
|
||||
file_dict[KEY_FILE_PROGRESS] = fp[i];
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
#include "prefjson.h"
|
||||
#include "core/preferences.h"
|
||||
#include "core/scanfoldersmodel.h"
|
||||
#include "core/fs_utils.h"
|
||||
#include "core/utils/fs.h"
|
||||
|
||||
#ifndef QT_NO_OPENSSL
|
||||
#include <QSslCertificate>
|
||||
@@ -53,12 +53,12 @@ QByteArray prefjson::getPreferences()
|
||||
// UI
|
||||
data["locale"] = pref->getLocale();
|
||||
// Downloads
|
||||
data["save_path"] = fsutils::toNativePath(pref->getSavePath());
|
||||
data["save_path"] = Utils::Fs::toNativePath(pref->getSavePath());
|
||||
data["temp_path_enabled"] = pref->isTempPathEnabled();
|
||||
data["temp_path"] = fsutils::toNativePath(pref->getTempPath());
|
||||
data["temp_path"] = Utils::Fs::toNativePath(pref->getTempPath());
|
||||
QVariantList l;
|
||||
foreach (const QString& s, pref->getScanDirs()) {
|
||||
l << fsutils::toNativePath(s);
|
||||
l << Utils::Fs::toNativePath(s);
|
||||
}
|
||||
data["scan_dirs"] = l;
|
||||
QVariantList var_list;
|
||||
@@ -67,7 +67,7 @@ QByteArray prefjson::getPreferences()
|
||||
}
|
||||
data["download_in_scan_dirs"] = var_list;
|
||||
data["export_dir_enabled"] = pref->isTorrentExportEnabled();
|
||||
data["export_dir"] = fsutils::toNativePath(pref->getTorrentExportDir());
|
||||
data["export_dir"] = Utils::Fs::toNativePath(pref->getTorrentExportDir());
|
||||
data["mail_notification_enabled"] = pref->isMailNotificationEnabled();
|
||||
data["mail_notification_email"] = pref->getMailNotificationEmail();
|
||||
data["mail_notification_smtp"] = pref->getMailNotificationSMTP();
|
||||
@@ -76,7 +76,7 @@ QByteArray prefjson::getPreferences()
|
||||
data["mail_notification_username"] = pref->getMailNotificationSMTPUsername();
|
||||
data["mail_notification_password"] = pref->getMailNotificationSMTPPassword();
|
||||
data["autorun_enabled"] = pref->isAutoRunEnabled();
|
||||
data["autorun_program"] = fsutils::toNativePath(pref->getAutoRunProgram());
|
||||
data["autorun_program"] = Utils::Fs::toNativePath(pref->getAutoRunProgram());
|
||||
data["preallocate_all"] = pref->preAllocateAllFiles();
|
||||
data["queueing_enabled"] = pref->isQueueingSystemEnabled();
|
||||
data["max_active_downloads"] = pref->getMaxActiveDownloads();
|
||||
@@ -122,7 +122,7 @@ QByteArray prefjson::getPreferences()
|
||||
data["proxy_password"] = pref->getProxyPassword();
|
||||
// IP Filter
|
||||
data["ip_filter_enabled"] = pref->isFilteringEnabled();
|
||||
data["ip_filter_path"] = fsutils::toNativePath(pref->getFilter());
|
||||
data["ip_filter_path"] = Utils::Fs::toNativePath(pref->getFilter());
|
||||
// Web UI
|
||||
data["web_ui_port"] = pref->getWebUiPort();
|
||||
data["web_ui_username"] = pref->getWebUiUsername();
|
||||
@@ -189,7 +189,7 @@ void prefjson::setPreferences(const QString& json)
|
||||
foreach (const QString &new_folder, new_folders) {
|
||||
qDebug("New watched folder: %s", qPrintable(new_folder));
|
||||
// Update new folders
|
||||
if (!old_folders.contains(fsutils::fromNativePath(new_folder))) {
|
||||
if (!old_folders.contains(Utils::Fs::fromNativePath(new_folder))) {
|
||||
ScanFoldersModel::instance()->addPath(new_folder, download_at_path.at(i));
|
||||
}
|
||||
++i;
|
||||
|
||||
@@ -33,8 +33,9 @@
|
||||
#include <queue>
|
||||
#include <vector>
|
||||
#include "core/iconprovider.h"
|
||||
#include "core/misc.h"
|
||||
#include "core/fs_utils.h"
|
||||
#include "core/utils/misc.h"
|
||||
#include "core/utils/fs.h"
|
||||
#include "core/utils/string.h"
|
||||
#include "core/preferences.h"
|
||||
#include "btjson.h"
|
||||
#include "prefjson.h"
|
||||
@@ -164,8 +165,8 @@ void WebApplication::action_public_login()
|
||||
md5.addData(request().posts["password"].toLocal8Bit());
|
||||
QString pass = md5.result().toHex();
|
||||
|
||||
bool equalUser = misc::slowEquals(request().posts["username"].toUtf8(), pref->getWebUiUsername().toUtf8());
|
||||
bool equalPass = misc::slowEquals(pass.toUtf8(), pref->getWebUiPassword().toUtf8());
|
||||
bool equalUser = Utils::String::slowEquals(request().posts["username"].toUtf8(), pref->getWebUiUsername().toUtf8());
|
||||
bool equalPass = Utils::String::slowEquals(pass.toUtf8(), pref->getWebUiPassword().toUtf8());
|
||||
|
||||
if (equalUser && equalPass) {
|
||||
sessionStart();
|
||||
@@ -303,7 +304,7 @@ void WebApplication::action_command_download()
|
||||
if (!url.isEmpty()) {
|
||||
if (url.startsWith("bc://bt/", Qt::CaseInsensitive)) {
|
||||
qDebug("Converting bc link to magnet link");
|
||||
url = misc::bcLinkToMagnet(url);
|
||||
url = Utils::Misc::bcLinkToMagnet(url);
|
||||
}
|
||||
|
||||
BitTorrent::Session::instance()->addTorrent(url);
|
||||
@@ -332,7 +333,7 @@ void WebApplication::action_command_upload()
|
||||
}
|
||||
}
|
||||
// Clean up
|
||||
fsutils::forceRemove(filePath);
|
||||
Utils::Fs::forceRemove(filePath);
|
||||
}
|
||||
else {
|
||||
qWarning() << "I/O Error: Could not create temporary file";
|
||||
|
||||
Reference in New Issue
Block a user