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

#include "camerasettings.h"

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

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

  return s_globalCameraSettings()->q;
}

CameraSettings::CameraSettings( QObject *parent )
  : KConfigSkeleton( QStringLiteral( "plasmacamerarc" ) )
{
  setParent(parent);
  Q_ASSERT(!s_globalCameraSettings()->q);
  s_globalCameraSettings()->q = this;
  KConfigCompilerSignallingItem::NotifyFunction notifyFunction = static_cast<KConfigCompilerSignallingItem::NotifyFunction>(&CameraSettings::itemChanged);

  setCurrentGroup( QStringLiteral( "General" ) );

  KConfigCompilerSignallingItem  *itemResolution;
  KConfigSkeleton::ItemSize  *innerItemResolution;
  innerItemResolution = new KConfigSkeleton::ItemSize( currentGroup(), QStringLiteral( "resolution" ), mResolution );
  itemResolution = new KConfigCompilerSignallingItem(innerItemResolution, this, notifyFunction, signalResolutionChanged);
  itemResolution->setWriteFlags(KConfigBase::Notify);
  addItem( itemResolution, QStringLiteral( "resolution" ) );
  KConfigCompilerSignallingItem  *itemCameraDeviceId;
  KConfigSkeleton::ItemString  *innerItemCameraDeviceId;
  innerItemCameraDeviceId = new KConfigSkeleton::ItemString( currentGroup(), QStringLiteral( "cameraDeviceId" ), mCameraDeviceId );
  itemCameraDeviceId = new KConfigCompilerSignallingItem(innerItemCameraDeviceId, this, notifyFunction, signalCameraDeviceIdChanged);
  itemCameraDeviceId->setWriteFlags(KConfigBase::Notify);
  addItem( itemCameraDeviceId, QStringLiteral( "cameraDeviceId" ) );
  KConfigCompilerSignallingItem  *itemCameraPosition;
  KConfigSkeleton::ItemInt  *innerItemCameraPosition;
  innerItemCameraPosition = new KConfigSkeleton::ItemInt( currentGroup(), QStringLiteral( "cameraPosition" ), mCameraPosition );
  itemCameraPosition = new KConfigCompilerSignallingItem(innerItemCameraPosition, this, notifyFunction, signalCameraPositionChanged);
  itemCameraPosition->setWriteFlags(KConfigBase::Notify);
  addItem( itemCameraPosition, QStringLiteral( "cameraPosition" ) );
  KConfigCompilerSignallingItem  *itemWhiteBalanceMode;
  KConfigSkeleton::ItemInt  *innerItemWhiteBalanceMode;
  innerItemWhiteBalanceMode = new KConfigSkeleton::ItemInt( currentGroup(), QStringLiteral( "whiteBalanceMode" ), mWhiteBalanceMode );
  itemWhiteBalanceMode = new KConfigCompilerSignallingItem(innerItemWhiteBalanceMode, this, notifyFunction, signalWhiteBalanceModeChanged);
  itemWhiteBalanceMode->setWriteFlags(KConfigBase::Notify);
  addItem( itemWhiteBalanceMode, QStringLiteral( "whiteBalanceMode" ) );
  KConfigCompilerSignallingItem  *itemVideoRecordingFps;
  KConfigSkeleton::ItemInt  *innerItemVideoRecordingFps;
  innerItemVideoRecordingFps = new KConfigSkeleton::ItemInt( currentGroup(), QStringLiteral( "videoRecordingFps" ), mVideoRecordingFps, 24 );
  itemVideoRecordingFps = new KConfigCompilerSignallingItem(innerItemVideoRecordingFps, this, notifyFunction, signalVideoRecordingFpsChanged);
  itemVideoRecordingFps->setWriteFlags(KConfigBase::Notify);
  addItem( itemVideoRecordingFps, QStringLiteral( "videoRecordingFps" ) );
  KConfigCompilerSignallingItem  *itemVideoRecordingQuality;
  KConfigSkeleton::ItemInt  *innerItemVideoRecordingQuality;
  innerItemVideoRecordingQuality = new KConfigSkeleton::ItemInt( currentGroup(), QStringLiteral( "videoRecordingQuality" ), mVideoRecordingQuality, 2 );
  itemVideoRecordingQuality = new KConfigCompilerSignallingItem(innerItemVideoRecordingQuality, this, notifyFunction, signalVideoRecordingQualityChanged);
  itemVideoRecordingQuality->setWriteFlags(KConfigBase::Notify);
  addItem( itemVideoRecordingQuality, QStringLiteral( "videoRecordingQuality" ) );
  KConfigCompilerSignallingItem  *itemVideoResolution;
  KConfigSkeleton::ItemInt  *innerItemVideoResolution;
  innerItemVideoResolution = new KConfigSkeleton::ItemInt( currentGroup(), QStringLiteral( "videoResolution" ), mVideoResolution, 0 );
  itemVideoResolution = new KConfigCompilerSignallingItem(innerItemVideoResolution, this, notifyFunction, signalVideoResolutionChanged);
  itemVideoResolution->setWriteFlags(KConfigBase::Notify);
  addItem( itemVideoResolution, QStringLiteral( "videoResolution" ) );
  KConfigCompilerSignallingItem  *itemVideoCodec;
  KConfigSkeleton::ItemInt  *innerItemVideoCodec;
  innerItemVideoCodec = new KConfigSkeleton::ItemInt( currentGroup(), QStringLiteral( "videoCodec" ), mVideoCodec, 0 );
  itemVideoCodec = new KConfigCompilerSignallingItem(innerItemVideoCodec, this, notifyFunction, signalVideoCodecChanged);
  itemVideoCodec->setWriteFlags(KConfigBase::Notify);
  addItem( itemVideoCodec, QStringLiteral( "videoCodec" ) );
  KConfigCompilerSignallingItem  *itemFilenamePattern;
  KConfigSkeleton::ItemInt  *innerItemFilenamePattern;
  innerItemFilenamePattern = new KConfigSkeleton::ItemInt( currentGroup(), QStringLiteral( "filenamePattern" ), mFilenamePattern, 0 );
  itemFilenamePattern = new KConfigCompilerSignallingItem(innerItemFilenamePattern, this, notifyFunction, signalFilenamePatternChanged);
  itemFilenamePattern->setWriteFlags(KConfigBase::Notify);
  addItem( itemFilenamePattern, QStringLiteral( "filenamePattern" ) );
  KConfigCompilerSignallingItem  *itemOutputPath;
  KConfigSkeleton::ItemInt  *innerItemOutputPath;
  innerItemOutputPath = new KConfigSkeleton::ItemInt( currentGroup(), QStringLiteral( "outputPath" ), mOutputPath, 0 );
  itemOutputPath = new KConfigCompilerSignallingItem(innerItemOutputPath, this, notifyFunction, signalOutputPathChanged);
  itemOutputPath->setWriteFlags(KConfigBase::Notify);
  addItem( itemOutputPath, QStringLiteral( "outputPath" ) );
}

