48
48
#include < QtWidgets/QApplication>
49
49
#include < QtWidgets/QLineEdit>
50
50
51
- InspectorOutputWidget::InspectorOutputWidget (QWidget* parent)
51
+ InspectorOutputWidget::InspectorOutputWidget (QWidget * parent)
52
52
: QWidget(parent),
53
53
command(NULL ), model(NULL ), delayType(" " ), libraryFilter(" " )
54
54
{
@@ -61,25 +61,25 @@ InspectorOutputWidget::InspectorOutputWidget(QWidget* parent)
61
61
this ->comboBoxTarget ->lineEdit ()->setStyleSheet (" background-color: transparent; border-width: 0px;" );
62
62
63
63
QObject::connect (&DeviceManager::getInstance (), SIGNAL (deviceRemoved ()), this , SLOT (deviceRemoved ()));
64
- QObject::connect (&DeviceManager::getInstance (), SIGNAL (deviceAdded (CasparDevice&)), this , SLOT (deviceAdded (CasparDevice&)));
65
-
66
- QObject::connect (&EventManager::getInstance (), SIGNAL (rundownItemSelected (const RundownItemSelectedEvent&)), this , SLOT (rundownItemSelected (const RundownItemSelectedEvent&)));
67
- QObject::connect (&EventManager::getInstance (), SIGNAL (libraryItemSelected (const LibraryItemSelectedEvent&)), this , SLOT (libraryItemSelected (const LibraryItemSelectedEvent&)));
68
- QObject::connect (&EventManager::getInstance (), SIGNAL (emptyRundown (const EmptyRundownEvent&)), this , SLOT (emptyRundown (const EmptyRundownEvent&)));
69
- QObject::connect (&EventManager::getInstance (), SIGNAL (deviceChanged (const DeviceChangedEvent&)), this , SLOT (deviceChanged (const DeviceChangedEvent&)));
70
- QObject::connect (&EventManager::getInstance (), SIGNAL (mediaChanged (const MediaChangedEvent&)), this , SLOT (mediaChanged (const MediaChangedEvent&)));
71
- QObject::connect (&EventManager::getInstance (), SIGNAL (templateChanged (const TemplateChangedEvent&)), this , SLOT (templateChanged (const TemplateChangedEvent&)));
72
- QObject::connect (&EventManager::getInstance (), SIGNAL (libraryFilterChanged (const LibraryFilterChangedEvent&)), this , SLOT (libraryFilterChanged (const LibraryFilterChangedEvent&)));
64
+ QObject::connect (&DeviceManager::getInstance (), SIGNAL (deviceAdded (CasparDevice &)), this , SLOT (deviceAdded (CasparDevice &)));
65
+
66
+ QObject::connect (&EventManager::getInstance (), SIGNAL (rundownItemSelected (const RundownItemSelectedEvent &)), this , SLOT (rundownItemSelected (const RundownItemSelectedEvent &)));
67
+ QObject::connect (&EventManager::getInstance (), SIGNAL (libraryItemSelected (const LibraryItemSelectedEvent &)), this , SLOT (libraryItemSelected (const LibraryItemSelectedEvent &)));
68
+ QObject::connect (&EventManager::getInstance (), SIGNAL (emptyRundown (const EmptyRundownEvent &)), this , SLOT (emptyRundown (const EmptyRundownEvent &)));
69
+ QObject::connect (&EventManager::getInstance (), SIGNAL (deviceChanged (const DeviceChangedEvent &)), this , SLOT (deviceChanged (const DeviceChangedEvent &)));
70
+ QObject::connect (&EventManager::getInstance (), SIGNAL (mediaChanged (const MediaChangedEvent &)), this , SLOT (mediaChanged (const MediaChangedEvent &)));
71
+ QObject::connect (&EventManager::getInstance (), SIGNAL (templateChanged (const TemplateChangedEvent &)), this , SLOT (templateChanged (const TemplateChangedEvent &)));
72
+ QObject::connect (&EventManager::getInstance (), SIGNAL (libraryFilterChanged (const LibraryFilterChangedEvent &)), this , SLOT (libraryFilterChanged (const LibraryFilterChangedEvent &)));
73
73
}
74
74
75
- void InspectorOutputWidget::libraryFilterChanged (const LibraryFilterChangedEvent& event)
75
+ void InspectorOutputWidget::libraryFilterChanged (const LibraryFilterChangedEvent & event)
76
76
{
77
77
this ->libraryFilter = event.getFilter ();
78
78
79
79
checkEmptyTarget ();
80
80
}
81
81
82
- void InspectorOutputWidget::rundownItemSelected (const RundownItemSelectedEvent& event)
82
+ void InspectorOutputWidget::rundownItemSelected (const RundownItemSelectedEvent & event)
83
83
{
84
84
this ->command = nullptr ;
85
85
this ->model = event.getLibraryModel ();
@@ -125,7 +125,7 @@ void InspectorOutputWidget::rundownItemSelected(const RundownItemSelectedEvent&
125
125
{
126
126
if (deviceModel != NULL )
127
127
{
128
- const QStringList& channelFormats = DatabaseManager::getInstance ().getDeviceByName (deviceModel->getName ()).getChannelFormats ().split (" ," );
128
+ const QStringList & channelFormats = DatabaseManager::getInstance ().getDeviceByName (deviceModel->getName ()).getChannelFormats ().split (" ," );
129
129
this ->spinBoxChannel ->setMaximum (channelFormats.count ());
130
130
}
131
131
}
@@ -147,16 +147,16 @@ void InspectorOutputWidget::rundownItemSelected(const RundownItemSelectedEvent&
147
147
148
148
fillTargetCombo (this ->model ->getType ());
149
149
150
- if (dynamic_cast <FileRecorderCommand*>(event.getCommand ()))
150
+ if (dynamic_cast <FileRecorderCommand *>(event.getCommand ()))
151
151
{
152
152
this ->comboBoxTarget ->setEnabled (false );
153
153
this ->spinBoxVideolayer ->setEnabled (false );
154
154
155
155
this ->comboBoxTarget ->setCurrentIndex (-1 );
156
156
this ->spinBoxVideolayer ->setValue (Output::DEFAULT_VIDEOLAYER);
157
157
}
158
- else if (dynamic_cast <CommitCommand*>(event.getCommand ()) ||
159
- dynamic_cast <PrintCommand*>(event.getCommand ()))
158
+ else if (dynamic_cast <CommitCommand *>(event.getCommand ()) ||
159
+ dynamic_cast <PrintCommand *>(event.getCommand ()))
160
160
{
161
161
this ->comboBoxTarget ->setEnabled (false );
162
162
this ->spinBoxVideolayer ->setEnabled (false );
@@ -166,14 +166,14 @@ void InspectorOutputWidget::rundownItemSelected(const RundownItemSelectedEvent&
166
166
this ->spinBoxVideolayer ->setValue (Output::DEFAULT_VIDEOLAYER);
167
167
this ->spinBoxDuration ->setValue (Output::DEFAULT_DURATION);
168
168
}
169
- else if (dynamic_cast <GridCommand*>(event.getCommand ()))
169
+ else if (dynamic_cast <GridCommand *>(event.getCommand ()))
170
170
{
171
171
this ->comboBoxTarget ->setEnabled (false );
172
172
this ->spinBoxVideolayer ->setEnabled (false );
173
173
174
174
this ->spinBoxVideolayer ->setValue (Output::DEFAULT_VIDEOLAYER);
175
175
}
176
- else if (dynamic_cast <GroupCommand*>(event.getCommand ()))
176
+ else if (dynamic_cast <GroupCommand *>(event.getCommand ()))
177
177
{
178
178
this ->comboBoxDevice ->setEnabled (false );
179
179
this ->comboBoxTarget ->setEnabled (false );
@@ -191,11 +191,11 @@ void InspectorOutputWidget::rundownItemSelected(const RundownItemSelectedEvent&
191
191
this ->spinBoxVideolayer ->setValue (Output::DEFAULT_VIDEOLAYER);
192
192
this ->spinBoxDelay ->setValue (Output::DEFAULT_DELAY);
193
193
}
194
- else if (dynamic_cast <GpiOutputCommand*>(event.getCommand ()) ||
195
- dynamic_cast <OscOutputCommand*>(event.getCommand ()) ||
196
- dynamic_cast <HttpGetCommand*>(event.getCommand ()) ||
197
- dynamic_cast <HttpPostCommand*>(event.getCommand ()) ||
198
- dynamic_cast <PlayoutCommand*>(event.getCommand ()))
194
+ else if (dynamic_cast <GpiOutputCommand *>(event.getCommand ()) ||
195
+ dynamic_cast <OscOutputCommand *>(event.getCommand ()) ||
196
+ dynamic_cast <HttpGetCommand *>(event.getCommand ()) ||
197
+ dynamic_cast <HttpPostCommand *>(event.getCommand ()) ||
198
+ dynamic_cast <PlayoutCommand *>(event.getCommand ()))
199
199
{
200
200
this ->comboBoxDevice ->setEnabled (false );
201
201
this ->comboBoxTarget ->setEnabled (false );
@@ -212,7 +212,7 @@ void InspectorOutputWidget::rundownItemSelected(const RundownItemSelectedEvent&
212
212
this ->spinBoxVideolayer ->setValue (Output::DEFAULT_VIDEOLAYER);
213
213
this ->spinBoxDuration ->setValue (Output::DEFAULT_DURATION);
214
214
}
215
- else if (dynamic_cast <SeparatorCommand*>(event.getCommand ()))
215
+ else if (dynamic_cast <SeparatorCommand *>(event.getCommand ()))
216
216
{
217
217
this ->comboBoxDevice ->setEnabled (false );
218
218
this ->comboBoxTarget ->setEnabled (false );
@@ -235,7 +235,7 @@ void InspectorOutputWidget::rundownItemSelected(const RundownItemSelectedEvent&
235
235
this ->checkBoxAllowRemoteTriggering ->setChecked (Output::DEFAULT_ALLOW_REMOTE_TRIGGERING);
236
236
this ->lineEditRemoteTriggerId ->setText (Output::DEFAULT_REMOTE_TRIGGER_ID);
237
237
}
238
- else if (dynamic_cast <CustomCommand*>(event.getCommand ()))
238
+ else if (dynamic_cast <CustomCommand *>(event.getCommand ()))
239
239
{
240
240
this ->comboBoxTarget ->setEnabled (false );
241
241
this ->spinBoxChannel ->setEnabled (false );
@@ -245,42 +245,41 @@ void InspectorOutputWidget::rundownItemSelected(const RundownItemSelectedEvent&
245
245
this ->spinBoxChannel ->setValue (Output::DEFAULT_CHANNEL);
246
246
this ->spinBoxVideolayer ->setValue (Output::DEFAULT_VIDEOLAYER);
247
247
}
248
- else if (dynamic_cast <ClearOutputCommand*>(event.getCommand ()) ||
249
- dynamic_cast <ResetCommand*>(event.getCommand ()))
248
+ else if (dynamic_cast <ClearOutputCommand *>(event.getCommand ()) ||
249
+ dynamic_cast <ResetCommand *>(event.getCommand ()))
250
250
{
251
251
this ->comboBoxTarget ->setEnabled (false );
252
252
this ->spinBoxDuration ->setEnabled (false );
253
253
254
254
this ->comboBoxTarget ->setCurrentIndex (-1 );
255
255
this ->spinBoxDuration ->setValue (Output::DEFAULT_DURATION);
256
256
}
257
- else if (dynamic_cast <DeckLinkInputCommand*>(event.getCommand ()) ||
258
- dynamic_cast <BlendModeCommand*>(event.getCommand ()) ||
259
- dynamic_cast <BrightnessCommand*>(event.getCommand ()) ||
260
- dynamic_cast <ContrastCommand*>(event.getCommand ()) ||
261
- dynamic_cast <ClipCommand*>(event.getCommand ()) ||
262
- dynamic_cast <CropCommand*>(event.getCommand ()) ||
263
- dynamic_cast <FillCommand*>(event.getCommand ()) ||
264
- dynamic_cast <PerspectiveCommand*>(event.getCommand ()) ||
265
- dynamic_cast <RotationCommand*>(event.getCommand ()) ||
266
- dynamic_cast <AnchorCommand*>(event.getCommand ()) ||
267
- dynamic_cast <KeyerCommand*>(event.getCommand ()) ||
268
- dynamic_cast <LevelsCommand*>(event.getCommand ()) ||
269
- dynamic_cast <OpacityCommand*>(event.getCommand ()) ||
270
- dynamic_cast <SaturationCommand*>(event.getCommand ()) ||
271
- dynamic_cast <VolumeCommand*>(event.getCommand ()) ||
272
- dynamic_cast <SolidColorCommand*>(event.getCommand ()) ||
273
- dynamic_cast <FadeToBlackCommand*>(event.getCommand ()) ||
274
- dynamic_cast <HtmlCommand*>(event.getCommand ()) ||
275
- dynamic_cast <RouteChannelCommand*>(event.getCommand ()) ||
276
- dynamic_cast <RouteVideolayerCommand*>(event.getCommand ()) ||
277
- dynamic_cast <ChromaCommand*>(event.getCommand ()))
257
+ else if (dynamic_cast <DeckLinkInputCommand *>(event.getCommand ()) ||
258
+ dynamic_cast <BlendModeCommand *>(event.getCommand ()) ||
259
+ dynamic_cast <BrightnessCommand *>(event.getCommand ()) ||
260
+ dynamic_cast <ContrastCommand *>(event.getCommand ()) ||
261
+ dynamic_cast <ClipCommand *>(event.getCommand ()) ||
262
+ dynamic_cast <CropCommand *>(event.getCommand ()) ||
263
+ dynamic_cast <FillCommand *>(event.getCommand ()) ||
264
+ dynamic_cast <PerspectiveCommand *>(event.getCommand ()) ||
265
+ dynamic_cast <RotationCommand *>(event.getCommand ()) ||
266
+ dynamic_cast <AnchorCommand *>(event.getCommand ()) ||
267
+ dynamic_cast <KeyerCommand *>(event.getCommand ()) ||
268
+ dynamic_cast <LevelsCommand *>(event.getCommand ()) ||
269
+ dynamic_cast <OpacityCommand *>(event.getCommand ()) ||
270
+ dynamic_cast <SaturationCommand *>(event.getCommand ()) ||
271
+ dynamic_cast <VolumeCommand *>(event.getCommand ()) ||
272
+ dynamic_cast <SolidColorCommand *>(event.getCommand ()) ||
273
+ dynamic_cast <FadeToBlackCommand *>(event.getCommand ()) ||
274
+ dynamic_cast <HtmlCommand *>(event.getCommand ()) ||
275
+ dynamic_cast <RouteChannelCommand *>(event.getCommand ()) ||
276
+ dynamic_cast <RouteVideolayerCommand *>(event.getCommand ()) ||
277
+ dynamic_cast <ChromaCommand *>(event.getCommand ()))
278
278
{
279
279
this ->comboBoxTarget ->setEnabled (false );
280
280
281
281
this ->comboBoxTarget ->setCurrentIndex (-1 );
282
282
}
283
-
284
283
}
285
284
286
285
if (deviceModel != NULL && deviceModel->getLockedChannel () > 0 && deviceModel->getLockedChannel () <= this ->spinBoxChannel ->maximum ())
@@ -298,7 +297,7 @@ void InspectorOutputWidget::rundownItemSelected(const RundownItemSelectedEvent&
298
297
blockAllSignals (false );
299
298
}
300
299
301
- void InspectorOutputWidget::libraryItemSelected (const LibraryItemSelectedEvent& event)
300
+ void InspectorOutputWidget::libraryItemSelected (const LibraryItemSelectedEvent & event)
302
301
{
303
302
this ->model = event.getLibraryModel ();
304
303
@@ -339,7 +338,7 @@ void InspectorOutputWidget::libraryItemSelected(const LibraryItemSelectedEvent&
339
338
blockAllSignals (false );
340
339
}
341
340
342
- void InspectorOutputWidget::emptyRundown (const EmptyRundownEvent& event)
341
+ void InspectorOutputWidget::emptyRundown (const EmptyRundownEvent & event)
343
342
{
344
343
Q_UNUSED (event);
345
344
@@ -384,7 +383,7 @@ void InspectorOutputWidget::emptyRundown(const EmptyRundownEvent& event)
384
383
blockAllSignals (false );
385
384
}
386
385
387
- void InspectorOutputWidget::deviceChanged (const DeviceChangedEvent& event)
386
+ void InspectorOutputWidget::deviceChanged (const DeviceChangedEvent & event)
388
387
{
389
388
if (this ->model == NULL )
390
389
return ;
@@ -400,7 +399,7 @@ void InspectorOutputWidget::deviceChanged(const DeviceChangedEvent& event)
400
399
blockAllSignals (false );
401
400
}
402
401
403
- void InspectorOutputWidget::mediaChanged (const MediaChangedEvent& event)
402
+ void InspectorOutputWidget::mediaChanged (const MediaChangedEvent & event)
404
403
{
405
404
Q_UNUSED (event);
406
405
@@ -414,7 +413,7 @@ void InspectorOutputWidget::mediaChanged(const MediaChangedEvent& event)
414
413
blockAllSignals (false );
415
414
}
416
415
417
- void InspectorOutputWidget::templateChanged (const TemplateChangedEvent& event)
416
+ void InspectorOutputWidget::templateChanged (const TemplateChangedEvent & event)
418
417
{
419
418
Q_UNUSED (event);
420
419
@@ -441,7 +440,7 @@ void InspectorOutputWidget::blockAllSignals(bool block)
441
440
this ->lineEditRemoteTriggerId ->blockSignals (block);
442
441
}
443
442
444
- void InspectorOutputWidget::fillTargetCombo (const QString& type, QString deviceName)
443
+ void InspectorOutputWidget::fillTargetCombo (const QString & type, QString deviceName)
445
444
{
446
445
this ->comboBoxTarget ->clear ();
447
446
@@ -451,56 +450,37 @@ void InspectorOutputWidget::fillTargetCombo(const QString& type, QString deviceN
451
450
if (deviceName.isEmpty ())
452
451
deviceName = this ->model ->getDeviceName ();
453
452
454
- if (deviceName.isEmpty ())
455
- return ;
456
-
457
- const QSharedPointer<CasparDevice> device = DeviceManager::getInstance ().getDeviceByName (deviceName);
458
- if (device == NULL )
459
- return ;
453
+ QSharedPointer<DeviceModel> deviceModel;
460
454
461
- const QSharedPointer<DeviceModel> deviceModel = DeviceManager::getInstance ().getDeviceModelByName (deviceName);
462
- if (deviceModel == NULL )
463
- return ;
455
+ if (!deviceName.isEmpty ())
456
+ deviceModel = DeviceManager::getInstance ().getDeviceModelByName (deviceName);
464
457
465
- QList<LibraryModel> models;
466
- if (this ->libraryFilter .isEmpty ())
467
- models = DatabaseManager::getInstance ().getLibraryByDeviceId (deviceModel->getId ());
468
- else
469
- models = DatabaseManager::getInstance ().getLibraryByDeviceIdAndFilter (deviceModel->getId (), this ->libraryFilter );
470
-
471
- if (models.count () > 0 )
458
+ if (deviceModel)
472
459
{
473
- foreach (LibraryModel model, models)
474
- {
475
- if (type == Rundown::MOVIE && model.getType () == Rundown::MOVIE)
476
- this ->comboBoxTarget ->addItem (model.getName ());
477
- else if (type == Rundown::AUDIO && model.getType () == Rundown::AUDIO)
478
- this ->comboBoxTarget ->addItem (model.getName ());
479
- else if (type == Rundown::TEMPLATE && model.getType () == Rundown::TEMPLATE)
480
- this ->comboBoxTarget ->addItem (model.getName ());
481
- else if ((type == Rundown::STILL || type == Rundown::IMAGESCROLLER) && model.getType () == Rundown::STILL)
482
- this ->comboBoxTarget ->addItem (model.getName ());
483
- }
460
+ QList<LibraryModel> models;
461
+ if (this ->libraryFilter .isEmpty ())
462
+ models = DatabaseManager::getInstance ().getLibraryByDeviceId (deviceModel->getId ());
463
+ else
464
+ models = DatabaseManager::getInstance ().getLibraryByDeviceIdAndFilter (deviceModel->getId (), this ->libraryFilter );
484
465
485
- // Include current target when using filter that do not match it.
486
- if (!this ->libraryFilter .isEmpty () && this ->comboBoxTarget ->findText (this ->model ->getName ()))
466
+ if (models.count () > 0 )
487
467
{
488
- if (!this ->model ->getName ().isEmpty () &&
489
- (this ->model ->getType () == Rundown::AUDIO || this ->model ->getType () == Rundown::STILL ||
490
- this ->model ->getType () == Rundown::IMAGESCROLLER || this ->model ->getType () == Rundown::TEMPLATE || this ->model ->getType () == Rundown::MOVIE) &&
491
- this ->model ->getName () != Rundown::DEFAULT_AUDIO_NAME &&
492
- this ->model ->getName () != Rundown::DEFAULT_STILL_NAME &&
493
- this ->model ->getName () != Rundown::DEFAULT_IMAGESCROLLER_NAME &&
494
- this ->model ->getName () != Rundown::DEFAULT_TEMPLATE_NAME &&
495
- this ->model ->getName () != Rundown::DEFAULT_MOVIE_NAME)
468
+ foreach (LibraryModel model, models)
496
469
{
497
- this ->comboBoxTarget ->addItem (this ->model ->getName ());
470
+ if (type == Rundown::MOVIE && model.getType () == Rundown::MOVIE)
471
+ this ->comboBoxTarget ->addItem (model.getName ());
472
+ else if (type == Rundown::AUDIO && model.getType () == Rundown::AUDIO)
473
+ this ->comboBoxTarget ->addItem (model.getName ());
474
+ else if (type == Rundown::TEMPLATE && model.getType () == Rundown::TEMPLATE)
475
+ this ->comboBoxTarget ->addItem (model.getName ());
476
+ else if ((type == Rundown::STILL || type == Rundown::IMAGESCROLLER) && model.getType () == Rundown::STILL)
477
+ this ->comboBoxTarget ->addItem (model.getName ());
498
478
}
499
479
}
500
-
501
- this ->comboBoxTarget ->setCurrentIndex (this ->comboBoxTarget ->findText (this ->model ->getName ()));
502
480
}
503
- else
481
+
482
+ // Include current target when it is not already an option.
483
+ if (this ->comboBoxTarget ->findText (this ->model ->getName ()) == -1 )
504
484
{
505
485
if (!this ->model ->getName ().isEmpty () &&
506
486
(this ->model ->getType () == Rundown::AUDIO || this ->model ->getType () == Rundown::STILL ||
@@ -549,13 +529,13 @@ void InspectorOutputWidget::deviceRemoved()
549
529
blockAllSignals (true );
550
530
551
531
this ->comboBoxDevice ->clear ();
552
- foreach (const DeviceModel& model, DeviceManager::getInstance ().getDeviceModels ())
532
+ foreach (const DeviceModel & model, DeviceManager::getInstance ().getDeviceModels ())
553
533
this ->comboBoxDevice ->addItem (model.getName ());
554
534
555
535
blockAllSignals (false );
556
536
}
557
537
558
- void InspectorOutputWidget::deviceAdded (CasparDevice& device)
538
+ void InspectorOutputWidget::deviceAdded (CasparDevice & device)
559
539
{
560
540
blockAllSignals (true );
561
541
@@ -579,7 +559,7 @@ void InspectorOutputWidget::deviceNameChanged(QString deviceName)
579
559
return ;
580
560
581
561
const QSharedPointer<DeviceModel> model = DeviceManager::getInstance ().getDeviceModelByName (deviceName);
582
- const QStringList& channelFormats = DatabaseManager::getInstance ().getDeviceByName (model->getName ()).getChannelFormats ().split (" ," );
562
+ const QStringList & channelFormats = DatabaseManager::getInstance ().getDeviceByName (model->getName ()).getChannelFormats ().split (" ," );
583
563
this ->spinBoxChannel ->setMaximum (channelFormats.count ());
584
564
585
565
if (model->getLockedChannel () > 0 && model->getLockedChannel () <= this ->spinBoxChannel ->maximum ())
0 commit comments