/****************************************************************************
** Form implementation generated from reading ui file 'mainpanel.ui'
**
** Created: Wed Apr 26 12:53:21 2006
**      by: The User Interface Compiler ($Id: qt/main.cpp   3.3.4   edited Nov 24 2003 $)
**
** WARNING! All changes made in this file will be lost!
****************************************************************************/

#include "mainpanel.h"

#include <qvariant.h>
#include <qlabel.h>
#include <qheader.h>
#include <qlistview.h>
#include <qtabwidget.h>
#include <qwidget.h>
#include <qlineedit.h>
#include <qpushbutton.h>
#include <qgroupbox.h>
#include <qlistbox.h>
#include <qbuttongroup.h>
#include <qlayout.h>
#include <qtooltip.h>
#include <qwhatsthis.h>
#include <qaction.h>
#include <qmenubar.h>
#include <qpopupmenu.h>
#include <qtoolbar.h>
#include "mainpanel.ui.h"

/*
 *  Constructs a CMainPanel as a child of 'parent', with the
 *  name 'name' and widget flags set to 'f'.
 *
 */
CMainPanel::CMainPanel( QWidget* parent, const char* name, WFlags fl )
    : QMainWindow( parent, name, fl )
{
    (void)statusBar();
    if ( !name )
	setName( "Form_MainPanel" );
    setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)4, (QSizePolicy::SizeType)4, 0, 0, sizePolicy().hasHeightForWidth() ) );
    setMinimumSize( QSize( 21, 115 ) );
    setMaximumSize( QSize( 712, 550 ) );
    setBaseSize( QSize( 712, 550 ) );
    setDockWindowsMovable( TRUE );
    setCentralWidget( new QWidget( this, "qt_central_widget" ) );

    textLabel3 = new QLabel( centralWidget(), "textLabel3" );
    textLabel3->setGeometry( QRect( 3, 372, 149, 16 ) );

    listViewLastEv = new QListView( centralWidget(), "listViewLastEv" );
    listViewLastEv->addColumn( tr( "Time" ) );
    listViewLastEv->addColumn( tr( "Description" ) );
    listViewLastEv->addColumn( tr( "Type" ) );
    listViewLastEv->setGeometry( QRect( 0, 390, 710, 110 ) );
    QFont listViewLastEv_font(  listViewLastEv->font() );
    listViewLastEv_font.setPointSize( 9 );
    listViewLastEv->setFont( listViewLastEv_font ); 
    listViewLastEv->setVScrollBarMode( QListView::AlwaysOn );
    listViewLastEv->setAllColumnsShowFocus( TRUE );
    listViewLastEv->setResizeMode( QListView::AllColumns );

    tabWidget2 = new QTabWidget( centralWidget(), "tabWidget2" );
    tabWidget2->setGeometry( QRect( 0, 0, 710, 370 ) );
    tabWidget2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, 0, 0, tabWidget2->sizePolicy().hasHeightForWidth() ) );
    tabWidget2->setBackgroundOrigin( QTabWidget::ParentOrigin );
    tabWidget2->setMouseTracking( FALSE );
    tabWidget2->setTabShape( QTabWidget::Rounded );

    tab = new QWidget( tabWidget2, "tab" );

    textLabel1_2 = new QLabel( tab, "textLabel1_2" );
    textLabel1_2->setGeometry( QRect( 10, 180, 28, 16 ) );

    textLabel2_2 = new QLabel( tab, "textLabel2_2" );
    textLabel2_2->setGeometry( QRect( 10, 230, 69, 16 ) );

    textLabel1 = new QLabel( tab, "textLabel1" );
    textLabel1->setGeometry( QRect( 270, 10, 86, 16 ) );

    lineEdit5 = new QLineEdit( tab, "lineEdit5" );
    lineEdit5->setEnabled( TRUE );
    lineEdit5->setGeometry( QRect( 10, 250, 240, 23 ) );
    QFont lineEdit5_font(  lineEdit5->font() );
    lineEdit5_font.setBold( TRUE );
    lineEdit5->setFont( lineEdit5_font ); 
    lineEdit5->setReadOnly( TRUE );

    lineEdit4 = new QLineEdit( tab, "lineEdit4" );
    lineEdit4->setEnabled( TRUE );
    lineEdit4->setGeometry( QRect( 10, 200, 240, 23 ) );
    QFont lineEdit4_font(  lineEdit4->font() );
    lineEdit4_font.setBold( TRUE );
    lineEdit4->setFont( lineEdit4_font ); 
    lineEdit4->setReadOnly( TRUE );

    lineEdit3 = new QLineEdit( tab, "lineEdit3" );
    lineEdit3->setEnabled( TRUE );
    lineEdit3->setGeometry( QRect( 10, 130, 240, 23 ) );
    lineEdit3->setPaletteForegroundColor( QColor( 0, 85, 255 ) );
    QFont lineEdit3_font(  lineEdit3->font() );
    lineEdit3_font.setBold( TRUE );
    lineEdit3->setFont( lineEdit3_font ); 
    lineEdit3->setReadOnly( TRUE );

    textLabel4_2 = new QLabel( tab, "textLabel4_2" );
    textLabel4_2->setGeometry( QRect( 10, 110, 58, 20 ) );

    textLabel4 = new QLabel( tab, "textLabel4" );
    textLabel4->setGeometry( QRect( 10, 60, 74, 16 ) );

    textLabel2 = new QLabel( tab, "textLabel2" );
    textLabel2->setGeometry( QRect( 10, 10, 51, 16 ) );

    lineEdit1 = new QLineEdit( tab, "lineEdit1" );
    lineEdit1->setEnabled( TRUE );
    lineEdit1->setGeometry( QRect( 10, 30, 180, 23 ) );
    lineEdit1->setPaletteForegroundColor( QColor( 0, 85, 255 ) );
    QFont lineEdit1_font(  lineEdit1->font() );
    lineEdit1_font.setBold( TRUE );
    lineEdit1->setFont( lineEdit1_font ); 
    lineEdit1->setReadOnly( TRUE );

    lineEdit2 = new QLineEdit( tab, "lineEdit2" );
    lineEdit2->setEnabled( TRUE );
    lineEdit2->setGeometry( QRect( 10, 80, 240, 23 ) );
    lineEdit2->setPaletteForegroundColor( QColor( 0, 85, 255 ) );
    QFont lineEdit2_font(  lineEdit2->font() );
    lineEdit2_font.setBold( TRUE );
    lineEdit2->setFont( lineEdit2_font ); 
    lineEdit2->setReadOnly( TRUE );

    listView1 = new QListView( tab, "listView1" );
    listView1->addColumn( tr( "Parameter" ) );
    listView1->addColumn( tr( "Value" ) );
    listView1->addColumn( tr( "Desc" ) );
    listView1->setGeometry( QRect( 270, 30, 430, 300 ) );
    listView1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)2, (QSizePolicy::SizeType)2, 0, 0, listView1->sizePolicy().hasHeightForWidth() ) );
    listView1->setBackgroundOrigin( QListView::ParentOrigin );
    QFont listView1_font(  listView1->font() );
    listView1_font.setPointSize( 9 );
    listView1->setFont( listView1_font ); 
    listView1->setAllColumnsShowFocus( TRUE );
    listView1->setResizeMode( QListView::AllColumns );

    btnRefresh = new QPushButton( tab, "btnRefresh" );
    btnRefresh->setGeometry( QRect( 150, 300, 101, 25 ) );

    pixDevice = new QLabel( tab, "pixDevice" );
    pixDevice->setGeometry( QRect( 198, 8, 64, 64 ) );
    pixDevice->setFrameShape( QLabel::Box );
    pixDevice->setFrameShadow( QLabel::Sunken );
    pixDevice->setScaledContents( TRUE );
    tabWidget2->insertTab( tab, QString::fromLatin1("") );

    tab_2 = new QWidget( tabWidget2, "tab_2" );

    groupBox1 = new QGroupBox( tab_2, "groupBox1" );
    groupBox1->setGeometry( QRect( 220, 10, 470, 320 ) );

    textLabel2_3 = new QLabel( groupBox1, "textLabel2_3" );
    textLabel2_3->setGeometry( QRect( 10, 20, 172, 20 ) );

    textLabel3_2 = new QLabel( groupBox1, "textLabel3_2" );
    textLabel3_2->setGeometry( QRect( 10, 260, 113, 20 ) );

    btnSelectAllNetCln = new QPushButton( groupBox1, "btnSelectAllNetCln" );
    btnSelectAllNetCln->setGeometry( QRect( 370, 220, 90, 25 ) );

    btnSendToNetCln = new QPushButton( groupBox1, "btnSendToNetCln" );
    btnSendToNetCln->setGeometry( QRect( 371, 280, 90, 25 ) );

    editMessageToNetCln = new QLineEdit( groupBox1, "editMessageToNetCln" );
    editMessageToNetCln->setGeometry( QRect( 10, 280, 350, 23 ) );
    editMessageToNetCln->setMaxLength( 255 );
    editMessageToNetCln->setDragEnabled( TRUE );

    lbNetCln = new QListBox( groupBox1, "lbNetCln" );
    lbNetCln->setGeometry( QRect( 10, 40, 350, 210 ) );
    lbNetCln->setSelectionMode( QListBox::Multi );
    lbNetCln->setColumnMode( QListBox::FixedNumber );

    btnRefreshNetClnList = new QPushButton( groupBox1, "btnRefreshNetClnList" );
    btnRefreshNetClnList->setGeometry( QRect( 370, 40, 90, 25 ) );

    buttonGroup1 = new QButtonGroup( tab_2, "buttonGroup1" );
    buttonGroup1->setGeometry( QRect( 10, 10, 190, 120 ) );

    btnMonDisable = new QPushButton( buttonGroup1, "btnMonDisable" );
    btnMonDisable->setGeometry( QRect( 20, 80, 150, 25 ) );

    btnMonEnable = new QPushButton( buttonGroup1, "btnMonEnable" );
    btnMonEnable->setGeometry( QRect( 20, 40, 150, 25 ) );
    tabWidget2->insertTab( tab_2, QString::fromLatin1("") );

    // actions
    fileExitAction = new QAction( this, "fileExitAction" );
    helpAboutAction = new QAction( this, "helpAboutAction" );
    Action = new QAction( this, "Action" );


    // toolbars


    // menubar
    menubar = new QMenuBar( this, "menubar" );


    fileMenu = new QPopupMenu( this );
    fileExitAction->addTo( fileMenu );
    menubar->insertItem( QString(""), fileMenu, 1 );

    helpMenu = new QPopupMenu( this );
    helpMenu->insertSeparator();
    helpAboutAction->addTo( helpMenu );
    menubar->insertItem( QString(""), helpMenu, 2 );

    languageChange();
    resize( QSize(712, 549).expandedTo(minimumSizeHint()) );
    clearWState( WState_Polished );

    // signals and slots connections
    connect( fileExitAction, SIGNAL( activated() ), this, SLOT( close() ) );
    connect( helpAboutAction, SIGNAL( activated() ), this, SLOT( helpAbout() ) );
    connect( btnRefresh, SIGNAL( clicked() ), this, SLOT( dataRefresh() ) );
    connect( btnMonEnable, SIGNAL( clicked() ), this, SLOT( enableMonitoring() ) );
    connect( btnMonDisable, SIGNAL( clicked() ), this, SLOT( disableMonitoring() ) );
    connect( btnRefreshNetClnList, SIGNAL( clicked() ), this, SLOT( netClnListRefresh() ) );
    connect( btnSelectAllNetCln, SIGNAL( clicked() ), this, SLOT( netClnListSelectAll() ) );
    connect( btnSendToNetCln, SIGNAL( clicked() ), this, SLOT( netClnSend() ) );

    // tab order
    setTabOrder( lineEdit1, lineEdit2 );
    setTabOrder( lineEdit2, lineEdit3 );
    setTabOrder( lineEdit3, lineEdit4 );
    setTabOrder( lineEdit4, lineEdit5 );
    setTabOrder( lineEdit5, btnRefresh );
    setTabOrder( btnRefresh, listView1 );
    setTabOrder( listView1, listViewLastEv );
    setTabOrder( listViewLastEv, btnMonEnable );
    setTabOrder( btnMonEnable, btnMonDisable );
    setTabOrder( btnMonDisable, lbNetCln );
    setTabOrder( lbNetCln, btnRefreshNetClnList );
    setTabOrder( btnRefreshNetClnList, editMessageToNetCln );
    setTabOrder( editMessageToNetCln, btnSelectAllNetCln );
    setTabOrder( btnSelectAllNetCln, btnSendToNetCln );
    setTabOrder( btnSendToNetCln, tabWidget2 );
    init();
}

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

