Commit 4e4725c8 authored by Clement CHAVANCE's avatar Clement CHAVANCE

Change of interface in PreferenceWidget.

The save method in PreferenceWidget now take a QHash<QString,QVariant>
instead of a QSettings.
parent 28d99da0
......@@ -38,9 +38,6 @@ bool AudioProjectPreferences::load()
return true;
}
void AudioProjectPreferences::save( QSettings& settings )
void AudioProjectPreferences::save( QHash<QString, QVariant>& settings )
{
settings.beginGroup( "Project" );
//settings.setValue( "outputFPS", m_ui.outputFPS->text() );
settings.endGroup();
}
......@@ -35,7 +35,7 @@ class AudioProjectPreferences : public PreferenceWidget
AudioProjectPreferences( QWidget *parent = 0 );
~AudioProjectPreferences();
bool load();
void save( QSettings& settings );
void save( QHash<QString, QVariant>& settings );
private:
Ui::AudioProjectPreferences m_ui;
};
......
......@@ -24,8 +24,11 @@
#ifndef PREFERENCEWIDGET_H
#define PREFERENCEWIDGET_H
#include <QSettings>
#include <QHash>
#include <QVariant>
#include <QString>
#include <QWidget>
#include <QVariant>
class PreferenceWidget : public QWidget
{
......@@ -34,7 +37,7 @@ class PreferenceWidget : public QWidget
virtual ~PreferenceWidget() {}
virtual bool load() = 0;
virtual void save( QSettings& settings ) = 0;
virtual void save( QHash<QString, QVariant>& settings ) = 0;
};
#endif
......@@ -43,9 +43,6 @@ bool ProjectPreferences::load()
return true;
}
void ProjectPreferences::save( QSettings& settings )
void ProjectPreferences::save( QHash<QString, QVariant>& settings )
{
settings.beginGroup( "Project" );
//settings.setValue( "outputFPS", m_ui.outputFPS->text() );
settings.endGroup();
}
......@@ -36,7 +36,7 @@ class ProjectPreferences : public PreferenceWidget
ProjectPreferences( QWidget* parent = 0 );
virtual ~ProjectPreferences();
bool load();
void save( QSettings& settings );
void save( QHash<QString, QVariant>& settings );
private:
Ui::ProjectPreferences m_ui;
};
......
......@@ -29,8 +29,10 @@
#include <QIcon>
#include <QLabel>
#include <QtDebug>
#include <QVariant>
#include "PreferenceWidget.h"
#include "SettingsManager.h"
#include "Settings.h"
#include "Panel.h"
......@@ -41,10 +43,14 @@ Settings::Settings( QWidget* parent, Qt::WindowFlags f )
{
m_panel = new Panel( this );
m_stackedWidgets = new QStackedWidget( this );
connect( m_panel, SIGNAL( changePanel( int ) ),
connect( m_panel,
SIGNAL( changePanel( int ) ),
SLOT( switchWidget( int ) ) );
QObject::connect( this, SIGNAL( widgetSwitched( int ) ),
m_stackedWidgets, SLOT( setCurrentIndex( int ) ));
QObject::connect( this,
SIGNAL( widgetSwitched( int ) ),
m_stackedWidgets,
SLOT( setCurrentIndex( int ) ));
m_settingsNumber = SettingsManager::getInstance()->createNewSettings();
}
Settings::~Settings()
......@@ -119,20 +125,36 @@ void Settings::save( void )
void Settings::buttonClicked( QAbstractButton* button )
{
bool save = false;
bool hide = false ;
switch ( m_buttons->standardButton( button ) )
{
case QDialogButtonBox::Ok :
qDebug() << "MOK";
save = true;
hide = true;
break;
case QDialogButtonBox::Cancel :
qDebug() << "Oh NOES";
hide = true;
break;
case QDialogButtonBox::Apply :
qDebug() << "Apply";
save = true;
break;
default :
break;
}
if ( save == true )
{
//Save Settings
QHash<QString, QVariant> sett;
PreferenceWidget* widg;
foreach( widg, m_pWidgets )
widg->save( sett );
}
if ( hide == true )
{
setVisible( false );
}
}
void Settings::switchWidget( int widget )
......
......@@ -65,6 +65,8 @@ class Settings : public QDialog
QDialogButtonBox* m_buttons;
bool m_saved;
int m_settingsNumber;
public slots:
void switchWidget( int widget );
......
......@@ -38,9 +38,6 @@ bool VLMCPreferences::load()
return true;
}
void VLMCPreferences::save( QSettings& settings )
void VLMCPreferences::save( QHash<QString, QVariant>& settings )
{
settings.beginGroup( "Project" );
//settings.setValue( "outputFPS", m_ui.outputFPS->text() );
settings.endGroup();
}
......@@ -35,7 +35,7 @@ class VLMCPreferences : public PreferenceWidget
VLMCPreferences( QWidget *parent = 0 );
~VLMCPreferences();
bool load();
void save( QSettings& settings );
void save( QHash<QString, QVariant>& settings );
private:
Ui::VLMCPreferences m_ui;
};
......
......@@ -38,9 +38,6 @@ bool VideoProjectPreferences::load()
return true;
}
void VideoProjectPreferences::save( QSettings& settings )
void VideoProjectPreferences::save( QHash<QString, QVariant>& settings )
{
settings.beginGroup( "Project" );
//settings.setValue( "outputFPS", m_ui.outputFPS->text() );
settings.endGroup();
}
......@@ -35,7 +35,7 @@ class VideoProjectPreferences : public PreferenceWidget
VideoProjectPreferences( QWidget *parent = 0 );
~VideoProjectPreferences();
bool load();
void save( QSettings& settings );
void save( QHash<QString, QVariant>& settings );
private:
Ui::VideoProjectPreferences m_ui;
};
......
......@@ -63,7 +63,8 @@ SOURCES += src/main.cpp \
src/GUI/AudioProjectPreferences.cpp \
src/GUI/VLMCPreferences.cpp \
src/GUI/VideoProjectPreferences.cpp \
src/Project/ProjectManager.cpp
src/Project/ProjectManager.cpp \
src/Configuration/SettingsManager.cpp
HEADERS += src/GUI/MainWindow.h \
src/GUI/DockWidgetManager.h \
src/GUI/LibraryWidget.h \
......@@ -119,7 +120,8 @@ HEADERS += src/GUI/MainWindow.h \
src/GUI/VLMCPreferences.h \
src/GUI/AudioProjectPreferences.h \
src/GUI/VideoProjectPreferences.h \
src/Project/ProjectManager.h
src/Project/ProjectManager.h \
src/Configuration/SettingsManager.h
FORMS += src/GUI/ui/MainWindow.ui \
src/GUI/ui/PreviewWidget.ui \
src/GUI/ui/LanguagePreferences.ui \
......@@ -148,6 +150,7 @@ INCLUDEPATH += src/LibVLCpp \
src/Library \
src/Media \
src/Project \
src/Configuration \
src
# QMAKE_CFLAGS+=-pg
......
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