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
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
Expand all
Hide 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,16 +142,8 @@ 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
()
);
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
This diff is collapsed.
Click to expand it.
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