Merge branch 'feature/styleTool' into 'dev'
Feature/style tool See merge request p2406187/sae201!27
This commit is contained in:
commit
55dcacaa96
3
data.qrc
3
data.qrc
@ -19,5 +19,8 @@
|
||||
<file>data/images/save_as.png</file>
|
||||
<file>data/images/underline.png</file>
|
||||
<file>data/images/add.png</file>
|
||||
<file>data/images/font-color.png</file>
|
||||
<file>data/images/overline.png</file>
|
||||
<file>data/images/font-size.png</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
||||
BIN
data/images/font-color.png
Normal file
BIN
data/images/font-color.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 5.3 KiB |
BIN
data/images/font-size.png
Normal file
BIN
data/images/font-size.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 11 KiB |
BIN
data/images/overline.png
Normal file
BIN
data/images/overline.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 4.7 KiB |
191
mainwindow.cpp
191
mainwindow.cpp
@ -8,6 +8,11 @@
|
||||
#include <fstream>
|
||||
#include <QLineEdit>
|
||||
#include <QTimer>
|
||||
#include <QTextEdit>
|
||||
#include <QColorDialog>
|
||||
#include <QPlainTextEdit>
|
||||
#include <QInputDialog>
|
||||
#include <QFontDialog>
|
||||
#include <QFile>
|
||||
#include <QJsonDocument>
|
||||
#include <QJsonObject>
|
||||
@ -616,6 +621,192 @@ void MainWindow::loadAndExportPaths(QStringList fichiers) {
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::setBold(){
|
||||
QWidget *focused = QApplication::focusWidget();
|
||||
QPlainTextEdit* plainTextEdit = qobject_cast<QPlainTextEdit*>(focused);
|
||||
|
||||
if (plainTextEdit) {
|
||||
QTextCursor cursor = plainTextEdit->textCursor();
|
||||
QTextCharFormat format;
|
||||
QFont font = cursor.charFormat().font();
|
||||
font.setBold(!font.bold());
|
||||
format.setFont(font);
|
||||
plainTextEdit->mergeCurrentCharFormat(format);
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::on_actionBold_triggered()
|
||||
{
|
||||
this->setBold();
|
||||
}
|
||||
|
||||
|
||||
|
||||
void MainWindow::setItalic(){
|
||||
QWidget *focused = QApplication::focusWidget();
|
||||
QPlainTextEdit* plainTextEdit = qobject_cast<QPlainTextEdit*>(focused);
|
||||
|
||||
if (plainTextEdit) {
|
||||
QTextCursor cursor = plainTextEdit->textCursor();
|
||||
QTextCharFormat format;
|
||||
QFont font = cursor.charFormat().font();
|
||||
font.setItalic(!font.italic());
|
||||
format.setFont(font);
|
||||
plainTextEdit->mergeCurrentCharFormat(format);
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::on_actionItalic_triggered()
|
||||
{
|
||||
this->setItalic();
|
||||
}
|
||||
|
||||
|
||||
void MainWindow::setUnderline(){
|
||||
QWidget *focused = QApplication::focusWidget();
|
||||
QPlainTextEdit* plainTextEdit = qobject_cast<QPlainTextEdit*>(focused);
|
||||
|
||||
if (plainTextEdit) {
|
||||
QTextCursor cursor = plainTextEdit->textCursor();
|
||||
QTextCharFormat format;
|
||||
QFont font = cursor.charFormat().font();
|
||||
font.setUnderline(!font.underline());
|
||||
format.setFont(font);
|
||||
plainTextEdit->mergeCurrentCharFormat(format);
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::on_actionUnderline_triggered()
|
||||
{
|
||||
this->setUnderline();
|
||||
}
|
||||
|
||||
|
||||
|
||||
void MainWindow::setColor(){
|
||||
QWidget *focused = QApplication::focusWidget();
|
||||
QPlainTextEdit* plainTextEdit = qobject_cast<QPlainTextEdit*>(focused);
|
||||
|
||||
if (plainTextEdit) {
|
||||
QColor color = QColorDialog::getColor(Qt::black, this, "Choisir une couleur");
|
||||
QTextCursor cursor = plainTextEdit->textCursor();
|
||||
if (color.isValid()) {
|
||||
QTextCharFormat format;
|
||||
format.setForeground(color);
|
||||
plainTextEdit->mergeCurrentCharFormat(format);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::on_actionColor_triggered()
|
||||
{
|
||||
this->setColor();
|
||||
}
|
||||
|
||||
void MainWindow::setOverline(){
|
||||
QWidget *focused = QApplication::focusWidget();
|
||||
QPlainTextEdit* plainTextEdit = qobject_cast<QPlainTextEdit*>(focused);
|
||||
|
||||
if (plainTextEdit) {
|
||||
QTextCursor cursor = plainTextEdit->textCursor();
|
||||
QTextCharFormat format;
|
||||
QFont font = cursor.charFormat().font();
|
||||
font.setOverline(!font.overline());
|
||||
format.setFont(font);
|
||||
plainTextEdit->mergeCurrentCharFormat(format);
|
||||
}
|
||||
}
|
||||
void MainWindow::on_actionOverline_triggered()
|
||||
{
|
||||
this->setOverline();
|
||||
}
|
||||
|
||||
void MainWindow::setSize(){
|
||||
QWidget *focused = QApplication::focusWidget();
|
||||
QPlainTextEdit* plainTextEdit = qobject_cast<QPlainTextEdit*>(focused);
|
||||
|
||||
if (plainTextEdit) {
|
||||
QTextCursor cursor = plainTextEdit->textCursor();
|
||||
bool ok;
|
||||
int size = QInputDialog::getInt(this, "Taille de la police", "Entrez la taille de la police:", cursor.charFormat().font().pointSize(), 1, 100, 1, &ok);
|
||||
|
||||
if (ok) {
|
||||
QTextCharFormat format;
|
||||
QFont font = cursor.charFormat().font();
|
||||
font.setPointSize(size);
|
||||
format.setFont(font);
|
||||
plainTextEdit->mergeCurrentCharFormat(format);
|
||||
}
|
||||
}
|
||||
}
|
||||
void MainWindow::on_actionSize_triggered()
|
||||
{
|
||||
this->setSize();
|
||||
}
|
||||
|
||||
void MainWindow::setFont(){
|
||||
QWidget *focused = QApplication::focusWidget();
|
||||
QPlainTextEdit* plainTextEdit = qobject_cast<QPlainTextEdit*>(focused);
|
||||
|
||||
if (plainTextEdit) {
|
||||
QTextCursor cursor = plainTextEdit->textCursor();
|
||||
bool ok;
|
||||
QFont font = QFontDialog::getFont(&ok, cursor.charFormat().font(), this, "Choisir une police");
|
||||
if (ok) {
|
||||
QTextCharFormat format;
|
||||
format.setFont(font);
|
||||
plainTextEdit->mergeCurrentCharFormat(format);
|
||||
}
|
||||
}
|
||||
}
|
||||
void MainWindow::on_actionFont_triggered()
|
||||
{
|
||||
this->setFont();
|
||||
}
|
||||
|
||||
|
||||
void MainWindow::on_actionFont_color_triggered()
|
||||
{
|
||||
this->setColor();
|
||||
}
|
||||
|
||||
|
||||
void MainWindow::on_actionFont_2_triggered()
|
||||
{
|
||||
this->setFont();
|
||||
}
|
||||
|
||||
|
||||
void MainWindow::on_actionBold_2_triggered()
|
||||
{
|
||||
this->setBold();
|
||||
}
|
||||
|
||||
|
||||
void MainWindow::on_actionItalic_2_triggered()
|
||||
{
|
||||
this->setItalic();
|
||||
}
|
||||
|
||||
|
||||
void MainWindow::on_actionUnderline_2_triggered()
|
||||
{
|
||||
this->setUnderline();
|
||||
}
|
||||
|
||||
|
||||
void MainWindow::on_actionOverline_2_triggered()
|
||||
{
|
||||
this->setOverline();
|
||||
}
|
||||
|
||||
|
||||
void MainWindow::on_actionFont_size_triggered()
|
||||
{
|
||||
this->setSize();
|
||||
}
|
||||
|
||||
|
||||
|
||||
void MainWindow::saveAsFile(){
|
||||
QString fileName = QFileDialog::getSaveFileName(this, "Save as");
|
||||
|
||||
37
mainwindow.h
37
mainwindow.h
@ -42,6 +42,13 @@ public:
|
||||
int getIndexPath() const;
|
||||
void setIndexPath(int newIndexPath);
|
||||
void exportHTMLMap();
|
||||
void setBold();
|
||||
void setItalic();
|
||||
void setUnderline();
|
||||
void setColor();
|
||||
void setOverline();
|
||||
void setSize();
|
||||
void setFont();
|
||||
void saveFile();
|
||||
void newPath();
|
||||
|
||||
@ -62,6 +69,34 @@ private slots:
|
||||
|
||||
void on_actionEditCut_triggered();
|
||||
|
||||
void on_actionBold_triggered();
|
||||
|
||||
void on_actionItalic_triggered();
|
||||
|
||||
void on_actionUnderline_triggered();
|
||||
|
||||
void on_actionColor_triggered();
|
||||
|
||||
void on_actionOverline_triggered();
|
||||
|
||||
void on_actionSize_triggered();
|
||||
|
||||
void on_actionFont_triggered();
|
||||
|
||||
void on_actionFont_color_triggered();
|
||||
|
||||
void on_actionFont_2_triggered();
|
||||
|
||||
void on_actionBold_2_triggered();
|
||||
|
||||
void on_actionItalic_2_triggered();
|
||||
|
||||
void on_actionUnderline_2_triggered();
|
||||
|
||||
void on_actionOverline_2_triggered();
|
||||
|
||||
void on_actionFont_size_triggered();
|
||||
|
||||
void on_pathNumber_valueChanged(int arg1);
|
||||
|
||||
void on_stepNumber_valueChanged(int arg1);
|
||||
@ -76,7 +111,6 @@ private slots:
|
||||
|
||||
void on_actionSaveAsFile_triggered();
|
||||
|
||||
|
||||
void on_actionCopy_triggered();
|
||||
|
||||
void on_actionPast_triggered();
|
||||
@ -87,6 +121,7 @@ private slots:
|
||||
|
||||
void on_actionNewFile_triggered();
|
||||
|
||||
|
||||
private:
|
||||
Ui::MainWindow *ui;
|
||||
QString currentFile;
|
||||
|
||||
@ -500,8 +500,22 @@
|
||||
<addaction name="actionUndo"/>
|
||||
<addaction name="actionRedo"/>
|
||||
</widget>
|
||||
<widget class="QMenu" name="menuFont">
|
||||
<property name="title">
|
||||
<string>Font</string>
|
||||
</property>
|
||||
<addaction name="separator"/>
|
||||
<addaction name="actionFont_color"/>
|
||||
<addaction name="actionFont_2"/>
|
||||
<addaction name="actionFont_size"/>
|
||||
<addaction name="actionBold_2"/>
|
||||
<addaction name="actionItalic_2"/>
|
||||
<addaction name="actionUnderline_2"/>
|
||||
<addaction name="actionOverline_2"/>
|
||||
</widget>
|
||||
<addaction name="menuFile"/>
|
||||
<addaction name="menuEdit"/>
|
||||
<addaction name="menuFont"/>
|
||||
</widget>
|
||||
<widget class="QToolBar" name="toolBar">
|
||||
<property name="windowTitle">
|
||||
@ -524,6 +538,13 @@
|
||||
<addaction name="actionEditUndo"/>
|
||||
<addaction name="actionEditRedo"/>
|
||||
<addaction name="separator"/>
|
||||
<addaction name="actionColor"/>
|
||||
<addaction name="actionFont"/>
|
||||
<addaction name="actionSize"/>
|
||||
<addaction name="actionBold"/>
|
||||
<addaction name="actionItalic"/>
|
||||
<addaction name="actionUnderline"/>
|
||||
<addaction name="actionOverline"/>
|
||||
</widget>
|
||||
<action name="actionOpen">
|
||||
<property name="text">
|
||||
|
||||
124
pages/parcours0.html
Normal file
124
pages/parcours0.html
Normal file
@ -0,0 +1,124 @@
|
||||
<!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>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">
|
||||
<h3>Étape 1</h3>
|
||||
<p><strong>Personnages :</strong></p>
|
||||
<ul><li>Quentin</li>
|
||||
</ul>
|
||||
<p><strong>Dialogues :</strong></p>
|
||||
<ul><li>ok c'est cool</li>
|
||||
</ul>
|
||||
<h3>Étape 2</h3>
|
||||
<p><strong>Personnages :</strong></p>
|
||||
<ul><li>Quentin</li>
|
||||
</ul>
|
||||
<p><strong>Dialogues :</strong></p>
|
||||
<ul><li>ok c'est cool</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([0, 0]).addTo(map).bindPopup("<b>Étape 1</b><br>");
|
||||
var latlngs = [
|
||||
[0, 0],
|
||||
];
|
||||
|
||||
var polyline = L.polyline(latlngs, {
|
||||
color: 'purple',
|
||||
weight: 2,
|
||||
dashArray: '10, 10',
|
||||
opacity: 0.7
|
||||
}).addTo(map);
|
||||
map.fitBounds(polyline.getBounds());
|
||||
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
Loading…
x
Reference in New Issue
Block a user