int CameraSettings::defaultVideoRecordingFpsValue_helper()
{

  return 24;
}

int CameraSettings::defaultVideoRecordingQualityValue_helper()
{

  return 2;
}

int CameraSettings::defaultVideoResolutionValue_helper()
{

  return 0;
}

int CameraSettings::defaultVideoCodecValue_helper()
{

  return 0;
}

int CameraSettings::defaultFilenamePatternValue_helper()
{

  return 0;
}

int CameraSettings::defaultOutputPathValue_helper()
{

  return 0;
}

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


void CameraSettings::itemChanged(quint64 signalFlag) {

  switch (signalFlag) {
  case signalResolutionChanged:
    Q_EMIT resolutionChanged();
    break;
  case signalCameraDeviceIdChanged:
    Q_EMIT cameraDeviceIdChanged();
    break;
  case signalCameraPositionChanged:
    Q_EMIT cameraPositionChanged();
    break;
  case signalWhiteBalanceModeChanged:
    Q_EMIT whiteBalanceModeChanged();
    break;
  case signalVideoRecordingFpsChanged:
    Q_EMIT videoRecordingFpsChanged();
    break;
  case signalVideoRecordingQualityChanged:
    Q_EMIT videoRecordingQualityChanged();
    break;
  case signalVideoResolutionChanged:
    Q_EMIT videoResolutionChanged();
    break;
  case signalVideoCodecChanged:
    Q_EMIT videoCodecChanged();
    break;
  case signalFilenamePatternChanged:
    Q_EMIT filenamePatternChanged();
    break;
  case signalOutputPathChanged:
    Q_EMIT outputPathChanged();
    break;
  }
}
