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

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

#include "OptionsDlgWidget.h"

#include <ntqvariant.h>
#include <kcombobox.h>
#include <klineedit.h>
#include <kpushbutton.h>
#include <knuminput.h>
#include <tdeapplication.h>
#include <tdefiledialog.h>
#include <tdemessagebox.h>
#include <tdeglobal.h>
#include <kdialog.h>
#include <ntqpushbutton.h>
#include <ntqlabel.h>
#include <ntqbuttongroup.h>
#include <ntqcheckbox.h>
#include <ntqlayout.h>
#include <ntqtooltip.h>
#include <ntqwhatsthis.h>
#include "OptionsDlgWidget.ui.h"

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

    layout4 = new TQVBoxLayout( 0, 0, KDialog::spacingHint(), "layout4"); 

    layout5 = new TQGridLayout( 0, 1, 1, 0, KDialog::spacingHint(), "layout5"); 

    _defaultTapeSize = new KIntSpinBox( this, "_defaultTapeSize" );
    _defaultTapeSize->setMinimumSize( TQSize( 96, 0 ) );
    _defaultTapeSize->setMaxValue( 4096 );

    layout5->addWidget( _defaultTapeSize, 0, 1 );

    _tapeBlockSize = new KIntSpinBox( this, "_tapeBlockSize" );
    _tapeBlockSize->setMinimumSize( TQSize( 96, 0 ) );
    _tapeBlockSize->setMaxValue( 262144 );

    layout5->addWidget( _tapeBlockSize, 1, 1 );

    _defaultTapeSizeUnits = new KComboBox( false, this, "_defaultTapeSizeUnits" );

    layout5->addWidget( _defaultTapeSizeUnits, 0, 2 );

    textLabel3 = new TQLabel( this, "textLabel3" );

    layout5->addWidget( textLabel3, 1, 2 );

    textLabel2 = new TQLabel( this, "textLabel2" );

    layout5->addWidget( textLabel2, 1, 0 );

    textLabel1 = new TQLabel( this, "textLabel1" );

    layout5->addWidget( textLabel1, 0, 0 );
    layout4->addLayout( layout5 );

    layout1 = new TQGridLayout( 0, 1, 1, 0, KDialog::spacingHint(), "layout1"); 

    browseTarCommand = new KPushButton( this, "browseTarCommand" );

    layout1->addWidget( browseTarCommand, 1, 2 );

    _tapeDevice = new KLineEdit( this, "_tapeDevice" );

    layout1->addWidget( _tapeDevice, 0, 1 );

    textLabel5 = new TQLabel( this, "textLabel5" );

    layout1->addWidget( textLabel5, 1, 0 );

    browseTapeDevice = new KPushButton( this, "browseTapeDevice" );

    layout1->addWidget( browseTapeDevice, 0, 2 );

    _tarCommand = new KLineEdit( this, "_tarCommand" );

    layout1->addWidget( _tarCommand, 1, 1 );

    textLabel4 = new TQLabel( this, "textLabel4" );

    layout1->addWidget( textLabel4, 0, 0 );
    layout4->addLayout( layout1 );

    buttonGroup1 = new TQButtonGroup( this, "buttonGroup1" );
    buttonGroup1->setColumnLayout(0, TQt::Vertical );
    buttonGroup1->layout()->setSpacing( KDialog::spacingHint() );
    buttonGroup1->layout()->setMargin( KDialog::marginHint() );
    buttonGroup1Layout = new TQVBoxLayout( buttonGroup1->layout() );
    buttonGroup1Layout->setAlignment( TQt::AlignTop );

    _loadOnMount = new TQCheckBox( buttonGroup1, "_loadOnMount" );
    buttonGroup1Layout->addWidget( _loadOnMount );

    _lockOnMount = new TQCheckBox( buttonGroup1, "_lockOnMount" );
    buttonGroup1Layout->addWidget( _lockOnMount );

    _ejectOnUnmount = new TQCheckBox( buttonGroup1, "_ejectOnUnmount" );
    buttonGroup1Layout->addWidget( _ejectOnUnmount );

    _variableBlockSize = new TQCheckBox( buttonGroup1, "_variableBlockSize" );
    buttonGroup1Layout->addWidget( _variableBlockSize );
    layout4->addWidget( buttonGroup1 );
    spacer1 = new TQSpacerItem( 20, 0, TQSizePolicy::Minimum, TQSizePolicy::Expanding );
    layout4->addItem( spacer1 );
    OptionsDlgWidgetLayout->addLayout( layout4 );
    languageChange();
    resize( TQSize(325, 332).expandedTo(minimumSizeHint()) );
    clearWState( WState_Polished );

    // signals and slots connections
    connect( _defaultTapeSize, TQ_SIGNAL( valueChanged(int) ), this, TQ_SLOT( slotValueChanged() ) );
    connect( _tapeBlockSize, TQ_SIGNAL( valueChanged(int) ), this, TQ_SLOT( slotValueChanged() ) );
    connect( _defaultTapeSizeUnits, TQ_SIGNAL( activated(int) ), this, TQ_SLOT( slotValueChanged() ) );
    connect( _tapeDevice, TQ_SIGNAL( textChanged(const TQString&) ), this, TQ_SLOT( slotValueChanged() ) );
    connect( _tarCommand, TQ_SIGNAL( textChanged(const TQString&) ), this, TQ_SLOT( slotValueChanged() ) );
    connect( _loadOnMount, TQ_SIGNAL( toggled(bool) ), this, TQ_SLOT( slotValueChanged() ) );
    connect( _lockOnMount, TQ_SIGNAL( toggled(bool) ), this, TQ_SLOT( slotValueChanged() ) );
    connect( _ejectOnUnmount, TQ_SIGNAL( toggled(bool) ), this, TQ_SLOT( slotValueChanged() ) );
    connect( _variableBlockSize, TQ_SIGNAL( toggled(bool) ), this, TQ_SLOT( slotValueChanged() ) );
    connect( browseTapeDevice, TQ_SIGNAL( clicked() ), this, TQ_SLOT( slotBrowseTapeDevice() ) );
    connect( browseTarCommand, TQ_SIGNAL( clicked() ), this, TQ_SLOT( slotBrowseTarCommand() ) );

    // buddies
    textLabel2->setBuddy( _tapeBlockSize );
    textLabel1->setBuddy( _defaultTapeSize );
    textLabel5->setBuddy( _tarCommand );
    textLabel4->setBuddy( _tapeDevice );
}

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

