Commit a12685aa authored by Matthieu Gallien's avatar Matthieu Gallien 🎵

ask KConfig to generate better code and export settings class

fix ability to do a proper usage of KConfig generated code in automated
tests

use KConfig in automated test
parent 9cf42e7e
......@@ -8,6 +8,8 @@
#include "manageaudioplayer.h"
#include "elisa_settings.h"
#include <QtTest>
#include <QStandardItemModel>
#include <QStandardItem>
......@@ -19,6 +21,8 @@ ManageAudioPlayerTest::ManageAudioPlayerTest(QObject *parent) : QObject(parent)
void ManageAudioPlayerTest::initTestCase()
{
QStandardPaths::setTestModeEnabled(true);
Elisa::ElisaConfiguration::instance(QStringLiteral("testfoo"));
}
void ManageAudioPlayerTest::simpleInitialCase()
......
......@@ -196,7 +196,7 @@ if (KF5Baloo_FOUND)
endif()
endif()
kconfig_add_kcfg_files(elisaLib_SOURCES ../src/elisa_settings.kcfgc )
kconfig_add_kcfg_files(elisaLib_SOURCES ../src/elisa_settings.kcfgc GENERATE_MOC )
set(elisaLib_SOURCES
${elisaLib_SOURCES}
../src/elisa_core.kcfg
......@@ -483,12 +483,6 @@ set(elisaImport_SOURCES
elisaimportapplication.cpp
)
kconfig_add_kcfg_files(elisaImport_SOURCES ../src/elisa_settings.kcfgc )
set(elisaImport_SOURCES
${elisaImport_SOURCES}
../src/elisa_core.kcfg
)
add_executable(elisaImport ${elisaImport_SOURCES})
target_link_libraries(elisaImport
......
......@@ -2,5 +2,8 @@ ClassName=ElisaConfiguration
NameSpace=Elisa
File=elisa_core.kcfg
Mutators=true
Notifiers=true
Visibility=Q_DECL_EXPORT
Singleton=true
MemberVariables=dpointer
GenerateProperties=true
......@@ -78,20 +78,20 @@ void ElisaConfigurationDialog::save()
Elisa::ElisaConfiguration::setForceUsageOfFastFileSearch(mForceUsageOfFastFileSearch);
Elisa::ElisaConfiguration::setPlayAtStartup(mPlayAtStartup);
Elisa::ElisaConfiguration::setEmbeddedView(0);
Elisa::ElisaConfiguration::setEmbeddedView(Elisa::ElisaConfiguration::EnumEmbeddedView::NoView);
switch (mEmbeddedView)
{
case ElisaUtils::Unknown:
Elisa::ElisaConfiguration::setEmbeddedView(0);
Elisa::ElisaConfiguration::setEmbeddedView(Elisa::ElisaConfiguration::EnumEmbeddedView::NoView);
break;
case ElisaUtils::Album:
Elisa::ElisaConfiguration::setEmbeddedView(1);
Elisa::ElisaConfiguration::setEmbeddedView(Elisa::ElisaConfiguration::EnumEmbeddedView::AllAlbums);
break;
case ElisaUtils::Artist:
Elisa::ElisaConfiguration::setEmbeddedView(2);
Elisa::ElisaConfiguration::setEmbeddedView(Elisa::ElisaConfiguration::EnumEmbeddedView::AllArtists);
break;
case ElisaUtils::Genre:
Elisa::ElisaConfiguration::setEmbeddedView(3);
Elisa::ElisaConfiguration::setEmbeddedView(Elisa::ElisaConfiguration::EnumEmbeddedView::AllGenres);
break;
case ElisaUtils::Radio:
case ElisaUtils::Track:
......@@ -176,16 +176,16 @@ void ElisaConfigurationDialog::configChanged()
switch (Elisa::ElisaConfiguration::embeddedView())
{
case 0:
case Elisa::ElisaConfiguration::EnumEmbeddedView::NoView:
setEmbeddedView(ElisaUtils::Unknown);
break;
case 1:
case Elisa::ElisaConfiguration::EnumEmbeddedView::AllAlbums:
setEmbeddedView(ElisaUtils::Album);
break;
case 2:
case Elisa::ElisaConfiguration::EnumEmbeddedView::AllArtists:
setEmbeddedView(ElisaUtils::Artist);
break;
case 3:
case Elisa::ElisaConfiguration::EnumEmbeddedView::AllGenres:
setEmbeddedView(ElisaUtils::Genre);
break;
}
......
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