#include <kdialog.h>
#include <tdelocale.h>

/****************************************************************************
** Form implementation generated from reading ui file 'sq_imageconvert.ui'
**
** Created by: The TQt user interface compiler (TQt 3.5.0)
**
** WARNING! All changes made in this file will be lost!
****************************************************************************/

#include "sq_imageconvert.h"

#include <ntqvariant.h>
#include <knuminput.h>
#include <kprogress.h>
#include <ksquirrel-libs/fmt_defs.h>
#include <ksquirrel-libs/fmt_types.h>
#include <kstandarddirs.h>
#include <tqapplication.h>
#include <tqcheckbox.h>
#include <tqfileinfo.h>
#include <tqheader.h>
#include <ntqpushbutton.h>
#include <ntqframe.h>
#include <ntqwidgetstack.h>
#include <ntqwidget.h>
#include <ntqgroupbox.h>
#include <ntqheader.h>
#include <ntqlistview.h>
#include <ntqtextedit.h>
#include <ntqlayout.h>
#include <ntqtooltip.h>
#include <ntqwhatsthis.h>
#include "sq_config.h"
#include "sq_errorstring.h"
#include "sq_iconloader.h"
#include "sq_imageeditoptions.h"
#include "sq_libraryhandler.h"
#include "sq_writeoption.h"
#include "sq_imageconvert.ui.h"

/*
 *  Constructs a SQ_ImageConvert as a child of 'parent', with the
 *  name 'name' and widget flags set to 'f'.
 *
 *  The qdialog will by default be modeless, unless you set 'modal' to
 *  true to construct a modal qdialog.
 */
