Merge branch 'feature/changePath' into 'main'
Feature/change path See merge request p2406187/sae201!12
This commit is contained in:
commit
d19946a779
@ -73,7 +73,7 @@ void MainWindow::onTextChanged()
|
|||||||
textChanged = true;
|
textChanged = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::loadPath()
|
void MainWindow::loadNewPath()
|
||||||
{
|
{
|
||||||
QString fileName = QFileDialog::getOpenFileName(this, "Open the file");
|
QString fileName = QFileDialog::getOpenFileName(this, "Open the file");
|
||||||
if(fileName.isEmpty()) return;
|
if(fileName.isEmpty()) return;
|
||||||
@ -85,9 +85,20 @@ void MainWindow::loadPath()
|
|||||||
|
|
||||||
file.close();
|
file.close();
|
||||||
Path* p = new Path(&file);
|
Path* p = new Path(&file);
|
||||||
QList<Step> steps = p->getStep();
|
|
||||||
currentPath = p;
|
currentPath = p;
|
||||||
path.append(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->titleEdit->setText(p->getName());
|
||||||
ui->locEdit->setText(p->getCity());
|
ui->locEdit->setText(p->getCity());
|
||||||
@ -97,6 +108,8 @@ void MainWindow::loadPath()
|
|||||||
ui->imagePath->setText(p->getImage());
|
ui->imagePath->setText(p->getImage());
|
||||||
loadImage(p->getImage());
|
loadImage(p->getImage());
|
||||||
|
|
||||||
|
ui->dialogEdit->clear();
|
||||||
|
|
||||||
if(!steps.isEmpty()) {
|
if(!steps.isEmpty()) {
|
||||||
Step firstStep = p->getStep().first();
|
Step firstStep = p->getStep().first();
|
||||||
ui->stepTitle->setText(firstStep.getTitle());
|
ui->stepTitle->setText(firstStep.getTitle());
|
||||||
@ -108,11 +121,6 @@ void MainWindow::loadPath()
|
|||||||
ui->dialogEdit->appendPlainText(q);
|
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()
|
void MainWindow::addNewPath()
|
||||||
@ -174,7 +182,7 @@ void MainWindow::on_pushButton_clicked()
|
|||||||
|
|
||||||
void MainWindow::on_actionOpen_triggered()
|
void MainWindow::on_actionOpen_triggered()
|
||||||
{
|
{
|
||||||
this->loadPath();
|
this->loadNewPath();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::on_toolButton_clicked()
|
void MainWindow::on_toolButton_clicked()
|
||||||
@ -187,7 +195,7 @@ void MainWindow::on_toolButton_clicked()
|
|||||||
|
|
||||||
void MainWindow::on_actionopenFile_triggered()
|
void MainWindow::on_actionopenFile_triggered()
|
||||||
{
|
{
|
||||||
this->loadPath();
|
this->loadNewPath();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::on_actionEditCopy_triggered()
|
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));
|
||||||
|
}
|
||||||
|
|
||||||
|
|||||||
@ -22,7 +22,8 @@ public:
|
|||||||
void updatePathView();
|
void updatePathView();
|
||||||
void updateStepView(size_t num);
|
void updateStepView(size_t num);
|
||||||
void onTextChanged();
|
void onTextChanged();
|
||||||
void loadPath();
|
void loadNewPath();
|
||||||
|
void loadPath(Path* p);
|
||||||
void addNewPath();
|
void addNewPath();
|
||||||
void addNewStep();
|
void addNewStep();
|
||||||
void exportHTMLMap();
|
void exportHTMLMap();
|
||||||
@ -43,6 +44,8 @@ private slots:
|
|||||||
|
|
||||||
void on_actionEditCut_triggered();
|
void on_actionEditCut_triggered();
|
||||||
|
|
||||||
|
void on_pathNumber_valueChanged(int arg1);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::MainWindow *ui;
|
Ui::MainWindow *ui;
|
||||||
QString currentFile;
|
QString currentFile;
|
||||||
|
|||||||
@ -78,6 +78,12 @@
|
|||||||
<height>27</height>
|
<height>27</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="minimum">
|
||||||
|
<number>1</number>
|
||||||
|
</property>
|
||||||
|
<property name="value">
|
||||||
|
<number>1</number>
|
||||||
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QLineEdit" name="titleEdit">
|
<widget class="QLineEdit" name="titleEdit">
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user