review of toolbar and menu bar

This commit is contained in:
Giovanni JOSSERAND 2025-06-20 21:21:46 +02:00
parent 6a4d58660e
commit 75f9928957
7 changed files with 175 additions and 207 deletions

View File

@ -20,7 +20,4 @@
<file>data/images/underline.png</file>
<file>data/images/add.png</file>
</qresource>
<qresource prefix="/data/filejson">
<file>data/parcours1.json</file>
</qresource>
</RCC>

View File

@ -46,6 +46,8 @@
<body>
<h1>Liste des parcours</h1>
<ul>
<li><a href="./pages/parcours0.html">azea</a></li>
<li><a href="./pages/parcours1.html">parcous123</a></li>
</ul>
</body>
</html>

View File

@ -24,7 +24,13 @@ MainWindow::MainWindow(QWidget *parent)
{
ui->setupUi(this);
indexPath++;
currentPath = new Path();
Path* p = new Path();
currentPath = p;
path.append(p);
loadPath(p);
int pathCount = path.length();
ui->pathNumber->setMaximum(pathCount);
ui->pathNumber->setSuffix("/" + QString::number(pathCount));
connect(ui->titleEdit, &QLineEdit::editingFinished, this, [this]() {
@ -505,8 +511,7 @@ void MainWindow::on_actionopenFile_triggered()
this->loadNewPath();
}
void MainWindow::on_actionEditCopy_triggered()
{
void MainWindow::copyText(){
QWidget *focused = QApplication::focusWidget();
QLineEdit* lineEdit = qobject_cast<QLineEdit*>(focused);
@ -515,9 +520,12 @@ void MainWindow::on_actionEditCopy_triggered()
}
}
void MainWindow::on_actionEditPaste_triggered()
void MainWindow::on_actionEditCopy_triggered()
{
this->copyText();
}
void MainWindow::pastText(){
QWidget *focused = QApplication::focusWidget();
QLineEdit* lineEdit = qobject_cast<QLineEdit*>(focused);
@ -528,10 +536,13 @@ void MainWindow::on_actionEditPaste_triggered()
lineEdit->setText(text);
}
}
void MainWindow::on_actionEditCut_triggered()
void MainWindow::on_actionEditPaste_triggered()
{
this->pastText();
}
void MainWindow::cutText(){
QWidget *focused = QApplication::focusWidget();
QLineEdit* lineEdit = qobject_cast<QLineEdit*>(focused);
@ -544,6 +555,10 @@ void MainWindow::on_actionEditCut_triggered()
lineEdit->setText(text);
}
}
void MainWindow::on_actionEditCut_triggered()
{
this->cutText();
}
void MainWindow::on_pathNumber_valueChanged(int arg1)
@ -648,3 +663,55 @@ void MainWindow::on_exportHTMLBtn_clicked()
w.siteHtml();
}
void MainWindow::on_actionSaveFile_triggered()
{
this->saveFile();
}
void MainWindow::on_actionSaveAsFile_triggered()
{
this->saveAsFile();
}
void MainWindow::on_actionCopy_triggered()
{
this->copyText();
}
void MainWindow::on_actionPast_triggered()
{
this->pastText();
}
void MainWindow::on_actionCut_triggered()
{
this->cutText();
}
void MainWindow::newPath(){
Path* p = new Path();
currentPath = p;
path.append(p);
loadPath(p);
int pathCount = path.length();
ui->pathNumber->setMaximum(pathCount);
ui->pathNumber->setSuffix("/" + QString::number(pathCount));
ui->pathNumber->setValue(path.indexOf(currentPath)+1);
}
void MainWindow::on_actionNew_triggered()
{
this->newPath();
}
void MainWindow::on_actionNewFile_triggered()
{
this->newPath();
}

View File

@ -36,11 +36,14 @@ public:
Path *getCurrentPath() const;
void setCurrentPath(Path *newCurrentPath);
void saveAsFile();
void copyText();
void pastText();
void cutText();
int getIndexPath() const;
void setIndexPath(int newIndexPath);
void exportHTMLMap();
void saveFile();
void newPath();
private slots:
void on_pushButton_clicked();
@ -69,6 +72,21 @@ private slots:
void on_exportHTMLBtn_clicked();
void on_actionSaveFile_triggered();
void on_actionSaveAsFile_triggered();
void on_actionCopy_triggered();
void on_actionPast_triggered();
void on_actionCut_triggered();
void on_actionNew_triggered();
void on_actionNewFile_triggered();
private:
Ui::MainWindow *ui;
QString currentFile;

View File

@ -79,7 +79,7 @@
</size>
</property>
<property name="frameShape">
<enum>QFrame::Shape::NoFrame</enum>
<enum>QFrame::NoFrame</enum>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_13">
<item>
@ -333,7 +333,7 @@
</size>
</property>
<property name="frameShape">
<enum>QFrame::Shape::NoFrame</enum>
<enum>QFrame::NoFrame</enum>
</property>
<layout class="QVBoxLayout" name="verticalLayout_3">
<item>
@ -374,9 +374,6 @@
<property name="text">
<string>Latitude</string>
</property>
<property name="alignment">
<set>Qt::AlignmentFlag::AlignCenter</set>
</property>
</widget>
</item>
<item>
@ -400,9 +397,6 @@
<property name="text">
<string>Longitude</string>
</property>
<property name="alignment">
<set>Qt::AlignmentFlag::AlignCenter</set>
</property>
</widget>
</item>
<item>
@ -429,9 +423,6 @@
<property name="text">
<string>Response</string>
</property>
<property name="alignment">
<set>Qt::AlignmentFlag::AlignCenter</set>
</property>
</widget>
</item>
<item>
@ -487,18 +478,30 @@
<x>0</x>
<y>0</y>
<width>800</width>
<height>23</height>
<height>21</height>
</rect>
</property>
<widget class="QMenu" name="menuFile">
<property name="title">
<string>File</string>
</property>
<addaction name="actionNew"/>
<addaction name="actionOpen"/>
<addaction name="actionSave"/>
<addaction name="actionSave_as"/>
</widget>
<widget class="QMenu" name="menuEdit">
<property name="title">
<string>Edit</string>
</property>
<addaction name="actionCopy"/>
<addaction name="actionPast"/>
<addaction name="actionCut"/>
<addaction name="actionUndo"/>
<addaction name="actionRedo"/>
</widget>
<addaction name="menuFile"/>
<addaction name="menuEdit"/>
</widget>
<widget class="QToolBar" name="toolBar">
<property name="windowTitle">
@ -514,7 +517,6 @@
<addaction name="actionopenFile"/>
<addaction name="actionSaveFile"/>
<addaction name="actionSaveAsFile"/>
<addaction name="actionPrintFile"/>
<addaction name="separator"/>
<addaction name="actionEditCopy"/>
<addaction name="actionEditPaste"/>
@ -556,7 +558,7 @@
<string>New File</string>
</property>
<property name="menuRole">
<enum>QAction::MenuRole::NoRole</enum>
<enum>QAction::NoRole</enum>
</property>
</action>
<action name="actionSaveFile">
@ -568,7 +570,7 @@
<string>Save</string>
</property>
<property name="menuRole">
<enum>QAction::MenuRole::NoRole</enum>
<enum>QAction::NoRole</enum>
</property>
</action>
<action name="actionSaveAsFile">
@ -580,19 +582,7 @@
<string>Save as</string>
</property>
<property name="menuRole">
<enum>QAction::MenuRole::NoRole</enum>
</property>
</action>
<action name="actionPrintFile">
<property name="icon">
<iconset resource="data.qrc">
<normaloff>:/data/images/data/images/print.png</normaloff>:/data/images/data/images/print.png</iconset>
</property>
<property name="text">
<string>Print</string>
</property>
<property name="menuRole">
<enum>QAction::MenuRole::NoRole</enum>
<enum>QAction::NoRole</enum>
</property>
</action>
<action name="actionEditCopy">
@ -604,7 +594,7 @@
<string>Copy</string>
</property>
<property name="menuRole">
<enum>QAction::MenuRole::NoRole</enum>
<enum>QAction::NoRole</enum>
</property>
</action>
<action name="actionEditPaste">
@ -616,7 +606,7 @@
<string>Paste</string>
</property>
<property name="menuRole">
<enum>QAction::MenuRole::NoRole</enum>
<enum>QAction::NoRole</enum>
</property>
</action>
<action name="actionEditCut">
@ -628,7 +618,7 @@
<string>Cut</string>
</property>
<property name="menuRole">
<enum>QAction::MenuRole::NoRole</enum>
<enum>QAction::NoRole</enum>
</property>
</action>
<action name="actionEditUndo">
@ -640,7 +630,7 @@
<string>Undo</string>
</property>
<property name="menuRole">
<enum>QAction::MenuRole::NoRole</enum>
<enum>QAction::NoRole</enum>
</property>
</action>
<action name="actionEditRedo">
@ -652,7 +642,7 @@
<string>Redo</string>
</property>
<property name="menuRole">
<enum>QAction::MenuRole::NoRole</enum>
<enum>QAction::NoRole</enum>
</property>
</action>
<action name="actionopenFile">
@ -664,7 +654,55 @@
<string>Open file</string>
</property>
<property name="menuRole">
<enum>QAction::MenuRole::NoRole</enum>
<enum>QAction::NoRole</enum>
</property>
</action>
<action name="actionNew">
<property name="text">
<string>New path</string>
</property>
<property name="shortcut">
<string>Ctrl+N</string>
</property>
</action>
<action name="actionCopy">
<property name="text">
<string>Copy</string>
</property>
<property name="shortcut">
<string>Ctrl+C</string>
</property>
</action>
<action name="actionPast">
<property name="text">
<string>Past</string>
</property>
<property name="shortcut">
<string>Ctrl+V</string>
</property>
</action>
<action name="actionCut">
<property name="text">
<string>Cut</string>
</property>
<property name="shortcut">
<string>Ctrl+X</string>
</property>
</action>
<action name="actionUndo">
<property name="text">
<string>Undo</string>
</property>
<property name="shortcut">
<string>Ctrl+Z</string>
</property>
</action>
<action name="actionRedo">
<property name="text">
<string>Redo</string>
</property>
<property name="shortcut">
<string>Ctrl+Y</string>
</property>
</action>
</widget>

