Exemple #1
0
    void buildDisplay() {
        // delete all the children
        foreach( QWidget* w, wl )
            delete w;
        wl.clear();

        // remove the stretch we added in the last call
        if ( QLayoutItem* item = layout->takeAt( 0 ) )
            delete item;

        // create new labels
        for( QStringList::const_iterator it = tags.constBegin();
             it != tags.constEnd(); ++it ) {
            if (  it != tags.constBegin() ) {
                QLabel* label = new QLabel( "-", parent );
                wl.append( label );
                layout->addWidget( label ); // FIXME: display some nicer symbol like a big dot
            }
            KUrlLabel* label = new KUrlLabel( *it, *it, parent );
            wl.append( label );
            label->setUnderline( false );
            layout->addWidget( label );

            connect( label, SIGNAL(leftClickedUrl(QString)),
                     parent, SIGNAL(tagClicked(QString)) );
        }

        layout->addStretch( 1 );
    }
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 );
}
Exemple #3
0
AudioPreview::AudioPreview( QWidget *parent, const KUrl &url, const QString &mimeType)
  : KVBox( parent )
{
  m_isTempFile = false;
  pic = 0;
  m_player = 0L;
  description = 0;
  setSpacing( 0 );
  if( url.isValid() && url.isLocalFile() ) {
    m_localFile = url.toLocalFile();
    pic = new QLabel(this);
    pic->setPixmap(KIO::pixmapForUrl( url ));
    pic->adjustSize();
    initView( mimeType );
  } else if( !url.isLocalFile() ) {
    KUrlLabel *label = new KUrlLabel( this );
    label->setText(i18n("This audio file is not stored\non the local host.\nClick on this label to load it.\n" ) );
    label->setUrl( url.prettyUrl() );
    connect(label, SIGNAL(leftClickedUrl(const QString&)), SLOT(downloadFile(const QString&)));
    pic = label;
  } else {
    description = new QLabel(this );
    description->setText(i18n("Unable to load audio file") );
  }
}
// link this page to SimpleViewer to gain acess to settings container.
FirstRunPage::FirstRunPage(KAssistantDialog* const dlg)
    : KPWizardPage(dlg, i18n("First Run")),
      d(new FirstRunPagePriv)
{
    KVBox* vbox   = new KVBox(this);
//    QVBoxLayout* topLayout = new QVBoxLayout(vbox);
    QLabel* info1 = new QLabel(vbox);
    info1->setWordWrap(true);
    info1->setText( i18n("<p>SimpleViewer's plugins are Flash components which are free to use, "
                         "but use a license which comes into conflict with several distributions. "
                         "Due to the license it is not possible to ship it with this tool.</p>"
                         "<p>You can now download plugin from its homepage and point this tool "
                         "to the downloaded archive. The archive will be stored with the plugin configuration, "
                         "so it is available for further use.</p>"
                         "<p><b>Note: Please download the plugin that you selected on the first page.</b></p>"));

    QLabel* info2   = new QLabel(vbox);
    info2->setText(i18n("<p>1.) Download plugin from the following url:</p>"));

    KUrlLabel* link = new KUrlLabel(vbox);
    link->setText("http://www.simpleviewer.net");
    link->setUrl("http://www.simpleviewer.net");

    connect(link, SIGNAL(leftClickedUrl(QString)),
            this, SLOT(slotDownload(QString)));

    QLabel* info3   = new QLabel(vbox);
    info3->setText(i18n("<p>2.) Point this tool to the downloaded archive</p>"));

    d->urlRequester = new KUrlRequester(vbox);
    connect(d->urlRequester, SIGNAL(urlSelected(KUrl)),
            this, SLOT(slotUrlSelected(KUrl)));

    setPageWidget(vbox);
    setLeftBottomPix(DesktopIcon("flash", 128));
}
Exemple #5
0
bool KrToolResultTable::addRow(SearchObject* search, QGridLayout* grid)
{
    ApplicationGroup* appGroup = dynamic_cast<ApplicationGroup*>(search);
    QList<Application*> _apps = appGroup->getAppVec();

    // Name column
    _label = new QLabel(appGroup->getSearchName(), this);
    _label->setContentsMargins(5, 5, 5, 5);
    _label->setAlignment(Qt::AlignTop);
    grid->addWidget(_label, _numRows, 0);

    // Tool column
    QWidget* toolBoxWidget = new QWidget(this);
    QVBoxLayout * toolBox = new QVBoxLayout(toolBoxWidget);

    for (QList<Application*>::Iterator it = _apps.begin(); it != _apps.end(); ++it) {
        KUrlLabel* l = new KUrlLabel((*it)->getWebsite(), (*it)->getAppName(), toolBoxWidget);
        toolBox->addWidget(l);

        l->setAlignment(Qt::AlignLeft | Qt::AlignTop);
        l->setContentsMargins(5, 5, 5, 5);
        connect(l, SIGNAL(leftClickedUrl(const QString&)),
                SLOT(website(const QString&)));
    }
    grid->addWidget(toolBoxWidget, _numRows, 1);

    // Found column
    QWidget* vboxWidget = new QWidget(this);
    QVBoxLayout * vbox = new QVBoxLayout(vboxWidget);

    for (QList<Application*>::Iterator it = _apps.begin(); it != _apps.end(); ++it) {
        _label = new QLabel((*it)->getPath(), vboxWidget);
        _label->setContentsMargins(5, 5, 5, 5);
        _label->setAlignment(Qt::AlignTop);
        vbox->addWidget(_label);
    }
    grid->addWidget(vboxWidget, _numRows, 2);

    // Status column
    _label = new QLabel(this);
    _label->setContentsMargins(5, 5, 5, 5);
    _label->setAlignment(Qt::AlignTop);
    if (appGroup->getFoundGroup()) {
        _label->setText(i18n("enabled"));
        QPalette pal = _label->palette();
        pal.setColor(_label->foregroundRole(), "darkgreen");
        _label->setPalette(pal);
    } else {
        _label->setText(i18n("disabled"));
        QPalette pal = _label->palette();
        pal.setColor(_label->foregroundRole(), "red");
        _label->setPalette(pal);
    }
    grid->addWidget(_label, _numRows, 3);

    // Apply shared design elements
    adjustRow(_grid);

    // Ensure the last column takes more space
    _label->setMinimumWidth(300);

    ++_numRows;
    return true;
}
Exemple #6
0
AccountingSelector::AccountingSelector(QWidget *parent, bool _isnewaccount, const char *name)
  :  QWidget(parent),
    isnewaccount(_isnewaccount)
{
  setObjectName(name);

  QVBoxLayout *l1 = new QVBoxLayout(parent);
  l1->setSpacing(KDialog::spacingHint());
  l1->setMargin(0);

  enable_accounting = new QCheckBox(i18n("&Enable accounting"), parent);
  l1->addWidget(enable_accounting, 1);
  connect(enable_accounting, SIGNAL(toggled(bool)), this, SLOT(enableItems(bool)));

  // insert the tree widget
  tl = new Q3ListView(parent, "treewidget");

  connect(tl, SIGNAL(selectionChanged(Q3ListViewItem*)), this,
          SLOT(slotSelectionChanged(Q3ListViewItem*)));
  tl->setMinimumSize(220, 200);
  l1->addWidget(tl, 1);

  KUrlLabel *up = new KUrlLabel(parent);
  up->setText(i18n("Check for rule updates"));
  up->setUrl("http://developer.kde.org/~kppp/rules.html");
  connect(up, SIGNAL(leftClickedUrl(QString)), SLOT(openUrl(QString)));

  l1->addWidget(up, 1);

  // label to display the currently selected ruleset
  QHBoxLayout *l11 = new QHBoxLayout;
  l1->addSpacing(10);
  l1->addLayout(l11);
  QLabel *lsel = new QLabel(i18n("Selected:"), parent);
  selected = new QLabel(parent);
  selected->setFrameStyle(QFrame::Sunken | QFrame::WinPanel);
  selected->setLineWidth(1);
  selected->setFixedHeight(selected->sizeHint().height() + 16);
  l11->addWidget(lsel, 0);
  l11->addSpacing(10);
  l11->addWidget(selected, 1);

  // volume accounting
  l1->addStretch(1);
  QHBoxLayout *l12 = new QHBoxLayout;
  l1->addLayout(l12);
  QLabel *usevol_l = new QLabel(i18n("Volume accounting:"), parent);
  use_vol = new QComboBox(parent);
  use_vol->insertItem(0, i18n("No Accounting"));
  use_vol->insertItem(1, i18n("Bytes In"));
  use_vol->insertItem(2, i18n("Bytes Out"));
  use_vol->insertItem(3, i18n("Bytes In & Out"));
  use_vol->setCurrentIndex(gpppdata.VolAcctEnabled());
  l12->addWidget(usevol_l);
  l12->addWidget(use_vol);

  // load the pmfolder pixmap from KDEdir
  pmfolder = UserIcon("folder");

  // scale the pixmap
  if(pmfolder.width() > 0) {
    QMatrix wm;
    wm.scale(16.0/pmfolder.width(), 16.0/pmfolder.width());
    pmfolder = pmfolder.transformed(wm);
  }

  // load the pmfolder pixmap from KDEdir
  pmfile = UserIcon("phone");

  // scale the pixmap
  if(pmfile.width() > 0) {
    QMatrix wm;
    wm.scale(16.0/pmfile.width(), 16.0/pmfile.width());
    pmfile = pmfile.transformed(wm);
  }

  enable_accounting->setChecked(gpppdata.AcctEnabled());

  setupTreeWidget();

  l1->activate();
}