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

#include "easyeffects_db_graph.h"

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

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

  return s_globalDbGraph()->q;
}

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

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

  setCurrentGroup( QStringLiteral( "Graph" ) );

  QList<KConfigBaseEE::ItemEnum::Choice> valuescolorScheme;
  {
    KConfigBaseEE::ItemEnum::Choice choice;
    choice.name = QStringLiteral("automatic");
    valuescolorScheme.append( choice );
  }
  {
    KConfigBaseEE::ItemEnum::Choice choice;
    choice.name = QStringLiteral("light");
    valuescolorScheme.append( choice );
  }
  {
    KConfigBaseEE::ItemEnum::Choice choice;
    choice.name = QStringLiteral("dark");
    valuescolorScheme.append( choice );
  }
  KConfigCompilerSignallingItem  *itemColorScheme;
  KConfigBaseEE::ItemEnum  *innerItemColorScheme;
  innerItemColorScheme = new KConfigBaseEE::ItemEnum( currentGroup(), QStringLiteral( "colorScheme" ), mColorScheme, valuescolorScheme, 2 );
  itemColorScheme = new KConfigCompilerSignallingItem(innerItemColorScheme, this, notifyFunction, signalColorSchemeChanged);
  itemColorScheme->setWriteFlags(KConfigBase::Notify);
  addItem( itemColorScheme, QStringLiteral( "colorScheme" ) );
  QList<KConfigBaseEE::ItemEnum::Choice> valuescolorTheme;
  {
    KConfigBaseEE::ItemEnum::Choice choice;
    choice.name = QStringLiteral("qtGreen");
    valuescolorTheme.append( choice );
  }
  {
    KConfigBaseEE::ItemEnum::Choice choice;
    choice.name = QStringLiteral("qtGreenNeon");
    valuescolorTheme.append( choice );
  }
  {
    KConfigBaseEE::ItemEnum::Choice choice;
    choice.name = QStringLiteral("mixSeries");
    valuescolorTheme.append( choice );
  }
  {
    KConfigBaseEE::ItemEnum::Choice choice;
    choice.name = QStringLiteral("orangeSeries");
    valuescolorTheme.append( choice );
  }
  {
    KConfigBaseEE::ItemEnum::Choice choice;
    choice.name = QStringLiteral("yellowSeries");
    valuescolorTheme.append( choice );
  }
  {
    KConfigBaseEE::ItemEnum::Choice choice;
    choice.name = QStringLiteral("blueSeries");
    valuescolorTheme.append( choice );
  }
  {
    KConfigBaseEE::ItemEnum::Choice choice;
    choice.name = QStringLiteral("purpleSeries");
    valuescolorTheme.append( choice );
  }
  {
    KConfigBaseEE::ItemEnum::Choice choice;
    choice.name = QStringLiteral("greySeries");
    valuescolorTheme.append( choice );
  }
  {
    KConfigBaseEE::ItemEnum::Choice choice;
    choice.name = QStringLiteral("userDefined");
    valuescolorTheme.append( choice );
  }
  KConfigCompilerSignallingItem  *itemColorTheme;
  KConfigBaseEE::ItemEnum  *innerItemColorTheme;
  innerItemColorTheme = new KConfigBaseEE::ItemEnum( currentGroup(), QStringLiteral( "colorTheme" ), mColorTheme, valuescolorTheme, 1 );
  itemColorTheme = new KConfigCompilerSignallingItem(innerItemColorTheme, this, notifyFunction, signalColorThemeChanged);
  itemColorTheme->setWriteFlags(KConfigBase::Notify);
  addItem( itemColorTheme, QStringLiteral( "colorTheme" ) );
  KConfigCompilerSignallingItem  *itemPlotAreaBackgroundColor;
  KConfigBaseEE::ItemColor  *innerItemPlotAreaBackgroundColor;
  innerItemPlotAreaBackgroundColor = new KConfigBaseEE::ItemColor( currentGroup(), QStringLiteral( "plotAreaBackgroundColor" ), mPlotAreaBackgroundColor, QColor( "#1f1f1f" ) );
  itemPlotAreaBackgroundColor = new KConfigCompilerSignallingItem(innerItemPlotAreaBackgroundColor, this, notifyFunction, signalPlotAreaBackgroundColorChanged);
  itemPlotAreaBackgroundColor->setWriteFlags(KConfigBase::Notify);
  addItem( itemPlotAreaBackgroundColor, QStringLiteral( "plotAreaBackgroundColor" ) );
  KConfigCompilerSignallingItem  *itemBackgroundColor;
  KConfigBaseEE::ItemColor  *innerItemBackgroundColor;
  innerItemBackgroundColor = new KConfigBaseEE::ItemColor( currentGroup(), QStringLiteral( "backgroundColor" ), mBackgroundColor, QColor( "#262626" ) );
  itemBackgroundColor = new KConfigCompilerSignallingItem(innerItemBackgroundColor, this, notifyFunction, signalBackgroundColorChanged);
  itemBackgroundColor->setWriteFlags(KConfigBase::Notify);
  addItem( itemBackgroundColor, QStringLiteral( "backgroundColor" ) );
  KConfigCompilerSignallingItem  *itemSeriesColors;
  KConfigBaseEE::ItemColor  *innerItemSeriesColors;
  innerItemSeriesColors = new KConfigBaseEE::ItemColor( currentGroup(), QStringLiteral( "seriesColors" ), mSeriesColors, QColor( "#000000" ) );
  itemSeriesColors = new KConfigCompilerSignallingItem(innerItemSeriesColors, this, notifyFunction, signalSeriesColorsChanged);
  itemSeriesColors->setWriteFlags(KConfigBase::Notify);
  addItem( itemSeriesColors, QStringLiteral( "seriesColors" ) );
  KConfigCompilerSignallingItem  *itemLabelTextColor;
  KConfigBaseEE::ItemColor  *innerItemLabelTextColor;
  innerItemLabelTextColor = new KConfigBaseEE::ItemColor( currentGroup(), QStringLiteral( "labelTextColor" ), mLabelTextColor, QColor( "#aeaeae" ) );
  itemLabelTextColor = new KConfigCompilerSignallingItem(innerItemLabelTextColor, this, notifyFunction, signalLabelTextColorChanged);
  itemLabelTextColor->setWriteFlags(KConfigBase::Notify);
  addItem( itemLabelTextColor, QStringLiteral( "labelTextColor" ) );
  KConfigCompilerSignallingItem  *itemLabelBackgroundColor;
  KConfigBaseEE::ItemColor  *innerItemLabelBackgroundColor;
  innerItemLabelBackgroundColor = new KConfigBaseEE::ItemColor( currentGroup(), QStringLiteral( "labelBackgroundColor" ), mLabelBackgroundColor, QColor( "#2e2e2e" ) );
  itemLabelBackgroundColor = new KConfigCompilerSignallingItem(innerItemLabelBackgroundColor, this, notifyFunction, signalLabelBackgroundColorChanged);
  itemLabelBackgroundColor->setWriteFlags(KConfigBase::Notify);
  addItem( itemLabelBackgroundColor, QStringLiteral( "labelBackgroundColor" ) );
  KConfigCompilerSignallingItem  *itemBorderColors;
  KConfigBaseEE::ItemColor  *innerItemBorderColors;
  innerItemBorderColors = new KConfigBaseEE::ItemColor( currentGroup(), QStringLiteral( "borderColors" ), mBorderColors, QColor( "#22d478" ) );
  itemBorderColors = new KConfigCompilerSignallingItem(innerItemBorderColors, this, notifyFunction, signalBorderColorsChanged);
  itemBorderColors->setWriteFlags(KConfigBase::Notify);
  addItem( itemBorderColors, QStringLiteral( "borderColors" ) );
  KConfigCompilerSignallingItem  *itemLineWidth;
  KConfigBaseEE::ItemDouble  *innerItemLineWidth;
  innerItemLineWidth = new KConfigBaseEE::ItemDouble( currentGroup(), QStringLiteral( "lineWidth" ), mLineWidth, 2 );
  itemLineWidth = new KConfigCompilerSignallingItem(innerItemLineWidth, this, notifyFunction, signalLineWidthChanged);
  innerItemLineWidth->setMinValue(0);
  innerItemLineWidth->setMaxValue(50);
  itemLineWidth->setWriteFlags(KConfigBase::Notify);
  addItem( itemLineWidth, QStringLiteral( "lineWidth" ) );
  KConfigCompilerSignallingItem  *itemGridVisible;
  KConfigBaseEE::ItemBool  *innerItemGridVisible;
  innerItemGridVisible = new KConfigBaseEE::ItemBool( currentGroup(), QStringLiteral( "gridVisible" ), mGridVisible, false );
  itemGridVisible = new KConfigCompilerSignallingItem(innerItemGridVisible, this, notifyFunction, signalGridVisibleChanged);
  itemGridVisible->setWriteFlags(KConfigBase::Notify);
  addItem( itemGridVisible, QStringLiteral( "gridVisible" ) );
}

