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
f417c29f
Commit
f417c29f
authored
Jan 27, 2008
by
Jean-Baptiste Kempf
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Qt4 - Try to separate IM and MIM
parent
8f2cd83a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
94 additions
and
91 deletions
+94
-91
modules/gui/qt4/input_manager.cpp
modules/gui/qt4/input_manager.cpp
+94
-91
No files found.
modules/gui/qt4/input_manager.cpp
View file @
f417c29f
...
@@ -57,15 +57,11 @@ InputManager::InputManager( QObject *parent, intf_thread_t *_p_intf) :
...
@@ -57,15 +57,11 @@ InputManager::InputManager( QObject *parent, intf_thread_t *_p_intf) :
old_name
=
""
;
old_name
=
""
;
p_input
=
NULL
;
p_input
=
NULL
;
i_rate
=
0
;
i_rate
=
0
;
var_AddCallback
(
THEPL
,
"playlist-current"
,
ItemChanged
,
this
);
var_AddCallback
(
THEPL
,
"intf-change"
,
ItemChanged
,
this
);
}
}
InputManager
::~
InputManager
()
InputManager
::~
InputManager
()
{
{
delInput
();
delInput
();
var_DelCallback
(
THEPL
,
"playlist-current"
,
ItemChanged
,
this
);
var_DelCallback
(
THEPL
,
"intf-change"
,
ItemChanged
,
this
);
}
}
void
InputManager
::
setInput
(
input_thread_t
*
_p_input
)
void
InputManager
::
setInput
(
input_thread_t
*
_p_input
)
...
@@ -103,105 +99,28 @@ void InputManager::delInput()
...
@@ -103,105 +99,28 @@ void InputManager::delInput()
emit
artChanged
(
""
);
emit
artChanged
(
""
);
}
}
void
InputManager
::
delCallbacks
(
void
)
{
var_DelCallback
(
p_input
,
"audio-es"
,
ChangeAudio
,
this
);
var_DelCallback
(
p_input
,
"video-es"
,
ChangeVideo
,
this
);
var_DelCallback
(
THEPL
,
"state"
,
ItemStateChanged
,
this
);
var_DelCallback
(
p_input
,
"rate"
,
ItemRateChanged
,
this
);
var_DelCallback
(
p_input
,
"title"
,
ItemTitleChanged
,
this
);
var_DelCallback
(
p_input
,
"intf-change"
,
InterfaceChanged
,
this
);
var_DelCallback
(
THEPL
,
"item-change"
,
ItemChanged
,
this
);
}
void
InputManager
::
addCallbacks
(
void
)
void
InputManager
::
addCallbacks
(
void
)
{
{
/* src/input/input.c:1629 */
var_AddCallback
(
p_input
,
"state"
,
ItemStateChanged
,
this
);
var_AddCallback
(
p_input
,
"audio-es"
,
ChangeAudio
,
this
);
var_AddCallback
(
p_input
,
"audio-es"
,
ChangeAudio
,
this
);
var_AddCallback
(
p_input
,
"video-es"
,
ChangeVideo
,
this
);
var_AddCallback
(
p_input
,
"video-es"
,
ChangeVideo
,
this
);
/* src/playlist/control.c */
var_AddCallback
(
THEPL
,
"state"
,
ItemStateChanged
,
this
);
/* src/input/input.c:1765 */
/* src/input/input.c:1765 */
var_AddCallback
(
p_input
,
"rate"
,
ItemRateChanged
,
this
);
var_AddCallback
(
p_input
,
"rate"
,
ItemRateChanged
,
this
);
/* src/input/input.c:2003 */
/* src/input/input.c:2003 */
var_AddCallback
(
p_input
,
"title"
,
ItemTitleChanged
,
this
);
var_AddCallback
(
p_input
,
"title"
,
ItemTitleChanged
,
this
);
/* src/input/input.c:734 for timers update*/
/* src/input/input.c:734 for timers update*/
var_AddCallback
(
p_input
,
"intf-change"
,
InterfaceChanged
,
this
);
var_AddCallback
(
p_input
,
"intf-change"
,
InterfaceChanged
,
this
);
/* src/input/input.c:2076*/
var_AddCallback
(
THEPL
,
"item-change"
,
ItemChanged
,
this
);
}
static
int
InterfaceChanged
(
vlc_object_t
*
p_this
,
const
char
*
psz_var
,
vlc_value_t
oldval
,
vlc_value_t
newval
,
void
*
param
)
{
static
int
counter
=
0
;
InputManager
*
im
=
(
InputManager
*
)
param
;
counter
=
counter
++
%
4
;
if
(
!
counter
)
return
VLC_SUCCESS
;
IMEvent
*
event
=
new
IMEvent
(
PositionUpdate_Type
,
0
);
QApplication
::
postEvent
(
im
,
static_cast
<
QEvent
*>
(
event
)
);
return
VLC_SUCCESS
;
}
static
int
ItemStateChanged
(
vlc_object_t
*
p_this
,
const
char
*
psz_var
,
vlc_value_t
oldval
,
vlc_value_t
newval
,
void
*
param
)
{
InputManager
*
im
=
(
InputManager
*
)
param
;
IMEvent
*
event
=
new
IMEvent
(
ItemStateChanged_Type
,
0
);
QApplication
::
postEvent
(
im
,
static_cast
<
QEvent
*>
(
event
)
);
return
VLC_SUCCESS
;
}
}
static
int
ItemRateChanged
(
vlc_object_t
*
p_this
,
const
char
*
psz_var
,
void
InputManager
::
delCallbacks
(
void
)
vlc_value_t
oldval
,
vlc_value_t
newval
,
void
*
param
)
{
InputManager
*
im
=
(
InputManager
*
)
param
;
IMEvent
*
event
=
new
IMEvent
(
ItemRateChanged_Type
,
0
);
QApplication
::
postEvent
(
im
,
static_cast
<
QEvent
*>
(
event
)
);
return
VLC_SUCCESS
;
}
static
int
ItemTitleChanged
(
vlc_object_t
*
p_this
,
const
char
*
psz_var
,
vlc_value_t
oldval
,
vlc_value_t
newval
,
void
*
param
)
{
InputManager
*
im
=
(
InputManager
*
)
param
;
IMEvent
*
event
=
new
IMEvent
(
ItemTitleChanged_Type
,
0
);
QApplication
::
postEvent
(
im
,
static_cast
<
QEvent
*>
(
event
)
);
return
VLC_SUCCESS
;
}
static
int
InputChanged
(
vlc_object_t
*
p_this
,
const
char
*
psz_var
,
vlc_value_t
oldval
,
vlc_value_t
newval
,
void
*
param
)
{
MainInputManager
*
im
=
(
MainInputManager
*
)
param
;
IMEvent
*
event
=
new
IMEvent
(
ItemChanged_Type
,
newval
.
i_int
);
QApplication
::
postEvent
(
im
,
static_cast
<
QEvent
*>
(
event
)
);
return
VLC_SUCCESS
;
}
static
int
VolumeChanged
(
vlc_object_t
*
p_this
,
const
char
*
psz_var
,
vlc_value_t
oldval
,
vlc_value_t
newval
,
void
*
param
)
{
MainInputManager
*
im
=
(
MainInputManager
*
)
param
;
IMEvent
*
event
=
new
IMEvent
(
VolumeChanged_Type
,
newval
.
i_int
);
QApplication
::
postEvent
(
im
,
static_cast
<
QEvent
*>
(
event
)
);
return
VLC_SUCCESS
;
}
static
int
ItemChanged
(
vlc_object_t
*
p_this
,
const
char
*
psz_var
,
vlc_value_t
oldval
,
vlc_value_t
newval
,
void
*
param
)
{
{
InputManager
*
im
=
(
InputManager
*
)
param
;
var_DelCallback
(
p_input
,
"audio-es"
,
ChangeAudio
,
this
);
var_DelCallback
(
p_input
,
"video-es"
,
ChangeVideo
,
this
);
IMEvent
*
event
=
new
IMEvent
(
ItemChanged_Type
,
newval
.
i_int
);
var_DelCallback
(
p_input
,
"state"
,
ItemStateChanged
,
this
);
QApplication
::
postEvent
(
im
,
static_cast
<
QEvent
*>
(
event
)
);
var_DelCallback
(
p_input
,
"rate"
,
ItemRateChanged
,
this
);
return
VLC_SUCCESS
;
var_DelCallback
(
p_input
,
"title"
,
ItemTitleChanged
,
this
);
var_DelCallback
(
p_input
,
"intf-change"
,
InterfaceChanged
,
this
);
}
}
void
InputManager
::
customEvent
(
QEvent
*
event
)
void
InputManager
::
customEvent
(
QEvent
*
event
)
...
@@ -212,7 +131,7 @@ void InputManager::customEvent( QEvent *event )
...
@@ -212,7 +131,7 @@ void InputManager::customEvent( QEvent *event )
type
!=
ItemStateChanged_Type
)
type
!=
ItemStateChanged_Type
)
return
;
return
;
if
(
!
p_input
||
p_input
->
b_dead
||
p_input
->
b_die
)
if
(
!
p_input
||
p_input
->
b_dead
||
p_input
->
b_die
)
{
{
delInput
();
delInput
();
return
;
return
;
...
@@ -474,9 +393,16 @@ MainInputManager::MainInputManager( intf_thread_t *_p_intf ) : QObject(NULL),
...
@@ -474,9 +393,16 @@ MainInputManager::MainInputManager( intf_thread_t *_p_intf ) : QObject(NULL),
{
{
p_input
=
NULL
;
p_input
=
NULL
;
im
=
new
InputManager
(
this
,
p_intf
);
im
=
new
InputManager
(
this
,
p_intf
);
var_AddCallback
(
THEPL
,
"playlist-current"
,
ItemChanged
,
this
);
var_AddCallback
(
THEPL
,
"intf-change"
,
ItemChanged
,
this
);
var_AddCallback
(
THEPL
,
"playlist-current"
,
InputChanged
,
this
);
var_AddCallback
(
THEPL
,
"playlist-current"
,
InputChanged
,
this
);
var_AddCallback
(
THEPL
,
"activity"
,
InputChanged
,
this
);
var_AddCallback
(
THEPL
,
"activity"
,
InputChanged
,
this
);
/* src/input/input.c:2076*/
var_AddCallback
(
THEPL
,
"item-change"
,
ItemChanged
,
this
);
var_AddCallback
(
p_intf
->
p_libvlc
,
"volume-change"
,
VolumeChanged
,
this
);
var_AddCallback
(
p_intf
->
p_libvlc
,
"volume-change"
,
VolumeChanged
,
this
);
/* Warn our embedded IM about input changes */
/* Warn our embedded IM about input changes */
CONNECT
(
this
,
inputChanged
(
input_thread_t
*
),
CONNECT
(
this
,
inputChanged
(
input_thread_t
*
),
im
,
setInput
(
input_thread_t
*
)
);
im
,
setInput
(
input_thread_t
*
)
);
...
@@ -492,10 +418,14 @@ MainInputManager::~MainInputManager()
...
@@ -492,10 +418,14 @@ MainInputManager::~MainInputManager()
var_DelCallback
(
p_intf
->
p_libvlc
,
"volume-change"
,
VolumeChanged
,
this
);
var_DelCallback
(
p_intf
->
p_libvlc
,
"volume-change"
,
VolumeChanged
,
this
);
var_DelCallback
(
THEPL
,
"playlist-current"
,
InputChanged
,
this
);
var_DelCallback
(
THEPL
,
"playlist-current"
,
InputChanged
,
this
);
var_DelCallback
(
THEPL
,
"activity"
,
InputChanged
,
this
);
var_DelCallback
(
THEPL
,
"activity"
,
InputChanged
,
this
);
var_DelCallback
(
THEPL
,
"playlist-current"
,
ItemChanged
,
this
);
var_DelCallback
(
THEPL
,
"intf-change"
,
ItemChanged
,
this
);
var_DelCallback
(
THEPL
,
"item-change"
,
ItemChanged
,
this
);
}
}
void
MainInputManager
::
customEvent
(
QEvent
*
event
)
void
MainInputManager
::
customEvent
(
QEvent
*
event
)
{
{
msg_Dbg
(
p_intf
,
"New Event"
);
int
type
=
event
->
type
();
int
type
=
event
->
type
();
if
(
type
!=
ItemChanged_Type
&&
type
!=
VolumeChanged_Type
)
if
(
type
!=
ItemChanged_Type
&&
type
!=
VolumeChanged_Type
)
return
;
return
;
...
@@ -571,7 +501,80 @@ void MainInputManager::togglePlayPause()
...
@@ -571,7 +501,80 @@ void MainInputManager::togglePlayPause()
getIM
()
->
togglePlayPause
();
getIM
()
->
togglePlayPause
();
}
}
/* Static functions */
static
int
InterfaceChanged
(
vlc_object_t
*
p_this
,
const
char
*
psz_var
,
vlc_value_t
oldval
,
vlc_value_t
newval
,
void
*
param
)
{
static
int
counter
=
0
;
InputManager
*
im
=
(
InputManager
*
)
param
;
counter
=
counter
++
%
4
;
if
(
!
counter
)
return
VLC_SUCCESS
;
IMEvent
*
event
=
new
IMEvent
(
PositionUpdate_Type
,
0
);
QApplication
::
postEvent
(
im
,
static_cast
<
QEvent
*>
(
event
)
);
return
VLC_SUCCESS
;
}
static
int
ItemStateChanged
(
vlc_object_t
*
p_this
,
const
char
*
psz_var
,
vlc_value_t
oldval
,
vlc_value_t
newval
,
void
*
param
)
{
InputManager
*
im
=
(
InputManager
*
)
param
;
IMEvent
*
event
=
new
IMEvent
(
ItemStateChanged_Type
,
0
);
QApplication
::
postEvent
(
im
,
static_cast
<
QEvent
*>
(
event
)
);
return
VLC_SUCCESS
;
}
static
int
ItemRateChanged
(
vlc_object_t
*
p_this
,
const
char
*
psz_var
,
vlc_value_t
oldval
,
vlc_value_t
newval
,
void
*
param
)
{
InputManager
*
im
=
(
InputManager
*
)
param
;
IMEvent
*
event
=
new
IMEvent
(
ItemRateChanged_Type
,
0
);
QApplication
::
postEvent
(
im
,
static_cast
<
QEvent
*>
(
event
)
);
return
VLC_SUCCESS
;
}
static
int
ItemTitleChanged
(
vlc_object_t
*
p_this
,
const
char
*
psz_var
,
vlc_value_t
oldval
,
vlc_value_t
newval
,
void
*
param
)
{
InputManager
*
im
=
(
InputManager
*
)
param
;
IMEvent
*
event
=
new
IMEvent
(
ItemTitleChanged_Type
,
0
);
QApplication
::
postEvent
(
im
,
static_cast
<
QEvent
*>
(
event
)
);
return
VLC_SUCCESS
;
}
static
int
InputChanged
(
vlc_object_t
*
p_this
,
const
char
*
psz_var
,
vlc_value_t
oldval
,
vlc_value_t
newval
,
void
*
param
)
{
MainInputManager
*
im
=
(
MainInputManager
*
)
param
;
IMEvent
*
event
=
new
IMEvent
(
ItemChanged_Type
,
newval
.
i_int
);
QApplication
::
postEvent
(
im
,
static_cast
<
QEvent
*>
(
event
)
);
return
VLC_SUCCESS
;
}
static
int
VolumeChanged
(
vlc_object_t
*
p_this
,
const
char
*
psz_var
,
vlc_value_t
oldval
,
vlc_value_t
newval
,
void
*
param
)
{
MainInputManager
*
im
=
(
MainInputManager
*
)
param
;
IMEvent
*
event
=
new
IMEvent
(
VolumeChanged_Type
,
newval
.
i_int
);
QApplication
::
postEvent
(
im
,
static_cast
<
QEvent
*>
(
event
)
);
return
VLC_SUCCESS
;
}
static
int
ItemChanged
(
vlc_object_t
*
p_this
,
const
char
*
psz_var
,
vlc_value_t
oldval
,
vlc_value_t
newval
,
void
*
param
)
{
InputManager
*
im
=
(
InputManager
*
)
param
;
IMEvent
*
event
=
new
IMEvent
(
ItemChanged_Type
,
newval
.
i_int
);
QApplication
::
postEvent
(
im
,
static_cast
<
QEvent
*>
(
event
)
);
return
VLC_SUCCESS
;
}
static
int
ChangeAudio
(
vlc_object_t
*
p_this
,
const
char
*
var
,
vlc_value_t
o
,
static
int
ChangeAudio
(
vlc_object_t
*
p_this
,
const
char
*
var
,
vlc_value_t
o
,
vlc_value_t
n
,
void
*
param
)
vlc_value_t
n
,
void
*
param
)
...
...
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