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
7e0df1f4
Commit
7e0df1f4
authored
Feb 18, 2010
by
Jakob Leben
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Qt: show buffering on the background of time label
parent
34965ad0
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
52 additions
and
58 deletions
+52
-58
modules/gui/qt4/components/interface_widgets.cpp
modules/gui/qt4/components/interface_widgets.cpp
+45
-40
modules/gui/qt4/components/interface_widgets.hpp
modules/gui/qt4/components/interface_widgets.hpp
+7
-14
modules/gui/qt4/main_interface.cpp
modules/gui/qt4/main_interface.cpp
+0
-4
No files found.
modules/gui/qt4/components/interface_widgets.cpp
View file @
7e0df1f4
...
...
@@ -43,6 +43,7 @@
#include <QWidgetAction>
#include <QDesktopWidget>
#include <QPainter>
#include <QTimer>
#ifdef Q_WS_X11
# include <X11/Xlib.h>
...
...
@@ -430,16 +431,18 @@ SpeedLabel::SpeedLabel( intf_thread_t *_p_intf, const QString& text,
CONNECT
(
THEMIM
,
inputChanged
(
input_thread_t
*
),
speedControl
,
activateOnState
()
);
}
SpeedLabel
::~
SpeedLabel
()
{
delete
speedControl
;
delete
speedControlMenu
;
delete
speedControl
;
delete
speedControlMenu
;
}
/****************************************************************************
* Small right-click menu for rate control
****************************************************************************/
void
SpeedLabel
::
showSpeedMenu
(
QPoint
pos
)
{
speedControlMenu
->
exec
(
QCursor
::
pos
()
-
pos
...
...
@@ -477,7 +480,7 @@ SpeedControlWidget::SpeedControlWidget( intf_thread_t *_p_i, QWidget *_parent )
speedSlider
->
setPageStep
(
1
);
speedSlider
->
setTickInterval
(
17
);
CONNECT
(
speedSlider
,
valueChang
ed
(
int
),
this
,
updateRate
(
int
)
);
CONNECT
(
speedSlider
,
sliderMov
ed
(
int
),
this
,
updateRate
(
int
)
);
QToolButton
*
normalSpeedButton
=
new
QToolButton
(
this
);
normalSpeedButton
->
setMaximumSize
(
QSize
(
26
,
20
)
);
...
...
@@ -521,10 +524,7 @@ void SpeedControlWidget::updateControls( int rate )
sliderValue
=
speedSlider
->
maximum
();
}
//Block signals to avoid feedback loop
speedSlider
->
blockSignals
(
true
);
speedSlider
->
setValue
(
sliderValue
);
speedSlider
->
blockSignals
(
false
);
}
void
SpeedControlWidget
::
updateRate
(
int
sliderValue
)
...
...
@@ -588,15 +588,21 @@ void CoverArtLabel::askForUpdate()
THEMIM
->
getIM
()
->
requestArtUpdate
();
}
TimeLabel
::
TimeLabel
(
intf_thread_t
*
_p_intf
)
:
QLabel
(),
p_intf
(
_p_intf
)
TimeLabel
::
TimeLabel
(
intf_thread_t
*
_p_intf
)
:
QLabel
(),
p_intf
(
_p_intf
),
bufTimer
(
new
QTimer
(
this
)
),
buffering
(
false
),
showBuffering
(
false
),
bufVal
(
-
1
)
{
b_remainingTime
=
false
;
setText
(
" --:--/--:-- "
);
setAlignment
(
Qt
::
AlignRight
|
Qt
::
AlignVCenter
);
setToolTip
(
qtr
(
"Toggle between elapsed and remaining time"
)
);
b_remainingTime
=
false
;
setText
(
" --:--/--:-- "
);
setAlignment
(
Qt
::
AlignRight
|
Qt
::
AlignVCenter
);
setToolTip
(
qtr
(
"Toggle between elapsed and remaining time"
)
);
bufTimer
->
setSingleShot
(
true
);
CONNECT
(
THEMIM
->
getIM
(),
positionUpdated
(
float
,
int64_t
,
int
),
this
,
setDisplayPosition
(
float
,
int64_t
,
int
)
);
CONNECT
(
THEMIM
->
getIM
(),
positionUpdated
(
float
,
int64_t
,
int
),
this
,
setDisplayPosition
(
float
,
int64_t
,
int
)
);
CONNECT
(
THEMIM
->
getIM
(),
cachingChanged
(
float
),
this
,
updateBuffering
(
float
)
);
CONNECT
(
bufTimer
,
timeout
(),
this
,
updateBuffering
()
);
}
void
TimeLabel
::
setDisplayPosition
(
float
pos
,
int64_t
t
,
int
length
)
...
...
@@ -647,39 +653,38 @@ void TimeLabel::toggleTimeDisplay()
b_remainingTime
=
!
b_remainingTime
;
}
CacheLabel
::
CacheLabel
(
intf_thread_t
*
_p_intf
,
QWidget
*
parent
)
:
QLabel
(
parent
),
p_intf
(
_p_intf
),
cached
(
0.
f
)
{
setText
(
qtr
(
"Buffering..."
)
);
setMinimumWidth
(
70
);
setSizePolicy
(
QSizePolicy
::
Minimum
,
QSizePolicy
::
Preferred
);
setAlignment
(
Qt
::
AlignCenter
);
CONNECT
(
THEMIM
->
getIM
(),
cachingChanged
(
float
),
this
,
showCaching
(
float
)
);
CONNECT
(
THEMIM
->
getIM
(),
positionUpdated
(
float
,
int64_t
,
int
),
this
,
hideCaching
()
);
}
void
CacheLabel
::
showCaching
(
float
_cach
ed
)
void
TimeLabel
::
updateBuffering
(
float
_buffer
ed
)
{
cached
=
_cached
;
show
();
update
();
//in case we are already visible
bufVal
=
_buffered
;
if
(
!
buffering
||
bufVal
==
0
)
{
showBuffering
=
false
;
buffering
=
true
;
bufTimer
->
start
(
200
);
}
else
if
(
bufVal
==
1
)
{
showBuffering
=
buffering
=
false
;
}
update
();
}
void
CacheLabel
::
hideCach
ing
()
void
TimeLabel
::
updateBuffer
ing
()
{
hide
();
showBuffering
=
true
;
update
();
}
void
Cach
eLabel
::
paintEvent
(
QPaintEvent
*
event
)
void
Tim
eLabel
::
paintEvent
(
QPaintEvent
*
event
)
{
QRect
r
(
rect
()
);
r
.
setWidth
(
r
.
width
()
*
cached
);
QPainter
p
(
this
);
p
.
setOpacity
(
0.4
);
p
.
fillRect
(
r
,
palette
().
color
(
QPalette
::
Highlight
)
);
if
(
showBuffering
)
{
QRect
r
(
rect
()
);
r
.
setLeft
(
r
.
width
()
*
bufVal
);
QPainter
p
(
this
);
p
.
setOpacity
(
0.4
);
p
.
fillRect
(
r
,
palette
().
color
(
QPalette
::
Highlight
)
);
}
QLabel
::
paintEvent
(
event
);
}
modules/gui/qt4/components/interface_widgets.hpp
View file @
7e0df1f4
...
...
@@ -141,14 +141,21 @@ private:
intf_thread_t
*
p_intf
;
bool
b_remainingTime
;
int
cachedLength
;
QTimer
*
bufTimer
;
float
bufVal
;
bool
buffering
;
bool
showBuffering
;
char
psz_length
[
MSTRTIME_MAX_SIZE
];
char
psz_time
[
MSTRTIME_MAX_SIZE
];
void
toggleTimeDisplay
();
void
paintEvent
(
QPaintEvent
*
);
signals:
void
timeLabelDoubleClicked
();
private
slots
:
void
setDisplayPosition
(
float
pos
,
int64_t
time
,
int
length
);
void
setDisplayPosition
(
float
pos
);
void
updateBuffering
(
float
);
void
updateBuffering
();
};
class
SpeedLabel
:
public
QLabel
...
...
@@ -172,20 +179,6 @@ private:
SpeedControlWidget
*
speedControl
;
};
class
CacheLabel
:
public
QLabel
{
Q_OBJECT
public:
CacheLabel
(
intf_thread_t
*
,
QWidget
*
);
private
slots
:
void
showCaching
(
float
);
void
hideCaching
();
private:
void
paintEvent
(
QPaintEvent
*
);
intf_thread_t
*
p_intf
;
float
cached
;
};
/******************** Speed Control Widgets ****************/
class
SpeedControlWidget
:
public
QFrame
{
...
...
modules/gui/qt4/main_interface.cpp
View file @
7e0df1f4
...
...
@@ -497,18 +497,14 @@ inline void MainInterface::createStatusBar()
nameLabel
->
setTextInteractionFlags
(
Qt
::
TextSelectableByMouse
|
Qt
::
TextSelectableByKeyboard
);
SpeedLabel
*
speedLabel
=
new
SpeedLabel
(
p_intf
,
"1.00x"
,
this
);
CacheLabel
*
cacheLabel
=
new
CacheLabel
(
p_intf
,
this
);
cacheLabel
->
hide
();
/* Styling those labels */
timeLabel
->
setFrameStyle
(
QFrame
::
Sunken
|
QFrame
::
Panel
);
speedLabel
->
setFrameStyle
(
QFrame
::
Sunken
|
QFrame
::
Panel
);
cacheLabel
->
setFrameStyle
(
QFrame
::
Sunken
|
QFrame
::
Panel
);
nameLabel
->
setFrameStyle
(
QFrame
::
Sunken
|
QFrame
::
StyledPanel
);
/* and adding those */
statusBarr
->
addWidget
(
nameLabel
,
8
);
statusBarr
->
addPermanentWidget
(
cacheLabel
,
0
);
statusBarr
->
addPermanentWidget
(
speedLabel
,
0
);
statusBarr
->
addPermanentWidget
(
timeLabel
,
0
);
...
...
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