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

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

#include "downloadpref.h"

#include <ntqvariant.h>
#include <kactivelabel.h>
#include <knuminput.h>
#include <ntqpushbutton.h>
#include <ntqgroupbox.h>
#include <ntqlabel.h>
#include <ntqcombobox.h>
#include <ntqspinbox.h>
#include <ntqcheckbox.h>
#include <ntqlayout.h>
#include <ntqtooltip.h>
#include <ntqwhatsthis.h>

/*
 *  Constructs a DownloadPref as a child of 'parent', with the
 *  name 'name' and widget flags set to 'f'.
 */
DownloadPref::DownloadPref( TQWidget* parent, const char* name, WFlags fl )
    : TQWidget( parent, name, fl )
{
    if ( !name )
	setName( "DownloadPref" );
    DownloadPrefLayout = new TQVBoxLayout( this, 11, 6, "DownloadPrefLayout"); 

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

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

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

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

    textLabel1 = new TQLabel( groupBox2, "textLabel1" );
    layout16->addWidget( textLabel1 );
    spacer7 = new TQSpacerItem( 40, 20, TQSizePolicy::Expanding, TQSizePolicy::Minimum );
    layout16->addItem( spacer7 );
    layout42->addLayout( layout16 );

    textLabel1_5 = new TQLabel( groupBox2, "textLabel1_5" );
    layout42->addWidget( textLabel1_5 );

    textLabel1_8 = new TQLabel( groupBox2, "textLabel1_8" );
    layout42->addWidget( textLabel1_8 );

    textLabel1_9 = new TQLabel( groupBox2, "textLabel1_9" );
    layout42->addWidget( textLabel1_9 );
    layout49->addLayout( layout42 );

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

    max_downloads = new KIntNumInput( groupBox2, "max_downloads" );
    max_downloads->setValue( 2 );
    max_downloads->setMinValue( 0 );
    layout46->addWidget( max_downloads );

    max_seeds = new KIntNumInput( groupBox2, "max_seeds" );
    max_seeds->setValue( 2 );
    max_seeds->setMinValue( 0 );
    layout46->addWidget( max_seeds );

    cmbDiskSpace = new TQComboBox( false, groupBox2, "cmbDiskSpace" );
    cmbDiskSpace->setSizePolicy( TQSizePolicy( (TQSizePolicy::SizeType)4, (TQSizePolicy::SizeType)0, 0, 0, cmbDiskSpace->sizePolicy().hasHeightForWidth() ) );
    layout46->addWidget( cmbDiskSpace );

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

    intMinDiskSpace = new TQSpinBox( groupBox2, "intMinDiskSpace" );
    intMinDiskSpace->setSizePolicy( TQSizePolicy( (TQSizePolicy::SizeType)4, (TQSizePolicy::SizeType)0, 0, 0, intMinDiskSpace->sizePolicy().hasHeightForWidth() ) );
    intMinDiskSpace->setMaxValue( 10000 );
    intMinDiskSpace->setMinValue( 10 );
    intMinDiskSpace->setValue( 100 );
    layout45->addWidget( intMinDiskSpace );

    textLabel2_2 = new TQLabel( groupBox2, "textLabel2_2" );
    textLabel2_2->setSizePolicy( TQSizePolicy( (TQSizePolicy::SizeType)4, (TQSizePolicy::SizeType)5, 0, 0, textLabel2_2->sizePolicy().hasHeightForWidth() ) );
    layout45->addWidget( textLabel2_2 );
    layout46->addLayout( layout45 );
    layout49->addLayout( layout46 );

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

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

    textLabel1_2 = new TQLabel( groupBox2, "textLabel1_2" );
    layout14->addWidget( textLabel1_2 );
    spacer5 = new TQSpacerItem( 10, 20, TQSizePolicy::Expanding, TQSizePolicy::Minimum );
    layout14->addItem( spacer5 );
    layout48->addLayout( layout14 );

    textLabel1_2_3 = new TQLabel( groupBox2, "textLabel1_2_3" );
    layout48->addWidget( textLabel1_2_3 );
    spacer36 = new TQSpacerItem( 191, 20, TQSizePolicy::Expanding, TQSizePolicy::Minimum );
    layout48->addItem( spacer36 );
    spacer17 = new TQSpacerItem( 207, 20, TQSizePolicy::Expanding, TQSizePolicy::Minimum );
    layout48->addItem( spacer17 );
    layout49->addLayout( layout48 );

    groupBox2Layout->addLayout( layout49, 0, 0 );
    DownloadPrefLayout->addWidget( groupBox2 );

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

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

    textLabel1_4 = new TQLabel( groupBox3, "textLabel1_4" );

    layout42_2->addWidget( textLabel1_4, 3, 0 );

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

    layout42_2->addWidget( textLabel5, 4, 0 );

    textLabel1_7 = new TQLabel( groupBox3, "textLabel1_7" );

    layout42_2->addWidget( textLabel1_7, 1, 0 );

    textLabel2_3 = new TQLabel( groupBox3, "textLabel2_3" );

    layout42_2->addWidget( textLabel2_3, 8, 0 );

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

    textLabel2 = new TQLabel( groupBox3, "textLabel2" );
    layout18->addWidget( textLabel2 );
    spacer8_2 = new TQSpacerItem( 40, 20, TQSizePolicy::Expanding, TQSizePolicy::Minimum );
    layout18->addItem( spacer8_2 );

    layout42_2->addLayout( layout18, 0, 0 );

    textLabel1_6 = new TQLabel( groupBox3, "textLabel1_6" );

    layout42_2->addWidget( textLabel1_6, 6, 0 );

    textLabel1_3 = new TQLabel( groupBox3, "textLabel1_3" );

    layout42_2->addWidget( textLabel1_3, 5, 0 );

    textLabel1_6_2 = new TQLabel( groupBox3, "textLabel1_6_2" );

    layout42_2->addWidget( textLabel1_6_2, 7, 0 );

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

    layout42_2->addWidget( textLabel3, 2, 0 );
    groupBox3Layout->addLayout( layout42_2 );

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

    max_conns = new KIntNumInput( groupBox3, "max_conns" );
    max_conns->setValue( 100 );
    max_conns->setMinValue( 0 );
    layout41->addWidget( max_conns );

    max_total_conns = new KIntNumInput( groupBox3, "max_total_conns" );
    max_total_conns->setValue( 800 );
    max_total_conns->setMinValue( 0 );
    layout41->addWidget( max_total_conns );

    max_upload_rate = new KIntNumInput( groupBox3, "max_upload_rate" );
    max_upload_rate->setValue( 5 );
    max_upload_rate->setMinValue( 0 );
    layout41->addWidget( max_upload_rate );

    max_download_rate = new KIntNumInput( groupBox3, "max_download_rate" );
    max_download_rate->setMinValue( 0 );
    layout41->addWidget( max_download_rate );

    port = new KIntNumInput( groupBox3, "port" );
    port->setValue( 6881 );
    port->setMinValue( 1 );
    port->setMaxValue( 65535 );
    layout41->addWidget( port );

    udp_tracker_port = new KIntNumInput( groupBox3, "udp_tracker_port" );
    udp_tracker_port->setValue( 4444 );
    udp_tracker_port->setMinValue( 1 );
    udp_tracker_port->setMaxValue( 65535 );
    layout41->addWidget( udp_tracker_port );

    num_upload_slots = new KIntNumInput( groupBox3, "num_upload_slots" );
    num_upload_slots->setValue( 2 );
    num_upload_slots->setMinValue( 2 );
    num_upload_slots->setMaxValue( 100 );
    num_upload_slots->setReferencePoint( 2 );
    layout41->addWidget( num_upload_slots );

    num_max_ratio = new KDoubleSpinBox( groupBox3, "num_max_ratio" );
    num_max_ratio->setMaxValue( 1000 );
    num_max_ratio->setPrecision( 2 );
    layout41->addWidget( num_max_ratio );

    max_seed_time = new KDoubleSpinBox( groupBox3, "max_seed_time" );
    max_seed_time->setMaxValue( 1e+07 );
    max_seed_time->setLineStep( 0.05 );
    max_seed_time->setPrecision( 2 );
    layout41->addWidget( max_seed_time );
    groupBox3Layout->addLayout( layout41 );

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

    textLabel1_2_2 = new TQLabel( groupBox3, "textLabel1_2_2" );
    layout40->addWidget( textLabel1_2_2 );

    textLabel1_2_2_2 = new TQLabel( groupBox3, "textLabel1_2_2_2" );
    layout40->addWidget( textLabel1_2_2_2 );

    textLabel4 = new TQLabel( groupBox3, "textLabel4" );
    layout40->addWidget( textLabel4 );

    textLabel4_2 = new TQLabel( groupBox3, "textLabel4_2" );
    layout40->addWidget( textLabel4_2 );
    spacer4 = new TQSpacerItem( 208, 20, TQSizePolicy::Expanding, TQSizePolicy::Minimum );
    layout40->addItem( spacer4 );
    spacer3 = new TQSpacerItem( 208, 20, TQSizePolicy::Expanding, TQSizePolicy::Minimum );
    layout40->addItem( spacer3 );
    spacer8 = new TQSpacerItem( 208, 20, TQSizePolicy::Expanding, TQSizePolicy::Minimum );
    layout40->addItem( spacer8 );

    textLabel1_2_2_2_2 = new TQLabel( groupBox3, "textLabel1_2_2_2_2" );
    layout40->addWidget( textLabel1_2_2_2_2 );

    textLabel3_2 = new TQLabel( groupBox3, "textLabel3_2" );
    layout40->addWidget( textLabel3_2 );
    groupBox3Layout->addLayout( layout40 );
    DownloadPrefLayout->addWidget( groupBox3 );

    keep_seeding = new TQCheckBox( this, "keep_seeding" );
    keep_seeding->setChecked( true );
    DownloadPrefLayout->addWidget( keep_seeding );

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

    kActiveLabel1 = new KActiveLabel( groupBox1, "kActiveLabel1" );
    groupBox1Layout->addWidget( kActiveLabel1 );
    DownloadPrefLayout->addWidget( groupBox1 );
    spacer6 = new TQSpacerItem( 20, 20, TQSizePolicy::Minimum, TQSizePolicy::Expanding );
    DownloadPrefLayout->addItem( spacer6 );
    languageChange();
    resize( TQSize(575, 706).expandedTo(minimumSizeHint()) );
    clearWState( WState_Polished );
}

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

