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

#include "playlistsettings.h"

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

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

  return s_globalPlaylistSettings()->q;
}

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

PlaylistSettings::PlaylistSettings( QObject *parent )
  : KConfigSkeleton( QStringLiteral( "haruna/haruna.conf" ) )
{
  setParent(parent);
  Q_ASSERT(!s_globalPlaylistSettings()->q);
  s_globalPlaylistSettings()->q = this;
  KConfigCompilerSignallingItem::NotifyFunction notifyFunction = static_cast<KConfigCompilerSignallingItem::NotifyFunction>(&PlaylistSettings::itemChanged);

  setCurrentGroup( QStringLiteral( "Playlist" ) );

  KConfigCompilerSignallingItem  *itemPosition;
  KConfigSkeleton::ItemString  *innerItemPosition;
  innerItemPosition = new KConfigSkeleton::ItemString( currentGroup(), QStringLiteral( "Position" ), mPosition, QStringLiteral( "right" ) );
  itemPosition = new KConfigCompilerSignallingItem(innerItemPosition, this, notifyFunction, signalPositionChanged);
  addItem( itemPosition, QStringLiteral( "Position" ) );
  KConfigCompilerSignallingItem  *itemStyle;
  KConfigSkeleton::ItemString  *innerItemStyle;
  innerItemStyle = new KConfigSkeleton::ItemString( currentGroup(), QStringLiteral( "Style" ), mStyle, QStringLiteral( "default" ) );
  itemStyle = new KConfigCompilerSignallingItem(innerItemStyle, this, notifyFunction, signalStyleChanged);
  addItem( itemStyle, QStringLiteral( "Style" ) );
  KConfigCompilerSignallingItem  *itemPlaybackBehavior;
  KConfigSkeleton::ItemString  *innerItemPlaybackBehavior;
  innerItemPlaybackBehavior = new KConfigSkeleton::ItemString( currentGroup(), QStringLiteral( "PlaybackBehavior" ), mPlaybackBehavior, QStringLiteral( "RepeatPlaylist" ) );
  itemPlaybackBehavior = new KConfigCompilerSignallingItem(innerItemPlaybackBehavior, this, notifyFunction, signalPlaybackBehaviorChanged);
  addItem( itemPlaybackBehavior, QStringLiteral( "PlaybackBehavior" ) );
  KConfigCompilerSignallingItem  *itemRandomPlayback;
  KConfigSkeleton::ItemBool  *innerItemRandomPlayback;
  innerItemRandomPlayback = new KConfigSkeleton::ItemBool( currentGroup(), QStringLiteral( "RandomPlayback" ), mRandomPlayback, false );
  itemRandomPlayback = new KConfigCompilerSignallingItem(innerItemRandomPlayback, this, notifyFunction, signalRandomPlaybackChanged);
  addItem( itemRandomPlayback, QStringLiteral( "RandomPlayback" ) );
  KConfigCompilerSignallingItem  *itemOverlayVideo;
  KConfigSkeleton::ItemBool  *innerItemOverlayVideo;
  innerItemOverlayVideo = new KConfigSkeleton::ItemBool( currentGroup(), QStringLiteral( "OverlayVideo" ), mOverlayVideo, true );
  itemOverlayVideo = new KConfigCompilerSignallingItem(innerItemOverlayVideo, this, notifyFunction, signalOverlayVideoChanged);
  addItem( itemOverlayVideo, QStringLiteral( "OverlayVideo" ) );
  KConfigCompilerSignallingItem  *itemShowThumbnails;
  KConfigSkeleton::ItemBool  *innerItemShowThumbnails;
  innerItemShowThumbnails = new KConfigSkeleton::ItemBool( currentGroup(), QStringLiteral( "ShowThumbnails" ), mShowThumbnails, false );
  itemShowThumbnails = new KConfigCompilerSignallingItem(innerItemShowThumbnails, this, notifyFunction, signalShowThumbnailsChanged);
  addItem( itemShowThumbnails, QStringLiteral( "ShowThumbnails" ) );
  KConfigCompilerSignallingItem  *itemShowMediaTitle;
  KConfigSkeleton::ItemBool  *innerItemShowMediaTitle;
  innerItemShowMediaTitle = new KConfigSkeleton::ItemBool( currentGroup(), QStringLiteral( "ShowMediaTitle" ), mShowMediaTitle, true );
  itemShowMediaTitle = new KConfigCompilerSignallingItem(innerItemShowMediaTitle, this, notifyFunction, signalShowMediaTitleChanged);
  addItem( itemShowMediaTitle, QStringLiteral( "ShowMediaTitle" ) );
  KConfigCompilerSignallingItem  *itemLoadSiblings;
  KConfigSkeleton::ItemBool  *innerItemLoadSiblings;
  innerItemLoadSiblings = new KConfigSkeleton::ItemBool( currentGroup(), QStringLiteral( "LoadSiblings" ), mLoadSiblings, true );
  itemLoadSiblings = new KConfigCompilerSignallingItem(innerItemLoadSiblings, this, notifyFunction, signalLoadSiblingsChanged);
  addItem( itemLoadSiblings, QStringLiteral( "LoadSiblings" ) );
  KConfigCompilerSignallingItem  *itemShowRowNumber;
  KConfigSkeleton::ItemBool  *innerItemShowRowNumber;
  innerItemShowRowNumber = new KConfigSkeleton::ItemBool( currentGroup(), QStringLiteral( "ShowRowNumber" ), mShowRowNumber, true );
  itemShowRowNumber = new KConfigCompilerSignallingItem(innerItemShowRowNumber, this, notifyFunction, signalShowRowNumberChanged);
  addItem( itemShowRowNumber, QStringLiteral( "ShowRowNumber" ) );
  KConfigCompilerSignallingItem  *itemCanToggleWithMouse;
  KConfigSkeleton::ItemBool  *innerItemCanToggleWithMouse;
  innerItemCanToggleWithMouse = new KConfigSkeleton::ItemBool( currentGroup(), QStringLiteral( "CanToggleWithMouse" ), mCanToggleWithMouse, true );
  itemCanToggleWithMouse = new KConfigCompilerSignallingItem(innerItemCanToggleWithMouse, this, notifyFunction, signalCanToggleWithMouseChanged);
  addItem( itemCanToggleWithMouse, QStringLiteral( "CanToggleWithMouse" ) );
  KConfigCompilerSignallingItem  *itemBigFontFullscreen;
  KConfigSkeleton::ItemBool  *innerItemBigFontFullscreen;
  innerItemBigFontFullscreen = new KConfigSkeleton::ItemBool( currentGroup(), QStringLiteral( "BigFontFullscreen" ), mBigFontFullscreen, true );
  itemBigFontFullscreen = new KConfigCompilerSignallingItem(innerItemBigFontFullscreen, this, notifyFunction, signalBigFontFullscreenChanged);
  addItem( itemBigFontFullscreen, QStringLiteral( "BigFontFullscreen" ) );
  KConfigCompilerSignallingItem  *itemRememberState;
  KConfigSkeleton::ItemBool  *innerItemRememberState;
  innerItemRememberState = new KConfigSkeleton::ItemBool( currentGroup(), QStringLiteral( "RememberState" ), mRememberState, false );
  itemRememberState = new KConfigCompilerSignallingItem(innerItemRememberState, this, notifyFunction, signalRememberStateChanged);
  addItem( itemRememberState, QStringLiteral( "RememberState" ) );
  KConfigCompilerSignallingItem  *itemVisible;
  KConfigSkeleton::ItemBool  *innerItemVisible;
  innerItemVisible = new KConfigSkeleton::ItemBool( currentGroup(), QStringLiteral( "Visible" ), mVisible, false );
  itemVisible = new KConfigCompilerSignallingItem(innerItemVisible, this, notifyFunction, signalVisibleChanged);
  addItem( itemVisible, QStringLiteral( "Visible" ) );
  KConfigCompilerSignallingItem  *itemShowToolbar;
  KConfigSkeleton::ItemBool  *innerItemShowToolbar;
  innerItemShowToolbar = new KConfigSkeleton::ItemBool( currentGroup(), QStringLiteral( "ShowToolbar" ), mShowToolbar, true );
  itemShowToolbar = new KConfigCompilerSignallingItem(innerItemShowToolbar, this, notifyFunction, signalShowToolbarChanged);
  addItem( itemShowToolbar, QStringLiteral( "ShowToolbar" ) );
  KConfigCompilerSignallingItem  *itemOpenWithSingleClick;
  KConfigSkeleton::ItemBool  *innerItemOpenWithSingleClick;
  innerItemOpenWithSingleClick = new KConfigSkeleton::ItemBool( currentGroup(), QStringLiteral( "OpenWithSingleClick" ), mOpenWithSingleClick, false );
  itemOpenWithSingleClick = new KConfigCompilerSignallingItem(innerItemOpenWithSingleClick, this, notifyFunction, signalOpenWithSingleClickChanged);
  addItem( itemOpenWithSingleClick, QStringLiteral( "OpenWithSingleClick" ) );
  KConfigCompilerSignallingItem  *itemPlaylistWidth;
  KConfigSkeleton::ItemDouble  *innerItemPlaylistWidth;
  innerItemPlaylistWidth = new KConfigSkeleton::ItemDouble( currentGroup(), QStringLiteral( "PlaylistWidth" ), mPlaylistWidth, 450.0 );
  itemPlaylistWidth = new KConfigCompilerSignallingItem(innerItemPlaylistWidth, this, notifyFunction, signalPlaylistWidthChanged);
  addItem( itemPlaylistWidth, QStringLiteral( "PlaylistWidth" ) );
}

