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
01982fcf
Commit
01982fcf
authored
Oct 13, 2020
by
Matthieu Gallien
🎵
Browse files
allow to configure initial view index
parent
e0842805
Pipeline
#37654
passed with stage
in 11 minutes and 27 seconds
Changes
7
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
src/elisa_core.kcfg
View file @
01982fcf
...
...
@@ -36,6 +36,19 @@
<choice
name=
"AllGenres"
/>
</choices>
</entry>
<entry
key=
"InitialView"
type=
"Enum"
>
<choices>
<choice
name=
"ContextView"
/>
<choice
name=
"RecentlyPlayed"
/>
<choice
name=
"FrequentlyPlayed"
/>
<choice
name=
"AllAlbums"
/>
<choice
name=
"AllArtists"
/>
<choice
name=
"AllTracks"
/>
<choice
name=
"AllGenres"
/>
<choice
name=
"Files"
/>
<choice
name=
"Radios"
/>
</choices>
</entry>
<entry
key=
"ColorScheme"
type=
"String"
>
</entry>
<entry
key=
"SortRolePreferences"
type=
"StringList"
>
...
...
src/elisaapplication.cpp
View file @
01982fcf
...
...
@@ -611,4 +611,11 @@ ElisaUtils::PlayListEntryType ElisaApplication::embeddedView() const
return
result
;
}
int
ElisaApplication
::
initialViewIndex
()
const
{
int
result
=
Elisa
::
ElisaConfiguration
::
initialView
();
return
result
;
}
#include "moc_elisaapplication.cpp"
src/elisaapplication.h
View file @
01982fcf
...
...
@@ -90,6 +90,10 @@ class ELISALIB_EXPORT ElisaApplication : public QObject
READ
colorSchemesModel
CONSTANT
)
Q_PROPERTY
(
int
initialViewIndex
READ
initialViewIndex
NOTIFY
initialViewIndexChanged
)
public:
explicit
ElisaApplication
(
QObject
*
parent
=
nullptr
);
...
...
@@ -125,6 +129,8 @@ public:
ElisaUtils
::
PlayListEntryType
embeddedView
()
const
;
int
initialViewIndex
()
const
;
Q_SIGNALS:
void
argumentsChanged
();
...
...
@@ -157,6 +163,8 @@ Q_SIGNALS:
void
embeddedViewChanged
();
void
initialViewIndexChanged
();
public
Q_SLOTS
:
void
appHelpActivated
();
...
...
src/localFileConfiguration/elisaconfigurationdialog.cpp
View file @
01982fcf
...
...
@@ -103,6 +103,8 @@ void ElisaConfigurationDialog::save()
break
;
}
Elisa
::
ElisaConfiguration
::
setInitialView
(
mInitialViewIndex
);
Elisa
::
ElisaConfiguration
::
self
()
->
save
();
mIsDirty
=
false
;
...
...
@@ -157,6 +159,18 @@ void ElisaConfigurationDialog::setEmbeddedView(ElisaUtils::PlayListEntryType emb
setDirty
();
}
void
ElisaConfigurationDialog
::
setInitialViewIndex
(
int
initialViewIndex
)
{
if
(
mInitialViewIndex
==
initialViewIndex
)
{
return
;
}
mInitialViewIndex
=
initialViewIndex
;
QTimer
::
singleShot
(
0
,
[
this
](){
Q_EMIT
initialViewIndexChanged
();
});
setDirty
();
}
void
ElisaConfigurationDialog
::
setPlayAtStartup
(
bool
playAtStartup
)
{
if
(
mPlayAtStartup
==
playAtStartup
)
{
...
...
@@ -202,6 +216,8 @@ void ElisaConfigurationDialog::configChanged()
setEmbeddedView
(
ElisaUtils
::
Genre
);
break
;
}
setInitialViewIndex
(
Elisa
::
ElisaConfiguration
::
initialView
());
}
void
ElisaConfigurationDialog
::
setDirty
()
...
...
src/localFileConfiguration/elisaconfigurationdialog.h
View file @
01982fcf
...
...
@@ -44,6 +44,11 @@ class ELISALIB_EXPORT ElisaConfigurationDialog : public QObject
WRITE
setEmbeddedView
NOTIFY
embeddedViewChanged
)
Q_PROPERTY
(
int
initialViewIndex
READ
initialViewIndex
WRITE
setInitialViewIndex
NOTIFY
initialViewIndexChanged
)
Q_PROPERTY
(
bool
isDirty
READ
isDirty
NOTIFY
isDirtyChanged
)
...
...
@@ -91,6 +96,11 @@ public:
return
mEmbeddedView
;
}
int
initialViewIndex
()
const
{
return
mInitialViewIndex
;
}
bool
playAtStartup
()
const
{
return
mPlayAtStartup
;
...
...
@@ -115,6 +125,8 @@ Q_SIGNALS:
void
embeddedViewChanged
();
void
initialViewIndexChanged
();
void
playAtStartupChanged
();
void
colorSchemeChanged
();
...
...
@@ -133,6 +145,8 @@ public Q_SLOTS:
void
setEmbeddedView
(
ElisaUtils
::
PlayListEntryType
embeddedView
);
void
setInitialViewIndex
(
int
initialViewIndex
);
void
setPlayAtStartup
(
bool
playAtStartup
);
void
setColorScheme
(
const
QString
&
scheme
);
...
...
@@ -162,6 +176,8 @@ private:
QString
mColorScheme
;
ElisaUtils
::
PlayListEntryType
mEmbeddedView
=
ElisaUtils
::
Unknown
;
int
mInitialViewIndex
=
2
;
};
#endif
src/qml/ElisaMainWindow.qml
View file @
01982fcf
...
...
@@ -127,8 +127,6 @@ Kirigami.ApplicationWindow {
property
bool
showPlaylist
:
true
property
bool
headerBarIsMaximized
:
false
property
int
initialIndex
}
Connections
{
...
...
@@ -159,8 +157,6 @@ Kirigami.ApplicationWindow {
persistentSettings
.
showPlaylist
=
contentView
.
showPlaylist
persistentSettings
.
headerBarIsMaximized
=
headerBar
.
isMaximized
persistentSettings
.
initialIndex
=
contentView
.
currentViewIndex
}
}
...
...
@@ -292,7 +288,7 @@ Kirigami.ApplicationWindow {
showPlaylist
:
persistentSettings
.
showPlaylist
showExpandedFilterView
:
persistentSettings
.
expandedFilterView
playlistDrawer
:
playlistDrawer
initialIndex
:
persistentSettings
.
value
(
'
initialIndex
'
,
initialViewIndex
)
initialIndex
:
ElisaApplication
.
initialViewIndex
}
}
}
...
...
src/qml/GeneralConfiguration.qml
View file @
01982fcf
...
...
@@ -103,4 +103,51 @@ ColumnLayout {
embeddedCategoryCombo
.
isFinished
=
true
}
}
RowLayout
{
spacing
:
Kirigami
.
Units
.
smallSpacing
Label
{
text
:
i18n
(
"
Initial view at start:
"
)
}
ComboBox
{
id
:
initialViewCombo
property
bool
isFinished
:
false
model
:
[
i18nc
(
"
Title of the view of the playlist
"
,
"
Now Playing
"
),
i18nc
(
"
Title of the view of recently played tracks
"
,
"
Recently Played
"
),
i18nc
(
"
Title of the view of frequently played tracks
"
,
"
Frequently Played
"
),
i18nc
(
"
Title of the view of all albums
"
,
"
Albums
"
),
i18nc
(
"
Title of the view of all artists
"
,
"
Artists
"
),
i18nc
(
"
Title of the view of all tracks
"
,
"
Tracks
"
),
i18nc
(
"
Title of the view of all genres
"
,
"
Genres
"
),
i18nc
(
"
Title of the file browser view
"
,
"
Files
"
),
i18nc
(
"
Title of the file radios browser view
"
,
"
Radios
"
),
]
editable
:
false
currentIndex
:
ElisaConfigurationDialog
.
initialViewIndex
onCurrentIndexChanged
:
{
if
(
!
isFinished
)
{
return
}
ElisaConfigurationDialog
.
initialViewIndex
=
currentIndex
}
}
Connections
{
target
:
ElisaConfigurationDialog
onInitialViewIndexChanged
:
initialViewCombo
.
currentIndex
=
ElisaConfigurationDialog
.
initialViewIndex
}
Component.onCompleted
:
{
initialViewCombo
.
currentIndex
=
ElisaConfigurationDialog
.
initialViewIndex
initialViewCombo
.
isFinished
=
true
}
}
}
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