#include <kdialog.h>
#include <tdelocale.h>

/****************************************************************************
** Form implementation generated from reading ui file 'kcmmiscwidget.ui'
**
** Created by: The TQt user interface compiler (TQt 3.5.0)
**
** WARNING! All changes made in this file will be lost!
****************************************************************************/

#include "kcmmiscwidget.h"

#include <ntqvariant.h>
#include <kdialog.h>
#include <knuminput.h>
#include <ntqpushbutton.h>
#include <ntqbuttongroup.h>
#include <ntqradiobutton.h>
#include <ntqgroupbox.h>
#include <ntqlabel.h>
#include <ntqslider.h>
#include <ntqcheckbox.h>
#include <ntqlayout.h>
#include <ntqtooltip.h>
#include <ntqwhatsthis.h>

/*
 *  Constructs a KeyboardConfigWidget as a child of 'parent', with the
 *  name 'name' and widget flags set to 'f'.
 */
KeyboardConfigWidget::KeyboardConfigWidget( TQWidget* parent, const char* name, WFlags fl )
    : TQWidget( parent, name, fl )
{
    if ( !name )
	setName( "KeyboardConfigWidget" );
    KeyboardConfigWidgetLayout = new TQGridLayout( this, 1, 1, 0, KDialog::spacingHint(), "KeyboardConfigWidgetLayout"); 

    numlockGroup = new TQButtonGroup( this, "numlockGroup" );
    numlockGroup->setFrameShape( TQButtonGroup::GroupBoxPanel );
    numlockGroup->setFrameShadow( TQButtonGroup::Sunken );
    numlockGroup->setColumnLayout(0, TQt::Vertical );
    numlockGroup->layout()->setSpacing( KDialog::spacingHint() );
    numlockGroup->layout()->setMargin( KDialog::marginHint() );
    numlockGroupLayout = new TQGridLayout( numlockGroup->layout() );
    numlockGroupLayout->setAlignment( TQt::AlignTop );

    RadioButton1_2 = new TQRadioButton( numlockGroup, "RadioButton1_2" );
    numlockGroup->insert( RadioButton1_2, 1 );

    numlockGroupLayout->addWidget( RadioButton1_2, 1, 0 );

    RadioButton1_3 = new TQRadioButton( numlockGroup, "RadioButton1_3" );
    numlockGroup->insert( RadioButton1_3, 2 );

    numlockGroupLayout->addWidget( RadioButton1_3, 2, 0 );

    RadioButton1 = new TQRadioButton( numlockGroup, "RadioButton1" );
    numlockGroup->insert( RadioButton1, 0 );

    numlockGroupLayout->addWidget( RadioButton1, 0, 0 );

    KeyboardConfigWidgetLayout->addMultiCellWidget( numlockGroup, 1, 1, 0, 1 );

    groupBox1 = new TQGroupBox( this, "groupBox1" );
    groupBox1->setColumnLayout(0, TQt::Vertical );
    groupBox1->layout()->setSpacing( KDialog::spacingHint() );
    groupBox1->layout()->setMargin( KDialog::marginHint() );
    groupBox1Layout = new TQGridLayout( groupBox1->layout() );
    groupBox1Layout->setAlignment( TQt::AlignTop );

    lblDelay = new TQLabel( groupBox1, "lblDelay" );
    lblDelay->setSizePolicy( TQSizePolicy( (TQSizePolicy::SizeType)0, (TQSizePolicy::SizeType)5, 0, 0, lblDelay->sizePolicy().hasHeightForWidth() ) );

    groupBox1Layout->addWidget( lblDelay, 2, 0 );

    delaySlider = new TQSlider( groupBox1, "delaySlider" );
    delaySlider->setMinValue( 0 );
    delaySlider->setMaxValue( 10000 );
    delaySlider->setLineStep( 1000 );
    delaySlider->setPageStep( 1000 );
    delaySlider->setValue( 5000 );
    delaySlider->setOrientation( TQSlider::Horizontal );
    delaySlider->setTickmarks( TQSlider::Below );
    delaySlider->setTickInterval( 1000 );

    groupBox1Layout->addWidget( delaySlider, 2, 1 );

    delay = new KIntNumInput( groupBox1, "delay" );
    delay->setValue( 250 );
    delay->setMinValue( 100 );
    delay->setMaxValue( 5000 );

    groupBox1Layout->addWidget( delay, 2, 2 );

    lblRate = new TQLabel( groupBox1, "lblRate" );
    lblRate->setSizePolicy( TQSizePolicy( (TQSizePolicy::SizeType)0, (TQSizePolicy::SizeType)5, 0, 0, lblRate->sizePolicy().hasHeightForWidth() ) );

    groupBox1Layout->addWidget( lblRate, 3, 0 );

    rateSlider = new TQSlider( groupBox1, "rateSlider" );
    rateSlider->setMinValue( 0 );
    rateSlider->setMaxValue( 10000 );
    rateSlider->setLineStep( 1000 );
    rateSlider->setPageStep( 1000 );
    rateSlider->setValue( 5000 );
    rateSlider->setOrientation( TQSlider::Horizontal );
    rateSlider->setTickmarks( TQSlider::Below );
    rateSlider->setTickInterval( 1000 );

    groupBox1Layout->addWidget( rateSlider, 3, 1 );

    rate = new KDoubleNumInput( groupBox1, "rate" );
    rate->setValue( 30 );
    rate->setMinValue( 0.2 );
    rate->setPrecision( 1 );
    rate->setMaxValue( 50.0 );

    groupBox1Layout->addWidget( rate, 3, 2 );

    repeatBox = new TQCheckBox( groupBox1, "repeatBox" );
    repeatBox->setChecked( true );

    groupBox1Layout->addMultiCellWidget( repeatBox, 0, 0, 0, 1 );

    KeyboardConfigWidgetLayout->addMultiCellWidget( groupBox1, 0, 0, 0, 1 );

    click = new KIntNumInput( this, "click" );
    click->setValue( 0 );
    click->setMinValue( 0 );
    click->setMaxValue( 100 );

    KeyboardConfigWidgetLayout->addWidget( click, 2, 1 );

    TextLabel1 = new TQLabel( this, "TextLabel1" );
    TextLabel1->setSizePolicy( TQSizePolicy( (TQSizePolicy::SizeType)0, (TQSizePolicy::SizeType)5, 0, 0, TextLabel1->sizePolicy().hasHeightForWidth() ) );

    KeyboardConfigWidgetLayout->addWidget( TextLabel1, 2, 0 );
    languageChange();
    resize( TQSize(599, 284).expandedTo(minimumSizeHint()) );
    clearWState( WState_Polished );

    // signals and slots connections
    connect( repeatBox, TQ_SIGNAL( toggled(bool) ), delaySlider, TQ_SLOT( setEnabled(bool) ) );
    connect( repeatBox, TQ_SIGNAL( toggled(bool) ), delay, TQ_SLOT( setEnabled(bool) ) );
    connect( repeatBox, TQ_SIGNAL( toggled(bool) ), rateSlider, TQ_SLOT( setEnabled(bool) ) );
    connect( repeatBox, TQ_SIGNAL( toggled(bool) ), rate, TQ_SLOT( setEnabled(bool) ) );
    connect( repeatBox, TQ_SIGNAL( toggled(bool) ), lblDelay, TQ_SLOT( setEnabled(bool) ) );
    connect( repeatBox, TQ_SIGNAL( toggled(bool) ), lblRate, TQ_SLOT( setEnabled(bool) ) );

    // tab order
    setTabOrder( repeatBox, click );
    setTabOrder( click, RadioButton1 );
    setTabOrder( RadioButton1, RadioButton1_2 );
    setTabOrder( RadioButton1_2, RadioButton1_3 );

    // buddies
    lblDelay->setBuddy( delay );
    lblRate->setBuddy( rate );
    TextLabel1->setBuddy( click );
}

/*
 *  Destroys the object and frees any allocated resources
 */
KeyboardConfigWidget::~KeyboardConfigWidget()
{
    // no need to delete child widgets, TQt does it all for us
}

/*
 *  Sets the strings of the subwidgets using the current
 *  language.
 */
void KeyboardConfigWidget::languageChange()
{
    numlockGroup->setTitle( tr2i18n( "NumLock on TDE Startup" ) );
    TQWhatsThis::add( numlockGroup, tr2i18n( "If supported, this option allows you to setup the state of NumLock after TDE startup.<p>You can configure NumLock to be turned on or off, or configure TDE not to set NumLock state." ) );
    RadioButton1_2->setText( tr2i18n( "Turn o&ff" ) );
    RadioButton1_3->setText( tr2i18n( "Leave unchan&ged" ) );
    RadioButton1->setText( tr2i18n( "T&urn on" ) );
    groupBox1->setTitle( tr2i18n( "Keyboard Repeat" ) );
    lblDelay->setText( tr2i18n( "&Delay:" ) );
    TQWhatsThis::add( delaySlider, tr2i18n( "If supported, this option allows you to set the delay after which a pressed key will start generating keycodes. The 'Repeat rate' option controls the frequency of these keycodes." ) );
    delay->setSuffix( tr2i18n( " msec" ) );
    TQWhatsThis::add( delay, tr2i18n( "If supported, this option allows you to set the delay after which a pressed key will start generating keycodes. The 'Repeat rate' option controls the frequency of these keycodes." ) );
    lblRate->setText( tr2i18n( "&Rate:" ) );
    TQWhatsThis::add( rateSlider, tr2i18n( "If supported, this option allows you to set the rate at which keycodes are generated while a key is pressed." ) );
    rate->setSuffix( tr2i18n( "/s" ) );
    TQWhatsThis::add( rate, tr2i18n( "If supported, this option allows you to set the rate at which keycodes are generated while a key is pressed." ) );
    repeatBox->setText( tr2i18n( "&Enable keyboard repeat" ) );
    TQWhatsThis::add( repeatBox, tr2i18n( "If you check this option, pressing and holding down a key emits the same character over and over again. For example, pressing and holding down the Tab key will have the same effect as that of pressing that key several times in succession: Tab characters continue to be emitted until you release the key." ) );
    click->setSuffix( tr2i18n( "%" ) );
    TQWhatsThis::add( click, tr2i18n( "If supported, this option allows you to hear audible clicks from your computer's speakers when you press the keys on your keyboard. This might be useful if your keyboard does not have mechanical keys, or if the sound that the keys make is very soft.<p>You can change the loudness of the key click feedback by dragging the slider button or by clicking the up/down arrows on the spin box. Setting the volume to 0% turns off the key click." ) );
    TextLabel1->setText( tr2i18n( "Key click &volume:" ) );
    TQWhatsThis::add( TextLabel1, tr2i18n( "If supported, this option allows you to hear audible clicks from your computer's speakers when you press the keys on your keyboard. This might be useful if your keyboard does not have mechanical keys, or if the sound that the keys make is very soft.<p>You can change the loudness of the key click feedback by dragging the slider button or by clicking the up/down arrows on the spin box. Setting the volume to 0% turns off the key click." ) );
}

