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
48018aed
Commit
48018aed
authored
Aug 23, 2008
by
Jean-Baptiste Kempf
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Video Widget cleaning. Corrections of previous commits.
zoom and resize when stop should be fixed. #1652 and #1716
parent
ac495caa
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
83 additions
and
120 deletions
+83
-120
modules/gui/qt4/components/interface_widgets.cpp
modules/gui/qt4/components/interface_widgets.cpp
+18
-8
modules/gui/qt4/components/interface_widgets.hpp
modules/gui/qt4/components/interface_widgets.hpp
+19
-21
modules/gui/qt4/main_interface.cpp
modules/gui/qt4/main_interface.cpp
+46
-88
modules/gui/qt4/main_interface.hpp
modules/gui/qt4/main_interface.hpp
+0
-3
No files found.
modules/gui/qt4/components/interface_widgets.cpp
View file @
48018aed
...
...
@@ -67,16 +67,23 @@ VideoWidget::VideoWidget( intf_thread_t *_p_i ) : QFrame( NULL ), p_intf( _p_i )
{
/* Init */
i_vout
=
0
;
hide
();
setMinimumSize
(
16
,
16
);
videoSize
.
rwidth
()
=
-
1
;
videoSize
.
rheight
()
=
-
1
;
hide
();
/* Set the policy to expand in both directions */
setSizePolicy
(
QSizePolicy
::
Expanding
,
QSizePolicy
::
Expanding
);
/* Black background is more coherent for a Video Widget
IMVHO
*/
/* Black background is more coherent for a Video Widget */
QPalette
plt
=
palette
();
plt
.
setColor
(
QPalette
::
Active
,
QPalette
::
Window
,
Qt
::
black
);
plt
.
setColor
(
QPalette
::
Inactive
,
QPalette
::
Window
,
Qt
::
black
);
plt
.
setColor
(
QPalette
::
Window
,
Qt
::
black
);
setPalette
(
plt
);
setAutoFillBackground
(
true
);
/* Indicates that the widget wants to draw directly onto the screen.
Widgets with this attribute set do not participate in composition
management */
setAttribute
(
Qt
::
WA_PaintOnScreen
,
true
);
/* The core can ask through a callback to show the video. */
...
...
@@ -85,7 +92,7 @@ VideoWidget::VideoWidget( intf_thread_t *_p_i ) : QFrame( NULL ), p_intf( _p_i )
this
,
SLOT
(
SetSizing
(
unsigned
int
,
unsigned
int
)),
Qt
::
BlockingQueuedConnection
);
#else
#
error This is broken. Fix it with a QEventLoop with a processEvents ()
#
warning This is broken. Fix it with a QEventLoop with a processEvents ()
connect
(
this
,
SIGNAL
(
askVideoWidgetToShow
(
unsigned
int
,
unsigned
int
)),
this
,
SLOT
(
SetSizing
(
unsigned
int
,
unsigned
int
))
);
#endif
...
...
@@ -99,10 +106,11 @@ void VideoWidget::paintEvent(QPaintEvent *ev)
#endif
}
/* Kill the vout at Destruction */
VideoWidget
::~
VideoWidget
()
{
vout_thread_t
*
p_vout
=
i_vout
?
(
vout_thread_t
*
)
vlc_object_get
(
i_vout
)
:
NULL
;
vout_thread_t
*
p_vout
=
i_vout
?
(
vout_thread_t
*
)
vlc_object_get
(
i_vout
)
:
NULL
;
if
(
p_vout
)
{
...
...
@@ -134,7 +142,9 @@ void *VideoWidget::request( vout_thread_t *p_nvout, int *pi_x, int *pi_y,
return
NULL
;
}
i_vout
=
p_nvout
->
i_object_id
;
#ifndef NDEBUG
msg_Dbg
(
p_intf
,
"embedded video ready (handle %p)"
,
winId
()
);
#endif
return
(
void
*
)
winId
();
}
...
...
@@ -156,8 +166,8 @@ void VideoWidget::release( void *p_win )
i_vout
=
0
;
videoSize
.
rwidth
()
=
0
;
videoSize
.
rheight
()
=
0
;
updateGeometry
();
hide
();
updateGeometry
();
// Needed for deinterlace
}
QSize
VideoWidget
::
sizeHint
()
const
...
...
modules/gui/qt4/components/interface_widgets.hpp
View file @
48018aed
...
...
@@ -41,26 +41,6 @@
#include <QWidget>
#include <QFrame>
#define VOLUME_MAX 200
/* on WIN32 hide() for fullscreen controller doesnt work, so it have to be
done by trick with setting the opacity of window */
#ifdef WIN32
#define WIN32TRICK
#endif
/* to trying transparency with fullscreen controller on windows enable that */
/* it can be enabled on-non windows systems,
but it will be transparent only with composite manager */
#ifndef WIN32
#define HAVE_TRANSPARENCY 1
#else
#define HAVE_TRANSPARENCY 0
#endif
/* Default value of opacity for FS controller */
#define DEFAULT_OPACITY 0.75
class
ResizeEvent
;
class
QPalette
;
class
QPixmap
;
...
...
@@ -240,6 +220,24 @@ signals:
void
advancedControlsToggled
(
bool
);
};
/* on WIN32 hide() for fullscreen controller doesnt work, so it have to be
done by trick with setting the opacity of window */
#ifdef WIN32
#define WIN32TRICK
#endif
/* to trying transparency with fullscreen controller on windows enable that */
/* it can be enabled on-non windows systems,
but it will be transparent only with composite manager */
#ifndef WIN32
#define HAVE_TRANSPARENCY 1
#else
#define HAVE_TRANSPARENCY 0
#endif
/* Default value of opacity for FS controller */
#define DEFAULT_OPACITY 0.75
/***********************************
* Fullscreen controller
***********************************/
...
...
@@ -302,7 +300,7 @@ private:
};
#define VOLUME_MAX 200
class
VolumeClickHandler
:
public
QObject
{
public:
...
...
modules/gui/qt4/main_interface.cpp
View file @
48018aed
/*****************************************************************************
* main_interface.cpp : Main interface
****************************************************************************
* Copyright (C) 2006-200
7
the VideoLAN team
* Copyright (C) 2006-200
8
the VideoLAN team
* $Id$
*
* Authors: Clément Stenac <zorglub@videolan.org>
...
...
@@ -51,9 +51,6 @@
#include <QLabel>
#include <QSlider>
#include <QWidgetAction>
#if 0
#include <QDockWidget>
#endif
#include <QToolBar>
#include <QGroupBox>
#include <QDate>
...
...
@@ -62,12 +59,6 @@
#include <vlc_keys.h>
#include <vlc_vout.h>
#define SET_WIDTH(i,j) i->widgetSize.setWidth(j)
#define SET_HEIGHT(i,j) i->widgetSize.setHeight(j)
#define SET_WH( i,j,k) i->widgetSize.setWidth(j); i->widgetSize.setHeight(k);
#define DS(i) i.width(),i.height()
/* Callback prototypes */
static
int
PopupMenuCB
(
vlc_object_t
*
p_this
,
const
char
*
psz_variable
,
vlc_value_t
old_val
,
vlc_value_t
new_val
,
void
*
param
);
...
...
@@ -112,8 +103,10 @@ MainInterface::MainInterface( intf_thread_t *_p_intf ) : QVLCMW( _p_intf )
settings
=
getSettings
();
settings
->
beginGroup
(
"MainWindow"
);
//TODO: I don't like that code
visualSelectorEnabled
=
settings
->
value
(
"visual-selector"
,
false
).
toBool
();
/* Visualisation, not really used yet */
visualSelectorEnabled
=
settings
->
value
(
"visual-selector"
,
false
).
toBool
();
/* Do we want anoying popups or not */
notificationEnabled
=
(
bool
)
config_GetInt
(
p_intf
,
"qt-notification"
);
/**************************
...
...
@@ -134,11 +127,10 @@ MainInterface::MainInterface( intf_thread_t *_p_intf ) : QVLCMW( _p_intf )
dockPL->hide();
#endif
/************
* Menu Bar
************/
/************
**************
* Menu Bar
and Status Bar
************
**************
/
QVLCMenu
::
createMenuBar
(
this
,
p_intf
,
visualSelectorEnabled
);
/* StatusBar Creation */
createStatusBar
();
...
...
@@ -197,13 +189,12 @@ MainInterface::MainInterface( intf_thread_t *_p_intf ) : QVLCMW( _p_intf )
/** OnTimeOut **/
/* TODO Remove this function, but so far, there is no choice because there
is no intf-should-die variable */
is no intf-should-die variable
#1365
*/
ON_TIMEOUT
(
updateOnTimer
()
);
//ON_TIMEOUT( debug() );
/**
/**
**********
* Callbacks
**/
**
**********
/
var_Create
(
p_intf
,
"interaction"
,
VLC_VAR_ADDRESS
);
var_AddCallback
(
p_intf
,
"interaction"
,
InteractCallback
,
this
);
p_intf
->
b_interaction
=
true
;
...
...
@@ -213,7 +204,8 @@ MainInterface::MainInterface( intf_thread_t *_p_intf ) : QVLCMW( _p_intf )
/* Register callback for the intf-popupmenu variable */
var_AddCallback
(
p_intf
->
p_libvlc
,
"intf-popupmenu"
,
PopupMenuCB
,
p_intf
);
/* VideoWidget connect mess to avoid different threads speaking to each other */
/* VideoWidget connects to avoid different threads speaking to each other */
CONNECT
(
this
,
askReleaseVideo
(
void
*
),
this
,
releaseVideoSlot
(
void
*
)
);
if
(
videoWidget
)
...
...
@@ -230,14 +222,20 @@ MainInterface::MainInterface( intf_thread_t *_p_intf ) : QVLCMW( _p_intf )
if
(
settings
->
value
(
"playlist-visible"
,
0
).
toInt
()
)
togglePlaylist
();
settings
->
endGroup
();
/* Final sizing and showing */
setMinimumWidth
(
__MAX
(
controls
->
sizeHint
().
width
(),
menuBar
()
->
sizeHint
().
width
()
)
);
show
();
/* And switch to minimal view if needed
Must be called after the show() */
if
(
i_visualmode
==
QT_MINIMAL_MODE
)
toggleMinimalView
();
/* Update the geometry TODO: is it useful ?*/
updateGeometry
();
resize
(
sizeHint
()
);
//
resize( sizeHint() );
/*****************************************************
* End everything by creating the Systray Management *
...
...
@@ -306,7 +304,6 @@ inline void MainInterface::createStatusBar()
speedLabel
->
setFrameStyle
(
QFrame
::
Sunken
|
QFrame
::
Panel
);
nameLabel
->
setFrameStyle
(
QFrame
::
Sunken
|
QFrame
::
StyledPanel
);
/* and adding those */
statusBar
()
->
addWidget
(
nameLabel
,
8
);
statusBar
()
->
addPermanentWidget
(
speedLabel
,
0
);
...
...
@@ -544,60 +541,34 @@ int MainInterface::privacyDialog( QList<ConfigControl *> *controls )
QSize
MainInterface
::
sizeHint
()
const
{
int
nwidth
=
__MAX
(
controls
->
sizeHint
().
width
(),
menuBar
()
->
sizeHint
().
width
()
);
int
nwidth
=
controls
->
sizeHint
().
width
();
int
nheight
=
controls
->
isVisible
()
?
controls
->
size
().
height
()
+
menuBar
()
->
size
().
height
()
+
statusBar
()
->
size
().
height
()
:
0
;
msg_Dbg
(
p_intf
,
"1 %i %i"
,
nheight
,
nwidth
);
if
(
VISIBLE
(
bgWidget
)
)
{
nheight
+=
bgWidget
->
size
().
height
();
nwidth
=
bgWidget
->
size
().
width
();
msg_Dbg
(
p_intf
,
"1b %i %i"
,
nheight
,
nwidth
);
}
else
if
(
videoIsActive
)
else
if
(
videoIsActive
&&
videoWidget
->
isVisible
()
)
{
nheight
+=
videoWidget
->
sizeHint
().
height
();
nwidth
=
videoWidget
->
sizeHint
().
width
();
msg_Dbg
(
p_intf
,
"2 %i %i"
,
nheight
,
nwidth
);
}
#if 0
if( !dockPL->isFloating() && dockPL->isVisible() && dockPL->widget() )
{
nheight += dockPL->size().height();
nwidth = __MAX( nwidth, dockPL->size().width() );
msg_
Dbg
( p_intf, "3 %i %i", nheight, nwidth );
msg_
Warn
( p_intf, "3 %i %i", nheight, nwidth );
}
#endif
msg_Dbg
(
p_intf
,
"4 %i %i"
,
nheight
,
nwidth
);
return
QSize
(
nwidth
,
nheight
);
}
#if 0
/* FIXME This is dead code and need to be removed AT THE END */
void MainInterface::resizeEvent( QResizeEvent *e )
{
if( videoWidget )
videoWidget->widgetSize.setWidth( e->size().width() - addSize.width() );
if( videoWidget && videoIsActive && videoWidget->widgetSize.height() > 1 )
{
SET_WH( videoWidget, e->size().width() - addSize.width(),
e->size().height() - addSize.height() );
videoWidget->updateGeometry();
}
if( VISIBLE( playlistWidget ) )
{
// SET_WH( playlistWidget , e->size().width() - addSize.width(),
// e->size().height() - addSize.height() );
playlistWidget->updateGeometry();
}
}
#endif
void
MainInterface
::
toggleFSC
()
{
if
(
!
fullscreenControls
)
return
;
...
...
@@ -605,25 +576,22 @@ void MainInterface::toggleFSC()
IMEvent
*
eShow
=
new
IMEvent
(
FullscreenControlToggle_Type
,
0
);
QApplication
::
postEvent
(
fullscreenControls
,
static_cast
<
QEvent
*>
(
eShow
)
);
}
#if 0
void MainInterface::requestLayoutUpdate()
{
emit askUpdate();
}
#endif
//FIXME remove me at the end...
void
MainInterface
::
debug
()
{
#ifndef NDEBUG
msg_Dbg
(
p_intf
,
"size: %i - %i"
,
size
().
height
(),
size
().
width
()
);
msg_Dbg
(
p_intf
,
"sizeHint: %i - %i"
,
sizeHint
().
height
(),
sizeHint
().
width
()
);
if
(
videoWidget
&&
videoWidget
->
isVisible
()
)
{
// sleep( 10 );
msg_Dbg
(
p_intf
,
"size: %i - %i"
,
size
().
height
(),
size
().
width
()
);
msg_Dbg
(
p_intf
,
"sizeHint: %i - %i"
,
sizeHint
().
height
(),
sizeHint
().
width
()
);
// sleep( 10 );
msg_Dbg
(
p_intf
,
"size: %i - %i"
,
size
().
height
(),
size
().
width
()
);
msg_Dbg
(
p_intf
,
"sizeHint: %i - %i"
,
sizeHint
().
height
(),
sizeHint
().
width
()
);
}
adjustSize
();
#endif
}
/****************************************************************************
...
...
@@ -638,6 +606,9 @@ void MainInterface::showSpeedMenu( QPoint pos )
/****************************************************************************
* 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:
...
...
@@ -645,17 +616,13 @@ public:
QEvent
(
(
QEvent
::
Type
)
SetVideoOnTopEvent_Type
),
onTop
(
_onTop
)
{}
bool
OnTop
()
const
{
return
onTop
;
}
bool
OnTop
()
const
{
return
onTop
;
}
private:
bool
onTop
;
};
/**
* README
* README
* Thou shall not call/resize/hide widgets from on another thread.
* This is wrong, and this is TEH reason to emit signals on those Video Functions
...
...
@@ -664,8 +631,6 @@ void *MainInterface::requestVideo( vout_thread_t *p_nvout, int *pi_x,
int
*
pi_y
,
unsigned
int
*
pi_width
,
unsigned
int
*
pi_height
)
{
bgWasVisible
=
false
;
/* Request the videoWidget */
void
*
ret
=
videoWidget
->
request
(
p_nvout
,
pi_x
,
pi_y
,
pi_width
,
pi_height
);
if
(
ret
)
/* The videoWidget is available */
...
...
@@ -676,22 +641,12 @@ void *MainInterface::requestVideo( vout_thread_t *p_nvout, int *pi_x,
bgWasVisible
=
true
;
emit
askBgWidgetToToggle
();
}
#if 0
if( THEMIM->getIM()->hasVideo() || !bgWasVisible )
{
videoWidget->widgetSize = QSize( *pi_width, *pi_height );
}
else /* Background widget available, use its size */
{
/* Ok, our visualizations are bad, so don't do this for the moment
* use the requested size anyway */
// videoWidget->widgetSize = bgWidget->widgeTSize;
videoWidget->widgetSize = QSize( *pi_width, *pi_height );
}
#endif
else
bgWasVisible
=
false
;
/* Consider the video active now */
videoIsActive
=
true
;
// emit askVideoToResize( *pi_width, *pi_height );
emit
askUpdate
();
if
(
fullscreenControls
)
fullscreenControls
->
attachVout
(
p_nvout
);
...
...
@@ -699,6 +654,7 @@ void *MainInterface::requestVideo( vout_thread_t *p_nvout, int *pi_x,
return
ret
;
}
/* Call from the WindowClose function */
void
MainInterface
::
releaseVideo
(
void
*
p_win
)
{
if
(
fullscreenControls
)
fullscreenControls
->
detachVout
();
...
...
@@ -706,21 +662,23 @@ void MainInterface::releaseVideo( void *p_win )
emit
askReleaseVideo
(
p_win
);
}
/* Function that is CONNECTED to the previous emit */
void
MainInterface
::
releaseVideoSlot
(
void
*
p_win
)
{
videoWidget
->
release
(
p_win
);
videoWidget
->
hide
();
if
(
bgWasVisible
)
{
/* Reset the bg state */
bgWasVisible
=
false
;
bgWidget
->
show
();
}
videoIsActive
=
false
;
if
(
!
isFullScreen
()
)
adjustSiz
e
();
/* Try to resize, except when you are in Fullscreen mode */
if
(
!
isFullScreen
()
)
doComponentsUpdat
e
();
}
/* Call from WindowControl function */
int
MainInterface
::
controlVideo
(
void
*
p_window
,
int
i_query
,
va_list
args
)
{
int
i_ret
=
VLC_SUCCESS
;
...
...
@@ -825,7 +783,7 @@ void MainInterface::toggleMinimalView()
else
{
/* If video is visible, then toggle the status of bgWidget */
bgWasVisible
=
!
bgWasVisible
;
bgWasVisible
=
!
bgWasVisible
;
}
}
...
...
@@ -840,8 +798,8 @@ void MainInterface::toggleMinimalView()
void
MainInterface
::
doComponentsUpdate
()
{
msg_Dbg
(
p_intf
,
"Updating the geometry"
);
// resize( sizeHint() );
debug
();
// resize( sizeHint() );
adjustSize
();
}
/* toggling advanced controls buttons */
...
...
modules/gui/qt4/main_interface.hpp
View file @
48018aed
...
...
@@ -75,9 +75,6 @@ public:
void
releaseVideo
(
void
*
);
int
controlVideo
(
void
*
p_window
,
int
i_query
,
va_list
args
);
#if 0
void requestLayoutUpdate();
#endif
/* Getters */
QSystemTrayIcon
*
getSysTray
()
{
return
sysTray
;
};
QMenu
*
getSysTrayMenu
()
{
return
systrayMenu
;
};
...
...
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