vrplayer: added volume, fix some useability issues

ulab-next
Jay Sorg 11 years ago
parent c41bced4df
commit def3ba8d6a

@ -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
}

@ -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;

@ -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;
}

@ -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);

@ -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

Loading…
Cancel
Save