Esempio n. 1
0
void InspectorFillWidget::deviceChanged(const DeviceChangedEvent& event)
{
    blockAllSignals(true);

    if (this->command != NULL)
    {
        const DeviceModel model = DatabaseManager::getInstance().getDeviceByName(event.getDeviceName());
        if (!model.getName().isEmpty())
        {
            const QStringList& channelFormats = DatabaseManager::getInstance().getDeviceByName(model.getName()).getChannelFormats().split(",");
            if (this->command->getChannel() > channelFormats.count())
                return;

            const FormatModel formatModel = DatabaseManager::getInstance().getFormat(channelFormats.at(this->command->getChannel() - 1));

            this->resolutionWidth = formatModel.getWidth();
            this->resolutionHeight = formatModel.getHeight();

            setScaleAndPositionValues();
        }

        this->spinBoxTransitionDuration->setValue(this->command->getTransitionDuration());
        this->comboBoxTween->setCurrentIndex(this->comboBoxTween->findText(this->command->getTween()));
        this->checkBoxTriggerOnNext->setChecked(this->command->getTriggerOnNext());
        this->checkBoxDefer->setChecked(this->command->getDefer());
        this->checkBoxUseMipmap->setChecked(this->command->getUseMipmap());
    }

    blockAllSignals(false);
}
Esempio n. 2
0
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);
}
Esempio n. 3
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);
}