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

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

#include "newdynamic.h"

#include <ntqvariant.h>
#include <knuminput.h>
#include <playlistselection.h>
#include <ntqlabel.h>
#include <ntqlineedit.h>
#include <ntqcheckbox.h>
#include <ntqframe.h>
#include <ntqlayout.h>
#include <ntqtooltip.h>
#include <ntqwhatsthis.h>
#include "playlistselection.h"

/*
 *  Constructs a NewDynamic as a child of 'parent', with the
 *  name 'name' and widget flags set to 'f'.
 */
NewDynamic::NewDynamic( TQWidget* parent, const char* name, WFlags fl )
    : TQWidget( parent, name, fl )
{
    if ( !name )
	setName( "NewDynamic" );
    NewDynamicLayout = new TQGridLayout( this, 1, 1, 0, 6, "NewDynamicLayout"); 

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

    NewDynamicLayout->addWidget( textLabel1, 5, 1 );
    spacer5_2 = new TQSpacerItem( 21, 5, TQSizePolicy::Minimum, TQSizePolicy::MinimumExpanding );
    NewDynamicLayout->addItem( spacer5_2, 8, 3 );
    spacer3 = new TQSpacerItem( 80, 21, TQSizePolicy::Preferred, TQSizePolicy::Minimum );
    NewDynamicLayout->addMultiCell( spacer3, 5, 5, 2, 4 );

    m_upcomingIntSpinBox = new KIntSpinBox( this, "m_upcomingIntSpinBox" );
    m_upcomingIntSpinBox->setSizePolicy( TQSizePolicy( (TQSizePolicy::SizeType)5, (TQSizePolicy::SizeType)0, 0, 0, m_upcomingIntSpinBox->sizePolicy().hasHeightForWidth() ) );
    m_upcomingIntSpinBox->setMaxValue( 50 );
    m_upcomingIntSpinBox->setMinValue( 1 );
    m_upcomingIntSpinBox->setValue( 10 );
    m_upcomingIntSpinBox->setBase( 10 );

    NewDynamicLayout->addWidget( m_upcomingIntSpinBox, 6, 5 );

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

    NewDynamicLayout->addWidget( textLabel2, 6, 1 );

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

    NewDynamicLayout->addWidget( m_playlistName_label, 2, 1 );

    m_name = new TQLineEdit( this, "m_name" );
    m_name->setSizePolicy( TQSizePolicy( (TQSizePolicy::SizeType)5, (TQSizePolicy::SizeType)0, 0, 0, m_name->sizePolicy().hasHeightForWidth() ) );

    NewDynamicLayout->addMultiCellWidget( m_name, 2, 2, 2, 5 );
    spacer4 = new TQSpacerItem( 110, 21, TQSizePolicy::Preferred, TQSizePolicy::Minimum );
    NewDynamicLayout->addMultiCell( spacer4, 6, 6, 2, 4 );

    m_previousIntSpinBox = new KIntSpinBox( this, "m_previousIntSpinBox" );
    m_previousIntSpinBox->setSizePolicy( TQSizePolicy( (TQSizePolicy::SizeType)5, (TQSizePolicy::SizeType)0, 0, 0, m_previousIntSpinBox->sizePolicy().hasHeightForWidth() ) );
    m_previousIntSpinBox->setMinimumSize( TQSize( 60, 0 ) );
    m_previousIntSpinBox->setButtonSymbols( KIntSpinBox::UpDownArrows );
    m_previousIntSpinBox->setMaxValue( 100 );
    m_previousIntSpinBox->setMinValue( 0 );
    m_previousIntSpinBox->setValue( 5 );
    m_previousIntSpinBox->setBase( 10 );

    NewDynamicLayout->addWidget( m_previousIntSpinBox, 5, 5 );
    spacer5 = new TQSpacerItem( 90, 21, TQSizePolicy::Preferred, TQSizePolicy::Minimum );
    NewDynamicLayout->addMultiCell( spacer5, 7, 7, 2, 4 );

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

    NewDynamicLayout->addMultiCellWidget( m_cycleTracks, 3, 3, 1, 2 );

    selectPlaylist = new PlaylistSelection( this, "selectPlaylist" );
    selectPlaylist->setSizePolicy( TQSizePolicy( (TQSizePolicy::SizeType)1, (TQSizePolicy::SizeType)5, 1, 0, selectPlaylist->sizePolicy().hasHeightForWidth() ) );
    selectPlaylist->setMinimumSize( TQSize( 250, 250 ) );

    NewDynamicLayout->addMultiCellWidget( selectPlaylist, 2, 8, 0, 0 );

    line1 = new TQFrame( this, "line1" );
    line1->setSizePolicy( TQSizePolicy( (TQSizePolicy::SizeType)5, (TQSizePolicy::SizeType)0, 0, 0, line1->sizePolicy().hasHeightForWidth() ) );
    line1->setFrameShape( TQFrame::HLine );
    line1->setFrameShadow( TQFrame::Sunken );
    line1->setFrameShape( TQFrame::HLine );

    NewDynamicLayout->addMultiCellWidget( line1, 4, 4, 1, 5 );

    line1_2 = new TQFrame( this, "line1_2" );
    line1_2->setSizePolicy( TQSizePolicy( (TQSizePolicy::SizeType)5, (TQSizePolicy::SizeType)0, 0, 0, line1_2->sizePolicy().hasHeightForWidth() ) );
    line1_2->setFrameShape( TQFrame::HLine );
    line1_2->setFrameShadow( TQFrame::Sunken );
    line1_2->setFrameShape( TQFrame::HLine );

    NewDynamicLayout->addMultiCellWidget( line1_2, 1, 1, 0, 5 );

    m_mixLabel = new TQLabel( this, "m_mixLabel" );
    TQFont m_mixLabel_font(  m_mixLabel->font() );
    m_mixLabel_font.setBold( true );
    m_mixLabel->setFont( m_mixLabel_font ); 
    m_mixLabel->setAlignment( int( TQLabel::AlignVCenter ) );

    NewDynamicLayout->addMultiCellWidget( m_mixLabel, 0, 0, 0, 4 );
    languageChange();
    resize( TQSize(560, 287).expandedTo(minimumSizeHint()) );
    clearWState( WState_Polished );

    // signals and slots connections
    connect( m_cycleTracks, TQ_SIGNAL( toggled(bool) ), textLabel1, TQ_SLOT( setEnabled(bool) ) );
    connect( m_cycleTracks, TQ_SIGNAL( toggled(bool) ), m_previousIntSpinBox, TQ_SLOT( setEnabled(bool) ) );

    // tab order
    setTabOrder( m_name, m_cycleTracks );
    setTabOrder( m_cycleTracks, m_previousIntSpinBox );
    setTabOrder( m_previousIntSpinBox, m_upcomingIntSpinBox );
}

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

