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

#include "mousesettings.h"

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

class MouseSettingsHelper
{
  public:
    MouseSettingsHelper() : q(nullptr) {}
    ~MouseSettingsHelper() { delete q; q = nullptr; }
    MouseSettingsHelper(const MouseSettingsHelper&) = delete;
    MouseSettingsHelper& operator=(const MouseSettingsHelper&) = delete;
    MouseSettings *q;
};
Q_GLOBAL_STATIC(MouseSettingsHelper, s_globalMouseSettings)
MouseSettings *MouseSettings::self()
{
  if (!s_globalMouseSettings()->q) {
    new MouseSettings;
    s_globalMouseSettings()->q->read();
  }

  return s_globalMouseSettings()->q;
}

MouseSettings *MouseSettings::create(QQmlEngine *, QJSEngine *)
{
  QQmlEngine::setObjectOwnership(self(), QQmlEngine::CppOwnership);
  return self();
}

MouseSettings::MouseSettings( QObject *parent )
  : KConfigSkeleton( QStringLiteral( "haruna/haruna.conf" ) )
{
  setParent(parent);
  Q_ASSERT(!s_globalMouseSettings()->q);
  s_globalMouseSettings()->q = this;
  KConfigCompilerSignallingItem::NotifyFunction notifyFunction = static_cast<KConfigCompilerSignallingItem::NotifyFunction>(&MouseSettings::itemChanged);

  setCurrentGroup( QStringLiteral( "Mouse" ) );

  KConfigCompilerSignallingItem  *itemLeft;
  KConfigSkeleton::ItemString  *innerItemLeft;
  innerItemLeft = new KConfigSkeleton::ItemString( currentGroup(), QStringLiteral( "Left" ), mLeft, QStringLiteral( "playPauseAction" ) );
  itemLeft = new KConfigCompilerSignallingItem(innerItemLeft, this, notifyFunction, signalLeftChanged);
  addItem( itemLeft, QStringLiteral( "Left" ) );
  KConfigCompilerSignallingItem  *itemLeftx2;
  KConfigSkeleton::ItemString  *innerItemLeftx2;
  innerItemLeftx2 = new KConfigSkeleton::ItemString( currentGroup(), QStringLiteral( "Leftx2" ), mLeftx2, QStringLiteral( "toggleFullscreenAction" ) );
  itemLeftx2 = new KConfigCompilerSignallingItem(innerItemLeftx2, this, notifyFunction, signalLeftx2Changed);
  addItem( itemLeftx2, QStringLiteral( "Leftx2" ) );
  KConfigCompilerSignallingItem  *itemMiddle;
  KConfigSkeleton::ItemString  *innerItemMiddle;
  innerItemMiddle = new KConfigSkeleton::ItemString( currentGroup(), QStringLiteral( "Middle" ), mMiddle, QStringLiteral( "muteAction" ) );
  itemMiddle = new KConfigCompilerSignallingItem(innerItemMiddle, this, notifyFunction, signalMiddleChanged);
  addItem( itemMiddle, QStringLiteral( "Middle" ) );
  KConfigCompilerSignallingItem  *itemMiddlex2;
  KConfigSkeleton::ItemString  *innerItemMiddlex2;
  innerItemMiddlex2 = new KConfigSkeleton::ItemString( currentGroup(), QStringLiteral( "Middlex2" ), mMiddlex2, QStringLiteral( "configureAction" ) );
  itemMiddlex2 = new KConfigCompilerSignallingItem(innerItemMiddlex2, this, notifyFunction, signalMiddlex2Changed);
  addItem( itemMiddlex2, QStringLiteral( "Middlex2" ) );
  KConfigCompilerSignallingItem  *itemRight;
  KConfigSkeleton::ItemString  *innerItemRight;
  innerItemRight = new KConfigSkeleton::ItemString( currentGroup(), QStringLiteral( "Right" ), mRight, QStringLiteral( "openContextMenuAction" ) );
  itemRight = new KConfigCompilerSignallingItem(innerItemRight, this, notifyFunction, signalRightChanged);
  addItem( itemRight, QStringLiteral( "Right" ) );
  KConfigCompilerSignallingItem  *itemRightx2;
  KConfigSkeleton::ItemString  *innerItemRightx2;
  innerItemRightx2 = new KConfigSkeleton::ItemString( currentGroup(), QStringLiteral( "Rightx2" ), mRightx2 );
  itemRightx2 = new KConfigCompilerSignallingItem(innerItemRightx2, this, notifyFunction, signalRightx2Changed);
  addItem( itemRightx2, QStringLiteral( "Rightx2" ) );
  KConfigCompilerSignallingItem  *itemForward;
  KConfigSkeleton::ItemString  *innerItemForward;
  innerItemForward = new KConfigSkeleton::ItemString( currentGroup(), QStringLiteral( "Forward" ), mForward, QStringLiteral( "seekForwardSmallAction" ) );
  itemForward = new KConfigCompilerSignallingItem(innerItemForward, this, notifyFunction, signalForwardChanged);
  addItem( itemForward, QStringLiteral( "Forward" ) );
  KConfigCompilerSignallingItem  *itemForwardx2;
  KConfigSkeleton::ItemString  *innerItemForwardx2;
  innerItemForwardx2 = new KConfigSkeleton::ItemString( currentGroup(), QStringLiteral( "Forwardx2" ), mForwardx2 );
  itemForwardx2 = new KConfigCompilerSignallingItem(innerItemForwardx2, this, notifyFunction, signalForwardx2Changed);
  addItem( itemForwardx2, QStringLiteral( "Forwardx2" ) );
  KConfigCompilerSignallingItem  *itemBack;
  KConfigSkeleton::ItemString  *innerItemBack;
  innerItemBack = new KConfigSkeleton::ItemString( currentGroup(), QStringLiteral( "Back" ), mBack, QStringLiteral( "seekBackwardSmallAction" ) );
  itemBack = new KConfigCompilerSignallingItem(innerItemBack, this, notifyFunction, signalBackChanged);
  addItem( itemBack, QStringLiteral( "Back" ) );
  KConfigCompilerSignallingItem  *itemBackx2;
  KConfigSkeleton::ItemString  *innerItemBackx2;
  innerItemBackx2 = new KConfigSkeleton::ItemString( currentGroup(), QStringLiteral( "Backx2" ), mBackx2 );
  itemBackx2 = new KConfigCompilerSignallingItem(innerItemBackx2, this, notifyFunction, signalBackx2Changed);
  addItem( itemBackx2, QStringLiteral( "Backx2" ) );
  KConfigCompilerSignallingItem  *itemScrollUp;
  KConfigSkeleton::ItemString  *innerItemScrollUp;
  innerItemScrollUp = new KConfigSkeleton::ItemString( currentGroup(), QStringLiteral( "ScrollUp" ), mScrollUp, QStringLiteral( "volumeUpAction" ) );
  itemScrollUp = new KConfigCompilerSignallingItem(innerItemScrollUp, this, notifyFunction, signalScrollUpChanged);
  addItem( itemScrollUp, QStringLiteral( "ScrollUp" ) );
  KConfigCompilerSignallingItem  *itemScrollDown;
  KConfigSkeleton::ItemString  *innerItemScrollDown;
  innerItemScrollDown = new KConfigSkeleton::ItemString( currentGroup(), QStringLiteral( "ScrollDown" ), mScrollDown, QStringLiteral( "volumeDownAction" ) );
  itemScrollDown = new KConfigCompilerSignallingItem(innerItemScrollDown, this, notifyFunction, signalScrollDownChanged);
  addItem( itemScrollDown, QStringLiteral( "ScrollDown" ) );
}

