qv4l2: added titles and moved settings
authorAnton Arbring <aarbring@cisco.com>
Fri, 11 Jul 2014 07:51:16 +0000 (09:51 +0200)
committerHans Verkuil <hans.verkuil@cisco.com>
Fri, 11 Jul 2014 10:08:47 +0000 (12:08 +0200)
Sorting related settings by type and adding titles for
explanation and structure.

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

index fb3c027..4235c2e 100644 (file)
@@ -147,6 +147,21 @@ void ApplicationWindow::addTabs(int size[])
                vbox->addWidget(w);
 
                QGridLayout *grid = new QGridLayout(w);
+               if((char *)qctrl.name) {
+                       QLabel *title_tab = new QLabel((char *)qctrl.name, parentWidget());
+                       QFont f = title_tab->font();
+                       f.setBold(true);
+                       title_tab->setFont(f);
+                       grid->addWidget(title_tab, m_row, m_col, 1, m_cols, Qt::AlignLeft);
+                       grid->setRowMinimumHeight(m_row, 25);
+                       m_row++;
+
+                       QFrame *m_line = new QFrame(grid->parentWidget());
+                       m_line->setFrameShape(QFrame::HLine);
+                       m_line->setFrameShadow(QFrame::Sunken);
+                       grid->addWidget(m_line, m_row, m_col, 1, m_cols, Qt::AlignVCenter);
+                       m_row++;
+               }
                m_tabs->addTab(t, (char *)qctrl.name);
                for (i = 0; i < iter->second.size(); i++) {
                        if (i & 1)
index 16feb2c..ab0277d 100644 (file)
@@ -108,6 +108,8 @@ GeneralTab::GeneralTab(const QString &device, v4l2 &fd, int n, QWidget *parent)
 
 
        if (querycap(m_querycap)) {
+               addTitle("General Information");
+
                addLabel("Device:");
                addLabel(device + (useWrapper() ? " (wrapped)" : ""));
 
@@ -126,6 +128,10 @@ GeneralTab::GeneralTab(const QString &device, v4l2 &fd, int n, QWidget *parent)
        g_modulator(m_modulator);
 
        v4l2_input vin;
+       v4l2_output vout;
+       v4l2_audio vaudio;
+       v4l2_audioout vaudout;
+       v4l2_fmtdesc fmt;
        bool needsStd = false;
        bool needsTimings = false;
 
@@ -162,6 +168,9 @@ GeneralTab::GeneralTab(const QString &device, v4l2 &fd, int n, QWidget *parent)
        m_stackedFrameSettings = new QStackedWidget;
        m_stackedFrequency = new QStackedWidget;
 
+       if (enum_input(vin, true) || m_tuner.capability)
+               addTitle("Input Settings");
+
        if (!isRadio() && enum_input(vin, true)) {
                addLabel("Input");
                m_videoInput = new QComboBox(parent);
@@ -225,41 +234,6 @@ GeneralTab::GeneralTab(const QString &device, v4l2 &fd, int n, QWidget *parent)
        QGridLayout::addWidget(m_stackedStandards, m_row, 0, 1, m_cols, Qt::AlignVCenter);
        m_row++;
 
-       QWidget *wFrameWH = new QWidget();
-       QWidget *wFrameSR = new QWidget();
-       QGridLayout *m_wh = new QGridLayout(wFrameWH);
-       QGridLayout *m_sr = new QGridLayout(wFrameSR);
-       m_grids.append(m_wh);
-       m_grids.append(m_sr);
-
-       m_wh->addWidget(new QLabel("Frame Width", parentWidget()), 0, 0, Qt::AlignLeft);
-       m_frameWidth = new QSpinBox(parent);
-       m_wh->addWidget(m_frameWidth, 0, 1, Qt::AlignLeft);
-       connect(m_frameWidth, SIGNAL(editingFinished()), SLOT(frameWidthChanged()));
-
-       m_wh->addWidget(new QLabel("Frame Height", parentWidget()), 0, 2, Qt::AlignLeft);
-       m_frameHeight = new QSpinBox(parent);
-       m_wh->addWidget(m_frameHeight, 0, 3, Qt::AlignLeft);
-       connect(m_frameHeight, SIGNAL(editingFinished()), SLOT(frameHeightChanged()));
-
-       m_sr->addWidget(new QLabel("Frame Size", parentWidget()), 0, 0, Qt::AlignLeft);
-       m_frameSize = new QComboBox(parent);
-       m_frameSize->setSizeAdjustPolicy(QComboBox::AdjustToContents);
-       m_sr->addWidget(m_frameSize, 0, 1, Qt::AlignLeft);
-       connect(m_frameSize, SIGNAL(activated(int)), SLOT(frameSizeChanged(int)));
-
-       m_sr->addWidget(new QLabel("Frame Rate", parentWidget()), 0, 2, Qt::AlignLeft);
-       m_frameInterval = new QComboBox(parent);
-       m_frameInterval->setSizeAdjustPolicy(QComboBox::AdjustToContents);
-       m_sr->addWidget(m_frameInterval, 0, 3, Qt::AlignLeft);
-       connect(m_frameInterval, SIGNAL(activated(int)), SLOT(frameIntervalChanged(int)));
-
-       m_stackedFrameSettings->addWidget(wFrameWH);
-       m_stackedFrameSettings->addWidget(wFrameSR);
-
-       QGridLayout::addWidget(m_stackedFrameSettings, m_row, 0, 1, m_cols, Qt::AlignVCenter);
-       m_row++;
-
        QWidget *wFreq = new QWidget();
        QGridLayout *m_freqRows = new QGridLayout(wFreq);
        m_grids.append(m_freqRows);
@@ -316,12 +290,148 @@ GeneralTab::GeneralTab(const QString &device, v4l2 &fd, int n, QWidget *parent)
        QGridLayout::addWidget(m_stackedFrequency, m_row, 0, 2, m_cols, Qt::AlignVCenter);
        m_row += 2;
 
+       QWidget *wFrameWH = new QWidget();
+       QWidget *wFrameSR = new QWidget();
+       QGridLayout *m_wh = new QGridLayout(wFrameWH);
+       QGridLayout *m_sr = new QGridLayout(wFrameSR);
+       m_grids.append(m_wh);
+       m_grids.append(m_sr);
+
+       m_wh->addWidget(new QLabel("Frame Width", parentWidget()), 0, 0, Qt::AlignLeft);
+       m_frameWidth = new QSpinBox(parent);
+       m_wh->addWidget(m_frameWidth, 0, 1, Qt::AlignLeft);
+       connect(m_frameWidth, SIGNAL(editingFinished()), SLOT(frameWidthChanged()));
+
+       m_wh->addWidget(new QLabel("Frame Height", parentWidget()), 0, 2, Qt::AlignLeft);
+       m_frameHeight = new QSpinBox(parent);
+       m_wh->addWidget(m_frameHeight, 0, 3, Qt::AlignLeft);
+       connect(m_frameHeight, SIGNAL(editingFinished()), SLOT(frameHeightChanged()));
+
+       m_sr->addWidget(new QLabel("Frame Size", parentWidget()), 0, 0, Qt::AlignLeft);
+       m_frameSize = new QComboBox(parent);
+       m_frameSize->setSizeAdjustPolicy(QComboBox::AdjustToContents);
+       m_sr->addWidget(m_frameSize, 0, 1, Qt::AlignLeft);
+       connect(m_frameSize, SIGNAL(activated(int)), SLOT(frameSizeChanged(int)));
+
+       m_sr->addWidget(new QLabel("Frame Rate", parentWidget()), 0, 2, Qt::AlignLeft);
+       m_frameInterval = new QComboBox(parent);
+       m_frameInterval->setSizeAdjustPolicy(QComboBox::AdjustToContents);
+       m_sr->addWidget(m_frameInterval, 0, 3, Qt::AlignLeft);
+       connect(m_frameInterval, SIGNAL(activated(int)), SLOT(frameIntervalChanged(int)));
+
+       m_stackedFrameSettings->addWidget(wFrameWH);
+       m_stackedFrameSettings->addWidget(wFrameSR);
+
+       QGridLayout::addWidget(m_stackedFrameSettings, m_row, 0, 1, m_cols, Qt::AlignVCenter);
+       m_row++;
+
+       if (m_tuner_rf.capability || m_modulator.capability || (!isRadio() && enum_output(vout, true))) {
+               addTitle("Output Settings");
+
+               if (!isRadio() && enum_output(vout, true)) {
+                       addLabel("Output");
+                       m_videoOutput = new QComboBox(parent);
+                       do {
+                               m_videoOutput->addItem((char *)vout.name);
+                       } while (enum_output(vout));
+                       addWidget(m_videoOutput);
+                       connect(m_videoOutput, SIGNAL(activated(int)), SLOT(outputChanged(int)));
+                       updateVideoOutput();
+               }
+
+               if (m_isOutput) {
+                       addLabel("Output Image Formats");
+                       m_vidOutFormats = new QComboBox(parent);
+                       m_vidOutFormats->setMinimumContentsLength(20);
+                       if (enum_fmt(fmt, m_buftype, true)) {
+                               do {
+                                       m_vidOutFormats->addItem(pixfmt2s(fmt.pixelformat) +
+                                               " - " + (const char *)fmt.description);
+                               } while (enum_fmt(fmt, m_buftype));
+                       }
+                       addWidget(m_vidOutFormats);
+                       connect(m_vidOutFormats, SIGNAL(activated(int)), SLOT(vidOutFormatChanged(int)));
+               }
+
+
+               if (m_tuner_rf.capability) {
+                       const char *unit = (m_tuner_rf.capability & V4L2_TUNER_CAP_LOW) ? " kHz" :
+                               (m_tuner_rf.capability & V4L2_TUNER_CAP_1HZ ? " Hz" : " MHz");
+
+                       m_freqRfFac = (m_tuner_rf.capability & V4L2_TUNER_CAP_1HZ) ? 1 : 16;
+                       m_freqRf = new QDoubleSpinBox(parent);
+                       m_freqRf->setMinimum(m_tuner_rf.rangelow / m_freqRfFac);
+                       m_freqRf->setMaximum(m_tuner_rf.rangehigh / m_freqRfFac);
+                       m_freqRf->setSingleStep(1.0 / m_freqRfFac);
+                       m_freqRf->setSuffix(unit);
+                       m_freqRf->setDecimals((m_tuner_rf.capability & V4L2_TUNER_CAP_1HZ) ? 0 : 4);
+                       m_freqRf->setWhatsThis(QString("RF Frequency\nLow: %1 %3\nHigh: %2 %3")
+                                           .arg((double)m_tuner_rf.rangelow / m_freqRfFac, 0, 'f', 2)
+                                           .arg((double)m_tuner_rf.rangehigh / m_freqRfFac, 0, 'f', 2)
+                                           .arg(unit));
+                       m_freqRf->setStatusTip(m_freqRf->whatsThis());
+                       connect(m_freqRf, SIGNAL(valueChanged(double)), SLOT(freqRfChanged(double)));
+                       updateFreqRf();
+                       addLabel("RF Frequency");
+                       addWidget(m_freqRf);
+               }
+
+               if (m_modulator.capability) {
+                       const char *unit = (m_modulator.capability & V4L2_TUNER_CAP_LOW) ? " kHz" :
+                               (m_modulator.capability & V4L2_TUNER_CAP_1HZ ? " Hz" : " MHz");
+
+                       m_freqFac = (m_modulator.capability & V4L2_TUNER_CAP_1HZ) ? 1 : 16;
+                       m_freq = new QDoubleSpinBox(parent);
+                       m_freq->setMinimum(m_modulator.rangelow / m_freqFac);
+                       m_freq->setMaximum(m_modulator.rangehigh / m_freqFac);
+                       m_freq->setSingleStep(1.0 / m_freqFac);
+                       m_freq->setSuffix(unit);
+                       m_freq->setDecimals((m_modulator.capability & V4L2_TUNER_CAP_1HZ) ? 0 : 4);
+                       m_freq->setWhatsThis(QString("Frequency\nLow: %1 %3\nHigh: %2 %3")
+                                           .arg((double)m_modulator.rangelow / m_freqFac, 0, 'f', 2)
+                                           .arg((double)m_modulator.rangehigh / m_freqFac, 0, 'f', 2)
+                                           .arg(unit));
+                       m_freq->setStatusTip(m_freq->whatsThis());
+                       connect(m_freq, SIGNAL(valueChanged(double)), SLOT(freqChanged(double)));
+                       updateFreq();
+                       addLabel("Frequency");
+                       addWidget(m_freq);
+               }
+               if (m_modulator.capability && !isSDR()) {
+                       if (m_modulator.capability & V4L2_TUNER_CAP_STEREO) {
+                               addLabel("Stereo");
+                               m_stereoMode = new QCheckBox(parent);
+                               m_stereoMode->setCheckState((m_modulator.txsubchans & V4L2_TUNER_SUB_STEREO) ?
+                                               Qt::Checked : Qt::Unchecked);
+                               addWidget(m_stereoMode);
+                               connect(m_stereoMode, SIGNAL(clicked()), SLOT(stereoModeChanged()));
+                       }
+                       if (m_modulator.capability & V4L2_TUNER_CAP_RDS) {
+                               addLabel("RDS");
+                               m_rdsMode = new QCheckBox(parent);
+                               m_rdsMode->setCheckState((m_modulator.txsubchans & V4L2_TUNER_SUB_RDS) ?
+                                               Qt::Checked : Qt::Unchecked);
+                               addWidget(m_rdsMode);
+                               connect(m_rdsMode, SIGNAL(clicked()), SLOT(rdsModeChanged()));
+                       }
+               }
+       }
+
+       if (isVbi())
+               goto format;
+
        if (hasAlsaAudio()) {
                m_audioInDevice = new QComboBox(parent);
                m_audioOutDevice = new QComboBox(parent);
                m_audioInDevice->setSizeAdjustPolicy(QComboBox::AdjustToContents);
                m_audioOutDevice->setSizeAdjustPolicy(QComboBox::AdjustToContents);
+       }
+
+       if (createAudioDeviceList() || (!isRadio() && enum_audio(vaudio, true)) ||
+           (!isSDR() && m_tuner.capability) || (!isRadio() && enum_audout(vaudout, true)))
+               addTitle("Audio Settings");
 
+       if (hasAlsaAudio()) {
                if (createAudioDeviceList()) {
                        addLabel("Audio Input Device");
                        connect(m_audioInDevice, SIGNAL(activated(int)), SLOT(changeAudioDevice()));
@@ -351,142 +461,6 @@ GeneralTab::GeneralTab(const QString &device, v4l2 &fd, int n, QWidget *parent)
                }
        }
 
-       if (!isRadio() && !isVbi()) {
-               m_pixelAspectRatio = new QComboBox(parent);
-               m_pixelAspectRatio->addItem("Autodetect");
-               m_pixelAspectRatio->addItem("Square");
-               m_pixelAspectRatio->addItem("NTSC/PAL-M/PAL-60");
-               m_pixelAspectRatio->addItem("NTSC/PAL-M/PAL-60, Anamorphic");
-               m_pixelAspectRatio->addItem("PAL/SECAM");
-               m_pixelAspectRatio->addItem("PAL/SECAM, Anamorphic");
-
-               // Update hints by calling a get
-               getPixelAspectRatio();
-
-               addLabel("Pixel Aspect Ratio");
-               addWidget(m_pixelAspectRatio);
-               connect(m_pixelAspectRatio, SIGNAL(activated(int)), SLOT(changePixelAspectRatio()));
-
-               m_cropping = new QComboBox(parent);
-               m_cropping->addItem("None");
-               m_cropping->addItem("Top and Bottom Line");
-               m_cropping->addItem("Widescreen 14:9 (Letterbox)");
-               m_cropping->addItem("Widescreen 16:9 (Letterbox)");
-               m_cropping->addItem("Cinema 1.85:1 (Letterbox)");
-               m_cropping->addItem("Cinema 2.39:1 (Letterbox)");
-               m_cropping->addItem("Traditional 4:3 (Pillarbox)");
-
-               addLabel("Cropping");
-               addWidget(m_cropping);
-               connect(m_cropping, SIGNAL(activated(int)), SIGNAL(croppingChanged()));
-
-#ifdef HAVE_QTGL
-               m_colorspace = new QComboBox(parent);
-               m_colorspace->addItem("Autodetect");
-               m_colorspace->addItem("SMPTE 170M");
-               m_colorspace->addItem("SMPTE 240M");
-               m_colorspace->addItem("REC 709");
-               m_colorspace->addItem("470 System M");
-               m_colorspace->addItem("470 System BG");
-               m_colorspace->addItem("sRGB");
-
-               addLabel("Colorspace");
-               addWidget(m_colorspace);
-               connect(m_colorspace, SIGNAL(activated(int)), SIGNAL(colorspaceChanged()));
-
-               m_displayColorspace = new QComboBox(parent);
-               m_displayColorspace->addItem("sRGB");
-               m_displayColorspace->addItem("Linear RGB");
-               m_displayColorspace->addItem("REC 709");
-               m_displayColorspace->addItem("SMPTE 240M");
-
-               addLabel("Display Colorspace");
-               addWidget(m_displayColorspace);
-               connect(m_displayColorspace, SIGNAL(activated(int)), SIGNAL(displayColorspaceChanged()));
-#endif
-
-               if (!m_isOutput && has_crop()) {
-                       m_cropWidth = new QSlider(Qt::Horizontal, parent);
-                       m_cropWidth->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Minimum);
-                       m_cropWidth->setRange(1, 100);
-                       m_cropWidth->setSliderPosition(100);
-                       addLabel("Crop Width");
-                       addWidget(m_cropWidth);
-                       connect(m_cropWidth, SIGNAL(valueChanged(int)), SLOT(cropChanged()));
-
-                       m_cropLeft = new QSlider(Qt::Horizontal, parent);
-                       m_cropLeft->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Minimum);
-                       m_cropLeft->setRange(0, 100);
-                       m_cropLeft->setSliderPosition(0);
-                       addLabel("Crop Left Offset");
-                       addWidget(m_cropLeft);
-                       connect(m_cropLeft, SIGNAL(valueChanged(int)), SLOT(cropChanged()));
-
-                       m_cropHeight = new QSlider(Qt::Horizontal, parent);
-                       m_cropHeight->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Minimum);
-                       m_cropHeight->setRange(1, 100);
-                       m_cropHeight->setSliderPosition(100);
-                       addLabel("Crop Height");
-                       addWidget(m_cropHeight);
-                       connect(m_cropHeight, SIGNAL(valueChanged(int)), SLOT(cropChanged()));
-
-                       m_cropTop = new QSlider(Qt::Horizontal, parent);
-                       m_cropTop->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Minimum);
-                       m_cropTop->setRange(0, 100);
-                       m_cropTop->setSliderPosition(0);
-                       addLabel("Crop Top Offset");
-                       addWidget(m_cropTop);
-                       connect(m_cropTop, SIGNAL(valueChanged(int)), SLOT(cropChanged()));
-               }
-
-               if (!m_isOutput && has_compose()) {
-                       m_composeWidth = new QSlider(Qt::Horizontal, parent);
-                       m_composeWidth->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Minimum);
-                       m_composeWidth->setRange(1, 100);
-                       m_composeWidth->setSliderPosition(100);
-                       addLabel("Compose Width");
-                       addWidget(m_composeWidth);
-                       connect(m_composeWidth, SIGNAL(valueChanged(int)), SLOT(composeChanged()));
-
-                       m_composeLeft = new QSlider(Qt::Horizontal, parent);
-                       m_composeLeft->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Minimum);
-                       m_composeLeft->setRange(0, 100);
-                       m_composeLeft->setSliderPosition(0);
-                       addLabel("Compose Left Offset");
-                       addWidget(m_composeLeft);
-                       connect(m_composeLeft, SIGNAL(valueChanged(int)), SLOT(composeChanged()));
-
-                       m_composeHeight = new QSlider(Qt::Horizontal, parent);
-                       m_composeHeight->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Minimum);
-                       m_composeHeight->setRange(1, 100);
-                       m_composeHeight->setSliderPosition(100);
-                       addLabel("Compose Height");
-                       addWidget(m_composeHeight);
-                       connect(m_composeHeight, SIGNAL(valueChanged(int)), SLOT(composeChanged()));
-
-                       m_composeTop = new QSlider(Qt::Horizontal, parent);
-                       m_composeTop->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Minimum);
-                       m_composeTop->setRange(0, 100);
-                       m_composeTop->setSliderPosition(0);
-                       addLabel("Compose Top Offset");
-                       addWidget(m_composeTop);
-                       connect(m_composeTop, SIGNAL(valueChanged(int)), SLOT(composeChanged()));
-               }
-       }
-
-       v4l2_output vout;
-       if (!isRadio() && enum_output(vout, true)) {
-               addLabel("Output");
-               m_videoOutput = new QComboBox(parent);
-               do {
-                       m_videoOutput->addItem((char *)vout.name);
-               } while (enum_output(vout));
-               addWidget(m_videoOutput);
-               connect(m_videoOutput, SIGNAL(activated(int)), SLOT(outputChanged(int)));
-               updateVideoOutput();
-       }
-
-       v4l2_audio vaudio;
        if (!isRadio() && enum_audio(vaudio, true)) {
                addLabel("Input Audio");
                m_audioInput = new QComboBox(parent);
@@ -499,19 +473,6 @@ GeneralTab::GeneralTab(const QString &device, v4l2 &fd, int n, QWidget *parent)
                updateAudioInput();
        }
 
