From 428cfc6210cc52dd8fb4e5c4380e9dbf7f359dc6 Mon Sep 17 00:00:00 2001 From: itsmattkc Date: Thu, 27 Feb 2020 00:58:19 +1100 Subject: [PATCH] exportdialog: use sequence name and project directory to auto-select export filename --- app/dialog/export/export.cpp | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/app/dialog/export/export.cpp b/app/dialog/export/export.cpp index c6b8a4582..055c14565 100644 --- a/app/dialog/export/export.cpp +++ b/app/dialog/export/export.cpp @@ -414,8 +414,18 @@ void ExportDialog::LoadPresets() void ExportDialog::SetDefaultFilename() { - QString doc_location = QStandardPaths::writableLocation(QStandardPaths::DocumentsLocation); - QString file_location = QDir(doc_location).filePath("export"); + Sequence* s = static_cast(viewer_node_->parent()); + Project* p = s->project(); + + QDir doc_location; + + if (p->filename().isEmpty()) { + doc_location.setPath(QStandardPaths::writableLocation(QStandardPaths::DocumentsLocation)); + } else { + doc_location = QFileInfo(p->filename()).dir(); + } + + QString file_location = doc_location.filePath(s->name()); filename_edit_->setText(file_location); }