10 #if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
29 : QDialog (parent, flags)
31 if (objectName().isEmpty())
32 setObjectName(QString::fromUtf8(
"Dialog"));
34 mBoardChoiceCombo =
new QComboBox;
35 for (
ULWord ndx(0); ndx < 100; ndx++)
41 {mBoardChoiceCombo->addItem(
"No Devices Found");
break;}
45 mBoardChoiceCombo->setCurrentIndex (0);
48 mInputButtonGroup =
new QButtonGroup ();
50 for (
unsigned ndx (0); ndx < 8; ndx++)
52 for (
unsigned ndx (0); ndx < 4; ndx++)
58 mCheckFixedReference =
new QCheckBox (
"Fixed Reference",
this);
65 mStreamGrabber->
SetDeviceIndex (mBoardChoiceCombo->currentIndex ());
68 QVBoxLayout * layout (
new QVBoxLayout);
69 layout->addWidget (mBoardChoiceCombo);
70 layout->addWidget (mVideoPreviewWidget);
72 for (
QButtonIterator iter (mInputButtonGroup->buttons()); iter.hasNext (); )
73 layout->addWidget (iter.next());
74 layout->addWidget (mCheckFixedReference);
76 layout->addStretch (1);
79 QObject::connect (mBoardChoiceCombo, SIGNAL (currentIndexChanged (
int)),
this, SLOT (RequestDeviceChange (
const int)));
80 QObject::connect (mInputButtonGroup, SIGNAL (buttonReleased (
int)),
this, SLOT (inputChanged (
int)));
81 QObject::connect (mCheckFixedReference, SIGNAL (toggled (
bool)),
this, SLOT (fixedRefChanged (
bool)));
82 connect (mStreamGrabber, SIGNAL (newFrame (
const QImage &,
bool)), mVideoPreviewWidget, SLOT (updateFrame (
const QImage &,
bool)));
83 connect (mStreamGrabber, SIGNAL (newStatusString (
const QString)), mVideoPreviewWidget, SLOT (updateStatusString (
const QString)));
86 mStreamGrabber->start ();
87 mTimerID = startTimer (100);
97 delete mStreamGrabber;
102 void NTV2StreamPreview::RequestDeviceChange (
const int inDeviceIndexNum)
107 qDebug (
"## NOTE: Device changed to %d", inDeviceIndexNum);
112 void NTV2StreamPreview::inputChanged (
int inputRadioButtonId)
122 qDebug (
"## DEBUG: NTV2StreamPreview::inputChanged: off");
132 void NTV2StreamPreview::fixedRefChanged (
bool checked)
139 void NTV2StreamPreview::updateInputs (
void)
141 CNTV2Card ntv2Card (mBoardChoiceCombo->currentIndex());
142 if (ntv2Card.IsOpen())
144 for (
QButtonIterator iter (mInputButtonGroup->buttons()); iter.hasNext(); )
146 QRadioButton * pButton (
reinterpret_cast<QRadioButton*
>(iter.next()));
150 const bool hasInputSource (ntv2Card.features().CanDoInputSource(inputSource));
151 const string videoFormatStr (hasInputSource ? ::
NTV2VideoFormatToString(ntv2Card.GetInputVideoFormat(inputSource)) :
"");
152 const QString buttonLabel (QString(
"%1 %2").arg(::
NTV2InputSourceToString(inputSource,
true).c_str(), videoFormatStr.empty() ?
"No Detected Input" : videoFormatStr.c_str()));
153 pButton->setText (buttonLabel);
154 pButton->setEnabled (hasInputSource);
162 void NTV2StreamPreview::timerEvent (QTimerEvent * event)
164 if (event->timerId() == mTimerID)
167 QWidget::timerEvent(event);
172 void NTV2StreamPreview::devicesChanged (
void)
174 qDebug () << QString (
"devicesChanged");
178 mBoardChoiceCombo->clear ();
179 for (
ULWord ndx (0); ndx < 100; ndx++)
183 mBoardChoiceCombo->addItem (tr (device.
GetDisplayName ().c_str ()));
185 {mBoardChoiceCombo->addItem (tr (
"No Devices Found"));
break;}
189 mBoardChoiceCombo->setCurrentIndex (0);
194 void NTV2StreamPreview::PnpCallback (
AJAPnpMessage inMessage,
void * pUserData)
201 pMainWindow->devicesChanged ();