QString PlaylistSettings::defaultPositionValue_helper()
{

  return QStringLiteral( "right" );
}

QString PlaylistSettings::defaultStyleValue_helper()
{

  return QStringLiteral( "default" );
}

QString PlaylistSettings::defaultPlaybackBehaviorValue_helper()
{

  return QStringLiteral( "RepeatPlaylist" );
}

bool PlaylistSettings::defaultRandomPlaybackValue_helper()
{

  return false;
}

bool PlaylistSettings::defaultOverlayVideoValue_helper()
{

  return true;
}

bool PlaylistSettings::defaultShowThumbnailsValue_helper()
{

  return false;
}

bool PlaylistSettings::defaultShowMediaTitleValue_helper()
{

  return true;
}

bool PlaylistSettings::defaultLoadSiblingsValue_helper()
{

  return true;
}

bool PlaylistSettings::defaultShowRowNumberValue_helper()
{

  return true;
}

bool PlaylistSettings::defaultCanToggleWithMouseValue_helper()
{

  return true;
}

bool PlaylistSettings::defaultBigFontFullscreenValue_helper()
{

  return true;
}

bool PlaylistSettings::defaultRememberStateValue_helper()
{

  return false;
}

bool PlaylistSettings::defaultVisibleValue_helper()
{

  return false;
}

