Skip to content

Commit

Permalink
Added tracking of stains between saves
Browse files Browse the repository at this point in the history
  • Loading branch information
Pkow1999 committed Sep 13, 2024
1 parent 19fc50a commit b2d9677
Showing 1 changed file with 19 additions and 2 deletions.
21 changes: 19 additions & 2 deletions mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
#include <QMessageBox>
#include <QCloseEvent>
#include <QScrollArea>
#include <algorithm>

QString MainWindow::notesText;

Expand Down Expand Up @@ -715,6 +714,7 @@ QJsonObject MainWindow::saveRest()
array->append(willpowerPoints);
json["Willpower"] = *array;
json["Humanity"] = QString::number(countIndicators(ui->HumanityLayout,10).second);
json["Stains"] = QString::number(countIndicators(ui->HumanityLayout,10).first);
json["Blood Potency"] = QString::number(countDots(ui->BloodPotencyGroup));
json["Notes"] = notesText;
delete array;
Expand Down Expand Up @@ -891,6 +891,15 @@ bool MainWindow::loadRest(QJsonObject json)
czek->setCheckState(Qt::CheckState::Checked);
}
}
if(restArray.first()["Stains"].isString())
{
int stains = restArray.first()["Stains"].toString().toInt();
for(int i = 0; i < stains; i++)
{
QCheckBox *czek = qobject_cast <QCheckBox * >(ui->HumanityLayout->itemAt(9 - i)->widget());
czek->setCheckState(Qt::CheckState::PartiallyChecked);
}
}
if(restArray.first()["Blood Potency"].isString())
{
int blood = restArray.first()["Blood Potency"].toString().toInt();
Expand Down Expand Up @@ -1201,6 +1210,15 @@ bool MainWindow::androidLoad(QJsonObject json)
czek->setCheckState(Qt::CheckState::Checked);
}
}
if(indicatorsJson.contains("stains") && indicatorsJson["stains"].isString())
{
size_t stains = indicatorsJson["stains"].toString().toInt();
for(size_t i = 0; i < stains; i++)
{
QCheckBox *czek = qobject_cast <QCheckBox * >(ui->HumanityLayout->itemAt(9 - i)->widget());
czek->setCheckState(Qt::CheckState::Checked);
}
}
if(indicatorsJson.contains("hunger") && indicatorsJson["hunger"].isString())
{
size_t hungerValue = indicatorsJson["hunger"].toString().toInt();
Expand Down Expand Up @@ -1254,7 +1272,6 @@ bool MainWindow::androidLoad(QJsonObject json)
if(json.contains("Disciplines") && json["Disciplines"].isObject())
{
auto disciplinesJson = json["Disciplines"].toObject();
size_t counter = 0;
QStringList keyList = disciplinesJson.keys();
for(QAbstractButton *bt : ui->buttonGroup_3->buttons())
{
Expand Down

0 comments on commit b2d9677

Please sign in to comment.