void Codri::Controller::_onInitializationSuccess() { mLogger->info() << "Initialisation completed successfully, all functionality should be operational"; // STATE EVENTS // // Kiosk connect(MainApplication::instance()->kiosk(), SIGNAL(onPowerChanged(Kiosk::Power)), mPlatformInterface, SLOT(setPower(Kiosk::Power))); // Configuration connect(MainApplication::instance()->configuration(), SIGNAL(onVolumeChanged(uint8_t)), mPlatformInterface, SLOT(setVolume(uint8_t))); // Presentation connect(MainApplication::instance()->presentation(), SIGNAL(onPathChanged(const QString&)), mRepositoryInterface, SLOT(check(const QString&))); // SUBSYSTEM EVENTS // // Repository interface connect(mRepositoryInterface, SIGNAL(changing()), mUserInterface, SLOT(showInit())); connect(mRepositoryInterface, SIGNAL(ready(QDir)), mUserInterface, SLOT(showPresentation(QDir))); connect(mRepositoryInterface, SIGNAL(runtimeFailure()), mUserInterface, SLOT(showError())); // User interface // connect(mRepositoryInterface, SIGNAL(runtimeFailure()), ..., SLOT(...)); // SUBSYSTEM START // mUserInterface->start(); mPlatformInterface->start(); mRepositoryInterface->start(); mNetworkInterface->start(); }
void Player::onMeltedUnitOpened() { m_isMeltedPlaying = -1; // unknown m_duration = MLT.producer()->get_length(); m_isSeekable = true; MLT.producer()->set("ignore_points", 1); m_scrubber->setFramerate(MLT.profile().fps()); m_scrubber->setScale(m_duration); m_scrubber->setMarkers(QList<int>()); m_inPointLabel->setText("--:--:--:-- / "); m_selectedLabel->setText("--:--:--:--"); m_durationLabel->setText(QString(MLT.producer()->get_length_time()).prepend(" / ")); m_previousIn = MLT.producer()->get_in(); m_scrubber->setEnabled(true); m_scrubber->setInPoint(m_previousIn); m_previousOut = MLT.producer()->get_out(); m_scrubber->setOutPoint(m_previousOut); m_positionSpinner->setEnabled(m_isSeekable); onVolumeChanged(m_volumeSlider->value()); m_savedVolume = MLT.volume(); onMuteButtonToggled(Settings.playerMuted()); actionPlay->setEnabled(true); actionSkipPrevious->setEnabled(m_isSeekable); actionSkipNext->setEnabled(m_isSeekable); actionRewind->setEnabled(m_isSeekable); actionFastForward->setEnabled(m_isSeekable); setIn(-1); setOut(-1); setFocus(); }
void Player::onProducerOpened(bool play) { m_duration = MLT.producer()->get_length(); m_isSeekable = MLT.isSeekable(); MLT.producer()->set("ignore_points", 1); m_scrubber->setFramerate(MLT.profile().fps()); m_scrubber->setScale(m_duration); if (!MLT.isPlaylist()) m_scrubber->setMarkers(QList<int>()); m_inPointLabel->setText("--:--:--:-- / "); m_selectedLabel->setText("--:--:--:--"); if (m_isSeekable) { m_durationLabel->setText(QString(MLT.producer()->get_length_time()).prepend(" / ")); m_previousIn = MLT.isClip()? MLT.producer()->get_in() : -1; m_scrubber->setEnabled(true); m_scrubber->setInPoint(m_previousIn); m_previousOut = MLT.isClip()? MLT.producer()->get_out() : -1; m_scrubber->setOutPoint(m_previousOut); } else { m_durationLabel->setText(tr("Live").prepend(" / ")); m_scrubber->setDisabled(true); // cause scrubber redraw m_scrubber->setScale(m_duration); } m_positionSpinner->setEnabled(m_isSeekable); onVolumeChanged(m_volumeSlider->value()); m_savedVolume = MLT.volume(); onMuteButtonToggled(Settings.playerMuted()); toggleZoom(Settings.playerZoom() > 0.0f); actionPlay->setEnabled(true); actionSkipPrevious->setEnabled(m_isSeekable); actionSkipNext->setEnabled(m_isSeekable); actionRewind->setEnabled(m_isSeekable); actionFastForward->setEnabled(m_isSeekable); if (!MLT.profile().is_explicit()) emit profileChanged(); connectTransport(MLT.transportControl()); // Closing the previous producer might call pause() milliseconds before // calling play() here. Delays while purging the consumer on pause can // interfere with the play() call. So, we delay play a little to let // pause purging to complete. if (play) { if (m_pauseAfterOpen) { m_pauseAfterOpen = false; QTimer::singleShot(500, this, SLOT(postProducerOpened())); } else { if (MLT.consumer()->is_stopped()) { this->play(); } else { // This seek purges the consumer to prevent latent end-of-stream detection. seek(0); QTimer::singleShot(500, this, SLOT(play())); } } } }
int QtKeyRec::qt_metacall(QMetaObject::Call _c, int _id, void **_a) { _id = QWidget::qt_metacall(_c, _id, _a); if (_id < 0) return _id; if (_c == QMetaObject::InvokeMetaMethod) { switch (_id) { case 0: on_quitButton_clicked(); break; case 1: on_startButton_clicked(); break; case 2: onVolumeChanged((*reinterpret_cast< int(*)>(_a[1]))); break; default: ; } _id -= 3; } return _id; }
MediaOutput::MediaOutput() : totalTimeInMSec(0) , prefinishMark( 0 ) , currentVolume( 1.0 ) , m_audioOutput( Phonon::MusicCategory, this ) , m_mediaFader() { m_mediaFader.setFadeCurve( Phonon::VolumeFaderEffect::Fade12Decibel ); Phonon::Path path = Phonon::createPath( this, &m_audioOutput ); fadingAvailable = path.insertEffect( &m_mediaFader ); tDebug() << "Connect media output " << &m_audioOutput; connect( &m_audioOutput, SIGNAL( volumeChanged( qreal ) ), SLOT( onVolumeChanged( qreal ) ) ); connect( this, SIGNAL( tick( qint64 ) ), SLOT( checkPrefinishMark( qint64 ) ) ); blockSignals( true ); }
Player::Player(QWidget *parent) : QWidget(parent) , m_position(0) , m_isMeltedPlaying(-1) , m_zoomToggleFactor(Settings.playerZoom() == 0.0f? 1.0f : Settings.playerZoom()) , m_pauseAfterOpen(false) , m_monitorScreen(-1) , m_currentTransport(0) { setObjectName("Player"); Mlt::Controller::singleton(); setupActions(this); m_playIcon = actionPlay->icon(); m_pauseIcon = actionPause->icon(); // Create a layout. QVBoxLayout *vlayout = new QVBoxLayout(this); vlayout->setObjectName("playerLayout"); vlayout->setContentsMargins(0, 0, 0, 0); vlayout->setSpacing(4); // Add tab bar to indicate/select what is playing: clip, playlist, timeline. m_tabs = new QTabBar; m_tabs->setShape(QTabBar::RoundedSouth); m_tabs->addTab(tr("Source")); m_tabs->addTab(tr("Program")); m_tabs->setTabEnabled(ProgramTabIndex, false); QHBoxLayout* tabLayout = new QHBoxLayout; tabLayout->addWidget(m_tabs); tabLayout->addStretch(); connect(m_tabs, SIGNAL(tabBarClicked(int)), SLOT(onTabBarClicked(int))); // Add the layouts for managing video view, scroll bars, and audio controls. m_videoLayout = new QHBoxLayout; m_videoLayout->setSpacing(4); m_videoLayout->setContentsMargins(0, 0, 0, 0); vlayout->addLayout(m_videoLayout, 10); vlayout->addStretch(); m_videoScrollWidget = new QWidget; m_videoLayout->addWidget(m_videoScrollWidget, 10); m_videoLayout->addStretch(); QGridLayout* glayout = new QGridLayout(m_videoScrollWidget); glayout->setSpacing(0); glayout->setContentsMargins(0, 0, 0, 0); // Add the video widgets. m_videoWidget = QWidget::createWindowContainer(qobject_cast<QWindow*>(MLT.videoWidget())); m_videoWidget->setMinimumSize(QSize(320, 180)); glayout->addWidget(m_videoWidget, 0, 0); m_verticalScroll = new QScrollBar(Qt::Vertical); glayout->addWidget(m_verticalScroll, 0, 1); m_verticalScroll->hide(); m_horizontalScroll = new QScrollBar(Qt::Horizontal); glayout->addWidget(m_horizontalScroll, 1, 0); m_horizontalScroll->hide(); // Add the volume and signal level meter m_volumePopup = new QFrame(this, Qt::Popup); QVBoxLayout *volumeLayoutV = new QVBoxLayout(m_volumePopup); volumeLayoutV->setContentsMargins(0, 0, 0, 0); volumeLayoutV->addSpacerItem(new QSpacerItem(0, 0, QSizePolicy::Minimum, QSizePolicy::Expanding)); QBoxLayout *volumeLayoutH = new QHBoxLayout; volumeLayoutH->setSpacing(0); volumeLayoutH->setContentsMargins(0, 0, 0, 0); volumeLayoutH->addWidget(new AudioScale); m_volumeSlider = new QSlider(Qt::Vertical); m_volumeSlider->setFocusPolicy(Qt::NoFocus); m_volumeSlider->setMinimumHeight(VOLUME_SLIDER_HEIGHT); m_volumeSlider->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); volumeLayoutH->addWidget(m_volumeSlider); volumeLayoutV->addLayout(volumeLayoutH); m_volumeSlider->setRange(0, 99); m_volumeSlider->setValue(Settings.playerVolume()); onVolumeChanged(m_volumeSlider->value()); m_savedVolume = MLT.volume(); m_volumeSlider->setToolTip(tr("Adjust the audio volume")); connect(m_volumeSlider, SIGNAL(valueChanged(int)), this, SLOT(onVolumeChanged(int))); // Add mute-volume buttons layout #ifdef Q_OS_MAC if (Settings.theme() == "system") volumeLayoutH = new QVBoxLayout; else #endif volumeLayoutH = new QHBoxLayout; volumeLayoutH->setContentsMargins(0, 0, 0, 0); volumeLayoutH->setSpacing(0); volumeLayoutV->addLayout(volumeLayoutH); // Add mute button QPushButton* muteButton = new QPushButton(this); muteButton->setFocusPolicy(Qt::NoFocus); muteButton->setObjectName(QString::fromUtf8("muteButton")); muteButton->setIcon(QIcon::fromTheme("dialog-cancel", QIcon(":/icons/oxygen/16x16/actions/dialog-cancel.png"))); muteButton->setToolTip(tr("Silence the audio")); muteButton->setCheckable(true); muteButton->setChecked(Settings.playerMuted()); onMuteButtonToggled(Settings.playerMuted()); volumeLayoutH->addWidget(muteButton); connect(muteButton, SIGNAL(toggled(bool)), this, SLOT(onMuteButtonToggled(bool))); // This hack realizes the volume popup geometry for on_actionVolume_triggered(). m_volumePopup->show(); m_volumePopup->hide(); // Add the scrub bar. m_scrubber = new ScrubBar(this); m_scrubber->setFocusPolicy(Qt::NoFocus); m_scrubber->setObjectName("scrubBar"); m_scrubber->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Preferred); vlayout->addWidget(m_scrubber); // Add toolbar for transport controls. QToolBar* toolbar = new QToolBar(tr("Transport Controls"), this); int s = style()->pixelMetric(QStyle::PM_SmallIconSize); toolbar->setIconSize(QSize(s, s)); toolbar->setContentsMargins(0, 0, 0, 0); QWidget *spacer = new QWidget(this); spacer->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Preferred); m_positionSpinner = new TimeSpinBox(this); m_positionSpinner->setToolTip(tr("Current position")); m_positionSpinner->setEnabled(false); m_positionSpinner->setKeyboardTracking(false); m_durationLabel = new QLabel(this); m_durationLabel->setToolTip(tr("Total Duration")); m_durationLabel->setText(" / 00:00:00:00"); m_durationLabel->setFixedWidth(m_positionSpinner->width()); m_inPointLabel = new QLabel(this); m_inPointLabel->setText("--:--:--:--"); m_inPointLabel->setToolTip(tr("In Point")); m_inPointLabel->setFixedWidth(m_inPointLabel->width()); m_selectedLabel = new QLabel(this); m_selectedLabel->setText("--:--:--:--"); m_selectedLabel->setToolTip(tr("Selected Duration")); m_selectedLabel->setFixedWidth(m_selectedLabel->width()); toolbar->addWidget(m_positionSpinner); toolbar->addWidget(m_durationLabel); toolbar->addWidget(spacer); toolbar->addAction(actionSkipPrevious); toolbar->addAction(actionRewind); toolbar->addAction(actionPlay); toolbar->addAction(actionFastForward); toolbar->addAction(actionSkipNext); // Add zoom button to toolbar. m_zoomButton = new QToolButton; QMenu* zoomMenu = new QMenu(this); m_zoomFitAction = zoomMenu->addAction( QIcon::fromTheme("zoom-fit-best", QIcon(":/icons/oxygen/32x32/actions/zoom-fit-best")), tr("Zoom Fit"), this, SLOT(zoomFit())); m_zoomOriginalAction = zoomMenu->addAction( QIcon::fromTheme("zoom-original", QIcon(":/icons/oxygen/32x32/actions/zoom-original")), tr("Zoom 100%"), this, SLOT(zoomOriginal())); m_zoomOutAction = zoomMenu->addAction( QIcon::fromTheme("zoom-out", QIcon(":/icons/oxygen/32x32/actions/zoom-out")), tr("Zoom 50%"), this, SLOT(zoomOut())); m_zoomInAction = zoomMenu->addAction( QIcon::fromTheme("zoom-in", QIcon(":/icons/oxygen/32x32/actions/zoom-in")), tr("Zoom 200%"), this, SLOT(zoomIn())); connect(m_zoomButton, SIGNAL(toggled(bool)), SLOT(toggleZoom(bool))); m_zoomButton->setMenu(zoomMenu); m_zoomButton->setPopupMode(QToolButton::MenuButtonPopup); m_zoomButton->setCheckable(true); m_zoomButton->setToolTip(tr("Toggle zoom")); toolbar->addWidget(m_zoomButton); toolbar->addAction(actionVolume); m_volumeWidget = toolbar->widgetForAction(actionVolume); // Add in-point and selected duration labels to toolbar. spacer = new QWidget(this); spacer->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Preferred); toolbar->addWidget(spacer); toolbar->addWidget(m_inPointLabel); toolbar->addWidget(m_selectedLabel); vlayout->addWidget(toolbar); vlayout->addLayout(tabLayout); connect(MLT.videoWidget(), SIGNAL(frameDisplayed(const SharedFrame&)), this, SLOT(onFrameDisplayed(const SharedFrame&))); connect(actionPlay, SIGNAL(triggered()), this, SLOT(togglePlayPaused())); connect(actionPause, SIGNAL(triggered()), this, SLOT(pause())); connect(actionFastForward, SIGNAL(triggered()), this, SLOT(fastForward())); connect(actionRewind, SIGNAL(triggered()), this, SLOT(rewind())); connect(m_scrubber, SIGNAL(seeked(int)), this, SLOT(seek(int))); connect(m_scrubber, SIGNAL(inChanged(int)), this, SLOT(onInChanged(int))); connect(m_scrubber, SIGNAL(outChanged(int)), this, SLOT(onOutChanged(int))); connect(m_positionSpinner, SIGNAL(valueChanged(int)), this, SLOT(seek(int))); connect(m_positionSpinner, SIGNAL(editingFinished()), this, SLOT(setFocus())); connect(this, SIGNAL(endOfStream()), this, SLOT(pause())); connect(this, SIGNAL(zoomChanged(float)), MLT.videoWidget(), SLOT(setZoom(float))); connect(m_horizontalScroll, SIGNAL(valueChanged(int)), MLT.videoWidget(), SLOT(setOffsetX(int))); connect(m_verticalScroll, SIGNAL(valueChanged(int)), MLT.videoWidget(), SLOT(setOffsetY(int))); setFocusPolicy(Qt::StrongFocus); }