Added ConfigProvider class to allow window to reload config
Cette révision appartient à :
Parent
1dc7ef935d
révision
67be2dbeaa
25
configprovider.cpp
Fichier normal
25
configprovider.cpp
Fichier normal
@ -0,0 +1,25 @@
|
||||
#include "configprovider.h"
|
||||
|
||||
ConfigProvider::ConfigProvider(QString configDirPath, QSettings &settings)
|
||||
{
|
||||
this->settings = &settings;
|
||||
this->configDirPath = configDirPath;
|
||||
}
|
||||
|
||||
QVector<EntryConfig> ConfigProvider::getUserEntries()
|
||||
{
|
||||
ConfigReader reader({this->configDirPath});
|
||||
return reader.readConfig();
|
||||
}
|
||||
|
||||
QVector<EntryConfig> ConfigProvider::getSystemEntries()
|
||||
{
|
||||
QStringList systemApplicationsPaths = settings->value("sysAppsPaths", "/usr/share/applications/").toStringList();
|
||||
ConfigReader systemConfigReader(systemApplicationsPaths);
|
||||
return systemConfigReader.readConfig();
|
||||
}
|
||||
|
||||
bool ConfigProvider::singleInstanceMode()
|
||||
{
|
||||
return settings->value("singleInstance", true).toBool();
|
||||
}
|
18
configprovider.h
Fichier normal
18
configprovider.h
Fichier normal
@ -0,0 +1,18 @@
|
||||
#ifndef CONFIGPROVIDER_H
|
||||
#define CONFIGPROVIDER_H
|
||||
#include <QSettings>
|
||||
#include "config.h"
|
||||
|
||||
class ConfigProvider
|
||||
{
|
||||
private:
|
||||
QSettings *settings;
|
||||
QString configDirPath;
|
||||
public:
|
||||
ConfigProvider(QString configDirPath, QSettings &settings);
|
||||
QVector<EntryConfig> getUserEntries();
|
||||
QVector<EntryConfig> getSystemEntries();
|
||||
bool singleInstanceMode();
|
||||
};
|
||||
|
||||
#endif // CONFIGPROVIDER_H
|
Chargement…
Référencer dans un nouveau ticket
Block a user