Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-1.1
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-1.1
Commits
27912412
Commit
27912412
authored
Jun 12, 2010
by
Adrien Maglo
Committed by
Jean-Baptiste Kempf
Jun 15, 2010
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Synchronise master and 1.1 branch Qt4 EPG
parent
081073b2
Changes
10
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
170 additions
and
84 deletions
+170
-84
modules/gui/qt4/Modules.am
modules/gui/qt4/Modules.am
+3
-0
modules/gui/qt4/components/epg/EPGChannels.cpp
modules/gui/qt4/components/epg/EPGChannels.cpp
+65
-0
modules/gui/qt4/components/epg/EPGChannels.hpp
modules/gui/qt4/components/epg/EPGChannels.hpp
+48
-0
modules/gui/qt4/components/epg/EPGItem.cpp
modules/gui/qt4/components/epg/EPGItem.cpp
+12
-14
modules/gui/qt4/components/epg/EPGView.cpp
modules/gui/qt4/components/epg/EPGView.cpp
+13
-47
modules/gui/qt4/components/epg/EPGView.hpp
modules/gui/qt4/components/epg/EPGView.hpp
+2
-7
modules/gui/qt4/components/epg/EPGWidget.cpp
modules/gui/qt4/components/epg/EPGWidget.cpp
+15
-6
modules/gui/qt4/components/epg/EPGWidget.hpp
modules/gui/qt4/components/epg/EPGWidget.hpp
+2
-0
modules/gui/qt4/dialogs/epg.cpp
modules/gui/qt4/dialogs/epg.cpp
+7
-9
modules/gui/qt4/dialogs/epg.hpp
modules/gui/qt4/dialogs/epg.hpp
+3
-1
No files found.
modules/gui/qt4/Modules.am
View file @
27912412
...
...
@@ -53,6 +53,7 @@ nodist_SOURCES_qt4 = \
components/interface_widgets.moc.cpp \
components/controller.moc.cpp \
components/controller_widget.moc.cpp \
components/epg/EPGChannels.moc.cpp \
components/epg/EPGRuler.moc.cpp \
components/epg/EPGView.moc.cpp \
components/epg/EPGWidget.moc.cpp \
...
...
@@ -251,6 +252,7 @@ SOURCES_qt4 = qt4.cpp \
components/interface_widgets.cpp \
components/controller.cpp \
components/controller_widget.cpp \
components/epg/EPGChannels.cpp \
components/epg/EPGItem.cpp \
components/epg/EPGRuler.cpp \
components/epg/EPGView.cpp \
...
...
@@ -307,6 +309,7 @@ noinst_HEADERS = \
components/interface_widgets.hpp \
components/controller.hpp \
components/controller_widget.hpp \
components/epg/EPGChannels.hpp \
components/epg/EPGEvent.hpp \
components/epg/EPGItem.hpp \
components/epg/EPGRuler.hpp \
...
...
modules/gui/qt4/components/epg/EPGChannels.cpp
0 → 100644
View file @
27912412
/*****************************************************************************
* EPGChannels.cpp: EPGChannels
****************************************************************************
* Copyright © 2009-2010 VideoLAN
*
* Authors: Adrien Maglo <magsoft@videolan.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#include "EPGChannels.hpp"
#include "EPGView.hpp"
#include <QPainter>
#include <QFont>
#include <QPaintEvent>
EPGChannels
::
EPGChannels
(
QWidget
*
parent
,
EPGView
*
m_epgView
)
:
QWidget
(
parent
),
m_epgView
(
m_epgView
),
m_offset
(
0
)
{
setContentsMargins
(
0
,
0
,
0
,
0
);
}
void
EPGChannels
::
setOffset
(
int
offset
)
{
m_offset
=
offset
;
update
();
}
void
EPGChannels
::
paintEvent
(
QPaintEvent
*
event
)
{
Q_UNUSED
(
event
);
QPainter
p
(
this
);
/* Draw the top and the bottom lines. */
p
.
drawLine
(
0
,
0
,
width
()
-
1
,
0
);
p
.
drawLine
(
0
,
height
()
-
1
,
width
(),
height
()
-
1
);
p
.
setFont
(
QFont
(
"Verdana"
,
8
)
);
QList
<
QString
>
channels
=
m_epgView
->
getChannelList
();
for
(
int
i
=
0
;
i
<
channels
.
count
();
++
i
)
{
p
.
drawText
(
0
,
-
m_offset
+
(
i
+
0.5
)
*
TRACKS_HEIGHT
-
4
,
width
(),
20
,
Qt
::
AlignLeft
,
channels
[
i
]
);
int
i_width
=
fontMetrics
().
width
(
channels
[
i
]
);
if
(
width
()
<
i_width
)
setMinimumWidth
(
i_width
);
}
}
modules/gui/qt4/components/epg/EPGChannels.hpp
0 → 100644
View file @
27912412
/*****************************************************************************
* EPGChannels.hpp : EPGChannels
****************************************************************************
* Copyright © 2009-2010 VideoLAN
*
* Authors: Adrien Maglo <magsoft@videolan.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#ifndef EPGCHANNELS_HPP
#define EPGCHANNELS_HPP
#include <QWidget>
class
EPGView
;
class
EPGChannels
:
public
QWidget
{
Q_OBJECT
public:
EPGChannels
(
QWidget
*
parent
,
EPGView
*
m_epgView
);
virtual
~
EPGChannels
()
{
}
public
slots
:
void
setOffset
(
int
offset
);
protected:
virtual
void
paintEvent
(
QPaintEvent
*
event
);
private:
EPGView
*
m_epgView
;
int
m_offset
;
};
#endif // EPGCHANNELS_HPP
modules/gui/qt4/components/epg/EPGItem.cpp
View file @
27912412
...
...
@@ -62,9 +62,9 @@ void EPGItem::paint( QPainter *painter, const QStyleOptionGraphicsItem*, QWidget
painter
->
setPen
(
QPen
(
Qt
::
black
)
);
if
(
m_current
)
painter
->
setBrush
(
QBrush
(
Q
t
::
red
)
);
painter
->
setBrush
(
QBrush
(
Q
Color
(
100
,
100
,
100
)
)
);
else
painter
->
setBrush
(
QBrush
(
Q
t
::
blue
)
);
painter
->
setBrush
(
QBrush
(
Q
Color
(
150
,
150
,
150
)
)
);
painter
->
drawRect
(
mapped
);
...
...
@@ -73,30 +73,28 @@ void EPGItem::paint( QPainter *painter, const QStyleOptionGraphicsItem*, QWidget
// Setup the font
QFont
f
=
painter
->
font
();
f
.
setBold
(
true
);
painter
->
setFont
(
f
);
// Get the font metrics
QFontMetrics
fm
=
painter
->
fontMetrics
();
// Adjust the drawing rect
mapped
.
adjust
(
2
,
2
,
-
2
,
-
2
);
mapped
.
adjust
(
6
,
6
,
-
6
,
-
6
);
painter
->
setPen
(
Qt
::
white
);
/* Draw the title. */
painter
->
drawText
(
mapped
,
Qt
::
AlignTop
|
Qt
::
AlignLeft
,
fm
.
elidedText
(
m_name
,
Qt
::
ElideRight
,
mapped
.
width
()
)
);
f
.
setBold
(
false
);
mapped
.
adjust
(
0
,
20
,
0
,
0
);
QDateTime
m_end
=
m_start
.
addSecs
(
m_duration
);
f
.
setPixelSize
(
10
);
f
.
setItalic
(
true
);
painter
->
setFont
(
f
);
QTextOption
textoption
;
textoption
.
setWrapMode
(
QTextOption
::
WordWrap
);
textoption
.
setAlignment
(
Qt
::
AlignTop
|
Qt
::
AlignLeft
);
painter
->
drawText
(
mapped
.
adjusted
(
0
,
20
,
0
,
0
),
m_shortDescription
,
textoption
);
/* Draw the hours. */
painter
->
drawText
(
mapped
,
Qt
::
AlignTop
|
Qt
::
AlignLeft
,
fm
.
elidedText
(
m_start
.
toString
(
"hh:mm"
)
+
" - "
+
m_end
.
toString
(
"hh:mm"
),
Qt
::
ElideRight
,
mapped
.
width
()
)
);
}
const
QDateTime
&
EPGItem
::
start
()
const
...
...
modules/gui/qt4/components/epg/EPGView.cpp
View file @
27912412
...
...
@@ -34,33 +34,14 @@
EPGView
::
EPGView
(
QWidget
*
parent
)
:
QGraphicsView
(
parent
)
{
setContentsMargins
(
0
,
0
,
0
,
0
);
setFrameStyle
(
QFrame
::
NoFrame
);
setFrameStyle
(
QFrame
::
Box
);
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
)
...
...
@@ -79,7 +60,11 @@ void EPGView::setStartTime( const QDateTime& startTime )
for
(
int
i
=
0
;
i
<
itemList
.
count
();
++
i
)
{
#ifndef WIN32
EPGItem
*
item
=
dynamic_cast
<
EPGItem
*>
(
itemList
.
at
(
i
)
);
#else
EPGItem
*
item
=
NULL
;
#endif
if
(
!
item
)
continue
;
item
->
setStart
(
item
->
start
().
addSecs
(
diff
)
);
}
...
...
@@ -98,13 +83,7 @@ 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
)
);
...
...
@@ -128,23 +107,6 @@ void EPGView::delEvent( EPGEvent* event )
//qDebug() << "Del event: " << event->name;
}
void
EPGView
::
drawBackground
(
QPainter
*
painter
,
const
QRectF
&
rect
)
{
painter
->
setPen
(
QPen
(
QColor
(
72
,
72
,
72
)
)
);
QPointF
p
=
mapToScene
(
width
(),
0
);
int
y
=
0
;
for
(
int
i
=
0
;
i
<
m_channels
.
count
()
+
1
;
++
i
)
{
painter
->
drawLine
(
0
,
y
*
TRACKS_HEIGHT
,
p
.
x
(),
y
*
TRACKS_HEIGHT
);
++
y
;
}
}
void
EPGView
::
updateDuration
()
{
QDateTime
lastItem
;
...
...
@@ -152,7 +114,11 @@ void EPGView::updateDuration()
for
(
int
i
=
0
;
i
<
list
.
count
();
++
i
)
{
#ifndef WIN32
EPGItem
*
item
=
dynamic_cast
<
EPGItem
*>
(
list
.
at
(
i
)
);
#else
EPGItem
*
item
=
NULL
;
#endif
if
(
!
item
)
continue
;
QDateTime
itemEnd
=
item
->
start
().
addSecs
(
item
->
duration
()
);
...
...
@@ -163,12 +129,12 @@ void EPGView::updateDuration()
emit
durationChanged
(
m_duration
);
}
void
EPGView
::
eventFocused
(
EPGEvent
*
ev
)
QList
<
QString
>
EPGView
::
getChannelList
(
)
{
emit
eventFocusedChanged
(
ev
)
;
return
m_channels
;
}
void
EPGView
::
sceneRectChanged
(
const
QRectF
&
rect
)
void
EPGView
::
eventFocused
(
EPGEvent
*
ev
)
{
m_overlay
->
setRect
(
0
,
0
,
m_overlay
->
rect
().
width
(),
rect
.
height
()
);
emit
eventFocusedChanged
(
ev
);
}
modules/gui/qt4/components/epg/EPGView.hpp
View file @
27912412
...
...
@@ -49,26 +49,21 @@ public:
void
delEvent
(
EPGEvent
*
event
);
void
updateDuration
();
QList
<
QString
>
getChannelList
();
signals:
void
startTimeChanged
(
const
QDateTime
&
startTime
);
void
durationChanged
(
int
seconds
);
void
eventFocusedChanged
(
EPGEvent
*
);
protected:
virtual
void
drawBackground
(
QPainter
*
painter
,
const
QRectF
&
rect
);
QList
<
QString
>
m_channels
;
QDateTime
m_startTime
;
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
modules/gui/qt4/components/epg/EPGWidget.cpp
View file @
27912412
...
...
@@ -37,13 +37,17 @@ EPGWidget::EPGWidget( QWidget *parent ) : QWidget( parent )
{
m_rulerWidget
=
new
EPGRuler
(
this
);
m_epgView
=
new
EPGView
(
this
);
m_channelsWidget
=
new
EPGChannels
(
this
,
m_epgView
);
m_channelsWidget
->
setMinimumWidth
(
100
);
m_epgView
->
setSizePolicy
(
QSizePolicy
::
Expanding
,
QSizePolicy
::
Expanding
);
setZoom
(
1
);
QVBoxLayout
*
layout
=
new
QVBoxLayout
(
this
);
layout
->
addWidget
(
m_rulerWidget
);
layout
->
addWidget
(
m_epgView
);
QGridLayout
*
layout
=
new
QGridLayout
(
this
);
layout
->
addWidget
(
m_rulerWidget
,
0
,
1
);
layout
->
addWidget
(
m_channelsWidget
,
1
,
0
);
layout
->
addWidget
(
m_epgView
,
1
,
1
);
layout
->
setSpacing
(
0
);
setLayout
(
layout
);
...
...
@@ -53,6 +57,8 @@ EPGWidget::EPGWidget( QWidget *parent ) : QWidget( parent )
m_rulerWidget
,
SLOT
(
setDuration
(
int
)
)
);
connect
(
m_epgView
->
horizontalScrollBar
(),
SIGNAL
(
valueChanged
(
int
)
),
m_rulerWidget
,
SLOT
(
setOffset
(
int
)
)
);
connect
(
m_epgView
->
verticalScrollBar
(),
SIGNAL
(
valueChanged
(
int
)
),
m_channelsWidget
,
SLOT
(
setOffset
(
int
)
)
);
connect
(
m_epgView
,
SIGNAL
(
eventFocusedChanged
(
EPGEvent
*
)),
this
,
SIGNAL
(
itemSelectionChanged
(
EPGEvent
*
))
);
}
...
...
@@ -77,19 +83,22 @@ void EPGWidget::updateEPG( vlc_epg_t **pp_epg, int i_epg )
EPGEvent
*
item
=
NULL
;
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
);
QList
<
EPGEvent
*>
events
=
m_events
.
values
(
channelName
);
for
(
int
k
=
0
;
k
<
events
.
count
();
++
k
)
{
if
(
events
.
at
(
k
)
->
name
==
eventName
&&
events
.
at
(
k
)
->
channelName
==
channelName
)
events
.
at
(
k
)
->
channelName
==
channelName
&&
events
.
at
(
k
)
->
start
==
eventStart
)
{
/* Update the event. */
item
=
events
.
at
(
k
);
item
->
updated
=
true
;
item
->
description
=
qfu
(
p_event
->
psz_description
);
item
->
shortDescription
=
qfu
(
p_event
->
psz_short_description
);
item
->
start
=
QDateTime
::
fromTime_t
(
p_event
->
i_start
)
;
item
->
start
=
eventStart
;
item
->
duration
=
p_event
->
i_duration
;
item
->
current
=
(
p_epg
->
p_current
==
p_event
)
?
true
:
false
;
...
...
@@ -106,7 +115,7 @@ void EPGWidget::updateEPG( vlc_epg_t **pp_epg, int i_epg )
item
=
new
EPGEvent
(
eventName
);
item
->
description
=
qfu
(
p_event
->
psz_description
);
item
->
shortDescription
=
qfu
(
p_event
->
psz_short_description
);
item
->
start
=
QDateTime
::
fromTime_t
(
p_event
->
i_start
)
;
item
->
start
=
eventStart
;
item
->
duration
=
p_event
->
i_duration
;
item
->
channelName
=
channelName
;
item
->
current
=
(
p_epg
->
p_current
==
p_event
)
?
true
:
false
;
...
...
modules/gui/qt4/components/epg/EPGWidget.hpp
View file @
27912412
...
...
@@ -27,6 +27,7 @@
#include "EPGView.hpp"
#include "EPGEvent.hpp"
#include "EPGRuler.hpp"
#include "EPGChannels.hpp"
#include <vlc_common.h>
#include <vlc_epg.h>
...
...
@@ -49,6 +50,7 @@ public slots:
private:
EPGRuler
*
m_rulerWidget
;
EPGView
*
m_epgView
;
EPGChannels
*
m_channelsWidget
;
QMultiMap
<
QString
,
EPGEvent
*>
m_events
;
...
...
modules/gui/qt4/dialogs/epg.cpp
View file @
27912412
...
...
@@ -33,6 +33,7 @@
#include <QLabel>
#include <QGroupBox>
#include <QPushButton>
#include <QTextEdit>
#include "qt4.hpp"
#include "input_manager.hpp"
...
...
@@ -43,20 +44,18 @@ EpgDialog::EpgDialog( intf_thread_t *_p_intf ): QVLCFrame( _p_intf )
QVBoxLayout
*
layout
=
new
QVBoxLayout
(
this
);
layout
->
setMargin
(
0
);
QSplitter
*
splitter
=
new
QSplitter
(
this
);
epg
=
new
EPGWidget
(
this
);
splitter
->
addWidget
(
epg
);
splitter
->
setOrientation
(
Qt
::
Vertical
);
QGroupBox
*
descBox
=
new
QGroupBox
(
qtr
(
"Description"
),
this
);
QVBoxLayout
*
boxLayout
=
new
QVBoxLayout
(
descBox
);
description
=
new
QLabel
(
this
);
description
=
new
QTextEdit
(
this
);
description
->
setReadOnly
(
true
);
description
->
setFrameStyle
(
QFrame
::
Sunken
|
QFrame
::
StyledPanel
);
description
->
setAutoFillBackground
(
true
);
description
->
setWordWrap
(
true
);
description
->
setAlignment
(
Qt
::
AlignLeft
|
Qt
::
AlignTop
);
description
->
setFixedHeight
(
100
);
QPalette
palette
;
palette
.
setBrush
(
QPalette
::
Active
,
QPalette
::
Window
,
palette
.
brush
(
QPalette
::
Base
)
);
...
...
@@ -65,11 +64,10 @@ EpgDialog::EpgDialog( intf_thread_t *_p_intf ): QVLCFrame( _p_intf )
title
=
new
QLabel
(
qtr
(
"Title"
),
this
);
boxLayout
->
addWidget
(
title
);
boxLayout
->
addWidget
(
description
,
10
);
boxLayout
->
addWidget
(
description
);
splitter
->
addWidget
(
epg
);
splitter
->
addWidget
(
descBox
);
layout
->
addWidget
(
splitter
);
layout
->
addWidget
(
epg
,
10
);
layout
->
addWidget
(
descBox
);
CONNECT
(
epg
,
itemSelectionChanged
(
EPGEvent
*
),
this
,
showEvent
(
EPGEvent
*
)
);
CONNECT
(
THEMIM
->
getIM
(),
epgChanged
(),
this
,
updateInfos
()
);
...
...
modules/gui/qt4/dialogs/epg.hpp
View file @
27912412
...
...
@@ -28,8 +28,10 @@
#include "util/singleton.hpp"
class
QLabel
;
class
QTextEdit
;
class
EPGEvent
;
class
EPGWidget
;
class
EpgDialog
:
public
QVLCFrame
,
public
Singleton
<
EpgDialog
>
{
Q_OBJECT
...
...
@@ -38,7 +40,7 @@ private:
virtual
~
EpgDialog
();
EPGWidget
*
epg
;
Q
Label
*
description
;
Q
TextEdit
*
description
;
QLabel
*
title
;
friend
class
Singleton
<
EpgDialog
>
;
...
...
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