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

#include "settings.h"

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

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

  return s_globalArkSettings()->q;
}

ArkSettings::ArkSettings( )
  : KConfigSkeleton( QStringLiteral( "arkrc" ) )
{
  Q_ASSERT(!s_globalArkSettings()->q);
  s_globalArkSettings()->q = this;
  KConfigCompilerSignallingItem::NotifyFunction notifyFunction = static_cast<KConfigCompilerSignallingItem::NotifyFunction>(&ArkSettings::itemChanged);

  setCurrentGroup( QStringLiteral( "General" ) );

  KConfigCompilerSignallingItem  *itemShowEncryptionWarning;
  KConfigSkeleton::ItemBool  *innerItemShowEncryptionWarning;
  innerItemShowEncryptionWarning = new KConfigSkeleton::ItemBool( currentGroup(), QStringLiteral( "showEncryptionWarning" ), mShowEncryptionWarning, true );
  itemShowEncryptionWarning = new KConfigCompilerSignallingItem(innerItemShowEncryptionWarning, this, notifyFunction, signalShowEncryptionWarningChanged);
  itemShowEncryptionWarning->setLabel( QCoreApplication::translate("ArkSettings", "Whether to show a warning when creating zip archives with AES encryption.") );
  addItem( itemShowEncryptionWarning, QStringLiteral( "showEncryptionWarning" ) );
  QList<KConfigSkeleton::ItemEnum::Choice> valuesdefaultOpenAction;
  {
    KConfigSkeleton::ItemEnum::Choice choice;
    choice.name = QStringLiteral("Preview");
    valuesdefaultOpenAction.append( choice );
  }
  {
    KConfigSkeleton::ItemEnum::Choice choice;
    choice.name = QStringLiteral("Open");
    valuesdefaultOpenAction.append( choice );
  }
  KConfigCompilerSignallingItem  *itemDefaultOpenAction;
  KConfigSkeleton::ItemEnum  *innerItemDefaultOpenAction;
  innerItemDefaultOpenAction = new KConfigSkeleton::ItemEnum( currentGroup(), QStringLiteral( "defaultOpenAction" ), mDefaultOpenAction, valuesdefaultOpenAction, EnumDefaultOpenAction::Preview );
  itemDefaultOpenAction = new KConfigCompilerSignallingItem(innerItemDefaultOpenAction, this, notifyFunction, signalDefaultOpenActionChanged);
  itemDefaultOpenAction->setLabel( QCoreApplication::translate("ArkSettings", "Default action when opening archive entries.") );
  addItem( itemDefaultOpenAction, QStringLiteral( "defaultOpenAction" ) );

  setCurrentGroup( QStringLiteral( "Extraction" ) );

  KConfigCompilerSignallingItem  *itemOpenDestinationFolderAfterExtraction;
  KConfigSkeleton::ItemBool  *innerItemOpenDestinationFolderAfterExtraction;
  innerItemOpenDestinationFolderAfterExtraction = new KConfigSkeleton::ItemBool( currentGroup(), QStringLiteral( "openDestinationFolderAfterExtraction" ), mOpenDestinationFolderAfterExtraction, false );
  itemOpenDestinationFolderAfterExtraction = new KConfigCompilerSignallingItem(innerItemOpenDestinationFolderAfterExtraction, this, notifyFunction, signalOpenDestinationFolderAfterExtractionChanged);
  itemOpenDestinationFolderAfterExtraction->setLabel( QCoreApplication::translate("ArkSettings", "Open destination folder after extraction.") );
  addItem( itemOpenDestinationFolderAfterExtraction, QStringLiteral( "openDestinationFolderAfterExtraction" ) );
  KConfigCompilerSignallingItem  *itemCloseAfterExtraction;
  KConfigSkeleton::ItemBool  *innerItemCloseAfterExtraction;
  innerItemCloseAfterExtraction = new KConfigSkeleton::ItemBool( currentGroup(), QStringLiteral( "closeAfterExtraction" ), mCloseAfterExtraction, false );
  itemCloseAfterExtraction = new KConfigCompilerSignallingItem(innerItemCloseAfterExtraction, this, notifyFunction, signalCloseAfterExtractionChanged);
  itemCloseAfterExtraction->setLabel( QCoreApplication::translate("ArkSettings", "Close Ark after extraction.") );
  addItem( itemCloseAfterExtraction, QStringLiteral( "closeAfterExtraction" ) );
  KConfigCompilerSignallingItem  *itemPreservePaths;
  KConfigSkeleton::ItemBool  *innerItemPreservePaths;
  innerItemPreservePaths = new KConfigSkeleton::ItemBool( currentGroup(), QStringLiteral( "preservePaths" ), mPreservePaths, true );
  itemPreservePaths = new KConfigCompilerSignallingItem(innerItemPreservePaths, this, notifyFunction, signalPreservePathsChanged);
  itemPreservePaths->setLabel( QCoreApplication::translate("ArkSettings", "Preserve paths when extracting.") );
  addItem( itemPreservePaths, QStringLiteral( "preservePaths" ) );
  KConfigCompilerSignallingItem  *itemExtractToSubfolder;
  KConfigSkeleton::ItemBool  *innerItemExtractToSubfolder;
  innerItemExtractToSubfolder = new KConfigSkeleton::ItemBool( currentGroup(), QStringLiteral( "extractToSubfolder" ), mExtractToSubfolder, true );
  itemExtractToSubfolder = new KConfigCompilerSignallingItem(innerItemExtractToSubfolder, this, notifyFunction, signalExtractToSubfolderChanged);
  itemExtractToSubfolder->setLabel( QCoreApplication::translate("ArkSettings", "Extract to a subfolder if the archive has more than one top-level entry.") );
  addItem( itemExtractToSubfolder, QStringLiteral( "extractToSubfolder" ) );

  setCurrentGroup( QStringLiteral( "MainWindow" ) );

  QList<int> defaultsplitterSizes;
  defaultsplitterSizes.append( 200 );
  defaultsplitterSizes.append( 100 );

  KConfigCompilerSignallingItem  *itemSplitterSizes;
  KConfigSkeleton::ItemIntList  *innerItemSplitterSizes;
  innerItemSplitterSizes = new KConfigSkeleton::ItemIntList( currentGroup(), QStringLiteral( "splitterSizes" ), mSplitterSizes, defaultsplitterSizes );
  itemSplitterSizes = new KConfigCompilerSignallingItem(innerItemSplitterSizes, this, notifyFunction, signalSplitterSizesChanged);
  itemSplitterSizes->setLabel( QCoreApplication::translate("ArkSettings", "How the main window is divided.") );
  addItem( itemSplitterSizes, QStringLiteral( "splitterSizes" ) );
  KConfigCompilerSignallingItem  *itemShowInfoPanel;
  KConfigSkeleton::ItemBool  *innerItemShowInfoPanel;
  innerItemShowInfoPanel = new KConfigSkeleton::ItemBool( currentGroup(), QStringLiteral( "showInfoPanel" ), mShowInfoPanel, true );
  itemShowInfoPanel = new KConfigCompilerSignallingItem(innerItemShowInfoPanel, this, notifyFunction, signalShowInfoPanelChanged);
  itemShowInfoPanel->setLabel( QCoreApplication::translate("ArkSettings", "Whether to show the information panel.") );
  addItem( itemShowInfoPanel, QStringLiteral( "showInfoPanel" ) );

  setCurrentGroup( QStringLiteral( "Plugins" ) );

  KConfigCompilerSignallingItem  *itemDisabledPlugins;
  KConfigSkeleton::ItemStringList  *innerItemDisabledPlugins;
  innerItemDisabledPlugins = new KConfigSkeleton::ItemStringList( currentGroup(), QStringLiteral( "disabledPlugins" ), mDisabledPlugins );
  itemDisabledPlugins = new KConfigCompilerSignallingItem(innerItemDisabledPlugins, this, notifyFunction, signalDisabledPluginsChanged);
  itemDisabledPlugins->setLabel( QCoreApplication::translate("ArkSettings", "disabledPlugins") );
  addItem( itemDisabledPlugins, QStringLiteral( "disabledPlugins" ) );

  setCurrentGroup( QStringLiteral( "Preview" ) );

  KConfigCompilerSignallingItem  *itemLimitPreviewFileSize;
  KConfigSkeleton::ItemBool  *innerItemLimitPreviewFileSize;
  innerItemLimitPreviewFileSize = new KConfigSkeleton::ItemBool( currentGroup(), QStringLiteral( "limitPreviewFileSize" ), mLimitPreviewFileSize, true );
  itemLimitPreviewFileSize = new KConfigCompilerSignallingItem(innerItemLimitPreviewFileSize, this, notifyFunction, signalLimitPreviewFileSizeChanged);
  itemLimitPreviewFileSize->setLabel( QCoreApplication::translate("ArkSettings", "Whether to limit the preview according to file size.") );
  addItem( itemLimitPreviewFileSize, QStringLiteral( "limitPreviewFileSize" ) );
  KConfigCompilerSignallingItem  *itemPreviewFileSizeLimit;
  KConfigSkeleton::ItemInt  *innerItemPreviewFileSizeLimit;
  innerItemPreviewFileSizeLimit = new KConfigSkeleton::ItemInt( currentGroup(), QStringLiteral( "previewFileSizeLimit" ), mPreviewFileSizeLimit, 200 );
  itemPreviewFileSizeLimit = new KConfigCompilerSignallingItem(innerItemPreviewFileSizeLimit, this, notifyFunction, signalPreviewFileSizeLimitChanged);
  itemPreviewFileSizeLimit->setLabel( QCoreApplication::translate("ArkSettings", "Preview file size limit in megabytes.") );
  addItem( itemPreviewFileSizeLimit, QStringLiteral( "previewFileSizeLimit" ) );
}

ArkSettings::~ArkSettings()
{
  s_globalArkSettings()->q = nullptr;
}


void ArkSettings::itemChanged(quint64 flags) {

  if ( flags & signalShowEncryptionWarningChanged ) {
    Q_EMIT showEncryptionWarningChanged();
  }
  if ( flags & signalDefaultOpenActionChanged ) {
    Q_EMIT defaultOpenActionChanged();
  }
  if ( flags & signalOpenDestinationFolderAfterExtractionChanged ) {
    Q_EMIT openDestinationFolderAfterExtractionChanged();
  }
  if ( flags & signalCloseAfterExtractionChanged ) {
    Q_EMIT closeAfterExtractionChanged();
  }
  if ( flags & signalPreservePathsChanged ) {
    Q_EMIT preservePathsChanged();
  }
  if ( flags & signalExtractToSubfolderChanged ) {
    Q_EMIT extractToSubfolderChanged();
  }
  if ( flags & signalSplitterSizesChanged ) {
    Q_EMIT splitterSizesChanged();
  }
  if ( flags & signalShowInfoPanelChanged ) {
    Q_EMIT showInfoPanelChanged();
  }
  if ( flags & signalDisabledPluginsChanged ) {
    Q_EMIT disabledPluginsChanged();
  }
  if ( flags & signalLimitPreviewFileSizeChanged ) {
    Q_EMIT limitPreviewFileSizeChanged();
  }
  if ( flags & signalPreviewFileSizeLimitChanged ) {
    Q_EMIT previewFileSizeLimitChanged();
  }
}

#include "settings.moc"

