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

#include "settings.h"

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

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

  return s_globalKronometerConfig()->q;
}

KronometerConfig::KronometerConfig( )
  : KConfigSkeleton( QStringLiteral( "kronometerrc" ) )
{
  Q_ASSERT(!s_globalKronometerConfig()->q);
  s_globalKronometerConfig()->q = this;
  KConfigCompilerSignallingItem::NotifyFunction notifyFunction = static_cast<KConfigCompilerSignallingItem::NotifyFunction>(&KronometerConfig::itemChanged);

  setCurrentGroup( QStringLiteral( "General" ) );

  KConfigCompilerSignallingItem  *itemStartTimerImmediately;
  KConfigSkeleton::ItemBool  *innerItemStartTimerImmediately;
  innerItemStartTimerImmediately = new KConfigSkeleton::ItemBool( currentGroup(), QStringLiteral( "startTimerImmediately" ), mStartTimerImmediately, false );
  itemStartTimerImmediately = new KConfigCompilerSignallingItem(innerItemStartTimerImmediately, this, notifyFunction, signalStartTimerImmediatelyChanged);
  addItem( itemStartTimerImmediately, QStringLiteral( "startTimerImmediately" ) );
  KConfigCompilerSignallingItem  *itemShowHours;
  KConfigSkeleton::ItemBool  *innerItemShowHours;
  innerItemShowHours = new KConfigSkeleton::ItemBool( currentGroup(), QStringLiteral( "showHours" ), mShowHours, false );
  itemShowHours = new KConfigCompilerSignallingItem(innerItemShowHours, this, notifyFunction, signalShowHoursChanged);
  addItem( itemShowHours, QStringLiteral( "showHours" ) );
  KConfigCompilerSignallingItem  *itemShowMinutes;
  KConfigSkeleton::ItemBool  *innerItemShowMinutes;
  innerItemShowMinutes = new KConfigSkeleton::ItemBool( currentGroup(), QStringLiteral( "showMinutes" ), mShowMinutes, true );
  itemShowMinutes = new KConfigCompilerSignallingItem(innerItemShowMinutes, this, notifyFunction, signalShowMinutesChanged);
  addItem( itemShowMinutes, QStringLiteral( "showMinutes" ) );
  KConfigCompilerSignallingItem  *itemShowSecondFractions;
  KConfigSkeleton::ItemBool  *innerItemShowSecondFractions;
  innerItemShowSecondFractions = new KConfigSkeleton::ItemBool( currentGroup(), QStringLiteral( "showSecondFractions" ), mShowSecondFractions, true );
  itemShowSecondFractions = new KConfigCompilerSignallingItem(innerItemShowSecondFractions, this, notifyFunction, signalShowSecondFractionsChanged);
  addItem( itemShowSecondFractions, QStringLiteral( "showSecondFractions" ) );
  QList<KConfigSkeleton::ItemEnum::Choice> valuesfractionsType;
  {
    KConfigSkeleton::ItemEnum::Choice choice;
    choice.name = QStringLiteral("UpToTenths");
    valuesfractionsType.append( choice );
  }
  {
    KConfigSkeleton::ItemEnum::Choice choice;
    choice.name = QStringLiteral("UpToHundredths");
    valuesfractionsType.append( choice );
  }
  {
    KConfigSkeleton::ItemEnum::Choice choice;
    choice.name = QStringLiteral("UpToMilliseconds");
    valuesfractionsType.append( choice );
  }
  {
    KConfigSkeleton::ItemEnum::Choice choice;
    choice.name = QStringLiteral("NoFractions");
    valuesfractionsType.append( choice );
  }
  KConfigCompilerSignallingItem  *itemFractionsType;
  KConfigSkeleton::ItemEnum  *innerItemFractionsType;
  innerItemFractionsType = new KConfigSkeleton::ItemEnum( currentGroup(), QStringLiteral( "fractionsType" ), mFractionsType, valuesfractionsType, TimeFormat::UpToHundredths );
  itemFractionsType = new KConfigCompilerSignallingItem(innerItemFractionsType, this, notifyFunction, signalFractionsTypeChanged);
  addItem( itemFractionsType, QStringLiteral( "fractionsType" ) );
  KConfigCompilerSignallingItem  *itemIsLapsRecordingEnabled;
  KConfigSkeleton::ItemBool  *innerItemIsLapsRecordingEnabled;
  innerItemIsLapsRecordingEnabled = new KConfigSkeleton::ItemBool( currentGroup(), QStringLiteral( "isLapsRecordingEnabled" ), mIsLapsRecordingEnabled, true );
  itemIsLapsRecordingEnabled = new KConfigCompilerSignallingItem(innerItemIsLapsRecordingEnabled, this, notifyFunction, signalIsLapsRecordingEnabledChanged);
  addItem( itemIsLapsRecordingEnabled, QStringLiteral( "isLapsRecordingEnabled" ) );
  KConfigCompilerSignallingItem  *itemShowLapHours;
  KConfigSkeleton::ItemBool  *innerItemShowLapHours;
  innerItemShowLapHours = new KConfigSkeleton::ItemBool( currentGroup(), QStringLiteral( "showLapHours" ), mShowLapHours, false );
  itemShowLapHours = new KConfigCompilerSignallingItem(innerItemShowLapHours, this, notifyFunction, signalShowLapHoursChanged);
  addItem( itemShowLapHours, QStringLiteral( "showLapHours" ) );
  KConfigCompilerSignallingItem  *itemShowLapMinutes;
  KConfigSkeleton::ItemBool  *innerItemShowLapMinutes;
  innerItemShowLapMinutes = new KConfigSkeleton::ItemBool( currentGroup(), QStringLiteral( "showLapMinutes" ), mShowLapMinutes, true );
  itemShowLapMinutes = new KConfigCompilerSignallingItem(innerItemShowLapMinutes, this, notifyFunction, signalShowLapMinutesChanged);
  addItem( itemShowLapMinutes, QStringLiteral( "showLapMinutes" ) );
  KConfigCompilerSignallingItem  *itemShowLapSecondFractions;
  KConfigSkeleton::ItemBool  *innerItemShowLapSecondFractions;
  innerItemShowLapSecondFractions = new KConfigSkeleton::ItemBool( currentGroup(), QStringLiteral( "showLapSecondFractions" ), mShowLapSecondFractions, true );
  itemShowLapSecondFractions = new KConfigCompilerSignallingItem(innerItemShowLapSecondFractions, this, notifyFunction, signalShowLapSecondFractionsChanged);
  addItem( itemShowLapSecondFractions, QStringLiteral( "showLapSecondFractions" ) );
  QList<KConfigSkeleton::ItemEnum::Choice> valueslapFractionsType;
  {
    KConfigSkeleton::ItemEnum::Choice choice;
    choice.name = QStringLiteral("UpToTenths");
    valueslapFractionsType.append( choice );
  }
  {
    KConfigSkeleton::ItemEnum::Choice choice;
    choice.name = QStringLiteral("UpToHundredths");
    valueslapFractionsType.append( choice );
  }
  {
    KConfigSkeleton::ItemEnum::Choice choice;
    choice.name = QStringLiteral("UpToMilliseconds");
    valueslapFractionsType.append( choice );
  }
  {
    KConfigSkeleton::ItemEnum::Choice choice;
    choice.name = QStringLiteral("NoFractions");
    valueslapFractionsType.append( choice );
  }
  KConfigCompilerSignallingItem  *itemLapFractionsType;
  KConfigSkeleton::ItemEnum  *innerItemLapFractionsType;
  innerItemLapFractionsType = new KConfigSkeleton::ItemEnum( currentGroup(), QStringLiteral( "lapFractionsType" ), mLapFractionsType, valueslapFractionsType, TimeFormat::UpToHundredths );
  itemLapFractionsType = new KConfigCompilerSignallingItem(innerItemLapFractionsType, this, notifyFunction, signalLapFractionsTypeChanged);
  addItem( itemLapFractionsType, QStringLiteral( "lapFractionsType" ) );
  KConfigCompilerSignallingItem  *itemShowLapAbsoluteTimes;
  KConfigSkeleton::ItemBool  *innerItemShowLapAbsoluteTimes;
  innerItemShowLapAbsoluteTimes = new KConfigSkeleton::ItemBool( currentGroup(), QStringLiteral( "showLapAbsoluteTimes" ), mShowLapAbsoluteTimes, false );
  itemShowLapAbsoluteTimes = new KConfigCompilerSignallingItem(innerItemShowLapAbsoluteTimes, this, notifyFunction, signalShowLapAbsoluteTimesChanged);
  addItem( itemShowLapAbsoluteTimes, QStringLiteral( "showLapAbsoluteTimes" ) );
  KConfigCompilerSignallingItem  *itemShowLapNotes;
  KConfigSkeleton::ItemBool  *innerItemShowLapNotes;
  innerItemShowLapNotes = new KConfigSkeleton::ItemBool( currentGroup(), QStringLiteral( "showLapNotes" ), mShowLapNotes, true );
  itemShowLapNotes = new KConfigCompilerSignallingItem(innerItemShowLapNotes, this, notifyFunction, signalShowLapNotesChanged);
  addItem( itemShowLapNotes, QStringLiteral( "showLapNotes" ) );
  KConfigCompilerSignallingItem  *itemMenuBarNeverShown;
  KConfigSkeleton::ItemBool  *innerItemMenuBarNeverShown;
  innerItemMenuBarNeverShown = new KConfigSkeleton::ItemBool( currentGroup(), QStringLiteral( "menuBarNeverShown" ), mMenuBarNeverShown, true );
  itemMenuBarNeverShown = new KConfigCompilerSignallingItem(innerItemMenuBarNeverShown, this, notifyFunction, signalMenuBarNeverShownChanged);
  addItem( itemMenuBarNeverShown, QStringLiteral( "menuBarNeverShown" ) );

  setCurrentGroup( QStringLiteral( "Font" ) );


                QFont defaultFont(QFontDatabase::systemFont(QFontDatabase::GeneralFont).family(), 54);
            
  KConfigCompilerSignallingItem  *itemHourFont;
  KConfigSkeleton::ItemFont  *innerItemHourFont;
  innerItemHourFont = new KConfigSkeleton::ItemFont( currentGroup(), QStringLiteral( "hourFont" ), mHourFont, defaultFont );
  itemHourFont = new KConfigCompilerSignallingItem(innerItemHourFont, this, notifyFunction, signalHourFontChanged);
  addItem( itemHourFont, QStringLiteral( "hourFont" ) );
  KConfigCompilerSignallingItem  *itemMinFont;
  KConfigSkeleton::ItemFont  *innerItemMinFont;
  innerItemMinFont = new KConfigSkeleton::ItemFont( currentGroup(), QStringLiteral( "minFont" ), mMinFont, defaultFont );
  itemMinFont = new KConfigCompilerSignallingItem(innerItemMinFont, this, notifyFunction, signalMinFontChanged);
  addItem( itemMinFont, QStringLiteral( "minFont" ) );
  KConfigCompilerSignallingItem  *itemSecFont;
  KConfigSkeleton::ItemFont  *innerItemSecFont;
  innerItemSecFont = new KConfigSkeleton::ItemFont( currentGroup(), QStringLiteral( "secFont" ), mSecFont, defaultFont );
  itemSecFont = new KConfigCompilerSignallingItem(innerItemSecFont, this, notifyFunction, signalSecFontChanged);
  addItem( itemSecFont, QStringLiteral( "secFont" ) );
  KConfigCompilerSignallingItem  *itemFracFont;
  KConfigSkeleton::ItemFont  *innerItemFracFont;
  innerItemFracFont = new KConfigSkeleton::ItemFont( currentGroup(), QStringLiteral( "fracFont" ), mFracFont, defaultFont );
  itemFracFont = new KConfigCompilerSignallingItem(innerItemFracFont, this, notifyFunction, signalFracFontChanged);
  addItem( itemFracFont, QStringLiteral( "fracFont" ) );

  setCurrentGroup( QStringLiteral( "Color" ) );


                KColorScheme schemeView(QPalette::Active, KColorScheme::View);
                QColor defaultColor = schemeView.background().color();
            
  KConfigCompilerSignallingItem  *itemBackgroundColor;
  KConfigSkeleton::ItemColor  *innerItemBackgroundColor;
  innerItemBackgroundColor = new KConfigSkeleton::ItemColor( currentGroup(), QStringLiteral( "backgroundColor" ), mBackgroundColor, defaultColor );
  itemBackgroundColor = new KConfigCompilerSignallingItem(innerItemBackgroundColor, this, notifyFunction, signalBackgroundColorChanged);
  addItem( itemBackgroundColor, QStringLiteral( "backgroundColor" ) );

                defaultColor = schemeView.foreground().color();
            
  KConfigCompilerSignallingItem  *itemTextColor;
  KConfigSkeleton::ItemColor  *innerItemTextColor;
  innerItemTextColor = new KConfigSkeleton::ItemColor( currentGroup(), QStringLiteral( "textColor" ), mTextColor, defaultColor );
  itemTextColor = new KConfigCompilerSignallingItem(innerItemTextColor, this, notifyFunction, signalTextColorChanged);
  addItem( itemTextColor, QStringLiteral( "textColor" ) );
}

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


