mirror of
https://github.com/d47081/qBittorrent.git
synced 2025-01-11 15:27:54 +00:00
Convert fsutils class to namespace
This commit is contained in:
parent
bd9dcf1247
commit
5854a2883b
@ -428,7 +428,8 @@ QString fsutils::QDesktopServicesDownloadLocation() {
|
|||||||
// TODO: Use IKnownFolderManager to get path of FOLDERID_Downloads
|
// TODO: Use IKnownFolderManager to get path of FOLDERID_Downloads
|
||||||
// instead of hardcoding "Downloads"
|
// instead of hardcoding "Downloads"
|
||||||
// Unfortunately, this would break compatibility with WinXP
|
// Unfortunately, this would break compatibility with WinXP
|
||||||
return QDir(QDesktopServices::storageLocation(QDesktopServices::DocumentsLocation)).absoluteFilePath(tr("Downloads"));
|
return QDir(QDesktopServices::storageLocation(QDesktopServices::DocumentsLocation)).absoluteFilePath(
|
||||||
|
QCoreApplication::translate("fsutils", "Downloads"));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef Q_WS_X11
|
#ifdef Q_WS_X11
|
||||||
@ -459,7 +460,7 @@ QString fsutils::QDesktopServicesDownloadLocation() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (save_path.isEmpty() || !QFile::exists(save_path)) {
|
if (save_path.isEmpty() || !QFile::exists(save_path)) {
|
||||||
save_path = QDir::home().absoluteFilePath(tr("Downloads"));
|
save_path = QDir::home().absoluteFilePath(QCoreApplication::translate("fsutils", "Downloads"));
|
||||||
qDebug() << Q_FUNC_INFO << "using" << save_path << "as fallback since the XDG detection did not work";
|
qDebug() << Q_FUNC_INFO << "using" << save_path << "as fallback since the XDG detection did not work";
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -471,7 +472,7 @@ QString fsutils::QDesktopServicesDownloadLocation() {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Fallback
|
// Fallback
|
||||||
return QDir::home().absoluteFilePath(tr("Downloads"));
|
return QDir::home().absoluteFilePath(QCoreApplication::translate("fsutils", "Downloads"));
|
||||||
}
|
}
|
||||||
|
|
||||||
QString fsutils::searchEngineLocation() {
|
QString fsutils::searchEngineLocation() {
|
||||||
|
@ -37,39 +37,37 @@
|
|||||||
/**
|
/**
|
||||||
* Utility functions related to file system.
|
* Utility functions related to file system.
|
||||||
*/
|
*/
|
||||||
class fsutils
|
namespace fsutils
|
||||||
{
|
{
|
||||||
Q_DECLARE_TR_FUNCTIONS(fsutils)
|
|
||||||
|
|
||||||
public:
|
QString toNativePath(const QString& path);
|
||||||
static QString toNativePath(const QString& path);
|
QString fromNativePath(const QString& path);
|
||||||
static QString fromNativePath(const QString& path);
|
QString fileExtension(const QString& filename);
|
||||||
static QString fileExtension(const QString& filename);
|
QString fileName(const QString& file_path);
|
||||||
static QString fileName(const QString& file_path);
|
qint64 computePathSize(const QString& path);
|
||||||
static qint64 computePathSize(const QString& path);
|
bool sameFiles(const QString& path1, const QString& path2);
|
||||||
static bool sameFiles(const QString& path1, const QString& path2);
|
QString updateLabelInSavePath(const QString &defaultSavePath, const QString &save_path, const QString& old_label, const QString& new_label);
|
||||||
static QString updateLabelInSavePath(const QString &defaultSavePath, const QString &save_path, const QString& old_label, const QString& new_label);
|
QString toValidFileSystemName(QString filename);
|
||||||
static QString toValidFileSystemName(QString filename);
|
bool isValidFileSystemName(const QString& filename);
|
||||||
static bool isValidFileSystemName(const QString& filename);
|
long long freeDiskSpaceOnPath(QString path);
|
||||||
static long long freeDiskSpaceOnPath(QString path);
|
QString branchPath(const QString& file_path, QString* removed = 0);
|
||||||
static QString branchPath(const QString& file_path, QString* removed = 0);
|
bool sameFileNames(const QString& first, const QString& second);
|
||||||
static bool sameFileNames(const QString& first, const QString& second);
|
QString expandPath(const QString& path);
|
||||||
static QString expandPath(const QString& path);
|
QString expandPathAbs(const QString& path);
|
||||||
static QString expandPathAbs(const QString& path);
|
bool isValidTorrentFile(const QString& path);
|
||||||
static bool isValidTorrentFile(const QString& path);
|
bool smartRemoveEmptyFolderTree(const QString& dir_path);
|
||||||
static bool smartRemoveEmptyFolderTree(const QString& dir_path);
|
bool forceRemove(const QString& file_path);
|
||||||
static bool forceRemove(const QString& file_path);
|
|
||||||
|
|
||||||
/* Ported from Qt4 to drop dependency on QtGui */
|
/* Ported from Qt4 to drop dependency on QtGui */
|
||||||
static QString QDesktopServicesDataLocation();
|
QString QDesktopServicesDataLocation();
|
||||||
static QString QDesktopServicesCacheLocation();
|
QString QDesktopServicesCacheLocation();
|
||||||
static QString QDesktopServicesDownloadLocation();
|
QString QDesktopServicesDownloadLocation();
|
||||||
/* End of Qt4 code */
|
/* End of Qt4 code */
|
||||||
static QString searchEngineLocation();
|
QString searchEngineLocation();
|
||||||
static QString BTBackupLocation();
|
QString BTBackupLocation();
|
||||||
static QString cacheLocation();
|
QString cacheLocation();
|
||||||
|
|
||||||
};
|
}
|
||||||
|
|
||||||
#endif // FS_UTILS_H
|
#endif // FS_UTILS_H
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user