Merge branch 'feature/stepInformation' into 'main'
Feature/step information See merge request p2406187/sae201!11
This commit is contained in:
commit
9f8bc30d5a
80
data/parcours2.json
Normal file
80
data/parcours2.json
Normal file
@ -0,0 +1,80 @@
|
||||
{
|
||||
"name": "Chemin des Saveurs",
|
||||
"city": "Bourg en Bresse",
|
||||
"departement": 1,
|
||||
"difficulty": 3,
|
||||
"duration": 3.8,
|
||||
"length": 24.6,
|
||||
"description": "Parcours gourmand et culturel entre ville et campagne, à la découverte des trésors cachés de Bourg en Bresse.",
|
||||
"image": "data/parcours1.png",
|
||||
"steps": [
|
||||
{
|
||||
"numero": 1,
|
||||
"title": "Départ au centre-ville",
|
||||
"GPS": "N 46 12.321 E 5 13.245",
|
||||
"indice": "Sous la grande horloge, cherchez la plaque dorée.",
|
||||
"reponse": "Horloge",
|
||||
"dialogue": [
|
||||
{
|
||||
"personnage": "Clémentine",
|
||||
"texte": "Bienvenue à tous, voici le centre historique !"
|
||||
},
|
||||
{
|
||||
"personnage": "Léo",
|
||||
"texte": "Regardez cette magnifique horloge, elle date du XIXe siècle !"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"numero": 2,
|
||||
"title": "Marché couvert",
|
||||
"GPS": "N 46 12.500 E 5 13.800",
|
||||
"indice": "Le nombre de colonnes à l'entrée principale vous donnera la solution.",
|
||||
"reponse": 6,
|
||||
"dialogue": [
|
||||
{
|
||||
"personnage": "Aurélie",
|
||||
"texte": "Ici, on trouve les meilleurs fromages de la région !"
|
||||
},
|
||||
{
|
||||
"personnage": "Sami",
|
||||
"texte": "Combien de colonnes vois-tu à l'entrée ?"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"numero": 3,
|
||||
"title": "Au bord de la Reyssouze",
|
||||
"GPS": "N 46 12.900 E 5 13.900",
|
||||
"indice": "Sous le vieux pont de pierre, cherchez une gravure effacée.",
|
||||
"reponse": "1912",
|
||||
"dialogue": [
|
||||
{
|
||||
"personnage": "Juliette",
|
||||
"texte": "La Reyssouze apporte de la fraîcheur en été."
|
||||
},
|
||||
{
|
||||
"personnage": "Marc",
|
||||
"texte": "Regarde cette inscription ancienne sur la pierre, tu arrives à la lire ?"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"numero": 4,
|
||||
"title": "Arrivée à l'abbaye",
|
||||
"GPS": "N 46 13.024 E 5 14.160",
|
||||
"indice": "L'année inscrite au-dessus du portail principal.",
|
||||
"reponse": 1655,
|
||||
"dialogue": [
|
||||
{
|
||||
"personnage": "Claire",
|
||||
"texte": "Voilà l'abbaye ! Admire l'architecture."
|
||||
},
|
||||
{
|
||||
"personnage": "Nathalie",
|
||||
"texte": "C'est ici la dernière étape. Observez bien la date !"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
@ -1,6 +1,7 @@
|
||||
#include "mainwindow.h"
|
||||
#include "ui_mainwindow.h"
|
||||
#include "path.h"
|
||||
#include "step.h"
|
||||
#include "Undo.h"
|
||||
#include <QFileDialog>
|
||||
#include <QMessageBox>
|
||||
@ -84,6 +85,7 @@ void MainWindow::loadPath()
|
||||
|
||||
file.close();
|
||||
Path* p = new Path(&file);
|
||||
QList<Step> steps = p->getStep();
|
||||
currentPath = p;
|
||||
path.append(p);
|
||||
|
||||
@ -93,8 +95,24 @@ void MainWindow::loadPath()
|
||||
ui->lengthSpin->setValue(p->getLength());
|
||||
ui->durationSpin->setValue(p->getDuration());
|
||||
ui->imagePath->setText(p->getImage());
|
||||
|
||||
loadImage(p->getImage());
|
||||
|
||||
if(!steps.isEmpty()) {
|
||||
Step firstStep = p->getStep().first();
|
||||
ui->stepTitle->setText(firstStep.getTitle());
|
||||
ui->LatitudeSpin->setValue(firstStep.getLatitude());
|
||||
ui->longitudeSpin->setValue(firstStep.getLongitude());
|
||||
|
||||
for(int i = 0; i < firstStep.getTexte().length(); i++) {
|
||||
QString q = firstStep.getPersonnage().at(i) + ": " + firstStep.getTexte().at(i);
|
||||
ui->dialogEdit->appendPlainText(q);
|
||||
}
|
||||
}
|
||||
|
||||
int pathCount = path.length();
|
||||
ui->pathNumber->setMaximum(pathCount);
|
||||
ui->pathNumber->setSuffix("/" + QString::number(pathCount));
|
||||
ui->pathNumber->setValue(path.indexOf(currentPath)+1);
|
||||
}
|
||||
|
||||
void MainWindow::addNewPath()
|
||||
|
||||
153
mainwindow.ui
153
mainwindow.ui
@ -7,9 +7,21 @@
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>800</width>
|
||||
<height>626</height>
|
||||
<height>598</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>MainWindow</string>
|
||||
</property>
|
||||
@ -57,7 +69,7 @@
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Shadow::Raised</enum>
|
||||
</property>
|
||||
<widget class="QSpinBox" name="spinBox">
|
||||
<widget class="QSpinBox" name="pathNumber">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
@ -285,13 +297,148 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QFrame" name="frame_2">
|
||||
<widget class="QFrame" name="stepInformationFrame">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::Shape::StyledPanel</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Shadow::Raised</enum>
|
||||
</property>
|
||||
<widget class="QWidget" name="steptitleFrame" native="true">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>10</y>
|
||||
<width>781</width>
|
||||
<height>45</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_7">
|
||||
<item>
|
||||
<widget class="QSpinBox" name="stepNumber">
|
||||
<property name="minimum">
|
||||
<number>1</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="stepTitle"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="addStep">
|
||||
<property name="text">
|
||||
<string>...</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="data.qrc">
|
||||
<normaloff>:/data/images/data/images/add.png</normaloff>:/data/images/data/images/add.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="stepCoordinatesFrame" native="true">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>60</y>
|
||||
<width>781</width>
|
||||
<height>63</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_11">
|
||||
<item>
|
||||
<widget class="QWidget" name="latFrame" native="true">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_8">
|
||||
<item>
|
||||
<widget class="QLabel" name="latLbl">
|
||||
<property name="text">
|
||||
<string>Latitude</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignmentFlag::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QDoubleSpinBox" name="LatitudeSpin">
|
||||
<property name="decimals">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<double>90.000000000000000</double>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QWidget" name="longFrame" native="true">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_9">
|
||||
<item>
|
||||
<widget class="QLabel" name="longLbl">
|
||||
<property name="text">
|
||||
<string>Longitude</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignmentFlag::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QDoubleSpinBox" name="longitudeSpin">
|
||||
<property name="decimals">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<double>-180.000000000000000</double>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<double>180.000000000000000</double>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QWidget" name="responseFrame" native="true">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_10">
|
||||
<item>
|
||||
<widget class="QLabel" name="responseLbl">
|
||||
<property name="text">
|
||||
<string>Response</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignmentFlag::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QSpinBox" name="responseSpin"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QPlainTextEdit" name="dialogEdit">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>130</y>
|
||||
<width>761</width>
|
||||
<height>81</height>
|
||||
</rect>
|
||||
</property>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
|
||||
2
path.cpp
2
path.cpp
@ -75,7 +75,7 @@ Path::Path(QFile *file){
|
||||
QJsonArray stepsArray = json["steps"].toArray();
|
||||
for (const QJsonValue &stepValue : stepsArray) {
|
||||
QJsonObject stepObj = stepValue.toObject();
|
||||
//step.append(Step(stepObj));
|
||||
step.append(Step(stepObj));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
12
step.cpp
12
step.cpp
@ -34,6 +34,16 @@ Step::Step() {
|
||||
}
|
||||
|
||||
|
||||
QList<QString> Step::getPersonnage() const
|
||||
{
|
||||
return personnage;
|
||||
}
|
||||
|
||||
QList<QString> Step::getTexte() const
|
||||
{
|
||||
return texte;
|
||||
}
|
||||
|
||||
Step::Step( QJsonObject &in)
|
||||
{
|
||||
title = in["title"].toString();
|
||||
@ -41,7 +51,7 @@ Step::Step( QJsonObject &in)
|
||||
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é
|
||||
QChar latDir = parts[0][0];
|
||||
int latDeg = parts[1].toInt();
|
||||
float latMin = parts[2].toFloat();
|
||||
setLatitude(latDeg, latMin, latDir);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user