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

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

#include "generalpref.h"

#include <ntqvariant.h>
#include <klineedit.h>
#include <knuminput.h>
#include <kpushbutton.h>
#include <kurlrequester.h>
#include <ntqpushbutton.h>
#include <ntqgroupbox.h>
#include <ntqcheckbox.h>
#include <ntqlabel.h>
#include <ntqlayout.h>
#include <ntqtooltip.h>
#include <ntqwhatsthis.h>
#include <ntqimage.h>
#include <ntqpixmap.h>

/*
 *  Constructs a GeneralPref as a child of 'parent', with the
 *  name 'name' and widget flags set to 'f'.
 */
GeneralPref::GeneralPref( TQWidget* parent, const char* name, WFlags fl )
    : TQWidget( parent, name, fl )
{
    if ( !name )
	setName( "GeneralPref" );
    GeneralPrefLayout = new TQGridLayout( this, 1, 1, 11, 6, "GeneralPrefLayout"); 
    spacer2 = new TQSpacerItem( 20, 50, TQSizePolicy::Minimum, TQSizePolicy::Expanding );
    GeneralPrefLayout->addItem( spacer2, 5, 0 );

    groupBox5 = new TQGroupBox( this, "groupBox5" );
    groupBox5->setColumnLayout(0, TQt::Vertical );
    groupBox5->layout()->setSpacing( 6 );
    groupBox5->layout()->setMargin( 11 );
    groupBox5Layout = new TQVBoxLayout( groupBox5->layout() );
    groupBox5Layout->setAlignment( TQt::AlignTop );

    use_encryption = new TQCheckBox( groupBox5, "use_encryption" );
    groupBox5Layout->addWidget( use_encryption );

    allow_unencrypted = new TQCheckBox( groupBox5, "allow_unencrypted" );
    groupBox5Layout->addWidget( allow_unencrypted );

    GeneralPrefLayout->addWidget( groupBox5, 4, 0 );

    groupBox4 = new TQGroupBox( this, "groupBox4" );
    groupBox4->setColumnLayout(0, TQt::Vertical );
    groupBox4->layout()->setSpacing( 6 );
    groupBox4->layout()->setMargin( 11 );
    groupBox4Layout = new TQVBoxLayout( groupBox4->layout() );
    groupBox4Layout->setAlignment( TQt::AlignTop );

    use_dht = new TQCheckBox( groupBox4, "use_dht" );
    groupBox4Layout->addWidget( use_dht );

    layout7 = new TQHBoxLayout( 0, 0, 6, "layout7"); 

    dht_port_label = new TQLabel( groupBox4, "dht_port_label" );
    layout7->addWidget( dht_port_label );

    dht_port = new KIntSpinBox( groupBox4, "dht_port" );
    dht_port->setMaxValue( 65535 );
    dht_port->setMinValue( 1 );
    dht_port->setValue( 6881 );
    layout7->addWidget( dht_port );
    spacer4 = new TQSpacerItem( 40, 20, TQSizePolicy::Expanding, TQSizePolicy::Minimum );
    layout7->addItem( spacer4 );
    groupBox4Layout->addLayout( layout7 );

    GeneralPrefLayout->addWidget( groupBox4, 3, 0 );

    groupBox3 = new TQGroupBox( this, "groupBox3" );
    groupBox3->setColumnLayout(0, TQt::Vertical );
    groupBox3->layout()->setSpacing( 6 );
    groupBox3->layout()->setMargin( 11 );
    groupBox3Layout = new TQVBoxLayout( groupBox3->layout() );
    groupBox3Layout->setAlignment( TQt::AlignTop );

    custom_ip_check = new TQCheckBox( groupBox3, "custom_ip_check" );
    groupBox3Layout->addWidget( custom_ip_check );

    layout3 = new TQHBoxLayout( 0, 0, 6, "layout3"); 

    custom_ip_label = new TQLabel( groupBox3, "custom_ip_label" );
    layout3->addWidget( custom_ip_label );

    custom_ip = new KLineEdit( groupBox3, "custom_ip" );
    layout3->addWidget( custom_ip );
    groupBox3Layout->addLayout( layout3 );

    GeneralPrefLayout->addWidget( groupBox3, 2, 0 );

    groupBox3_2 = new TQGroupBox( this, "groupBox3_2" );
    groupBox3_2->setColumnLayout(0, TQt::Vertical );
    groupBox3_2->layout()->setSpacing( 6 );
    groupBox3_2->layout()->setMargin( 11 );
    groupBox3_2Layout = new TQGridLayout( groupBox3_2->layout() );
    groupBox3_2Layout->setAlignment( TQt::AlignTop );

    show_systray_icon = new TQCheckBox( groupBox3_2, "show_systray_icon" );

    groupBox3_2Layout->addWidget( show_systray_icon, 0, 0 );

    show_speedbar = new TQCheckBox( groupBox3_2, "show_speedbar" );

    groupBox3_2Layout->addWidget( show_speedbar, 1, 0 );

    show_popups = new TQCheckBox( groupBox3_2, "show_popups" );

    groupBox3_2Layout->addMultiCellWidget( show_popups, 2, 2, 0, 1 );

    layout13 = new TQGridLayout( 0, 1, 1, 0, 6, "layout13"); 

    textLabel1_3_2_2_2_2 = new TQLabel( groupBox3_2, "textLabel1_3_2_2_2_2" );

    layout13->addWidget( textLabel1_3_2_2_2_2, 1, 0 );

    uploadBandwidth = new KIntSpinBox( groupBox3_2, "uploadBandwidth" );
    uploadBandwidth->setButtonSymbols( KIntSpinBox::UpDownArrows );
    uploadBandwidth->setMaxValue( 1000000 );
    uploadBandwidth->setMinValue( 1 );
    uploadBandwidth->setValue( 500 );

    layout13->addWidget( uploadBandwidth, 1, 1 );

    textLabel1_3_2_2_2 = new TQLabel( groupBox3_2, "textLabel1_3_2_2_2" );

    layout13->addWidget( textLabel1_3_2_2_2, 0, 0 );

    downloadBandwidth = new KIntSpinBox( groupBox3_2, "downloadBandwidth" );
    downloadBandwidth->setButtonSymbols( KIntSpinBox::UpDownArrows );
    downloadBandwidth->setMaxValue( 1000000 );
    downloadBandwidth->setMinValue( 1 );
    downloadBandwidth->setValue( 500 );

    layout13->addWidget( downloadBandwidth, 0, 1 );

    groupBox3_2Layout->addMultiCellLayout( layout13, 0, 1, 1, 1 );

    GeneralPrefLayout->addWidget( groupBox3_2, 1, 0 );

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

    layout24 = new TQHBoxLayout( 0, 0, 6, "layout24"); 

    textLabel1 = new TQLabel( groupBox1, "textLabel1" );
    layout24->addWidget( textLabel1 );

    temp_dir = new KURLRequester( groupBox1, "temp_dir" );
    layout24->addWidget( temp_dir );

    groupBox1Layout->addMultiCellLayout( layout24, 0, 0, 0, 1 );

    checkCompletedDir = new TQCheckBox( groupBox1, "checkCompletedDir" );

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

    autosave_downloads_check = new TQCheckBox( groupBox1, "autosave_downloads_check" );

    groupBox1Layout->addWidget( autosave_downloads_check, 1, 0 );

    layout14 = new TQVBoxLayout( 0, 0, 6, "layout14"); 

    autosave_location = new KURLRequester( groupBox1, "autosave_location" );
    autosave_location->setEnabled( false );
    layout14->addWidget( autosave_location );

    urlCompletedDir = new KURLRequester( groupBox1, "urlCompletedDir" );
    urlCompletedDir->setEnabled( false );
    layout14->addWidget( urlCompletedDir );

    urlTorrentDir = new KURLRequester( groupBox1, "urlTorrentDir" );
    urlTorrentDir->setEnabled( false );
    layout14->addWidget( urlTorrentDir );

    groupBox1Layout->addMultiCellLayout( layout14, 1, 3, 1, 1 );

    checkTorrentDir = new TQCheckBox( groupBox1, "checkTorrentDir" );

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

    GeneralPrefLayout->addWidget( groupBox1, 0, 0 );
    languageChange();
    resize( TQSize(603, 657).expandedTo(minimumSizeHint()) );
    clearWState( WState_Polished );

    // signals and slots connections
    connect( show_speedbar, TQ_SIGNAL( toggled(bool) ), textLabel1_3_2_2_2, TQ_SLOT( setEnabled(bool) ) );
    connect( show_speedbar, TQ_SIGNAL( toggled(bool) ), textLabel1_3_2_2_2_2, TQ_SLOT( setEnabled(bool) ) );
    connect( show_speedbar, TQ_SIGNAL( toggled(bool) ), downloadBandwidth, TQ_SLOT( setEnabled(bool) ) );
    connect( show_speedbar, TQ_SIGNAL( toggled(bool) ), uploadBandwidth, TQ_SLOT( setEnabled(bool) ) );
    connect( checkCompletedDir, TQ_SIGNAL( toggled(bool) ), urlCompletedDir, TQ_SLOT( setEnabled(bool) ) );
    connect( autosave_downloads_check, TQ_SIGNAL( toggled(bool) ), autosave_location, TQ_SLOT( setEnabled(bool) ) );
    connect( checkTorrentDir, TQ_SIGNAL( toggled(bool) ), urlTorrentDir, TQ_SLOT( setEnabled(bool) ) );

    // tab order
    setTabOrder( autosave_downloads_check, show_systray_icon );

    // buddies
    textLabel1->setBuddy( temp_dir );
}

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

/*
 *  Sets the strings of the subwidgets using the current
 *  language.
 */
void GeneralPref::languageChange()
{
    setCaption( tr2i18n( "General Options" ) );
    groupBox5->setTitle( tr2i18n( "Encryption" ) );
    TQToolTip::add( groupBox5, TQString::null );
    use_encryption->setText( tr2i18n( "Use protocol encryption" ) );
    TQToolTip::add( use_encryption, tr2i18n( "Protocol encryption is used to prevent ISP's from slowing down bittorrent connections." ) );
    allow_unencrypted->setText( tr2i18n( "Allow unencrypted connections" ) );
    TQToolTip::add( allow_unencrypted, tr2i18n( "If unchecked, you'll be able to connect only to clients supporting encryption." ) );
    groupBox4->setTitle( tr2i18n( "DHT" ) );
    TQToolTip::add( groupBox4, tr2i18n( "<b>D</b>istributed <b>H</b>ash <b>T</b>able protocol.<br>Decentralized peers exchange protocol. See manual for more info." ) );
    use_dht->setText( tr2i18n( "&Use DHT to get additional peers" ) );
    TQToolTip::add( use_dht, TQString::null );
    dht_port_label->setText( tr2i18n( "UDP port for DHT communication:" ) );
    groupBox3->setTitle( tr2i18n( "Custom IP" ) );
    custom_ip_check->setText( tr2i18n( "Se&nd the tracker a custom IP address or hostname" ) );
    custom_ip_label->setText( tr2i18n( "Custom IP address or hostname:" ) );
    groupBox3_2->setTitle( tr2i18n( "System Tray Icon" ) );
    show_systray_icon->setText( tr2i18n( "Show s&ystem tray icon" ) );
    show_speedbar->setText( tr2i18n( "Show speed &bar in tray icon" ) );
    show_popups->setText( tr2i18n( "Show system tray popup messages" ) );
    textLabel1_3_2_2_2_2->setText( tr2i18n( "Upload bandwidth (in KB/sec):" ) );
    textLabel1_3_2_2_2->setText( tr2i18n( "Download bandwidth (in KB/sec):" ) );
    groupBox1->setTitle( tr2i18n( "Folders" ) );
    textLabel1->setText( tr2i18n( "Folder to store temporary files:" ) );
    checkCompletedDir->setText( tr2i18n( "Move completed downloads to:" ) );
    autosave_downloads_check->setText( tr2i18n( "&Automatically save downloads to:" ) );
    checkTorrentDir->setText( tr2i18n( "Copy .torrent files to:" ) );
}

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

TQMetaObject *GeneralPref::metaObj = 0;
static TQMetaObjectCleanUp cleanUp_GeneralPref( "GeneralPref", &GeneralPref::staticMetaObject );

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

#endif // TQT_NO_TRANSLATION

TQMetaObject* GeneralPref::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(
	"GeneralPref", parentObject,
	slot_tbl, 1,
	0, 0,
#ifndef TQT_NO_PROPERTIES
	0, 0,
	0, 0,
#endif // TQT_NO_PROPERTIES
	0, 0 );
    cleanUp_GeneralPref.setMetaObject( metaObj );
#ifdef TQT_THREAD_SUPPORT
    if (tqt_sharedMetaObjectMutex) tqt_sharedMetaObjectMutex->unlock();
#endif // TQT_THREAD_SUPPORT
    return metaObj;
}

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

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

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

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

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