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
4b897bbb
Commit
4b897bbb
authored
Aug 04, 2010
by
Adrien Maglo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Qt/EPG: Remove channels when they don't have any item.
parent
daae8e52
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
47 additions
and
5 deletions
+47
-5
modules/gui/qt4/components/epg/EPGItem.cpp
modules/gui/qt4/components/epg/EPGItem.cpp
+6
-1
modules/gui/qt4/components/epg/EPGItem.hpp
modules/gui/qt4/components/epg/EPGItem.hpp
+2
-1
modules/gui/qt4/components/epg/EPGView.cpp
modules/gui/qt4/components/epg/EPGView.cpp
+39
-3
No files found.
modules/gui/qt4/components/epg/EPGItem.cpp
View file @
4b897bbb
...
...
@@ -112,7 +112,12 @@ int EPGItem::duration() const
return
m_duration
;
}
void
EPGItem
::
setChannel
(
int
channelNb
)
int
EPGItem
::
getChannelNb
()
const
{
return
m_channelNb
;
}
void
EPGItem
::
setChannelNb
(
int
channelNb
)
{
//qDebug() << "Channel" << channelNb;
m_channelNb
=
channelNb
;
...
...
modules/gui/qt4/components/epg/EPGItem.hpp
View file @
4b897bbb
...
...
@@ -44,8 +44,9 @@ public:
const
QDateTime
&
start
()
const
;
int
duration
()
const
;
int
getChannelNb
()
const
;
void
setChannel
(
int
channelNb
);
void
setChannel
Nb
(
int
channelNb
);
void
setStart
(
const
QDateTime
&
start
);
void
setDuration
(
int
duration
);
void
setName
(
const
QString
&
name
);
...
...
modules/gui/qt4/components/epg/EPGView.cpp
View file @
4b897bbb
...
...
@@ -92,7 +92,7 @@ void EPGView::addEvent( EPGEvent* event )
m_channels
.
append
(
event
->
channelName
);
EPGItem
*
item
=
new
EPGItem
(
this
);
item
->
setChannel
(
m_channels
.
indexOf
(
event
->
channelName
)
);
item
->
setChannel
Nb
(
m_channels
.
indexOf
(
event
->
channelName
)
);
item
->
setStart
(
event
->
start
);
item
->
setDuration
(
event
->
duration
);
item
->
setName
(
event
->
name
);
...
...
@@ -107,9 +107,45 @@ void EPGView::addEvent( EPGEvent* event )
void
EPGView
::
delEvent
(
EPGEvent
*
event
)
{
if
(
event
->
item
!=
NULL
)
scene
()
->
removeItem
(
event
->
item
);
if
(
event
->
item
==
NULL
)
return
;
int
channelNb
=
event
->
item
->
getChannelNb
();
// Remove the item.
scene
()
->
removeItem
(
event
->
item
);
event
->
item
=
NULL
;
// Look if the channel is still used by other events.
QList
<
QGraphicsItem
*>
itemList
=
items
();
bool
b_used
=
false
;
for
(
int
i
=
0
;
i
<
itemList
.
count
();
++
i
)
{
EPGItem
*
item
=
qgraphicsitem_cast
<
EPGItem
*>
(
itemList
.
at
(
i
)
);
if
(
!
item
)
continue
;
if
(
item
->
getChannelNb
()
==
channelNb
)
{
b_used
=
true
;
break
;
}
}
// If the channel is no more used, then we remove it from the list
// and decrease the channel number of the concerned items.
if
(
!
b_used
)
{
m_channels
.
removeAt
(
channelNb
);
for
(
int
i
=
0
;
i
<
itemList
.
count
();
++
i
)
{
EPGItem
*
item
=
qgraphicsitem_cast
<
EPGItem
*>
(
itemList
.
at
(
i
)
);
if
(
!
item
)
continue
;
int
itemChannelNb
=
item
->
getChannelNb
();
if
(
itemChannelNb
>
channelNb
)
item
->
setChannelNb
(
itemChannelNb
-
1
);
}
}
}
void
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