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()
void
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
......
......@@ -44,10 +44,3 @@ GUIProjectManager::shouldDeleteOutdatedBackupFile()
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
public:
virtual bool shouldLoadBackupFile();
virtual bool shouldDeleteOutdatedBackupFile();
virtual QString getProjectFileDestination( const QString &defaultPath );
};
#endif // GUIPROJECTMANAGER_H
......@@ -187,14 +187,11 @@ Project::save()
}
void
Project::saveAs()
Project::saveAs( const QString& fileName )
{
if ( m_projectManagerUi == NULL )
return ;
QFileInfo fInfo( *m_projectFile );
const QString& fileName = m_projectManagerUi->getProjectFileDestination( fInfo.absolutePath() );
if ( fileName.isEmpty() )
return ;
QFile* newProjectFile = new QFile( fileName );
delete m_projectFile;
m_projectFile = newProjectFile;
saveProject( fileName );
emit projectUpdated( name() );
}
......
......@@ -58,7 +58,7 @@ class Project : public QObject
virtual ~Project();
void save();
void saveAs();
void saveAs(const QString& fileName);
void emergencyBackup();
bool registerLoadSave( ILoadSave* loadSave );
bool isClean() const;
......
......@@ -37,13 +37,6 @@ public:
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
* @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