View File

@ -74,30 +74,26 @@
<div id="container">
<div id="map"></div>
<div id="fiche">
<h2>parcous1</h2>
<h2>parcous123</h2>
<p><strong>Ville :</strong> Bourg en bresse</p>
<p><strong>Département :</strong> 0</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">
<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><li>ok c'est cool</li>
</ul>
<h3>Étape 2</h3>
<p><strong>Personnages :</strong></p>
<ul><li>Antoine</li>
<li>Giovanni</li>
<ul><li>Quentin</li>
</ul>
<p><strong>Dialogues :</strong></p>
<ul><li>ligne de dialogue 1</li>
<li>ligne de dialogue 2</li>
<ul><li>ok c'est cool</li>
</ul>
</div>
@ -110,11 +106,9 @@
L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
attribution: '© OpenStreetMap contributors'
}).addTo(map);
L.marker([45.62, -0.966517]).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([-44.38, 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>");
L.marker([0, 0]).addTo(map).bindPopup("<b>Étape 1</b><br>");
var latlngs = [
[45.62, -0.966517],
[-44.38, 1.03348],
[0, 0],
];
var polyline = L.polyline(latlngs, {

View File

@ -1,148 +0,0 @@
<!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>Chemin des</h2>
<p><strong>Ville :</strong> Bourg en Bresse</p>
<p><strong>Département :</strong> 0</p>
<p><strong>Difficulté :</strong> 3</p>
<p><strong>Durée (heures) :</strong> 3.8</p>
<p><strong>Longueur (km) :</strong> 24.6</p>
<img src="data/parcours1.png">
<h3>Étape 1</h3>
<p><strong>Personnages :</strong></p>
<ul><li>Clémentine</li>
<li>Léo</li>
</ul>
<p><strong>Dialogues :</strong></p>
<ul><li>Bienvenue à tous, voici le centre historique !</li>
<li>Regardez cette magnifique horloge, elle date du XIXe siècle !</li>
</ul>
<h3>Étape 2</h3>
<p><strong>Personnages :</strong></p>
<ul><li>Aurélie</li>
<li>Sami</li>
</ul>
<p><strong>Dialogues :</strong></p>
<ul><li>Ici, on trouve les meilleurs fromages de la région !</li>
<li>Combien de colonnes vois-tu à l'entrée ?</li>
</ul>
<h3>Étape 3</h3>
<p><strong>Personnages :</strong></p>
<ul><li>Juliette</li>
<li>Marc</li>
</ul>
<p><strong>Dialogues :</strong></p>
<ul><li>La Reyssouze apporte de la fraîcheur en été.</li>
<li>Regarde cette inscription ancienne sur la pierre, tu arrives à la lire ?</li>
</ul>
<h3>Étape 4</h3>
<p><strong>Personnages :</strong></p>
<ul><li>Claire</li>
<li>Nathalie</li>
</ul>
<p><strong>Dialogues :</strong></p>
<ul><li>Voilà l'abbaye ! Admire l'architecture.</li>
<li>C'est ici la dernière étape. Observez bien la date !</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, -0.966517]).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([-44.38, 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, -0.966517],
[-44.38, 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>