Commit 979db9ad authored by Hugo Beauzee-Luyssen's avatar Hugo Beauzee-Luyssen

Preferences: Double value widget are autogenerated

parent 6e58f38a
......@@ -43,6 +43,7 @@ SET(VLMC_SRCS
Gui/library/MediaListViewController.cpp
Gui/library/StackViewController.cpp
Gui/library/StackViewNavController.cpp
Gui/settings/DoubleWidget.cpp
Gui/settings/IntWidget.cpp
Gui/settings/KeyboardShortcut.cpp
Gui/settings/KeyboardShortcutInput.cpp
......@@ -128,6 +129,7 @@ SET (VLMC_HDRS
Gui/MainWindow.h
Gui/PreviewRuler.h
Gui/PreviewWidget.h
Gui/settings/DoubleWidget.h
Gui/settings/IntWidget.h
Gui/settings/ISettingsCategorieWidget.h
Gui/settings/KeyboardShortcut.h
......
/*****************************************************************************
* DoubleWidget.cpp Handle double and float settings.
*****************************************************************************
* Copyright (C) 2008-2010 VideoLAN
*
* Authors: Hugo Beauzée-Luyssen <hugo@vlmc.org>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#include "DoubleWidget.h"
#include "SettingValue.h"
#include <QDoubleSpinBox>
DoubleWidget::DoubleWidget( SettingValue *s, QWidget *parent /*= NULL*/ ) :
m_setting( s )
{
m_spinbox = new QDoubleSpinBox( parent );
m_spinbox->setValue( s->get().toInt() );
}
QWidget*
DoubleWidget::widget()
{
return m_spinbox;
}
void
DoubleWidget::save()
{
m_setting->set( m_spinbox->value() );
}
/*****************************************************************************
* DoubleWidget.cpp Handle double and float settings.
*****************************************************************************
* Copyright (C) 2008-2010 VideoLAN
*
* Authors: Hugo Beauzée-Luyssen <hugo@vlmc.org>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#ifndef DOUBLEWIDGET_H
#define DOUBLEWIDGET_H
#include "ISettingsCategorieWidget.h"
#include <stddef.h>
class SettingValue;
class QDoubleSpinBox;
class DoubleWidget : public ISettingsCategorieWidget
{
public:
DoubleWidget( SettingValue *s, QWidget *parent = NULL );
QWidget* widget();
void save();
private:
SettingValue *m_setting;
QDoubleSpinBox *m_spinbox;
};
#endif // DOUBLEWIDGET_H
......@@ -28,18 +28,18 @@
IntWidget::IntWidget( SettingValue *s, QWidget *parent /*= NULL*/ ) :
m_setting( s )
{
m_lineEdit = new QSpinBox( parent );
m_lineEdit->setValue( s->get().toInt() );
m_spinbox = new QSpinBox( parent );
m_spinbox->setValue( s->get().toInt() );
}
QWidget*
IntWidget::widget()
{
return m_lineEdit;
return m_spinbox;
}
void
IntWidget::save()
{
m_setting->set( m_lineEdit->value() );
m_setting->set( m_spinbox->value() );
}
......@@ -39,7 +39,7 @@ class IntWidget : public ISettingsCategorieWidget
private:
SettingValue *m_setting;
QSpinBox *m_lineEdit;
QSpinBox *m_spinbox;
};
#endif // INTWIDGET_H
......@@ -30,6 +30,7 @@
#include "LanguageWidget.h"
#include "StringWidget.h"
#include "IntWidget.h"
#include "DoubleWidget.h"
#include <QFormLayout>
#include <QtDebug>
......@@ -72,6 +73,8 @@ PreferenceWidget::widgetFactory( SettingValue *s )
return new StringWidget( s, this );
case SettingValue::Int:
return new IntWidget( s, this );
case SettingValue::Double:
return new DoubleWidget( s, this );
default:
return NULL;
}
......
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