Commit 495ffbc9 authored by Matthieu Gallien's avatar Matthieu Gallien 🎵

allow to modify the display of progress on taskbar entries

parent b7ab3d0e
......@@ -406,6 +406,7 @@ if (Qt5Quick_FOUND AND Qt5Widgets_FOUND)
qml/ElisaConfigurationDialog.qml
qml/FileScanningConfiguration.qml
qml/GeneralConfiguration.qml
)
qt5_add_resources(elisa_SOURCES resources.qrc)
......
......@@ -35,6 +35,7 @@ ElisaConfigurationDialog::ElisaConfigurationDialog(QObject* parent)
setRootPath(Elisa::ElisaConfiguration::rootPath());
setShowProgressInTaskBar(Elisa::ElisaConfiguration::showProgressOnTaskBar());
save();
mConfigFileWatcher.addPath(Elisa::ElisaConfiguration::self()->config()->name());
......@@ -78,23 +79,41 @@ void ElisaConfigurationDialog::setRootPath(const QStringList &rootPath)
Q_EMIT rootPathChanged(mRootPath);
mIsDirty = true;
Q_EMIT isDirtyChanged();
setDirty();
}
void ElisaConfigurationDialog::save()
{
Elisa::ElisaConfiguration::setRootPath(mRootPath);
Elisa::ElisaConfiguration::setShowProgressOnTaskBar(mShowProgressInTaskBar);
Elisa::ElisaConfiguration::self()->save();
mIsDirty = false;
Q_EMIT isDirtyChanged();
}
void ElisaConfigurationDialog::setShowProgressInTaskBar(bool showProgressInTaskBar)
{
if (mShowProgressInTaskBar == showProgressInTaskBar) {
return;
}
mShowProgressInTaskBar = showProgressInTaskBar;
Q_EMIT showProgressInTaskBarChanged();
setDirty();
}
void ElisaConfigurationDialog::configChanged()
{
setRootPath(Elisa::ElisaConfiguration::rootPath());
}
void ElisaConfigurationDialog::setDirty()
{
mIsDirty = true;
Q_EMIT isDirtyChanged();
}
#include "moc_elisaconfigurationdialog.cpp"
......@@ -33,6 +33,11 @@ class ELISALIB_EXPORT ElisaConfigurationDialog : public QObject
WRITE setRootPath
NOTIFY rootPathChanged)
Q_PROPERTY(bool showProgressInTaskBar
READ showProgressInTaskBar
WRITE setShowProgressInTaskBar
NOTIFY showProgressInTaskBarChanged)
Q_PROPERTY(bool isDirty
READ isDirty
NOTIFY isDirtyChanged)
......@@ -50,30 +55,42 @@ public:
return mIsDirty;
}
bool showProgressInTaskBar() const
{
return mShowProgressInTaskBar;
}
Q_SIGNALS:
void rootPathChanged(const QStringList &rootPath);
void isDirtyChanged();
void showProgressInTaskBarChanged();
public Q_SLOTS:
void setRootPath(const QStringList &rootPath);
void save();
void setShowProgressInTaskBar(bool showProgressInTaskBar);
private Q_SLOTS:
void configChanged();
private:
void setDirty();
QStringList mRootPath;
QFileSystemWatcher mConfigFileWatcher;
bool mIsDirty = false;
bool mShowProgressInTaskBar = true;
};
#endif
......@@ -113,7 +113,7 @@ Window {
currentIndex: pagesList.currentIndex
Item {
GeneralConfiguration {
}
FileScanningConfiguration {
......
/*
* Copyright 2017 Matthieu Gallien <matthieu_gallien@yahoo.fr>
*
* This program is free software: you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
import QtQuick 2.11
import QtQuick.Controls 2.4
import QtQuick.Layouts 1.3
import QtQml.Models 2.3
import QtQuick.Dialogs 1.2 as Dialogs
ColumnLayout {
spacing: 0
SystemPalette {
id: myPalette
colorGroup: SystemPalette.Active
}
CheckBox {
checked: config.showProgressInTaskBar
text: i18nc("Option to control the display of music progress on taskbar entries", "Show progress on taskbar entries")
onCheckedChanged: config.showProgressInTaskBar = checked
}
}
......@@ -40,6 +40,7 @@
<file>qml/NativeApplicationMenu.qml</file>
<file>qml/ElisaConfigurationDialog.qml</file>
<file>qml/FileScanningConfiguration.qml</file>
<file>qml/GeneralConfiguration.qml</file>
</qresource>
<qresource prefix="/qml/+windows">
<file alias="Theme.qml">windows/WindowsTheme.qml</file>
......
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