/***************************************************************************
                          NewAudioCdDialogBase.cpp  -  description
                             -------------------
    begin                : Fri Apr 5 2002
    copyright            : (C) 2002 by alexpod
    email                : alexpod@localhost.localdomain
 ***************************************************************************/

/***************************************************************************
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 ***************************************************************************/
#include "NewAudioCdDialogBase.h"
#include "NewAudioCdDialogBase.moc"

#include <qvariant.h>
#include <qcheckbox.h>
#include <qcombobox.h>
#include <qframe.h>
#include <qgroupbox.h>
#include <qlabel.h>
#include <qlineedit.h>
#include <qpushbutton.h>
#include <qspinbox.h>
#include <qlayout.h>
#include <qtooltip.h>
#include <qwhatsthis.h>
#include <qimage.h>
#include <qpixmap.h>

#include "dialogParts/DialogCntPnl.h"
#include "dialogParts/DriveInfoPnl.h"
#include "dialogParts/SpeedPnl.h"


/* 
 *  Constructs a NewAudioCdDialogBase which is a child of 'parent', with the 
 *  name 'name' and widget flags set to 'f'.
 *
 *  The dialog will by default be modeless, unless you set 'modal' to
 *  TRUE to construct a modal dialog.
 */
NewAudioCdDialogBase::NewAudioCdDialogBase( QWidget* parent,  const char* name, bool modal, WFlags fl )
    : QDialog( parent, name, modal, fl )
{
    if ( !name )
	setName( "NewAudioCdDialogBase" );
    resize( 780, 500 ); 
    setMinimumSize( QSize( 780, 500 ) );
    setMaximumSize( QSize( 780, 500 ) );
    setCaption( i18n( "New Audio CD Dialog" ) );
    NewAudioCdDialogBaseLayout = new QGridLayout( this, 1, 1, 0, 0, "NewAudioCdDialogBaseLayout"); 

    Frame5 = new QFrame( this, "Frame5" );
    Frame5->setMaximumSize( QSize( 325, 32767 ) );
    Frame5->setFrameShape( QFrame::StyledPanel );
    Frame5->setFrameShadow( QFrame::Raised );
    Frame5->setLineWidth( 1 );
    Frame5->setMargin( 4 );
    Frame5->setMidLineWidth( 0 );
    Frame5Layout = new QVBoxLayout( Frame5, 8, 5, "Frame5Layout");

    targetDevicePnl = new DriveInfoPnl( Frame5, "targetDevicePnl" );
    targetDevicePnl->setMinimumSize( QSize( 310, 128 ) );
    targetDevicePnl->setMaximumSize( QSize( 320, 134 ) );
    Frame5Layout->addWidget( targetDevicePnl );

    speedPnl = new SpeedPnl( Frame5, "speedPnl" );
    speedPnl->setMinimumSize( QSize( 310, 65 ) );
    speedPnl->setMaximumSize( QSize( 320, 75 ) );
    Frame5Layout->addWidget( speedPnl );

    NewAudioCdDialogBaseLayout->addWidget( Frame5, 0, 0 );

    dialogCntPnl = new DialogCntPnl( this, "dialogCntPnl" );
    dialogCntPnl->setMinimumSize( QSize( 0, 280 ) );

    NewAudioCdDialogBaseLayout->addMultiCellWidget( dialogCntPnl, 1, 1, 0, 1 );

    detailsPnl = new QFrame( this, "detailsPnl" );
    detailsPnl->setMinimumSize( QSize( 455, 0 ) );
    detailsPnl->setMaximumSize( QSize( 455, 32767 ) );
    detailsPnl->setFrameShape( QFrame::StyledPanel );
    detailsPnl->setFrameShadow( QFrame::Raised );
    detailsPnlLayout = new QVBoxLayout( detailsPnl, 9, 6, "detailsPnlLayout");

    GroupBox6 = new QGroupBox( detailsPnl, "GroupBox6" );
    GroupBox6->setEnabled( TRUE );
    GroupBox6->setMinimumSize( QSize( 46, 75 ) );
    GroupBox6->setMaximumSize( QSize( 4650, 95 ) );
    GroupBox6->setTitle( i18n( "Recording Details" ) );
    QWhatsThis::add( GroupBox6, i18n( "Details" ) );
    GroupBox6->setColumnLayout(0, Qt::Vertical );
    GroupBox6->layout()->setSpacing( 6 );
    GroupBox6->layout()->setMargin( 9 );
    GroupBox6Layout = new QGridLayout( GroupBox6->layout() );
    GroupBox6Layout->setAlignment( Qt::AlignTop );

    actionCmb = new QComboBox( FALSE, GroupBox6, "actionCmb" );
    actionCmb->insertItem( i18n( "Burn" ) );
    actionCmb->insertItem( i18n( "Test and Burn" ) );
    actionCmb->insertItem( i18n( "Dummy Burn" ) );
    actionCmb->setMinimumSize( QSize( 160, 30 ) );
    actionCmb->setMaximumSize( QSize( 160, 30 ) );
   // QToolTip::add( actionCmb, i18n( "Select the action to take:<br>Burn >> Decompress needed files and then burn.<br>Test and Burn >> same as above with a test first run.<br>Burn 'on-the-fly' >> Decompress needed files directly as input into cdrecorder. No tmp files will be created with this option. Fastest option, but less stable.<br>Dummy 'on-the-fly' >> same as above but in test mode." ) );
	QToolTip::add( actionCmb, i18n( "Select the action to take.") );

    GroupBox6Layout->addWidget( actionCmb, 0, 0 );

    numOfCopiesLbl = new QLabel( GroupBox6, "numOfCopiesLbl" );
    numOfCopiesLbl->setMinimumSize( QSize( 80, 35 ) );
    numOfCopiesLbl->setMaximumSize( QSize( 90, 35 ) );
    numOfCopiesLbl->setText( i18n( "Number<br>of Copies" ) );
    numOfCopiesLbl->setAlignment( int( QLabel::WordBreak | QLabel::AlignCenter ) );
    numOfCopiesLbl->setIndent( -1 );

    GroupBox6Layout->addWidget( numOfCopiesLbl, 0, 1 );

    numberSpn = new QSpinBox( GroupBox6, "numberSpn" );
    numberSpn->setMinimumSize( QSize( 50, 30 ) );
    numberSpn->setMaximumSize( QSize( 50, 30 ) );
    numberSpn->setButtonSymbols( QSpinBox::PlusMinus );
    numberSpn->setMinValue( 1 );
    numberSpn->setValue( 1 );
    QToolTip::add( numberSpn, i18n( "Specify number of copies to make" ) );

    GroupBox6Layout->addWidget( numberSpn, 0, 2 );

    customBurnBtn = new QPushButton( GroupBox6, "customBurnBtn" );
    customBurnBtn->setMinimumSize( QSize( 90, 30 ) );
    customBurnBtn->setMaximumSize( QSize( 90, 30 ) );
    customBurnBtn->setText( i18n( "Cus&tom" ) );
    QToolTip::add( customBurnBtn, i18n( "Configure recording options" ) );

    GroupBox6Layout->addWidget( customBurnBtn, 0, 3 );

    finalizeChk = new QCheckBox( GroupBox6, "finalizeChk" );
    finalizeChk->setText( i18n( "Finalize CD" ) );
    QToolTip::add( finalizeChk, i18n( "Fixate (Finalize) the disk after writing the tracks. This may be used to create an audio disk in steps. You can fixate this disk later from the 'Fixate Dialog'." ) );

    GroupBox6Layout->addWidget( finalizeChk, 1, 0 );
    QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
    GroupBox6Layout->addMultiCell( spacer, 1, 1, 1, 3 );
    detailsPnlLayout->addWidget( GroupBox6 );

    GroupBox5 = new QGroupBox( detailsPnl, "GroupBox5" );
    GroupBox5->setTitle( i18n( "Audio CD Details (CD-TEXT)" ) );
    GroupBox5->setColumnLayout(0, Qt::Vertical );
    GroupBox5->layout()->setSpacing( 6 );
    GroupBox5->layout()->setMargin( 11 );
    GroupBox5Layout = new QGridLayout( GroupBox5->layout() );
    GroupBox5Layout->setAlignment( Qt::AlignTop );

    titleTxt = new QLineEdit( GroupBox5, "titleTxt" );
    QToolTip::add( titleTxt, i18n( "Specify the album title for the new Audio CD." ) );

    GroupBox5Layout->addMultiCellWidget( titleTxt, 0, 0, 1, 3 );

    perfomLbl = new QLabel( GroupBox5, "perfomLbl" );
    perfomLbl->setText( i18n( "Artist:" ) );

    GroupBox5Layout->addWidget( perfomLbl, 1, 0 );

    titleLbl = new QLabel( GroupBox5, "titleLbl" );
    titleLbl->setText( i18n( "Album:" ) );

    GroupBox5Layout->addWidget( titleLbl, 0, 0 );

    perfomTxt = new QLineEdit( GroupBox5, "perfomTxt" );
    QToolTip::add( perfomTxt, i18n( "Specify the artist's name for the new Audio CD." ) );

    GroupBox5Layout->addMultiCellWidget( perfomTxt, 1, 1, 1, 3 );
	 uploadBtn = new QPushButton( GroupBox5, "uploadBtn" );
    uploadBtn->setEnabled( FALSE );
    uploadBtn->setMinimumSize( QSize( 90, 30 ) );
    uploadBtn->setMaximumSize( QSize( 90, 30 ) );
    uploadBtn->setText( trUtf8( "Upload" ) );
    QToolTip::add( uploadBtn, trUtf8( "Submite info <b></b>about this CD to CDDB server via SMTP." ) );

    GroupBox5Layout->addWidget( uploadBtn, 2, 3 );

    saveChk = new QCheckBox( GroupBox5, "saveChk" );
    saveChk->setText( i18n( "Save for the next time" ) );
    QToolTip::add( saveChk, i18n( "Preserve CD labels for the next time this dialog is launched." ) );

    GroupBox5Layout->addMultiCellWidget( saveChk, 2, 2, 0, 1 );
    QSpacerItem* spacer_2 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
    GroupBox5Layout->addItem( spacer_2, 2, 2 );
    detailsPnlLayout->addWidget( GroupBox5 );

    NewAudioCdDialogBaseLayout->addWidget( detailsPnl, 0, 1 );

    // signals and slots connections
    connect( customBurnBtn, SIGNAL( clicked() ), this, SLOT( customBtnSlot() ) );

    // tab order
    setTabOrder( actionCmb, customBurnBtn );
}

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

void NewAudioCdDialogBase::customBtnSlot()
{
    qWarning( "NewAudioCdDialogBase::customBtnSlot(): Not implemented yet!" );
}

void NewAudioCdDialogBase::isoBrowseSlot()
{
    qWarning( "NewAudioCdDialogBase::isoBrowseSlot(): Not implemented yet!" );
}

void NewAudioCdDialogBase::isoOptionsSlot()
{
    qWarning( "NewAudioCdDialogBase::isoOptionsSlot(): Not implemented yet!" );
}

void NewAudioCdDialogBase::isoPreviewSlot()
{
    qWarning( "NewAudioCdDialogBase::isoPreviewSlot(): Not implemented yet!" );
}

