diff options
Diffstat (limited to 'vrplayer/mainwindow.cpp')
| -rw-r--r-- | vrplayer/mainwindow.cpp | 94 |
1 files changed, 56 insertions, 38 deletions
diff --git a/vrplayer/mainwindow.cpp b/vrplayer/mainwindow.cpp index 1782f710..65bff0f0 100644 --- a/vrplayer/mainwindow.cpp +++ b/vrplayer/mainwindow.cpp @@ -66,8 +66,8 @@ MainWindow::~MainWindow() { delete ui; - if (moveResizeTimer) - delete moveResizeTimer; + //if (moveResizeTimer) + // delete moveResizeTimer; } void MainWindow::closeEvent(QCloseEvent *event) @@ -86,50 +86,50 @@ void MainWindow::closeEvent(QCloseEvent *event) void MainWindow::resizeEvent(QResizeEvent *) { - if (vcrFlag != VCR_PLAY) + //if (vcrFlag != VCR_PLAY) { QRect rect; getVdoGeometry(&rect); interface->sendGeometry(rect); - return; + //return; } - interface->setVcrOp(VCR_PAUSE); - vcrFlag = VCR_PAUSE; - - if (!moveResizeTimer) - { - moveResizeTimer = new QTimer; - connect(moveResizeTimer, SIGNAL(timeout()), - this, SLOT(onMoveCompleted())); - } - lblVideo->setStyleSheet("QLabel { background-color : black; color : blue; }"); - moveResizeTimer->start(1000); + //interface->setVcrOp(VCR_PAUSE); + //vcrFlag = VCR_PAUSE; + + //if (!moveResizeTimer) + //{ + // moveResizeTimer = new QTimer; + // connect(moveResizeTimer, SIGNAL(timeout()), + // this, SLOT(onMoveCompleted())); + //} + //lblVideo->setStyleSheet("QLabel { background-color : black; color : blue; }"); + //moveResizeTimer->start(1000); } void MainWindow::moveEvent(QMoveEvent *) { - if (vcrFlag != VCR_PLAY) + //if (vcrFlag != VCR_PLAY) { QRect rect; getVdoGeometry(&rect); interface->sendGeometry(rect); - return; + //return; } - interface->setVcrOp(VCR_PAUSE); - vcrFlag = VCR_PAUSE; - - if (!moveResizeTimer) - { - moveResizeTimer = new QTimer; - connect(moveResizeTimer, SIGNAL(timeout()), - this, SLOT(onMoveCompleted())); - } - lblVideo->setStyleSheet("QLabel { background-color : black; color : blue; }"); - moveResizeTimer->start(1000); + //interface->setVcrOp(VCR_PAUSE); + //vcrFlag = VCR_PAUSE; + + //if (!moveResizeTimer) + //{ + // moveResizeTimer = new QTimer; + // connect(moveResizeTimer, SIGNAL(timeout()), + // this, SLOT(onMoveCompleted())); + //} + //lblVideo->setStyleSheet("QLabel { background-color : black; color : blue; }"); + //moveResizeTimer->start(1000); } void MainWindow::onVolSliderValueChanged(int value) @@ -253,10 +253,17 @@ void MainWindow::openMediaFile() if (filename.length() == 0) { + /* no previous selection - open user's home folder TODO */ // TODO filename = QFileDialog::getOpenFileName(this, "Select Media File", "/"); + //filename = QFileDialog::getOpenFileName(this, "Select Media File", + // QDir::currentPath()); + filename = QFileDialog::getOpenFileName(this, "Select Media File", - QDir::currentPath()); + QDir::currentPath(), + "Media *.mov *.mp4 *.mkv (*.mov *.mp4 *.mkv)"); + + } else { @@ -302,13 +309,19 @@ void MainWindow::clearDisplay() void MainWindow::on_actionOpen_Media_File_triggered() { if (vcrFlag != 0) + { onBtnStopClicked(true); + } /* if media was specified on cmd line, use it just once */ if (gotMediaOnCmdline) + { gotMediaOnCmdline = false; + } else + { openMediaFile(); + } if (filename.length() == 0) { @@ -327,10 +340,10 @@ void MainWindow::on_actionOpen_Media_File_triggered() interface->initRemoteClient(); } - playVideo = interface->getPlayVideoInstance(); - if (playVideo) + demuxMedia = interface->getDemuxMediaInstance(); + if (demuxMedia) { - connect(playVideo, SIGNAL(onElapsedtime(int)), + connect(demuxMedia, SIGNAL(onElapsedtime(int)), this, SLOT(onElapsedTime(int))); } @@ -355,7 +368,7 @@ void MainWindow::onBtnPlayClicked(bool) { if (vcrFlag == 0) { - /* first time play button has been clicked */ + /* first time play button3 has been clicked */ on_actionOpen_Media_File_triggered(); btnPlay->setText("Pause"); vcrFlag = VCR_PLAY; @@ -385,8 +398,8 @@ void MainWindow::onBtnPlayClicked(bool) void MainWindow::onBtnRewindClicked(bool) { - if (playVideo) - playVideo->onMediaSeek(0); + //if (playVideo) + // playVideo->onMediaSeek(0); } void MainWindow::onBtnStopClicked(bool) @@ -401,6 +414,8 @@ void MainWindow::onBtnStopClicked(bool) /* clear screen by filling it with black */ clearDisplay(); + + btnPlay->setChecked(false); } void MainWindow::onMediaDurationInSeconds(int duration) @@ -479,8 +494,10 @@ void MainWindow::onSliderValueChanged(int value) if (acceptSliderMove) { acceptSliderMove = false; - if (playVideo) - playVideo->onMediaSeek(value / 100); + if (demuxMedia != NULL) + { + demuxMedia->onMediaSeek(value / 100); + } } } @@ -503,6 +520,7 @@ void MainWindow::onSliderActionTriggered(int action) } } +// not called void MainWindow::onMoveCompleted() { QRect rect; @@ -512,7 +530,7 @@ void MainWindow::onMoveCompleted() interface->setVcrOp(VCR_PLAY); vcrFlag = VCR_PLAY; - moveResizeTimer->stop(); + //moveResizeTimer->stop(); } void MainWindow::on_actionAbout_triggered() |
