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

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

#include "cdinfodialogbase.h"

#include <ntqvariant.h>
#include <kcombobox.h>
#include <klineedit.h>
#include <knuminput.h>
#include <tdelistview.h>
#include <ntqlabel.h>
#include <ntqcheckbox.h>
#include <ntqpushbutton.h>
#include <ntqlayout.h>
#include <ntqtooltip.h>
#include <ntqwhatsthis.h>
#include "kdialog.h"
#include "tqdatetime.h"
#include "cdinfodialogbase.ui.h"

/*
 *  Constructs a CDInfoDialogBase as a child of 'parent', with the
 *  name 'name' and widget flags set to 'f'.
 */
CDInfoDialogBase::CDInfoDialogBase( TQWidget* parent, const char* name, WFlags fl )
    : TQWidget( parent, name, fl )
{
    if ( !name )
	setName( "CDInfoDialogBase" );
    CDInfoDialogBaseLayout = new TQVBoxLayout( this, KDialog::marginHint(), KDialog::spacingHint(), "CDInfoDialogBaseLayout"); 

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

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

    layout1->addWidget( lb_revision, 5, 2 );

    m_title = new KLineEdit( this, "m_title" );

    layout1->addMultiCellWidget( m_title, 1, 1, 1, 3 );

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

    layout1->addWidget( lb_category, 4, 0 );

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

    layout1->addWidget( m_id, 5, 1 );

    m_artist = new KLineEdit( this, "m_artist" );

    layout1->addMultiCellWidget( m_artist, 0, 0, 1, 3 );

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

    layout1->addWidget( lb_artist, 0, 0 );

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

    layout1->addWidget( lb_year, 3, 0 );

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

    layout1->addWidget( lb_genre, 4, 2 );

    m_category = new KComboBox( false, this, "m_category" );
    m_category->setEnabled( false );

    layout1->addWidget( m_category, 4, 1 );

    m_year = new KIntSpinBox( this, "m_year" );
    m_year->setMaxValue( 2100 );
    m_year->setMinValue( 0 );

    layout1->addWidget( m_year, 3, 1 );

    m_multiple = new TQCheckBox( this, "m_multiple" );

    layout1->addMultiCellWidget( m_multiple, 6, 6, 0, 1 );

    m_comment = new KLineEdit( this, "m_comment" );

    layout1->addMultiCellWidget( m_comment, 2, 2, 1, 3 );

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

    layout1->addWidget( lb_comment, 2, 0 );

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

    layout1->addWidget( lb_title, 1, 0 );

    m_genre = new KComboBox( false, this, "m_genre" );
    m_genre->setEditable( true );
    m_genre->setDuplicatesEnabled( false );

    layout1->addWidget( m_genre, 4, 3 );

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

    layout1->addWidget( lb_id, 5, 0 );

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

    layout1->addWidget( lb_length, 3, 2 );

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

    layout1->addWidget( m_revision, 5, 3 );

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

    layout1->addWidget( m_length, 3, 3 );
    CDInfoDialogBaseLayout->addLayout( layout1 );

    m_trackList = new TDEListView( this, "m_trackList" );
    m_trackList->addColumn( tr2i18n( "Track" ) );
    m_trackList->addColumn( tr2i18n( "Length" ) );
    m_trackList->addColumn( tr2i18n( "Title" ) );
    m_trackList->addColumn( tr2i18n( "Comment" ) );
    m_trackList->addColumn( tr2i18n( "Artist" ) );
    m_trackList->setAllColumnsShowFocus( true );
    m_trackList->setDefaultRenameAction( TDEListView::Accept );
    CDInfoDialogBaseLayout->addWidget( m_trackList );

    layout2 = new TQHBoxLayout( 0, 0, KDialog::spacingHint(), "layout2"); 
    spacer1 = new TQSpacerItem( 231, 41, TQSizePolicy::Expanding, TQSizePolicy::Minimum );
    layout2->addItem( spacer1 );

    m_changeEncoding = new TQPushButton( this, "m_changeEncoding" );
    layout2->addWidget( m_changeEncoding );
    CDInfoDialogBaseLayout->addLayout( layout2 );

    lb_playingOrder = new TQLabel( this, "lb_playingOrder" );
    CDInfoDialogBaseLayout->addWidget( lb_playingOrder );

    m_playOrder = new KLineEdit( this, "m_playOrder" );
    CDInfoDialogBaseLayout->addWidget( m_playOrder );
    languageChange();
    resize( TQSize(501, 600).expandedTo(minimumSizeHint()) );
    clearWState( WState_Polished );

    // signals and slots connections
    connect( m_trackList, TQ_SIGNAL( selectionChanged(TQListViewItem*) ), this, TQ_SLOT( slotTrackSelected(TQListViewItem*) ) );
    connect( m_trackList, TQ_SIGNAL( doubleClicked(TQListViewItem*,const TQPoint&,int) ), this, TQ_SLOT( slotTrackDoubleClicked(TQListViewItem*,const TQPoint&,int) ) );
    connect( m_artist, TQ_SIGNAL( textChanged(const TQString&) ), this, TQ_SLOT( artistChanged(const TQString&) ) );
    connect( m_genre, TQ_SIGNAL( textChanged(const TQString&) ), this, TQ_SLOT( genreChanged(const TQString&) ) );
    connect( m_multiple, TQ_SIGNAL( toggled(bool) ), this, TQ_SLOT( slotMultipleArtists(bool) ) );
    connect( m_changeEncoding, TQ_SIGNAL( clicked() ), this, TQ_SLOT( slotChangeEncoding() ) );

    // tab order
    setTabOrder( m_artist, m_title );
    setTabOrder( m_title, m_comment );
    setTabOrder( m_comment, m_year );
    setTabOrder( m_year, m_category );
    setTabOrder( m_category, m_genre );
    setTabOrder( m_genre, m_trackList );
    setTabOrder( m_trackList, m_playOrder );

    // buddies
    lb_category->setBuddy( m_category );
    lb_artist->setBuddy( m_artist );
    lb_year->setBuddy( m_year );
    lb_genre->setBuddy( m_genre );
    lb_title->setBuddy( m_title );
    init();
}

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

