[vlmc-devel] MainWindow: Don't use pointers to show QDialogs
Yikai Lu
git at videolan.org
Wed Apr 6 14:39:52 CEST 2016
vlmc | branch: master | Yikai Lu <luyikei.qmltu at gmail.com> | Wed Apr 6 20:59:04 2016 +0900| [f7626ead4bb101fbf276484dd8be8625780e0bf6] | committer: Hugo Beauzée-Luyssen
MainWindow: Don't use pointers to show QDialogs
Signed-off-by: Hugo Beauzée-Luyssen <hugo at beauzee.fr>
> https://code.videolan.org/videolan/vlmc/commit/f7626ead4bb101fbf276484dd8be8625780e0bf6
---
src/Gui/MainWindow.cpp | 37 +++++++++++++------------------------
1 file changed, 13 insertions(+), 24 deletions(-)
diff --git a/src/Gui/MainWindow.cpp b/src/Gui/MainWindow.cpp
index d6ff46c..5a34014 100644
--- a/src/Gui/MainWindow.cpp
+++ b/src/Gui/MainWindow.cpp
@@ -603,20 +603,14 @@ MainWindow::renderVideo( const QString& outputFileName, quint32 width, quint32 h
double fps, const QString& ar,
quint32 vbitrate, quint32 abitrate )
{
- WorkflowFileRendererDialog *dialog = new WorkflowFileRendererDialog( width, height );
- dialog->setModal( true );
- dialog->setOutputFileName( outputFileName );
-
+ WorkflowFileRendererDialog dialog( width, height );
+ dialog.setModal( true );
+ dialog.setOutputFileName( outputFileName );
Core::instance()->workflowRenderer()->startRenderToFile( outputFileName, width, height,
fps, ar, vbitrate, abitrate );
- if ( dialog->exec() == QDialog::Rejected )
- {
- delete dialog;
+ if ( dialog.exec() == QDialog::Rejected )
return false;
- }
-
- delete dialog;
return true;
}
@@ -625,23 +619,18 @@ MainWindow::renderVideoSettings( bool shareOnInternet )
{
Core::instance()->workflowRenderer()->stop();
- RendererSettings *settings = new RendererSettings( shareOnInternet );
+ RendererSettings settings( shareOnInternet );
- if ( settings->exec() == QDialog::Rejected )
- {
- delete settings;
+ if ( settings.exec() == QDialog::Rejected )
return false;
- }
-
- QString outputFileName = settings->outputFileName();
- quint32 width = settings->width();
- quint32 height = settings->height();
- double fps = settings->fps();
- quint32 vbitrate = settings->videoBitrate();
- quint32 abitrate = settings->audioBitrate();
- auto ar = settings->aspectRatio();
- delete settings;
+ QString outputFileName = settings.outputFileName();
+ quint32 width = settings.width();
+ quint32 height = settings.height();
+ double fps = settings.fps();
+ quint32 vbitrate = settings.videoBitrate();
+ quint32 abitrate = settings.audioBitrate();
+ auto ar = settings.aspectRatio();
return renderVideo( outputFileName, width, height, fps, ar, vbitrate, abitrate );
}
More information about the Vlmc-devel
mailing list