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
8551d47c
Commit
8551d47c
authored
Jan 19, 2011
by
Jean-Philippe André
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Qt: show embedded icons of Lua extensions
parent
cdcd09f9
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
40 additions
and
6 deletions
+40
-6
modules/gui/qt4/dialogs/plugins.cpp
modules/gui/qt4/dialogs/plugins.cpp
+40
-6
No files found.
modules/gui/qt4/dialogs/plugins.cpp
View file @
8551d47c
...
...
@@ -52,6 +52,9 @@
#include <QStyleOptionViewItem>
#include <QKeyEvent>
#include <QPushButton>
#include <QPixmap>
static
QPixmap
*
loadPixmapFromData
(
char
*
,
int
size
);
PluginDialog
::
PluginDialog
(
intf_thread_t
*
_p_intf
)
:
QVLCFrame
(
_p_intf
)
...
...
@@ -272,10 +275,12 @@ public:
author
=
qfu
(
p_ext
->
psz_author
);
version
=
qfu
(
p_ext
->
psz_version
);
url
=
qfu
(
p_ext
->
psz_url
);
icon
=
loadPixmapFromData
(
p_ext
->
p_icondata
,
p_ext
->
i_icondata_size
);
}
~
ExtensionCopy
()
{}
QString
name
,
title
,
description
,
shortdesc
,
author
,
version
,
url
;
QPixmap
*
icon
;
};
/* Extensions list model for the QListView */
...
...
@@ -418,19 +423,27 @@ void ExtensionItemDelegate::paint( QPainter *painter,
pixpaint
->
setPen
(
pen
);
QFontMetrics
metrics
=
option
.
fontMetrics
;
/// @todo Add extension's icon
// Icon
if
(
ext
->
icon
!=
NULL
)
{
pixpaint
->
drawPixmap
(
7
,
7
,
2
*
metrics
.
height
(),
2
*
metrics
.
height
(),
*
ext
->
icon
);
}
// Title: bold
pixpaint
->
setRenderHint
(
QPainter
::
TextAntialiasing
);
font
.
setBold
(
true
);
pixpaint
->
setFont
(
font
);
pixpaint
->
drawText
(
QRect
(
10
,
7
,
width
-
70
,
metrics
.
height
()
),
pixpaint
->
drawText
(
QRect
(
17
+
2
*
metrics
.
height
(),
7
,
width
-
40
-
2
*
metrics
.
height
(),
metrics
.
height
()
),
Qt
::
AlignLeft
,
ext
->
title
);
// Short description: normal
font
.
setBold
(
false
);
pixpaint
->
setFont
(
font
);
pixpaint
->
drawText
(
QRect
(
10
,
7
+
metrics
.
height
(),
width
-
40
,
pixpaint
->
drawText
(
QRect
(
17
+
2
*
metrics
.
height
(),
7
+
metrics
.
height
(),
width
-
40
,
metrics
.
height
()
),
Qt
::
AlignLeft
,
ext
->
shortdesc
);
...
...
@@ -471,10 +484,18 @@ ExtensionInfoDialog::ExtensionInfoDialog( const ExtensionCopy& extension,
QGridLayout
*
layout
=
new
QGridLayout
(
this
);
// Icon
/// @todo Use the extension's icon, when extensions will support icons :)
QLabel
*
icon
=
new
QLabel
(
this
);
QPixmap
pix
(
":/logo/vlc48.png"
);
icon
->
setPixmap
(
pix
);
if
(
!
extension
.
icon
)
{
QPixmap
pix
(
":/logo/vlc48.png"
);
icon
->
setPixmap
(
pix
);
}
else
{
icon
->
setPixmap
(
*
extension
.
icon
);
}
icon
->
setAlignment
(
Qt
::
AlignCenter
);
icon
->
setFixedSize
(
48
,
48
);
layout
->
addWidget
(
icon
,
1
,
0
,
2
,
1
);
// Title
...
...
@@ -542,3 +563,16 @@ ExtensionInfoDialog::~ExtensionInfoDialog()
{
delete
extension
;
}
static
QPixmap
*
loadPixmapFromData
(
char
*
data
,
int
size
)
{
if
(
!
data
||
size
<=
0
)
return
NULL
;
QPixmap
*
pixmap
=
new
QPixmap
();
if
(
!
pixmap
->
loadFromData
(
(
const
uchar
*
)
data
,
(
uint
)
size
)
)
{
delete
pixmap
;
return
NULL
;
}
return
pixmap
;
}
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