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

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

#include "maxmin.h"

#include <ntqvariant.h>
#include <ntqpushbutton.h>
#include <ntqgroupbox.h>
#include <ntqlabel.h>
#include <ntqspinbox.h>
#include <ntqcheckbox.h>
#include <ntqheader.h>
#include <ntqlistview.h>
#include <ntqcombobox.h>
#include <ntqdatetimeedit.h>
#include <ntqlayout.h>
#include <ntqtooltip.h>
#include <ntqwhatsthis.h>
#include "maxmin.ui.h"

/*
 *  Constructs a MaxMin as a child of 'parent', with the
 *  name 'name' and widget flags set to 'f'.
 */
MaxMin::MaxMin( TQWidget* parent, const char* name, WFlags fl )
    : TQWidget( parent, name, fl )
{
    if ( !name )
	setName( "MaxMin" );
    setSizePolicy( TQSizePolicy( (TQSizePolicy::SizeType)7, (TQSizePolicy::SizeType)7, 0, 0, sizePolicy().hasHeightForWidth() ) );
    MaxMinLayout = new TQGridLayout( this, 1, 1, 11, 6, "MaxMinLayout"); 

    MaxMinOptions = new TQGroupBox( this, "MaxMinOptions" );
    MaxMinOptions->setEnabled( false );
    MaxMinOptions->setColumnLayout(0, TQt::Vertical );
    MaxMinOptions->layout()->setSpacing( 6 );
    MaxMinOptions->layout()->setMargin( 11 );
    MaxMinOptionsLayout = new TQGridLayout( MaxMinOptions->layout() );
    MaxMinOptionsLayout->setAlignment( TQt::AlignTop );
    spacer3 = new TQSpacerItem( 71, 20, TQSizePolicy::Expanding, TQSizePolicy::Minimum );
    MaxMinOptionsLayout->addMultiCell( spacer3, 2, 2, 1, 2 );
    spacer2 = new TQSpacerItem( 20, 20, TQSizePolicy::Expanding, TQSizePolicy::Minimum );
    MaxMinOptionsLayout->addItem( spacer2, 1, 3 );

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

    MaxMinOptionsLayout->addWidget( textLabel4, 0, 0 );
    spacer1 = new TQSpacerItem( 101, 20, TQSizePolicy::Expanding, TQSizePolicy::Minimum );
    MaxMinOptionsLayout->addItem( spacer1, 0, 1 );

    textLabel4_2 = new TQLabel( MaxMinOptions, "textLabel4_2" );

    MaxMinOptionsLayout->addMultiCellWidget( textLabel4_2, 1, 1, 0, 1 );

    textLabel4_2_2 = new TQLabel( MaxMinOptions, "textLabel4_2_2" );

    MaxMinOptionsLayout->addWidget( textLabel4_2_2, 2, 0 );

    kcfg_BandwidthBurst = new TQSpinBox( MaxMinOptions, "kcfg_BandwidthBurst" );
    kcfg_BandwidthBurst->setMaxValue( 2097151 );
    kcfg_BandwidthBurst->setMinValue( 20 );
    kcfg_BandwidthBurst->setValue( 20 );

    MaxMinOptionsLayout->addWidget( kcfg_BandwidthBurst, 1, 4 );

    kcfg_MaxAdvertisedBandwidth = new TQSpinBox( MaxMinOptions, "kcfg_MaxAdvertisedBandwidth" );
    kcfg_MaxAdvertisedBandwidth->setMaxValue( 999999 );
    kcfg_MaxAdvertisedBandwidth->setMinValue( 10 );

    MaxMinOptionsLayout->addWidget( kcfg_MaxAdvertisedBandwidth, 2, 4 );

    kcfg_BandwidthRate = new TQSpinBox( MaxMinOptions, "kcfg_BandwidthRate" );
    kcfg_BandwidthRate->setMaxValue( 99999999 );
    kcfg_BandwidthRate->setMinValue( 20 );
    kcfg_BandwidthRate->setValue( 20 );

    MaxMinOptionsLayout->addWidget( kcfg_BandwidthRate, 0, 4 );

    MaxMinLayout->addWidget( MaxMinOptions, 1, 0 );

    kcfg_DefaultMaxMinOptions = new TQCheckBox( this, "kcfg_DefaultMaxMinOptions" );
    kcfg_DefaultMaxMinOptions->setChecked( true );

    MaxMinLayout->addWidget( kcfg_DefaultMaxMinOptions, 0, 0 );

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

    timedBandwidthList = new TQListView( TimedBandwidth, "timedBandwidthList" );
    timedBandwidthList->addColumn( tr2i18n( "From" ) );
    timedBandwidthList->addColumn( tr2i18n( "Every" ) );
    timedBandwidthList->addColumn( tr2i18n( "Use Max Incoming BW" ) );
    timedBandwidthList->addColumn( tr2i18n( "Max Chunk" ) );
    timedBandwidthList->addColumn( tr2i18n( "Max Advertise" ) );
    timedBandwidthList->setAllColumnsShowFocus( true );

    TimedBandwidthLayout->addMultiCellWidget( timedBandwidthList, 0, 0, 0, 6 );
    spacer7 = new TQSpacerItem( 16, 20, TQSizePolicy::Expanding, TQSizePolicy::Minimum );
    TimedBandwidthLayout->addItem( spacer7, 1, 2 );
    spacer7_2 = new TQSpacerItem( 16, 20, TQSizePolicy::Expanding, TQSizePolicy::Minimum );
    TimedBandwidthLayout->addItem( spacer7_2, 1, 4 );

    textLabel1_2 = new TQLabel( TimedBandwidth, "textLabel1_2" );

    TimedBandwidthLayout->addWidget( textLabel1_2, 1, 3 );

    theDay = new TQComboBox( false, TimedBandwidth, "theDay" );

    TimedBandwidthLayout->addWidget( theDay, 1, 5 );

    pushButton1 = new TQPushButton( TimedBandwidth, "pushButton1" );

    TimedBandwidthLayout->addWidget( pushButton1, 1, 6 );

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

    TimedBandwidthLayout->addWidget( textLabel1, 1, 0 );

    theTime = new TQTimeEdit( TimedBandwidth, "theTime" );
    theTime->setMaxValue( TQTime( 23, 50, 0 ) );

    TimedBandwidthLayout->addWidget( theTime, 1, 1 );

    MaxMinLayout->addWidget( TimedBandwidth, 3, 0 );

    kcfg_UseScheduledBandwidth = new TQCheckBox( this, "kcfg_UseScheduledBandwidth" );
    kcfg_UseScheduledBandwidth->setEnabled( false );
    kcfg_UseScheduledBandwidth->setChecked( false );

    MaxMinLayout->addWidget( kcfg_UseScheduledBandwidth, 2, 0 );
    languageChange();
    resize( TQSize(529, 430).expandedTo(minimumSizeHint()) );
    clearWState( WState_Polished );

    // signals and slots connections
    connect( kcfg_DefaultMaxMinOptions, TQ_SIGNAL( toggled(bool) ), this, TQ_SLOT( kcfg_DefaultMaxMinOptions_toggled(bool) ) );
    connect( kcfg_BandwidthBurst, TQ_SIGNAL( valueChanged(int) ), this, TQ_SLOT( kcfg_BandwidthBurst_valueChanged(int) ) );
    connect( kcfg_BandwidthRate, TQ_SIGNAL( valueChanged(int) ), this, TQ_SLOT( kcfg_BandwidthRate_valueChanged(int) ) );
    connect( pushButton1, TQ_SIGNAL( clicked() ), this, TQ_SLOT( pushButton1_clicked() ) );
    connect( timedBandwidthList, TQ_SIGNAL( contextMenuRequested(TQListViewItem*,const TQPoint&,int) ), this, TQ_SLOT( timedBandwidthList_contextMenuRequested(TQListViewItem*,const TQPoint&,int) ) );
    connect( kcfg_UseScheduledBandwidth, TQ_SIGNAL( toggled(bool) ), this, TQ_SLOT( kcfg_UseScheduledBandwidth_toggled(bool) ) );

    // tab order
    setTabOrder( kcfg_DefaultMaxMinOptions, kcfg_BandwidthRate );
    setTabOrder( kcfg_BandwidthRate, kcfg_BandwidthBurst );
    setTabOrder( kcfg_BandwidthBurst, kcfg_MaxAdvertisedBandwidth );
    setTabOrder( kcfg_MaxAdvertisedBandwidth, timedBandwidthList );
    setTabOrder( timedBandwidthList, theTime );
    setTabOrder( theTime, theDay );
    setTabOrder( theDay, pushButton1 );
    init();
}

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

