RedPanda-CPP/RedPandaIDE/settings.cpp

29 lines
673 B
C++
Raw Normal View History

#include "settings.h"
#include <QTextCodec>
Settings* pSettings;
Settings::Settings():
mSettings(QSettings::IniFormat,QSettings::UserScope,"Red Panda C++")
{
// default values for editors
setDefault(EDITOR_DEFAULT_ENCODING, QTextCodec::codecForLocale()->name());
2021-04-09 17:48:25 +08:00
setDefault(EDITOR_AUTO_INDENT,true);
}
void Settings::setDefault(const QString &key, const QVariant &value) {
if (!mSettings.contains(key)) {
mSettings.setValue(key,value);
}
}
void Settings::setValue(const QString &key, const QVariant &value) {
mSettings.setValue(key,value);
}
QVariant Settings::value(const QString &key) const {
return mSettings.value(key);
}