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

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

#include "ksnapshotwidget.h"

#include <ntqvariant.h>
#include <kdialog.h>
#include <kiconloader.h>
#include <tdeglobalsettings.h>
#include <kpushbutton.h>
#include <ntqframe.h>
#include <ntqspinbox.h>
#include <ntqlabel.h>
#include <ntqcheckbox.h>
#include <ntqcombobox.h>
#include <ntqlayout.h>
#include <ntqtooltip.h>
#include <ntqwhatsthis.h>
#include <ntqimage.h>
#include <ntqpixmap.h>

#include "ksnapshot.h"
#include "ksnapshotwidget.ui.h"
/*
 *  Constructs a KSnapshotWidget as a child of 'parent', with the
 *  name 'name' and widget flags set to 'f'.
 */
KSnapshotWidget::KSnapshotWidget( TQWidget* parent, const char* name, WFlags fl )
    : TQWidget( parent, name, fl )
{
    if ( !name )
	setName( "KSnapshotWidget" );
    KSnapshotWidgetLayout = new TQGridLayout( this, 1, 1, 0, KDialog::spacingHint(), "KSnapshotWidgetLayout"); 

    lblImage = new KSnapshotPreview( this, "lblImage" );
    lblImage->setMinimumSize( TQSize( 200, 130 ) );

    KSnapshotWidgetLayout->addMultiCellWidget( lblImage, 0, 0, 0, 2 );

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

    KSnapshotWidgetLayout->addMultiCellWidget( line1, 1, 1, 0, 3 );

    spinDelay = new TQSpinBox( this, "spinDelay" );

    KSnapshotWidgetLayout->addWidget( spinDelay, 3, 1 );

    lblDelay = new TQLabel( this, "lblDelay" );

    KSnapshotWidgetLayout->addWidget( lblDelay, 3, 0 );

    textLabel1 = new TQLabel( this, "textLabel1" );

    KSnapshotWidgetLayout->addWidget( textLabel1, 2, 0 );
    Spacer1 = new TQSpacerItem( 156, 16, TQSizePolicy::Expanding, TQSizePolicy::Minimum );
    KSnapshotWidgetLayout->addMultiCell( Spacer1, 3, 3, 2, 3 );

    cbIncludeDecorations = new TQCheckBox( this, "cbIncludeDecorations" );
    cbIncludeDecorations->setChecked( true );

    KSnapshotWidgetLayout->addMultiCellWidget( cbIncludeDecorations, 4, 4, 0, 3 );

    comboMode = new TQComboBox( false, this, "comboMode" );

    KSnapshotWidgetLayout->addMultiCellWidget( comboMode, 2, 2, 1, 3 );

    layout1 = new TQVBoxLayout( 0, 0, KDialog::spacingHint(), "layout1"); 

    btnNew = new KPushButton( this, "btnNew" );
    btnNew->setIconSet( TQIconSet( SmallIconSet( "ksnapshot", 32 ) ) );
    layout1->addWidget( btnNew );
    Spacer6 = new TQSpacerItem( 16, 16, TQSizePolicy::Minimum, TQSizePolicy::Expanding );
    layout1->addItem( Spacer6 );

    btnSave = new KPushButton( this, "btnSave" );
    btnSave->setIconSet( TQIconSet( SmallIconSet( "document-save" ) ) );
    layout1->addWidget( btnSave );

    btnCopy = new KPushButton( this, "btnCopy" );
    btnCopy->setIconSet( TQIconSet( SmallIconSet( "edit-copy" ) ) );
    layout1->addWidget( btnCopy );

    btnPrint = new KPushButton( this, "btnPrint" );
    btnPrint->setIconSet( TQIconSet( SmallIconSet( "document-print" ) ) );
    layout1->addWidget( btnPrint );

    btnOpenWithKP = new KPushButton( this, "btnOpenWithKP" );
    btnOpenWithKP->setIconSet( TQIconSet( SmallIconSet( "kolourpaint" ) ) );
    layout1->addWidget( btnOpenWithKP );

    btnOpenWith = new KPushButton( this, "btnOpenWith" );
    btnOpenWith->setIconSet( TQIconSet( SmallIconSet( "document-open" ) ) );
    layout1->addWidget( btnOpenWith );

    KSnapshotWidgetLayout->addLayout( layout1, 0, 3 );
    languageChange();
    resize( TQSize(356, 226).expandedTo(minimumSizeHint()) );
    clearWState( WState_Polished );

    // signals and slots connections
    connect( comboMode, TQ_SIGNAL( activated(int) ), this, TQ_SLOT( slotModeChanged(int) ) );
    connect( btnNew, TQ_SIGNAL( clicked() ), this, TQ_SLOT( slotNewClicked() ) );
    connect( btnPrint, TQ_SIGNAL( clicked() ), this, TQ_SLOT( slotPrintClicked() ) );
    connect( btnOpenWithKP, TQ_SIGNAL( clicked() ), this, TQ_SLOT( slotOpenWithKPClicked() ) );
    connect( btnSave, TQ_SIGNAL( clicked() ), this, TQ_SLOT( slotSaveClicked() ) );
    connect( btnCopy, TQ_SIGNAL( clicked() ), this, TQ_SLOT( slotCopyClicked() ) );
    connect( lblImage, TQ_SIGNAL( startDrag() ), this, TQ_SLOT( slotStartDrag() ) );

    // tab order
    setTabOrder( btnNew, btnSave );
    setTabOrder( btnSave, btnCopy );
    setTabOrder( btnCopy, btnPrint );
    setTabOrder( btnPrint, comboMode );
    setTabOrder( comboMode, spinDelay );
    setTabOrder( spinDelay, cbIncludeDecorations );

    // buddies
    lblDelay->setBuddy( spinDelay );
    textLabel1->setBuddy( comboMode );
}

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

