Commit efa3e107 authored by Ronan's avatar Ronan

feat(DesktopTools): add skeletions for MacOs and GNU/Linux

parent 5593b36b
Pipeline #99 failed with stage
in 0 seconds
......@@ -147,7 +147,6 @@ 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
......@@ -228,11 +227,32 @@ set(HEADERS
set(MAIN_FILE src/app/main.cpp)
if (APPLE)
list(APPEND SOURCES src/components/core/messages-count-notifier/MessagesCountNotifierMacOs.m)
list(APPEND HEADERS src/components/core/messages-count-notifier/MessagesCountNotifierMacOs.hpp)
list(APPEND SOURCES
src/components/core/messages-count-notifier/MessagesCountNotifierMacOs.m
src/components/other/desktop-tools/DesktopToolsMacOs.cpp
)
list(APPEND HEADERS
src/components/core/messages-count-notifier/MessagesCountNotifierMacOs.hpp
src/components/other/desktop-tools/DesktopToolsMacOs.hpp
)
elseif (WIN32)
list(APPEND SOURCES
src/components/core/messages-count-notifier/MessagesCountNotifierSystemTrayIcon.cpp
src/components/other/desktop-tools/DesktopToolsWindows.cpp
)
list(APPEND HEADERS
src/components/core/messages-count-notifier/MessagesCountNotifierSystemTrayIcon.hpp
src/components/other/desktop-tools/DesktopToolsWindows.hpp
)
else ()
list(APPEND SOURCES src/components/core/messages-count-notifier/MessagesCountNotifierSystemTrayIcon.cpp)
list(APPEND HEADERS src/components/core/messages-count-notifier/MessagesCountNotifierSystemTrayIcon.hpp)
list(APPEND SOURCES
src/components/core/messages-count-notifier/MessagesCountNotifierSystemTrayIcon.cpp
src/components/other/desktop-tools/DesktopToolsLinux.cpp
)
list(APPEND HEADERS
src/components/core/messages-count-notifier/MessagesCountNotifierSystemTrayIcon.hpp
src/components/other/desktop-tools/DesktopToolsLinux.hpp
)
endif ()
if (ENABLE_DBUS)
......
......@@ -23,27 +23,16 @@
#ifndef DESKTOP_TOOLS_H_
#define DESKTOP_TOOLS_H_
#include <QObject>
#include <QtGlobal>
// =============================================================================
class DesktopTools : public QObject {
Q_OBJECT;
Q_PROPERTY(bool screenSaverStatus READ getScreenSaverStatus WRITE setScreenSaverStatus NOTIFY screenSaverStatusChanged);
public:
DesktopTools (QObject *parent = Q_NULLPTR);
~DesktopTools ();
#ifdef Q_OS_LINUX
#include "DesktopToolsLinux.hpp"
#elif defined(Q_OS_WIN)
#include "DesktopToolsWindows.hpp"
#else
#include "DesktopToolsMacOs.hpp"
#endif // ifdef Q_OS_LINUX
bool getScreenSaverStatus () const;
void setScreenSaverStatus (bool status);
signals:
void screenSaverStatusChanged (bool status);
private:
bool mScreenSaverStatus = true;
};
// =============================================================================
#endif // DESKTOP_TOOLS_H_
/*
* DesktopToolsLinux.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 "DesktopToolsLinux.hpp"
// =============================================================================
DesktopTools::DesktopTools (QObject *parent) : QObject(parent) {}
DesktopTools::~DesktopTools () {
setScreenSaverStatus(true);
}
bool DesktopTools::getScreenSaverStatus () const {
return mScreenSaverStatus;
}
void DesktopTools::setScreenSaverStatus (bool status) {
if (status == mScreenSaverStatus)
return;
// TODO: Deal with me.
emit screenSaverStatusChanged(status);
}
/*
* DesktopToolsLinux.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_LINUX_H_
#define DESKTOP_TOOLS_LINUX_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_LINUX_H_
/*
* DesktopToolsMacOs.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 "DesktopToolsMacOs.hpp"
// =============================================================================
DesktopTools::DesktopTools (QObject *parent) : QObject(parent) {}
DesktopTools::~DesktopTools () {
setScreenSaverStatus(true);
}
bool DesktopTools::getScreenSaverStatus () const {
return mScreenSaverStatus;
}
void DesktopTools::setScreenSaverStatus (bool status) {
if (status == mScreenSaverStatus)
return;
// TODO: Deal with me.
emit screenSaverStatusChanged(status);
}
/*
* DesktopToolsMacOs.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_MAC_OS_H_
#define DESKTOP_TOOLS_MAC_OS_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_MAC_OS_H_
/*
* DesktopTools.cpp
* DesktopToolsWindows.cpp
* Copyright (C) 2017-2018 Belledonne Communications, Grenoble, France
*
* This program is free software; you can redistribute it and/or
......@@ -20,14 +20,9 @@
* Author: Ronan Abhamon
*/
#include <QDebug>
#include <QtGlobal>
#include <Windows.h>
#ifdef Q_OS_WIN
#include <Windows.h>
#endif // ifdef Q_OS_WIN
#include "DesktopTools.hpp"
#include "DesktopToolsWindows.hpp"
// =============================================================================
......@@ -41,27 +36,15 @@ 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.";
if (!status)
SetThreadExecutionState(ES_CONTINUOUS | ES_DISPLAY_REQUIRED);
} else {
qInfo() << "Enable screen saver.";
else {
SetThreadExecutionState(ES_CONTINUOUS);
}
emit screenSaverStatusChanged(status);
}
#else
void DesktopTools::setScreenSaverStatus (bool) {
emit screenSaverStatusChanged(true);
}
#endif // ifdef Q_OS_WIN
/*
* DesktopToolsWindows.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_WINDOWS_H_
#define DESKTOP_TOOLS_WINDOWS_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_WINDOWS_H_
linphone @ bb8c1866
Subproject commit 64cb3ebcf69a0d0dfea196cfa14b3627c9112d9b
Subproject commit bb8c1866bb8bdb792b7a4483ad90456781f3ad15
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