/****************************************************************************
** Form implementation generated from reading ui file 'namedlg.ui'
**
** Created: Thu Nov 23 11:10:17 2000
**      by:  The User Interface Compiler (uic)
**
** WARNING! All changes made in this file will be lost!
****************************************************************************/
#include "namedlg.h"

#include <tqgroupbox.h>
#include <tqlabel.h>
#include <tqlineedit.h>
#include <tqlayout.h>
#include <tqwhatsthis.h>

#include <tdelocale.h>

#define NAME_MAX_LEN 12

/* 
 *  Constructs a NameDlg which is a child of 'parent', with the 
 *  name 'name' and widget flags set to 'f' 
 *
 *  The dialog will by default be modeless, unless you set 'modal' to
 *  TRUE to construct a modal dialog.
 */
NameDlg::NameDlg( TQWidget *parent, const char *name,bool /* modal */, WFlags /* fl */ )
    : KDialogBase( Plain, i18n("Configure Names"), Ok|Cancel, Ok,
                   parent, name, true,true )

{
  TQWidget *page = plainPage();
    if ( !name ) setName( "NameDlg" );
    resize( 252, 186 ); 
//    setCaption( i18n( "Configure Names"  ) );
    vbox = new TQVBoxLayout( page,spacingHint() ); 
    vbox->setSpacing( 6 );
    vbox->setMargin( 11 );

    hbox = new TQHBoxLayout; 
    hbox->setSpacing( 6 );
    hbox->setMargin( 0 );

    player_names = new TQGroupBox( page, "player_names" );
    player_names->setTitle(i18n("Player Names") );
    player_names->setColumnLayout(0, TQt::Vertical );
    player_names->layout()->setSpacing( 0 );
    player_names->layout()->setMargin( 0 );
    vbox_2 = new TQVBoxLayout( player_names->layout() );
    vbox_2->setAlignment( TQt::AlignTop );
    vbox_2->setSpacing( 6 );
    vbox_2->setMargin( 11 );

    vbox_3 = new TQVBoxLayout; 
    vbox_3->setSpacing( 6 );
    vbox_3->setMargin( 0 );

    hbox_2 = new TQHBoxLayout; 
    hbox_2->setSpacing( 6 );
    hbox_2->setMargin( 0 );

    text_player1 = new TQLabel( player_names, "text_player1" );
    text_player1->setText( i18n("Player 1:" ) );
    hbox_2->addWidget( text_player1 );

    edit_player1 = new TQLineEdit( player_names, "edit_player1" );
    edit_player1->setMaxLength( NAME_MAX_LEN );
    TQWhatsThis::add(  edit_player1, i18n( "Enter a player's name" ) );

    hbox_2->addWidget( edit_player1 );
    vbox_3->addLayout( hbox_2 );

    hbox_3 = new TQHBoxLayout;
    hbox_3->setSpacing( 6 );
    hbox_3->setMargin( 0 );

    text_player2 = new TQLabel( player_names, "text_player2" );
    text_player2->setText( i18n("Player 2:" ) );
    hbox_3->addWidget( text_player2 );

    edit_player2 = new TQLineEdit( player_names, "edit_player2" );
    edit_player2->setMaxLength( NAME_MAX_LEN );
    TQWhatsThis::add(  edit_player2, i18n( "Enter a player's name" ) );
    hbox_3->addWidget( edit_player2 );
    vbox_3->addLayout( hbox_3 );
    vbox_2->addLayout( vbox_3 );

    // left
    TQSpacerItem* spacer_3 = new TQSpacerItem( 0, 0, TQSizePolicy::Expanding, TQSizePolicy::Minimum );
    hbox->addItem( spacer_3 );

    hbox->addWidget( player_names );
    TQSpacerItem* spacer = new TQSpacerItem( 20, 20, TQSizePolicy::Expanding, TQSizePolicy::Minimum );
    hbox->addItem( spacer );

    // top
    TQSpacerItem* spacer_4 = new TQSpacerItem( 0, 0, TQSizePolicy::Minimum, TQSizePolicy::Expanding );
    vbox->addItem( spacer_4 );

    vbox->addLayout( hbox );
    TQSpacerItem* spacer_2 = new TQSpacerItem( 20, 20, TQSizePolicy::Minimum, TQSizePolicy::Expanding );
    vbox->addItem( spacer_2 );

}

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

// In and output the name strings
void NameDlg::SetNames(TQString n1, TQString n2)
{
  edit_player1->setText( n1 );
  edit_player2->setText( n2 );
}
void NameDlg::GetNames(TQString &n1, TQString &n2)
{
  n1=edit_player1->text(  );
  n1.truncate(NAME_MAX_LEN);
  n2=edit_player2->text(  );
  n2.truncate(NAME_MAX_LEN);
}

#include "namedlg.moc"
