Ejemplo n.º 1
0
void InspectorOutputWidget::fillTargetCombo(const QString& type)
{
    if (this->model == NULL)
        return;

    this->comboBoxTarget->clear();

    const QSharedPointer<CasparDevice> device = DeviceManager::getInstance().getDeviceByName(this->model->getDeviceName());
    if (device == NULL)
        return;

    const DeviceModel deviceModel = DeviceManager::getInstance().getDeviceModelByName(this->model->getDeviceName());

    QList<LibraryModel> models = DatabaseManager::getInstance().getLibraryByDeviceId(deviceModel.getId());
    if (models.count() == 0)
        return;

    foreach (LibraryModel model, models)
    {
        if (type == "MOVIE" && model.getType() == "MOVIE")
            this->comboBoxTarget->addItem(model.getName());
        else if (type == Rundown::AUDIO && model.getType() == Rundown::AUDIO)
            this->comboBoxTarget->addItem(model.getName());
        else if (type == Rundown::TEMPLATE && model.getType() == Rundown::TEMPLATE)
            this->comboBoxTarget->addItem(model.getName());
        else if ((type == Rundown::IMAGE || type == Rundown::IMAGESCROLLER) && model.getType() == "STILL")
            this->comboBoxTarget->addItem(model.getName());
    }

    this->comboBoxTarget->setCurrentIndex(this->comboBoxTarget->findText(this->model->getName()));
}
Ejemplo n.º 2
0
void InspectorFillWidget::channelChanged(const ChannelChangedEvent& event)
{
    blockAllSignals(true);

    if (this->model != NULL && this->command != NULL)
    {
        const DeviceModel model = DatabaseManager::getInstance().getDeviceByName(this->model->getDeviceName());
        if (!model.getName().isEmpty())
        {
            const QStringList& channelFormats = DatabaseManager::getInstance().getDeviceByName(model.getName()).getChannelFormats().split(",");
            if (event.getChannel() <= channelFormats.count())
            {
                const FormatModel& formatModel = DatabaseManager::getInstance().getFormat(channelFormats.at(event.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);
}
Ejemplo n.º 3
0
void InspectorFillWidget::rundownItemSelected(const RundownItemSelectedEvent& event)
{
    this->command = nullptr;
    this->model = event.getLibraryModel();

    blockAllSignals(true);

    if (dynamic_cast<FillCommand*>(event.getCommand()))
    {
        this->command = dynamic_cast<FillCommand*>(event.getCommand());

        const DeviceModel model = DatabaseManager::getInstance().getDeviceByName(this->model->getDeviceName());
        if (!model.getName().isEmpty())
        {
            const QStringList& channelFormats = DatabaseManager::getInstance().getDeviceByName(model.getName()).getChannelFormats().split(",");
            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);
}
Ejemplo n.º 4
0
bool
canBeResized( PartitionCoreModule* core, const QString& partitionPath )
{
    //FIXME: check for max partitions count on DOS MBR
    cDebug() << "checking if" << partitionPath << "can be resized.";
    QString partitionWithOs = partitionPath;
    if ( partitionWithOs.startsWith( "/dev/" ) )
    {
        cDebug() << partitionWithOs << "seems like a good path";
        bool canResize = false;
        DeviceModel* dm = core->deviceModel();
        for ( int i = 0; i < dm->rowCount(); ++i )
        {
            Device* dev = dm->deviceForIndex( dm->index( i ) );
            Partition* candidate = KPMHelpers::findPartitionByPath( { dev }, partitionWithOs );
            if ( candidate )
            {
                cDebug() << "found Partition* for" << partitionWithOs;
                return canBeResized( candidate );
            }
        }
    }

    cDebug() << "Partition" << partitionWithOs << "CANNOT BE RESIZED FOR AUTOINSTALL.";
    return false;
}
bool AbstractFilteredDeviceModel::filterAcceptsRow(int sourceRow, const QModelIndex &) const {
	DeviceModel *model = qobject_cast<DeviceModel *>(this->sourceModel());
	if (!model) {
		//Should not happen
		return false;
	}
	return this->filterAcceptsDevice(qobject_cast<Device *>(model->get(sourceRow).value<QObject *>()));
}
void AbstractFilteredDeviceModel::rowsAdded(const QModelIndex &, int start, int end) {
	DeviceModel *model = qobject_cast<DeviceModel *>(this->sourceModel());
	if (!model) {
		return;
	}
	for (int i = start; i <= end; ++i ) {
		Device *device = qobject_cast<Device *>(model->get(i).value<QObject *>());
		connect(device, SIGNAL(nameChanged()), this, SLOT(invalidate()));
		this->deviceAdded(device);
	}
}
Ejemplo n.º 7
0
void InspectorOutputWidget::deviceAdded(CasparDevice& device)
{
    DeviceModel model = DeviceManager::getInstance().getDeviceModelByAddress(device.getAddress());
    if (model.getShadow() == "Yes")
        return; // Don't add shadow systems.

    int index = this->comboBoxDevice->currentIndex();

    this->comboBoxDevice->addItem(model.getName());

    if (index == -1)
        this->comboBoxDevice->setCurrentIndex(index);
}
Ejemplo n.º 8
0
void DeviceFilterWidget::deviceAdded(CasparDevice& device)
{
    this->sendEvents = false;

    DeviceModel model = DeviceManager::getInstance().getDeviceModelByAddress(device.getAddress());
    if (model.getShadow() == "Yes")
        return; // Don't add shadow systems.

    this->comboBoxDeviceFilter->addItem(QString("%1").arg(model.getName()));

    dynamic_cast<QStandardItemModel*>(this->comboBoxDeviceFilter->model())->item(this->comboBoxDeviceFilter->count() - 1, 0)->setFlags(Qt::ItemIsUserCheckable | Qt::ItemIsEnabled);
    dynamic_cast<QStandardItemModel*>(this->comboBoxDeviceFilter->model())->item(this->comboBoxDeviceFilter->count() - 1, 0)->setData(Qt::Unchecked, Qt::CheckStateRole);

    this->sendEvents = true;
}
Ejemplo n.º 9
0
void DeviceDialog::accept()
{
    if (this->lineEditDeviceName->text().isEmpty() || this->lineEditAddress->text().isEmpty())
        return;

    if (!this->editMode)
    {
        DeviceModel model = DatabaseManager::getInstance().getDeviceByName(this->lineEditDeviceName->text());
        if (!model.getName().isEmpty())
        {
            QMessageBox box(this);
            box.setWindowTitle("Add Device");
            box.setWindowIcon(QIcon(":/Graphics/Images/CasparCG.png"));
            box.setText("The name already exists in the database. Please choose a unique name.");
            box.setIconPixmap(QPixmap(":/Graphics/Images/Attention.png"));
            box.setStandardButtons(QMessageBox::Ok);
            box.buttons().at(0)->setFocusPolicy(Qt::NoFocus);
            box.exec();

            this->lineEditDeviceName->setFocus();
            this->lineEditDeviceName->selectAll();

            return;
        }

        /*
        model = DatabaseManager::getInstance().getDeviceByAddress(this->lineEditAddress->text());
        if (!model.getName().isEmpty())
        {
            QMessageBox box(this);
            box.setWindowTitle("Add Device");
            box.setWindowIcon(QIcon(":/Graphics/Images/CasparCG.png"));
            box.setText("The address already exists in the database. Please choose a unique address.");
            box.setIconPixmap(QPixmap(":/Graphics/Images/Attention.png"));
            box.setStandardButtons(QMessageBox::Ok);
            box.buttons().at(0)->setFocusPolicy(Qt::NoFocus);
            box.exec();

            this->lineEditAddress->setFocus();
            this->lineEditAddress->selectAll();

            return;
        }
        */
    }

    QDialog::accept();
}
Ejemplo n.º 10
0
void DeviceDialog::setDeviceModel(const DeviceModel& model)
{
    this->editMode = true;

    setWindowTitle("Edit CasparCG Server");

    this->lineEditDeviceName->setText(model.getName());
    this->lineEditAddress->setText(model.getAddress());
    this->lineEditPort->setText(QString("%1").arg(model.getPort()));
    this->lineEditUsername->setText(model.getUsername());
    this->lineEditPassword->setText(model.getPassword());
    this->lineEditDescription->setText(model.getDescription());
    this->checkBoxShadow->setChecked((model.getShadow() == "Yes") ? true : false);
    this->checkBoxPreview->setChecked((model.getPreviewChannel() > 0) ? true : false);
    this->spinBoxPreviewChannel->setEnabled(this->checkBoxPreview->isChecked());
}