/****************************************************************************
** KeyboardConfigWidget meta object code from reading C++ file 'kcmmiscwidget.h'
**
** Created by: The TQt Meta Object Compiler version 26 (TQt 3.5.0)
** WARNING! All changes made in this file will be lost!
*****************************************************************************/

#undef TQT_NO_COMPAT
#include "kcmmiscwidget.h"
#include <ntqmetaobject.h>
#include <ntqapplication.h>

#include <private/qucomextra_p.h>
#if !defined(Q_MOC_OUTPUT_REVISION) || (Q_MOC_OUTPUT_REVISION != 26)
#error "This file was generated using the moc from 3.5.0. It"
#error "cannot be used with the include files from this version of TQt."
#error "(The moc has changed too much.)"
#endif

const char *KeyboardConfigWidget::className() const
{
    return "KeyboardConfigWidget";
}

TQMetaObject *KeyboardConfigWidget::metaObj = 0;
static TQMetaObjectCleanUp cleanUp_KeyboardConfigWidget( "KeyboardConfigWidget", &KeyboardConfigWidget::staticMetaObject );

#ifndef TQT_NO_TRANSLATION
TQString KeyboardConfigWidget::tr( const char *s, const char *c )
{
    if ( tqApp )
	return tqApp->translate( "KeyboardConfigWidget", s, c, TQApplication::DefaultCodec );
    else
	return TQString::fromLatin1( s );
}
#ifndef TQT_NO_TRANSLATION_UTF8
TQString KeyboardConfigWidget::trUtf8( const char *s, const char *c )
{
    if ( tqApp )
	return tqApp->translate( "KeyboardConfigWidget", s, c, TQApplication::UnicodeUTF8 );
    else
	return TQString::fromUtf8( s );
}
#endif // TQT_NO_TRANSLATION_UTF8

