/****************************************************************************
** Form implementation generated from reading ui file 'tobrowserconstraintui.ui'
**
** Created: Tue Sep 18 08:21:20 2007
**      by: The User Interface Compiler ($Id: qt/main.cpp   3.3.8   edited Jan 11 14:47 $)
**
** WARNING! All changes made in this file will be lost!
****************************************************************************/

#include "tobrowserconstraintui.h"

#include <qvariant.h>
#include <qpushbutton.h>
#include <qcombobox.h>
#include <qlabel.h>
#include <qtoolbutton.h>
#include <qwidgetstack.h>
#include <qwidget.h>
#include <qlineedit.h>
#include <qframe.h>
#include <qbuttongroup.h>
#include <qradiobutton.h>
#include <qlayout.h>
#include <qtooltip.h>
#include <qwhatsthis.h>
#include <qimage.h>
#include <qpixmap.h>

#include "toresultcols.h"
#include "totableselect.h"
static const char* const image0_data[] = { 
"16 16 3 1",
". c None",
"# c #000000",
"a c #00ff00",
"..........###...",
"..........#a#...",
"..........#a#...",
".......####a####",
".......#aaaaaaa#",
".......####a####",
"..........#a#...",
"..........#a#...",
"..........###...",
"................",
"................",
"................",
"................",
"................",
"................",
"................"};

static const char* const image1_data[] = { 
"16 16 3 1",
". c None",
"# c #000000",
"a c #ff0000",
"................",
"................",
"................",
".......#########",
".......#aaaaaaa#",
".......#########",
"................",
"................",
"................",
"................",
"................",
"................",
"................",
"................",
"................",
"................"};

static const char* const image2_data[] = { 
"16 16 14 1",
". c None",
"# c #000000",
"i c #181841",
"e c #20205a",
"k c #202462",
"c c #292873",
"l c #292c7b",
"h c #313083",
"b c #393cac",
"d c #4140b4",
"f c #4a4ccd",
"j c #5a59f6",
"g c #5a5df6",
"a c #5a5dff",
"................",
".###..###..##...",
"#..#.#..#..#....",
"##...#...#.#....",
"..#..#####.#....",
"...#.#aab#.#....",
"#..##cdaef##..#.",
".##.#ghiha#####.",
"....#aajkl#.....",
".....#aaa#......",
"......#####.....",
".........###....",
"..........###...",
"...........##...",
"................",
"................"};


/*
 *  Constructs a toBrowserConstraintUI as 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.
 */
