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
2f1aa52f
Commit
2f1aa52f
authored
Mar 04, 2011
by
Francois Cartegnie
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Qt: don't throw previous EPG data on channel/input switch
parent
887ad85c
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
38 additions
and
12 deletions
+38
-12
modules/gui/qt4/components/epg/EPGEvent.hpp
modules/gui/qt4/components/epg/EPGEvent.hpp
+6
-0
modules/gui/qt4/components/epg/EPGWidget.cpp
modules/gui/qt4/components/epg/EPGWidget.cpp
+32
-12
No files found.
modules/gui/qt4/components/epg/EPGEvent.hpp
View file @
2f1aa52f
...
...
@@ -48,6 +48,12 @@ public:
&&
current
==
other
.
current
;
}
bool
ends_before
(
const
QDateTime
&
ref
)
const
{
QDateTime
start_
=
start
;
return
start_
.
addSecs
(
duration
)
<
ref
;
}
QDateTime
start
;
int
duration
;
QString
name
;
...
...
modules/gui/qt4/components/epg/EPGWidget.cpp
View file @
2f1aa52f
...
...
@@ -31,6 +31,7 @@
#include <QScrollBar>
#include <QDebug>
#include <QLabel>
#include <QStringList>
#include "qt4.hpp"
EPGWidget
::
EPGWidget
(
QWidget
*
parent
)
:
QWidget
(
parent
)
...
...
@@ -72,20 +73,32 @@ void EPGWidget::setZoom( int level )
void
EPGWidget
::
updateEPG
(
vlc_epg_t
**
pp_epg
,
int
i_epg
)
{
QStringList
channelsList
;
EPGEvent
*
item
;
/* FIXME: dvb time might be from the next timezone */
QDateTime
timeReference
=
QDateTime
::
currentDateTime
();
/* flag all entries as non updated */
foreach
(
const
QString
&
str
,
m_events
.
uniqueKeys
()
)
foreach
(
item
,
m_events
.
values
(
str
)
)
item
->
updated
=
false
;
for
(
int
i
=
0
;
i
<
i_epg
;
++
i
)
{
vlc_epg_t
*
p_epg
=
pp_epg
[
i
];
QString
channelName
=
qfu
(
p_epg
->
psz_name
);
channelsList
.
append
(
channelName
);
/* Read current epg events from libvlc and try to insert them */
for
(
int
j
=
0
;
j
<
p_epg
->
i_event
;
++
j
)
{
vlc_epg_event_t
*
p_event
=
p_epg
->
pp_event
[
j
];
QString
eventName
=
qfu
(
p_event
->
psz_name
);
QDateTime
eventStart
=
QDateTime
::
fromTime_t
(
p_event
->
i_start
);
/* ensure we display ongoing item */
if
(
eventStart
<
timeReference
)
timeReference
=
eventStart
;
QList
<
EPGEvent
*>
events
=
m_events
.
values
(
channelName
);
EPGEvent
*
item
=
new
EPGEvent
(
eventName
);
item
=
new
EPGEvent
(
eventName
);
item
->
description
=
qfu
(
p_event
->
psz_description
);
item
->
shortDescription
=
qfu
(
p_event
->
psz_short_description
);
item
->
start
=
eventStart
;
...
...
@@ -110,27 +123,34 @@ void EPGWidget::updateEPG( vlc_epg_t **pp_epg, int i_epg )
m_events
.
insert
(
channelName
,
item
);
m_epgView
->
addEvent
(
item
);
}
else
else
/* the new item is unused */
delete
item
;
}
}
// Remove old items
/* Remove old (not in current epg list) items for current tuned channels */
/* and try to keep previously tuned in channels data */
QMultiMap
<
QString
,
EPGEvent
*>::
iterator
i
=
m_events
.
begin
();
while
(
i
!=
m_events
.
end
()
)
{
EPGEvent
*
item
=
i
.
value
();
if
(
!
item
->
updated
)
item
=
i
.
value
();
if
(
channelsList
.
contains
(
item
->
channelName
)
&&
!
item
->
updated
)
{
m_epgView
->
delEvent
(
item
);
delete
item
;
--
i
;
m_events
.
erase
(
i
+
1
);
i
=
m_events
.
erase
(
i
);
}
else
item
->
updated
=
false
;
++
i
;
{
/* If it's known but not in current libvlc data, try to expire it */
if
(
item
->
ends_before
(
timeReference
)
)
{
m_epgView
->
delEvent
(
item
);
delete
item
;
i
=
m_events
.
erase
(
i
);
}
else
++
i
;
}
}
// Update the global duration and start time.
...
...
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