Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-2-2
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
videolan
vlc-2-2
Commits
cfaa0cb3
Commit
cfaa0cb3
authored
Aug 27, 2006
by
Clément Stenac
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improved layout for preferences
parent
21ab0e41
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
129 additions
and
56 deletions
+129
-56
modules/gui/qt4/components/preferences.cpp
modules/gui/qt4/components/preferences.cpp
+28
-16
modules/gui/qt4/components/preferences_widgets.cpp
modules/gui/qt4/components/preferences_widgets.cpp
+77
-33
modules/gui/qt4/components/preferences_widgets.hpp
modules/gui/qt4/components/preferences_widgets.hpp
+24
-7
No files found.
modules/gui/qt4/components/preferences.cpp
View file @
cfaa0cb3
...
...
@@ -46,6 +46,7 @@
#include <QScrollArea>
#include <QVBoxLayout>
#include <QHBoxLayout>
#include <QGridLayout>
#include <QHeaderView>
#define ITEM_HEIGHT 25
...
...
@@ -414,13 +415,14 @@ PrefsPanel::PrefsPanel( intf_thread_t *_p_intf, QWidget *_parent,
global_layout
->
addWidget
(
help
);
QGroupBox
*
box
=
NULL
;
Q
VBox
Layout
*
boxlayout
=
NULL
;
Q
Grid
Layout
*
boxlayout
=
NULL
;
QScrollArea
*
scroller
=
new
QScrollArea
;
scroller
->
setFrameStyle
(
QFrame
::
NoFrame
);
QWidget
*
scrolled_area
=
new
QWidget
;
QVBoxLayout
*
layout
=
new
QVBoxLayout
();
QGridLayout
*
layout
=
new
QGridLayout
();
int
i_line
=
0
,
i_boxline
=
0
;
if
(
p_item
)
do
{
...
...
@@ -438,24 +440,29 @@ PrefsPanel::PrefsPanel( intf_thread_t *_p_intf, QWidget *_parent,
if
(
box
)
{
box
->
setLayout
(
boxlayout
);
layout
->
addWidget
(
box
,
1
);
layout
->
addWidget
(
box
,
i_line
,
0
,
1
,
2
);
i_line
++
;
}
box
=
new
QGroupBox
(
qfu
(
p_item
->
psz_text
)
);
boxlayout
=
new
QVBoxLayout
();
boxlayout
=
new
QGridLayout
();
}
ConfigControl
*
control
;
if
(
!
box
)
{
control
=
ConfigControl
::
createControl
(
VLC_OBJECT
(
p_intf
),
p_item
,
NULL
,
layout
,
i_line
);
}
else
{
control
=
ConfigControl
::
createControl
(
VLC_OBJECT
(
p_intf
),
p_item
,
NULL
,
boxlayout
,
i_boxline
);
}
ConfigControl
*
control
=
ConfigControl
::
createControl
(
VLC_OBJECT
(
p_intf
),
p_item
,
NULL
);
if
(
!
control
)
{
continue
;
}
if
(
!
box
)
layout
->
addWidget
(
control
->
getWidget
()
);
else
boxlayout
->
addWidget
(
control
->
getWidget
()
);
if
(
box
)
i_boxline
++
;
else
i_line
++
;
controls
.
append
(
control
);
}
while
(
!
(
p_item
->
i_type
==
CONFIG_HINT_END
||
...
...
@@ -467,7 +474,7 @@ PrefsPanel::PrefsPanel( intf_thread_t *_p_intf, QWidget *_parent,
if
(
box
)
{
box
->
setLayout
(
boxlayout
);
layout
->
addWidget
(
box
,
1
);
layout
->
addWidget
(
box
,
i_line
,
0
,
1
,
2
);
}
vlc_object_release
(
p_module
);
...
...
@@ -527,8 +534,13 @@ void PrefsPanel::setAdvanced( bool adv, bool force )
{
if
(
(
*
i
)
->
isAdvanced
()
)
{
if
(
!
advanced
)
some_hidden
=
true
;
(
*
i
)
->
getWidget
()
->
setVisible
(
advanced
);
if
(
!
advanced
)
{
some_hidden
=
true
;
(
*
i
)
->
hide
();
}
else
(
*
i
)
->
show
();
}
}
if
(
some_hidden_text
)
...
...
modules/gui/qt4/components/preferences_widgets.cpp
View file @
cfaa0cb3
...
...
@@ -38,10 +38,19 @@
#include <QDoubleSpinBox>
#include <QVariant>
#include <QComboBox>
#include <QGridLayout>
ConfigControl
*
ConfigControl
::
createControl
(
vlc_object_t
*
p_this
,
module_config_t
*
p_item
,
QWidget
*
parent
)
{
return
createControl
(
p_this
,
p_item
,
parent
,
NULL
,
0
);
}
ConfigControl
*
ConfigControl
::
createControl
(
vlc_object_t
*
p_this
,
module_config_t
*
p_item
,
QWidget
*
parent
,
QGridLayout
*
l
,
int
line
)
{
ConfigControl
*
p_control
=
NULL
;
if
(
p_item
->
psz_current
)
return
NULL
;
...
...
@@ -49,14 +58,17 @@ ConfigControl *ConfigControl::createControl( vlc_object_t *p_this,
switch
(
p_item
->
i_type
)
{
case
CONFIG_ITEM_MODULE
:
p_control
=
new
ModuleConfigControl
(
p_this
,
p_item
,
parent
,
false
);
p_control
=
new
ModuleConfigControl
(
p_this
,
p_item
,
parent
,
false
,
l
,
line
);
break
;
case
CONFIG_ITEM_MODULE_CAT
:
p_control
=
new
ModuleConfigControl
(
p_this
,
p_item
,
parent
,
true
);
p_control
=
new
ModuleConfigControl
(
p_this
,
p_item
,
parent
,
true
,
l
,
line
);
break
;
case
CONFIG_ITEM_STRING
:
if
(
!
p_item
->
i_list
)
p_control
=
new
StringConfigControl
(
p_this
,
p_item
,
parent
,
false
);
p_control
=
new
StringConfigControl
(
p_this
,
p_item
,
parent
,
l
,
line
,
false
);
else
fprintf
(
stderr
,
"TODO
\n
"
);
break
;
...
...
@@ -66,7 +78,8 @@ ConfigControl *ConfigControl::createControl( vlc_object_t *p_this,
else
if
(
p_item
->
i_min
||
p_item
->
i_max
)
fprintf
(
stderr
,
"Todo
\n
"
);
else
p_control
=
new
IntegerConfigControl
(
p_this
,
p_item
,
parent
);
p_control
=
new
IntegerConfigControl
(
p_this
,
p_item
,
parent
,
l
,
line
);
break
;
default:
break
;
...
...
@@ -81,28 +94,37 @@ ConfigControl *ConfigControl::createControl( vlc_object_t *p_this,
/*********** String **************/
StringConfigControl
::
StringConfigControl
(
vlc_object_t
*
_p_this
,
module_config_t
*
_p_item
,
QWidget
*
_parent
,
bool
pwd
)
:
QWidget
*
_parent
,
QGridLayout
*
l
,
int
line
,
bool
pwd
)
:
VStringConfigControl
(
_p_this
,
_p_item
,
_parent
)
{
QLabel
*
label
=
new
QLabel
(
qfu
(
p_item
->
psz_text
)
);
label
=
new
QLabel
(
qfu
(
p_item
->
psz_text
)
);
text
=
new
QLineEdit
(
qfu
(
p_item
->
psz_value
)
);
finish
(
label
);
finish
();
if
(
!
l
)
{
QHBoxLayout
*
layout
=
new
QHBoxLayout
();
layout
->
addWidget
(
label
,
0
);
layout
->
addWidget
(
text
,
1
);
widget
->
setLayout
(
layout
);
}
else
{
l
->
addWidget
(
label
,
line
,
0
);
l
->
addWidget
(
text
,
line
,
1
);
}
}
StringConfigControl
::
StringConfigControl
(
vlc_object_t
*
_p_this
,
module_config_t
*
_p_item
,
QLabel
*
label
,
QLineEdit
*
_text
,
bool
pwd
)
:
QLabel
*
_
label
,
QLineEdit
*
_text
,
bool
pwd
)
:
VStringConfigControl
(
_p_this
,
_p_item
)
{
text
=
_text
;
finish
(
label
);
label
=
_label
;
finish
(
);
}
void
StringConfigControl
::
finish
(
QLabel
*
label
)
void
StringConfigControl
::
finish
()
{
text
->
setText
(
qfu
(
p_item
->
psz_value
)
);
text
->
setToolTip
(
qfu
(
p_item
->
psz_longtext
)
);
...
...
@@ -111,25 +133,35 @@ void StringConfigControl::finish( QLabel *label )
/********* Module **********/
ModuleConfigControl
::
ModuleConfigControl
(
vlc_object_t
*
_p_this
,
module_config_t
*
_p_item
,
QWidget
*
_parent
,
bool
bycat
)
:
VStringConfigControl
(
_p_this
,
_p_item
,
_parent
)
module_config_t
*
_p_item
,
QWidget
*
_parent
,
bool
bycat
,
QGridLayout
*
l
,
int
line
)
:
VStringConfigControl
(
_p_this
,
_p_item
,
_parent
)
{
QLabel
*
label
=
new
QLabel
(
qfu
(
p_item
->
psz_text
)
);
label
=
new
QLabel
(
qfu
(
p_item
->
psz_text
)
);
combo
=
new
QComboBox
();
finish
(
label
,
bycat
);
finish
(
bycat
);
if
(
!
l
)
{
QHBoxLayout
*
layout
=
new
QHBoxLayout
();
layout
->
addWidget
(
label
);
layout
->
addWidget
(
combo
);
widget
->
setLayout
(
layout
);
}
else
{
l
->
addWidget
(
label
,
line
,
0
);
l
->
addWidget
(
combo
,
line
,
1
,
Qt
::
AlignRight
);
}
}
ModuleConfigControl
::
ModuleConfigControl
(
vlc_object_t
*
_p_this
,
module_config_t
*
_p_item
,
QLabel
*
label
,
QComboBox
*
_combo
,
module_config_t
*
_p_item
,
QLabel
*
_
label
,
QComboBox
*
_combo
,
bool
bycat
)
:
VStringConfigControl
(
_p_this
,
_p_item
)
{
combo
=
_combo
;
finish
(
label
,
bycat
);
label
=
_label
;
finish
(
bycat
);
}
void
ModuleConfigControl
::
finish
(
QLabel
*
label
,
bool
bycat
)
void
ModuleConfigControl
::
finish
(
bool
bycat
)
{
vlc_list_t
*
p_list
;
module_t
*
p_parser
;
...
...
@@ -186,28 +218,40 @@ QString ModuleConfigControl::getValue()
/*********** Integer **************/
IntegerConfigControl
::
IntegerConfigControl
(
vlc_object_t
*
_p_this
,
module_config_t
*
_p_item
,
QWidget
*
_parent
)
:
QWidget
*
_parent
,
QGridLayout
*
l
,
int
line
)
:
VIntConfigControl
(
_p_this
,
_p_item
,
_parent
)
{
QLabel
*
label
=
new
QLabel
(
qfu
(
p_item
->
psz_text
)
);
spin
=
new
QSpinBox
;
finish
(
label
);
label
=
new
QLabel
(
qfu
(
p_item
->
psz_text
)
);
spin
=
new
QSpinBox
;
spin
->
setMinimumWidth
(
80
);
spin
->
setMaximumWidth
(
90
);
finish
();
if
(
!
l
)
{
QHBoxLayout
*
layout
=
new
QHBoxLayout
();
layout
->
addWidget
(
label
,
0
);
layout
->
addWidget
(
spin
,
1
);
widget
->
setLayout
(
layout
);
}
else
{
l
->
addWidget
(
label
,
line
,
0
);
l
->
addWidget
(
spin
,
line
,
1
,
Qt
::
AlignRight
);
}
}
IntegerConfigControl
::
IntegerConfigControl
(
vlc_object_t
*
_p_this
,
module_config_t
*
_p_item
,
QLabel
*
label
,
QSpinBox
*
_spin
)
:
QLabel
*
_
label
,
QSpinBox
*
_spin
)
:
VIntConfigControl
(
_p_this
,
_p_item
)
{
spin
=
_spin
;
finish
(
label
);
label
=
_label
;
finish
();
}
void
IntegerConfigControl
::
finish
(
QLabel
*
label
)
void
IntegerConfigControl
::
finish
()
{
spin
->
setMaximum
(
2000000000
);
spin
->
setValue
(
p_item
->
i_value
);
spin
->
setToolTip
(
qfu
(
p_item
->
psz_longtext
)
);
label
->
setToolTip
(
qfu
(
p_item
->
psz_longtext
)
);
...
...
modules/gui/qt4/components/preferences_widgets.hpp
View file @
cfaa0cb3
...
...
@@ -26,6 +26,8 @@
#include <vlc/vlc.h>
#include <QWidget>
#include <QLineEdit>
#include <QSpinBox>
#include <QComboBox>
#include "ui/input_stats.h"
#include "qt4.hpp"
#include <assert.h>
...
...
@@ -53,9 +55,14 @@ public:
QString
getName
()
{
return
qfu
(
p_item
->
psz_name
);
}
QWidget
*
getWidget
()
{
assert
(
widget
);
return
widget
;
}
bool
isAdvanced
()
{
return
p_item
->
b_advanced
;
}
virtual
void
hide
()
{
getWidget
()
->
hide
();
};
virtual
void
show
()
{
getWidget
()
->
show
();
};
static
ConfigControl
*
createControl
(
vlc_object_t
*
,
module_config_t
*
,
QWidget
*
);
static
ConfigControl
*
createControl
(
vlc_object_t
*
,
module_config_t
*
,
QWidget
*
,
QGridLayout
*
,
int
);
protected:
vlc_object_t
*
p_this
;
module_config_t
*
p_item
;
...
...
@@ -83,14 +90,18 @@ public:
class
IntegerConfigControl
:
public
VIntConfigControl
{
public:
IntegerConfigControl
(
vlc_object_t
*
,
module_config_t
*
,
QWidget
*
);
IntegerConfigControl
(
vlc_object_t
*
,
module_config_t
*
,
QWidget
*
,
QGridLayout
*
,
int
);
IntegerConfigControl
(
vlc_object_t
*
,
module_config_t
*
,
QLabel
*
,
QSpinBox
*
);
virtual
~
IntegerConfigControl
()
{};
virtual
int
getValue
();
virtual
void
show
()
{
spin
->
show
();
label
->
show
();
}
virtual
void
hide
()
{
spin
->
hide
();
label
->
hide
();
}
private:
QSpinBox
*
spin
;
void
finish
(
QLabel
*
);
QLabel
*
label
;
void
finish
();
};
#if 0
...
...
@@ -150,27 +161,33 @@ class StringConfigControl : public VStringConfigControl
{
public:
StringConfigControl
(
vlc_object_t
*
,
module_config_t
*
,
QWidget
*
,
bool
pwd
);
QGridLayout
*
,
int
,
bool
pwd
);
StringConfigControl
(
vlc_object_t
*
,
module_config_t
*
,
QLabel
*
,
QLineEdit
*
,
bool
pwd
);
virtual
~
StringConfigControl
()
{};
virtual
QString
getValue
()
{
return
text
->
text
();
};
virtual
void
show
()
{
text
->
show
();
label
->
show
();
}
virtual
void
hide
()
{
text
->
hide
();
label
->
hide
();
}
private:
void
finish
(
QLabel
*
);
void
finish
();
QLineEdit
*
text
;
QLabel
*
label
;
};
class
ModuleConfigControl
:
public
VStringConfigControl
{
public:
ModuleConfigControl
(
vlc_object_t
*
,
module_config_t
*
,
QWidget
*
,
bool
byca
t
);
ModuleConfigControl
(
vlc_object_t
*
,
module_config_t
*
,
QWidget
*
,
bool
,
QGridLayout
*
,
in
t
);
ModuleConfigControl
(
vlc_object_t
*
,
module_config_t
*
,
QLabel
*
,
QComboBox
*
,
bool
);
virtual
~
ModuleConfigControl
()
{};
virtual
QString
getValue
();
virtual
void
hide
()
{
combo
->
hide
();
label
->
hide
();
}
virtual
void
show
()
{
combo
->
show
();
label
->
show
();
}
private:
void
finish
(
QLabel
*
,
bool
);
void
finish
(
bool
);
QLabel
*
label
;
QComboBox
*
combo
;
};
#if 0
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a 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