Possibility to change the current Path
This commit is contained in:
parent
dda5d3e724
commit
c2151515f5
@ -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));
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user