Commit 9f07adda authored by Matthieu Gallien's avatar Matthieu Gallien 🎵
Browse files

ensure the configuration dialog is not dirty when just open

avoid setting it dirty when reading the setting during the first init

when clicking on cancel, ensure that the c++ backend is reset

BUG: 430743
parent 334d35e0
......@@ -110,6 +110,16 @@ void ElisaConfigurationDialog::save()
Q_EMIT isDirtyChanged();
}
void ElisaConfigurationDialog::cancel()
{
if (mIsDirty) {
configChanged();
mIsDirty = false;
Q_EMIT isDirtyChanged();
}
}
void ElisaConfigurationDialog::setShowProgressInTaskBar(bool showProgressInTaskBar)
{
if (mShowProgressInTaskBar == showProgressInTaskBar) {
......@@ -200,30 +210,43 @@ void ElisaConfigurationDialog::removeMusicLocation(QString location)
void ElisaConfigurationDialog::configChanged()
{
setRootPath(Elisa::ElisaConfiguration::rootPath());
setShowProgressInTaskBar(Elisa::ElisaConfiguration::showProgressOnTaskBar());
setShowSystemTrayIcon(Elisa::ElisaConfiguration::showSystemTrayIcon());
setPlayAtStartup(Elisa::ElisaConfiguration::playAtStartup());
setColorScheme(Elisa::ElisaConfiguration::colorScheme());
setForceUsageOfFastFileSearch(Elisa::ElisaConfiguration::forceUsageOfFastFileSearch());
mRootPath = Elisa::ElisaConfiguration::rootPath();
Q_EMIT rootPathChanged(mRootPath);
mShowProgressInTaskBar = Elisa::ElisaConfiguration::showProgressOnTaskBar();
Q_EMIT showProgressInTaskBarChanged();
mShowSystemTrayIcon = Elisa::ElisaConfiguration::showSystemTrayIcon();
Q_EMIT showSystemTrayIconChanged();
mPlayAtStartup = Elisa::ElisaConfiguration::playAtStartup();
Q_EMIT playAtStartupChanged();
mColorScheme = Elisa::ElisaConfiguration::colorScheme();
Q_EMIT colorSchemeChanged();
mForceUsageOfFastFileSearch = Elisa::ElisaConfiguration::forceUsageOfFastFileSearch();
Q_EMIT forceUsageOfFastFileSearchChanged();
switch (Elisa::ElisaConfiguration::embeddedView())
{
case Elisa::ElisaConfiguration::EnumEmbeddedView::NoView:
setEmbeddedView(ElisaUtils::Unknown);
mEmbeddedView = ElisaUtils::Unknown;
break;
case Elisa::ElisaConfiguration::EnumEmbeddedView::AllAlbums:
setEmbeddedView(ElisaUtils::Album);
mEmbeddedView = ElisaUtils::Album;
break;
case Elisa::ElisaConfiguration::EnumEmbeddedView::AllArtists:
setEmbeddedView(ElisaUtils::Artist);
mEmbeddedView = ElisaUtils::Artist;
break;
case Elisa::ElisaConfiguration::EnumEmbeddedView::AllGenres:
setEmbeddedView(ElisaUtils::Genre);
mEmbeddedView = ElisaUtils::Genre;
break;
}
Q_EMIT embeddedViewChanged();
setInitialViewIndex(Elisa::ElisaConfiguration::initialView());
mInitialViewIndex = Elisa::ElisaConfiguration::initialView();
Q_EMIT initialViewIndexChanged();
}
void ElisaConfigurationDialog::setDirty()
......
......@@ -140,6 +140,8 @@ public Q_SLOTS:
void save();
void cancel();
void setShowProgressInTaskBar(bool showProgressInTaskBar);
void setShowSystemTrayIcon(bool showSystemTrayIcon);
......
......@@ -313,7 +313,10 @@ Window {
QQC2.DialogButtonBox.buttonRole: QQC2.DialogButtonBox.RejectRole
Accessible.onPressAction: onClicked
}
onRejected: close()
onRejected: {
ElisaConfigurationDialog.cancel()
close()
}
}
}
}
......
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