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

#include "generalsettings.h"

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

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

  return s_globalGeneralSettings()->q;
}

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

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

  setCurrentGroup( QStringLiteral( "General" ) );

  KConfigCompilerSignallingItem  *itemOsdFontSize;
  KConfigSkeleton::ItemInt  *innerItemOsdFontSize;
  innerItemOsdFontSize = new KConfigSkeleton::ItemInt( currentGroup(), QStringLiteral( "OsdFontSize" ), mOsdFontSize, 25 );
  itemOsdFontSize = new KConfigCompilerSignallingItem(innerItemOsdFontSize, this, notifyFunction, signalOsdFontSizeChanged);
  addItem( itemOsdFontSize, QStringLiteral( "OsdFontSize" ) );
  KConfigCompilerSignallingItem  *itemShowMenuBar;
  KConfigSkeleton::ItemBool  *innerItemShowMenuBar;
  innerItemShowMenuBar = new KConfigSkeleton::ItemBool( currentGroup(), QStringLiteral( "ShowMenuBar" ), mShowMenuBar, true );
  itemShowMenuBar = new KConfigCompilerSignallingItem(innerItemShowMenuBar, this, notifyFunction, signalShowMenuBarChanged);
  addItem( itemShowMenuBar, QStringLiteral( "ShowMenuBar" ) );
  KConfigCompilerSignallingItem  *itemShowHeader;
  KConfigSkeleton::ItemBool  *innerItemShowHeader;
  innerItemShowHeader = new KConfigSkeleton::ItemBool( currentGroup(), QStringLiteral( "ShowHeader" ), mShowHeader, true );
  itemShowHeader = new KConfigCompilerSignallingItem(innerItemShowHeader, this, notifyFunction, signalShowHeaderChanged);
  addItem( itemShowHeader, QStringLiteral( "ShowHeader" ) );
  KConfigCompilerSignallingItem  *itemShowChapterMarkers;
  KConfigSkeleton::ItemBool  *innerItemShowChapterMarkers;
  innerItemShowChapterMarkers = new KConfigSkeleton::ItemBool( currentGroup(), QStringLiteral( "ShowChapterMarkers" ), mShowChapterMarkers, true );
  itemShowChapterMarkers = new KConfigCompilerSignallingItem(innerItemShowChapterMarkers, this, notifyFunction, signalShowChapterMarkersChanged);
  addItem( itemShowChapterMarkers, QStringLiteral( "ShowChapterMarkers" ) );
  KConfigCompilerSignallingItem  *itemColorScheme;
  KConfigSkeleton::ItemString  *innerItemColorScheme;
  innerItemColorScheme = new KConfigSkeleton::ItemString( currentGroup(), QStringLiteral( "ColorScheme" ), mColorScheme );
  itemColorScheme = new KConfigCompilerSignallingItem(innerItemColorScheme, this, notifyFunction, signalColorSchemeChanged);
  addItem( itemColorScheme, QStringLiteral( "ColorScheme" ) );
  KConfigCompilerSignallingItem  *itemGuiStyle;
  KConfigSkeleton::ItemString  *innerItemGuiStyle;
  innerItemGuiStyle = new KConfigSkeleton::ItemString( currentGroup(), QStringLiteral( "GuiStyle" ), mGuiStyle, QStringLiteral( "Default" ) );
  itemGuiStyle = new KConfigCompilerSignallingItem(innerItemGuiStyle, this, notifyFunction, signalGuiStyleChanged);
  addItem( itemGuiStyle, QStringLiteral( "GuiStyle" ) );
  KConfigCompilerSignallingItem  *itemLastPlayedFile;
  KConfigSkeleton::ItemString  *innerItemLastPlayedFile;
  innerItemLastPlayedFile = new KConfigSkeleton::ItemString( currentGroup(), QStringLiteral( "LastPlayedFile" ), mLastPlayedFile );
  itemLastPlayedFile = new KConfigCompilerSignallingItem(innerItemLastPlayedFile, this, notifyFunction, signalLastPlayedFileChanged);
  addItem( itemLastPlayedFile, QStringLiteral( "LastPlayedFile" ) );
  KConfigCompilerSignallingItem  *itemLastPlaylist;
  KConfigSkeleton::ItemString  *innerItemLastPlaylist;
  innerItemLastPlaylist = new KConfigSkeleton::ItemString( currentGroup(), QStringLiteral( "LastPlaylist" ), mLastPlaylist );
  itemLastPlaylist = new KConfigCompilerSignallingItem(innerItemLastPlaylist, this, notifyFunction, signalLastPlaylistChanged);
  addItem( itemLastPlaylist, QStringLiteral( "LastPlaylist" ) );

        QString videoFolder = QStandardPaths::writableLocation(QStandardPaths::MoviesLocation);
      
  KConfigCompilerSignallingItem  *itemFileDialogLastLocation;
  KConfigSkeleton::ItemString  *innerItemFileDialogLastLocation;
  innerItemFileDialogLastLocation = new KConfigSkeleton::ItemString( currentGroup(), QStringLiteral( "FileDialogLastLocation" ), mFileDialogLastLocation, videoFolder );
  itemFileDialogLastLocation = new KConfigCompilerSignallingItem(innerItemFileDialogLastLocation, this, notifyFunction, signalFileDialogLastLocationChanged);
  addItem( itemFileDialogLastLocation, QStringLiteral( "FileDialogLastLocation" ) );
  KConfigCompilerSignallingItem  *itemLastUrl;
  KConfigSkeleton::ItemString  *innerItemLastUrl;
  innerItemLastUrl = new KConfigSkeleton::ItemString( currentGroup(), QStringLiteral( "LastUrl" ), mLastUrl );
  itemLastUrl = new KConfigCompilerSignallingItem(innerItemLastUrl, this, notifyFunction, signalLastUrlChanged);
  addItem( itemLastUrl, QStringLiteral( "LastUrl" ) );
  KConfigCompilerSignallingItem  *itemMaxRecentFiles;
  KConfigSkeleton::ItemInt  *innerItemMaxRecentFiles;
  innerItemMaxRecentFiles = new KConfigSkeleton::ItemInt( currentGroup(), QStringLiteral( "MaxRecentFiles" ), mMaxRecentFiles, 10 );
  itemMaxRecentFiles = new KConfigCompilerSignallingItem(innerItemMaxRecentFiles, this, notifyFunction, signalMaxRecentFilesChanged);
  addItem( itemMaxRecentFiles, QStringLiteral( "MaxRecentFiles" ) );
  KConfigCompilerSignallingItem  *itemRememberWindowGeometry;
  KConfigSkeleton::ItemBool  *innerItemRememberWindowGeometry;
  innerItemRememberWindowGeometry = new KConfigSkeleton::ItemBool( currentGroup(), QStringLiteral( "RememberWindowGeometry" ), mRememberWindowGeometry, false );
  itemRememberWindowGeometry = new KConfigCompilerSignallingItem(innerItemRememberWindowGeometry, this, notifyFunction, signalRememberWindowGeometryChanged);
  addItem( itemRememberWindowGeometry, QStringLiteral( "RememberWindowGeometry" ) );
  KConfigCompilerSignallingItem  *itemShowPreviewThumbnail;
  KConfigSkeleton::ItemBool  *innerItemShowPreviewThumbnail;
  innerItemShowPreviewThumbnail = new KConfigSkeleton::ItemBool( currentGroup(), QStringLiteral( "ShowPreviewThumbnail" ), mShowPreviewThumbnail, false );
  itemShowPreviewThumbnail = new KConfigCompilerSignallingItem(innerItemShowPreviewThumbnail, this, notifyFunction, signalShowPreviewThumbnailChanged);
  addItem( itemShowPreviewThumbnail, QStringLiteral( "ShowPreviewThumbnail" ) );
  KConfigCompilerSignallingItem  *itemAccuratePreviewThumbnail;
  KConfigSkeleton::ItemBool  *innerItemAccuratePreviewThumbnail;
  innerItemAccuratePreviewThumbnail = new KConfigSkeleton::ItemBool( currentGroup(), QStringLiteral( "AccuratePreviewThumbnail" ), mAccuratePreviewThumbnail, false );
  itemAccuratePreviewThumbnail = new KConfigCompilerSignallingItem(innerItemAccuratePreviewThumbnail, this, notifyFunction, signalAccuratePreviewThumbnailChanged);
  addItem( itemAccuratePreviewThumbnail, QStringLiteral( "AccuratePreviewThumbnail" ) );
  KConfigCompilerSignallingItem  *itemPreviewThumbnailWidth;
  KConfigSkeleton::ItemInt  *innerItemPreviewThumbnailWidth;
  innerItemPreviewThumbnailWidth = new KConfigSkeleton::ItemInt( currentGroup(), QStringLiteral( "PreviewThumbnailWidth" ), mPreviewThumbnailWidth, 200 );
  itemPreviewThumbnailWidth = new KConfigCompilerSignallingItem(innerItemPreviewThumbnailWidth, this, notifyFunction, signalPreviewThumbnailWidthChanged);
  addItem( itemPreviewThumbnailWidth, QStringLiteral( "PreviewThumbnailWidth" ) );
  KConfigCompilerSignallingItem  *itemResizeWindowToVideo;
  KConfigSkeleton::ItemBool  *innerItemResizeWindowToVideo;
  innerItemResizeWindowToVideo = new KConfigSkeleton::ItemBool( currentGroup(), QStringLiteral( "ResizeWindowToVideo" ), mResizeWindowToVideo, false );
  itemResizeWindowToVideo = new KConfigCompilerSignallingItem(innerItemResizeWindowToVideo, this, notifyFunction, signalResizeWindowToVideoChanged);
  addItem( itemResizeWindowToVideo, QStringLiteral( "ResizeWindowToVideo" ) );
  KConfigCompilerSignallingItem  *itemFullscreenOnStartUp;
  KConfigSkeleton::ItemBool  *innerItemFullscreenOnStartUp;
  innerItemFullscreenOnStartUp = new KConfigSkeleton::ItemBool( currentGroup(), QStringLiteral( "FullscreenOnStartUp" ), mFullscreenOnStartUp, false );
  itemFullscreenOnStartUp = new KConfigCompilerSignallingItem(innerItemFullscreenOnStartUp, this, notifyFunction, signalFullscreenOnStartUpChanged);
  addItem( itemFullscreenOnStartUp, QStringLiteral( "FullscreenOnStartUp" ) );
  KConfigCompilerSignallingItem  *itemUseSingleInstance;
  KConfigSkeleton::ItemBool  *innerItemUseSingleInstance;
  innerItemUseSingleInstance = new KConfigSkeleton::ItemBool( currentGroup(), QStringLiteral( "UseSingleInstance" ), mUseSingleInstance, false );
  itemUseSingleInstance = new KConfigCompilerSignallingItem(innerItemUseSingleInstance, this, notifyFunction, signalUseSingleInstanceChanged);
  addItem( itemUseSingleInstance, QStringLiteral( "UseSingleInstance" ) );
  KConfigCompilerSignallingItem  *itemAppendVideoToSingleInstance;
  KConfigSkeleton::ItemBool  *innerItemAppendVideoToSingleInstance;
  innerItemAppendVideoToSingleInstance = new KConfigSkeleton::ItemBool( currentGroup(), QStringLiteral( "AppendVideoToSingleInstance" ), mAppendVideoToSingleInstance, false );
  itemAppendVideoToSingleInstance = new KConfigCompilerSignallingItem(innerItemAppendVideoToSingleInstance, this, notifyFunction, signalAppendVideoToSingleInstanceChanged);
  addItem( itemAppendVideoToSingleInstance, QStringLiteral( "AppendVideoToSingleInstance" ) );
  KConfigCompilerSignallingItem  *itemPlayNewFileInSingleInstance;
  KConfigSkeleton::ItemBool  *innerItemPlayNewFileInSingleInstance;
  innerItemPlayNewFileInSingleInstance = new KConfigSkeleton::ItemBool( currentGroup(), QStringLiteral( "PlayNewFileInSingleInstance" ), mPlayNewFileInSingleInstance, false );
  itemPlayNewFileInSingleInstance = new KConfigCompilerSignallingItem(innerItemPlayNewFileInSingleInstance, this, notifyFunction, signalPlayNewFileInSingleInstanceChanged);
  addItem( itemPlayNewFileInSingleInstance, QStringLiteral( "PlayNewFileInSingleInstance" ) );
  KConfigCompilerSignallingItem  *itemFooterStyle;
  KConfigSkeleton::ItemString  *innerItemFooterStyle;
  innerItemFooterStyle = new KConfigSkeleton::ItemString( currentGroup(), QStringLiteral( "FooterStyle" ), mFooterStyle, QStringLiteral( "default" ) );
  itemFooterStyle = new KConfigCompilerSignallingItem(innerItemFooterStyle, this, notifyFunction, signalFooterStyleChanged);
  addItem( itemFooterStyle, QStringLiteral( "FooterStyle" ) );
  KConfigCompilerSignallingItem  *itemFloatingFooterTrigger;
  KConfigSkeleton::ItemString  *innerItemFloatingFooterTrigger;
  innerItemFloatingFooterTrigger = new KConfigSkeleton::ItemString( currentGroup(), QStringLiteral( "FloatingFooterTrigger" ), mFloatingFooterTrigger, QStringLiteral( "EveryMouseMovement" ) );
  itemFloatingFooterTrigger = new KConfigCompilerSignallingItem(innerItemFloatingFooterTrigger, this, notifyFunction, signalFloatingFooterTriggerChanged);
  addItem( itemFloatingFooterTrigger, QStringLiteral( "FloatingFooterTrigger" ) );
  KConfigCompilerSignallingItem  *itemShowTaskbarProgress;
  KConfigSkeleton::ItemBool  *innerItemShowTaskbarProgress;
  innerItemShowTaskbarProgress = new KConfigSkeleton::ItemBool( currentGroup(), QStringLiteral( "ShowTaskbarProgress" ), mShowTaskbarProgress, false );
  itemShowTaskbarProgress = new KConfigCompilerSignallingItem(innerItemShowTaskbarProgress, this, notifyFunction, signalShowTaskbarProgressChanged);
  addItem( itemShowTaskbarProgress, QStringLiteral( "ShowTaskbarProgress" ) );
}

