/****************************************************************************
** Form implementation generated from reading ui file 'tochartalarmui.ui'
**
** Created: Tue Sep 18 08:21:21 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 "tochartalarmui.h"

#include <qvariant.h>
#include <qcombobox.h>
#include <qlineedit.h>
#include <qlabel.h>
#include <qpushbutton.h>
#include <qcheckbox.h>
#include <qlayout.h>
#include <qtooltip.h>
#include <qwhatsthis.h>
#include "toresultview.h"

/*
 *  Constructs a toChartAlarmUI 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.
 */
toChartAlarmUI::toChartAlarmUI( QWidget* parent, const char* name, bool modal, WFlags fl )
    : QDialog( parent, name, modal, fl )
{
    if ( !name )
	setName( "toChartAlarmUI" );
    toChartAlarmUILayout = new QGridLayout( this, 1, 1, 11, 6, "toChartAlarmUILayout"); 

    Operation = new QComboBox( FALSE, this, "Operation" );

    toChartAlarmUILayout->addWidget( Operation, 0, 2 );

    Action = new QComboBox( FALSE, this, "Action" );

    toChartAlarmUILayout->addWidget( Action, 3, 2 );

    Comparison = new QComboBox( FALSE, this, "Comparison" );

    toChartAlarmUILayout->addWidget( Comparison, 1, 2 );

    Value = new QLineEdit( this, "Value" );

    toChartAlarmUILayout->addWidget( Value, 2, 2 );

    TextLabel1 = new QLabel( this, "TextLabel1" );

    toChartAlarmUILayout->addWidget( TextLabel1, 0, 1 );

    TextLabel2 = new QLabel( this, "TextLabel2" );

    toChartAlarmUILayout->addWidget( TextLabel2, 2, 1 );

    TextLabel1_2 = new QLabel( this, "TextLabel1_2" );

    toChartAlarmUILayout->addWidget( TextLabel1_2, 1, 1 );

    TextLabel3 = new QLabel( this, "TextLabel3" );

    toChartAlarmUILayout->addWidget( TextLabel3, 3, 1 );

    Layout2 = new QHBoxLayout( 0, 0, 6, "Layout2"); 
    Spacer1 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
    Layout2->addItem( Spacer1 );

    PushButton1 = new QPushButton( this, "PushButton1" );
    PushButton1->setDefault( TRUE );
    Layout2->addWidget( PushButton1 );

    PushButton2 = new QPushButton( this, "PushButton2" );
    Layout2->addWidget( PushButton2 );

    toChartAlarmUILayout->addMultiCellLayout( Layout2, 7, 7, 0, 2 );

    Charts = new toListView( this, "Charts" );
    Charts->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)7, 0, 0, Charts->sizePolicy().hasHeightForWidth() ) );
    Charts->setFocusPolicy( toListView::StrongFocus );

    toChartAlarmUILayout->addMultiCellWidget( Charts, 0, 6, 0, 0 );
    Spacer2 = new QSpacerItem( 20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding );
    toChartAlarmUILayout->addItem( Spacer2, 6, 2 );

    Persistent = new QCheckBox( this, "Persistent" );

    toChartAlarmUILayout->addMultiCellWidget( Persistent, 5, 5, 1, 2 );

    ExtraLabel = new QLabel( this, "ExtraLabel" );

    toChartAlarmUILayout->addWidget( ExtraLabel, 4, 1 );

    Extra = new QLineEdit( this, "Extra" );

    toChartAlarmUILayout->addWidget( Extra, 4, 2 );
    languageChange();
    resize( QSize(388, 509).expandedTo(minimumSizeHint()) );
    clearWState( WState_Polished );

    // signals and slots connections
    connect( PushButton1, SIGNAL( clicked() ), this, SLOT( accept() ) );
    connect( PushButton2, SIGNAL( clicked() ), this, SLOT( reject() ) );
    connect( Action, SIGNAL( activated(int) ), this, SLOT( changeValue(int) ) );

    // tab order
    setTabOrder( Charts, Operation );
    setTabOrder( Operation, Comparison );
    setTabOrder( Comparison, Value );
    setTabOrder( Value, Action );
    setTabOrder( Action, Extra );
    setTabOrder( Extra, Persistent );
    setTabOrder( Persistent, PushButton1 );
    setTabOrder( PushButton1, PushButton2 );
}

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

/*
 *  Sets the strings of the subwidgets using the current
 *  language.
 */
void toChartAlarmUI::languageChange()
{
    setCaption( tr( "Chart alarm" ) );
    Operation->clear();
    Operation->insertItem( tr( "Any" ) );
    Operation->insertItem( tr( "All" ) );
    Operation->insertItem( tr( "Sum" ) );
    Operation->insertItem( tr( "Average" ) );
    Operation->insertItem( tr( "Max" ) );
    Operation->insertItem( tr( "Min" ) );
    Action->clear();
    Action->insertItem( tr( "Statusmessage" ) );
    Action->insertItem( tr( "Email" ) );
    Action->insertItem( tr( "Ignore" ) );
    Comparison->clear();
    Comparison->insertItem( tr( "=" ) );
    Comparison->insertItem( tr( "!=" ) );
    Comparison->insertItem( tr( "<" ) );
    Comparison->insertItem( tr( ">" ) );
    Comparison->insertItem( tr( "<=" ) );
    Comparison->insertItem( tr( ">=" ) );
    TextLabel1->setText( tr( "Operation" ) );
    QToolTip::add( TextLabel1, tr( "Operation to perform on the selected columns" ) );
    TextLabel2->setText( tr( "Value" ) );
    QToolTip::add( TextLabel2, tr( "Value to use in comparison." ) );
    TextLabel1_2->setText( tr( "Comparison" ) );
    QToolTip::add( TextLabel1_2, tr( "What comparison to do with the result from the above operation." ) );
    TextLabel3->setText( tr( "Action" ) );
    QToolTip::add( TextLabel3, tr( "What to do when alarm is triggered." ) );
    PushButton1->setText( tr( "&Ok" ) );
    PushButton2->setText( tr( "Cancel" ) );
    Persistent->setText( tr( "Persistent" ) );
    QToolTip::add( Persistent, tr( "Remember this alarm when restarting." ) );
    ExtraLabel->setText( QString::null );
}

void toChartAlarmUI::changeValue(int)
{
    qWarning( "toChartAlarmUI::changeValue(int): Not implemented yet" );
}

