Merge branch 'feature/Terraventura' into 'main'

Feature/terraventura

See merge request p2406187/sae201!4
This commit is contained in:
T'JAMPENS QUENTIN p2406187 2025-06-19 07:38:07 +00:00
commit 938a7798b6
4 changed files with 561 additions and 2 deletions

1
.gitignore vendored
View File

@ -454,3 +454,4 @@ compile_commands.json
*creator.user* *creator.user*
*_qmlcache.qrc *_qmlcache.qrc
build

View File

@ -1,6 +1,9 @@
#include "mainwindow.h" #include "mainwindow.h"
#include "ui_mainwindow.h" #include "ui_mainwindow.h"
#include <QFileDialog>
#include <QMessageBox>
MainWindow::MainWindow(QWidget *parent) MainWindow::MainWindow(QWidget *parent)
: QMainWindow(parent) : QMainWindow(parent)
, ui(new Ui::MainWindow) , ui(new Ui::MainWindow)
@ -11,4 +14,98 @@ MainWindow::MainWindow(QWidget *parent)
MainWindow::~MainWindow() MainWindow::~MainWindow()
{ {
delete ui; delete ui;
delete currentPath;
for(Path* p : path) {
delete p;
} }
}
void MainWindow::updatePathView()
{
}
void MainWindow::updateStepView(size_t num)
{
}
void MainWindow::onTextChanged()
{
textChanged = true;
}
void MainWindow::loadPath(QTextStream &in)
{
}
void MainWindow::addNewPath()
{
}
void MainWindow::addNewStep()
{
}
void MainWindow::exportHTMLMap()
{
}
void MainWindow::on_pushButton_clicked()
{
QString ext[] = {"png", "jpeg", "jpg"};
QString fileName = QFileDialog::getOpenFileName(this, "Open the file");
if (fileName.isEmpty()) return;
QFile file(fileName);
if (!file.open(QIODevice::ReadOnly | QFile::Text)) {
QMessageBox::warning(this, "Warning", "Cannot open file: " +
file.errorString());
return;
}
QString text = file.fileName();
bool acceptedExt = false;
for(QString e : ext) {
if(text.endsWith(e)) acceptedExt = true;
}
if(!acceptedExt) {
QMessageBox::warning(this, "Warning", "Format de fichier incorrect");
return;
}
ui->imagePath->setText(text);
QPixmap px(fileName);
ui->imageLbl->setPixmap(px);
file.close();
}
void MainWindow::on_actionOpen_triggered()
{
QString fileName = QFileDialog::getOpenFileName(this, "Open the file");
if(fileName.isEmpty()) return;
QFile file(fileName);
if(!file.open(QIODevice::ReadOnly | QFile::Text)) {
QMessageBox::warning(this, "Warning", "Fichier non valide" + file.errorString());
return;
}
}

View File

@ -3,6 +3,8 @@
#include <QMainWindow> #include <QMainWindow>
#include "path.h"
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
namespace Ui { namespace Ui {
class MainWindow; class MainWindow;
@ -24,9 +26,16 @@ public:
void addNewStep(); void addNewStep();
void exportHTMLMap(); void exportHTMLMap();
private slots:
void on_pushButton_clicked();
void on_actionOpen_triggered();
private: private:
Ui::MainWindow *ui; Ui::MainWindow *ui;
QString currentFile; QString currentFile;
bool textChanged; bool textChanged;
QList<Path*> path;
Path* currentPath;
}; };
#endif // MAINWINDOW_H #endif // MAINWINDOW_H

View File

