Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-2-2
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-2-2
Commits
c0670fd9
Commit
c0670fd9
authored
Jul 03, 2011
by
Francois Cartegnie
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Qt: Make chapters marks clickable
parent
0f762cdd
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
46 additions
and
2 deletions
+46
-2
modules/gui/qt4/util/input_slider.cpp
modules/gui/qt4/util/input_slider.cpp
+45
-2
modules/gui/qt4/util/input_slider.hpp
modules/gui/qt4/util/input_slider.hpp
+1
-0
No files found.
modules/gui/qt4/util/input_slider.cpp
View file @
c0670fd9
...
@@ -31,6 +31,8 @@
...
@@ -31,6 +31,8 @@
#include "util/input_slider.hpp"
#include "util/input_slider.hpp"
#include "adapters/seekpoints.hpp"
#include "adapters/seekpoints.hpp"
#include <stdlib.h>
#include <QPaintEvent>
#include <QPaintEvent>
#include <QPainter>
#include <QPainter>
#include <QBitmap>
#include <QBitmap>
...
@@ -42,6 +44,7 @@
...
@@ -42,6 +44,7 @@
#define MINIMUM 0
#define MINIMUM 0
#define MAXIMUM 1000
#define MAXIMUM 1000
#define CHAPTERSSPOTSIZE 3
SeekSlider
::
SeekSlider
(
QWidget
*
_parent
)
:
QSlider
(
_parent
)
SeekSlider
::
SeekSlider
(
QWidget
*
_parent
)
:
QSlider
(
_parent
)
{
{
...
@@ -145,6 +148,11 @@ void SeekSlider::mouseReleaseEvent( QMouseEvent *event )
...
@@ -145,6 +148,11 @@ void SeekSlider::mouseReleaseEvent( QMouseEvent *event )
event
->
accept
();
event
->
accept
();
b_isSliding
=
false
;
b_isSliding
=
false
;
seekLimitTimer
->
stop
();
/* We're not sliding anymore: only last seek on release */
seekLimitTimer
->
stop
();
/* We're not sliding anymore: only last seek on release */
if
(
b_is_jumping
)
{
b_is_jumping
=
false
;
return
;
}
QSlider
::
mouseReleaseEvent
(
event
);
QSlider
::
mouseReleaseEvent
(
event
);
updatePos
();
updatePos
();
}
}
...
@@ -159,6 +167,41 @@ void SeekSlider::mousePressEvent( QMouseEvent* event )
...
@@ -159,6 +167,41 @@ void SeekSlider::mousePressEvent( QMouseEvent* event )
return
;
return
;
}
}
b_is_jumping
=
false
;
/* handle chapter clicks */
int
i_width
=
size
().
width
();
if
(
chapters
&&
inputLength
&&
i_width
)
{
if
(
orientation
()
==
Qt
::
Horizontal
)
/* TODO: vertical */
{
/* only on chapters zone */
if
(
event
->
y
()
<
CHAPTERSSPOTSIZE
||
event
->
y
()
>
(
size
().
height
()
-
CHAPTERSSPOTSIZE
)
)
{
QList
<
SeekPoint
>
points
=
chapters
->
getPoints
();
int
i_selected
=
-
1
;
int
i_min_diff
=
i_width
+
1
;
for
(
int
i
=
0
;
i
<
points
.
count
()
;
i
++
)
{
int
x
=
points
.
at
(
i
).
time
/
1000000.0
/
inputLength
*
i_width
;
int
diff_x
=
abs
(
x
-
event
->
x
()
);
if
(
diff_x
<
i_min_diff
)
{
i_min_diff
=
diff_x
;
i_selected
=
i
;
}
else
break
;
}
if
(
i_selected
&&
i_min_diff
<
4
)
// max 4px around mark
{
chapters
->
jumpTo
(
i_selected
);
event
->
accept
();
b_is_jumping
=
true
;
return
;
}
}
}
}
b_isSliding
=
true
;
b_isSliding
=
true
;
setValue
(
QStyle
::
sliderValueFromPosition
(
MINIMUM
,
MAXIMUM
,
event
->
x
(),
width
(),
false
)
);
setValue
(
QStyle
::
sliderValueFromPosition
(
MINIMUM
,
MAXIMUM
,
event
->
x
(),
width
(),
false
)
);
event
->
accept
();
event
->
accept
();
...
@@ -362,8 +405,8 @@ void SeekSlider::paintEvent( QPaintEvent *event )
...
@@ -362,8 +405,8 @@ void SeekSlider::paintEvent( QPaintEvent *event )
int
x
=
point
.
time
/
1000000.0
/
inputLength
*
size
().
width
();
int
x
=
point
.
time
/
1000000.0
/
inputLength
*
size
().
width
();
painter
.
setPen
(
QColor
(
80
,
80
,
80
)
);
painter
.
setPen
(
QColor
(
80
,
80
,
80
)
);
painter
.
setBrush
(
Qt
::
NoBrush
);
painter
.
setBrush
(
Qt
::
NoBrush
);
painter
.
drawLine
(
x
,
0
,
x
,
3
);
painter
.
drawLine
(
x
,
0
,
x
,
CHAPTERSSPOTSIZE
);
painter
.
drawLine
(
x
,
height
(),
x
,
height
()
-
3
);
painter
.
drawLine
(
x
,
height
(),
x
,
height
()
-
CHAPTERSSPOTSIZE
);
}
}
}
}
}
}
...
...
modules/gui/qt4/util/input_slider.hpp
View file @
c0670fd9
...
@@ -65,6 +65,7 @@ protected:
...
@@ -65,6 +65,7 @@ protected:
private:
private:
bool
b_isSliding
;
/* Whether we are currently sliding by user action */
bool
b_isSliding
;
/* Whether we are currently sliding by user action */
bool
b_is_jumping
;
/* if we requested a jump to another chapter */
int
inputLength
;
/* InputLength that can change */
int
inputLength
;
/* InputLength that can change */
char
psz_length
[
MSTRTIME_MAX_SIZE
];
/* Used for the ToolTip */
char
psz_length
[
MSTRTIME_MAX_SIZE
];
/* Used for the ToolTip */
QTimer
*
seekLimitTimer
;
QTimer
*
seekLimitTimer
;
...
...
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