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
0972b082
Commit
0972b082
authored
Feb 17, 2010
by
Jakob Leben
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Qt: separate status bar label for "Buffering" + show time while seeking (close #2760)
parent
2f75620a
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
91 additions
and
9 deletions
+91
-9
modules/gui/qt4/components/interface_widgets.cpp
modules/gui/qt4/components/interface_widgets.cpp
+56
-8
modules/gui/qt4/components/interface_widgets.hpp
modules/gui/qt4/components/interface_widgets.hpp
+18
-1
modules/gui/qt4/input_manager.cpp
modules/gui/qt4/input_manager.cpp
+1
-0
modules/gui/qt4/input_manager.hpp
modules/gui/qt4/input_manager.hpp
+1
-0
modules/gui/qt4/main_interface.cpp
modules/gui/qt4/main_interface.cpp
+13
-0
modules/gui/qt4/main_interface.hpp
modules/gui/qt4/main_interface.hpp
+2
-0
No files found.
modules/gui/qt4/components/interface_widgets.cpp
View file @
0972b082
...
@@ -42,6 +42,7 @@
...
@@ -42,6 +42,7 @@
#include <QMenu>
#include <QMenu>
#include <QWidgetAction>
#include <QWidgetAction>
#include <QDesktopWidget>
#include <QDesktopWidget>
#include <QPainter>
#ifdef Q_WS_X11
#ifdef Q_WS_X11
# include <X11/Xlib.h>
# include <X11/Xlib.h>
...
@@ -594,9 +595,6 @@ TimeLabel::TimeLabel( intf_thread_t *_p_intf ) :QLabel(), p_intf( _p_intf )
...
@@ -594,9 +595,6 @@ TimeLabel::TimeLabel( intf_thread_t *_p_intf ) :QLabel(), p_intf( _p_intf )
setAlignment
(
Qt
::
AlignRight
|
Qt
::
AlignVCenter
);
setAlignment
(
Qt
::
AlignRight
|
Qt
::
AlignVCenter
);
setToolTip
(
qtr
(
"Toggle between elapsed and remaining time"
)
);
setToolTip
(
qtr
(
"Toggle between elapsed and remaining time"
)
);
CONNECT
(
THEMIM
->
getIM
(),
cachingChanged
(
float
),
this
,
setCaching
(
float
)
);
CONNECT
(
THEMIM
->
getIM
(),
positionUpdated
(
float
,
int64_t
,
int
),
CONNECT
(
THEMIM
->
getIM
(),
positionUpdated
(
float
,
int64_t
,
int
),
this
,
setDisplayPosition
(
float
,
int64_t
,
int
)
);
this
,
setDisplayPosition
(
float
,
int64_t
,
int
)
);
}
}
...
@@ -610,7 +608,7 @@ void TimeLabel::setDisplayPosition( float pos, int64_t t, int length )
...
@@ -610,7 +608,7 @@ void TimeLabel::setDisplayPosition( float pos, int64_t t, int length )
}
}
int
time
=
t
/
1000000
;
int
time
=
t
/
1000000
;
char
psz_length
[
MSTRTIME_MAX_SIZE
],
psz_time
[
MSTRTIME_MAX_SIZE
];
secstotimestr
(
psz_length
,
length
);
secstotimestr
(
psz_length
,
length
);
secstotimestr
(
psz_time
,
(
b_remainingTime
&&
length
)
?
length
-
time
secstotimestr
(
psz_time
,
(
b_remainingTime
&&
length
)
?
length
-
time
:
time
);
:
time
);
...
@@ -620,18 +618,68 @@ void TimeLabel::setDisplayPosition( float pos, int64_t t, int length )
...
@@ -620,18 +618,68 @@ void TimeLabel::setDisplayPosition( float pos, int64_t t, int length )
psz_time
,
(
!
length
&&
time
)
?
"--:--"
:
psz_length
);
psz_time
,
(
!
length
&&
time
)
?
"--:--"
:
psz_length
);
setText
(
timestr
);
setText
(
timestr
);
cachedLength
=
length
;
}
void
TimeLabel
::
setDisplayPosition
(
float
pos
)
{
if
(
pos
==
-
1.
f
||
cachedLength
==
0
)
{
setText
(
" --:--/--:-- "
);
return
;
}
int
time
=
pos
*
cachedLength
;
secstotimestr
(
psz_time
,
(
b_remainingTime
&&
cachedLength
?
cachedLength
-
time
:
time
)
);
QString
timestr
;
timestr
.
sprintf
(
" %s%s/%s "
,
(
b_remainingTime
&&
cachedLength
)
?
"-"
:
""
,
psz_time
,
(
!
cachedLength
&&
time
)
?
"--:--"
:
psz_length
);
setText
(
timestr
);
}
}
void
TimeLabel
::
toggleTimeDisplay
()
void
TimeLabel
::
toggleTimeDisplay
()
{
{
b_remainingTime
=
!
b_remainingTime
;
b_remainingTime
=
!
b_remainingTime
;
}
}
void
TimeLabel
::
setCaching
(
float
f_cache
)
CacheLabel
::
CacheLabel
(
intf_thread_t
*
_p_intf
,
QWidget
*
parent
)
:
QLabel
(
parent
),
p_intf
(
_p_intf
),
cached
(
0.
f
)
{
{
QString
amount
;
setText
(
qtr
(
"Buffering..."
)
);
amount
.
sprintf
(
"Buff: %i%%"
,
(
int
)(
100
*
f_cache
)
);
setMinimumWidth
(
70
);
setText
(
amount
);
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
_cached
)
{
cached
=
_cached
;
show
();
update
();
//in case we are already visible
}
void
CacheLabel
::
hideCaching
()
{
hide
();
}
void
CacheLabel
::
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
)
);
QLabel
::
paintEvent
(
event
);
}
modules/gui/qt4/components/interface_widgets.hpp
View file @
0972b082
...
@@ -140,12 +140,15 @@ protected:
...
@@ -140,12 +140,15 @@ protected:
private:
private:
intf_thread_t
*
p_intf
;
intf_thread_t
*
p_intf
;
bool
b_remainingTime
;
bool
b_remainingTime
;
int
cachedLength
;
char
psz_length
[
MSTRTIME_MAX_SIZE
];
char
psz_time
[
MSTRTIME_MAX_SIZE
];
void
toggleTimeDisplay
();
void
toggleTimeDisplay
();
signals:
signals:
void
timeLabelDoubleClicked
();
void
timeLabelDoubleClicked
();
private
slots
:
private
slots
:
void
setDisplayPosition
(
float
pos
,
int64_t
time
,
int
length
);
void
setDisplayPosition
(
float
pos
,
int64_t
time
,
int
length
);
void
set
Caching
(
float
);
void
set
DisplayPosition
(
float
pos
);
};
};
class
SpeedLabel
:
public
QLabel
class
SpeedLabel
:
public
QLabel
...
@@ -169,6 +172,20 @@ private:
...
@@ -169,6 +172,20 @@ private:
SpeedControlWidget
*
speedControl
;
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 ****************/
/******************** Speed Control Widgets ****************/
class
SpeedControlWidget
:
public
QFrame
class
SpeedControlWidget
:
public
QFrame
{
{
...
...
modules/gui/qt4/input_manager.cpp
View file @
0972b082
...
@@ -683,6 +683,7 @@ void InputManager::sliderUpdate( float new_pos )
...
@@ -683,6 +683,7 @@ void InputManager::sliderUpdate( float new_pos )
{
{
if
(
hasInput
()
)
if
(
hasInput
()
)
var_SetFloat
(
p_input
,
"position"
,
new_pos
);
var_SetFloat
(
p_input
,
"position"
,
new_pos
);
emit
seekRequested
(
new_pos
);
}
}
/* User togglePlayPause */
/* User togglePlayPause */
...
...
modules/gui/qt4/input_manager.hpp
View file @
0972b082
...
@@ -203,6 +203,7 @@ private slots:
...
@@ -203,6 +203,7 @@ private slots:
signals:
signals:
/// Send new position, new time and new length
/// Send new position, new time and new length
void
positionUpdated
(
float
,
int64_t
,
int
);
void
positionUpdated
(
float
,
int64_t
,
int
);
void
seekRequested
(
float
pos
);
void
rateChanged
(
int
);
void
rateChanged
(
int
);
void
nameChanged
(
const
QString
&
);
void
nameChanged
(
const
QString
&
);
/// Used to signal whether we should show navigation buttons
/// Used to signal whether we should show navigation buttons
...
...
modules/gui/qt4/main_interface.cpp
View file @
0972b082
...
@@ -497,14 +497,18 @@ inline void MainInterface::createStatusBar()
...
@@ -497,14 +497,18 @@ inline void MainInterface::createStatusBar()
nameLabel
->
setTextInteractionFlags
(
Qt
::
TextSelectableByMouse
nameLabel
->
setTextInteractionFlags
(
Qt
::
TextSelectableByMouse
|
Qt
::
TextSelectableByKeyboard
);
|
Qt
::
TextSelectableByKeyboard
);
SpeedLabel
*
speedLabel
=
new
SpeedLabel
(
p_intf
,
"1.00x"
,
this
);
SpeedLabel
*
speedLabel
=
new
SpeedLabel
(
p_intf
,
"1.00x"
,
this
);
CacheLabel
*
cacheLabel
=
new
CacheLabel
(
p_intf
,
this
);
cacheLabel
->
hide
();
/* Styling those labels */
/* Styling those labels */
timeLabel
->
setFrameStyle
(
QFrame
::
Sunken
|
QFrame
::
Panel
);
timeLabel
->
setFrameStyle
(
QFrame
::
Sunken
|
QFrame
::
Panel
);
speedLabel
->
setFrameStyle
(
QFrame
::
Sunken
|
QFrame
::
Panel
);
speedLabel
->
setFrameStyle
(
QFrame
::
Sunken
|
QFrame
::
Panel
);
cacheLabel
->
setFrameStyle
(
QFrame
::
Sunken
|
QFrame
::
Panel
);
nameLabel
->
setFrameStyle
(
QFrame
::
Sunken
|
QFrame
::
StyledPanel
);
nameLabel
->
setFrameStyle
(
QFrame
::
Sunken
|
QFrame
::
StyledPanel
);
/* and adding those */
/* and adding those */
statusBarr
->
addWidget
(
nameLabel
,
8
);
statusBarr
->
addWidget
(
nameLabel
,
8
);
statusBarr
->
addPermanentWidget
(
cacheLabel
,
0
);
statusBarr
->
addPermanentWidget
(
speedLabel
,
0
);
statusBarr
->
addPermanentWidget
(
speedLabel
,
0
);
statusBarr
->
addPermanentWidget
(
timeLabel
,
0
);
statusBarr
->
addPermanentWidget
(
timeLabel
,
0
);
...
@@ -516,6 +520,9 @@ inline void MainInterface::createStatusBar()
...
@@ -516,6 +520,9 @@ inline void MainInterface::createStatusBar()
CONNECT
(
THEMIM
->
getIM
(),
encryptionChanged
(
bool
),
CONNECT
(
THEMIM
->
getIM
(),
encryptionChanged
(
bool
),
this
,
showCryptedLabel
(
bool
)
);
this
,
showCryptedLabel
(
bool
)
);
connect
(
THEMIM
->
getIM
(),
SIGNAL
(
seekRequested
(
float
)),
timeLabel
,
SLOT
(
setDisplayPosition
(
float
))
);
}
}
#ifdef WIN32
#ifdef WIN32
...
@@ -1180,6 +1187,12 @@ void MainInterface::showCryptedLabel( bool b_show )
...
@@ -1180,6 +1187,12 @@ void MainInterface::showCryptedLabel( bool b_show )
cryptedLabel
->
setVisible
(
b_show
);
cryptedLabel
->
setVisible
(
b_show
);
}
}
void
MainInterface
::
showBuffering
(
float
f_cache
)
{
QString
amount
=
QString
(
"Buffering: %1%"
).
arg
(
(
int
)(
100
*
f_cache
)
);
statusBar
()
->
showMessage
(
amount
,
1000
);
}
/*****************************************************************************
/*****************************************************************************
* Systray Icon and Systray Menu
* Systray Icon and Systray Menu
*****************************************************************************/
*****************************************************************************/
...
...
modules/gui/qt4/main_interface.hpp
View file @
0972b082
...
@@ -217,6 +217,8 @@ private slots:
...
@@ -217,6 +217,8 @@ private slots:
void
handleKeyPress
(
QKeyEvent
*
);
void
handleKeyPress
(
QKeyEvent
*
);
void
showBuffering
(
float
);
signals:
signals:
void
askGetVideo
(
WId
*
p_id
,
int
*
pi_x
,
int
*
pi_y
,
void
askGetVideo
(
WId
*
p_id
,
int
*
pi_x
,
int
*
pi_y
,
unsigned
*
pi_width
,
unsigned
*
pi_height
);
unsigned
*
pi_width
,
unsigned
*
pi_height
);
...
...
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