Commit c1231278 authored by Hugo Beauzée-Luyssen's avatar Hugo Beauzée-Luyssen

Ask the new project file location from the main window

parent 5433c79b
...@@ -324,7 +324,12 @@ MainWindow::on_actionSave_triggered() ...@@ -324,7 +324,12 @@ MainWindow::on_actionSave_triggered()
void void
MainWindow::on_actionSave_As_triggered() MainWindow::on_actionSave_As_triggered()
{ {
Core::getInstance()->currentProject()->saveAs(); //FIXME: This lacks the current project file path as a default location.
QString dest = QFileDialog::getSaveFileName( NULL, QObject::tr( "Enter the output file name" ),
QString(), QObject::tr( "VLMC project file(*.vlmc)" ) );
if ( dest.isEmpty() == true )
return;
Core::getInstance()->currentProject()->saveAs( dest );
} }
void void
......
...@@ -44,10 +44,3 @@ GUIProjectManager::shouldDeleteOutdatedBackupFile() ...@@ -44,10 +44,3 @@ GUIProjectManager::shouldDeleteOutdatedBackupFile()
QMessageBox::Ok | QMessageBox::No ) == QMessageBox::Ok; QMessageBox::Ok | QMessageBox::No ) == QMessageBox::Ok;
} }
QString
GUIProjectManager::getProjectFileDestination( const QString &defaultPath )
{
return QFileDialog::getSaveFileName( NULL, QObject::tr( "Enter the output file name" ),
defaultPath, QObject::tr( "VLMC project file(*.vlmc)" ) );
}
...@@ -30,7 +30,6 @@ class GUIProjectManager : public IProjectUiCb ...@@ -30,7 +30,6 @@ class GUIProjectManager : public IProjectUiCb
public: public:
virtual bool shouldLoadBackupFile(); virtual bool shouldLoadBackupFile();
virtual bool shouldDeleteOutdatedBackupFile(); virtual bool shouldDeleteOutdatedBackupFile();
virtual QString getProjectFileDestination( const QString &defaultPath );
}; };
#endif // GUIPROJECTMANAGER_H #endif // GUIPROJECTMANAGER_H
...@@ -187,14 +187,11 @@ Project::save() ...@@ -187,14 +187,11 @@ Project::save()
} }
void void
Project::saveAs() Project::saveAs( const QString& fileName )
{ {
if ( m_projectManagerUi == NULL ) QFile* newProjectFile = new QFile( fileName );
return ; delete m_projectFile;
QFileInfo fInfo( *m_projectFile ); m_projectFile = newProjectFile;
const QString& fileName = m_projectManagerUi->getProjectFileDestination( fInfo.absolutePath() );
if ( fileName.isEmpty() )
return ;
saveProject( fileName ); saveProject( fileName );
emit projectUpdated( name() ); emit projectUpdated( name() );
} }
......
...@@ -58,7 +58,7 @@ class Project : public QObject ...@@ -58,7 +58,7 @@ class Project : public QObject
virtual ~Project(); virtual ~Project();
void save(); void save();
void saveAs(); void saveAs(const QString& fileName);
void emergencyBackup(); void emergencyBackup();
bool registerLoadSave( ILoadSave* loadSave ); bool registerLoadSave( ILoadSave* loadSave );
bool isClean() const; bool isClean() const;
......
...@@ -37,13 +37,6 @@ public: ...@@ -37,13 +37,6 @@ public:
virtual ~IProjectUiCb() {} virtual ~IProjectUiCb() {}
/**
* @brief getProjectFile Ask the user where to save a new project
* @param defaultPath A default project location, if any.
* @return The selected project file
*/
virtual QString getProjectFileDestination( const QString& defaultPath ) = 0;
/** /**
* @brief shouldLoadBackupFile * @brief shouldLoadBackupFile
* @return True if the user wants to load the backup file. * @return True if the user wants to load the backup file.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment