Skip to content
Snippets Groups Projects
Commit 525c382e authored by Emmanuel Lepage Vallee's avatar Emmanuel Lepage Vallee
Browse files

[ #48205 ] Add device configuration widget skeleton

parent e0d38a6f
No related branches found
No related tags found
No related merge requests found
......@@ -67,7 +67,8 @@ bool VideoDeviceModel::setData(const QModelIndex& idx, const QVariant &value, in
///Constructor
VideoDeviceModel::VideoDeviceModel() : QAbstractListModel(QCoreApplication::instance()),
m_pResolutionModel(nullptr),m_pChannelModel(nullptr),m_pRateModel(nullptr)
m_pResolutionModel(nullptr),m_pChannelModel(nullptr),m_pRateModel(nullptr),
m_pDummyDevice(nullptr)
{
connect(this ,SIGNAL(changed()) , channelModel () , SLOT(reload()));
connect(channelModel() ,SIGNAL(changed()) , resolutionModel() , SLOT(reload()));
......@@ -155,7 +156,18 @@ VideoDevice* VideoDeviceModel::activeDevice() const
const QString deId = interface.getActiveDevice();
if (!m_lDevices.size())
const_cast<VideoDeviceModel*>(this)->reload();
return m_hDevices[deId];
VideoDevice* dev = m_hDevices[deId];
//Handling null everywhere is too long, better create a dummy device and
//log the event
if (!dev) {
if (!deId.isEmpty())
qWarning() << "Requested unknown device" << deId;
if (!m_pDummyDevice)
const_cast<VideoDeviceModel*>(this)->m_pDummyDevice = new VideoDevice("None");
return m_pDummyDevice;
}
return dev;
}
......
......@@ -112,6 +112,12 @@ Q_DECLARE_METATYPE(VideoDeviceChannelModel*)
class LIB_EXPORT ExtendedVideoDeviceModel : public QAbstractListModel {
Q_OBJECT
public:
enum ExtendedDeviceList {
NONE ,
SCREEN ,
FILE ,
__COUNT
};
QVariant data ( const QModelIndex& index, int role = Qt::DisplayRole ) const;
int rowCount ( const QModelIndex& parent = QModelIndex() ) const;
Qt::ItemFlags flags ( const QModelIndex& index ) const;
......@@ -120,12 +126,6 @@ public:
//Singleton
static ExtendedVideoDeviceModel* instance();
private:
enum ExtendedDeviceList {
NONE ,
SCREEN ,
FILE ,
__COUNT
};
struct Display {
Display() : res("0x0"),point(0,0),index(0){}
Resolution res ; /* Resolution 0x0 for native */
......@@ -215,6 +215,7 @@ private:
VideoDeviceResolutionModel* m_pResolutionModel;
VideoDeviceChannelModel* m_pChannelModel ;
VideoDeviceRateModel* m_pRateModel ;
VideoDevice* m_pDummyDevice ;
public Q_SLOTS:
void setActive(const QModelIndex& idx);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment