Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-gpu
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-gpu
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
Show 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:
...
@@ -48,6 +48,12 @@ public:
&&
current
==
other
.
current
;
&&
current
==
other
.
current
;
}
}
bool
ends_before
(
const
QDateTime
&
ref
)
const
{
QDateTime
start_
=
start
;
return
start_
.
addSecs
(
duration
)
<
ref
;
}
QDateTime
start
;
QDateTime
start
;
int
duration
;
int
duration
;
QString
name
;
QString
name
;
...
...
modules/gui/qt4/components/epg/EPGWidget.cpp
View file @
2f1aa52f
...
@@ -31,6 +31,7 @@
...
@@ -31,6 +31,7 @@
#include <QScrollBar>
#include <QScrollBar>
#include <QDebug>
#include <QDebug>
#include <QLabel>
#include <QLabel>
#include <QStringList>
#include "qt4.hpp"
#include "qt4.hpp"
EPGWidget
::
EPGWidget
(
QWidget
*
parent
)
:
QWidget
(
parent
)
EPGWidget
::
EPGWidget
(
QWidget
*
parent
)
:
QWidget
(
parent
)
...
@@ -72,20 +73,32 @@ void EPGWidget::setZoom( int level )
...
@@ -72,20 +73,32 @@ void EPGWidget::setZoom( int level )
void
EPGWidget
::
updateEPG
(
vlc_epg_t
**
pp_epg
,
int
i_epg
)
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
)
for
(
int
i
=
0
;
i
<
i_epg
;
++
i
)
{
{
vlc_epg_t
*
p_epg
=
pp_epg
[
i
];
vlc_epg_t
*
p_epg
=
pp_epg
[
i
];
QString
channelName
=
qfu
(
p_epg
->
psz_name
);
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
)
for
(
int
j
=
0
;
j
<
p_epg
->
i_event
;
++
j
)
{
{
vlc_epg_event_t
*
p_event
=
p_epg
->
pp_event
[
j
];
vlc_epg_event_t
*
p_event
=
p_epg
->
pp_event
[
j
];
QString
eventName
=
qfu
(
p_event
->
psz_name
);
QString
eventName
=
qfu
(
p_event
->
psz_name
);
QDateTime
eventStart
=
QDateTime
::
fromTime_t
(
p_event
->
i_start
);
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
);
QList
<
EPGEvent
*>
events
=
m_events
.
values
(
channelName
);
EPGEvent
*
item
=
new
EPGEvent
(
eventName
);
item
=
new
EPGEvent
(
eventName
);
item
->
description
=
qfu
(
p_event
->
psz_description
);
item
->
description
=
qfu
(
p_event
->
psz_description
);
item
->
shortDescription
=
qfu
(
p_event
->
psz_short_description
);
item
->
shortDescription
=
qfu
(
p_event
->
psz_short_description
);
item
->
start
=
eventStart
;
item
->
start
=
eventStart
;
...
@@ -110,28 +123,35 @@ void EPGWidget::updateEPG( vlc_epg_t **pp_epg, int i_epg )
...
@@ -110,28 +123,35 @@ void EPGWidget::updateEPG( vlc_epg_t **pp_epg, int i_epg )
m_events
.
insert
(
channelName
,
item
);
m_events
.
insert
(
channelName
,
item
);
m_epgView
->
addEvent
(
item
);
m_epgView
->
addEvent
(
item
);
}
}
else
else
/* the new item is unused */
delete
item
;
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
();
QMultiMap
<
QString
,
EPGEvent
*>::
iterator
i
=
m_events
.
begin
();
while
(
i
!=
m_events
.
end
()
)
while
(
i
!=
m_events
.
end
()
)
{
{
EPGEvent
*
item
=
i
.
value
();
item
=
i
.
value
();
if
(
!
item
->
updated
)
if
(
channelsList
.
contains
(
item
->
channelName
)
&&
!
item
->
updated
)
{
{
m_epgView
->
delEvent
(
item
);
m_epgView
->
delEvent
(
item
);
delete
item
;
delete
item
;
--
i
;
i
=
m_events
.
erase
(
i
);
m_events
.
erase
(
i
+
1
);
}
else
{
/* 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
else
item
->
updated
=
false
;
++
i
;
++
i
;
}
}
}
// Update the global duration and start time.
// Update the global duration and start time.
m_epgView
->
updateDuration
();
m_epgView
->
updateDuration
();
...
...
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