mirror of
https://gitlab.linphone.org/BC/public/linphone-desktop.git
synced 2026-01-17 11:28:07 +00:00
feat(DesktopTools): add skeletions for MacOs and GNU/Linux
This commit is contained in:
parent
5593b36b81
commit
efa3e10776
9 changed files with 273 additions and 48 deletions
|
|
@ -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>
|
||||
|
||||
#ifdef Q_OS_LINUX
|
||||
#include "DesktopToolsLinux.hpp"
|
||||
#elif defined(Q_OS_WIN)
|
||||
#include "DesktopToolsWindows.hpp"
|
||||
#else
|
||||
#include "DesktopToolsMacOs.hpp"
|
||||
#endif // ifdef Q_OS_LINUX
|
||||
|
||||
// =============================================================================
|
||||
|
||||
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_
|
||||
|
|
|
|||
43
src/components/other/desktop-tools/DesktopToolsLinux.cpp
Normal file
43
src/components/other/desktop-tools/DesktopToolsLinux.cpp
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
/*
|
||||
* 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);
|
||||
}
|
||||
49
src/components/other/desktop-tools/DesktopToolsLinux.hpp
Normal file
49
src/components/other/desktop-tools/DesktopToolsLinux.hpp
Normal file
|
|
@ -0,0 +1,49 @@
|
|||
/*
|
||||
* 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_
|
||||
43
src/components/other/desktop-tools/DesktopToolsMacOs.cpp
Normal file
43
src/components/other/desktop-tools/DesktopToolsMacOs.cpp
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
/*
|
||||
* 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);
|
||||
}
|
||||
49
src/components/other/desktop-tools/DesktopToolsMacOs.hpp
Normal file
49
src/components/other/desktop-tools/DesktopToolsMacOs.hpp
Normal file
|
|
@ -0,0 +1,49 @@
|
|||
/*
|
||||
* 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_
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* 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
|
||||
49
src/components/other/desktop-tools/DesktopToolsWindows.hpp
Normal file
49
src/components/other/desktop-tools/DesktopToolsWindows.hpp
Normal file
|
|
@ -0,0 +1,49 @@
|
|||
/*
|
||||
* 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_
|
||||
|
|
@ -1 +1 @@
|
|||
Subproject commit 64cb3ebcf69a0d0dfea196cfa14b3627c9112d9b
|
||||
Subproject commit bb8c1866bb8bdb792b7a4483ad90456781f3ad15
|
||||
Loading…
Add table
Reference in a new issue