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

View File

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

View File

@ -133,7 +133,7 @@ void FormSettings::selectBrowserExecutable() {
tr("Executables (*.*)"));
if (!executable_file.isEmpty()) {
m_ui->m_txtExternalBrowserExecutable->setText(executable_file);
m_ui->m_txtExternalBrowserExecutable->setText(executable_file);
}
}
@ -425,13 +425,11 @@ void FormSettings::loadGeneral() {
void FormSettings::saveGeneral() {
// If auto-start feature is available and user wants
// to turn it on, then turn it on.
if (SystemFactory::getInstance()->getAutoStartStatus() != SystemFactory::Unavailable) {
if (m_ui->m_checkAutostart->isChecked()) {
SystemFactory::getInstance()->setAutoStartStatus(SystemFactory::Enabled);
}
else {
SystemFactory::getInstance()->setAutoStartStatus(SystemFactory::Disabled);
}
if (m_ui->m_checkAutostart->isChecked()) {
SystemFactory::getInstance()->setAutoStartStatus(SystemFactory::Enabled);
}
else {
SystemFactory::getInstance()->setAutoStartStatus(SystemFactory::Disabled);
}
}