From 32ae63a2b50ddfa22dbe76941f708a371379bb10 Mon Sep 17 00:00:00 2001 From: Ale Martinez Date: Fri, 15 Nov 2019 10:27:30 -0300 Subject: [PATCH] Added Video Overlays Initialization on Windows builds with VLC If video config file is not present copy a default one to be used as a model by the user. An empty video-layout.xml file disables video overlays Fixes #2525 --- src/Resources/application.qrc | 1 + src/Train/VideoWindow.cpp | 16 +++++++++++----- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/src/Resources/application.qrc b/src/Resources/application.qrc index a07435347..d9c8ce853 100644 --- a/src/Resources/application.qrc +++ b/src/Resources/application.qrc @@ -97,6 +97,7 @@ xml/charts.xml xml/metadata.xml xml/train-layout.xml + xml/video-layout.xml xml/diary-layout.xml xml/analysis-layout.xml xml/home-layout.xml diff --git a/src/Train/VideoWindow.cpp b/src/Train/VideoWindow.cpp index 397426bd0..8276d2752 100644 --- a/src/Train/VideoWindow.cpp +++ b/src/Train/VideoWindow.cpp @@ -103,13 +103,19 @@ VideoWindow::VideoWindow(Context *context) : layout->addWidget(container); libvlc_media_player_set_hwnd (mp, (HWND)(container->winId())); + // Video Overlays Initialization: if video config file is not present + // copy a default one to be used as a model by the user. + // An empty video-layout.xml file disables video overlays QString filename = context->athlete->home->config().canonicalPath() + "/" + "video-layout.xml"; - QFileInfo finfo(filename); - - if (finfo.exists()) + QFile file(filename); + if (!file.exists()) + { + file.setFileName(":/xml/video-layout.xml"); + file.copy(filename); + QFile::setPermissions(filename, QFileDevice::ReadUser|QFileDevice::WriteUser); + } + if (file.exists()) { - QFile file(filename); - // clean previous layout foreach(MeterWidget* p_meterWidget, m_metersWidget) {