qv4l2: correctly disable two menu items
authorAnton Arbring <aarbring@cisco.com>
Thu, 3 Jul 2014 12:00:04 +0000 (14:00 +0200)
committerHans Verkuil <hans.verkuil@cisco.com>
Thu, 3 Jul 2014 12:30:52 +0000 (14:30 +0200)
The "Save Raw Frames" menu item should be disabled if no video device is open,
the "Use OpenGL Rendering" menu item should be disabled if streaming is in
progress.

Signed-off-by: Anton Arbring <aarbring@cisco.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
utils/qv4l2/qv4l2.cpp

index 6994469..5072636 100644 (file)
@@ -254,6 +254,8 @@ void ApplicationWindow::setDevice(const QString &device, bool rawOpen)
        m_tabs->setFocus();
        m_convertData = v4lconvert_create(fd());
        m_capStartAct->setEnabled(fd() >= 0);
+       m_saveRawAct->setEnabled(fd() >= 0);
+       m_useGLAct->setEnabled(CaptureWinGL::isSupported());
        m_ctrlNotifier = new QSocketNotifier(fd(), QSocketNotifier::Exception, m_tabs);
        connect(m_ctrlNotifier, SIGNAL(activated(int)), this, SLOT(ctrlEvent()));
 }
@@ -695,6 +697,8 @@ bool ApplicationWindow::startCapture(unsigned buffer_size)
 
        memset(&req, 0, sizeof(req));
 
+       m_useGLAct->setEnabled(false);
+
        switch (m_capMethod) {
        case methodRead:
                m_snapshotAct->setEnabled(true);
@@ -846,6 +850,7 @@ bool ApplicationWindow::startCapture(unsigned buffer_size)
 
 error:
        m_capStartAct->setChecked(false);
+       m_useGLAct->setEnabled(CaptureWinGL::isSupported());
        return false;
 }
 
@@ -863,6 +868,7 @@ void ApplicationWindow::stopCapture()
 
        m_capture->stop();
        m_snapshotAct->setDisabled(true);
+       m_useGLAct->setEnabled(CaptureWinGL::isSupported());
        switch (m_capMethod) {
        case methodRead:
                memset(&cmd, 0, sizeof(cmd));
@@ -1167,6 +1173,7 @@ void ApplicationWindow::closeDevice()
        m_sigMapper = NULL;
        m_capStartAct->setEnabled(false);
        m_capStartAct->setChecked(false);
+       m_saveRawAct->setEnabled(false);
        if (fd() >= 0) {
                if (m_capNotifier) {
                        delete m_capNotifier;