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
895c05d7
Commit
895c05d7
authored
Jun 16, 2008
by
Jean-Philippe Andre
Committed by
Jean-Baptiste Kempf
Jun 16, 2008
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Qt menus: enable/disable correctly static entries
Signed-off-by:
Jean-Baptiste Kempf
<
jb@videolan.org
>
parent
33aa26b1
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
35 additions
and
10 deletions
+35
-10
modules/gui/qt4/menus.cpp
modules/gui/qt4/menus.cpp
+35
-10
No files found.
modules/gui/qt4/menus.cpp
View file @
895c05d7
...
...
@@ -63,20 +63,23 @@ void addDPStaticEntry( QMenu *menu,
const
char
*
member
,
const
char
*
shortcut
)
{
QAction
*
action
=
NULL
;
if
(
!
EMPTY_STR
(
icon
)
>
0
)
{
if
(
!
EMPTY_STR
(
shortcut
)
>
0
)
menu
->
addAction
(
QIcon
(
icon
),
text
,
THEDP
,
member
,
qtr
(
shortcut
)
);
action
=
menu
->
addAction
(
QIcon
(
icon
),
text
,
THEDP
,
member
,
qtr
(
shortcut
)
);
else
menu
->
addAction
(
QIcon
(
icon
),
text
,
THEDP
,
member
);
action
=
menu
->
addAction
(
QIcon
(
icon
),
text
,
THEDP
,
member
);
}
else
{
if
(
!
EMPTY_STR
(
shortcut
)
>
0
)
menu
->
addAction
(
text
,
THEDP
,
member
,
qtr
(
shortcut
)
);
action
=
menu
->
addAction
(
text
,
THEDP
,
member
,
qtr
(
shortcut
)
);
else
menu
->
addAction
(
text
,
THEDP
,
member
);
action
=
menu
->
addAction
(
text
,
THEDP
,
member
);
}
action
->
setData
(
"_static_"
);
}
void
addMIMStaticEntry
(
intf_thread_t
*
p_intf
,
...
...
@@ -97,6 +100,19 @@ void addMIMStaticEntry( intf_thread_t *p_intf,
}
}
void
EnableDPStaticEntries
(
QMenu
*
menu
,
bool
enable
=
true
)
{
if
(
!
menu
)
return
;
QAction
*
action
;
Q_FOREACH
(
action
,
menu
->
actions
()
)
{
if
(
action
->
data
().
toString
()
==
"_static_"
)
action
->
setEnabled
(
enable
);
}
}
/*****************************************************************************
* Definitions of variables for the dynamic menus
*****************************************************************************/
...
...
@@ -476,6 +492,14 @@ QMenu *QVLCMenu::NavigMenu( intf_thread_t *p_intf, QMenu *menu )
vector
<
int
>
objects
;
vector
<
const
char
*>
varnames
;
if
(
!
menu
)
{
menu
=
new
QMenu
();
addDPStaticEntry
(
menu
,
qtr
(
I_MENU_GOTOTIME
),
""
,
""
,
SLOT
(
gotoTimeDialog
()
),
"Ctrl+T"
);
menu
->
addSeparator
();
}
p_object
=
(
vlc_object_t
*
)
vlc_object_find
(
p_intf
,
VLC_OBJECT_INPUT
,
FIND_ANYWHERE
);
InputAutoMenuBuilder
(
p_object
,
objects
,
varnames
);
...
...
@@ -483,13 +507,12 @@ QMenu *QVLCMenu::NavigMenu( intf_thread_t *p_intf, QMenu *menu )
PUSH_VAR
(
"next-title"
);
PUSH_VAR
(
"prev-chapter"
);
PUSH_VAR
(
"next-chapter"
);
EnableDPStaticEntries
(
menu
,
(
p_object
!=
NULL
)
);
if
(
p_object
)
{
vlc_object_release
(
p_object
);
QMenu
*
navMenu
=
new
QMenu
(
menu
);
addDPStaticEntry
(
navMenu
,
qtr
(
I_MENU_GOTOTIME
),
""
,
""
,
SLOT
(
gotoTimeDialog
()
),
"Ctrl+T"
);
navMenu
->
addSeparator
();
return
Populate
(
p_intf
,
navMenu
,
varnames
,
objects
,
true
);
}
return
Populate
(
p_intf
,
menu
,
varnames
,
objects
,
true
);
}
/**
...
...
@@ -792,10 +815,12 @@ QMenu * QVLCMenu::Populate( intf_thread_t *p_intf,
if
(
!
menu
)
menu
=
new
QMenu
();
/* Disable all non static entries */
QAction
*
p_action
;
Q_FOREACH
(
p_action
,
menu
->
actions
()
)
{
p_action
->
setEnabled
(
false
);
if
(
p_action
->
data
().
toString
()
!=
"_static_"
)
p_action
->
setEnabled
(
false
);
}
currentGroup
=
NULL
;
...
...
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