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
726e595b
Commit
726e595b
authored
Mar 09, 2013
by
Francois Cartegnie
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Qt: EPGView: use bounding rects for simplification
parent
11315607
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
21 deletions
+23
-21
modules/gui/qt4/components/epg/EPGRuler.cpp
modules/gui/qt4/components/epg/EPGRuler.cpp
+23
-21
No files found.
modules/gui/qt4/components/epg/EPGRuler.cpp
View file @
726e595b
...
...
@@ -28,6 +28,9 @@
#include <QPaintEvent>
#include <QtDebug>
#include <QDateTime>
#include <QPoint>
#include <QRect>
#include <QSize>
EPGRuler
::
EPGRuler
(
QWidget
*
parent
)
:
QWidget
(
parent
)
...
...
@@ -66,41 +69,40 @@ void EPGRuler::paintEvent( QPaintEvent *event )
{
Q_UNUSED
(
event
);
const
QSize
margin
(
0
,
15
);
const
QSize
header
(
0
,
15
);
const
int
spacing
=
m_scale
*
3600
;
QPainter
p
(
this
);
int
secondsOffset
=
m_offset
/
m_scale
;
QDateTime
localStartTime
;
localStartTime
=
m_startTime
.
addSecs
(
secondsOffset
);
localStartTime
=
m_startTime
.
addSecs
(
m_offset
/
m_scale
);
QDateTime
diff
(
localStartTime
);
diff
.
setTime
(
QTime
(
localStartTime
.
time
().
hour
(),
0
,
0
,
0
)
);
int
secondsToHour
=
localStartTime
.
secsTo
(
diff
);
/* draw hour blocks, with right bound being hourmark */
QPoint
here
(
secondsToHour
*
m_scale
,
margin
.
height
()
);
QPoint
previous
(
-
1
,
0
);
QDateTime
current
(
localStartTime
.
addSecs
(
secondsToHour
)
);
int
spacing
=
(
m_scale
*
60
)
*
60
;
int
posx
=
secondsToHour
*
m_scale
;
// Count the number of items to draw
int
itemsToDraw
=
(
width
()
/
spacing
)
+
1
;
for
(
;
itemsToDraw
>=
0
;
--
itemsToDraw
)
current
=
current
.
addSecs
(
-
3600
);
while
(
here
.
rx
()
<
width
()
+
spacing
)
{
p
.
drawLine
(
posx
,
15
,
posx
,
30
);
p
.
drawText
(
posx
+
1
,
12
,
50
,
15
,
Qt
::
AlignLeft
,
current
.
toString
(
"hh'h'"
)
);
posx
+=
spacing
;
current
=
current
.
addSecs
(
60
*
60
);
QRect
area
(
QPoint
(
previous
.
x
()
+
1
,
margin
.
height
()
),
here
);
area
.
adjust
(
0
,
0
,
0
,
header
.
height
()
);
p
.
drawLine
(
area
.
topRight
(),
area
.
bottomRight
()
);
p
.
drawText
(
area
,
Qt
::
AlignLeft
,
current
.
toString
(
"hh'h'"
)
);
previous
=
here
;
here
.
rx
()
+=
spacing
;
current
=
current
.
addSecs
(
3600
);
}
/* draw current time line */
posx
=
localStartTime
.
secsTo
(
QDateTime
::
currentDateTime
()
)
*
m_scale
;
if
(
posx
<=
width
()
&&
posx
>=
0
)
here
.
rx
()
=
localStartTime
.
secsTo
(
QDateTime
::
currentDateTime
()
)
*
m_scale
;
if
(
here
.
x
()
<=
width
()
&&
here
.
x
()
>=
0
)
{
QPen
pen
(
QPen
(
QColor
(
255
,
0
,
0
,
128
)
)
);
pen
.
setWidth
(
3
);
p
.
setPen
(
pen
);
p
.
drawLine
(
posx
-
1
,
15
,
posx
-
1
,
30
);
p
.
setPen
(
QPen
(
QColor
(
255
,
0
,
0
,
128
)
)
);
p
.
drawLine
(
here
,
QPoint
(
here
.
x
(),
here
.
y
()
+
header
.
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