Changeset View
Changeset View
Standalone View
Standalone View
src/app/mainWindow.cpp
Context not available. | |||||
91 | , m_mainView( 0 ) | 91 | , m_mainView( 0 ) | ||
---|---|---|---|---|---|
92 | , m_audioView( 0 ) | 92 | , m_audioView( 0 ) | ||
93 | , m_loadView( new LoadView(this) ) | 93 | , m_loadView( new LoadView(this) ) | ||
94 | , m_currentWidget( new QWidget(this) ) | 94 | , m_currentWidget( nullptr ) | ||
95 | , m_leftDock( 0 ) | 95 | , m_leftDock( 0 ) | ||
96 | , m_positionSlider( 0 ) | 96 | , m_positionSlider( 0 ) | ||
97 | , m_volumeSlider( 0 ) | 97 | , m_volumeSlider( 0 ) | ||
Context not available. | |||||
125 | m_mainView->addWidget(videoWindow()); | 125 | m_mainView->addWidget(videoWindow()); | ||
126 | m_mainView->setCurrentWidget(m_loadView); | 126 | m_mainView->setCurrentWidget(m_loadView); | ||
127 | 127 | | |||
128 | m_currentWidget = m_loadView; | | |||
129 | | ||||
130 | setCentralWidget( m_mainView ); | 128 | setCentralWidget( m_mainView ); | ||
131 | 129 | | |||
132 | setFocusProxy( videoWindow() ); // essential! See VideoWindow::event(), QEvent::FocusOut | 130 | setFocusProxy( videoWindow() ); // essential! See VideoWindow::event(), QEvent::FocusOut | ||
Context not available. | |||||
213 | connect( engine(), SIGNAL(audioChannelsChanged(QList<QAction*>)), this, SLOT(audioChannelsChanged(QList<QAction*>)) ); | 211 | connect( engine(), SIGNAL(audioChannelsChanged(QList<QAction*>)), this, SLOT(audioChannelsChanged(QList<QAction*>)) ); | ||
214 | connect( engine(), SIGNAL(mutedChanged(bool)), this, SLOT(mutedChanged(bool)) ); | 212 | connect( engine(), SIGNAL(mutedChanged(bool)), this, SLOT(mutedChanged(bool)) ); | ||
215 | 213 | | |||
214 | connect( engine(), &VideoWindow::finished, this, &MainWindow::toggleLoadView ); | ||||
215 | | ||||
216 | if( !engine()->init() ) { | 216 | if( !engine()->init() ) { | ||
217 | KMessageBox::error( this, i18n( | 217 | KMessageBox::error( this, i18n( | ||
218 | "<qt>Phonon could not be successfully initialized. Dragon Player will now exit.</qt>") ); | 218 | "<qt>Phonon could not be successfully initialized. Dragon Player will now exit.</qt>") ); | ||
Context not available. | |||||
434 | MainWindow::toggleLoadView() | 434 | MainWindow::toggleLoadView() | ||
435 | { | 435 | { | ||
436 | if( m_mainView->currentWidget() == m_loadView ) { | 436 | if( m_mainView->currentWidget() == m_loadView ) { | ||
437 | if( m_mainView->indexOf(m_currentWidget) == -1 ) { | 437 | if( engine()->state() != Phonon::StoppedState ) { | ||
438 | m_mainView->addWidget(m_currentWidget); | 438 | if( m_mainView->indexOf(m_currentWidget) == -1 ) { | ||
439 | m_mainView->addWidget(m_currentWidget); | ||||
440 | } | ||||
441 | m_mainView->setCurrentWidget(m_currentWidget); | ||||
439 | } | 442 | } | ||
440 | m_mainView->setCurrentWidget(m_currentWidget); | | |||
441 | engine()->isPreview(false); | 443 | engine()->isPreview(false); | ||
442 | } else if( m_currentWidget != m_audioView ) { | 444 | } else if( m_currentWidget != m_audioView ) { | ||
443 | qDebug() << "setting Thumbnail for video Widget"; | 445 | m_mainView->setCurrentWidget( m_loadView ); | ||
444 | m_mainView->setCurrentWidget(m_loadView); | 446 | if( engine()->state() != Phonon::StoppedState ) { | ||
445 | m_mainView->removeWidget(m_currentWidget); | 447 | m_mainView->removeWidget(m_currentWidget); | ||
446 | engine()->isPreview(true); | 448 | engine()->isPreview(true); | ||
447 | m_loadView->setThumbnail(m_currentWidget); | 449 | m_loadView->setThumbnail(m_currentWidget); | ||
450 | } | ||||
448 | } else { | 451 | } else { | ||
449 | m_mainView->setCurrentWidget(m_loadView); | 452 | m_mainView->setCurrentWidget(m_loadView); | ||
450 | } | 453 | } | ||
Context not available. | |||||
494 | void MainWindow::stop() | 497 | void MainWindow::stop() | ||
495 | { | 498 | { | ||
496 | engine()->stop(); | 499 | engine()->stop(); | ||
497 | m_mainView->setCurrentWidget(m_loadView); | 500 | toggleLoadView(); | ||
498 | } | 501 | } | ||
499 | 502 | | |||
500 | void | 503 | void | ||
Context not available. | |||||
569 | job->deleteLater(); | 572 | job->deleteLater(); | ||
570 | } | 573 | } | ||
571 | 574 | | |||
572 | if( m_mainView->indexOf(engine()) == -1 ) | | |||
573 | toggleLoadView(); | | |||
574 | | ||||
575 | //let xine handle invalid, etc, QUrlS | 575 | //let xine handle invalid, etc, QUrlS | ||
576 | //TODO it handles non-existing files with bad error message | 576 | //TODO it handles non-existing files with bad error message | ||
577 | if (!ret) | 577 | if (!ret) | ||
578 | ret = engine()->load( url ); | 578 | ret = engine()->load( url ); | ||
579 | 579 | | |||
580 | if( ret ) { | 580 | if( ret ) { | ||
581 | if( TheStream::hasVideo() ) { | 581 | m_currentWidget = nullptr; | ||
582 | m_currentWidget = engine(); | 582 | m_loadView->setThumbnail(nullptr); | ||
583 | } else { | | |||
584 | m_currentWidget = m_audioView; | | |||
585 | if( !isMaximized() ) | | |||
586 | resize(m_currentWidget->minimumSize()); | | |||
587 | } | | |||
588 | m_mainView->setCurrentWidget(m_currentWidget); | | |||
589 | } | 583 | } | ||
590 | return ret; | 584 | return ret; | ||
591 | } | 585 | } | ||
Context not available. | |||||
603 | toggleLoadView(); | 597 | toggleLoadView(); | ||
604 | break; | 598 | break; | ||
605 | case Phonon::StoppedState: | 599 | case Phonon::StoppedState: | ||
606 | if( TheStream::hasVideo() ) { | | |||
607 | m_currentWidget = engine(); | | |||
608 | } else { | | |||
609 | m_currentWidget = m_audioView; | | |||
610 | if( !isMaximized() ) | | |||
611 | resize(m_currentWidget->minimumSize()); | | |||
612 | } | | |||
613 | engine()->play(); | 600 | engine()->play(); | ||
614 | m_mainView->setCurrentWidget(m_currentWidget); | 601 | m_currentWidget = nullptr; | ||
602 | m_loadView->setThumbnail(nullptr); | ||||
615 | break; | 603 | break; | ||
616 | default: | 604 | default: | ||
617 | break; | 605 | break; | ||
Context not available. | |||||
692 | } | 680 | } | ||
693 | } else { | 681 | } else { | ||
694 | engine()->playDvd(); | 682 | engine()->playDvd(); | ||
683 | m_loadView->setThumbnail(nullptr); | ||||
684 | toggleLoadView(); | ||||
695 | qDebug() << "no disc in drive or Solid isn't working"; | 685 | qDebug() << "no disc in drive or Solid isn't working"; | ||
696 | } | 686 | } | ||
697 | } | 687 | } | ||
Context not available. |