v0.0.3
This commit is contained in:
parent
2b4f09bb49
commit
a934520cd9
1 changed files with 180 additions and 36 deletions
|
|
@ -22,12 +22,15 @@ ConfigInterface::ConfigInterface(QObject *parent)
|
|||
config.close();
|
||||
QJsonObject top = QJsonDocument::fromJson(data).object();
|
||||
QString max, min, alert;
|
||||
bool flipbits;
|
||||
max = top["max_threshold"].toString();
|
||||
min = top["min_threshold"].toString();
|
||||
alert = top["alert_threshold"].toString();
|
||||
flipbits = top["flip_bits"].toBool();
|
||||
setMax(max);
|
||||
setMin(min);
|
||||
setAlert(alert);
|
||||
setFlipBits(flipbits);
|
||||
}
|
||||
else {
|
||||
qDebug() << "File does not exist creating one...";
|
||||
|
|
@ -47,7 +50,7 @@ ConfigInterface::ConfigInterface(QObject *parent)
|
|||
}
|
||||
}
|
||||
|
||||
void ConfigInterface::saveConfig(QString max, QString min, QString alert)
|
||||
void ConfigInterface::saveConfig(QString max, QString min, QString alert, bool flipbits)
|
||||
{
|
||||
auto paths = QStandardPaths::writableLocation(QStandardPaths::AppDataLocation);
|
||||
qDebug() << "Got writable path as: " << paths;
|
||||
|
|
@ -58,6 +61,7 @@ void ConfigInterface::saveConfig(QString max, QString min, QString alert)
|
|||
top["max_threshold"] = max;
|
||||
top["min_threshold"] = min;
|
||||
top["alert_threshold"] = alert;
|
||||
top["flip_bits"] = flipbits;
|
||||
setMax(max);
|
||||
setMin(min);
|
||||
setAlert(alert);
|
||||
|
|
@ -106,3 +110,16 @@ void ConfigInterface::setMin(const QString &newMin)
|
|||
m_min = newMin;
|
||||
emit minChanged();
|
||||
}
|
||||
|
||||
bool ConfigInterface::flipBits() const
|
||||
{
|
||||
return m_flipBits;
|
||||
}
|
||||
|
||||
void ConfigInterface::setFlipBits(bool newFlipBits)
|
||||
{
|
||||
if (m_flipBits == newFlipBits)
|
||||
return;
|
||||
m_flipBits = newFlipBits;
|
||||
emit flipBitsChanged();
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue