/***************************************************************************
                          NewAudioCdDialog.h  -  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.                                   *
 *                                                                         *
 ***************************************************************************/
#ifndef NEWAUDIOCDDIALOG_H
#define NEWAUDIOCDDIALOG_H

#include <qwidget.h>
#include <qstring.h>
#include <qevent.h>

#include <kconfig.h>

#include "NewAudioCdDialogBase.h"
#include "CdboDialogBase.h"
#include "CdboDialogActionFactory.h"
#include "dialogParts/DriveInfoPnl.h"
#include "dialogParts/SpeedPnl.h"
#include "dialogParts/DialogCntPnl.h"

class KProcess;

class NewAudioCdDialog : public NewAudioCdDialogBase, public CdboDialogBase  {
 Q_OBJECT

public:
	NewAudioCdDialog(QStringList *flist, QWidget *parent, const char *name) ;
	~NewAudioCdDialog();
	
	//implementing pure virtuals
	virtual void blockBtns(bool) const;
	virtual QString getActionType() const;
	
	inline virtual void output(int type, QString message) const { dialogCntPnl->output(type, message); }
	virtual void status(QString message) const { dialogCntPnl->status(message); }
	
	inline virtual QString getScsiDevice() const { return targetDevicePnl->getScsiDevice(); }
	inline virtual QString getSpeed() const { return speedPnl->getSpeed(); }
	inline virtual void setProcessType(int type) const { dialogCntPnl->setProcessType(type); }
	inline virtual void setTotalProcesses(int type) const { dialogCntPnl->setTotalProcesses(type); }
	
public slots:
	void readOptions();

protected slots:
	virtual void closeEvent(QCloseEvent *e);
	
	void taskDone(bool);
	void taskFailedToStart();

    void startBtnSlot();
    void quitSlot();
    void detectDestSlot();
    void settingsSlot();
    void cancelSlot();
    void eraseSlot();
    void cancelledByUser();

    virtual void customBtnSlot();

	virtual void keyPressEvent(QKeyEvent *e);
	void kcmshellDone(KProcess *proc);

private:
	void init();
	void cleanUp();
	void blockActionBtns(bool);
	
	void startBurn();
	
	//bool createImageOnly;
	//bool createImage;
	//bool createOnTheFly;
	
	bool stillDecoding;
	bool stillChecking;
	bool stillBurning;
	//bool stillCreatingOnTheFly;
	
	int copiesWanted;
	int copiesDone;
	
	QString imageAddr;
	QStringList *fileList;
	QStringList tmpList;
	QStringList tracksList;
	
	KConfig *config;
	CdboDialogActionFactory *factory;
	
	//methods
	void saveOptions();
	void initBtns();
	bool confermExit();
};
#endif
