Created
February 17, 2016 11:17
-
-
Save ihewitt/33832417e108c9d09d44 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
index 43fa65f..aac02ca 100644 | |
--- a/src/VideoWindow.cpp | |
+++ b/src/VideoWindow.cpp | |
@@ -141,8 +141,11 @@ VideoWindow::VideoWindow(Context *context) : | |
mp = new QMediaPlayer(this); | |
mp->setVideoOutput(wd); | |
- | |
layout->addWidget(wd); | |
+ | |
+ menu->addAction(tr("Detach"), this, SLOT(detachPlayer())); | |
+ menu->addAction(tr("Attach"), this, SLOT(attachPlayer())); | |
+ | |
#endif | |
if (init) { | |
@@ -188,6 +191,27 @@ VideoWindow::~VideoWindow() | |
#endif | |
} | |
+void VideoWindow::detachPlayer() | |
+{ | |
+ QPoint pos = wd->pos(); | |
+ QSize size = wd->size(); | |
+ | |
+ QLayout *l = layout(); | |
+ l->removeWidget(wd); | |
+ | |
+ Qt::WindowFlags f = wd->windowFlags(); | |
+ wd->setWindowFlags(Qt::Tool|Qt::CustomizeWindowHint|Qt::WindowMinMaxButtonsHint); | |
+ wd->move(pos); | |
+ wd->resize(size); | |
+ wd->show(); | |
+} | |
+void VideoWindow::attachPlayer() | |
+{ | |
+ QLayout *l = layout(); | |
+ wd->setWindowFlags(Qt::Widget); | |
+ l->addWidget(wd); | |
+} | |
+ | |
void VideoWindow::resizeEvent(QResizeEvent * ) | |
{ | |
foreach(MeterWidget* p_meterWidget , m_metersWidget) | |
@@ -219,6 +243,7 @@ void VideoWindow::startPlayback() | |
#ifdef GC_VIDEO_QT5 | |
// open the media object | |
+ wd->show(); | |
mp->play(); | |
#endif | |
@@ -247,6 +272,8 @@ void VideoWindow::stopPlayback() | |
#ifdef GC_VIDEO_QT5 | |
mp->stop(); | |
+ wd->hide(); | |
+ | |
#endif | |
foreach(MeterWidget* p_meterWidget , m_metersWidget) | |
p_meterWidget->hide(); | |
@@ -491,7 +518,7 @@ void VideoWindow::mediaSelected(QString filename) | |
#else | |
// A Windows "c:\xyz\abc def.avi" filename should become file:///c:/xyz/abc%20def.avi | |
QString fileURL = "file:///" + filename.replace("\\", "/"); | |
-#endif | |
+#endif | |
//qDebug()<<"file url="<<fileURL; | |
/* open media */ | |
m = libvlc_media_new_location(inst, filename.endsWith("/DVD") ? "dvd://" : fileURL.toLocal8Bit()); | |
diff --git a/src/VideoWindow.h b/src/VideoWindow.h | |
index a5cdcbc..7cb4aa5 100644 | |
--- a/src/VideoWindow.h | |
+++ b/src/VideoWindow.h | |
@@ -174,6 +174,8 @@ class VideoWindow : public GcWindow | |
void telemetryUpdate(RealtimeData rtd); | |
void seekPlayback(long ms); | |
void mediaSelected(QString filename); | |
+ void detachPlayer(); | |
+ void attachPlayer(); | |
protected: |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment