// This file is generated by kconfig_compiler_kf6 from config.kcfg.
// All changes you do to this file will be lost.

#include "config.h"

#include <qglobal.h>
#include <QFile>
#include <QQmlEngine>

class ConfigHelper
{
  public:
    ConfigHelper() : q(nullptr) {}
    ~ConfigHelper() { delete q; q = nullptr; }
    ConfigHelper(const ConfigHelper&) = delete;
    ConfigHelper& operator=(const ConfigHelper&) = delete;
    Config *q;
};
Q_GLOBAL_STATIC(ConfigHelper, s_globalConfig)
Config *Config::self()
{
  if (!s_globalConfig()->q) {
    new Config;
    s_globalConfig()->q->read();
  }

  return s_globalConfig()->q;
}

Config *Config::create(QQmlEngine *, QJSEngine *)
{
  QQmlEngine::setObjectOwnership(self(), QQmlEngine::CppOwnership);
  return self();
}

Config::Config( QObject *parent )
  : KConfigSkeleton( QStringLiteral( "marblemapsrc" ) )
{
  setParent(parent);
  Q_ASSERT(!s_globalConfig()->q);
  s_globalConfig()->q = this;
  KConfigCompilerSignallingItem::NotifyFunction notifyFunction = static_cast<KConfigCompilerSignallingItem::NotifyFunction>(&Config::itemChanged);

  setCurrentGroup( QStringLiteral( "General" ) );

  KConfigCompilerSignallingItem  *itemMapThemeId;
  KConfigSkeleton::ItemString  *innerItemMapThemeId;
  innerItemMapThemeId = new KConfigSkeleton::ItemString( currentGroup(), QStringLiteral( "MapThemeId" ), mMapThemeId, QStringLiteral( "earth/vectorosm/vectorosm.dgml" ) );
  itemMapThemeId = new KConfigCompilerSignallingItem(innerItemMapThemeId, this, notifyFunction, signalMapThemeIdChanged);
  addItem( itemMapThemeId, QStringLiteral( "MapThemeId" ) );

  setCurrentGroup( QStringLiteral( "Routing" ) );

  QList<KConfigSkeleton::ItemEnum::Choice> valuesProfile;
  {
    KConfigSkeleton::ItemEnum::Choice choice;
    choice.name = QStringLiteral("Car");
    valuesProfile.append( choice );
  }
  {
    KConfigSkeleton::ItemEnum::Choice choice;
    choice.name = QStringLiteral("Bicycle");
    valuesProfile.append( choice );
  }
  {
    KConfigSkeleton::ItemEnum::Choice choice;
    choice.name = QStringLiteral("Pedestrian");
    valuesProfile.append( choice );
  }
  KConfigCompilerSignallingItem  *itemProfile;
  KConfigSkeleton::ItemEnum  *innerItemProfile;
  innerItemProfile = new KConfigSkeleton::ItemEnum( currentGroup(), QStringLiteral( "Profile" ), mProfile, valuesProfile, Bicycle );
  itemProfile = new KConfigCompilerSignallingItem(innerItemProfile, this, notifyFunction, signalProfileChanged);
  addItem( itemProfile, QStringLiteral( "Profile" ) );
}

QString Config::defaultMapThemeIdValue_helper()
{

  return QStringLiteral( "earth/vectorosm/vectorosm.dgml" );
}

int Config::defaultProfileValue_helper()
{

  return Bicycle;
}

Config::~Config()
{
  if (s_globalConfig.exists() && !s_globalConfig.isDestroyed()) {
    s_globalConfig()->q = nullptr;
  }
}


void Config::itemChanged(quint64 signalFlag) {

  switch (signalFlag) {
  case signalMapThemeIdChanged:
    Q_EMIT MapThemeIdChanged();
    break;
  case signalProfileChanged:
    Q_EMIT ProfileChanged();
    break;
  }
}
