Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
linphone-desktop
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
Administrator
linphone-desktop
Commits
64b45e2d
Commit
64b45e2d
authored
Jun 19, 2017
by
Ronan Abhamon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat(Colors): provide a way to get colors (without alpha)
parent
a8bc6ad5
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
4 deletions
+24
-4
Colors.cpp
src/components/other/colors/Colors.cpp
+20
-4
Colors.hpp
src/components/other/colors/Colors.hpp
+4
-0
No files found.
src/components/other/colors/Colors.cpp
View file @
64b45e2d
...
@@ -37,17 +37,33 @@ Colors::Colors (QObject *parent) : QObject(parent) {
...
@@ -37,17 +37,33 @@ Colors::Colors (QObject *parent) : QObject(parent) {
QObject
::
connect
(
CoreManager
::
getInstance
(),
&
CoreManager
::
coreCreated
,
this
,
&
Colors
::
overrideColors
);
QObject
::
connect
(
CoreManager
::
getInstance
(),
&
CoreManager
::
coreCreated
,
this
,
&
Colors
::
overrideColors
);
}
}
// -----------------------------------------------------------------------------
void
Colors
::
overrideColors
()
{
void
Colors
::
overrideColors
()
{
shared_ptr
<
linphone
::
Config
>
config
=
CoreManager
::
getInstance
()
->
getCore
()
->
getConfig
();
shared_ptr
<
linphone
::
Config
>
config
=
CoreManager
::
getInstance
()
->
getCore
()
->
getConfig
();
const
QMetaObject
*
info
=
metaObject
();
const
QMetaObject
*
info
=
metaObject
();
for
(
int
i
=
info
->
propertyOffset
();
i
<
info
->
propertyCount
();
++
i
)
{
for
(
int
i
=
info
->
propertyOffset
();
i
<
info
->
propertyCount
();
++
i
)
{
const
QMetaProperty
&
metaProperty
=
info
->
property
(
i
);
const
QMetaProperty
metaProperty
=
info
->
property
(
i
);
const
string
colorName
=
metaProperty
.
name
();
string
colorName
=
metaProperty
.
name
();
const
string
colorValue
=
config
->
getString
(
COLORS_SECTION
,
colorName
,
""
);
string
colorValue
=
config
->
getString
(
COLORS_SECTION
,
colorName
,
""
);
if
(
!
colorValue
.
empty
())
if
(
!
colorValue
.
empty
())
setProperty
(
colorName
.
c_str
(),
QColor
(
::
Utils
::
coreStringToAppString
(
colorValue
)));
setProperty
(
colorName
.
c_str
(),
QColor
(
::
Utils
::
coreStringToAppString
(
colorValue
)));
}
}
}
}
QStringList
Colors
::
getColorNames
()
const
{
static
QStringList
colorNames
;
if
(
!
colorNames
.
isEmpty
())
return
colorNames
;
const
QMetaObject
*
info
=
metaObject
();
for
(
int
i
=
info
->
propertyOffset
();
i
<
info
->
propertyCount
();
++
i
)
{
const
QMetaProperty
metaProperty
=
info
->
property
(
i
);
if
(
metaProperty
.
isWritable
())
colorNames
<<
QString
::
fromLatin1
(
metaProperty
.
name
());
}
return
colorNames
;
}
src/components/other/colors/Colors.hpp
View file @
64b45e2d
...
@@ -50,6 +50,8 @@
...
@@ -50,6 +50,8 @@
class
Colors
:
public
QObject
{
class
Colors
:
public
QObject
{
Q_OBJECT
;
Q_OBJECT
;
Q_PROPERTY
(
QStringList
colorNames
READ
getColorNames
CONSTANT
);
ADD_COLOR
(
a
,
"transparent"
);
ADD_COLOR
(
a
,
"transparent"
);
ADD_COLOR
(
b
,
"#5E5E5F"
);
ADD_COLOR
(
b
,
"#5E5E5F"
);
ADD_COLOR
(
c
,
"#CBCBCB"
);
ADD_COLOR
(
c
,
"#CBCBCB"
);
...
@@ -124,6 +126,8 @@ signals:
...
@@ -124,6 +126,8 @@ signals:
private:
private:
void
overrideColors
();
void
overrideColors
();
QStringList
getColorNames
()
const
;
};
};
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
...
...
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