Merge branch 'main' into 'feature/openFile'
# Conflicts: # path.h
This commit is contained in:
commit
6b4191057f
21
build/Desktop_Qt_6_9_0_MinGW_64_bit-Debug/.qmake.stash
Normal file
21
build/Desktop_Qt_6_9_0_MinGW_64_bit-Debug/.qmake.stash
Normal file
@ -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
|
||||||
5
data.qrc
Normal file
5
data.qrc
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
<RCC>
|
||||||
|
<qresource prefix="/data">
|
||||||
|
<file>ex.txt</file>
|
||||||
|
</qresource>
|
||||||
|
</RCC>
|
||||||
7
ex.txt
Normal file
7
ex.txt
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
{
|
||||||
|
"id": 1,
|
||||||
|
"texte": "tkt",
|
||||||
|
"latitude": "N 45 37.199",
|
||||||
|
"longitude": "W 1 2.009",
|
||||||
|
"valeur": -1
|
||||||
|
}
|
||||||
5
main.cpp
5
main.cpp
@ -4,13 +4,14 @@
|
|||||||
|
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
#include <step.h>
|
#include <step.h>
|
||||||
|
#include <QFile>
|
||||||
|
|
||||||
|
using namespace std;
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
QApplication a(argc, argv);
|
QApplication a(argc, argv);
|
||||||
MainWindow w;
|
MainWindow w;
|
||||||
w.show();
|
//w.show();
|
||||||
|
|
||||||
|
|
||||||
return a.exec();
|
return a.exec();
|
||||||
}
|
}
|
||||||
|
|||||||
9
path.cpp
9
path.cpp
@ -81,4 +81,11 @@ Path::Path(QFile *file){
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Path::addStep(int indice){step.insert(indice, Step());}
|
void Path::addStep(int indice){
|
||||||
|
if(indice==-1){
|
||||||
|
step.append(Step());
|
||||||
|
}else{
|
||||||
|
step.insert(indice, Step());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|||||||
2
path.h
2
path.h
@ -20,7 +20,7 @@ private:
|
|||||||
public:
|
public:
|
||||||
Path();
|
Path();
|
||||||
Path(QFile *file);
|
Path(QFile *file);
|
||||||
void addStep(int indice);
|
void addStep(int indice=-1);
|
||||||
QString getCity() const;
|
QString getCity() const;
|
||||||
int getDepartement() const;
|
int getDepartement() const;
|
||||||
QString getName() const;
|
QString getName() const;
|
||||||
|
|||||||
@ -26,3 +26,7 @@ FORMS += \
|
|||||||
qnx: target.path = /tmp/$${TARGET}/bin
|
qnx: target.path = /tmp/$${TARGET}/bin
|
||||||
else: unix:!android: target.path = /opt/$${TARGET}/bin
|
else: unix:!android: target.path = /opt/$${TARGET}/bin
|
||||||
!isEmpty(target.path): INSTALLS += target
|
!isEmpty(target.path): INSTALLS += target
|
||||||
|
|
||||||
|
RESOURCES += \
|
||||||
|
data.qrc
|
||||||
|
|
||||||
|
|||||||
69
step.cpp
69
step.cpp
@ -1,26 +1,73 @@
|
|||||||
#include "step.h"
|
#include "step.h"
|
||||||
|
|
||||||
|
#include <QJsonDocument>
|
||||||
|
#include <QJsonObject>
|
||||||
|
#include <QJsonParseError>
|
||||||
|
#include <QJsonDocument>
|
||||||
|
#include <QJsonObject>
|
||||||
|
#include <QJsonArray>
|
||||||
|
#include <QJsonParseError>
|
||||||
|
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() {
|
Step::Step() {
|
||||||
latitude = 0.0;
|
latitude = 0.0;
|
||||||
longitude = 0.0;
|
longitude = 0.0;
|
||||||
response = 0;
|
response = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
Step::Step(QTextStream &in)
|
|
||||||
|
Step::Step( QJsonObject &in)
|
||||||
{
|
{
|
||||||
int stepNumber;
|
title = in["title"].toString();
|
||||||
in >> stepNumber;
|
response = in["reponse"].toInt();
|
||||||
in.readLine();
|
QString gps = in["GPS"].toString();
|
||||||
title = in.readLine();
|
QStringList parts = gps.split(" ", Qt::SkipEmptyParts);
|
||||||
QChar latDir, lonDir;
|
|
||||||
int latDeg, lonDeg;
|
QChar latDir = parts[0][0]; // c'est le premier QChar du QString t'as capté
|
||||||
float latMin, lonMin;
|
int latDeg = parts[1].toInt();
|
||||||
in >> latDir >> latDeg >> latMin >> lonDir >> lonDeg >> lonMin;
|
float latMin = parts[2].toFloat();
|
||||||
setLatitude(latDeg, latMin, latDir);
|
setLatitude(latDeg, latMin, latDir);
|
||||||
|
|
||||||
|
QChar lonDir = parts[3][0];
|
||||||
|
int lonDeg = parts[4].toInt();
|
||||||
|
float lonMin = parts[5].toFloat();
|
||||||
setLongitude(lonDeg, lonMin, lonDir);
|
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 personnages = obj["personnage"].toString();
|
||||||
|
personnage.append(personnages);
|
||||||
|
QString textes = obj["texte"].toString();
|
||||||
|
texte.append(textes);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void Step::setLatitude(int degree, float minute, QChar NS)
|
void Step::setLatitude(int degree, float minute, QChar NS)
|
||||||
{
|
{
|
||||||
latitude = degree + minute / 60.0;
|
latitude = degree + minute / 60.0;
|
||||||
|
|||||||
13
step.h
13
step.h
@ -2,6 +2,10 @@
|
|||||||
#define STEP_H
|
#define STEP_H
|
||||||
#include <QString>
|
#include <QString>
|
||||||
#include <QTextStream>
|
#include <QTextStream>
|
||||||
|
#include <iostream>
|
||||||
|
#include <QJsonObject>
|
||||||
|
#include <QList>
|
||||||
|
using namespace std;
|
||||||
class Step
|
class Step
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -9,14 +13,19 @@ private:
|
|||||||
QString title;
|
QString title;
|
||||||
float latitude;
|
float latitude;
|
||||||
float longitude;
|
float longitude;
|
||||||
QString text;
|
|
||||||
int response;
|
int response;
|
||||||
|
QList<QString> personnage;
|
||||||
|
QList<QString> texte;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Step();
|
Step();
|
||||||
Step(QTextStream &in);
|
Step(QJsonObject &in);
|
||||||
void setLatitude(int degree,float minute,QChar NS);
|
void setLatitude(int degree,float minute,QChar NS);
|
||||||
void setLongitude(int degree,float minute,QChar EW);
|
void setLongitude(int degree,float minute,QChar EW);
|
||||||
|
QString getTitle() const;
|
||||||
|
float getLatitude() const;
|
||||||
|
float getLongitude() const;
|
||||||
|
int getResponse() const;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // STEP_H
|
#endif // STEP_H
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user