/*
 *  Sets the strings of the subwidgets using the current
 *  language.
 */
void DownloadPref::languageChange()
{
    groupBox2->setTitle( tr2i18n( "Queue Manager" ) );
    textLabel1->setText( tr2i18n( "Maximum downloads:" ) );
    textLabel1_5->setText( tr2i18n( "Maximum seeds:" ) );
    textLabel1_8->setText( tr2i18n( "Start download on low disk space :" ) );
    textLabel1_9->setText( tr2i18n( "Minimum disk space:" ) );
    cmbDiskSpace->clear();
    cmbDiskSpace->insertItem( tr2i18n( "Don't start" ) );
    cmbDiskSpace->insertItem( tr2i18n( "Always ask" ) );
    cmbDiskSpace->insertItem( tr2i18n( "Force start" ) );
    textLabel2_2->setText( tr2i18n( "MB" ) );
    textLabel1_2->setText( tr2i18n( "(0 is no limit)" ) );
    textLabel1_2_3->setText( tr2i18n( "(0 is no limit)" ) );
    groupBox3->setTitle( tr2i18n( "Preferences" ) );
    textLabel1_4->setText( tr2i18n( "Maximum download rate:" ) );
    textLabel5->setText( tr2i18n( "Port:" ) );
    textLabel1_7->setText( tr2i18n( "Global connection limit:" ) );
    textLabel2_3->setText( tr2i18n( "Max seed time:" ) );
    textLabel2->setText( tr2i18n( "Maximum connections per torrent:" ) );
    textLabel1_6->setText( tr2i18n( "Number of upload slots:" ) );
    textLabel1_3->setText( tr2i18n( "UDP tracker port:" ) );
    textLabel1_6_2->setText( tr2i18n( "Max share ratio:" ) );
    textLabel3->setText( tr2i18n( "Maximum upload rate:" ) );
    textLabel1_2_2->setText( tr2i18n( "(0 is no limit)" ) );
    textLabel1_2_2_2->setText( tr2i18n( "(0 is no limit)" ) );
    textLabel4->setText( tr2i18n( "KB/sec (0 is no limit)" ) );
    textLabel4_2->setText( tr2i18n( "KB/sec (0 is no limit)" ) );
    textLabel1_2_2_2_2->setText( tr2i18n( "(0 is no limit)" ) );
    textLabel3_2->setText( tr2i18n( "Hours (0 is no limit)" ) );
    keep_seeding->setText( tr2i18n( "&Keep seeding after download is finished" ) );
    groupBox1->setTitle( tr2i18n( "Attention" ) );
    kActiveLabel1->setText( tr2i18n( "The above ports must also be forwarded if you are behind a router. The UPnP plugin can do this for you." ) );
}

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

TQMetaObject *DownloadPref::metaObj = 0;
static TQMetaObjectCleanUp cleanUp_DownloadPref( "DownloadPref", &DownloadPref::staticMetaObject );

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

#endif // TQT_NO_TRANSLATION

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

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

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

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

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

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