void InspectorOutputWidget::templateChanged(const TemplateChangedEvent& event)
{
    if (this->model == NULL)
        return;

    blockAllSignals(true);

    fillTargetCombo(this->model->getType());

    blockAllSignals(false);
}
void InspectorOutputWidget::deviceChanged(const DeviceChangedEvent& event)
{
    if (this->model == NULL)
        return;

    blockAllSignals(true);

    if (!event.getDeviceName().isEmpty())
    {
        this->model->setDeviceName(event.getDeviceName());

        fillTargetCombo(this->model->getType());
    }

    checkEmptyDevice();
    checkEmptyAtemDevice();
    checkEmptyTriCasterDevice();
    checkEmptyTarget();

    blockAllSignals(false);
}
void InspectorOutputWidget::libraryItemSelected(const LibraryItemSelectedEvent& event)
{
    this->model = event.getLibraryModel();

    blockAllSignals(true);

    this->comboBoxDevice->setVisible(true);
    this->comboBoxAtemDevice->setVisible(false);
    this->comboBoxTriCasterDevice->setVisible(false);

    this->comboBoxDevice->setEnabled(false);
    this->comboBoxTarget->setEnabled(false);
    this->spinBoxChannel->setEnabled(false);
    this->spinBoxVideolayer->setEnabled(false);
    this->spinBoxDelay->setEnabled(false);
    this->checkBoxAllowGpi->setEnabled(false);
    this->checkBoxAllowRemoteTriggering->setEnabled(false);
    this->labelRemoteTriggerId->setEnabled(false);
    this->lineEditRemoteTriggerId->setEnabled(false);

    this->labelMillisecond->setText("");
    this->labelMillisecond->setVisible(false);

    this->comboBoxDevice->setCurrentIndex(this->comboBoxDevice->findText(this->model->getDeviceName()));
    this->comboBoxAtemDevice->setCurrentIndex(this->comboBoxAtemDevice->findText(this->model->getDeviceName()));
    this->comboBoxTriCasterDevice->setCurrentIndex(this->comboBoxTriCasterDevice->findText(this->model->getDeviceName()));
    this->checkBoxAllowGpi->setChecked(Output::DEFAULT_ALLOW_GPI);
    this->checkBoxAllowRemoteTriggering->setChecked(Output::DEFAULT_ALLOW_REMOTE_TRIGGERING);
    this->lineEditRemoteTriggerId->setText(Output::DEFAULT_REMOTE_TRIGGER_ID);

    fillTargetCombo(this->model->getType());

    checkEmptyDevice();
    checkEmptyAtemDevice();
    checkEmptyTriCasterDevice();
    checkEmptyTarget();

    blockAllSignals(false);
}
void InspectorOutputWidget::rundownItemSelected(const RundownItemSelectedEvent& event)
{
    this->model = event.getLibraryModel();

    blockAllSignals(true);

    this->comboBoxDevice->setVisible(true);
    this->comboBoxAtemDevice->setVisible(false);
    this->comboBoxTriCasterDevice->setVisible(false);

    this->comboBoxDevice->setEnabled(true);
    this->comboBoxTarget->setEnabled(true);
    this->spinBoxChannel->setEnabled(true);
    this->spinBoxVideolayer->setEnabled(true);
    this->spinBoxDelay->setEnabled(true);
    this->checkBoxAllowGpi->setEnabled(true);
    this->checkBoxAllowRemoteTriggering->setEnabled(true);
    this->labelRemoteTriggerId->setEnabled(true);
    this->lineEditRemoteTriggerId->setEnabled(true);

    this->labelMillisecond->setVisible(true);
    if (this->delayType == Output::DEFAULT_DELAY_IN_FRAMES)
        this->labelMillisecond->setText("frm");
    else if (this->delayType == Output::DEFAULT_DELAY_IN_MILLISECONDS)
        this->labelMillisecond->setText("ms");

    if (event.getCommand() != NULL && event.getLibraryModel() != NULL)
    {
        this->command = event.getCommand();

        int index = this->comboBoxDevice->findText(this->model->getDeviceName());
        if (index == -1)
            this->spinBoxChannel->setMaximum(1);
        else
        {
            const QStringList& channelFormats = DatabaseManager::getInstance().getDeviceByName(this->model->getDeviceName()).getChannelFormats().split(",");
            this->spinBoxChannel->setMaximum(channelFormats.count());
        }

        this->comboBoxDevice->setCurrentIndex(index);
        this->comboBoxAtemDevice->setCurrentIndex(this->comboBoxAtemDevice->findText(this->model->getDeviceName()));
        this->comboBoxTriCasterDevice->setCurrentIndex(this->comboBoxTriCasterDevice->findText(this->model->getDeviceName()));
        this->spinBoxChannel->setValue(this->command->getChannel());
        this->spinBoxVideolayer->setValue(this->command->getVideolayer());
        this->spinBoxDelay->setValue(this->command->getDelay());
        this->checkBoxAllowGpi->setChecked(this->command->getAllowGpi());
        this->checkBoxAllowRemoteTriggering->setChecked(this->command->getAllowRemoteTriggering());
        this->lineEditRemoteTriggerId->setText(this->command->getRemoteTriggerId());

        if (!this->checkBoxAllowRemoteTriggering->isChecked())
        {
            this->labelRemoteTriggerId->setEnabled(false);
            this->lineEditRemoteTriggerId->setEnabled(false);
        }

        fillTargetCombo(this->model->getType());

        if (dynamic_cast<CommitCommand*>(event.getCommand()) ||
            dynamic_cast<PrintCommand*>(event.getCommand()) ||
            dynamic_cast<FileRecorderCommand*>(event.getCommand()) ||
            dynamic_cast<GridCommand*>(event.getCommand()))
        {
            this->comboBoxTarget->setEnabled(false);
            this->spinBoxVideolayer->setEnabled(false);

            this->spinBoxVideolayer->setValue(Output::DEFAULT_VIDEOLAYER);
        }
        else if (dynamic_cast<GroupCommand*>(event.getCommand()))
        {
            this->comboBoxDevice->setEnabled(false);
            this->comboBoxTarget->setEnabled(false);
            this->spinBoxChannel->setEnabled(false);
            this->spinBoxVideolayer->setEnabled(false);
            this->spinBoxDelay->setEnabled(false);

            this->labelMillisecond->setText("ms");

            this->comboBoxDevice->setCurrentIndex(-1);
            this->comboBoxTarget->setCurrentIndex(-1);
            this->spinBoxChannel->setValue(Output::DEFAULT_CHANNEL);
            this->spinBoxVideolayer->setValue(Output::DEFAULT_VIDEOLAYER);
            this->spinBoxDelay->setValue(Output::DEFAULT_DELAY);
        }
        else if (dynamic_cast<GpiOutputCommand*>(event.getCommand()) ||
                 dynamic_cast<OscOutputCommand*>(event.getCommand()))
        {
            this->comboBoxDevice->setEnabled(false);
            this->comboBoxTarget->setEnabled(false);
            this->spinBoxChannel->setEnabled(false);
            this->spinBoxVideolayer->setEnabled(false);

            this->labelMillisecond->setText("ms");

            this->comboBoxDevice->setCurrentIndex(-1);
            this->comboBoxTarget->setCurrentIndex(-1);
            this->spinBoxChannel->setValue(Output::DEFAULT_CHANNEL);
            this->spinBoxVideolayer->setValue(Output::DEFAULT_VIDEOLAYER);
        }
        else if (dynamic_cast<SeparatorCommand*>(event.getCommand()))
        {
            this->comboBoxDevice->setEnabled(false);
            this->comboBoxTarget->setEnabled(false);
            this->spinBoxChannel->setEnabled(false);
            this->spinBoxVideolayer->setEnabled(false);
            this->spinBoxDelay->setEnabled(false);
            this->checkBoxAllowGpi->setEnabled(false);
            this->checkBoxAllowRemoteTriggering->setEnabled(false);
            this->labelRemoteTriggerId->setEnabled(false);
            this->lineEditRemoteTriggerId->setEnabled(false);

            this->comboBoxDevice->setCurrentIndex(-1);
            this->comboBoxTarget->setCurrentIndex(-1);
            this->spinBoxChannel->setValue(Output::DEFAULT_CHANNEL);
            this->spinBoxVideolayer->setValue(Output::DEFAULT_VIDEOLAYER);
            this->spinBoxDelay->setValue(Output::DEFAULT_DELAY);
            this->checkBoxAllowGpi->setChecked(Output::DEFAULT_ALLOW_GPI);
            this->checkBoxAllowRemoteTriggering->setChecked(Output::DEFAULT_ALLOW_REMOTE_TRIGGERING);
            this->lineEditRemoteTriggerId->setText(Output::DEFAULT_REMOTE_TRIGGER_ID);
        }
        else if (dynamic_cast<CustomCommand*>(event.getCommand()))
        {
            this->comboBoxTarget->setEnabled(false);
            this->spinBoxChannel->setEnabled(false);
            this->spinBoxVideolayer->setEnabled(false);

            this->comboBoxTarget->clear();
            this->spinBoxChannel->setValue(Output::DEFAULT_CHANNEL);
            this->spinBoxVideolayer->setValue(Output::DEFAULT_VIDEOLAYER);
        }
        else if (dynamic_cast<DeckLinkInputCommand*>(event.getCommand()) ||
                 dynamic_cast<BlendModeCommand*>(event.getCommand()) ||
                 dynamic_cast<BrightnessCommand*>(event.getCommand()) ||
                 dynamic_cast<ContrastCommand*>(event.getCommand()) ||
                 dynamic_cast<CropCommand*>(event.getCommand()) ||
                 dynamic_cast<GeometryCommand*>(event.getCommand()) ||
                 dynamic_cast<KeyerCommand*>(event.getCommand()) ||
                 dynamic_cast<LevelsCommand*>(event.getCommand()) ||
                 dynamic_cast<OpacityCommand*>(event.getCommand()) ||
                 dynamic_cast<SaturationCommand*>(event.getCommand()) ||
                 dynamic_cast<VolumeCommand*>(event.getCommand()) ||
                 dynamic_cast<SolidColorCommand*>(event.getCommand()) ||
                 dynamic_cast<ClearOutputCommand*>(event.getCommand()) ||
                 dynamic_cast<ChromaCommand*>(event.getCommand()))
        {
            this->comboBoxTarget->setEnabled(false);
        }
        else if (dynamic_cast<InputCommand*>(event.getCommand()) ||
                 dynamic_cast<PresetCommand*>(event.getCommand()) ||
                 dynamic_cast<AutoCommand*>(event.getCommand()) ||
                 dynamic_cast<TakeCommand*>(event.getCommand()) ||
                 dynamic_cast<NetworkSourceCommand*>(event.getCommand()) ||
                 dynamic_cast<MacroCommand*>(event.getCommand()))
        {
            this->comboBoxDevice->setVisible(false);
            this->comboBoxAtemDevice->setVisible(false);
            this->comboBoxTriCasterDevice->setVisible(true);

            this->comboBoxDevice->setCurrentIndex(-1);
            this->comboBoxAtemDevice->setCurrentIndex(-1);
            this->comboBoxTarget->setEnabled(false);
            this->spinBoxChannel->setEnabled(false);
            this->spinBoxVideolayer->setEnabled(false);

            this->labelMillisecond->setText("ms");

            this->comboBoxTarget->clear();
            this->spinBoxChannel->setValue(Output::DEFAULT_CHANNEL);
            this->spinBoxVideolayer->setValue(Output::DEFAULT_VIDEOLAYER);
        }
        else if (dynamic_cast<AtemInputCommand*>(event.getCommand()) ||
                 dynamic_cast<AtemCutCommand*>(event.getCommand()) ||
                 dynamic_cast<AtemAutoCommand*>(event.getCommand()) ||
                 dynamic_cast<AtemKeyerStateCommand*>(event.getCommand()) ||
                 dynamic_cast<AtemVideoFormatCommand*>(event.getCommand()) ||
                 dynamic_cast<AtemAudioInputStateCommand*>(event.getCommand()) ||
                 dynamic_cast<AtemAudioGainCommand*>(event.getCommand()) ||
                 dynamic_cast<AtemAudioInputBalanceCommand*>(event.getCommand()))
        {
            this->comboBoxDevice->setVisible(false);
            this->comboBoxAtemDevice->setVisible(true);
            this->comboBoxTriCasterDevice->setVisible(false);

            this->comboBoxDevice->setCurrentIndex(-1);
            this->comboBoxTriCasterDevice->setCurrentIndex(-1);
            this->comboBoxTarget->setEnabled(false);
            this->spinBoxChannel->setEnabled(false);
            this->spinBoxVideolayer->setEnabled(false);

            this->labelMillisecond->setText("ms");

            this->comboBoxTarget->clear();
            this->spinBoxChannel->setValue(Output::DEFAULT_CHANNEL);
            this->spinBoxVideolayer->setValue(Output::DEFAULT_VIDEOLAYER);
        }
    }

    checkEmptyDevice();
    checkEmptyAtemDevice();
    checkEmptyTriCasterDevice();
    checkEmptyTarget();

    blockAllSignals(false);
}
Exemple #5
0
bool InspectorOutputWidget::eventFilter(QObject* target, QEvent* event)
{
    if (event->type() == static_cast<QEvent::Type>(Event::EventType::LibraryItemSelected))
    {
        LibraryItemSelectedEvent* libraryItemSelectedEvent = dynamic_cast<LibraryItemSelectedEvent*>(event);
        this->model = libraryItemSelectedEvent->getLibraryModel();

        blockAllSignals(true);

        this->comboBoxDevice->setEnabled(false);
        this->comboBoxTarget->setEnabled(false);
        this->spinBoxChannel->setEnabled(false);
        this->spinBoxVideolayer->setEnabled(false);
        this->spinBoxDelay->setEnabled(false);

        this->comboBoxDevice->setCurrentIndex(this->comboBoxDevice->findText(this->model->getDeviceName()));

        fillTargetCombo(this->model->getType());

        checkEmptyDevice();
        checkEmptyTarget();

        blockAllSignals(false);
    }
    else if (event->type() == static_cast<QEvent::Type>(Event::EventType::EmptyRundown))
    {
        blockAllSignals(true);

        this->comboBoxDevice->setEnabled(false);
        this->comboBoxDevice->setCurrentIndex(-1);
        this->comboBoxTarget->setEnabled(false);
        this->comboBoxTarget->clear();

        checkEmptyDevice();
        checkEmptyTarget();

        blockAllSignals(false);
    }
    else if (event->type() == static_cast<QEvent::Type>(Event::EventType::RundownItemSelected))
    {
        RundownItemSelectedEvent* rundownItemSelectedEvent = dynamic_cast<RundownItemSelectedEvent*>(event);
        this->model = rundownItemSelectedEvent->getLibraryModel();

        blockAllSignals(true);

        this->comboBoxDevice->setEnabled(true);
        this->comboBoxTarget->setEnabled(true);
        this->spinBoxChannel->setEnabled(true);
        this->spinBoxVideolayer->setEnabled(true);
        this->spinBoxDelay->setEnabled(true);

        if (rundownItemSelectedEvent->getCommand() != NULL && rundownItemSelectedEvent->getLibraryModel() != NULL)
        {
            this->command = rundownItemSelectedEvent->getCommand();

            this->comboBoxDevice->setEnabled(true);
            this->comboBoxTarget->setEnabled(true);
            this->spinBoxChannel->setEnabled(true);
            this->spinBoxVideolayer->setEnabled(true);

            int index = this->comboBoxDevice->findText(this->model->getDeviceName());
            if (index == -1)
                this->spinBoxChannel->setMaximum(1);
            else
            {
                const QStringList& channelFormats = DatabaseManager::getInstance().getDeviceByName(this->model->getDeviceName()).getChannelFormats().split(",");
                this->spinBoxChannel->setMaximum(channelFormats.count());
            }

            this->comboBoxDevice->setCurrentIndex(index);
            this->spinBoxChannel->setValue(this->command->getChannel());
            this->spinBoxVideolayer->setValue(this->command->getVideolayer());
            this->spinBoxDelay->setValue(this->command->getDelay());
            this->checkBoxAllowGpi->setChecked(this->command->getAllowGpi());

            fillTargetCombo(this->model->getType());

            if (dynamic_cast<CommitCommand*>(rundownItemSelectedEvent->getCommand()) ||
                dynamic_cast<PrintCommand*>(rundownItemSelectedEvent->getCommand()) ||
                dynamic_cast<FileRecorderCommand*>(rundownItemSelectedEvent->getCommand()) ||
                dynamic_cast<GridCommand*>(rundownItemSelectedEvent->getCommand()))
            {
                this->comboBoxTarget->setEnabled(false);
                this->spinBoxVideolayer->setEnabled(false);

                this->spinBoxVideolayer->setValue(Output::DEFAULT_VIDEOLAYER);
            }
            else if (dynamic_cast<GroupCommand*>(rundownItemSelectedEvent->getCommand()) ||
                     dynamic_cast<SeparatorCommand*>(rundownItemSelectedEvent->getCommand()) ||
                     dynamic_cast<GpiOutputCommand*>(rundownItemSelectedEvent->getCommand()))
            {
                this->comboBoxDevice->setEnabled(false);
                this->comboBoxTarget->setEnabled(false);
                this->spinBoxChannel->setEnabled(false);
                this->spinBoxVideolayer->setEnabled(false);
                this->spinBoxDelay->setEnabled(false);

                this->comboBoxDevice->setCurrentIndex(-1);
                this->spinBoxChannel->setValue(Output::DEFAULT_CHANNEL);
                this->spinBoxVideolayer->setValue(Output::DEFAULT_VIDEOLAYER);
                this->spinBoxDelay->setValue(Output::DEFAULT_DELAY);
                this->checkBoxAllowGpi->setChecked(Output::DEFAULT_ALLOW_GPI);
            }
            else if (dynamic_cast<CustomCommand*>(rundownItemSelectedEvent->getCommand()))
            {
                this->comboBoxTarget->setEnabled(false);
                this->spinBoxChannel->setEnabled(false);
                this->spinBoxVideolayer->setEnabled(false);

                this->spinBoxChannel->setValue(Output::DEFAULT_CHANNEL);
                this->spinBoxVideolayer->setValue(Output::DEFAULT_VIDEOLAYER);
            }
            else if (dynamic_cast<DeckLinkInputCommand*>(rundownItemSelectedEvent->getCommand()) ||
                     dynamic_cast<BlendModeCommand*>(rundownItemSelectedEvent->getCommand()) ||
                     dynamic_cast<BrightnessCommand*>(rundownItemSelectedEvent->getCommand()) ||
                     dynamic_cast<ContrastCommand*>(rundownItemSelectedEvent->getCommand()) ||
                     dynamic_cast<CropCommand*>(rundownItemSelectedEvent->getCommand()) ||
                     dynamic_cast<GeometryCommand*>(rundownItemSelectedEvent->getCommand()) ||
                     dynamic_cast<KeyerCommand*>(rundownItemSelectedEvent->getCommand()) ||
                     dynamic_cast<LevelsCommand*>(rundownItemSelectedEvent->getCommand()) ||
                     dynamic_cast<OpacityCommand*>(rundownItemSelectedEvent->getCommand()) ||
                     dynamic_cast<SaturationCommand*>(rundownItemSelectedEvent->getCommand()) ||
                     dynamic_cast<VolumeCommand*>(rundownItemSelectedEvent->getCommand()) ||
                     dynamic_cast<SolidColorCommand*>(rundownItemSelectedEvent->getCommand()) ||
                     dynamic_cast<ClearOutputCommand*>(rundownItemSelectedEvent->getCommand()) ||
                     dynamic_cast<ChromaCommand*>(rundownItemSelectedEvent->getCommand()))
            {
                this->comboBoxTarget->setEnabled(false);
            }
        }

        checkEmptyDevice();
        checkEmptyTarget();

        blockAllSignals(false);
    }
    else if (event->type() == static_cast<QEvent::Type>(Event::EventType::DeviceChanged))
    {
        if (this->model == NULL)
            return false;

        blockAllSignals(true);

        DeviceChangedEvent* deviceChangedEvent = dynamic_cast<DeviceChangedEvent*>(event);
        if (!deviceChangedEvent->getDeviceName().isEmpty())
        {
            this->model->setDeviceName(deviceChangedEvent->getDeviceName());

            fillTargetCombo(this->model->getType());
        }

        checkEmptyDevice();
        checkEmptyTarget();

        blockAllSignals(false);
    }
    else if (event->type() == static_cast<QEvent::Type>(Event::EventType::MediaChanged) ||
             event->type() == static_cast<QEvent::Type>(Event::EventType::TemplateChanged))
    {
        if (this->model == NULL)
            return false;

        blockAllSignals(true);

        fillTargetCombo(this->model->getType());

        blockAllSignals(false);
    }

    return QObject::eventFilter(target, event);
}