mirror of
https://github.com/kiwix/kiwix-desktop.git
synced 2025-09-27 06:42:07 -04:00
use QSettings to save settings
This commit is contained in:
parent
aab3d123a0
commit
49bad4bf59
@ -1,7 +1,9 @@
|
|||||||
#include "settingsmanager.h"
|
#include "settingsmanager.h"
|
||||||
|
|
||||||
SettingsManager::SettingsManager(QObject *parent)
|
SettingsManager::SettingsManager(QObject *parent)
|
||||||
: QObject(parent), m_settingsViewDisplayed(false)
|
: QObject(parent),
|
||||||
|
m_settings("Kiwix", "Kiwix-desktop"),
|
||||||
|
m_settingsViewDisplayed(false)
|
||||||
{
|
{
|
||||||
setSettings();
|
setSettings();
|
||||||
}
|
}
|
||||||
@ -19,10 +21,11 @@ SettingsManagerView* SettingsManager::getView()
|
|||||||
void SettingsManager::setKiwixServerPort(int port)
|
void SettingsManager::setKiwixServerPort(int port)
|
||||||
{
|
{
|
||||||
m_kiwixServerPort = port;
|
m_kiwixServerPort = port;
|
||||||
|
m_settings.setValue("localKiwixServer/port", port);
|
||||||
emit(portChanged(port));
|
emit(portChanged(port));
|
||||||
}
|
}
|
||||||
|
|
||||||
void SettingsManager::setSettings()
|
void SettingsManager::setSettings()
|
||||||
{
|
{
|
||||||
m_kiwixServerPort = 8181;
|
m_kiwixServerPort = m_settings.value("localKiwixServer/port", 8181).toInt();
|
||||||
}
|
}
|
@ -2,6 +2,7 @@
|
|||||||
#define SETTINGSMANAGER_H
|
#define SETTINGSMANAGER_H
|
||||||
|
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
|
#include <QSettings>
|
||||||
#include "settingsmanagerview.h"
|
#include "settingsmanagerview.h"
|
||||||
|
|
||||||
class SettingsManager : public QObject
|
class SettingsManager : public QObject
|
||||||
@ -26,6 +27,7 @@ signals:
|
|||||||
void portChanged(int port);
|
void portChanged(int port);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
QSettings m_settings;
|
||||||
bool m_settingsViewDisplayed;
|
bool m_settingsViewDisplayed;
|
||||||
int m_kiwixServerPort;
|
int m_kiwixServerPort;
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user