1
0
mirror of https://gitlab.com/kelteseth/ScreenPlay.git synced 2024-07-18 18:48:28 +02:00

Add disable wallpaper playing if not visible (again)

Changed from not rendering to pause the video. This does not work if
the wallpaper contains audio, but has the advantage of not displaying
a black bar in the windows task bar.

Add audio icon to installed list if we item contains an audio.mp3
This commit is contained in:
Elias Steurer 2023-06-29 20:31:35 +02:00
parent 73f31d2092
commit 82b38820f2
12 changed files with 90 additions and 2 deletions

View File

@ -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

View File

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg width="100%" height="100%" viewBox="0 0 48 48" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve" xmlns:serif="http://www.serif.com/" style="fill-rule:evenodd;clip-rule:evenodd;stroke-linejoin:round;stroke-miterlimit:2;">
<g transform="matrix(2.21067,0,0,2.21067,-2.52809,-2.52809)">
<g>
<g id="volume">
<path d="M3,9L7,9L12,4L12,20L7,15L3,15L3,9ZM21,12C21,16.283 18.008,19.868 14,20.777L14,18.71C16.891,17.85 19,15.171 19,12C19,8.829 16.891,6.151 14,5.29L14,3.223C18.008,4.133 21,7.717 21,12ZM17,12C17,14.05 15.766,15.812 14,16.584L14,7.416C15.766,8.188 17,9.95 17,12Z" style="fill-rule:nonzero;"/>
</g>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 907 B

View File

@ -59,6 +59,7 @@ public:
SearchType,
LastModified,
IsNew,
ContainsAudio,
};
Q_ENUM(ScreenPlayItem)

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -154,6 +154,8 @@ QVariant InstalledListModel::data(const QModelIndex& index, int role) const
return m_screenPlayFiles.at(row).tags;
case static_cast<int>(ScreenPlayItem::IsNew):
return m_screenPlayFiles.at(row).isNew;
case static_cast<int>(ScreenPlayItem::ContainsAudio):
return m_screenPlayFiles.at(row).containsAudio;
case static_cast<int>(ScreenPlayItem::LastModified):
return m_screenPlayFiles.at(row).lastModified;
case static_cast<int>(ScreenPlayItem::SearchType):
@ -181,6 +183,7 @@ QHash<int, QByteArray> InstalledListModel::roleNames() const
{ static_cast<int>(ScreenPlayItem::Tags), "m_tags" },
{ static_cast<int>(ScreenPlayItem::SearchType), "m_searchType" },
{ static_cast<int>(ScreenPlayItem::IsNew), "m_isNew" },
{ static_cast<int>(ScreenPlayItem::ContainsAudio), "m_containsAudio" },
{ static_cast<int>(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;
}

View File

@ -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;
};
}

View File

@ -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()

View File

@ -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
}
}

View File

@ -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 {

View File

@ -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);
}