Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc
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
Commits
fb1eda2e
Commit
fb1eda2e
authored
Aug 15, 2012
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Qt4: use config_Get(Int|Psz)Choices()
parent
40ec6172
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
71 additions
and
63 deletions
+71
-63
modules/gui/qt4/components/extended_panels.cpp
modules/gui/qt4/components/extended_panels.cpp
+30
-12
modules/gui/qt4/components/preferences_widgets.cpp
modules/gui/qt4/components/preferences_widgets.cpp
+41
-51
No files found.
modules/gui/qt4/components/extended_panels.cpp
View file @
fb1eda2e
...
...
@@ -440,23 +440,41 @@ void ExtVideo::initComboBoxItems( QObject *widget )
QString
option
=
OptionFromWidgetName
(
widget
);
module_config_t
*
p_item
=
config_FindConfig
(
VLC_OBJECT
(
p_intf
),
qtu
(
option
)
);
if
(
p_item
)
if
(
p_item
==
NULL
)
{
int
i_type
=
p_item
->
i_type
;
for
(
int
i_index
=
0
;
i_index
<
p_item
->
i_list
;
i_index
++
)
msg_Err
(
p_intf
,
"Couldn't find option
\"
%s
\"
."
,
qtu
(
option
)
);
return
;
}
if
(
p_item
->
i_type
==
CONFIG_ITEM_INTEGER
||
p_item
->
i_type
==
CONFIG_ITEM_BOOL
)
{
int64_t
*
values
;
char
**
texts
;
ssize_t
count
=
config_GetIntChoices
(
VLC_OBJECT
(
p_intf
),
qtu
(
option
),
&
values
,
&
texts
);
for
(
ssize_t
i
=
0
;
i
<
count
;
i
++
)
{
if
(
i_type
==
CONFIG_ITEM_INTEGER
||
i_type
==
CONFIG_ITEM_BOOL
)
combobox
->
addItem
(
qtr
(
p_item
->
ppsz_list_text
[
i_index
]
),
p_item
->
pi_list
[
i_index
]
);
else
if
(
i_type
==
CONFIG_ITEM_STRING
)
combobox
->
addItem
(
qtr
(
p_item
->
ppsz_list_text
[
i_index
]
),
p_item
->
ppsz_list
[
i_index
]
);
combobox
->
addItem
(
qtr
(
texts
[
i
]
),
values
[
i
]
);
free
(
texts
[
i
]
);
}
free
(
texts
);
free
(
values
);
}
else
else
if
(
p_item
->
i_type
==
CONFIG_ITEM_STRING
)
{
msg_Err
(
p_intf
,
"Couldn't find option
\"
%s
\"
."
,
qtu
(
option
)
);
char
**
values
;
char
**
texts
;
ssize_t
count
=
config_GetPszChoices
(
VLC_OBJECT
(
p_intf
),
qtu
(
option
),
&
values
,
&
texts
);
for
(
ssize_t
i
=
0
;
i
<
count
;
i
++
)
{
combobox
->
addItem
(
qtr
(
texts
[
i
]
),
values
[
i
]
);
free
(
texts
[
i
]
);
free
(
values
[
i
]
);
}
free
(
texts
);
free
(
values
);
}
}
...
...
modules/gui/qt4/components/preferences_widgets.cpp
View file @
fb1eda2e
...
...
@@ -469,33 +469,19 @@ void StringListConfigControl::finish(module_config_t *p_module_config )
if
(
!
p_module_config
)
return
;
if
(
p_module_config
->
pf_update_list
)
{
vlc_value_t
val
;
val
.
psz_string
=
strdup
(
p_module_config
->
value
.
psz
);
p_module_config
->
pf_update_list
(
p_this
,
p_item
->
psz_name
,
val
,
val
,
NULL
);
free
(
val
.
psz_string
);
}
for
(
int
i_index
=
0
;
i_index
<
p_module_config
->
i_list
;
i_index
++
)
char
**
values
,
**
texts
;
ssize_t
count
=
config_GetPszChoices
(
p_this
,
p_item
->
psz_name
,
&
values
,
&
texts
);
for
(
ssize_t
i
=
0
;
i
<
count
;
i
++
)
{
if
(
!
p_module_config
->
ppsz_list
[
i_index
]
)
{
combo
->
addItem
(
""
,
QVariant
(
""
));
if
(
!
p_item
->
value
.
psz
)
combo
->
setCurrentIndex
(
combo
->
count
()
-
1
);
continue
;
}
combo
->
addItem
(
qfu
((
p_module_config
->
ppsz_list_text
&&
p_module_config
->
ppsz_list_text
[
i_index
])
?
_
(
p_module_config
->
ppsz_list_text
[
i_index
])
:
p_module_config
->
ppsz_list
[
i_index
]
),
QVariant
(
qfu
(
p_module_config
->
ppsz_list
[
i_index
]
))
);
if
(
p_item
->
value
.
psz
&&
!
strcmp
(
p_module_config
->
value
.
psz
,
p_module_config
->
ppsz_list
[
i_index
]
)
)
combo
->
addItem
(
qfu
(
texts
[
i
]),
QVariant
(
qfu
(
values
[
i
]))
);
if
(
!
strcmp
(
p_item
->
value
.
psz
?
p_item
->
value
.
psz
:
""
,
values
[
i
]
)
)
combo
->
setCurrentIndex
(
combo
->
count
()
-
1
);
free
(
texts
[
i
]
);
free
(
values
[
i
]
);
}
free
(
texts
);
free
(
values
);
if
(
p_module_config
->
psz_longtext
)
{
...
...
@@ -518,39 +504,43 @@ void setfillVLCConfigCombo( const char *configname, intf_thread_t *p_intf,
{
module_config_t
*
p_config
=
config_FindConfig
(
VLC_OBJECT
(
p_intf
),
configname
);
if
(
p_config
)
{
QVariant
def
;
bool
string
=
(
p_config
->
i_type
&
0xF0
)
==
CONFIG_ITEM_STRING
;
if
(
string
)
def
=
QVariant
(
qfu
(
p_config
->
value
.
psz
)
);
else
def
=
QVariant
(
qlonglong
(
p_config
->
value
.
i
)
);
if
(
p_config
==
NULL
)
return
;
if
(
p_config
->
pf_update_list
)
if
(
(
p_config
->
i_type
&
0xF0
)
==
CONFIG_ITEM_STRING
)
{
char
**
values
,
**
texts
;
ssize_t
count
=
config_GetPszChoices
(
VLC_OBJECT
(
p_intf
),
configname
,
&
values
,
&
texts
);
for
(
ssize_t
i
=
0
;
i
<
count
;
i
++
)
{
vlc_value_t
val
;
val
.
i_int
=
p_config
->
value
.
i
;
p_config
->
pf_update_list
(
VLC_OBJECT
(
p_intf
),
configname
,
val
,
val
,
NULL
);
combo
->
addItem
(
qtr
(
texts
[
i
]),
QVariant
(
qfu
(
values
[
i
]))
);
if
(
!
strcmp
(
p_config
->
value
.
psz
,
values
[
i
])
)
combo
->
setCurrentIndex
(
i
);
free
(
texts
[
i
]
);
free
(
values
[
i
]
);
}
for
(
int
i_index
=
0
;
i_index
<
p_config
->
i_list
;
i_index
++
)
free
(
texts
);
free
(
values
);
}
else
{
int64_t
*
values
;
char
**
texts
;
ssize_t
count
=
config_GetIntChoices
(
VLC_OBJECT
(
p_intf
),
configname
,
&
values
,
&
texts
);
for
(
ssize_t
i
=
0
;
i
<
count
;
i
++
)
{
QVariant
value
;
if
(
string
)
value
=
QVariant
(
qfu
(
p_config
->
ppsz_list
[
i_index
])
);
else
value
=
QVariant
(
p_config
->
pi_list
[
i_index
]
);
combo
->
addItem
(
qtr
(
p_config
->
ppsz_list_text
[
i_index
]),
value
);
if
(
def
==
value
)
combo
->
setCurrentIndex
(
i_index
);
combo
->
addItem
(
qtr
(
texts
[
i
]),
QVariant
(
qlonglong
(
values
[
i
]))
);
if
(
p_config
->
value
.
i
==
values
[
i
]
)
combo
->
setCurrentIndex
(
i
);
free
(
texts
[
i
]
);
}
if
(
p_config
->
psz_longtext
)
combo
->
setToolTip
(
qfu
(
p_config
->
psz_longtext
)
);
free
(
texts
);
}
if
(
p_config
->
psz_longtext
!=
NULL
)
combo
->
setToolTip
(
qfu
(
p_config
->
psz_longtext
)
);
}
/********* Module **********/
...
...
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