Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Multimedia
Elisa
Commits
b4bacfc0
Commit
b4bacfc0
authored
Oct 11, 2020
by
George Florea Bănuș
Committed by
Nate Graham
Oct 11, 2020
Browse files
Add setting to change color scheme
parent
54ee976e
Pipeline
#37305
passed with stage
in 9 minutes and 40 seconds
Changes
7
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
src/elisa_core.kcfg
View file @
b4bacfc0
...
...
@@ -36,6 +36,8 @@
<choice
name=
"AllGenres"
/>
</choices>
</entry>
<entry
key=
"ColorScheme"
type=
"String"
>
</entry>
<entry
key=
"SortRolePreferences"
type=
"StringList"
>
</entry>
<entry
key=
"SortOrderPreferences"
type=
"StringList"
>
...
...
src/elisaapplication.cpp
View file @
b4bacfc0
...
...
@@ -33,6 +33,7 @@
#include <KXmlGui/KShortcutsDialog>
#endif
#include <KColorSchemeManager>
#include <KCoreAddons/KAboutData>
#include <QQmlEngine>
...
...
@@ -89,6 +90,7 @@ public:
QFileSystemWatcher
mConfigFileWatcher
;
KColorSchemeManager
*
mSchemes
;
};
ElisaApplication
::
ElisaApplication
(
QObject
*
parent
)
:
QObject
(
parent
),
d
(
std
::
make_unique
<
ElisaApplicationPrivate
>
(
this
))
...
...
@@ -99,6 +101,8 @@ ElisaApplication::ElisaApplication(QObject *parent) : QObject(parent), d(std::ma
Elisa
::
ElisaConfiguration
::
self
()
->
load
();
Elisa
::
ElisaConfiguration
::
self
()
->
save
();
d
->
mSchemes
=
new
KColorSchemeManager
(
this
);
d
->
mConfigFileWatcher
.
addPath
(
Elisa
::
ElisaConfiguration
::
self
()
->
config
()
->
name
());
connect
(
Elisa
::
ElisaConfiguration
::
self
(),
&
Elisa
::
ElisaConfiguration
::
configChanged
,
...
...
@@ -114,6 +118,16 @@ ElisaApplication::ElisaApplication(QObject *parent) : QObject(parent), d(std::ma
ElisaApplication
::~
ElisaApplication
()
=
default
;
QAbstractItemModel
*
ElisaApplication
::
colorSchemesModel
()
{
return
d
->
mSchemes
->
model
();
}
void
ElisaApplication
::
activateColorScheme
(
const
QString
&
name
)
{
d
->
mSchemes
->
activateScheme
(
d
->
mSchemes
->
indexForScheme
(
name
));
}
void
ElisaApplication
::
setupActions
(
const
QString
&
actionName
)
{
#if defined KF5XmlGui_FOUND && KF5XmlGui_FOUND
...
...
src/elisaapplication.h
View file @
b4bacfc0
...
...
@@ -31,6 +31,8 @@ class ManageHeaderBar;
class
QQmlEngine
;
class
ElisaApplicationPrivate
;
class
QSessionManager
;
class
KColorSchemeManager
;
class
QAbstractItemModel
;
class
ELISALIB_EXPORT
ElisaApplication
:
public
QObject
{
...
...
@@ -84,6 +86,10 @@ class ELISALIB_EXPORT ElisaApplication : public QObject
READ
showSystemTrayIcon
NOTIFY
showSystemTrayIconChanged
)
Q_PROPERTY
(
QAbstractItemModel
*
colorSchemesModel
READ
colorSchemesModel
CONSTANT
)
public:
explicit
ElisaApplication
(
QObject
*
parent
=
nullptr
);
...
...
@@ -173,6 +179,8 @@ public Q_SLOTS:
void
initialize
();
void
activateColorScheme
(
const
QString
&
name
);
public:
void
setQmlEngine
(
QQmlEngine
*
engine
);
...
...
@@ -208,6 +216,8 @@ private:
DataTypes
::
EntryDataList
checkFileListAndMakeAbsolute
(
const
DataTypes
::
EntryDataList
&
filesList
,
const
QString
&
workingDirectory
)
const
;
QAbstractItemModel
*
colorSchemesModel
();
std
::
unique_ptr
<
ElisaApplicationPrivate
>
d
;
};
...
...
src/localFileConfiguration/elisaconfigurationdialog.cpp
View file @
b4bacfc0
...
...
@@ -77,6 +77,7 @@ void ElisaConfigurationDialog::save()
Elisa
::
ElisaConfiguration
::
setShowSystemTrayIcon
(
mShowSystemTrayIcon
);
Elisa
::
ElisaConfiguration
::
setForceUsageOfFastFileSearch
(
mForceUsageOfFastFileSearch
);
Elisa
::
ElisaConfiguration
::
setPlayAtStartup
(
mPlayAtStartup
);
Elisa
::
ElisaConfiguration
::
setColorScheme
(
mColorScheme
);
Elisa
::
ElisaConfiguration
::
setEmbeddedView
(
Elisa
::
ElisaConfiguration
::
EnumEmbeddedView
::
NoView
);
switch
(
mEmbeddedView
)
...
...
@@ -167,12 +168,24 @@ void ElisaConfigurationDialog::setPlayAtStartup(bool playAtStartup)
setDirty
();
}
void
ElisaConfigurationDialog
::
setColorScheme
(
const
QString
&
scheme
)
{
if
(
mColorScheme
==
scheme
)
{
return
;
}
mColorScheme
=
scheme
;
Q_EMIT
colorSchemeChanged
();
setDirty
();
}
void
ElisaConfigurationDialog
::
configChanged
()
{
setRootPath
(
Elisa
::
ElisaConfiguration
::
rootPath
());
setShowProgressInTaskBar
(
Elisa
::
ElisaConfiguration
::
showProgressOnTaskBar
());
setShowSystemTrayIcon
(
Elisa
::
ElisaConfiguration
::
showSystemTrayIcon
());
setPlayAtStartup
(
Elisa
::
ElisaConfiguration
::
playAtStartup
());
setColorScheme
(
Elisa
::
ElisaConfiguration
::
colorScheme
());
switch
(
Elisa
::
ElisaConfiguration
::
embeddedView
())
{
...
...
src/localFileConfiguration/elisaconfigurationdialog.h
View file @
b4bacfc0
...
...
@@ -53,6 +53,11 @@ class ELISALIB_EXPORT ElisaConfigurationDialog : public QObject
WRITE
setPlayAtStartup
NOTIFY
playAtStartupChanged
)
Q_PROPERTY
(
QString
colorScheme
READ
colorScheme
WRITE
setColorScheme
NOTIFY
colorSchemeChanged
)
public:
explicit
ElisaConfigurationDialog
(
QObject
*
parent
=
nullptr
);
...
...
@@ -91,6 +96,11 @@ public:
return
mPlayAtStartup
;
}
QString
colorScheme
()
const
{
return
mColorScheme
;
}
Q_SIGNALS:
void
rootPathChanged
(
const
QStringList
&
rootPath
);
...
...
@@ -107,6 +117,8 @@ Q_SIGNALS:
void
playAtStartupChanged
();
void
colorSchemeChanged
();
public
Q_SLOTS
:
void
setRootPath
(
const
QStringList
&
rootPath
);
...
...
@@ -123,6 +135,8 @@ public Q_SLOTS:
void
setPlayAtStartup
(
bool
playAtStartup
);
void
setColorScheme
(
const
QString
&
scheme
);
private
Q_SLOTS
:
void
configChanged
();
...
...
@@ -145,6 +159,8 @@ private:
bool
mPlayAtStartup
=
false
;
QString
mColorScheme
;
ElisaUtils
::
PlayListEntryType
mEmbeddedView
=
ElisaUtils
::
Unknown
;
};
...
...
src/qml/ApplicationMenu.qml
View file @
b4bacfc0
...
...
@@ -8,6 +8,7 @@
import
QtQuick
2.7
import
QtQuick
.
Controls
2.3
import
org
.
kde
.
elisa
1.0
import
org
.
kde
.
kirigami
2.5
as
Kirigami
Menu
{
id
:
applicationMenu
...
...
@@ -29,6 +30,24 @@ Menu {
}
}
Menu
{
title
:
i18n
(
"
Color Scheme
"
)
Repeater
{
model
:
ElisaApplication
.
colorSchemesModel
delegate
:
Kirigami.BasicListItem
{
icon
:
model
.
decoration
text
:
model
.
display
highlighted
:
model
.
display
===
ElisaConfigurationDialog
.
colorScheme
onClicked
:
{
ElisaApplication
.
activateColorScheme
(
model
.
display
)
ElisaConfigurationDialog
.
setColorScheme
(
model
.
display
)
ElisaConfigurationDialog
.
save
()
applicationMenu
.
close
()
}
}
}
}
MenuSeparator
{
}
...
...
src/qml/ElisaMainWindow.qml
View file @
b4bacfc0
...
...
@@ -32,7 +32,7 @@ Kirigami.ApplicationWindow {
onPausePlayback
:
ElisaApplication
.
audioControl
.
playPause
()
}
}
minimumWidth
:
590
property
int
minHeight
:
320
...
...
@@ -345,6 +345,7 @@ Kirigami.ApplicationWindow {
Component.onCompleted
:
{
ElisaApplication
.
initialize
()
ElisaApplication
.
activateColorScheme
(
ElisaConfigurationDialog
.
colorScheme
)
if
(
persistentSettings
.
playListState
)
{
ElisaApplication
.
mediaPlayListProxyModel
.
persistentState
=
persistentSettings
.
playListState
...
...
Write
Preview
Supports
Markdown
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