/***************************************************************************
                          devicewidgetimpl.h  -  description
                             -------------------
    begin                : Mon Jun 3 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 DEVICEWIDGETIMPL_H
#define DEVICEWIDGETIMPL_H

#include <devicewidget.h>

#include "pluginfactory.h"

class ConfigData;
class QtVision;


/**
  *@author Kevin Hessels
  */

class DeviceWidgetImpl : public DeviceWidget
{
Q_OBJECT

public: 
	DeviceWidgetImpl(QWidget *, ConfigData*, QtVision *);
	~DeviceWidgetImpl();

    /** set QtVision object to contain the currently selected device */
    void device(QtVision *);
    /** Update the dialog to display the currently selected device, if it exists */
    void setCurrentDevice();
    bool deviceChanged();

    enum RegionNPS
    {
        region_ntsc = 1,
        region_pal = 2,
        region_pal_60 = 3,
        region_secam = 4
    };

protected slots:
    void slotChangeSources(const QString &);

private:
    void scanDevices();
    void updateRegionStatus();
    bool deviceIsTuner(const QString &);


    typedef QMap<PluginDesc,QStringList> DeviceMap;
    typedef QMap<QString,QStringList> SourceMap;

    QMap<QString,bool> _devTuner;
    QMap<QString,bool> _devNeedsNorm;

    DeviceMap _devs;
    SourceMap _srcs;

    QtVision *_qtv;
    ConfigData *_cfg;
    bool _devChanged, _srcChanged;

private slots:
    void slotDeviceChanged();
    void slotSourceChanged();
};

#endif
