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

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

#include "sq_thumbnailcachemaster.h"

#include <ntqvariant.h>
#include <kdirsize.h>
#include <kpushbutton.h>
#include <tdeio/global.h>
#include <tdeio/job.h>
#include <tqapplication.h>
#include <ntqlabel.h>
#include <ntqframe.h>
#include <ntqpushbutton.h>
#include <ntqlayout.h>
#include <ntqtooltip.h>
#include <ntqwhatsthis.h>
#include "sq_dirthumbs.h"
#include "sq_iconloader.h"
#include "sq_pixmapcache.h"
#include "sq_viewcache.h"
#include "sq_thumbnailcachemaster.ui.h"

/*
 *  Constructs a SQ_ThumbnailCacheMaster 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_ThumbnailCacheMaster::SQ_ThumbnailCacheMaster( TQWidget* parent, const char* name, bool modal, WFlags fl )
    : TQDialog( parent, name, modal, fl )
{
    if ( !name )
	setName( "SQ_ThumbnailCacheMaster" );
    setSizeGripEnabled( true );
    SQ_ThumbnailCacheMasterLayout = new TQGridLayout( this, 1, 1, 11, 6, "SQ_ThumbnailCacheMasterLayout"); 

    pushCache = new KPushButton( this, "pushCache" );
    pushCache->setAutoDefault( false );

    SQ_ThumbnailCacheMasterLayout->addWidget( pushCache, 0, 0 );

    textThumbSize = new TQLabel( this, "textThumbSize" );
    textThumbSize->setFrameShape( TQLabel::StyledPanel );
    textThumbSize->setMargin( 1 );
    textThumbSize->setAlignment( int( TQLabel::AlignCenter ) );

    SQ_ThumbnailCacheMasterLayout->addWidget( textThumbSize, 0, 1 );

    pushClearCache = new KPushButton( this, "pushClearCache" );
    pushClearCache->setAutoDefault( false );

    SQ_ThumbnailCacheMasterLayout->addWidget( pushClearCache, 1, 0 );

    pushShowCache = new KPushButton( this, "pushShowCache" );
    pushShowCache->setAutoDefault( false );

    SQ_ThumbnailCacheMasterLayout->addWidget( pushShowCache, 3, 0 );

    pushClearCacheMemory = new KPushButton( this, "pushClearCacheMemory" );
    pushClearCacheMemory->setAutoDefault( false );

    SQ_ThumbnailCacheMasterLayout->addWidget( pushClearCacheMemory, 4, 0 );

    textCacheMemSize = new TQLabel( this, "textCacheMemSize" );
    textCacheMemSize->setFrameShape( TQLabel::StyledPanel );
    textCacheMemSize->setMargin( 1 );
    textCacheMemSize->setAlignment( int( TQLabel::AlignCenter ) );

    SQ_ThumbnailCacheMasterLayout->addWidget( textCacheMemSize, 2, 1 );

    pushSyncCache = new KPushButton( this, "pushSyncCache" );
    pushSyncCache->setAutoDefault( false );

    SQ_ThumbnailCacheMasterLayout->addWidget( pushSyncCache, 5, 0 );

    pushCacheMemory = new KPushButton( this, "pushCacheMemory" );
    pushCacheMemory->setAutoDefault( false );

    SQ_ThumbnailCacheMasterLayout->addWidget( pushCacheMemory, 2, 0 );

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

    SQ_ThumbnailCacheMasterLayout->addMultiCellWidget( line1, 6, 6, 0, 1 );

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

    pushClose = new TQPushButton( this, "pushClose" );
    layout1->addWidget( pushClose );

    SQ_ThumbnailCacheMasterLayout->addMultiCellLayout( layout1, 7, 7, 0, 1 );
    languageChange();
    resize( TQSize(331, 244).expandedTo(minimumSizeHint()) );
    clearWState( WState_Polished );

    // signals and slots connections
    connect( pushSyncCache, TQ_SIGNAL( clicked() ), this, TQ_SLOT( slotSyncCache() ) );
    connect( pushShowCache, TQ_SIGNAL( clicked() ), this, TQ_SLOT( slotShowDiskCache() ) );
    connect( pushClearCacheMemory, TQ_SIGNAL( clicked() ), this, TQ_SLOT( slotClearMemoryCache() ) );
    connect( pushClearCache, TQ_SIGNAL( clicked() ), this, TQ_SLOT( slotClearCache() ) );
    connect( pushCacheMemory, TQ_SIGNAL( clicked() ), this, TQ_SLOT( slotCalcCacheMemory() ) );
    connect( pushCache, TQ_SIGNAL( clicked() ), this, TQ_SLOT( slotCalcCache() ) );
    connect( pushClose, TQ_SIGNAL( clicked() ), this, TQ_SLOT( reject() ) );

    // tab order
    setTabOrder( pushCache, pushClearCache );
    setTabOrder( pushClearCache, pushCacheMemory );
    setTabOrder( pushCacheMemory, pushShowCache );
    setTabOrder( pushShowCache, pushClearCacheMemory );
    setTabOrder( pushClearCacheMemory, pushSyncCache );
    setTabOrder( pushSyncCache, pushClose );
    init();
}

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

/*
 *  Sets the strings of the subwidgets using the current
 *  language.
 */
