mirror of
https://gitlab.linphone.org/BC/public/linphone-desktop.git
synced 2026-01-17 11:28:07 +00:00
Add systray notification options:
- '[ui] systray_notification_blink' : option to activate/deactivate the blinking systray on unread notifications. - '[ui] systray_notification_global' : option to display notification number from all accounts or only selected. - '[ui] systray_notification_filtered' : option to filtering the number (not count if chat room is muted).
This commit is contained in:
parent
85c7b8c15a
commit
019be99e62
6 changed files with 73 additions and 16 deletions
|
|
@ -9,7 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||
### Added
|
||||
- Screen Sharing
|
||||
|
||||
## 5.2.2 - 2024-03-08
|
||||
## 5.2.2 - 2024-03-11
|
||||
|
||||
### Fixed
|
||||
- Day offset in start date when scheduling a conference.
|
||||
|
|
|
|||
|
|
@ -22,33 +22,69 @@
|
|||
|
||||
#include "components/call/CallModel.hpp"
|
||||
#include "components/core/CoreManager.hpp"
|
||||
#include "components/settings/AccountSettingsModel.hpp"
|
||||
#include "components/settings/SettingsModel.hpp"
|
||||
#include "components/timeline/TimelineListModel.hpp"
|
||||
|
||||
#include "AbstractEventCountNotifier.hpp"
|
||||
#include "components/timeline/TimelineModel.hpp"
|
||||
|
||||
// =============================================================================
|
||||
|
||||
using namespace std;
|
||||
|
||||
AbstractEventCountNotifier::AbstractEventCountNotifier (QObject *parent) : QObject(parent) {
|
||||
CoreManager *coreManager = CoreManager::getInstance();
|
||||
connect(coreManager, &CoreManager::eventCountChanged, this, &AbstractEventCountNotifier::eventCountChanged);
|
||||
connect(this, &AbstractEventCountNotifier::eventCountChanged, this, &AbstractEventCountNotifier::internalNotifyEventCount);
|
||||
AbstractEventCountNotifier::AbstractEventCountNotifier(QObject *parent)
|
||||
: QObject(parent)
|
||||
{
|
||||
CoreManager *coreManager = CoreManager::getInstance();
|
||||
connect(coreManager,
|
||||
&CoreManager::eventCountChanged,
|
||||
this,
|
||||
&AbstractEventCountNotifier::eventCountChanged);
|
||||
connect(coreManager->getAccountSettingsModel(),
|
||||
&AccountSettingsModel::defaultAccountChanged,
|
||||
this,
|
||||
&AbstractEventCountNotifier::internalNotifyEventCount);
|
||||
connect(this,
|
||||
&AbstractEventCountNotifier::eventCountChanged,
|
||||
this,
|
||||
&AbstractEventCountNotifier::internalNotifyEventCount);
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
int AbstractEventCountNotifier::getEventCount () const {
|
||||
int AbstractEventCountNotifier::getEventCount() const
|
||||
{
|
||||
auto coreManager = CoreManager::getInstance();
|
||||
int count = coreManager->getCore()->getMissedCallsCount();
|
||||
if( coreManager->getSettingsModel()->getStandardChatEnabled() || coreManager->getSettingsModel()->getSecureChatEnabled())
|
||||
count += coreManager->getCore()->getUnreadChatMessageCount();
|
||||
if (coreManager->getSettingsModel()->getStandardChatEnabled()
|
||||
|| coreManager->getSettingsModel()->getSecureChatEnabled())
|
||||
count += coreManager->getCore()->getUnreadChatMessageCountFromActiveLocals();
|
||||
return count;
|
||||
}
|
||||
|
||||
void AbstractEventCountNotifier::internalNotifyEventCount () {
|
||||
int n = getEventCount();
|
||||
qInfo() << QStringLiteral("Notify event count: %1.").arg(n);
|
||||
n = n > 99 ? 99 : n;
|
||||
notifyEventCount(n);
|
||||
}
|
||||
int AbstractEventCountNotifier::getCurrentEventCount() const
|
||||
{
|
||||
auto coreManager = CoreManager::getInstance();
|
||||
int count = coreManager->getCore()->getMissedCallsCount();
|
||||
auto timelines = coreManager->getTimelineListModel()->getSharedList<TimelineModel>();
|
||||
bool filtered = CoreManager::getInstance()->getSettingsModel()->isSystrayNotificationFiltered();
|
||||
bool global = CoreManager::getInstance()->getSettingsModel()->isSystrayNotificationGlobal();
|
||||
if( global && !filtered) return getEventCount();
|
||||
for (const auto &timeline : timelines) {
|
||||
auto chatRoom = timeline->getChatRoomModel();
|
||||
if (!coreManager->getCore()->getDefaultAccount()
|
||||
|| ((global || chatRoom->isCurrentAccount()) && (!filtered || chatRoom->isNotificationsEnabled())))
|
||||
count += chatRoom->getUnreadMessagesCount();
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
void AbstractEventCountNotifier::internalNotifyEventCount()
|
||||
{
|
||||
int n = getCurrentEventCount();
|
||||
|
||||
qInfo() << QStringLiteral("Notify event count: %1.").arg(n);
|
||||
n = n > 99 ? 99 : n;
|
||||
notifyEventCount(n);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -45,7 +45,8 @@ public:
|
|||
|
||||
int getUnreadMessageCount () const;
|
||||
int getMissedCallCount () const;
|
||||
int getEventCount () const;
|
||||
int getEventCount () const;// global
|
||||
int getCurrentEventCount () const;// Current account
|
||||
signals:
|
||||
void eventCountChanged ();
|
||||
|
||||
|
|
|
|||
|
|
@ -28,7 +28,9 @@
|
|||
#include "app/App.hpp"
|
||||
#include "utils/Utils.hpp"
|
||||
#include "utils/Constants.hpp"
|
||||
#include "components/core/CoreManager.hpp"
|
||||
#include "components/other/colors/ColorListModel.hpp"
|
||||
#include "components/settings/SettingsModel.hpp"
|
||||
|
||||
#include "EventCountNotifierSystemTrayIcon.hpp"
|
||||
|
||||
|
|
@ -102,7 +104,9 @@ void EventCountNotifier::notifyEventCount (int n) {
|
|||
|
||||
// Change counter.
|
||||
mBlinkTimer->stop();
|
||||
mBlinkTimer->start();
|
||||
auto coreManager = CoreManager::getInstance();
|
||||
if(!coreManager->isInitialized() || coreManager->getSettingsModel()->isSystrayNotificationBlinkEnabled())
|
||||
mBlinkTimer->start();
|
||||
mDisplayCounter = true;
|
||||
update();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1067,6 +1067,18 @@ int SettingsModel::getNotificationOrigin() const {
|
|||
);
|
||||
}
|
||||
|
||||
bool SettingsModel::isSystrayNotificationBlinkEnabled() const {
|
||||
return !!mConfig->getInt(UiSection, "systray_notification_blink", 1);
|
||||
}
|
||||
|
||||
bool SettingsModel::isSystrayNotificationGlobal() const {
|
||||
return !!mConfig->getInt(UiSection, "systray_notification_global", 1);
|
||||
}
|
||||
|
||||
bool SettingsModel::isSystrayNotificationFiltered() const {
|
||||
return !!mConfig->getInt(UiSection, "systray_notification_filtered", 0);
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
QString SettingsModel::getFileTransferUrl() const {
|
||||
|
|
|
|||
|
|
@ -533,6 +533,10 @@ public:
|
|||
|
||||
int getNotificationOrigin() const;
|
||||
|
||||
bool isSystrayNotificationBlinkEnabled() const;
|
||||
bool isSystrayNotificationGlobal() const;
|
||||
bool isSystrayNotificationFiltered() const;
|
||||
|
||||
QString getFileTransferUrl() const;
|
||||
void setFileTransferUrl(const QString &url);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue