[vlmc-devel] commit: Wizzard: Don' t modify settings until the entire wizzard has been validated. ( =?UTF-8?Q?Hugo=20Beauz=C3=A9e=2DLuyssen?==?UTF-8?Q?=20?=)
git at videolan.org
git at videolan.org
Sat Nov 27 15:34:06 CET 2010
vlmc | branch: master | Hugo Beauzée-Luyssen <beauze.h at gmail.com> | Sat Nov 27 15:13:52 2010 +0100| [1fc3fa9833c280629cee8f40fc6fc11a1cd04052] | committer: Hugo Beauzée-Luyssen
Wizzard: Don't modify settings until the entire wizzard has been validated.
Fixes #56
> http://git.videolan.org/gitweb.cgi/vlmc.git/?a=commit;h=1fc3fa9833c280629cee8f40fc6fc11a1cd04052
---
src/Gui/wizard/GeneralPage.cpp | 7 +------
src/Gui/wizard/ProjectWizard.cpp | 12 ++++++++++++
src/Gui/wizard/VideoPage.cpp | 14 +++++---------
3 files changed, 18 insertions(+), 15 deletions(-)
diff --git a/src/Gui/wizard/GeneralPage.cpp b/src/Gui/wizard/GeneralPage.cpp
index f27c23e..ded436c 100644
--- a/src/Gui/wizard/GeneralPage.cpp
+++ b/src/Gui/wizard/GeneralPage.cpp
@@ -49,6 +49,7 @@ GeneralPage::GeneralPage( QWidget *parent ) :
this, SLOT( updateProjectLocation() ) );
registerField( "projectName*", ui.lineEditName );
+ registerField( "workspace*", ui.lineEditProjectLocation );
}
void
@@ -94,8 +95,6 @@ GeneralPage::validatePage()
{
if ( m_valid == false )
return false;
- SettingsManager *sManager = SettingsManager::getInstance();
-
const QString &defaultProjectName = ProjectManager::unNamedProject;
if ( ui.lineEditName->text().isEmpty() ||
ui.lineEditName->text() == defaultProjectName )
@@ -113,16 +112,12 @@ GeneralPage::validatePage()
return false;
}
- QVariant projectName( ui.lineEditName->text() );
- sManager->setValue( "general/ProjectName", projectName, SettingsManager::Project );
-
//Create the project directory in the workspace dir.
QString projectPath = ui.lineEditName->text().replace( ' ', '_' );
QDir workspaceDir( ui.lineEditWorkspace->text() );
if ( workspaceDir.exists( projectPath ) == false )
workspaceDir.mkdir( projectPath );
- sManager->setValue( "general/Workspace", ui.lineEditProjectLocation->text(), SettingsManager::Project );
return true;
}
diff --git a/src/Gui/wizard/ProjectWizard.cpp b/src/Gui/wizard/ProjectWizard.cpp
index f8d7bbe..053f1f7 100644
--- a/src/Gui/wizard/ProjectWizard.cpp
+++ b/src/Gui/wizard/ProjectWizard.cpp
@@ -93,8 +93,20 @@ void ProjectWizard::showHelp()
void ProjectWizard::accept()
{
+ //This intend to check if the user opened a project, or created one.
+ //If he was creating a project, the current page will be the video/audio settings one.
if ( currentId() == Page_Video )
+ {
+ SettingsManager *sManager = SettingsManager::getInstance();
GUIProjectManager::getInstance()->newProject( field( "projectName" ).toString() );
+ sManager->setValue( "general/Workspace", field( "workspace" ), SettingsManager::Project );
+
+ sManager->setValue( "video/VLMCOutputFPS", field( "fps" ), SettingsManager::Project );
+ sManager->setValue( "video/VideoProjectHeight", field( "height" ), SettingsManager::Project );
+ sManager->setValue( "video/VideoProjectWidth", field( "width" ), SettingsManager::Project );
+ sManager->setValue( "audio/AudioSampleRate", field( "samplerate" ), SettingsManager::Project );
+ sManager->setValue( "audio/NbChannels", field( "samplerate" ), SettingsManager::Project );
+ }
QDialog::accept();
}
diff --git a/src/Gui/wizard/VideoPage.cpp b/src/Gui/wizard/VideoPage.cpp
index c68da6e..94305b5 100644
--- a/src/Gui/wizard/VideoPage.cpp
+++ b/src/Gui/wizard/VideoPage.cpp
@@ -37,6 +37,11 @@ VideoPage::VideoPage( QWidget* parent ) :
this, SLOT( updateVideoPresets() ) );
connect( ui.comboBoxAudioPresets, SIGNAL( currentIndexChanged(int) ),
this, SLOT( updateAudioPresets() ) );
+ registerField( "fps", ui.doubleSpinBoxVideoFPS );
+ registerField( "width", ui.spinBoxVideoWidth );
+ registerField( "height", ui.spinBoxVideoHeight );
+ registerField( "samplerate", ui.comboBoxAudioSamplerate );
+ registerField( "channels", ui.spinBoxAudioChannels );
}
void
@@ -94,15 +99,6 @@ VideoPage::initializePage()
bool
VideoPage::validatePage()
{
- SettingsManager* sManager = SettingsManager::getInstance();
- QVariant projectFps( ui.doubleSpinBoxVideoFPS->value() );
- QVariant projectHeight( ui.spinBoxVideoHeight->value() );
- QVariant projectWidth( ui.spinBoxVideoWidth->value() );
-
- sManager->setValue( "video/VLMCOutputFPS", projectFps, SettingsManager::Project );
- sManager->setValue( "video/VideoProjectHeight", projectHeight, SettingsManager::Project );
- sManager->setValue( "video/VideoProjectWidth", projectWidth, SettingsManager::Project );
-
return true;
}
More information about the Vlmc-devel
mailing list