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

#include "structviewpreferences.h"

#include <klocalizedstring.h>

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

using namespace Kasten;

namespace Kasten {

class StructViewPreferencesHelper
{
  public:
    StructViewPreferencesHelper() : q(nullptr) {}
    ~StructViewPreferencesHelper() { delete q; }
    StructViewPreferences *q;
};
}

Q_GLOBAL_STATIC(StructViewPreferencesHelper, s_globalStructViewPreferences)
StructViewPreferences *StructViewPreferences::self()
{
  if (!s_globalStructViewPreferences()->q) {
    new StructViewPreferences;
    s_globalStructViewPreferences()->q->read();
  }

  return s_globalStructViewPreferences()->q;
}

StructViewPreferences::StructViewPreferences(  )
  : KConfigSkeleton( QStringLiteral( "oktetastructuresrc" ) )
{
  Q_ASSERT(!s_globalStructViewPreferences()->q);
  s_globalStructViewPreferences()->q = this;
  setCurrentGroup( QStringLiteral( "ValueDisplay" ) );

  mUnsignedDisplayBaseItem = new KConfigSkeleton::ItemInt( currentGroup(), QStringLiteral( "UnsignedDisplayBase" ), mUnsignedDisplayBase, 10 );
  mUnsignedDisplayBaseItem->setLabel( i18nd("liboktetakasten", "UnsignedDisplayBase") );
  mUnsignedDisplayBaseItem->setToolTip( i18ndc("liboktetakasten", "@info:tooltip", "The base to use when converting unsigned numbers to a string.") );
  addItem( mUnsignedDisplayBaseItem, QStringLiteral( "UnsignedDisplayBase" ) );
  mSignedDisplayBaseItem = new KConfigSkeleton::ItemInt( currentGroup(), QStringLiteral( "SignedDisplayBase" ), mSignedDisplayBase, 10 );
  mSignedDisplayBaseItem->setLabel( i18nd("liboktetakasten", "SignedDisplayBase") );
  mSignedDisplayBaseItem->setToolTip( i18ndc("liboktetakasten", "@info:tooltip", "The base to use when converting signed numbers to a string.") );
  addItem( mSignedDisplayBaseItem, QStringLiteral( "SignedDisplayBase" ) );
  mCharDisplayBaseItem = new KConfigSkeleton::ItemInt( currentGroup(), QStringLiteral( "CharDisplayBase" ), mCharDisplayBase, 10 );
  mCharDisplayBaseItem->setLabel( i18nd("liboktetakasten", "CharDisplayBase") );
  mCharDisplayBaseItem->setToolTip( i18ndc("liboktetakasten", "@info:tooltip", "The base to use when converting characters to a value string.") );
  addItem( mCharDisplayBaseItem, QStringLiteral( "CharDisplayBase" ) );
  mShowCharNumericalValueItem = new KConfigSkeleton::ItemBool( currentGroup(), QStringLiteral( "ShowCharNumericalValue" ), mShowCharNumericalValue, true );
  mShowCharNumericalValueItem->setLabel( i18nd("liboktetakasten", "ShowCharNumericalValue") );
  mShowCharNumericalValueItem->setToolTip( i18ndc("liboktetakasten", "@info:tooltip", "Whether to show the numerical value of chars") );
  addItem( mShowCharNumericalValueItem, QStringLiteral( "ShowCharNumericalValue" ) );
  mLocaleAwareFloatFormattingItem = new KConfigSkeleton::ItemBool( currentGroup(), QStringLiteral( "LocaleAwareFloatFormatting" ), mLocaleAwareFloatFormatting, false );
  mLocaleAwareFloatFormattingItem->setLabel( i18nd("liboktetakasten", "LocaleAwareFloatFormatting") );
  mLocaleAwareFloatFormattingItem->setToolTip( i18ndc("liboktetakasten", "@info:tooltip", "Whether to format floating point values according to the current locale") );
  addItem( mLocaleAwareFloatFormattingItem, QStringLiteral( "LocaleAwareFloatFormatting" ) );
  mShortTypeNamesItem = new KConfigSkeleton::ItemBool( currentGroup(), QStringLiteral( "ShortTypeNames" ), mShortTypeNames, true );
  mShortTypeNamesItem->setLabel( i18nd("liboktetakasten", "ShortTypeNames") );
  mShortTypeNamesItem->setToolTip( i18ndc("liboktetakasten", "@info:tooltip", "Whether to use short type names (i.e. uint32 instead of unsigned int)") );
  addItem( mShortTypeNamesItem, QStringLiteral( "ShortTypeNames" ) );
  mLocaleAwareDecimalFormattingItem = new KConfigSkeleton::ItemBool( currentGroup(), QStringLiteral( "LocaleAwareDecimalFormatting" ), mLocaleAwareDecimalFormatting, false );
  mLocaleAwareDecimalFormattingItem->setLabel( i18nd("liboktetakasten", "LocaleAwareDecimalFormatting") );
  mLocaleAwareDecimalFormattingItem->setToolTip( i18ndc("liboktetakasten", "@info:tooltip", "If true, integers being displayed in decimal format will be formatted according to the current locale settings") );
  mLocaleAwareDecimalFormattingItem->setWhatsThis( i18nd("liboktetakasten", "Whether to format integer values according to the current locale") );
  addItem( mLocaleAwareDecimalFormattingItem, QStringLiteral( "LocaleAwareDecimalFormatting" ) );
  mFloatPrecisionItem = new KConfigSkeleton::ItemInt( currentGroup(), QStringLiteral( "FloatPrecision" ), mFloatPrecision, 3 );
  mFloatPrecisionItem->setMinValue(-1);
  mFloatPrecisionItem->setMaxValue(100);
  mFloatPrecisionItem->setLabel( i18nd("liboktetakasten", "FloatPrecision") );
  mFloatPrecisionItem->setToolTip( i18ndc("liboktetakasten", "@info:tooltip", "The precision used for converting floating-point numbers to strings (number of decimal digits)") );
  addItem( mFloatPrecisionItem, QStringLiteral( "FloatPrecision" ) );

  setCurrentGroup( QStringLiteral( "StructureSettings" ) );

  QList<KConfigSkeleton::ItemEnum::Choice> valuesByteOrder;
  {
    KConfigSkeleton::ItemEnum::Choice choice;
    choice.name = QStringLiteral("BigEndian");
    choice.label = i18ndc("liboktetakasten", "@item:inlistbox", "Big endian");
    valuesByteOrder.append( choice );
  }
  {
    KConfigSkeleton::ItemEnum::Choice choice;
    choice.name = QStringLiteral("LittleEndian");
    choice.label = i18ndc("liboktetakasten", "@item:inlistbox", "Little endian");
    valuesByteOrder.append( choice );
  }
  mByteOrderItem = new KConfigSkeleton::ItemEnum( currentGroup(), QStringLiteral( "ByteOrder" ), mByteOrder, valuesByteOrder, QSysInfo::LittleEndian );
  mByteOrderItem->setLabel( i18ndc("liboktetakasten", "@label:listbox", "Byte order") );
  addItem( mByteOrderItem, QStringLiteral( "ByteOrder" ) );
  mLoadedStructuresItem = new KConfigSkeleton::ItemStringList( currentGroup(), QStringLiteral( "LoadedStructures" ), mLoadedStructures );
  mLoadedStructuresItem->setLabel( i18nd("liboktetakasten", "LoadedStructures") );
  addItem( mLoadedStructuresItem, QStringLiteral( "LoadedStructures" ) );
}

StructViewPreferences::~StructViewPreferences()
{
  s_globalStructViewPreferences()->q = nullptr;
}

