/***************************************************************************
 *   Copyright (C) 2005 by yunfan                                          *
 *   yunfan_zg@163.com                                                     *
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 *   This program is distributed in the hope that it will be useful,       *
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
 *   GNU General Public License for more details.                          *
 *                                                                         *
 *   You should have received a copy of the GNU General Public License     *
 *   along with this program; if not, write to the                         *
 *   Free Software Foundation, Inc.,                                       *
 *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
 ***************************************************************************/

#include "evasearchuibase.h"

#include <qvariant.h>
#include <qpushbutton.h>
#include <qlabel.h>
#include <qwidgetstack.h>
#include <qbuttongroup.h>
#include <qradiobutton.h>
#include <qlineedit.h>
#include <qcheckbox.h>
#include <qtable.h>
#include <qgroupbox.h>
#include <qframe.h>
#include <qlayout.h>
#include <qtooltip.h>
#include <qwhatsthis.h>
#include <qimage.h>
#include <qpixmap.h>
#include <klocale.h>

EvaSearchUIBase::EvaSearchUIBase( QWidget* parent, const char* name, WFlags fl )
	: QWidget( parent, name, fl )
{
	if ( !name )
		setName( "EvaSearchUIBase" );
	EvaSearchUIBaseLayout = new QGridLayout( this, 1, 1, 0, 0, "EvaSearchUIBaseLayout"); 
	
	layout24 = new QVBoxLayout( 0, 3, 3, "layout24"); 
	
	layout21 = new QHBoxLayout( 0, 0, 0, "layout21"); 
	
	lblLogo = new QLabel( this, "lblLogo" );
	lblLogo->setMinimumSize( QSize( 100, 250 ) );
	lblLogo->setMaximumSize( QSize( 100, 250 ) );
	layout21->addWidget( lblLogo );
	
	wsMain = new QWidgetStack( this, "wsMain" );
	
	WStackPage = new QWidget( wsMain, "WStackPage" );
	WStackPageLayout = new QGridLayout( WStackPage, 1, 1, 0, 0, "WStackPageLayout"); 
	
	bgP0 = new QButtonGroup( WStackPage, "bgP0" );
	bgP0->setColumnLayout(0, Qt::Vertical );
	bgP0->layout()->setSpacing( 6 );
	bgP0->layout()->setMargin( 11 );
	bgP0Layout = new QGridLayout( bgP0->layout() );
	bgP0Layout->setAlignment( Qt::AlignTop );
	
	layout18 = new QVBoxLayout( 0, 0, 6, "layout18"); 
	
	rbP0Online = new QRadioButton( bgP0, "rbP0Online" );
	rbP0Online->setChecked( true );
	layout18->addWidget( rbP0Online );
	
	rbP0Customer = new QRadioButton( bgP0, "rbP0Customer" );
	layout18->addWidget( rbP0Customer );
	
	rbP0Qun = new QRadioButton( bgP0, "rbP0Qun" );
	rbP0Qun->setEnabled( true );
	layout18->addWidget( rbP0Qun );
	
	bgP0Layout->addLayout( layout18, 0, 0 );
	
	WStackPageLayout->addWidget( bgP0, 1, 0 );
	
	lblP0Tip = new QLabel( WStackPage, "lblP0Tip" );
	
	WStackPageLayout->addWidget( lblP0Tip, 0, 0 );
	
	layout19 = new QHBoxLayout( 0, 0, 6, "layout19"); 
	
	lblP0OnlineNumbers = new QLabel( WStackPage, "lblP0OnlineNumbers" );
	layout19->addWidget( lblP0OnlineNumbers );
	
	lblOnlineNum = new QLabel( WStackPage, "lblOnlineNum" );
	layout19->addWidget( lblOnlineNum );
	spacer7 = new QSpacerItem( 71, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
	layout19->addItem( spacer7 );
	
	WStackPageLayout->addLayout( layout19, 2, 0 );
	wsMain->addWidget( WStackPage, 0 );
	
	WStackPage_2 = new QWidget( wsMain, "WStackPage_2" );
	WStackPageLayout_2 = new QGridLayout( WStackPage_2, 1, 1, 11, 6, "WStackPageLayout_2"); 
	
	layout4 = new QVBoxLayout( 0, 0, 6, "layout4"); 
	
	lblP1Tip = new QLabel( WStackPage_2, "lblP1Tip" );
	layout4->addWidget( lblP1Tip );
	
	layout3 = new QHBoxLayout( 0, 0, 6, "layout3"); 
	
	layout1 = new QVBoxLayout( 0, 0, 6, "layout1"); 
	
	lblP1QQ = new QLabel( WStackPage_2, "lblP1QQ" );
	layout1->addWidget( lblP1QQ );
	
	leP1QQ = new QLineEdit( WStackPage_2, "leP1QQ" );
	layout1->addWidget( leP1QQ );
	
	lblP1Nick = new QLabel( WStackPage_2, "lblP1Nick" );
	layout1->addWidget( lblP1Nick );
	
	leP1Nick = new QLineEdit( WStackPage_2, "leP1Nick" );
	layout1->addWidget( leP1Nick );
	
	lblP1Email = new QLabel( WStackPage_2, "lblP1Email" );
	layout1->addWidget( lblP1Email );
	
	leP1Email = new QLineEdit( WStackPage_2, "leP1Email" );
	layout1->addWidget( leP1Email );
	layout3->addLayout( layout1 );
	
	layout2 = new QVBoxLayout( 0, 0, 6, "layout2"); 
	spacer1 = new QSpacerItem( 20, 121, QSizePolicy::Minimum, QSizePolicy::Expanding );
	layout2->addItem( spacer1 );
	
	cbP1Match = new QCheckBox( WStackPage_2, "cbP1Match" );
	layout2->addWidget( cbP1Match );
	layout3->addLayout( layout2 );
	layout4->addLayout( layout3 );
	spacer2 = new QSpacerItem( 20, 21, QSizePolicy::Minimum, QSizePolicy::Expanding );
	layout4->addItem( spacer2 );
	
	WStackPageLayout_2->addLayout( layout4, 0, 0 );
	wsMain->addWidget( WStackPage_2, 1 );
	
	WStackPage_3 = new QWidget( wsMain, "WStackPage_3" );
	WStackPageLayout_3 = new QGridLayout( WStackPage_3, 1, 1, 11, 6, "WStackPageLayout_3"); 
	
	layout7 = new QVBoxLayout( 0, 0, 6, "layout7"); 
	
	tblP2Users = new QTable( WStackPage_3, "tblP2Users" );
	tblP2Users->setNumCols( tblP2Users->numCols() + 1 );
	tblP2Users->horizontalHeader()->setLabel( tblP2Users->numCols() - 1, i18n( "QQ" ) );
	tblP2Users->setNumCols( tblP2Users->numCols() + 1 );
	tblP2Users->horizontalHeader()->setLabel( tblP2Users->numCols() - 1, i18n( "Nickname" ) );
	tblP2Users->setNumCols( tblP2Users->numCols() + 1 );
	tblP2Users->horizontalHeader()->setLabel( tblP2Users->numCols() - 1, i18n( "From" ) );
	tblP2Users->setNumRows( 0 );
	tblP2Users->setNumCols( 3 );
	tblP2Users->setSelectionMode(QTable::SingleRow);
	tblP2Users->setFocusStyle( QTable::FollowStyle );
	tblP2Users->setReadOnly(true);
	layout7->addWidget( tblP2Users );
	
	layout6 = new QHBoxLayout( 0, 0, 0, "layout6"); 
	spacer3 = new QSpacerItem( 21, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
	layout6->addItem( spacer3 );
	
	pbP2Prev = new QPushButton( WStackPage_3, "pbP2Prev" );
	//pbP2Prev->setMaximumSize( QSize( 50, 32767 ) );
	layout6->addWidget( pbP2Prev );
	
	pbP2Next = new QPushButton( WStackPage_3, "pbP2Next" );
	//pbP2Next->setMaximumSize( QSize( 50, 32767 ) );
	layout6->addWidget( pbP2Next );
	
	pbP2Details = new QPushButton( WStackPage_3, "pbP2Details" );
	//pbP2Details->setMaximumSize( QSize( 50, 32767 ) );
	layout6->addWidget( pbP2Details );
	
	pbP2All = new QPushButton( WStackPage_3, "pbP2All" );
	//pbP2All->setMaximumSize( QSize( 50, 32767 ) );
	layout6->addWidget( pbP2All );
	layout7->addLayout( layout6 );
	
	layout5 = new QHBoxLayout( 0, 0, 0, "layout5"); 
	
	lblP2Tip = new QLabel( WStackPage_3, "lblP2Tip" );
	layout5->addWidget( lblP2Tip );
	spacer4 = new QSpacerItem( 81, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
	layout5->addItem( spacer4 );
	layout7->addLayout( layout5 );
	
	WStackPageLayout_3->addLayout( layout7, 0, 0 );
	wsMain->addWidget( WStackPage_3, 2 );
	
	WStackPage_4 = new QWidget( wsMain, "WStackPage_4" );
	WStackPageLayout_4 = new QGridLayout( WStackPage_4, 1, 1, 11, 6, "WStackPageLayout_4"); 
	
	gbP3Tip = new QGroupBox( WStackPage_4, "gbP3Tip" );
	gbP3Tip->setMaximumSize( QSize( 32767, 80 ) );
	gbP3Tip->setColumnLayout(0, Qt::Vertical );
	gbP3Tip->layout()->setSpacing( 0 );
	gbP3Tip->layout()->setMargin( 0 );
	gbP3TipLayout = new QGridLayout( gbP3Tip->layout() );
	gbP3TipLayout->setAlignment( Qt::AlignTop );
	
	layout13 = new QVBoxLayout( 0, 0, 0, "layout13"); 
	
	layout12 = new QHBoxLayout( 0, 0, 0, "layout12"); 
	spacer5 = new QSpacerItem( 91, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
	layout12->addItem( spacer5 );
	
	lblP3Tip = new QLabel( gbP3Tip, "lblP3Tip" );
	lblP3Tip->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, lblP3Tip->sizePolicy().hasHeightForWidth() ) );
	lblP3Tip->setMinimumSize( QSize( 40, 40 ) );
	lblP3Tip->setMaximumSize( QSize( 40, 40 ) );
	lblP3Tip->setScaledContents( TRUE );
	lblP3Tip->setAlignment( int( QLabel::AlignCenter ) );
	layout12->addWidget( lblP3Tip );
	spacer6 = new QSpacerItem( 111, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
	layout12->addItem( spacer6 );
	layout13->addLayout( layout12 );
	
	lblP3NickTip = new QLabel( gbP3Tip, "lblP3NickTip" );
	lblP3NickTip->setAlignment( int( QLabel::AlignCenter ) );
	layout13->addWidget( lblP3NickTip );
	
	gbP3TipLayout->addLayout( layout13, 0, 0 );
	
	WStackPageLayout_4->addWidget( gbP3Tip, 0, 0 );
	
	wsP3Add = new QWidgetStack( WStackPage_4, "wsP3Add" );
	
	WStackPage_5 = new QWidget( wsP3Add, "WStackPage_5" );
	WStackPageLayout_5 = new QGridLayout( WStackPage_5, 1, 1, 0, 0, "WStackPageLayout_5"); 
	
	gbP3P0Verify = new QGroupBox( WStackPage_5, "gbP3P0Verify" );
	gbP3P0Verify->setColumnLayout(0, Qt::Vertical );
	gbP3P0Verify->layout()->setSpacing( 6 );
	gbP3P0Verify->layout()->setMargin( 11 );
	gbP3P0VerifyLayout = new QGridLayout( gbP3P0Verify->layout() );
	gbP3P0VerifyLayout->setAlignment( Qt::AlignTop );
	
	layout17 = new QVBoxLayout( 0, 0, 6, "layout17"); 
	
	lblP3P0Tip = new QLabel( gbP3P0Verify, "lblP3P0Tip" );
	lblP3P0Tip->setAlignment( int( QLabel::WordBreak | QLabel::AlignVCenter ) );
	layout17->addWidget( lblP3P0Tip );
	
	layout16 = new QHBoxLayout( 0, 0, 6, "layout16"); 
	
	leP3P0Msg = new QLineEdit( gbP3P0Verify, "leP3P0Msg" );
	layout16->addWidget( leP3P0Msg );
	
	pbP3P0Send = new QPushButton( gbP3P0Verify, "pbP3P0Send" );
	layout16->addWidget( pbP3P0Send );
	layout17->addLayout( layout16 );
	
	gbP3P0VerifyLayout->addLayout( layout17, 0, 0 );
	
	WStackPageLayout_5->addWidget( gbP3P0Verify, 0, 0 );
	wsP3Add->addWidget( WStackPage_5, 0 );
	
	WStackPage_6 = new QWidget( wsP3Add, "WStackPage_6" );
	WStackPageLayout_6 = new QGridLayout( WStackPage_6, 1, 1, 0, 0, "WStackPageLayout_6"); 
	
	gbP3P1Tip = new QGroupBox( WStackPage_6, "gbP3P1Tip" );
	gbP3P1Tip->setColumnLayout(0, Qt::Vertical );
	gbP3P1Tip->layout()->setSpacing( 3 );
	gbP3P1Tip->layout()->setMargin( 3 );
	gbP3P1TipLayout = new QGridLayout( gbP3P1Tip->layout() );
	gbP3P1TipLayout->setAlignment( Qt::AlignTop );
	
	lblP3P1Tip = new QLabel( gbP3P1Tip, "lblP3P1Tip" );
	lblP3P1Tip->setAlignment( int( QLabel::WordBreak | QLabel::AlignVCenter ) );
	
	gbP3P1TipLayout->addWidget( lblP3P1Tip, 0, 0 );
	
	WStackPageLayout_6->addWidget( gbP3P1Tip, 0, 0 );
	wsP3Add->addWidget( WStackPage_6, 1 );
	
	WStackPageLayout_4->addWidget( wsP3Add, 1, 0 );
	wsMain->addWidget( WStackPage_4, 3 );
	
	WStackPage_Qun = new QWidget( wsMain, "WStackPage_Qun" );
	WStackPage_QunLayout = new QGridLayout( WStackPage_Qun, 1, 1, 11, 6, "WStackPage_QunLayout"); 
	
	layout19_2 = new QVBoxLayout( 0, 0, 6, "layout19_2"); 
	
	lblQunTip = new QLabel( WStackPage_Qun, "lblQunTip" );
	layout19_2->addWidget( lblQunTip );
	
	line2 = new QFrame( WStackPage_Qun, "line2" );
	line2->setFrameShape( QFrame::HLine );
	line2->setFrameShadow( QFrame::Sunken );
	line2->setFrameShape( QFrame::HLine );
	layout19_2->addWidget( line2 );
	
	lblQunNumber = new QLabel( WStackPage_Qun, "lblQunNumber" );
	layout19_2->addWidget( lblQunNumber );
	
	layout18_2 = new QHBoxLayout( 0, 0, 6, "layout18_2"); 
	
	leQunExtID = new QLineEdit( WStackPage_Qun, "leQunExtID" );
	layout18_2->addWidget( leQunExtID );
	spacer10 = new QSpacerItem( 51, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
	layout18_2->addItem( spacer10 );
	layout19_2->addLayout( layout18_2 );
	spacer9 = new QSpacerItem( 20, 150, QSizePolicy::Minimum, QSizePolicy::Expanding );
	layout19_2->addItem( spacer9 );
	
	WStackPage_QunLayout->addLayout( layout19_2, 0, 0 );
	wsMain->addWidget( WStackPage_Qun, 4 );
	layout21->addWidget( wsMain );
	layout24->addLayout( layout21 );
	
	line1 = new QFrame( this, "line1" );
	line1->setMaximumSize( QSize( 32767, 10 ) );
	line1->setFrameShape( QFrame::HLine );
	line1->setFrameShadow( QFrame::Sunken );
	line1->setFrameShape( QFrame::HLine );
	layout24->addWidget( line1 );
	
	layout22 = new QHBoxLayout( 0, 0, 0, "layout22"); 
	spacer8 = new QSpacerItem( 51, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
	layout22->addItem( spacer8 );
	
	pbPrev = new QPushButton( this, "pbPrev" );
	layout22->addWidget( pbPrev );
	
	pbNext = new QPushButton( this, "pbNext" );
	layout22->addWidget( pbNext );
	
	pbCancel = new QPushButton( this, "pbCancel" );
	layout22->addWidget( pbCancel );
	layout24->addLayout( layout22 );
	
	EvaSearchUIBaseLayout->addLayout( layout24, 0, 0 );
	languageChange();
	resize( QSize(450, 294).expandedTo(minimumSizeHint()) );
	clearWState( WState_Polished );
}

EvaSearchUIBase::~EvaSearchUIBase()
{
	// no need to delete child widgets, Qt does it all for us
}

void EvaSearchUIBase::languageChange()
{
	setCaption( i18n( "Search - Eva" ) );
	lblLogo->setText( i18n( "Logo" ) );
	bgP0->setTitle( i18n( "Options:" ) );
	rbP0Online->setText( i18n( "search online users" ) );
	rbP0Customer->setText( i18n( "customized search" ) );
	rbP0Qun->setText( i18n( "search Qun" ) );
	lblP0Tip->setText( i18n( "Please select one of the following options:" ) );
	lblP0OnlineNumbers->setText( i18n( "Number of online users:" ) );
	lblOnlineNum->setText( "0" );
	lblP1Tip->setText( i18n( "Tip: conditions can be combined" ) );
	lblP1QQ->setText( i18n( "search by QQ number:" ) );
	lblP1Nick->setText( i18n( "search by nickname:" ) );
	lblP1Email->setText( i18n( "search by email:" ) );
	cbP1Match->setText( i18n( "full match" ) );
	tblP2Users->horizontalHeader()->setLabel( 0, i18n( "QQ" ) );
	tblP2Users->horizontalHeader()->setLabel( 1, i18n( "Nickname" ) );
	tblP2Users->horizontalHeader()->setLabel( 2, i18n( "From" ) );
	pbP2Prev->setText( i18n( "P&rev" ) );
	pbP2Prev->setAccel( QKeySequence( "Alt+R"  ) );
	pbP2Next->setText( i18n( "N&ext" ) );
	pbP2Next->setAccel( QKeySequence( "Alt+E"  ) );
	pbP2Details->setText( i18n( "De&tails" ) );
	pbP2Details->setAccel( QKeySequence( "Alt+T"  ) );
	pbP2All->setText( i18n( "A&ll" ) );
	pbP2All->setAccel( QKeySequence( "Alt+L"  ) );
	lblP2Tip->setText( i18n( "searching ..." ) );
	gbP3Tip->setTitle( i18n( "Add" ) );
	lblP3Tip->setText( i18n( "Face" ) );
	lblP3NickTip->setText( "12345678" );
	gbP3P0Verify->setTitle( i18n( "Authorization" ) );
	lblP3P0Tip->setText( i18n( "Authorization is needed, you can input some comments, then click Send" ) );
	pbP3P0Send->setText( i18n( "&Send" ) );
	pbP3P0Send->setAccel( QKeySequence( "Alt+S"  ) );
	gbP3P1Tip->setTitle( i18n( "Buddy added" ) );
	lblP3P1Tip->setText( i18n( "The user you selected has been added into your \"Buddy\", click \"Prev\" to add more, or click \"Finish\" to close this dialog." ) );
	lblQunTip->setText( i18n( "Search Qun" ) );
	lblQunNumber->setText( i18n( "Input Qun Number:" ) );
	pbPrev->setText( i18n( "&Prev" ) );
	pbPrev->setAccel( QKeySequence( "Alt+P"  ) );
	pbNext->setText( i18n( "&Next" ) );
	pbNext->setAccel( QKeySequence( "Alt+N"  ) );
	pbCancel->setText( i18n( "&Cancel" ) );
	pbCancel->setAccel( QKeySequence( "Alt+C"  ) );
}

