Merge branch 'feature/changePath' into 'main'

Feature/change path

See merge request p2406187/sae201!12
This commit is contained in:
T'JAMPENS QUENTIN p2406187 2025-06-20 09:31:28 +00:00
commit d19946a779
3 changed files with 33 additions and 10 deletions

View File

@ -73,7 +73,7 @@ void MainWindow::onTextChanged()
textChanged = true;
}
void MainWindow::loadPath()
void MainWindow::loadNewPath()
{
QString fileName = QFileDialog::getOpenFileName(this, "Open the file");
if(fileName.isEmpty()) return;
@ -85,9 +85,20 @@ void MainWindow::loadPath()
file.close();
Path* p = new Path(&file);
QList<Step> steps = p->getStep();
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::loadPath(Path* p) {
QList<Step> steps = p->getStep();
ui->titleEdit->setText(p->getName());
ui->locEdit->setText(p->getCity());
@ -97,6 +108,8 @@ void MainWindow::loadPath()
ui->imagePath->setText(p->getImage());
loadImage(p->getImage());
ui->dialogEdit->clear();
if(!steps.isEmpty()) {
Step firstStep = p->getStep().first();
ui->stepTitle->setText(firstStep.getTitle());
@ -108,11 +121,6 @@ void MainWindow::loadPath()
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()
@ -174,7 +182,7 @@ void MainWindow::on_pushButton_clicked()
void MainWindow::on_actionOpen_triggered()
{
this->loadPath();
this->loadNewPath();
}
void MainWindow::on_toolButton_clicked()
@ -187,7 +195,7 @@ void MainWindow::on_toolButton_clicked()
void MainWindow::on_actionopenFile_triggered()
{
this->loadPath();
this->loadNewPath();
}
void MainWindow::on_actionEditCopy_triggered()
@ -230,3 +238,9 @@ void MainWindow::on_actionEditCut_triggered()
}
}
void MainWindow::on_pathNumber_valueChanged(int arg1)
{
this->loadPath(path.at(ui->pathNumber->value()-1));
}

View File

@ -22,7 +22,8 @@ public:
void updatePathView();
void updateStepView(size_t num);
void onTextChanged();
void loadPath();
void loadNewPath();
void loadPath(Path* p);
void addNewPath();
void addNewStep();
void exportHTMLMap();
@ -43,6 +44,8 @@ private slots:
void on_actionEditCut_triggered();
void on_pathNumber_valueChanged(int arg1);
private:
Ui::MainWindow *ui;
QString currentFile;

View File

@ -78,6 +78,12 @@
<height>27</height>
</rect>
</property>
<property name="minimum">
<number>1</number>
</property>
<property name="value">
<number>1</number>
</property>
</widget>
<widget class="QLineEdit" name="titleEdit">
<property name="geometry">