vrplayer: added volume, fix some useability issues
This commit is contained in:
parent
c41bced4df
commit
def3ba8d6a
@ -132,8 +132,22 @@ void MainWindow::moveEvent(QMoveEvent *)
|
|||||||
moveResizeTimer->start(1000);
|
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()
|
void MainWindow::setupUI()
|
||||||
{
|
{
|
||||||
|
this->setWindowTitle("vrplayer");
|
||||||
|
|
||||||
/* setup area to display video */
|
/* setup area to display video */
|
||||||
lblVideo = new QLabel();
|
lblVideo = new QLabel();
|
||||||
lblVideo->setMinimumWidth(320);
|
lblVideo->setMinimumWidth(320);
|
||||||
@ -198,10 +212,26 @@ void MainWindow::setupUI()
|
|||||||
connect(btnRewind, SIGNAL(clicked(bool)),
|
connect(btnRewind, SIGNAL(clicked(bool)),
|
||||||
this, SLOT(onBtnRewindClicked(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 */
|
/* add buttons to bottom panel */
|
||||||
hboxLayoutBottom = new QHBoxLayout;
|
hboxLayoutBottom = new QHBoxLayout;
|
||||||
hboxLayoutBottom->addWidget(btnPlay);
|
hboxLayoutBottom->addWidget(btnPlay);
|
||||||
hboxLayoutBottom->addWidget(btnStop);
|
hboxLayoutBottom->addWidget(btnStop);
|
||||||
|
hboxLayoutBottom->addWidget(volSlider);
|
||||||
|
|
||||||
//hboxLayoutBottom->addWidget(btnRewind);
|
//hboxLayoutBottom->addWidget(btnRewind);
|
||||||
hboxLayoutBottom->addStretch();
|
hboxLayoutBottom->addStretch();
|
||||||
|
|
||||||
@ -482,14 +512,21 @@ void MainWindow::onMoveCompleted()
|
|||||||
|
|
||||||
interface->setVcrOp(VCR_PLAY);
|
interface->setVcrOp(VCR_PLAY);
|
||||||
vcrFlag = VCR_PLAY;
|
vcrFlag = VCR_PLAY;
|
||||||
|
moveResizeTimer->stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::on_actionAbout_triggered()
|
void MainWindow::on_actionAbout_triggered()
|
||||||
{
|
{
|
||||||
|
#if 0
|
||||||
QMessageBox msgBox;
|
QMessageBox msgBox;
|
||||||
|
|
||||||
msgBox.setText("VRPlayer version 1.2");
|
msgBox.setText("VRPlayer version 1.2");
|
||||||
msgBox.setStandardButtons(QMessageBox::Ok);
|
msgBox.setStandardButtons(QMessageBox::Ok);
|
||||||
msgBox.setDefaultButton(QMessageBox::Ok);
|
msgBox.setDefaultButton(QMessageBox::Ok);
|
||||||
msgBox.exec();
|
msgBox.exec();
|
||||||
|
#else
|
||||||
|
DlgAbout *dlgabt = new DlgAbout(this);
|
||||||
|
dlgabt->exec();
|
||||||
|
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -33,6 +33,7 @@
|
|||||||
#include "decoder.h"
|
#include "decoder.h"
|
||||||
#include "ourinterface.h"
|
#include "ourinterface.h"
|
||||||
#include "playvideo.h"
|
#include "playvideo.h"
|
||||||
|
#include "dlgabout.h"
|
||||||
|
|
||||||
/* ffmpeg related stuff */
|
/* ffmpeg related stuff */
|
||||||
extern "C"
|
extern "C"
|
||||||
@ -81,6 +82,8 @@ private slots:
|
|||||||
|
|
||||||
void on_actionAbout_triggered();
|
void on_actionAbout_triggered();
|
||||||
|
|
||||||
|
void onVolSliderValueChanged(int value);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void resizeEvent(QResizeEvent *e);
|
void resizeEvent(QResizeEvent *e);
|
||||||
void closeEvent(QCloseEvent *e);
|
void closeEvent(QCloseEvent *e);
|
||||||
@ -101,6 +104,7 @@ private:
|
|||||||
QPushButton *btnStop;
|
QPushButton *btnStop;
|
||||||
QPushButton *btnRewind;
|
QPushButton *btnRewind;
|
||||||
QSlider *slider;
|
QSlider *slider;
|
||||||
|
QSlider *volSlider;
|
||||||
QWidget *window;
|
QWidget *window;
|
||||||
bool acceptSliderMove;
|
bool acceptSliderMove;
|
||||||
QTimer *moveResizeTimer;
|
QTimer *moveResizeTimer;
|
||||||
|
@ -215,3 +215,15 @@ void OurInterface::setVcrOp(int op)
|
|||||||
if (demuxMedia)
|
if (demuxMedia)
|
||||||
demuxMedia->setVcrOp(op);
|
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();
|
void playMedia();
|
||||||
PlayVideo *getPlayVideoInstance();
|
PlayVideo *getPlayVideoInstance();
|
||||||
void setVcrOp(int op);
|
void setVcrOp(int op);
|
||||||
|
int setVolume(int volume);
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void onGeometryChanged(int x, int y, int width, int height);
|
void onGeometryChanged(int x, int y, int width, int height);
|
||||||
|
@ -16,16 +16,19 @@ SOURCES += main.cpp\
|
|||||||
mediapacket.cpp \
|
mediapacket.cpp \
|
||||||
playaudio.cpp \
|
playaudio.cpp \
|
||||||
demuxmedia.cpp \
|
demuxmedia.cpp \
|
||||||
ourinterface.cpp
|
ourinterface.cpp \
|
||||||
|
dlgabout.cpp
|
||||||
|
|
||||||
HEADERS += mainwindow.h \
|
HEADERS += mainwindow.h \
|
||||||
mediapacket.h \
|
mediapacket.h \
|
||||||
playvideo.h \
|
playvideo.h \
|
||||||
playaudio.h \
|
playaudio.h \
|
||||||
demuxmedia.h \
|
demuxmedia.h \
|
||||||
ourinterface.h
|
ourinterface.h \
|
||||||
|
dlgabout.h
|
||||||
|
|
||||||
FORMS += mainwindow.ui
|
FORMS += mainwindow.ui \
|
||||||
|
dlgabout.ui
|
||||||
|
|
||||||
# added by LK
|
# added by LK
|
||||||
INCLUDEPATH += ../xrdpvr
|
INCLUDEPATH += ../xrdpvr
|
||||||
|
Loading…
Reference in New Issue
Block a user