/*
 *  Sets the strings of the subwidgets using the current
 *  language.
 */
void MaxMin::languageChange()
{
    setCaption( tr2i18n( "Form1" ) );
    MaxMinOptions->setTitle( tr2i18n( "Bandwidth Options" ) );
    textLabel4->setText( tr2i18n( "Maximum Incoming Bandwidth: " ) );
    textLabel4_2->setText( tr2i18n( "Largest Chunk of Bandwidth to Allocate In One Go:" ) );
    textLabel4_2_2->setText( tr2i18n( "Max Bandwidth to Advertise:" ) );
    kcfg_BandwidthBurst->setSuffix( tr2i18n( " KB per second" ) );
    kcfg_MaxAdvertisedBandwidth->setSuffix( tr2i18n( " KB per second" ) );
    kcfg_BandwidthRate->setSuffix( tr2i18n( " KB per second" ) );
    kcfg_DefaultMaxMinOptions->setText( tr2i18n( "Let Tor &figure out the best bandwidth options to use." ) );
    TimedBandwidth->setTitle( tr2i18n( "Scheduled Bandwidth" ) );
    timedBandwidthList->header()->setLabel( 0, tr2i18n( "From" ) );
    timedBandwidthList->header()->setLabel( 1, tr2i18n( "Every" ) );
    timedBandwidthList->header()->setLabel( 2, tr2i18n( "Use Max Incoming BW" ) );
    timedBandwidthList->header()->setLabel( 3, tr2i18n( "Max Chunk" ) );
    timedBandwidthList->header()->setLabel( 4, tr2i18n( "Max Advertise" ) );
    textLabel1_2->setText( tr2i18n( "every" ) );
    theDay->clear();
    theDay->insertItem( tr2i18n( "Day" ) );
    theDay->insertItem( tr2i18n( "Monday" ) );
    theDay->insertItem( tr2i18n( "Tuesday" ) );
    theDay->insertItem( tr2i18n( "Wednesday" ) );
    theDay->insertItem( tr2i18n( "Thursday" ) );
    theDay->insertItem( tr2i18n( "Friday" ) );
    theDay->insertItem( tr2i18n( "Saturday" ) );
    theDay->insertItem( tr2i18n( "Sunday" ) );
    pushButton1->setText( tr2i18n( "&Use B/W Options Above" ) );
    textLabel1->setText( tr2i18n( "From" ) );
    kcfg_UseScheduledBandwidth->setText( tr2i18n( "Use Scheduled Bandwidth" ) );
}

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