/*
 *  Sets the strings of the subwidgets using the current
 *  language.
 */
void OptionsDlgWidget::languageChange()
{
    setCaption( tr2i18n( "Options Widget" ) );
    TQWhatsThis::add( _defaultTapeSize, tr2i18n( "This setting determines the capacity that KDat assumes your backup tapes to be.  This is used when formatting the tapes." ) );
    TQWhatsThis::add( _tapeBlockSize, tr2i18n( "Tape drives read and write data in individual blocks.  This setting controls the size of each block, and should be set to your tape drive's block size.  For floppy tape drives this should be set to <b>10240</b> bytes." ) );
    _defaultTapeSizeUnits->clear();
    _defaultTapeSizeUnits->insertItem( tr2i18n( "MB" ) );
    _defaultTapeSizeUnits->insertItem( tr2i18n( "GB" ) );
    TQToolTip::add( _defaultTapeSizeUnits, TQString::null );
    TQWhatsThis::add( _defaultTapeSizeUnits, tr2i18n( "This option chooses whether the default tape size to the left is in megabytes (MB) or gigabytes (GB)." ) );
    textLabel3->setText( tr2i18n( "bytes" ) );
    textLabel2->setText( tr2i18n( "Tape block size:" ) );
    textLabel1->setText( tr2i18n( "Default tape size:" ) );
    browseTarCommand->setText( tr2i18n( "..." ) );
    TQToolTip::add( browseTarCommand, tr2i18n( "Browse for the tar command." ) );
    TQWhatsThis::add( _tapeDevice, tr2i18n( "The location in the filesystem of the <em>non-rewinding</em> tape device.  The default is <b>/dev/tape</b>." ) );
    textLabel5->setText( tr2i18n( "Tar command:" ) );
    browseTapeDevice->setText( tr2i18n( "..." ) );
    TQToolTip::add( browseTapeDevice, tr2i18n( "Browse for the tape device." ) );
    TQWhatsThis::add( _tarCommand, tr2i18n( "This setting controls the command that KDat uses to perform the tape backup.  The full path should be given.  The default is <b>tar</b>." ) );
    textLabel4->setText( tr2i18n( "Tape device:" ) );
    buttonGroup1->setTitle( tr2i18n( "Tape Drive Options" ) );
    _loadOnMount->setText( tr2i18n( "Load tape on mount" ) );
    TQToolTip::add( _loadOnMount, tr2i18n( "<qt>Issue an <tt>mtload</tt> command prior to mounting the tape.</qt>" ) );
    TQWhatsThis::add( _loadOnMount, tr2i18n( "This command issues an <tt>mtload</tt> command to the tape device before trying to mount it.\n"
"\n"
"This is required by some tape drives." ) );
    _lockOnMount->setText( tr2i18n( "Lock tape drive on mount" ) );
    TQToolTip::add( _lockOnMount, tr2i18n( "Disable the eject button after mounting the tape." ) );
    TQWhatsThis::add( _lockOnMount, tr2i18n( "This option makes KDat try to disable the eject button on the tape drive after the tape has been mounted.\n"
"\n"
"This doesn't work for all tape drives." ) );
    _ejectOnUnmount->setText( tr2i18n( "Eject tape on unmount" ) );
    TQToolTip::add( _ejectOnUnmount, tr2i18n( "Try to eject the tape after it is unmounted.  Don't use this for ftape." ) );
    TQWhatsThis::add( _ejectOnUnmount, tr2i18n( "Try to eject the tape after it has been unmounted.\n"
"\n"
"This option should not be used for floppy-tape drives." ) );
    _variableBlockSize->setText( tr2i18n( "Variable block size" ) );
    TQToolTip::add( _variableBlockSize, tr2i18n( "Enable variable-block size support in the tape drive." ) );
    TQWhatsThis::add( _variableBlockSize, tr2i18n( "Some tape drives support different sizes of the data block.  With this option, KDat will attempt to enable that support.\n"
"\n"
"You must still specify the block size." ) );
}

/****************************************************************************
** OptionsDlgWidget meta object code from reading C++ file 'OptionsDlgWidget.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 "OptionsDlgWidget.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 *OptionsDlgWidget::className() const
{
    return "OptionsDlgWidget";
}

TQMetaObject *OptionsDlgWidget::metaObj = 0;
static TQMetaObjectCleanUp cleanUp_OptionsDlgWidget( "OptionsDlgWidget", &OptionsDlgWidget::staticMetaObject );

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

#endif // TQT_NO_TRANSLATION

TQMetaObject* OptionsDlgWidget::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 TQUMethod slot_1 = {"slotValueChanged", 0, 0 };
    static const TQUMethod slot_2 = {"slotBrowseTapeDevice", 0, 0 };
    static const TQUMethod slot_3 = {"slotBrowseTarCommand", 0, 0 };
    static const TQMetaData slot_tbl[] = {
	{ "languageChange()", &slot_0, TQMetaData::Protected },
	{ "slotValueChanged()", &slot_1, TQMetaData::Protected },
	{ "slotBrowseTapeDevice()", &slot_2, TQMetaData::Protected },
	{ "slotBrowseTarCommand()", &slot_3, TQMetaData::Protected }
    };
    static const TQUMethod signal_0 = {"doBrowseTapeDevice", 0, 0 };
    static const TQUMethod signal_1 = {"doBrowseTarCommand", 0, 0 };
    static const TQUMethod signal_2 = {"valueChanged", 0, 0 };
    static const TQMetaData signal_tbl[] = {
	{ "doBrowseTapeDevice()", &signal_0, TQMetaData::Public },
	{ "doBrowseTarCommand()", &signal_1, TQMetaData::Public },
	{ "valueChanged()", &signal_2, TQMetaData::Public }
    };
    metaObj = TQMetaObject::new_metaobject(
	"OptionsDlgWidget", parentObject,
	slot_tbl, 4,
	signal_tbl, 3,
#ifndef TQT_NO_PROPERTIES
	0, 0,
	0, 0,
#endif // TQT_NO_PROPERTIES
	0, 0 );
    cleanUp_OptionsDlgWidget.setMetaObject( metaObj );
#ifdef TQT_THREAD_SUPPORT
    if (tqt_sharedMetaObjectMutex) tqt_sharedMetaObjectMutex->unlock();
#endif // TQT_THREAD_SUPPORT
    return metaObj;
}

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

// TQ_SIGNAL doBrowseTapeDevice
void OptionsDlgWidget::doBrowseTapeDevice()
{
    activate_signal( staticMetaObject()->signalOffset() + 0 );
}

// TQ_SIGNAL doBrowseTarCommand
void OptionsDlgWidget::doBrowseTarCommand()
{
    activate_signal( staticMetaObject()->signalOffset() + 1 );
}

// TQ_SIGNAL valueChanged
void OptionsDlgWidget::valueChanged()
{
    activate_signal( staticMetaObject()->signalOffset() + 2 );
}

bool OptionsDlgWidget::tqt_invoke( int _id, TQUObject* _o )
{
    switch ( _id - staticMetaObject()->slotOffset() ) {
    case 0: languageChange(); break;
    case 1: slotValueChanged(); break;
    case 2: slotBrowseTapeDevice(); break;
    case 3: slotBrowseTarCommand(); break;
    default:
	return TQWidget::tqt_invoke( _id, _o );
    }
    return true;
}

bool OptionsDlgWidget::tqt_emit( int _id, TQUObject* _o )
{
    switch ( _id - staticMetaObject()->signalOffset() ) {
    case 0: doBrowseTapeDevice(); break;
    case 1: doBrowseTarCommand(); break;
    case 2: valueChanged(); break;
    default:
	return TQWidget::tqt_emit(_id,_o);
    }
    return true;
}
#ifndef TQT_NO_PROPERTIES

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

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