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

#include "glaxnimate_settings.hpp"

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

using namespace glaxnimate::gui;

namespace glaxnimate {
namespace gui {

class GlaxnimateSettingsHelper
{
  public:
    GlaxnimateSettingsHelper() : q(nullptr) {}
    ~GlaxnimateSettingsHelper() { delete q; q = nullptr; }
    GlaxnimateSettingsHelper(const GlaxnimateSettingsHelper&) = delete;
    GlaxnimateSettingsHelper& operator=(const GlaxnimateSettingsHelper&) = delete;
    GlaxnimateSettings *q;
};

}
}
Q_GLOBAL_STATIC(GlaxnimateSettingsHelper, s_globalGlaxnimateSettings)
GlaxnimateSettings *GlaxnimateSettings::self()
{
  if (!s_globalGlaxnimateSettings()->q) {
    new GlaxnimateSettings;
    s_globalGlaxnimateSettings()->q->read();
  }

  return s_globalGlaxnimateSettings()->q;
}

GlaxnimateSettings::GlaxnimateSettings( )
  : glaxnimate::gui::settings::GlaxnimateSettingsBase()
{
  Q_ASSERT(!s_globalGlaxnimateSettings()->q);
  s_globalGlaxnimateSettings()->q = this;
  setCurrentGroup( QStringLiteral( "ui" ) );

  mStartup_dialogItem = new glaxnimate::gui::settings::GlaxnimateSettingsBase::ItemBool( currentGroup(), QStringLiteral( "startup_dialog" ), mStartup_dialog, true );
  addItem( mStartup_dialogItem, QStringLiteral( "startup_dialog" ) );
  mTimeline_scroll_horizontalItem = new glaxnimate::gui::settings::GlaxnimateSettingsBase::ItemBool( currentGroup(), QStringLiteral( "timeline_scroll_horizontal" ), mTimeline_scroll_horizontal, false );
  addItem( mTimeline_scroll_horizontalItem, QStringLiteral( "timeline_scroll_horizontal" ) );
  mDebug_timelineItem = new glaxnimate::gui::settings::GlaxnimateSettingsBase::ItemBool( currentGroup(), QStringLiteral( "debug_timeline" ), mDebug_timeline, false );
  addItem( mDebug_timelineItem, QStringLiteral( "debug_timeline" ) );
  mLayoutItem = new glaxnimate::gui::settings::GlaxnimateSettingsBase::ItemInt( currentGroup(), QStringLiteral( "layout" ), mLayout, 2 );
  addItem( mLayoutItem, QStringLiteral( "layout" ) );
  mWindow_stateItem = new glaxnimate::gui::settings::GlaxnimateSettingsBase::ItemString( currentGroup(), QStringLiteral( "window_state" ), mWindow_state );
  addItem( mWindow_stateItem, QStringLiteral( "window_state" ) );
  mTimeline_splitterItem = new glaxnimate::gui::settings::GlaxnimateSettingsBase::ItemString( currentGroup(), QStringLiteral( "timeline_splitter" ), mTimeline_splitter );
  addItem( mTimeline_splitterItem, QStringLiteral( "timeline_splitter" ) );
  mIcon_themeItem = new glaxnimate::gui::settings::GlaxnimateSettingsBase::ItemString( currentGroup(), QStringLiteral( "icon_theme" ), mIcon_theme );
  addItem( mIcon_themeItem, QStringLiteral( "icon_theme" ) );

  setCurrentGroup( QStringLiteral( "defaults" ) );

  mWidthItem = new glaxnimate::gui::settings::GlaxnimateSettingsBase::ItemInt( currentGroup(), QStringLiteral( "width" ), mWidth, 512 );
  mWidthItem->setMinValue(0);
  mWidthItem->setMaxValue(999999);
  addItem( mWidthItem, QStringLiteral( "width" ) );
  mHeightItem = new glaxnimate::gui::settings::GlaxnimateSettingsBase::ItemInt( currentGroup(), QStringLiteral( "height" ), mHeight, 512 );
  mHeightItem->setMinValue(0);
  mHeightItem->setMaxValue(999999);
  addItem( mHeightItem, QStringLiteral( "height" ) );
  mFpsItem = new glaxnimate::gui::settings::GlaxnimateSettingsBase::ItemDouble( currentGroup(), QStringLiteral( "fps" ), mFps, 60 );
  mFpsItem->setMinValue(1);
  mFpsItem->setMaxValue(999);
  addItem( mFpsItem, QStringLiteral( "fps" ) );
  mDurationItem = new glaxnimate::gui::settings::GlaxnimateSettingsBase::ItemDouble( currentGroup(), QStringLiteral( "duration" ), mDuration, 3 );
  mDurationItem->setMinValue(0);
  addItem( mDurationItem, QStringLiteral( "duration" ) );

  setCurrentGroup( QStringLiteral( "open_save" ) );

  mBackup_frequencyItem = new glaxnimate::gui::settings::GlaxnimateSettingsBase::ItemInt( currentGroup(), QStringLiteral( "backup_frequency" ), mBackup_frequency, 5 );
  addItem( mBackup_frequencyItem, QStringLiteral( "backup_frequency" ) );
  mUse_native_io_dialogItem = new glaxnimate::gui::settings::GlaxnimateSettingsBase::ItemBool( currentGroup(), QStringLiteral( "use_native_io_dialog" ), mUse_native_io_dialog, true );
  addItem( mUse_native_io_dialogItem, QStringLiteral( "use_native_io_dialog" ) );
  mPathItem = new glaxnimate::gui::settings::GlaxnimateSettingsBase::ItemPath( currentGroup(), QStringLiteral( "path" ), mPath );
  addItem( mPathItem, QStringLiteral( "path" ) );
  mRender_pathItem = new glaxnimate::gui::settings::GlaxnimateSettingsBase::ItemPath( currentGroup(), QStringLiteral( "render_path" ), mRender_path );
  addItem( mRender_pathItem, QStringLiteral( "render_path" ) );
  mImport_pathItem = new glaxnimate::gui::settings::GlaxnimateSettingsBase::ItemPath( currentGroup(), QStringLiteral( "import_path" ), mImport_path );
  addItem( mImport_pathItem, QStringLiteral( "import_path" ) );

  setCurrentGroup( QStringLiteral( "scripting" ) );

  mScript_max_historyItem = new glaxnimate::gui::settings::GlaxnimateSettingsBase::ItemInt( currentGroup(), QStringLiteral( "script_max_history" ), mScript_max_history, 100 );
  addItem( mScript_max_historyItem, QStringLiteral( "script_max_history" ) );
  mScript_historyItem = new glaxnimate::gui::settings::GlaxnimateSettingsBase::ItemStringList( currentGroup(), QStringLiteral( "script_history" ), mScript_history );
  addItem( mScript_historyItem, QStringLiteral( "script_history" ) );

  setCurrentGroup( QStringLiteral( "tools" ) );

  mShape_groupItem = new glaxnimate::gui::settings::GlaxnimateSettingsBase::ItemBool( currentGroup(), QStringLiteral( "shape_group" ), mShape_group, true );
  addItem( mShape_groupItem, QStringLiteral( "shape_group" ) );
  mShape_fillItem = new glaxnimate::gui::settings::GlaxnimateSettingsBase::ItemBool( currentGroup(), QStringLiteral( "shape_fill" ), mShape_fill, true );
  addItem( mShape_fillItem, QStringLiteral( "shape_fill" ) );
  mShape_strokeItem = new glaxnimate::gui::settings::GlaxnimateSettingsBase::ItemBool( currentGroup(), QStringLiteral( "shape_stroke" ), mShape_stroke, true );
  addItem( mShape_strokeItem, QStringLiteral( "shape_stroke" ) );
  mEdit_maskItem = new glaxnimate::gui::settings::GlaxnimateSettingsBase::ItemBool( currentGroup(), QStringLiteral( "edit_mask" ), mEdit_mask, false );
  addItem( mEdit_maskItem, QStringLiteral( "edit_mask" ) );
  mColor_mainItem = new glaxnimate::gui::settings::GlaxnimateSettingsBase::ItemColor( currentGroup(), QStringLiteral( "color_main" ), mColor_main, QColor( "#ffffff" ) );
  addItem( mColor_mainItem, QStringLiteral( "color_main" ) );
  mColor_secondaryItem = new glaxnimate::gui::settings::GlaxnimateSettingsBase::ItemColor( currentGroup(), QStringLiteral( "color_secondary" ), mColor_secondary, QColor( "#000000" ) );
  addItem( mColor_secondaryItem, QStringLiteral( "color_secondary" ) );
  mStroke_widthItem = new glaxnimate::gui::settings::GlaxnimateSettingsBase::ItemDouble( currentGroup(), QStringLiteral( "stroke_width" ), mStroke_width, 1. );
  addItem( mStroke_widthItem, QStringLiteral( "stroke_width" ) );
  QList<glaxnimate::gui::settings::GlaxnimateSettingsBase::ItemEnum::Choice> valuesstroke_cap;
  mStroke_capItem = new glaxnimate::gui::settings::GlaxnimateSettingsBase::ItemEnum( currentGroup(), QStringLiteral( "stroke_cap" ), mStroke_cap, valuesstroke_cap, Qt::RoundCap );
  addItem( mStroke_capItem, QStringLiteral( "stroke_cap" ) );
  QList<glaxnimate::gui::settings::GlaxnimateSettingsBase::ItemEnum::Choice> valuesstroke_join;
  mStroke_joinItem = new glaxnimate::gui::settings::GlaxnimateSettingsBase::ItemEnum( currentGroup(), QStringLiteral( "stroke_join" ), mStroke_join, valuesstroke_join, Qt::RoundJoin );
  addItem( mStroke_joinItem, QStringLiteral( "stroke_join" ) );
  mStroke_miterItem = new glaxnimate::gui::settings::GlaxnimateSettingsBase::ItemDouble( currentGroup(), QStringLiteral( "stroke_miter" ), mStroke_miter, 4. );
  addItem( mStroke_miterItem, QStringLiteral( "stroke_miter" ) );
  mStar_typeItem = new glaxnimate::gui::settings::GlaxnimateSettingsBase::ItemInt( currentGroup(), QStringLiteral( "star_type" ), mStar_type, 1 );
  addItem( mStar_typeItem, QStringLiteral( "star_type" ) );
  mStar_ratioItem = new glaxnimate::gui::settings::GlaxnimateSettingsBase::ItemDouble( currentGroup(), QStringLiteral( "star_ratio" ), mStar_ratio, 0.5 );
  addItem( mStar_ratioItem, QStringLiteral( "star_ratio" ) );
  mStar_pointsItem = new glaxnimate::gui::settings::GlaxnimateSettingsBase::ItemInt( currentGroup(), QStringLiteral( "star_points" ), mStar_points, 5 );
  addItem( mStar_pointsItem, QStringLiteral( "star_points" ) );
  mFavourite_font_familiesItem = new glaxnimate::gui::settings::GlaxnimateSettingsBase::ItemStringList( currentGroup(), QStringLiteral( "favourite_font_families" ), mFavourite_font_families );
  addItem( mFavourite_font_familiesItem, QStringLiteral( "favourite_font_families" ) );
  mText_familyItem = new glaxnimate::gui::settings::GlaxnimateSettingsBase::ItemString( currentGroup(), QStringLiteral( "text_family" ), mText_family, QFontInfo(QFont()).family() );
  addItem( mText_familyItem, QStringLiteral( "text_family" ) );
  mText_styleItem = new glaxnimate::gui::settings::GlaxnimateSettingsBase::ItemString( currentGroup(), QStringLiteral( "text_style" ), mText_style, QFontInfo(QFont()).styleName() );
  addItem( mText_styleItem, QStringLiteral( "text_style" ) );
  mText_sizeItem = new glaxnimate::gui::settings::GlaxnimateSettingsBase::ItemDouble( currentGroup(), QStringLiteral( "text_size" ), mText_size, QFontInfo(QFont()).pointSizeF() );
  addItem( mText_sizeItem, QStringLiteral( "text_size" ) );
}

