mirror of
https://github.com/d47081/qBittorrent.git
synced 2025-01-24 05:25:37 +00:00
Clean up Application class constructor
This commit is contained in:
parent
62a3938480
commit
47b9d8dbc6
@ -122,20 +122,22 @@ Application::Application(const QString &id, int &argc, char **argv)
|
|||||||
, m_running(false)
|
, m_running(false)
|
||||||
, m_shutdownAct(ShutdownDialogAction::Exit)
|
, m_shutdownAct(ShutdownDialogAction::Exit)
|
||||||
, m_commandLineArgs(parseCommandLine(this->arguments()))
|
, m_commandLineArgs(parseCommandLine(this->arguments()))
|
||||||
#ifndef DISABLE_WEBUI
|
|
||||||
, m_webui(nullptr)
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
qRegisterMetaType<Log::Msg>("Log::Msg");
|
qRegisterMetaType<Log::Msg>("Log::Msg");
|
||||||
|
|
||||||
setApplicationName("qBittorrent");
|
setApplicationName("qBittorrent");
|
||||||
setOrganizationDomain("qbittorrent.org");
|
setOrganizationDomain("qbittorrent.org");
|
||||||
|
#if !defined(DISABLE_GUI)
|
||||||
|
setDesktopFileName("org.qbittorrent.qBittorrent");
|
||||||
|
setAttribute(Qt::AA_UseHighDpiPixmaps, true); // opt-in to the high DPI pixmap support
|
||||||
|
setQuitOnLastWindowClosed(false);
|
||||||
|
#endif
|
||||||
|
|
||||||
validateCommandLineParameters();
|
validateCommandLineParameters();
|
||||||
|
|
||||||
const QString profileDir = m_commandLineArgs.portableMode
|
const QString profileDir = m_commandLineArgs.portableMode
|
||||||
? QDir(QCoreApplication::applicationDirPath()).absoluteFilePath(DEFAULT_PORTABLE_MODE_PROFILE_DIR)
|
? QDir(QCoreApplication::applicationDirPath()).absoluteFilePath(DEFAULT_PORTABLE_MODE_PROFILE_DIR)
|
||||||
: m_commandLineArgs.profileDir;
|
: m_commandLineArgs.profileDir;
|
||||||
|
|
||||||
Profile::initialize(profileDir, m_commandLineArgs.configurationName,
|
Profile::initialize(profileDir, m_commandLineArgs.configurationName,
|
||||||
m_commandLineArgs.relativeFastresumePaths || m_commandLineArgs.portableMode);
|
m_commandLineArgs.relativeFastresumePaths || m_commandLineArgs.portableMode);
|
||||||
|
|
||||||
@ -143,24 +145,17 @@ Application::Application(const QString &id, int &argc, char **argv)
|
|||||||
SettingsStorage::initInstance();
|
SettingsStorage::initInstance();
|
||||||
Preferences::initInstance();
|
Preferences::initInstance();
|
||||||
|
|
||||||
|
initializeTranslation();
|
||||||
|
|
||||||
if (m_commandLineArgs.webUiPort > 0) // it will be -1 when user did not set any value
|
if (m_commandLineArgs.webUiPort > 0) // it will be -1 when user did not set any value
|
||||||
Preferences::instance()->setWebUiPort(m_commandLineArgs.webUiPort);
|
Preferences::instance()->setWebUiPort(m_commandLineArgs.webUiPort);
|
||||||
|
|
||||||
initializeTranslation();
|
connect(this, &QCoreApplication::aboutToQuit, this, &Application::cleanup);
|
||||||
|
connect(m_instanceManager, &ApplicationInstanceManager::messageReceived, this, &Application::processMessage);
|
||||||
#if !defined(DISABLE_GUI)
|
|
||||||
setAttribute(Qt::AA_UseHighDpiPixmaps, true); // opt-in to the high DPI pixmap support
|
|
||||||
setQuitOnLastWindowClosed(false);
|
|
||||||
setDesktopFileName("org.qbittorrent.qBittorrent");
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(Q_OS_WIN) && !defined(DISABLE_GUI)
|
#if defined(Q_OS_WIN) && !defined(DISABLE_GUI)
|
||||||
connect(this, &QGuiApplication::commitDataRequest, this, &Application::shutdownCleanup, Qt::DirectConnection);
|
connect(this, &QGuiApplication::commitDataRequest, this, &Application::shutdownCleanup, Qt::DirectConnection);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
connect(m_instanceManager, &ApplicationInstanceManager::messageReceived, this, &Application::processMessage);
|
|
||||||
connect(this, &QCoreApplication::aboutToQuit, this, &Application::cleanup);
|
|
||||||
|
|
||||||
if (isFileLoggerEnabled())
|
if (isFileLoggerEnabled())
|
||||||
m_fileLogger = new FileLogger(fileLoggerPath(), isFileLoggerBackup(), fileLoggerMaxSize(), isFileLoggerDeleteOld(), fileLoggerAge(), static_cast<FileLogger::FileLogAgeType>(fileLoggerAgeType()));
|
m_fileLogger = new FileLogger(fileLoggerPath(), isFileLoggerBackup(), fileLoggerMaxSize(), isFileLoggerDeleteOld(), fileLoggerAge(), static_cast<FileLogger::FileLogAgeType>(fileLoggerAgeType()));
|
||||||
|
|
||||||
|
@ -130,7 +130,7 @@ private:
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef DISABLE_WEBUI
|
#ifndef DISABLE_WEBUI
|
||||||
WebUI *m_webui;
|
WebUI *m_webui = nullptr;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// FileLog
|
// FileLog
|
||||||
|
Loading…
x
Reference in New Issue
Block a user