/****************************************************************************
** Form implementation generated from reading ui file 'lookandfeelconfig.ui'
**
** Created: Sat Nov 25 14:32:04 2000
**      by:  The User Interface Compiler (uic)
**
** WARNING! All changes made in this file will be lost!
****************************************************************************/
#include "lookandfeelconfig.h"

#include <kcolorbutton.h>
#include <klocale.h>
#include <qframe.h>
#include <qgroupbox.h>
#include <qlabel.h>
#include <qpushbutton.h>
#include <qlayout.h>
#include <qvariant.h>
#include <qtooltip.h>
#include <qwhatsthis.h>
/* 
 *  Constructs a LookAndFeel which is a child of 'parent', with the 
 *  name 'name' and widget flags set to 'f' 
 */
LookAndFeel::LookAndFeel( QWidget* parent,  const char* name, WFlags fl )
    : QWidget( parent, name, fl )
{
    if ( !name )
	setName( "LookAndFeel" );
    resize( 421, 301 ); 
    setCaption( i18n( "Look & Feel"  ) );
    LookAndFeelLayout = new QVBoxLayout( this ); 
    LookAndFeelLayout->setSpacing( 0 );
    LookAndFeelLayout->setMargin( 0 );

    mFontBox = new QGroupBox( this, "mFontBox" );
    mFontBox->setTitle( i18n( "Fonts"  ) );
    mFontBox->setColumnLayout(0, Qt::Vertical );
    mFontBox->layout()->setSpacing( 0 );
    mFontBox->layout()->setMargin( 0 );
    mFontBoxLayout = new QVBoxLayout( mFontBox->layout() );
    mFontBoxLayout->setAlignment( Qt::AlignTop );
    mFontBoxLayout->setSpacing( 6 );
    mFontBoxLayout->setMargin( 11 );

    mTopLayout = new QGridLayout; 
    mTopLayout->setSpacing( 6 );
    mTopLayout->setMargin( 0 );

    mChooseNumberFont = new QPushButton( mFontBox, "mChooseNumberFont" );
    mChooseNumberFont->setText( i18n( "C&hoose..."  ) );

    mTopLayout->addWidget( mChooseNumberFont, 1, 2 );

    mServiceFontPreview = new QLabel( mFontBox, "mServiceFontPreview" );
    mServiceFontPreview->setText( i18n( "dummy-font"  ) );
    mServiceFontPreview->setFrameShape( QLabel::StyledPanel );
    mServiceFontPreview->setFrameShadow( QLabel::Sunken );
    mServiceFontPreview->setMinimumSize( QSize( 200, 0 ) );
    mServiceFontPreview->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)1, mServiceFontPreview->sizePolicy().hasHeightForWidth() ) );

    mTopLayout->addWidget( mServiceFontPreview, 0, 1 );

    mNumberFontPreview = new QLabel( mFontBox, "mNumberFontPreview" );
    mNumberFontPreview->setText( i18n( "dummy-font"  ) );
    mNumberFontPreview->setFrameShape( QLabel::StyledPanel );
    mNumberFontPreview->setFrameShadow( QLabel::Sunken );
    mNumberFontPreview->setMinimumSize( QSize( 200, 0 ) );
    mNumberFontPreview->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)1, mNumberFontPreview->sizePolicy().hasHeightForWidth() ) );

    mTopLayout->addWidget( mNumberFontPreview, 1, 1 );

    mServiceFontLabel = new QLabel( mFontBox, "mServiceFontLabel" );
    mServiceFontLabel->setText( i18n( "Services:"  ) );
    mServiceFontLabel->setAlignment( int( QLabel::AlignVCenter | QLabel::AlignRight ) );

    mTopLayout->addWidget( mServiceFontLabel, 0, 0 );

    mNumberFontLabel = new QLabel( mFontBox, "mNumberFontLabel" );
    mNumberFontLabel->setText( i18n( "Sorting numbers:"  ) );
    mNumberFontLabel->setAlignment( int( QLabel::AlignVCenter | QLabel::AlignRight ) );

    mTopLayout->addWidget( mNumberFontLabel, 1, 0 );

    mChooseServiceFont = new QPushButton( mFontBox, "mChooseServiceFont" );
    mChooseServiceFont->setText( i18n( "&Choose..."  ) );

    mTopLayout->addWidget( mChooseServiceFont, 0, 2 );
    mFontBoxLayout->addLayout( mTopLayout );
    LookAndFeelLayout->addWidget( mFontBox );

    mSpacer = new QFrame( this, "mSpacer" );
    mSpacer->setFrameShadow( QFrame::Plain );
    mSpacer->setFrameShape( QFrame::NoFrame );
    mSpacer->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, mSpacer->sizePolicy().hasHeightForWidth() ) );
    mSpacer->setMinimumSize( QSize( 0, 10 ) );
    LookAndFeelLayout->addWidget( mSpacer );

    mColorBox = new QGroupBox( this, "mColorBox" );
    mColorBox->setTitle( i18n( "Colors"  ) );
    mColorBox->setColumnLayout(0, Qt::Vertical );
    mColorBox->layout()->setSpacing( 0 );
    mColorBox->layout()->setMargin( 0 );
    mColorBoxLayout = new QVBoxLayout( mColorBox->layout() );
    mColorBoxLayout->setAlignment( Qt::AlignTop );
    mColorBoxLayout->setSpacing( 6 );
    mColorBoxLayout->setMargin( 11 );

    mColorGrid = new QGridLayout;
    mColorGrid->setSpacing( 6 );
    mColorGrid->setMargin( 0 );

    mChangedNormal = new KColorButton( mColorBox, "mChangedNormal" );
    mChangedNormal->setText( i18n( "Dummy"  ) );
    mChangedNormal->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, mChangedNormal->sizePolicy().hasHeightForWidth() ) );
    mChangedNormal->setFocusPolicy( KColorButton::StrongFocus );
    mChangedNormal->setMinimumSize( QSize( 80, 0 ) );
    QToolTip::add(  mChangedNormal, i18n( "Choose a color for changed services" ) );
    QWhatsThis::add(  mChangedNormal, i18n( "<p>Use the <strong>Select Color dialog box</strong> to pick a text color for <em>services that have been changed</em> (either order/sorting number or name).</p>\n<p>Changed service entries will be distinguished by this color.</p>" ) );

    mColorGrid->addWidget( mChangedNormal, 2, 1 );

    mChangedNormalLabel = new QLabel( mColorBox, "mChangedNormalLabel" );
    mChangedNormalLabel->setText( i18n( "&Changed:"  ) );
    mChangedNormalLabel->setAlignment( int( QLabel::AlignVCenter | QLabel::AlignRight ) );

    mColorGrid->addWidget( mChangedNormalLabel, 2, 0 );

    mNewNormal = new KColorButton( mColorBox, "mNewNormal" );
    mNewNormal->setText( i18n( "Dummy"  ) );
    mNewNormal->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, mNewNormal->sizePolicy().hasHeightForWidth() ) );
    mNewNormal->setFocusPolicy( KColorButton::StrongFocus );
    mNewNormal->setMinimumSize( QSize( 80, 0 ) );
    QToolTip::add(  mNewNormal, i18n( "Choose a color for service new to a runlevel" ) );
    QWhatsThis::add(  mNewNormal, i18n( "<p>Use the <strong>Select Color dialog box</strong> to pick a text color for <em>services new to a runlevel</em>.</p>\n<p>New service entries will be distinguished by this color.</p>" ) );

    mColorGrid->addWidget( mNewNormal, 0, 1 );

    mNewNormalLabel = new QLabel( mColorBox, "mNewNormalLabel" );
    mNewNormalLabel->setText( i18n( "&New:"  ) );
    mNewNormalLabel->setAlignment( int( QLabel::AlignVCenter | QLabel::AlignRight ) );

    mColorGrid->addWidget( mNewNormalLabel, 0, 0 );

    mChangedSelected = new KColorButton( mColorBox, "mChangedSelected" );
    mChangedSelected->setText( i18n( "Dummy"  ) );
    mChangedSelected->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, mChangedSelected->sizePolicy().hasHeightForWidth() ) );
    mChangedSelected->setFocusPolicy( KColorButton::StrongFocus );
    mChangedSelected->setMinimumSize( QSize( 80, 0 ) );
    QToolTip::add(  mChangedSelected, i18n( "Choose a color for changed services that are selected" ) );
    QWhatsThis::add(  mChangedSelected, i18n( "<p>Use the <strong>Select Color dialog box</strong> to pick a selected text color for <em>services that have been changed</em> (either order/sorting number or name).</p>\n<p>Changed service entries will be distinguished by this color while they are selected.</p>" ) );

    mColorGrid->addWidget( mChangedSelected, 3, 1 );

    mNewSelected = new KColorButton( mColorBox, "mNewSelected" );
    mNewSelected->setText( i18n( "Dummy"  ) );
    mNewSelected->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, mNewSelected->sizePolicy().hasHeightForWidth() ) );
    mNewSelected->setFocusPolicy( KColorButton::StrongFocus );
    mNewSelected->setMinimumSize( QSize( 80, 0 ) );
    QToolTip::add(  mNewSelected, i18n( "Choose a color for services new to a runlevel that are selected" ) );
    QWhatsThis::add(  mNewSelected, i18n( "<p>Use the <strong>Select Color dialog box</strong> to pick a selected text color for <em>services new to a runlevel</em>.</p>\n<p>New service entries will be distinguished by this color while they are selected.</p>" ) );

    mColorGrid->addWidget( mNewSelected, 1, 1 );

    mNewSelectedLabel = new QLabel( mColorBox, "mNewSelectedLabel" );
    mNewSelectedLabel->setText( i18n( "New + &selected:"  ) );
    mNewSelectedLabel->setAlignment( int( QLabel::AlignVCenter | QLabel::AlignRight ) );

    mColorGrid->addWidget( mNewSelectedLabel, 1, 0 );

    mChangedSelectedLabel = new QLabel( mColorBox, "mChangedSelectedLabel" );
    mChangedSelectedLabel->setText( i18n( "Changed + s&elected:"  ) );
    mChangedSelectedLabel->setAlignment( int( QLabel::AlignVCenter | QLabel::AlignRight ) );

    mColorGrid->addWidget( mChangedSelectedLabel, 3, 0 );
    mColorBoxLayout->addLayout( mColorGrid );
    LookAndFeelLayout->addWidget( mColorBox );
    QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding );
    LookAndFeelLayout->addItem( spacer );

    // signals and slots connections
    connect( mChooseServiceFont, SIGNAL( clicked() ), this, SLOT( chooseServiceFont() ) );
    connect( mChooseNumberFont, SIGNAL( clicked() ), this, SLOT( chooseNumberFont() ) );

    // tab order
    setTabOrder( mChooseServiceFont, mChooseNumberFont );
    setTabOrder( mChooseNumberFont, mNewNormal );
    setTabOrder( mNewNormal, mNewSelected );
    setTabOrder( mNewSelected, mChangedNormal );
    setTabOrder( mChangedNormal, mChangedSelected );

    // buddies
    mServiceFontLabel->setBuddy( mChooseServiceFont );
    mNumberFontLabel->setBuddy( mChooseNumberFont );
    mChangedNormalLabel->setBuddy( mChangedNormal );
    mNewNormalLabel->setBuddy( mNewNormal );
    mNewSelectedLabel->setBuddy( mNewSelected );
    mChangedSelectedLabel->setBuddy( mChangedSelected );
}

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

void LookAndFeel::chooseNumberFont()
{
    qWarning( "LookAndFeel::chooseNumberFont(): Not implemented yet!" );
}

void LookAndFeel::chooseServiceFont()
{
    qWarning( "LookAndFeel::chooseServiceFont(): Not implemented yet!" );
}

