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

#include "bluedevilglobalsettings.h"

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

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

  return s_globalGlobalSettings()->q;
}

GlobalSettings::GlobalSettings( )
  : KConfigSkeleton( QStringLiteral( "bluedevilglobalrc" ) )
{
  Q_ASSERT(!s_globalGlobalSettings()->q);
  s_globalGlobalSettings()->q = this;
  KConfigCompilerSignallingItem::NotifyFunction notifyFunction = static_cast<KConfigCompilerSignallingItem::NotifyFunction>(&GlobalSettings::itemChanged);

  setCurrentGroup( QStringLiteral( "General" ) );

  QList<KConfigSkeleton::ItemEnum::Choice> valueslaunchState;
  {
    KConfigSkeleton::ItemEnum::Choice choice;
    choice.name = QStringLiteral("Remember");
    valueslaunchState.append( choice );
  }
  {
    KConfigSkeleton::ItemEnum::Choice choice;
    choice.name = QStringLiteral("Enable");
    valueslaunchState.append( choice );
  }
  {
    KConfigSkeleton::ItemEnum::Choice choice;
    choice.name = QStringLiteral("Disable");
    valueslaunchState.append( choice );
  }
  KConfigCompilerSignallingItem  *itemLaunchState;
  KConfigSkeleton::ItemEnum  *innerItemLaunchState;
  innerItemLaunchState = new KConfigSkeleton::ItemEnum( currentGroup(), QStringLiteral( "launchState" ), mLaunchState, valueslaunchState, Remember );
  itemLaunchState = new KConfigCompilerSignallingItem(innerItemLaunchState, this, notifyFunction, signalLaunchStateChanged);
  innerItemLaunchState->setValueForChoice(QStringLiteral( "Remember" ), QStringLiteral( "remember" ));
  innerItemLaunchState->setValueForChoice(QStringLiteral( "Enable" ), QStringLiteral( "enable" ));
  innerItemLaunchState->setValueForChoice(QStringLiteral( "Disable" ), QStringLiteral( "disable" ));
  addItem( itemLaunchState, QStringLiteral( "launchState" ) );
  KConfigCompilerSignallingItem  *itemBluetoothBlocked;
  KConfigSkeleton::ItemBool  *innerItemBluetoothBlocked;
  innerItemBluetoothBlocked = new KConfigSkeleton::ItemBool( currentGroup(), QStringLiteral( "bluetoothBlocked" ), mBluetoothBlocked, false );
  itemBluetoothBlocked = new KConfigCompilerSignallingItem(innerItemBluetoothBlocked, this, notifyFunction, signalBluetoothBlockedChanged);
  addItem( itemBluetoothBlocked, QStringLiteral( "bluetoothBlocked" ) );

  setCurrentGroup( QStringLiteral( "Devices" ) );

  QStringList defaultconnectedDevices;
  defaultconnectedDevices.append( QString::fromUtf8( "QStringList()" ) );

  KConfigCompilerSignallingItem  *itemConnectedDevices;
  KConfigSkeleton::ItemStringList  *innerItemConnectedDevices;
  innerItemConnectedDevices = new KConfigSkeleton::ItemStringList( currentGroup(), QStringLiteral( "connectedDevices" ), mConnectedDevices, defaultconnectedDevices );
  itemConnectedDevices = new KConfigCompilerSignallingItem(innerItemConnectedDevices, this, notifyFunction, signalConnectedDevicesChanged);
  addItem( itemConnectedDevices, QStringLiteral( "connectedDevices" ) );
}

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


void GlobalSettings::itemChanged(quint64 signalFlag) {

  switch (signalFlag) {
  case signalLaunchStateChanged:
    Q_EMIT launchStateChanged();
    break;
  case signalBluetoothBlockedChanged:
    Q_EMIT bluetoothBlockedChanged();
    break;
  case signalConnectedDevicesChanged:
    Q_EMIT connectedDevicesChanged();
    break;
  }
}
