Introduce Settingsprovider to read settings
Previously, it was in the configprovider.cpp. Now, it has been split to this file
This commit is contained in:
parent
f03e247bd8
commit
2824f84f9f
27
settingsprovider.cpp
Normal file
27
settingsprovider.cpp
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
#include "settingsprovider.h"
|
||||||
|
#include <QFileInfo>
|
||||||
|
#include <QDir>
|
||||||
|
|
||||||
|
SettingsProvider::SettingsProvider(QSettings &settings)
|
||||||
|
{
|
||||||
|
this->settings = &settings;
|
||||||
|
}
|
||||||
|
|
||||||
|
QStringList SettingsProvider::userEntriesPaths() const
|
||||||
|
{
|
||||||
|
//TODO: make it configurable, but we stick with this for now.
|
||||||
|
QFileInfo fi(this->settings->fileName());
|
||||||
|
return { fi.absoluteDir().absolutePath() };
|
||||||
|
}
|
||||||
|
|
||||||
|
QStringList SettingsProvider::systemApplicationsEntriesPaths() const
|
||||||
|
{
|
||||||
|
return settings->value("sysAppsPaths", "/usr/share/applications/").toStringList();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool SettingsProvider::singleInstanceMode() const
|
||||||
|
{
|
||||||
|
return settings->value("singleInstance", true).toBool();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
18
settingsprovider.h
Normal file
18
settingsprovider.h
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
#ifndef SETTINGSPROVIDER_H
|
||||||
|
#define SETTINGSPROVIDER_H
|
||||||
|
|
||||||
|
#include <stdexcept>
|
||||||
|
#include <QSettings>
|
||||||
|
|
||||||
|
class SettingsProvider
|
||||||
|
{
|
||||||
|
private:
|
||||||
|
QSettings *settings;
|
||||||
|
public:
|
||||||
|
SettingsProvider(QSettings &settings);
|
||||||
|
virtual QStringList userEntriesPaths() const;
|
||||||
|
virtual QStringList systemApplicationsEntriesPaths() const;
|
||||||
|
virtual bool singleInstanceMode() const;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // SETTINGSPROVIDER_H
|
Loading…
Reference in New Issue
Block a user