@ -7,13 +7,281 @@
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>800</width> <width>800</width>
<height>600</height> <height>626</height>
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
<string>MainWindow</string> <string>MainWindow</string>
</property> </property>
<widget class="QWidget" name="centralwidget"/> <widget class="QWidget" name="centralwidget">
<property name="maximumSize">
<size>
<width>800</width>
<height>521</height>
</size>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QLabel" name="PathInformation">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>20</height>
</size>
</property>
<property name="text">
<string>Path information</string>
</property>
<property name="alignment">
<set>Qt::AlignmentFlag::AlignLeading|Qt::AlignmentFlag::AlignLeft|Qt::AlignmentFlag::AlignTop</set>
</property>
</widget>
</item>
<item>
<widget class="QFrame" name="frame">
<property name="maximumSize">
<size>
<width>16777215</width>
<height>16777215</height>
</size>
</property>
<property name="frameShape">
<enum>QFrame::Shape::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Shadow::Raised</enum>
</property>
<widget class="QSpinBox" name="spinBox">
<property name="geometry">
<rect>
<x>10</x>
<y>20</y>
<width>45</width>
<height>27</height>
</rect>
</property>
</widget>
<widget class="QLineEdit" name="lineEdit">
<property name="geometry">
<rect>
<x>60</x>
<y>20</y>
<width>391</width>
<height>26</height>
</rect>
</property>
</widget>
<widget class="QWidget" name="widget" native="true">
<property name="geometry">
<rect>
<x>10</x>
<y>60</y>
<width>441</width>
<height>45</height>
</rect>
</property>
<layout class="QHBoxLayout" name="horizontalLayout">
<property name="leftMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<item>
<widget class="QLabel" name="label">
<property name="text">
<string>Localisation</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="lineEdit_2"/>
</item>
<item>
<widget class="QSpinBox" name="spinBox_2"/>
</item>
</layout>
</widget>
<widget class="QLabel" name="imageLbl">
<property name="geometry">
<rect>
<x>470</x>
<y>20</y>
<width>281</width>
<height>191</height>
</rect>
</property>
<property name="text">
<string/>
</property>
</widget>
<widget class="QWidget" name="widget_5" native="true">
<property name="geometry">
<rect>
<x>0</x>
<y>110</y>
<width>451</width>
<height>63</height>
</rect>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_5">
<property name="leftMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<item>
<widget class="QWidget" name="widget_2" native="true">
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QLabel" name="label_3">
<property name="text">
<string>Difficulty</string>
</property>
</widget>
</item>
<item>
<widget class="QSpinBox" name="spinBox_3">
<property name="suffix">
<string>/5</string>
</property>
<property name="maximum">
<number>5</number>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QWidget" name="widget_3" native="true">
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<widget class="QLabel" name="label_4">
<property name="text">
<string>Duration</string>
</property>
</widget>
</item>
<item>
<widget class="QDoubleSpinBox" name="doubleSpinBox">
<property name="suffix">
<string>h</string>
</property>
<property name="decimals">
<number>1</number>
</property>
<property name="singleStep">
<double>0.100000000000000</double>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QWidget" name="widget_4" native="true">
<layout class="QHBoxLayout" name="horizontalLayout_4">
<item>
<widget class="QLabel" name="label_5">
<property name="text">
<string>Length</string>
</property>
</widget>
</item>
<item>
<widget class="QDoubleSpinBox" name="doubleSpinBox_2">
<property name="suffix">
<string>Km</string>
</property>
<property name="decimals">
<number>1</number>
</property>
<property name="maximum">
<double>500.000000000000000</double>
</property>
<property name="singleStep">
<double>0.100000000000000</double>
</property>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="widget_6" native="true">
<property name="geometry">
<rect>
<x>0</x>
<y>180</y>
<width>451</width>
<height>44</height>
</rect>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_6">
<property name="leftMargin">
<number>9</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<item>
<widget class="QLabel" name="label_6">
<property name="text">
<string>Image</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="imagePath"/>
</item>
<item>
<widget class="QPushButton" name="pushButton">
<property name="text">
<string>Select Image File</string>
</property>
</widget>
</item>
</layout>
</widget>
</widget>
</item>
<item>
<widget class="QLabel" name="StepInformation">
<property name="maximumSize">
<size>
<width>16777215</width>
<height>20</height>
</size>
</property>
<property name="text">
<string>Step information</string>
</property>
<property name="alignment">
<set>Qt::AlignmentFlag::AlignLeading|Qt::AlignmentFlag::AlignLeft|Qt::AlignmentFlag::AlignTop</set>
</property>
</widget>
</item>
<item>
<widget class="QFrame" name="frame_2">
<property name="frameShape">
<enum>QFrame::Shape::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Shadow::Raised</enum>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="QMenuBar" name="menubar"> <widget class="QMenuBar" name="menubar">
<property name="geometry"> <property name="geometry">
<rect> <rect>
@ -23,8 +291,192 @@
<height>23</height> <height>23</height>
</rect> </rect>
</property> </property>
<widget class="QMenu" name="menuFile">
<property name="title">
<string>File</string>
</property>
<addaction name="actionOpen"/>
<addaction name="actionSave"/>
<addaction name="actionSave_as"/>
</widget>
<widget class="QMenu" name="menuEdit">
<property name="title">
<string>Edit</string>
</property>
</widget>
<addaction name="menuFile"/>
<addaction name="menuEdit"/>
</widget> </widget>
<widget class="QStatusBar" name="statusbar"/> <widget class="QStatusBar" name="statusbar"/>
<widget class="QToolBar" name="toolBar">
<property name="windowTitle">
<string>toolBar</string>
</property>
<attribute name="toolBarArea">
<enum>TopToolBarArea</enum>
</attribute>
<attribute name="toolBarBreak">
<bool>false</bool>
</attribute>
<addaction name="actionNewFile"/>
<addaction name="actionNew"/>
<addaction name="actionSaveFile"/>
<addaction name="actionSaveAsFile"/>
<addaction name="actionPrintFile"/>
<addaction name="separator"/>
<addaction name="actionEditCopy"/>
<addaction name="actionEditPaste"/>
<addaction name="actionEditCut"/>
<addaction name="actionEditDelete"/>
<addaction name="actionEditUndo"/>
<addaction name="actionEditRedo"/>
<addaction name="separator"/>
</widget>
<action name="actionOpen">
<property name="text">
<string>Open</string>
</property>
<property name="shortcut">
<string>Ctrl+O</string>
</property>
</action>
<action name="actionSave">
<property name="text">
<string>Save</string>
</property>
<property name="shortcut">
<string>Ctrl+S</string>
</property>
</action>
<action name="actionSave_as">
<property name="text">
<string>Save as</string>
</property>
<property name="shortcut">
<string>Ctrl+Shift+S</string>
</property>
</action>
<action name="actionNewFile">
<property name="icon">
<iconset theme="QIcon::ThemeIcon::DocumentNew"/>
</property>
<property name="text">
<string>NewFile</string>
</property>
<property name="menuRole">
<enum>QAction::MenuRole::NoRole</enum>
</property>
</action>
<action name="actionSaveFile">
<property name="icon">
<iconset theme="QIcon::ThemeIcon::DocumentSave"/>
</property>
<property name="text">
<string>SaveFile</string>
</property>
<property name="menuRole">
<enum>QAction::MenuRole::NoRole</enum>
</property>
</action>
<action name="actionSaveAsFile">
<property name="icon">
<iconset theme="QIcon::ThemeIcon::DocumentSaveAs"/>
</property>
<property name="text">
<string>SaveAsFile</string>
</property>
<property name="menuRole">
<enum>QAction::MenuRole::NoRole</enum>
</property>
</action>
<action name="actionPrintFile">
<property name="icon">
<iconset theme="QIcon::ThemeIcon::DocumentPrint"/>
</property>
<property name="text">
<string>PrintFile</string>
</property>
<property name="menuRole">
<enum>QAction::MenuRole::NoRole</enum>
</property>
</action>
<action name="actionEditCopy">
<property name="icon">
<iconset theme="QIcon::ThemeIcon::EditCopy"/>
</property>
<property name="text">
<string>EditCopy</string>
</property>
<property name="menuRole">
<enum>QAction::MenuRole::NoRole</enum>
</property>
</action>
<action name="actionEditPaste">
<property name="icon">
<iconset theme="QIcon::ThemeIcon::EditPaste"/>
</property>
<property name="text">
<string>EditPaste</string>
</property>
<property name="menuRole">
<enum>QAction::MenuRole::NoRole</enum>
</property>
</action>
<action name="actionEditCut">
<property name="icon">
<iconset theme="QIcon::ThemeIcon::EditCut"/>
</property>
<property name="text">
<string>EditCut</string>
</property>
<property name="menuRole">
<enum>QAction::MenuRole::NoRole</enum>
</property>
</action>
<action name="actionEditDelete">
<property name="icon">
<iconset theme="QIcon::ThemeIcon::EditDelete"/>
</property>
<property name="text">
<string>EditDelete</string>
</property>
<property name="menuRole">
<enum>QAction::MenuRole::NoRole</enum>
</property>
</action>
<action name="actionEditUndo">
<property name="icon">
<iconset theme="QIcon::ThemeIcon::EditUndo"/>
</property>
<property name="text">
<string>EditUndo</string>
</property>
<property name="menuRole">
<enum>QAction::MenuRole::NoRole</enum>
</property>
</action>
<action name="actionEditRedo">
<property name="icon">
<iconset theme="QIcon::ThemeIcon::EditRedo"/>
</property>
<property name="text">
<string>EditRedo</string>
</property>
<property name="menuRole">
<enum>QAction::MenuRole::NoRole</enum>
</property>
</action>
<action name="actionNew">
<property name="icon">
<iconset theme="QIcon::ThemeIcon::DocumentOpen"/>
</property>
<property name="text">
<string>New</string>
</property>
<property name="menuRole">
<enum>QAction::MenuRole::NoRole</enum>
</property>
</action>
</widget> </widget>
<resources/> <resources/>
<connections/> <connections/>