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
44e31c0f
Commit
44e31c0f
authored
Sep 21, 2008
by
Jean-Baptiste Kempf
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Qt4: Really split the TimeLabel into its own class.
Code simplification and TimeLabel in the FSC.
parent
cd794aec
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
56 additions
and
39 deletions
+56
-39
modules/gui/qt4/components/interface_widgets.cpp
modules/gui/qt4/components/interface_widgets.cpp
+42
-2
modules/gui/qt4/components/interface_widgets.hpp
modules/gui/qt4/components/interface_widgets.hpp
+13
-4
modules/gui/qt4/main_interface.cpp
modules/gui/qt4/main_interface.cpp
+1
-30
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 @
44e31c0f
...
...
@@ -1027,6 +1027,7 @@ FullscreenControllerWidget::FullscreenControllerWidget( intf_thread_t *_p_i,
fsLayout
->
addWidget
(
slider
,
0
,
1
,
1
,
9
);
fsLayout
->
addWidget
(
fasterButton
,
0
,
10
);
/* Second line */
fsLayout
->
addWidget
(
playButton
,
1
,
0
,
1
,
2
);
fsLayout
->
addLayout
(
controlButLayout
,
1
,
2
);
...
...
@@ -1036,8 +1037,12 @@ FullscreenControllerWidget::FullscreenControllerWidget( intf_thread_t *_p_i,
fsLayout
->
addWidget
(
advControls
,
1
,
6
,
Qt
::
AlignVCenter
);
fsLayout
->
setColumnStretch
(
7
,
10
);
fsLayout
->
addWidget
(
volMuteLabel
,
1
,
8
);
fsLayout
->
addWidget
(
volumeSlider
,
1
,
9
,
1
,
2
);
TimeLabel
*
timeLabel
=
new
TimeLabel
(
p_intf
);
fsLayout
->
addWidget
(
timeLabel
,
1
,
8
);
fsLayout
->
addWidget
(
volMuteLabel
,
1
,
9
);
fsLayout
->
addWidget
(
volumeSlider
,
1
,
10
,
1
,
2
);
/* hiding timer */
p_hideTimer
=
new
QTimer
(
this
);
...
...
@@ -1068,6 +1073,7 @@ FullscreenControllerWidget::FullscreenControllerWidget( intf_thread_t *_p_i,
fullscreenButton
->
setIcon
(
QIcon
(
":/defullscreen"
)
);
vlc_mutex_init_recursive
(
&
lock
);
setMinimumWidth
(
450
);
}
FullscreenControllerWidget
::~
FullscreenControllerWidget
()
...
...
@@ -1608,3 +1614,37 @@ void CoverArtLabel::doUpdate()
}
}
TimeLabel
::
TimeLabel
(
intf_thread_t
*
_p_intf
)
:
QLabel
(),
p_intf
(
_p_intf
)
{
b_remainingTime
=
false
;
setText
(
" --:--/--:-- "
);
setAlignment
(
Qt
::
AlignRight
|
Qt
::
AlignVCenter
);
setToolTip
(
qtr
(
"Toggle between elapsed and remaining time"
)
);
CONNECT
(
THEMIM
->
getIM
(),
positionUpdated
(
float
,
int
,
int
),
this
,
setDisplayPosition
(
float
,
int
,
int
)
);
}
void
TimeLabel
::
setDisplayPosition
(
float
pos
,
int
time
,
int
length
)
{
char
psz_length
[
MSTRTIME_MAX_SIZE
],
psz_time
[
MSTRTIME_MAX_SIZE
];
secstotimestr
(
psz_length
,
length
);
secstotimestr
(
psz_time
,
(
b_remainingTime
&&
length
)
?
length
-
time
:
time
);
QString
timestr
;
timestr
.
sprintf
(
"%s/%s"
,
psz_time
,
(
!
length
&&
time
)
?
"--:--"
:
psz_length
);
/* Add a minus to remaining time*/
if
(
b_remainingTime
&&
length
)
setText
(
" -"
+
timestr
+
" "
);
else
setText
(
" "
+
timestr
+
" "
);
}
void
TimeLabel
::
toggleTimeDisplay
()
{
b_remainingTime
=
!
b_remainingTime
;
}
modules/gui/qt4/components/interface_widgets.hpp
View file @
44e31c0f
...
...
@@ -332,16 +332,25 @@ private:
class
TimeLabel
:
public
QLabel
{
Q_OBJECT
void
mousePressEvent
(
QMouseEvent
*
event
)
public:
TimeLabel
(
intf_thread_t
*
_p_intf
);
protected:
virtual
void
mousePressEvent
(
QMouseEvent
*
event
)
{
emit
timeLabelClicked
();
toggleTimeDisplay
();
}
void
mouseDoubleClickEvent
(
QMouseEvent
*
event
)
v
irtual
v
oid
mouseDoubleClickEvent
(
QMouseEvent
*
event
)
{
toggleTimeDisplay
();
emit
timeLabelDoubleClicked
();
}
private
slots
:
void
setDisplayPosition
(
float
pos
,
int
time
,
int
length
);
private:
intf_thread_t
*
p_intf
;
bool
b_remainingTime
;
void
toggleTimeDisplay
();
signals:
void
timeLabelClicked
();
void
timeLabelDoubleClicked
();
};
...
...
modules/gui/qt4/main_interface.cpp
View file @
44e31c0f
...
...
@@ -146,8 +146,6 @@ MainInterface::MainInterface( intf_thread_t *_p_intf ) : QVLCMW( _p_intf )
/* Connect the input manager to the GUI elements it manages */
/* It is also connected to the control->slider, see the ControlsWidget */
CONNECT
(
THEMIM
->
getIM
(),
positionUpdated
(
float
,
int
,
int
),
this
,
setDisplayPosition
(
float
,
int
,
int
)
);
/* Change the SpeedRate in the Status */
CONNECT
(
THEMIM
->
getIM
(),
rateChanged
(
int
),
this
,
setRate
(
int
)
);
...
...
@@ -291,11 +289,7 @@ inline void MainInterface::createStatusBar()
* Status Bar *
****************/
/* Widgets Creation*/
b_remainingTime
=
false
;
timeLabel
=
new
TimeLabel
;
timeLabel
->
setText
(
" --:--/--:-- "
);
timeLabel
->
setAlignment
(
Qt
::
AlignRight
|
Qt
::
AlignVCenter
);
timeLabel
->
setToolTip
(
qtr
(
"Toggle between elapsed and remaining time"
)
);
timeLabel
=
new
TimeLabel
(
p_intf
);
nameLabel
=
new
QLabel
;
nameLabel
->
setTextInteractionFlags
(
Qt
::
TextSelectableByMouse
|
Qt
::
TextSelectableByKeyboard
);
...
...
@@ -318,9 +312,7 @@ inline void MainInterface::createStatusBar()
- double clicking opens the goto time dialog
- right-clicking and clicking just toggle between remaining and
elapsed time.*/
CONNECT
(
timeLabel
,
timeLabelClicked
(),
this
,
toggleTimeDisplay
()
);
CONNECT
(
timeLabel
,
timeLabelDoubleClicked
(),
THEDP
,
gotoTimeDialog
()
);
CONNECT
(
timeLabel
,
timeLabelDoubleClicked
(),
this
,
toggleTimeDisplay
()
);
/* Speed Label behaviour:
- right click gives the vertical speed slider */
...
...
@@ -854,27 +846,6 @@ void MainInterface::visual()
/************************************************************************
* Other stuff
************************************************************************/
void
MainInterface
::
setDisplayPosition
(
float
pos
,
int
time
,
int
length
)
{
char
psz_length
[
MSTRTIME_MAX_SIZE
],
psz_time
[
MSTRTIME_MAX_SIZE
];
secstotimestr
(
psz_length
,
length
);
secstotimestr
(
psz_time
,
(
b_remainingTime
&&
length
)
?
length
-
time
:
time
);
QString
timestr
;
timestr
.
sprintf
(
"%s/%s"
,
psz_time
,
(
!
length
&&
time
)
?
"--:--"
:
psz_length
);
/* Add a minus to remaining time*/
if
(
b_remainingTime
&&
length
)
timeLabel
->
setText
(
" -"
+
timestr
+
" "
);
else
timeLabel
->
setText
(
" "
+
timestr
+
" "
);
}
void
MainInterface
::
toggleTimeDisplay
()
{
b_remainingTime
=
!
b_remainingTime
;
}
void
MainInterface
::
setName
(
QString
name
)
{
input_name
=
name
;
/* store it for the QSystray use */
...
...
modules/gui/qt4/main_interface.hpp
View file @
44e31c0f
...
...
@@ -133,7 +133,6 @@ private:
bool
playlistVisible
;
///< Is the playlist visible ?
bool
visualSelectorEnabled
;
bool
notificationEnabled
;
/// Systray Notifications
bool
b_remainingTime
;
/* Show elapsed or remaining time */
bool
bgWasVisible
;
int
i_visualmode
;
///< Visual Mode
pl_dock_e
i_pl_dock
;
...
...
@@ -171,8 +170,6 @@ private slots:
void
setRate
(
int
);
void
setName
(
QString
);
void
setVLCWindowsTitle
(
QString
title
=
""
);
void
setDisplayPosition
(
float
,
int
,
int
);
void
toggleTimeDisplay
();
#if 0
void visual();
#endif
...
...
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