/***************************************************************************
                          CdCopyDialogBase.cpp  -  description
                             -------------------
    begin                : Sat May 5 2002
    copyright            : (C) 2001 by Alex Podolsky
    email                : alexpod@users.sourceforge.net
 ***************************************************************************/

/***************************************************************************
 *                                                                         *
 *   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 "CdCopyDialogBase.h"
#include "CdCopyDialogBase.moc"

#include <qbuttongroup.h>
#include <qcheckbox.h>
#include <qcombobox.h>
#include <qframe.h>
#include <qgroupbox.h>
#include <qheader.h>
#include <qlabel.h>
#include <qpushbutton.h>
#include <qradiobutton.h>
#include <qspinbox.h>
#include <qtabwidget.h>
#include <qwidget.h>
#include <qlayout.h>
#include <qvariant.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"
#include "../audio/CdboCddaView.h"
#include <ktabctl.h>

//
CdCopyDialogBase::CdCopyDialogBase( QWidget* parent,  const char* name, bool modal, WFlags fl )
    : KDialog( parent, name, modal, fl )
{
	if ( !name )
		setName( "CdCopyDialogBase" );
    resize( 800, 550 );
    setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)5, sizePolicy().hasHeightForWidth() ) );
    setMinimumSize( QSize( 800, 550 ) );
    setMaximumSize( QSize( 800, 550 ) );
    setBaseSize( QSize( 827, 540 ) );
    setCaption( i18n( "Copy CD - CD Bake Oven" ) );
    setSizeGripEnabled( FALSE );


    dialogCntPnl = new DialogCntPnl( this, "dialogCntPnl" );
    dialogCntPnl->setGeometry( QRect( 1, 271, 798, 280 ) );
    dialogCntPnl->setMinimumSize( QSize( 0, 280 ) );

    Frame5 = new QFrame( this, "Frame5" );
    Frame5->setGeometry( QRect( 1, 1, 320, 270 ) );
    Frame5->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)1, (QSizePolicy::SizeType)5, Frame5->sizePolicy().hasHeightForWidth() ) );
    Frame5->setMaximumSize( QSize( 320, 32767 ) );
    Frame5->setFrameShape( QFrame::StyledPanel );
    Frame5->setFrameShadow( QFrame::Raised );
    Frame5->setLineWidth( 1 );
    Frame5->setMargin( 0 );
    Frame5->setMidLineWidth( 0 );
    Frame5Layout = new QVBoxLayout( Frame5 ); 
    Frame5Layout->setSpacing( 5 );
    Frame5Layout->setMargin( 8 );

    srcDevicePnl = new DriveInfoPnl( Frame5, "srcDevicePnl" );
    srcDevicePnl->setMinimumSize( QSize( 300, 120 ) );
    Frame5Layout->addWidget( srcDevicePnl );

    targetDevicePnl = new DriveInfoPnl( Frame5, "targetDevicePnl" );
    targetDevicePnl->setMinimumSize( QSize( 300, 120 ) );
    Frame5Layout->addWidget( targetDevicePnl );

    detailesPnl = new QFrame( this, "detailesPnl" );
    detailesPnl->setGeometry( QRect( 321, 2, 477, 268 ) );//497
    detailesPnl->setFrameShape( QFrame::Panel );
    detailesPnl->setFrameShadow( QFrame::Raised );

    detailesPnlLayout = new QVBoxLayout( detailesPnl );
    detailesPnlLayout->setSpacing( 0 );
    detailesPnlLayout->setMargin( 1 );

   deatilesTab = new CdCopyDialogBaseTabs( detailesPnl, "deatilesTab" );

  //  deatilesTab->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)4, (QSizePolicy::SizeType)4, deatilesTab->sizePolicy().hasHeightForWidth() ) );
    deatilesTab->setMinimumSize( QSize( 490, 0 ) );
 deatilesTab->setBorder(false);
    //deatilesTab->setShape( QTabBar::RoundedAbove );
	deatilesTab->setShape( QTabBar::TriangularAbove );
	
	
    detailesTb = new QWidget( deatilesTab, "detailesTb" );
    detailesTbLayout = new QVBoxLayout( detailesTb ); 
    detailesTbLayout->setSpacing( 0 );
    detailesTbLayout->setMargin( 0 );


    detailsFrm = new QFrame( detailesTb, "detailsFrm" );
    detailsFrm->setMaximumSize( QSize( 32767, 2900 ) );
    detailsFrm->setFrameShape( QFrame::NoFrame );
    detailsFrm->setFrameShadow( QFrame::Plain );

    detailsFrm->setLineWidth( 1 );
    detailsFrmLayout = new QGridLayout( detailsFrm ); 
    detailsFrmLayout->setSpacing( 2 );
    detailsFrmLayout->setMargin( 5 );

    GroupBox6_2_2 = new QGroupBox( detailsFrm, "GroupBox6_2_2" );
    GroupBox6_2_2->setMinimumSize( QSize( 0, 0 ) );
    GroupBox6_2_2->setTitle( i18n( "Read Details" ) );
    QToolTip::add(  GroupBox6_2_2, i18n( "" ) );
    QWhatsThis::add(  GroupBox6_2_2, i18n( "Source CDROM read details." ) );
    GroupBox6_2_2->setColumnLayout(0, Qt::Vertical );
    GroupBox6_2_2->layout()->setSpacing( 0 );
    GroupBox6_2_2->layout()->setMargin( 0 );
    GroupBox6_2_2Layout = new QGridLayout( GroupBox6_2_2->layout() );
    GroupBox6_2_2Layout->setAlignment( Qt::AlignTop );
    GroupBox6_2_2Layout->setSpacing( 3 );
    GroupBox6_2_2Layout->setMargin( 7 );

    optionsBtn = new QPushButton( GroupBox6_2_2, "optionsBtn" );
    optionsBtn->setMinimumSize( QSize( 90, 30 ) );
    optionsBtn->setMaximumSize( QSize( 90, 30 ) );
    optionsBtn->setText( i18n( "&Options" ) );
    QToolTip::add(  optionsBtn, i18n( "Configure source CD read options" ) );

    GroupBox6_2_2Layout->addWidget( optionsBtn, 1, 3 );

    outputTypeChk = new QComboBox( FALSE, GroupBox6_2_2, "outputTypeChk" );
    outputTypeChk->insertItem( i18n( "ISO" ) );
    //outputTypeChk->insertItem( i18n( "BIN/CUE" ) );
    outputTypeChk->setInsertionPolicy( QComboBox::NoInsertion );
    outputTypeChk->setMinimumSize( QSize( 10, 30 ) );
    QToolTip::add(  outputTypeChk, i18n( "Output should be in " ) );

    GroupBox6_2_2Layout->addWidget( outputTypeChk, 0, 3 );

    removeTempBtn = new QCheckBox( GroupBox6_2_2, "removeTempBtn" );
    removeTempBtn->setText( i18n( "Remove temporary files" ) );
    QToolTip::add(  removeTempBtn, i18n( "When done, remove 'tracks' saved during copy process " ) );

    GroupBox6_2_2Layout->addMultiCellWidget( removeTempBtn, 1, 1, 0, 2 );

    readOnlyChk = new QCheckBox( GroupBox6_2_2, "readOnlyChk" );
    readOnlyChk->setText( i18n( "Read only" ) );
    QToolTip::add(  readOnlyChk, i18n( "Read only and don't burn anything" ) );

    GroupBox6_2_2Layout->addWidget( readOnlyChk, 0, 0 );

    TextLabel1 = new QLabel( GroupBox6_2_2, "TextLabel1" );
    TextLabel1->setMinimumSize( QSize( 100, 0 ) );
    TextLabel1->setText( i18n( "Output Format:" ) );

    GroupBox6_2_2Layout->addWidget( TextLabel1, 0, 2 );
    QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
    GroupBox6_2_2Layout->addItem( spacer, 0, 1 );

    detailsFrmLayout->addWidget( GroupBox6_2_2, 0, 1 );

    recordDetailesOnl = new QGroupBox( detailsFrm, "recordDetailesOnl" );
    recordDetailesOnl->setEnabled( TRUE );
    recordDetailesOnl->setTitle( i18n( "Recording Details" ) );
    QWhatsThis::add(  recordDetailesOnl, i18n( "Recording Details." ) );
    recordDetailesOnl->setColumnLayout(0, Qt::Vertical );
    recordDetailesOnl->layout()->setSpacing( 0 );
    recordDetailesOnl->layout()->setMargin( 0 );
    recordDetailesOnlLayout = new QHBoxLayout( recordDetailesOnl->layout() );
    recordDetailesOnlLayout->setAlignment( Qt::AlignTop );
    recordDetailesOnlLayout->setSpacing( 4 );
    recordDetailesOnlLayout->setMargin( 7 );

    actionCmb = new QComboBox( FALSE, recordDetailesOnl, "actionCmb" );
    actionCmb->insertItem( i18n( "Burn" ) );
    actionCmb->insertItem( i18n( "Test and Burn " ) );
    actionCmb->insertItem( i18n( "'Dummy' Write" ) );
    actionCmb->insertItem( i18n( "Copy on the Fly" ) );
    actionCmb->setMinimumSize( QSize( 145, 30 ) );
    actionCmb->setMaximumSize( QSize( 145, 30 ) );
    QToolTip::add(  actionCmb, i18n( "Choose the action to take" ) );
    recordDetailesOnlLayout->addWidget( actionCmb );
    QSpacerItem* spacer_2 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
    recordDetailesOnlLayout->addItem( spacer_2 );

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

    numberSpn = new QSpinBox( recordDetailesOnl, "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" ) );
    recordDetailesOnlLayout->addWidget( numberSpn );
    QSpacerItem* spacer_3 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
    recordDetailesOnlLayout->addItem( spacer_3 );

    customBurnBtn = new QPushButton( recordDetailesOnl, "customBurnBtn" );
    customBurnBtn->setMinimumSize( QSize( 90, 30 ) );
    customBurnBtn->setMaximumSize( QSize( 90, 30 ) );
    customBurnBtn->setText( i18n( "Custo&m" ) );
    QToolTip::add(  customBurnBtn, i18n( "Configure recording options" ) );
    recordDetailesOnlLayout->addWidget( customBurnBtn );

    detailsFrmLayout->addMultiCellWidget( recordDetailesOnl, 1, 1, 0, 1 );

    speedPnl = new SpeedPnl( detailsFrm, "speedPnl" );
    speedPnl->setMinimumSize( QSize( 400, 60 ) );
    speedPnl->setMaximumSize( QSize( 32767, 65 ) );

    detailsFrmLayout->addMultiCellWidget( speedPnl, 2, 2, 0, 1 );

    ButtonGroup17_2 = new QButtonGroup( detailsFrm, "ButtonGroup17_2" );
    ButtonGroup17_2->setMaximumSize( QSize( 100, 32767 ) );
    ButtonGroup17_2->setTitle( i18n( "Type of CD" ) );
    QWhatsThis::add(  ButtonGroup17_2, i18n( "Media type of the source CD" ) );
    ButtonGroup17_2->setColumnLayout(0, Qt::Vertical );
    ButtonGroup17_2->layout()->setSpacing( 0 );
    ButtonGroup17_2->layout()->setMargin( 0 );
    ButtonGroup17_2Layout = new QVBoxLayout( ButtonGroup17_2->layout() );
    ButtonGroup17_2Layout->setAlignment( Qt::AlignTop );
    ButtonGroup17_2Layout->setSpacing( 5 );
    ButtonGroup17_2Layout->setMargin( 6 );

    dataRBtn = new QRadioButton( ButtonGroup17_2, "dataRBtn" );
    dataRBtn->setMinimumSize( QSize( 0, 25 ) );
    dataRBtn->setText( i18n( "Data" ) );
    dataRBtn->setChecked( TRUE );
    ButtonGroup17_2Layout->addWidget( dataRBtn );

    musicRBtn = new QRadioButton( ButtonGroup17_2, "musicRBtn" );
    musicRBtn->setMinimumSize( QSize( 0, 25 ) );
    musicRBtn->setText( i18n( "Music" ) );
    QToolTip::add(  musicRBtn, i18n( "Copy audio CD, please use 'Audio Tracks Selection'" ) );
    ButtonGroup17_2Layout->addWidget( musicRBtn );

    detailsFrmLayout->addWidget( ButtonGroup17_2, 0, 0 );
    detailesTbLayout->addWidget( detailsFrm );
    deatilesTab->addTab( detailesTb, i18n( "Read/Write Details" ) );

    audioTb = new QWidget( deatilesTab, "audioTb" );
    audioTbLayout = new QVBoxLayout( audioTb );
    audioTbLayout->setSpacing( 4 );
    audioTbLayout->setMargin( 4 );

    trackView = new CdboCddaView( audioTb, "trackViewInCopy" );
	audioTbLayout->addWidget( trackView );
    deatilesTab->addTab( audioTb, i18n( "Audio Tracks Selection" ) );
    detailesPnlLayout->addWidget( deatilesTab );


    // signals and slots connections
    connect( customBurnBtn, SIGNAL( clicked() ), this, SLOT( customBtnSlot() ) );
    connect( optionsBtn, SIGNAL( clicked() ), this, SLOT( readOptionsBtnSlot() ) );
    connect( dataRBtn, SIGNAL( clicked() ), this, SLOT( dataSlot() ) );
    connect( musicRBtn, SIGNAL( clicked() ), this, SLOT( musicSlot() ) );

}

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

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

void CdCopyDialogBase::dataSlot()
{
    qWarning( "CdCopyDialogBase::dataSlot(): Not implemented yet!" );
}

void CdCopyDialogBase::musicSlot()
{
    qWarning( "CdCopyDialogBase::musicSlot(): Not implemented yet!" );
}
void CdCopyDialogBase::readOptionsBtnSlot()
{
    qWarning( "CdCopyDialogBase::readOptionsBtnSlot(): Not implemented yet!" );
}
//================================================
CdCopyDialogBaseTabs::CdCopyDialogBaseTabs( QWidget* parent, const char* name):KTabCtl(parent, name){
}