QString MouseSettings::defaultLeftValue_helper()
{

  return QStringLiteral( "playPauseAction" );
}

QString MouseSettings::defaultLeftx2Value_helper()
{

  return QStringLiteral( "toggleFullscreenAction" );
}

QString MouseSettings::defaultMiddleValue_helper()
{

  return QStringLiteral( "muteAction" );
}

QString MouseSettings::defaultMiddlex2Value_helper()
{

  return QStringLiteral( "configureAction" );
}

QString MouseSettings::defaultRightValue_helper()
{

  return QStringLiteral( "openContextMenuAction" );
}

QString MouseSettings::defaultForwardValue_helper()
{

  return QStringLiteral( "seekForwardSmallAction" );
}

QString MouseSettings::defaultBackValue_helper()
{

  return QStringLiteral( "seekBackwardSmallAction" );
}

QString MouseSettings::defaultScrollUpValue_helper()
{

  return QStringLiteral( "volumeUpAction" );
}

QString MouseSettings::defaultScrollDownValue_helper()
{

  return QStringLiteral( "volumeDownAction" );
}

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


void MouseSettings::itemChanged(quint64 signalFlag) {

  switch (signalFlag) {
  case signalLeftChanged:
    Q_EMIT LeftChanged();
    break;
  case signalLeftx2Changed:
    Q_EMIT Leftx2Changed();
    break;
  case signalMiddleChanged:
    Q_EMIT MiddleChanged();
    break;
  case signalMiddlex2Changed:
    Q_EMIT Middlex2Changed();
    break;
  case signalRightChanged:
    Q_EMIT RightChanged();
    break;
  case signalRightx2Changed:
    Q_EMIT Rightx2Changed();
    break;
  case signalForwardChanged:
    Q_EMIT ForwardChanged();
    break;
  case signalForwardx2Changed:
    Q_EMIT Forwardx2Changed();
    break;
  case signalBackChanged:
    Q_EMIT BackChanged();
    break;
  case signalBackx2Changed:
    Q_EMIT Backx2Changed();
    break;
  case signalScrollUpChanged:
    Q_EMIT ScrollUpChanged();
    break;
  case signalScrollDownChanged:
    Q_EMIT ScrollDownChanged();
    break;
  }
}
