示例#1
0
bool PreviewWidget::eventFilter(QObject* target, QEvent* event)
{
    if (event->type() == static_cast<QEvent::Type>(Enum::EventType::LibraryItemSelected) ||
        event->type() == static_cast<QEvent::Type>(Enum::EventType::RundownItemSelected))
    {
        int thumbnailId = 0;
        if (dynamic_cast<LibraryItemSelectedEvent*>(event))
        {
            LibraryItemSelectedEvent* libraryItemSelectedEvent = dynamic_cast<LibraryItemSelectedEvent*>(event);
            thumbnailId = libraryItemSelectedEvent->getLibraryModel()->getThumbnailId();
        }
        else if (dynamic_cast<RundownItemSelectedEvent*>(event))
        {
            RundownItemSelectedEvent* rundownItemSelected = dynamic_cast<RundownItemSelectedEvent*>(event);
            thumbnailId = rundownItemSelected->getLibraryModel()->getThumbnailId();
        }

        if (thumbnailId > 0)
        {
            QString data = DatabaseManager::getInstance().getThumbnailById(thumbnailId).getData();
            this->image.loadFromData(QByteArray::fromBase64(data.toAscii()), "PNG");

            if (this->previewAlpha)
                this->labelPreview->setPixmap(QPixmap::fromImage(this->image.alphaChannel()));
            else
                this->labelPreview->setPixmap(QPixmap::fromImage(this->image));
        }
        else
        {
            this->labelPreview->setPixmap(NULL);
        }
    }

    return QObject::eventFilter(target, event);
}
bool InspectorMetadataWidget::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->lineEditLabel->setEnabled(false);

        this->lineEditType->setText(this->model->getType());
        this->lineEditLabel->clear();

        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->lineEditLabel->setEnabled(true);

        this->lineEditLabel->setReadOnly(false);

        this->lineEditType->setText(this->model->getType());
        this->lineEditLabel->setText(this->model->getLabel());

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

        this->lineEditLabel->setEnabled(false);

        this->lineEditType->clear();
        this->lineEditLabel->clear();

        blockAllSignals(false);
    }

    return QObject::eventFilter(target, event);
}
示例#3
0
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);
}
bool InspectorMetadataWidget::eventFilter(QObject* target, QEvent* event)
{
    if (event->type() == static_cast<QEvent::Type>(Enum::EventType::LibraryItemSelected))
    {
        this->preview = false;

        this->lineEditLabel->setReadOnly(true);
        this->comboBoxDevice->setEnabled(false);
        this->lineEditName->setReadOnly(true);

        LibraryItemSelectedEvent* libraryItemSelectedEvent = dynamic_cast<LibraryItemSelectedEvent*>(event);
        this->model = libraryItemSelectedEvent->getLibraryModel();

        this->lineEditLabel->clear();
        this->lineEditType->setText(this->model->getType());
        this->comboBoxDevice->setCurrentIndex(this->comboBoxDevice->findText(this->model->getDeviceName()));
        this->lineEditName->setText(this->model->getName());

        checkEmptyDevice();

        this->preview = true;
    }
    else if (event->type() == static_cast<QEvent::Type>(Enum::EventType::RundownItemSelected))
    {
        this->preview = false;

        RundownItemSelectedEvent* rundownItemSelectedEvent = dynamic_cast<RundownItemSelectedEvent*>(event);
        this->model = rundownItemSelectedEvent->getLibraryModel();

        this->lineEditLabel->setReadOnly(false);
        this->comboBoxDevice->setEnabled(true);
        this->lineEditName->setReadOnly(false);
        this->lineEditName->setEnabled(true);

        this->lineEditType->setText(this->model->getType());
        this->lineEditLabel->setText(this->model->getLabel());
        this->comboBoxDevice->setCurrentIndex(this->comboBoxDevice->findText(this->model->getDeviceName()));
        this->lineEditName->setText(this->model->getName());

        if (dynamic_cast<GpiOutputCommand*>(rundownItemSelectedEvent->getCommand()) ||
            dynamic_cast<GroupCommand*>(rundownItemSelectedEvent->getCommand()) ||
            dynamic_cast<SeparatorCommand*>(rundownItemSelectedEvent->getCommand()))
        {
            this->comboBoxDevice->setEnabled(false);
            this->lineEditName->setEnabled(false);
        }
        else if (dynamic_cast<PrintCommand*>(rundownItemSelectedEvent->getCommand()) ||
                 dynamic_cast<FileRecorderCommand*>(rundownItemSelectedEvent->getCommand()) ||
                 dynamic_cast<DeckLinkInputCommand*>(rundownItemSelectedEvent->getCommand()) ||
                 dynamic_cast<BlendModeCommand*>(rundownItemSelectedEvent->getCommand()) ||
                 dynamic_cast<ChromaCommand*>(rundownItemSelectedEvent->getCommand()) ||
                 dynamic_cast<BrightnessCommand*>(rundownItemSelectedEvent->getCommand()) ||
                 dynamic_cast<CommitCommand*>(rundownItemSelectedEvent->getCommand()) ||
                 dynamic_cast<ContrastCommand*>(rundownItemSelectedEvent->getCommand()) ||
                 dynamic_cast<CropCommand*>(rundownItemSelectedEvent->getCommand()) ||
                 dynamic_cast<GeometryCommand*>(rundownItemSelectedEvent->getCommand()) ||
                 dynamic_cast<GridCommand*>(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<ColorProducerCommand*>(rundownItemSelectedEvent->getCommand()))
        {
            this->lineEditName->setEnabled(false);
        }

        checkEmptyDevice();

        this->preview = true;
    }
    else if (event->type() == static_cast<QEvent::Type>(Enum::EventType::RundownIsEmpty))
    {
        this->preview = false;

        this->lineEditLabel->setReadOnly(true);
        this->comboBoxDevice->setEnabled(false);
        this->lineEditName->setReadOnly(true);

        this->lineEditType->clear();
        this->lineEditLabel->clear();
        this->comboBoxDevice->setCurrentIndex(-1);
        this->lineEditName->clear();

        checkEmptyDevice();

        this->preview = true;
    }

    return QObject::eventFilter(target, event);
}
示例#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);
}
示例#6
0
void PreviewWidget::libraryItemSelected(const LibraryItemSelectedEvent& event)
{
    this->model = event.getLibraryModel();

    setThumbnail();
}