Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
VideoLAN
VLMC
Commits
2b830399
Commit
2b830399
authored
Feb 21, 2010
by
Hugo Beauzee-Luyssen
Browse files
Preferences: Boolean value widget are autogenerated.
parent
979db9ad
Changes
5
Hide whitespace changes
Inline
Side-by-side
src/CMakeLists.txt
View file @
2b830399
...
...
@@ -43,6 +43,7 @@ SET(VLMC_SRCS
Gui/library/MediaListViewController.cpp
Gui/library/StackViewController.cpp
Gui/library/StackViewNavController.cpp
Gui/settings/BoolWidget.cpp
Gui/settings/DoubleWidget.cpp
Gui/settings/IntWidget.cpp
Gui/settings/KeyboardShortcut.cpp
...
...
@@ -129,6 +130,7 @@ SET (VLMC_HDRS
Gui/MainWindow.h
Gui/PreviewRuler.h
Gui/PreviewWidget.h
Gui/settings/BoolWidget.h
Gui/settings/DoubleWidget.h
Gui/settings/IntWidget.h
Gui/settings/ISettingsCategorieWidget.h
...
...
src/Gui/settings/BoolWidget.cpp
0 → 100644
View file @
2b830399
/*****************************************************************************
* BoolWidget.cpp Handle boolean 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
"BoolWidget.h"
#include
"SettingValue.h"
#include
<QCheckBox>
BoolWidget
::
BoolWidget
(
SettingValue
*
s
,
QWidget
*
parent
/*= NULL*/
)
:
m_setting
(
s
)
{
m_checkbox
=
new
QCheckBox
(
parent
);
m_checkbox
->
setChecked
(
s
->
get
().
toBool
()
);
}
QWidget
*
BoolWidget
::
widget
()
{
return
m_checkbox
;
}
void
BoolWidget
::
save
()
{
m_setting
->
set
(
m_checkbox
->
isChecked
()
);
}
src/Gui/settings/BoolWidget.h
0 → 100644
View file @
2b830399
/*****************************************************************************
* BoolWidget.h Handle boolean 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 BOOLWIDGET_H
#define BOOLWIDGET_H
#include
"ISettingsCategorieWidget.h"
#include
<stddef.h>
class
SettingValue
;
class
QCheckBox
;
class
BoolWidget
:
public
ISettingsCategorieWidget
{
public:
BoolWidget
(
SettingValue
*
s
,
QWidget
*
parent
=
NULL
);
QWidget
*
widget
();
void
save
();
private:
SettingValue
*
m_setting
;
QCheckBox
*
m_checkbox
;
};
#endif // BOOLWIDGET_H
src/Gui/settings/DoubleWidget.cpp
View file @
2b830399
...
...
@@ -29,7 +29,7 @@ DoubleWidget::DoubleWidget( SettingValue *s, QWidget *parent /*= NULL*/ ) :
m_setting
(
s
)
{
m_spinbox
=
new
QDoubleSpinBox
(
parent
);
m_spinbox
->
setValue
(
s
->
get
().
to
Int
()
);
m_spinbox
->
setValue
(
s
->
get
().
to
Double
()
);
}
QWidget
*
...
...
src/Gui/settings/PreferenceWidget.cpp
View file @
2b830399
...
...
@@ -26,11 +26,12 @@
#include
"PreferenceWidget.h"
#include
"SettingsManager.h"
#include
"BoolWidget.h"
#include
"DoubleWidget.h"
#include
"IntWidget.h"
#include
"KeyboardShortcut.h"
#include
"LanguageWidget.h"
#include
"StringWidget.h"
#include
"IntWidget.h"
#include
"DoubleWidget.h"
#include
<QFormLayout>
#include
<QtDebug>
...
...
@@ -48,13 +49,7 @@ PreferenceWidget::PreferenceWidget( const QString &categorie, SettingsManager::T
foreach
(
SettingValue
*
s
,
settings
.
values
()
)
{
ISettingsCategorieWidget
*
widget
=
widgetFactory
(
s
);
if
(
widget
==
NULL
)
layout
->
addRow
(
s
->
name
(),
new
QLabel
(
s
->
description
()
)
);
else
{
layout
->
addRow
(
s
->
name
(),
widget
->
widget
()
);
m_settings
.
push_back
(
widget
);
}
layout
->
addRow
(
s
->
name
(),
new
QLabel
(
s
->
description
()
)
);
}
setLayout
(
layout
);
...
...
@@ -75,8 +70,8 @@ PreferenceWidget::widgetFactory( SettingValue *s )
return
new
IntWidget
(
s
,
this
);
case
SettingValue
::
Double
:
return
new
DoubleWidget
(
s
,
this
);
default
:
return
NULL
;
case
SettingValue
::
Bool
:
return
new
BoolWidget
(
s
,
this
)
;
}
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment