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
efed5df6
Commit
efed5df6
authored
Jul 18, 2006
by
Clément Stenac
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
* compiles-but-untested complete implementation of menus and popups
* handle play/pause status
parent
054049cf
Changes
9
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
377 additions
and
426 deletions
+377
-426
modules/gui/qt4/dialogs_provider.cpp
modules/gui/qt4/dialogs_provider.cpp
+9
-0
modules/gui/qt4/dialogs_provider.hpp
modules/gui/qt4/dialogs_provider.hpp
+2
-0
modules/gui/qt4/input_manager.cpp
modules/gui/qt4/input_manager.cpp
+38
-2
modules/gui/qt4/input_manager.hpp
modules/gui/qt4/input_manager.hpp
+4
-0
modules/gui/qt4/main_interface.cpp
modules/gui/qt4/main_interface.cpp
+32
-26
modules/gui/qt4/main_interface.hpp
modules/gui/qt4/main_interface.hpp
+1
-0
modules/gui/qt4/menus.cpp
modules/gui/qt4/menus.cpp
+249
-388
modules/gui/qt4/menus.hpp
modules/gui/qt4/menus.hpp
+38
-10
modules/gui/qt4/qt4.hpp
modules/gui/qt4/qt4.hpp
+4
-0
No files found.
modules/gui/qt4/dialogs_provider.cpp
View file @
efed5df6
...
...
@@ -45,6 +45,9 @@ DialogsProvider::DialogsProvider( intf_thread_t *_p_intf ) :
connect
(
menusMapper
,
SIGNAL
(
mapped
(
QObject
*
)
),
this
,
SLOT
(
menuAction
(
QObject
*
))
);
menusUpdateMapper
=
new
QSignalMapper
();
connect
(
menusMapper
,
SIGNAL
(
mapped
(
QObject
*
)
),
this
,
SLOT
(
menuUpdateAction
(
QObject
*
))
);
}
DialogsProvider
::~
DialogsProvider
()
...
...
@@ -152,6 +155,12 @@ void DialogsProvider::menuAction( QObject *data )
QVLCMenu
::
DoAction
(
p_intf
,
data
);
}
void
DialogsProvider
::
menuUpdateAction
(
QObject
*
data
)
{
MenuFunc
*
f
=
qobject_cast
<
MenuFunc
*>
(
data
);
f
->
doFunc
(
p_intf
);
}
void
DialogsProvider
::
simpleOpenDialog
()
{
}
...
...
modules/gui/qt4/dialogs_provider.hpp
View file @
efed5df6
...
...
@@ -56,6 +56,7 @@ public:
protected:
friend
class
QVLCMenu
;
QSignalMapper
*
menusMapper
;
QSignalMapper
*
menusUpdateMapper
;
void
customEvent
(
QEvent
*
);
private:
DialogsProvider
(
intf_thread_t
*
);
...
...
@@ -73,6 +74,7 @@ public slots:
void
popupMenu
(
int
);
void
doInteraction
(
intf_dialog_args_t
*
);
void
menuAction
(
QObject
*
);
void
menuUpdateAction
(
QObject
*
);
void
streamingDialog
();
};
...
...
modules/gui/qt4/input_manager.cpp
View file @
efed5df6
...
...
@@ -34,10 +34,10 @@
InputManager
::
InputManager
(
QObject
*
parent
,
intf_thread_t
*
_p_intf
)
:
QObject
(
parent
),
p_intf
(
_p_intf
)
{
i_old_playing_status
=
END_S
;
p_input
=
NULL
;
/* Subscribe to updates */
connect
(
DialogsProvider
::
getInstance
(
p_intf
)
->
fixed_timer
,
SIGNAL
(
timeout
()
),
this
,
SLOT
(
update
()
)
);
connect
(
THEDP
->
fixed_timer
,
SIGNAL
(
timeout
()
),
this
,
SLOT
(
update
()
)
);
}
InputManager
::~
InputManager
()
...
...
@@ -103,6 +103,14 @@ void InputManager::update()
}
emit
nameChanged
(
text
);
/* Update playing status */
var_Get
(
p_input
,
"state"
,
&
val
);
val
.
i_int
=
val
.
i_int
==
PAUSE_S
?
PAUSE_S
:
PLAYING_S
;
if
(
i_old_playing_status
!=
val
.
i_int
)
{
i_old_playing_status
=
val
.
i_int
;
emit
statusChanged
(
val
.
i_int
==
PAUSE_S
?
PAUSE_S
:
PLAYING_S
);
}
}
void
InputManager
::
sliderUpdate
(
float
new_pos
)
...
...
@@ -111,6 +119,24 @@ void InputManager::sliderUpdate( float new_pos )
var_SetFloat
(
p_input
,
"position"
,
new_pos
);
}
void
InputManager
::
togglePlayPause
()
{
vlc_value_t
state
;
var_Get
(
p_input
,
"state"
,
&
state
);
if
(
state
.
i_int
!=
PAUSE_S
)
{
/* A stream is being played, pause it */
state
.
i_int
=
PAUSE_S
;
}
else
{
/* Stream is paused, resume it */
state
.
i_int
=
PLAYING_S
;
}
var_Set
(
p_input
,
"state"
,
state
);
emit
statusChanged
(
state
.
i_int
);
}
/**********************************************************************
* MainInputManager implementation. Wrap an input manager and
* take care of updating the main playlist input
...
...
@@ -157,3 +183,13 @@ void MainInputManager::updateInput()
}
vlc_mutex_unlock
(
&
p_intf
->
change_lock
);
}
void
MainInputManager
::
togglePlayPause
()
{
if
(
p_input
==
NULL
)
{
playlist_Play
(
THEPL
);
return
;
}
getIM
()
->
togglePlayPause
();
}
modules/gui/qt4/input_manager.hpp
View file @
efed5df6
...
...
@@ -37,8 +37,10 @@ public:
private:
intf_thread_t
*
p_intf
;
input_thread_t
*
p_input
;
int
i_old_playing_status
;
public
slots
:
void
togglePlayPause
();
void
update
();
///< Periodic updates
void
setInput
(
input_thread_t
*
);
///< Our controlled input changed
void
sliderUpdate
(
float
);
///< User dragged the slider. We get new pos
...
...
@@ -70,6 +72,8 @@ private:
input_thread_t
*
p_input
;
static
MainInputManager
*
instance
;
MainInputManager
(
intf_thread_t
*
);
public
slots
:
void
togglePlayPause
();
private
slots
:
void
updateInput
();
signals:
...
...
modules/gui/qt4/main_interface.cpp
View file @
efed5df6
...
...
@@ -30,6 +30,7 @@
#include <QCloseEvent>
#include <assert.h>
#include <QPushButton>
#include "menus.hpp"
static
int
InteractCallback
(
vlc_object_t
*
,
const
char
*
,
vlc_value_t
,
vlc_value_t
,
void
*
);
...
...
@@ -57,10 +58,9 @@ MainInterface::MainInterface( intf_thread_t *_p_intf ) : QVLCMW( _p_intf )
ui
.
volLowLabel
->
setPixmap
(
QPixmap
(
":/pixmaps/volume-low.png"
)
);
ui
.
volHighLabel
->
setPixmap
(
QPixmap
(
":/pixmaps/volume-high.png"
)
);
//QVLCMenu::createMenuBar(
);
QVLCMenu
::
createMenuBar
(
menuBar
(),
p_intf
);
resize
(
500
,
131
);
fprintf
(
stderr
,
"Before creating the video widget, size is %ix%i
\n
"
,
size
().
width
(),
size
().
height
()
);
// if( config_GetInt( p_intf, "embedded" ) )
{
...
...
@@ -99,19 +99,18 @@ MainInterface::MainInterface( intf_thread_t *_p_intf ) : QVLCMW( _p_intf )
MainInputManager
::
getInstance
(
p_intf
);
/* Get timer updates */
connect
(
DialogsProvider
::
getInstance
(
NULL
)
->
fixed_timer
,
SIGNAL
(
timeout
()
),
this
,
SLOT
(
updateOnTimer
()
)
);
connect
(
THEDP
->
fixed_timer
,
SIGNAL
(
timeout
()
)
,
this
,
SLOT
(
updateOnTimer
()
)
);
/* Connect the input manager to the GUI elements it manages */
connect
(
MainInputManager
::
getInstance
(
p_intf
)
->
getIM
(),
SIGNAL
(
positionUpdated
(
float
,
int
,
int
)
),
connect
(
THEMIM
->
getIM
(),
SIGNAL
(
positionUpdated
(
float
,
int
,
int
)
),
slider
,
SLOT
(
setPosition
(
float
,
int
,
int
)
)
);
connect
(
slider
,
SIGNAL
(
sliderDragged
(
float
)
),
MainInputManager
::
getInstance
(
p_intf
)
->
getIM
(),
SLOT
(
sliderUpdate
(
float
)
)
);
connect
(
MainInputManager
::
getInstance
(
p_intf
)
->
getIM
(),
SIGNAL
(
positionUpdated
(
float
,
int
,
int
)
),
connect
(
THEMIM
->
getIM
(),
SIGNAL
(
positionUpdated
(
float
,
int
,
int
)
),
this
,
SLOT
(
setDisplay
(
float
,
int
,
int
)
)
);
connect
(
THEMIM
->
getIM
(),
SIGNAL
(
statusChanged
(
int
)
),
this
,
SLOT
(
setStatus
(
int
)
)
);
connect
(
slider
,
SIGNAL
(
sliderDragged
(
float
)
),
THEMIM
->
getIM
(),
SLOT
(
sliderUpdate
(
float
)
)
);
/* Actions */
connect
(
ui
.
playButton
,
SLOT
(
clicked
()
),
this
,
SLOT
(
play
()
)
);
...
...
@@ -119,8 +118,8 @@ MainInterface::MainInterface( intf_thread_t *_p_intf ) : QVLCMW( _p_intf )
connect
(
ui
.
nextButton
,
SLOT
(
clicked
()
),
this
,
SLOT
(
next
()
)
);
connect
(
ui
.
prevButton
,
SLOT
(
clicked
()
),
this
,
SLOT
(
prev
()
)
);
connect
(
ui
.
playlistButton
,
SLOT
(
clicked
()
),
DialogsProvider
::
getInstance
(
p_intf
)
,
SLOT
(
playlistDialog
()
)
);
connect
(
ui
.
playlistButton
,
SLOT
(
clicked
()
),
THEDP
,
SLOT
(
playlistDialog
()
)
);
var_Create
(
p_intf
,
"interaction"
,
VLC_VAR_ADDRESS
);
var_AddCallback
(
p_intf
,
"interaction"
,
InteractCallback
,
this
);
...
...
@@ -143,14 +142,6 @@ MainInterface::~MainInterface()
void
MainInterface
::
resizeEvent
(
QResizeEvent
*
e
)
{
fprintf
(
stderr
,
"Resized to %ix%i
\n
"
,
e
->
size
().
width
(),
e
->
size
().
height
()
);
fprintf
(
stderr
,
"MI constraints %ix%i -> %ix%i
\n
"
,
p_intf
->
p_sys
->
p_mi
->
minimumSize
().
width
(),
p_intf
->
p_sys
->
p_mi
->
minimumSize
().
height
(),
p_intf
->
p_sys
->
p_mi
->
maximumSize
().
width
(),
p_intf
->
p_sys
->
p_mi
->
maximumSize
().
height
()
);
videoSize
.
setHeight
(
e
->
size
().
height
()
-
addSize
.
height
()
);
videoSize
.
setWidth
(
e
->
size
().
width
()
-
addSize
.
width
()
);
p_intf
->
p_sys
->
p_video
->
updateGeometry
()
;
...
...
@@ -162,7 +153,14 @@ void MainInterface::stop()
}
void
MainInterface
::
play
()
{
playlist_Play
(
THEPL
);
if
(
!
THEPL
->
i_size
||
!
THEPL
->
i_enabled
)
{
/* The playlist is empty, open a file requester */
THEDP
->
openDialog
();
setStatus
(
0
);
return
;
}
THEMIM
->
togglePlayPause
();
}
void
MainInterface
::
prev
()
{
...
...
@@ -183,6 +181,15 @@ void MainInterface::setDisplay( float pos, int time, int length )
ui
.
sliderBox
->
setTitle
(
title
);
}
void
MainInterface
::
setStatus
(
int
status
)
{
fprintf
(
stderr
,
"Status is now %i
\n
"
,
status
);
if
(
status
==
2
)
// Playing
ui
.
playButton
->
setIcon
(
QIcon
(
":/pixmaps/pause.png"
)
);
else
ui
.
playButton
->
setIcon
(
QIcon
(
":/pixmaps/play.png"
)
);
}
void
MainInterface
::
updateOnTimer
()
{
if
(
p_intf
->
b_die
)
...
...
@@ -206,7 +213,6 @@ static int InteractCallback( vlc_object_t *p_this,
MainInterface
*
p_interface
=
(
MainInterface
*
)
param
;
DialogEvent
*
event
=
new
DialogEvent
(
INTF_DIALOG_INTERACTION
,
0
,
p_arg
);
QApplication
::
postEvent
(
DialogsProvider
::
getInstance
(
NULL
),
static_cast
<
QEvent
*>
(
event
)
);
QApplication
::
postEvent
(
THEDP
,
static_cast
<
QEvent
*>
(
event
)
);
return
VLC_SUCCESS
;
}
modules/gui/qt4/main_interface.hpp
View file @
efed5df6
...
...
@@ -53,6 +53,7 @@ private:
input_thread_t
*
p_input
;
Ui
::
MainInterfaceUI
ui
;
private
slots
:
void
setStatus
(
int
);
void
setDisplay
(
float
,
int
,
int
);
void
updateOnTimer
();
void
play
();
...
...
modules/gui/qt4/menus.cpp
View file @
efed5df6
...
...
@@ -23,7 +23,9 @@
#include "menus.hpp"
#include "dialogs_provider.hpp"
#include "input_manager.hpp"
#include <QMenu>
#include <QMenuBar>
#include <QAction>
#include <QActionGroup>
#include <QSignalMapper>
...
...
@@ -37,59 +39,23 @@ enum
static
QActionGroup
*
currentGroup
;
/*****************************************************************************
* Static menu helpers
* These create already mapped and connected menus
*****************************************************************************/
#define STATIC_ADD( text, help, icon, slot ) { QAction *action = menu->addAction( text, THEDP, SLOT( slot ) ); }
QMenu
*
QVLCMenu
::
FileMenu
()
{
QMenu
*
menu
=
new
QMenu
();
STATIC_ADD
(
_
(
"Quick &Open File..."
)
,
""
,
NULL
,
simpleOpenDialog
()
);
STATIC_ADD
(
_
(
"&Advanced Open..."
),
""
,
NULL
,
openDialog
()
);
menu
->
addSeparator
();
STATIC_ADD
(
_
(
"Streaming..."
),
""
,
NULL
,
streamingDialog
()
);
menu
->
addSeparator
();
STATIC_ADD
(
_
(
"&Quit"
)
,
""
,
NULL
,
quit
()
);
return
menu
;
}
// Add static entries to menus
#define DP_SADD( text, help, icon, slot ) { if( strlen(icon) > 0 ) { QAction *action = menu->addAction( text, THEDP, SLOT( slot ) ); action->setIcon(QIcon(icon));} else { menu->addAction( text, THEDP, SLOT( slot ) ); } }
#define MIM_SADD( text, help, icon, slot ) { if( strlen(icon) > 0 ) { QAction *action = menu->addAction( text, THEMIM, SLOT( slot ) ); action->setIcon(QIcon(icon));} else { menu->addAction( text, THEMIM, SLOT( slot ) ); } }
#if 0
QMenu *OpenStreamMenu( intf_thread_t *p_intf )
{
QMenu *menu = new QMenu;
menu->Append( OpenFileSimple_Event, wxU(_("Quick &Open File...")) );
menu->Append( OpenFile_Event, wxU(_("Open &File...")) );
menu->Append( OpenDirectory_Event, wxU(_("Open D&irectory...")) );
menu->Append( OpenDisc_Event, wxU(_("Open &Disc...")) );
menu->Append( OpenNet_Event, wxU(_("Open &Network Stream...")) );
menu->Append( OpenCapture_Event, wxU(_("Open &Capture Device...")) );
return menu;
}
wxMenu *MiscMenu( intf_thread_t *p_intf )
{
wxMenu *menu = new wxMenu;
menu->Append( MediaInfo_Event, wxU(_("Media &Info...")) );
menu->Append( Messages_Event, wxU(_("&Messages...")) );
menu->Append( Preferences_Event, wxU(_("&Preferences...")) );
return menu;
}
#endif
/*****************************************************************************
*
Builder
s for the dynamic menus
*
Definitions of variable
s for the dynamic menus
*****************************************************************************/
#define PUSH_VAR( var ) rs_varnames.push_back( var ); \
ri_objects.push_back( p_object->i_object_id )
#define PUSH_VAR( var ) varnames.push_back( var ); \
objects.push_back( p_object->i_object_id )
#define PUSH_SEPARATOR if( objects.size() != i_last_separator ) { \
objects.push_back( 0 ); varnames.push_back( "" ); \
i_last_separator = objects.size(); }
static
int
InputAutoMenuBuilder
(
vlc_object_t
*
p_object
,
vector
<
int
>
&
ri_
objects
,
vector
<
const
char
*>
&
rs_
varnames
)
vector
<
int
>
&
objects
,
vector
<
const
char
*>
&
varnames
)
{
PUSH_VAR
(
"bookmark"
);
PUSH_VAR
(
"title"
);
...
...
@@ -101,8 +67,8 @@ static int InputAutoMenuBuilder( vlc_object_t *p_object,
}
static
int
VideoAutoMenuBuilder
(
vlc_object_t
*
p_object
,
vector
<
int
>
&
ri_
objects
,
vector
<
const
char
*>
&
rs_
varnames
)
vector
<
int
>
&
objects
,
vector
<
const
char
*>
&
varnames
)
{
PUSH_VAR
(
"fullscreen"
);
PUSH_VAR
(
"zoom"
);
...
...
@@ -125,8 +91,8 @@ static int VideoAutoMenuBuilder( vlc_object_t *p_object,
}
static
int
AudioAutoMenuBuilder
(
vlc_object_t
*
p_object
,
vector
<
int
>
&
ri_
objects
,
vector
<
const
char
*>
&
rs_
varnames
)
vector
<
int
>
&
objects
,
vector
<
const
char
*>
&
varnames
)
{
PUSH_VAR
(
"audio-device"
);
PUSH_VAR
(
"audio-channels"
);
...
...
@@ -135,321 +101,310 @@ static int AudioAutoMenuBuilder( vlc_object_t *p_object,
return
VLC_SUCCESS
;
}
static
int
IntfAutoMenuBuilder
(
intf_thread_t
*
p_intf
,
vector
<
int
>
&
ri_objects
,
vector
<
const
char
*>
&
rs_varnames
,
bool
is_popup
)
/*****************************************************************************
* All normal menus
*****************************************************************************/
void
QVLCMenu
::
createMenuBar
(
QMenuBar
*
bar
,
intf_thread_t
*
p_intf
)
{
/* vlc_object_find is needed because of the dialogs provider case */
vlc_object_t
*
p_object
;
p_object
=
(
vlc_object_t
*
)
vlc_object_find
(
p_intf
,
VLC_OBJECT_INTF
,
FIND_PARENT
);
#define BAR_ADD( func, title ) { \
QMenu *menu = func; menu->setTitle( title ); bar->addMenu( menu ); }
#define BAR_DADD( func, title, id ) { \
QMenu *menu = func; menu->setTitle( title ); bar->addMenu( menu ); \
MenuFunc *f = new MenuFunc( menu, id ); \
connect( menu, SIGNAL( aboutToShow() ), \
THEDP->menusUpdateMapper, SLOT(map()) ); \
THEDP->menusUpdateMapper->setMapping( menu, f ); }
BAR_ADD
(
FileMenu
(),
_
(
"File"
)
);
BAR_ADD
(
ToolsMenu
(
p_intf
),
_
(
"Tools"
)
);
BAR_DADD
(
VideoMenu
(
p_intf
,
NULL
),
_
(
"Video"
),
1
);
BAR_DADD
(
AudioMenu
(
p_intf
,
NULL
),
_
(
"Audio"
),
2
);
BAR_DADD
(
NavigMenu
(
p_intf
,
NULL
),
_
(
"Navigation"
),
3
);
// BAR_ADD( HelpMenu(), _("Help" ) );
}
QMenu
*
QVLCMenu
::
FileMenu
()
{
QMenu
*
menu
=
new
QMenu
();
DP_SADD
(
_
(
"Quick &Open File..."
)
,
""
,
""
,
simpleOpenDialog
()
);
DP_SADD
(
_
(
"&Advanced Open..."
),
""
,
""
,
openDialog
()
);
menu
->
addSeparator
();
DP_SADD
(
_
(
"Streaming..."
),
""
,
""
,
streamingDialog
()
);
menu
->
addSeparator
();
DP_SADD
(
_
(
"&Quit"
)
,
""
,
""
,
quit
()
);
return
menu
;
}
QMenu
*
QVLCMenu
::
ToolsMenu
(
intf_thread_t
*
p_intf
,
bool
with_intf
)
{
QMenu
*
menu
=
new
QMenu
();
if
(
with_intf
)
{
QMenu
*
intfmenu
=
InterfacesMenu
(
p_intf
,
NULL
);
intfmenu
->
setTitle
(
_
(
"Interfaces"
)
);
menu
->
addMenu
(
intfmenu
);
/** \todo ADD EXT GUI HERE */
menu
->
addSeparator
();
}
DP_SADD
(
_
(
"Messages"
),
""
,
""
,
messagesDialog
()
);
DP_SADD
(
_
(
"Information"
)
,
""
,
""
,
streaminfoDialog
()
);
DP_SADD
(
_
(
"Bookmarks"
),
""
,
""
,
bookmarksDialog
()
);
menu
->
addSeparator
();
DP_SADD
(
_
(
"Preferences"
),
""
,
""
,
prefsDialog
()
);
return
menu
;
}
QMenu
*
QVLCMenu
::
InterfacesMenu
(
intf_thread_t
*
p_intf
,
QMenu
*
current
)
{
vector
<
int
>
objects
;
vector
<
const
char
*>
varnames
;
/** \todo add "switch to XXX" */
varnames
.
push_back
(
"intf-add"
);
objects
.
push_back
(
p_intf
->
i_object_id
);
QMenu
*
menu
=
Populate
(
p_intf
,
current
,
varnames
,
objects
);
connect
(
menu
,
SIGNAL
(
aboutToShow
()
),
THEDP
->
menusUpdateMapper
,
SLOT
(
map
())
);
THEDP
->
menusUpdateMapper
->
setMapping
(
menu
,
4
);
return
menu
;
}
QMenu
*
QVLCMenu
::
AudioMenu
(
intf_thread_t
*
p_intf
,
QMenu
*
current
)
{
vector
<
int
>
objects
;
vector
<
const
char
*>
varnames
;
vlc_object_t
*
p_object
=
(
vlc_object_t
*
)
vlc_object_find
(
p_intf
,
VLC_OBJECT_INPUT
,
FIND_ANYWHERE
);
if
(
p_object
!=
NULL
)
{
if
(
is_popup
)
PUSH_VAR
(
"audio-es"
);
vlc_object_release
(
p_object
);
}
p_object
=
(
vlc_object_t
*
)
vlc_object_find
(
p_intf
,
VLC_OBJECT_AOUT
,
FIND_ANYWHERE
);
if
(
p_object
)
{
PUSH_VAR
(
"intf-switch"
);
AudioAutoMenuBuilder
(
p_object
,
objects
,
varnames
);
vlc_object_release
(
p_object
);
}
else
return
Populate
(
p_intf
,
current
,
varnames
,
objects
);
}
QMenu
*
QVLCMenu
::
VideoMenu
(
intf_thread_t
*
p_intf
,
QMenu
*
current
)
{
vlc_object_t
*
p_object
;
vector
<
int
>
objects
;
vector
<
const
char
*>
varnames
;
p_object
=
(
vlc_object_t
*
)
vlc_object_find
(
p_intf
,
VLC_OBJECT_INPUT
,
FIND_ANYWHERE
);
if
(
p_object
!=
NULL
)
{
PUSH_VAR
(
"intf-switch"
);
PUSH_VAR
(
"video-es"
);
PUSH_VAR
(
"spu-es"
);
vlc_object_release
(
p_object
);
}
PUSH_VAR
(
"intf-add"
);
PUSH_VAR
(
"intf-skins"
);
p_object
=
(
vlc_object_t
*
)
vlc_object_find
(
p_intf
,
VLC_OBJECT_VOUT
,
FIND_ANYWHERE
);
if
(
p_object
!=
NULL
)
{
VideoAutoMenuBuilder
(
p_object
,
objects
,
varnames
);
vlc_object_release
(
p_object
);
}
return
VLC_SUCCESS
;
return
Populate
(
p_intf
,
current
,
varnames
,
objects
)
;
}
#undef PUSH_VAR
/*****************************************************************************
* Popup menus
*****************************************************************************/
QMenu
*
QVLCMenu
::
NavigMenu
(
intf_thread_t
*
p_intf
,
QMenu
*
current
)
{
vlc_object_t
*
p_object
;
vector
<
int
>
objects
;
vector
<
const
char
*>
varnames
;
#define PUSH_VAR( var ) as_varnames.push_back( var ); \
ai_objects.push_back( p_object->i_object_id )
/* FIXME */
p_object
=
(
vlc_object_t
*
)
vlc_object_find
(
p_intf
,
VLC_OBJECT_INPUT
,
FIND_ANYWHERE
);
if
(
p_object
!=
NULL
)
{
InputAutoMenuBuilder
(
p_object
,
objects
,
varnames
);
PUSH_VAR
(
"prev-title"
);
PUSH_VAR
(
"next-title"
);
PUSH_VAR
(
"prev-chapter"
);
PUSH_VAR
(
"next-chapter"
);
vlc_object_release
(
p_object
);
}
return
Populate
(
p_intf
,
current
,
varnames
,
objects
);
}
#define PUSH_SEPARATOR if( ai_objects.size() != i_last_separator ) { \
ai_objects.push_back( 0 ); \
as_varnames.push_back( "" ); \
i_last_separator = ai_objects.size(); }
/*****************************************************************************
* Popup menus
*****************************************************************************/
#define POPUP_BOILERPLATE \
unsigned int i_last_separator = 0; \
vector<int> ai_objects; \
vector<const char *> as_varnames; \
playlist_t *p_playlist = (playlist_t *) vlc_object_find( p_intf, \
VLC_OBJECT_PLAYLIST, FIND_ANYWHERE );\
if( !p_playlist ) \
return; \
input_thread_t *p_input = p_playlist->p_input
vector<int> objects; \
vector<const char *> varnames; \
input_thread_t *p_input = THEMIM->getInput();
#define CREATE_POPUP \
QMenu *popupmenu = new QMenu(); \
QVLCMenu::Populate( popupmenu, as_varnames, ai_objects ); \
p_intf->p_sys->p_popup_menu = &popupmenu; \
QMenu *menu = new QMenu(); \
Populate( p_intf, menu, varnames, objects ); \
p_intf->p_sys->p_popup_menu = menu; \
menu->popup( QCursor::pos() ); \
p_intf->p_sys->p_popup_menu = NULL; \
i_last_separator = 0 // stop compiler warning
/// p_parent->PopupMenu( &popupmenu, pos.x, pos.y ); \ /// TODO
i_last_separator = 0;
#define POPUP_STATIC_ENTRIES \
if( p_input != NULL ) \
{ \
vlc_value_t val; \
popupmenu.InsertSeparator( 0 ); \
popupmenu.Insert( 0, Stop_Event, wxU(_("Stop")) ); \
popupmenu.Insert( 0, Previous_Event, wxU(_("Previous")) ); \
popupmenu.Insert( 0, Next_Event, wxU(_("Next")) ); \
MIM_SADD( _("Stop"), "", "", stop() ); \
MIM_SADD( _("Previous"), "", "", prev() ); \
MIM_SADD( _("Next"), "", "", next() ); \
if( p_input ) \
{ \
var_Get( p_input, "state", &val ); \
if( val.i_int == PAUSE_S ) \
popupmenu.Insert( 0, Play_Event, wxU(_("Play")) ); \
else \
popupmenu.Insert( 0, Pause_Event, wxU(_("Pause")) ); \
\
vlc_object_release( p_input ); \
} \
MIM_SADD( _("Play"), "", "", togglePlayPause() ) \
else \
{ \
if( p_playlist && p_playlist->i_size ) \
{ \
popupmenu.InsertSeparator( 0 ); \
popupmenu.Insert( 0, Play_Event, wxU(_("Play")) ); \
} \
if( p_playlist ) vlc_object_release( p_playlist ); \
MIM_SADD( _("Pause"), "", "", togglePlayPause() ) \
} \
else if( THEPL->i_size && THEPL->i_enabled ) \
MIM_SADD( _("Play"), "", "", togglePlayPause() ) \
\
popupmenu.Append( MenuDummy_Event, wxU(_("Miscellaneous")), \
MiscMenu( p_intf ), wxT("") )
QMenu *intfmenu = InterfacesMenu( p_intf, NULL ); \
intfmenu->setTitle( _("Interfaces" ) ); \
menu->addMenu( intfmenu ); \
\
QMenu *toolsmenu = ToolsMenu( p_intf, false ); \
toolsmenu->setTitle( _("Tools" ) ); \
menu->addMenu( toolsmenu ); \
void
QVLCMenu
::
VideoPopupMenu
(
intf_thread_t
*
p_intf
,
const
QPoint
&
pos
)
void
QVLCMenu
::
VideoPopupMenu
(
intf_thread_t
*
p_intf
)
{
POPUP_BOILERPLATE
;
if
(
p_input
)
{
vlc_object_yield
(
p_input
);
as_
varnames
.
push_back
(
"video-es"
);
ai_
objects
.
push_back
(
p_input
->
i_object_id
);
as_
varnames
.
push_back
(
"spu-es"
);
ai_
objects
.
push_back
(
p_input
->
i_object_id
);
varnames
.
push_back
(
"video-es"
);
objects
.
push_back
(
p_input
->
i_object_id
);
varnames
.
push_back
(
"spu-es"
);
objects
.
push_back
(
p_input
->
i_object_id
);
vlc_object_t
*
p_vout
=
(
vlc_object_t
*
)
vlc_object_find
(
p_input
,
VLC_OBJECT_VOUT
,
FIND_CHILD
);
if
(
p_vout
)
{
VideoAutoMenuBuilder
(
p_vout
,
ai_objects
,
as_
varnames
);
VideoAutoMenuBuilder
(
p_vout
,
objects
,
varnames
);
vlc_object_release
(
p_vout
);
}
vlc_object_release
(
p_input
);
}
vlc_object_release
(
p_playlist
);
//CREATE_POPUP;
CREATE_POPUP
;
}
void
QVLCMenu
::
AudioPopupMenu
(
intf_thread_t
*
p_intf
,
const
QPoint
&
pos
)
void
QVLCMenu
::
AudioPopupMenu
(
intf_thread_t
*
p_intf
)
{
POPUP_BOILERPLATE
;
if
(
p_input
)
{
vlc_object_yield
(
p_input
);
as_
varnames
.
push_back
(
"audio-es"
);
ai_
objects
.
push_back
(
p_input
->
i_object_id
);
varnames
.
push_back
(
"audio-es"
);
objects
.
push_back
(
p_input
->
i_object_id
);
vlc_object_t
*
p_aout
=
(
vlc_object_t
*
)
vlc_object_find
(
p_input
,
VLC_OBJECT_AOUT
,
FIND_ANYWHERE
);
if
(
p_aout
)
{
AudioAutoMenuBuilder
(
p_aout
,
ai_objects
,
as_
varnames
);
AudioAutoMenuBuilder
(
p_aout
,
objects
,
varnames
);
vlc_object_release
(
p_aout
);
}
vlc_object_release
(
p_input
);
}
vlc_object_release
(
p_playlist
);
//CREATE_POPUP;
CREATE_POPUP
;
}
#if 0
/* Navigation stuff, and general */
static void MiscPopupMenu( intf_thread_t *p_intf, const QPoint &pos
)
void
QVLCMenu
::
MiscPopupMenu
(
intf_thread_t
*
p_intf
)
{
POPUP_BOILERPLATE
;
if
(
p_input
)
{
vlc_object_yield
(
p_input
);
as_
varnames.push_back( "audio-es" );
InputAutoMenuBuilder( VLC_OBJECT(p_input),
ai_objects, as_
varnames );
varnames
.
push_back
(
"audio-es"
);
InputAutoMenuBuilder
(
VLC_OBJECT
(
p_input
),
objects
,
varnames
);
PUSH_SEPARATOR
;
}
IntfAutoMenuBuilder( p_intf, ai_objects, as_varnames, true );
Menu popupmenu( p_intf, PopupMenu_Events );
popupmenu.Populate( as_varnames, ai_objects );
QMenu
*
menu
=
new
QMenu
();
Populate
(
p_intf
,
menu
,
varnames
,
objects
);
menu
->
addSeparator
();
POPUP_STATIC_ENTRIES
;
popupmenu.Append( MenuDummy_Event, wxU(_("Open")),
OpenStreamMenu( p_intf ), wxT("") );
p_intf->p_sys->p_popup_menu =
&popup
menu;
p_parent->PopupMenu( &popupmenu, pos.x, pos.y
);
p_intf
->
p_sys
->
p_popup_menu
=
menu
;
menu
->
popup
(
QCursor
::
pos
()
);
p_intf
->
p_sys
->
p_popup_menu
=
NULL
;
vlc_object_release( p_playlist );
}
void PopupMenu( intf_thread_t *p_intf, wxWindow *p_parent,
const wxPoint& pos )
void
QVLCMenu
::
PopupMenu
(
intf_thread_t
*
p_intf
)
{
POPUP_BOILERPLATE
;
if
(
p_input
)
{
vlc_object_yield
(
p_input
);
InputAutoMenuBuilder( VLC_OBJECT(p_input),
ai_objects, as_
varnames );
InputAutoMenuBuilder
(
VLC_OBJECT
(
p_input
),
objects
,
varnames
);
/* Video menu */
PUSH_SEPARATOR
;
as_
varnames.push_back( "video-es" );
ai_
objects.push_back( p_input->i_object_id );
as_
varnames.push_back( "spu-es" );
ai_
objects.push_back( p_input->i_object_id );
varnames
.
push_back
(
"video-es"
);
objects
.
push_back
(
p_input
->
i_object_id
);
varnames
.
push_back
(
"spu-es"
);
objects
.
push_back
(
p_input
->
i_object_id
);
vlc_object_t
*
p_vout
=
(
vlc_object_t
*
)
vlc_object_find
(
p_input
,
VLC_OBJECT_VOUT
,
FIND_CHILD
);
if
(
p_vout
)
{
VideoAutoMenuBuilder( p_vout,
ai_objects, as_
varnames );
VideoAutoMenuBuilder
(
p_vout
,
objects
,
varnames
);
vlc_object_release
(
p_vout
);
}
/* Audio menu */
PUSH_SEPARATOR
as_
varnames.push_back( "audio-es" );
ai_
objects.push_back( p_input->i_object_id );
varnames
.
push_back
(
"audio-es"
);
objects
.
push_back
(
p_input
->
i_object_id
);
vlc_object_t
*
p_aout
=
(
vlc_object_t
*
)
vlc_object_find
(
p_input
,
VLC_OBJECT_AOUT
,
FIND_ANYWHERE
);
if
(
p_aout
)
{
AudioAutoMenuBuilder( p_aout,
ai_objects, as_
varnames );
AudioAutoMenuBuilder
(
p_aout
,
objects
,
varnames
);
vlc_object_release
(
p_aout
);
}
}
/* Interface menu */
PUSH_SEPARATOR
IntfAutoMenuBuilder( p_intf, ai_objects, as_varnames, true );
/* Build menu */
Menu popupmenu( p_intf, PopupMenu_Events );
popupmenu.Populate( as_varnames, ai_objects );
QMenu
*
menu
=
new
QMenu
();
Populate
(
p_intf
,
menu
,
varnames
,
objects
);
menu
->
addSeparator
();
POPUP_STATIC_ENTRIES
;
popupmenu.Append( MenuDummy_Event, wxU(_("Open")),
OpenStreamMenu( p_intf ), wxT("") );
p_intf->p_sys->p_popup_menu = &popupmenu;
p_parent->PopupMenu( &popupmenu, pos.x, pos.y );
p_intf
->
p_sys
->
p_popup_menu
=
menu
;
menu
->
popup
(
QCursor
::
pos
()
);
p_intf
->
p_sys
->
p_popup_menu
=
NULL
;
vlc_object_release( p_playlist );
}
#endif
/*****************************************************************************
* Auto menus
*****************************************************************************/
QMenu
*
QVLCMenu
::
AudioMenu
(
intf_thread_t
*
p_intf
,
QMenu
*
current
)
{
vector
<
int
>
ai_objects
;
vector
<
const
char
*>
as_varnames
;
vlc_object_t
*
p_object
=
(
vlc_object_t
*
)
vlc_object_find
(
p_intf
,
VLC_OBJECT_INPUT
,
FIND_ANYWHERE
);
if
(
p_object
!=
NULL
)
{
PUSH_VAR
(
"audio-es"
);
vlc_object_release
(
p_object
);
}
p_object
=
(
vlc_object_t
*
)
vlc_object_find
(
p_intf
,
VLC_OBJECT_AOUT
,
FIND_ANYWHERE
);
if
(
p_object
)
{
AudioAutoMenuBuilder
(
p_object
,
ai_objects
,
as_varnames
);
vlc_object_release
(
p_object
);
}
return
Populate
(
p_intf
,
current
,
as_varnames
,
ai_objects
);
}
QMenu
*
QVLCMenu
::
VideoMenu
(
intf_thread_t
*
p_intf
,
QMenu
*
current
)
{
vlc_object_t
*
p_object
;
vector
<
int
>
ai_objects
;
vector
<
const
char
*>
as_varnames
;
p_object
=
(
vlc_object_t
*
)
vlc_object_find
(
p_intf
,
VLC_OBJECT_INPUT
,
FIND_ANYWHERE
);
if
(
p_object
!=
NULL
)
{
PUSH_VAR
(
"video-es"
);
PUSH_VAR
(
"spu-es"
);
vlc_object_release
(
p_object
);
}
p_object
=
(
vlc_object_t
*
)
vlc_object_find
(
p_intf
,
VLC_OBJECT_VOUT
,
FIND_ANYWHERE
);
if
(
p_object
!=
NULL
)
{
VideoAutoMenuBuilder
(
p_object
,
ai_objects
,
as_varnames
);
vlc_object_release
(
p_object
);
}
return
Populate
(
p_intf
,
current
,
as_varnames
,
ai_objects
);
}
QMenu
*
QVLCMenu
::
NavigMenu
(
intf_thread_t
*
p_intf
,
QMenu
*
current
)
{
vlc_object_t
*
p_object
;
vector
<
int
>
ai_objects
;
vector
<
const
char
*>
as_varnames
;
p_object
=
(
vlc_object_t
*
)
vlc_object_find
(
p_intf
,
VLC_OBJECT_INPUT
,
FIND_ANYWHERE
);
if
(
p_object
!=
NULL
)
{
InputAutoMenuBuilder
(
p_object
,
ai_objects
,
as_varnames
);
PUSH_VAR
(
"prev-title"
);
PUSH_VAR
(
"next-title"
);
PUSH_VAR
(
"prev-chapter"
);
PUSH_VAR
(
"next-chapter"
);
vlc_object_release
(
p_object
);
}
return
Populate
(
p_intf
,
current
,
as_varnames
,
ai_objects
);
}
#if 0
wxMenu *SettingsMenu( intf_thread_t *_p_intf, wxWindow *p_parent,
wxMenu *p_menu )
{
vlc_object_t *p_object;
vector<int> ai_objects;
vector<const char *> as_varnames;
p_object = (vlc_object_t *)vlc_object_find( _p_intf, VLC_OBJECT_INTF,
FIND_PARENT );
if( p_object != NULL )
{
PUSH_VAR( "intf-switch" );
PUSH_VAR( "intf-add" );
vlc_object_release( p_object );
}
/* Build menu */
Menu *p_vlc_menu = (Menu *)p_menu;
if( !p_vlc_menu )
p_vlc_menu = new Menu( _p_intf, SettingsMenu_Events );
else
p_vlc_menu->Clear();
p_vlc_menu->Populate( as_varnames, ai_objects );
return p_vlc_menu;
}
#endif
#undef PUSH_VAR
#undef PUSH_SEPARATOR
/*************************************************************************
* Builders for automenus
*************************************************************************/
QMenu
*
QVLCMenu
::
Populate
(
intf_thread_t
*
p_intf
,
QMenu
*
current
,
vector
<
const
char
*>
&
ras_
varnames
,
vector
<
int
>
&
rai_objects
)
vector
<
const
char
*>
&
varnames
,
vector
<
int
>
&
objects
,
bool
append
)
{
QMenu
*
menu
=
current
;
if
(
!
menu
)
menu
=
new
QMenu
();
else
else
if
(
!
append
)
menu
->
clear
();
currentGroup
=
NULL
;
...
...
@@ -461,9 +416,9 @@ QMenu * QVLCMenu::Populate( intf_thread_t *p_intf, QMenu *current,
#define APPEND_EMPTY { QAction *action = menu->addAction( _("Empty" ) ); \
action->setEnabled( false ); }
for
(
i
=
0
;
i
<
(
int
)
rai_
objects
.
size
()
;
i
++
)
for
(
i
=
0
;
i
<
(
int
)
objects
.
size
()
;
i
++
)
{
if
(
!
ras_varnames
[
i
]
||
!*
ras_
varnames
[
i
]
)
if
(
!
varnames
[
i
]
||
!*
varnames
[
i
]
)
{
if
(
b_section_empty
)
APPEND_EMPTY
;
...
...
@@ -472,20 +427,24 @@ QMenu * QVLCMenu::Populate( intf_thread_t *p_intf, QMenu *current,
continue
;
}
if
(
rai_
objects
[
i
]
==
0
)
if
(
objects
[
i
]
==
0
)
{
/// \bug What is this ?
// Append( menu,
ras_
varnames[i], NULL );
// Append( menu, varnames[i], NULL );
b_section_empty
=
VLC_FALSE
;
continue
;
}
p_object
=
(
vlc_object_t
*
)
vlc_object_get
(
p_intf
,
rai_
objects
[
i
]
);
objects
[
i
]
);
if
(
p_object
==
NULL
)
continue
;
b_section_empty
=
VLC_FALSE
;
CreateItem
(
menu
,
ras_varnames
[
i
],
p_object
);
/* Ugly specific stuff */
if
(
strstr
(
varnames
[
i
],
"intf-add"
)
)
CreateItem
(
menu
,
varnames
[
i
],
p_object
,
false
);
else
CreateItem
(
menu
,
varnames
[
i
],
p_object
,
true
);
vlc_object_release
(
p_object
);
}
...
...
@@ -548,9 +507,8 @@ static bool IsMenuEmpty( const char *psz_var, vlc_object_t *p_object,
}
void
QVLCMenu
::
CreateItem
(
QMenu
*
menu
,
const
char
*
psz_var
,
vlc_object_t
*
p_object
)
vlc_object_t
*
p_object
,
bool
b_submenu
)
{
QAction
*
action
;
vlc_value_t
val
,
text
;
int
i_type
;
...
...
@@ -580,9 +538,15 @@ void QVLCMenu::CreateItem( QMenu *menu, const char *psz_var,
if
(
i_type
&
VLC_VAR_HASCHOICE
)
{
/* Append choices menu */
QMenu
*
submenu
=
CreateChoicesMenu
(
psz_var
,
p_object
,
true
);
if
(
b_submenu
)
{
QMenu
*
submenu
=
new
QMenu
();
submenu
->
setTitle
(
text
.
psz_string
?
text
.
psz_string
:
psz_var
);
if
(
CreateChoicesMenu
(
submenu
,
psz_var
,
p_object
,
true
)
==
0
)
menu
->
addMenu
(
submenu
);
}
else
CreateChoicesMenu
(
menu
,
psz_var
,
p_object
,
true
);
FREE
(
text
.
psz_string
);
return
;
}
...
...
@@ -608,7 +572,7 @@ void QVLCMenu::CreateItem( QMenu *menu, const char *psz_var,
}
QMenu
*
QVLCMenu
::
CreateChoicesMenu
(
const
char
*
psz_var
,
int
QVLCMenu
::
CreateChoicesMenu
(
QMenu
*
submenu
,
const
char
*
psz_var
,
vlc_object_t
*
p_object
,
bool
b_root
)
{
vlc_value_t
val
,
val_list
,
text_list
;
...
...
@@ -618,7 +582,7 @@ QMenu *QVLCMenu::CreateChoicesMenu( const char *psz_var,
i_type
=
var_Type
(
p_object
,
psz_var
);
/* Make sure we want to display the variable */
if
(
IsMenuEmpty
(
psz_var
,
p_object
,
b_root
)
)
return
NULL
;
if
(
IsMenuEmpty
(
psz_var
,
p_object
,
b_root
)
)
return
VLC_EGENERIC
;
switch
(
i_type
&
VLC_VAR_TYPE
)
{
...
...
@@ -631,31 +595,29 @@ QMenu *QVLCMenu::CreateChoicesMenu( const char *psz_var,
break
;
default:
/* Variable doesn't exist or isn't handled */
return
NULL
;
return
VLC_EGENERIC
;
}
if
(
var_Change
(
p_object
,
psz_var
,
VLC_VAR_GETLIST
,
&
val_list
,
&
text_list
)
<
0
)
{
return
NULL
;
return
VLC_EGENERIC
;
}
#define NORMAL_OR_RADIO i_type & VLC_VAR_ISCOMMAND ? ITEM_NORMAL: ITEM_RADIO
#define NOTCOMMAND !(i_type & VLC_VAR_ISCOMMAND)
#define CURVAL val_list.p_list->p_values[i]
#define CURTEXT text_list.p_list->p_values[i].psz_string
QMenu
*
submenu
=
new
QMenu
();
for
(
i
=
0
;
i
<
val_list
.
p_list
->
i_count
;
i
++
)
{
vlc_value_t
another_val
;
QString
menutext
;
QMenu
*
subsubmenu
;
QMenu
*
subsubmenu
=
new
QMenu
()
;
switch
(
i_type
&
VLC_VAR_TYPE
)
{
case
VLC_VAR_VARIABLE
:
subsubmenu
=
CreateChoicesMenu
(
CURVAL
.
psz_string
,
p_object
,
false
);
CreateChoicesMenu
(
subsubmenu
,
CURVAL
.
psz_string
,
p_object
,
false
);
subsubmenu
->
setTitle
(
CURTEXT
?
CURTEXT
:
CURVAL
.
psz_string
);
submenu
->
addMenu
(
subsubmenu
);
break
;
...
...
@@ -703,7 +665,7 @@ QMenu *QVLCMenu::CreateChoicesMenu( const char *psz_var,
#undef NOTCOMMAND
#undef CURVAL
#undef CURTEXT
return
submenu
;
return
VLC_SUCCESS
;
}
void
QVLCMenu
::
CreateAndConnect
(
QMenu
*
menu
,
const
char
*
psz_var
,
...
...
@@ -751,104 +713,3 @@ void QVLCMenu::DoAction( intf_thread_t *p_intf, QObject *data )
var_Set
(
p_object
,
itemData
->
psz_var
,
itemData
->
val
);
vlc_object_release
(
p_object
);
}
#if 0
void MenuEvtHandler::OnMenuEvent( wxCommandEvent& event )
{
wxMenuItem *p_menuitem = NULL;
int i_hotkey_event = p_intf->p_sys->i_first_hotkey_event;
int i_hotkeys = p_intf->p_sys->i_hotkeys;
if( event.GetId() >= Play_Event && event.GetId() <= Stop_Event )
{
input_thread_t *p_input;
playlist_t * p_playlist =
(playlist_t *)vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
FIND_ANYWHERE );
if( !p_playlist ) return;
switch( event.GetId() )
{
case Play_Event:
case Pause_Event:
p_input =
(input_thread_t *)vlc_object_find( p_intf, VLC_OBJECT_INPUT,
FIND_ANYWHERE );
if( !p_input ) playlist_Play( p_playlist );
else
{
vlc_value_t val;
var_Get( p_input, "state", &val );
if( val.i_int != PAUSE_S ) val.i_int = PAUSE_S;
else val.i_int = PLAYING_S;
var_Set( p_input, "state", val );
vlc_object_release( p_input );
}
break;
case Stop_Event:
playlist_Stop( p_playlist );
break;
case Previous_Event:
playlist_Prev( p_playlist );
break;
case Next_Event:
playlist_Next( p_playlist );
break;
}
vlc_object_release( p_playlist );
return;
}
/* Check if this is an auto generated menu item */
if( event.GetId() < FirstAutoGenerated_Event )
{
event.Skip();
return;
}
/* Check if this is an hotkey event */
if( event.GetId() >= i_hotkey_event &&
event.GetId() < i_hotkey_event + i_hotkeys )
{
vlc_value_t val;
val.i_int =
p_intf->p_vlc->p_hotkeys[event.GetId() - i_hotkey_event].i_key;
/* Get the key combination and send it to the hotkey handler */
var_Set( p_intf->p_vlc, "key-pressed", val );
return;
}
if( !p_main_interface ||
(p_menuitem = p_main_interface->GetMenuBar()->FindItem(event.GetId()))
== NULL )
{
if( p_intf->p_sys->p_popup_menu )
{
p_menuitem =
p_intf->p_sys->p_popup_menu->FindItem( event.GetId() );
}
}
if( p_menuitem )
{
wxMenuItemExt *p_menuitemext = (wxMenuItemExt *)p_menuitem;
vlc_object_t *p_object;
p_object = (vlc_object_t *)vlc_object_get( p_intf,
p_menuitemext->i_object_id );
if( p_object == NULL ) return;
wxMutexGuiLeave(); // We don't want deadlocks
var_Set( p_object, p_menuitemext->psz_var, p_menuitemext->val );
//wxMutexGuiEnter();
vlc_object_release( p_object );
}
else
event.Skip();
}
#endif
modules/gui/qt4/menus.hpp
View file @
efed5df6
...
...
@@ -30,7 +30,7 @@
using
namespace
std
;
class
QMenu
;
class
Q
Point
;
class
Q
MenuBar
;
class
MenuItemData
:
public
QObject
{
...
...
@@ -58,27 +58,55 @@ class QVLCMenu : public QObject
{
Q_OBJECT
;
public:
static
void
createMenuBar
(
QMenuBar
*
,
intf_thread_t
*
);
/*
Individual menu builder
s */
/*
Menu
s */
static
QMenu
*
FileMenu
();
static
void
AudioPopupMenu
(
intf_thread_t
*
,
const
QPoint
&
);
static
void
VideoPopupMenu
(
intf_thread_t
*
,
const
QPoint
&
);
static
QMenu
*
ToolsMenu
(
intf_thread_t
*
,
bool
with_intf
=
true
);
static
QMenu
*
NavigMenu
(
intf_thread_t
*
,
QMenu
*
);
static
QMenu
*
VideoMenu
(
intf_thread_t
*
,
QMenu
*
);
static
QMenu
*
AudioMenu
(
intf_thread_t
*
,
QMenu
*
);
static
QMenu
*
InterfacesMenu
(
intf_thread_t
*
p_intf
,
QMenu
*
);
/* Popups */
static
void
AudioPopupMenu
(
intf_thread_t
*
);
static
void
VideoPopupMenu
(
intf_thread_t
*
);
static
void
MiscPopupMenu
(
intf_thread_t
*
);
static
void
PopupMenu
(
intf_thread_t
*
);
static
void
DoAction
(
intf_thread_t
*
,
QObject
*
);
private:
/* Generic automenu methods */
static
QMenu
*
Populate
(
intf_thread_t
*
,
QMenu
*
current
,
vector
<
const
char
*>&
,
vector
<
int
>&
);
vector
<
const
char
*>&
,
vector
<
int
>&
,
bool
append
=
false
);
static
void
CreateAndConnect
(
QMenu
*
,
const
char
*
,
QString
,
QString
,
int
,
int
,
vlc_value_t
,
int
,
bool
c
=
false
);
static
void
CreateItem
(
QMenu
*
,
const
char
*
,
vlc_object_t
*
);
static
QMenu
*
CreateChoicesMenu
(
const
char
*
,
vlc_object_t
*
,
bool
);
static
void
CreateItem
(
QMenu
*
,
const
char
*
,
vlc_object_t
*
,
bool
);
static
int
CreateChoicesMenu
(
QMenu
*
,
const
char
*
,
vlc_object_t
*
,
bool
);
static
void
DoAction
(
intf_thread_t
*
,
QObject
*
);
};
class
MenuFunc
:
public
QObject
{
public:
MenuFunc
(
QMenu
*
_menu
,
int
_id
)
{
menu
=
_menu
;
id
=
_id
;
};
void
doFunc
(
intf_thread_t
*
p_intf
)
{
switch
(
id
)
{
case
1
:
QVLCMenu
::
VideoMenu
(
p_intf
,
menu
);
break
;
case
2
:
QVLCMenu
::
AudioMenu
(
p_intf
,
menu
);
break
;
case
3
:
QVLCMenu
::
NavigMenu
(
p_intf
,
menu
);
break
;
case
4
:
QVLCMenu
::
InterfacesMenu
(
p_intf
,
menu
);
break
;
}
};
int
id
;
QMenu
*
menu
;
};
#endif
modules/gui/qt4/qt4.hpp
View file @
efed5df6
...
...
@@ -28,6 +28,7 @@
#include <QEvent>
class
QApplication
;
class
QMenu
;
class
MainInterface
;
class
DialogsProvider
;
class
VideoWidget
;
...
...
@@ -41,10 +42,13 @@ struct intf_sys_t
VideoWidget
*
p_video
;
int
i_saved_height
,
i_saved_width
;
QMenu
*
p_popup_menu
;
};
#define THEPL p_intf->p_sys->p_playlist
#define THEDP DialogsProvider::getInstance()
#define THEMIM MainInputManager::getInstance( NULL )
static
int
DialogEvent_Type
=
QEvent
::
User
+
1
;
...
...
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