/***************************************************************************
                          RippAudioDialogBase.cpp  -  description
                             -------------------
    begin                : Mon Feb 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 "RippAudioDialogBase.h"
#include "RippAudioDialogBase.moc"

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

#include "../audio/CdboCddaView.h"
#include "dialogParts/DialogCntPnl.h"
#include "dialogParts/DriveInfoPnl.h"


//=====================================================================
RippAudioDialogBase::RippAudioDialogBase( QWidget* parent,  const char* name, bool modal, WFlags fl )
    : QDialog( parent, name, modal, fl )
{
    if ( !name )
	setName( "RippAudioDialogBase" );
    resize( 766, 535 );
    setMinimumSize( QSize( 766, 535 ) );
    setMaximumSize( QSize( 766, 535 ) );
    setCaption( i18n( "Rip (Read) Audio CD - CD Bake Oven" ) );
    RippAudioDialogBaseLayout = new QGridLayout( this );
    RippAudioDialogBaseLayout->setSpacing( 0 );
    RippAudioDialogBaseLayout->setMargin( 0 );

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

    srcDevicePnl = new DriveInfoPnl( Frame5, "srcDevicePnl" );
    srcDevicePnl->setMinimumSize( QSize( 310, 128 ) );
    srcDevicePnl->setMaximumSize( QSize( 3500, 134 ) );

    Frame5Layout->addWidget( srcDevicePnl, 0, 0 );

    detailsPnl = new QGroupBox( Frame5, "detailsPnl" );
    detailsPnl->setMinimumSize( QSize( 0, 0 ) );
    detailsPnl->setMaximumSize( QSize( 3500, 115 ) );
    detailsPnl->setTitle( i18n( "Output Details" ) );
    QWhatsThis::add(  detailsPnl, i18n( "Output Details" ) );
    detailsPnl->setColumnLayout(0, Qt::Vertical );
    detailsPnl->layout()->setSpacing( 0 );
    detailsPnl->layout()->setMargin( 0 );
    detailsPnlLayout = new QGridLayout( detailsPnl->layout() );
    detailsPnlLayout->setAlignment( Qt::AlignTop );
    detailsPnlLayout->setSpacing( 6 );
    detailsPnlLayout->setMargin( 11 );

    outputDirLbl = new QLabel( detailsPnl, "outputDirLbl" );
    outputDirLbl->setFrameShape( QLabel::Box );
    outputDirLbl->setFrameShadow( QLabel::Raised );
    outputDirLbl->setText( i18n( "" ) );
    QToolTip::add(  outputDirLbl, i18n( "Output directory" ) );

    detailsPnlLayout->addMultiCellWidget( outputDirLbl, 1, 1, 0, 1 );

    imageBrowseBtn = new QPushButton( detailsPnl, "imageBrowseBtn" );
    imageBrowseBtn->setMinimumSize( QSize( 30, 30 ) );
    imageBrowseBtn->setMaximumSize( QSize( 30, 30 ) );
    imageBrowseBtn->setText( i18n( "..." ) );

    detailsPnlLayout->addWidget( imageBrowseBtn, 1, 2 );

    fileFormatCmb = new QComboBox( FALSE, detailsPnl, "fileFormatCmb" );
    fileFormatCmb->insertItem( "Ogg-Vorbis (.ogg)" );
    fileFormatCmb->insertItem( "MP3 (.mp3)" );
    fileFormatCmb->insertItem( "Wave (.wav)" );
    fileFormatCmb->insertItem( "Raw (headerless) (.cda)" );
    //fileFormatCmb->insertItem( "Apple/SGI (.aiff)" );


    fileFormatCmb->setMinimumSize( QSize( 150, 30 ) );
    QToolTip::add(  fileFormatCmb, i18n( "Select the output format" ) );
    QWhatsThis::add(  fileFormatCmb, i18n( "Select the file output format" ) );

    detailsPnlLayout->addMultiCellWidget( fileFormatCmb, 0, 0, 1, 2 );

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

    detailsPnlLayout->addWidget( TextLabel1, 0, 0 );

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

    RippAudioDialogBaseLayout->addWidget( Frame5, 0, 0 );
//////////
	tracksPnl = new QFrame( this, "tracksPnl" );
    tracksPnl->setMinimumSize( QSize( 420, 250 ) );
    tracksPnl->setMaximumSize( QSize( 450, 32767 ) );
    tracksPnl->setFrameShape( QFrame::StyledPanel );
    tracksPnl->setFrameShadow( QFrame::Raised );
    tracksPnlLayout = new QVBoxLayout( tracksPnl );
    tracksPnlLayout->setSpacing( 6 );
    tracksPnlLayout->setMargin( 7 );
/*
    tracksView = new QListView( tracksPnl, "tracksView" );
    tracksView->addColumn( i18n( "Column 1" ) );
    QListViewItem * item = new QListViewItem( tracksView, 0 );
    item->setText( 0, i18n( "New Item" ) );*/
//////////
	trackView = new CdboCddaView( tracksPnl, "trackViewInCopy" );
    tracksPnlLayout->addWidget( trackView );

    RippAudioDialogBaseLayout->addWidget( tracksPnl, 0, 1 );

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

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

    // signals and slots connections
    connect( imageBrowseBtn, SIGNAL( clicked() ), this, SLOT( isoBrowseSlot() ) );

}

//===========================================================
RippAudioDialogBase::~RippAudioDialogBase(){
}
//=================================================================
void RippAudioDialogBase::isoBrowseSlot(){
    qWarning( "RippAudioDialogBase::isoBrowseSlot(): Not implemented yet!" );
}

