qBittorrent
|
Functions | |
QString | toNativePath (const QString &path) |
QString | toUniformPath (const QString &path) |
QString | resolvePath (const QString &relativePath, const QString &basePath) |
QString | fileExtension (const QString &filename) |
QString | fileName (const QString &filePath) |
QString | folderName (const QString &filePath) |
qint64 | computePathSize (const QString &path) |
bool | sameFiles (const QString &path1, const QString &path2) |
QString | toValidFileSystemName (const QString &name, bool allowSeparators=false, const QString &pad=QLatin1String(" ")) |
bool | isValidFileSystemName (const QString &name, bool allowSeparators=false) |
qint64 | freeDiskSpaceOnPath (const QString &path) |
QString | branchPath (const QString &filePath, QString *removed=nullptr) |
bool | sameFileNames (const QString &first, const QString &second) |
QString | expandPath (const QString &path) |
QString | expandPathAbs (const QString &path) |
bool | isRegularFile (const QString &path) |
bool | smartRemoveEmptyFolderTree (const QString &path) |
bool | forceRemove (const QString &filePath) |
void | removeDirRecursive (const QString &path) |
QString | tempPath () |
QString | findRootFolder (const QStringList &filePaths) |
void | stripRootFolder (QStringList &filePaths) |
void | addRootFolder (QStringList &filePaths, const QString &name) |
bool | isNetworkFileSystem (const QString &path) |
Utility functions related to file system.
void Utils::Fs::addRootFolder | ( | QStringList & | filePaths, |
const QString & | name | ||
) |
Definition at line 432 of file fs.cpp.
Referenced by BitTorrent::applyContentLayout().
QString Utils::Fs::branchPath | ( | const QString & | filePath, |
QString * | removed = nullptr |
||
) |
Definition at line 276 of file fs.cpp.
References toUniformPath().
Referenced by FileLogger::deleteOld(), TorrentCreatorDialog::handleCreationSuccess(), TorrentCreatorDialog::onCreateButtonClicked(), BitTorrent::TorrentCreatorThread::run(), and BitTorrent::TorrentImpl::TorrentImpl().
qint64 Utils::Fs::computePathSize | ( | const QString & | path | ) |
QString Utils::Fs::expandPath | ( | const QString & | path | ) |
Definition at line 300 of file fs.cpp.
Referenced by expandPathAbs(), and PropertiesWidget::getFullPath().
QString Utils::Fs::expandPathAbs | ( | const QString & | path | ) |
Definition at line 309 of file fs.cpp.
References expandPath().
Referenced by TorrentOptionsDialog::accept(), OptionsDialog::askForExportDir(), RSS::AutoDownloader::AutoDownloader(), WebApplication::configure(), Net::GeoIPManager::downloadFinished(), SearchPluginManager::engineLocation(), OptionsDialog::getFinishedTorrentExportDir(), OptionsDialog::getTorrentExportDir(), Net::GeoIPManager::loadDatabase(), CustomStorage::move_storage(), OptionsDialog::saveOptions(), RSS::Session::Session(), TorrentsController::setLocationAction(), and BitTorrent::Session::startUpTorrents().
QString Utils::Fs::fileExtension | ( | const QString & | filename | ) |
Returns the file extension part of a file name.
Definition at line 82 of file fs.cpp.
Referenced by AutoExpandableDialog::getText(), Utils::Misc::isPreviewable(), and anonymous_namespace{torrentcontentlayout.cpp}::removeExtension().
QString Utils::Fs::fileName | ( | const QString & | filePath | ) |
Definition at line 87 of file fs.cpp.
References toUniformPath().
Referenced by BitTorrent::Session::addTorrent_impl(), RSS::AutoDownloader::AutoDownloader(), anonymous_namespace{torrentcreatorthread.cpp}::fileFilter(), BitTorrent::TorrentInfo::fileIndex(), straceWin::getBacktrace(), SearchPluginManager::getPluginVersion(), SearchPluginManager::installPlugin(), SearchPluginManager::pluginDownloadFinished(), PreviewSelectDialog::PreviewSelectDialog(), anonymous_namespace{uithememanager.cpp}::readFile(), anonymous_namespace{torrentcontentlayout.cpp}::removeExtension(), BitTorrent::TorrentCreatorThread::run(), FileSearcher::search(), RSS::Session::Session(), TorrentContentModel::setupModelData(), AsyncFileStorage::store(), AsyncFileStorage::store_impl(), anonymous_namespace{transferlistwidget.cpp}::torrentContainsPreviewableFiles(), TorrentContentModelFile::TorrentContentModelFile(), and BitTorrent::TorrentImpl::TorrentImpl().
QString Utils::Fs::findRootFolder | ( | const QStringList & | filePaths | ) |
Definition at line 403 of file fs.cpp.
Referenced by BitTorrent::Session::addTorrent_impl(), BitTorrent::applyContentLayout(), AddNewTorrentDialog::contentLayoutChanged(), BitTorrent::detectContentLayout(), BitTorrent::TorrentInfo::rootFolder(), AddNewTorrentDialog::setupTreeview(), and stripRootFolder().
QString Utils::Fs::folderName | ( | const QString & | filePath | ) |
Definition at line 96 of file fs.cpp.
References toUniformPath().
Referenced by OptionsDialog::on_addWatchedFolderButton_clicked().
bool Utils::Fs::forceRemove | ( | const QString & | filePath | ) |
Removes the file with the given filePath.
This function will try to fix the file permissions before removing it.
Definition at line 173 of file fs.cpp.
References f().
Referenced by RSS::Feed::cleanup(), anonymous_namespace{searchpluginmanager.cpp}::clearPythonCache(), FileLogger::deleteOld(), TrackerFiltersList::handleFavicoDownloadFinished(), PluginSelectDialog::iconDownloadFinished(), SearchPluginManager::installPlugin_impl(), SearchPluginManager::pluginDownloadFinished(), TorrentFilesWatcher::Worker::processFailedTorrents(), TorrentFilesWatcher::Worker::processFolder(), anonymous_namespace{settingsstorage.cpp}::TransactionalSettings::read(), BitTorrent::BencodeResumeDataStorage::Worker::remove(), smartRemoveEmptyFolderTree(), BitTorrent::Session::startUpTorrents(), SearchPluginManager::uninstallPlugin(), SearchPluginManager::updateNova(), anonymous_namespace{settingsstorage.cpp}::TransactionalSettings::write(), FileGuard::~FileGuard(), and TrackerFiltersList::~TrackerFiltersList().
qint64 Utils::Fs::freeDiskSpaceOnPath | ( | const QString & | path | ) |
Definition at line 271 of file fs.cpp.
Referenced by FreeDiskSpaceChecker::check(), and AddNewTorrentDialog::updateDiskSpaceLabel().
bool Utils::Fs::isNetworkFileSystem | ( | const QString & | path | ) |
Definition at line 337 of file fs.cpp.
References file().
Referenced by TorrentFilesWatcher::Worker::addWatchedFolder(), and TorrentFilesWatcher::Worker::updateWatchedFolder().
bool Utils::Fs::isRegularFile | ( | const QString & | path | ) |
Definition at line 321 of file fs.cpp.
Referenced by WebApplication::sendWebUIFile().
bool Utils::Fs::isValidFileSystemName | ( | const QString & | name, |
bool | allowSeparators = false |
||
) |
Definition at line 248 of file fs.cpp.
Referenced by BitTorrent::AbstractFileStorage::renameFile(), and BitTorrent::AbstractFileStorage::renameFolder().
void Utils::Fs::removeDirRecursive | ( | const QString & | path | ) |
Removes directory and its content recursively.
Definition at line 187 of file fs.cpp.
Referenced by Application::cleanup(), and anonymous_namespace{searchpluginmanager.cpp}::clearPythonCache().
QString Utils::Fs::resolvePath | ( | const QString & | relativePath, |
const QString & | basePath | ||
) |
If path is relative then resolves it against
basePath, otherwise returns the
path` itself
Definition at line 74 of file fs.cpp.
Referenced by BitTorrent::Session::categoryDownloadPath(), TorrentCategoryDialog::categoryNameChanged(), BitTorrent::Session::categorySavePath(), BitTorrent::Session::initLoadTorrentParams(), BitTorrent::Session::setDownloadPath(), BitTorrent::TorrentImpl::setDownloadPath(), BitTorrent::Session::setSavePath(), BitTorrent::TorrentImpl::setSavePath(), and TorrentCategoryDialog::useDownloadPathChanged().
bool Utils::Fs::sameFileNames | ( | const QString & | first, |
const QString & | second | ||
) |
bool Utils::Fs::sameFiles | ( | const QString & | path1, |
const QString & | path2 | ||
) |
bool Utils::Fs::smartRemoveEmptyFolderTree | ( | const QString & | path | ) |
This function will first check if there are only system cache files, e.g. Thumbs.db
, .DS_Store
and/or only temp files that end with '~', e.g. filename~
. If they are the only files it will try to remove them and delete the folder. This action will be performed for each subfolder starting from the deepest folder. There is an inherent race condition here. A file might appear after it is checked that only the above mentioned "useless" files exist but before the whole folder is removed. In this case, the folder will not be removed but the "useless" files will be deleted.
Definition at line 114 of file fs.cpp.
References asConst(), f(), and forceRemove().
Referenced by BitTorrent::Session::handleTorrentDeletedAlert(), and BitTorrent::Session::handleTorrentDeleteFailedAlert().
void Utils::Fs::stripRootFolder | ( | QStringList & | filePaths | ) |
Definition at line 422 of file fs.cpp.
References findRootFolder().
Referenced by BitTorrent::applyContentLayout().
QString Utils::Fs::tempPath | ( | ) |
Definition at line 314 of file fs.cpp.
Referenced by Application::cleanup(), BitTorrent::Session::downloadMetadata(), UIThemeManager::getIconPath(), and anonymous_namespace{downloadhandlerimpl.cpp}::saveToTempFile().
QString Utils::Fs::toNativePath | ( | const QString & | path | ) |
Converts a path to a string suitable for display. This function makes sure the directory separator used is consistent with the OS being run.
Definition at line 64 of file fs.cpp.
Referenced by FileSystemPathComboEdit::addItem(), BitTorrent::Session::addMoveTorrentStorageJob(), BitTorrent::Session::addTorrent_impl(), TorrentFilesWatcher::Worker::addWatchedFolder(), BitTorrent::BencodeResumeDataStorage::BencodeResumeDataStorage(), FileSystemPathEdit::FileSystemPathEditPrivate::browseActionTriggered(), BitTorrent::TorrentCreatorThread::calculateTotalPieces(), AddNewTorrentDialog::categoryChanged(), WatchedFoldersModel::data(), TransferListModel::displayValue(), BitTorrent::Session::downloadMetadata(), BitTorrent::TorrentImpl::endReceivedMetadataHandling(), anonymous_namespace{upgrade.cpp}::exportWebUIHttpsFiles(), BitTorrent::Session::fileSearchFinished(), TorrentOptionsDialog::handleCategoryChanged(), TorrentCreatorDialog::handleCreationSuccess(), TorrentOptionsDialog::handleTMMChanged(), BitTorrent::Session::handleTorrentFinished(), FileSystemPathComboEdit::insertItem(), TransferListModel::internalValue(), OptionsDialog::loadOptions(), AddNewTorrentDialog::loadTorrentFile(), BitTorrent::TorrentImpl::moveStorage(), OptionsDialog::on_addWatchedFolderButton_clicked(), WatchedFolderOptionsDialog::onCategoryChanged(), Utils::Gui::openFolderSelect(), Utils::Gui::openPath(), AppController::preferencesAction(), PreviewSelectDialog::previewButtonClicked(), TorrentsController::propertiesAction(), anonymous_namespace{settingsstorage.cpp}::TransactionalSettings::read(), BitTorrent::Session::recursiveTorrentDownload(), BitTorrent::TorrentImpl::renameFile(), BitTorrent::TorrentCreatorThread::run(), Application::runExternalProgram(), SearchDownloadHandler::SearchDownloadHandler(), SearchHandler::SearchHandler(), serialize(), TorrentsController::setLocationAction(), FileSystemPathEdit::setSelectedPath(), SearchPluginManager::update(), TorrentCreatorDialog::updateInputPath(), AutomatedRssDownloader::updateRuleDefinitionBox(), and PropertiesWidget::updateSavePath().
QString Utils::Fs::toUniformPath | ( | const QString & | path | ) |
Converts a path to a string suitable for processing. This function makes sure the directory separator used is independent from the OS being run so it is the same on all supported platforms. Slash ('/') is used as "uniform" directory separator.
Definition at line 69 of file fs.cpp.
Referenced by BitTorrent::TorrentImpl::actualStorageLocation(), branchPath(), RSS::Feed::Feed(), fileName(), BitTorrent::TorrentInfo::filePath(), TorrentsController::filesAction(), BitTorrent::Session::finishedTorrentExportDirectory(), folderName(), Preferences::getScanDirsLastPath(), BitTorrent::TorrentImpl::handleFileRenamedAlert(), PluginSelectDialog::iconDownloadFinished(), BitTorrent::Session::IPFilterFile(), FileSystemPathComboEdit::item(), Preferences::lastLocationPath(), BitTorrent::DBResumeDataStorage::load(), BitTorrent::BencodeResumeDataStorage::loadTorrentResumeData(), MainWindow::on_actionOpen_triggered(), TorrentCreatorDialog::onCreateButtonClicked(), Utils::Gui::openFolderSelect(), Utils::Gui::openPath(), SearchPluginManager::pluginDownloadFinished(), BitTorrent::AbstractFileStorage::renameFile(), BitTorrent::AbstractFileStorage::renameFolder(), FileSystemPathEdit::selectedPath(), BitTorrent::Session::setFinishedTorrentExportDirectory(), BitTorrent::Session::setIPFilterFile(), Preferences::setLastLocationPath(), RSS::AutoDownloadRule::setSavePath(), Preferences::setScanDirsLastPath(), BitTorrent::Session::setTorrentExportDirectory(), TorrentContentModel::setupModelData(), BitTorrent::Session::torrentExportDirectory(), and BitTorrent::TorrentImpl::TorrentImpl().
QString Utils::Fs::toValidFileSystemName | ( | const QString & | name, |
bool | allowSeparators = false , |
||
const QString & | pad = QLatin1String(" ") |
||
) |
Definition at line 237 of file fs.cpp.
Referenced by BitTorrent::Session::categoryDownloadPath(), TorrentCategoryDialog::categoryNameChanged(), BitTorrent::Session::categorySavePath(), BitTorrent::Session::exportTorrentFile(), RSS::Feed::Feed(), and TorrentCategoryDialog::useDownloadPathChanged().