int DbGraph::defaultColorSchemeValue_helper()
{

  return 2;
}

int DbGraph::defaultColorThemeValue_helper()
{

  return 1;
}

QColor DbGraph::defaultPlotAreaBackgroundColorValue_helper()
{

  return QColor( "#1f1f1f" );
}

QColor DbGraph::defaultBackgroundColorValue_helper()
{

  return QColor( "#262626" );
}

QColor DbGraph::defaultSeriesColorsValue_helper()
{

  return QColor( "#000000" );
}

QColor DbGraph::defaultLabelTextColorValue_helper()
{

  return QColor( "#aeaeae" );
}

QColor DbGraph::defaultLabelBackgroundColorValue_helper()
{

  return QColor( "#2e2e2e" );
}

QColor DbGraph::defaultBorderColorsValue_helper()
{

  return QColor( "#22d478" );
}

double DbGraph::defaultLineWidthValue_helper()
{

  return 2;
}

bool DbGraph::defaultGridVisibleValue_helper()
{

  return false;
}

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


void DbGraph::itemChanged(quint64 signalFlag) {

  switch (signalFlag) {
  case signalColorSchemeChanged:
    Q_EMIT colorSchemeChanged();
    break;
  case signalColorThemeChanged:
    Q_EMIT colorThemeChanged();
    break;
  case signalPlotAreaBackgroundColorChanged:
    Q_EMIT plotAreaBackgroundColorChanged();
    break;
  case signalBackgroundColorChanged:
    Q_EMIT backgroundColorChanged();
    break;
  case signalSeriesColorsChanged:
    Q_EMIT seriesColorsChanged();
    break;
  case signalLabelTextColorChanged:
    Q_EMIT labelTextColorChanged();
    break;
  case signalLabelBackgroundColorChanged:
    Q_EMIT labelBackgroundColorChanged();
    break;
  case signalBorderColorsChanged:
    Q_EMIT borderColorsChanged();
    break;
  case signalLineWidthChanged:
    Q_EMIT lineWidthChanged();
    break;
  case signalGridVisibleChanged:
    Q_EMIT gridVisibleChanged();
    break;
  }
}
