SIngleton getter for systemfactory.

This commit is contained in:
Martin Rotter 2013-12-17 18:16:09 +01:00
parent 738dbbe5c6
commit 010dd24e4b
3 changed files with 11 additions and 10 deletions

View File

@ -1,6 +1,7 @@
#include <QString> #include <QString>
#include <QFile> #include <QFile>
#include <QApplication> #include <QApplication>
#include <QReadWriteLock>
#if defined(Q_OS_WIN) #if defined(Q_OS_WIN)
#include <QSettings> #include <QSettings>
@ -86,6 +87,7 @@ QString SystemFactory::getAutostartDesktopFileLocation() {
// No location found, return empty string. // No location found, return empty string.
return desktop_file_location; return desktop_file_location;
} }
#endif
SystemFactory *SystemFactory::getInstance() { SystemFactory *SystemFactory::getInstance() {
if (s_instance.isNull()) { if (s_instance.isNull()) {
@ -94,7 +96,6 @@ SystemFactory *SystemFactory::getInstance() {
return s_instance; return s_instance;
} }
#endif
bool SystemFactory::setAutoStartStatus(const AutoStartStatus &new_status) { bool SystemFactory::setAutoStartStatus(const AutoStartStatus &new_status) {
SystemFactory::AutoStartStatus current_status = SystemFactory::getAutoStartStatus(); SystemFactory::AutoStartStatus current_status = SystemFactory::getAutoStartStatus();

View File

@ -5,6 +5,8 @@
#include <QPointer> #include <QPointer>
class QReadWriteLock;
class SystemFactory : public QObject { class SystemFactory : public QObject {
Q_OBJECT Q_OBJECT
@ -32,7 +34,7 @@ class SystemFactory : public QObject {
#if defined(Q_OS_LINUX) #if defined(Q_OS_LINUX)
// Returns standard location where auto-start .desktop files // Returns standard location where auto-start .desktop files
// should be placed. // should be placed.
static QString getAutostartDesktopFileLocation(); QString getAutostartDesktopFileLocation();
#endif #endif
// Singleton getter. // Singleton getter.

View File

@ -425,14 +425,12 @@ void FormSettings::loadGeneral() {
void FormSettings::saveGeneral() { void FormSettings::saveGeneral() {
// If auto-start feature is available and user wants // If auto-start feature is available and user wants
// to turn it on, then turn it on. // to turn it on, then turn it on.
if (SystemFactory::getInstance()->getAutoStartStatus() != SystemFactory::Unavailable) {
if (m_ui->m_checkAutostart->isChecked()) { if (m_ui->m_checkAutostart->isChecked()) {
SystemFactory::getInstance()->setAutoStartStatus(SystemFactory::Enabled); SystemFactory::getInstance()->setAutoStartStatus(SystemFactory::Enabled);
} }
else { else {
SystemFactory::getInstance()->setAutoStartStatus(SystemFactory::Disabled); SystemFactory::getInstance()->setAutoStartStatus(SystemFactory::Disabled);
} }
}
} }
void FormSettings::loadInterface() { void FormSettings::loadInterface() {