qBittorrent
|
#include <application.h>
Public Member Functions | |
Application (int &argc, char **argv) | |
~Application () override | |
bool | isRunning () |
int | exec (const QStringList ¶ms) |
bool | sendParams (const QStringList ¶ms) |
QPointer< MainWindow > | mainWindow () |
const QBtCommandLineParameters & | commandLineArgs () const |
bool | isFileLoggerEnabled () const |
void | setFileLoggerEnabled (bool value) |
QString | fileLoggerPath () const |
void | setFileLoggerPath (const QString &path) |
bool | isFileLoggerBackup () const |
void | setFileLoggerBackup (bool value) |
bool | isFileLoggerDeleteOld () const |
void | setFileLoggerDeleteOld (bool value) |
int | fileLoggerMaxSize () const |
void | setFileLoggerMaxSize (int bytes) |
int | fileLoggerAge () const |
void | setFileLoggerAge (int value) |
int | fileLoggerAgeType () const |
void | setFileLoggerAgeType (int value) |
Private Slots | |
void | processMessage (const QString &message) |
void | torrentFinished (BitTorrent::Torrent *const torrent) |
void | allTorrentsFinished () |
void | cleanup () |
Private Member Functions | |
void | initializeTranslation () |
void | processParams (const QStringList ¶ms) |
void | runExternalProgram (const BitTorrent::Torrent *torrent) const |
void | sendNotificationEmail (const BitTorrent::Torrent *torrent) |
Private Attributes | |
ApplicationInstanceManager * | m_instanceManager = nullptr |
bool | m_running |
ShutdownDialogAction | m_shutdownAct |
QBtCommandLineParameters | m_commandLineArgs |
QPointer< MainWindow > | m_window |
WebUI * | m_webui = nullptr |
QPointer< FileLogger > | m_fileLogger |
QTranslator | m_qtTranslator |
QTranslator | m_translator |
QStringList | m_paramsQueue |
SettingValue< bool > | m_storeFileLoggerEnabled |
SettingValue< bool > | m_storeFileLoggerBackup |
SettingValue< bool > | m_storeFileLoggerDeleteOld |
SettingValue< int > | m_storeFileLoggerMaxSize |
SettingValue< int > | m_storeFileLoggerAge |
SettingValue< int > | m_storeFileLoggerAgeType |
SettingValue< QString > | m_storeFileLoggerPath |
Definition at line 72 of file application.h.
Application::Application | ( | int & | argc, |
char ** | argv | ||
) |
Definition at line 119 of file application.cpp.
References Logger::addMessage(), cleanup(), Config, QBtCommandLineParameters::configurationName, anonymous_namespace{application.cpp}::DEFAULT_PORTABLE_MODE_PROFILE_DIR, Exit, fileLoggerAge(), fileLoggerAgeType(), fileLoggerMaxSize(), fileLoggerPath(), initializeTranslation(), Logger::initInstance(), Preferences::initInstance(), SettingsStorage::initInstance(), Profile::initInstance(), Logger::instance(), Preferences::instance(), Profile::instance(), isFileLoggerBackup(), isFileLoggerDeleteOld(), isFileLoggerEnabled(), Profile::location(), m_commandLineArgs, m_fileLogger, m_instanceManager, ApplicationInstanceManager::messageReceived(), anonymous_namespace{application.cpp}::PIXMAP_CACHE_SIZE, processMessage(), QBtCommandLineParameters::profileDir, QBtCommandLineParameters::relativeFastresumePaths, Preferences::setWebUiPort(), Log::WARNING, and QBtCommandLineParameters::webUiPort.
|
override |
Definition at line 188 of file application.cpp.
References cleanup().
|
privateslot |
Definition at line 472 of file application.cpp.
References tstool::action, ShutdownConfirmDialog::askForConfirmation(), Preferences::dontConfirmAutoExit(), Exit, Hibernate, Preferences::hibernateWhenDownloadsComplete(), Preferences::instance(), m_shutdownAct, m_window, Preferences::setHibernateWhenDownloadsComplete(), Preferences::setShutdownWhenDownloadsComplete(), Preferences::setSuspendWhenDownloadsComplete(), Shutdown, Preferences::shutdownqBTWhenDownloadsComplete(), Preferences::shutdownWhenDownloadsComplete(), Suspend, and Preferences::suspendWhenDownloadsComplete().
Referenced by exec().
|
privateslot |
Definition at line 774 of file application.cpp.
References Exit, BitTorrent::Session::freeInstance(), IconProvider::freeInstance(), Logger::freeInstance(), Net::DownloadManager::freeInstance(), Net::GeoIPManager::freeInstance(), Net::ProxyConfigurationManager::freeInstance(), Preferences::freeInstance(), Profile::freeInstance(), SearchPluginManager::freeInstance(), SettingsStorage::freeInstance(), TorrentFilesWatcher::freeInstance(), UIThemeManager::freeInstance(), RSS::AutoDownloader::instance(), RSS::Session::instance(), m_fileLogger, m_shutdownAct, m_webui, m_window, Utils::Fs::removeDirRecursive(), Utils::Misc::shutdownComputer(), and Utils::Fs::tempPath().
Referenced by Application(), and ~Application().
const QBtCommandLineParameters & Application::commandLineArgs | ( | ) | const |
Definition at line 202 of file application.cpp.
References m_commandLineArgs.
int Application::exec | ( | const QStringList & | params | ) |
Definition at line 603 of file application.cpp.
References allTorrentsFinished(), BitTorrent::Session::allTorrentsFinished(), WebUI::fatalError(), Preferences::getWebUIPassword(), Preferences::getWebUiPort(), Preferences::getWebUiUsername(), BitTorrent::Session::initInstance(), IconProvider::initInstance(), Net::DownloadManager::initInstance(), Net::GeoIPManager::initInstance(), Net::ProxyConfigurationManager::initInstance(), TorrentFilesWatcher::initInstance(), UIThemeManager::initInstance(), BitTorrent::Session::instance(), Preferences::instance(), WebUI::isErrored(), Preferences::isWebUiHttpsEnabled(), m_paramsQueue, m_running, m_webui, m_window, Exception::message(), processParams(), Utils::Gui::screenCenter(), BitTorrent::Session::startUpTorrents(), torrentFinished(), and BitTorrent::Session::torrentFinished().
int Application::fileLoggerAge | ( | ) | const |
Definition at line 271 of file application.cpp.
References SettingValue< T >::get(), and m_storeFileLoggerAge.
Referenced by Application(), OptionsDialog::loadOptions(), setFileLoggerDeleteOld(), and setFileLoggerEnabled().
int Application::fileLoggerAgeType | ( | ) | const |
Definition at line 282 of file application.cpp.
References SettingValue< T >::get(), and m_storeFileLoggerAgeType.
Referenced by Application(), OptionsDialog::loadOptions(), setFileLoggerDeleteOld(), and setFileLoggerEnabled().
int Application::fileLoggerMaxSize | ( | ) | const |
Definition at line 257 of file application.cpp.
References anonymous_namespace{application.cpp}::DEFAULT_FILELOG_SIZE, SettingValue< T >::get(), m_storeFileLoggerMaxSize, anonymous_namespace{application.cpp}::MAX_FILELOG_SIZE, and anonymous_namespace{application.cpp}::MIN_FILELOG_SIZE.
Referenced by Application(), OptionsDialog::loadOptions(), and setFileLoggerEnabled().
QString Application::fileLoggerPath | ( | ) | const |
Definition at line 221 of file application.cpp.
References Data, SettingValue< T >::get(), anonymous_namespace{application.cpp}::LOG_FOLDER, m_storeFileLoggerPath, and specialFolderLocation().
Referenced by Application(), OptionsDialog::loadOptions(), and setFileLoggerEnabled().
|
private |
Definition at line 713 of file application.cpp.
References Preferences::getLocale(), Preferences::instance(), m_qtTranslator, and m_translator.
Referenced by Application().
bool Application::isFileLoggerBackup | ( | ) | const |
Definition at line 233 of file application.cpp.
References SettingValue< T >::get(), and m_storeFileLoggerBackup.
Referenced by Application(), OptionsDialog::loadOptions(), and setFileLoggerEnabled().
bool Application::isFileLoggerDeleteOld | ( | ) | const |
Definition at line 245 of file application.cpp.
References SettingValue< T >::get(), and m_storeFileLoggerDeleteOld.
Referenced by Application(), OptionsDialog::loadOptions(), and setFileLoggerEnabled().
bool Application::isFileLoggerEnabled | ( | ) | const |
Definition at line 207 of file application.cpp.
References SettingValue< T >::get(), and m_storeFileLoggerEnabled.
Referenced by Application(), and OptionsDialog::loadOptions().
bool Application::isRunning | ( | ) |
Definition at line 683 of file application.cpp.
References ApplicationInstanceManager::isFirstInstance(), and m_instanceManager.
QPointer< MainWindow > Application::mainWindow | ( | ) |
Definition at line 196 of file application.cpp.
References m_window.
|
privateslot |
Definition at line 293 of file application.cpp.
References m_paramsQueue, m_running, anonymous_namespace{application.cpp}::PARAMS_SEPARATOR, and processParams().
Referenced by Application().
|
private |
Definition at line 528 of file application.cpp.
References BitTorrent::AddTorrentParams::addPaused, BitTorrent::Session::addTorrent(), BitTorrent::AddTorrentParams::category, BitTorrent::AddTorrentParams::firstLastPiecePriority, BitTorrent::Session::instance(), AddNewTorrentDialog::isEnabled(), m_window, BitTorrent::AddTorrentParams::savePath, BitTorrent::AddTorrentParams::sequential, AddNewTorrentDialog::show(), and BitTorrent::AddTorrentParams::skipChecking.
Referenced by exec(), and processMessage().
|
private |
Definition at line 304 of file application.cpp.
References tstool::args, BitTorrent::Torrent::category(), BitTorrent::Torrent::contentPath(), BitTorrent::Torrent::currentTracker(), BitTorrent::AbstractFileStorage::filesCount(), Preferences::getAutoRunProgram(), BitTorrent::Torrent::id(), BitTorrent::Torrent::infoHash(), Preferences::instance(), Digest32< N >::isValid(), OrderedSet< T, Compare >::join(), LogMsg(), BitTorrent::Torrent::name(), BitTorrent::Torrent::rootPath(), BitTorrent::Torrent::savePath(), BitTorrent::Torrent::tags(), Utils::Fs::toNativePath(), Digest32< N >::toString(), BitTorrent::Torrent::totalSize(), BitTorrent::InfoHash::v1(), and BitTorrent::InfoHash::v2().
Referenced by torrentFinished().
|
private |
Definition at line 437 of file application.cpp.
References BitTorrent::Torrent::activeTime(), Utils::Misc::friendlyUnit(), Preferences::getMailNotificationEmail(), Preferences::getMailNotificationSender(), Preferences::instance(), BitTorrent::Torrent::name(), BitTorrent::Torrent::savePath(), Utils::Misc::userFriendlyDuration(), and BitTorrent::Torrent::wantedSize().
Referenced by torrentFinished().
bool Application::sendParams | ( | const QStringList & | params | ) |
Definition at line 519 of file application.cpp.
References m_instanceManager, anonymous_namespace{application.cpp}::PARAMS_SEPARATOR, and ApplicationInstanceManager::sendMessage().
void Application::setFileLoggerAge | ( | int | value | ) |
Definition at line 277 of file application.cpp.
References m_storeFileLoggerAge, and anonymous_namespace{preferences.cpp}::value().
void Application::setFileLoggerAgeType | ( | int | value | ) |
Definition at line 288 of file application.cpp.
References m_storeFileLoggerAgeType, and anonymous_namespace{preferences.cpp}::value().
void Application::setFileLoggerBackup | ( | bool | value | ) |
Definition at line 238 of file application.cpp.
References m_fileLogger, m_storeFileLoggerBackup, and anonymous_namespace{preferences.cpp}::value().
void Application::setFileLoggerDeleteOld | ( | bool | value | ) |
Definition at line 250 of file application.cpp.
References fileLoggerAge(), fileLoggerAgeType(), m_fileLogger, m_storeFileLoggerDeleteOld, and anonymous_namespace{preferences.cpp}::value().
void Application::setFileLoggerEnabled | ( | bool | value | ) |
Definition at line 212 of file application.cpp.
References fileLoggerAge(), fileLoggerAgeType(), fileLoggerMaxSize(), fileLoggerPath(), isFileLoggerBackup(), isFileLoggerDeleteOld(), m_fileLogger, m_storeFileLoggerEnabled, and anonymous_namespace{preferences.cpp}::value().
void Application::setFileLoggerMaxSize | ( | int | bytes | ) |
Definition at line 263 of file application.cpp.
References m_fileLogger, m_storeFileLoggerMaxSize, anonymous_namespace{application.cpp}::MAX_FILELOG_SIZE, and anonymous_namespace{application.cpp}::MIN_FILELOG_SIZE.
void Application::setFileLoggerPath | ( | const QString & | path | ) |
Definition at line 226 of file application.cpp.
References m_fileLogger, and m_storeFileLoggerPath.
Referenced by OptionsDialog::saveOptions().
|
privateslot |
Definition at line 456 of file application.cpp.
References Logger::addMessage(), Logger::instance(), Preferences::instance(), Preferences::isAutoRunEnabled(), Preferences::isMailNotificationEnabled(), BitTorrent::Torrent::name(), runExternalProgram(), and sendNotificationEmail().
Referenced by exec().
|
private |
Definition at line 132 of file application.h.
Referenced by Application(), and commandLineArgs().
|
private |
Definition at line 143 of file application.h.
Referenced by Application(), cleanup(), setFileLoggerBackup(), setFileLoggerDeleteOld(), setFileLoggerEnabled(), setFileLoggerMaxSize(), and setFileLoggerPath().
|
private |
Definition at line 129 of file application.h.
Referenced by Application(), isRunning(), and sendParams().
|
private |
Definition at line 147 of file application.h.
Referenced by exec(), and processMessage().
|
private |
Definition at line 145 of file application.h.
Referenced by initializeTranslation().
|
private |
Definition at line 130 of file application.h.
Referenced by exec(), and processMessage().
|
private |
Definition at line 131 of file application.h.
Referenced by allTorrentsFinished(), and cleanup().
|
private |
Definition at line 153 of file application.h.
Referenced by fileLoggerAge(), and setFileLoggerAge().
|
private |
Definition at line 154 of file application.h.
Referenced by fileLoggerAgeType(), and setFileLoggerAgeType().
|
private |
Definition at line 150 of file application.h.
Referenced by isFileLoggerBackup(), and setFileLoggerBackup().
|
private |
Definition at line 151 of file application.h.
Referenced by isFileLoggerDeleteOld(), and setFileLoggerDeleteOld().
|
private |
Definition at line 149 of file application.h.
Referenced by isFileLoggerEnabled(), and setFileLoggerEnabled().
|
private |
Definition at line 152 of file application.h.
Referenced by fileLoggerMaxSize(), and setFileLoggerMaxSize().
|
private |
Definition at line 155 of file application.h.
Referenced by fileLoggerPath(), and setFileLoggerPath().
|
private |
Definition at line 146 of file application.h.
Referenced by initializeTranslation().
|
private |
Definition at line 139 of file application.h.
|
private |
Definition at line 135 of file application.h.
Referenced by allTorrentsFinished(), cleanup(), exec(), mainWindow(), and processParams().