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

#include "globalsettings.h"

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

using namespace Clazy;

namespace Clazy {

class GlobalSettingsHelper
{
  public:
    GlobalSettingsHelper() : q(nullptr) {}
    ~GlobalSettingsHelper() { delete q; }
    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()
  , mSettingsChanged(0)
{
  Q_ASSERT(!s_globalGlobalSettings()->q);
  s_globalGlobalSettings()->q = this;
  KConfigCompilerSignallingItem::NotifyFunction notifyFunction = static_cast<KConfigCompilerSignallingItem::NotifyFunction>(&GlobalSettings::itemChanged);

  setCurrentGroup( QStringLiteral( "Clazy" ) );

  KConfigSkeleton::ItemUrl  *itemExecutablePath;
  itemExecutablePath = new KConfigSkeleton::ItemUrl( currentGroup(), QStringLiteral( "executablePath" ), mExecutablePath, JobGlobalParameters::defaultExecutablePath() );
  addItem( itemExecutablePath, QStringLiteral( "executablePath" ) );
  KConfigCompilerSignallingItem  *itemDocsPath;
  itemDocsPath = new KConfigCompilerSignallingItem(new KConfigSkeleton::ItemUrl( currentGroup(), QStringLiteral( "docsPath" ), mDocsPath, JobGlobalParameters::defaultDocsPath() ), this, notifyFunction, signalDocsPathChanged);
  addItem( itemDocsPath, QStringLiteral( "docsPath" ) );
  KConfigSkeleton::ItemBool  *itemParallelJobsEnabled;
  itemParallelJobsEnabled = new KConfigSkeleton::ItemBool( currentGroup(), QStringLiteral( "parallelJobsEnabled" ), mParallelJobsEnabled, true );
  addItem( itemParallelJobsEnabled, QStringLiteral( "parallelJobsEnabled" ) );
  KConfigSkeleton::ItemBool  *itemParallelJobsAutoCount;
  itemParallelJobsAutoCount = new KConfigSkeleton::ItemBool( currentGroup(), QStringLiteral( "parallelJobsAutoCount" ), mParallelJobsAutoCount, true );
  addItem( itemParallelJobsAutoCount, QStringLiteral( "parallelJobsAutoCount" ) );
  KConfigSkeleton::ItemInt  *itemParallelJobsFixedCount;
  itemParallelJobsFixedCount = new KConfigSkeleton::ItemInt( currentGroup(), QStringLiteral( "parallelJobsFixedCount" ), mParallelJobsFixedCount, 2 );
  addItem( itemParallelJobsFixedCount, QStringLiteral( "parallelJobsFixedCount" ) );
  KConfigSkeleton::ItemBool  *itemHideOutputView;
  itemHideOutputView = new KConfigSkeleton::ItemBool( currentGroup(), QStringLiteral( "hideOutputView" ), mHideOutputView, true );
  addItem( itemHideOutputView, QStringLiteral( "hideOutputView" ) );
  KConfigSkeleton::ItemBool  *itemVerboseOutput;
  itemVerboseOutput = new KConfigSkeleton::ItemBool( currentGroup(), QStringLiteral( "verboseOutput" ), mVerboseOutput, false );
  addItem( itemVerboseOutput, QStringLiteral( "verboseOutput" ) );
}

GlobalSettings::~GlobalSettings()
{
  s_globalGlobalSettings()->q = nullptr;
}

bool GlobalSettings::usrSave()
{
  const bool res = KConfigSkeleton::usrSave();
  if (!res) return false;

  if ( mSettingsChanged & signalDocsPathChanged )
    Q_EMIT docsPathChanged();
  mSettingsChanged = 0;
  return true;
}

void GlobalSettings::itemChanged(quint64 flags) {
  mSettingsChanged |= flags;

}

#include "globalsettings.moc"

