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

#include <qvariant.h>
#include <qpushbutton.h>
#include <qheader.h>
#include <qlistview.h>
#include <qframe.h>
#include <qlineedit.h>
#include <qlabel.h>
#include <qtextview.h>
#include <qlayout.h>
#include <qtooltip.h>
#include <qwhatsthis.h>
#include <qimage.h>
#include <qpixmap.h>

#include "tomarkedtext.h"
static const char* const image0_data[] = { 
"16 16 4 1",
". c None",
"# c #000000",
"b c #7b7d7b",
"a c #d5d6d5",
"................",
"................",
".....######.....",
"...##aaaaaa##...",
"..#aaaa##aaaa#..",
"..#aaaa##aaaa#..",
"...##aaaaaa##...",
"...#b######b#...",
"...#b#bb#b#b#...",
"...#b#bb#b#b#...",
"...#b#bb#b#b#...",
"...#b#bb#b#b#...",
"...#b#bb#b#b#...",
"...#b#bb#b#b#...",
"....##bb#bb#....",
".....######....."};

static const char* const image1_data[] = { 
"16 16 4 1",
". c None",
"# c #000000",
"a c #00ff00",
"b c #ffffff",
"..........####..",
"......#####a#b#.",
"......#bbb#a#bb#",
"......#####a####",
"########aaaaaaa#",
"bbbbbb#####a####",
"b####bbbbb#a#...",
"bbbbbbbbbb#a#...",
"b###b###bb###...",
"bbbbbbbbbb#.....",
"b######bbb#.....",
"bbbbbbbbbb#.....",
"b#####bbbb#.....",
"bbbbbbbbbb#.....",
"b##b#####b#.....",
"bbbbbbbbbb#....."};


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

    Templates = new QListView( this, "Templates" );
    Templates->addColumn( tr( "Template" ) );
    Templates->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)7, 0, 0, Templates->sizePolicy().hasHeightForWidth() ) );
    Templates->setAllColumnsShowFocus( TRUE );
    Templates->setRootIsDecorated( TRUE );

    toTemplateEditUILayout->addWidget( Templates, 0, 0 );

    Frame3 = new QFrame( this, "Frame3" );
    Frame3->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)5, 0, 0, Frame3->sizePolicy().hasHeightForWidth() ) );
    Frame3->setFrameShape( QFrame::StyledPanel );
    Frame3->setFrameShadow( QFrame::Raised );
    Frame3Layout = new QGridLayout( Frame3, 1, 1, 11, 6, "Frame3Layout"); 

    Name = new QLineEdit( Frame3, "Name" );

    Frame3Layout->addMultiCellWidget( Name, 1, 1, 0, 2 );

    Description = new toMarkedText( Frame3, "Description" );
    Description->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)7, 0, 0, Description->sizePolicy().hasHeightForWidth() ) );

    Frame3Layout->addMultiCellWidget( Description, 3, 3, 0, 2 );

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

    Frame3Layout->addMultiCellWidget( TextLabel3, 2, 2, 0, 2 );

    Preview = new QTextView( Frame3, "Preview" );
    Preview->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)7, 0, 0, Preview->sizePolicy().hasHeightForWidth() ) );

    Frame3Layout->addMultiCellWidget( Preview, 5, 5, 0, 2 );

    PreviewButton = new QPushButton( Frame3, "PreviewButton" );

    Frame3Layout->addMultiCellWidget( PreviewButton, 4, 4, 1, 2 );

    TextLabel2 = new QLabel( Frame3, "TextLabel2" );
    TextLabel2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)1, 0, 0, TextLabel2->sizePolicy().hasHeightForWidth() ) );

    Frame3Layout->addWidget( TextLabel2, 0, 0 );

    TrashButton = new QPushButton( Frame3, "TrashButton" );
    TrashButton->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)1, (QSizePolicy::SizeType)0, 0, 0, TrashButton->sizePolicy().hasHeightForWidth() ) );
    TrashButton->setPixmap( image0 );

    Frame3Layout->addWidget( TrashButton, 0, 2 );

    NewButton = new QPushButton( Frame3, "NewButton" );
    NewButton->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)1, (QSizePolicy::SizeType)0, 0, 0, NewButton->sizePolicy().hasHeightForWidth() ) );
    NewButton->setPixmap( image1 );

    Frame3Layout->addWidget( NewButton, 0, 1 );

    TextLabel4 = new QLabel( Frame3, "TextLabel4" );
    TextLabel4->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)1, 0, 0, TextLabel4->sizePolicy().hasHeightForWidth() ) );

    Frame3Layout->addWidget( TextLabel4, 4, 0 );

    toTemplateEditUILayout->addMultiCellWidget( Frame3, 0, 0, 1, 3 );
    Spacer1 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
    toTemplateEditUILayout->addMultiCell( Spacer1, 1, 1, 0, 1 );

    PushButton2 = new QPushButton( this, "PushButton2" );

    toTemplateEditUILayout->addWidget( PushButton2, 1, 3 );

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

    toTemplateEditUILayout->addWidget( PushButton1, 1, 2 );
    languageChange();
    resize( QSize(659, 547).expandedTo(minimumSizeHint()) );
    clearWState( WState_Polished );

    // signals and slots connections
    connect( PushButton1, SIGNAL( clicked() ), this, SLOT( accept() ) );
    connect( PushButton2, SIGNAL( clicked() ), this, SLOT( reject() ) );
    connect( PreviewButton, SIGNAL( clicked() ), this, SLOT( preview() ) );
    connect( TrashButton, SIGNAL( clicked() ), this, SLOT( remove() ) );
    connect( NewButton, SIGNAL( clicked() ), this, SLOT( newTemplate() ) );
    connect( Templates, SIGNAL( selectionChanged() ), this, SLOT( changeSelection() ) );

    // buddies
    TextLabel3->setBuddy( Description );
    TextLabel2->setBuddy( Name );
    TextLabel4->setBuddy( Preview );
}

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

