1
0
mirror of https://gitlab.com/kelteseth/ScreenPlay.git synced 2024-11-22 18:52:30 +01:00

Add mute and play all functionality

This commit is contained in:
kelteseth 2017-11-21 10:13:36 +01:00
parent e50b94e63e
commit 0c8a8f5f0a
3 changed files with 62 additions and 5 deletions

View File

@ -106,13 +106,12 @@ void Settings::setWallpaper(int monitorIndex, QUrl absoluteStoragePath)
if (!m_ilm->getProjectByAbsoluteStoragePath(&absoluteStoragePath, &project)) {
return;
}
for(int i = 0; i < m_wallpapers.length();++i){
if(m_wallpapers.at(i).data()->monitor().m_id == monitor.m_id){
for (int i = 0; i < m_wallpapers.length(); ++i) {
if (m_wallpapers.at(i).data()->monitor().m_id == monitor.m_id) {
m_wallpapers.removeAt(i);
}
}
m_wallpapers.append(QSharedPointer<Wallpaper>(new Wallpaper(project, monitor)));
}
void Settings::loadActiveProfiles()
@ -154,6 +153,42 @@ void Settings::removeAll()
m_wallpapers.clear();
}
void Settings::setMuteAll(bool isMuted)
{
if (isMuted) {
for (int i = 0; i < m_wallpapers.size(); ++i) {
m_wallpapers.at(i).data()->setVolume(0.0f);
}
} else {
for (int i = 0; i < m_wallpapers.size(); ++i) {
m_wallpapers.at(i).data()->setVolume(1.0f);
}
}
}
void Settings::setPlayAll(bool isPlaying)
{
if (isPlaying) {
for (int i = 0; i < m_wallpapers.size(); ++i) {
m_wallpapers.at(i).data()->setIsPlaying(true);
}
} else {
for (int i = 0; i < m_wallpapers.size(); ++i) {
m_wallpapers.at(i).data()->setIsPlaying(false);
}
}
}
QUrl Settings::getPreviewImageByMonitorID(QString id)
{
// for (int i = 0; i < m_mlm->m_monitorList.size(); ++i) {
// if(m_mlm->m_monitorList.at(i).m_id == id){
// //return m_mlm->m_monitorList.at(i).m_
// }
// }
return QUrl();
}
void Settings::createNewWallpaper(int monitorListPosition, Profile profile, ProjectFile projectFile)
{
}

View File

@ -44,6 +44,10 @@ public:
void loadActiveProfiles();
Q_INVOKABLE void removeAll();
Q_INVOKABLE void setMuteAll(bool isMuted);
Q_INVOKABLE void setPlayAll(bool isPlaying);
Q_INVOKABLE QUrl getPreviewImageByMonitorID(QString id);
enum LocalCopyResult {
NoError,
@ -156,8 +160,6 @@ public slots:
Q_INVOKABLE void setWallpaper(int monitorIndex, QUrl absoluteStoragePath);
void setLocalStoragePath(QUrl localStoragePath)
{
if (m_localStoragePath == localStoragePath)

View File

@ -22,6 +22,7 @@ public:
~Wallpaper();
Q_PROPERTY(QString absoluteFilePath READ absoluteFilePath WRITE setAbsoluteFilePath NOTIFY absoluteFilePathChanged)
Q_PROPERTY(bool isPlaying READ isPlaying WRITE setIsPlaying NOTIFY isPlayingChanged)
Q_PROPERTY(float volume READ volume WRITE setVolume NOTIFY volumeChanged)
@ -39,6 +40,11 @@ public:
void setMonitor(const Monitor &monitor);
float volume() const
{
return m_volume;
}
public slots:
void setAbsoluteFilePath(QString absoluteFilePath)
{
@ -60,11 +66,23 @@ public slots:
void setVisible(bool visible);
void setVolume(float volume)
{
qWarning("Floating point comparison needs context sanity check");
if (qFuzzyCompare(m_volume, volume))
return;
m_volume = volume;
emit volumeChanged(m_volume);
}
signals:
void absoluteFilePathChanged(QString absoluteFilePath);
void isPlayingChanged(bool isPlaying);
void volumeChanged(float volume);
private:
HWND m_hwnd;
HWND m_worker_hwnd;
@ -75,7 +93,9 @@ private:
ProjectFile m_project;
Monitor m_monitor;
QString m_absoluteFilePath;
bool m_isPlaying;
float m_volume;
};
#endif // WALLPAPER_H