#endif // TQT_NO_TRANSLATION

TQMetaObject* KeyboardConfigWidget::staticMetaObject()
{
    if ( metaObj ) {
	return metaObj;
}
#ifdef TQT_THREAD_SUPPORT
    if (tqt_sharedMetaObjectMutex) tqt_sharedMetaObjectMutex->lock();
    if ( metaObj ) {
	if (tqt_sharedMetaObjectMutex) tqt_sharedMetaObjectMutex->unlock();
	return metaObj;
    }
#endif // TQT_THREAD_SUPPORT
    TQMetaObject* parentObject = TQWidget::staticMetaObject();
    static const TQUMethod slot_0 = {"languageChange", 0, 0 };
    static const TQMetaData slot_tbl[] = {
	{ "languageChange()", &slot_0, TQMetaData::Protected }
    };
    metaObj = TQMetaObject::new_metaobject(
	"KeyboardConfigWidget", parentObject,
	slot_tbl, 1,
	0, 0,
#ifndef TQT_NO_PROPERTIES
	0, 0,
	0, 0,
#endif // TQT_NO_PROPERTIES
	0, 0 );
    cleanUp_KeyboardConfigWidget.setMetaObject( metaObj );
#ifdef TQT_THREAD_SUPPORT
    if (tqt_sharedMetaObjectMutex) tqt_sharedMetaObjectMutex->unlock();
#endif // TQT_THREAD_SUPPORT
    return metaObj;
}

void* KeyboardConfigWidget::tqt_cast( const char* clname )
{
    if ( !qstrcmp( clname, "KeyboardConfigWidget" ) )
	return this;
    return TQWidget::tqt_cast( clname );
}

bool KeyboardConfigWidget::tqt_invoke( int _id, TQUObject* _o )
{
    switch ( _id - staticMetaObject()->slotOffset() ) {
    case 0: languageChange(); break;
    default:
	return TQWidget::tqt_invoke( _id, _o );
    }
    return true;
}

bool KeyboardConfigWidget::tqt_emit( int _id, TQUObject* _o )
{
    return TQWidget::tqt_emit(_id,_o);
}
#ifndef TQT_NO_PROPERTIES

bool KeyboardConfigWidget::tqt_property( int id, int f, TQVariant* v)
{
    return TQWidget::tqt_property( id, f, v);
}

bool KeyboardConfigWidget::tqt_static_property( TQObject* , int , int , TQVariant* ){ return false; }
#endif // TQT_NO_PROPERTIES
