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

The PreferenceWidget class is now functionnal

parent 00bef748
......@@ -36,6 +36,8 @@
#include "Transcode.h"
#include "FileBrowser.h"
#include "PreviewWidget.h"
#include "PreferenceWidget.h"
#include "ProjectPreferences.h"
MainWindow::MainWindow( QWidget *parent ) :
QMainWindow( parent ), m_renderer( NULL )
......@@ -163,15 +165,19 @@ void MainWindow::m_initializeDockWidgets( void )
void MainWindow::createGlobalPreferences()
{
m_globalPreferences = new SimplePreferences( );
m_globalPreferences->addWidget("language",
Preferences::instance(),
m_globalPreferences->addWidget("Project",
new ProjectPreferences,
"images/vlmc.png",
"Language");
//For debugging purpose
m_globalPreferences->addWidget("Test",
new QLabel("This is a test"),
"Project");
m_globalPreferences->addWidget("test",
new ProjectPreferences,
"images/vlmc.png",
"Test");
"Truc");
////For debugging purpose
//m_globalPreferences->addWidget("Test",
// new QLabel("This is a test"),
// "images/vlmc.png",
// "Test");
m_globalPreferences->build();
}
......
......@@ -34,3 +34,9 @@ QWidget* PreferenceWidget::widget() const
{
return ( m_widget );
}
void PreferenceWidget::setWidget( QWidget* widget )
{
m_widget = widget;
return ;
}
......@@ -24,18 +24,20 @@
#ifndef PREFERENCEWIDGET_H
#define PREFERENCEWIDGET_H
#include <QSettings>
#include <QWidget>
class PreferenceWidget
{
public:
PreferenceWidget( QWidget* widget );
PreferenceWidget( QWidget* widget = 0 );
virtual ~PreferenceWidget() {}
virtual bool load() = 0;
virtual bool save() = 0;
virtual void save( QSettings& settings ) = 0;
QWidget* widget() const;
void setWidget( QWidget* widget );
private:
QWidget* m_widget;
......
//DEBUG
#include <QtDebug>
//!DEBUG
#include "ui_ProjectPreferences.h"
#include "ProjectPreferences.h"
#include "PreferenceWidget.h"
ProjectPreferences::ProjectPreferences()
ProjectPreferences::ProjectPreferences( QWidget* parent )
: QWidget( parent )
{
this->setWidget( this );
m_ui.setupUi( this );
}
ProjectPreferences::~ProjectPreferences() { }
bool ProjectPreferences::load()
{
qDebug() << "Loading ProjectPreferences values";
return true;
}
void ProjectPreferences::save( QSettings& settings )
{
settings.beginGroup( "Project" );
settings.setValue( "outputFPS", m_ui.outputFPS->text() );
settings.setValue( "previewFPS", m_ui.previewFPS->text() );
settings.setValue( "trackNb", m_ui.tracksNb->text() );
settings.endGroup();
}
#ifndef PROJECTPREFERENCES_H
#define PROJECTPREFERENCES_H
#include <QSettings>
#include <QWidget>
#include "ui_ProjectPreferences.h"
#include "PreferenceWidget.h"
class ProjectPreferences : public PreferenceWidget
class ProjectPreferences : public QWidget, public PreferenceWidget
{
//Q_OBJECT
public:
ProjectPreferences( QWidget* parent = 0 );
~ProjectPreferences();
bool load();
bool save();
void save( QSettings& settings );
private:
Ui::ProjectPreferences m_ui;
};
......
......@@ -64,7 +64,6 @@ void SimplePreferences::addWidget( const QString& name,
const QString& icon,
const QString& label)
{
widget->setParent( this );
m_stackedWidgets->addWidget( pWidget->widget() );
int idx = m_stackedWidgets->indexOf( pWidget->widget() );
......@@ -74,7 +73,6 @@ void SimplePreferences::addWidget( const QString& name,
{
m_currentWidget = pWidget->widget();
}
m_pWidgets.append( pWidget );
}
void SimplePreferences::build()
......
......@@ -47,7 +47,10 @@ SOURCES += src/main.cpp \
src/API/ModuleManager.cpp \
src/WorkflowFileRenderer.cpp \
src/gui/SimplePreferences.cpp \
src/gui/Panel.cpp
src/gui/Panel.cpp \
src/gui/PreferenceWidget.cpp \
src/gui/ProjectPreferences.cpp
HEADERS += src/gui/MainWindow.h \
src/gui/DockWidgetManager.h \
src/gui/LibraryWidget.h \
......@@ -92,7 +95,9 @@ HEADERS += src/gui/MainWindow.h \
src/vlmc.h \
src/tools/Pool.hpp \
src/gui/SimplePreferences.h \
src/gui/Panel.h
src/gui/Panel.h \
src/gui/PreferenceWidget.h \
src/gui/ProjectPreferences.h
FORMS += src/gui/ui/MainWindow.ui \
src/gui/ui/PreviewWidget.ui \
src/gui/ui/LanguagePreferences.ui \
......@@ -101,7 +106,8 @@ FORMS += src/gui/ui/MainWindow.ui \
src/gui/ui/About.ui \
src/gui/ui/Transcode.ui \
src/gui/ui/FileBrowser.ui \
src/gui/ui/WorkflowFileRenderer.ui
src/gui/ui/WorkflowFileRenderer.ui \
src/gui/ui/ProjectPreferences.ui
FORMS +=
TRANSLATIONS = ts/vlmc_es.ts \
ts/vlmc_fr.ts \
......
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