Commit daf161ad authored by Clement CHAVANCE's avatar Clement CHAVANCE

Settings are now functionnals

parent 8b1a5ea8
......@@ -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()
......@@ -398,3 +404,8 @@ void MainWindow::toolButtonClicked( int id )
{
emit toolChanged( (ToolButtons)id );
}
void MainWindow::on_actionProject_Preferences_triggered()
{
m_projectPreferences->show();
}
......@@ -63,7 +63,7 @@ private:
void setupLibrary();
void createStatusBar();
void createGlobalPreferences();
void createProjectPreferences();
Ui::MainWindow m_ui;
MetaDataManager* m_metaDataManager;
......@@ -86,6 +86,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();
......
......@@ -43,13 +43,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,11 +68,8 @@ 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() ),
this,
SLOT( loadSettings() ) );
int idx = m_stackedWidgets->indexOf( pWidget );
m_widgets.insert( idx, name );
......@@ -175,6 +176,10 @@ void Settings::switchWidget( int widget )
emit widgetSwitched( widget );
}
void Settings::loadSettings()
void Settings::load()
{
qDebug() << "Pwid size :" << m_pWidgets.size();
PreferenceWidget* pwidg;
foreach( pwidg, m_pWidgets )
pwidg->load();
}
......@@ -67,7 +67,7 @@ class Settings : public QDialog
public slots:
void switchWidget( int widget );
void loadSettings();
void load();
private slots:
void buttonClicked( QAbstractButton* button );
......
......@@ -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();
......
......@@ -27,7 +27,7 @@
<x>0</x>
<y>0</y>
<width>800</width>
<height>21</height>
<height>24</height>
</rect>
</property>
<widget class="QMenu" name="menuFile">
......@@ -45,6 +45,7 @@
<string>Edit</string>
</property>
<addaction name="actionPreferences"/>
<addaction name="actionProject_Preferences"/>
</widget>
<widget class="QMenu" name="menuView">
<property name="title">
......@@ -177,6 +178,11 @@
<string>Save</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