-       v4l2_audioout vaudout;
-       if (!isRadio() && enum_audout(vaudout, true)) {
-               addLabel("Output Audio");
-               m_audioOutput = new QComboBox(parent);
-               m_audioOutput->setMinimumContentsLength(10);
-               do {
-                       m_audioOutput->addItem((char *)vaudout.name);
-               } while (enum_audout(vaudout));
-               addWidget(m_audioOutput);
-               connect(m_audioOutput, SIGNAL(activated(int)), SLOT(outputAudioChanged(int)));
-               updateAudioOutput();
-       }
-
        if (m_tuner.capability && !isSDR()) {
                addLabel("Audio Mode");
                m_audioMode = new QComboBox(parent);
@@ -544,70 +505,22 @@ GeneralTab::GeneralTab(const QString &device, v4l2 &fd, int n, QWidget *parent)
                connect(m_audioMode, SIGNAL(activated(int)), SLOT(audioModeChanged(int)));
        }
 
-       if (m_tuner_rf.capability) {
-               const char *unit = (m_tuner_rf.capability & V4L2_TUNER_CAP_LOW) ? " kHz" :
-                       (m_tuner_rf.capability & V4L2_TUNER_CAP_1HZ ? " Hz" : " MHz");
-
-               m_freqRfFac = (m_tuner_rf.capability & V4L2_TUNER_CAP_1HZ) ? 1 : 16;
-               m_freqRf = new QDoubleSpinBox(parent);
-               m_freqRf->setMinimum(m_tuner_rf.rangelow / m_freqRfFac);
-               m_freqRf->setMaximum(m_tuner_rf.rangehigh / m_freqRfFac);
-               m_freqRf->setSingleStep(1.0 / m_freqRfFac);
-               m_freqRf->setSuffix(unit);
-               m_freqRf->setDecimals((m_tuner_rf.capability & V4L2_TUNER_CAP_1HZ) ? 0 : 4);
-               m_freqRf->setWhatsThis(QString("RF Frequency\nLow: %1 %3\nHigh: %2 %3")
-                                    .arg((double)m_tuner_rf.rangelow / m_freqRfFac, 0, 'f', 2)
-                                    .arg((double)m_tuner_rf.rangehigh / m_freqRfFac, 0, 'f', 2)
-                                    .arg(unit));
-               m_freqRf->setStatusTip(m_freqRf->whatsThis());
-               connect(m_freqRf, SIGNAL(valueChanged(double)), SLOT(freqRfChanged(double)));
-               updateFreqRf();
-               addLabel("RF Frequency");
-               addWidget(m_freqRf);
-       }
-
-       if (m_modulator.capability) {
-               const char *unit = (m_modulator.capability & V4L2_TUNER_CAP_LOW) ? " kHz" :
-                       (m_modulator.capability & V4L2_TUNER_CAP_1HZ ? " Hz" : " MHz");
-
-               m_freqFac = (m_modulator.capability & V4L2_TUNER_CAP_1HZ) ? 1 : 16;
-               m_freq = new QDoubleSpinBox(parent);
-               m_freq->setMinimum(m_modulator.rangelow / m_freqFac);
-               m_freq->setMaximum(m_modulator.rangehigh / m_freqFac);
-               m_freq->setSingleStep(1.0 / m_freqFac);
-               m_freq->setSuffix(unit);
-               m_freq->setDecimals((m_modulator.capability & V4L2_TUNER_CAP_1HZ) ? 0 : 4);
-               m_freq->setWhatsThis(QString("Frequency\nLow: %1 %3\nHigh: %2 %3")
-                                    .arg((double)m_modulator.rangelow / m_freqFac, 0, 'f', 2)
-                                    .arg((double)m_modulator.rangehigh / m_freqFac, 0, 'f', 2)
-                                    .arg(unit));
-               m_freq->setStatusTip(m_freq->whatsThis());
-               connect(m_freq, SIGNAL(valueChanged(double)), SLOT(freqChanged(double)));
-               updateFreq();
-               addLabel("Frequency");
-               addWidget(m_freq);
-       }
-       if (m_modulator.capability && !isSDR()) {
-               if (m_modulator.capability & V4L2_TUNER_CAP_STEREO) {
-                       addLabel("Stereo");
-                       m_stereoMode = new QCheckBox(parent);
-                       m_stereoMode->setCheckState((m_modulator.txsubchans & V4L2_TUNER_SUB_STEREO) ?
-                                       Qt::Checked : Qt::Unchecked);
-                       addWidget(m_stereoMode);
-                       connect(m_stereoMode, SIGNAL(clicked()), SLOT(stereoModeChanged()));
-               }
-               if (m_modulator.capability & V4L2_TUNER_CAP_RDS) {
-                       addLabel("RDS");
-                       m_rdsMode = new QCheckBox(parent);
-                       m_rdsMode->setCheckState((m_modulator.txsubchans & V4L2_TUNER_SUB_RDS) ?
-                                       Qt::Checked : Qt::Unchecked);
-                       addWidget(m_rdsMode);
-                       connect(m_rdsMode, SIGNAL(clicked()), SLOT(rdsModeChanged()));
-               }
+       if (!isRadio() && enum_audout(vaudout, true)) {
+               addLabel("Output Audio");
+               m_audioOutput = new QComboBox(parent);
+               m_audioOutput->setMinimumContentsLength(10);
+               do {
+                       m_audioOutput->addItem((char *)vaudout.name);
+               } while (enum_audout(vaudout));
+               addWidget(m_audioOutput);
+               connect(m_audioOutput, SIGNAL(activated(int)), SLOT(outputAudioChanged(int)));
+               updateAudioOutput();
        }
 
        if (isRadio())
                goto done;
+format:
+       addTitle("Format Settings");
 
        if (isVbi()) {
                addLabel("VBI Capture Method");
@@ -622,21 +535,7 @@ GeneralTab::GeneralTab(const QString &device, v4l2 &fd, int n, QWidget *parent)
                goto capture_method;
        }
 
-       v4l2_fmtdesc fmt;
-
-       if (m_isOutput) {
-               addLabel("Output Image Formats");
-               m_vidOutFormats = new QComboBox(parent);
-               m_vidOutFormats->setMinimumContentsLength(20);
-               if (enum_fmt(fmt, m_buftype, true)) {
-                       do {
-                               m_vidOutFormats->addItem(pixfmt2s(fmt.pixelformat) +
-                                               " - " + (const char *)fmt.description);
-                       } while (enum_fmt(fmt, m_buftype));
-               }
-               addWidget(m_vidOutFormats);
-               connect(m_vidOutFormats, SIGNAL(activated(int)), SLOT(vidOutFormatChanged(int)));
-       } else {
+       if (!m_isOutput) {
                addLabel("Capture Image Formats");
                m_vidCapFormats = new QComboBox(parent);
                m_vidCapFormats->setMinimumContentsLength(20);
@@ -660,9 +559,60 @@ GeneralTab::GeneralTab(const QString &device, v4l2 &fd, int n, QWidget *parent)
        addWidget(m_vidFields);
        connect(m_vidFields, SIGNAL(activated(int)), SLOT(vidFieldChanged(int)));
 
-       updateVideoInput();
-       updateVideoOutput();
-       updateVidFormat();
+       m_cropping = new QComboBox(parent);
+       m_cropping->addItem("Source Width and Height");
+       m_cropping->addItem("Crop Top and Bottom Line");
+       m_cropping->addItem("Widescreen 14:9");
+       m_cropping->addItem("Widescreen 16:9");
+       m_cropping->addItem("Cinema 1.85:1");
+       m_cropping->addItem("Cinema 2.39:1");
+       m_cropping->addItem("Traditional 4:3");
+
+       addLabel("Video Aspect Ratio");
+       addWidget(m_cropping);
+       connect(m_cropping, SIGNAL(activated(int)), SIGNAL(croppingChanged()));
+
+       if (!isRadio() && !isVbi()) {
+               m_pixelAspectRatio = new QComboBox(parent);
+               m_pixelAspectRatio->addItem("Autodetect");
+               m_pixelAspectRatio->addItem("Square");
+               m_pixelAspectRatio->addItem("NTSC/PAL-M/PAL-60");
+               m_pixelAspectRatio->addItem("NTSC/PAL-M/PAL-60, Anamorphic");
+               m_pixelAspectRatio->addItem("PAL/SECAM");
+               m_pixelAspectRatio->addItem("PAL/SECAM, Anamorphic");
+
+               // Update hints by calling a get
+               getPixelAspectRatio();
+
+               addLabel("Pixel Aspect Ratio");
+               addWidget(m_pixelAspectRatio);
+               connect(m_pixelAspectRatio, SIGNAL(activated(int)), SLOT(changePixelAspectRatio()));
+
+#ifdef HAVE_QTGL
+               m_colorspace = new QComboBox(parent);
+               m_colorspace->addItem("Autodetect");
+               m_colorspace->addItem("SMPTE 170M");
+               m_colorspace->addItem("SMPTE 240M");
+               m_colorspace->addItem("REC 709");
+               m_colorspace->addItem("470 System M");
+               m_colorspace->addItem("470 System BG");
+               m_colorspace->addItem("sRGB");
+
+               addLabel("Colorspace");
+               addWidget(m_colorspace);
+               connect(m_colorspace, SIGNAL(activated(int)), SIGNAL(colorspaceChanged()));
+
+               m_displayColorspace = new QComboBox(parent);
+               m_displayColorspace->addItem("sRGB");
+               m_displayColorspace->addItem("Linear RGB");
+               m_displayColorspace->addItem("REC 709");
+               m_displayColorspace->addItem("SMPTE 240M");
+
+               addLabel("Display Colorspace");
+               addWidget(m_displayColorspace);
+               connect(m_displayColorspace, SIGNAL(activated(int)), SIGNAL(displayColorspaceChanged()));
+#endif
+       }
 
 capture_method:
        addLabel("Capture Method");
@@ -693,6 +643,85 @@ capture_method:
        }
        addWidget(m_capMethods);
 
+
+
+       if (!isRadio() && !isVbi()) {
+               if (!m_isOutput && (has_crop() || has_compose()))
+                       addTitle("Cropping & Compose Settings");
+
+               if (!m_isOutput && has_crop()) {
+                       m_cropWidth = new QSlider(Qt::Horizontal, parent);
+                       m_cropWidth->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Minimum);
+                       m_cropWidth->setRange(1, 100);
+                       m_cropWidth->setSliderPosition(100);
+                       addLabel("Crop Width");
+                       addWidget(m_cropWidth);
+                       connect(m_cropWidth, SIGNAL(valueChanged(int)), SLOT(cropChanged()));
+
+                       m_cropLeft = new QSlider(Qt::Horizontal, parent);
+                       m_cropLeft->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Minimum);
+                       m_cropLeft->setRange(0, 100);
+                       m_cropLeft->setSliderPosition(0);
+                       addLabel("Crop Left Offset");
+                       addWidget(m_cropLeft);
+                       connect(m_cropLeft, SIGNAL(valueChanged(int)), SLOT(cropChanged()));
+
+                       m_cropHeight = new QSlider(Qt::Horizontal, parent);
+                       m_cropHeight->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Minimum);
+                       m_cropHeight->setRange(1, 100);
+                       m_cropHeight->setSliderPosition(100);
+                       addLabel("Crop Height");
+                       addWidget(m_cropHeight);
+                       connect(m_cropHeight, SIGNAL(valueChanged(int)), SLOT(cropChanged()));
+
+                       m_cropTop = new QSlider(Qt::Horizontal, parent);
+                       m_cropTop->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Minimum);
+                       m_cropTop->setRange(0, 100);
+                       m_cropTop->setSliderPosition(0);
+                       addLabel("Crop Top Offset");
+                       addWidget(m_cropTop);
+                       connect(m_cropTop, SIGNAL(valueChanged(int)), SLOT(cropChanged()));
+               }
+
+               if (!m_isOutput && has_compose()) {
+                       m_composeWidth = new QSlider(Qt::Horizontal, parent);
+                       m_composeWidth->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Minimum);
+                       m_composeWidth->setRange(1, 100);
+                       m_composeWidth->setSliderPosition(100);
+                       addLabel("Compose Width");
+                       addWidget(m_composeWidth);
+                       connect(m_composeWidth, SIGNAL(valueChanged(int)), SLOT(composeChanged()));
+
+                       m_composeLeft = new QSlider(Qt::Horizontal, parent);
+                       m_composeLeft->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Minimum);
+                       m_composeLeft->setRange(0, 100);
+                       m_composeLeft->setSliderPosition(0);
+                       addLabel("Compose Left Offset");
+                       addWidget(m_composeLeft);
+                       connect(m_composeLeft, SIGNAL(valueChanged(int)), SLOT(composeChanged()));
+
+                       m_composeHeight = new QSlider(Qt::Horizontal, parent);
+                       m_composeHeight->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Minimum);
+                       m_composeHeight->setRange(1, 100);
+                       m_composeHeight->setSliderPosition(100);
+                       addLabel("Compose Height");
+                       addWidget(m_composeHeight);
+                       connect(m_composeHeight, SIGNAL(valueChanged(int)), SLOT(composeChanged()));
+
+                       m_composeTop = new QSlider(Qt::Horizontal, parent);
+                       m_composeTop->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Minimum);
+                       m_composeTop->setRange(0, 100);
+                       m_composeTop->setSliderPosition(0);
+                       addLabel("Compose Top Offset");
+                       addWidget(m_composeTop);
+                       connect(m_composeTop, SIGNAL(valueChanged(int)), SLOT(composeChanged()));
+               }
+       }
+
+       updateVideoInput();
+       updateVideoOutput();
+       updateVidFormat();
+
 done:
        QGridLayout::addWidget(new QWidget(parent), rowCount(), 0, 1, n);
        setRowStretch(rowCount() - 1, 1);