/*
 *  Sets the strings of the subwidgets using the current
 *  language.
 */
void CDInfoDialogBase::languageChange()
{
    lb_revision->setText( tr2i18n( "Revision:" ) );
    TQToolTip::add( m_title, tr2i18n( "Use the name of the artist if there is no title." ) );
    lb_category->setText( tr2i18n( "&Category:" ) );
    m_id->setText( TQString::null );
    TQToolTip::add( m_artist, tr2i18n( "Write names as \"first last\", not \"last, first\". Omit any leading \"The\".  Use \"Various\" for compilations." ) );
    lb_artist->setText( tr2i18n( "&Artist:" ) );
    lb_year->setText( tr2i18n( "&Year:" ) );
    lb_genre->setText( tr2i18n( "&Genre:" ) );
    TQToolTip::add( m_category, tr2i18n( "Disc Id values must be unique within a category." ) );
    m_multiple->setText( tr2i18n( "&Multiple artists" ) );
    m_comment->setText( TQString::null );
    lb_comment->setText( tr2i18n( "Comment:" ) );
    lb_title->setText( tr2i18n( "&Title:" ) );
    TQToolTip::add( m_genre, tr2i18n( "Avoid custom values, as they will be written to CDDB as-is." ) );
    lb_id->setText( tr2i18n( "Disc Id:" ) );
    lb_length->setText( tr2i18n( "Length:" ) );
    m_length->setText( TQString::null );
    m_trackList->header()->setLabel( 0, tr2i18n( "Track" ) );
    m_trackList->header()->setLabel( 1, tr2i18n( "Length" ) );
    m_trackList->header()->setLabel( 2, tr2i18n( "Title" ) );
    m_trackList->header()->setLabel( 3, tr2i18n( "Comment" ) );
    m_trackList->header()->setLabel( 4, tr2i18n( "Artist" ) );
    TQToolTip::add( m_trackList, tr2i18n( "For a CD-Extra, set title to \"Data\"." ) );
    m_changeEncoding->setText( tr2i18n( "Change Encoding..." ) );
    lb_playingOrder->setText( tr2i18n( "Playing order:" ) );
}

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

