Commit 5f509193 authored by stef lep's avatar stef lep Committed by Nate Graham
Browse files

add configuration to disable play at startup

parent dfa4cb9a
......@@ -21,6 +21,11 @@
false
</default>
</entry>
<entry key="PlayAtStartup" type="Bool" >
<default>
false
</default>
</entry>
</group>
<group name="Views">
<entry key="EmbeddedView" type="Enum">
......
......@@ -76,6 +76,7 @@ void ElisaConfigurationDialog::save()
Elisa::ElisaConfiguration::setShowProgressOnTaskBar(mShowProgressInTaskBar);
Elisa::ElisaConfiguration::setShowSystemTrayIcon(mShowSystemTrayIcon);
Elisa::ElisaConfiguration::setForceUsageOfFastFileSearch(mForceUsageOfFastFileSearch);
Elisa::ElisaConfiguration::setPlayAtStartup(mPlayAtStartup);
Elisa::ElisaConfiguration::setEmbeddedView(0);
switch (mEmbeddedView)
......@@ -155,11 +156,24 @@ void ElisaConfigurationDialog::setEmbeddedView(ElisaUtils::PlayListEntryType emb
setDirty();
}
void ElisaConfigurationDialog::setPlayAtStartup(bool playAtStartup)
{
if (mPlayAtStartup == playAtStartup) {
return;
}
mPlayAtStartup = playAtStartup;
Q_EMIT playAtStartupChanged();
setDirty();
}
void ElisaConfigurationDialog::configChanged()
{
setRootPath(Elisa::ElisaConfiguration::rootPath());
setShowProgressInTaskBar(Elisa::ElisaConfiguration::showProgressOnTaskBar());
setShowSystemTrayIcon(Elisa::ElisaConfiguration::showSystemTrayIcon());
setPlayAtStartup(Elisa::ElisaConfiguration::playAtStartup());
switch (Elisa::ElisaConfiguration::embeddedView())
{
case 0:
......
......@@ -48,6 +48,11 @@ class ELISALIB_EXPORT ElisaConfigurationDialog : public QObject
READ isDirty
NOTIFY isDirtyChanged)
Q_PROPERTY(bool playAtStartup
READ playAtStartup
WRITE setPlayAtStartup
NOTIFY playAtStartupChanged)
public:
explicit ElisaConfigurationDialog(QObject *parent = nullptr);
......@@ -81,6 +86,11 @@ public:
return mEmbeddedView;
}
bool playAtStartup() const
{
return mPlayAtStartup;
}
Q_SIGNALS:
void rootPathChanged(const QStringList &rootPath);
......@@ -95,6 +105,8 @@ Q_SIGNALS:
void embeddedViewChanged();
void playAtStartupChanged();
public Q_SLOTS:
void setRootPath(const QStringList &rootPath);
......@@ -109,6 +121,8 @@ public Q_SLOTS:
void setEmbeddedView(ElisaUtils::PlayListEntryType embeddedView);
void setPlayAtStartup(bool playAtStartup);
private Q_SLOTS:
void configChanged();
......@@ -129,6 +143,8 @@ private:
bool mForceUsageOfFastFileSearch = true;
bool mPlayAtStartup = false;
ElisaUtils::PlayListEntryType mEmbeddedView = ElisaUtils::Unknown;
};
......
......@@ -8,6 +8,8 @@
#include "mediaplaylist.h"
#include "elisa_settings.h"
#include <QTimer>
#include <QDateTime>
......@@ -570,7 +572,9 @@ void ManageAudioPlayer::restorePreviousState()
}
auto isPlaying = mPersistentState.find(QStringLiteral("isPlaying"));
if (isPlaying != mPersistentState.end() && mPlayingState != isPlaying->toBool()) {
auto currentConfiguration = Elisa::ElisaConfiguration::self();
bool autoPlay = currentConfiguration->playAtStartup();
if (autoPlay && isPlaying != mPersistentState.end() && mPlayingState != isPlaying->toBool()) {
mPlayingState = isPlaying->toBool();
}
......
......@@ -35,6 +35,14 @@ ColumnLayout {
onToggled: ElisaConfigurationDialog.showSystemTrayIcon = checked
}
CheckBox {
checked: ElisaConfigurationDialog.playAtStartup
text: i18n("Start playing on startup")
onToggled: ElisaConfigurationDialog.playAtStartup = checked
}
RowLayout {
spacing: Kirigami.Units.smallSpacing
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment