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
abfcd0d5
Commit
abfcd0d5
authored
Jan 01, 2012
by
Edward Wang
Committed by
Jean-Baptiste Kempf
Jan 03, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Qt4: allow more types of timeLabel in toolbars
Signed-off-by:
Jean-Baptiste Kempf
<
jb@videolan.org
>
parent
e06dc389
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
73 additions
and
13 deletions
+73
-13
modules/gui/qt4/components/controller.cpp
modules/gui/qt4/components/controller.cpp
+6
-0
modules/gui/qt4/components/controller.hpp
modules/gui/qt4/components/controller.hpp
+2
-0
modules/gui/qt4/components/interface_widgets.cpp
modules/gui/qt4/components/interface_widgets.cpp
+46
-12
modules/gui/qt4/components/interface_widgets.hpp
modules/gui/qt4/components/interface_widgets.hpp
+11
-1
modules/gui/qt4/dialogs/toolbar.cpp
modules/gui/qt4/dialogs/toolbar.cpp
+8
-0
No files found.
modules/gui/qt4/components/controller.cpp
View file @
abfcd0d5
...
...
@@ -471,6 +471,12 @@ QWidget *AbstractController::createWidget( buttonType_e button, int options )
case
SPEED_LABEL
:
widget
=
new
SpeedLabel
(
p_intf
,
this
);
break
;
case
TIME_LABEL_ELAPSED
:
widget
=
new
TimeLabel
(
p_intf
,
TimeLabel
::
Elapsed
);
break
;
case
TIME_LABEL_REMAINING
:
widget
=
new
TimeLabel
(
p_intf
,
TimeLabel
::
Remaining
);
break
;
default:
msg_Warn
(
p_intf
,
"This should not happen %i"
,
button
);
break
;
...
...
modules/gui/qt4/components/controller.hpp
View file @
abfcd0d5
...
...
@@ -101,6 +101,8 @@ typedef enum buttonType_e
PLAYBACK_BUTTONS
,
ASPECT_RATIO_COMBOBOX
,
SPEED_LABEL
,
TIME_LABEL_ELAPSED
,
TIME_LABEL_REMAINING
,
SPECIAL_MAX
,
WIDGET_SPACER
=
0x40
,
...
...
modules/gui/qt4/components/interface_widgets.cpp
View file @
abfcd0d5
...
...
@@ -549,17 +549,33 @@ void CoverArtLabel::askForUpdate()
THEMIM
->
getIM
()
->
requestArtUpdate
();
}
TimeLabel
::
TimeLabel
(
intf_thread_t
*
_p_intf
)
TimeLabel
::
TimeLabel
(
intf_thread_t
*
_p_intf
,
TimeLabel
::
Display
_displayType
)
:
QLabel
(),
p_intf
(
_p_intf
),
bufTimer
(
new
QTimer
(
this
)
),
buffering
(
false
),
showBuffering
(
false
),
bufVal
(
-
1
)
buffering
(
false
),
showBuffering
(
false
),
bufVal
(
-
1
)
,
displayType
(
_displayType
)
{
b_remainingTime
=
false
;
setText
(
" --:--/--:-- "
);
switch
(
_displayType
)
{
case
TimeLabel
:
:
Elapsed
:
setText
(
" --:-- "
);
setToolTip
(
qtr
(
"Elapsed time"
)
);
break
;
case
TimeLabel
:
:
Remaining
:
setText
(
" --:-- "
);
setToolTip
(
qtr
(
"Total/Remaining time"
)
+
QString
(
"
\n
-"
)
+
qtr
(
"Click to toggle between total and remaining time"
)
);
break
;
case
TimeLabel
:
:
Both
:
setText
(
" --:--/--:-- "
);
setToolTip
(
QString
(
"- "
)
+
qtr
(
"Click to toggle between elapsed and remaining time"
)
+
QString
(
"
\n
- "
)
+
qtr
(
"Double click to jump to a chosen time position"
)
);
break
;
}
setAlignment
(
Qt
::
AlignRight
|
Qt
::
AlignVCenter
);
setToolTip
(
QString
(
"- "
)
+
qtr
(
"Click to toggle between elapsed and remaining time"
)
+
QString
(
"
\n
- "
)
+
qtr
(
"Double click to jump to a chosen time position"
)
);
bufTimer
->
setSingleShot
(
true
);
CONNECT
(
THEMIM
->
getIM
(),
positionUpdated
(
float
,
int64_t
,
int
),
...
...
@@ -567,6 +583,8 @@ TimeLabel::TimeLabel( intf_thread_t *_p_intf )
CONNECT
(
THEMIM
->
getIM
(),
cachingChanged
(
float
),
this
,
updateBuffering
(
float
)
);
CONNECT
(
bufTimer
,
timeout
(),
this
,
updateBuffering
()
);
this
->
setContentsMargins
(
4
,
0
,
4
,
0
);
}
void
TimeLabel
::
setDisplayPosition
(
float
pos
,
int64_t
t
,
int
length
)
...
...
@@ -576,7 +594,10 @@ void TimeLabel::setDisplayPosition( float pos, int64_t t, int length )
if
(
pos
==
-
1.
f
)
{
setText
(
" --:--/--:-- "
);
if
(
displayType
==
TimeLabel
::
Both
)
setText
(
" --:--/--:-- "
);
else
setText
(
" --:-- "
);
return
;
}
...
...
@@ -585,14 +606,27 @@ void TimeLabel::setDisplayPosition( float pos, int64_t t, int length )
secstotimestr
(
psz_length
,
length
);
secstotimestr
(
psz_time
,
(
b_remainingTime
&&
length
)
?
length
-
time
:
time
);
QString
timestr
=
QString
(
" %1%2/%3 "
)
switch
(
displayType
)
{
case
TimeLabel
:
:
Elapsed
:
setText
(
QString
(
" "
)
+
QString
(
psz_time
)
+
QString
(
" "
)
);
break
;
case
TimeLabel
:
:
Remaining
:
if
(
b_remainingTime
)
setText
(
QString
(
" -"
)
+
QString
(
psz_time
)
+
QString
(
" "
)
);
else
setText
(
QString
(
" "
)
+
QString
(
psz_length
)
+
QString
(
" "
)
);
break
;
case
TimeLabel
:
:
Both
:
default:
QString
timestr
=
QString
(
" %1%2/%3 "
)
.
arg
(
QString
(
(
b_remainingTime
&&
length
)
?
"-"
:
""
)
)
.
arg
(
QString
(
psz_time
)
)
.
arg
(
QString
(
(
!
length
&&
time
)
?
"--:--"
:
psz_length
)
);
setText
(
timestr
);
setText
(
timestr
);
break
;
}
cachedLength
=
length
;
}
...
...
modules/gui/qt4/components/interface_widgets.hpp
View file @
abfcd0d5
...
...
@@ -122,15 +122,24 @@ class TimeLabel : public QLabel
{
Q_OBJECT
public:
TimeLabel
(
intf_thread_t
*
_p_intf
);
enum
Display
{
Elapsed
,
Remaining
,
Both
};
TimeLabel
(
intf_thread_t
*
_p_intf
,
TimeLabel
::
Display
_displayType
=
TimeLabel
::
Both
);
protected:
virtual
void
mousePressEvent
(
QMouseEvent
*
event
)
{
if
(
displayType
==
TimeLabel
::
Elapsed
)
return
;
toggleTimeDisplay
();
event
->
accept
();
}
virtual
void
mouseDoubleClickEvent
(
QMouseEvent
*
event
)
{
if
(
displayType
!=
TimeLabel
::
Both
)
return
;
event
->
accept
();
toggleTimeDisplay
();
emit
timeLabelDoubleClicked
();
...
...
@@ -144,6 +153,7 @@ private:
bool
buffering
;
bool
showBuffering
;
float
bufVal
;
TimeLabel
::
Display
displayType
;
char
psz_length
[
MSTRTIME_MAX_SIZE
];
char
psz_time
[
MSTRTIME_MAX_SIZE
];
...
...
modules/gui/qt4/dialogs/toolbar.cpp
View file @
abfcd0d5
...
...
@@ -453,6 +453,14 @@ WidgetListing::WidgetListing( intf_thread_t *p_intf, QWidget *_parent )
widget
=
new
SpeedLabel
(
p_intf
,
this
);
widgetItem
->
setText
(
qtr
(
"Speed selector"
)
);
break
;
case
TIME_LABEL_ELAPSED
:
widget
=
new
QLabel
(
"2:42"
,
this
);
widgetItem
->
setText
(
qtr
(
"Elasped time"
)
);
break
;
case
TIME_LABEL_REMAINING
:
widget
=
new
QLabel
(
"-2:42"
,
this
);
widgetItem
->
setText
(
qtr
(
"Total/Remaining time"
)
);
break
;
default:
msg_Warn
(
p_intf
,
"This should not happen %i"
,
i
);
break
;
...
...
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