TQMetaObject *CDInfoDialogBase::metaObj = 0;
static TQMetaObjectCleanUp cleanUp_CDInfoDialogBase( "CDInfoDialogBase", &CDInfoDialogBase::staticMetaObject );

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

#endif // TQT_NO_TRANSLATION

TQMetaObject* CDInfoDialogBase::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[] = {
	{ "info", &static_QUType_ptr, "KCDDB::CDInfo", TQUParameter::In },
	{ "trackStartFrames", &static_QUType_ptr, "KCDDB::TrackOffsetList", TQUParameter::InOut }
    };
    static const TQUMethod slot_0 = {"setInfo", 2, param_slot_0 };
    static const TQUParameter param_slot_1[] = {
	{ "newArtist", &static_QUType_TQString, 0, TQUParameter::In }
    };
    static const TQUMethod slot_1 = {"artistChanged", 1, param_slot_1 };
    static const TQUParameter param_slot_2[] = {
	{ "newGenre", &static_QUType_TQString, 0, TQUParameter::In }
    };
    static const TQUMethod slot_2 = {"genreChanged", 1, param_slot_2 };
    static const TQUParameter param_slot_3[] = {
	{ "hasMultipleArtist", &static_QUType_bool, 0, TQUParameter::In }
    };
    static const TQUMethod slot_3 = {"slotMultipleArtists", 1, param_slot_3 };
    static const TQUMethod slot_4 = {"languageChange", 0, 0 };
    static const TQUParameter param_slot_5[] = {
	{ "item", &static_QUType_ptr, "TQListViewItem", TQUParameter::In }
    };
    static const TQUMethod slot_5 = {"slotTrackSelected", 1, param_slot_5 };
    static const TQUMethod slot_6 = {"slotNextTrack", 0, 0 };
    static const TQUParameter param_slot_7[] = {
	{ "item", &static_QUType_ptr, "TQListViewItem", TQUParameter::In },
	{ 0, &static_QUType_varptr, "\x0e", TQUParameter::In },
	{ "column", &static_QUType_int, 0, TQUParameter::In }
    };
    static const TQUMethod slot_7 = {"slotTrackDoubleClicked", 3, param_slot_7 };
    static const TQUMethod slot_8 = {"slotChangeEncoding", 0, 0 };
    static const TQMetaData slot_tbl[] = {
	{ "setInfo(const KCDDB::CDInfo&,KCDDB::TrackOffsetList&)", &slot_0, TQMetaData::Public },
	{ "artistChanged(const TQString&)", &slot_1, TQMetaData::Public },
	{ "genreChanged(const TQString&)", &slot_2, TQMetaData::Public },
	{ "slotMultipleArtists(bool)", &slot_3, TQMetaData::Public },
	{ "languageChange()", &slot_4, TQMetaData::Protected },
	{ "slotTrackSelected(TQListViewItem*)", &slot_5, TQMetaData::Protected },
	{ "slotNextTrack()", &slot_6, TQMetaData::Protected },
	{ "slotTrackDoubleClicked(TQListViewItem*,const TQPoint&,int)", &slot_7, TQMetaData::Protected },
	{ "slotChangeEncoding()", &slot_8, TQMetaData::Private }
    };
    static const TQUParameter param_signal_0[] = {
	{ "i", &static_QUType_int, 0, TQUParameter::In }
    };
    static const TQUMethod signal_0 = {"play", 1, param_signal_0 };
    static const TQUMethod signal_1 = {"discInfoClicked", 0, 0 };
    static const TQUParameter param_signal_2[] = {
	{ 0, &static_QUType_ptr, "unsigned", TQUParameter::In }
    };
    static const TQUMethod signal_2 = {"trackInfoClicked", 1, param_signal_2 };
    static const TQMetaData signal_tbl[] = {
	{ "play(int)", &signal_0, TQMetaData::Public },
	{ "discInfoClicked()", &signal_1, TQMetaData::Public },
	{ "trackInfoClicked(unsigned)", &signal_2, TQMetaData::Public }
    };
    metaObj = TQMetaObject::new_metaobject(
	"CDInfoDialogBase", parentObject,
	slot_tbl, 9,
	signal_tbl, 3,
#ifndef TQT_NO_PROPERTIES
	0, 0,
	0, 0,
#endif // TQT_NO_PROPERTIES
	0, 0 );
    cleanUp_CDInfoDialogBase.setMetaObject( metaObj );
