From a994f23948ebc21c20b6a83ce09bbdfadd3898da Mon Sep 17 00:00:00 2001 From: dfighter1985 Date: Wed, 30 Jul 2014 15:55:09 +0200 Subject: [PATCH] When hitting 'save as' ask for a filename even if one is set. --HG-- branch : gsoc2014-dfighter --- .../tile_editor/tile_editor_main_window.cpp | 21 ++++++++++++------- .../tile_editor/tile_editor_main_window.h | 1 + 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/code/studio/src/plugins/tile_editor/tile_editor_main_window.cpp b/code/studio/src/plugins/tile_editor/tile_editor_main_window.cpp index cc4e5e6b0..ee6221229 100644 --- a/code/studio/src/plugins/tile_editor/tile_editor_main_window.cpp +++ b/code/studio/src/plugins/tile_editor/tile_editor_main_window.cpp @@ -200,23 +200,28 @@ TileEditorMainWindow::~TileEditorMainWindow() void TileEditorMainWindow::save() { - saveAs(); + if( m_fileName.isEmpty() ) + saveAs(); + else + saveAs( m_fileName ); } void TileEditorMainWindow::saveAs() { - if( m_fileName.isEmpty() ) - { - m_fileName = QFileDialog::getSaveFileName( this, + QString fn = QFileDialog::getSaveFileName( this, tr( "Save TileBank as..." ), "", tr( "TileBank files (*.tilebank)" ) ); - if( m_fileName.isEmpty() ) - return; + if( fn.isEmpty() ) + return; - } + saveAs( fn ); +} + +void TileEditorMainWindow::saveAs( const QString &fn ) +{ QList< QString > landNames; int c = m_ui->landLW->count(); @@ -227,7 +232,7 @@ void TileEditorMainWindow::saveAs() } TileBankSaver saver; - bool ok = saver.save( m_fileName.toUtf8().constData(), m_tileModel, m_lands ); + bool ok = saver.save( fn.toUtf8().constData(), m_tileModel, m_lands ); if( !ok ) { diff --git a/code/studio/src/plugins/tile_editor/tile_editor_main_window.h b/code/studio/src/plugins/tile_editor/tile_editor_main_window.h index 2c4286377..d98ec9651 100644 --- a/code/studio/src/plugins/tile_editor/tile_editor_main_window.h +++ b/code/studio/src/plugins/tile_editor/tile_editor_main_window.h @@ -47,6 +47,7 @@ public: public Q_SLOTS: void save(); void saveAs(); + void saveAs( const QString &fn ); void open(); private Q_SLOTS: