void SCameraConfigLauncher::starting() { this->create(); m_cameraSeries = this->getInOut< ::arData::CameraSeries >("cameraSeries"); SLM_ASSERT("Missing cameraSeries.", m_cameraSeries); m_activitySeries = this->getInOut< ::fwMedData::ActivitySeries >("activitySeries"); SLM_ASSERT("Missing activitySeries.", m_activitySeries); auto qtContainer = ::fwGuiQt::container::QtContainer::dynamicCast( this->getContainer() ); QHBoxLayout* layout = new QHBoxLayout(); m_cameraComboBox = new QComboBox(); layout->addWidget(m_cameraComboBox); QIcon addIcon(QString::fromStdString(::fwRuntime::getBundleResourceFilePath("media", "icons/Import.svg").string())); m_addButton = new QPushButton(addIcon, ""); m_addButton->setToolTip("Add a new camera."); layout->addWidget(m_addButton); QIcon importIcon(QString::fromStdString(::fwRuntime::getBundleResourceFilePath("arMedia", "icons/CameraSeries.svg").string())); m_importButton = new QPushButton(importIcon, ""); m_importButton->setToolTip("Import an intrinsic calibration."); layout->addWidget(m_importButton); QIcon removeIcon(QString::fromStdString(::fwRuntime::getBundleResourceFilePath("arMedia", "icons/remove.svg").string())); m_removeButton = new QPushButton(removeIcon, ""); m_removeButton->setToolTip("Remove the camera."); layout->addWidget(m_removeButton); m_extrinsicButton = new QPushButton("Extrinsic"); layout->addWidget(m_extrinsicButton); m_extrinsicButton->setCheckable(true); qtContainer->setLayout( layout ); const size_t nbCam = m_cameraSeries->getNumberOfCameras(); if (nbCam == 0) { this->addCamera(); m_extrinsicButton->setEnabled(false); m_removeButton->setEnabled(false); } else { for (size_t i = 0; i < nbCam; ++i) { m_cameraComboBox->addItem(QString("Camera %1").arg(i+1)); } const bool moreThanOneCamera = (nbCam > 1); m_extrinsicButton->setEnabled(moreThanOneCamera); m_removeButton->setEnabled(moreThanOneCamera); } QObject::connect(m_cameraComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(onCameraChanged(int))); QObject::connect(m_addButton, SIGNAL(clicked()), this, SLOT(onAddClicked())); QObject::connect(m_importButton, SIGNAL(clicked()), this, SLOT(onImportClicked())); QObject::connect(m_removeButton, SIGNAL(clicked()), this, SLOT(onRemoveClicked())); QObject::connect(m_extrinsicButton, SIGNAL(toggled(bool)), this, SLOT(onExtrinsicToggled(bool))); this->startIntrinsicConfig(0); }
void TrackWidget::contextMenuEvent( QContextMenuEvent* event ) { QMenu* contextMenu = new QMenu( this ); if ( ! m_nowPlaying ) { contextMenu->addAction( tr( "Delete this scrobble from your profile" ), this, SLOT(onRemoveClicked())); contextMenu->addSeparator(); } contextMenu->addAction( tr( "Play %1 Radio" ).arg( m_track.artist().name() ), this, SLOT(play())); if ( RadioService::instance().state() == Playing ) contextMenu->addAction( tr( "Cue %1 Radio" ).arg( m_track.artist().name() ), this, SLOT(playNext())); if ( contextMenu->actions().count() ) contextMenu->exec( event->globalPos() ); }
void OSItem::createLayout() { QHBoxLayout * mainHLayout = new QHBoxLayout(); mainHLayout->setContentsMargins(10,5,10,5); mainHLayout->setAlignment(Qt::AlignVCenter); setLayout(mainHLayout); QVBoxLayout * leftVBoxLayout = new QVBoxLayout(); m_imageLeftLbl = new QLabel(this); leftVBoxLayout->addWidget(m_imageLeftLbl); m_bclBadge = new QLabel("BCL",this); m_bclBadge->setStyleSheet("QLabel { color: #4B7DB0; font-size: 10pt; }"); m_bclBadge->setVisible(false); leftVBoxLayout->addWidget(m_bclBadge); mainHLayout->addLayout(leftVBoxLayout); boost::shared_ptr<OSDocument> doc = OSAppBase::instance()->currentDocument(); if(doc){ boost::optional<IddObjectType> iddObjectType = doc->getIddObjectType(m_itemId); if(iddObjectType){ const QPixmap * pixmap = IconLibrary::Instance().findMiniIcon(iddObjectType->value()); if(pixmap){ setLeftPixmap(*pixmap); } pixmap = IconLibrary::Instance().findIcon(iddObjectType->value()); if(pixmap){ m_largePixmap = *pixmap; } } } { int w = leftPixmap().size().width(); int h = leftPixmap().size().height(); if(w==-1 || h==-1){ setLeftPixmap(QPixmap(":/images/lilBug.png")); } else{ setLeftPixmap(leftPixmap()); } } m_textLbl = new QLabel(this); m_textLbl->setWordWrap(true); mainHLayout->addWidget(m_textLbl); mainHLayout->addStretch(); m_removeButton = new QPushButton(this); mainHLayout->addWidget(m_removeButton); QString style; style.append("QWidget { "); style.append("border: none;"); style.append(" background-image: url(\":/images/delete.png\")"); style.append("}"); m_removeButton->setFlat(true); m_removeButton->setStyleSheet(style); m_removeButton->setFixedSize(20,20); if (m_itemId.isDefaulted()){ m_textLbl->setStyleSheet("QLabel { color: #006837 }"); this->setRemoveable(false); } bool isConnected = false; isConnected = connect(m_removeButton,SIGNAL(clicked()), this,SLOT(onRemoveClicked())); BOOST_ASSERT(isConnected); }