/*
 *  Sets the strings of the subwidgets using the current
 *  language.
 */
void NewDynamic::languageChange()
{
    textLabel1->setText( tr2i18n( "Played tracks to show:" ) );
    TQToolTip::add( textLabel1, tr2i18n( "How many played items to show before removal" ) );
    TQWhatsThis::add( textLabel1, tr2i18n( "How many played items to show before removal" ) );
    TQToolTip::add( m_upcomingIntSpinBox, tr2i18n( "Minimum number of upcoming tracks to keep in the playlist" ) );
    TQWhatsThis::add( m_upcomingIntSpinBox, tr2i18n( "Minimum number of upcoming tracks to keep in the playlist" ) );
    textLabel2->setText( tr2i18n( "Upcoming tracks:" ) );
    TQToolTip::add( textLabel2, tr2i18n( "Minimum number of upcoming tracks to keep in the playlist" ) );
    TQWhatsThis::add( textLabel2, tr2i18n( "Minimum number of upcoming tracks to keep in the playlist" ) );
    m_playlistName_label->setText( tr2i18n( "Dynamic playlist name:" ) );
    m_name->setText( tr2i18n( "Untitled" ) );
    TQToolTip::add( m_previousIntSpinBox, tr2i18n( "How many played items to show before removal" ) );
    TQWhatsThis::add( m_previousIntSpinBox, tr2i18n( "How many played items to show before removal" ) );
    m_cycleTracks->setText( tr2i18n( "Remove pla&yed tracks" ) );
    TQToolTip::add( m_cycleTracks, tr2i18n( "Automatically remove played tracks from the playlist" ) );
    TQWhatsThis::add( m_cycleTracks, tr2i18n( "Automatically remove played tracks from the playlist" ) );
    m_mixLabel->setText( TQString::null );
}

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

TQMetaObject *NewDynamic::metaObj = 0;
static TQMetaObjectCleanUp cleanUp_NewDynamic( "NewDynamic", &NewDynamic::staticMetaObject );

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

#endif // TQT_NO_TRANSLATION

TQMetaObject* NewDynamic::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 TQUMethod slot_0 = {"languageChange", 0, 0 };
    static const TQMetaData slot_tbl[] = {
	{ "languageChange()", &slot_0, TQMetaData::Protected }
    };
    metaObj = TQMetaObject::new_metaobject(
	"NewDynamic", parentObject,
	slot_tbl, 1,
	0, 0,
#ifndef TQT_NO_PROPERTIES
	0, 0,
	0, 0,
#endif // TQT_NO_PROPERTIES
	0, 0 );
    cleanUp_NewDynamic.setMetaObject( metaObj );
#ifdef TQT_THREAD_SUPPORT
    if (tqt_sharedMetaObjectMutex) tqt_sharedMetaObjectMutex->unlock();
#endif // TQT_THREAD_SUPPORT
    return metaObj;
}

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

bool NewDynamic::tqt_invoke( int _id, TQUObject* _o )
{
    switch ( _id - staticMetaObject()->slotOffset() ) {
    case 0: languageChange(); break;
    default:
	return TQWidget::tqt_invoke( _id, _o );
    }
    return true;
}

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

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

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