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
67c51e4b
Commit
67c51e4b
authored
Jan 28, 2010
by
Jean-Philippe André
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Qt/Menu: ViewMenu is now dynamic (uses aboutToShow)
parent
1ce616c7
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
42 additions
and
49 deletions
+42
-49
modules/gui/qt4/menus.cpp
modules/gui/qt4/menus.cpp
+37
-44
modules/gui/qt4/menus.hpp
modules/gui/qt4/menus.hpp
+5
-5
No files found.
modules/gui/qt4/menus.cpp
View file @
67c51e4b
...
...
@@ -294,7 +294,7 @@ void QVLCMenu::createMenuBar( MainInterface *mi,
BAR_DADD
(
VideoMenu
(
p_intf
,
bar
),
qtr
(
"&Video"
),
2
);
BAR_ADD
(
ToolsMenu
(
bar
),
qtr
(
"&Tools"
)
);
BAR_ADD
(
ViewMenu
(
p_intf
,
mi
),
qtr
(
"V&iew"
)
);
BAR_ADD
(
ViewMenu
(
p_intf
,
bar
),
qtr
(
"V&iew"
)
);
BAR_ADD
(
HelpMenu
(
bar
),
qtr
(
"&Help"
)
);
}
#undef BAR_ADD
...
...
@@ -397,19 +397,40 @@ QMenu *QVLCMenu::ToolsMenu( QWidget *parent )
return
ToolsMenu
(
new
QMenu
(
parent
)
);
}
/**
* Dynamic View Menu
* Connect signal "aboutToShow" to the creation of the View Menu
**/
QMenu
*
QVLCMenu
::
ViewMenu
(
intf_thread_t
*
p_intf
,
QWidget
*
parent
)
{
QMenu
*
viewMenu
=
new
QMenu
(
parent
);
MenuFunc
*
f
=
new
MenuFunc
(
viewMenu
,
4
);
CONNECT
(
viewMenu
,
aboutToShow
(),
THEDP
->
menusUpdateMapper
,
map
()
);
THEDP
->
menusUpdateMapper
->
setMapping
(
viewMenu
,
f
);
return
viewMenu
;
}
/**
* View Menu
* Interface
Modification
* Interface
modification, load other interfaces, activate Extensions
**/
QMenu
*
QVLCMenu
::
ViewMenu
(
intf_thread_t
*
p_intf
,
MainInterface
*
mi
,
bool
with_intf
)
QMenu
*
current
,
bool
with_intf
)
{
QAction
*
action
;
assert
(
mi
);
QMenu
*
menu
;
if
(
!
with_intf
)
menu
=
new
QMenu
(
qtr
(
"&View"
),
current
);
else
{
menu
=
current
;
menu
->
clear
();
}
QMenu
*
menu
=
new
QMenu
(
qtr
(
"V&iew"
),
mi
);
MainInterface
*
mi
=
p_intf
->
p_sys
->
p_mi
;
assert
(
mi
);
menu
->
addAction
(
QIcon
(
":/menu/playlist_menu"
),
qtr
(
"Play&list"
),
mi
,
...
...
@@ -424,9 +445,6 @@ QMenu *QVLCMenu::ViewMenu( intf_thread_t *p_intf,
if
(
with_intf
)
{
QMenu
*
intfmenu
=
InterfacesMenu
(
p_intf
,
menu
);
MenuFunc
*
f
=
new
MenuFunc
(
intfmenu
,
4
);
CONNECT
(
intfmenu
,
aboutToShow
(),
THEDP
->
menusUpdateMapper
,
map
()
);
THEDP
->
menusUpdateMapper
->
setMapping
(
intfmenu
,
f
);
menu
->
addSeparator
();
}
...
...
@@ -473,14 +491,11 @@ QMenu *QVLCMenu::ViewMenu( intf_thread_t *p_intf,
menu
->
addSeparator
();
addDPStaticEntry
(
menu
,
qtr
(
"Customi&ze Interface..."
),
":/menu/preferences"
,
SLOT
(
toolbarDialog
()
)
);
menu
->
addSeparator
();
/* Extensions */
/// @todo Check configuration variable "auto load extensions"
menu
->
addSeparator
();
QMenu
*
extmenu
=
ExtensionsMenu
(
p_intf
,
menu
);
MenuFunc
*
f
=
new
MenuFunc
(
menu
,
5
);
CONNECT
(
menu
,
aboutToShow
(),
THEDP
->
menusUpdateMapper
,
map
()
);
THEDP
->
menusUpdateMapper
->
setMapping
(
menu
,
f
);
ExtensionsMenu
(
p_intf
,
menu
);
return
menu
;
}
...
...
@@ -499,41 +514,19 @@ QMenu *QVLCMenu::InterfacesMenu( intf_thread_t *p_intf, QMenu *current )
}
/**
* Extensions Sub-Menu
* EXPERIMENTAL
* Extensions menu: populate the current menu with extensions
**/
QMenu
*
QVLCMenu
::
ExtensionsMenu
(
intf_thread_t
*
p_intf
,
QMenu
*
current
)
void
QVLCMenu
::
ExtensionsMenu
(
intf_thread_t
*
p_intf
,
QMenu
*
extMenu
)
{
QAction
*
extAction
=
NULL
;
foreach
(
QAction
*
action
,
current
->
actions
()
)
{
if
(
action
->
text
()
==
qtr
(
"&Extensions"
)
)
{
extAction
=
action
;
break
;
}
}
/* Get ExtensionsManager and load extensions if needed */
ExtensionsManager
*
extMgr
=
ExtensionsManager
::
getInstance
(
p_intf
);
QMenu
*
extMenu
=
new
QMenu
(
qtr
(
"&Extensions"
),
current
);
if
(
extMgr
->
isLoaded
()
)
{
/* Let the ExtensionsManager build itself the menu */
extMgr
->
menu
(
extMenu
);
}
else
if
(
!
extMgr
->
isLoaded
()
&&
!
extMgr
->
cannotLoad
()
)
{
extMenu
->
addAction
(
qtr
(
"&Load extensions"
),
extMgr
,
SLOT
(
loadExtensions
()
)
);
extMgr
->
loadExtensions
();
}
if
(
extAction
)
extAction
->
setMenu
(
extMenu
);
else
current
->
addMenu
(
extMenu
);
return
extMenu
;
/* Let the ExtensionsManager build itself the menu */
extMgr
->
menu
(
extMenu
);
}
/**
...
...
@@ -1035,7 +1028,7 @@ void QVLCMenu::PopupMenu( intf_thread_t *p_intf, bool show )
msg_Warn
(
p_intf
,
"could not find parent interface"
);
}
else
menu
->
addMenu
(
ViewMenu
(
p_intf
,
m
i
,
false
));
menu
->
addMenu
(
ViewMenu
(
p_intf
,
m
enu
,
false
));
menu
->
addMenu
(
submenu
);
}
...
...
modules/gui/qt4/menus.hpp
View file @
67c51e4b
...
...
@@ -106,10 +106,11 @@ private:
static
QMenu
*
ToolsMenu
(
QMenu
*
);
static
QMenu
*
ToolsMenu
(
QWidget
*
);
static
QMenu
*
ViewMenu
(
intf_thread_t
*
,
MainInterface
*
,
bool
with
=
true
);
static
QMenu
*
ViewMenu
(
intf_thread_t
*
,
QWidget
*
parent
);
static
QMenu
*
ViewMenu
(
intf_thread_t
*
,
QMenu
*
,
bool
with_intf
);
static
QMenu
*
InterfacesMenu
(
intf_thread_t
*
p_intf
,
QMenu
*
);
static
QMenu
*
ExtensionsMenu
(
intf_thread_t
*
p_intf
,
QMenu
*
);
static
void
ExtensionsMenu
(
intf_thread_t
*
p_intf
,
QMenu
*
);
static
QMenu
*
NavigMenu
(
intf_thread_t
*
,
QMenu
*
);
static
QMenu
*
NavigMenu
(
intf_thread_t
*
,
QWidget
*
);
...
...
@@ -163,8 +164,7 @@ public:
case
1
:
QVLCMenu
::
AudioMenu
(
p_intf
,
menu
);
break
;
case
2
:
QVLCMenu
::
VideoMenu
(
p_intf
,
menu
);
break
;
case
3
:
QVLCMenu
::
RebuildNavigMenu
(
p_intf
,
menu
);
break
;
case
4
:
QVLCMenu
::
InterfacesMenu
(
p_intf
,
menu
);
break
;
case
5
:
QVLCMenu
::
ExtensionsMenu
(
p_intf
,
menu
);
break
;
case
4
:
QVLCMenu
::
ViewMenu
(
p_intf
,
menu
,
true
);
break
;
}
}
private:
...
...
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