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
99d44589
Commit
99d44589
authored
Feb 04, 2010
by
Jean-Baptiste Kempf
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Qt: iconView, code cosmetics
parent
6acd8e48
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
21 deletions
+21
-21
modules/gui/qt4/components/playlist/icon_view.cpp
modules/gui/qt4/components/playlist/icon_view.cpp
+21
-21
No files found.
modules/gui/qt4/components/playlist/icon_view.cpp
View file @
99d44589
...
@@ -50,9 +50,7 @@ void PlListViewItemDelegate::paint( QPainter * painter, const QStyleOptionViewIt
...
@@ -50,9 +50,7 @@ void PlListViewItemDelegate::paint( QPainter * painter, const QStyleOptionViewIt
PLItem
*
currentItem
=
static_cast
<
PLItem
*>
(
index
.
internalPointer
()
);
PLItem
*
currentItem
=
static_cast
<
PLItem
*>
(
index
.
internalPointer
()
);
assert
(
currentItem
);
assert
(
currentItem
);
char
*
meta
;
char
*
meta
=
input_item_GetTitleFbName
(
currentItem
->
inputItem
()
);
meta
=
input_item_GetTitleFbName
(
currentItem
->
inputItem
()
);
QString
title
=
qfu
(
meta
);
QString
title
=
qfu
(
meta
);
free
(
meta
);
free
(
meta
);
...
@@ -60,16 +58,15 @@ void PlListViewItemDelegate::paint( QPainter * painter, const QStyleOptionViewIt
...
@@ -60,16 +58,15 @@ void PlListViewItemDelegate::paint( QPainter * painter, const QStyleOptionViewIt
QString
artist
=
qfu
(
meta
);
QString
artist
=
qfu
(
meta
);
free
(
meta
);
free
(
meta
);
/* Primary ArtUrl */
QString
artUrl
=
InputManager
::
decodeArtURL
(
currentItem
->
inputItem
()
);
QString
artUrl
=
InputManager
::
decodeArtURL
(
currentItem
->
inputItem
()
);
/
/ look up through all children and use the first picture found
/
* else look up through all children and use the first picture found */
if
(
artUrl
.
isEmpty
()
)
if
(
artUrl
.
isEmpty
()
)
{
{
int
children
=
currentItem
->
childCount
();
for
(
int
i
=
0
;
i
<
currentItem
->
childCount
();
i
++
)
for
(
int
i
=
0
;
i
<
children
;
i
++
)
{
{
PLItem
*
child
=
currentItem
->
child
(
i
);
artUrl
=
InputManager
::
decodeArtURL
(
currentItem
->
child
(
i
)
->
inputItem
()
);
artUrl
=
InputManager
::
decodeArtURL
(
child
->
inputItem
()
);
if
(
!
artUrl
.
isEmpty
()
)
if
(
!
artUrl
.
isEmpty
()
)
break
;
break
;
}
}
...
@@ -80,7 +77,7 @@ void PlListViewItemDelegate::paint( QPainter * painter, const QStyleOptionViewIt
...
@@ -80,7 +77,7 @@ void PlListViewItemDelegate::paint( QPainter * painter, const QStyleOptionViewIt
QApplication
::
style
()
->
drawPrimitive
(
QStyle
::
PE_PanelItemViewItem
,
&
option
,
QApplication
::
style
()
->
drawPrimitive
(
QStyle
::
PE_PanelItemViewItem
,
&
option
,
painter
);
painter
);
/
/ picture where all the rendering happens and which will be cached
/
* Pixmap where all the rendering will happen and that will be cached */
QPixmap
pix
;
QPixmap
pix
;
QString
key
=
title
+
artist
+
artUrl
QString
key
=
title
+
artist
+
artUrl
...
@@ -92,14 +89,7 @@ void PlListViewItemDelegate::paint( QPainter * painter, const QStyleOptionViewIt
...
@@ -92,14 +89,7 @@ void PlListViewItemDelegate::paint( QPainter * painter, const QStyleOptionViewIt
return
;
return
;
}
}
// load album art
/* Background decorations */
QPixmap
artPix
;
if
(
artUrl
.
isEmpty
()
||
!
artPix
.
load
(
artUrl
)
)
artPix
=
QPixmap
(
":/noart64"
);
else
artPix
=
artPix
.
scaled
(
ART_SIZE
,
ART_SIZE
,
Qt
::
KeepAspectRatioByExpanding
);
pix
=
QPixmap
(
RECT_SIZE_W
,
RECT_SIZE_H
);
pix
=
QPixmap
(
RECT_SIZE_W
,
RECT_SIZE_H
);
pix
.
fill
(
Qt
::
transparent
);
pix
.
fill
(
Qt
::
transparent
);
...
@@ -125,20 +115,30 @@ void PlListViewItemDelegate::paint( QPainter * painter, const QStyleOptionViewIt
...
@@ -125,20 +115,30 @@ void PlListViewItemDelegate::paint( QPainter * painter, const QStyleOptionViewIt
pixpainter
->
drawRoundedRect
(
artRect
.
adjusted
(
2
,
2
,
2
,
2
),
ART_RADIUS
,
ART_RADIUS
);
pixpainter
->
drawRoundedRect
(
artRect
.
adjusted
(
2
,
2
,
2
,
2
),
ART_RADIUS
,
ART_RADIUS
);
pixpainter
->
restore
();
pixpainter
->
restore
();
// Draw the art pix
// load album art in the pixmap
QPixmap
artPix
;
if
(
artUrl
.
isEmpty
()
||
!
artPix
.
load
(
artUrl
)
)
artPix
=
QPixmap
(
":/noart64"
);
else
artPix
=
artPix
.
scaled
(
ART_SIZE
,
ART_SIZE
,
Qt
::
KeepAspectRatioByExpanding
);
// Draw the art pixmap
QPainterPath
artRectPath
;
QPainterPath
artRectPath
;
artRectPath
.
addRoundedRect
(
artRect
,
ART_RADIUS
,
ART_RADIUS
);
artRectPath
.
addRoundedRect
(
artRect
,
ART_RADIUS
,
ART_RADIUS
);
pixpainter
->
setClipPath
(
artRectPath
);
pixpainter
->
setClipPath
(
artRectPath
);
pixpainter
->
drawPixmap
(
artRect
,
artPix
);
pixpainter
->
drawPixmap
(
artRect
,
artPix
);
pixpainter
->
setClipping
(
false
);
pixpainter
->
setClipping
(
false
);
/* */
QColor
text
=
qApp
->
palette
().
text
().
color
();
QColor
text
=
qApp
->
palette
().
text
().
color
();
// Draw title
// Draw title
pixpainter
->
setPen
(
text
);
pixpainter
->
setPen
(
text
);
QFont
font
;
QFont
font
;
font
.
setPointSize
(
7
);
font
.
setPointSize
(
7
);
font
.
setItalic
(
true
);
font
.
setItalic
(
true
);
font
.
setBold
(
index
.
data
(
Qt
::
FontRole
).
value
<
QFont
>
().
bold
()
);
font
.
setBold
(
index
.
data
(
Qt
::
FontRole
).
value
<
QFont
>
().
bold
()
);
pixpainter
->
setFont
(
font
);
pixpainter
->
setFont
(
font
);
QFontMetrics
fm
=
pixpainter
->
fontMetrics
();
QFontMetrics
fm
=
pixpainter
->
fontMetrics
();
...
@@ -150,12 +150,11 @@ void PlListViewItemDelegate::paint( QPainter * painter, const QStyleOptionViewIt
...
@@ -150,12 +150,11 @@ void PlListViewItemDelegate::paint( QPainter * painter, const QStyleOptionViewIt
QTextOption
(
Qt
::
AlignCenter
)
);
QTextOption
(
Qt
::
AlignCenter
)
);
// Draw artist
// Draw artist
pixpainter
->
setPen
(
text
.
lighter
(
2
4
0
)
);
pixpainter
->
setPen
(
text
.
lighter
(
2
2
0
)
);
font
.
setItalic
(
false
);
font
.
setItalic
(
false
);
pixpainter
->
setFont
(
font
);
pixpainter
->
setFont
(
font
);
fm
=
pixpainter
->
fontMetrics
();
fm
=
pixpainter
->
fontMetrics
();
textRect
=
textRect
.
adjusted
(
0
,
textRect
.
height
(),
textRect
=
textRect
.
adjusted
(
0
,
textRect
.
height
(),
0
,
textRect
.
height
()
);
0
,
textRect
.
height
()
);
pixpainter
->
drawText
(
textRect
,
pixpainter
->
drawText
(
textRect
,
...
@@ -192,3 +191,4 @@ PlIconView::PlIconView( PLModel *model, QWidget *parent ) : QListView( parent )
...
@@ -192,3 +191,4 @@ PlIconView::PlIconView( PLModel *model, QWidget *parent ) : QListView( parent )
PlListViewItemDelegate
*
pl
=
new
PlListViewItemDelegate
(
this
);
PlListViewItemDelegate
*
pl
=
new
PlListViewItemDelegate
(
this
);
setItemDelegate
(
pl
);
setItemDelegate
(
pl
);
}
}
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