printing: pass current filename to dialog

Instead of accessing a global variable, pass the filename
from the MainWindow to the dialog. This is supposed to cut
down on the global variable mess.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
Berthold Stoeger 2024-03-16 13:39:15 +01:00 committed by bstoeger
parent 3a1122048b
commit 37f2207f94
3 changed files with 8 additions and 6 deletions

View file

@ -551,7 +551,8 @@ void MainWindow::on_actionPrint_triggered()
// When in planner, only print the planned dive.
dive *singleDive = appState == ApplicationState::PlanDive ? plannerWidgets->getDive()
: nullptr;
PrintDialog dlg(singleDive, this);
QString filename = existing_filename ?: prefs.default_filename;
PrintDialog dlg(singleDive, filename, this);
dlg.exec();
#endif