bool PlaylistSettings::defaultShowToolbarValue_helper()
{

  return true;
}

bool PlaylistSettings::defaultOpenWithSingleClickValue_helper()
{

  return false;
}

double PlaylistSettings::defaultPlaylistWidthValue_helper()
{

  return 450.0;
}

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


void PlaylistSettings::itemChanged(quint64 signalFlag) {

  switch (signalFlag) {
  case signalPositionChanged:
    Q_EMIT PositionChanged();
    break;
  case signalStyleChanged:
    Q_EMIT StyleChanged();
    break;
  case signalPlaybackBehaviorChanged:
    Q_EMIT PlaybackBehaviorChanged();
    break;
  case signalRandomPlaybackChanged:
    Q_EMIT RandomPlaybackChanged();
    break;
  case signalOverlayVideoChanged:
    Q_EMIT OverlayVideoChanged();
    break;
  case signalShowThumbnailsChanged:
    Q_EMIT ShowThumbnailsChanged();
    break;
  case signalShowMediaTitleChanged:
    Q_EMIT ShowMediaTitleChanged();
    break;
  case signalLoadSiblingsChanged:
    Q_EMIT LoadSiblingsChanged();
    break;
  case signalShowRowNumberChanged:
    Q_EMIT ShowRowNumberChanged();
    break;
  case signalCanToggleWithMouseChanged:
    Q_EMIT CanToggleWithMouseChanged();
    break;
  case signalBigFontFullscreenChanged:
    Q_EMIT BigFontFullscreenChanged();
    break;
  case signalRememberStateChanged:
    Q_EMIT RememberStateChanged();
    break;
  case signalVisibleChanged:
    Q_EMIT VisibleChanged();
    break;
  case signalShowToolbarChanged:
    Q_EMIT ShowToolbarChanged();
    break;
  case signalOpenWithSingleClickChanged:
    Q_EMIT OpenWithSingleClickChanged();
    break;
  case signalPlaylistWidthChanged:
    Q_EMIT PlaylistWidthChanged();
    break;
  }
}
