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

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

#include "networkdlgbase.h"

#include <ntqvariant.h>
#include <ntqpushbutton.h>
#include <ntqbuttongroup.h>
#include <ntqradiobutton.h>
#include <ntqwidgetstack.h>
#include <ntqwidget.h>
#include <ntqlabel.h>
#include <ntqlineedit.h>
#include <ntqcombobox.h>
#include <ntqspinbox.h>
#include <ntqlayout.h>
#include <ntqtooltip.h>
#include <ntqwhatsthis.h>

/*
 *  Constructs a NetworkDlgBase as a child of 'parent', with the
 *  name 'name' and widget flags set to 'f'.
 *
 *  The qdialog will by default be modeless, unless you set 'modal' to
 *  true to construct a modal qdialog.
 */
NetworkDlgBase::NetworkDlgBase( TQWidget* parent, const char* name, bool modal, WFlags fl )
    : TQDialog( parent, name, modal, fl )
{
    if ( !name )
	setName( "NetworkDlgBase" );
    NetworkDlgBaseLayout = new TQVBoxLayout( this, 11, 6, "NetworkDlgBaseLayout"); 

    group = new TQButtonGroup( this, "group" );
    group->setSizePolicy( TQSizePolicy( (TQSizePolicy::SizeType)5, (TQSizePolicy::SizeType)0, 0, 0, group->sizePolicy().hasHeightForWidth() ) );
    group->setColumnLayout(0, TQt::Vertical );
    group->layout()->setSpacing( 6 );
    group->layout()->setMargin( 11 );
    groupLayout = new TQVBoxLayout( group->layout() );
    groupLayout->setAlignment( TQt::AlignTop );

    serverBtn = new TQRadioButton( group, "serverBtn" );
    serverBtn->setChecked( true );
    groupLayout->addWidget( serverBtn );

    clientBtn = new TQRadioButton( group, "clientBtn" );
    groupLayout->addWidget( clientBtn );
    NetworkDlgBaseLayout->addWidget( group );

    stack = new TQWidgetStack( this, "stack" );

    serverPage = new TQWidget( stack, "serverPage" );
    serverPageLayout = new TQHBoxLayout( serverPage, 0, 0, "serverPageLayout"); 

    serverLabel = new TQLabel( serverPage, "serverLabel" );
    serverPageLayout->addWidget( serverLabel );

    serverName = new TQLineEdit( serverPage, "serverName" );
    serverName->setSizePolicy( TQSizePolicy( (TQSizePolicy::SizeType)1, (TQSizePolicy::SizeType)0, 0, 0, serverName->sizePolicy().hasHeightForWidth() ) );
    serverPageLayout->addWidget( serverName );
    stack->addWidget( serverPage, 0 );

    clientPage = new TQWidget( stack, "clientPage" );
    clientPageLayout = new TQHBoxLayout( clientPage, 0, 0, "clientPageLayout"); 

    clientLabel = new TQLabel( clientPage, "clientLabel" );
    clientPageLayout->addWidget( clientLabel );

    clientName = new TQComboBox( false, clientPage, "clientName" );
    clientPageLayout->addWidget( clientName );
    stack->addWidget( clientPage, 1 );
    NetworkDlgBaseLayout->addWidget( stack );

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

    hostLabel = new TQLabel( this, "hostLabel" );
    hostLabel->setSizePolicy( TQSizePolicy( (TQSizePolicy::SizeType)5, (TQSizePolicy::SizeType)0, 0, 0, hostLabel->sizePolicy().hasHeightForWidth() ) );
    hostLabel->setAlignment( int( TQLabel::AlignVCenter | TQLabel::AlignLeft ) );
    layout9->addWidget( hostLabel );

    hostname = new TQLineEdit( this, "hostname" );
    hostname->setEnabled( false );
    layout9->addWidget( hostname );

    portLabel = new TQLabel( this, "portLabel" );
    portLabel->setSizePolicy( TQSizePolicy( (TQSizePolicy::SizeType)0, (TQSizePolicy::SizeType)0, 0, 0, portLabel->sizePolicy().hasHeightForWidth() ) );
    portLabel->setAlignment( int( TQLabel::AlignVCenter | TQLabel::AlignLeft ) );
    layout9->addWidget( portLabel );

    port = new TQSpinBox( this, "port" );
    port->setMaxValue( 65000 );
    port->setValue( 7432 );
    layout9->addWidget( port );
    NetworkDlgBaseLayout->addLayout( layout9 );

    layout11 = new TQHBoxLayout( 0, 0, 6, "layout11"); 
    spacer5 = new TQSpacerItem( 51, 20, TQSizePolicy::Expanding, TQSizePolicy::Minimum );
    layout11->addItem( spacer5 );

    pushButton1 = new TQPushButton( this, "pushButton1" );
    layout11->addWidget( pushButton1 );
    spacer6 = new TQSpacerItem( 61, 20, TQSizePolicy::Expanding, TQSizePolicy::Minimum );
    layout11->addItem( spacer6 );
    NetworkDlgBaseLayout->addLayout( layout11 );
    languageChange();
    resize( TQSize(320, 218).expandedTo(minimumSizeHint()) );
    clearWState( WState_Polished );

    // signals and slots connections
    connect( pushButton1, TQ_SIGNAL( clicked() ), this, TQ_SLOT( accept() ) );
    connect( clientName, TQ_SIGNAL( activated(int) ), this, TQ_SLOT( gameSelected(int) ) );
    connect( serverBtn, TQ_SIGNAL( toggled(bool) ), this, TQ_SLOT( toggleServerClient() ) );
    connect( clientBtn, TQ_SIGNAL( toggled(bool) ), this, TQ_SLOT( toggleServerClient() ) );

    // buddies
    serverLabel->setBuddy( serverName );
    clientLabel->setBuddy( clientName );
}

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