int GeneralSettings::defaultOsdFontSizeValue_helper()
{

  return 25;
}

bool GeneralSettings::defaultShowMenuBarValue_helper()
{

  return true;
}

bool GeneralSettings::defaultShowHeaderValue_helper()
{

  return true;
}

bool GeneralSettings::defaultShowChapterMarkersValue_helper()
{

  return true;
}

QString GeneralSettings::defaultGuiStyleValue_helper()
{

  return QStringLiteral( "Default" );
}

QString GeneralSettings::defaultFileDialogLastLocationValue_helper()
{

        QString videoFolder = QStandardPaths::writableLocation(QStandardPaths::MoviesLocation);
      
  return videoFolder;
}

int GeneralSettings::defaultMaxRecentFilesValue_helper()
{

  return 10;
}

bool GeneralSettings::defaultRememberWindowGeometryValue_helper()
{

  return false;
}

bool GeneralSettings::defaultShowPreviewThumbnailValue_helper()
{

  return false;
}

bool GeneralSettings::defaultAccuratePreviewThumbnailValue_helper()
{

  return false;
}

int GeneralSettings::defaultPreviewThumbnailWidthValue_helper()
{

  return 200;
}

bool GeneralSettings::defaultResizeWindowToVideoValue_helper()
{

  return false;
}