void KronometerConfig::itemChanged(quint64 signalFlag) {

  switch (signalFlag) {
  case signalStartTimerImmediatelyChanged:
    Q_EMIT startTimerImmediatelyChanged();
    break;
  case signalShowHoursChanged:
    Q_EMIT showHoursChanged();
    break;
  case signalShowMinutesChanged:
    Q_EMIT showMinutesChanged();
    break;
  case signalShowSecondFractionsChanged:
    Q_EMIT showSecondFractionsChanged();
    break;
  case signalFractionsTypeChanged:
    Q_EMIT fractionsTypeChanged();
    break;
  case signalIsLapsRecordingEnabledChanged:
    Q_EMIT isLapsRecordingEnabledChanged();
    break;
  case signalShowLapHoursChanged:
    Q_EMIT showLapHoursChanged();
    break;
  case signalShowLapMinutesChanged:
    Q_EMIT showLapMinutesChanged();
    break;
  case signalShowLapSecondFractionsChanged:
    Q_EMIT showLapSecondFractionsChanged();
    break;
  case signalLapFractionsTypeChanged:
    Q_EMIT lapFractionsTypeChanged();
    break;
  case signalShowLapAbsoluteTimesChanged:
    Q_EMIT showLapAbsoluteTimesChanged();
    break;
  case signalShowLapNotesChanged:
    Q_EMIT showLapNotesChanged();
    break;
  case signalMenuBarNeverShownChanged:
    Q_EMIT menuBarNeverShownChanged();
    break;
  case signalHourFontChanged:
    Q_EMIT hourFontChanged();
    break;
  case signalMinFontChanged:
    Q_EMIT minFontChanged();
    break;
  case signalSecFontChanged:
    Q_EMIT secFontChanged();
    break;
  case signalFracFontChanged:
    Q_EMIT fracFontChanged();
    break;
  case signalBackgroundColorChanged:
    Q_EMIT backgroundColorChanged();
    break;
  case signalTextColorChanged:
    Q_EMIT textColorChanged();
    break;
  }
}

#include "settings.moc"