void SQ_ThumbnailCacheMaster::languageChange()
{
    setCaption( tr2i18n( "Thumbnail cache" ) );
    pushCache->setText( tr2i18n( "Calculate cache size on disk" ) );
    textThumbSize->setText( TQString::null );
    pushClearCache->setText( tr2i18n( "Clear cache on disk" ) );
    pushShowCache->setText( tr2i18n( "View memory cache" ) );
    pushClearCacheMemory->setText( tr2i18n( "Clear cache in memory" ) );
    textCacheMemSize->setText( TQString::null );
    pushSyncCache->setText( tr2i18n( "Sync cache to disk" ) );
    pushCacheMemory->setText( tr2i18n( "Calculate cache size in memory" ) );
    pushClose->setText( tr2i18n( "Close" ) );
}

/****************************************************************************
** SQ_ThumbnailCacheMaster meta object code from reading C++ file 'sq_thumbnailcachemaster.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_thumbnailcachemaster.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_ThumbnailCacheMaster::className() const
{
    return "SQ_ThumbnailCacheMaster";
}

TQMetaObject *SQ_ThumbnailCacheMaster::metaObj = 0;
static TQMetaObjectCleanUp cleanUp_SQ_ThumbnailCacheMaster( "SQ_ThumbnailCacheMaster", &SQ_ThumbnailCacheMaster::staticMetaObject );

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

#endif // TQT_NO_TRANSLATION

TQMetaObject* SQ_ThumbnailCacheMaster::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 TQUMethod slot_0 = {"languageChange", 0, 0 };
    static const TQUMethod slot_1 = {"slotCalcCache", 0, 0 };
    static const TQUMethod slot_2 = {"slotClearCache", 0, 0 };
    static const TQUParameter param_slot_3[] = {
	{ 0, &static_QUType_ptr, "TDEIO::Job", TQUParameter::In }
    };
    static const TQUMethod slot_3 = {"slotClearFinished", 1, param_slot_3 };
    static const TQUMethod slot_4 = {"slotClearMemoryCache", 0, 0 };
    static const TQUMethod slot_5 = {"slotCalcCacheMemory", 0, 0 };
    static const TQUMethod slot_6 = {"slotShowDiskCache", 0, 0 };
    static const TQUMethod slot_7 = {"slotSyncCache", 0, 0 };
    static const TQMetaData slot_tbl[] = {
	{ "languageChange()", &slot_0, TQMetaData::Protected },
	{ "slotCalcCache()", &slot_1, TQMetaData::Private },
	{ "slotClearCache()", &slot_2, TQMetaData::Private },
	{ "slotClearFinished(TDEIO::Job*)", &slot_3, TQMetaData::Private },
	{ "slotClearMemoryCache()", &slot_4, TQMetaData::Private },
	{ "slotCalcCacheMemory()", &slot_5, TQMetaData::Private },
	{ "slotShowDiskCache()", &slot_6, TQMetaData::Private },
	{ "slotSyncCache()", &slot_7, TQMetaData::Private }
    };
    metaObj = TQMetaObject::new_metaobject(
	"SQ_ThumbnailCacheMaster", parentObject,
	slot_tbl, 8,
	0, 0,
#ifndef TQT_NO_PROPERTIES
	0, 0,
	0, 0,
#endif // TQT_NO_PROPERTIES
	0, 0 );
    cleanUp_SQ_ThumbnailCacheMaster.setMetaObject( metaObj );
#ifdef TQT_THREAD_SUPPORT
    if (tqt_sharedMetaObjectMutex) tqt_sharedMetaObjectMutex->unlock();
#endif // TQT_THREAD_SUPPORT
    return metaObj;
}

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

bool SQ_ThumbnailCacheMaster::tqt_invoke( int _id, TQUObject* _o )
{
    switch ( _id - staticMetaObject()->slotOffset() ) {
    case 0: languageChange(); break;
    case 1: slotCalcCache(); break;
    case 2: slotClearCache(); break;
    case 3: slotClearFinished((TDEIO::Job*)static_QUType_ptr.get(_o+1)); break;
    case 4: slotClearMemoryCache(); break;
    case 5: slotCalcCacheMemory(); break;
    case 6: slotShowDiskCache(); break;
    case 7: slotSyncCache(); break;
    default:
	return TQDialog::tqt_invoke( _id, _o );
    }
    return true;
}

bool SQ_ThumbnailCacheMaster::tqt_emit( int _id, TQUObject* _o )
{
    return TQDialog::tqt_emit(_id,_o);
}
#ifndef TQT_NO_PROPERTIES

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

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