bool GeneralSettings::defaultFullscreenOnStartUpValue_helper()
{

  return false;
}

bool GeneralSettings::defaultUseSingleInstanceValue_helper()
{

  return false;
}

bool GeneralSettings::defaultAppendVideoToSingleInstanceValue_helper()
{

  return false;
}

bool GeneralSettings::defaultPlayNewFileInSingleInstanceValue_helper()
{

  return false;
}

QString GeneralSettings::defaultFooterStyleValue_helper()
{

  return QStringLiteral( "default" );
}

QString GeneralSettings::defaultFloatingFooterTriggerValue_helper()
{

  return QStringLiteral( "EveryMouseMovement" );
}

bool GeneralSettings::defaultShowTaskbarProgressValue_helper()
{

  return false;
}

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


void GeneralSettings::itemChanged(quint64 signalFlag) {

  switch (signalFlag) {
  case signalOsdFontSizeChanged:
    Q_EMIT OsdFontSizeChanged();
    break;
  case signalShowMenuBarChanged:
    Q_EMIT ShowMenuBarChanged();
    break;
  case signalShowHeaderChanged:
    Q_EMIT ShowHeaderChanged();
    break;
  case signalShowChapterMarkersChanged:
    Q_EMIT ShowChapterMarkersChanged();
    break;
  case signalColorSchemeChanged:
    Q_EMIT ColorSchemeChanged();
    break;
  case signalGuiStyleChanged:
    Q_EMIT GuiStyleChanged();
    break;
  case signalLastPlayedFileChanged:
    Q_EMIT LastPlayedFileChanged();
    break;
  case signalLastPlaylistChanged:
    Q_EMIT LastPlaylistChanged();
    break;
  case signalFileDialogLastLocationChanged:
    Q_EMIT FileDialogLastLocationChanged();
    break;
  case signalLastUrlChanged:
    Q_EMIT LastUrlChanged();
    break;
  case signalMaxRecentFilesChanged:
    Q_EMIT MaxRecentFilesChanged();
    break;
  case signalRememberWindowGeometryChanged:
    Q_EMIT RememberWindowGeometryChanged();
    break;
  case signalShowPreviewThumbnailChanged:
    Q_EMIT ShowPreviewThumbnailChanged();
    break;
  case signalAccuratePreviewThumbnailChanged:
    Q_EMIT AccuratePreviewThumbnailChanged();
    break;
  case signalPreviewThumbnailWidthChanged:
    Q_EMIT PreviewThumbnailWidthChanged();
    break;
  case signalResizeWindowToVideoChanged:
    Q_EMIT ResizeWindowToVideoChanged();
    break;
  case signalFullscreenOnStartUpChanged:
    Q_EMIT FullscreenOnStartUpChanged();
    break;
  case signalUseSingleInstanceChanged:
    Q_EMIT UseSingleInstanceChanged();
    break;
  case signalAppendVideoToSingleInstanceChanged:
    Q_EMIT AppendVideoToSingleInstanceChanged();
    break;
  case signalPlayNewFileInSingleInstanceChanged:
    Q_EMIT PlayNewFileInSingleInstanceChanged();
    break;
  case signalFooterStyleChanged:
    Q_EMIT FooterStyleChanged();
    break;
  case signalFloatingFooterTriggerChanged:
    Q_EMIT FloatingFooterTriggerChanged();
    break;
  case signalShowTaskbarProgressChanged:
    Q_EMIT ShowTaskbarProgressChanged();
    break;
  }
}
