mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2024-11-29 13:58:51 +03:00
Convert fsutils class to namespace
This commit is contained in:
parent
bd9dcf1247
commit
5854a2883b
2 changed files with 29 additions and 30 deletions
|
@ -428,7 +428,8 @@ QString fsutils::QDesktopServicesDownloadLocation() {
|
|||
// TODO: Use IKnownFolderManager to get path of FOLDERID_Downloads
|
||||
// instead of hardcoding "Downloads"
|
||||
// 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
|
||||
|
||||
#ifdef Q_WS_X11
|
||||
|
@ -459,7 +460,7 @@ QString fsutils::QDesktopServicesDownloadLocation() {
|
|||
}
|
||||
|
||||
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";
|
||||
}
|
||||
|
||||
|
@ -471,7 +472,7 @@ QString fsutils::QDesktopServicesDownloadLocation() {
|
|||
#endif
|
||||
|
||||
// Fallback
|
||||
return QDir::home().absoluteFilePath(tr("Downloads"));
|
||||
return QDir::home().absoluteFilePath(QCoreApplication::translate("fsutils", "Downloads"));
|
||||
}
|
||||
|
||||
QString fsutils::searchEngineLocation() {
|
||||
|
|
|
@ -37,39 +37,37 @@
|
|||
/**
|
||||
* Utility functions related to file system.
|
||||
*/
|
||||
class fsutils
|
||||
namespace fsutils
|
||||
{
|
||||
Q_DECLARE_TR_FUNCTIONS(fsutils)
|
||||
|
||||
public:
|
||||
static QString toNativePath(const QString& path);
|
||||
static QString fromNativePath(const QString& path);
|
||||
static QString fileExtension(const QString& filename);
|
||||
static QString fileName(const QString& file_path);
|
||||
static qint64 computePathSize(const QString& path);
|
||||
static bool sameFiles(const QString& path1, const QString& path2);
|
||||
static QString updateLabelInSavePath(const QString &defaultSavePath, const QString &save_path, const QString& old_label, const QString& new_label);
|
||||
static QString toValidFileSystemName(QString filename);
|
||||
static bool isValidFileSystemName(const QString& filename);
|
||||
static long long freeDiskSpaceOnPath(QString path);
|
||||
static QString branchPath(const QString& file_path, QString* removed = 0);
|
||||
static bool sameFileNames(const QString& first, const QString& second);
|
||||
static QString expandPath(const QString& path);
|
||||
static QString expandPathAbs(const QString& path);
|
||||
static bool isValidTorrentFile(const QString& path);
|
||||
static bool smartRemoveEmptyFolderTree(const QString& dir_path);
|
||||
static bool forceRemove(const QString& file_path);
|
||||
QString toNativePath(const QString& path);
|
||||
QString fromNativePath(const QString& path);
|
||||
QString fileExtension(const QString& filename);
|
||||
QString fileName(const QString& file_path);
|
||||
qint64 computePathSize(const QString& path);
|
||||
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);
|
||||
QString toValidFileSystemName(QString filename);
|
||||
bool isValidFileSystemName(const QString& filename);
|
||||
long long freeDiskSpaceOnPath(QString path);
|
||||
QString branchPath(const QString& file_path, QString* removed = 0);
|
||||
bool sameFileNames(const QString& first, const QString& second);
|
||||
QString expandPath(const QString& path);
|
||||
QString expandPathAbs(const QString& path);
|
||||
bool isValidTorrentFile(const QString& path);
|
||||
bool smartRemoveEmptyFolderTree(const QString& dir_path);
|
||||
bool forceRemove(const QString& file_path);
|
||||
|
||||
/* Ported from Qt4 to drop dependency on QtGui */
|
||||
static QString QDesktopServicesDataLocation();
|
||||
static QString QDesktopServicesCacheLocation();
|
||||
static QString QDesktopServicesDownloadLocation();
|
||||
QString QDesktopServicesDataLocation();
|
||||
QString QDesktopServicesCacheLocation();
|
||||
QString QDesktopServicesDownloadLocation();
|
||||
/* End of Qt4 code */
|
||||
static QString searchEngineLocation();
|
||||
static QString BTBackupLocation();
|
||||
static QString cacheLocation();
|
||||
QString searchEngineLocation();
|
||||
QString BTBackupLocation();
|
||||
QString cacheLocation();
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
#endif // FS_UTILS_H
|
||||
|
||||
|
|
Loading…
Reference in a new issue