Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Q
qtquickcontrols-nemo
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
NemoMobile
qtquickcontrols-nemo
Commits
b44cef3c
Commit
b44cef3c
authored
Jun 17, 2017
by
eekkelund
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Icons] Add fontawesome icons to image provider Glacier#884
parent
3858cd52
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
32 additions
and
10 deletions
+32
-10
nemoimageprovider.cpp
src/controls/nemoimageprovider.cpp
+5
-0
nemoimageprovider.h
src/controls/nemoimageprovider.h
+1
-0
mlocalthemedaemonclient.cpp
src/controls/themedaemon/mlocalthemedaemonclient.cpp
+24
-10
mlocalthemedaemonclient.h
src/controls/themedaemon/mlocalthemedaemonclient.h
+2
-0
No files found.
src/controls/nemoimageprovider.cpp
View file @
b44cef3c
...
...
@@ -30,3 +30,8 @@ QImage NemoImageProvider::requestImage(const QString &id, QSize *size, const QSi
Q_UNUSED
(
requestedSize
);
return
m_client
->
readImage
(
id
);
}
QPixmap
NemoImageProvider
::
requestPixmap
(
const
QString
&
id
,
QSize
*
size
,
const
QSize
&
requestedSize
)
{
Q_UNUSED
(
size
);
return
m_client
->
requestPixmap
(
id
,
requestedSize
);
}
src/controls/nemoimageprovider.h
View file @
b44cef3c
...
...
@@ -27,6 +27,7 @@ class NemoImageProvider : public QQuickImageProvider
public:
explicit
NemoImageProvider
();
QImage
requestImage
(
const
QString
&
id
,
QSize
*
size
,
const
QSize
&
requestedSize
);
QPixmap
requestPixmap
(
const
QString
&
id
,
QSize
*
size
,
const
QSize
&
requestedSize
);
private:
MLocalThemeDaemonClient
*
m_client
;
};
...
...
src/controls/themedaemon/mlocalthemedaemonclient.cpp
View file @
b44cef3c
...
...
@@ -48,9 +48,9 @@ MLocalThemeDaemonClient::MLocalThemeDaemonClient(const QString &testPath, QObjec
MAbstractThemeDaemonClient
(
parent
),
m_pixmapCache
(),
m_imageDirNodes
()
#ifdef HAVE_MLITE
,
themeItem
(
"/meegotouch/theme/name"
)
#endif
#ifdef HAVE_MLITE
,
themeItem
(
"/meegotouch/theme/name"
)
#endif
{
QStringList
themeRoots
;
QString
themeRoot
=
testPath
;
...
...
@@ -111,6 +111,7 @@ MLocalThemeDaemonClient::MLocalThemeDaemonClient(const QString &testPath, QObjec
inheritanceChain
.
insert
(
nextTheme
);
// the paths should be stored in reverse order than in the inheritance chain
themeRoots
.
prepend
(
themeRoot
+
QDir
::
separator
()
+
nextTheme
+
QDir
::
separator
()
+
QLatin1String
(
"meegotouch"
));
themeRoots
.
prepend
(
themeRoot
+
QDir
::
separator
()
+
nextTheme
+
QDir
::
separator
()
+
QLatin1String
(
"fontawesome"
));
QString
parentTheme
=
themeIndexFile
.
value
(
"X-MeeGoTouch-Metatheme/X-Inherits"
,
""
).
toString
();
...
...
@@ -148,7 +149,10 @@ MLocalThemeDaemonClient::~MLocalThemeDaemonClient()
QPixmap
MLocalThemeDaemonClient
::
requestPixmap
(
const
QString
&
id
,
const
QSize
&
requestedSize
)
{
QPixmap
pixmap
;
qDebug
()
<<
"ID requested: "
<<
id
;
QStringList
parts
=
id
.
split
(
'?'
);
qDebug
()
<<
"ID requested: "
<<
parts
.
at
(
0
);
QSize
size
=
requestedSize
;
if
(
size
.
width
()
<
1
)
{
...
...
@@ -158,20 +162,30 @@ QPixmap MLocalThemeDaemonClient::requestPixmap(const QString &id, const QSize &r
size
.
rheight
()
=
0
;
}
const
PixmapIdentifier
pixmapId
(
id
,
size
);
const
PixmapIdentifier
pixmapId
(
parts
.
at
(
0
)
,
size
);
pixmap
=
m_pixmapCache
.
value
(
pixmapId
);
if
(
pixmap
.
isNull
())
{
// The pixmap is not cached yet. Decode the image and
// store it into the cache as pixmap.
const
QImage
image
=
readImage
(
id
);
const
QImage
image
=
readImage
(
parts
.
at
(
0
)
);
if
(
!
image
.
isNull
())
{
pixmap
=
QPixmap
::
fromImage
(
image
);
if
(
requestedSize
.
isValid
()
&&
(
pixmap
.
size
()
!=
requestedSize
))
{
pixmap
=
pixmap
.
scaled
(
requestedSize
);
}
if
(
parts
.
length
()
>
1
)
if
(
parts
.
length
()
>
1
&&
QColor
::
isValidColor
(
parts
.
at
(
1
)))
{
QPainter
painter
(
&
pixmap
);
painter
.
setCompositionMode
(
QPainter
::
CompositionMode_SourceIn
);
painter
.
fillRect
(
pixmap
.
rect
(),
parts
.
at
(
1
));
painter
.
end
();
}
m_pixmapCache
.
insert
(
pixmapId
,
pixmap
);
}
if
(
requestedSize
.
width
()
>
0
&&
requestedSize
.
height
()
>
0
)
pixmap
=
pixmap
.
scaled
(
requestedSize
.
width
(),
requestedSize
.
height
(),
Qt
::
IgnoreAspectRatio
);
else
pixmap
=
pixmap
;
m_pixmapCache
.
insert
(
pixmapId
,
pixmap
);
}
return
pixmap
;
}
...
...
src/controls/themedaemon/mlocalthemedaemonclient.h
View file @
b44cef3c
...
...
@@ -45,6 +45,8 @@
#include <QHash>
#include <QPixmap>
#include <QString>
#include <QPainter>
#include <QColor>
#ifdef HAVE_MLITE
#include <mgconfitem.h>
...
...
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