/****************************************************************************
** Form implementation generated from reading ui file 'advancedsearchform.ui'
**
** Created: Fri Oct 21 16:49:00 2005
**      by: The User Interface Compiler ($Id$)
**
** WARNING! All changes made in this file will be lost!
****************************************************************************/

#include "advancedsearchform.h"

#include <qvariant.h>
#include <qpushbutton.h>
#include <qlabel.h>
#include <qtable.h>
#include <qtoolbutton.h>
#include <qspinbox.h>
#include <qlayout.h>
#include <qtooltip.h>
#include <qwhatsthis.h>
#include <qimage.h>
#include <qpixmap.h>

#include "advancedsearchform.ui.h"
static const unsigned char image0_data[] = { 
    0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, 0x00, 0x00, 0x00, 0x0d,
    0x49, 0x48, 0x44, 0x52, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x0f,
    0x08, 0x06, 0x00, 0x00, 0x00, 0x3b, 0xd6, 0x95, 0x4a, 0x00, 0x00, 0x00,
    0x98, 0x49, 0x44, 0x41, 0x54, 0x78, 0x9c, 0x63, 0x64, 0x65, 0x13, 0x64,
    0x40, 0x07, 0xbc, 0xbc, 0xac, 0xff, 0xd1, 0xc5, 0x3e, 0x7f, 0xfe, 0xcd,
    0x88, 0x2e, 0xc6, 0x82, 0xa1, 0x13, 0x0a, 0x36, 0xae, 0x7f, 0x09, 0x67,
    0xfb, 0x07, 0x8a, 0x63, 0x55, 0xc3, 0x84, 0x4b, 0x73, 0x55, 0x49, 0x25,
    0xc3, 0x8a, 0xc5, 0x6b, 0x71, 0x49, 0xe3, 0xd7, 0x4c, 0x0c, 0xa0, 0x48,
    0x33, 0x0b, 0xb6, 0xc0, 0xc1, 0x06, 0xb0, 0xa9, 0x63, 0x61, 0x60, 0x60,
    0x60, 0xd0, 0x56, 0x4e, 0x62, 0xd0, 0xd3, 0x37, 0xc1, 0xa9, 0x11, 0x39,
    0xf0, 0x60, 0xc0, 0x3f, 0x50, 0x1c, 0x77, 0x68, 0xc3, 0x00, 0xb6, 0x40,
    0x8b, 0x88, 0x0d, 0x46, 0xd8, 0xcc, 0xc0, 0xc0, 0xc0, 0x70, 0xe9, 0xe2,
    0x19, 0x0c, 0x45, 0xf8, 0x5c, 0xc3, 0xc0, 0xc0, 0xc0, 0xc0, 0x28, 0x24,
    0x2c, 0x86, 0xd5, 0xcf, 0xc8, 0x5e, 0x59, 0xbe, 0x2e, 0x0b, 0xab, 0x66,
    0x16, 0x6c, 0x29, 0x87, 0xd8, 0x14, 0x36, 0x80, 0xf1, 0x8c, 0x4f, 0x12,
    0x5b, 0x20, 0x22, 0x03, 0x46, 0x4a, 0x72, 0x15, 0x00, 0x78, 0xfa, 0x28,
    0xc9, 0xd1, 0x80, 0x96, 0x33, 0x00, 0x00, 0x00, 0x00, 0x49, 0x45, 0x4e,
    0x44, 0xae, 0x42, 0x60, 0x82
};

