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
4f30340a
Commit
4f30340a
authored
Jun 02, 2010
by
Ludovic Fauvet
Committed by
Jean-Baptiste Kempf
Jun 02, 2010
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
epg: add an overlay containing the channels list
Signed-off-by:
Jean-Baptiste Kempf
<
jb@videolan.org
>
parent
5cae846c
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
43 additions
and
2 deletions
+43
-2
modules/gui/qt4/components/epg/EPGView.cpp
modules/gui/qt4/components/epg/EPGView.cpp
+37
-2
modules/gui/qt4/components/epg/EPGView.hpp
modules/gui/qt4/components/epg/EPGView.hpp
+6
-0
No files found.
modules/gui/qt4/components/epg/EPGView.cpp
View file @
4f30340a
...
...
@@ -26,19 +26,41 @@
#include <QDateTime>
#include <QMatrix>
#include <QPaintEvent>
#include <QScrollBar>
#include <QtDebug>
#include <QGraphicsTextItem>
EPGView
::
EPGView
(
QWidget
*
parent
)
:
QGraphicsView
(
parent
)
{
setContentsMargins
(
0
,
0
,
0
,
0
);
setFrameStyle
(
QFrame
::
NoFrame
);
setAlignment
(
Qt
::
AlignLeft
|
Qt
::
AlignTop
);
setViewportUpdateMode
(
QGraphicsView
::
FullViewportUpdate
);
m_startTime
=
QDateTime
::
currentDateTime
();
QGraphicsScene
*
EPGscene
=
new
QGraphicsScene
(
this
);
setScene
(
EPGscene
);
connect
(
horizontalScrollBar
(),
SIGNAL
(
valueChanged
(
int
)
),
this
,
SLOT
(
updateOverlayPosition
(
int
)
)
);
m_overlay
=
EPGscene
->
addRect
(
0
,
0
,
100
,
1
,
QPen
(),
QBrush
(
QColor
(
40
,
86
,
255
,
220
)
)
);
m_overlay
->
setFlag
(
QGraphicsItem
::
ItemIgnoresTransformations
);
m_overlay
->
setZValue
(
100
);
sceneRectChanged
(
scene
()
->
sceneRect
()
);
connect
(
scene
(),
SIGNAL
(
sceneRectChanged
(
QRectF
)
),
this
,
SLOT
(
sceneRectChanged
(
QRectF
)
)
);
}
void
EPGView
::
updateOverlayPosition
(
int
value
)
{
int
pos
=
value
*
matrix
().
inverted
().
m11
();
m_overlay
->
setPos
(
pos
,
0
);
}
void
EPGView
::
setScale
(
double
scaleFactor
)
...
...
@@ -57,7 +79,8 @@ void EPGView::setStartTime( const QDateTime& startTime )
for
(
int
i
=
0
;
i
<
itemList
.
count
();
++
i
)
{
EPGItem
*
item
=
static_cast
<
EPGItem
*>
(
itemList
.
at
(
i
)
);
EPGItem
*
item
=
dynamic_cast
<
EPGItem
*>
(
itemList
.
at
(
i
)
);
if
(
!
item
)
continue
;
item
->
setStart
(
item
->
start
().
addSecs
(
diff
)
);
}
...
...
@@ -75,7 +98,13 @@ const QDateTime& EPGView::startTime()
void
EPGView
::
addEvent
(
EPGEvent
*
event
)
{
if
(
!
m_channels
.
contains
(
event
->
channelName
)
)
{
m_channels
.
append
(
event
->
channelName
);
QGraphicsTextItem
*
channelTitle
=
new
QGraphicsTextItem
(
event
->
channelName
,
m_overlay
);
channelTitle
->
setZValue
(
101
);
channelTitle
->
setPos
(
0
,
m_channels
.
indexOf
(
event
->
channelName
)
*
TRACKS_HEIGHT
);
channelTitle
->
setTextWidth
(
100
);
}
EPGItem
*
item
=
new
EPGItem
(
this
);
item
->
setChannel
(
m_channels
.
indexOf
(
event
->
channelName
)
);
...
...
@@ -123,7 +152,8 @@ void EPGView::updateDuration()
for
(
int
i
=
0
;
i
<
list
.
count
();
++
i
)
{
EPGItem
*
item
=
static_cast
<
EPGItem
*>
(
list
.
at
(
i
)
);
EPGItem
*
item
=
dynamic_cast
<
EPGItem
*>
(
list
.
at
(
i
)
);
if
(
!
item
)
continue
;
QDateTime
itemEnd
=
item
->
start
().
addSecs
(
item
->
duration
()
);
if
(
itemEnd
>
lastItem
)
...
...
@@ -137,3 +167,8 @@ void EPGView::eventFocused( EPGEvent *ev )
{
emit
eventFocusedChanged
(
ev
);
}
void
EPGView
::
sceneRectChanged
(
const
QRectF
&
rect
)
{
m_overlay
->
setRect
(
0
,
0
,
m_overlay
->
rect
().
width
(),
rect
.
height
()
);
}
modules/gui/qt4/components/epg/EPGView.hpp
View file @
4f30340a
...
...
@@ -61,8 +61,14 @@ protected:
int
m_scaleFactor
;
int
m_duration
;
private:
QGraphicsRectItem
*
m_overlay
;
public
slots
:
void
eventFocused
(
EPGEvent
*
);
private
slots
:
void
updateOverlayPosition
(
int
value
);
void
sceneRectChanged
(
const
QRectF
&
rect
);
};
#endif // EPGVIEW_H
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