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
f7a97201
Commit
f7a97201
authored
Dec 29, 2008
by
Jean-Baptiste Kempf
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Qt: separate speedLabel code from interface code
Signed-off-by:
Jean-Baptiste Kempf
<
jb@videolan.org
>
parent
0ac6bc13
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
63 additions
and
55 deletions
+63
-55
modules/gui/qt4/components/interface_widgets.cpp
modules/gui/qt4/components/interface_widgets.cpp
+52
-5
modules/gui/qt4/components/interface_widgets.hpp
modules/gui/qt4/components/interface_widgets.hpp
+8
-4
modules/gui/qt4/main_interface.cpp
modules/gui/qt4/main_interface.cpp
+3
-42
modules/gui/qt4/main_interface.hpp
modules/gui/qt4/main_interface.hpp
+0
-4
No files found.
modules/gui/qt4/components/interface_widgets.cpp
View file @
f7a97201
...
@@ -39,6 +39,8 @@
...
@@ -39,6 +39,8 @@
#include <QPalette>
#include <QPalette>
#include <QResizeEvent>
#include <QResizeEvent>
#include <QDate>
#include <QDate>
#include <QMenu>
#include <QWidgetAction>
#ifdef Q_WS_X11
#ifdef Q_WS_X11
# include <X11/Xlib.h>
# include <X11/Xlib.h>
...
@@ -280,6 +282,52 @@ void VisualSelector::next()
...
@@ -280,6 +282,52 @@ void VisualSelector::next()
}
}
#endif
#endif
SpeedLabel
::
SpeedLabel
(
intf_thread_t
*
_p_intf
,
const
QString
text
)
:
QLabel
(
text
),
p_intf
(
_p_intf
)
{
setToolTip
(
qtr
(
"Current playback speed.
\n
Right click to adjust"
)
);
setContextMenuPolicy
(
Qt
::
CustomContextMenu
);
/* Create the Speed Control Widget */
speedControl
=
new
SpeedControlWidget
(
p_intf
);
speedControlMenu
=
new
QMenu
(
this
);
QWidgetAction
*
widgetAction
=
new
QWidgetAction
(
speedControl
);
widgetAction
->
setDefaultWidget
(
speedControl
);
speedControlMenu
->
addAction
(
widgetAction
);
/* Speed Label behaviour:
- right click gives the vertical speed slider */
CONNECT
(
this
,
customContextMenuRequested
(
QPoint
),
this
,
showSpeedMenu
(
QPoint
)
);
/* Change the SpeedRate in the Status Bar */
CONNECT
(
THEMIM
->
getIM
(),
rateChanged
(
int
),
this
,
setRate
(
int
)
);
// FIXME this is wrong but will work for some time.
CONNECT
(
THEMIM
->
getIM
(),
statusChanged
(
int
),
speedControl
,
activateOnState
()
);
}
/****************************************************************************
* Small right-click menu for rate control
****************************************************************************/
void
SpeedLabel
::
showSpeedMenu
(
QPoint
pos
)
{
speedControlMenu
->
exec
(
QCursor
::
pos
()
-
pos
+
QPoint
(
0
,
height
()
)
);
}
void
SpeedLabel
::
setRate
(
int
rate
)
{
QString
str
;
str
.
setNum
(
(
1000
/
(
double
)
rate
),
'f'
,
2
);
str
.
append
(
"x"
);
setText
(
str
);
setToolTip
(
str
);
speedControl
->
updateControls
(
rate
);
}
/**********************************************************************
/**********************************************************************
* Speed control widget
* Speed control widget
**********************************************************************/
**********************************************************************/
...
@@ -317,14 +365,13 @@ SpeedControlWidget::SpeedControlWidget( intf_thread_t *_p_i ) :
...
@@ -317,14 +365,13 @@ SpeedControlWidget::SpeedControlWidget( intf_thread_t *_p_i ) :
speedControlLayout
->
addWidget
(
speedSlider
);
speedControlLayout
->
addWidget
(
speedSlider
);
speedControlLayout
->
addWidget
(
normalSpeedButton
);
speedControlLayout
->
addWidget
(
normalSpeedButton
);
setLayout
(
speedControlLayout
);
setLayout
(
speedControlLayout
);
}
SpeedControlWidget
::~
SpeedControlWidget
()
activateOnState
();
{
}
}
void
SpeedControlWidget
::
setEnable
(
bool
b_enable
)
void
SpeedControlWidget
::
activateOnState
(
)
{
{
speedSlider
->
setEnabled
(
b_enable
);
speedSlider
->
setEnabled
(
THEMIM
->
getIM
()
->
hasInput
()
);
}
}
void
SpeedControlWidget
::
updateControls
(
int
rate
)
void
SpeedControlWidget
::
updateControls
(
int
rate
)
...
...
modules/gui/qt4/components/interface_widgets.hpp
View file @
f7a97201
...
@@ -47,6 +47,7 @@ class ResizeEvent;
...
@@ -47,6 +47,7 @@ class ResizeEvent;
class
QPalette
;
class
QPalette
;
class
QPixmap
;
class
QPixmap
;
class
QHBoxLayout
;
class
QHBoxLayout
;
class
QMenu
;
/******************** Video Widget ****************/
/******************** Video Widget ****************/
class
VideoWidget
:
public
QFrame
class
VideoWidget
:
public
QFrame
...
@@ -153,16 +154,20 @@ class SpeedLabel : public QLabel
...
@@ -153,16 +154,20 @@ class SpeedLabel : public QLabel
{
{
Q_OBJECT
Q_OBJECT
public:
public:
SpeedLabel
(
intf_thread_t
*
_p_intf
,
const
QString
text
)
:
QLabel
(
text
)
SpeedLabel
(
intf_thread_t
*
,
const
QString
);
{
p_intf
=
_p_intf
;
}
protected:
protected:
virtual
void
mouseDoubleClickEvent
(
QMouseEvent
*
event
)
virtual
void
mouseDoubleClickEvent
(
QMouseEvent
*
event
)
{
{
THEMIM
->
getIM
()
->
setRate
(
INPUT_RATE_DEFAULT
);
THEMIM
->
getIM
()
->
setRate
(
INPUT_RATE_DEFAULT
);
}
}
private
slots
:
void
showSpeedMenu
(
QPoint
);
void
setRate
(
int
);
private:
private:
intf_thread_t
*
p_intf
;
intf_thread_t
*
p_intf
;
QMenu
*
speedControlMenu
;
SpeedControlWidget
*
speedControl
;
};
};
/******************** Speed Control Widgets ****************/
/******************** Speed Control Widgets ****************/
...
@@ -171,14 +176,13 @@ class SpeedControlWidget : public QFrame
...
@@ -171,14 +176,13 @@ class SpeedControlWidget : public QFrame
Q_OBJECT
Q_OBJECT
public:
public:
SpeedControlWidget
(
intf_thread_t
*
);
SpeedControlWidget
(
intf_thread_t
*
);
virtual
~
SpeedControlWidget
();
void
updateControls
(
int
);
void
updateControls
(
int
);
private:
private:
intf_thread_t
*
p_intf
;
intf_thread_t
*
p_intf
;
QSlider
*
speedSlider
;
QSlider
*
speedSlider
;
public
slots
:
public
slots
:
void
setEnable
(
bool
);
void
activateOnState
(
);
private
slots
:
private
slots
:
void
updateRate
(
int
);
void
updateRate
(
int
);
...
...
modules/gui/qt4/main_interface.cpp
View file @
f7a97201
...
@@ -49,12 +49,12 @@
...
@@ -49,12 +49,12 @@
#include <QSize>
#include <QSize>
#include <QDate>
#include <QDate>
#include <QMenu>
#include <QMenuBar>
#include <QMenuBar>
#include <QStatusBar>
#include <QStatusBar>
#include <QLabel>
#include <QLabel>
#include <QGroupBox>
#include <QGroupBox>
#include <QPushButton>
#include <QPushButton>
#include <QWidgetAction>
#include <assert.h>
#include <assert.h>
...
@@ -151,8 +151,6 @@ MainInterface::MainInterface( intf_thread_t *_p_intf ) : QVLCMW( _p_intf )
...
@@ -151,8 +151,6 @@ MainInterface::MainInterface( intf_thread_t *_p_intf ) : QVLCMW( _p_intf )
**************************/
**************************/
/* Connect the input manager to the GUI elements it manages */
/* Connect the input manager to the GUI elements it manages */
/* Change the SpeedRate in the Status Bar */
CONNECT
(
THEMIM
->
getIM
(),
rateChanged
(
int
),
this
,
setRate
(
int
)
);
/**
/**
* Connects on nameChanged()
* Connects on nameChanged()
...
@@ -291,14 +289,11 @@ inline void MainInterface::createStatusBar()
...
@@ -291,14 +289,11 @@ inline void MainInterface::createStatusBar()
* Status Bar *
* Status Bar *
****************/
****************/
/* Widgets Creation*/
/* Widgets Creation*/
timeLabel
=
new
TimeLabel
(
p_intf
);
TimeLabel
*
timeLabel
=
new
TimeLabel
(
p_intf
);
nameLabel
=
new
QLabel
;
nameLabel
=
new
QLabel
;
nameLabel
->
setTextInteractionFlags
(
Qt
::
TextSelectableByMouse
nameLabel
->
setTextInteractionFlags
(
Qt
::
TextSelectableByMouse
|
Qt
::
TextSelectableByKeyboard
);
|
Qt
::
TextSelectableByKeyboard
);
speedLabel
=
new
SpeedLabel
(
p_intf
,
"1.00x"
);
SpeedLabel
*
speedLabel
=
new
SpeedLabel
(
p_intf
,
"1.00x"
);
speedLabel
->
setToolTip
(
qtr
(
"Current playback speed.
\n
Right click to adjust"
)
);
speedLabel
->
setContextMenuPolicy
(
Qt
::
CustomContextMenu
);
/* Styling those labels */
/* Styling those labels */
timeLabel
->
setFrameStyle
(
QFrame
::
Sunken
|
QFrame
::
Panel
);
timeLabel
->
setFrameStyle
(
QFrame
::
Sunken
|
QFrame
::
Panel
);
...
@@ -315,11 +310,6 @@ inline void MainInterface::createStatusBar()
...
@@ -315,11 +310,6 @@ inline void MainInterface::createStatusBar()
- right-clicking and clicking just toggle between remaining and
- right-clicking and clicking just toggle between remaining and
elapsed time.*/
elapsed time.*/
CONNECT
(
timeLabel
,
timeLabelDoubleClicked
(),
THEDP
,
gotoTimeDialog
()
);
CONNECT
(
timeLabel
,
timeLabelDoubleClicked
(),
THEDP
,
gotoTimeDialog
()
);
/* Speed Label behaviour:
- right click gives the vertical speed slider */
CONNECT
(
speedLabel
,
customContextMenuRequested
(
QPoint
),
this
,
showSpeedMenu
(
QPoint
)
);
}
}
inline
void
MainInterface
::
initSystray
()
inline
void
MainInterface
::
initSystray
()
...
@@ -383,14 +373,6 @@ void MainInterface::handleMainUi( QSettings *settings )
...
@@ -383,14 +373,6 @@ void MainInterface::handleMainUi( QSettings *settings )
mainLayout
->
insertWidget
(
0
,
controls
,
0
,
Qt
::
AlignBottom
);
mainLayout
->
insertWidget
(
0
,
controls
,
0
,
Qt
::
AlignBottom
);
mainLayout
->
insertWidget
(
0
,
inputC
,
0
,
Qt
::
AlignBottom
);
mainLayout
->
insertWidget
(
0
,
inputC
,
0
,
Qt
::
AlignBottom
);
/* Create the Speed Control Widget */
speedControl
=
new
SpeedControlWidget
(
p_intf
);
speedControlMenu
=
new
QMenu
(
this
);
QWidgetAction
*
widgetAction
=
new
QWidgetAction
(
speedControl
);
widgetAction
->
setDefaultWidget
(
speedControl
);
speedControlMenu
->
addAction
(
widgetAction
);
/* Visualisation */
/* Visualisation */
/* Disabled for now, they SUCK */
/* Disabled for now, they SUCK */
#if 0
#if 0
...
@@ -589,15 +571,6 @@ void MainInterface::debug()
...
@@ -589,15 +571,6 @@ void MainInterface::debug()
#endif
#endif
}
}
/****************************************************************************
* Small right-click menu for rate control
****************************************************************************/
void
MainInterface
::
showSpeedMenu
(
QPoint
pos
)
{
speedControlMenu
->
exec
(
QCursor
::
pos
()
-
pos
+
QPoint
(
0
,
speedLabel
->
height
()
)
);
}
/****************************************************************************
/****************************************************************************
* Video Handling
* Video Handling
****************************************************************************/
****************************************************************************/
...
@@ -859,23 +832,11 @@ void MainInterface::setStatus( int status )
...
@@ -859,23 +832,11 @@ void MainInterface::setStatus( int status )
{
{
msg_Dbg
(
p_intf
,
"Updating the stream status: %i"
,
status
);
msg_Dbg
(
p_intf
,
"Updating the stream status: %i"
,
status
);
speedControl
->
setEnable
(
THEMIM
->
getIM
()
->
hasInput
()
);
/* And in the systray for the menu */
/* And in the systray for the menu */
if
(
sysTray
)
if
(
sysTray
)
QVLCMenu
::
updateSystrayMenu
(
this
,
p_intf
);
QVLCMenu
::
updateSystrayMenu
(
this
,
p_intf
);
}
}
void
MainInterface
::
setRate
(
int
rate
)
{
QString
str
;
str
.
setNum
(
(
1000
/
(
double
)
rate
),
'f'
,
2
);
str
.
append
(
"x"
);
speedLabel
->
setText
(
str
);
speedLabel
->
setToolTip
(
str
);
speedControl
->
updateControls
(
rate
);
}
/*****************************************************************************
/*****************************************************************************
* Systray Icon and Systray Menu
* Systray Icon and Systray Menu
*****************************************************************************/
*****************************************************************************/
...
...
modules/gui/qt4/main_interface.hpp
View file @
f7a97201
...
@@ -139,8 +139,6 @@ private:
...
@@ -139,8 +139,6 @@ private:
input_thread_t
*
p_input
;
///< Main input associated to the playlist
input_thread_t
*
p_input
;
///< Main input associated to the playlist
/* Status Bar */
/* Status Bar */
QLabel
*
timeLabel
;
QLabel
*
speedLabel
;
QLabel
*
nameLabel
;
QLabel
*
nameLabel
;
virtual
void
customEvent
(
QEvent
*
);
virtual
void
customEvent
(
QEvent
*
);
...
@@ -164,7 +162,6 @@ private slots:
...
@@ -164,7 +162,6 @@ private slots:
void
debug
();
void
debug
();
void
doComponentsUpdate
();
void
doComponentsUpdate
();
void
setStatus
(
int
);
void
setStatus
(
int
);
void
setRate
(
int
);
void
setName
(
QString
);
void
setName
(
QString
);
void
setVLCWindowsTitle
(
QString
title
=
""
);
void
setVLCWindowsTitle
(
QString
title
=
""
);
#if 0
#if 0
...
@@ -173,7 +170,6 @@ private slots:
...
@@ -173,7 +170,6 @@ private slots:
void
handleSystrayClick
(
QSystemTrayIcon
::
ActivationReason
);
void
handleSystrayClick
(
QSystemTrayIcon
::
ActivationReason
);
void
updateSystrayTooltipName
(
QString
);
void
updateSystrayTooltipName
(
QString
);
void
updateSystrayTooltipStatus
(
int
);
void
updateSystrayTooltipStatus
(
int
);
void
showSpeedMenu
(
QPoint
);
void
updateRecentsMenu
();
void
updateRecentsMenu
();
signals:
signals:
void
askReleaseVideo
(
);
void
askReleaseVideo
(
);
...
...
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