~ubuntu-branches/ubuntu/natty/kdemultimedia/natty-proposed

« back to all changes in this revision

Viewing changes to dragonplayer/src/app/videoWindow.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Debian Qt/KDE Maintainers
  • Date: 2011-05-26 02:41:36 UTC
  • mfrom: (0.2.3 upstream)
  • mto: This revision was merged to the branch mainline in revision 108.
  • Revision ID: james.westby@ubuntu.com-20110526024136-jjwsigfy402jhupm
Tags: upstream-4.6.3
ImportĀ upstreamĀ versionĀ 4.6.3

Show diffs side-by-side

added added

removed removed

Lines of Context:
49
49
#include <KStandardDirs>
50
50
 
51
51
#include <Phonon/AudioOutput>
 
52
#include <phonon/audiodataoutput.h>
52
53
#include <Phonon/MediaController>
53
54
#include <Phonon/MediaObject>
54
55
#include <Phonon/MediaSource>
91
92
        , m_subLanguages( new QActionGroup( this ) )
92
93
        , m_audioLanguages( new QActionGroup( this ) )
93
94
        , m_logo( new QLabel( this ) )
 
95
        , m_aDataOutput(0)
94
96
{
95
 
    
 
97
 
96
98
    m_isPreview = false;
97
99
 
98
100
    s_instance = this;
99
 
    setObjectName( "VideoWindow" );
 
101
    setObjectName( QLatin1String( "VideoWindow" ) );
100
102
 
101
103
    QVBoxLayout *box = new QVBoxLayout( this );
102
104
    box->setMargin(0);
202
204
 
203
205
    KMimeType::Ptr mimeType = KMimeType::findByUrl( url );
204
206
    kDebug() << "detected mimetype: " << mimeType->name();
205
 
    if( mimeType->is( "application/x-cd-image" ) || mimeType->is( "inode/directory" ) )
 
207
    if( mimeType->is( QLatin1String( "application/x-cd-image" ) ) || mimeType->is( QLatin1String( "inode/directory" ) ) )
206
208
        m_media->setCurrentSource( Phonon::MediaSource( Phonon::Dvd, url.path() ) );
207
209
    else
208
210
        m_media->setCurrentSource( url );
300
302
    }
301
303
}
302
304
 
303
 
bool 
 
305
bool
304
306
VideoWindow::isPreview(const bool &v)
305
307
{
306
308
   if( v )
362
364
    {
363
365
        case Phonon::MediaSource::Invalid:
364
366
        case Phonon::MediaSource::Empty:
365
 
            return "Invalid"; //no i18n, used for DBus responses
 
367
            return QLatin1String( "Invalid" ); //no i18n, used for DBus responses
366
368
            break;
367
369
        case Phonon::MediaSource::Url:
368
370
        case Phonon::MediaSource::LocalFile:
372
374
            return source.deviceName();
373
375
            break;
374
376
        case Phonon::MediaSource::Stream:
375
 
            return "Data Stream";
 
377
            return QLatin1String( "Data Stream" );
376
378
            break;
377
379
        default:
378
380
            break;
379
381
    }
380
 
    return "Error";
 
382
    return QLatin1String( "Error" );
381
383
}
382
384
 
383
385
QMultiMap<QString, QString>
465
467
}
466
468
 
467
469
bool
 
470
VideoWindow::setupAnalyzer(QObject* analyzer)
 
471
{
 
472
    if(!m_aDataOutput)
 
473
    {
 
474
        m_aDataOutput = new Phonon::AudioDataOutput(this);
 
475
        m_audioDataPath = Phonon::createPath(m_media, m_aDataOutput);
 
476
        connect(m_aDataOutput, SIGNAL(dataReady(const QMap<Phonon::AudioDataOutput::Channel, QVector<qint16> >&)),
 
477
                analyzer,  SLOT(drawFrame(const QMap<Phonon::AudioDataOutput::Channel,QVector<qint16> >&)));
 
478
    }
 
479
 
 
480
    return m_audioDataPath.isValid();
 
481
}
 
