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
7e26f748
Commit
7e26f748
authored
May 30, 2010
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Qt4: convert on top event to signal/slot model
parent
ac1b335c
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
37 deletions
+24
-37
modules/gui/qt4/main_interface.cpp
modules/gui/qt4/main_interface.cpp
+22
-36
modules/gui/qt4/main_interface.hpp
modules/gui/qt4/main_interface.hpp
+2
-1
No files found.
modules/gui/qt4/main_interface.cpp
View file @
7e26f748
...
...
@@ -204,6 +204,7 @@ MainInterface::MainInterface( intf_thread_t *_p_intf ) : QVLCMW( _p_intf )
connect
(
this
,
SIGNAL
(
askReleaseVideo
(
void
)),
this
,
SLOT
(
releaseVideoSlot
(
void
)),
Qt
::
BlockingQueuedConnection
);
CONNECT
(
this
,
askVideoOnTop
(
bool
),
this
,
setVideoOnTop
(
bool
));
if
(
videoWidget
)
{
...
...
@@ -531,21 +532,6 @@ void MainInterface::toggleFSC()
* Video Handling
****************************************************************************/
/* This event is used to deal with the fullscreen and always on top
issue conflict (bug in wx) */
class
SetVideoOnTopQtEvent
:
public
QEvent
{
public:
SetVideoOnTopQtEvent
(
bool
_onTop
)
:
QEvent
(
(
QEvent
::
Type
)
SetVideoOnTopEvent_Type
),
onTop
(
_onTop
)
{}
bool
OnTop
()
const
{
return
onTop
;
}
private:
bool
onTop
;
};
/**
* NOTE:
* You must not change the state of this object or other Qt4 UI objects,
...
...
@@ -588,13 +574,13 @@ void MainInterface::getVideoSlot( WId *p_id, int *pi_x, int *pi_y,
void
MainInterface
::
releaseVideo
(
void
)
{
emit
askReleaseVideo
();
QApplication
::
postEvent
(
this
,
new
SetVideoOnTopQtEvent
(
false
)
);
}
/* Function that is CONNECTED to the previous emit */
void
MainInterface
::
releaseVideoSlot
(
void
)
{
videoWidget
->
release
();
setVideoOnTop
(
false
);
if
(
stackCentralW
->
currentWidget
()
==
videoWidget
)
restoreStackOldWidget
();
...
...
@@ -603,6 +589,24 @@ void MainInterface::releaseVideoSlot( void )
stackCentralOldWidget
=
bgWidget
;
}
/* Slot to change the video always-on-top flag.
* Emit askVideoOnTop() to invoke this from other thread. */
void
MainInterface
::
setVideoOnTop
(
bool
on_top
)
{
Qt
::
WindowFlags
oldflags
=
windowFlags
(),
newflags
;
if
(
on_top
)
newflags
=
oldflags
|
Qt
::
WindowStaysOnTopHint
;
else
newflags
=
oldflags
&
~
Qt
::
WindowStaysOnTopHint
;
if
(
newflags
!=
oldflags
)
{
setWindowFlags
(
newflags
);
show
();
/* necessary to apply window flags */
}
}
/* Asynchronous call from WindowControl function */
int
MainInterface
::
controlVideo
(
int
i_query
,
va_list
args
)
{
...
...
@@ -621,7 +625,8 @@ int MainInterface::controlVideo( int i_query, va_list args )
{
unsigned
i_arg
=
va_arg
(
args
,
unsigned
);
unsigned
on_top
=
i_arg
&
VOUT_WINDOW_STATE_ABOVE
;
QApplication
::
postEvent
(
this
,
new
SetVideoOnTopQtEvent
(
on_top
)
);
emit
askVideoOnTop
(
on_top
!=
0
);
return
VLC_SUCCESS
;
}
case
VOUT_WINDOW_SET_FULLSCREEN
:
...
...
@@ -1035,25 +1040,6 @@ void MainInterface::dragLeaveEvent(QDragLeaveEvent *event)
/************************************************************************
* Events stuff
************************************************************************/
void
MainInterface
::
customEvent
(
QEvent
*
event
)
{
if
(
event
->
type
()
==
(
int
)
SetVideoOnTopEvent_Type
)
{
SetVideoOnTopQtEvent
*
p_event
=
(
SetVideoOnTopQtEvent
*
)
event
;
Qt
::
WindowFlags
oldflags
=
windowFlags
(),
newflags
;
if
(
p_event
->
OnTop
()
)
newflags
=
oldflags
|
Qt
::
WindowStaysOnTopHint
;
else
newflags
=
oldflags
&
~
Qt
::
WindowStaysOnTopHint
;
if
(
newflags
!=
oldflags
)
{
setWindowFlags
(
newflags
);
show
();
/* necessary to apply window flags */
}
}
}
void
MainInterface
::
keyPressEvent
(
QKeyEvent
*
e
)
{
handleKeyPress
(
e
);
...
...
modules/gui/qt4/main_interface.hpp
View file @
7e26f748
...
...
@@ -97,7 +97,6 @@ protected:
virtual
void
dragMoveEvent
(
QDragMoveEvent
*
);
virtual
void
dragLeaveEvent
(
QDragLeaveEvent
*
);
virtual
void
closeEvent
(
QCloseEvent
*
);
virtual
void
customEvent
(
QEvent
*
);
virtual
void
keyPressEvent
(
QKeyEvent
*
);
virtual
void
wheelEvent
(
QWheelEvent
*
);
...
...
@@ -215,6 +214,7 @@ private slots:
else
resize
(
size
()
-
stackCentralW
->
size
()
+
QSize
(
w
,
h
)
);
debug
();
}
void
setVideoOnTop
(
bool
);
signals:
void
askGetVideo
(
WId
*
p_id
,
int
*
pi_x
,
int
*
pi_y
,
...
...
@@ -222,6 +222,7 @@ signals:
void
askReleaseVideo
(
);
void
askVideoToResize
(
unsigned
int
,
unsigned
int
);
void
askVideoSetFullScreen
(
bool
);
void
askVideoOnTop
(
bool
);
void
minimalViewToggled
(
bool
);
void
fullscreenInterfaceToggled
(
bool
);
...
...
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