toBrowserConstraintUI::toBrowserConstraintUI( QWidget* parent, const char* name, bool modal, WFlags fl )
    : QDialog( parent, name, modal, fl ),
      image0( (const char **) image0_data ),
      image1( (const char **) image1_data ),
      image2( (const char **) image2_data )
{
    if ( !name )
	setName( "toBrowserConstraintUI" );
    toBrowserConstraintUILayout = new QGridLayout( this, 1, 1, 11, 6, "toBrowserConstraintUILayout"); 

    layout2 = new QHBoxLayout( 0, 0, 6, "layout2"); 

    Name = new QComboBox( FALSE, this, "Name" );
    Name->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)1, (QSizePolicy::SizeType)0, 3, 0, Name->sizePolicy().hasHeightForWidth() ) );
    layout2->addWidget( Name );

    Type = new QComboBox( FALSE, this, "Type" );
    Type->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)1, (QSizePolicy::SizeType)0, 1, 0, Type->sizePolicy().hasHeightForWidth() ) );
    layout2->addWidget( Type );

    toBrowserConstraintUILayout->addMultiCellLayout( layout2, 2, 2, 0, 3 );
    Spacer1 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
    toBrowserConstraintUILayout->addItem( Spacer1, 4, 1 );

    layout1 = new QHBoxLayout( 0, 0, 6, "layout1"); 

    TextLabel1 = new QLabel( this, "TextLabel1" );
    TextLabel1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)5, 0, 0, TextLabel1->sizePolicy().hasHeightForWidth() ) );
    layout1->addWidget( TextLabel1 );

    AddButton = new QToolButton( this, "AddButton" );
    AddButton->setPixmap( image0 );
    layout1->addWidget( AddButton );

    DeleteButton = new QToolButton( this, "DeleteButton" );
    DeleteButton->setPixmap( image1 );
    layout1->addWidget( DeleteButton );

    toBrowserConstraintUILayout->addMultiCellLayout( layout1, 1, 1, 0, 3 );

    PushButton2 = new QPushButton( this, "PushButton2" );

    toBrowserConstraintUILayout->addWidget( PushButton2, 4, 3 );

    WidgetStack = new QWidgetStack( this, "WidgetStack" );
    WidgetStack->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)7, 0, 0, WidgetStack->sizePolicy().hasHeightForWidth() ) );

    ReferentialPage = new QWidget( WidgetStack, "ReferentialPage" );
    ReferentialPageLayout = new QGridLayout( ReferentialPage, 1, 1, 11, 6, "ReferentialPageLayout"); 

    TextLabel3 = new QLabel( ReferentialPage, "TextLabel3" );
    TextLabel3->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, 0, 0, TextLabel3->sizePolicy().hasHeightForWidth() ) );

    ReferentialPageLayout->addMultiCellWidget( TextLabel3, 1, 2, 0, 0 );

    SourceColumns = new QLineEdit( ReferentialPage, "SourceColumns" );

    ReferentialPageLayout->addWidget( SourceColumns, 3, 0 );

    SourceColList = new toResultCols( ReferentialPage, "SourceColList" );
    SourceColList->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)2, (QSizePolicy::SizeType)7, 0, 0, SourceColList->sizePolicy().hasHeightForWidth() ) );
    SourceColList->setFocusPolicy( toResultCols::StrongFocus );

    ReferentialPageLayout->addWidget( SourceColList, 4, 0 );

    TextLabel5 = new QLabel( ReferentialPage, "TextLabel5" );
    TextLabel5->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, 0, 0, TextLabel5->sizePolicy().hasHeightForWidth() ) );

    ReferentialPageLayout->addMultiCellWidget( TextLabel5, 2, 2, 2, 3 );

    ReferedColumns = new QLineEdit( ReferentialPage, "ReferedColumns" );

    ReferentialPageLayout->addMultiCellWidget( ReferedColumns, 3, 3, 2, 3 );

    ReferColList = new toResultCols( ReferentialPage, "ReferColList" );
    ReferColList->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)2, (QSizePolicy::SizeType)7, 0, 0, ReferColList->sizePolicy().hasHeightForWidth() ) );
    ReferColList->setFocusPolicy( toResultCols::StrongFocus );

    ReferentialPageLayout->addMultiCellWidget( ReferColList, 4, 4, 2, 3 );

    Line3 = new QFrame( ReferentialPage, "Line3" );
    Line3->setFrameShape( QFrame::HLine );
    Line3->setFrameShadow( QFrame::Sunken );
    Line3->setFrameShape( QFrame::HLine );

    ReferentialPageLayout->addMultiCellWidget( Line3, 1, 1, 2, 3 );

    Line1 = new QFrame( ReferentialPage, "Line1" );
    Line1->setFrameShape( QFrame::VLine );
    Line1->setFrameShadow( QFrame::Sunken );
    Line1->setFrameShape( QFrame::VLine );

    ReferentialPageLayout->addMultiCellWidget( Line1, 0, 4, 1, 1 );

    ReferTable = new QComboBox( FALSE, ReferentialPage, "ReferTable" );
    ReferTable->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, 0, 0, ReferTable->sizePolicy().hasHeightForWidth() ) );
    ReferTable->setEditable( TRUE );

    ReferentialPageLayout->addWidget( ReferTable, 0, 3 );

    TextLabel4 = new QLabel( ReferentialPage, "TextLabel4" );
    TextLabel4->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)1, 0, 0, TextLabel4->sizePolicy().hasHeightForWidth() ) );

    ReferentialPageLayout->addWidget( TextLabel4, 0, 2 );
    WidgetStack->addWidget( ReferentialPage, 0 );

    PrimaryPage = new QWidget( WidgetStack, "PrimaryPage" );
    PrimaryPageLayout = new QVBoxLayout( PrimaryPage, 11, 6, "PrimaryPageLayout"); 

    UniqueType = new QButtonGroup( PrimaryPage, "UniqueType" );
    UniqueType->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)4, 0, 0, UniqueType->sizePolicy().hasHeightForWidth() ) );
    UniqueType->setColumnLayout(0, Qt::Vertical );
    UniqueType->layout()->setSpacing( 6 );
    UniqueType->layout()->setMargin( 11 );
    UniqueTypeLayout = new QGridLayout( UniqueType->layout() );
    UniqueTypeLayout->setAlignment( Qt::AlignTop );

    Primary = new QRadioButton( UniqueType, "Primary" );
    Primary->setChecked( TRUE );

    UniqueTypeLayout->addWidget( Primary, 0, 0 );

    Unique = new QRadioButton( UniqueType, "Unique" );

    UniqueTypeLayout->addWidget( Unique, 0, 1 );
    PrimaryPageLayout->addWidget( UniqueType );

    TextLabel2 = new QLabel( PrimaryPage, "TextLabel2" );
    PrimaryPageLayout->addWidget( TextLabel2 );

    UniqueCols = new QLineEdit( PrimaryPage, "UniqueCols" );
    PrimaryPageLayout->addWidget( UniqueCols );

    UniqueColList = new toResultCols( PrimaryPage, "UniqueColList" );
    UniqueColList->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)7, 0, 0, UniqueColList->sizePolicy().hasHeightForWidth() ) );
    UniqueColList->setFocusPolicy( toResultCols::StrongFocus );
    PrimaryPageLayout->addWidget( UniqueColList );
    WidgetStack->addWidget( PrimaryPage, 1 );

    CheckPage = new QWidget( WidgetStack, "CheckPage" );
    CheckPageLayout = new QGridLayout( CheckPage, 1, 1, 11, 6, "CheckPageLayout"); 

    TextLabel2_2 = new QLabel( CheckPage, "TextLabel2_2" );

    CheckPageLayout->addWidget( TextLabel2_2, 2, 0 );

    TextLabel6 = new QLabel( CheckPage, "TextLabel6" );

    CheckPageLayout->addWidget( TextLabel6, 0, 0 );

    CheckCondition = new QLineEdit( CheckPage, "CheckCondition" );

    CheckPageLayout->addWidget( CheckCondition, 3, 0 );

    CheckColumn = new toResultCols( CheckPage, "CheckColumn" );
    CheckColumn->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)7, 0, 0, CheckColumn->sizePolicy().hasHeightForWidth() ) );
    CheckColumn->setFocusPolicy( toResultCols::StrongFocus );

    CheckPageLayout->addWidget( CheckColumn, 1, 0 );
    WidgetStack->addWidget( CheckPage, 2 );

    toBrowserConstraintUILayout->addMultiCellWidget( WidgetStack, 3, 3, 0, 3 );

    ApplyButton = new QPushButton( this, "ApplyButton" );
    ApplyButton->setDefault( TRUE );

    toBrowserConstraintUILayout->addWidget( ApplyButton, 4, 2 );

    ToolButton1 = new QToolButton( this, "ToolButton1" );
    ToolButton1->setFocusPolicy( QToolButton::StrongFocus );
    ToolButton1->setPixmap( image2 );

    toBrowserConstraintUILayout->addWidget( ToolButton1, 4, 0 );

    TableSelect = new toTableSelect( this, "TableSelect" );

    toBrowserConstraintUILayout->addMultiCellWidget( TableSelect, 0, 0, 0, 3 );
    languageChange();
    resize( QSize(640, 669).expandedTo(minimumSizeHint()) );
    clearWState( WState_Polished );

    // signals and slots connections
    connect( ToolButton1, SIGNAL( clicked() ), this, SLOT( displaySQL() ) );
    connect( PushButton2, SIGNAL( clicked() ), this, SLOT( reject() ) );
    connect( ApplyButton, SIGNAL( clicked() ), this, SLOT( accept() ) );
    connect( Name, SIGNAL( activated(int) ), this, SLOT( changeConstraint() ) );
    connect( AddButton, SIGNAL( clicked() ), this, SLOT( addConstraint() ) );
    connect( DeleteButton, SIGNAL( clicked() ), this, SLOT( delConstraint() ) );
    connect( ReferTable, SIGNAL( activated(const QString&) ), this, SLOT( changeRefered() ) );
    connect( Type, SIGNAL( activated(int) ), this, SLOT( changeType(int) ) );

    // tab order
    setTabOrder( Name, ReferTable );
    setTabOrder( ReferTable, SourceColumns );
    setTabOrder( SourceColumns, ReferedColumns );
    setTabOrder( ReferedColumns, SourceColList );
    setTabOrder( SourceColList, ReferColList );
    setTabOrder( ReferColList, Primary );
    setTabOrder( Primary, UniqueCols );
    setTabOrder( UniqueCols, UniqueColList );
    setTabOrder( UniqueColList, CheckColumn );
    setTabOrder( CheckColumn, CheckCondition );
    setTabOrder( CheckCondition, ToolButton1 );
    setTabOrder( ToolButton1, ApplyButton );
    setTabOrder( ApplyButton, PushButton2 );

    // buddies
    TextLabel1->setBuddy( Name );
    TextLabel3->setBuddy( SourceColumns );
    TextLabel5->setBuddy( ReferedColumns );
    TextLabel4->setBuddy( ReferTable );
    TextLabel2->setBuddy( UniqueCols );
    TextLabel2_2->setBuddy( CheckCondition );
    TextLabel6->setBuddy( CheckColumn );
}

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