/*
 *  Sets the strings of the subwidgets using the current
 *  language.
 */
void KSnapshotWidget::languageChange()
{
    TQWhatsThis::add( lblImage, tr2i18n( "This is a preview of the current snapshot.\n"
"\n"
"The image can be dragged to another application or document to copy the full screenshot there. Try it with the Konqueror file manager.\n"
"\n"
"You can also copy the image to the clipboard by pressing Ctrl+C." ) );
    spinDelay->setSuffix( tr2i18n( " sec" ) );
    spinDelay->setSpecialValueText( tr2i18n( "No delay" ) );
    TQToolTip::add( spinDelay, tr2i18n( "Snapshot delay in seconds" ) );
    TQWhatsThis::add( spinDelay, tr2i18n( "<qt>\n"
"This is the number of seconds to wait after clicking the <i>New Snapshot</i> button before taking the snapshot.\n"
"<p>\n"
"This is very useful for getting windows, menus and other items on the screen set up just the way you want.\n"
"<p>\n"
"If <i>no delay</i> is set, the program will wait for a mouse click before taking a snapshot.\n"
"</p>\n"
"</qt>" ) );
    lblDelay->setText( tr2i18n( "Snapshot &delay:" ) );
    textLabel1->setText( tr2i18n( "Cap&ture mode:" ) );
    cbIncludeDecorations->setText( tr2i18n( "Include &window decorations" ) );
    TQWhatsThis::add( cbIncludeDecorations, tr2i18n( "When enabled, snapshot of a window will also include the window decorations" ) );
    comboMode->clear();
    comboMode->insertItem( tr2i18n( "Full Screen" ) );
    comboMode->insertItem( tr2i18n( "Window Under Cursor" ) );
    comboMode->insertItem( tr2i18n( "Region" ) );
    comboMode->insertItem( tr2i18n( "Section of Window" ) );
    TQWhatsThis::add( comboMode, tr2i18n( "<qt>Using this menu, you can select from the four following snapshot modes:\n"
"<p>\n"
"<b>Full Screen</b> - captures the entire desktop.<br>\n"
"<b>Window Under Cursor</b> - captures only the window (or menu) that is under the mouse cursor when the snapshot is taken.<br>\n"
"<b>Region</b> - captures only the region of the desktop that you specify. When taking a new snapshot in this mode you will be able to select any area of the screen by clicking and dragging the mouse.</p>\n"
"<b>Section of Window</b> - captures only a section of the window. When taking a new snapshot in this mode you will be able to select any child window by moving the mouse over it.</p></qt>" ) );
    btnNew->setText( tr2i18n( "&New Snapshot" ) );
    TQWhatsThis::add( btnNew, tr2i18n( "Click this button to take a new snapshot." ) );
    btnSave->setText( tr2i18n( "&Save As..." ) );
    TQWhatsThis::add( btnSave, tr2i18n( "Click this button to save the current snapshot. To quickly save the snapshot without showing the file dialog, press Ctrl+Shift+S. The filename is automatically incremented after each save." ) );
    btnCopy->setText( tr2i18n( "&Copy to Clipboard" ) );
    TQWhatsThis::add( btnCopy, tr2i18n( "Click this button to copy the current snapshot to the clipboard." ) );
    btnPrint->setText( tr2i18n( "&Print..." ) );
    TQWhatsThis::add( btnPrint, tr2i18n( "Click this button to print the current screenshot." ) );
    btnOpenWithKP->setText( tr2i18n( "Open in &KolourPaint" ) );
    TQWhatsThis::add( btnOpenWithKP, tr2i18n( "Click this button to edit the snapshot in KolourPaint." ) );
    btnOpenWith->setText( tr2i18n( "Open &with..." ) );
    TQWhatsThis::add( btnOpenWith, tr2i18n( "Click this button to open the snapshot in another application." ) );
}

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

