Merge branch 'feature/web' into 'dev'
Feature/web See merge request p2406187/sae201!18
This commit is contained in:
commit
d14bd80a23
3
data.qrc
3
data.qrc
@ -20,4 +20,7 @@
|
|||||||
<file>data/images/underline.png</file>
|
<file>data/images/underline.png</file>
|
||||||
<file>data/images/add.png</file>
|
<file>data/images/add.png</file>
|
||||||
</qresource>
|
</qresource>
|
||||||
|
<qresource prefix="/data/filejson">
|
||||||
|
<file>data/parcours1.json</file>
|
||||||
|
</qresource>
|
||||||
</RCC>
|
</RCC>
|
||||||
|
|||||||
100
data/parcours.html
Normal file
100
data/parcours.html
Normal file
@ -0,0 +1,100 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="fr">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<title>Carte du parcours</title>
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<link rel="stylesheet" href="https://unpkg.com/leaflet@1.9.4/dist/leaflet.css" />
|
||||||
|
<style>
|
||||||
|
body {
|
||||||
|
font-family: Arial, sans-serif;
|
||||||
|
margin: 20px;
|
||||||
|
background-color: whitesmoke ;
|
||||||
|
}
|
||||||
|
#container {
|
||||||
|
display: flex;
|
||||||
|
gap: 20px;
|
||||||
|
}
|
||||||
|
#map {
|
||||||
|
height: 600px;
|
||||||
|
width: 60%;
|
||||||
|
border-radius: 5%;
|
||||||
|
border: 1px solid #aaa;
|
||||||
|
}
|
||||||
|
#fiche {
|
||||||
|
width: 40%;
|
||||||
|
max-height: 600px;
|
||||||
|
overflow-y: auto;
|
||||||
|
border: 1px solid #aaa;
|
||||||
|
padding: 10px;
|
||||||
|
box-sizing: border-box;
|
||||||
|
background-color:#095228;
|
||||||
|
border-radius: 5%;
|
||||||
|
}
|
||||||
|
body h1 {
|
||||||
|
display:flex;
|
||||||
|
align-items:center;
|
||||||
|
justify-content:center;
|
||||||
|
text-align: center;
|
||||||
|
color: blue;
|
||||||
|
font-style: bold;
|
||||||
|
margin-bottom: 20px;
|
||||||
|
background-color:#70726e;
|
||||||
|
border-radius:12px;
|
||||||
|
height: 75px;
|
||||||
|
}
|
||||||
|
#fiche h2{
|
||||||
|
color:white;
|
||||||
|
}
|
||||||
|
#fiche p{
|
||||||
|
color:white;
|
||||||
|
}
|
||||||
|
#fiche img {
|
||||||
|
max-width: 100%;
|
||||||
|
height: auto;
|
||||||
|
margin-top: 10px;
|
||||||
|
border-radius: 5px;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<h1>Fiche du parcours</h1>
|
||||||
|
<div id="container">
|
||||||
|
<div id="map"></div>
|
||||||
|
<div id="fiche">
|
||||||
|
<h2>parcous1</h2>
|
||||||
|
<p><strong>Ville :</strong> Bourg en bresse</p>
|
||||||
|
<p><strong>Département :</strong> 1</p>
|
||||||
|
<p><strong>Difficulté :</strong> 2</p>
|
||||||
|
<p><strong>Durée (heures) :</strong> 2.3</p>
|
||||||
|
<p><strong>Longueur (km) :</strong> 17.3</p>
|
||||||
|
<img src="data/parcours1.png">
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<script src="https://unpkg.com/leaflet@1.9.4/dist/leaflet.js"></script>
|
||||||
|
<script>
|
||||||
|
var map = L.map('map').setView([45.5, 1.5], 10); // Vue centrée
|
||||||
|
|
||||||
|
L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
|
||||||
|
attribution: '© OpenStreetMap contributors'
|
||||||
|
}).addTo(map);
|
||||||
|
L.marker([45.62, -1.03348]).addTo(map).bindPopup("<b>Étape 1</b><br><b>Personnages :</b><ul><li>Quentin</li><li>Malo</li></ul><b>Textes :</b><ul><li>ligne de dialogue 1</li><li>ligne de dialogue 2</li></ul>");
|
||||||
|
L.marker([-45.62, 1.03348]).addTo(map).bindPopup("<b>Étape 2</b><br><b>Personnages :</b><ul><li>Antoine</li><li>Giovanni</li></ul><b>Textes :</b><ul><li>ligne de dialogue 1</li><li>ligne de dialogue 2</li></ul>");
|
||||||
|
var latlngs = [
|
||||||
|
[45.62, -1.03348],
|
||||||
|
[-45.62, 1.03348],
|
||||||
|
];
|
||||||
|
|
||||||
|
var polyline = L.polyline(latlngs, {
|
||||||
|
color: 'purple',
|
||||||
|
weight: 2,
|
||||||
|
dashArray: '10, 10',
|
||||||
|
opacity: 0.7
|
||||||
|
}).addTo(map);
|
||||||
|
map.fitBounds(polyline.getBounds());
|
||||||
|
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
@ -5,7 +5,7 @@
|
|||||||
"difficulty": 2,
|
"difficulty": 2,
|
||||||
"duration": 2.3,
|
"duration": 2.3,
|
||||||
"length": 17.3,
|
"length": 17.3,
|
||||||
"image": "data/parcours1.png",
|
"image": "../data/parcours1.png",
|
||||||
"steps": [
|
"steps": [
|
||||||
{
|
{
|
||||||
"numero": 1,
|
"numero": 1,
|
||||||
|
|||||||
53
index.html
Normal file
53
index.html
Normal file
@ -0,0 +1,53 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="fr">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8" />
|
||||||
|
<title>Liste des parcours</title>
|
||||||
|
<style>
|
||||||
|
body {
|
||||||
|
font-family: Arial;
|
||||||
|
margin: 40px;
|
||||||
|
background-color: whitesmoke;
|
||||||
|
|
||||||
|
}
|
||||||
|
h1 {
|
||||||
|
text-align: center;
|
||||||
|
color: black;
|
||||||
|
font-style: bold;
|
||||||
|
}
|
||||||
|
ul {
|
||||||
|
max-width: 600px;
|
||||||
|
margin: 0 auto;
|
||||||
|
padding: 0;
|
||||||
|
list-style-type: none;
|
||||||
|
}
|
||||||
|
li {
|
||||||
|
background: white;
|
||||||
|
margin: 10px 0;
|
||||||
|
padding: 15px;
|
||||||
|
border-radius: 8px;
|
||||||
|
box-shadow: 0 0 6px rgba(0,0,0,0.1);
|
||||||
|
transition: background-color 0.3s ease;
|
||||||
|
}
|
||||||
|
li:hover {
|
||||||
|
background-color:black;
|
||||||
|
}
|
||||||
|
a {
|
||||||
|
text-decoration: none;
|
||||||
|
color: purple;
|
||||||
|
font-weight: bold;
|
||||||
|
font-size: 1.2em;
|
||||||
|
}
|
||||||
|
a:hover {
|
||||||
|
text-decoration: underline;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<h1>Liste des parcours</h1>
|
||||||
|
<ul>
|
||||||
|
<li><a href="./pages/parcours1.html">parcous1</a></li>
|
||||||
|
<li><a href="./pages/parcours2.html">parcours2</a></li>
|
||||||
|
</ul>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
8
main.cpp
8
main.cpp
@ -1,17 +1,17 @@
|
|||||||
#include "mainwindow.h"
|
#include "mainwindow.h"
|
||||||
|
|
||||||
#include "path.h"
|
#include "path.h"
|
||||||
|
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
#include <step.h>
|
#include <step.h>
|
||||||
#include <QFile>
|
#include <QFile>
|
||||||
|
#include <web.h>
|
||||||
using namespace std;
|
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.loadAndExportPaths();
|
||||||
|
Web u(w.getPath());
|
||||||
|
u.siteHtml();
|
||||||
|
|
||||||
return a.exec();
|
return a.exec();
|
||||||
}
|
}
|
||||||
|
|||||||
252
mainwindow.cpp
252
mainwindow.cpp
@ -5,15 +5,15 @@
|
|||||||
#include "Undo.h"
|
#include "Undo.h"
|
||||||
#include <QFileDialog>
|
#include <QFileDialog>
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
|
#include <fstream>
|
||||||
#include <QLineEdit>
|
#include <QLineEdit>
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
|
|
||||||
|
|
||||||
#include <QFile>
|
#include <QFile>
|
||||||
#include <QJsonDocument>
|
#include <QJsonDocument>
|
||||||
#include <QJsonObject>
|
#include <QJsonObject>
|
||||||
#include <QJsonArray>
|
#include <QJsonArray>
|
||||||
|
|
||||||
|
int MainWindow::indexPath = 0;
|
||||||
|
|
||||||
MainWindow::MainWindow(QWidget *parent)
|
MainWindow::MainWindow(QWidget *parent)
|
||||||
: QMainWindow(parent)
|
: QMainWindow(parent)
|
||||||
@ -22,6 +22,7 @@ MainWindow::MainWindow(QWidget *parent)
|
|||||||
, Clipboard(QGuiApplication::clipboard())
|
, Clipboard(QGuiApplication::clipboard())
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
|
indexPath++;
|
||||||
//currentPath = new Path();
|
//currentPath = new Path();
|
||||||
|
|
||||||
connect(ui->titleEdit, &QLineEdit::editingFinished, this, [this]() {
|
connect(ui->titleEdit, &QLineEdit::editingFinished, this, [this]() {
|
||||||
@ -64,16 +65,11 @@ MainWindow::~MainWindow()
|
|||||||
delete p;
|
delete p;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::updatePathView()
|
void MainWindow::updatePathView()
|
||||||
{
|
{}
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
void MainWindow::updateStepView(size_t num)
|
void MainWindow::updateStepView(size_t num)
|
||||||
{
|
{}
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
void MainWindow::onTextChanged()
|
void MainWindow::onTextChanged()
|
||||||
{
|
{
|
||||||
@ -151,19 +147,209 @@ void MainWindow::loadStep(Step s) {
|
|||||||
|
|
||||||
void MainWindow::addNewPath()
|
void MainWindow::addNewPath()
|
||||||
{
|
{
|
||||||
|
path.append(currentPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::addNewStep()
|
void MainWindow::addNewStep()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
void MainWindow::exportHTMLMap(int index)
|
||||||
void MainWindow::exportHTMLMap()
|
|
||||||
{
|
{
|
||||||
|
std::ofstream file("./pages/parcours" + std::to_string(index) + ".html");
|
||||||
|
|
||||||
|
if (!file.is_open()) {
|
||||||
|
QMessageBox::warning(this, "Erreur", "Impossible d'ouvrir le fichier.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
file << R"(<!DOCTYPE html>
|
||||||
|
<html lang="fr">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<title>Carte du parcours</title>
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<link rel="stylesheet" href="https://unpkg.com/leaflet@1.9.4/dist/leaflet.css" />
|
||||||
|
<style>
|
||||||
|
body {
|
||||||
|
font-family: Arial, sans-serif;
|
||||||
|
margin: 20px;
|
||||||
|
background-color: whitesmoke;
|
||||||
|
}
|
||||||
|
#container {
|
||||||
|
display: flex;
|
||||||
|
gap: 20px;
|
||||||
|
}
|
||||||
|
#map {
|
||||||
|
height: 600px;
|
||||||
|
width: 60%;
|
||||||
|
border-radius: 5%;
|
||||||
|
border: 1px solid #aaa;
|
||||||
|
}
|
||||||
|
#fiche {
|
||||||
|
padding-right:20px;
|
||||||
|
width: 40%;
|
||||||
|
max-height: 600px;
|
||||||
|
overflow-y: auto;
|
||||||
|
border: 1px solid #aaa;
|
||||||
|
padding: 10px;
|
||||||
|
box-sizing: border-box;
|
||||||
|
background-color:#095228;
|
||||||
|
border-radius: 5%;
|
||||||
|
}
|
||||||
|
#fiche ul {
|
||||||
|
padding-left: 20px;
|
||||||
|
list-style-type: disc;
|
||||||
|
overflow-wrap: break-word;
|
||||||
|
word-wrap: break-word;
|
||||||
|
word-break: break-word;
|
||||||
|
white-space: normal;
|
||||||
|
max-width: 90%;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#fiche li {
|
||||||
|
white-space: normal;
|
||||||
|
overflow-wrap: break-word;
|
||||||
|
}
|
||||||
|
body h1 {
|
||||||
|
display:flex;
|
||||||
|
align-items:center;
|
||||||
|
justify-content:center;
|
||||||
|
text-align: center;
|
||||||
|
color: black;
|
||||||
|
font-style: bold;
|
||||||
|
margin-bottom: 20px;
|
||||||
|
background-color:brown;
|
||||||
|
border-radius:12px;
|
||||||
|
height: 75px;
|
||||||
|
}
|
||||||
|
#fiche h2, #fiche h3, #fiche p, #fiche li {
|
||||||
|
color: white;
|
||||||
|
}
|
||||||
|
#fiche img {
|
||||||
|
max-width: 100%;
|
||||||
|
height: auto;
|
||||||
|
margin-top: 10px;
|
||||||
|
border-radius: 5px;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<h1>Fiche du parcours</h1>
|
||||||
|
<div id="container">
|
||||||
|
<div id="map"></div>
|
||||||
|
<div id="fiche">
|
||||||
|
)";
|
||||||
|
|
||||||
|
if (currentPath) {
|
||||||
|
Path* p = currentPath;
|
||||||
|
file << "<h2>" << p->getName().toStdString() << "</h2>\n";
|
||||||
|
file << "<p><strong>Ville :</strong> " << p->getCity().toStdString() << "</p>\n";
|
||||||
|
file << "<p><strong>Département :</strong> " << p->getDepartement() << "</p>\n";
|
||||||
|
file << "<p><strong>Difficulté :</strong> " << p->getDifficulty() << "</p>\n";
|
||||||
|
file << "<p><strong>Durée (heures) :</strong> " << p->getDuration() << "</p>\n";
|
||||||
|
file << "<p><strong>Longueur (km) :</strong> " << p->getLength() << "</p>\n";
|
||||||
|
if (!p->getImage().isEmpty()) {
|
||||||
|
file << "<img src=\"" << p->getImage().toStdString() << "\">\n";
|
||||||
|
}
|
||||||
|
int stepNum = 1;
|
||||||
|
for (const Step& s : p->getStep()) {
|
||||||
|
file << "<h3>Étape " << stepNum << "</h3>\n";
|
||||||
|
const QList<QString> persos = s.getPersonnage();
|
||||||
|
const QList<QString> textes = s.getTexte();
|
||||||
|
|
||||||
|
if (!persos.isEmpty()) {
|
||||||
|
file << "<p><strong>Personnages :</strong></p>\n<ul>";
|
||||||
|
for (const QString& pers : persos) {
|
||||||
|
file << "<li>" << pers.toStdString() << "</li>\n";
|
||||||
|
}
|
||||||
|
file << "</ul>\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!textes.isEmpty()) {
|
||||||
|
file << "<p><strong>Dialogues :</strong></p>\n<ul>";
|
||||||
|
for (const QString& txt : textes) {
|
||||||
|
file << "<li>" << txt.toStdString() << "</li>\n";
|
||||||
|
}
|
||||||
|
file << "</ul>\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
stepNum++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
file << R"(
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<script src="https://unpkg.com/leaflet@1.9.4/dist/leaflet.js"></script>
|
||||||
|
<script>
|
||||||
|
var map = L.map('map').setView([45.5, 1.5], 10); // Vue centrée
|
||||||
|
|
||||||
|
L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
|
||||||
|
attribution: '© OpenStreetMap contributors'
|
||||||
|
}).addTo(map);
|
||||||
|
)";
|
||||||
|
|
||||||
|
if (!path.isEmpty() && path[0]) {
|
||||||
|
Path* p = path[0];
|
||||||
|
int stepNum = 1;
|
||||||
|
|
||||||
|
for (const Step& s : p->getStep()) {
|
||||||
|
float lat = s.getLatitude();
|
||||||
|
float lon = s.getLongitude();
|
||||||
|
QList<QString> personnages = s.getPersonnage();
|
||||||
|
QList<QString> textes = s.getTexte();
|
||||||
|
QString popupHtml = "<b>Étape " + QString::number(stepNum) + "</b><br>";
|
||||||
|
if (!personnages.isEmpty()) {
|
||||||
|
popupHtml += "<b>Personnages :</b><ul>";
|
||||||
|
for (const QString& pers : personnages) {
|
||||||
|
popupHtml += "<li>" + pers + "</li>";
|
||||||
|
}
|
||||||
|
popupHtml += "</ul>";
|
||||||
|
}
|
||||||
|
if (!textes.isEmpty()) {
|
||||||
|
popupHtml += "<b>Textes :</b><ul>";
|
||||||
|
for (const QString& txt : textes) {
|
||||||
|
popupHtml += "<li>" + txt + "</li>";
|
||||||
|
}
|
||||||
|
popupHtml += "</ul>";
|
||||||
|
}
|
||||||
|
|
||||||
|
file << "L.marker([" << lat << ", " << lon << "]).addTo(map)"
|
||||||
|
<< ".bindPopup(\"" << popupHtml.toStdString() << "\");\n";
|
||||||
|
|
||||||
|
++stepNum;
|
||||||
|
}
|
||||||
|
|
||||||
|
file << "var latlngs = [\n";
|
||||||
|
for (const Step& s : p->getStep()) {
|
||||||
|
float lat = s.getLatitude();
|
||||||
|
float lon = s.getLongitude();
|
||||||
|
file << " [" << lat << ", " << lon << "],\n";
|
||||||
|
}
|
||||||
|
file << "];\n";
|
||||||
|
|
||||||
|
file << R"(
|
||||||
|
var polyline = L.polyline(latlngs, {
|
||||||
|
color: 'purple',
|
||||||
|
weight: 2,
|
||||||
|
dashArray: '10, 10',
|
||||||
|
opacity: 0.7
|
||||||
|
}).addTo(map);
|
||||||
|
map.fitBounds(polyline.getBounds());
|
||||||
|
)";
|
||||||
|
}
|
||||||
|
|
||||||
|
file << R"(
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
)";
|
||||||
|
file.close();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void MainWindow::loadImage(QString fileName) {
|
void MainWindow::loadImage(QString fileName) {
|
||||||
QString ext[] = {"png", "jpeg", "jpg"};
|
QString ext[] = {"png", "jpeg", "jpg"};
|
||||||
|
|
||||||
@ -217,6 +403,46 @@ void MainWindow::on_toolButton_clicked()
|
|||||||
loadImage(fileName);
|
loadImage(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
<<<<<<< mainwindow.cpp
|
||||||
|
int MainWindow::getIndexPath() const
|
||||||
|
{
|
||||||
|
return indexPath;
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainWindow::setIndexPath(int newIndexPath)
|
||||||
|
{
|
||||||
|
indexPath = newIndexPath;
|
||||||
|
}
|
||||||
|
|
||||||
|
QString MainWindow::getCurrentFile() const
|
||||||
|
{
|
||||||
|
return currentFile;
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainWindow::setCurrentFile(const QString &newCurrentFile)
|
||||||
|
{
|
||||||
|
currentFile = newCurrentFile;
|
||||||
|
}
|
||||||
|
|
||||||
|
QList<Path *> MainWindow::getPath() const
|
||||||
|
{
|
||||||
|
return path;
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainWindow::setPath(const QList<Path *> &newPath)
|
||||||
|
{
|
||||||
|
path = newPath;
|
||||||
|
}
|
||||||
|
|
||||||
|
Path *MainWindow::getCurrentPath() const
|
||||||
|
{
|
||||||
|
return currentPath;
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainWindow::setCurrentPath(Path *newCurrentPath)
|
||||||
|
{
|
||||||
|
currentPath = newCurrentPath;
|
||||||
|
=======
|
||||||
|
|
||||||
void MainWindow::saveFile(){
|
void MainWindow::saveFile(){
|
||||||
QString fileName;
|
QString fileName;
|
||||||
|
|||||||
12
mainwindow.h
12
mainwindow.h
@ -27,6 +27,17 @@ public:
|
|||||||
void loadStep(Step s);
|
void loadStep(Step s);
|
||||||
void addNewPath();
|
void addNewPath();
|
||||||
void addNewStep();
|
void addNewStep();
|
||||||
|
void exportHTMLMap(int index);
|
||||||
|
void loadAndExportPaths();
|
||||||
|
QString getCurrentFile() const;
|
||||||
|
void setCurrentFile(const QString &newCurrentFile);
|
||||||
|
QList<Path *> getPath() const;
|
||||||
|
void setPath(const QList<Path *> &newPath);
|
||||||
|
Path *getCurrentPath() const;
|
||||||
|
void setCurrentPath(Path *newCurrentPath);
|
||||||
|
|
||||||
|
int getIndexPath() const;
|
||||||
|
void setIndexPath(int newIndexPath);
|
||||||
void exportHTMLMap();
|
void exportHTMLMap();
|
||||||
void saveFile();
|
void saveFile();
|
||||||
|
|
||||||
@ -56,6 +67,7 @@ private slots:
|
|||||||
private:
|
private:
|
||||||
Ui::MainWindow *ui;
|
Ui::MainWindow *ui;
|
||||||
QString currentFile;
|
QString currentFile;
|
||||||
|
static int indexPath;
|
||||||
bool textChanged;
|
bool textChanged;
|
||||||
QList<Path*> path;
|
QList<Path*> path;
|
||||||
Path* currentPath;
|
Path* currentPath;
|
||||||
|
|||||||
130
pages/parcours1.html
Normal file
130
pages/parcours1.html
Normal file
@ -0,0 +1,130 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="fr">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<title>Carte du parcours</title>
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<link rel="stylesheet" href="https://unpkg.com/leaflet@1.9.4/dist/leaflet.css" />
|
||||||
|
<style>
|
||||||
|
body {
|
||||||
|
font-family: Arial, sans-serif;
|
||||||
|
margin: 20px;
|
||||||
|
background-color: whitesmoke;
|
||||||
|
}
|
||||||
|
#container {
|
||||||
|
display: flex;
|
||||||
|
gap: 20px;
|
||||||
|
}
|
||||||
|
#map {
|
||||||
|
height: 600px;
|
||||||
|
width: 60%;
|
||||||
|
border-radius: 5%;
|
||||||
|
border: 1px solid #aaa;
|
||||||
|
}
|
||||||
|
#fiche {
|
||||||
|
padding-right:20px;
|
||||||
|
width: 40%;
|
||||||
|
max-height: 600px;
|
||||||
|
overflow-y: auto;
|
||||||
|
border: 1px solid #aaa;
|
||||||
|
padding: 10px;
|
||||||
|
box-sizing: border-box;
|
||||||
|
background-color:#095228;
|
||||||
|
border-radius: 5%;
|
||||||
|
}
|
||||||
|
#fiche ul {
|
||||||
|
padding-left: 20px;
|
||||||
|
list-style-type: disc;
|
||||||
|
overflow-wrap: break-word;
|
||||||
|
word-wrap: break-word;
|
||||||
|
word-break: break-word;
|
||||||
|
white-space: normal;
|
||||||
|
max-width: 90%;
|
||||||
|
}
|
||||||
|
|
||||||
|
#fiche li {
|
||||||
|
white-space: normal;
|
||||||
|
overflow-wrap: break-word;
|
||||||
|
}
|
||||||
|
body h1 {
|
||||||
|
display:flex;
|
||||||
|
align-items:center;
|
||||||
|
justify-content:center;
|
||||||
|
text-align: center;
|
||||||
|
color: black;
|
||||||
|
font-style: bold;
|
||||||
|
margin-bottom: 20px;
|
||||||
|
background-color:brown;
|
||||||
|
border-radius:12px;
|
||||||
|
height: 75px;
|
||||||
|
}
|
||||||
|
#fiche h2, #fiche h3, #fiche p, #fiche li {
|
||||||
|
color: white;
|
||||||
|
}
|
||||||
|
#fiche img {
|
||||||
|
max-width: 100%;
|
||||||
|
height: auto;
|
||||||
|
margin-top: 10px;
|
||||||
|
border-radius: 5px;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<h1>Fiche du parcours</h1>
|
||||||
|
<div id="container">
|
||||||
|
<div id="map"></div>
|
||||||
|
<div id="fiche">
|
||||||
|
<h2>parcous1</h2>
|
||||||
|
<p><strong>Ville :</strong> Bourg en bresse</p>
|
||||||
|
<p><strong>Département :</strong> 1</p>
|
||||||
|
<p><strong>Difficulté :</strong> 2</p>
|
||||||
|
<p><strong>Durée (heures) :</strong> 2.3</p>
|
||||||
|
<p><strong>Longueur (km) :</strong> 17.3</p>
|
||||||
|
<img src="../data/parcours1.png">
|
||||||
|
<h3>Étape 1</h3>
|
||||||
|
<p><strong>Personnages :</strong></p>
|
||||||
|
<ul><li>Quentin</li>
|
||||||
|
<li>Malo</li>
|
||||||
|
</ul>
|
||||||
|
<p><strong>Dialogues :</strong></p>
|
||||||
|
<ul><li>ligne de dialogue 1</li>
|
||||||
|
<li>ligne de dialogue 2</li>
|
||||||
|
</ul>
|
||||||
|
<h3>Étape 2</h3>
|
||||||
|
<p><strong>Personnages :</strong></p>
|
||||||
|
<ul><li>Antoine</li>
|
||||||
|
<li>Giovanni</li>
|
||||||
|
</ul>
|
||||||
|
<p><strong>Dialogues :</strong></p>
|
||||||
|
<ul><li>ligne de dialogue 1</li>
|
||||||
|
<li>ligne de dialogue 2</li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<script src="https://unpkg.com/leaflet@1.9.4/dist/leaflet.js"></script>
|
||||||
|
<script>
|
||||||
|
var map = L.map('map').setView([45.5, 1.5], 10); // Vue centrée
|
||||||
|
|
||||||
|
L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
|
||||||
|
attribution: '© OpenStreetMap contributors'
|
||||||
|
}).addTo(map);
|
||||||
|
L.marker([45.62, -1.03348]).addTo(map).bindPopup("<b>Étape 1</b><br><b>Personnages :</b><ul><li>Quentin</li><li>Malo</li></ul><b>Textes :</b><ul><li>ligne de dialogue 1</li><li>ligne de dialogue 2</li></ul>");
|
||||||
|
L.marker([-45.62, 1.03348]).addTo(map).bindPopup("<b>Étape 2</b><br><b>Personnages :</b><ul><li>Antoine</li><li>Giovanni</li></ul><b>Textes :</b><ul><li>ligne de dialogue 1</li><li>ligne de dialogue 2</li></ul>");
|
||||||
|
var latlngs = [
|
||||||
|
[45.62, -1.03348],
|
||||||
|
[-45.62, 1.03348],
|
||||||
|
];
|
||||||
|
|
||||||
|
var polyline = L.polyline(latlngs, {
|
||||||
|
color: 'purple',
|
||||||
|
weight: 2,
|
||||||
|
dashArray: '10, 10',
|
||||||
|
opacity: 0.7
|
||||||
|
}).addTo(map);
|
||||||
|
map.fitBounds(polyline.getBounds());
|
||||||
|
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
130
pages/parcours2.html
Normal file
130
pages/parcours2.html
Normal file
@ -0,0 +1,130 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="fr">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<title>Carte du parcours</title>
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<link rel="stylesheet" href="https://unpkg.com/leaflet@1.9.4/dist/leaflet.css" />
|
||||||
|
<style>
|
||||||
|
body {
|
||||||
|
font-family: Arial, sans-serif;
|
||||||
|
margin: 20px;
|
||||||
|
background-color: whitesmoke;
|
||||||
|
}
|
||||||
|
#container {
|
||||||
|
display: flex;
|
||||||
|
gap: 20px;
|
||||||
|
}
|
||||||
|
#map {
|
||||||
|
height: 600px;
|
||||||
|
width: 60%;
|
||||||
|
border-radius: 5%;
|
||||||
|
border: 1px solid #aaa;
|
||||||
|
}
|
||||||
|
#fiche {
|
||||||
|
padding-right:20px;
|
||||||
|
width: 40%;
|
||||||
|
max-height: 600px;
|
||||||
|
overflow-y: auto;
|
||||||
|
border: 1px solid #aaa;
|
||||||
|
padding: 10px;
|
||||||
|
box-sizing: border-box;
|
||||||
|
background-color:#095228;
|
||||||
|
border-radius: 5%;
|
||||||
|
}
|
||||||
|
#fiche ul {
|
||||||
|
padding-left: 20px;
|
||||||
|
list-style-type: disc;
|
||||||
|
overflow-wrap: break-word;
|
||||||
|
word-wrap: break-word;
|
||||||
|
word-break: break-word;
|
||||||
|
white-space: normal;
|
||||||
|
max-width: 90%;
|
||||||
|
}
|
||||||
|
|
||||||
|
#fiche li {
|
||||||
|
white-space: normal;
|
||||||
|
overflow-wrap: break-word;
|
||||||
|
}
|
||||||
|
body h1 {
|
||||||
|
display:flex;
|
||||||
|
align-items:center;
|
||||||
|
justify-content:center;
|
||||||
|
text-align: center;
|
||||||
|
color: black;
|
||||||
|
font-style: bold;
|
||||||
|
margin-bottom: 20px;
|
||||||
|
background-color:brown;
|
||||||
|
border-radius:12px;
|
||||||
|
height: 75px;
|
||||||
|
}
|
||||||
|
#fiche h2, #fiche h3, #fiche p, #fiche li {
|
||||||
|
color: white;
|
||||||
|
}
|
||||||
|
#fiche img {
|
||||||
|
max-width: 100%;
|
||||||
|
height: auto;
|
||||||
|
margin-top: 10px;
|
||||||
|
border-radius: 5px;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<h1>Fiche du parcours</h1>
|
||||||
|
<div id="container">
|
||||||
|
<div id="map"></div>
|
||||||
|
<div id="fiche">
|
||||||
|
<h2>parcours2</h2>
|
||||||
|
<p><strong>Ville :</strong> Paris</p>
|
||||||
|
<p><strong>Département :</strong> 1</p>
|
||||||
|
<p><strong>Difficulté :</strong> 2</p>
|
||||||
|
<p><strong>Durée (heures) :</strong> 2.3</p>
|
||||||
|
<p><strong>Longueur (km) :</strong> 17.3</p>
|
||||||
|
<img src="../data/parcours1.png">
|
||||||
|
<h3>Étape 1</h3>
|
||||||
|
<p><strong>Personnages :</strong></p>
|
||||||
|
<ul><li>Quentin</li>
|
||||||
|
<li>Malo</li>
|
||||||
|
</ul>
|
||||||
|
<p><strong>Dialogues :</strong></p>
|
||||||
|
<ul><li>ligne de dialogue 1 HJDDDZJJJJJJJJJJJJJJJJJJJDBJBDJZBZJDBJ</li>
|
||||||
|
<li>ligne de dialogue 2BDJJHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHBDHDBHBZHVZDHVHVHEDHJVHVDHEDJD</li>
|
||||||
|
</ul>
|
||||||
|
<h3>Étape 2</h3>
|
||||||
|
<p><strong>Personnages :</strong></p>
|
||||||
|
<ul><li>Antoine</li>
|
||||||
|
<li>Giovanni</li>
|
||||||
|
</ul>
|
||||||
|
<p><strong>Dialogues :</strong></p>
|
||||||
|
<ul><li>ligne de dialogue 1</li>
|
||||||
|
<li>ligne de dialogue 2</li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<script src="https://unpkg.com/leaflet@1.9.4/dist/leaflet.js"></script>
|
||||||
|
<script>
|
||||||
|
var map = L.map('map').setView([45.5, 1.5], 10); // Vue centrée
|
||||||
|
|
||||||
|
L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
|
||||||
|
attribution: '© OpenStreetMap contributors'
|
||||||
|
}).addTo(map);
|
||||||
|
L.marker([45.62, -1.03348]).addTo(map).bindPopup("<b>Étape 1</b><br><b>Personnages :</b><ul><li>Quentin</li><li>Malo</li></ul><b>Textes :</b><ul><li>ligne de dialogue 1</li><li>ligne de dialogue 2</li></ul>");
|
||||||
|
L.marker([-45.62, 1.03348]).addTo(map).bindPopup("<b>Étape 2</b><br><b>Personnages :</b><ul><li>Antoine</li><li>Giovanni</li></ul><b>Textes :</b><ul><li>ligne de dialogue 1</li><li>ligne de dialogue 2</li></ul>");
|
||||||
|
var latlngs = [
|
||||||
|
[45.62, -1.03348],
|
||||||
|
[-45.62, 1.03348],
|
||||||
|
];
|
||||||
|
|
||||||
|
var polyline = L.polyline(latlngs, {
|
||||||
|
color: 'purple',
|
||||||
|
weight: 2,
|
||||||
|
dashArray: '10, 10',
|
||||||
|
opacity: 0.7
|
||||||
|
}).addTo(map);
|
||||||
|
map.fitBounds(polyline.getBounds());
|
||||||
|
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
@ -13,12 +13,14 @@ SOURCES += \
|
|||||||
mainwindow.cpp \
|
mainwindow.cpp \
|
||||||
step.cpp \
|
step.cpp \
|
||||||
path.cpp \
|
path.cpp \
|
||||||
|
web.cpp
|
||||||
|
|
||||||
HEADERS += \
|
HEADERS += \
|
||||||
Undo.h \
|
Undo.h \
|
||||||
mainwindow.h \
|
mainwindow.h \
|
||||||
step.h \
|
step.h \
|
||||||
path.h \
|
path.h \
|
||||||
|
web.h
|
||||||
|
|
||||||
FORMS += \
|
FORMS += \
|
||||||
mainwindow.ui
|
mainwindow.ui
|
||||||
|
|||||||
20
step.cpp
20
step.cpp
@ -27,6 +27,16 @@ int Step::getResponse() const
|
|||||||
return response;
|
return response;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QList<QString> Step::getPersonnage() const
|
||||||
|
{
|
||||||
|
return personnage;
|
||||||
|
}
|
||||||
|
|
||||||
|
QList<QString> Step::getTexte() const
|
||||||
|
{
|
||||||
|
return texte;
|
||||||
|
}
|
||||||
|
|
||||||
void Step::setTitle(const QString &newTitle)
|
void Step::setTitle(const QString &newTitle)
|
||||||
{
|
{
|
||||||
title = newTitle;
|
title = newTitle;
|
||||||
@ -37,6 +47,16 @@ void Step::setResponse(int newResponse)
|
|||||||
response = newResponse;
|
response = newResponse;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Step::setPersonnage(const QList<QString> &newPersonnage)
|
||||||
|
{
|
||||||
|
personnage = newPersonnage;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Step::setTexte(const QList<QString> &newTexte)
|
||||||
|
{
|
||||||
|
texte = newTexte;
|
||||||
|
}
|
||||||
|
|
||||||
Step::Step() {
|
Step::Step() {
|
||||||
latitude = 0.0;
|
latitude = 0.0;
|
||||||
longitude = 0.0;
|
longitude = 0.0;
|
||||||
|
|||||||
3
step.h
3
step.h
@ -26,11 +26,12 @@ public:
|
|||||||
float getLatitude() const;
|
float getLatitude() const;
|
||||||
float getLongitude() const;
|
float getLongitude() const;
|
||||||
int getResponse() const;
|
int getResponse() const;
|
||||||
QString toGPSFormat();
|
|
||||||
QList<QString> getPersonnage() const;
|
QList<QString> getPersonnage() const;
|
||||||
QList<QString> getTexte() const;
|
QList<QString> getTexte() const;
|
||||||
void setTitle(const QString &newTitle);
|
void setTitle(const QString &newTitle);
|
||||||
void setResponse(int newResponse);
|
void setResponse(int newResponse);
|
||||||
|
void setPersonnage(const QList<QString> &newPersonnage);
|
||||||
|
void setTexte(const QList<QString> &newTexte);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // STEP_H
|
#endif // STEP_H
|
||||||
|
|||||||
85
web.cpp
Normal file
85
web.cpp
Normal file
@ -0,0 +1,85 @@
|
|||||||
|
#include "web.h"
|
||||||
|
#include <fstream>
|
||||||
|
Web::Web()
|
||||||
|
{}
|
||||||
|
|
||||||
|
Web::Web(const QList<Path*>& list) : list(list)
|
||||||
|
{}
|
||||||
|
|
||||||
|
void Web::siteHtml()
|
||||||
|
{
|
||||||
|
std::ofstream file("index.html");
|
||||||
|
if (!file.is_open()) {
|
||||||
|
qWarning("Impossible d'ouvrir le fichier index.html");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
file << R"(<!DOCTYPE html>
|
||||||
|
<html lang="fr">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8" />
|
||||||
|
<title>Liste des parcours</title>
|
||||||
|
<style>
|
||||||
|
body {
|
||||||
|
font-family: Arial;
|
||||||
|
margin: 40px;
|
||||||
|
background-color: whitesmoke;
|
||||||
|
|
||||||
|
}
|
||||||
|
h1 {
|
||||||
|
text-align: center;
|
||||||
|
color: black;
|
||||||
|
font-style: bold;
|
||||||
|
}
|
||||||
|
ul {
|
||||||
|
max-width: 600px;
|
||||||
|
margin: 0 auto;
|
||||||
|
padding: 0;
|
||||||
|
list-style-type: none;
|
||||||
|
}
|
||||||
|
li {
|
||||||
|
background: white;
|
||||||
|
margin: 10px 0;
|
||||||
|
padding: 15px;
|
||||||
|
border-radius: 8px;
|
||||||
|
box-shadow: 0 0 6px rgba(0,0,0,0.1);
|
||||||
|
transition: background-color 0.3s ease;
|
||||||
|
}
|
||||||
|
li:hover {
|
||||||
|
background-color:black;
|
||||||
|
}
|
||||||
|
a {
|
||||||
|
text-decoration: none;
|
||||||
|
color: purple;
|
||||||
|
font-weight: bold;
|
||||||
|
font-size: 1.2em;
|
||||||
|
}
|
||||||
|
a:hover {
|
||||||
|
text-decoration: underline;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<h1>Liste des parcours</h1>
|
||||||
|
<ul>
|
||||||
|
)";
|
||||||
|
|
||||||
|
int index = 1;
|
||||||
|
for (const Path* p : list) {
|
||||||
|
QString fileName = QString("parcours%1.html").arg(index);
|
||||||
|
QString name = p->getName();
|
||||||
|
file << " <li><a href=\"./pages/"
|
||||||
|
<< fileName.toStdString()
|
||||||
|
<< "\">"
|
||||||
|
<< name.toStdString()
|
||||||
|
<< "</a></li>\n";
|
||||||
|
++index;
|
||||||
|
}
|
||||||
|
|
||||||
|
file << R"( </ul>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
)";
|
||||||
|
|
||||||
|
file.close();
|
||||||
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user