void TriCasterDeviceDialog::accept() { if (this->lineEditDeviceName->text().isEmpty() || this->lineEditAddress->text().isEmpty()) return; if (!this->editMode) { TriCasterDeviceModel model = DatabaseManager::getInstance().getTriCasterDeviceByName(this->lineEditDeviceName->text()); if (!model.getName().isEmpty()) { QMessageBox box(this); box.setWindowTitle("Add TriCaster 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().getTriCasterDeviceByAddress(this->lineEditAddress->text()); if (!model.getName().isEmpty()) { QMessageBox box(this); box.setWindowTitle("Add TriCaster 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(); }
void InspectorOutputWidget::tricasterDeviceAdded(TriCasterDevice& device) { TriCasterDeviceModel model = TriCasterDeviceManager::getInstance().getDeviceModelByAddress(device.getAddress()); int index = this->comboBoxTriCasterDevice->currentIndex(); this->comboBoxTriCasterDevice->addItem(model.getName()); if (index == -1) this->comboBoxTriCasterDevice->setCurrentIndex(index); }
void TriCasterDeviceDialog::setDeviceModel(const TriCasterDeviceModel& model) { this->editMode = true; setWindowTitle("Edit TriCaster Server"); this->lineEditDeviceName->setText(model.getName()); this->lineEditAddress->setText(model.getAddress()); this->lineEditPort->setText(QString("%1").arg(model.getPort())); this->lineEditDescription->setText(model.getDescription()); }