TQMetaObject *MaxMin::metaObj = 0;
static TQMetaObjectCleanUp cleanUp_MaxMin( "MaxMin", &MaxMin::staticMetaObject );

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

#endif // TQT_NO_TRANSLATION

TQMetaObject* MaxMin::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 TQUParameter param_slot_0[] = {
	{ "state", &static_QUType_bool, 0, TQUParameter::In }
    };
    static const TQUMethod slot_0 = {"kcfg_DefaultMaxMinOptions_toggled", 1, param_slot_0 };
    static const TQUParameter param_slot_1[] = {
	{ "newValue", &static_QUType_int, 0, TQUParameter::In }
    };
    static const TQUMethod slot_1 = {"kcfg_BandwidthRate_valueChanged", 1, param_slot_1 };
    static const TQUParameter param_slot_2[] = {
	{ "newValue", &static_QUType_int, 0, TQUParameter::In }
    };
    static const TQUMethod slot_2 = {"kcfg_BandwidthBurst_valueChanged", 1, param_slot_2 };
    static const TQUMethod slot_3 = {"pushButton1_clicked", 0, 0 };
    static const TQUParameter param_slot_4[] = {
	{ 0, &static_QUType_ptr, "TQListViewItem", TQUParameter::In },
	{ "point", &static_QUType_varptr, "\x0e", TQUParameter::In },
	{ 0, &static_QUType_int, 0, TQUParameter::In }
    };
    static const TQUMethod slot_4 = {"timedBandwidthList_contextMenuRequested", 3, param_slot_4 };
    static const TQUMethod slot_5 = {"slotDeleteEntry", 0, 0 };
    static const TQUParameter param_slot_6[] = {
	{ 0, &static_QUType_bool, 0, TQUParameter::In }
    };
    static const TQUMethod slot_6 = {"kcfg_UseScheduledBandwidth_toggled", 1, param_slot_6 };
    static const TQUMethod slot_7 = {"languageChange", 0, 0 };
    static const TQMetaData slot_tbl[] = {
	{ "kcfg_DefaultMaxMinOptions_toggled(bool)", &slot_0, TQMetaData::Public },
	{ "kcfg_BandwidthRate_valueChanged(int)", &slot_1, TQMetaData::Public },
	{ "kcfg_BandwidthBurst_valueChanged(int)", &slot_2, TQMetaData::Public },
	{ "pushButton1_clicked()", &slot_3, TQMetaData::Public },
	{ "timedBandwidthList_contextMenuRequested(TQListViewItem*,const TQPoint&,int)", &slot_4, TQMetaData::Public },
	{ "slotDeleteEntry()", &slot_5, TQMetaData::Public },
	{ "kcfg_UseScheduledBandwidth_toggled(bool)", &slot_6, TQMetaData::Public },
	{ "languageChange()", &slot_7, TQMetaData::Protected }
    };
    metaObj = TQMetaObject::new_metaobject(
	"MaxMin", parentObject,
	slot_tbl, 8,
	0, 0,
#ifndef TQT_NO_PROPERTIES
	0, 0,
	0, 0,
#endif // TQT_NO_PROPERTIES
	0, 0 );
    cleanUp_MaxMin.setMetaObject( metaObj );
