Beispiel #1
0
bool AboutDialog::eventFilter(QObject *obj, QEvent *event)
{
    if (event->type() == QEvent::MouseButtonPress )
    {
        if( obj == ui.version )
        {
            if( !b_advanced )
            {
                ui.version->setText(qfu( VLC_CompileBy() )+ "@" + qfu( VLC_CompileHost() )
                    + " " + __DATE__ + " " + __TIME__);
                b_advanced = true;
            }
            else
            {
                ui.version->setText(qfu( " " VERSION_MESSAGE ) );
                b_advanced = false;
            }
            return true;
        }
        else if( obj == ui.licenseButton )
            showLicense();
        else if( obj == ui.authorsButton )
            showAuthors();
        else if( obj == ui.creditsButton )
            showCredit();

        return false;
    }

    return QVLCDialog::eventFilter( obj, event);
}
Beispiel #2
0
/* This function may not be the best way to do it
   It destroys everything and gets everything again instead of just
   building the necessary columns.
   This does extra work if you re-display the same column. Slower...
   On the other hand, this way saves memory.
   There must be a more clever way.
   */
void PLItem::update( playlist_item_t *p_item, bool iscurrent )
{
    assert( p_item->p_input->i_id == i_input_id );

    /* Useful for the model */
    i_type = p_item->p_input->i_type;
    b_current = iscurrent;

    item_col_strings.clear();

    if( model->i_depth == 1 )  /* Selector Panel */
    {
        item_col_strings.append( qfu( p_item->p_input->psz_name ) );
        return;
    }

    i_showflags = parentItem ? parentItem->i_showflags : i_showflags;

    /* Meta: ID */
    if( i_showflags & COLUMN_NUMBER )
    {
        QModelIndex idx = model->index( this, 0 );
        item_col_strings.append( QString::number( idx.row() + 1 ) );
    }
    /* Other meta informations */
    for( uint32_t i_index=2; i_index < COLUMN_END; i_index <<= 1 )
    {
        if( i_showflags & i_index )
        {
            char *psz = psz_column_meta( p_item->p_input, i_index );
            item_col_strings.append( qfu( psz ) );
            free( psz );
        }
    }
}
Beispiel #3
0
bool EPGItem::setData( vlc_epg_event_t *data )
{
    QDateTime newtime = QDateTime::fromTime_t( data->i_start );
    QString newname = qfu( data->psz_name );
    QString newdesc = qfu( data->psz_description );
    QString newshortdesc = qfu( data->psz_short_description );

    if ( m_start != newtime ||
         m_name != newname ||
         m_description != newdesc ||
         m_shortDescription != newshortdesc ||
         m_duration != data->i_duration )
    {
        m_start = newtime;
        m_name = newname;
        setToolTip( newname );
        m_description = newdesc;
        m_shortDescription = newshortdesc;
        setDuration( data->i_duration );
        setRating( data->i_rating );
        update();
        return true;
    }
    return false;
}
Beispiel #4
0
void MessagesDialog::buildTree( QTreeWidgetItem *parentItem,
                                vlc_object_t *p_obj )
{
    QTreeWidgetItem *item;

    if( parentItem )
        item = new QTreeWidgetItem( parentItem );
    else
        item = new QTreeWidgetItem( ui.modulesTree );

    char *name = vlc_object_get_name( p_obj );
    item->setText( 0, QString("%1%2 (0x%3)")
                   .arg( qfu( p_obj->psz_object_type ) )
                   .arg( ( name != NULL )
                         ? QString( " \"%1\"" ).arg( qfu( name ) )
                             : "" )
                   .arg( (uintptr_t)p_obj, 0, 16 )
                 );
    free( name );
    item->setExpanded( true );

    vlc_list_t *l = vlc_list_children( p_obj );
    for( int i=0; i < l->i_count; i++ )
        buildTree( item, l->p_values[i].p_object );
    vlc_list_release( l );
}
Beispiel #5
0
bool EPGItem::setData( const vlc_epg_event_t *data )
{
    QDateTime newtime = QDateTime::fromTime_t( data->i_start );
    QString newname = qfu( data->psz_name );
    QString newdesc = qfu( data->psz_description );
    QString newshortdesc = qfu( data->psz_short_description );

    if ( m_start != newtime ||
         m_name != newname ||
         m_description != newdesc ||
         m_shortDescription != newshortdesc ||
         m_duration != data->i_duration )
    {
        m_start = newtime;
        m_name = newname;
        setToolTip( newname );
        m_description = newdesc;
        m_shortDescription = newshortdesc;
        setDuration( data->i_duration );
        setRating( data->i_rating );
        m_descitems.clear();
        for( int i=0; i<data->i_description_items; i++ )
        {
            m_descitems.append(QPair<QString, QString>(
                                  QString(data->description_items[i].psz_key),
                                  QString(data->description_items[i].psz_value)));
        }
        updatePos();
        prepareGeometryChange();
        return true;
    }
    return false;
}
Beispiel #6
0
/**
 * Update the Codecs information on parent->update()
 **/
void InfoPanel::update( input_item_t *p_item)
{
    if( !p_item )
    {
        clear();
        return;
    }

    InfoTree->clear();
    QTreeWidgetItem *current_item = NULL;
    QTreeWidgetItem *child_item = NULL;

    for( int i = 0; i< p_item->i_categories ; i++)
    {
        current_item = new QTreeWidgetItem();
        current_item->setText( 0, qfu(p_item->pp_categories[i]->psz_name) );
        InfoTree->addTopLevelItem( current_item );

        for( int j = 0 ; j < p_item->pp_categories[i]->i_infos ; j++ )
        {
            child_item = new QTreeWidgetItem ();
            child_item->setText( 0,
                    qfu(p_item->pp_categories[i]->pp_infos[j]->psz_name)
                    + ": "
                    + qfu(p_item->pp_categories[i]->pp_infos[j]->psz_value));

            current_item->addChild(child_item);
        }
        InfoTree->setItemExpanded( current_item, true);
    }
}
void StringListConfigControl::finish(module_config_t *p_module_config )
{
    combo->setEditable( false );
    CONNECT( combo, currentIndexChanged ( int ), this, comboIndexChanged( int ) );

    if(!p_module_config) return;

    char **values, **texts;
    ssize_t count = config_GetPszChoices( p_this, p_item->psz_name,
                                          &values, &texts );
    for( ssize_t i = 0; i < count && texts; i++ )
    {
        if( texts[i] == NULL || values[i] == NULL )
            continue;

        combo->addItem( qfu(texts[i]), QVariant( qfu(values[i])) );
        if( !strcmp( p_item->value.psz ? p_item->value.psz : "", values[i] ) )
            combo->setCurrentIndex( combo->count() - 1 );
        free( texts[i] );
        free( values[i] );
    }
    free( texts );
    free( values );

    if( p_module_config->psz_longtext  )
    {
        QString tipText = qtr(p_module_config->psz_longtext);
        combo->setToolTip( formatTooltip(tipText) );
        if( label )
            label->setToolTip( formatTooltip(tipText) );
    }
    if( label )
        label->setBuddy( combo );
}
Beispiel #8
0
MsgEvent::MsgEvent( int type, const vlc_log_t *msg, const char *text )
    : QEvent( (QEvent::Type)MsgEvent_Type ),
      priority( type ),
      object_id( msg->i_object_id ),
      object_type( qfu(msg->psz_object_type) ),
      header( qfu(msg->psz_header) ),
      module( qfu(msg->psz_module) ),
      text( qfu(text) )
{
}
MsgEvent::MsgEvent( const msg_item_t *msg )
    : QEvent( (QEvent::Type)MsgEvent_Type ),
      priority( msg->i_type ),
      object_id( msg->i_object_id ),
      object_type( qfu(msg->psz_object_type) ),
      header( qfu(msg->psz_header) ),
      module( qfu(msg->psz_module) ),
      text( qfu(msg->psz_msg) )
{
}
Beispiel #10
0
/* Define the Input used.
   Add the callbacks on input
   p_input is held once here */
void InputManager::setInput( input_thread_t *_p_input )
{
    delInput();
    p_input = _p_input;
    if( p_input != NULL )
    {
        msg_Dbg( p_intf, "IM: Setting an input" );
        vlc_object_hold( p_input );
        addCallbacks();

        UpdateStatus();
        UpdateName();
        UpdateArt();
        UpdateTeletext();
        UpdateNavigation();
        UpdateVout();

        p_item = input_GetItem( p_input );
        emit rateChanged( var_GetFloat( p_input, "rate" ) );

        /* Get Saved Time */
        if( p_item->i_type == ITEM_TYPE_FILE )
        {
            char *uri = input_item_GetURI( p_item );

            int i_time = RecentsMRL::getInstance( p_intf )->time( qfu(uri) );
            if( i_time > 0 && qfu( uri ) != lastURI &&
                    !var_GetFloat( p_input, "run-time" ) &&
                    !var_GetFloat( p_input, "start-time" ) &&
                    !var_GetFloat( p_input, "stop-time" ) )
            {
                emit resumePlayback( (int64_t)i_time * 1000 );
            }
            playlist_Lock( THEPL );
            // Add root items only
            playlist_item_t* p_node = playlist_CurrentPlayingItem( THEPL );
            if ( p_node != NULL && p_node->p_parent != NULL && p_node->p_parent->i_id == THEPL->p_playing->i_id )
            {
                // Save the latest URI to avoid asking to restore the
                // position on the same input file.
                lastURI = qfu( uri );
                RecentsMRL::getInstance( p_intf )->addRecent( lastURI );
            }
            playlist_Unlock( THEPL );
            free( uri );
        }
    }
    else
    {
        p_item = NULL;
        lastURI.clear();
        assert( !p_input_vbi );
        emit rateChanged( var_InheritFloat( p_intf, "rate" ) );
    }
}
Beispiel #11
0
void VLMDialog::mediasPopulator()
{
    if( p_vlm )
    {
        int i_nMedias;
        QString typeShortName;
        int vlmItemCount;
        vlm_media_t ***ppp_dsc = (vlm_media_t ***)malloc( sizeof( vlm_media_t ) );

        /* Get medias information and numbers */
        vlm_Control( p_vlm, VLM_GET_MEDIAS, ppp_dsc, &i_nMedias );

        /* Loop on all of them */
        for( int i = 0; i < i_nMedias; i++ )
        {
            VLMAWidget * vlmAwidget;
            vlmItemCount = vlmItems.count();

            QString mediaName = qfu( (*ppp_dsc)[i]->psz_name );
            /* It may have several inputs, we take the first one by default
                 - an evolution will be to manage these inputs in the gui */
            QString inputText = qfu( (*ppp_dsc)[i]->ppsz_input[0] );

            QString outputText = qfu( (*ppp_dsc)[i]->psz_output );

            /* Schedule media is a quite especial, maybe there is another way to grab information */
            if( (*ppp_dsc)[i]->b_vod )
            {
                typeShortName = "VOD";
                QString mux = qfu( (*ppp_dsc)[i]->vod.psz_mux );
                vlmAwidget = new VLMVod( mediaName, inputText, inputOptions,
                                         outputText, (*ppp_dsc)[i]->b_enabled,
                                         mux, this );
            }
            else
            {
                typeShortName = "Bcast";
                vlmAwidget = new VLMBroadcast( mediaName, inputText, inputOptions,
                                               outputText, (*ppp_dsc)[i]->b_enabled,
                                               (*ppp_dsc)[i]->broadcast.b_loop, this );
            }
            /* Add an Item of the Side List */
            ui.vlmListItem->addItem( typeShortName + " : " + mediaName );
            ui.vlmListItem->setCurrentRow( vlmItemCount - 1 );

            /* Add a new VLMAWidget on the main List */
            vlmItemLayout->insertWidget( vlmItemCount, vlmAwidget );
            vlmItems.append( vlmAwidget );
            clearWidgets();
        }
        free( ppp_dsc );
    }
}
Beispiel #12
0
QString toURI( const QString& s )
{
    if( s.contains( qfu("://") ) )
        return s;

    char *psz = vlc_path2uri( qtu(s), NULL );
    if( psz == NULL )
        return qfu("");

    QString uri = qfu( psz );
    free( psz );
    return uri;
}
Beispiel #13
0
static QTreeWidgetItem * PLWalk( playlist_item_t *p_node )
{
    QTreeWidgetItem *current = new QTreeWidgetItem();
    current->setText( 0, qfu( p_node->p_input->psz_name ) );
    current->setToolTip( 0, qfu( p_node->p_input->psz_uri ) );
    current->setText( 1, QString("%1").arg( p_node->i_id ) );
    current->setText( 2, QString("%1").arg( p_node->p_input->i_id ) );
    current->setText( 3, QString("0x%1").arg( p_node->i_flags, 0, 16 ) );
    current->setText( 4, QString("0x%1").arg(  p_node->p_input->i_type, 0, 16 ) );
    for ( int i = 0; p_node->i_children > 0 && i < p_node->i_children; i++ )
        current->addChild( PLWalk( p_node->pp_children[ i ] ) );
    return current;
}
Beispiel #14
0
AboutDialog::AboutDialog( intf_thread_t *_p_intf)
            : QVLCDialog( (QWidget*)_p_intf->p_sys->p_mi, _p_intf ), b_advanced( false )
{
    /* Build UI */
    ui.setupUi( this );
    setWindowTitle( qtr( "About" ) );
    setWindowRole( "vlc-about" );
    setWindowModality( Qt::WindowModal );

    ui.version->setText(qfu( " " VERSION_MESSAGE ) );
    ui.title->setText("<html><head/><body><p><span style=\" font-size:26pt; color:#353535;\"> " + qtr( "VLC media player" ) + " </span></p></body></html>");

    ui.MainBlabla->setText("<html><head/><body>" +
    qtr( "<p>VLC media player is a free and open source media player, encoder, and streamer made by the volunteers of the <a href=\"http://www.videolan.org/\"><span style=\" text-decoration: underline; color:#0057ae;\">VideoLAN</span></a> community.</p><p>VLC uses its internal codecs, works on essentially every popular platform, and can read almost all files, CDs, DVDs, network streams, capture cards and other media formats!</p><p><a href=\"http://www.videolan.org/contribute/\"><span style=\" text-decoration: underline; color:#0057ae;\">Help and join us!</span></a>" ) +
    "</p></body> </html>");

#if 0
    if( QDate::currentDate().dayOfYear() >= QT_XMAS_JOKE_DAY && var_InheritBool( p_intf, "qt-icon-change" ) )
        ui.iconVLC->setPixmap( QPixmap( ":/logo/vlc128-xmas.png" ) );
    else
        ui.iconVLC->setPixmap( QPixmap( ":/logo/vlc128.png" ) );
#endif

#if 0
    ifdef UPDATE_CHECK
#else
    ui.update->hide();
#endif

    /* GPL License */
    ui.licensePage->setText( qfu( psz_license ) );

    /* People who helped */
    ui.creditPage->setText( qfu( psz_thanks ) );

    /* People who wrote the software */
    ui.authorsPage->setText( qfu( psz_authors ) );

    ui.licenseButton->setText( "<html><head/><body><p><span style=\" text-decoration: underline; color:#0057ae;\">"+qtr( "License" )+"</span></p></body></html>");
    ui.licenseButton->installEventFilter( this );

    ui.authorsButton->setText( "<html><head/><body><p><span style=\" text-decoration: underline; color:#0057ae;\">"+qtr( "Authors" )+"</span></p></body></html>");
    ui.authorsButton->installEventFilter( this );

    ui.creditsButton->setText( "<html><head/><body><p><span style=\" text-decoration: underline; color:#0057ae;\">"+qtr( "Credits" )+"</span></p></body></html>");
    ui.creditsButton->installEventFilter( this );

    ui.version->installEventFilter( this );
}
Beispiel #15
0
void SoutDialog::addDest( )
{
    VirtualDestBox *db;
    QString caption;

    switch( ui.destBox->currentIndex() )
    {
        case 0:
            db = new FileDestBox( this, p_intf );
            caption = qtr( "File" );
            break;
        case 1:
            db = new HTTPDestBox( this );
            caption = qfu( "HTTP" );
            break;
        case 2:
            db = new MMSHDestBox( this );
            caption = qfu( "WMSP" );
            break;
        case 3:
            db = new RTSPDestBox( this );
            caption = qfu( "RTSP" );
            break;
        case 4:
            db = new RTPDestBox( this, "ts" );
            caption = "RTP/TS";
            break;
        case 5:
            db = new RTPDestBox( this );
            caption = "RTP/AVP";
            break;
        case 6:
            db = new UDPDestBox( this );
            caption = "UDP";
            break;
        case 7:
            db = new ICEDestBox( this );
            caption = "Icecast";
            break;
        default:
            assert(0);
    }

    int index = ui.destTab->addTab( db, caption );
    CONNECT( db, mrlUpdated(), this, updateMRL() );
    ui.destTab->setCurrentIndex( index );
    updateMRL();
}
Beispiel #16
0
/*********** String **************/
StringConfigControl::StringConfigControl( vlc_object_t *_p_this,
                                          module_config_t *_p_item,
                                          QWidget *_parent, QGridLayout *l,
                                          int &line, bool pwd ) :
                           VStringConfigControl( _p_this, _p_item, _parent )
{
    label = new QLabel( qtr(p_item->psz_text) );
    text = new QLineEdit( qfu(p_item->value.psz) );
    if( pwd ) text->setEchoMode( QLineEdit::Password );
    finish();

    if( !l )
    {
        QHBoxLayout *layout = new QHBoxLayout();
        layout->addWidget( label, 0 ); layout->insertSpacing( 1, 10 );
        layout->addWidget( text, LAST_COLUMN );
        widget->setLayout( layout );
    }
    else
    {
        l->addWidget( label, line, 0 );
        l->setColumnMinimumWidth( 1, 10 );
        l->addWidget( text, line, LAST_COLUMN );
    }
}
Beispiel #17
0
void FileConfigControl::updateField()
{
    QString file = QFileDialog::getOpenFileName( NULL,
                  qtr( "Select File" ), qfu( config_GetHomeDir() ) );
    if( file.isNull() ) return;
    text->setText( toNativeSeparators( file ) );
}
Beispiel #18
0
SearchLineEdit::SearchLineEdit( QWidget *parent ) : QLineEdit( parent )
{
    clearButton = new QFramelessButton( this );
    clearButton->setIcon( QIcon( ":/search_clear" ) );
    clearButton->setIconSize( QSize( 16, 16 ) );
    clearButton->setCursor( Qt::ArrowCursor );
    clearButton->setToolTip( qfu(vlc_pgettext("Tooltip|Clear", "Clear")) );
    clearButton->hide();

    CONNECT( clearButton, clicked(), this, clear() );

    int frameWidth = style()->pixelMetric( QStyle::PM_DefaultFrameWidth, 0, this );

    QFontMetrics metrics( font() );
    QString styleSheet = QString( "min-height: %1px; "
                                  "padding-top: 1px; "
                                  "padding-bottom: 1px; "
                                  "padding-right: %2px;" )
                                  .arg( metrics.height() + ( 2 * frameWidth ) )
                                  .arg( clearButton->sizeHint().width() + 6 );
    setStyleSheet( styleSheet );

    setMessageVisible( true );

    CONNECT( this, textEdited( const QString& ),
             this, updateText( const QString& ) );

    CONNECT( this, editingFinished(),
             this, searchEditingFinished() );

}
Beispiel #19
0
void EPGWidget::updateEPG( input_item_t *p_input_item )
{
    if( !p_input_item ) return;

    /* flush our EPG data if input type has changed */
    if ( b_input_type_known && p_input_item->i_type != i_event_source_type ) m_epgView->reset();
    i_event_source_type = p_input_item->i_type;
    b_input_type_known = true;

    m_epgView->cleanup(); /* expire items and flags */
    /* Fixme: input could have dissapeared */
    vlc_mutex_lock(  & p_input_item->lock );

    for ( int i = 0; i < p_input_item->i_epg; ++i )
    {
        vlc_epg_t *p_epg = p_input_item->pp_epg[i];

        /* Read current epg events from libvlc and try to insert them */
        for ( int j = 0; j < p_epg->i_event; ++j )
        {
            vlc_epg_event_t *p_event = p_epg->pp_event[j];
            m_epgView->addEPGEvent( p_event, qfu( p_epg->psz_name ),
                                    ( p_epg->p_current == p_event ) );
        }
    }
    vlc_mutex_unlock( & p_input_item->lock );

    /* toggle our widget view */
    rootWidget->setCurrentIndex(
            m_epgView->hasValidData() ? EPGVIEW_WIDGET : NOEPG_WIDGET );

    // Update the global duration and start time.
    m_epgView->updateDuration();
    m_epgView->updateStartTime();
}
Beispiel #20
0
/*********** File **************/
FileConfigControl::FileConfigControl( vlc_object_t *_p_this,
                                          module_config_t *_p_item,
                                          QWidget *_parent, QGridLayout *l,
                                          int &line ) :
                           VStringConfigControl( _p_this, _p_item, _parent )
{
    label = new QLabel( qtr(p_item->psz_text) );
    text = new QLineEdit( qfu(p_item->value.psz) );
    browse = new QPushButton( qtr( "Browse..." ) );
    QHBoxLayout *textAndButton = new QHBoxLayout();
    textAndButton->setMargin( 0 );
    textAndButton->addWidget( text, 2 );
    textAndButton->addWidget( browse, 0 );

    BUTTONACT( browse, updateField() );

    finish();

    if( !l )
    {
        QHBoxLayout *layout = new QHBoxLayout();
        layout->addWidget( label, 0 );
        layout->insertSpacing( 1, 10 );
        layout->addLayout( textAndButton, LAST_COLUMN );
        widget->setLayout( layout );
    }
    else
    {
        l->addWidget( label, line, 0 );
        l->setColumnMinimumWidth( 1, 10 );
        l->addLayout( textAndButton, line, LAST_COLUMN );
    }
}
Beispiel #21
0
QString HTTPDestBox::getMRL( const QString& mux )
{
    if( HTTPEdit->text().isEmpty() ) return "";

    QString path = HTTPEdit->text();
    if( path[0] != '/' )
        path.prepend( qfu("/") );
    QString port;
    port.setNum( HTTPPort->value() );
    QString dst = ":" + port + path;

    SoutMrl m;
    m.begin( "http" );
    /* Path-extension is primary muxer to use if possible,
       otherwise check for mux-choise and see that it isn't mp4
       then fallback to flv*/
    if ( !path.contains(QRegExp("\\..{2,3}$") ) )
    {
        if( !mux.isEmpty() && mux.compare("mp4") )
           m.option( "mux", mux );
        else
           m.option( "mux", "ffmpeg{mux=flv}" );
    }
    m.option( "dst", dst );
    m.end();

    return m.getMrl();
}
Beispiel #22
0
RTPDestBox::RTPDestBox( QWidget *_parent, const char *_mux )
    : VirtualDestBox( _parent ), mux( qfu(_mux) )
{
    QGridLayout *layout = new QGridLayout( this );

    QLabel *rtpOutput = new QLabel(
        qtr( "This module outputs the transcoded stream to a network via RTP."),
        this );
    layout->addWidget(rtpOutput, 0, 0, 1, -1);

    QLabel *RTPLabel = new QLabel( qtr("Address"), this );
    RTPEdit = new QLineEdit(this);
    layout->addWidget(RTPLabel, 1, 0, 1, 1);
    layout->addWidget(RTPEdit, 1, 1, 1, 1);

    QLabel *RTPPortLabel = new QLabel( qtr("Base port"), this );
    RTPPort = new QSpinBox(this);
    RTPPort->setMaximumSize(QSize(90, 16777215));
    RTPPort->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter);
    RTPPort->setMinimum(1);
    RTPPort->setMaximum(65535);
    RTPPort->setValue(5004);
    layout->addWidget(RTPPortLabel, 2, 0, 1, 1);
    layout->addWidget(RTPPort, 2, 1, 1, 1);

    QLabel *SAPNameLabel = new QLabel( qtr("Stream name"), this );
    SAPName = new QLineEdit(this);
    layout->addWidget(SAPNameLabel, 3, 0, 1, 1);
    layout->addWidget(SAPName, 3, 1, 1, 1);

    CT( RTPEdit );
    CS( RTPPort );
    CT( SAPName );
}
ExtensionDialog::ExtensionDialog( intf_thread_t *_p_intf,
                                  extensions_manager_t *p_mgr,
                                  extension_dialog_t *_p_dialog )
         : QDialog( NULL ), p_intf( _p_intf ), p_extensions_manager( p_mgr )
         , p_dialog( _p_dialog ), has_lock(true)
{
    assert( p_dialog );
    CONNECT( ExtensionsDialogProvider::getInstance(), destroyed(),
             this, parentDestroyed() );

    msg_Dbg( p_intf, "Creating a new dialog: '%s'", p_dialog->psz_title );
    this->setWindowFlags( Qt::WindowMinMaxButtonsHint
                        | Qt::WindowCloseButtonHint );
    this->setWindowTitle( qfu( p_dialog->psz_title ) );

    layout = new QGridLayout( this );
    clickMapper = new QSignalMapper( this );
    CONNECT( clickMapper, mapped( QObject* ), this, TriggerClick( QObject* ) );
    inputMapper = new QSignalMapper( this );
    CONNECT( inputMapper, mapped( QObject* ), this, SyncInput( QObject* ) );
    selectMapper = new QSignalMapper( this );
    CONNECT( selectMapper, mapped( QObject* ), this, SyncSelection(QObject*) );

    UpdateWidgets();
}
Beispiel #24
0
/**
 * Update the Extra Metadata from p_meta->i_extras
 **/