SQ_ImageConvert::SQ_ImageConvert( TQWidget* parent, const char* name, bool modal, WFlags fl )
    : TQDialog( parent, name, modal, fl )
{
    if ( !name )
	setName( "SQ_ImageConvert" );
    setSizeGripEnabled( true );
    SQ_ImageConvertLayout = new TQGridLayout( this, 1, 1, 11, 6, "SQ_ImageConvertLayout"); 

    layout1 = new TQHBoxLayout( 0, 0, 6, "layout1"); 
    spacer1 = new TQSpacerItem( 237, 20, TQSizePolicy::Expanding, TQSizePolicy::Minimum );
    layout1->addItem( spacer1 );

    pushConvert = new TQPushButton( this, "pushConvert" );
    pushConvert->setDefault( true );
    layout1->addWidget( pushConvert );

    pushCancel = new TQPushButton( this, "pushCancel" );
    pushCancel->setAutoDefault( false );
    layout1->addWidget( pushCancel );

    SQ_ImageConvertLayout->addLayout( layout1, 2, 0 );

    line8 = new TQFrame( this, "line8" );
    line8->setFrameShape( TQFrame::HLine );
    line8->setFrameShadow( TQFrame::Sunken );
    line8->setFrameShape( TQFrame::HLine );

    SQ_ImageConvertLayout->addWidget( line8, 1, 0 );

    widgetStack = new TQWidgetStack( this, "widgetStack" );

    WStackPage = new TQWidget( widgetStack, "WStackPage" );
    WStackPageLayout = new TQGridLayout( WStackPage, 1, 1, 0, 6, "WStackPageLayout"); 

    groupBoxActions = new TQGroupBox( WStackPage, "groupBoxActions" );
    groupBoxActions->setSizePolicy( TQSizePolicy( (TQSizePolicy::SizeType)0, (TQSizePolicy::SizeType)5, 0, 0, groupBoxActions->sizePolicy().hasHeightForWidth() ) );
    groupBoxActions->setFrameShape( TQGroupBox::NoFrame );
    groupBoxActions->setColumnLayout(0, TQt::Vertical );
    groupBoxActions->layout()->setSpacing( 6 );
    groupBoxActions->layout()->setMargin( 0 );
    groupBoxActionsLayout = new TQGridLayout( groupBoxActions->layout() );
    groupBoxActionsLayout->setAlignment( TQt::AlignTop );

    pushOptions = new TQPushButton( groupBoxActions, "pushOptions" );
    pushOptions->setFlat( true );

    groupBoxActionsLayout->addWidget( pushOptions, 0, 0 );
    spacer15 = new TQSpacerItem( 26, 155, TQSizePolicy::Minimum, TQSizePolicy::Expanding );
    groupBoxActionsLayout->addItem( spacer15, 2, 0 );

    pushWriteOptions = new TQPushButton( groupBoxActions, "pushWriteOptions" );
    pushWriteOptions->setToggleButton( true );
    pushWriteOptions->setFlat( true );

    groupBoxActionsLayout->addWidget( pushWriteOptions, 1, 0 );

    WStackPageLayout->addWidget( groupBoxActions, 0, 1 );

    tableLib = new TQListView( WStackPage, "tableLib" );
    tableLib->addColumn( tr2i18n( "col1" ) );
    tableLib->addColumn( tr2i18n( "col2" ) );
    tableLib->setAllColumnsShowFocus( true );
    tableLib->setResizeMode( TQListView::LastColumn );

    WStackPageLayout->addWidget( tableLib, 0, 0 );
    widgetStack->addWidget( WStackPage, 0 );

    WStackPage_2 = new TQWidget( widgetStack, "WStackPage_2" );
    WStackPageLayout_2 = new TQGridLayout( WStackPage_2, 1, 1, 0, 6, "WStackPageLayout_2"); 

    textResult = new TQTextEdit( WStackPage_2, "textResult" );
    textResult->setWordWrap( TQTextEdit::NoWrap );
    textResult->setReadOnly( true );
    textResult->setUndoRedoEnabled( false );

    WStackPageLayout_2->addWidget( textResult, 0, 0 );

    progress = new KProgress( WStackPage_2, "progress" );

    WStackPageLayout_2->addWidget( progress, 1, 0 );
    widgetStack->addWidget( WStackPage_2, 1 );

    SQ_ImageConvertLayout->addWidget( widgetStack, 0, 0 );
    languageChange();
    resize( TQSize(436, 324).expandedTo(minimumSizeHint()) );
    clearWState( WState_Polished );

    // signals and slots connections
    connect( pushCancel, TQ_SIGNAL( clicked() ), this, TQ_SLOT( slotReject() ) );
    connect( pushOptions, TQ_SIGNAL( clicked() ), this, TQ_SLOT( slotOptions() ) );
    connect( pushWriteOptions, TQ_SIGNAL( toggled(bool) ), this, TQ_SLOT( slotShowExtWrapper(bool) ) );
    connect( pushConvert, TQ_SIGNAL( clicked() ), this, TQ_SLOT( slotStartConvert() ) );
    connect( tableLib, TQ_SIGNAL( currentChanged(TQListViewItem*) ), this, TQ_SLOT( slotCurrentLibraryChanged(TQListViewItem*) ) );

    // tab order
    setTabOrder( tableLib, pushOptions );
    setTabOrder( pushOptions, pushWriteOptions );
    setTabOrder( pushWriteOptions, pushConvert );
    setTabOrder( pushConvert, pushCancel );
    setTabOrder( pushCancel, textResult );
    init();
}

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

/*
 *  Sets the strings of the subwidgets using the current
 *  language.
 */
void SQ_ImageConvert::languageChange()
{
    setCaption( tr2i18n( "SQ_ImageConvert" ) );
    pushConvert->setText( tr2i18n( "Convert" ) );
    pushCancel->setText( tr2i18n( "Close" ) );
    groupBoxActions->setTitle( TQString::null );
    pushOptions->setText( TQString::null );
    pushWriteOptions->setText( TQString::null );
    TQToolTip::add( pushWriteOptions, tr2i18n( "Conversion options" ) );
    tableLib->header()->setLabel( 0, tr2i18n( "col1" ) );
    tableLib->header()->setLabel( 1, tr2i18n( "col2" ) );
}

/****************************************************************************
** SQ_ImageConvert meta object code from reading C++ file 'sq_imageconvert.h'
**
** Created by: The TQt Meta Object Compiler version 26 (TQt 3.5.0)
** WARNING! All changes made in this file will be lost!
*****************************************************************************/

#undef TQT_NO_COMPAT
#include "sq_imageconvert.h"
#include <ntqmetaobject.h>
#include <ntqapplication.h>

#include <private/qucomextra_p.h>
#if !defined(Q_MOC_OUTPUT_REVISION) || (Q_MOC_OUTPUT_REVISION != 26)
#error "This file was generated using the moc from 3.5.0. It"
#error "cannot be used with the include files from this version of TQt."
#error "(The moc has changed too much.)"
#endif

const char *SQ_ImageConvert::className() const
{
    return "SQ_ImageConvert";
}

TQMetaObject *SQ_ImageConvert::metaObj = 0;
static TQMetaObjectCleanUp cleanUp_SQ_ImageConvert( "SQ_ImageConvert", &SQ_ImageConvert::staticMetaObject );

#ifndef TQT_NO_TRANSLATION
TQString SQ_ImageConvert::tr( const char *s, const char *c )
{
    if ( tqApp )
	return tqApp->translate( "SQ_ImageConvert", s, c, TQApplication::DefaultCodec );
    else
	return TQString::fromLatin1( s );
}
#ifndef TQT_NO_TRANSLATION_UTF8
TQString SQ_ImageConvert::trUtf8( const char *s, const char *c )
{
    if ( tqApp )
	return tqApp->translate( "SQ_ImageConvert", s, c, TQApplication::UnicodeUTF8 );
    else
	return TQString::fromUtf8( s );
}
#endif // TQT_NO_TRANSLATION_UTF8

#endif // TQT_NO_TRANSLATION

TQMetaObject* SQ_ImageConvert::staticMetaObject()
{
    if ( metaObj ) {
	return metaObj;
}
#ifdef TQT_THREAD_SUPPORT
    if (tqt_sharedMetaObjectMutex) tqt_sharedMetaObjectMutex->lock();
    if ( metaObj ) {
	if (tqt_sharedMetaObjectMutex) tqt_sharedMetaObjectMutex->unlock();
	return metaObj;
    }
#endif // TQT_THREAD_SUPPORT
    TQMetaObject* parentObject = TQDialog::staticMetaObject();
    static const TQUParameter param_slot_0[] = {
	{ "show", &static_QUType_bool, 0, TQUParameter::In }
    };
    static const TQUMethod slot_0 = {"slotShowExtWrapper", 1, param_slot_0 };
    static const TQUMethod slot_1 = {"languageChange", 0, 0 };
    static const TQUMethod slot_2 = {"createExtension", 0, 0 };
    static const TQUParameter param_slot_3[] = {
	{ "text", &static_QUType_TQString, 0, TQUParameter::In },
	{ "bold", &static_QUType_bool, 0, TQUParameter::In }
    };
    static const TQUMethod slot_3 = {"slotDebugText", 2, param_slot_3 };
    static const TQUMethod slot_4 = {"slotStartConvert", 0, 0 };
    static const TQUMethod slot_5 = {"slotOneProcessed", 0, 0 };
    static const TQUParameter param_slot_6[] = {
	{ "i", &static_QUType_ptr, "TQListViewItem", TQUParameter::In }
    };
    static const TQUMethod slot_6 = {"slotCurrentLibraryChanged", 1, param_slot_6 };
    static const TQUMethod slot_7 = {"slotOptions", 0, 0 };
    static const TQUParameter param_slot_8[] = {
	{ "close", &static_QUType_bool, 0, TQUParameter::In }
    };
    static const TQUMethod slot_8 = {"slotDone", 1, param_slot_8 };
    static const TQUMethod slot_9 = {"slotReject", 0, 0 };
    static const TQMetaData slot_tbl[] = {
	{ "slotShowExtWrapper(bool)", &slot_0, TQMetaData::Public },
	{ "languageChange()", &slot_1, TQMetaData::Protected },
	{ "createExtension()", &slot_2, TQMetaData::Private },
	{ "slotDebugText(const TQString&,bool)", &slot_3, TQMetaData::Private },
	{ "slotStartConvert()", &slot_4, TQMetaData::Private },
	{ "slotOneProcessed()", &slot_5, TQMetaData::Private },
	{ "slotCurrentLibraryChanged(TQListViewItem*)", &slot_6, TQMetaData::Private },
	{ "slotOptions()", &slot_7, TQMetaData::Private },
	{ "slotDone(bool)", &slot_8, TQMetaData::Private },
	{ "slotReject()", &slot_9, TQMetaData::Private }
    };
    static const TQUParameter param_signal_0[] = {
	{ 0, &static_QUType_ptr, "SQ_ImageOptions", TQUParameter::In },
	{ 0, &static_QUType_ptr, "SQ_ImageConvertOptions", TQUParameter::In }
    };
    static const TQUMethod signal_0 = {"convert", 2, param_signal_0 };
    static const TQMetaData signal_tbl[] = {
	{ "convert(SQ_ImageOptions*,SQ_ImageConvertOptions*)", &signal_0, TQMetaData::Public }
    };
    metaObj = TQMetaObject::new_metaobject(
	"SQ_ImageConvert", parentObject,
	slot_tbl, 10,
	signal_tbl, 1,
#ifndef TQT_NO_PROPERTIES
	0, 0,
	0, 0,
#endif // TQT_NO_PROPERTIES
	0, 0 );
    cleanUp_SQ_ImageConvert.setMetaObject( metaObj );
#ifdef TQT_THREAD_SUPPORT
    if (tqt_sharedMetaObjectMutex) tqt_sharedMetaObjectMutex->unlock();
#endif // TQT_THREAD_SUPPORT
    return metaObj;
}