#ifdef TQT_THREAD_SUPPORT
    if (tqt_sharedMetaObjectMutex) tqt_sharedMetaObjectMutex->unlock();
#endif // TQT_THREAD_SUPPORT
    return metaObj;
}

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

bool MaxMin::tqt_invoke( int _id, TQUObject* _o )
{
    switch ( _id - staticMetaObject()->slotOffset() ) {
    case 0: kcfg_DefaultMaxMinOptions_toggled((bool)static_QUType_bool.get(_o+1)); break;
    case 1: kcfg_BandwidthRate_valueChanged((int)static_QUType_int.get(_o+1)); break;
    case 2: kcfg_BandwidthBurst_valueChanged((int)static_QUType_int.get(_o+1)); break;
    case 3: pushButton1_clicked(); break;
    case 4: timedBandwidthList_contextMenuRequested((TQListViewItem*)static_QUType_ptr.get(_o+1),(const TQPoint&)*((const TQPoint*)static_QUType_ptr.get(_o+2)),(int)static_QUType_int.get(_o+3)); break;
    case 5: slotDeleteEntry(); break;
    case 6: kcfg_UseScheduledBandwidth_toggled((bool)static_QUType_bool.get(_o+1)); break;
    case 7: languageChange(); break;
    default:
	return TQWidget::tqt_invoke( _id, _o );
    }
    return true;
}

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

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

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