Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc
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
Commits
0dd7de57
Commit
0dd7de57
authored
Feb 27, 2014
by
Francois Cartegnie
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Qt: addons: tag addons with colors
parent
d839410a
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
45 additions
and
1 deletion
+45
-1
modules/gui/qt4/dialogs/plugins.cpp
modules/gui/qt4/dialogs/plugins.cpp
+43
-1
modules/gui/qt4/dialogs/plugins.hpp
modules/gui/qt4/dialogs/plugins.hpp
+2
-0
No files found.
modules/gui/qt4/dialogs/plugins.cpp
View file @
0dd7de57
...
...
@@ -57,7 +57,6 @@
#include <QCheckBox>
#include <QPixmap>
#include <QStylePainter>
#include <QGraphicsColorizeEffect>
#include <QProgressBar>
#include <QTextEdit>
#include <QUrl>
...
...
@@ -846,6 +845,32 @@ bool AddonsListModel::setData( const QModelIndex &index, const QVariant &value,
return
true
;
}
QColor
AddonsListModel
::
getColorByAddonType
(
int
i_type
)
{
QColor
color
;
switch
(
i_type
)
{
case
ADDON_EXTENSION
:
color
=
QColor
(
0xDB
,
0xC5
,
0x40
);
break
;
case
ADDON_PLAYLIST_PARSER
:
color
=
QColor
(
0x36
,
0xBB
,
0x59
);
break
;
case
ADDON_SERVICE_DISCOVERY
:
color
=
QColor
(
0xDB
,
0x52
,
0x40
);
break
;
case
ADDON_SKIN2
:
color
=
QColor
(
0x8B
,
0xD6
,
0xFC
);
break
;
case
ADDON_PLUGIN
:
case
ADDON_UNKNOWN
:
case
ADDON_OTHER
:
default:
break
;
}
return
color
;
}
QVariant
AddonsListModel
::
data
(
const
QModelIndex
&
index
,
int
role
)
const
{
if
(
!
index
.
isValid
()
)
...
...
@@ -1004,7 +1029,24 @@ void AddonItemDelegate::paint( QPainter *painter,
{
QStyleOptionViewItemV4
newopt
=
option
;
int
i_state
=
index
.
data
(
AddonsListModel
::
StateRole
).
toInt
();
int
i_type
=
index
.
data
(
AddonsListModel
::
TypeRole
).
toInt
();
/* Draw Background gradient by addon type */
QColor
backgroundColor
=
AddonsListModel
::
getColorByAddonType
(
i_type
);
if
(
backgroundColor
.
isValid
()
)
{
painter
->
save
();
QLinearGradient
gradient
(
QPoint
(
option
.
rect
.
right
()
-
50
,
option
.
rect
.
top
()
),
option
.
rect
.
bottomRight
()
);
gradient
.
setColorAt
(
0
,
Qt
::
transparent
);
gradient
.
setColorAt
(
1.0
,
backgroundColor
);
painter
->
fillRect
(
option
.
rect
,
gradient
);
painter
->
restore
();
}
/* Draw base info from parent */
ExtensionItemDelegate
::
paint
(
painter
,
newopt
,
index
);
initStyleOption
(
&
newopt
,
index
);
...
...
modules/gui/qt4/dialogs/plugins.hpp
View file @
0dd7de57
...
...
@@ -227,6 +227,8 @@ public:
ScoreRole
};
static
QColor
getColorByAddonType
(
int
);
protected
slots
:
void
addonAdded
(
addon_entry_t
*
);
void
addonChanged
(
const
addon_entry_t
*
);
...
...
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