diff --git a/build/Desktop_Qt_6_9_0_MinGW_64_bit-Debug/.qmake.stash b/build/Desktop_Qt_6_9_0_MinGW_64_bit-Debug/.qmake.stash
new file mode 100644
index 0000000..8e49e8a
--- /dev/null
+++ b/build/Desktop_Qt_6_9_0_MinGW_64_bit-Debug/.qmake.stash
@@ -0,0 +1,21 @@
+QMAKE_CXX.QT_COMPILER_STDCXX = 201703L
+QMAKE_CXX.QMAKE_GCC_MAJOR_VERSION = 13
+QMAKE_CXX.QMAKE_GCC_MINOR_VERSION = 1
+QMAKE_CXX.QMAKE_GCC_PATCH_VERSION = 0
+QMAKE_CXX.COMPILER_MACROS = \
+ QT_COMPILER_STDCXX \
+ QMAKE_GCC_MAJOR_VERSION \
+ QMAKE_GCC_MINOR_VERSION \
+ QMAKE_GCC_PATCH_VERSION
+QMAKE_CXX.INCDIRS = \
+ C:/Qt/Tools/mingw1310_64/lib/gcc/x86_64-w64-mingw32/13.1.0/include/c++ \
+ C:/Qt/Tools/mingw1310_64/lib/gcc/x86_64-w64-mingw32/13.1.0/include/c++/x86_64-w64-mingw32 \
+ C:/Qt/Tools/mingw1310_64/lib/gcc/x86_64-w64-mingw32/13.1.0/include/c++/backward \
+ C:/Qt/Tools/mingw1310_64/lib/gcc/x86_64-w64-mingw32/13.1.0/include \
+ C:/Qt/Tools/mingw1310_64/lib/gcc/x86_64-w64-mingw32/13.1.0/include-fixed \
+ C:/Qt/Tools/mingw1310_64/x86_64-w64-mingw32/include
+QMAKE_CXX.LIBDIRS = \
+ C:/Qt/Tools/mingw1310_64/lib/gcc/x86_64-w64-mingw32/13.1.0 \
+ C:/Qt/Tools/mingw1310_64/lib/gcc \
+ C:/Qt/Tools/mingw1310_64/x86_64-w64-mingw32/lib \
+ C:/Qt/Tools/mingw1310_64/lib
diff --git a/data.qrc b/data.qrc
new file mode 100644
index 0000000..2f0a67e
--- /dev/null
+++ b/data.qrc
@@ -0,0 +1,5 @@
+
+
+ ex.txt
+
+
diff --git a/ex.txt b/ex.txt
new file mode 100644
index 0000000..563752a
--- /dev/null
+++ b/ex.txt
@@ -0,0 +1,7 @@
+{
+ "id": 1,
+ "texte": "tkt",
+ "latitude": "N 45 37.199",
+ "longitude": "W 1 2.009",
+ "valeur": -1
+}
diff --git a/main.cpp b/main.cpp
index 4b6acc2..d0f29f9 100644
--- a/main.cpp
+++ b/main.cpp
@@ -2,13 +2,22 @@
#include
#include
+#include
+using namespace std;
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
MainWindow w;
- w.show();
+ //w.show();
+ QFile file(":/data/ex.txt");
+ file.open(QIODevice::ReadOnly|QIODevice::Text);
+ QTextStream in(&file);
+ Step v();
+ /* QString contenu = in.readAll();
+ qDebug() << "Contenu lu depuis QTextStream:";
+ qDebug().noquote() << contenu;*/
return a.exec();
}
diff --git a/sae201.pro b/sae201.pro
index 1e37e62..135504b 100644
--- a/sae201.pro
+++ b/sae201.pro
@@ -24,3 +24,7 @@ FORMS += \
qnx: target.path = /tmp/$${TARGET}/bin
else: unix:!android: target.path = /opt/$${TARGET}/bin
!isEmpty(target.path): INSTALLS += target
+
+RESOURCES += \
+ data.qrc
+
diff --git a/step.cpp b/step.cpp
index 17f2edc..ce43ad1 100644
--- a/step.cpp
+++ b/step.cpp
@@ -1,26 +1,77 @@
#include "step.h"
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+QString Step::getTitle() const
+{
+ return title;
+}
+
+float Step::getLatitude() const
+{
+ return latitude;
+}
+
+float Step::getLongitude() const
+{
+ return longitude;
+}
+
+int Step::getResponse() const
+{
+ return response;
+}
+
Step::Step() {
latitude = 0.0;
longitude = 0.0;
response = 0;
}
-Step::Step(QTextStream &in)
+
+Step::Step( QJsonObject &in)
{
- int stepNumber;
- in >> stepNumber;
- in.readLine();
- title = in.readLine();
- QChar latDir, lonDir;
- int latDeg, lonDeg;
- float latMin, lonMin;
- in >> latDir >> latDeg >> latMin >> lonDir >> lonDeg >> lonMin;
+ title = in["title"].toString();
+ response = in["reponse"].toInt();
+ QString gps = in["GPS"].toString();
+ QStringList parts = gps.split(" ", Qt::SkipEmptyParts);
+
+ QChar latDir = parts[0][0]; // c'est le premier QChar du QString t'as capté
+ int latDeg = parts[1].toInt();
+ float latMin = parts[2].toFloat();
setLatitude(latDeg, latMin, latDir);
+
+ QChar lonDir = parts[3][0];
+ int lonDeg = parts[4].toInt();
+ float lonMin = parts[5].toFloat();
setLongitude(lonDeg, lonMin, lonDir);
- in >> response;
- in.readLine();
+
+ QJsonArray personnagetab = in["dialogue"].toArray();
+ for (const QJsonValue &val : personnagetab) {
+ if (val.isObject()) {
+ QJsonObject obj = val.toObject();
+ QString personnage = obj["personnage"].toString();
+ personnage.append(personnage);
+ }
+ }
+ QJsonArray textetab = in["dialogue"].toArray();
+ for (const QJsonValue &val : textetab) {
+ if (val.isObject()) {
+ QJsonObject obj = val.toObject();
+ QString textes = obj["texte"].toString();
+ texte.append(textes);
+ }
+ }
}
+
+
+
+
void Step::setLatitude(int degree, float minute, QChar NS)
{
latitude = degree + minute / 60.0;
diff --git a/step.h b/step.h
index eb46bbc..8d93c46 100644
--- a/step.h
+++ b/step.h
@@ -2,6 +2,10 @@
#define STEP_H
#include
#include
+#include
+#include
+#include
+using namespace std;
class Step
{
@@ -9,14 +13,19 @@ private:
QString title;
float latitude;
float longitude;
- QString text;
int response;
+ QList personnage;
+ QList texte;
public:
Step();
- Step(QTextStream &in);
+ Step(QJsonObject &in);
void setLatitude(int degree,float minute,QChar NS);
void setLongitude(int degree,float minute,QChar EW);
+ QString getTitle() const;
+ float getLatitude() const;
+ float getLongitude() const;
+ int getResponse() const;
};
#endif // STEP_H