From def3ba8d6a2a216028e0da963e31079907a3dd24 Mon Sep 17 00:00:00 2001 From: Jay Sorg Date: Fri, 19 Jul 2013 17:38:36 -0700 Subject: [PATCH] vrplayer: added volume, fix some useability issues --- vrplayer/mainwindow.cpp | 37 +++++++++++++++++++++++++++++++++++++ vrplayer/mainwindow.h | 4 ++++ vrplayer/ourinterface.cpp | 12 ++++++++++++ vrplayer/ourinterface.h | 1 + vrplayer/vrplayer.pro | 9 ++++++--- 5 files changed, 60 insertions(+), 3 deletions(-) diff --git a/vrplayer/mainwindow.cpp b/vrplayer/mainwindow.cpp index 4c8ea2b1..1782f710 100644 --- a/vrplayer/mainwindow.cpp +++ b/vrplayer/mainwindow.cpp @@ -132,8 +132,22 @@ void MainWindow::moveEvent(QMoveEvent *) moveResizeTimer->start(1000); } +void MainWindow::onVolSliderValueChanged(int value) +{ + int volume; + + volume = (value * 0xffff) / 100; + if (interface != 0) + { + interface->setVolume(volume); + } + qDebug() << "vol = " << volume; +} + void MainWindow::setupUI() { + this->setWindowTitle("vrplayer"); + /* setup area to display video */ lblVideo = new QLabel(); lblVideo->setMinimumWidth(320); @@ -198,10 +212,26 @@ void MainWindow::setupUI() connect(btnRewind, SIGNAL(clicked(bool)), this, SLOT(onBtnRewindClicked(bool))); + /* setup volume control slider */ + volSlider = new QSlider(); + volSlider->setOrientation(Qt::Horizontal); + volSlider->setMinimumWidth(100); + volSlider->setMaximumWidth(100); + volSlider->setMinimum(0); + volSlider->setMaximum(100); + volSlider->setValue(20); + volSlider->setTickPosition(QSlider::TicksAbove); + volSlider->setTickInterval(10); + + connect(volSlider, SIGNAL(valueChanged(int)), + this, SLOT(onVolSliderValueChanged(int))); + /* add buttons to bottom panel */ hboxLayoutBottom = new QHBoxLayout; hboxLayoutBottom->addWidget(btnPlay); hboxLayoutBottom->addWidget(btnStop); + hboxLayoutBottom->addWidget(volSlider); + //hboxLayoutBottom->addWidget(btnRewind); hboxLayoutBottom->addStretch(); @@ -482,14 +512,21 @@ void MainWindow::onMoveCompleted() interface->setVcrOp(VCR_PLAY); vcrFlag = VCR_PLAY; + moveResizeTimer->stop(); } void MainWindow::on_actionAbout_triggered() { +#if 0 QMessageBox msgBox; msgBox.setText("VRPlayer version 1.2"); msgBox.setStandardButtons(QMessageBox::Ok); msgBox.setDefaultButton(QMessageBox::Ok); msgBox.exec(); +#else + DlgAbout *dlgabt = new DlgAbout(this); + dlgabt->exec(); + +#endif } diff --git a/vrplayer/mainwindow.h b/vrplayer/mainwindow.h index 50663408..4fef0d60 100644 --- a/vrplayer/mainwindow.h +++ b/vrplayer/mainwindow.h @@ -33,6 +33,7 @@ #include "decoder.h" #include "ourinterface.h" #include "playvideo.h" +#include "dlgabout.h" /* ffmpeg related stuff */ extern "C" @@ -81,6 +82,8 @@ private slots: void on_actionAbout_triggered(); + void onVolSliderValueChanged(int value); + protected: void resizeEvent(QResizeEvent *e); void closeEvent(QCloseEvent *e); @@ -101,6 +104,7 @@ private: QPushButton *btnStop; QPushButton *btnRewind; QSlider *slider; + QSlider *volSlider; QWidget *window; bool acceptSliderMove; QTimer *moveResizeTimer; diff --git a/vrplayer/ourinterface.cpp b/vrplayer/ourinterface.cpp index 094a84f7..cee66691 100644 --- a/vrplayer/ourinterface.cpp +++ b/vrplayer/ourinterface.cpp @@ -215,3 +215,15 @@ void OurInterface::setVcrOp(int op) if (demuxMedia) demuxMedia->setVcrOp(op); } + +int OurInterface::setVolume(int volume) +{ + printf("OurInterface::setVolume\n"); + if (xrdpvr_set_volume(channel, volume)) + { + emit on_ErrorMsg("I/O Error", + "Error sending volume to remote client"); + return -1; + } + return 0; +} diff --git a/vrplayer/ourinterface.h b/vrplayer/ourinterface.h index ea402048..86352001 100644 --- a/vrplayer/ourinterface.h +++ b/vrplayer/ourinterface.h @@ -42,6 +42,7 @@ public: void playMedia(); PlayVideo *getPlayVideoInstance(); void setVcrOp(int op); + int setVolume(int volume); public slots: void onGeometryChanged(int x, int y, int width, int height); diff --git a/vrplayer/vrplayer.pro b/vrplayer/vrplayer.pro index a6e53231..1708a7f4 100644 --- a/vrplayer/vrplayer.pro +++ b/vrplayer/vrplayer.pro @@ -16,16 +16,19 @@ SOURCES += main.cpp\ mediapacket.cpp \ playaudio.cpp \ demuxmedia.cpp \ - ourinterface.cpp + ourinterface.cpp \ + dlgabout.cpp HEADERS += mainwindow.h \ mediapacket.h \ playvideo.h \ playaudio.h \ demuxmedia.h \ - ourinterface.h + ourinterface.h \ + dlgabout.h -FORMS += mainwindow.ui +FORMS += mainwindow.ui \ + dlgabout.ui # added by LK INCLUDEPATH += ../xrdpvr