#ifdef TQT_THREAD_SUPPORT
    if (tqt_sharedMetaObjectMutex) tqt_sharedMetaObjectMutex->unlock();
#endif // TQT_THREAD_SUPPORT
    return metaObj;
}

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

// TQ_SIGNAL play
void CDInfoDialogBase::play( int t0 )
{
    activate_signal( staticMetaObject()->signalOffset() + 0, t0 );
}

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

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

// TQ_SIGNAL trackInfoClicked
void CDInfoDialogBase::trackInfoClicked( unsigned t0 )
{
    if ( signalsBlocked() )
	return;
    TQConnectionList *clist = receivers( staticMetaObject()->signalOffset() + 2 );
    if ( !clist )
	return;
    TQUObject o[2];
    static_QUType_ptr.set(o+1,&t0);
    o[1].isLastObject = true;
    activate_signal( clist, o );
}

bool CDInfoDialogBase::tqt_invoke( int _id, TQUObject* _o )
{
    switch ( _id - staticMetaObject()->slotOffset() ) {
    case 0: setInfo((const KCDDB::CDInfo&)*((const KCDDB::CDInfo*)static_QUType_ptr.get(_o+1)),(KCDDB::TrackOffsetList&)*((KCDDB::TrackOffsetList*)static_QUType_ptr.get(_o+2))); break;
    case 1: artistChanged((const TQString&)static_QUType_TQString.get(_o+1)); break;
    case 2: genreChanged((const TQString&)static_QUType_TQString.get(_o+1)); break;
    case 3: slotMultipleArtists((bool)static_QUType_bool.get(_o+1)); break;
    case 4: languageChange(); break;
    case 5: slotTrackSelected((TQListViewItem*)static_QUType_ptr.get(_o+1)); break;
    case 6: slotNextTrack(); break;
    case 7: slotTrackDoubleClicked((TQListViewItem*)static_QUType_ptr.get(_o+1),(const TQPoint&)*((const TQPoint*)static_QUType_ptr.get(_o+2)),(int)static_QUType_int.get(_o+3)); break;
    case 8: slotChangeEncoding(); break;
    default:
	return TQWidget::tqt_invoke( _id, _o );
    }
    return true;
}

bool CDInfoDialogBase::tqt_emit( int _id, TQUObject* _o )
{
    switch ( _id - staticMetaObject()->signalOffset() ) {
    case 0: play((int)static_QUType_int.get(_o+1)); break;
    case 1: discInfoClicked(); break;
    case 2: trackInfoClicked((unsigned)(*((unsigned*)static_QUType_ptr.get(_o+1)))); break;
    default:
	return TQWidget::tqt_emit(_id,_o);
    }
    return true;
}
#ifndef TQT_NO_PROPERTIES

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

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