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

#include "easyeffects_db_spectrum.h"

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

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

  return s_globalDbSpectrum()->q;
}

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

DbSpectrum::DbSpectrum( )
  : KConfigBaseEE( QStringLiteral( "easyeffects/db/easyeffectsrc" ) )
{
  Q_ASSERT(!s_globalDbSpectrum()->q);
  s_globalDbSpectrum()->q = this;
  KConfigCompilerSignallingItem::NotifyFunction notifyFunction = static_cast<KConfigCompilerSignallingItem::NotifyFunction>(&DbSpectrum::itemChanged);

  setCurrentGroup( QStringLiteral( "Spectrum" ) );

  KConfigCompilerSignallingItem  *itemState;
  KConfigBaseEE::ItemBool  *innerItemState;
  innerItemState = new KConfigBaseEE::ItemBool( currentGroup(), QStringLiteral( "state" ), mState, true );
  itemState = new KConfigCompilerSignallingItem(innerItemState, this, notifyFunction, signalStateChanged);
  itemState->setWriteFlags(KConfigBase::Notify);
  addItem( itemState, QStringLiteral( "state" ) );
  KConfigCompilerSignallingItem  *itemDynamicYScale;
  KConfigBaseEE::ItemBool  *innerItemDynamicYScale;
  innerItemDynamicYScale = new KConfigBaseEE::ItemBool( currentGroup(), QStringLiteral( "dynamicYScale" ), mDynamicYScale, true );
  itemDynamicYScale = new KConfigCompilerSignallingItem(innerItemDynamicYScale, this, notifyFunction, signalDynamicYScaleChanged);
  itemDynamicYScale->setWriteFlags(KConfigBase::Notify);
  addItem( itemDynamicYScale, QStringLiteral( "dynamicYScale" ) );
  KConfigCompilerSignallingItem  *itemLogarithmicHorizontalAxis;
  KConfigBaseEE::ItemBool  *innerItemLogarithmicHorizontalAxis;
  innerItemLogarithmicHorizontalAxis = new KConfigBaseEE::ItemBool( currentGroup(), QStringLiteral( "logarithmicHorizontalAxis" ), mLogarithmicHorizontalAxis, true );
  itemLogarithmicHorizontalAxis = new KConfigCompilerSignallingItem(innerItemLogarithmicHorizontalAxis, this, notifyFunction, signalLogarithmicHorizontalAxisChanged);
  itemLogarithmicHorizontalAxis->setWriteFlags(KConfigBase::Notify);
  addItem( itemLogarithmicHorizontalAxis, QStringLiteral( "logarithmicHorizontalAxis" ) );
  QList<KConfigBaseEE::ItemEnum::Choice> valuesspectrumShape;
  {
    KConfigBaseEE::ItemEnum::Choice choice;
    choice.name = QStringLiteral("bars");
    valuesspectrumShape.append( choice );
  }
  {
    KConfigBaseEE::ItemEnum::Choice choice;
    choice.name = QStringLiteral("lines");
    valuesspectrumShape.append( choice );
  }
  {
    KConfigBaseEE::ItemEnum::Choice choice;
    choice.name = QStringLiteral("dots");
    valuesspectrumShape.append( choice );
  }
  {
    KConfigBaseEE::ItemEnum::Choice choice;
    choice.name = QStringLiteral("area");
    valuesspectrumShape.append( choice );
  }
  KConfigCompilerSignallingItem  *itemSpectrumShape;
  KConfigBaseEE::ItemEnum  *innerItemSpectrumShape;
  innerItemSpectrumShape = new KConfigBaseEE::ItemEnum( currentGroup(), QStringLiteral( "spectrumShape" ), mSpectrumShape, valuesspectrumShape, 0 );
  itemSpectrumShape = new KConfigCompilerSignallingItem(innerItemSpectrumShape, this, notifyFunction, signalSpectrumShapeChanged);
  itemSpectrumShape->setWriteFlags(KConfigBase::Notify);
  addItem( itemSpectrumShape, QStringLiteral( "spectrumShape" ) );
  KConfigCompilerSignallingItem  *itemNPoints;
  KConfigBaseEE::ItemInt  *innerItemNPoints;
  innerItemNPoints = new KConfigBaseEE::ItemInt( currentGroup(), QStringLiteral( "nPoints" ), mNPoints, 100 );
  itemNPoints = new KConfigCompilerSignallingItem(innerItemNPoints, this, notifyFunction, signalNPointsChanged);
  innerItemNPoints->setMinValue(2);
  innerItemNPoints->setMaxValue(2048);
  itemNPoints->setWriteFlags(KConfigBase::Notify);
  addItem( itemNPoints, QStringLiteral( "nPoints" ) );
  KConfigCompilerSignallingItem  *itemHeight;
  KConfigBaseEE::ItemInt  *innerItemHeight;
  innerItemHeight = new KConfigBaseEE::ItemInt( currentGroup(), QStringLiteral( "height" ), mHeight, 140 );
  itemHeight = new KConfigCompilerSignallingItem(innerItemHeight, this, notifyFunction, signalHeightChanged);
  innerItemHeight->setMinValue(100);
  innerItemHeight->setMaxValue(1000);
  itemHeight->setWriteFlags(KConfigBase::Notify);
  addItem( itemHeight, QStringLiteral( "height" ) );
  KConfigCompilerSignallingItem  *itemMinimumFrequency;
  KConfigBaseEE::ItemInt  *innerItemMinimumFrequency;
  innerItemMinimumFrequency = new KConfigBaseEE::ItemInt( currentGroup(), QStringLiteral( "minimumFrequency" ), mMinimumFrequency, 20 );
  itemMinimumFrequency = new KConfigCompilerSignallingItem(innerItemMinimumFrequency, this, notifyFunction, signalMinimumFrequencyChanged);
  innerItemMinimumFrequency->setMinValue(1);
  innerItemMinimumFrequency->setMaxValue(21900);
  itemMinimumFrequency->setWriteFlags(KConfigBase::Notify);
  addItem( itemMinimumFrequency, QStringLiteral( "minimumFrequency" ) );
  KConfigCompilerSignallingItem  *itemMaximumFrequency;
  KConfigBaseEE::ItemInt  *innerItemMaximumFrequency;
  innerItemMaximumFrequency = new KConfigBaseEE::ItemInt( currentGroup(), QStringLiteral( "maximumFrequency" ), mMaximumFrequency, 20000 );
  itemMaximumFrequency = new KConfigCompilerSignallingItem(innerItemMaximumFrequency, this, notifyFunction, signalMaximumFrequencyChanged);
  innerItemMaximumFrequency->setMinValue(120);
  innerItemMaximumFrequency->setMaxValue(25000);
  itemMaximumFrequency->setWriteFlags(KConfigBase::Notify);
  addItem( itemMaximumFrequency, QStringLiteral( "maximumFrequency" ) );
  KConfigCompilerSignallingItem  *itemAvsyncDelay;
  KConfigBaseEE::ItemInt  *innerItemAvsyncDelay;
  innerItemAvsyncDelay = new KConfigBaseEE::ItemInt( currentGroup(), QStringLiteral( "avsyncDelay" ), mAvsyncDelay, 0 );
  itemAvsyncDelay = new KConfigCompilerSignallingItem(innerItemAvsyncDelay, this, notifyFunction, signalAvsyncDelayChanged);
  innerItemAvsyncDelay->setMinValue(0);
  innerItemAvsyncDelay->setMaxValue(1000);
  itemAvsyncDelay->setWriteFlags(KConfigBase::Notify);
  addItem( itemAvsyncDelay, QStringLiteral( "avsyncDelay" ) );
  KConfigCompilerSignallingItem  *itemSpectrumFpsCap;
  KConfigBaseEE::ItemInt  *innerItemSpectrumFpsCap;
  innerItemSpectrumFpsCap = new KConfigBaseEE::ItemInt( currentGroup(), QStringLiteral( "spectrumFpsCap" ), mSpectrumFpsCap, 60 );
  itemSpectrumFpsCap = new KConfigCompilerSignallingItem(innerItemSpectrumFpsCap, this, notifyFunction, signalSpectrumFpsCapChanged);
  innerItemSpectrumFpsCap->setMinValue(1);
  innerItemSpectrumFpsCap->setMaxValue(240);
  itemSpectrumFpsCap->setWriteFlags(KConfigBase::Notify);
  addItem( itemSpectrumFpsCap, QStringLiteral( "spectrumFpsCap" ) );
}

