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

#include "kokoconfig.h"

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

class ConfigHelper
{
  public:
    ConfigHelper() noexcept : q(nullptr) {}
    ~ConfigHelper() noexcept { 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( )
  : KConfigSkeleton( QStringLiteral( "kokorc" ) )
{
  Q_ASSERT(!s_globalConfig()->q);
  s_globalConfig()->q = this;
  KConfigCompilerSignallingItem::NotifyFunction notifyFunction = static_cast<KConfigCompilerSignallingItem::NotifyFunction>(&Config::itemChanged);

  setCurrentGroup( QStringLiteral( "Backend" ) );

  KConfigCompilerSignallingItem  *itemInitialRun;
  KConfigSkeleton::ItemBool  *innerItemInitialRun;
  innerItemInitialRun = new KConfigSkeleton::ItemBool( currentGroup(), QStringLiteral( "InitialRun" ), mInitialRun, true );
  itemInitialRun = new KConfigCompilerSignallingItem(innerItemInitialRun, this, notifyFunction, signalInitialRunChanged);
  addItem( itemInitialRun, QStringLiteral( "InitialRun" ) );

  setCurrentGroup( QStringLiteral( "General" ) );

  KConfigCompilerSignallingItem  *itemIconSize;
  KConfigSkeleton::ItemInt  *innerItemIconSize;
  innerItemIconSize = new KConfigSkeleton::ItemInt( currentGroup(), QStringLiteral( "IconSize" ), mIconSize, 128 );
  itemIconSize = new KConfigCompilerSignallingItem(innerItemIconSize, this, notifyFunction, signalIconSizeChanged);
  innerItemIconSize->setMinValue(80);
  innerItemIconSize->setMaxValue(256);
  addItem( itemIconSize, QStringLiteral( "IconSize" ) );
  QList<KConfigSkeleton::ItemEnum::Choice> valuesSortBehavior;
  {
    KConfigSkeleton::ItemEnum::Choice choice;
    choice.name = QStringLiteral("Natural");
    valuesSortBehavior.append( choice );
  }
  {
    KConfigSkeleton::ItemEnum::Choice choice;
    choice.name = QStringLiteral("AlphabeticalCaseInsensitive");
    valuesSortBehavior.append( choice );
  }
  {
    KConfigSkeleton::ItemEnum::Choice choice;
    choice.name = QStringLiteral("AlphabeticalCaseSensitive");
    valuesSortBehavior.append( choice );
  }
  KConfigCompilerSignallingItem  *itemSortBehavior;
  KConfigSkeleton::ItemEnum  *innerItemSortBehavior;
  innerItemSortBehavior = new KConfigSkeleton::ItemEnum( currentGroup(), QStringLiteral( "SortBehavior" ), mSortBehavior, valuesSortBehavior, EnumSortBehavior::Natural );
  itemSortBehavior = new KConfigCompilerSignallingItem(innerItemSortBehavior, this, notifyFunction, signalSortBehaviorChanged);
  addItem( itemSortBehavior, QStringLiteral( "SortBehavior" ) );
  KConfigCompilerSignallingItem  *itemImageViewPreview;
  KConfigSkeleton::ItemBool  *innerItemImageViewPreview;
  innerItemImageViewPreview = new KConfigSkeleton::ItemBool( currentGroup(), QStringLiteral( "ImageViewPreview" ), mImageViewPreview, true );
  itemImageViewPreview = new KConfigCompilerSignallingItem(innerItemImageViewPreview, this, notifyFunction, signalImageViewPreviewChanged);
  addItem( itemImageViewPreview, QStringLiteral( "ImageViewPreview" ) );
  KConfigCompilerSignallingItem  *itemSavedFolders;
  KConfigSkeleton::ItemPathList  *innerItemSavedFolders;
  innerItemSavedFolders = new KConfigSkeleton::ItemPathList( currentGroup(), QStringLiteral( "SavedFolders" ), mSavedFolders );
  itemSavedFolders = new KConfigCompilerSignallingItem(innerItemSavedFolders, this, notifyFunction, signalSavedFoldersChanged);
  addItem( itemSavedFolders, QStringLiteral( "SavedFolders" ) );
  QList<KConfigSkeleton::ItemEnum::Choice> valuesImageViewBackgroundColor;
  {
    KConfigSkeleton::ItemEnum::Choice choice;
    choice.name = QStringLiteral("Black");
    valuesImageViewBackgroundColor.append( choice );
  }
  {
    KConfigSkeleton::ItemEnum::Choice choice;
    choice.name = QStringLiteral("White");
    valuesImageViewBackgroundColor.append( choice );
  }
  {
    KConfigSkeleton::ItemEnum::Choice choice;
    choice.name = QStringLiteral("Theme");
    valuesImageViewBackgroundColor.append( choice );
  }
  {
    KConfigSkeleton::ItemEnum::Choice choice;
    choice.name = QStringLiteral("Gray");
    valuesImageViewBackgroundColor.append( choice );
  }
  KConfigCompilerSignallingItem  *itemImageViewBackgroundColor;
  KConfigSkeleton::ItemEnum  *innerItemImageViewBackgroundColor;
  innerItemImageViewBackgroundColor = new KConfigSkeleton::ItemEnum( currentGroup(), QStringLiteral( "ImageViewBackgroundColor" ), mImageViewBackgroundColor, valuesImageViewBackgroundColor, EnumImageViewBackgroundColor::Black );
  itemImageViewBackgroundColor = new KConfigCompilerSignallingItem(innerItemImageViewBackgroundColor, this, notifyFunction, signalImageViewBackgroundColorChanged);
  addItem( itemImageViewBackgroundColor, QStringLiteral( "ImageViewBackgroundColor" ) );
  KConfigCompilerSignallingItem  *itemImageViewShowCheckerboard;
  KConfigSkeleton::ItemBool  *innerItemImageViewShowCheckerboard;
  innerItemImageViewShowCheckerboard = new KConfigSkeleton::ItemBool( currentGroup(), QStringLiteral( "ImageViewShowCheckerboard" ), mImageViewShowCheckerboard, true );
  itemImageViewShowCheckerboard = new KConfigCompilerSignallingItem(innerItemImageViewShowCheckerboard, this, notifyFunction, signalImageViewShowCheckerboardChanged);
  addItem( itemImageViewShowCheckerboard, QStringLiteral( "ImageViewShowCheckerboard" ) );
  KConfigCompilerSignallingItem  *itemEnlargeSmallImages;
  KConfigSkeleton::ItemBool  *innerItemEnlargeSmallImages;
  innerItemEnlargeSmallImages = new KConfigSkeleton::ItemBool( currentGroup(), QStringLiteral( "EnlargeSmallImages" ), mEnlargeSmallImages, false );
  itemEnlargeSmallImages = new KConfigCompilerSignallingItem(innerItemEnlargeSmallImages, this, notifyFunction, signalEnlargeSmallImagesChanged);
  addItem( itemEnlargeSmallImages, QStringLiteral( "EnlargeSmallImages" ) );
  KConfigCompilerSignallingItem  *itemRememberZoom;
  KConfigSkeleton::ItemBool  *innerItemRememberZoom;
  innerItemRememberZoom = new KConfigSkeleton::ItemBool( currentGroup(), QStringLiteral( "RememberZoom" ), mRememberZoom, false );
  itemRememberZoom = new KConfigCompilerSignallingItem(innerItemRememberZoom, this, notifyFunction, signalRememberZoomChanged);
  addItem( itemRememberZoom, QStringLiteral( "RememberZoom" ) );

  setCurrentGroup( QStringLiteral( "Slideshow" ) );

  KConfigCompilerSignallingItem  *itemNextImageInterval;
  KConfigSkeleton::ItemInt  *innerItemNextImageInterval;
  innerItemNextImageInterval = new KConfigSkeleton::ItemInt( currentGroup(), QStringLiteral( "NextImageInterval" ), mNextImageInterval, 5 );
  itemNextImageInterval = new KConfigCompilerSignallingItem(innerItemNextImageInterval, this, notifyFunction, signalNextImageIntervalChanged);
  addItem( itemNextImageInterval, QStringLiteral( "NextImageInterval" ) );
  KConfigCompilerSignallingItem  *itemLoopImages;
  KConfigSkeleton::ItemBool  *innerItemLoopImages;
  innerItemLoopImages = new KConfigSkeleton::ItemBool( currentGroup(), QStringLiteral( "LoopImages" ), mLoopImages, true );
  itemLoopImages = new KConfigCompilerSignallingItem(innerItemLoopImages, this, notifyFunction, signalLoopImagesChanged);
  addItem( itemLoopImages, QStringLiteral( "LoopImages" ) );
  KConfigCompilerSignallingItem  *itemRandomizeImages;
  KConfigSkeleton::ItemBool  *innerItemRandomizeImages;
  innerItemRandomizeImages = new KConfigSkeleton::ItemBool( currentGroup(), QStringLiteral( "RandomizeImages" ), mRandomizeImages, false );
  itemRandomizeImages = new KConfigCompilerSignallingItem(innerItemRandomizeImages, this, notifyFunction, signalRandomizeImagesChanged);
  addItem( itemRandomizeImages, QStringLiteral( "RandomizeImages" ) );

  setCurrentGroup( QStringLiteral( "WindowState" ) );

  QList<KConfigSkeleton::ItemEnum::Choice> valuesVisibility;
  {
    KConfigSkeleton::ItemEnum::Choice choice;
    choice.name = QStringLiteral("Hidden");
    valuesVisibility.append( choice );
  }
  {
    KConfigSkeleton::ItemEnum::Choice choice;
    choice.name = QStringLiteral("AutomaticVisibility");
    valuesVisibility.append( choice );
  }
  {
    KConfigSkeleton::ItemEnum::Choice choice;
    choice.name = QStringLiteral("Windowed");
    valuesVisibility.append( choice );
  }
  {
    KConfigSkeleton::ItemEnum::Choice choice;
    choice.name = QStringLiteral("Minimized");
    valuesVisibility.append( choice );
  }
  {
    KConfigSkeleton::ItemEnum::Choice choice;
    choice.name = QStringLiteral("Maximized");
    valuesVisibility.append( choice );
  }
  {
    KConfigSkeleton::ItemEnum::Choice choice;
    choice.name = QStringLiteral("FullScreen");
    valuesVisibility.append( choice );
  }
  KConfigCompilerSignallingItem  *itemVisibility;
  KConfigSkeleton::ItemEnum  *innerItemVisibility;
  innerItemVisibility = new KConfigSkeleton::ItemEnum( currentGroup(), QStringLiteral( "Visibility" ), mVisibility, valuesVisibility, QWindow::AutomaticVisibility );
  itemVisibility = new KConfigCompilerSignallingItem(innerItemVisibility, this, notifyFunction, signalVisibilityChanged);
  addItem( itemVisibility, QStringLiteral( "Visibility" ) );
  KConfigCompilerSignallingItem  *itemControlsVisible;
  KConfigSkeleton::ItemBool  *innerItemControlsVisible;
  innerItemControlsVisible = new KConfigSkeleton::ItemBool( currentGroup(), QStringLiteral( "ControlsVisible" ), mControlsVisible, true );
  itemControlsVisible = new KConfigCompilerSignallingItem(innerItemControlsVisible, this, notifyFunction, signalControlsVisibleChanged);
  addItem( itemControlsVisible, QStringLiteral( "ControlsVisible" ) );

  setCurrentGroup( QStringLiteral( "Metadata" ) );

  QStringList defaultMetadataToDisplay;
  defaultMetadataToDisplay.append( QString::fromUtf8( "General.Name" ) );
  defaultMetadataToDisplay.append( QString::fromUtf8( "General.Size" ) );
  defaultMetadataToDisplay.append( QString::fromUtf8( "General.ImageSize" ) );
  defaultMetadataToDisplay.append( QString::fromUtf8( "General.Created" ) );
  defaultMetadataToDisplay.append( QString::fromUtf8( "Exif.Image.Model" ) );
  defaultMetadataToDisplay.append( QString::fromUtf8( "General.Location" ) );

  KConfigCompilerSignallingItem  *itemMetadataToDisplay;
  KConfigSkeleton::ItemStringList  *innerItemMetadataToDisplay;
  innerItemMetadataToDisplay = new KConfigSkeleton::ItemStringList( currentGroup(), QStringLiteral( "MetadataToDisplay" ), mMetadataToDisplay, defaultMetadataToDisplay );
  itemMetadataToDisplay = new KConfigCompilerSignallingItem(innerItemMetadataToDisplay, this, notifyFunction, signalMetadataToDisplayChanged);
  addItem( itemMetadataToDisplay, QStringLiteral( "MetadataToDisplay" ) );
}

bool Config::defaultInitialRunValue_helper()
{

  return true;
}

int Config::defaultIconSizeValue_helper()
{

  return 128;
}

int Config::defaultSortBehaviorValue_helper()
{

  return EnumSortBehavior::Natural;
}

bool Config::defaultImageViewPreviewValue_helper()
{

  return true;
}

int Config::defaultImageViewBackgroundColorValue_helper()
{

  return EnumImageViewBackgroundColor::Black;
}

bool Config::defaultImageViewShowCheckerboardValue_helper()
{

  return true;
}

bool Config::defaultEnlargeSmallImagesValue_helper()
{

  return false;
}

bool Config::defaultRememberZoomValue_helper()
{

  return false;
}

int Config::defaultNextImageIntervalValue_helper()
{

  return 5;
}

bool Config::defaultLoopImagesValue_helper()
{

  return true;
}

bool Config::defaultRandomizeImagesValue_helper()
{

  return false;
}

int Config::defaultVisibilityValue_helper()
{

  return QWindow::AutomaticVisibility;
}

bool Config::defaultControlsVisibleValue_helper()
{

  return true;
}

QStringList Config::defaultMetadataToDisplayValue_helper()
{
  QStringList defaultMetadataToDisplay;
  defaultMetadataToDisplay.append( QString::fromUtf8( "General.Name" ) );
  defaultMetadataToDisplay.append( QString::fromUtf8( "General.Size" ) );
  defaultMetadataToDisplay.append( QString::fromUtf8( "General.ImageSize" ) );
  defaultMetadataToDisplay.append( QString::fromUtf8( "General.Created" ) );
  defaultMetadataToDisplay.append( QString::fromUtf8( "Exif.Image.Model" ) );
  defaultMetadataToDisplay.append( QString::fromUtf8( "General.Location" ) );

  return defaultMetadataToDisplay;
}

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


void Config::itemChanged(quint64 signalFlag) {

  switch (signalFlag) {
  case signalInitialRunChanged:
    Q_EMIT InitialRunChanged();
    break;
  case signalIconSizeChanged:
    Q_EMIT IconSizeChanged();
    break;
  case signalSortBehaviorChanged:
    Q_EMIT SortBehaviorChanged();
    break;
  case signalImageViewPreviewChanged:
    Q_EMIT ImageViewPreviewChanged();
    break;
  case signalSavedFoldersChanged:
    Q_EMIT SavedFoldersChanged();
    break;
  case signalImageViewBackgroundColorChanged:
    Q_EMIT ImageViewBackgroundColorChanged();
    break;
  case signalImageViewShowCheckerboardChanged:
    Q_EMIT ImageViewShowCheckerboardChanged();
    break;
  case signalEnlargeSmallImagesChanged:
    Q_EMIT EnlargeSmallImagesChanged();
    break;
  case signalRememberZoomChanged:
    Q_EMIT RememberZoomChanged();
    break;
  case signalNextImageIntervalChanged:
    Q_EMIT NextImageIntervalChanged();
    break;
  case signalLoopImagesChanged:
    Q_EMIT LoopImagesChanged();
    break;
  case signalRandomizeImagesChanged:
    Q_EMIT RandomizeImagesChanged();
    break;
  case signalVisibilityChanged:
    Q_EMIT VisibilityChanged();
    break;
  case signalControlsVisibleChanged:
    Q_EMIT ControlsVisibleChanged();
    break;
  case signalMetadataToDisplayChanged:
    Q_EMIT MetadataToDisplayChanged();
    break;
  }
}
