/***************************************************************************
 *   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 "evasyssettinguibase.h"

#include <qvariant.h>
#include <qpushbutton.h>
#include <qlabel.h>
#include <qtabwidget.h>
#include <qcheckbox.h>
#include <qframe.h>
#include <qspinbox.h>
#include <qslider.h>
#include <qlineedit.h>
#include <qgroupbox.h>
#include <qcombobox.h>
#include <qtextedit.h>
#include <qlayout.h>
#include <qtooltip.h>
#include <qwhatsthis.h>
#include <kkeybutton.h>
#include <klocale.h>

EvaSysSettingUIBase::EvaSysSettingUIBase( QWidget* parent, const char* name, WFlags fl )
	: QWidget( parent, name, fl )
{
	if ( !name )
		setName( "EvaSysSettingUIBase" );
	EvaSysSettingUIBaseLayout = new QVBoxLayout( this, 0, 6, "EvaSysSettingUIBaseLayout"); 
	
	layout25 = new QHBoxLayout( 0, 0, 0, "layout25"); 
	
	lblLogo = new QLabel( this, "lblLogo" );
	lblLogo->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, lblLogo->sizePolicy().hasHeightForWidth() ) );
	lblLogo->setMinimumSize( QSize( 100, 280 ) );
	lblLogo->setMaximumSize( QSize( 100, 280 ) );
	layout25->addWidget( lblLogo );
	
	tw = new QTabWidget( this, "tw" );
	tw->setTabShape( QTabWidget::Triangular );
	
	tab = new QWidget( tw, "tab" );
	tabLayout = new QGridLayout( tab, 1, 1, 20, 6, "tabLayout"); 
	
	layout6 = new QVBoxLayout( 0, 0, 15, "layout6"); 
	
	layout3 = new QHBoxLayout( 0, 0, 6, "layout3"); 
	
	layout1 = new QVBoxLayout( 0, 0, 6, "layout1"); 
	
	chbOnline = new QCheckBox( tab, "chbOnline" );
	layout1->addWidget( chbOnline );
	chbMessage = new QCheckBox( tab, "chbMessage" );
	layout1->addWidget( chbMessage );
	chbShowOnlineUsers = new QCheckBox( tab, "chbShowOnlineUsers");
	layout1->addWidget(chbShowOnlineUsers);
	layout3->addLayout( layout1 );
	
	layout2 = new QVBoxLayout( 0, 0, 6, "layout2"); 
	
	chbSystemBroadcast = new QCheckBox( tab, "chbSystemBroadcast" );
	layout2->addWidget( chbSystemBroadcast );
	chbSound = new QCheckBox( tab, "chbSound" );
	layout2->addWidget( chbSound );
	chbSendKey = new QCheckBox( tab, "chbSendKey");
	layout2->addWidget(chbSendKey);
	
	layout3->addLayout( layout2 );
	layout6->addLayout( layout3 );
	
	line1 = new QFrame( tab, "line1" );
	line1->setFrameShape( QFrame::HLine );
	line1->setFrameShadow( QFrame::Sunken );
	line1->setFrameShape( QFrame::HLine );
	layout6->addWidget( line1 );
	
	layout4 = new QHBoxLayout( 0, 0, 6, "layout4"); 
	
	lblPageSize = new QLabel( tab, "lblPageSize" );
	layout4->addWidget( lblPageSize );
	
	sbPageSize = new QSpinBox( tab, "sbPageSize" );
	sbPageSize->setMaxValue( 50 );
	sbPageSize->setMinValue( 5 );
	sbPageSize->setValue( 25 );
	layout4->addWidget( sbPageSize );
	
	lblPageSizeEnd = new QLabel( tab, "lblPageSizeEnd" );
	layout4->addWidget( lblPageSizeEnd );
	layout6->addLayout( layout4 );
	
	layout5 = new QHBoxLayout( 0, 0, 6, "layout5"); 
	
	lblFaceSize = new QLabel( tab, "lblFaceSize" );
	layout5->addWidget( lblFaceSize );
	
	lblFaceSmall = new QLabel( tab, "lblFaceSmall" );
	layout5->addWidget( lblFaceSmall );
	
	sliderFaceSize = new QSlider( tab, "sliderFaceSize" );
	sliderFaceSize->setMinValue( 10 );
	sliderFaceSize->setMaxValue( 40 );
	sliderFaceSize->setPageStep( 5 );
	sliderFaceSize->setValue( 16 );
	sliderFaceSize->setOrientation( QSlider::Horizontal );
	sliderFaceSize->setTickmarks( QSlider::NoMarks );
	layout5->addWidget( sliderFaceSize );
	
	lblFaceBig = new QLabel( tab, "lblFaceBig" );
	layout5->addWidget( lblFaceBig );
	layout6->addLayout( layout5 );
	
	layout27 = new QHBoxLayout( 0, 0, 6, "layout27");
	
	lblShortKey = new QLabel(tab, "lblShortKey");
	layout27->addWidget(lblShortKey);
	
	kkbtnShortKey = new KKeyButton(tab, "kkbtnShortKey");
	layout27->addWidget(kkbtnShortKey);
	
	spacer9 = new QSpacerItem( 40, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
	layout27->addItem(spacer9);
	layout6->addLayout(layout27);
	
	tabLayout->addLayout( layout6, 0, 0 );
	spacer1 = new QSpacerItem( 20, 21, QSizePolicy::Minimum, QSizePolicy::Expanding );
	tabLayout->addItem( spacer1, 1, 0 );
	tw->insertTab( tab, QString("") );
	
	tab_2 = new QWidget( tw, "tab_2" );
	tabLayout_2 = new QVBoxLayout( tab_2, 15, 15, "tabLayout_2"); 
	
	layout10 = new QVBoxLayout( 0, 0, 6, "layout10"); 
	
	lblThemePath = new QLabel( tab_2, "lblThemePath" );
	layout10->addWidget( lblThemePath );
	
	layout7 = new QHBoxLayout( 0, 0, 6, "layout7"); 
	
	leThemePath = new QLineEdit( tab_2, "leThemePath" );
	layout7->addWidget( leThemePath );
	
	pbTheme = new QPushButton( tab_2, "pbTheme" );
	layout7->addWidget( pbTheme );
	layout10->addLayout( layout7 );
	tabLayout_2->addLayout( layout10 );
	
	layout11 = new QVBoxLayout( 0, 0, 6, "layout11"); 
	
	lblSoundPath = new QLabel( tab_2, "lblSoundPath" );
	layout11->addWidget( lblSoundPath );
	
	layout8 = new QHBoxLayout( 0, 0, 6, "layout8"); 
	
	leSoundPath = new QLineEdit( tab_2, "leSoundPath" );
	layout8->addWidget( leSoundPath );
	
	pbSound = new QPushButton( tab_2, "pbSound" );
	layout8->addWidget( pbSound );
	layout11->addLayout( layout8 );
	tabLayout_2->addLayout( layout11 );
	spacer2 = new QSpacerItem( 20, 31, QSizePolicy::Minimum, QSizePolicy::Expanding );
	tabLayout_2->addItem( spacer2 );
	tw->insertTab( tab_2, QString("") );
	
	TabPage = new QWidget( tw, "TabPage" );
	TabPageLayout = new QVBoxLayout( TabPage, 11, 6, "TabPageLayout"); 
	
	gbAutoReply = new QGroupBox( TabPage, "gbAutoReply" );
	gbAutoReply->setColumnLayout(0, Qt::Vertical );
	gbAutoReply->layout()->setSpacing( 6 );
	gbAutoReply->layout()->setMargin( 11 );
	gbAutoReplyLayout = new QVBoxLayout( gbAutoReply->layout() );
	gbAutoReplyLayout->setAlignment( Qt::AlignTop );
	
	layout13 = new QHBoxLayout( 0, 0, 6, "layout13"); 
	
	cbbAutoNo = new QComboBox( FALSE, gbAutoReply, "cbbAutoNo" );
	cbbAutoNo->setMaximumSize( QSize( 50, 32767 ) );
	cbbAutoNo->setDuplicatesEnabled( FALSE );
	layout13->addWidget( cbbAutoNo );
	
	chbAutoReply = new QCheckBox( gbAutoReply, "chbAutoReply" );
	layout13->addWidget( chbAutoReply );
	gbAutoReplyLayout->addLayout( layout13 );
	
	layout23 = new QHBoxLayout( 0, 0, 6, "layout23"); 
	
	teAutoMessage = new QTextEdit( gbAutoReply, "teAutoMessage" );
	layout23->addWidget( teAutoMessage );
	
	layout22 = new QVBoxLayout( 0, 0, 6, "layout22"); 
	
	pbAutoNew = new QPushButton( gbAutoReply, "pbAutoNew" );
	layout22->addWidget( pbAutoNew );
	
	pbAutoDelete = new QPushButton( gbAutoReply, "pbAutoDelete" );
	layout22->addWidget( pbAutoDelete );
	layout23->addLayout( layout22 );
	gbAutoReplyLayout->addLayout( layout23 );
	TabPageLayout->addWidget( gbAutoReply );
	
	gbQuickReply = new QGroupBox( TabPage, "gbQuickReply" );
	gbQuickReply->setColumnLayout(0, Qt::Vertical );
	gbQuickReply->layout()->setSpacing( 6 );
	gbQuickReply->layout()->setMargin( 11 );
	gbQuickReplyLayout = new QVBoxLayout( gbQuickReply->layout() );
	gbQuickReplyLayout->setAlignment( Qt::AlignTop );
	
	layout18 = new QHBoxLayout( 0, 0, 6, "layout18"); 
	
	cbbQuickNo = new QComboBox( FALSE, gbQuickReply, "cbbQuickNo" );
	cbbQuickNo->setDuplicatesEnabled( FALSE );
	layout18->addWidget( cbbQuickNo );
	spacer3 = new QSpacerItem( 201, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
	layout18->addItem( spacer3 );
	gbQuickReplyLayout->addLayout( layout18 );
	
	layout21 = new QHBoxLayout( 0, 0, 6, "layout21"); 
	
	teQuickMessage = new QTextEdit( gbQuickReply, "teQuickMessage" );
	teQuickMessage->setMaximumSize( QSize( 32767, 32767 ) );
	layout21->addWidget( teQuickMessage );
	
	layout20 = new QVBoxLayout( 0, 0, 6, "layout20"); 
	
	pbQuickNew = new QPushButton( gbQuickReply, "pbQuickNew" );
	layout20->addWidget( pbQuickNew );
	
	pbQuickDelete = new QPushButton( gbQuickReply, "pbQuickDelete" );
	layout20->addWidget( pbQuickDelete );
	layout21->addLayout( layout20 );
	gbQuickReplyLayout->addLayout( layout21 );
	TabPageLayout->addWidget( gbQuickReply );
	tw->insertTab( TabPage, QString("") );
	layout25->addWidget( tw );
	EvaSysSettingUIBaseLayout->addLayout( layout25 );
	
	layout26 = new QHBoxLayout( 0, 9, 6, "layout26"); 
	spacer7 = new QSpacerItem( 40, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
	layout26->addItem( spacer7 );
	
	pbFaceDefault = new QPushButton( this, "pbFaceDefault" );
	layout26->addWidget( pbFaceDefault );
	
	pbSave = new QPushButton( this, "pbSave" );
	layout26->addWidget( pbSave );
	spacer6 = new QSpacerItem( 100, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
	layout26->addItem( spacer6 );
	
	pbClose = new QPushButton( this, "pbClose" );
	layout26->addWidget( pbClose );
	spacer8 = new QSpacerItem( 15, 20, QSizePolicy::Maximum, QSizePolicy::Minimum );
	layout26->addItem( spacer8 );
	EvaSysSettingUIBaseLayout->addLayout( layout26 );
	languageChange();
	resize( QSize(498, 343).expandedTo(minimumSizeHint()) );
	clearWState( WState_Polished );
}

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

void EvaSysSettingUIBase::languageChange()
{
	setCaption( i18n("Eva System Setting" ) );
	lblLogo->setText( i18n("Logo" ) );
	chbOnline->setText( i18n("display buddy online tip" ) );
	chbMessage->setText( i18n("display message tip" ) );
	chbShowOnlineUsers->setText( i18n("display online users only" ) );
	chbSystemBroadcast->setText( i18n("display system ad. tip" ) );
	chbSound->setText( i18n("sound enabled" ) );
	chbSendKey->setText( i18n("change send key to \"Enter\"" ) );
	lblPageSize->setText( i18n("message page size:" ) );
	lblPageSizeEnd->setText( i18n("pieces" ) );
	lblFaceSize->setText( i18n("face size:" ) );
	lblFaceSmall->setText( i18n("small" ) );
	lblFaceBig->setText( i18n("large" ) );
	lblShortKey->setText( i18n("Shortcut Key for reading messages:") );
	tw->changeTab( tab, i18n("general" ) );
	lblThemePath->setText( i18n("theme path:" ) );
	pbTheme->setText( i18n("Browse" ) );
	pbTheme->setAccel( QKeySequence( QString::null ) );
	lblSoundPath->setText( i18n("sound path:" ) );
	pbSound->setText( i18n("Browse" ) );
	pbSound->setAccel( QKeySequence( QString::null ) );
	tw->changeTab( tab_2, i18n("resource" ) );
	gbAutoReply->setTitle( i18n("Auto-Reply (within 50 words):" ) );
	chbAutoReply->setText( i18n("reply automatically when leave" ) );
	pbAutoNew->setText( i18n("New" ) );
	pbAutoDelete->setText( i18n("Delete" ) );
	gbQuickReply->setTitle( i18n("Quick Reply (within 50 words):" ) );
	pbQuickNew->setText( i18n("New" ) );
	pbQuickDelete->setText( i18n("Delete" ) );
	tw->changeTab( TabPage, i18n("reply messages" ) );
	pbFaceDefault->setText( i18n("&Default" ) );
	pbFaceDefault->setAccel( QKeySequence( i18n("Alt+D" ) ) );
	pbSave->setText( i18n("&Save" ) );
	pbSave->setAccel( QKeySequence( i18n("Alt+S" ) ) );
	pbClose->setText( i18n("&Close" ) );
	pbClose->setAccel( QKeySequence( i18n("Alt+C" ) ) );
}

