ATBTariffCalculator/Utilities/main.cpp

52 lines
1.4 KiB
C++
Raw Normal View History

2024-03-01 13:38:12 +01:00
#include <QtGlobal>
2024-03-03 11:20:35 +01:00
#include <QFile>
#include <QJsonDocument>
#include <QJsonObject>
#include <QDebug>
#include "tariff_editor.h"
2024-03-01 13:38:12 +01:00
int main(int argc, char **argv) {
Q_UNUSED(argc);
Q_UNUSED(argv);
2024-03-03 11:20:35 +01:00
TariffEditor editor;
editor.writeToDocument("Project", "Szeged");
editor.writeToDocument("Version", "1.0.0");
editor.writeToDocument("Date", "01.01.1970");
editor.writeToDocument("Commiter" , "");
editor.writeToDocument("Info", "");
editor.writeToDocument(editor.create("TariffType"));
editor.writeToDocument(editor.create("TariffAccuracy"));
editor.writeToDocument(editor.create("TariffPrice"));
editor.writeToDocument(editor.create("TariffProducts"));
editor.writeToDocument(editor.create("TariffConfig"));
editor.writeToDocument(editor.create("TimeRanges"));
qCritical().noquote() << editor.document().toJson();
return 0;
QFile currentFile("/home/linux/ATBTariffCalculator/Utilities/tariff.template.json");
if (currentFile.open(QIODevice::ReadOnly)) {
qCritical() << __LINE__;
QByteArray json = currentFile.readAll();
QJsonParseError e;
QJsonDocument doc = QJsonDocument::fromJson(json, &e);
if (e.error == QJsonParseError::NoError) {
qCritical().noquote() << doc.toJson(QJsonDocument::JsonFormat::Indented);
} else {
qCritical() << e.errorString();
}
}
2024-03-01 13:38:12 +01:00
return 0;
}