mirror-chatterino2/settings/stringsetting.h

62 lines
917 B
C
Raw Normal View History

2017-01-20 06:10:28 +01:00
#ifndef STRINGSETTING_H
#define STRINGSETTING_H
#include "settings/setting.h"
#include <QString>
namespace chatterino {
namespace settings {
class StringSetting : public Setting
{
Q_OBJECT
2017-01-20 06:10:28 +01:00
public:
StringSetting(const QString &name, const QString &defaultValue)
: Setting(name)
, value(defaultValue)
, defaultValue(defaultValue)
{
}
const QString &
get() const
{
return this->value;
}
const QString &
set(const QString &value)
{
2017-01-21 05:14:27 +01:00
this->value = value;
QString tmp = value;
emit valueChanged(tmp);
return this->value;
2017-01-20 06:10:28 +01:00
}
void
save(const QSettings &settings) override
{
}
void
load(const QSettings &settings) override
{
}
2017-01-21 05:14:27 +01:00
signals:
void valueChanged(const QString &value);
2017-01-20 06:10:28 +01:00
private:
QString value;
QString defaultValue;
};
}
}
#endif // STRINGSETTING_H