bool GlaxnimateSettings::defaultStartup_dialogValue_helper()
{

  return true;
}

bool GlaxnimateSettings::defaultTimeline_scroll_horizontalValue_helper()
{

  return false;
}

bool GlaxnimateSettings::defaultDebug_timelineValue_helper()
{

  return false;
}

int GlaxnimateSettings::defaultLayoutValue_helper()
{

  return 2;
}

int GlaxnimateSettings::defaultWidthValue_helper()
{

  return 512;
}

int GlaxnimateSettings::defaultHeightValue_helper()
{

  return 512;
}

double GlaxnimateSettings::defaultFpsValue_helper()
{

  return 60;
}

double GlaxnimateSettings::defaultDurationValue_helper()
{

  return 3;
}

int GlaxnimateSettings::defaultBackup_frequencyValue_helper()
{

  return 5;
}

bool GlaxnimateSettings::defaultUse_native_io_dialogValue_helper()
{

  return true;
}

int GlaxnimateSettings::defaultScript_max_historyValue_helper()
{

  return 100;
}

bool GlaxnimateSettings::defaultShape_groupValue_helper()
{

  return true;
}

bool GlaxnimateSettings::defaultShape_fillValue_helper()
{

  return true;
}

bool GlaxnimateSettings::defaultShape_strokeValue_helper()
{

  return true;
}

