Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Multimedia
Kdenlive
Commits
cc7e26b9
Commit
cc7e26b9
authored
Feb 03, 2020
by
Jean-Baptiste Mardelle
Browse files
Make use of KColorSchemeManager's new handling of system theme (Backported from KDevelop)
parent
3522a5ed
Pipeline
#14403
passed with stage
in 17 minutes and 44 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
src/utils/thememanager.cpp
View file @
cc7e26b9
...
...
@@ -79,7 +79,14 @@ QString ThemeManager::loadCurrentScheme() const
{
KSharedConfigPtr
config
=
KSharedConfig
::
openConfig
();
KConfigGroup
cg
(
config
,
"UiSettings"
);
return
cg
.
readEntry
(
"ColorScheme"
,
currentDesktopDefaultScheme
());
#if KCONFIGWIDGETS_VERSION >= QT_VERSION_CHECK(5, 67, 0)
// Since 5.67 KColorSchemeManager includes a system color scheme option that reacts to system
// scheme changes. This scheme will be activated if we pass an empty string to KColorSchemeManager
// So no need anymore to read the the current global scheme ourselves if no custom one is configured.
return
cg
.
readEntry
(
"ColorScheme"
);
#else
return
cg
.
readEntry
(
"ColorScheme"
,
currentDesktopDefaultScheme
());
#endif
}
void
ThemeManager
::
saveCurrentScheme
(
const
QString
&
name
)
...
...
@@ -90,12 +97,14 @@ void ThemeManager::saveCurrentScheme(const QString &name)
cg
.
sync
();
}
#if KCONFIGWIDGETS_VERSION < QT_VERSION_CHECK(5, 67, 0)
QString
ThemeManager
::
currentDesktopDefaultScheme
()
const
{
KSharedConfigPtr
config
=
KSharedConfig
::
openConfig
(
QLatin1String
(
"kdeglobals"
));
KConfigGroup
group
(
config
,
"General"
);
return
group
.
readEntry
(
"ColorScheme"
,
QStringLiteral
(
"Breeze"
));
}
#endif
QString
ThemeManager
::
currentSchemeName
()
const
{
...
...
@@ -104,7 +113,12 @@ QString ThemeManager::currentSchemeName() const
QAction
*
const
action
=
menu
()
->
activeAction
();
if
(
action
)
return
KLocalizedString
::
removeAcceleratorMarker
(
action
->
text
());
#if KCONFIGWIDGETS_VERSION >= QT_VERSION_CHECK(5, 67, 0)
// See above
return
QString
();
#else
return
currentDesktopDefaultScheme
();
#endif
}
void
ThemeManager
::
slotSchemeChanged
(
QAction
*
triggeredAction
,
const
QString
&
path
)
...
...
src/utils/thememanager.h
View file @
cc7e26b9
...
...
@@ -25,13 +25,14 @@
// Qt includes
#include
<QAction>
#include
<QObject>
#include
<QString>
#include
<QtGlobal>
#include
<kconfigwidgets_version.h>
// KDE includes
#include
<KColorSchemeManager>
class
ThemeManager
:
public
QAction
{
Q_OBJECT
...
...
@@ -45,7 +46,9 @@ private Q_SLOTS:
private:
QString
loadCurrentScheme
()
const
;
void
saveCurrentScheme
(
const
QString
&
name
);
#if KCONFIGWIDGETS_VERSION < QT_VERSION_CHECK(5, 67, 0)
QString
currentDesktopDefaultScheme
()
const
;
#endif
signals:
void
themeChanged
(
const
QString
&
name
);
...
...
Farid Abdelnour
🎥
@frdbr
mentioned in issue
#445
·
Feb 03, 2020
mentioned in issue
#445
mentioned in issue #445
Toggle commit list
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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