@@ -1006,6 +1035,26 @@ void GeneralTab::addWidget(QWidget *w, Qt::Alignment align)
        }
 }
 
+void GeneralTab::addTitle(const QString &titlename)
+{
+       m_row++;
+       QLabel *title_info = new QLabel(titlename, parentWidget());
+       QFont f = title_info->font();
+       f.setBold(true);
+       title_info->setFont(f);
+
+       QGridLayout::addWidget(title_info, m_row, 0, 1, m_cols, Qt::AlignLeft);
+       setRowMinimumHeight(m_row, 25);
+       m_row++;
+
+       QFrame *m_line = new QFrame(parentWidget());
+       m_line->setFrameShape(QFrame::HLine);
+       m_line->setFrameShadow(QFrame::Sunken);
+       QGridLayout::addWidget(m_line, m_row, 0, 1, m_cols, Qt::AlignVCenter);
+       m_row++;
+       m_col = 0;
+}
+
 int GeneralTab::getWidth()
 {
        int total = 0;
index bc09f2d..a50ce18 100644 (file)
@@ -167,6 +167,7 @@ private:
 #endif
 
        void addWidget(QWidget *w, Qt::Alignment align = Qt::AlignLeft);
+       void addTitle(const QString &titlename);
        void addLabel(const QString &text, Qt::Alignment align = Qt::AlignLeft)
        {
                addWidget(new QLabel(text, parentWidget()), align);