/*
 *  Sets the strings of the subwidgets using the current
 *  language.
 */
void toBrowserConstraintUI::languageChange()
{
    setCaption( tr( "Constraint info" ) );
    Type->clear();
    Type->insertItem( tr( "Foreign Key" ) );
    Type->insertItem( tr( "Check" ) );
    Type->insertItem( tr( "Unique Primary Key" ) );
    TextLabel1->setText( tr( "&Name" ) );
    AddButton->setText( QString::null );
    DeleteButton->setText( QString::null );
    PushButton2->setText( tr( "Cancel" ) );
    TextLabel3->setText( tr( "&Columns" ) );
    TextLabel5->setText( tr( "R&efered columns" ) );
    TextLabel4->setText( tr( "Refers &To" ) );
    UniqueType->setTitle( tr( "&Type" ) );
    Primary->setText( tr( "Primary key" ) );
    Unique->setText( tr( "Unique" ) );
    TextLabel2->setText( tr( "&Columns" ) );
    TextLabel2_2->setText( tr( "C&ondition" ) );
    TextLabel6->setText( tr( "&Column" ) );
    ApplyButton->setText( tr( "&Ok" ) );
    ToolButton1->setText( QString::null );
    QToolTip::add( ToolButton1, tr( "Display SQL to create this constraint" ) );
}

void toBrowserConstraintUI::addConstraint()
{
    qWarning( "toBrowserConstraintUI::addConstraint(): Not implemented yet" );
}

void toBrowserConstraintUI::displaySQL()
{
    qWarning( "toBrowserConstraintUI::displaySQL(): Not implemented yet" );
}

void toBrowserConstraintUI::delConstraint()
{
    qWarning( "toBrowserConstraintUI::delConstraint(): Not implemented yet" );
}

void toBrowserConstraintUI::changeConstraint()
{
    qWarning( "toBrowserConstraintUI::changeConstraint(): Not implemented yet" );
}

void toBrowserConstraintUI::changeRefered()
{
    qWarning( "toBrowserConstraintUI::changeRefered(): Not implemented yet" );
}

void toBrowserConstraintUI::changeType(int)
{
    qWarning( "toBrowserConstraintUI::changeType(int): Not implemented yet" );
}