/*
 *  Sets the strings of the subwidgets using the current
 *  language.
 */
void toTemplateEditUI::languageChange()
{
    setCaption( tr( "Template editor" ) );
    Templates->header()->setLabel( 0, tr( "Template" ) );
    TextLabel3->setText( tr( "&Description" ) );
    QToolTip::add( TextLabel3, tr( "Description text. Can be in HTML format." ) );
    PreviewButton->setText( tr( "&Preview" ) );
    TextLabel2->setText( tr( "&Name" ) );
    QToolTip::add( TextLabel2, tr( "Name of the template." ) );
    TrashButton->setText( QString::null );
    QToolTip::add( TrashButton, tr( "Remove the current template" ) );
    NewButton->setText( QString::null );
    QToolTip::add( NewButton, tr( "Add new template" ) );
    TextLabel4->setText( tr( "Preview" ) );
    QToolTip::add( TextLabel4, tr( "Preview of the description. Press the button to update" ) );
    PushButton2->setText( tr( "Cancel" ) );
    PushButton1->setText( tr( "&Ok" ) );
}

void toTemplateEditUI::newTemplate()
{
    qWarning( "toTemplateEditUI::newTemplate(): Not implemented yet" );
}

void toTemplateEditUI::changeSelection()
{
    qWarning( "toTemplateEditUI::changeSelection(): Not implemented yet" );
}

void toTemplateEditUI::preview()
{
    qWarning( "toTemplateEditUI::preview(): Not implemented yet" );
}

void toTemplateEditUI::remove()
{
    qWarning( "toTemplateEditUI::remove(): Not implemented yet" );
}

void toTemplateEditUI::updateFromMap()
{
    qWarning( "toTemplateEditUI::updateFromMap(): Not implemented yet" );
}