/*
 *  Sets the strings of the subwidgets using the current
 *  language.
 */
void CMainPanel::languageChange()
{
    setCaption( tr( "PowerSoft Plus - Control Panel" ) );
    textLabel3->setText( tr( "Last registered events list:" ) );
    listViewLastEv->header()->setLabel( 0, tr( "Time" ) );
    listViewLastEv->header()->setLabel( 1, tr( "Description" ) );
    listViewLastEv->header()->setLabel( 2, tr( "Type" ) );
    textLabel1_2->setText( tr( "User" ) );
    textLabel2_2->setText( tr( "Workstation" ) );
    textLabel1->setText( tr( "Parameters list" ) );
    textLabel4_2->setText( tr( "Attention!" ) );
    textLabel4->setText( tr( "Current state" ) );
    textLabel2->setText( tr( "Ups type" ) );
    listView1->header()->setLabel( 0, tr( "Parameter" ) );
    listView1->header()->setLabel( 1, tr( "Value" ) );
    listView1->header()->setLabel( 2, tr( "Desc" ) );
    btnRefresh->setText( tr( "Refresh now" ) );
    QToolTip::add( pixDevice, tr( "That's how your UPS should looks like." ) );
    tabWidget2->changeTab( tab, tr( "Information" ) );
    groupBox1->setTitle( tr( "Network clients" ) );
    textLabel2_3->setText( tr( "Configured network clients list" ) );
    textLabel3_2->setText( tr( "Enter message text:" ) );
    btnSelectAllNetCln->setText( tr( "S&elect all" ) );
    btnSelectAllNetCln->setAccel( QKeySequence( tr( "Alt+E" ) ) );
    btnSendToNetCln->setText( tr( "&Send" ) );
    btnSendToNetCln->setAccel( QKeySequence( tr( "Alt+S" ) ) );
    QToolTip::add( lbNetCln, tr( "List of currently configured network clients" ) );
    btnRefreshNetClnList->setText( tr( "&Refresh list" ) );
    btnRefreshNetClnList->setAccel( QKeySequence( tr( "Alt+R" ) ) );
    buttonGroup1->setTitle( tr( "Monitoring" ) );
    btnMonDisable->setText( tr( "Disable monitoring" ) );
    btnMonEnable->setText( tr( "Enable monitoring" ) );
    tabWidget2->changeTab( tab_2, tr( "Control" ) );
    fileExitAction->setText( tr( "Exit" ) );
    fileExitAction->setMenuText( tr( "E&xit" ) );
    fileExitAction->setAccel( QString::null );
    helpAboutAction->setText( tr( "About" ) );
    helpAboutAction->setMenuText( tr( "&About" ) );
    helpAboutAction->setAccel( QString::null );
    Action->setText( tr( "Action" ) );
    if (menubar->findItem(1))
        menubar->findItem(1)->setText( tr( "&File" ) );
    if (menubar->findItem(2))
        menubar->findItem(2)->setText( tr( "&Help" ) );
}

