Exemplo n.º 1
0
void K3b::DataMultisessionImportDialog::addMedium( const K3b::Medium& medium )
{
    QTreeWidgetItem* mediumItem = new QTreeWidgetItem( d->sessionView );
    QFont fnt( mediumItem->font(0) );
    fnt.setBold( true );
    mediumItem->setText( 0, medium.shortString() );
    mediumItem->setFont( 0, fnt );
    mediumItem->setIcon( 0, QIcon::fromTheme("media-optical-recordable") );

    const K3b::Device::Toc& toc = medium.toc();
    QTreeWidgetItem* sessionItem = 0;
    int lastSession = 0;
    for ( K3b::Device::Toc::const_iterator it = toc.begin(); it != toc.end(); ++it ) {
        const K3b::Device::Track& track = *it;

        if( track.session() != lastSession ) {
            lastSession = track.session();
            QString sessionInfo;
            if ( track.type() == K3b::Device::Track::TYPE_DATA ) {
                K3b::Iso9660 iso( medium.device(), track.firstSector().lba() );
                if ( iso.open() ) {
                    sessionInfo = iso.primaryDescriptor().volumeId;
                }
            }
            else {
                int numAudioTracks = 1;
                while ( it != toc.end()
                        && ( *it ).type() == K3b::Device::Track::TYPE_AUDIO
                        && ( *it ).session() == lastSession ) {
                    ++it;
                    ++numAudioTracks;
                }
                --it;
                sessionInfo = i18np("1 audio track", "%1 audio tracks", numAudioTracks );
            }

            sessionItem = new QTreeWidgetItem( mediumItem, sessionItem );
            sessionItem->setText( 0, i18n( "Session %1", lastSession )
                                     + ( sessionInfo.isEmpty() ? QString() : " (" + sessionInfo + ')' ) );
            if ( track.type() == K3b::Device::Track::TYPE_AUDIO )
                sessionItem->setIcon( 0, QIcon::fromTheme( "audio-x-generic" ) );
            else
                sessionItem->setIcon( 0, QIcon::fromTheme( "application-x-tar" ) );

            d->sessions.insert( sessionItem, SessionInfo( lastSession, medium.device() ) );
        }
    }

    if( 0 == lastSession ) {
        // the medium item in case we have no session info (will always use the last session)
        d->sessions.insert( mediumItem, SessionInfo( 0, medium.device() ) );
    }
    else {
        // we have a session item, there is no need to select the medium as a whole
        mediumItem->setFlags( mediumItem->flags() ^ Qt::ItemIsSelectable );
    }

    mediumItem->setExpanded( true );
}
Exemplo n.º 2
0
void K3b::DirView::showMediumInfo( const K3b::Medium& medium )
{
    if( !d->contextMediaInfoRequested ||
            medium.diskInfo().diskState() == K3b::Device::STATE_EMPTY ||
            medium.diskInfo().diskState() == K3b::Device::STATE_NO_MEDIA ) {

        // show cd info
        d->setCurrentView( d->infoView );
        d->infoView->reload( medium );
        return;
    }

#ifdef ENABLE_DVD_RIPPING
    else if( medium.content() & K3b::Medium::ContentVideoDVD ) {
        d->movieView->reload( medium );
        d->setCurrentView( d->movieView );
        return;
    }
#endif

    else if( medium.content() & K3b::Medium::ContentVideoCD ) {
        if( k3bcore ->externalBinManager() ->foundBin( "vcdxrip" ) ) {
            d->setCurrentView( d->videoView );
            d->videoView->reload( medium );
        }
        else {
            KMessageBox::sorry( this, i18n("K3b uses vcdxrip from the vcdimager package to rip Video CDs. "
                                           "Please make sure it is installed.") );
            k3bappcore->appDeviceManager()->mountDisk( medium.device() );
        }
    }

    else if( medium.content() & K3b::Medium::ContentAudio ) {
        d->setCurrentView( d->cdView );
        d->cdView->reload( medium );
    }

    else if( medium.content() & K3b::Medium::ContentData ) {
        k3bappcore->appDeviceManager()->mountDisk( medium.device() );
    }

    else {
        // show cd info
        d->setCurrentView( d->infoView );
        d->infoView->reload( medium );
    }

    d->contextMediaInfoRequested = false;
}
Exemplo n.º 3
0
 QString mediumToolTip( const K3b::Medium& m ) const {
     if( m.device() == m_overrideDevice )
         return m_overrideToolTip;
     else {
         QString s = K3b::MediaSelectionComboBox::mediumToolTip( m );
         if( !m.diskInfo().empty() && !(wantedMediumState() & m.diskInfo().diskState()) )
             s.append( "<p><i>" + i18n("Medium will be overwritten.") + "</i>" );
         return s;
     }
 }
Exemplo n.º 4
0
 QString mediumString( const K3b::Medium& m ) const {
     if( m.device() == m_overrideDevice )
         return m_overrideString;
     else
         return K3b::MediaSelectionComboBox::mediumString( m );
 }
Exemplo n.º 5
0
 bool showMedium( const K3b::Medium& m ) const {
     return ( m.device() == m_overrideDevice ||
              K3b::MediaSelectionComboBox::showMedium( m ) );
 }