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

#include "terminalsettings.h"

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

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

  return s_globalTerminalSettings()->q;
}

TerminalSettings::TerminalSettings( QObject *parent )
  : KConfigSkeleton( QStringLiteral( "qmlkonsolerc" ) )
{
  setParent(parent);
  Q_ASSERT(!s_globalTerminalSettings()->q);
  s_globalTerminalSettings()->q = this;
  KConfigCompilerSignallingItem::NotifyFunction notifyFunction = static_cast<KConfigCompilerSignallingItem::NotifyFunction>(&TerminalSettings::itemChanged);

  setCurrentGroup( QStringLiteral( "General" ) );

  KConfigCompilerSignallingItem  *itemColorScheme;
  KConfigSkeleton::ItemString  *innerItemColorScheme;
  innerItemColorScheme = new KConfigSkeleton::ItemString( currentGroup(), QStringLiteral( "colorScheme" ), mColorScheme, QStringLiteral( "\"cool-retro-term\"" ) );
  itemColorScheme = new KConfigCompilerSignallingItem(innerItemColorScheme, this, notifyFunction, signalColorSchemeChanged);
  itemColorScheme->setWriteFlags(KConfigBase::Notify);
  addItem( itemColorScheme, QStringLiteral( "colorScheme" ) );
  KConfigCompilerSignallingItem  *itemFontFamily;
  KConfigSkeleton::ItemString  *innerItemFontFamily;
  innerItemFontFamily = new KConfigSkeleton::ItemString( currentGroup(), QStringLiteral( "fontFamily" ), mFontFamily, QStringLiteral( "\"Monospace\"" ) );
  itemFontFamily = new KConfigCompilerSignallingItem(innerItemFontFamily, this, notifyFunction, signalFontFamilyChanged);
  itemFontFamily->setWriteFlags(KConfigBase::Notify);
  addItem( itemFontFamily, QStringLiteral( "fontFamily" ) );
  KConfigCompilerSignallingItem  *itemFontSize;
  KConfigSkeleton::ItemInt  *innerItemFontSize;
  innerItemFontSize = new KConfigSkeleton::ItemInt( currentGroup(), QStringLiteral( "fontSize" ), mFontSize, 12 );
  itemFontSize = new KConfigCompilerSignallingItem(innerItemFontSize, this, notifyFunction, signalFontSizeChanged);
  itemFontSize->setWriteFlags(KConfigBase::Notify);
  addItem( itemFontSize, QStringLiteral( "fontSize" ) );
  KConfigCompilerSignallingItem  *itemWindowOpacity;
  KConfigSkeleton::ItemDouble  *innerItemWindowOpacity;
  innerItemWindowOpacity = new KConfigSkeleton::ItemDouble( currentGroup(), QStringLiteral( "windowOpacity" ), mWindowOpacity, 1 );
  itemWindowOpacity = new KConfigCompilerSignallingItem(innerItemWindowOpacity, this, notifyFunction, signalWindowOpacityChanged);
  itemWindowOpacity->setWriteFlags(KConfigBase::Notify);
  addItem( itemWindowOpacity, QStringLiteral( "windowOpacity" ) );
  KConfigCompilerSignallingItem  *itemActions;
  KConfigSkeleton::ItemStringList  *innerItemActions;
  innerItemActions = new KConfigSkeleton::ItemStringList( currentGroup(), QStringLiteral( "actions" ), mActions );
  itemActions = new KConfigCompilerSignallingItem(innerItemActions, this, notifyFunction, signalActionsChanged);
  itemActions->setWriteFlags(KConfigBase::Notify);
  addItem( itemActions, QStringLiteral( "actions" ) );
  KConfigCompilerSignallingItem  *itemBlurWindow;
  KConfigSkeleton::ItemBool  *innerItemBlurWindow;
  innerItemBlurWindow = new KConfigSkeleton::ItemBool( currentGroup(), QStringLiteral( "blurWindow" ), mBlurWindow, false );
  itemBlurWindow = new KConfigCompilerSignallingItem(innerItemBlurWindow, this, notifyFunction, signalBlurWindowChanged);
  itemBlurWindow->setWriteFlags(KConfigBase::Notify);
  addItem( itemBlurWindow, QStringLiteral( "blurWindow" ) );
  KConfigCompilerSignallingItem  *itemForceModifierButtons;
  KConfigSkeleton::ItemBool  *innerItemForceModifierButtons;
  innerItemForceModifierButtons = new KConfigSkeleton::ItemBool( currentGroup(), QStringLiteral( "forceModifierButtons" ), mForceModifierButtons, false );
  itemForceModifierButtons = new KConfigCompilerSignallingItem(innerItemForceModifierButtons, this, notifyFunction, signalForceModifierButtonsChanged);
  itemForceModifierButtons->setWriteFlags(KConfigBase::Notify);
  addItem( itemForceModifierButtons, QStringLiteral( "forceModifierButtons" ) );
}

QString TerminalSettings::defaultColorSchemeValue_helper()
{

  return QStringLiteral( "\"cool-retro-term\"" );
}

QString TerminalSettings::defaultFontFamilyValue_helper()
{

  return QStringLiteral( "\"Monospace\"" );
}

int TerminalSettings::defaultFontSizeValue_helper()
{

  return 12;
}

double TerminalSettings::defaultWindowOpacityValue_helper()
{

  return 1;
}

bool TerminalSettings::defaultBlurWindowValue_helper()
{

  return false;
}

bool TerminalSettings::defaultForceModifierButtonsValue_helper()
{

  return false;
}

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


void TerminalSettings::itemChanged(quint64 signalFlag) {

  switch (signalFlag) {
  case signalColorSchemeChanged:
    Q_EMIT colorSchemeChanged();
    break;
  case signalFontFamilyChanged:
    Q_EMIT fontFamilyChanged();
    break;
  case signalFontSizeChanged:
    Q_EMIT fontSizeChanged();
    break;
  case signalWindowOpacityChanged:
    Q_EMIT windowOpacityChanged();
    break;
  case signalActionsChanged:
    Q_EMIT actionsChanged();
    break;
  case signalBlurWindowChanged:
    Q_EMIT blurWindowChanged();
    break;
  case signalForceModifierButtonsChanged:
    Q_EMIT forceModifierButtonsChanged();
    break;
  }
}
