maj copyright

This commit is contained in:
Gaelle Braud 2025-08-20 10:21:43 +02:00 committed by gaelle
parent d42af52ba1
commit 8566f830d1
37 changed files with 226 additions and 252 deletions

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2010-2020 Belledonne Communications SARL.
* Copyright (c) 2010-2024 Belledonne Communications SARL.
*
* This file is part of linphone-desktop
* (see https://www.linphone.org).

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2010-2020 Belledonne Communications SARL.
* Copyright (c) 2010-2024 Belledonne Communications SARL.
*
* This file is part of linphone-desktop
* (see https://www.linphone.org).

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2010-2020 Belledonne Communications SARL.
* Copyright (c) 2010-2024 Belledonne Communications SARL.
*
* This file is part of linphone-desktop
* (see https://www.linphone.org).
@ -57,8 +57,9 @@ void ParticipantInfoList::setChatCore(const QSharedPointer<ChatCore> &chatCore)
QStringList participantAddresses;
QList<QSharedPointer<ParticipantGui>> participantList;
auto participants = mChatCore->getParticipants();
resetData();
for(auto p: participants) add(p);
resetData();
for (auto p : participants)
add(p);
};
connect(mChatCore.get(), &ChatCore::participantsChanged, this, buildList);
buildList();

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2010-2020 Belledonne Communications SARL.
* Copyright (c) 2010-2024 Belledonne Communications SARL.
*
* This file is part of linphone-desktop
* (see https://www.linphone.org).

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2010-2020 Belledonne Communications SARL.
* Copyright (c) 2010-2024 Belledonne Communications SARL.
*
* This file is part of linphone-desktop
* (see https://www.linphone.org).

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2010-2020 Belledonne Communications SARL.
* Copyright (c) 2010-2024 Belledonne Communications SARL.
*
* This file is part of linphone-desktop
* (see https://www.linphone.org).

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2010-2020 Belledonne Communications SARL.
* Copyright (c) 2010-2024 Belledonne Communications SARL.
*
* This file is part of linphone-desktop
* (see https://www.linphone.org).

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2010-2020 Belledonne Communications SARL.
* Copyright (c) 2010-2024 Belledonne Communications SARL.
*
* This file is part of linphone-desktop
* (see https://www.linphone.org).

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2010-2020 Belledonne Communications SARL.
* Copyright (c) 2010-2024 Belledonne Communications SARL.
*
* This file is part of linphone-desktop
* (see https://www.linphone.org).

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2010-2020 Belledonne Communications SARL.
* Copyright (c) 2010-2024 Belledonne Communications SARL.
*
* This file is part of linphone-desktop
* (see https://www.linphone.org).

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2010-2020 Belledonne Communications SARL.
* Copyright (c) 2010-2024 Belledonne Communications SARL.
*
* This file is part of linphone-desktop
* (see https://www.linphone.org).
@ -25,46 +25,40 @@
// =============================================================================
DefaultTranslatorCore::DefaultTranslatorCore (QObject *parent) : QTranslator(parent) {
QDirIterator it(":", QDirIterator::Subdirectories);
while (it.hasNext()) {
QFileInfo info(it.next());
DefaultTranslatorCore::DefaultTranslatorCore(QObject *parent) : QTranslator(parent) {
QDirIterator it(":", QDirIterator::Subdirectories);
while (it.hasNext()) {
QFileInfo info(it.next());
if (info.suffix() == QLatin1String("qml")) {
QString dir = info.absoluteDir().absolutePath();
if (info.suffix() == QLatin1String("qml")) {
QString dir = info.absoluteDir().absolutePath();
// Ignore extra selectors.
// TODO: Remove 5.9 support in July 2019.
for (const auto &selector : { "+linux", "+mac", "+windows", "+custom", "+5.9" })
if (dir.contains(selector))
goto end;
// Ignore extra selectors.
// TODO: Remove 5.9 support in July 2019.
for (const auto &selector : {"+linux", "+mac", "+windows", "+custom", "+5.9"})
if (dir.contains(selector)) goto end;
// Ignore default imports.
if (dir.startsWith(":/QtQuick"))
continue;
// Ignore default imports.
if (dir.startsWith(":/QtQuick")) continue;
QString basename = info.baseName();
if (!mContexts.contains(basename))
mContexts << basename;
}
end:;
}
QString basename = info.baseName();
if (!mContexts.contains(basename)) mContexts << basename;
}
end:;
}
}
QString DefaultTranslatorCore::translate (
const char *context,
const char *sourceText,
const char *disambiguation,
int n
) const {
if (!context)
return QString("");
QString
DefaultTranslatorCore::translate(const char *context, const char *sourceText, const char *disambiguation, int n) const {
if (!context) return QString("");
QString translation = QTranslator::translate(context, sourceText, disambiguation, n);
QString translation = QTranslator::translate(context, sourceText, disambiguation, n);
if (translation.length() == 0 && mContexts.contains(context))
qDebug() << QStringLiteral("Unable to find a translation. (context=%1, label=%2, disambiguation=%3)")
.arg(context).arg(sourceText).arg(disambiguation);
if (translation.length() == 0 && mContexts.contains(context))
qDebug() << QStringLiteral("Unable to find a translation. (context=%1, label=%2, disambiguation=%3)")
.arg(context)
.arg(sourceText)
.arg(disambiguation);
return translation;
return translation;
}

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2010-2020 Belledonne Communications SARL.
* Copyright (c) 2010-2024 Belledonne Communications SARL.
*
* This file is part of linphone-desktop
* (see https://www.linphone.org).
@ -28,22 +28,20 @@
class DefaultTranslatorCore : public QTranslator {
public:
DefaultTranslatorCore (QObject *parent = Q_NULLPTR);
DefaultTranslatorCore(QObject *parent = Q_NULLPTR);
QString translate (
const char *context,
const char *sourceText,
const char *disambiguation = Q_NULLPTR,
int n = -1
) const override;
QString translate(const char *context,
const char *sourceText,
const char *disambiguation = Q_NULLPTR,
int n = -1) const override;
private:
QSet<QString> mContexts;
QSet<QString> mContexts;
};
// Workaround for bad Application Menu translation on Mac:
// Overwrite Qt source by our translations :
//static const char *application_menu_strings[] =
// static const char *application_menu_strings[] =
//{
// QT_TRANSLATE_NOOP("MAC_APPLICATION_MENU","About %1"),
// QT_TRANSLATE_NOOP("MAC_APPLICATION_MENU","Preferences…"),
@ -54,10 +52,11 @@ private:
// QT_TRANSLATE_NOOP("MAC_APPLICATION_MENU","Quit %1")
//};
//class MAC_APPLICATION_MENU : public QObject{
// class MAC_APPLICATION_MENU : public QObject{
// QString forcedTranslation(){
// return tr("About %1") + tr("Preferences…") + tr("Services") + tr("Hide %1") + tr("Hide Others") + tr("Show All") + tr("Quit %1");
// return tr("About %1") + tr("Preferences…") + tr("Services") + tr("Hide %1") + tr("Hide Others") + tr("Show All") +
//tr("Quit %1");
// }
//};
// };
#endif // DEFAULT_TRANSLATOR_CORE_H_

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2010-2020 Belledonne Communications SARL.
* Copyright (c) 2010-2024 Belledonne Communications SARL.
*
* This file is part of linphone-desktop
* (see https://www.linphone.org).
@ -18,62 +18,58 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "MediastreamerUtils.hpp"
#include <linphone/linphonecore.h>
#include <mediastreamer2/msvolume.h>
#include <mediastreamer2/mssndcard.h>
#include <mediastreamer2/msticker.h>
#include <mediastreamer2/msvolume.h>
#include <model/core/CoreModel.hpp>
#include "MediastreamerUtils.hpp"
#include <qlogging.h>
using namespace MediastreamerUtils;
SimpleCaptureGraph::SimpleCaptureGraph(const std::string &capture, const std::string &playback)
: captureCardId(capture), playbackCardId(playback)
{
: captureCardId(capture), playbackCardId(playback) {
LinphoneCore *ccore = CoreModel::getInstance()->getCore()->cPtr();
msFactory = linphone_core_get_ms_factory(ccore);
playbackCard = ms_snd_card_manager_get_card(ms_factory_get_snd_card_manager(msFactory), playbackCardId.c_str());
if (!playbackCard)
qWarning("Cannot get playback card from MSFactory with : %s", playbackCardId.c_str());
if (!playbackCard) qWarning("Cannot get playback card from MSFactory with : %s", playbackCardId.c_str());
captureCard = ms_snd_card_manager_get_card(ms_factory_get_snd_card_manager(msFactory), captureCardId.c_str());
if (!captureCard)
qWarning("Cannot get capture card from MSFactory with : %s", captureCardId.c_str());
if (!captureCard) qWarning("Cannot get capture card from MSFactory with : %s", captureCardId.c_str());
if(playbackCard && captureCard)// Assure to initialize when playback and capture are available
if (playbackCard && captureCard) // Assure to initialize when playback and capture are available
init();
}
SimpleCaptureGraph::~SimpleCaptureGraph()
{
SimpleCaptureGraph::~SimpleCaptureGraph() {
destroy();
}
static void device_notify_cb(void *user_data, MSFilter *f, unsigned int event, void *eventdata) {
if (event == MS_FILTER_OUTPUT_FMT_CHANGED) {
SimpleCaptureGraph * graph = (SimpleCaptureGraph *)user_data;
SimpleCaptureGraph *graph = (SimpleCaptureGraph *)user_data;
int captureRate, playbackRate, captureChannels, playbackChannels;
ms_filter_call_method(graph->audioCapture,MS_FILTER_GET_SAMPLE_RATE,&captureRate);
ms_filter_call_method(graph->audioSink,MS_FILTER_GET_SAMPLE_RATE,&playbackRate);
ms_filter_call_method(graph->audioCapture,MS_FILTER_GET_NCHANNELS,&captureChannels);
ms_filter_call_method(graph->audioSink,MS_FILTER_GET_NCHANNELS,&playbackChannels);
ms_filter_call_method(graph->audioCapture, MS_FILTER_GET_SAMPLE_RATE, &captureRate);
ms_filter_call_method(graph->audioSink, MS_FILTER_GET_SAMPLE_RATE, &playbackRate);
ms_filter_call_method(graph->audioCapture, MS_FILTER_GET_NCHANNELS, &captureChannels);
ms_filter_call_method(graph->audioSink, MS_FILTER_GET_NCHANNELS, &playbackChannels);
ms_filter_call_method(graph->resamplerFilter,MS_FILTER_SET_SAMPLE_RATE,&captureRate);
ms_filter_call_method(graph->resamplerFilter,MS_FILTER_SET_OUTPUT_SAMPLE_RATE,&playbackRate);
ms_filter_call_method(graph->resamplerFilter,MS_FILTER_SET_NCHANNELS,&captureChannels);
ms_filter_call_method(graph->resamplerFilter,MS_FILTER_SET_OUTPUT_NCHANNELS,&playbackChannels);
ms_filter_call_method(graph->resamplerFilter, MS_FILTER_SET_SAMPLE_RATE, &captureRate);
ms_filter_call_method(graph->resamplerFilter, MS_FILTER_SET_OUTPUT_SAMPLE_RATE, &playbackRate);
ms_filter_call_method(graph->resamplerFilter, MS_FILTER_SET_NCHANNELS, &captureChannels);
ms_filter_call_method(graph->resamplerFilter, MS_FILTER_SET_OUTPUT_NCHANNELS, &playbackChannels);
}
}
void SimpleCaptureGraph::init() {
if (!audioCapture) {
audioCapture = ms_snd_card_create_reader(captureCard);
ms_filter_add_notify_callback(audioCapture, device_notify_cb,this,FALSE);
ms_filter_add_notify_callback(audioCapture, device_notify_cb, this, FALSE);
}
if (!audioSink) {
audioSink = ms_snd_card_create_writer(playbackCard);
ms_filter_add_notify_callback(audioSink, device_notify_cb,this,FALSE);
ms_filter_add_notify_callback(audioSink, device_notify_cb, this, FALSE);
}
if (!captureVolumeFilter) {
captureVolumeFilter = ms_factory_create_filter(msFactory, MS_VOLUME_ID);
@ -81,42 +77,39 @@ void SimpleCaptureGraph::init() {
if (!playbackVolumeFilter) {
playbackVolumeFilter = ms_factory_create_filter(msFactory, MS_VOLUME_ID);
}
if(!resamplerFilter)
resamplerFilter = ms_factory_create_filter(msFactory, MS_RESAMPLE_ID);
if (!resamplerFilter) resamplerFilter = ms_factory_create_filter(msFactory, MS_RESAMPLE_ID);
int captureRate, playbackRate, captureChannels, playbackChannels;
ms_filter_call_method(audioCapture,MS_FILTER_GET_SAMPLE_RATE,&captureRate);
ms_filter_call_method(audioSink,MS_FILTER_GET_SAMPLE_RATE,&playbackRate);
ms_filter_call_method(audioCapture,MS_FILTER_GET_NCHANNELS,&captureChannels);
ms_filter_call_method(audioSink,MS_FILTER_GET_NCHANNELS,&playbackChannels);
ms_filter_call_method(audioCapture, MS_FILTER_GET_SAMPLE_RATE, &captureRate);
ms_filter_call_method(audioSink, MS_FILTER_GET_SAMPLE_RATE, &playbackRate);
ms_filter_call_method(audioCapture, MS_FILTER_GET_NCHANNELS, &captureChannels);
ms_filter_call_method(audioSink, MS_FILTER_GET_NCHANNELS, &playbackChannels);
ms_filter_call_method(resamplerFilter,MS_FILTER_SET_SAMPLE_RATE,&captureRate);
ms_filter_call_method(resamplerFilter,MS_FILTER_SET_OUTPUT_SAMPLE_RATE,&playbackRate);
ms_filter_call_method(resamplerFilter,MS_FILTER_SET_NCHANNELS,&captureChannels);
ms_filter_call_method(resamplerFilter,MS_FILTER_SET_OUTPUT_NCHANNELS,&playbackChannels);
ms_filter_call_method(resamplerFilter, MS_FILTER_SET_SAMPLE_RATE, &captureRate);
ms_filter_call_method(resamplerFilter, MS_FILTER_SET_OUTPUT_SAMPLE_RATE, &playbackRate);
ms_filter_call_method(resamplerFilter, MS_FILTER_SET_NCHANNELS, &captureChannels);
ms_filter_call_method(resamplerFilter, MS_FILTER_SET_OUTPUT_NCHANNELS, &playbackChannels);
ms_filter_link(audioCapture, 0, captureVolumeFilter, 0);
ms_filter_link(captureVolumeFilter, 0, resamplerFilter, 0);
ms_filter_link(resamplerFilter, 0, playbackVolumeFilter, 0);
ms_filter_link(playbackVolumeFilter, 0, audioSink, 0);
//Mute playback
// Mute playback
float muteGain = 0.0f;
ms_filter_call_method(playbackVolumeFilter, static_cast<unsigned int>(MS_VOLUME_SET_GAIN), &muteGain);
ticker = ms_ticker_new();
running = false;
}
void SimpleCaptureGraph::start() {
if (!running && audioCapture) {
running = true;
ms_ticker_attach(ticker, audioCapture);
}
}
void SimpleCaptureGraph::stop() {
if (running && audioCapture){
if (running && audioCapture) {
ms_ticker_detach(ticker, audioCapture);
running = false;
}
@ -127,26 +120,17 @@ void SimpleCaptureGraph::destroy() {
stop();
}
if (audioSink)
ms_filter_unlink(playbackVolumeFilter, 0, audioSink, 0);
if (captureVolumeFilter && resamplerFilter)
ms_filter_unlink(captureVolumeFilter, 0, resamplerFilter, 0);
if (resamplerFilter && playbackVolumeFilter)
ms_filter_unlink(resamplerFilter, 0, playbackVolumeFilter, 0);
if (audioCapture)
ms_filter_unlink(audioCapture, 0, captureVolumeFilter, 0);
if (playbackVolumeFilter)
ms_filter_destroy(playbackVolumeFilter);
if (captureVolumeFilter)
ms_filter_destroy(captureVolumeFilter);
if (resamplerFilter)
ms_filter_destroy(resamplerFilter);
if (audioSink)
ms_filter_destroy(audioSink);
if (audioCapture)
ms_filter_destroy(audioCapture);
if (audioSink) ms_filter_unlink(playbackVolumeFilter, 0, audioSink, 0);
if (captureVolumeFilter && resamplerFilter) ms_filter_unlink(captureVolumeFilter, 0, resamplerFilter, 0);
if (resamplerFilter && playbackVolumeFilter) ms_filter_unlink(resamplerFilter, 0, playbackVolumeFilter, 0);
if (audioCapture) ms_filter_unlink(audioCapture, 0, captureVolumeFilter, 0);
if (playbackVolumeFilter) ms_filter_destroy(playbackVolumeFilter);
if (captureVolumeFilter) ms_filter_destroy(captureVolumeFilter);
if (resamplerFilter) ms_filter_destroy(resamplerFilter);
if (audioSink) ms_filter_destroy(audioSink);
if (audioCapture) ms_filter_destroy(audioCapture);
if (ticker) {
ms_ticker_destroy(ticker);// Destroy ticker at the end to avoid conflicts between attached filters
ms_ticker_destroy(ticker); // Destroy ticker at the end to avoid conflicts between attached filters
}
ticker = nullptr;
playbackVolumeFilter = nullptr;

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2010-2020 Belledonne Communications SARL.
* Copyright (c) 2010-2024 Belledonne Communications SARL.
*
* This file is part of linphone-desktop
* (see https://www.linphone.org).
@ -36,64 +36,62 @@ struct _MSFactory;
namespace MediastreamerUtils {
inline float computeVu (float volume) {
constexpr float VuMin = -20.f;
constexpr float VuMax = 4.f;
inline float computeVu(float volume) {
constexpr float VuMin = -20.f;
constexpr float VuMax = 4.f;
if (volume < VuMin)
return 0.f;
if (volume > VuMax)
return 1.f;
return (volume - VuMin) / (VuMax - VuMin);
}
inline float dbToLinear(float volume) {
return static_cast<float>(pow(10.0, volume / 10.0));
}
float linearToDb(float volume);
//Simple mediastreamer audio capture graph
//Used to get current microphone volume in audio settings
class SimpleCaptureGraph {
public:
SimpleCaptureGraph(const std::string &captureCardId, const std::string &playbackCardId);
~SimpleCaptureGraph();
void start();
void stop();
float getCaptureVolume();
float getCaptureGain();
float getPlaybackGain();
void setCaptureGain(float volume);
void setPlaybackGain(float volume);
bool isRunning() const {
return running;
}
void init();
void destroy();
bool running = false;
std::string captureCardId;
std::string playbackCardId;
_MSFilter *audioSink = nullptr;
_MSFilter *audioCapture = nullptr;
_MSFilter *captureVolumeFilter = nullptr;
_MSFilter *playbackVolumeFilter = nullptr;
_MSFilter *resamplerFilter = nullptr;
_MSTicker *ticker = nullptr;
_MSSndCard *playbackCard = nullptr;
_MSSndCard *captureCard = nullptr;
_MSFactory *msFactory = nullptr;
};
if (volume < VuMin) return 0.f;
if (volume > VuMax) return 1.f;
return (volume - VuMin) / (VuMax - VuMin);
}
inline float dbToLinear(float volume) {
return static_cast<float>(pow(10.0, volume / 10.0));
}
float linearToDb(float volume);
// Simple mediastreamer audio capture graph
// Used to get current microphone volume in audio settings
class SimpleCaptureGraph {
public:
SimpleCaptureGraph(const std::string &captureCardId, const std::string &playbackCardId);
~SimpleCaptureGraph();
void start();
void stop();
float getCaptureVolume();
float getCaptureGain();
float getPlaybackGain();
void setCaptureGain(float volume);
void setPlaybackGain(float volume);
bool isRunning() const {
return running;
}
void init();
void destroy();
bool running = false;
std::string captureCardId;
std::string playbackCardId;
_MSFilter *audioSink = nullptr;
_MSFilter *audioCapture = nullptr;
_MSFilter *captureVolumeFilter = nullptr;
_MSFilter *playbackVolumeFilter = nullptr;
_MSFilter *resamplerFilter = nullptr;
_MSTicker *ticker = nullptr;
_MSSndCard *playbackCard = nullptr;
_MSSndCard *captureCard = nullptr;
_MSFactory *msFactory = nullptr;
};
} // namespace MediastreamerUtils
#endif // ifndef MEDIASTREAMER_UTILS_H_

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2010-2020 Belledonne Communications SARL.
* Copyright (c) 2010-2024 Belledonne Communications SARL.
*
* This file is part of linphone-desktop
* (see https://www.linphone.org).

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2010-2020 Belledonne Communications SARL.
* Copyright (c) 2010-2024 Belledonne Communications SARL.
*
* This file is part of linphone-desktop
* (see https://www.linphone.org).

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2010-2020 Belledonne Communications SARL.
* Copyright (c) 2010-2024 Belledonne Communications SARL.
*
* This file is part of linphone-desktop
* (see https://www.linphone.org).

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2010-2020 Belledonne Communications SARL.
* Copyright (c) 2010-2024 Belledonne Communications SARL.
*
* This file is part of linphone-desktop
* (see https://www.linphone.org).

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2010-2020 Belledonne Communications SARL.
* Copyright (c) 2010-2024 Belledonne Communications SARL.
*
* This file is part of linphone-desktop
* (see https://www.linphone.org).

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2010-2020 Belledonne Communications SARL.
* Copyright (c) 2010-2024 Belledonne Communications SARL.
*
* This file is part of linphone-desktop
* (see https://www.linphone.org).

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2010-2020 Belledonne Communications SARL.
* Copyright (c) 2010-2024 Belledonne Communications SARL.
*
* This file is part of linphone-desktop
* (see https://www.linphone.org).

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2010-2020 Belledonne Communications SARL.
* Copyright (c) 2010-2024 Belledonne Communications SARL.
*
* This file is part of linphone-desktop
* (see https://www.linphone.org).

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2010-2020 Belledonne Communications SARL.
* Copyright (c) 2010-2024 Belledonne Communications SARL.
*
* This file is part of linphone-desktop
* (see https://www.linphone.org).
@ -24,11 +24,11 @@
#include <QtGlobal>
#ifdef Q_OS_LINUX
#include "DesktopToolsLinux.hpp"
#include "DesktopToolsLinux.hpp"
#elif defined(Q_OS_WIN)
#include "DesktopToolsWindows.hpp"
#include "DesktopToolsWindows.hpp"
#else
#include "DesktopToolsMacOs.hpp"
#include "DesktopToolsMacOs.hpp"
#endif // ifdef Q_OS_LINUX
// =============================================================================

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2010-2020 Belledonne Communications SARL.
* Copyright (c) 2010-2024 Belledonne Communications SARL.
*
* This file is part of linphone-desktop
* (see https://www.linphone.org).

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2010-2020 Belledonne Communications SARL.
* Copyright (c) 2010-2024 Belledonne Communications SARL.
*
* This file is part of linphone-desktop
* (see https://www.linphone.org).

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2010-2020 Belledonne Communications SARL.
* Copyright (c) 2010-2024 Belledonne Communications SARL.
*
* This file is part of linphone-desktop
* (see https://www.linphone.org).
@ -22,22 +22,23 @@
// =============================================================================
extern "C" bool enableScreenSaverMacOs ();
extern "C" bool disableScreenSaverMacOs ();
extern "C" bool enableScreenSaverMacOs();
extern "C" bool disableScreenSaverMacOs();
DesktopTools::DesktopTools (QObject *parent) : QObject(parent) {}
DesktopTools::~DesktopTools () {
setScreenSaverStatus(true);
DesktopTools::DesktopTools(QObject *parent) : QObject(parent) {
}
bool DesktopTools::getScreenSaverStatus () const {
return mScreenSaverStatus;
DesktopTools::~DesktopTools() {
setScreenSaverStatus(true);
}
void DesktopTools::setScreenSaverStatus (bool status) {
if (status != mScreenSaverStatus && (status ? enableScreenSaverMacOs() : disableScreenSaverMacOs())) {
mScreenSaverStatus = status;
emit screenSaverStatusChanged(mScreenSaverStatus);
}
bool DesktopTools::getScreenSaverStatus() const {
return mScreenSaverStatus;
}
void DesktopTools::setScreenSaverStatus(bool status) {
if (status != mScreenSaverStatus && (status ? enableScreenSaverMacOs() : disableScreenSaverMacOs())) {
mScreenSaverStatus = status;
emit screenSaverStatusChanged(mScreenSaverStatus);
}
}

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2010-2020 Belledonne Communications SARL.
* Copyright (c) 2010-2024 Belledonne Communications SARL.
*
* This file is part of linphone-desktop
* (see https://www.linphone.org).

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2010-2020 Belledonne Communications SARL.
* Copyright (c) 2010-2024 Belledonne Communications SARL.
*
* This file is part of linphone-desktop
* (see https://www.linphone.org).

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2010-2020 Belledonne Communications SARL.
* Copyright (c) 2010-2024 Belledonne Communications SARL.
*
* This file is part of linphone-desktop
* (see https://www.linphone.org).

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2010-2020 Belledonne Communications SARL.
* Copyright (c) 2010-2024 Belledonne Communications SARL.
*
* This file is part of linphone-desktop
* (see https://www.linphone.org).

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2010-2020 Belledonne Communications SARL.
* Copyright (c) 2010-2024 Belledonne Communications SARL.
*
* This file is part of linphone-desktop
* (see https://www.linphone.org).
@ -28,23 +28,23 @@
class QDBusPendingCallWatcher;
class ScreenSaverDBus : public QObject {
Q_OBJECT;
Q_OBJECT;
public:
ScreenSaverDBus (QObject *parent = Q_NULLPTR);
~ScreenSaverDBus ();
ScreenSaverDBus(QObject *parent = Q_NULLPTR);
~ScreenSaverDBus();
bool getScreenSaverStatus () const;
void setScreenSaverStatus (bool status);
bool getScreenSaverStatus() const;
void setScreenSaverStatus(bool status);
signals:
void screenSaverStatusChanged (bool status);
void screenSaverStatusChanged(bool status);
private:
bool mScreenSaverStatus = true;
bool mScreenSaverStatus = true;
QDBusInterface mBus;
uint32_t mToken;
QDBusInterface mBus;
uint32_t mToken;
};
#endif // SCREEN_SAVER_DBUS_H_

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2010-2020 Belledonne Communications SARL.
* Copyright (c) 2010-2024 Belledonne Communications SARL.
*
* This file is part of linphone-desktop
* (see https://www.linphone.org).
@ -25,32 +25,29 @@
// =============================================================================
namespace {
constexpr char Program[] = "xdg-screensaver";
const QStringList Arguments{"reset"};
constexpr char Program[] = "xdg-screensaver";
const QStringList Arguments{"reset"};
constexpr int Interval = 30000;
constexpr int Interval = 30000;
} // namespace
ScreenSaverXdg::ScreenSaverXdg(QObject *parent) : QObject(parent) {
mTimer.setInterval(Interval);
QObject::connect(&mTimer, &QTimer::timeout, []() {
// Legacy for systems without DBus screensaver.
QProcess::startDetached(Program, Arguments);
});
}
ScreenSaverXdg::ScreenSaverXdg (QObject *parent) : QObject(parent) {
mTimer.setInterval(Interval);
QObject::connect(&mTimer, &QTimer::timeout, []() {
// Legacy for systems without DBus screensaver.
QProcess::startDetached(Program, Arguments);
});
bool ScreenSaverXdg::getScreenSaverStatus() const {
return !mTimer.isActive();
}
bool ScreenSaverXdg::getScreenSaverStatus () const {
return !mTimer.isActive();
}
void ScreenSaverXdg::setScreenSaverStatus (bool status) {
if (status == !mTimer.isActive())
return;
if (status)
mTimer.stop();
else
mTimer.start();
emit screenSaverStatusChanged(status);
void ScreenSaverXdg::setScreenSaverStatus(bool status) {
if (status == !mTimer.isActive()) return;
if (status) mTimer.stop();
else mTimer.start();
emit screenSaverStatusChanged(status);
}

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2010-2020 Belledonne Communications SARL.
* Copyright (c) 2010-2024 Belledonne Communications SARL.
*
* This file is part of linphone-desktop
* (see https://www.linphone.org).
@ -26,19 +26,19 @@
// =============================================================================
class ScreenSaverXdg : public QObject {
Q_OBJECT;
Q_OBJECT;
public:
ScreenSaverXdg (QObject *parent = Q_NULLPTR);
ScreenSaverXdg(QObject *parent = Q_NULLPTR);
bool getScreenSaverStatus () const;
void setScreenSaverStatus (bool status);
bool getScreenSaverStatus() const;
void setScreenSaverStatus(bool status);
signals:
void screenSaverStatusChanged (bool status);
void screenSaverStatusChanged(bool status);
private:
QTimer mTimer;
QTimer mTimer;
};
#endif // SCREEN_SAVER_XDG_H_

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2010-2020 Belledonne Communications SARL.
* Copyright (c) 2010-2024 Belledonne Communications SARL.
*
* This file is part of linphone-desktop
* (see https://www.linphone.org).

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2010-2020 Belledonne Communications SARL.
* Copyright (c) 2010-2024 Belledonne Communications SARL.
*
* This file is part of linphone-desktop
* (see https://www.linphone.org).

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2010-2020 Belledonne Communications SARL.
* Copyright (c) 2010-2024 Belledonne Communications SARL.
*
* This file is part of linphone-desktop
* (see https://www.linphone.org).

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2010-2020 Belledonne Communications SARL.
* Copyright (c) 2010-2024 Belledonne Communications SARL.
*
* This file is part of linphone-desktop
* (see https://www.linphone.org).