bool DbSpectrum::defaultStateValue_helper()
{

  return true;
}

bool DbSpectrum::defaultDynamicYScaleValue_helper()
{

  return true;
}

bool DbSpectrum::defaultLogarithmicHorizontalAxisValue_helper()
{

  return true;
}

int DbSpectrum::defaultSpectrumShapeValue_helper()
{

  return 0;
}

int DbSpectrum::defaultNPointsValue_helper()
{

  return 100;
}

int DbSpectrum::defaultHeightValue_helper()
{

  return 140;
}

int DbSpectrum::defaultMinimumFrequencyValue_helper()
{

  return 20;
}

int DbSpectrum::defaultMaximumFrequencyValue_helper()
{

  return 20000;
}

int DbSpectrum::defaultAvsyncDelayValue_helper()
{

  return 0;
}

int DbSpectrum::defaultSpectrumFpsCapValue_helper()
{

  return 60;
}

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


void DbSpectrum::itemChanged(quint64 signalFlag) {

  switch (signalFlag) {
  case signalStateChanged:
    Q_EMIT stateChanged();
    break;
  case signalDynamicYScaleChanged:
    Q_EMIT dynamicYScaleChanged();
    break;
  case signalLogarithmicHorizontalAxisChanged:
    Q_EMIT logarithmicHorizontalAxisChanged();
    break;
  case signalSpectrumShapeChanged:
    Q_EMIT spectrumShapeChanged();
    break;
  case signalNPointsChanged:
    Q_EMIT nPointsChanged();
    break;
  case signalHeightChanged:
    Q_EMIT heightChanged();
    break;
  case signalMinimumFrequencyChanged:
    Q_EMIT minimumFrequencyChanged();
    break;
  case signalMaximumFrequencyChanged:
    Q_EMIT maximumFrequencyChanged();
    break;
  case signalAvsyncDelayChanged:
    Q_EMIT avsyncDelayChanged();
    break;
  case signalSpectrumFpsCapChanged:
    Q_EMIT spectrumFpsCapChanged();
    break;
  }
}
