Commit 6525b4b9 authored by Matthieu Gallien's avatar Matthieu Gallien 🎵
Browse files

use KConfig configuration to show/hide progress on task bar entries

need an HMI but should just works
parent 180ba8db
......@@ -8,4 +8,8 @@
<entry key="RootPath" type="PathList" >
</entry>
</group>
<group name="PlayerSettings">
<entry key="ShowProgressOnTaskBar" type="Bool" >
</entry>
</group>
</kcfg>
......@@ -60,6 +60,7 @@
#include <QDir>
#include <QKeyEvent>
#include <QDebug>
#include <QFileSystemWatcher>
#include <memory>
......@@ -79,6 +80,8 @@ public:
Elisa::ElisaConfiguration::instance(configurationFileName);
Elisa::ElisaConfiguration::self()->load();
Elisa::ElisaConfiguration::self()->save();
mConfigFileWatcher.addPath(configurationFileName);
}
#if defined KF5XmlGui_FOUND && KF5XmlGui_FOUND
......@@ -101,10 +104,17 @@ public:
QQmlApplicationEngine *mEngine = nullptr;
QFileSystemWatcher mConfigFileWatcher;
};
ElisaApplication::ElisaApplication(QObject *parent) : QObject(parent), d(std::make_unique<ElisaApplicationPrivate>(this))
{
connect(Elisa::ElisaConfiguration::self(), &Elisa::ElisaConfiguration::configChanged,
this, &ElisaApplication::configChanged);
connect(&d->mConfigFileWatcher, &QFileSystemWatcher::fileChanged,
this, &ElisaApplication::configChanged);
}
ElisaApplication::~ElisaApplication()
......@@ -288,6 +298,18 @@ void ElisaApplication::scrub() {}
void ElisaApplication::playPause() {}
void ElisaApplication::configChanged()
{
auto currentConfiguration = Elisa::ElisaConfiguration::self();
d->mConfigFileWatcher.addPath(currentConfiguration->config()->name());
currentConfiguration->load();
currentConfiguration->read();
Q_EMIT showProgressOnTaskBarChanged();
}
ElisaUtils::EntryDataList ElisaApplication::checkFileListAndMakeAbsolute(const ElisaUtils::EntryDataList &filesList,
const QString &workingDirectory) const
{
......@@ -504,4 +526,11 @@ ManageHeaderBar *ElisaApplication::manageHeaderBar() const
return d->mManageHeaderBar.get();
}
bool ElisaApplication::showProgressOnTaskBar() const
{
auto currentConfiguration = Elisa::ElisaConfiguration::self();
return currentConfiguration->showProgressOnTaskBar();
}
#include "moc_elisaapplication.cpp"
......@@ -74,6 +74,10 @@ class ELISALIB_EXPORT ElisaApplication : public QObject
READ manageHeaderBar
NOTIFY manageHeaderBarChanged)
Q_PROPERTY(bool showProgressOnTaskBar
READ showProgressOnTaskBar
NOTIFY showProgressOnTaskBarChanged)
public:
explicit ElisaApplication(QObject *parent = nullptr);
......@@ -101,6 +105,8 @@ public:
ManageHeaderBar *manageHeaderBar() const;
bool showProgressOnTaskBar() const;
Q_SIGNALS:
void argumentsChanged();
......@@ -124,6 +130,8 @@ Q_SIGNALS:
void initializationDone();
void showProgressOnTaskBarChanged();
public Q_SLOTS:
void appHelpActivated();
......@@ -164,6 +172,8 @@ private Q_SLOTS:
void playPause();
void configChanged();
private:
void initializeModels();
......
......@@ -63,12 +63,6 @@ Menu {
}
}
MenuItem {
text: mainWindow.showProgressOnTaskBar ? i18nc("Do not show progress on task bar menu entry in the elisa menu", "Do Not Show Progress on Task Bar Entries") :
i18nc("Show Progress on Task Bar Entries entry in the elisa menu", "Show Progress on Task Bar Entries")
onTriggered: mainWindow.showProgressOnTaskBar = !mainWindow.showProgressOnTaskBar
}
MenuSeparator {
visible: reportBugAction.text !== ""
}
......
......@@ -38,8 +38,6 @@ ApplicationWindow {
width: persistentSettings.width
height: persistentSettings.height
property bool showProgressOnTaskBar: persistentSettings.showProgressOnTaskBar
title: i18n("Elisa")
Accessible.role: Accessible.Application
......@@ -109,8 +107,6 @@ ApplicationWindow {
property bool showPlaylist: true
property bool headerBarIsMaximized: false
property bool showProgressOnTaskBar: true
}
Connections {
......@@ -142,8 +138,6 @@ ApplicationWindow {
persistentSettings.showPlaylist = contentView.showPlaylist
persistentSettings.headerBarIsMaximized = headerBar.isMaximized
persistentSettings.showProgressOnTaskBar = showProgressOnTaskBar
}
}
......@@ -159,7 +153,7 @@ ApplicationWindow {
player: elisa.audioPlayer
headerBarManager: elisa.manageHeaderBar
manageMediaPlayerControl: elisa.playerControl
showProgressOnTaskBar: mainWindow.showProgressOnTaskBar
showProgressOnTaskBar: elisa.showProgressOnTaskBar
onRaisePlayer: {
mainWindow.show()
......
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