Commit b707ab34 authored by Clement CHAVANCE's avatar Clement CHAVANCE Committed by Hugo Beauzee-Luyssen

Settings are now functionnals

parent 62e51d6f
......@@ -93,6 +93,7 @@ void SettingsManager::saveSettings( QDomDocument& xmlfile, QDomElement& root )
void SettingsManager::loadSettings( const QDomElement& settings )
{
qDebug() << "Loading settings";
if ( settings.isNull() == true || settings.tagName() != "settings" )
{
qWarning() << "Invalid settings node";
......
......@@ -35,6 +35,7 @@ AudioProjectPreferences::~AudioProjectPreferences() { }
void AudioProjectPreferences::load()
{
qDebug() << "Loading preferences : Audio";
int sampleRate = SettingsManager::getInstance()->getValue( "AudioSampleRate" ).toInt();
m_ui.SampleRate->setValue( sampleRate );
......
......@@ -60,6 +60,7 @@ MainWindow::MainWindow( QWidget *parent ) :
initializeDockWidgets();
createStatusBar();
createGlobalPreferences();
createProjectPreferences();
// Translations
connect( this, SIGNAL( translateDockWidgetTitle() ),
......@@ -293,6 +294,24 @@ void MainWindow::createGlobalPreferences()
m_globalPreferences->build();
}
void MainWindow::createProjectPreferences()
{
m_projectPreferences = new Settings( );
m_projectPreferences->addWidget("Project",
new ProjectPreferences,
"../images/vlmc.png",
"Project settings");
m_projectPreferences->addWidget("Video",
new VideoProjectPreferences,
"../images/scalable/video.svg",
"Video settings");
m_projectPreferences->addWidget("Audio",
new AudioProjectPreferences,
"../images/scalable/audio.svg",
"Audio settings");
m_projectPreferences->build();
}
//Private slots definition
void MainWindow::on_actionQuit_triggered()
......@@ -342,21 +361,8 @@ void MainWindow::on_actionNew_Project_triggered()
{
//TODO : clear the library, the timeline, and show the configuration box
//of the newly created project
m_projectPreferences = new Settings( );
m_projectPreferences->addWidget("Project",
new ProjectPreferences,
"../images/vlmc.png",
"Project settings");
m_projectPreferences->addWidget("Video",
new VideoProjectPreferences,
"../images/scalable/video.svg",
"Video settings");
m_projectPreferences->addWidget("Audio",
new AudioProjectPreferences,
"../images/scalable/audio.svg",
"Audio settings");
m_projectPreferences->build();
m_projectPreferences->exec();
m_projectPreferences->show();
}
void MainWindow::on_actionHelp_triggered()
......@@ -409,4 +415,9 @@ void MainWindow::on_actionBypass_effects_engine_toggled(bool toggled)
else
ee->disable();
return ;
}
void MainWindow::on_actionProject_Preferences_triggered()
{
m_projectPreferences->show();
}
......@@ -65,7 +65,7 @@ private:
void setupLibrary();
void createStatusBar();
void createGlobalPreferences();
void createProjectPreferences();
Ui::MainWindow m_ui;
MetaDataManager* m_metaDataManager;
......@@ -89,6 +89,7 @@ private slots:
void on_actionLoad_Project_triggered();
void on_actionSave_triggered();
void on_actionHelp_triggered();
void on_actionProject_Preferences_triggered();
void mediaListItemDoubleClicked( QListWidgetItem* );
void toolButtonClicked( int id );
......
......@@ -40,6 +40,7 @@ ProjectPreferences::~ProjectPreferences() { }
void ProjectPreferences::load()
{
qDebug() << "Loading preferences : Project";
QString Name = SettingsManager::getInstance()->getValue( "ProjectName" ).toString();
QString Dir = SettingsManager::getInstance()->getValue( "ProjectDirectory" ).toString();
......
......@@ -19,6 +19,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#include <QPushButton>
#include <QDialogButtonBox>
#include <QAbstractButton>
......@@ -43,13 +44,17 @@ Settings::Settings( QWidget* parent, Qt::WindowFlags f )
{
m_panel = new Panel( this );
m_stackedWidgets = new QStackedWidget( this );
connect( m_panel,
QObject::connect( m_panel,
SIGNAL( changePanel( int ) ),
SLOT( switchWidget( int ) ) );
QObject::connect( this,
SIGNAL( widgetSwitched( int ) ),
m_stackedWidgets,
SLOT( setCurrentIndex( int ) ));
QObject::connect( SettingsManager::getInstance(),
SIGNAL( settingsLoaded() ),
this,
SLOT( load() ) );
}
Settings::~Settings()
......@@ -64,6 +69,7 @@ void Settings::addWidget( const QString& name,
const QString& icon,
const QString& label )
{
qDebug() << "calling SettingsManager::addWidget()";
m_stackedWidgets->addWidget( pWidget );
QObject::connect( SettingsManager::getInstance(),
SIGNAL( settingsLoaded( const QHash<QString, QVariant>& ) ),
......@@ -177,4 +183,8 @@ void Settings::switchWidget( int widget )
void Settings::loadSettings( const QHash<QString, QVariant>& sett )
{
qDebug() << "Pwid size :" << m_pWidgets.size();
PreferenceWidget* pwidg;
foreach( pwidg, m_pWidgets )
pwidg->load();
}
......@@ -35,6 +35,7 @@ VLMCPreferences::~VLMCPreferences() { }
void VLMCPreferences::load()
{
qDebug() << "Loading Prefs : VLMC";
QString outputFPS = SettingsManager::getInstance()->getValue( "VLMCOutPutFPS" ).toString();
QString previewFPS = SettingsManager::getInstance()->getValue( "VLMCPreviewFPS" ).toString();
QString tracksNb = SettingsManager::getInstance()->getValue( "VLMCTracksNb" ).toString();
......
......@@ -35,6 +35,7 @@ VideoProjectPreferences::~VideoProjectPreferences() { }
void VideoProjectPreferences::load()
{
qDebug() << "Loading Prefs : VideoProject";
int projectFps = SettingsManager::getInstance()->getValue( "VideoProjectFPS" ).toInt();
int projectHeight = SettingsManager::getInstance()->getValue( "VideoProjectHeight" ).toInt();
int projectWidth = SettingsManager::getInstance()->getValue( "VideoProjectWidth" ).toInt();
......
......@@ -45,6 +45,7 @@
<string>Edit</string>
</property>
<addaction name="actionPreferences"/>
<addaction name="actionProject_Preferences"/>
</widget>
<widget class="QMenu" name="menuView">
<property name="title">
......@@ -189,6 +190,11 @@
<string>Enable effects engine</string>
</property>
</action>
<action name="actionProject_Preferences">
<property name="text">
<string>Project Preferences</string>
</property>
</action>
</widget>
<resources>
<include location="../../../ressources.qrc"/>
......
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