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
9f0375cd
Commit
9f0375cd
authored
Feb 22, 2009
by
Jean-Baptiste Kempf
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Qt, menus: various changes, speedups and addition to approach mac menus.
parent
8d5ee287
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
196 additions
and
204 deletions
+196
-204
modules/gui/qt4/main_interface.cpp
modules/gui/qt4/main_interface.cpp
+1
-4
modules/gui/qt4/menus.cpp
modules/gui/qt4/menus.cpp
+177
-191
modules/gui/qt4/menus.hpp
modules/gui/qt4/menus.hpp
+18
-9
No files found.
modules/gui/qt4/main_interface.cpp
View file @
9f0375cd
...
@@ -121,9 +121,6 @@ MainInterface::MainInterface( intf_thread_t *_p_intf ) : QVLCMW( _p_intf )
...
@@ -121,9 +121,6 @@ MainInterface::MainInterface( intf_thread_t *_p_intf ) : QVLCMW( _p_intf )
mainBasedSize
=
settings
->
value
(
"mainBasedSize"
,
QSize
(
350
,
120
)
).
toSize
();
mainBasedSize
=
settings
->
value
(
"mainBasedSize"
,
QSize
(
350
,
120
)
).
toSize
();
mainVideoSize
=
settings
->
value
(
"mainVideoSize"
,
QSize
(
400
,
300
)
).
toSize
();
mainVideoSize
=
settings
->
value
(
"mainVideoSize"
,
QSize
(
400
,
300
)
).
toSize
();
/* Visualisation, not really used yet */
visualSelectorEnabled
=
settings
->
value
(
"visual-selector"
,
false
).
toBool
();
/* Do we want anoying popups or not */
/* Do we want anoying popups or not */
notificationEnabled
=
(
bool
)
config_GetInt
(
p_intf
,
"qt-notification"
);
notificationEnabled
=
(
bool
)
config_GetInt
(
p_intf
,
"qt-notification"
);
...
@@ -141,7 +138,7 @@ MainInterface::MainInterface( intf_thread_t *_p_intf ) : QVLCMW( _p_intf )
...
@@ -141,7 +138,7 @@ MainInterface::MainInterface( intf_thread_t *_p_intf ) : QVLCMW( _p_intf )
/************
/************
* Menu Bar *
* Menu Bar *
************/
************/
QVLCMenu
::
createMenuBar
(
this
,
p_intf
,
visualSelectorEnabled
);
QVLCMenu
::
createMenuBar
(
this
,
p_intf
);
#if 0
#if 0
/* Create a Dock to get the playlist */
/* Create a Dock to get the playlist */
...
...
modules/gui/qt4/menus.cpp
View file @
9f0375cd
...
@@ -141,7 +141,9 @@ void EnableStaticEntries( QMenu *menu, bool enable = true )
...
@@ -141,7 +141,9 @@ void EnableStaticEntries( QMenu *menu, bool enable = true )
QList
<
QAction
*
>
actions
=
menu
->
actions
();
QList
<
QAction
*
>
actions
=
menu
->
actions
();
for
(
int
i
=
0
;
i
<
actions
.
size
();
++
i
)
for
(
int
i
=
0
;
i
<
actions
.
size
();
++
i
)
{
{
actions
[
i
]
->
setEnabled
(
enable
&&
actions
[
i
]
->
data
().
toBool
()
);
actions
[
i
]
->
setEnabled
(
enable
&&
/* Be careful here, because data("string").toBool is true */
(
actions
[
i
]
->
data
().
toString
()
==
"true"
)
);
}
}
}
}
...
@@ -150,9 +152,10 @@ void EnableStaticEntries( QMenu *menu, bool enable = true )
...
@@ -150,9 +152,10 @@ void EnableStaticEntries( QMenu *menu, bool enable = true )
*/
*/
int
DeleteNonStaticEntries
(
QMenu
*
menu
)
int
DeleteNonStaticEntries
(
QMenu
*
menu
)
{
{
if
(
!
menu
)
return
VLC_EGENERIC
;
int
i_ret
=
0
;
int
i_ret
=
0
;
if
(
!
menu
)
return
VLC_EGENERIC
;
QList
<
QAction
*
>
actions
=
menu
->
actions
();
QList
<
QAction
*
>
actions
=
menu
->
actions
();
for
(
int
i
=
0
;
i
<
actions
.
size
();
++
i
)
for
(
int
i
=
0
;
i
<
actions
.
size
();
++
i
)
{
{
...
@@ -200,7 +203,6 @@ static int InputAutoMenuBuilder( input_thread_t *p_object,
...
@@ -200,7 +203,6 @@ static int InputAutoMenuBuilder( input_thread_t *p_object,
PUSH_VAR
(
"chapter"
);
PUSH_VAR
(
"chapter"
);
PUSH_VAR
(
"navigation"
);
PUSH_VAR
(
"navigation"
);
PUSH_VAR
(
"program"
);
PUSH_VAR
(
"program"
);
PUSH_VAR
(
"dvd_menus"
);
return
VLC_SUCCESS
;
return
VLC_SUCCESS
;
}
}
...
@@ -269,9 +271,7 @@ static int AudioAutoMenuBuilder( aout_instance_t *p_object,
...
@@ -269,9 +271,7 @@ static int AudioAutoMenuBuilder( aout_instance_t *p_object,
* Main Menu Bar Creation
* Main Menu Bar Creation
**/
**/
void
QVLCMenu
::
createMenuBar
(
MainInterface
*
mi
,
void
QVLCMenu
::
createMenuBar
(
MainInterface
*
mi
,
intf_thread_t
*
p_intf
,
intf_thread_t
*
p_intf
)
bool
visual_selector_enabled
)
/* FIXME remove this visual dependency */
{
{
/* QMainWindows->menuBar()
/* QMainWindows->menuBar()
gives the QProcess::destroyed timeout issue on Cleanlooks style with
gives the QProcess::destroyed timeout issue on Cleanlooks style with
...
@@ -286,8 +286,7 @@ void QVLCMenu::createMenuBar( MainInterface *mi,
...
@@ -286,8 +286,7 @@ void QVLCMenu::createMenuBar( MainInterface *mi,
BAR_DADD
(
VideoMenu
(
p_intf
,
bar
),
qtr
(
"&Video"
),
2
);
BAR_DADD
(
VideoMenu
(
p_intf
,
bar
),
qtr
(
"&Video"
),
2
);
BAR_ADD
(
ToolsMenu
(
bar
),
qtr
(
"&Tools"
)
);
BAR_ADD
(
ToolsMenu
(
bar
),
qtr
(
"&Tools"
)
);
BAR_ADD
(
ViewMenu
(
p_intf
,
NULL
,
mi
,
visual_selector_enabled
,
true
),
BAR_ADD
(
ViewMenu
(
p_intf
,
mi
),
qtr
(
"V&iew"
)
);
qtr
(
"V&iew"
)
);
BAR_ADD
(
HelpMenu
(
bar
),
qtr
(
"&Help"
)
);
BAR_ADD
(
HelpMenu
(
bar
),
qtr
(
"&Help"
)
);
}
}
#undef BAR_ADD
#undef BAR_ADD
...
@@ -386,29 +385,21 @@ QMenu *QVLCMenu::ToolsMenu( QWidget *parent )
...
@@ -386,29 +385,21 @@ QMenu *QVLCMenu::ToolsMenu( QWidget *parent )
* Interface Modification
* Interface Modification
**/
**/
QMenu
*
QVLCMenu
::
ViewMenu
(
intf_thread_t
*
p_intf
,
QMenu
*
QVLCMenu
::
ViewMenu
(
intf_thread_t
*
p_intf
,
QMenu
*
current
,
MainInterface
*
mi
,
MainInterface
*
mi
,
bool
visual_selector_enabled
,
bool
with_intf
)
bool
with_intf
)
{
{
QMenu
*
menu
;
assert
(
mi
);
if
(
current
)
menu
=
new
QMenu
(
current
);
QMenu
*
menu
=
new
QMenu
(
qtr
(
"V&iew"
),
mi
);
else
menu
=
new
QMenu
(
mi
);
QAction
*
act
=
menu
->
addAction
(
QIcon
(
":/playlist_menu"
),
QAction
*
act
;
if
(
mi
)
{
act
=
menu
->
addAction
(
QIcon
(
":/playlist_menu"
),
qtr
(
"Play&list"
),
mi
,
qtr
(
"Play&list"
),
mi
,
SLOT
(
togglePlaylist
()
),
qtr
(
"Ctrl+L"
)
);
SLOT
(
togglePlaylist
()
),
qtr
(
"Ctrl+L"
)
);
act
->
setData
(
true
);
}
/*menu->addSeparator();
/*menu->addSeparator();
menu->addAction( qtr( "Undock from Interface" ), mi,
menu->addAction( qtr( "Undock from Interface" ), mi,
SLOT( undockPlaylist() ), qtr( "Ctrl+U" ) );*/
SLOT( undockPlaylist() ), qtr( "Ctrl+U" ) );*/
menu
->
addSeparator
();
menu
->
addSeparator
();
if
(
with_intf
)
if
(
with_intf
)
...
@@ -419,13 +410,12 @@ QMenu *QVLCMenu::ViewMenu( intf_thread_t *p_intf,
...
@@ -419,13 +410,12 @@ QMenu *QVLCMenu::ViewMenu( intf_thread_t *p_intf,
THEDP
->
menusUpdateMapper
->
setMapping
(
intfmenu
,
f
);
THEDP
->
menusUpdateMapper
->
setMapping
(
intfmenu
,
f
);
menu
->
addSeparator
();
menu
->
addSeparator
();
}
}
if
(
mi
)
{
/* Minimal View */
/* Minimal View */
QAction
*
action
=
menu
->
addAction
(
qtr
(
"Mi&nimal View"
),
mi
,
QAction
*
action
=
menu
->
addAction
(
qtr
(
"Mi&nimal View"
),
mi
,
SLOT
(
toggleMinimalView
()
),
qtr
(
"Ctrl+H"
)
);
SLOT
(
toggleMinimalView
()
),
qtr
(
"Ctrl+H"
)
);
action
->
setCheckable
(
true
);
action
->
setCheckable
(
true
);
action
->
setData
(
true
);
if
(
mi
->
getControlsVisibilityStatus
()
&
CONTROLS_VISIBLE
)
if
(
mi
->
getControlsVisibilityStatus
()
&
CONTROLS_VISIBLE
)
action
->
setChecked
(
true
);
action
->
setChecked
(
true
);
minimalViewAction
=
action
;
/* HACK for minimalView */
minimalViewAction
=
action
;
/* HACK for minimalView */
...
@@ -435,22 +425,20 @@ QMenu *QVLCMenu::ViewMenu( intf_thread_t *p_intf,
...
@@ -435,22 +425,20 @@ QMenu *QVLCMenu::ViewMenu( intf_thread_t *p_intf,
SLOT
(
toggleFullScreen
()
),
QString
(
"F11"
)
);
SLOT
(
toggleFullScreen
()
),
QString
(
"F11"
)
);
fullscreenViewAction
=
action
;
fullscreenViewAction
=
action
;
action
->
setCheckable
(
true
);
action
->
setCheckable
(
true
);
action
->
setData
(
true
);
/* Advanced Controls */
/* Advanced Controls */
action
=
menu
->
addAction
(
qtr
(
"&Advanced Controls"
),
mi
,
action
=
menu
->
addAction
(
qtr
(
"&Advanced Controls"
),
mi
,
SLOT
(
toggleAdvanced
()
)
);
SLOT
(
toggleAdvanced
()
)
);
action
->
setCheckable
(
true
);
action
->
setCheckable
(
true
);
action
->
setData
(
true
);
if
(
mi
->
getControlsVisibilityStatus
()
&
CONTROLS_ADVANCED
)
if
(
mi
->
getControlsVisibilityStatus
()
&
CONTROLS_ADVANCED
)
action
->
setChecked
(
true
);
action
->
setChecked
(
true
);
#if 0 /* For Visualisations. Not yet working */
#if 0 /* For Visualisations. Not yet working */
adv = menu->addAction( qtr( "Visualizations selector" ),
adv = menu->addAction( qtr( "Visualizations selector" ),
mi, SLOT( visual() ) );
mi, SLOT( visual() ) );
adv->setCheckable( true );
adv->setCheckable( true );
if( visual_selector_enabled ) adv->setChecked( true );
if( visual_selector_enabled ) adv->setChecked( true );
#endif
#endif
}
menu
->
addSeparator
();
menu
->
addSeparator
();
addDPStaticEntry
(
menu
,
qtr
(
"Customi&ze Interface..."
),
addDPStaticEntry
(
menu
,
qtr
(
"Customi&ze Interface..."
),
...
@@ -594,46 +582,49 @@ QMenu *QVLCMenu::VideoMenu( intf_thread_t *p_intf, QWidget *parent )
...
@@ -594,46 +582,49 @@ QMenu *QVLCMenu::VideoMenu( intf_thread_t *p_intf, QWidget *parent )
**/
**/
QMenu
*
QVLCMenu
::
NavigMenu
(
intf_thread_t
*
p_intf
,
QMenu
*
menu
)
QMenu
*
QVLCMenu
::
NavigMenu
(
intf_thread_t
*
p_intf
,
QMenu
*
menu
)
{
{
if
(
menu
->
isEmpty
()
)
{
QAction
*
action
;
QAction
*
action
;
QMenu
*
submenu
=
new
QMenu
(
qtr
(
"&Bookmarks"
),
menu
);
QMenu
*
submenu
=
new
QMenu
(
qtr
(
"&Bookmarks"
),
menu
);
addDPStaticEntry
(
submenu
,
qtr
(
"Manage &bookmarks"
),
""
,
addDPStaticEntry
(
submenu
,
qtr
(
"Manage &bookmarks"
),
""
,
SLOT
(
bookmarksDialog
()
)
);
SLOT
(
bookmarksDialog
()
)
);
submenu
->
addSeparator
();
submenu
->
addSeparator
();
action
=
menu
->
addMenu
(
submenu
);
action
=
menu
->
addMenu
(
submenu
);
action
->
setData
(
"bookmark"
);
action
->
setData
(
"bookmark"
);
ACT_ADDMENU
(
menu
,
"title"
,
qtr
(
"T&itle"
)
);
ACT_ADDMENU
(
menu
,
"title"
,
qtr
(
"T&itle"
)
);
ACT_ADDMENU
(
menu
,
"chapter"
,
qtr
(
"&Chapter"
)
);
ACT_ADDMENU
(
menu
,
"chapter"
,
qtr
(
"&Chapter"
)
);
ACT_ADDMENU
(
menu
,
"navigation"
,
qtr
(
"&Navigation"
)
);
ACT_ADDMENU
(
menu
,
"navigation"
,
qtr
(
"&Navigation"
)
);
ACT_ADDMENU
(
menu
,
"program"
,
qtr
(
"&Program"
)
);
ACT_ADDMENU
(
menu
,
"program"
,
qtr
(
"&Program"
)
);
menu
->
addSeparator
();
menu
->
addSeparator
();
addDPStaticEntry
(
menu
,
qtr
(
I_MENU_GOTOTIME
),
""
,
PopupMenuControlEntries
(
menu
,
p_intf
);
//, THEMIM->getInput() );
SLOT
(
gotoTimeDialog
()
),
"Ctrl+T"
);
PopupMenuPlaylistControlEntries
(
menu
,
p_intf
);
}
return
menu
;
}
QMenu
*
QVLCMenu
::
RebuildNavigMenu
(
intf_thread_t
*
p_intf
,
QMenu
*
menu
)
{
/* */
/* */
input_thread_t
*
p_object
;
input_thread_t
*
p_object
;
vector
<
vlc_object_t
*>
objects
;
vector
<
vlc_object_t
*>
objects
;
vector
<
const
char
*>
varnames
;
vector
<
const
char
*>
varnames
;
/* Get the input and hold it */
p_object
=
THEMIM
->
getInput
();
p_object
=
THEMIM
->
getInput
();
if
(
p_object
)
if
(
p_object
)
vlc_object_hold
(
p_object
);
vlc_object_hold
(
p_object
);
InputAutoMenuBuilder
(
p_object
,
objects
,
varnames
);
InputAutoMenuBuilder
(
p_object
,
objects
,
varnames
);
menu
->
addSeparator
();
/* Title and so on */
/* Title and so on */
PUSH_VAR
(
"prev-title"
);
PUSH_VAR
(
"prev-title"
);
PUSH_VAR
(
"next-title"
);
PUSH_VAR
(
"next-title"
);
PUSH_VAR
(
"prev-chapter"
);
PUSH_VAR
(
"prev-chapter"
);
PUSH_VAR
(
"next-chapter"
);
PUSH_VAR
(
"next-chapter"
);
menu
->
addSeparator
();
EnableStaticEntries
(
menu
,
(
p_object
!=
NULL
)
);
if
(
p_object
)
if
(
p_object
)
vlc_object_release
(
p_object
);
vlc_object_release
(
p_object
);
...
@@ -717,7 +708,7 @@ QMenu *QVLCMenu::HelpMenu( QWidget *parent )
...
@@ -717,7 +708,7 @@ QMenu *QVLCMenu::HelpMenu( QWidget *parent )
p_intf->p_sys->p_popup_menu = NULL; \
p_intf->p_sys->p_popup_menu = NULL; \
i_last_separator = 0;
i_last_separator = 0;
void
QVLCMenu
::
Popup
MenuControl
Entries
(
QMenu
*
menu
,
void
QVLCMenu
::
Popup
Play
Entries
(
QMenu
*
menu
,
intf_thread_t
*
p_intf
,
intf_thread_t
*
p_intf
,
input_thread_t
*
p_input
)
input_thread_t
*
p_input
)
{
{
...
@@ -736,9 +727,13 @@ void QVLCMenu::PopupMenuControlEntries( QMenu *menu,
...
@@ -736,9 +727,13 @@ void QVLCMenu::PopupMenuControlEntries( QMenu *menu,
":/pause"
,
SLOT
(
togglePlayPause
()
)
);
":/pause"
,
SLOT
(
togglePlayPause
()
)
);
}
}
}
void
QVLCMenu
::
PopupMenuControlEntries
(
QMenu
*
menu
,
intf_thread_t
*
p_intf
)
{
QAction
*
action
;
/* Stop */
/* Stop */
addMIMStaticEntry
(
p_intf
,
menu
,
qtr
(
"Stop"
),
addMIMStaticEntry
(
p_intf
,
menu
,
qtr
(
"Stop"
),
":/stop"
,
SLOT
(
stop
()
)
);
":/stop"
,
SLOT
(
stop
()
)
);
/* Faster/Slower */
/* Faster/Slower */
action
=
menu
->
addAction
(
qtr
(
"Faster"
),
THEMIM
->
getIM
(),
SLOT
(
faster
()
)
);
action
=
menu
->
addAction
(
qtr
(
"Faster"
),
THEMIM
->
getIM
(),
SLOT
(
faster
()
)
);
...
@@ -746,13 +741,24 @@ void QVLCMenu::PopupMenuControlEntries( QMenu *menu,
...
@@ -746,13 +741,24 @@ void QVLCMenu::PopupMenuControlEntries( QMenu *menu,
menu
->
addAction
(
qtr
(
"Normal Speed"
),
THEMIM
->
getIM
(),
SLOT
(
normalRate
()
)
);
menu
->
addAction
(
qtr
(
"Normal Speed"
),
THEMIM
->
getIM
(),
SLOT
(
normalRate
()
)
);
action
=
menu
->
addAction
(
qtr
(
"Slower"
),
THEMIM
->
getIM
(),
SLOT
(
slower
()
)
);
action
=
menu
->
addAction
(
qtr
(
"Slower"
),
THEMIM
->
getIM
(),
SLOT
(
slower
()
)
);
action
->
setIcon
(
QIcon
(
":/slower"
)
);
action
->
setIcon
(
QIcon
(
":/slower"
)
);
menu
->
addSeparator
();
action
=
menu
->
addAction
(
qtr
(
"Jump Forward"
),
THEMIM
->
getIM
(),
SLOT
(
jumpFwd
()
)
);
action
->
setIcon
(
QIcon
(
":/skip_fw"
)
);
action
=
menu
->
addAction
(
qtr
(
"Jump Backward"
),
THEMIM
->
getIM
(),
SLOT
(
jumpBwd
()
)
);
action
->
setIcon
(
QIcon
(
":/skip_back"
)
);
}
}
void
QVLCMenu
::
PopupMenuPlaylistControlEntries
(
QMenu
*
menu
,
void
QVLCMenu
::
PopupMenuPlaylistControlEntries
(
QMenu
*
menu
,
intf_thread_t
*
p_intf
,
intf_thread_t
*
p_intf
)
input_thread_t
*
p_input
)
{
{
addDPStaticEntry
(
menu
,
qtr
(
I_MENU_GOTOTIME
),
""
,
SLOT
(
gotoTimeDialog
()
),
"Ctrl+T"
);
menu
->
addSeparator
();
/* Next / Previous */
/* Next / Previous */
addMIMStaticEntry
(
p_intf
,
menu
,
qtr
(
"Previous"
),
addMIMStaticEntry
(
p_intf
,
menu
,
qtr
(
"Previous"
),
":/previous"
,
SLOT
(
prev
()
)
);
":/previous"
,
SLOT
(
prev
()
)
);
...
@@ -822,7 +828,7 @@ void QVLCMenu::AudioPopupMenu( intf_thread_t *p_intf )
...
@@ -822,7 +828,7 @@ void QVLCMenu::AudioPopupMenu( intf_thread_t *p_intf )
CREATE_POPUP
;
CREATE_POPUP
;
}
}
/* Navigation stuff, and general menus ( open ) */
/* Navigation stuff, and general menus ( open )
, used only for skins
*/
void
QVLCMenu
::
MiscPopupMenu
(
intf_thread_t
*
p_intf
)
void
QVLCMenu
::
MiscPopupMenu
(
intf_thread_t
*
p_intf
)
{
{
POPUP_BOILERPLATE
;
POPUP_BOILERPLATE
;
...
@@ -839,10 +845,10 @@ void QVLCMenu::MiscPopupMenu( intf_thread_t *p_intf )
...
@@ -839,10 +845,10 @@ void QVLCMenu::MiscPopupMenu( intf_thread_t *p_intf )
Populate
(
p_intf
,
menu
,
varnames
,
objects
);
Populate
(
p_intf
,
menu
,
varnames
,
objects
);
menu
->
addSeparator
();
menu
->
addSeparator
();
PopupMenuControlEntries
(
menu
,
p_intf
,
p_input
);
PopupMenuControlEntries
(
menu
,
p_intf
);
//
, p_input );
menu
->
addSeparator
();
menu
->
addSeparator
();
PopupMenuPlaylistControlEntries
(
menu
,
p_intf
,
p_input
);
PopupMenuPlaylistControlEntries
(
menu
,
p_intf
);
//
, p_input );
menu
->
addSeparator
();
menu
->
addSeparator
();
PopupMenuStaticEntries
(
menu
);
PopupMenuStaticEntries
(
menu
);
...
@@ -855,45 +861,48 @@ void QVLCMenu::MiscPopupMenu( intf_thread_t *p_intf )
...
@@ -855,45 +861,48 @@ void QVLCMenu::MiscPopupMenu( intf_thread_t *p_intf )
/* Main Menu that sticks everything together */
/* Main Menu that sticks everything together */
void
QVLCMenu
::
PopupMenu
(
intf_thread_t
*
p_intf
,
bool
show
)
void
QVLCMenu
::
PopupMenu
(
intf_thread_t
*
p_intf
,
bool
show
)
{
{
MainInterface
*
mi
=
p_intf
->
p_sys
->
p_mi
;
/* Destroy popup menu if there is one */
if
(
show
)
if
(
!
show
)
{
{
delete
p_intf
->
p_sys
->
p_popup_menu
;
p_intf
->
p_sys
->
p_popup_menu
=
NULL
;
return
;
}
/* Delete and recreate a popup if there is one */
/* Delete and recreate a popup if there is one */
if
(
p_intf
->
p_sys
->
p_popup_menu
)
if
(
p_intf
->
p_sys
->
p_popup_menu
)
delete
p_intf
->
p_sys
->
p_popup_menu
;
delete
p_intf
->
p_sys
->
p_popup_menu
;
/* */
QMenu
*
menu
=
new
QMenu
();
QMenu
*
menu
=
new
QMenu
();
QMenu
*
submenu
;
QMenu
*
submenu
;
QAction
*
action
;
QAction
*
action
;
bool
b_isFullscreen
=
false
;
bool
b_isFullscreen
=
false
;
MainInterface
*
mi
=
p_intf
->
p_sys
->
p_mi
;
POPUP_BOILERPLATE
;
POPUP_BOILERPLATE
;
PopupMenuControlEntries
(
menu
,
p_intf
,
p_input
);
PopupMenuControlEntries
(
menu
,
p_intf
);
//, p_input );
menu
->
addSeparator
();
PopupMenuPlaylistControlEntries
(
menu
,
p_intf
,
p_input
);
menu
->
addSeparator
();
menu
->
addSeparator
();
if
(
p_input
)
if
(
p_input
)
{
{
vout_thread_t
*
p_vout
=
THEMIM
->
getVout
();
vout_thread_t
*
p_vout
=
THEMIM
->
getVout
();
/* Add a fullscreen switch butt
on */
/* Add a fullscreen switch button, since it is the most used functi
on */
if
(
p_vout
)
if
(
p_vout
)
{
{
vlc_value_t
val
;
vlc_value_t
val
;
var_Get
(
p_vout
,
"fullscreen"
,
&
val
)
;
var_Get
(
p_vout
,
"fullscreen"
,
&
val
);
b_isFullscreen
=
!
(
!
val
.
b_bool
);
b_isFullscreen
=
!
(
!
val
.
b_bool
);
if
(
b_isFullscreen
)
if
(
b_isFullscreen
)
CreateAndConnect
(
menu
,
"fullscreen"
,
CreateAndConnect
(
menu
,
"fullscreen"
,
qtr
(
"Leave Fullscreen"
),
""
,
ITEM_NORMAL
,
qtr
(
"Leave Fullscreen"
),
""
,
ITEM_NORMAL
,
VLC_OBJECT
(
p_vout
),
val
,
VLC_VAR_BOOL
,
VLC_OBJECT
(
p_vout
),
val
,
VLC_VAR_BOOL
,
b_isFullscreen
);
b_isFullscreen
);
vlc_object_release
(
p_vout
);
vlc_object_release
(
p_vout
);
}
menu
->
addSeparator
();
menu
->
addSeparator
();
}
/* Input menu */
/* Input menu */
vlc_object_hold
(
p_input
);
vlc_object_hold
(
p_input
);
...
@@ -928,29 +937,14 @@ void QVLCMenu::PopupMenu( intf_thread_t *p_intf, bool show )
...
@@ -928,29 +937,14 @@ void QVLCMenu::PopupMenu( intf_thread_t *p_intf, bool show )
if
(
!
b_isFullscreen
)
if
(
!
b_isFullscreen
)
{
{
submenu
=
new
QMenu
(
qtr
(
"Interface"
),
menu
);
submenu
=
new
QMenu
(
qtr
(
"Interface"
),
menu
);
if
(
mi
)
{
submenu
->
addAction
(
QIcon
(
":/playlist"
),
qtr
(
"Show Playlist"
),
mi
,
SLOT
(
togglePlaylist
()
)
);
action
=
submenu
->
addAction
(
QIcon
(
""
),
qtr
(
"Minimal View"
),
mi
,
SLOT
(
toggleMinimalView
()
)
);
action
->
setCheckable
(
true
);
action
->
setChecked
(
!
(
mi
->
getControlsVisibilityStatus
()
&
CONTROLS_VISIBLE
)
);
action
=
submenu
->
addAction
(
QIcon
(
""
),
qtr
(
"Fullscreen Interface"
),
mi
,
SLOT
(
toggleFullScreen
()
)
);
action
->
setCheckable
(
true
);
action
->
setChecked
(
mi
->
isFullScreen
()
);
}
else
/* We are using the skins interface.
If not, this entry will not show. */
{
QMenu
*
tools
=
ToolsMenu
(
submenu
);
QMenu
*
tools
=
ToolsMenu
(
submenu
);
submenu
->
addSeparator
();
submenu
->
addSeparator
();
objects
.
clear
();
varnames
.
clear
();
/* In skins interface, append some items */
if
(
!
mi
)
{
objects
.
clear
();
varnames
.
clear
();
vlc_object_t
*
p_object
=
(
vlc_object_t
*
)
vlc_object_t
*
p_object
=
(
vlc_object_t
*
)
vlc_object_find_name
(
p_intf
,
"skins2"
,
FIND_PARENT
);
vlc_object_find_name
(
p_intf
,
"skins2"
,
FIND_PARENT
);
if
(
p_object
)
if
(
p_object
)
...
@@ -961,8 +955,11 @@ void QVLCMenu::PopupMenu( intf_thread_t *p_intf, bool show )
...
@@ -961,8 +955,11 @@ void QVLCMenu::PopupMenu( intf_thread_t *p_intf, bool show )
vlc_object_release
(
p_object
);
vlc_object_release
(
p_object
);
}
}
else
else
msg_Dbg
(
p_intf
,
"could not find parent interface"
);
msg_Warn
(
p_intf
,
"could not find parent interface"
);
}
}
else
menu
->
addMenu
(
ViewMenu
(
p_intf
,
mi
,
false
));
menu
->
addMenu
(
submenu
);
menu
->
addMenu
(
submenu
);
}
}
...
@@ -971,13 +968,6 @@ void QVLCMenu::PopupMenu( intf_thread_t *p_intf, bool show )
...
@@ -971,13 +968,6 @@ void QVLCMenu::PopupMenu( intf_thread_t *p_intf, bool show )
p_intf
->
p_sys
->
p_popup_menu
=
menu
;
p_intf
->
p_sys
->
p_popup_menu
=
menu
;
p_intf
->
p_sys
->
p_popup_menu
->
popup
(
QCursor
::
pos
()
);
p_intf
->
p_sys
->
p_popup_menu
->
popup
(
QCursor
::
pos
()
);
}
else
{
// destroy popup if there is one
delete
p_intf
->
p_sys
->
p_popup_menu
;
p_intf
->
p_sys
->
p_popup_menu
=
NULL
;
}
}
}
#undef ACT_ADD
#undef ACT_ADD
...
@@ -1013,8 +1003,8 @@ void QVLCMenu::updateSystrayMenu( MainInterface *mi,
...
@@ -1013,8 +1003,8 @@ void QVLCMenu::updateSystrayMenu( MainInterface *mi,
}
}
sysMenu
->
addSeparator
();
sysMenu
->
addSeparator
();
PopupMenuControlEntries
(
sysMenu
,
p_intf
,
p_input
);
PopupMenuControlEntries
(
sysMenu
,
p_intf
);
//
, p_input );
PopupMenuPlaylistControlEntries
(
sysMenu
,
p_intf
,
p_input
);
PopupMenuPlaylistControlEntries
(
sysMenu
,
p_intf
);
//
, p_input );
sysMenu
->
addSeparator
();
sysMenu
->
addSeparator
();
addDPStaticEntry
(
sysMenu
,
qtr
(
"&Open Media"
),
addDPStaticEntry
(
sysMenu
,
qtr
(
"&Open Media"
),
...
@@ -1038,11 +1028,7 @@ QMenu * QVLCMenu::Populate( intf_thread_t *p_intf,
...
@@ -1038,11 +1028,7 @@ QMenu * QVLCMenu::Populate( intf_thread_t *p_intf,
vector
<
vlc_object_t
*>
&
objects
)
vector
<
vlc_object_t
*>
&
objects
)
{
{
QMenu
*
menu
=
current
;
QMenu
*
menu
=
current
;
if
(
!
menu
)
assert
(
menu
);
{
msg_Warn
(
p_intf
,
"%s leaking a menu"
,
__func__
);
menu
=
new
QMenu
();
}
currentGroup
=
NULL
;
currentGroup
=
NULL
;
...
...
modules/gui/qt4/menus.hpp
View file @
9f0375cd
...
@@ -79,7 +79,7 @@ class QVLCMenu : public QObject
...
@@ -79,7 +79,7 @@ class QVLCMenu : public QObject
public:
public:
/* Main bar creation */
/* Main bar creation */
static
void
createMenuBar
(
MainInterface
*
mi
,
intf_thread_t
*
,
bool
);
static
void
createMenuBar
(
MainInterface
*
mi
,
intf_thread_t
*
);
/* Popups Menus */
/* Popups Menus */
static
void
PopupMenu
(
intf_thread_t
*
,
bool
);
static
void
PopupMenu
(
intf_thread_t
*
,
bool
);
...
@@ -102,31 +102,40 @@ private:
...
@@ -102,31 +102,40 @@ private:
/* All main Menus */
/* All main Menus */
static
QMenu
*
FileMenu
(
intf_thread_t
*
,
QWidget
*
);
static
QMenu
*
FileMenu
(
intf_thread_t
*
,
QWidget
*
);
static
QMenu
*
SDMenu
(
intf_thread_t
*
,
QWidget
*
);
static
QMenu
*
SDMenu
(
intf_thread_t
*
,
QWidget
*
);
static
QMenu
*
ToolsMenu
(
QMenu
*
);
static
QMenu
*
ToolsMenu
(
QMenu
*
);
static
QMenu
*
ToolsMenu
(
QWidget
*
);
static
QMenu
*
ToolsMenu
(
QWidget
*
);
static
QMenu
*
ViewMenu
(
intf_thread_t
*
,
QMenu
*
,
MainInterface
*
,
bool
,
bool
with
=
true
);
static
QMenu
*
ViewMenu
(
intf_thread_t
*
,
MainInterface
*
,
bool
with
=
true
);
static
QMenu
*
InterfacesMenu
(
intf_thread_t
*
p_intf
,
QMenu
*
);
static
QMenu
*
NavigMenu
(
intf_thread_t
*
,
QMenu
*
);
static
QMenu
*
NavigMenu
(
intf_thread_t
*
,
QMenu
*
);
static
QMenu
*
NavigMenu
(
intf_thread_t
*
,
QWidget
*
);
static
QMenu
*
NavigMenu
(
intf_thread_t
*
,
QWidget
*
);
static
QMenu
*
RebuildNavigMenu
(
intf_thread_t
*
,
QMenu
*
);
static
QMenu
*
VideoMenu
(
intf_thread_t
*
,
QMenu
*
);
static
QMenu
*
VideoMenu
(
intf_thread_t
*
,
QMenu
*
);
static
QMenu
*
VideoMenu
(
intf_thread_t
*
,
QWidget
*
);
static
QMenu
*
VideoMenu
(
intf_thread_t
*
,
QWidget
*
);
static
QMenu
*
AudioMenu
(
intf_thread_t
*
,
QMenu
*
);
static
QMenu
*
AudioMenu
(
intf_thread_t
*
,
QMenu
*
);
static
QMenu
*
AudioMenu
(
intf_thread_t
*
,
QWidget
*
);
static
QMenu
*
AudioMenu
(
intf_thread_t
*
,
QWidget
*
);
static
QMenu
*
InterfacesMenu
(
intf_thread_t
*
p_intf
,
QMenu
*
);
static
QMenu
*
HelpMenu
(
QWidget
*
);
static
QMenu
*
HelpMenu
(
QWidget
*
);
/* Popups Menus */
/* Popups Menus */
static
void
PopupMenuStaticEntries
(
QMenu
*
menu
);
static
void
PopupMenuStaticEntries
(
QMenu
*
menu
);
static
void
PopupMenuControlEntries
(
QMenu
*
menu
,
intf_thread_t
*
p_intf
,
static
void
PopupPlayEntries
(
QMenu
*
menu
,
intf_thread_t
*
p_intf
,
input_thread_t
*
p_input
);
static
void
PopupMenuPlaylistControlEntries
(
QMenu
*
menu
,
intf_thread_t
*
p_intf
,
input_thread_t
*
p_input
);
input_thread_t
*
p_input
);
static
void
PopupMenuControlEntries
(
QMenu
*
menu
,
intf_thread_t
*
p_intf
);
static
void
PopupMenuPlaylistControlEntries
(
QMenu
*
menu
,
intf_thread_t
*
p_intf
);
/* Generic automenu methods */
/* Generic automenu methods */
static
QMenu
*
Populate
(
intf_thread_t
*
,
QMenu
*
current
,
static
QMenu
*
Populate
(
intf_thread_t
*
,
QMenu
*
current
,
vector
<
const
char
*>&
,
vector
<
vlc_object_t
*>&
);
vector
<
const
char
*>&
,
vector
<
vlc_object_t
*>&
);
static
void
CreateAndConnect
(
QMenu
*
,
const
char
*
,
QString
,
QString
,
static
void
CreateAndConnect
(
QMenu
*
,
const
char
*
,
QString
,
QString
,
int
,
vlc_object_t
*
,
vlc_value_t
,
int
,
bool
c
=
false
);
int
,
vlc_object_t
*
,
vlc_value_t
,
int
,
bool
c
=
false
);
static
void
UpdateItem
(
intf_thread_t
*
,
QMenu
*
,
const
char
*
,
static
void
UpdateItem
(
intf_thread_t
*
,
QMenu
*
,
const
char
*
,
vlc_object_t
*
,
bool
);
vlc_object_t
*
,
bool
);
static
int
CreateChoicesMenu
(
QMenu
*
,
const
char
*
,
vlc_object_t
*
,
bool
);
static
int
CreateChoicesMenu
(
QMenu
*
,
const
char
*
,
vlc_object_t
*
,
bool
);
...
@@ -152,7 +161,7 @@ public:
...
@@ -152,7 +161,7 @@ public:
{
{
case
1
:
QVLCMenu
::
AudioMenu
(
p_intf
,
menu
);
break
;
case
1
:
QVLCMenu
::
AudioMenu
(
p_intf
,
menu
);
break
;
case
2
:
QVLCMenu
::
VideoMenu
(
p_intf
,
menu
);
break
;
case
2
:
QVLCMenu
::
VideoMenu
(
p_intf
,
menu
);
break
;
case
3
:
QVLCMenu
::
NavigMenu
(
p_intf
,
menu
);
break
;
case
3
:
QVLCMenu
::
Rebuild
NavigMenu
(
p_intf
,
menu
);
break
;
case
4
:
QVLCMenu
::
InterfacesMenu
(
p_intf
,
menu
);
break
;
case
4
:
QVLCMenu
::
InterfacesMenu
(
p_intf
,
menu
);
break
;
}
}
}
}
...
...
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