void ExtraMetaPanel::update( input_item_t *p_item )
{
    if( !p_item )
    {
        clear();
        return;
    }

    QList<QTreeWidgetItem *> items;

    extraMetaTree->clear();

    vlc_mutex_lock( &p_item->lock );
    vlc_meta_t *p_meta = p_item->p_meta;
    if( !p_meta )
    {
        vlc_mutex_unlock( &p_item->lock );
        return;
    }

    const char *psz_disc_number = vlc_meta_Get( p_meta, vlc_meta_DiscNumber);
    if( psz_disc_number )
    {
        QStringList tempItem;
        tempItem.append( VLC_META_DISCNUMBER );
        tempItem.append( qfu( psz_disc_number ) );
        items.append( new QTreeWidgetItem ( extraMetaTree, tempItem ) );
    }

    char ** ppsz_allkey = vlc_meta_CopyExtraNames( p_meta);

    for( int i = 0; ppsz_allkey[i] ; i++ )
    {
        const char * psz_value = vlc_meta_GetExtra( p_meta, ppsz_allkey[i] );
        QStringList tempItem;
        tempItem.append( qfu( ppsz_allkey[i] ) + " : ");
        tempItem.append( qfu( psz_value ) );
        items.append( new QTreeWidgetItem ( extraMetaTree, tempItem ) );
        free( ppsz_allkey[i] );
    }
    vlc_mutex_unlock( &p_item->lock );
    free( ppsz_allkey );

    extraMetaTree->addTopLevelItems( items );
    extraMetaTree->resizeColumnToContents( 0 );
}
Beispiel #25
0
QVariant MLModel::headerData( int section, Qt::Orientation orientation,
                                    int role ) const
{
    if (orientation == Qt::Horizontal && role == Qt::DisplayRole)
        return QVariant( qfu( psz_column_title( columnToMeta( section ) ) ) );
    else
        return QVariant();
}
void VisualSelector::next()
{
    char *psz_new = aout_VisualNext( p_intf );
    if( psz_new )
    {
        current->setText( qfu( psz_new ) );
        free( psz_new );
    }
}
Beispiel #27
0
static inline QString QVLCUserDir( vlc_userdir_t type )
{
    char *dir = config_GetUserDir( type );
    if( !dir )
        return "";
    QString res = qfu( dir );
    free( dir );
    return res;
}
Beispiel #28
0
void SoundWidget::refreshLabels()
{
    int i_sliderVolume = volumeSlider->value();

    if( b_is_muted )
    {
        volMuteLabel->setPixmap( QPixmap(":/toolbar/volume-muted" ) );
        volMuteLabel->setToolTip(qfu(vlc_pgettext("Tooltip|Unmute", "Unmute")));
        return;
    }

    if( i_sliderVolume < VOLUME_MAX / 3 )
        volMuteLabel->setPixmap( QPixmap( ":/toolbar/volume-low" ) );
    else if( i_sliderVolume > (VOLUME_MAX * 2 / 3 ) )
        volMuteLabel->setPixmap( QPixmap( ":/toolbar/volume-high" ) );
    else volMuteLabel->setPixmap( QPixmap( ":/toolbar/volume-medium" ) );
    volMuteLabel->setToolTip( qfu(vlc_pgettext("Tooltip|Mute", "Mute")) );
}
Beispiel #29
0
void InputManager::UpdateName()
{
    assert( p_input );

    /* Update text, name and nowplaying */
    QString name;

    /* Try to get the nowplaying */
    char *format = var_InheritString( p_intf, "input-title-format" );
    char *formatted = NULL;
    if (format != NULL)
    {
        formatted = str_format_meta( p_input, format );
        free( format );
        if( formatted != NULL )
        {
            name = qfu(formatted);
            free( formatted );
        }
    }

    /* If we have Nothing */
    if( name.simplified().isEmpty() )
    {
        char *uri = input_item_GetURI( input_GetItem( p_input ) );
        char *file = uri ? strrchr( uri, '/' ) : NULL;
        if( file != NULL )
        {
            decode_URI( ++file );
            name = qfu(file);
        }
        else
            name = qfu(uri);
        free( uri );
    }

    name = name.trimmed();

    if( oldName != name )
    {
        emit nameChanged( name );
        oldName = name;
    }
}
Beispiel #30
0
/********* String / choice list **********/
StringListConfigControl::StringListConfigControl( vlc_object_t *_p_this,
               module_config_t *_p_item, QWidget *_parent, bool bycat,
               QGridLayout *l, int &line) :
               VStringConfigControl( _p_this, _p_item, _parent )
{
    label = new QLabel( qtr(p_item->psz_text) );
    combo = new QComboBox();
    combo->setMinimumWidth( MINWIDTH_BOX );
    combo->setSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::Preferred );

    module_config_t *p_module_config = config_FindConfig( p_this, p_item->psz_name );
    if(p_module_config && p_module_config->pf_update_list)
    {
       vlc_value_t val;
       val.psz_string = strdup(p_module_config->value.psz);

       p_module_config->pf_update_list(p_this, p_item->psz_name, val, val, NULL);

       // assume in any case that dirty was set to true
       // because lazy programmes will use the same callback for
       // this, like the one behind the refresh push button?
       p_module_config->b_dirty = false;

       free( val.psz_string );
    }

    finish( p_module_config, bycat );
    if( !l )
    {
        l = new QGridLayout();
        l->addWidget( label, 0, 0 ); l->addWidget( combo, 0, LAST_COLUMN );
        widget->setLayout( l );
    }
    else
    {
        l->addWidget( label, line, 0 );
        l->addWidget( combo, line, LAST_COLUMN, Qt::AlignRight );
    }

    if( p_item->i_action )
    {
        QSignalMapper *signalMapper = new QSignalMapper(this);

        /* Some stringLists like Capture listings have action associated */
        for( int i = 0; i < p_item->i_action; i++ )
        {
            QPushButton *button =
                new QPushButton( qfu( p_item->ppsz_action_text[i] ));
            CONNECT( button, clicked(), signalMapper, map() );
            signalMapper->setMapping( button, i );
            l->addWidget( button, line, LAST_COLUMN - p_item->i_action + i,
                    Qt::AlignRight );
        }
        CONNECT( signalMapper, mapped( int ),
                this, actionRequested( int ) );
    }