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
e74c516f
Commit
e74c516f
authored
Oct 26, 2010
by
Hugo Beauzée-Luyssen
Browse files
Settings: Simplifications
parent
01f29963
Changes
21
Hide whitespace changes
Inline
Side-by-side
src/Gui/effectsengine/EffectInstanceWidget.cpp
View file @
e74c516f
...
...
@@ -61,9 +61,9 @@ EffectInstanceWidget::setEffectInstance( EffectInstance *instance )
ISettingsCategoryWidget
*
widget
=
widgetFactory
(
s
);
QLabel
*
label
=
new
QLabel
(
tr
(
s
->
name
()
),
this
);
m_widgets
.
push_back
(
label
);
m_widgets
.
push_back
(
widget
->
widget
()
);
widget
->
widget
()
->
setToolTip
(
s
->
description
()
);
m_ui
->
settingsLayout
->
addRow
(
label
,
widget
->
widget
()
);
m_widgets
.
push_back
(
widget
);
widget
->
setToolTip
(
s
->
description
()
);
m_ui
->
settingsLayout
->
addRow
(
label
,
widget
);
m_settings
.
push_back
(
widget
);
++
it
;
}
...
...
src/Gui/settings/BoolWidget.cpp
View file @
e74c516f
...
...
@@ -26,18 +26,13 @@
#include
<QCheckBox>
BoolWidget
::
BoolWidget
(
SettingValue
*
s
,
QWidget
*
parent
/*= NULL*/
)
:
ISettingsCategoryWidget
(
s
)
ISettingsCategoryWidget
(
parent
,
s
)
{
m_checkbox
=
new
QCheckBox
(
parent
);
m_checkbox
=
new
QCheckBox
(
this
);
layout
()
->
addWidget
(
m_checkbox
);
changed
(
s
->
get
()
);
}
QWidget
*
BoolWidget
::
widget
()
{
return
m_checkbox
;
}
void
BoolWidget
::
save
()
{
...
...
src/Gui/settings/BoolWidget.h
View file @
e74c516f
...
...
@@ -36,7 +36,6 @@ class BoolWidget : public ISettingsCategoryWidget
public:
BoolWidget
(
SettingValue
*
s
,
QWidget
*
parent
=
NULL
);
QWidget
*
widget
();
void
save
();
private
slots
:
...
...
src/Gui/settings/ColorWidget.cpp
View file @
e74c516f
...
...
@@ -28,21 +28,16 @@
#include
<QPushButton>
ColorWidget
::
ColorWidget
(
SettingValue
*
s
,
QWidget
*
parent
)
:
ISettingsCategoryWidget
(
s
)
ISettingsCategoryWidget
(
parent
,
s
)
{
m_color
=
s
->
get
().
value
<
QColor
>
();
m_button
=
new
QPushButton
(
parent
);
m_button
=
new
QPushButton
(
this
);
m_button
->
setPalette
(
QPalette
(
m_color
)
);
layout
()
->
addWidget
(
m_button
);
connect
(
m_button
,
SIGNAL
(
clicked
()
),
this
,
SLOT
(
buttonClicked
()
)
);
changed
(
m_color
);
}
QWidget
*
ColorWidget
::
widget
()
{
return
m_button
;
}
void
ColorWidget
::
save
()
{
...
...
src/Gui/settings/ColorWidget.h
View file @
e74c516f
...
...
@@ -36,7 +36,6 @@ class ColorWidget : public ISettingsCategoryWidget
public:
ColorWidget
(
SettingValue
*
s
,
QWidget
*
parent
=
NULL
);
QWidget
*
widget
();
void
save
();
private
slots
:
...
...
src/Gui/settings/DoubleSliderWidget.cpp
View file @
e74c516f
...
...
@@ -29,21 +29,19 @@
#include
<QSlider>
DoubleSliderWidget
::
DoubleSliderWidget
(
SettingValue
*
s
,
QWidget
*
parent
/*= NULL*/
)
:
ISettingsCategoryWidget
(
s
)
ISettingsCategoryWidget
(
parent
,
s
)
{
m_container
=
new
QWidget
(
parent
);
//Creating the slider
m_slider
=
new
QSlider
(
m_container
);
m_slider
=
new
QSlider
(
this
);
m_slider
->
setOrientation
(
Qt
::
Horizontal
);
//Creating the label
m_valueDisplayer
=
new
QLabel
(
QString
::
number
(
s
->
get
().
toDouble
()
),
m_container
);
m_valueDisplayer
=
new
QLabel
(
QString
::
number
(
s
->
get
().
toDouble
()
),
this
);
//Avoid label resizing due to roundups
const
QFontMetrics
&
fm
=
m_valueDisplayer
->
fontMetrics
();
m_valueDisplayer
->
setFixedWidth
(
fm
.
width
(
"0.00"
)
);
//Setting the layout:
QHBoxLayout
*
layout
=
new
QHBoxLayout
(
m_container
);
layout
->
addWidget
(
m_slider
);
layout
->
addWidget
(
m_valueDisplayer
);
layout
()
->
addWidget
(
m_slider
);
layout
()
->
addWidget
(
m_valueDisplayer
);
//TODO: check if the value is clamped
m_slider
->
setMaximum
(
s
->
max
().
toDouble
()
*
100.0
);
m_slider
->
setMinimum
(
s
->
min
().
toDouble
()
*
100.0
);
...
...
@@ -51,12 +49,6 @@ DoubleSliderWidget::DoubleSliderWidget( SettingValue *s, QWidget *parent /*= NUL
connect
(
m_slider
,
SIGNAL
(
valueChanged
(
int
)
),
this
,
SLOT
(
sliderMoved
(
int
)
)
);
}
QWidget
*
DoubleSliderWidget
::
widget
()
{
return
m_container
;
}
void
DoubleSliderWidget
::
save
()
{
...
...
src/Gui/settings/DoubleSliderWidget.h
View file @
e74c516f
...
...
@@ -36,12 +36,10 @@ class DoubleSliderWidget : public ISettingsCategoryWidget
public:
DoubleSliderWidget
(
SettingValue
*
s
,
QWidget
*
parent
=
NULL
);
QWidget
*
widget
();
void
save
();
private:
QSlider
*
m_slider
;
QWidget
*
m_container
;
QLabel
*
m_valueDisplayer
;
private
slots
:
...
...
src/Gui/settings/DoubleWidget.cpp
View file @
e74c516f
...
...
@@ -26,9 +26,10 @@
#include
<QDoubleSpinBox>
DoubleWidget
::
DoubleWidget
(
SettingValue
*
s
,
QWidget
*
parent
/*= NULL*/
)
:
ISettingsCategoryWidget
(
s
)
ISettingsCategoryWidget
(
parent
,
s
)
{
m_spinbox
=
new
QDoubleSpinBox
(
parent
);
m_spinbox
=
new
QDoubleSpinBox
(
this
);
layout
()
->
addWidget
(
m_spinbox
);
changed
(
s
->
get
()
);
if
(
(
s
->
flags
()
&
SettingValue
::
Clamped
)
!=
0
)
...
...
@@ -40,12 +41,6 @@ DoubleWidget::DoubleWidget( SettingValue *s, QWidget *parent /*= NULL*/ ) :
}
}
QWidget
*
DoubleWidget
::
widget
()
{
return
m_spinbox
;
}
void
DoubleWidget
::
save
()
{
...
...
src/Gui/settings/DoubleWidget.h
View file @
e74c516f
...
...
@@ -36,7 +36,6 @@ class DoubleWidget : public ISettingsCategoryWidget
public:
DoubleWidget
(
SettingValue
*
s
,
QWidget
*
parent
=
NULL
);
QWidget
*
widget
();
void
save
();
private
slots
:
...
...
src/Gui/settings/ISettingsCategoryWidget.h
View file @
e74c516f
...
...
@@ -27,25 +27,28 @@
#include
"SettingValue.h"
class
QVariant
;
class
QWidget
;
#include
<QObject>
#include
<QWidget>
#include
<QHBoxLayout>
class
ISettingsCategoryWidget
:
public
Q
Objec
t
class
ISettingsCategoryWidget
:
public
Q
Widge
t
{
Q_OBJECT
public:
virtual
~
ISettingsCategoryWidget
(){}
virtual
SettingValue
*
setting
()
{
return
m_setting
;
}
virtual
QWidget
*
widget
()
=
0
;
virtual
void
save
()
=
0
;
protected:
ISettingsCategoryWidget
(
SettingValue
*
s
)
:
m_setting
(
s
)
ISettingsCategoryWidget
(
QWidget
*
parent
,
SettingValue
*
s
)
:
QWidget
(
parent
),
m_setting
(
s
)
{
connect
(
s
,
SIGNAL
(
changed
(
const
QVariant
&
)
),
this
,
SLOT
(
changed
(
const
QVariant
&
)
)
);
QHBoxLayout
*
layout
=
new
QHBoxLayout
;
setLayout
(
layout
);
}
protected:
...
...
src/Gui/settings/IntWidget.cpp
View file @
e74c516f
...
...
@@ -26,9 +26,9 @@
#include
<QSpinBox>
IntWidget
::
IntWidget
(
SettingValue
*
s
,
QWidget
*
parent
/*= NULL*/
)
:
ISettingsCategoryWidget
(
s
)
ISettingsCategoryWidget
(
parent
,
s
)
{
m_spinbox
=
new
QSpinBox
(
parent
);
m_spinbox
=
new
QSpinBox
(
this
);
if
(
(
s
->
flags
()
&
SettingValue
::
Clamped
)
!=
0
)
{
if
(
s
->
min
().
isValid
()
)
...
...
@@ -40,15 +40,10 @@ IntWidget::IntWidget( SettingValue *s, QWidget *parent /*= NULL*/ ) :
{
m_spinbox
->
setSingleStep
(
8
);
}
layout
()
->
addWidget
(
m_spinbox
);
changed
(
s
->
get
()
);
}
QWidget
*
IntWidget
::
widget
()
{
return
m_spinbox
;
}
void
IntWidget
::
save
()
{
...
...
src/Gui/settings/IntWidget.h
View file @
e74c516f
...
...
@@ -36,7 +36,6 @@ class IntWidget : public ISettingsCategoryWidget
public:
IntWidget
(
SettingValue
*
s
,
QWidget
*
parent
=
NULL
);
QWidget
*
widget
();
void
save
();
private
slots
:
...
...
src/Gui/settings/KeyboardShortcut.cpp
View file @
e74c516f
...
...
@@ -25,15 +25,10 @@
#include
"SettingValue.h"
KeyboardShortcut
::
KeyboardShortcut
(
SettingValue
*
s
,
QWidget
*
parent
/*= NULL*/
)
:
ISettingsCategoryWidget
(
s
)
ISettingsCategoryWidget
(
parent
,
s
)
{
m_input
=
new
KeyboardShortcutInput
(
s
->
name
(),
s
->
get
().
toString
(),
parent
);
}
QWidget
*
KeyboardShortcut
::
widget
()
{
return
m_input
;
m_input
=
new
KeyboardShortcutInput
(
s
->
name
(),
s
->
get
().
toString
(),
this
);
layout
()
->
addWidget
(
m_input
);
}
void
...
...
src/Gui/settings/KeyboardShortcut.h
View file @
e74c516f
...
...
@@ -35,7 +35,6 @@ class KeyboardShortcut : public ISettingsCategoryWidget
public:
KeyboardShortcut
(
SettingValue
*
s
,
QWidget
*
parent
=
NULL
);
QWidget
*
widget
();
void
save
();
private
slots
:
...
...
src/Gui/settings/LanguageWidget.cpp
View file @
e74c516f
...
...
@@ -34,9 +34,9 @@
#define TS_PREFIX "vlmc_"
LanguageWidget
::
LanguageWidget
(
SettingValue
*
s
,
QWidget
*
parent
/*= NULL*/
)
:
ISettingsCategoryWidget
(
s
)
ISettingsCategoryWidget
(
parent
,
s
)
{
m_list
=
new
QComboBox
(
parent
);
m_list
=
new
QComboBox
(
this
);
QDir
dir
(
":/ts/"
,
"*.qm"
,
QDir
::
Name
|
QDir
::
IgnoreCase
,
QDir
::
Files
);
foreach
(
const
QString
&
tsFileName
,
dir
.
entryList
()
)
...
...
@@ -74,16 +74,10 @@ LanguageWidget::LanguageWidget( SettingValue *s, QWidget *parent /*= NULL*/ ) :
// Add the system default option (auto-detection of the locale)
m_list
->
insertItem
(
0
,
"System Locale (autodetect)"
,
"default"
);
layout
()
->
addWidget
(
m_list
);
changed
(
s
->
get
()
);
}
QWidget
*
LanguageWidget
::
widget
()
{
return
m_list
;
}
void
LanguageWidget
::
save
()
{
...
...
src/Gui/settings/LanguageWidget.h
View file @
e74c516f
...
...
@@ -36,7 +36,6 @@ class LanguageWidget : public ISettingsCategoryWidget
public:
LanguageWidget
(
SettingValue
*
s
,
QWidget
*
parent
=
NULL
);
QWidget
*
widget
();
void
save
();
private
slots
:
...
...
src/Gui/settings/PathWidget.cpp
View file @
e74c516f
...
...
@@ -24,32 +24,22 @@
#include
"SettingValue.h"
#include
<QFileDialog>
#include
<QHBoxLayout>
#include
<QLineEdit>
#include
<QPushButton>
PathWidget
::
PathWidget
(
SettingValue
*
s
,
QWidget
*
parent
/*= NULL*/
)
:
ISettingsCategoryWidget
(
s
)
ISettingsCategoryWidget
(
parent
,
s
)
{
m_widget
=
new
QWidget
(
parent
);
QHBoxLayout
*
layout
=
new
QHBoxLayout
;
m_lineEdit
=
new
QLineEdit
(
m_widget
);
m_pushButton
=
new
QPushButton
(
m_widget
);
m_lineEdit
=
new
QLineEdit
(
this
);
m_pushButton
=
new
QPushButton
(
this
);
m_pushButton
->
setText
(
tr
(
"Select a path"
)
);
layout
->
addWidget
(
m_lineEdit
);
layout
->
addWidget
(
m_pushButton
);
m_widget
->
setLayout
(
layout
);
layout
()
->
addWidget
(
m_lineEdit
);
layout
()
->
addWidget
(
m_pushButton
);
changed
(
s
->
get
()
);
connect
(
m_pushButton
,
SIGNAL
(
clicked
()
),
this
,
SLOT
(
selectPathButtonPressed
()
)
);
}
QWidget
*
PathWidget
::
widget
()
{
return
m_widget
;
}
void
PathWidget
::
save
()
{
...
...
src/Gui/settings/PathWidget.h
View file @
e74c516f
...
...
@@ -37,7 +37,6 @@ class PathWidget : public ISettingsCategoryWidget
public:
PathWidget
(
SettingValue
*
s
,
QWidget
*
parent
=
NULL
);
QWidget
*
widget
();
void
save
();
private
slots
:
...
...
src/Gui/settings/PreferenceWidget.cpp
View file @
e74c516f
...
...
@@ -63,8 +63,8 @@ PreferenceWidget::PreferenceWidget( const QString &name, const char *label, Sett
QLabel
*
label
=
new
QLabel
(
tr
(
s
->
name
()
),
this
);
label
->
setToolTip
(
tr
(
s
->
description
()
)
);
m_labels
.
insert
(
s
,
label
);
widget
->
widget
()
->
setToolTip
(
s
->
description
()
);
layout
->
addRow
(
label
,
widget
->
widget
()
);
widget
->
setToolTip
(
s
->
description
()
);
layout
->
addRow
(
label
,
widget
);
m_settings
.
push_back
(
widget
);
}
...
...
src/Gui/settings/StringWidget.cpp
View file @
e74c516f
...
...
@@ -26,20 +26,15 @@
#include
<QLineEdit>
StringWidget
::
StringWidget
(
SettingValue
*
s
,
QWidget
*
parent
/*= NULL*/
)
:
ISettingsCategoryWidget
(
s
)
ISettingsCategoryWidget
(
parent
,
s
)
{
m_lineEdit
=
new
QLineEdit
(
parent
);
m_lineEdit
=
new
QLineEdit
(
this
);
if
(
(
s
->
flags
()
&
SettingValue
::
Password
)
!=
0
)
m_lineEdit
->
setEchoMode
(
QLineEdit
::
Password
);
layout
()
->
addWidget
(
m_lineEdit
);
changed
(
s
->
get
()
);
}
QWidget
*
StringWidget
::
widget
()
{
return
m_lineEdit
;
}
void
StringWidget
::
save
()
{
...
...
Prev
1
2
Next
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