TQMetaObject *KSnapshotWidget::metaObj = 0;
static TQMetaObjectCleanUp cleanUp_KSnapshotWidget( "KSnapshotWidget", &KSnapshotWidget::staticMetaObject );

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

#endif // TQT_NO_TRANSLATION

TQMetaObject* KSnapshotWidget::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 = TQWidget::staticMetaObject();
    static const TQUParameter param_slot_0[] = {
	{ 0, &static_QUType_int, 0, TQUParameter::Out }
    };
    static const TQUMethod slot_0 = {"previewWidth", 1, param_slot_0 };
    static const TQUParameter param_slot_1[] = {
	{ 0, &static_QUType_int, 0, TQUParameter::Out }
    };
    static const TQUMethod slot_1 = {"previewHeight", 1, param_slot_1 };
    static const TQUMethod slot_2 = {"languageChange", 0, 0 };
    static const TQUParameter param_slot_3[] = {
	{ "mode", &static_QUType_int, 0, TQUParameter::In }
    };
    static const TQUMethod slot_3 = {"slotModeChanged", 1, param_slot_3 };
    static const TQUMethod slot_4 = {"slotNewClicked", 0, 0 };
    static const TQUMethod slot_5 = {"slotSaveClicked", 0, 0 };
    static const TQUMethod slot_6 = {"slotCopyClicked", 0, 0 };
    static const TQUMethod slot_7 = {"slotPrintClicked", 0, 0 };
    static const TQUMethod slot_8 = {"slotStartDrag", 0, 0 };
    static const TQUMethod slot_9 = {"slotOpenWithKPClicked", 0, 0 };
    static const TQMetaData slot_tbl[] = {
	{ "previewWidth()", &slot_0, TQMetaData::Public },
	{ "previewHeight()", &slot_1, TQMetaData::Public },
	{ "languageChange()", &slot_2, TQMetaData::Protected },
	{ "slotModeChanged(int)", &slot_3, TQMetaData::Protected },
	{ "slotNewClicked()", &slot_4, TQMetaData::Protected },
	{ "slotSaveClicked()", &slot_5, TQMetaData::Protected },
	{ "slotCopyClicked()", &slot_6, TQMetaData::Protected },
	{ "slotPrintClicked()", &slot_7, TQMetaData::Protected },
	{ "slotStartDrag()", &slot_8, TQMetaData::Protected },
	{ "slotOpenWithKPClicked()", &slot_9, TQMetaData::Protected }
    };
    static const TQUMethod signal_0 = {"newClicked", 0, 0 };
    static const TQUMethod signal_1 = {"saveClicked", 0, 0 };
    static const TQUMethod signal_2 = {"copyClicked", 0, 0 };
    static const TQUMethod signal_3 = {"printClicked", 0, 0 };
    static const TQUMethod signal_4 = {"openWithKPClicked", 0, 0 };
    static const TQUMethod signal_5 = {"startImageDrag", 0, 0 };
    static const TQMetaData signal_tbl[] = {
	{ "newClicked()", &signal_0, TQMetaData::Public },
	{ "saveClicked()", &signal_1, TQMetaData::Public },
	{ "copyClicked()", &signal_2, TQMetaData::Public },
	{ "printClicked()", &signal_3, TQMetaData::Public },
	{ "openWithKPClicked()", &signal_4, TQMetaData::Public },
	{ "startImageDrag()", &signal_5, TQMetaData::Public }
    };
    metaObj = TQMetaObject::new_metaobject(
	"KSnapshotWidget", parentObject,
	slot_tbl, 10,
	signal_tbl, 6,
#ifndef TQT_NO_PROPERTIES
	0, 0,
	0, 0,
#endif // TQT_NO_PROPERTIES
	0, 0 );
    cleanUp_KSnapshotWidget.setMetaObject( metaObj );
