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

#include "importerconfig.h"

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

using namespace Gwenview;

namespace Gwenview {

class ImporterConfigHelper
{
  public:
    ImporterConfigHelper() : q(nullptr) {}
    ~ImporterConfigHelper() { delete q; q = nullptr; }
    ImporterConfigHelper(const ImporterConfigHelper&) = delete;
    ImporterConfigHelper& operator=(const ImporterConfigHelper&) = delete;
    ImporterConfig *q;
};

}
Q_GLOBAL_STATIC(ImporterConfigHelper, s_globalImporterConfig)
ImporterConfig *ImporterConfig::self()
{
  if (!s_globalImporterConfig()->q) {
    new ImporterConfig;
    s_globalImporterConfig()->q->read();
  }

  return s_globalImporterConfig()->q;
}

ImporterConfig::ImporterConfig( )
  : KConfigSkeleton( QStringLiteral( "gwenview_importerrc" ) )
{
  Q_ASSERT(!s_globalImporterConfig()->q);
  s_globalImporterConfig()->q = this;
  setCurrentGroup( QStringLiteral( "General" ) );

  KConfigSkeleton::ItemUrl  *itemDestinationUrl;
  itemDestinationUrl = new KConfigSkeleton::ItemUrl( currentGroup(), QStringLiteral( "DestinationUrl" ), mDestinationUrl );
  addItem( itemDestinationUrl, QStringLiteral( "DestinationUrl" ) );
  KConfigSkeleton::ItemBool  *itemAutoRename;
  itemAutoRename = new KConfigSkeleton::ItemBool( currentGroup(), QStringLiteral( "AutoRename" ), mAutoRename, true );
  addItem( itemAutoRename, QStringLiteral( "AutoRename" ) );
  KConfigSkeleton::ItemString  *itemAutoRenameFormat;
  itemAutoRenameFormat = new KConfigSkeleton::ItemString( currentGroup(), QStringLiteral( "AutoRenameFormat" ), mAutoRenameFormat, QStringLiteral( "{date}_{time}.{ext.lower}" ) );
  addItem( itemAutoRenameFormat, QStringLiteral( "AutoRenameFormat" ) );
}

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