482
 
 
483
bool
468
484
VideoWindow::isDVD() const
469
485
{
470
486
    return m_media->currentSource().discType() == Phonon::Dvd;
474
490
VideoWindow::newPositionSlider()
475
491
{
476
492
    SeekSlider *seekSlider = new SeekSlider();
 
493
    seekSlider->setIconVisible( false );
477
494
    seekSlider->setMediaObject( m_media );
478
495
    seekSlider->setSingleStep( 5000 );
479
496
    return seekSlider;
483
500
VideoWindow::newVolumeSlider()
484
501
{
485
502
    VolumeSlider *volumeSlider = new VolumeSlider();
486
 
    volumeSlider->setObjectName( "volume" );
 
503
    volumeSlider->setObjectName( QLatin1String( "volume" ) );
487
504
    volumeSlider->setAudioOutput( m_aOutput );
488
505
    volumeSlider->setMuteVisible( false );
489
506
    volumeSlider->setOrientation( Qt::Vertical );
511
528
{
512
529
kDebug() << "chapters: " << m_controller->availableChapters() << " titles: " << m_controller->availableTitles();
513
530
    QStringList states;
514
 
    states << "Loading" << "Stopped" << "Playing" << "Buffering" << "Paused" << "Error";
 
531
    states << QLatin1String( "Loading" ) << QLatin1String( "Stopped" ) << QLatin1String( "Playing" ) << QLatin1String( "Buffering" ) << QLatin1String( "Paused" ) << QLatin1String( "Error" );
515
532
    kDebug() << "going from " << states.at(oldstate) << " to " << states.at(currentState);
516
533
 
517
534
    if( currentState == Phonon::LoadingState )
541
558
    const QString name = sender()->objectName();
542
559
    const double dSetting = static_cast<double>( setting ) * 0.01;
543
560
    kDebug() << "setting " << name << " to " << dSetting;
544
 
    if( name == "brightnessSlider" )
 
561
    if( name == QLatin1String( "brightnessSlider" ) )
545
562
    {
546
563
        m_vWidget->setBrightness( dSetting );
547
564
    }
548
 
    else if( name == "contrastSlider" )
 
565
    else if( name == QLatin1String( "contrastSlider" ) )
549
566
    {
550
567
        m_vWidget->setContrast( dSetting );
551
568
    }
552
 
    else if( name == "hueSlider" )
 
569
    else if( name == QLatin1String( "hueSlider" ) )
553
570
    {
554
571
        m_vWidget->setHue( dSetting );
555
572
    }
556
 
    else if( name == "saturationSlider" )
 
573
    else if( name == QLatin1String( "saturationSlider" ) )
557
574
    {
558
575
        m_vWidget->setSaturation( dSetting );
559
576
    }
669
686
VideoWindow::videoSetting( const QString& setting )
670
687
{
671
688
    double dValue = 0.0;
672
 
    if( setting == "brightnessSlider" )
 
689
    if( setting == QLatin1String( "brightnessSlider" ) )
673
690
    {
674
691
        dValue = m_vWidget->brightness();
675
692
    }
676
 
    else if( setting == "contrastSlider" )
 
693
    else if( setting == QLatin1String( "contrastSlider" ) )
677
694
    {
678
695
        dValue = m_vWidget->contrast();
679
696
    }
680
 
    else if( setting == "hueSlider" )
 
697
    else if( setting == QLatin1String( "hueSlider" ) )
681
698
    {
682
699
        dValue = m_vWidget->hue();
683
700
    }
684
 
    else if( setting == "saturationSlider" )
 
701
    else if( setting == QLatin1String( "saturationSlider" ) )
685
702
    {
686
703
        dValue = m_vWidget->saturation();
687
704
    }
750
767
      case QEvent::Enter:
751
768
      case QEvent::MouseMove:
752
769
      case QEvent::MouseButtonPress:
753
 
         kapp->restoreOverrideCursor();
754
 
         m_cursorTimer->start( CURSOR_HIDE_TIMEOUT );
 
770
            kapp->restoreOverrideCursor();
 
771
            m_cursorTimer->start( CURSOR_HIDE_TIMEOUT );
755
772
         break;
756
773
      default: return QWidget::event( event );
757
774
    }