1
0
mirror of https://gitlab.com/kelteseth/ScreenPlay.git synced 2024-11-07 03:22:33 +01:00

Add can fade property

This commit is contained in:
Elias 2019-08-11 19:48:07 +02:00
parent da63c09920
commit 7c2a6b8e1f
3 changed files with 33 additions and 6 deletions

View File

@ -13,7 +13,7 @@ Rectangle {
}
}
property bool canFadeIn: true
property bool canFadeByWallpaperFillMode: true
Component.onCompleted: {
@ -48,7 +48,7 @@ Rectangle {
function fadeIn() {
window.setVisible(true)
if (canFadeIn) {
if (canFadeByWallpaperFillMode && window.canFade) {
animFadeIn.start()
} else {
imgCover.opacity = 0
@ -177,7 +177,7 @@ Rectangle {
}
break
case 22:
canFadeIn = false
canFadeByWallpaperFillMode = false
break
}
}
@ -199,7 +199,12 @@ Rectangle {
onQmlExit: {
webView.runJavaScript(
"var videoPlayer = document.getElementById('videoPlayer'); videoPlayer.volume = 0;")
animFadeOut.start()
if (canFadeByWallpaperFillMode && window.canFade) {
animFadeOut.start()
} else {
window.terminate()
}
}
onQmlSceneValueReceived: {

View File

@ -20,12 +20,16 @@ public:
Q_PROPERTY(QString appID READ appID WRITE setAppID NOTIFY appIDChanged)
Q_PROPERTY(QString fullContentPath READ fullContentPath WRITE setFullContentPath NOTIFY fullContentPathChanged)
Q_PROPERTY(bool loops READ loops WRITE setLoops NOTIFY loopsChanged)
Q_PROPERTY(bool isPlaying READ isPlaying WRITE setIsPlaying NOTIFY isPlayingChanged)
Q_PROPERTY(float volume READ volume WRITE setVolume NOTIFY volumeChanged)
Q_PROPERTY(bool muted READ muted WRITE setMuted NOTIFY mutedChanged)
Q_PROPERTY(bool canFade READ canFade WRITE setCanFade NOTIFY canFadeChanged)
Q_PROPERTY(float volume READ volume WRITE setVolume NOTIFY volumeChanged)
Q_PROPERTY(float playbackRate READ playbackRate WRITE setPlaybackRate NOTIFY playbackRateChanged)
Q_PROPERTY(float currentTime READ currentTime WRITE setCurrentTime NOTIFY currentTimeChanged)
Q_PROPERTY(WallpaperType type READ type WRITE setType NOTIFY typeChanged)
Q_PROPERTY(QString OSVersion READ OSVersion WRITE setOSVersion NOTIFY OSVersionChanged)
@ -91,6 +95,11 @@ public:
return m_currentTime;
}
bool canFade() const
{
return m_canFade;
}
signals:
void loopsChanged(bool loops);
void volumeChanged(float volume);
@ -105,6 +114,8 @@ signals:
void mutedChanged(bool muted);
void currentTimeChanged(float currentTime);
void canFadeChanged(bool canFade);
public slots:
virtual void destroyThis() {}
virtual void setVisible(bool show) { Q_UNUSED(show) }
@ -205,18 +216,28 @@ public slots:
emit currentTimeChanged(m_currentTime);
}
void setCanFade(bool canFade)
{
if (m_canFade == canFade)
return;
m_canFade = canFade;
emit canFadeChanged(m_canFade);
}
private:
bool m_loops { true };
bool m_isPlaying { true };
bool m_muted { false };
bool m_canFade { false };
float m_volume { 1.0f };
float m_playbackRate { 1.0f };
float m_currentTime { 0.0f };
QString m_fullContentPath;
QString m_appID;
WallpaperType m_type = BaseWindow::WallpaperType::Qml;
QString m_OSVersion;
float m_currentTime;
};

View File

@ -97,6 +97,7 @@ WinWindow::WinWindow(const QVector<int> &activeScreensList, QString projectPath,
qDebug() << "setupWallpaperForAllScreens()";
} else if (activeScreensList.length() == 1) {
setupWallpaperForOneScreen(activeScreensList.at(0));
setCanFade(true);
qDebug() << "setupWallpaperForOneScreen()";
} else if (activeScreensList.length() == 1) {
setupWallpaperForMultipleScreens(activeScreensList);