Commit 5593b36b authored by Ronan's avatar Ronan

feat(Incall): disable screen saver on fullscreen video call (Windows)

parent bd6072b2
......@@ -147,6 +147,7 @@ set(SOURCES
src/components/notifier/Notifier.cpp
src/components/other/clipboard/Clipboard.cpp
src/components/other/colors/Colors.cpp
src/components/other/desktop-tools/DesktopTools.cpp
src/components/other/text-to-speech/TextToSpeech.cpp
src/components/other/units/Units.cpp
src/components/presence/OwnPresenceModel.cpp
......@@ -205,6 +206,7 @@ set(HEADERS
src/components/notifier/Notifier.hpp
src/components/other/clipboard/Clipboard.hpp
src/components/other/colors/Colors.hpp
src/components/other/desktop-tools/DesktopTools.hpp
src/components/other/text-to-speech/TextToSpeech.hpp
src/components/other/units/Units.hpp
src/components/presence/OwnPresenceModel.hpp
......
......@@ -424,6 +424,7 @@ void App::registerToolTypes () {
qInfo() << QStringLiteral("Registering tool types...");
registerToolType<Clipboard>("Clipboard");
registerToolType<DesktopTools>("DesktopTools");
registerToolType<TextToSpeech>("TextToSpeech");
registerToolType<Units>("Units");
}
......
......@@ -56,6 +56,7 @@
#include "other/colors/Colors.hpp"
#include "other/clipboard/Clipboard.hpp"
#include "other/desktop-tools/DesktopTools.hpp"
#include "other/text-to-speech/TextToSpeech.hpp"
#include "other/units/Units.hpp"
......
/*
* DesktopTools.cpp
* Copyright (C) 2017-2018 Belledonne Communications, Grenoble, France
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* Created on: June 21, 2018
* Author: Ronan Abhamon
*/
#include <QDebug>
#include <QtGlobal>
#ifdef Q_OS_WIN
#include <Windows.h>
#endif // ifdef Q_OS_WIN
#include "DesktopTools.hpp"
// =============================================================================
DesktopTools::DesktopTools (QObject *parent) : QObject(parent) {}
DesktopTools::~DesktopTools () {
setScreenSaverStatus(true);
}
bool DesktopTools::getScreenSaverStatus () const {
return mScreenSaverStatus;
}
#ifdef Q_OS_WIN
void DesktopTools::setScreenSaverStatus (bool status) {
if (status == mScreenSaverStatus)
return;
if (!status) {
qInfo() << "Disable screen saver.";
SetThreadExecutionState(ES_CONTINUOUS | ES_DISPLAY_REQUIRED);
} else {
qInfo() << "Enable screen saver.";
SetThreadExecutionState(ES_CONTINUOUS);
}
emit screenSaverStatusChanged(status);
}
#else
void DesktopTools::setScreenSaverStatus (bool) {
emit screenSaverStatusChanged(true);
}
#endif // ifdef Q_OS_WIN
/*
* DesktopTools.hpp
* Copyright (C) 2017-2018 Belledonne Communications, Grenoble, France
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* Created on: June 21, 2018
* Author: Ronan Abhamon
*/
#ifndef DESKTOP_TOOLS_H_
#define DESKTOP_TOOLS_H_
#include <QObject>
// =============================================================================
class DesktopTools : public QObject {
Q_OBJECT;
Q_PROPERTY(bool screenSaverStatus READ getScreenSaverStatus WRITE setScreenSaverStatus NOTIFY screenSaverStatusChanged);
public:
DesktopTools (QObject *parent = Q_NULLPTR);
~DesktopTools ();
bool getScreenSaverStatus () const;
void setScreenSaverStatus (bool status);
signals:
void screenSaverStatusChanged (bool status);
private:
bool mScreenSaverStatus = true;
};
#endif // DESKTOP_TOOLS_H_
......@@ -2,6 +2,7 @@
// `Incall.qml` Logic.
// =============================================================================
.import DesktopTools 1.0 as DesktopTools
.import Linphone 1.0 as Linphone
.import 'qrc:/ui/scripts/Utils/utils.js' as Utils
......@@ -115,6 +116,7 @@ function showFullscreen () {
return
}
DesktopTools.DesktopTools.screenSaverStatus = false
incall._fullscreen = Utils.openWindow(Qt.resolvedUrl('IncallFullscreenWindow.qml'), window, {
properties: {
caller: incall
......
......@@ -4,6 +4,7 @@ import QtQuick.Window 2.2
import Common 1.0
import Common.Styles 1.0
import DesktopTools 1.0
import Linphone 1.0
import Utils 1.0
......@@ -25,6 +26,8 @@ Window {
// ---------------------------------------------------------------------------
function exit (cb) {
DesktopTools.screenSaverStatus = true
// `exit` is called by `Incall.qml`.
// The `window` id can be null if the window was closed in this view.
if (!window) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment