From f06b7025babfe9e599912bb501bbe45424f88725 Mon Sep 17 00:00:00 2001 From: Marius Kintel Date: Sun, 26 Dec 2010 00:22:45 +0100 Subject: Suggest filename based on document name on export diff --git a/doc/TODO.txt b/doc/TODO.txt index 182a7b7..0e1576a 100644 --- a/doc/TODO.txt +++ b/doc/TODO.txt @@ -58,8 +58,6 @@ o Preferences - Default language feature settings - Auto-view CSG/thrown together on load - Make the library search path configurable? -o Export etc.: - - Remember document name and suggest that as export filename o MDI - Think about how to do MDI the right way - Ctrl-W should close the current dialog, not the current main window diff --git a/src/mainwin.cc b/src/mainwin.cc index 951c4f5..3963170 100644 --- a/src/mainwin.cc +++ b/src/mainwin.cc @@ -1309,8 +1309,10 @@ void MainWindow::actionExportSTLorOFF(bool) return; } + QString suffix = stl_mode ? ".stl" : ".off"; QString stl_filename = QFileDialog::getSaveFileName(this, - stl_mode ? "Export STL File" : "Export OFF File", "", + stl_mode ? "Export STL File" : "Export OFF File", + this->fileName.isEmpty() ? "Untitled"+suffix : QFileInfo(this->fileName).baseName()+suffix, stl_mode ? "STL Files (*.stl)" : "OFF Files (*.off)"); if (stl_filename.isEmpty()) { PRINTF("No filename specified. %s export aborted.", stl_mode ? "STL" : "OFF"); @@ -1372,7 +1374,9 @@ void MainWindow::actionExportDXF() } QString dxf_filename = QFileDialog::getSaveFileName(this, - "Export DXF File", "", "DXF Files (*.dxf)"); + "Export DXF File", + this->fileName.isEmpty() ? "Untitled.dxf" : QFileInfo(this->fileName).baseName()+".dxf", + "DXF Files (*.dxf)"); if (dxf_filename.isEmpty()) { PRINTF("No filename specified. DXF export aborted."); clearCurrentOutput(); -- cgit v0.10.1