static const unsigned char image1_data[] = { 
    0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, 0x00, 0x00, 0x00, 0x0d,
    0x49, 0x48, 0x44, 0x52, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x0f,
    0x08, 0x06, 0x00, 0x00, 0x00, 0x3b, 0xd6, 0x95, 0x4a, 0x00, 0x00, 0x02,
    0x4d, 0x49, 0x44, 0x41, 0x54, 0x78, 0x9c, 0x6d, 0x93, 0xdd, 0x4b, 0x53,
    0x61, 0x1c, 0xc7, 0x3f, 0x67, 0x9e, 0xe9, 0x39, 0x7b, 0xe9, 0xf8, 0xd2,
    0xa6, 0x06, 0x5a, 0x98, 0x52, 0x96, 0x11, 0xbd, 0x40, 0x64, 0x05, 0x11,
    0x48, 0x17, 0xd5, 0x4d, 0x17, 0x52, 0x5e, 0x08, 0x41, 0x17, 0x62, 0xd7,
    0xdd, 0x78, 0xd3, 0xdf, 0x10, 0x44, 0x04, 0xde, 0x75, 0x91, 0xd0, 0x8d,
    0x10, 0x29, 0x95, 0xa9, 0x21, 0x34, 0x35, 0x74, 0x73, 0x2a, 0xe1, 0x4b,
    0xae, 0xcd, 0xb5, 0xa9, 0x9b, 0x9b, 0x67, 0x73, 0xce, 0x1d, 0xdd, 0x76,
    0xba, 0x10, 0x8f, 0x8d, 0xf5, 0xbd, 0x7a, 0x2e, 0x9e, 0xcf, 0xf7, 0xfb,
    0xe5, 0xf7, 0x7b, 0x1e, 0xc1, 0xe5, 0x0e, 0xf2, 0xaf, 0x9e, 0x75, 0x75,
    0xeb, 0x00, 0xa9, 0xe4, 0x26, 0x8e, 0x5a, 0x85, 0x70, 0x38, 0xc4, 0xbb,
    0xbe, 0x41, 0x81, 0xff, 0x48, 0x70, 0xb9, 0x83, 0xdc, 0xb8, 0x7c, 0x52,
    0x37, 0x5b, 0xab, 0x69, 0xa8, 0x6b, 0x01, 0xe0, 0xfa, 0xad, 0x0b, 0xf4,
    0xbc, 0xe8, 0xa1, 0xf7, 0x4d, 0x2f, 0xd1, 0x8d, 0x28, 0xe1, 0xe0, 0x0e,
    0x3e, 0xff, 0x2c, 0x7f, 0xfc, 0xe3, 0x0c, 0xbb, 0x82, 0x86, 0x91, 0x20,
    0x60, 0xd2, 0x1b, 0xcf, 0x5e, 0xa3, 0x04, 0x1b, 0x1d, 0x8f, 0x9e, 0x10,
    0xde, 0x58, 0xe5, 0x58, 0x95, 0x8e, 0xb3, 0x46, 0xc1, 0x26, 0x39, 0x98,
    0x75, 0xcf, 0x93, 0xd5, 0xac, 0x04, 0x42, 0x2b, 0xf8, 0x56, 0x46, 0xf8,
    0x13, 0x5c, 0x36, 0x0c, 0x44, 0x80, 0x12, 0x6c, 0xdc, 0xbd, 0xf3, 0x98,
    0x58, 0x24, 0x43, 0x77, 0xd7, 0x73, 0xe4, 0xaa, 0x2d, 0xb4, 0xbd, 0x4d,
    0x06, 0x3e, 0x4c, 0x53, 0xe3, 0x3c, 0x43, 0x2c, 0x92, 0x61, 0x71, 0x61,
    0x18, 0xca, 0xa4, 0xe2, 0xda, 0x1d, 0x0f, 0x9f, 0xea, 0x75, 0xce, 0x4b,
    0xd8, 0x95, 0x0a, 0x9a, 0x9a, 0x1c, 0xd4, 0x9d, 0xcb, 0x10, 0x08, 0x2f,
    0x92, 0x53, 0xcb, 0x09, 0x45, 0x4b, 0xf9, 0xd2, 0x3f, 0x42, 0xf3, 0xc5,
    0x7a, 0xfc, 0xfe, 0x01, 0x3e, 0x0e, 0x4d, 0x1b, 0xb5, 0x45, 0x80, 0xf0,
    0x9a, 0xca, 0xbd, 0xb6, 0xab, 0xb4, 0xdd, 0x7e, 0x40, 0x43, 0x8b, 0x48,
    0x7d, 0x73, 0x06, 0x49, 0xcc, 0xb3, 0xf0, 0x53, 0xc0, 0xeb, 0x0d, 0x73,
    0xfe, 0xd4, 0x4d, 0x3e, 0x7f, 0xea, 0x63, 0x7b, 0x7b, 0xbf, 0x20, 0x59,
    0x3c, 0x3c, 0x28, 0xe5, 0x0e, 0xb6, 0xd4, 0x3d, 0x12, 0x89, 0xd2, 0x82,
    0x0b, 0xf3, 0xee, 0x45, 0xd2, 0x49, 0x0d, 0x59, 0xb1, 0x21, 0x98, 0xa5,
    0x62, 0x38, 0x9f, 0x4f, 0x90, 0xda, 0xd9, 0x3d, 0x30, 0x51, 0xf2, 0x00,
    0x64, 0xb2, 0x26, 0x4c, 0x39, 0x89, 0x74, 0x52, 0xa3, 0xc4, 0x6c, 0x23,
    0xba, 0xf6, 0x1b, 0xab, 0xd9, 0x5a, 0x00, 0x9b, 0x00, 0xc6, 0x26, 0x87,
    0x84, 0xb1, 0xd1, 0x41, 0x00, 0x12, 0x09, 0x13, 0x92, 0x68, 0x01, 0x60,
    0x5f, 0xd3, 0xd1, 0x34, 0x9d, 0xdc, 0x7e, 0x8a, 0xbd, 0x4c, 0x96, 0x81,
    0x91, 0x51, 0xa1, 0x08, 0x06, 0xb0, 0xdb, 0x2d, 0xcc, 0xcc, 0x4d, 0x61,
    0x91, 0x72, 0x47, 0x95, 0x97, 0x7d, 0x38, 0xab, 0x9d, 0x4c, 0x4c, 0x7c,
    0xa5, 0x54, 0x12, 0xe9, 0x6c, 0x6f, 0xd5, 0xef, 0xb7, 0x5d, 0xd1, 0x8b,
    0xe0, 0x48, 0x6c, 0x19, 0x00, 0xcf, 0xf8, 0x12, 0x80, 0x91, 0x1e, 0xd9,
    0x88, 0x20, 0x2b, 0x36, 0xb4, 0x5c, 0x0a, 0x80, 0xca, 0x8a, 0x32, 0x3a,
    0xdb, 0x5b, 0xf5, 0x82, 0x81, 0x45, 0x62, 0x5e, 0x74, 0x93, 0x46, 0x79,
    0xad, 0xf3, 0x20, 0x75, 0x36, 0x80, 0xd5, 0x5c, 0x09, 0x40, 0x7a, 0x37,
    0x86, 0x24, 0xe5, 0xc9, 0x66, 0x41, 0x10, 0x8e, 0x86, 0x66, 0xc0, 0xaa,
    0xea, 0xc3, 0x33, 0xf5, 0x8d, 0xd3, 0x8d, 0xb5, 0x64, 0xb2, 0x32, 0x00,
    0xf1, 0x78, 0x9c, 0x0a, 0x87, 0x44, 0x68, 0x7d, 0x1e, 0xbb, 0xbc, 0x0e,
    0x40, 0x2c, 0x9e, 0x30, 0x76, 0x6d, 0xd4, 0xfe, 0xee, 0x0e, 0x08, 0xe9,
    0x5d, 0x15, 0xd9, 0x22, 0xe3, 0x5f, 0xd2, 0x11, 0xc5, 0xe3, 0x07, 0xa9,
    0x49, 0xcd, 0x48, 0x7a, 0xfb, 0xde, 0x25, 0x14, 0x3d, 0x92, 0x43, 0xcd,
    0x2d, 0x79, 0x78, 0xfd, 0xf2, 0x15, 0x6e, 0xef, 0x09, 0x00, 0x56, 0x7f,
    0x09, 0xfc, 0x98, 0xf1, 0xa0, 0xaa, 0xdb, 0xf4, 0x4f, 0xba, 0x8a, 0x7e,
    0xd6, 0x5f, 0xc3, 0x4c, 0xf4, 0xc5, 0xae, 0x3e, 0xf5, 0xdf, 0x00, 0x00,
    0x00, 0x00, 0x49, 0x45, 0x4e, 0x44, 0xae, 0x42, 0x60, 0x82
};


