/***************************************************************************
 *   Copyright (C) 2005 by James Thorniley                                 *
 *   james@uncommonlygood.co.uk                                            *
 *                                                                         *
 *   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.                                   *
 *                                                                         *
 *   This program is distributed in the hope that it will be useful,       *
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
 *   GNU General Public License for more details.                          *
 *                                                                         *
 *   You should have received a copy of the GNU General Public License     *
 *   along with this program; if not, write to the                         *
 *   Free Software Foundation, Inc.,                                       *
 *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
 ***************************************************************************/
#ifndef BURNAUDIOCDCONFIGWIDGET_H
#define BURNAUDIOCDCONFIGWIDGET_H

#include <qframe.h>
#include "burnk3bdoccreator.h"
#include <kfileitem.h>
#include <qmap.h>
#include <qptrlist.h>
#include <qvaluelist.h>

class KListView;
class QLabel;
class QWidgetStack;
class KURL;
class KListViewItem;
class BurnSidebarPlugin;
class QTimer;
class K3bPlugin;

/**
@author James Thorniley
*/
class BurnAudioCDConfigWidget : public QFrame, public BurnK3bDocCreator
{
  Q_OBJECT
  public:
    BurnAudioCDConfigWidget(BurnSidebarPlugin *plugin, QWidget *parent = 0, const char *name = 0);

    virtual ~BurnAudioCDConfigWidget();

    virtual K3bDoc *k3bDoc();

  private slots:
    void initPlaylist();

    void slotNewItems( const KFileItemList &newItems );
    void slotDeleteItem( KFileItem *item );
    void slotRefreshItems( const KFileItemList & );

    void slotMoved();

    void slotTimeout();

  private:
    QValueList<KURL> *m_savedItems;
    QTimer *m_timer;
    QLabel *m_emptyLabel;
    QWidgetStack *m_widgetStack;
    KListView *m_playlistView;
    BurnSidebarPlugin *m_plugin;
    QMap<KFileItem*,KListViewItem*> *m_playlistMap;

    /**Adds an item to the playlist view representing \p item if is it an audio
    file in the root directory of burn:/
    */
    void addFile( KFileItem *item  );
};

#endif
