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

#include "inputhandlersettings.h"

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

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

  return s_globalInputHandlerSettings()->q;
}

InputHandlerSettings::InputHandlerSettings( )
  : KCoreConfigSkeleton( QStringLiteral( "plasma-bigscreen-inputhandlerrc" ) )
{
  Q_ASSERT(!s_globalInputHandlerSettings()->q);
  s_globalInputHandlerSettings()->q = this;
  KConfigCompilerSignallingItem::NotifyFunction notifyFunction = static_cast<KConfigCompilerSignallingItem::NotifyFunction>(&InputHandlerSettings::itemChanged);

  setCurrentGroup( QStringLiteral( "General" ) );

  KConfigCompilerSignallingItem  *itemEnabled;
  KCoreConfigSkeleton::ItemBool  *innerItemEnabled;
  innerItemEnabled = new KCoreConfigSkeleton::ItemBool( currentGroup(), QStringLiteral( "Enabled" ), mEnabled, true );
  itemEnabled = new KConfigCompilerSignallingItem(innerItemEnabled, this, notifyFunction, signalEnabledChanged);
  addItem( itemEnabled, QStringLiteral( "enabled" ) );
  KConfigCompilerSignallingItem  *itemGameControllerEnabled;
  KCoreConfigSkeleton::ItemBool  *innerItemGameControllerEnabled;
  innerItemGameControllerEnabled = new KCoreConfigSkeleton::ItemBool( currentGroup(), QStringLiteral( "GameControllerEnabled" ), mGameControllerEnabled, true );
  itemGameControllerEnabled = new KConfigCompilerSignallingItem(innerItemGameControllerEnabled, this, notifyFunction, signalGameControllerEnabledChanged);
  addItem( itemGameControllerEnabled, QStringLiteral( "gameControllerEnabled" ) );
  KConfigCompilerSignallingItem  *itemCecEnabled;
  KCoreConfigSkeleton::ItemBool  *innerItemCecEnabled;
  innerItemCecEnabled = new KCoreConfigSkeleton::ItemBool( currentGroup(), QStringLiteral( "CecEnabled" ), mCecEnabled, true );
  itemCecEnabled = new KConfigCompilerSignallingItem(innerItemCecEnabled, this, notifyFunction, signalCecEnabledChanged);
  addItem( itemCecEnabled, QStringLiteral( "cecEnabled" ) );
  KConfigCompilerSignallingItem  *itemAutoSuppressInput;
  KCoreConfigSkeleton::ItemBool  *innerItemAutoSuppressInput;
  innerItemAutoSuppressInput = new KCoreConfigSkeleton::ItemBool( currentGroup(), QStringLiteral( "AutoSuppressInput" ), mAutoSuppressInput, true );
  itemAutoSuppressInput = new KConfigCompilerSignallingItem(innerItemAutoSuppressInput, this, notifyFunction, signalAutoSuppressInputChanged);
  addItem( itemAutoSuppressInput, QStringLiteral( "autoSuppressInput" ) );
  KConfigCompilerSignallingItem  *itemDisabledControllers;
  KCoreConfigSkeleton::ItemStringList  *innerItemDisabledControllers;
  innerItemDisabledControllers = new KCoreConfigSkeleton::ItemStringList( currentGroup(), QStringLiteral( "DisabledControllers" ), mDisabledControllers );
  itemDisabledControllers = new KConfigCompilerSignallingItem(innerItemDisabledControllers, this, notifyFunction, signalDisabledControllersChanged);
  addItem( itemDisabledControllers, QStringLiteral( "disabledControllers" ) );
  KConfigCompilerSignallingItem  *itemStartButtonDisabledWhenSuppressedControllers;
  KCoreConfigSkeleton::ItemStringList  *innerItemStartButtonDisabledWhenSuppressedControllers;
  innerItemStartButtonDisabledWhenSuppressedControllers = new KCoreConfigSkeleton::ItemStringList( currentGroup(), QStringLiteral( "StartButtonDisabledWhenSuppressedControllers" ), mStartButtonDisabledWhenSuppressedControllers );
  itemStartButtonDisabledWhenSuppressedControllers = new KConfigCompilerSignallingItem(innerItemStartButtonDisabledWhenSuppressedControllers, this, notifyFunction, signalStartButtonDisabledWhenSuppressedControllersChanged);
  addItem( itemStartButtonDisabledWhenSuppressedControllers, QStringLiteral( "startButtonDisabledWhenSuppressedControllers" ) );
}

bool InputHandlerSettings::defaultEnabledValue_helper()
{

  return true;
}

bool InputHandlerSettings::defaultGameControllerEnabledValue_helper()
{

  return true;
}

bool InputHandlerSettings::defaultCecEnabledValue_helper()
{

  return true;
}

bool InputHandlerSettings::defaultAutoSuppressInputValue_helper()
{

  return true;
}

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


void InputHandlerSettings::itemChanged(quint64 signalFlag) {

  switch (signalFlag) {
  case signalEnabledChanged:
    Q_EMIT enabledChanged();
    break;
  case signalGameControllerEnabledChanged:
    Q_EMIT gameControllerEnabledChanged();
    break;
  case signalCecEnabledChanged:
    Q_EMIT cecEnabledChanged();
    break;
  case signalAutoSuppressInputChanged:
    Q_EMIT autoSuppressInputChanged();
    break;
  case signalDisabledControllersChanged:
    Q_EMIT disabledControllersChanged();
    break;
  case signalStartButtonDisabledWhenSuppressedControllersChanged:
    Q_EMIT startButtonDisabledWhenSuppressedControllersChanged();
    break;
  }
}
