/****************************************************************************
** Form implementation generated from reading ui file 'tobrowserfilterui.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 "tobrowserfilterui.h"

#include <qvariant.h>
#include <qpushbutton.h>
#include <qbuttongroup.h>
#include <qlineedit.h>
#include <qradiobutton.h>
#include <qcheckbox.h>
#include <qlayout.h>
#include <qtooltip.h>
#include <qwhatsthis.h>
#include "toresultview.h"

/*
 *  Constructs a toBrowserFilterUI 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.
 */
toBrowserFilterUI::toBrowserFilterUI( QWidget* parent, const char* name, bool modal, WFlags fl )
    : QDialog( parent, name, modal, fl )
{
    if ( !name )
	setName( "toBrowserFilterUI" );
    toBrowserFilterUILayout = new QGridLayout( this, 1, 1, 11, 6, "toBrowserFilterUILayout"); 
    Spacer1 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
    toBrowserFilterUILayout->addItem( Spacer1, 4, 0 );

    OkButton = new QPushButton( this, "OkButton" );
    OkButton->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, OkButton->sizePolicy().hasHeightForWidth() ) );
    OkButton->setDefault( TRUE );

    toBrowserFilterUILayout->addWidget( OkButton, 4, 1 );

    Cancel = new QPushButton( this, "Cancel" );
    Cancel->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, Cancel->sizePolicy().hasHeightForWidth() ) );

    toBrowserFilterUILayout->addWidget( Cancel, 4, 2 );

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

    String = new QLineEdit( Buttons, "String" );
    String->setEnabled( FALSE );

    ButtonsLayout->addMultiCellWidget( String, 1, 1, 0, 5 );

    None = new QRadioButton( Buttons, "None" );
    None->setChecked( TRUE );
    Buttons->insert( None, 0 );

    ButtonsLayout->addWidget( None, 0, 0 );

    StartWith = new QRadioButton( Buttons, "StartWith" );
    Buttons->insert( StartWith, 1 );

    ButtonsLayout->addWidget( StartWith, 0, 1 );

    EndWith = new QRadioButton( Buttons, "EndWith" );
    Buttons->insert( EndWith, 2 );

    ButtonsLayout->addWidget( EndWith, 0, 2 );

    Contains = new QRadioButton( Buttons, "Contains" );
    Buttons->insert( Contains, 3 );

    ButtonsLayout->addWidget( Contains, 0, 3 );

    RegExp = new QRadioButton( Buttons, "RegExp" );
    Buttons->insert( RegExp, 5 );

    ButtonsLayout->addWidget( RegExp, 0, 5 );

    CommaSeparate = new QRadioButton( Buttons, "CommaSeparate" );
    Buttons->insert( CommaSeparate, 4 );

    ButtonsLayout->addWidget( CommaSeparate, 0, 4 );

    toBrowserFilterUILayout->addMultiCellWidget( Buttons, 1, 1, 0, 2 );
    Spacer2 = new QSpacerItem( 20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding );
    toBrowserFilterUILayout->addItem( Spacer2, 3, 0 );

    TablespaceType = new QButtonGroup( this, "TablespaceType" );
    TablespaceType->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)7, 0, 0, TablespaceType->sizePolicy().hasHeightForWidth() ) );
    TablespaceType->setColumnLayout(0, Qt::Vertical );
    TablespaceType->layout()->setSpacing( 6 );
    TablespaceType->layout()->setMargin( 11 );
    TablespaceTypeLayout = new QGridLayout( TablespaceType->layout() );
    TablespaceTypeLayout->setAlignment( Qt::AlignTop );

    IncludeAll = new QRadioButton( TablespaceType, "IncludeAll" );
    IncludeAll->setChecked( TRUE );

    TablespaceTypeLayout->addWidget( IncludeAll, 0, 0 );

    Include = new QRadioButton( TablespaceType, "Include" );

    TablespaceTypeLayout->addWidget( Include, 0, 1 );

    Exclude = new QRadioButton( TablespaceType, "Exclude" );

    TablespaceTypeLayout->addWidget( Exclude, 0, 2 );

    Tablespaces = new toResultView( TablespaceType, "Tablespaces" );
    Tablespaces->setEnabled( FALSE );
    Tablespaces->setFocusPolicy( toResultView::StrongFocus );

    TablespaceTypeLayout->addMultiCellWidget( Tablespaces, 1, 1, 0, 2 );

    toBrowserFilterUILayout->addMultiCellWidget( TablespaceType, 2, 2, 0, 2 );

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

    OnlyOwnSchema = new QCheckBox( this, "OnlyOwnSchema" );
    Layout1->addWidget( OnlyOwnSchema );

    IgnoreCase = new QCheckBox( this, "IgnoreCase" );
    IgnoreCase->setEnabled( FALSE );
    IgnoreCase->setChecked( TRUE );
    Layout1->addWidget( IgnoreCase );

    Invert = new QCheckBox( this, "Invert" );
    Invert->setEnabled( FALSE );
    Layout1->addWidget( Invert );

    toBrowserFilterUILayout->addMultiCellLayout( Layout1, 0, 0, 0, 2 );
    languageChange();
    resize( QSize(464, 378).expandedTo(minimumSizeHint()) );
    clearWState( WState_Polished );

    // signals and slots connections
    connect( None, SIGNAL( toggled(bool) ), String, SLOT( setDisabled(bool) ) );
    connect( None, SIGNAL( toggled(bool) ), IgnoreCase, SLOT( setDisabled(bool) ) );
    connect( None, SIGNAL( toggled(bool) ), Invert, SLOT( setDisabled(bool) ) );
    connect( Cancel, SIGNAL( clicked() ), this, SLOT( reject() ) );
    connect( OkButton, SIGNAL( clicked() ), this, SLOT( accept() ) );
    connect( IncludeAll, SIGNAL( toggled(bool) ), Tablespaces, SLOT( setDisabled(bool) ) );

    // tab order
    setTabOrder( OnlyOwnSchema, IgnoreCase );
    setTabOrder( IgnoreCase, Invert );
    setTabOrder( Invert, None );
    setTabOrder( None, String );
    setTabOrder( String, IncludeAll );
    setTabOrder( IncludeAll, Include );
    setTabOrder( Include, Exclude );
    setTabOrder( Exclude, Tablespaces );
    setTabOrder( Tablespaces, OkButton );
    setTabOrder( OkButton, Cancel );
}

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

