From 3534e1be0053e4ae078b782bc102f40ce40e6d0f Mon Sep 17 00:00:00 2001 From: Ken Moore Date: Mon, 7 Aug 2017 15:05:30 -0400 Subject: A couple quick updates to lumina-mediaplayer: 1. Enable video for the local file playback where supported. 2. Fix the single-instance forwarding --- .../lumina-fm/widgets/MultimediaWidget.cpp | 33 +++++++++++----------- src-qt5/desktop-utils/lumina-mediaplayer/main.cpp | 1 + .../desktop-utils/lumina-mediaplayer/mainUI.cpp | 12 ++++---- 3 files changed, 23 insertions(+), 23 deletions(-) diff --git a/src-qt5/desktop-utils/lumina-fm/widgets/MultimediaWidget.cpp b/src-qt5/desktop-utils/lumina-fm/widgets/MultimediaWidget.cpp index 851a0b31..eaa15a59 100644 --- a/src-qt5/desktop-utils/lumina-fm/widgets/MultimediaWidget.cpp +++ b/src-qt5/desktop-utils/lumina-fm/widgets/MultimediaWidget.cpp @@ -11,7 +11,7 @@ MultimediaWidget::MultimediaWidget(QWidget *parent) : QWidget(parent), ui(new Ui::MultimediaWidget){ ui->setupUi(this); //load the designer file - + //Add in the special QMultimediaWidgets mediaObj = new QMediaPlayer(this); mediaObj->setVolume(100); @@ -21,10 +21,10 @@ MultimediaWidget::MultimediaWidget(QWidget *parent) : QWidget(parent), ui(new Ui ui->videoLayout->addWidget(videoDisplay); mediaObj->setVideoOutput(videoDisplay); videoDisplay->setVisible(false); - + UpdateIcons(); UpdateText(); - + //Connect the special signals/slots for the media object connect(mediaObj, SIGNAL(durationChanged(qint64)), this, SLOT(playerDurationChanged(qint64)) ); connect(mediaObj, SIGNAL(seekableChanged(bool)), ui->playerSlider, SLOT(setEnabled(bool)) ); @@ -33,7 +33,7 @@ MultimediaWidget::MultimediaWidget(QWidget *parent) : QWidget(parent), ui(new Ui connect(mediaObj, SIGNAL(stateChanged(QMediaPlayer::State)), this, SLOT(playerStateChanged(QMediaPlayer::State)) ); connect(mediaObj, SIGNAL(videoAvailableChanged(bool)), this, SLOT(playerVideoAvailable(bool)) ); connect(mediaObj, SIGNAL(error(QMediaPlayer::Error)), this, SLOT(playerError()) ); - + //Disable some of the initial states ui->tool_player_stop->setEnabled(false); //nothing to stop yet ui->tool_player_pause->setVisible(false); //nothing to pause yet @@ -41,7 +41,7 @@ MultimediaWidget::MultimediaWidget(QWidget *parent) : QWidget(parent), ui(new Ui } MultimediaWidget::~MultimediaWidget(){ - + } // ================ @@ -82,8 +82,8 @@ void MultimediaWidget::UpdateText(){ QString MultimediaWidget::msToText(qint64 ms){ QString disp; if(ms>3600000){ - disp.append( QString::number(ms/3600000)+":" ); - ms = ms%3600000; + disp.append( QString::number(ms/3600000)+":" ); + ms = ms%3600000; } if(ms>60000){ disp.append( QString::number(ms/60000)+":" ); @@ -107,7 +107,7 @@ void MultimediaWidget::playerStatusChanged(QMediaPlayer::MediaStatus stat){ //Only use this for end-of-file detection - use the state detection otherwise if(stat == QMediaPlayer::EndOfMedia){ if(!mediaObj->isMuted()){ playerFinished(); } //make sure it is not being seeked right now - } + } } void MultimediaWidget::playerStateChanged(QMediaPlayer::State newstate){ @@ -139,13 +139,13 @@ void MultimediaWidget::playerStateChanged(QMediaPlayer::State newstate){ void MultimediaWidget::playerVideoAvailable(bool showVideo){ ui->label_player_novideo->setVisible(!showVideo); - videoDisplay->setVisible(showVideo); + videoDisplay->setVisible(showVideo); } void MultimediaWidget::playerDurationChanged(qint64 dur){ if(dur < 0){ return; } //not ready yet ui->playerSlider->setMaximum(mediaObj->duration()); - playerTTime = msToText(dur); + playerTTime = msToText(dur); } void MultimediaWidget::playerTimeChanged(qint64 ctime){ @@ -185,7 +185,7 @@ void MultimediaWidget::on_tool_player_play_clicked(){ } void MultimediaWidget::on_combo_player_list_currentIndexChanged(int index){ - ui->tool_player_next->setEnabled( ui->combo_player_list->count() > (index+1) ); + ui->tool_player_next->setEnabled( ui->combo_player_list->count() > (index+1) ); ui->tool_player_prev->setEnabled( (index-1) >= 0 ); } @@ -195,16 +195,16 @@ void MultimediaWidget::on_tool_player_next_clicked(){ } void MultimediaWidget::on_tool_player_prev_clicked(){ - ui->combo_player_list->setCurrentIndex( ui->combo_player_list->currentIndex()-1); + ui->combo_player_list->setCurrentIndex( ui->combo_player_list->currentIndex()-1); if(mediaObj->state()!=QMediaPlayer::StoppedState){ on_tool_player_play_clicked(); } } -void MultimediaWidget::on_tool_player_pause_clicked(){ - mediaObj->pause(); +void MultimediaWidget::on_tool_player_pause_clicked(){ + mediaObj->pause(); } -void MultimediaWidget::on_tool_player_stop_clicked(){ - mediaObj->stop(); +void MultimediaWidget::on_tool_player_stop_clicked(){ + mediaObj->stop(); } //Slider controls @@ -220,4 +220,3 @@ void MultimediaWidget::on_playerSlider_valueChanged(int val){ ui->label_player_runstats->setText( msToText(val)+"/"+playerTTime ); if(mediaObj->isMuted()){ mediaObj->setPosition(val); } //currently seeking } - \ No newline at end of file diff --git a/src-qt5/desktop-utils/lumina-mediaplayer/main.cpp b/src-qt5/desktop-utils/lumina-mediaplayer/main.cpp index 9eebff9f..18b6d73e 100644 --- a/src-qt5/desktop-utils/lumina-mediaplayer/main.cpp +++ b/src-qt5/desktop-utils/lumina-mediaplayer/main.cpp @@ -16,6 +16,7 @@ int main(int argc, char *argv[]) { LTHEME::LoadCustomEnvSettings(); LSingleApplication a(argc, argv, "l-mediap"); + if(!a.isPrimaryProcess()){ return 0; } //Now go ahead and setup the app QStringList args; for(int i=1; isetupUi(this); SETTINGS = LUtils::openSettings("lumina-desktop","lumina-mediaplayer",this); closing = false; - DISABLE_VIDEO = true; //add a toggle in the UI for this later + DISABLE_VIDEO = false; //add a toggle in the UI for this later //Any special UI changes QWidget *spacer = new QWidget(this); spacer->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred); @@ -69,7 +69,7 @@ void MainUI::loadArguments(QStringList args){ void MainUI::setupPlayer(){ PLAYER = new QMediaPlayer(this); //base multimedia object VIDEO = new QVideoWidget(this); //output to this widget for video - PLAYLIST = new QMediaPlaylist(PLAYER); //pull from this playlist + PLAYLIST = new QMediaPlaylist(PLAYER); //pull from this playlist ui->videoLayout->addWidget(VIDEO); //Now setup the interfaces between all these objects @@ -262,13 +262,13 @@ void MainUI::closeApplication(){ QTimer::singleShot(500, this, SLOT(close()) ); }else{ this->close(); - } + } } void MainUI::PlayerTypeChanged(bool active){ if(!active){ return; } //this gets rid of the "extra" signals from the radio button functionality (1 signal from each button on change) - if(ui->radio_pandora->isChecked()){ - ui->stackedWidget->setCurrentWidget(ui->page_pandora); + if(ui->radio_pandora->isChecked()){ + ui->stackedWidget->setCurrentWidget(ui->page_pandora); PandoraStateChanged(PANDORA->currentState()); QIcon ico = LXDG::findIcon("pandora",":pandora"); SYSTRAY->setIcon( ico ); @@ -276,7 +276,7 @@ void MainUI::PlayerTypeChanged(bool active){ this->setWindowTitle( tr("Pandora Radio") ); //Now hide/deactivate any toolbar buttons which are not used ui->actionBack->setVisible(!ui->radio_pandora->isChecked()); - }else{ + }else{ ui->stackedWidget->setCurrentWidget(ui->page_local); LocalStateChanged(QMediaPlayer::StoppedState); QIcon ico = LXDG::findIcon("media-playlist-audio","audio-x-generic"); -- cgit From d550e9cb668db58c8f818981916a465fb91b4e13 Mon Sep 17 00:00:00 2001 From: Ken Moore Date: Mon, 7 Aug 2017 15:15:29 -0400 Subject: Update the Makefile for lumina-mediaplayer gstreamer1-plugins-gl is required for video playback to not crash/stop when the video is hidden (such as changing tabs or minimizing the window). The gstreamer1-qt5 package is just a good idea to pull in the other plugins that Qt5 supports. --- port-files/FreeBSD/deskutils/lumina-mediaplayer/Makefile | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/port-files/FreeBSD/deskutils/lumina-mediaplayer/Makefile b/port-files/FreeBSD/deskutils/lumina-mediaplayer/Makefile index 2a319ee5..1bc0c455 100644 --- a/port-files/FreeBSD/deskutils/lumina-mediaplayer/Makefile +++ b/port-files/FreeBSD/deskutils/lumina-mediaplayer/Makefile @@ -11,6 +11,9 @@ COMMENT= Streaming media player from the Lumina Desktop LICENSE= BSD3CLAUSE +RUN_DEPENDS= gstreamer1-qt5>=0:multimedia/gstreamer1-qt5 \ + gstreamer1-plugins-gl>=0:graphics/gstreamer1-plugins-gl + OPTIONS_DEFINE= I18N OPTIONS_DEFAULT= I18N I18N_DESC= Install localization files @@ -19,9 +22,9 @@ I18N_DESC= Install localization files MAKE_JOBS_UNSAFE=yes +USES= qmake USE_QT5= core gui widgets network svg \ buildtools_build x11extras multimedia concurrent -USES= qmake USE_GITHUB= yes GH_ACCOUNT= trueos GH_PROJECT= lumina -- cgit