/***************************************************************************
                          channelwidgetimpl.h  -  description
                             -------------------
    begin                : Wed Jun 12 2002
    copyright            : (C) 2002 by Kevin Hessels
    email                : khessels@shaw.ca
 ***************************************************************************/

/***************************************************************************
 *                                                                         *
 *   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 CHANNELWIDGETIMPL_H
#define CHANNELWIDGETIMPL_H

#include <qlistview.h>

#include "channelstore.h"
#include "channelwidget.h"

class QtVision;
class Channel;

/**
  *@author Kevin Hessels
  */

class ChannelListViewItem : public QObject, public QCheckListItem
{
Q_OBJECT
public:
    ChannelListViewItem(KListView *, Channel*);
    ~ChannelListViewItem();

    int compare(QListViewItem *, int, bool) const;

    int rtti() const;

    Channel *c;

public slots:
    void updateFields();
};


/***************************************************************************/


class ChannelWidgetImpl : public ChannelWidget
{

Q_OBJECT

public:
    ChannelWidgetImpl(QWidget *, QtVision *);
    ~ChannelWidgetImpl();

    void updateChannels();

private:
    void createChannelList(ChannelStore *);

    void setItemInEditor( ChannelListViewItem * );
    ChannelListViewItem *getItemInEditor();

    ChannelListViewItem *itemInEditor;
    ChannelStore *cs;
    QtVision *qtv;

private slots:
    void slotListItemClicked();
    void slotAutoscanClicked();
    void slotRenumberClicked();
    void slotNewClicked();
    void slotChangeChannel();
    void slotEditClicked();
    void slotRenameClicked();
    void slotRemoveClicked();
    void slotMoveUpClicked();
    void slotMoveDownClicked();
    void slotRenameItem(QListViewItem*);
    void slotFreqUpdate( unsigned long freq );
};

#endif