#ifdef TQT_THREAD_SUPPORT
    if (tqt_sharedMetaObjectMutex) tqt_sharedMetaObjectMutex->unlock();
#endif // TQT_THREAD_SUPPORT
    return metaObj;
}

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

// TQ_SIGNAL newClicked
void KSnapshotWidget::newClicked()
{
    activate_signal( staticMetaObject()->signalOffset() + 0 );
}

// TQ_SIGNAL saveClicked
void KSnapshotWidget::saveClicked()
{
    activate_signal( staticMetaObject()->signalOffset() + 1 );
}

// TQ_SIGNAL copyClicked
void KSnapshotWidget::copyClicked()
{
    activate_signal( staticMetaObject()->signalOffset() + 2 );
}

// TQ_SIGNAL printClicked
void KSnapshotWidget::printClicked()
{
    activate_signal( staticMetaObject()->signalOffset() + 3 );
}

// TQ_SIGNAL openWithKPClicked
void KSnapshotWidget::openWithKPClicked()
{
    activate_signal( staticMetaObject()->signalOffset() + 4 );
}

// TQ_SIGNAL startImageDrag
void KSnapshotWidget::startImageDrag()
{
    activate_signal( staticMetaObject()->signalOffset() + 5 );
}

bool KSnapshotWidget::tqt_invoke( int _id, TQUObject* _o )
{
    switch ( _id - staticMetaObject()->slotOffset() ) {
    case 0: static_QUType_int.set(_o,previewWidth()); break;
    case 1: static_QUType_int.set(_o,previewHeight()); break;
    case 2: languageChange(); break;
    case 3: slotModeChanged((int)static_QUType_int.get(_o+1)); break;
    case 4: slotNewClicked(); break;
    case 5: slotSaveClicked(); break;
    case 6: slotCopyClicked(); break;
    case 7: slotPrintClicked(); break;
    case 8: slotStartDrag(); break;
    case 9: slotOpenWithKPClicked(); break;
    default:
	return TQWidget::tqt_invoke( _id, _o );
    }
    return true;
}

bool KSnapshotWidget::tqt_emit( int _id, TQUObject* _o )
{
    switch ( _id - staticMetaObject()->signalOffset() ) {
    case 0: newClicked(); break;
    case 1: saveClicked(); break;
    case 2: copyClicked(); break;
    case 3: printClicked(); break;
    case 4: openWithKPClicked(); break;
    case 5: startImageDrag(); break;
    default:
	return TQWidget::tqt_emit(_id,_o);
    }
    return true;
}
#ifndef TQT_NO_PROPERTIES

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

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