/*
 *  Sets the strings of the subwidgets using the current
 *  language.
 */
void toBrowserFilterUI::languageChange()
{
    setCaption( tr( "Filter setting" ) );
    OkButton->setText( tr( "&Ok" ) );
    Cancel->setText( tr( "Cancel" ) );
    Buttons->setTitle( tr( "Filter on name" ) );
    None->setText( tr( "&No filter" ) );
    StartWith->setText( tr( "&Start with" ) );
    QToolTip::add( StartWith, tr( "Object name start with" ) );
    EndWith->setText( tr( "&End with" ) );
    QToolTip::add( EndWith, tr( "Object name ends in" ) );
    Contains->setText( tr( "&Contains" ) );
    QToolTip::add( Contains, tr( "Object name contains" ) );
    RegExp->setText( tr( "&RegExp" ) );
    QToolTip::add( RegExp, tr( "Object name matches RegExp" ) );
    CommaSeparate->setText( tr( "&Comma list" ) );
    QToolTip::add( CommaSeparate, tr( "Comma separated list of object names" ) );
    TablespaceType->setTitle( tr( "Filter on tablespace" ) );
    IncludeAll->setText( tr( "Include &All" ) );
    Include->setText( tr( "&Include" ) );
    Exclude->setText( tr( "&Exclude" ) );
    OnlyOwnSchema->setText( tr( "Only display own schema" ) );
    IgnoreCase->setText( tr( "Ignore &Case" ) );
    Invert->setText( tr( "&Invert selection" ) );
}

void toBrowserFilterUI::displayHelp()
{
    qWarning( "toBrowserFilterUI::displayHelp(): Not implemented yet" );
}

