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

#include "skanpage_config.h"

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

class SkanpageConfigurationPrivate
{
  public:

    // General
    int defaultNameFilterIndex;
    QUrl defaultFolder;
    bool showAllDevices;
    QString nameTemplate;

    // items
    KConfigCompilerSignallingItem *itemDefaultNameFilterIndex;
    KConfigCompilerSignallingItem *itemDefaultFolder;
    KConfigCompilerSignallingItem *itemShowAllDevices;
    KConfigCompilerSignallingItem *itemNameTemplate;
};

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

  return s_globalSkanpageConfiguration()->q;
}

SkanpageConfiguration::SkanpageConfiguration( )
  : KConfigSkeleton( QStringLiteral( "skanpagerc" ) )
{
  d = new SkanpageConfigurationPrivate;
  Q_ASSERT(!s_globalSkanpageConfiguration()->q);
  s_globalSkanpageConfiguration()->q = this;
  KConfigCompilerSignallingItem::NotifyFunction notifyFunction = static_cast<KConfigCompilerSignallingItem::NotifyFunction>(&SkanpageConfiguration::itemChanged);

  setCurrentGroup( QStringLiteral( "General" ) );

  KConfigSkeleton::ItemInt  *innerItemDefaultNameFilterIndex;
  innerItemDefaultNameFilterIndex = new KConfigSkeleton::ItemInt( currentGroup(), QStringLiteral( "defaultNameFilterIndex" ), d->defaultNameFilterIndex );
  d->itemDefaultNameFilterIndex = new KConfigCompilerSignallingItem(innerItemDefaultNameFilterIndex, this, notifyFunction, signalDefaultNameFilterIndexChanged);
  d->itemDefaultNameFilterIndex->setWriteFlags(KConfigBase::Notify);
  addItem( d->itemDefaultNameFilterIndex, QStringLiteral( "defaultNameFilterIndex" ) );
  KConfigSkeleton::ItemUrl  *innerItemDefaultFolder;
  innerItemDefaultFolder = new KConfigSkeleton::ItemUrl( currentGroup(), QStringLiteral( "defaultFolder" ), d->defaultFolder );
  d->itemDefaultFolder = new KConfigCompilerSignallingItem(innerItemDefaultFolder, this, notifyFunction, signalDefaultFolderChanged);
  d->itemDefaultFolder->setWriteFlags(KConfigBase::Notify);
  addItem( d->itemDefaultFolder, QStringLiteral( "defaultFolder" ) );
  KConfigSkeleton::ItemBool  *innerItemShowAllDevices;
  innerItemShowAllDevices = new KConfigSkeleton::ItemBool( currentGroup(), QStringLiteral( "showAllDevices" ), d->showAllDevices, false );
  d->itemShowAllDevices = new KConfigCompilerSignallingItem(innerItemShowAllDevices, this, notifyFunction, signalShowAllDevicesChanged);
  d->itemShowAllDevices->setWriteFlags(KConfigBase::Notify);
  addItem( d->itemShowAllDevices, QStringLiteral( "showAllDevices" ) );
  KConfigSkeleton::ItemString  *innerItemNameTemplate;
  innerItemNameTemplate = new KConfigSkeleton::ItemString( currentGroup(), QStringLiteral( "nameTemplate" ), d->nameTemplate );
  d->itemNameTemplate = new KConfigCompilerSignallingItem(innerItemNameTemplate, this, notifyFunction, signalNameTemplateChanged);
  d->itemNameTemplate->setWriteFlags(KConfigBase::Notify);
  addItem( d->itemNameTemplate, QStringLiteral( "nameTemplate" ) );
}

void SkanpageConfiguration::setDefaultNameFilterIndex( int v )
{
    if (v != self()->d->defaultNameFilterIndex && !self()->SkanpageConfiguration::isDefaultNameFilterIndexImmutable()) {
      self()->d->defaultNameFilterIndex = v;
      Q_EMIT self()->defaultNameFilterIndexChanged();
    }
}

int SkanpageConfiguration::defaultNameFilterIndex()
{
  return self()->d->defaultNameFilterIndex;
}

bool  SkanpageConfiguration::isDefaultNameFilterIndexImmutable()
{
    return self()->isImmutable( QStringLiteral( "defaultNameFilterIndex" ) );
}


void SkanpageConfiguration::setDefaultFolder( const QUrl & v )
{
    if (v != self()->d->defaultFolder && !self()->SkanpageConfiguration::isDefaultFolderImmutable()) {
      self()->d->defaultFolder = v;
      Q_EMIT self()->defaultFolderChanged();
    }
}

QUrl SkanpageConfiguration::defaultFolder()
{
  return self()->d->defaultFolder;
}

bool  SkanpageConfiguration::isDefaultFolderImmutable()
{
    return self()->isImmutable( QStringLiteral( "defaultFolder" ) );
}


void SkanpageConfiguration::setShowAllDevices( bool v )
{
    if (v != self()->d->showAllDevices && !self()->SkanpageConfiguration::isShowAllDevicesImmutable()) {
      self()->d->showAllDevices = v;
      Q_EMIT self()->showAllDevicesChanged();
    }
}

bool SkanpageConfiguration::showAllDevices()
{
  return self()->d->showAllDevices;
}

bool  SkanpageConfiguration::isShowAllDevicesImmutable()
{
    return self()->isImmutable( QStringLiteral( "showAllDevices" ) );
}


void SkanpageConfiguration::setNameTemplate( const QString & v )
{
    if (v != self()->d->nameTemplate && !self()->SkanpageConfiguration::isNameTemplateImmutable()) {
      self()->d->nameTemplate = v;
      Q_EMIT self()->nameTemplateChanged();
    }
}

QString SkanpageConfiguration::nameTemplate()
{
  return self()->d->nameTemplate;
}

bool  SkanpageConfiguration::isNameTemplateImmutable()
{
    return self()->isImmutable( QStringLiteral( "nameTemplate" ) );
}


SkanpageConfiguration::~SkanpageConfiguration()
{
  delete d;
  if (s_globalSkanpageConfiguration.exists() && !s_globalSkanpageConfiguration.isDestroyed()) {
    s_globalSkanpageConfiguration()->q = nullptr;
  }
}


void SkanpageConfiguration::itemChanged(quint64 signalFlag) {

  switch (signalFlag) {
  case signalDefaultNameFilterIndexChanged:
    Q_EMIT defaultNameFilterIndexChanged();
    break;
  case signalDefaultFolderChanged:
    Q_EMIT defaultFolderChanged();
    break;
  case signalShowAllDevicesChanged:
    Q_EMIT showAllDevicesChanged();
    break;
  case signalNameTemplateChanged:
    Q_EMIT nameTemplateChanged();
    break;
  }
}
