Exemplo n.º 1
0
ScriptItem::ScriptItem(const openstudio::path& path,
                       OSItemType type,
                       QWidget * parent)
  : OSItem(scriptToItemId(path), type, parent),
    m_removed(false),
    m_scriptInfo(path, true, false)
{
  setText(openstudio::toQString(path.filename()));
  setLeftPixmap(QPixmap(":/images/icon_scripts.png"));
  if (boost::regex_search(toString(itemId().sourceId()),boost::regex("resource"))) {
    m_scriptInfo.isUserScript = false;
  }
  else {
    try {
      m_scriptInfo = runmanager::RubyJobBuilder::updateArgumentsFromDb(m_scriptInfo);
    } catch (const runmanager::ScriptDetectionError &e) {
      // Nothing to display here in the constructor
      m_scriptInfo = e.scriptInfo;
    }
  }


  std::shared_ptr<OSDocument> osDoc = OSAppBase::instance()->currentDocument();
  connect(this, &ScriptItem::argChanged, osDoc.get(), &OSDocument::markAsModified);
}
Exemplo n.º 2
0
K3b::VideoDVDRippingView::VideoDVDRippingView( QWidget* parent )
    : K3b::MediaContentsView( true,
                            K3b::Medium::ContentVideoDVD,
                            K3b::Device::MEDIA_DVD_ALL,
                            K3b::Device::STATE_INCOMPLETE|K3b::Device::STATE_COMPLETE,
                            parent ),
      d( new Private )
{
    // toolbox
    // ----------------------------------------------------------------------------------
    d->toolBox = new KToolBar( mainWidget() );

    KUrlLabel* showFilesLabel = new KUrlLabel( d->toolBox );
    showFilesLabel->setContentsMargins( style()->pixelMetric( QStyle::PM_LayoutLeftMargin ), 0,
                                        style()->pixelMetric( QStyle::PM_LayoutRightMargin ), 0 );
    showFilesLabel->setText( i18n("Show files") );
    showFilesLabel->setWhatsThis( i18n("Shows plain Video DVD vob files from the DVD "
                                       "(including decryption) for further processing with another application") );
    connect( showFilesLabel, SIGNAL(leftClickedUrl()), this, SLOT(slotShowFiles()) );

    d->labelLength = new QLabel( d->toolBox );
    d->labelLength->setAlignment( Qt::AlignVCenter | Qt::AlignRight );
    d->labelLength->setContentsMargins( style()->pixelMetric( QStyle::PM_LayoutLeftMargin ), 0,
                                        style()->pixelMetric( QStyle::PM_LayoutRightMargin ), 0 );

    d->delegate = new VideoDVDTitleDelegate( this );
    d->model = new VideoDVDTitleModel( this );

    // the title view
    // ----------------------------------------------------------------------------------
    d->view = new QTreeView( mainWidget() );
    d->view->setItemDelegate( d->delegate );
    d->view->setSelectionMode( QAbstractItemView::ExtendedSelection );
    d->view->setModel( d->model );
    d->view->setRootIsDecorated( false );
    d->view->header()->setResizeMode( QHeaderView::ResizeToContents );
    d->view->setContextMenuPolicy( Qt::CustomContextMenu );
    d->view->installEventFilter( this );
    connect( d->view, SIGNAL(customContextMenuRequested(QPoint)),
             this, SLOT(slotContextMenu(QPoint)) );

    // general layout
    // ----------------------------------------------------------------------------------
    QVBoxLayout* mainGrid = new QVBoxLayout( mainWidget() );
    mainGrid->addWidget( d->toolBox );
    mainGrid->addWidget( d->view );
    mainGrid->setContentsMargins( 0, 0, 0, 0 );
    mainGrid->setSpacing( 0 );

    setLeftPixmap( K3b::Theme::MEDIA_LEFT );
    setRightPixmap( K3b::Theme::MEDIA_VIDEO );

    initActions();

    d->toolBox->addAction( actionCollection()->action("start_rip") );
    d->toolBox->addSeparator();
    d->toolBox->addWidget( showFilesLabel );
    d->toolBox->addAction( new KToolBarSpacerAction( d->toolBox ) );
    d->toolBox->addWidget( d->labelLength );
}
Exemplo n.º 3
0
K3bVideoDVDRippingView::K3bVideoDVDRippingView( QWidget* parent, const char * name )
  : K3bMediaContentsView( true,
			  K3bMedium::CONTENT_VIDEO_DVD,
			  K3bDevice::MEDIA_DVD_ALL,
			  K3bDevice::STATE_INCOMPLETE|K3bDevice::STATE_COMPLETE,
			  parent, name )
{
  QGridLayout* mainGrid = new QGridLayout( mainWidget() );

  // toolbox
  // ----------------------------------------------------------------------------------
  QHBoxLayout* toolBoxLayout = new QHBoxLayout( 0, 0, 0, "toolBoxLayout" );
  m_toolBox = new K3bToolBox( mainWidget() );
  toolBoxLayout->addWidget( m_toolBox );
  QSpacerItem* spacer = new QSpacerItem( 10, 10, QSizePolicy::Expanding, QSizePolicy::Minimum );
  toolBoxLayout->addItem( spacer );
  m_labelLength = new QLabel( mainWidget() );
  m_labelLength->setAlignment( int( QLabel::AlignVCenter | QLabel::AlignRight ) );
  toolBoxLayout->addWidget( m_labelLength );


  // the title view
  // ----------------------------------------------------------------------------------
  m_titleView = new K3bVideoDVDRippingTitleListView( mainWidget() );

  connect( m_titleView, SIGNAL(contextMenu(KListView*, QListViewItem*, const QPoint&)),
	   this, SLOT(slotContextMenu(KListView*, QListViewItem*, const QPoint&)) );

  // general layout
  // ----------------------------------------------------------------------------------
  mainGrid->addLayout( toolBoxLayout, 0, 0 );
  mainGrid->addWidget( m_titleView, 1, 0 );


  initActions();

  m_toolBox->addButton( actionCollection()->action("start_rip"), true );

  setLeftPixmap( K3bTheme::MEDIA_LEFT );
  setRightPixmap( K3bTheme::MEDIA_VIDEO );
}
Exemplo n.º 4
0
void OSItem::createLayout()
{
  auto mainHLayout = new QHBoxLayout();
  mainHLayout->setContentsMargins(10,5,10,5);
  mainHLayout->setAlignment(Qt::AlignVCenter);
  setLayout(mainHLayout);

  auto leftVBoxLayout = new QVBoxLayout();

  m_imageLeftLbl = new QLabel(this);
  leftVBoxLayout->addWidget(m_imageLeftLbl);

  m_measureBadge = new MeasureBadge();
  //m_measureBadge->setFixedWidth(25); NOTE mirror other instance?

  leftVBoxLayout->addWidget(m_measureBadge);

  mainHLayout->addLayout(leftVBoxLayout);

  std::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);
  }

  connect(m_removeButton, &QPushButton::clicked, this, &OSItem::onRemoveClicked);
}