/*
 *  Constructs a advancedSearchForm as a child of 'parent', with the
 *  name 'name' and widget flags set to 'f'.
 */
advancedSearchForm::advancedSearchForm( QWidget* parent, const char* name, WFlags fl )
    : QWidget( parent, name, fl )
{
    QImage img;
    img.loadFromData( image0_data, sizeof( image0_data ), "PNG" );
    image0 = img;
    img.loadFromData( image1_data, sizeof( image1_data ), "PNG" );
    image1 = img;
    if ( !name )
	setName( "advancedSearchForm" );
    advancedSearchFormLayout = new QGridLayout( this, 1, 1, 11, 6, "advancedSearchFormLayout"); 

    textLabel2 = new QLabel( this, "textLabel2" );
    textLabel2->setAlignment( int( QLabel::WordBreak | QLabel::AlignVCenter ) );

    advancedSearchFormLayout->addWidget( textLabel2, 0, 0 );

    table = new QTable( this, "table" );
    table->setFrameShape( QTable::NoFrame );
    table->setNumRows( 0 );
    table->setNumCols( 4 );
    table->setRowMovingEnabled( TRUE );
    table->setSelectionMode( QTable::SingleRow );

    advancedSearchFormLayout->addWidget( table, 1, 0 );

    layout8 = new QHBoxLayout( 0, 0, 6, "layout8"); 
    spacer4 = new QSpacerItem( 149, 16, QSizePolicy::Expanding, QSizePolicy::Minimum );
    layout8->addItem( spacer4 );

    doAdvancedSearchButton = new QPushButton( this, "doAdvancedSearchButton" );
    doAdvancedSearchButton->setMaximumSize( QSize( 100, 32767 ) );
    layout8->addWidget( doAdvancedSearchButton );

    cancelAdvancedSearchButton = new QPushButton( this, "cancelAdvancedSearchButton" );
    cancelAdvancedSearchButton->setMaximumSize( QSize( 100, 32767 ) );
    layout8->addWidget( cancelAdvancedSearchButton );

    advancedSearchFormLayout->addLayout( layout8, 4, 0 );
    spacer3 = new QSpacerItem( 16, 68, QSizePolicy::Minimum, QSizePolicy::Expanding );
    advancedSearchFormLayout->addItem( spacer3, 3, 0 );

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

    addConditionButton = new QToolButton( this, "addConditionButton" );
    addConditionButton->setIconSet( QIconSet( image0 ) );
    addConditionButton->setUsesBigPixmap( FALSE );
    addConditionButton->setUsesTextLabel( TRUE );
    addConditionButton->setTextPosition( QToolButton::BesideIcon );
    layout12->addWidget( addConditionButton );

    deleteConditionButton = new QToolButton( this, "deleteConditionButton" );
    deleteConditionButton->setIconSet( QIconSet( image1 ) );
    deleteConditionButton->setUsesBigPixmap( FALSE );
    deleteConditionButton->setUsesTextLabel( TRUE );
    deleteConditionButton->setTextPosition( QToolButton::BesideIcon );
    layout12->addWidget( deleteConditionButton );

    dummyLabel = new QLabel( this, "dummyLabel" );
    dummyLabel->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)5, 2, 0, dummyLabel->sizePolicy().hasHeightForWidth() ) );
    layout12->addWidget( dummyLabel );

    hitLimitSpinBox = new QSpinBox( this, "hitLimitSpinBox" );
    hitLimitSpinBox->setMaxValue( 500 );
    hitLimitSpinBox->setMinValue( 10 );
    hitLimitSpinBox->setLineStep( 10 );
    hitLimitSpinBox->setValue( 50 );
    layout12->addWidget( hitLimitSpinBox );

    advancedSearchFormLayout->addLayout( layout12, 2, 0 );
    languageChange();
    resize( QSize(376, 348).expandedTo(minimumSizeHint()) );
    clearWState( WState_Polished );

    // signals and slots connections
    connect( addConditionButton, SIGNAL( clicked() ), this, SLOT( addCondition() ) );
    connect( deleteConditionButton, SIGNAL( clicked() ), this, SLOT( deleteSelectedCondition() ) );
    connect( doAdvancedSearchButton, SIGNAL( clicked() ), this, SLOT( executeSearch() ) );
    init();
}

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

/*
 *  Sets the strings of the subwidgets using the current
 *  language.
 */
void advancedSearchForm::languageChange()
{
    setCaption( tr( "Advanced Search" ) );
    textLabel2->setText( tr( "Construct a query by combining conditions below. Conditions can be added and deleted from the table." ) );
    doAdvancedSearchButton->setText( tr( "&Search" ) );
    doAdvancedSearchButton->setAccel( QKeySequence( tr( "Alt+S" ) ) );
    cancelAdvancedSearchButton->setText( tr( "Cancel" ) );
    addConditionButton->setText( QString::null );
    addConditionButton->setTextLabel( tr( "Add row" ) );
    deleteConditionButton->setText( QString::null );
    deleteConditionButton->setTextLabel( tr( "Delete row" ) );
    dummyLabel->setText( QString::null );
    hitLimitSpinBox->setPrefix( tr( "Limit to " ) );
    hitLimitSpinBox->setSuffix( tr( " hits" ) );
}

