Commit 19bbe9e9 authored by Hugo Beauzee-Luyssen's avatar Hugo Beauzee-Luyssen
Browse files

Saving project is functionnal

parent 7170c83f
...@@ -140,6 +140,21 @@ void MainWindow::setupLibrary() ...@@ -140,6 +140,21 @@ void MainWindow::setupLibrary()
this, SLOT( mediaListItemDoubleClicked( QListWidgetItem* ) ) ); this, SLOT( mediaListItemDoubleClicked( QListWidgetItem* ) ) );
} }
void MainWindow::on_actionSave_triggered()
{
QString outputFileName =
QFileDialog::getSaveFileName( NULL, "Enter the output file name",
QString(), "VLMC project file(*.vlmc)" );
if ( outputFileName.length() == 0 )
return ;
else
{
//Project manager will destroy itself.
ProjectManager* pm = new ProjectManager( outputFileName );
pm->saveProject();
}
}
void MainWindow::on_actionLoad_Project_triggered() void MainWindow::on_actionLoad_Project_triggered()
{ {
QString outputFileName = QString outputFileName =
...@@ -252,7 +267,7 @@ void MainWindow::on_actionRender_triggered() ...@@ -252,7 +267,7 @@ void MainWindow::on_actionRender_triggered()
} }
QString outputFileName = QString outputFileName =
QFileDialog::getSaveFileName( NULL, "Enter the output file name", QFileDialog::getSaveFileName( NULL, "Enter the output file name",
QString(), "Videos(*.avi *.mpg)" ); QDir::currentPath(), "Videos(*.avi *.mpg)" );
if ( outputFileName.length() == 0 ) if ( outputFileName.length() == 0 )
return ; return ;
else else
...@@ -285,13 +300,6 @@ void MainWindow::on_actionNew_Project_triggered() ...@@ -285,13 +300,6 @@ void MainWindow::on_actionNew_Project_triggered()
m_projectPreferences->show(); m_projectPreferences->show();
} }
void MainWindow::on_actionOpen_Project_triggered()
{
QString path = QFileDialog::getOpenFileName( this, tr( "Choose a project to open" ),
QDir::currentPath(),
tr( "VideoLAN Movie Creator file (*.vlmc)" ) );
}
void MainWindow::zoomIn() void MainWindow::zoomIn()
{ {
m_zoomSlider->setValue( m_zoomSlider->value() - 1 ); m_zoomSlider->setValue( m_zoomSlider->value() - 1 );
......
...@@ -81,8 +81,8 @@ private slots: ...@@ -81,8 +81,8 @@ private slots:
void on_actionTranscode_File_triggered(); void on_actionTranscode_File_triggered();
void on_actionRender_triggered(); void on_actionRender_triggered();
void on_actionNew_Project_triggered(); void on_actionNew_Project_triggered();
void on_actionOpen_Project_triggered();
void on_actionLoad_Project_triggered(); void on_actionLoad_Project_triggered();
void on_actionSave_triggered();
void mediaListItemDoubleClicked( QListWidgetItem* ); void mediaListItemDoubleClicked( QListWidgetItem* );
signals: signals:
......
...@@ -35,8 +35,8 @@ ...@@ -35,8 +35,8 @@
<string>File</string> <string>File</string>
</property> </property>
<addaction name="actionNew_Project"/> <addaction name="actionNew_Project"/>
<addaction name="actionOpen_Project"/>
<addaction name="actionLoad_Project"/> <addaction name="actionLoad_Project"/>
<addaction name="actionSave"/>
<addaction name="actionTranscode_File"/> <addaction name="actionTranscode_File"/>
<addaction name="actionRender"/> <addaction name="actionRender"/>
<addaction name="actionQuit"/> <addaction name="actionQuit"/>
...@@ -171,6 +171,11 @@ ...@@ -171,6 +171,11 @@
<string>Load Project</string> <string>Load Project</string>
</property> </property>
</action> </action>
<action name="actionSave">
<property name="text">
<string>Save</string>
</property>
</action>
</widget> </widget>
<resources> <resources>
<include location="../../../ressources.qrc"/> <include location="../../../ressources.qrc"/>
......
...@@ -149,7 +149,7 @@ void Library::loadProject( const QDomElement& medias ) ...@@ -149,7 +149,7 @@ void Library::loadProject( const QDomElement& medias )
} }
} }
void Library::saveProject( QDomDocument& doc ) void Library::saveProject( QDomDocument& doc, QDomElement& rootNode )
{ {
QHash<QUuid, Media*>::iterator it = m_medias.begin(); QHash<QUuid, Media*>::iterator it = m_medias.begin();
QHash<QUuid, Media*>::iterator end = m_medias.end(); QHash<QUuid, Media*>::iterator end = m_medias.end();
...@@ -174,5 +174,5 @@ void Library::saveProject( QDomDocument& doc ) ...@@ -174,5 +174,5 @@ void Library::saveProject( QDomDocument& doc )
media.appendChild( mrl ); media.appendChild( mrl );
media.appendChild( uuid ); media.appendChild( uuid );
} }
doc.appendChild( medias ); rootNode.appendChild( medias );
} }
...@@ -70,7 +70,7 @@ public slots: ...@@ -70,7 +70,7 @@ public slots:
void removingMediaAsked( const QUuid& uuid ); void removingMediaAsked( const QUuid& uuid );
void loadProject( const QDomElement& project ); void loadProject( const QDomElement& project );
void saveProject( QDomDocument& doc ); void saveProject( QDomDocument& doc, QDomElement& rootNode );
private slots: private slots:
void metaDataComputed( Media* ); void metaDataComputed( Media* );
......
...@@ -474,7 +474,7 @@ void MainWorkflow::loadProject( const QDomElement& project ) ...@@ -474,7 +474,7 @@ void MainWorkflow::loadProject( const QDomElement& project )
} }
} }
void MainWorkflow::saveProject( QDomDocument& doc ) void MainWorkflow::saveProject( QDomDocument& doc, QDomElement& rootNode )
{ {
QDomElement project = doc.createElement( "timeline" ); QDomElement project = doc.createElement( "timeline" );
for ( unsigned int i = 0; i < m_trackCount; ++i ) for ( unsigned int i = 0; i < m_trackCount; ++i )
...@@ -489,7 +489,7 @@ void MainWorkflow::saveProject( QDomDocument& doc ) ...@@ -489,7 +489,7 @@ void MainWorkflow::saveProject( QDomDocument& doc )
project.appendChild( trackNode ); project.appendChild( trackNode );
} }
} }
doc.appendChild( project ); rootNode.appendChild( project );
} }
void MainWorkflow::clear() void MainWorkflow::clear()
......
...@@ -148,7 +148,7 @@ class MainWorkflow : public QObject, public Singleton<MainWorkflow> ...@@ -148,7 +148,7 @@ class MainWorkflow : public QObject, public Singleton<MainWorkflow>
public slots: public slots:
void loadProject( const QDomElement& project ); void loadProject( const QDomElement& project );
void saveProject( QDomDocument& doc ); void saveProject( QDomDocument& doc, QDomElement& rootNode );
signals: signals:
/** /**
......
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