Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-gpu
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-gpu
Commits
7f120f79
Commit
7f120f79
authored
May 17, 2008
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Qt4: do not use vlc_object_get
parent
602005bd
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
34 additions
and
45 deletions
+34
-45
modules/gui/qt4/menus.cpp
modules/gui/qt4/menus.cpp
+27
-40
modules/gui/qt4/menus.hpp
modules/gui/qt4/menus.hpp
+7
-5
No files found.
modules/gui/qt4/menus.cpp
View file @
7f120f79
...
...
@@ -97,14 +97,14 @@ void addMIMStaticEntry( intf_thread_t *p_intf,
* Definitions of variables for the dynamic menus
*****************************************************************************/
#define PUSH_VAR( var ) varnames.push_back( var ); \
objects.push_back( p_object
->i_object_id
)
objects.push_back( p_object )
#define PUSH_SEPARATOR if( objects.size() != i_last_separator ) { \
objects.push_back(
0
); varnames.push_back( "" ); \
objects.push_back(
NULL
); varnames.push_back( "" ); \
i_last_separator = objects.size(); }
static
int
InputAutoMenuBuilder
(
vlc_object_t
*
p_object
,
vector
<
int
>
&
objects
,
vector
<
vlc_object_t
*
>
&
objects
,
vector
<
const
char
*>
&
varnames
)
{
PUSH_VAR
(
"bookmark"
);
...
...
@@ -117,7 +117,7 @@ static int InputAutoMenuBuilder( vlc_object_t *p_object,
}
static
int
VideoAutoMenuBuilder
(
vlc_object_t
*
p_object
,
vector
<
int
>
&
objects
,
vector
<
vlc_object_t
*
>
&
objects
,
vector
<
const
char
*>
&
varnames
)
{
PUSH_VAR
(
"fullscreen"
);
...
...
@@ -142,7 +142,7 @@ static int VideoAutoMenuBuilder( vlc_object_t *p_object,
}
static
int
AudioAutoMenuBuilder
(
vlc_object_t
*
p_object
,
vector
<
int
>
&
objects
,
vector
<
vlc_object_t
*
>
&
objects
,
vector
<
const
char
*>
&
varnames
)
{
PUSH_VAR
(
"audio-device"
);
...
...
@@ -327,11 +327,11 @@ QMenu *QVLCMenu::ToolsMenu( intf_thread_t *p_intf,
**/
QMenu
*
QVLCMenu
::
InterfacesMenu
(
intf_thread_t
*
p_intf
,
QMenu
*
current
)
{
vector
<
int
>
objects
;
vector
<
vlc_object_t
*
>
objects
;
vector
<
const
char
*>
varnames
;
/** \todo add "switch to XXX" */
varnames
.
push_back
(
"intf-add"
);
objects
.
push_back
(
p_intf
->
i_object_id
);
objects
.
push_back
(
VLC_OBJECT
(
p_intf
)
);
QMenu
*
menu
=
Populate
(
p_intf
,
current
,
varnames
,
objects
);
...
...
@@ -345,7 +345,7 @@ QMenu *QVLCMenu::InterfacesMenu( intf_thread_t *p_intf, QMenu *current )
*/
QMenu
*
QVLCMenu
::
AudioMenu
(
intf_thread_t
*
p_intf
,
QMenu
*
current
)
{
vector
<
int
>
objects
;
vector
<
vlc_object_t
*
>
objects
;
vector
<
const
char
*>
varnames
;
vlc_object_t
*
p_object
=
(
vlc_object_t
*
)
vlc_object_find
(
p_intf
,
...
...
@@ -373,7 +373,7 @@ QMenu *QVLCMenu::AudioMenu( intf_thread_t *p_intf, QMenu * current )
QMenu
*
QVLCMenu
::
VideoMenu
(
intf_thread_t
*
p_intf
,
QMenu
*
current
)
{
vlc_object_t
*
p_object
;
vector
<
int
>
objects
;
vector
<
vlc_object_t
*
>
objects
;
vector
<
const
char
*>
varnames
;
p_object
=
(
vlc_object_t
*
)
vlc_object_find
(
p_intf
,
VLC_OBJECT_INPUT
,
...
...
@@ -402,7 +402,7 @@ QMenu *QVLCMenu::VideoMenu( intf_thread_t *p_intf, QMenu *current )
QMenu
*
QVLCMenu
::
NavigMenu
(
intf_thread_t
*
p_intf
,
QMenu
*
navMenu
)
{
vlc_object_t
*
p_object
;
vector
<
int
>
objects
;
vector
<
vlc_object_t
*
>
objects
;
vector
<
const
char
*>
varnames
;
p_object
=
(
vlc_object_t
*
)
vlc_object_find
(
p_intf
,
VLC_OBJECT_INPUT
,
...
...
@@ -482,7 +482,7 @@ QMenu *QVLCMenu::HelpMenu()
*****************************************************************************/
#define POPUP_BOILERPLATE \
unsigned int i_last_separator = 0; \
vector<
int
> objects; \
vector<
vlc_object_t *
> objects; \
vector<const char *> varnames; \
input_thread_t *p_input = THEMIM->getInput();
...
...
@@ -553,9 +553,9 @@ void QVLCMenu::VideoPopupMenu( intf_thread_t *p_intf )
{
vlc_object_yield
(
p_input
);
varnames
.
push_back
(
"video-es"
);
objects
.
push_back
(
p_input
->
i_object_id
);
objects
.
push_back
(
VLC_OBJECT
(
p_input
)
);
varnames
.
push_back
(
"spu-es"
);
objects
.
push_back
(
p_input
->
i_object_id
);
objects
.
push_back
(
VLC_OBJECT
(
p_input
)
);
vlc_object_t
*
p_vout
=
(
vlc_object_t
*
)
vlc_object_find
(
p_input
,
VLC_OBJECT_VOUT
,
FIND_CHILD
);
if
(
p_vout
)
...
...
@@ -577,7 +577,7 @@ void QVLCMenu::AudioPopupMenu( intf_thread_t *p_intf )
{
vlc_object_yield
(
p_input
);
varnames
.
push_back
(
"audio-es"
);
objects
.
push_back
(
p_input
->
i_object_id
);
objects
.
push_back
(
VLC_OBJECT
(
p_input
)
);
vlc_object_t
*
p_aout
=
(
vlc_object_t
*
)
vlc_object_find
(
p_input
,
VLC_OBJECT_AOUT
,
FIND_ANYWHERE
);
if
(
p_aout
)
...
...
@@ -636,7 +636,7 @@ void QVLCMenu::PopupMenu( intf_thread_t *p_intf, bool show )
/* Audio menu */
PUSH_SEPARATOR
;
varnames
.
push_back
(
"audio-es"
);
objects
.
push_back
(
p_input
->
i_object_id
);
objects
.
push_back
(
VLC_OBJECT
(
p_input
)
);
vlc_object_t
*
p_aout
=
(
vlc_object_t
*
)
vlc_object_find
(
p_input
,
VLC_OBJECT_AOUT
,
FIND_ANYWHERE
);
if
(
p_aout
)
...
...
@@ -648,9 +648,9 @@ void QVLCMenu::PopupMenu( intf_thread_t *p_intf, bool show )
/* Video menu */
PUSH_SEPARATOR
;
varnames
.
push_back
(
"video-es"
);
objects
.
push_back
(
p_input
->
i_object_id
);
objects
.
push_back
(
VLC_OBJECT
(
p_input
)
);
varnames
.
push_back
(
"spu-es"
);
objects
.
push_back
(
p_input
->
i_object_id
);
objects
.
push_back
(
VLC_OBJECT
(
p_input
)
);
vlc_object_t
*
p_vout
=
(
vlc_object_t
*
)
vlc_object_find
(
p_input
,
VLC_OBJECT_VOUT
,
FIND_CHILD
);
if
(
p_vout
)
...
...
@@ -732,7 +732,7 @@ void QVLCMenu::updateSystrayMenu( MainInterface *mi,
QMenu
*
QVLCMenu
::
Populate
(
intf_thread_t
*
p_intf
,
QMenu
*
current
,
vector
<
const
char
*>
&
varnames
,
vector
<
int
>
&
objects
,
vector
<
vlc_object_t
*
>
&
objects
,
bool
append
)
{
QMenu
*
menu
=
current
;
...
...
@@ -761,15 +761,7 @@ QMenu * QVLCMenu::Populate( intf_thread_t *p_intf,
continue
;
}
if
(
objects
[
i
]
==
0
)
{
/// \bug What is this ?
// Append( menu, varnames[i], NULL );
b_section_empty
=
false
;
continue
;
}
p_object
=
(
vlc_object_t
*
)
vlc_object_get
(
objects
[
i
]
);
p_object
=
objects
[
i
];
if
(
p_object
==
NULL
)
continue
;
b_section_empty
=
false
;
...
...
@@ -778,7 +770,6 @@ QMenu * QVLCMenu::Populate( intf_thread_t *p_intf,
CreateItem
(
menu
,
varnames
[
i
],
p_object
,
false
);
else
CreateItem
(
menu
,
varnames
[
i
],
p_object
,
true
);
vlc_object_release
(
p_object
);
}
/* Special case for empty menus */
...
...
@@ -890,14 +881,14 @@ void QVLCMenu::CreateItem( QMenu *menu, const char *psz_var,
case
VLC_VAR_VOID
:
var_Get
(
p_object
,
psz_var
,
&
val
);
CreateAndConnect
(
menu
,
psz_var
,
TEXT_OR_VAR
,
""
,
ITEM_NORMAL
,
p_object
->
i_object_id
,
val
,
i_type
);
p_object
,
val
,
i_type
);
break
;
case
VLC_VAR_BOOL
:
var_Get
(
p_object
,
psz_var
,
&
val
);
val
.
b_bool
=
!
val
.
b_bool
;
CreateAndConnect
(
menu
,
psz_var
,
TEXT_OR_VAR
,
""
,
ITEM_CHECK
,
p_object
->
i_object_id
,
val
,
i_type
,
!
val
.
b_bool
);
p_object
,
val
,
i_type
,
!
val
.
b_bool
);
break
;
}
FREENULL
(
text
.
psz_string
);
...
...
@@ -960,7 +951,7 @@ int QVLCMenu::CreateChoicesMenu( QMenu *submenu, const char *psz_var,
another_val
.
psz_string
=
strdup
(
CURVAL
.
psz_string
);
menutext
=
qfu
(
CURTEXT
?
CURTEXT
:
another_val
.
psz_string
);
CreateAndConnect
(
submenu
,
psz_var
,
menutext
,
""
,
NORMAL_OR_RADIO
,
p_object
->
i_object_id
,
another_val
,
i_type
,
p_object
,
another_val
,
i_type
,
NOTCOMMAND
&&
val
.
psz_string
&&
!
strcmp
(
val
.
psz_string
,
CURVAL
.
psz_string
)
);
...
...
@@ -972,7 +963,7 @@ int QVLCMenu::CreateChoicesMenu( QMenu *submenu, const char *psz_var,
if
(
CURTEXT
)
menutext
=
qfu
(
CURTEXT
);
else
menutext
.
sprintf
(
"%d"
,
CURVAL
.
i_int
);
CreateAndConnect
(
submenu
,
psz_var
,
menutext
,
""
,
NORMAL_OR_RADIO
,
p_object
->
i_object_id
,
CURVAL
,
i_type
,
p_object
,
CURVAL
,
i_type
,
NOTCOMMAND
&&
CURVAL
.
i_int
==
val
.
i_int
);
break
;
...
...
@@ -981,7 +972,7 @@ int QVLCMenu::CreateChoicesMenu( QMenu *submenu, const char *psz_var,
if
(
CURTEXT
)
menutext
=
qfu
(
CURTEXT
);
else
menutext
.
sprintf
(
"%.2f"
,
CURVAL
.
f_float
);
CreateAndConnect
(
submenu
,
psz_var
,
menutext
,
""
,
NORMAL_OR_RADIO
,
p_object
->
i_object_id
,
CURVAL
,
i_type
,
p_object
,
CURVAL
,
i_type
,
NOTCOMMAND
&&
CURVAL
.
f_float
==
val
.
f_float
);
break
;
...
...
@@ -1003,7 +994,7 @@ int QVLCMenu::CreateChoicesMenu( QMenu *submenu, const char *psz_var,
void
QVLCMenu
::
CreateAndConnect
(
QMenu
*
menu
,
const
char
*
psz_var
,
QString
text
,
QString
help
,
int
i_item_type
,
int
i_object_id
,
int
i_item_type
,
vlc_object_t
*
object
,
vlc_value_t
val
,
int
i_val_type
,
bool
checked
)
{
...
...
@@ -1027,7 +1018,7 @@ void QVLCMenu::CreateAndConnect( QMenu *menu, const char *psz_var,
{
action
->
setChecked
(
true
);
}
MenuItemData
*
itemData
=
new
MenuItemData
(
i_object_id
,
i_val_type
,
MenuItemData
*
itemData
=
new
MenuItemData
(
object
,
i_val_type
,
val
,
psz_var
);
CONNECT
(
action
,
triggered
(),
THEDP
->
menusMapper
,
map
()
);
THEDP
->
menusMapper
->
setMapping
(
action
,
itemData
);
...
...
@@ -1037,10 +1028,6 @@ void QVLCMenu::CreateAndConnect( QMenu *menu, const char *psz_var,
void
QVLCMenu
::
DoAction
(
intf_thread_t
*
p_intf
,
QObject
*
data
)
{
MenuItemData
*
itemData
=
qobject_cast
<
MenuItemData
*>
(
data
);
vlc_object_t
*
p_object
=
(
vlc_object_t
*
)
vlc_object_get
(
itemData
->
i_object_id
);
if
(
p_object
==
NULL
)
return
;
var_Set
(
p_object
,
itemData
->
psz_var
,
itemData
->
val
);
vlc_object_release
(
p_object
);
var_Set
(
itemData
->
obj
,
itemData
->
psz_var
,
itemData
->
val
);
}
modules/gui/qt4/menus.hpp
View file @
7f120f79
...
...
@@ -49,9 +49,10 @@ class MenuItemData : public QObject
Q_OBJECT
public:
MenuItemData
(
int
i_id
,
int
_i_type
,
vlc_value_t
_val
,
const
char
*
_var
)
MenuItemData
(
vlc_object_t
*
_obj
,
int
_i_type
,
vlc_value_t
_val
,
const
char
*
_var
)
{
i_object_id
=
i_id
;
obj
=
_obj
;
i_val_type
=
_i_type
;
val
=
_val
;
psz_var
=
strdup
(
_var
);
...
...
@@ -62,7 +63,7 @@ public:
if
(
(
i_val_type
&
VLC_VAR_TYPE
)
==
VLC_VAR_STRING
)
free
(
val
.
psz_string
);
}
int
i_object_id
;
vlc_object_t
*
obj
;
int
i_val_type
;
vlc_value_t
val
;
char
*
psz_var
;
...
...
@@ -102,11 +103,12 @@ public:
private:
/* Generic automenu methods */
static
QMenu
*
Populate
(
intf_thread_t
*
,
QMenu
*
current
,
vector
<
const
char
*>&
,
vector
<
int
>&
,
vector
<
const
char
*>&
,
vector
<
vlc_object_t
*
>&
,
bool
append
=
false
);
static
void
CreateAndConnect
(
QMenu
*
,
const
char
*
,
QString
,
QString
,
int
,
int
,
vlc_value_t
,
int
,
bool
c
=
false
);
int
,
vlc_object_t
*
,
vlc_value_t
,
int
,
bool
c
=
false
);
static
void
CreateItem
(
QMenu
*
,
const
char
*
,
vlc_object_t
*
,
bool
);
static
int
CreateChoicesMenu
(
QMenu
*
,
const
char
*
,
vlc_object_t
*
,
bool
);
};
...
...
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