Merge pull request #11994 from Chocobo1/profile

Unify singleton pattern in Profile class
This commit is contained in:
Mike Tzou
2020-02-12 23:59:47 +08:00
committed by GitHub
9 changed files with 39 additions and 34 deletions

View File

@@ -149,7 +149,7 @@ Application::Application(const QString &id, int &argc, char **argv)
const QString profileDir = portableModeEnabled
? QDir(QCoreApplication::applicationDirPath()).absoluteFilePath(DEFAULT_PORTABLE_MODE_PROFILE_DIR)
: m_commandLineArgs.profileDir;
Profile::initialize(profileDir, m_commandLineArgs.configurationName,
Profile::initInstance(profileDir, m_commandLineArgs.configurationName,
(m_commandLineArgs.relativeFastresumePaths || portableModeEnabled));
Logger::initInstance();
@@ -177,7 +177,7 @@ Application::Application(const QString &id, int &argc, char **argv)
Logger::instance()->addMessage(tr("Redundant command line flag detected: \"%1\". Portable mode implies relative fastresume.").arg("--relative-fastresume"), Log::WARNING); // to avoid translating the `--relative-fastresume` string
}
else {
Logger::instance()->addMessage(tr("Using config directory: %1").arg(Profile::instance().location(SpecialFolder::Config)));
Logger::instance()->addMessage(tr("Using config directory: %1").arg(Profile::instance()->location(SpecialFolder::Config)));
}
}
@@ -764,6 +764,8 @@ void Application::cleanup()
}
#endif // DISABLE_GUI
Profile::freeInstance();
if (m_shutdownAct != ShutdownDialogAction::Exit) {
qDebug() << "Sending computer shutdown/suspend/hibernate signal...";
Utils::Misc::shutdownComputer(m_shutdownAct);