void* SQ_ImageConvert::tqt_cast( const char* clname )
{
    if ( !qstrcmp( clname, "SQ_ImageConvert" ) )
	return this;
    return TQDialog::tqt_cast( clname );
}

#include <ntqobjectdefs.h>
#include <ntqsignalslotimp.h>

// TQ_SIGNAL convert
void SQ_ImageConvert::convert( SQ_ImageOptions* t0, SQ_ImageConvertOptions* t1 )
{
    if ( signalsBlocked() )
	return;
    TQConnectionList *clist = receivers( staticMetaObject()->signalOffset() + 0 );
    if ( !clist )
	return;
    TQUObject o[3];
    static_QUType_ptr.set(o+1,t0);
    static_QUType_ptr.set(o+2,t1);
    o[2].isLastObject = true;
    activate_signal( clist, o );
}

bool SQ_ImageConvert::tqt_invoke( int _id, TQUObject* _o )
{
    switch ( _id - staticMetaObject()->slotOffset() ) {
    case 0: slotShowExtWrapper((bool)static_QUType_bool.get(_o+1)); break;
    case 1: languageChange(); break;
    case 2: createExtension(); break;
    case 3: slotDebugText((const TQString&)static_QUType_TQString.get(_o+1),(bool)static_QUType_bool.get(_o+2)); break;
    case 4: slotStartConvert(); break;
    case 5: slotOneProcessed(); break;
    case 6: slotCurrentLibraryChanged((TQListViewItem*)static_QUType_ptr.get(_o+1)); break;
    case 7: slotOptions(); break;
    case 8: slotDone((bool)static_QUType_bool.get(_o+1)); break;
    case 9: slotReject(); break;
    default:
	return TQDialog::tqt_invoke( _id, _o );
    }
    return true;
}

bool SQ_ImageConvert::tqt_emit( int _id, TQUObject* _o )
{
    switch ( _id - staticMetaObject()->signalOffset() ) {
    case 0: convert((SQ_ImageOptions*)static_QUType_ptr.get(_o+1),(SQ_ImageConvertOptions*)static_QUType_ptr.get(_o+2)); break;
    default:
	return TQDialog::tqt_emit(_id,_o);
    }
    return true;
}
#ifndef TQT_NO_PROPERTIES

bool SQ_ImageConvert::tqt_property( int id, int f, TQVariant* v)
{
    return TQDialog::tqt_property( id, f, v);
}

bool SQ_ImageConvert::tqt_static_property( TQObject* , int , int , TQVariant* ){ return false; }
#endif // TQT_NO_PROPERTIES
