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
dc222d6c
Commit
dc222d6c
authored
Aug 12, 2017
by
eekkelund
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Controls] Add Theme.iconLauncherSize
parent
051e2f9c
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
45 additions
and
0 deletions
+45
-0
sizing.cpp
src/controls/sizing.cpp
+24
-0
sizing.h
src/controls/sizing.h
+4
-0
theme.cpp
src/controls/theme.cpp
+9
-0
theme.h
src/controls/theme.h
+8
-0
No files found.
src/controls/sizing.cpp
View file @
dc222d6c
...
@@ -22,6 +22,30 @@ Sizing::Sizing(QObject *parent) : QObject(parent)
...
@@ -22,6 +22,30 @@ Sizing::Sizing(QObject *parent) : QObject(parent)
m_dpi
=
screen
->
physicalDotsPerInch
();
m_dpi
=
screen
->
physicalDotsPerInch
();
int
largerSide
;
qDebug
()
<<
"Height: "
<<
m_height
<<
"Width: "
<<
m_width
;
if
(
m_height
>
m_width
)
{
largerSide
=
m_width
;
}
else
{
largerSide
=
m_height
;
}
if
(
largerSide
>
2160
){
//>2160
m_launcher_icon_size
=
256
;
}
else
if
(
largerSide
>
1080
){
//1081-2160
m_launcher_icon_size
=
128
;
}
else
if
(
largerSide
>
720
){
//721-1080
m_launcher_icon_size
=
108
;
}
else
{
//>720
m_launcher_icon_size
=
86
;
}
qDebug
()
<<
"DPI is "
<<
m_dpi
;
qDebug
()
<<
"DPI is "
<<
m_dpi
;
if
(
m_dpi
<
140
){
if
(
m_dpi
<
140
){
...
...
src/controls/sizing.h
View file @
dc222d6c
...
@@ -32,6 +32,8 @@ public:
...
@@ -32,6 +32,8 @@ public:
float
getMmScaleFactor
(){
return
m_mm_factor
;}
float
getMmScaleFactor
(){
return
m_mm_factor
;}
float
getDpScaleFactor
(){
return
m_dp_factor
;}
float
getDpScaleFactor
(){
return
m_dp_factor
;}
int
getLauncherIconSize
(){
return
m_launcher_icon_size
;}
Densitie
getDensitie
();
Densitie
getDensitie
();
Q_INVOKABLE
float
mm
(
float
value
);
Q_INVOKABLE
float
mm
(
float
value
);
...
@@ -49,6 +51,8 @@ private:
...
@@ -49,6 +51,8 @@ private:
int
m_width
;
int
m_width
;
int
m_height
;
int
m_height
;
int
m_launcher_icon_size
;
float
m_mm_factor
;
float
m_mm_factor
;
float
m_dp_factor
;
float
m_dp_factor
;
...
...
src/controls/theme.cpp
View file @
dc222d6c
...
@@ -10,6 +10,7 @@ Theme::Theme(QObject *parent) : QObject(parent)
...
@@ -10,6 +10,7 @@ Theme::Theme(QObject *parent) : QObject(parent)
{
{
Sizing
*
size
=
new
Sizing
;
Sizing
*
size
=
new
Sizing
;
m_dp
=
size
->
getDpScaleFactor
();
m_dp
=
size
->
getDpScaleFactor
();
m_iconSizeLauncher
=
size
->
getLauncherIconSize
();
//Load defaults
//Load defaults
m_itemWidthLarge
=
320
*
m_dp
;
m_itemWidthLarge
=
320
*
m_dp
;
m_itemWidthMedium
=
240
*
m_dp
;
m_itemWidthMedium
=
240
*
m_dp
;
...
@@ -67,6 +68,14 @@ bool Theme::loadTheme(QString fileName)
...
@@ -67,6 +68,14 @@ bool Theme::loadTheme(QString fileName)
QJsonDocument
t
=
QJsonDocument
::
fromJson
(
themeJsonString
.
toUtf8
());
QJsonDocument
t
=
QJsonDocument
::
fromJson
(
themeJsonString
.
toUtf8
());
QJsonObject
theme
=
t
.
object
();
QJsonObject
theme
=
t
.
object
();
if
(
theme
.
value
(
"iconSizeLauncher"
).
toString
().
toFloat
()
!=
0
&&
theme
.
value
(
"iconSizeLauncher"
).
toString
().
toFloat
()
!=
m_iconSizeLauncher
)
{
m_iconSizeLauncher
=
theme
.
value
(
"iconSizeLauncher"
).
toString
().
toFloat
();
emit
iconSizeLauncherChanged
();
updated
=
true
;
}
if
(
theme
.
value
(
"itemWidthLarge"
).
toString
().
toFloat
()
!=
0
&&
if
(
theme
.
value
(
"itemWidthLarge"
).
toString
().
toFloat
()
!=
0
&&
theme
.
value
(
"itemWidthLarge"
).
toString
().
toFloat
()
!=
m_itemWidthLarge
)
theme
.
value
(
"itemWidthLarge"
).
toString
().
toFloat
()
!=
m_itemWidthLarge
)
{
{
...
...
src/controls/theme.h
View file @
dc222d6c
...
@@ -7,6 +7,8 @@ class Theme : public QObject
...
@@ -7,6 +7,8 @@ class Theme : public QObject
{
{
Q_OBJECT
Q_OBJECT
Q_PROPERTY
(
qreal
iconSizeLauncher
READ
iconSizeLauncher
NOTIFY
iconSizeLauncherChanged
)
Q_PROPERTY
(
qreal
itemWidthLarge
READ
itemWidthLarge
NOTIFY
itemWidthLargeChanged
)
Q_PROPERTY
(
qreal
itemWidthLarge
READ
itemWidthLarge
NOTIFY
itemWidthLargeChanged
)
Q_PROPERTY
(
qreal
itemWidthMedium
READ
itemWidthMedium
NOTIFY
itemWidthMediumChanged
)
Q_PROPERTY
(
qreal
itemWidthMedium
READ
itemWidthMedium
NOTIFY
itemWidthMediumChanged
)
Q_PROPERTY
(
qreal
itemWidthSmall
READ
itemWidthSmall
NOTIFY
itemWidthSmallChanged
)
Q_PROPERTY
(
qreal
itemWidthSmall
READ
itemWidthSmall
NOTIFY
itemWidthSmallChanged
)
...
@@ -81,6 +83,8 @@ public:
...
@@ -81,6 +83,8 @@ public:
QString
backgroundColor
(){
return
m_backgroundColor
;}
QString
backgroundColor
(){
return
m_backgroundColor
;}
QString
backgroundAccentColor
(){
return
m_backgroundAccentColor
;}
QString
backgroundAccentColor
(){
return
m_backgroundAccentColor
;}
qreal
iconSizeLauncher
()
{
return
m_iconSizeLauncher
;}
signals:
signals:
void
themeUpdate
();
void
themeUpdate
();
...
@@ -118,9 +122,13 @@ signals:
...
@@ -118,9 +122,13 @@ signals:
void
backgroundColorChanged
();
void
backgroundColorChanged
();
void
backgroundAccentColorChanged
();
void
backgroundAccentColorChanged
();
void
iconSizeLauncherChanged
();
public
slots
:
public
slots
:
private:
private:
qreal
m_iconSizeLauncher
;
//86 or 108 or 128 or 256
qreal
m_itemWidthLarge
;
//320
qreal
m_itemWidthLarge
;
//320
qreal
m_itemWidthMedium
;
//240
qreal
m_itemWidthMedium
;
//240
qreal
m_itemWidthSmall
;
//120
qreal
m_itemWidthSmall
;
//120
...
...
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