2024-08-08 17:41:59 +00:00
|
|
|
/*
|
|
|
|
|
* synergy -- mouse and keyboard sharing utility
|
|
|
|
|
* Copyright (C) 2024 Symless Ltd.
|
|
|
|
|
*
|
|
|
|
|
* This package is free software; you can redistribute it and/or
|
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
|
* found in the file LICENSE that should have accompanied this file.
|
|
|
|
|
*
|
|
|
|
|
* This package is distributed in the hope that it will be useful,
|
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
|
*
|
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
#include <QSettings>
|
|
|
|
|
|
|
|
|
|
namespace synergy::gui::proxy {
|
|
|
|
|
|
2024-08-09 18:20:10 +00:00
|
|
|
QString getSystemSettingPath();
|
|
|
|
|
|
2024-08-08 17:41:59 +00:00
|
|
|
class QSettingsProxy {
|
|
|
|
|
public:
|
|
|
|
|
virtual ~QSettingsProxy() = default;
|
2024-08-09 18:20:10 +00:00
|
|
|
|
|
|
|
|
virtual void loadUser();
|
|
|
|
|
virtual void loadSystem();
|
2024-08-10 23:58:24 +00:00
|
|
|
virtual void clear() { m_pSettings->clear(); }
|
2024-08-09 18:20:10 +00:00
|
|
|
virtual void sync() { m_pSettings->sync(); }
|
2024-08-08 17:41:59 +00:00
|
|
|
virtual int beginReadArray(const QString &prefix);
|
|
|
|
|
virtual void beginWriteArray(const QString &prefix);
|
|
|
|
|
virtual void setArrayIndex(int i);
|
|
|
|
|
virtual QVariant value(const QString &key) const;
|
|
|
|
|
virtual QVariant
|
|
|
|
|
value(const QString &key, const QVariant &defaultValue) const;
|
|
|
|
|
virtual void endArray();
|
|
|
|
|
virtual void setValue(const QString &key, const QVariant &value);
|
|
|
|
|
virtual void beginGroup(const QString &prefix);
|
|
|
|
|
virtual void endGroup();
|
|
|
|
|
virtual void remove(const QString &key);
|
|
|
|
|
virtual bool isWritable() const;
|
|
|
|
|
virtual bool contains(const QString &key) const;
|
2024-08-09 13:03:48 +00:00
|
|
|
virtual QString fileName() const { return m_pSettings->fileName(); }
|
2024-08-08 17:41:59 +00:00
|
|
|
|
|
|
|
|
QSettings &get() const { return *m_pSettings; }
|
|
|
|
|
|
|
|
|
|
private:
|
2024-08-09 18:20:10 +00:00
|
|
|
std::unique_ptr<QSettings> m_pSettings;
|
2024-08-08 17:41:59 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
} // namespace synergy::gui::proxy
|