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
3e5cee9c
Commit
3e5cee9c
authored
Jun 20, 2017
by
Ronan Abhamon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix(App): override colors at app creation, not at core started signal
parent
5d13b7ab
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
29 additions
and
16 deletions
+29
-16
App.cpp
src/app/App.cpp
+15
-9
App.hpp
src/app/App.hpp
+1
-1
Colors.cpp
src/components/other/colors/Colors.cpp
+6
-5
Colors.hpp
src/components/other/colors/Colors.hpp
+7
-1
No files found.
src/app/App.cpp
View file @
3e5cee9c
...
...
@@ -68,6 +68,16 @@ inline bool installLocale (App &app, QTranslator &translator, const QLocale &loc
return
translator
.
load
(
locale
,
LANGUAGES_PATH
)
&&
app
.
installTranslator
(
&
translator
);
}
inline
shared_ptr
<
linphone
::
Config
>
getConfigIfExists
(
const
QCommandLineParser
&
parser
)
{
string
configPath
=
Paths
::
getConfigFilePath
(
parser
.
value
(
"config"
),
false
);
if
(
Paths
::
filePathExists
(
configPath
))
return
linphone
::
Config
::
newWithFactory
(
configPath
,
""
);
return
nullptr
;
}
// -----------------------------------------------------------------------------
App
::
App
(
int
&
argc
,
char
*
argv
[])
:
SingleApplication
(
argc
,
argv
,
true
,
Mode
::
User
|
Mode
::
ExcludeAppPath
|
Mode
::
ExcludeAppVersion
)
{
setWindowIcon
(
QIcon
(
WINDOW_ICON_PATH
));
...
...
@@ -87,7 +97,7 @@ App::App (int &argc, char *argv[]) : SingleApplication(argc, argv, true, Mode::U
// Init locale.
mTranslator
=
new
DefaultTranslator
(
this
);
initLocale
();
initLocale
(
::
getConfigIfExists
(
*
mParser
)
);
if
(
mParser
->
isSet
(
"help"
))
{
createParser
();
...
...
@@ -175,6 +185,7 @@ void App::initContentApp () {
mEngine
->
addImageProvider
(
ThumbnailProvider
::
PROVIDER_ID
,
new
ThumbnailProvider
());
mColors
=
new
Colors
(
this
);
mColors
->
useConfig
(
::
getConfigIfExists
(
*
mParser
));
registerTypes
();
registerSharedTypes
();
...
...
@@ -452,16 +463,11 @@ void App::setTrayIcon () {
// -----------------------------------------------------------------------------
void
App
::
initLocale
()
{
void
App
::
initLocale
(
const
shared_ptr
<
linphone
::
Config
>
&
config
)
{
// Try to use preferred locale.
QString
locale
;
string
configPath
=
Paths
::
getConfigFilePath
(
mParser
->
value
(
"config"
),
false
);
if
(
Paths
::
filePathExists
(
configPath
))
locale
=
::
Utils
::
coreStringToAppString
(
linphone
::
Config
::
newWithFactory
(
configPath
,
""
)
->
getString
(
SettingsModel
::
UI_SECTION
,
"locale"
,
""
)
);
if
(
config
)
locale
=
::
Utils
::
coreStringToAppString
(
config
->
getString
(
SettingsModel
::
UI_SECTION
,
"locale"
,
""
));
if
(
!
locale
.
isEmpty
()
&&
::
installLocale
(
*
this
,
*
mTranslator
,
QLocale
(
locale
)))
{
mLocale
=
locale
;
...
...
src/app/App.hpp
View file @
3e5cee9c
...
...
@@ -102,7 +102,7 @@ private:
void
setTrayIcon
();
void
createNotifier
();
void
initLocale
();
void
initLocale
(
const
std
::
shared_ptr
<
linphone
::
Config
>
&
config
);
QString
getConfigLocale
()
const
;
void
setConfigLocale
(
const
QString
&
locale
);
...
...
src/components/other/colors/Colors.cpp
View file @
3e5cee9c
...
...
@@ -20,10 +20,10 @@
* Author: Ronan Abhamon
*/
#include <linphone++/linphone.hh>
#include <QMetaProperty>
#include "../../../utils/Utils.hpp"
#include "../../core/CoreManager.hpp"
#include "Colors.hpp"
...
...
@@ -33,14 +33,15 @@ using namespace std;
// =============================================================================
Colors
::
Colors
(
QObject
*
parent
)
:
QObject
(
parent
)
{
QObject
::
connect
(
CoreManager
::
getInstance
(),
&
CoreManager
::
coreCreated
,
this
,
&
Colors
::
overrideColors
);
Colors
::
Colors
(
QObject
*
parent
)
:
QObject
(
parent
)
{}
void
Colors
::
useConfig
(
const
std
::
shared_ptr
<
linphone
::
Config
>
&
config
)
{
overrideColors
(
config
);
}
// -----------------------------------------------------------------------------
void
Colors
::
overrideColors
()
{
shared_ptr
<
linphone
::
Config
>
config
=
CoreManager
::
getInstance
()
->
getCore
()
->
getConfig
();
void
Colors
::
overrideColors
(
const
shared_ptr
<
linphone
::
Config
>
&
config
)
{
const
QMetaObject
*
info
=
metaObject
();
for
(
int
i
=
info
->
propertyOffset
();
i
<
info
->
propertyCount
();
++
i
)
{
...
...
src/components/other/colors/Colors.hpp
View file @
3e5cee9c
...
...
@@ -47,6 +47,10 @@
// -----------------------------------------------------------------------------
namespace
linphone
{
class
Config
;
}
class
Colors
:
public
QObject
{
Q_OBJECT
;
...
...
@@ -94,6 +98,8 @@ public:
Colors
(
QObject
*
parent
=
Q_NULLPTR
);
~
Colors
()
=
default
;
void
useConfig
(
const
std
::
shared_ptr
<
linphone
::
Config
>
&
config
);
signals:
void
colorTaChanged
(
const
QColor
&
color
);
void
colorTbChanged
(
const
QColor
&
color
);
...
...
@@ -125,7 +131,7 @@ signals:
void
colorTerrorChanged
(
const
QColor
&
color
);
private:
void
overrideColors
();
void
overrideColors
(
const
std
::
shared_ptr
<
linphone
::
Config
>
&
config
);
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