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

#include "structviewpreferences.h"

#include <klocale.h>

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

using namespace Kasten2;

namespace Kasten2 {

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

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

  return s_globalStructViewPreferences->q;
}

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

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

  setCurrentGroup( QLatin1String( "StructureSettings" ) );

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

StructViewPreferences::~StructViewPreferences()
{
  if (!s_globalStructViewPreferences.isDestroyed()) {
    s_globalStructViewPreferences->q = 0;
  }
}

