diff --git a/ScreenPlay/CMakeLists.txt b/ScreenPlay/CMakeLists.txt index 0c2aa097..6b22e320 100644 --- a/ScreenPlay/CMakeLists.txt +++ b/ScreenPlay/CMakeLists.txt @@ -152,6 +152,7 @@ set(RESOURCES assets/icons/icon_installed.svg assets/icons/icon_launch.svg assets/icons/icon_minimize.svg + assets/icons/icon_contains_audio.svg assets/icons/icon_movie.svg assets/icons/icon_new_releases.svg assets/icons/icon_open_in_new.svg diff --git a/ScreenPlay/assets/icons/icon_contains_audio.svg b/ScreenPlay/assets/icons/icon_contains_audio.svg new file mode 100644 index 00000000..509dd641 --- /dev/null +++ b/ScreenPlay/assets/icons/icon_contains_audio.svg @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/ScreenPlay/inc/public/ScreenPlay/installedlistmodel.h b/ScreenPlay/inc/public/ScreenPlay/installedlistmodel.h index 6a71e527..e3edc6c3 100644 --- a/ScreenPlay/inc/public/ScreenPlay/installedlistmodel.h +++ b/ScreenPlay/inc/public/ScreenPlay/installedlistmodel.h @@ -59,6 +59,7 @@ public: SearchType, LastModified, IsNew, + ContainsAudio, }; Q_ENUM(ScreenPlayItem) diff --git a/ScreenPlay/qml/Installed/Installed.qml b/ScreenPlay/qml/Installed/Installed.qml index 50499a30..c8600802 100644 --- a/ScreenPlay/qml/Installed/Installed.qml +++ b/ScreenPlay/qml/Installed/Installed.qml @@ -229,6 +229,7 @@ Item { customTitle: m_title type: m_type isNew: m_isNew + containsAudio: m_containsAudio screenId: m_folderName absoluteStoragePath: m_absoluteStoragePath publishedFileID: m_publishedFileID diff --git a/ScreenPlay/qml/Installed/ScreenPlayItem.qml b/ScreenPlay/qml/Installed/ScreenPlayItem.qml index f2e04297..be8aa23d 100644 --- a/ScreenPlay/qml/Installed/ScreenPlayItem.qml +++ b/ScreenPlay/qml/Installed/ScreenPlayItem.qml @@ -18,6 +18,7 @@ Item { property int itemIndex property bool isScrolling: false property bool isNew: false + property bool containsAudio: false signal openContextMenu(point position) @@ -157,6 +158,24 @@ Item { absoluteStoragePath: m_absoluteStoragePath } + Image { + id: icnAudio + + width: 20 + height: 20 + opacity: 0.25 + visible: root.containsAudio + source: "qrc:/qml/ScreenPlayApp/assets/icons/icon_contains_audio.svg" + sourceSize: Qt.size(20, 20) + + anchors { + top: parent.top + left: icnType.right + margins: 10 + } + } + + Image { id: icnType @@ -259,6 +278,13 @@ Item { to: 0.8 } + OpacityAnimator { + target: icnAudio + duration: 80 + from: 0.25 + to: 0.8 + } + OpacityAnimator { target: effect duration: 80 @@ -291,6 +317,13 @@ Item { to: 0.25 } + OpacityAnimator { + target: icnAudio + duration: 80 + from: 0.8 + to: 0.25 + } + OpacityAnimator { target: effect duration: 80 diff --git a/ScreenPlay/qml/Settings/Settings.qml b/ScreenPlay/qml/Settings/Settings.qml index 0cc36f77..8321de70 100644 --- a/ScreenPlay/qml/Settings/Settings.qml +++ b/ScreenPlay/qml/Settings/Settings.qml @@ -236,6 +236,18 @@ Item { anchors.margins: 20 spacing: 20 + SettingBool { + headline: qsTr("Pause wallpaper video rendering while another app is in the foreground.") + description: qsTr("Limitations: This setting is Windows only, currently only works if you have exactly one monitor connected, and is limited to wallpapers with no audio. Wallpaper restart is required, when changing this setting!") + isChecked: App.settings.checkWallpaperVisible + onCheckboxChanged: function (checked) { + App.settings.setCheckWallpaperVisible(checked); + } + } + + SettingsHorizontalSeperator { + } + SettingsComboBox { id: cbVideoFillMode diff --git a/ScreenPlay/src/installedlistmodel.cpp b/ScreenPlay/src/installedlistmodel.cpp index 1e1276b8..a363baec 100644 --- a/ScreenPlay/src/installedlistmodel.cpp +++ b/ScreenPlay/src/installedlistmodel.cpp @@ -154,6 +154,8 @@ QVariant InstalledListModel::data(const QModelIndex& index, int role) const return m_screenPlayFiles.at(row).tags; case static_cast(ScreenPlayItem::IsNew): return m_screenPlayFiles.at(row).isNew; + case static_cast(ScreenPlayItem::ContainsAudio): + return m_screenPlayFiles.at(row).containsAudio; case static_cast(ScreenPlayItem::LastModified): return m_screenPlayFiles.at(row).lastModified; case static_cast(ScreenPlayItem::SearchType): @@ -181,6 +183,7 @@ QHash InstalledListModel::roleNames() const { static_cast(ScreenPlayItem::Tags), "m_tags" }, { static_cast(ScreenPlayItem::SearchType), "m_searchType" }, { static_cast(ScreenPlayItem::IsNew), "m_isNew" }, + { static_cast(ScreenPlayItem::ContainsAudio), "m_containsAudio" }, { static_cast(ScreenPlayItem::LastModified), "m_lastModified" } }; } @@ -259,6 +262,7 @@ QVariantMap InstalledListModel::get(const QString& folderName) const map.insert("m_absoluteStoragePath", QUrl::fromLocalFile(item.projectJsonFilePath.dir().path())); map.insert("m_publishedFileID", item.publishedFileID); map.insert("m_isNew", item.isNew); + map.insert("m_containsAudio", item.containsAudio); map.insert("m_lastModified", item.lastModified); return map; } diff --git a/ScreenPlayUtil/inc/public/ScreenPlayUtil/projectfile.h b/ScreenPlayUtil/inc/public/ScreenPlayUtil/projectfile.h index c951c694..97842218 100644 --- a/ScreenPlayUtil/inc/public/ScreenPlayUtil/projectfile.h +++ b/ScreenPlayUtil/inc/public/ScreenPlayUtil/projectfile.h @@ -52,6 +52,7 @@ struct ProjectFile { InstalledType::InstalledType type = InstalledType::InstalledType::Unknown; SearchType::SearchType searchType = SearchType::SearchType::All; bool isNew = false; + bool containsAudio = false; QDateTime lastModified; }; } diff --git a/ScreenPlayUtil/src/projectfile.cpp b/ScreenPlayUtil/src/projectfile.cpp index c3121da6..8777347f 100644 --- a/ScreenPlayUtil/src/projectfile.cpp +++ b/ScreenPlayUtil/src/projectfile.cpp @@ -101,6 +101,11 @@ bool ProjectFile::init() } } + if (type == ScreenPlay::InstalledType::InstalledType::VideoWallpaper){ + QFileInfo audioFile(folder.absolutePath() + "/audio.mp3"); + containsAudio = audioFile.exists(); + } + return true; } bool ProjectFile::isValid() diff --git a/ScreenPlayWallpaper/qml/MultimediaView.qml b/ScreenPlayWallpaper/qml/MultimediaView.qml index 00b648ac..5003d3ee 100644 --- a/ScreenPlayWallpaper/qml/MultimediaView.qml +++ b/ScreenPlayWallpaper/qml/MultimediaView.qml @@ -75,6 +75,15 @@ Item { mediaPlayer.position = currentTime * mediaPlayer.duration; } + function onVisualsPausedChanged(visualsPaused) { + if(!Wallpaper.isPlaying) + return + if(visualsPaused) + mediaPlayer.pause() + else + mediaPlayer.play() + } + target: Wallpaper } } diff --git a/ScreenPlayWallpaper/src/basewindow.cpp b/ScreenPlayWallpaper/src/basewindow.cpp index 04140788..b4119343 100644 --- a/ScreenPlayWallpaper/src/basewindow.cpp +++ b/ScreenPlayWallpaper/src/basewindow.cpp @@ -58,6 +58,15 @@ ScreenPlay::WallpaperExitCode BaseWindow::setup() setType(projectFile.type); setProjectSourceFile(projectFile.file); + // We do not yet have implemented continue playing the audio.mp3 yet + // so disable the checkWallpaperVisible for now + if(checkWallpaperVisible()){ + if(projectFile.containsAudio){ + qInfo() << "Disable wallpaper visible check, because it contains audio."; + setCheckWallpaperVisible(false); + } + } + if (m_type == ScreenPlay::InstalledType::InstalledType::WebsiteWallpaper) { setProjectSourceFileAbsolute(projectFile.url); } else { diff --git a/ScreenPlayWallpaper/src/winwindow.cpp b/ScreenPlayWallpaper/src/winwindow.cpp index 06abb70d..0f2a375e 100644 --- a/ScreenPlayWallpaper/src/winwindow.cpp +++ b/ScreenPlayWallpaper/src/winwindow.cpp @@ -148,8 +148,9 @@ ScreenPlay::WallpaperExitCode WinWindow::start() configureWindowGeometry(); - // We do not support autopause for multi monitor wallpaper - if (this->activeScreensList().length() == 1) { + // We do not support autopause for multi monitor wallpaper and + // wallpaper than contain audio, see BaseWindow::setup(). + if (activeScreensList().length() == 1) { if (checkWallpaperVisible()) { m_checkForFullScreenWindowTimer.start(10); }