bool GlaxnimateSettings::defaultEdit_maskValue_helper()
{

  return false;
}

QColor GlaxnimateSettings::defaultColor_mainValue_helper()
{

  return QColor( "#ffffff" );
}

QColor GlaxnimateSettings::defaultColor_secondaryValue_helper()
{

  return QColor( "#000000" );
}

double GlaxnimateSettings::defaultStroke_widthValue_helper()
{

  return 1.;
}

int GlaxnimateSettings::defaultStroke_capValue_helper()
{

  return Qt::RoundCap;
}

int GlaxnimateSettings::defaultStroke_joinValue_helper()
{

  return Qt::RoundJoin;
}

double GlaxnimateSettings::defaultStroke_miterValue_helper()
{

  return 4.;
}

int GlaxnimateSettings::defaultStar_typeValue_helper()
{

  return 1;
}

double GlaxnimateSettings::defaultStar_ratioValue_helper()
{

  return 0.5;
}

int GlaxnimateSettings::defaultStar_pointsValue_helper()
{

  return 5;
}

QString GlaxnimateSettings::defaultText_familyValue_helper()
{

  return QFontInfo(QFont()).family();
}

QString GlaxnimateSettings::defaultText_styleValue_helper()
{

  return QFontInfo(QFont()).styleName();
}

double GlaxnimateSettings::defaultText_sizeValue_helper()
{

  return QFontInfo(QFont()).pointSizeF();
}

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