/*
 *  Sets the strings of the subwidgets using the current
 *  language.
 */
void NetworkDlgBase::languageChange()
{
    setCaption( tr2i18n( "Network Options" ) );
    group->setTitle( tr2i18n( "Play As" ) );
    serverBtn->setText( tr2i18n( "Server" ) );
    clientBtn->setText( tr2i18n( "Client" ) );
    serverLabel->setText( tr2i18n( "Game name:" ) );
    clientLabel->setText( tr2i18n( "Network games:" ) );
    hostLabel->setText( tr2i18n( "Host:" ) );
    portLabel->setText( tr2i18n( "Port:" ) );
    TQWhatsThis::add( port, tr2i18n( "Choose a port to connect to" ) );
    pushButton1->setText( tr2i18n( "&OK" ) );
}

void NetworkDlgBase::toggleServerClient()
{
    tqWarning( "NetworkDlgBase::toggleServerClient(): Not implemented yet" );
}

void NetworkDlgBase::gameSelected(int)
{
    tqWarning( "NetworkDlgBase::gameSelected(int): Not implemented yet" );
}

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

TQMetaObject *NetworkDlgBase::metaObj = 0;
static TQMetaObjectCleanUp cleanUp_NetworkDlgBase( "NetworkDlgBase", &NetworkDlgBase::staticMetaObject );

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

#endif // TQT_NO_TRANSLATION

TQMetaObject* NetworkDlgBase::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 = TQDialog::staticMetaObject();
    static const TQUMethod slot_0 = {"languageChange", 0, 0 };
    static const TQUMethod slot_1 = {"toggleServerClient", 0, 0 };
    static const TQUParameter param_slot_2[] = {
	{ "nr", &static_QUType_int, 0, TQUParameter::In }
    };
    static const TQUMethod slot_2 = {"gameSelected", 1, param_slot_2 };
    static const TQMetaData slot_tbl[] = {
	{ "languageChange()", &slot_0, TQMetaData::Protected },
	{ "toggleServerClient()", &slot_1, TQMetaData::Protected },
	{ "gameSelected(int)", &slot_2, TQMetaData::Protected }
    };
    metaObj = TQMetaObject::new_metaobject(
	"NetworkDlgBase", parentObject,
	slot_tbl, 3,
	0, 0,
#ifndef TQT_NO_PROPERTIES
	0, 0,
	0, 0,
#endif // TQT_NO_PROPERTIES
	0, 0 );
    cleanUp_NetworkDlgBase.setMetaObject( metaObj );
#ifdef TQT_THREAD_SUPPORT
    if (tqt_sharedMetaObjectMutex) tqt_sharedMetaObjectMutex->unlock();
#endif // TQT_THREAD_SUPPORT
    return metaObj;
}

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

bool NetworkDlgBase::tqt_invoke( int _id, TQUObject* _o )
{
    switch ( _id - staticMetaObject()->slotOffset() ) {
    case 0: languageChange(); break;
    case 1: toggleServerClient(); break;
    case 2: gameSelected((int)static_QUType_int.get(_o+1)); break;
    default:
	return TQDialog::tqt_invoke( _id, _o );
    }
    return true;
}

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

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

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