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

#include "drawyglobalconfig.h"

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

class DrawyGlobalConfigHelper
{
  public:
    DrawyGlobalConfigHelper() noexcept : q(nullptr) {}
    ~DrawyGlobalConfigHelper() noexcept { delete q; q = nullptr; }
    DrawyGlobalConfigHelper(const DrawyGlobalConfigHelper&) = delete;
    DrawyGlobalConfigHelper& operator=(const DrawyGlobalConfigHelper&) = delete;
    DrawyGlobalConfig *q;
};
Q_GLOBAL_STATIC(DrawyGlobalConfigHelper, s_globalDrawyGlobalConfig)
DrawyGlobalConfig *DrawyGlobalConfig::self()
{
  if (!s_globalDrawyGlobalConfig()->q) {
    new DrawyGlobalConfig;
    s_globalDrawyGlobalConfig()->q->read();
  }

  return s_globalDrawyGlobalConfig()->q;
}

DrawyGlobalConfig::DrawyGlobalConfig( )
  : KConfigSkeleton()
{
  Q_ASSERT(!s_globalDrawyGlobalConfig()->q);
  s_globalDrawyGlobalConfig()->q = this;
  setCurrentGroup( QStringLiteral( "Properties" ) );

  mStrokeWidthItem = new KConfigSkeleton::ItemInt( currentGroup(), QStringLiteral( "StrokeWidth" ), mStrokeWidth, 6 );
  addItem( mStrokeWidthItem, QStringLiteral( "StrokeWidth" ) );
  mFontSizeItem = new KConfigSkeleton::ItemInt( currentGroup(), QStringLiteral( "FontSize" ), mFontSize, 24 );
  addItem( mFontSizeItem, QStringLiteral( "FontSize" ) );
  mEraserSizeItem = new KConfigSkeleton::ItemInt( currentGroup(), QStringLiteral( "EraserSize" ), mEraserSize, 30 );
  addItem( mEraserSizeItem, QStringLiteral( "EraserSize" ) );

  setCurrentGroup( QStringLiteral( "AutoSave" ) );

  mDelayItem = new KConfigSkeleton::ItemInt( currentGroup(), QStringLiteral( "Delay" ), mDelay, 1 );
  addItem( mDelayItem, QStringLiteral( "Delay" ) );
  mPathItem = new KConfigSkeleton::ItemPath( currentGroup(), QStringLiteral( "Path" ), mPath, QStandardPaths::writableLocation(QStandardPaths::CacheLocation) + QStringLiteral("/drawy.autosave") );
  addItem( mPathItem, QStringLiteral( "Path" ) );
  mAutoSaveEnabledItem = new KConfigSkeleton::ItemBool( currentGroup(), QStringLiteral( "AutoSaveEnabled" ), mAutoSaveEnabled, true );
  addItem( mAutoSaveEnabledItem, QStringLiteral( "AutoSaveEnabled" ) );

  setCurrentGroup( QStringLiteral( "PowerManager" ) );

  mEnabledInFullScreenItem = new KConfigSkeleton::ItemBool( currentGroup(), QStringLiteral( "EnabledInFullScreen" ), mEnabledInFullScreen, false );
  addItem( mEnabledInFullScreenItem, QStringLiteral( "EnabledInFullScreen" ) );

  setCurrentGroup( QStringLiteral( "Freehand" ) );

  mStreamlineItem = new KConfigSkeleton::ItemDouble( currentGroup(), QStringLiteral( "Streamline" ), mStreamline, 0.5 );
  addItem( mStreamlineItem, QStringLiteral( "Streamline" ) );
  mThinningItem = new KConfigSkeleton::ItemDouble( currentGroup(), QStringLiteral( "Thinning" ), mThinning, 0.5 );
  addItem( mThinningItem, QStringLiteral( "Thinning" ) );
  mSmoothingItem = new KConfigSkeleton::ItemDouble( currentGroup(), QStringLiteral( "Smoothing" ), mSmoothing, 0.5 );
  addItem( mSmoothingItem, QStringLiteral( "Smoothing" ) );

  setCurrentGroup( QStringLiteral( "Canvas" ) );

  mBackgroundColorLightItem = new KConfigSkeleton::ItemColor( currentGroup(), QStringLiteral( "BackgroundColorLight" ), mBackgroundColorLight, QColor( "#f8f9fa" ) );
  addItem( mBackgroundColorLightItem, QStringLiteral( "BackgroundColorLight" ) );
  mBackgroundColorDarkItem = new KConfigSkeleton::ItemColor( currentGroup(), QStringLiteral( "BackgroundColorDark" ), mBackgroundColorDark, QColor( "#121212" ) );
  addItem( mBackgroundColorDarkItem, QStringLiteral( "BackgroundColorDark" ) );

  setCurrentGroup( QStringLiteral( "Palette" ) );

  mForegroundColorLightItem = new KConfigSkeleton::ItemColor( currentGroup(), QStringLiteral( "ForegroundColorLight" ), mForegroundColorLight, QColor( "#2B2F36" ) );
  addItem( mForegroundColorLightItem, QStringLiteral( "ForegroundColorLight" ) );
  mForegroundColorDarkItem = new KConfigSkeleton::ItemColor( currentGroup(), QStringLiteral( "ForegroundColorDark" ), mForegroundColorDark, QColor( "#F5F6F8" ) );
  addItem( mForegroundColorDarkItem, QStringLiteral( "ForegroundColorDark" ) );
  mFirstColorLightItem = new KConfigSkeleton::ItemColor( currentGroup(), QStringLiteral( "FirstColorLight" ), mFirstColorLight, QColor( "#D84452" ) );
  addItem( mFirstColorLightItem, QStringLiteral( "FirstColorLight" ) );
  mFirstColorDarkItem = new KConfigSkeleton::ItemColor( currentGroup(), QStringLiteral( "FirstColorDark" ), mFirstColorDark, QColor( "#D84452" ) );
  addItem( mFirstColorDarkItem, QStringLiteral( "FirstColorDark" ) );
  mSecondColorLightItem = new KConfigSkeleton::ItemColor( currentGroup(), QStringLiteral( "SecondColorLight" ), mSecondColorLight, QColor( "#F5BA45" ) );
  addItem( mSecondColorLightItem, QStringLiteral( "SecondColorLight" ) );
  mSecondColorDarkItem = new KConfigSkeleton::ItemColor( currentGroup(), QStringLiteral( "SecondColorDark" ), mSecondColorDark, QColor( "#F5BA45" ) );
  addItem( mSecondColorDarkItem, QStringLiteral( "SecondColorDark" ) );
  mThirdColorLightItem = new KConfigSkeleton::ItemColor( currentGroup(), QStringLiteral( "ThirdColorLight" ), mThirdColorLight, QColor( "#4A89D9" ) );
  addItem( mThirdColorLightItem, QStringLiteral( "ThirdColorLight" ) );
  mThirdColorDarkItem = new KConfigSkeleton::ItemColor( currentGroup(), QStringLiteral( "ThirdColorDark" ), mThirdColorDark, QColor( "#4A89D9" ) );
  addItem( mThirdColorDarkItem, QStringLiteral( "ThirdColorDark" ) );
  mFourthColorLightItem = new KConfigSkeleton::ItemColor( currentGroup(), QStringLiteral( "FourthColorLight" ), mFourthColorLight, QColor( "#88C053" ) );
  addItem( mFourthColorLightItem, QStringLiteral( "FourthColorLight" ) );
  mFourthColorDarkItem = new KConfigSkeleton::ItemColor( currentGroup(), QStringLiteral( "FourthColorDark" ), mFourthColorDark, QColor( "#88C053" ) );
  addItem( mFourthColorDarkItem, QStringLiteral( "FourthColorDark" ) );
}

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

