Commit 4a43f00e authored by Simon Morlat's avatar Simon Morlat

Merge branch 'feature/update_sdk'

parents 95245907 d8f1eea6
Pipeline #6797 passed with stages
in 40 minutes and 28 seconds
......@@ -9,8 +9,9 @@
- ccache -s
- export Qt5_DIR=/usr/local/opt/qt/lib/cmake
- export PATH=$PATH:/usr/local/opt/qt/bin
- python prepare.py -G "$CMAKE_GENERATOR" -cc --package $DEFAULT_MACOS_CMAKE_OPTIONS $CMAKE_OPTIONS
- python prepare.py -G "$CMAKE_GENERATOR" -cc --package -DLINPHONE_BUILDER_SIGNING_IDENTITY="$MACOS_SIGNING_IDENTITY" $DEFAULT_MACOS_CMAKE_OPTIONS $CMAKE_OPTIONS
- cmake --build WORK/desktop/cmake -- $ADDITIONAL_BUILD_OPTIONS
- codesign --verbose -s "$MACOS_SIGNING_IDENTITY" WORK/desktop/Build/linphone_package/Linphone-*.dmg
- ccache -s
artifacts:
......@@ -87,4 +88,4 @@ job-macosx-deploy:
- job-macosx-ninja
script:
- scp WORK/desktop/Build/linphone_package/$PACKAGE_NAME-*-mac.dmg $DEPLOY_SERVER:$MACOSX_UPLOAD_DIRECTORY/
\ No newline at end of file
- scp WORK/desktop/Build/linphone_package/$PACKAGE_NAME-*-mac.dmg $DEPLOY_SERVER:$MACOSX_UPLOAD_DIRECTORY/
......@@ -29,4 +29,4 @@ include:
stages:
- build
- package
- deploy
\ No newline at end of file
- deploy
......@@ -142,7 +142,7 @@ set(SOURCES
src/components/contacts/ContactsListProxyModel.cpp
src/components/core/CoreHandlers.cpp
src/components/core/CoreManager.cpp
src/components/core/messages-count-notifier/AbstractMessageCountNotifier.cpp
src/components/core/event-count-notifier/AbstractEventCountNotifier.cpp
src/components/file/FileDownloader.cpp
src/components/file/FileExtractor.cpp
src/components/notifier/Notifier.cpp
......@@ -200,7 +200,7 @@ set(HEADERS
src/components/contacts/ContactsListProxyModel.hpp
src/components/core/CoreHandlers.hpp
src/components/core/CoreManager.hpp
src/components/core/messages-count-notifier/AbstractMessageCountNotifier.hpp
src/components/core/event-count-notifier/AbstractEventCountNotifier.hpp
src/components/file/FileDownloader.hpp
src/components/file/FileExtractor.hpp
src/components/notifier/Notifier.hpp
......@@ -230,37 +230,37 @@ set(MAIN_FILE src/app/main.cpp)
if (APPLE)
list(APPEND SOURCES
src/app/single-application/SingleApplication.cpp
src/components/core/messages-count-notifier/MessageCountNotifierMacOs.m
src/components/core/event-count-notifier/EventCountNotifierMacOs.m
src/components/other/desktop-tools/DesktopToolsMacOs.cpp
src/components/other/desktop-tools/screen-saver/ScreenSaverMacOs.m
)
list(APPEND HEADERS
src/app/single-application/SingleApplicationPrivate.hpp
src/components/core/messages-count-notifier/MessageCountNotifierMacOs.hpp
src/components/core/event-count-notifier/EventCountNotifierMacOs.hpp
src/components/other/desktop-tools/DesktopToolsMacOs.hpp
)
elseif (WIN32)
list(APPEND SOURCES
src/app/single-application/SingleApplication.cpp
src/components/core/messages-count-notifier/MessageCountNotifierSystemTrayIcon.cpp
src/components/core/event-count-notifier/EventCountNotifierSystemTrayIcon.cpp
src/components/other/desktop-tools/DesktopToolsWindows.cpp
)
list(APPEND HEADERS
src/app/single-application/SingleApplicationPrivate.hpp
src/components/core/messages-count-notifier/MessageCountNotifierSystemTrayIcon.hpp
src/components/core/event-count-notifier/EventCountNotifierSystemTrayIcon.hpp
src/components/other/desktop-tools/DesktopToolsWindows.hpp
)
else ()
list(APPEND SOURCES
src/app/single-application/SingleApplicationDBus.cpp
src/components/core/messages-count-notifier/MessageCountNotifierSystemTrayIcon.cpp
src/components/core/event-count-notifier/EventCountNotifierSystemTrayIcon.cpp
src/components/other/desktop-tools/DesktopToolsLinux.cpp
src/components/other/desktop-tools/screen-saver/ScreenSaverDBus.cpp
src/components/other/desktop-tools/screen-saver/ScreenSaverXdg.cpp
)
list(APPEND HEADERS
src/app/single-application/SingleApplicationDBusPrivate.hpp
src/components/core/messages-count-notifier/MessageCountNotifierSystemTrayIcon.hpp
src/components/core/event-count-notifier/EventCountNotifierSystemTrayIcon.hpp
src/components/other/desktop-tools/DesktopToolsLinux.hpp
src/components/other/desktop-tools/screen-saver/ScreenSaverDBus.hpp
src/components/other/desktop-tools/screen-saver/ScreenSaverXdg.hpp
......
set(APPLICATION_DESCRIPTION "A libre SIP client")
set(APPLICATION_ID "com.belledonnecommunications.linphone")
set(APPLICATION_NAME Linphone)
set(APPLICATION_URL "https://www.linphone.org")
set(APPLICATION_VENDOR "Belledonne Communications")
......
......@@ -36,7 +36,7 @@
<array>
<dict>
<key>CFBundleURLName</key>
<string>com.belledonnecommunications.linphone</string>
<string>@APPLICATION_ID@</string>
<key>CFBundleURLSchemes</key>
<array>
<string>sip</string>
......
Subproject commit a46331c82ce16a427bf486f029af34e9c50d7c9c
Subproject commit 44380577a36e41c5e9226328dac64e7b27c4d0fc
......@@ -76,13 +76,13 @@ namespace {
constexpr char AssistantViewName[] = "Assistant";
#ifdef Q_OS_LINUX
QString AutoStartDirectory(
QStandardPaths::standardLocations(QStandardPaths::ConfigLocation).at(0) + QLatin1String("/autostart/")
);
const QString AutoStartDirectory(QDir::homePath().append(QStringLiteral("/.config/autostart/")));
#elif defined(Q_OS_MACOS)
QString OsascriptExecutable("osascript");
const QString OsascriptExecutable(QStringLiteral("osascript"));
#else
QString AutoStartSettingsFilePath("HKEY_CURRENT_USER\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run");
const QString AutoStartSettingsFilePath(
QStringLiteral("HKEY_CURRENT_USER\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run")
);
#endif // ifdef Q_OS_LINUX
}
......@@ -673,7 +673,9 @@ void App::setAutoStart (bool enabled) {
return;
}
QFile file(AutoStartDirectory + EXECUTABLE_NAME ".desktop");
const QString confPath(AutoStartDirectory + EXECUTABLE_NAME ".desktop");
qInfo() << QStringLiteral("Updating `%1`...").arg(confPath);
QFile file(confPath);
if (!enabled) {
if (file.exists() && !file.remove()) {
......@@ -691,20 +693,25 @@ void App::setAutoStart (bool enabled) {
return;
}
QString fileContent(
const QString binPath(applicationFilePath());
const QString exec(
binPath.startsWith("/app")
? QStringLiteral("flatpak run " APPLICATION_ID)
: binPath
);
QTextStream(&file) << QString(
"[Desktop Entry]\n"
"Name=" APPLICATION_NAME "\n"
"GenericName=SIP Phone\n"
"Comment=" APPLICATION_DESCRIPTION "\n"
"Type=Application\n"
"Exec=" + applicationFilePath() + "\n"
"Exec=" + exec + "\n"
"Icon=\n"
"Terminal=false\n"
"Categories=Network;Telephony;\n"
"MimeType=x-scheme-handler/sip-linphone;x-scheme-handler/sip;x-scheme-handler/sips-linphone;x-scheme-handler/sips;\n"
);
QTextStream out(&file);
out << fileContent;
mAutoStart = enabled;
emit autoStartChanged(enabled);
......
......@@ -88,11 +88,11 @@ CallModel::~CallModel () {
// -----------------------------------------------------------------------------
QString CallModel::getPeerAddress () const {
return Utils::coreStringToAppString(mCall->getRemoteAddress()->asString());
return Utils::coreStringToAppString(mCall->getRemoteAddress()->asStringUriOnly());
}
QString CallModel::getLocalAddress () const {
return Utils::coreStringToAppString(mCall->getCallLog()->getFromAddress()->asString());
return Utils::coreStringToAppString(mCall->getCallLog()->getLocalAddress()->asStringUriOnly());
}
// -----------------------------------------------------------------------------
......
......@@ -131,7 +131,6 @@ void CallsListModel::launchVideoCall (const QString &sipAddress) const {
return;
shared_ptr<linphone::CallParams> params = core->createCallParams(nullptr);
params->enableEarlyMediaSending(true);
params->enableVideo(true);
CallModel::setRecordFile(params, Utils::coreStringToAppString(address->getUsername()));
......@@ -192,6 +191,8 @@ void CallsListModel::handleCallStateChanged (const shared_ptr<linphone::Call> &c
case linphone::Call::State::End:
case linphone::Call::State::Error:
if (call->getCallLog()->getStatus() == linphone::Call::Status::Missed)
emit callMissed(&call->getData<CallModel>("call-model"));
removeCall(call);
break;
......
......@@ -55,6 +55,8 @@ signals:
void callRunning (int index, CallModel *callModel);
void callTransferAsked (CallModel *callModel);
void callMissed (CallModel *callModel);
private:
bool removeRow (int row, const QModelIndex &parent = QModelIndex());
bool removeRows (int row, int count, const QModelIndex &parent = QModelIndex()) override;
......
......@@ -117,6 +117,8 @@ signals:
void messageCountReset ();
void focused ();
private:
typedef QPair<QVariantMap, std::shared_ptr<void>> ChatEntryData;
......
......@@ -194,6 +194,7 @@ void ChatProxyModel::reload () {
if (mChatModel) {
mChatModel->resetMessageCount();
mChatModel->focused();
ChatModel *chatModel = mChatModel.get();
QObject::connect(chatModel, &ChatModel::isRemoteComposingChanged, this, &ChatProxyModel::handleIsRemoteComposingChanged);
......@@ -217,8 +218,10 @@ static inline QWindow *getParentWindow (QObject *object) {
}
void ChatProxyModel::handleIsActiveChanged (QWindow *window) {
if (mChatModel && window->isActive() && getParentWindow(this) == window)
if (mChatModel && window->isActive() && getParentWindow(this) == window) {
mChatModel->resetMessageCount();
mChatModel->focused();
}
}
void ChatProxyModel::handleIsRemoteComposingChanged (bool status) {
......
......@@ -39,9 +39,9 @@
#include "utils/Utils.hpp"
#if defined(Q_OS_MACOS)
#include "messages-count-notifier/MessageCountNotifierMacOs.hpp"
#include "event-count-notifier/EventCountNotifierMacOs.hpp"
#else
#include "messages-count-notifier/MessageCountNotifierSystemTrayIcon.hpp"
#include "event-count-notifier/EventCountNotifierSystemTrayIcon.hpp"
#endif // if defined(Q_OS_MACOS)
#include "CoreHandlers.hpp"
......@@ -90,13 +90,13 @@ CoreManager::CoreManager (QObject *parent, const QString &configPath) :
mInstance->mSipAddressesModel = new SipAddressesModel(mInstance);
{
MessageCountNotifier *messageCountNotifier = new MessageCountNotifier(mInstance);
messageCountNotifier->updateUnreadMessageCount();
EventCountNotifier *eventCountNotifier = new EventCountNotifier(mInstance);
eventCountNotifier->updateUnreadMessageCount();
QObject::connect(
messageCountNotifier, &MessageCountNotifier::unreadMessageCountChanged,
mInstance, &CoreManager::unreadMessageCountChanged
eventCountNotifier, &EventCountNotifier::eventCountChanged,
mInstance, &CoreManager::eventCountChanged
);
mInstance->mMessageCountNotifier = messageCountNotifier;
mInstance->mEventCountNotifier = eventCountNotifier;
}
mInstance->migrate();
......@@ -319,8 +319,8 @@ QString CoreManager::getVersion () const {
// -----------------------------------------------------------------------------
int CoreManager::getUnreadMessageCount () const {
return mMessageCountNotifier ? mMessageCountNotifier->getUnreadMessageCount() : 0;
int CoreManager::getEventCount () const {
return mEventCountNotifier ? mEventCountNotifier->getEventCount() : 0;
}
// -----------------------------------------------------------------------------
......
......@@ -35,7 +35,7 @@ class CallsListModel;
class ChatModel;
class ContactsListModel;
class CoreHandlers;
class MessageCountNotifier;
class EventCountNotifier;
class SettingsModel;
class SipAddressesModel;
class VcardModel;
......@@ -45,7 +45,7 @@ class CoreManager : public QObject {
Q_PROPERTY(QString version READ getVersion CONSTANT);
Q_PROPERTY(QString downloadUrl READ getDownloadUrl CONSTANT);
Q_PROPERTY(int unreadMessageCount READ getUnreadMessageCount NOTIFY unreadMessageCountChanged);
Q_PROPERTY(int eventCount READ getEventCount NOTIFY eventCountChanged);
public:
bool started () const {
......@@ -137,7 +137,7 @@ signals:
void logsUploaded (const QString &url);
void unreadMessageCountChanged (int count);
void eventCountChanged (int count);
private:
CoreManager (QObject *parent, const QString &configPath);
......@@ -151,7 +151,7 @@ private:
QString getVersion () const;
int getUnreadMessageCount () const;
int getEventCount () const;
void iterate ();
......@@ -170,7 +170,7 @@ private:
SettingsModel *mSettingsModel = nullptr;
AccountSettingsModel *mAccountSettingsModel = nullptr;
MessageCountNotifier *mMessageCountNotifier = nullptr;
EventCountNotifier *mEventCountNotifier = nullptr;
QHash<QPair<QString, QString>, std::weak_ptr<ChatModel>> mChatModels;
......
/*
* AbstractMessageCountNotifier.cpp
* AbstractEventCountNotifier.cpp
* Copyright (C) 2017-2018 Belledonne Communications, Grenoble, France
*
* This program is free software; you can redistribute it and/or
......@@ -20,53 +20,79 @@
* Author: Ronan Abhamon
*/
#include "components/call/CallModel.hpp"
#include "components/calls/CallsListModel.hpp"
#include "components/chat/ChatModel.hpp"
#include "components/core/CoreHandlers.hpp"
#include "components/core/CoreManager.hpp"
#include "components/settings/SettingsModel.hpp"
#include "AbstractMessageCountNotifier.hpp"
#include "AbstractEventCountNotifier.hpp"
// =============================================================================
using namespace std;
AbstractMessageCountNotifier::AbstractMessageCountNotifier (QObject *parent) : QObject(parent) {
AbstractEventCountNotifier::AbstractEventCountNotifier (QObject *parent) : QObject(parent) {
CoreManager *coreManager = CoreManager::getInstance();
QObject::connect(
coreManager, &CoreManager::chatModelCreated,
this, &AbstractMessageCountNotifier::handleChatModelCreated
this, &AbstractEventCountNotifier::handleChatModelCreated
);
QObject::connect(
coreManager->getHandlers().get(), &CoreHandlers::messageReceived,
this, &AbstractMessageCountNotifier::updateUnreadMessageCount
this, &AbstractEventCountNotifier::updateUnreadMessageCount
);
QObject::connect(
coreManager->getSettingsModel(), &SettingsModel::chatEnabledChanged,
this, &AbstractMessageCountNotifier::internalNotifyUnreadMessageCount
this, &AbstractEventCountNotifier::internalnotifyEventCount
);
QObject::connect(
coreManager->getCallsListModel(), &CallsListModel::callMissed,
this, &AbstractEventCountNotifier::handleCallMissed
);
}
// -----------------------------------------------------------------------------
void AbstractMessageCountNotifier::updateUnreadMessageCount () {
void AbstractEventCountNotifier::updateUnreadMessageCount () {
mUnreadMessageCount = CoreManager::getInstance()->getCore()->getUnreadChatMessageCountFromActiveLocals();
internalNotifyUnreadMessageCount();
internalnotifyEventCount();
}
void AbstractMessageCountNotifier::internalNotifyUnreadMessageCount () {
qInfo() << QStringLiteral("Notify unread messages count: %1.").arg(mUnreadMessageCount);
int n = mUnreadMessageCount > 99 ? 99 : mUnreadMessageCount;
void AbstractEventCountNotifier::internalnotifyEventCount () {
int n = mUnreadMessageCount + getMissedCallCount();
qInfo() << QStringLiteral("Notify event count: %1.").arg(n);
n = n > 99 ? 99 : n;
notifyUnreadMessageCount(CoreManager::getInstance()->getSettingsModel()->getChatEnabled() ? n : 0);
unreadMessageCountChanged(mUnreadMessageCount);
notifyEventCount(CoreManager::getInstance()->getSettingsModel()->getChatEnabled() ? n : 0);
emit eventCountChanged(mUnreadMessageCount);
}
// -----------------------------------------------------------------------------
void AbstractMessageCountNotifier::handleChatModelCreated (const shared_ptr<ChatModel> &chatModel) {
void AbstractEventCountNotifier::handleChatModelCreated (const shared_ptr<ChatModel> &chatModel) {
ChatModel *chatModelPtr = chatModel.get();
QObject::connect(
chatModelPtr, &ChatModel::messageCountReset,
this, &AbstractEventCountNotifier::updateUnreadMessageCount
);
QObject::connect(
chatModel.get(), &ChatModel::messageCountReset,
this, &AbstractMessageCountNotifier::updateUnreadMessageCount
chatModelPtr, &ChatModel::focused,
this, [this, chatModelPtr]() { handleChatModelFocused(chatModelPtr); }
);
}
void AbstractEventCountNotifier::handleChatModelFocused (ChatModel *chatModel) {
auto it = mMissedCalls.find({ chatModel->getPeerAddress(), chatModel->getLocalAddress() });
if (it != mMissedCalls.cend()) {
mMissedCalls.erase(it);
internalnotifyEventCount();
}
}
void AbstractEventCountNotifier::handleCallMissed (CallModel *callModel) {
Q_UNUSED(callModel);
++mMissedCalls[{ callModel->getPeerAddress(), callModel->getLocalAddress() }];
internalnotifyEventCount();
}
/*
* AbstractMessageCountNotifier.hpp
* AbstractEventCountNotifier.hpp
* Copyright (C) 2017-2018 Belledonne Communications, Grenoble, France
*
* This program is free software; you can redistribute it and/or
......@@ -20,12 +20,14 @@
* Author: Ronan Abhamon
*/
#ifndef ABSTRACT_MESSAGE_COUNT_NOTIFIER_H_
#define ABSTRACT_MESSAGE_COUNT_NOTIFIER_H_
#ifndef ABSTRACT_EVENT_COUNT_NOTIFIER_H_
#define ABSTRACT_EVENT_COUNT_NOTIFIER_H_
#include <memory>
#include <QHash>
#include <QObject>
#include <QPair>
// =============================================================================
......@@ -33,32 +35,44 @@ namespace linphone {
class ChatMessage;
}
class CallModel;
class ChatModel;
class AbstractMessageCountNotifier : public QObject {
class AbstractEventCountNotifier : public QObject {
Q_OBJECT;
public:
AbstractMessageCountNotifier (QObject *parent = Q_NULLPTR);
AbstractEventCountNotifier (QObject *parent = Q_NULLPTR);
void updateUnreadMessageCount ();
int getUnreadMessageCount () const {
return mUnreadMessageCount;
int getUnreadMessageCount () const { return mUnreadMessageCount; }
int getMissedCallCount () const {
int t = 0;
for (int n : mMissedCalls) t += n;
return t;
}
int getEventCount () const { return mUnreadMessageCount + getMissedCallCount(); }
signals:
void unreadMessageCountChanged (int count);
void eventCountChanged (int count);
protected:
virtual void notifyUnreadMessageCount (int n) = 0;
virtual void notifyEventCount (int n) = 0;
private:
void internalNotifyUnreadMessageCount ();
using ConferenceId = QPair<QString, QString>;
void internalnotifyEventCount ();
void handleChatModelCreated (const std::shared_ptr<ChatModel> &chatModel);
void handleChatModelFocused (ChatModel *chatModel);
void handleCallMissed (CallModel *callModel);
QHash<ConferenceId, int> mMissedCalls;
int mUnreadMessageCount = 0;
};
#endif // ABSTRACT_MESSAGE_COUNT_NOTIFIER_H_
#endif // ABSTRACT_EVENT_COUNT_NOTIFIER_H_
/*
* MessageCountNotifierMacOs.hpp
* EventCountNotifierMacOs.hpp
* Copyright (C) 2017-2018 Belledonne Communications, Grenoble, France
*
* This program is free software; you can redistribute it and/or
......@@ -20,22 +20,22 @@
* Author: Ghislain MARY
*/
#ifndef MESSAGE_COUNT_NOTIFIER_MAC_OS_H_
#define MESSAGE_COUNT_NOTIFIER_MAC_OS_H_
#ifndef EVENT_COUNT_NOTIFIER_MAC_OS_H_
#define EVENT_COUNT_NOTIFIER_MAC_OS_H_
#include "AbstractMessageCountNotifier.hpp"
#include "AbstractEventCountNotifier.hpp"
// =============================================================================
extern "C" void notifyUnreadMessageCountMacOs (int n);
extern "C" void notifyEventCountMacOs (int n);
class MessageCountNotifier : public AbstractMessageCountNotifier {
class EventCountNotifier : public AbstractEventCountNotifier {
public:
MessageCountNotifier (QObject *parent = Q_NULLPTR) : AbstractMessageCountNotifier(parent) {}
EventCountNotifier (QObject *parent = Q_NULLPTR) : AbstractEventCountNotifier(parent) {}
void notifyUnreadMessageCount (int n) override {
notifyUnreadMessageCountMacOs(n);
void notifyEventCount (int n) override {
notifyEventCountMacOs(n);
}
};
#endif // MESSAGE_COUNT_NOTIFIER_MAC_OS_H_
#endif // EVENT_COUNT_NOTIFIER_MAC_OS_H_
/*
* MessageCountNotifierMacOS.m
* EventCountNotifierMacOs.m
* Copyright (C) 2017-2018 Belledonne Communications, Grenoble, France
*
* This program is free software; you can redistribute it and/or
......@@ -24,7 +24,7 @@
// =============================================================================
void notifyUnreadMessageCountMacOs (int n) {
void notifyEventCountMacOs (int n) {
NSString *badgeStr = (n > 0) ? [NSString stringWithFormat:@"%d", n] : @"";
[[NSApp dockTile] setBadgeLabel:badgeStr];
}
/*
* MessageCountNotifierSystemTrayIcon.hpp
* EventCountNotifierSystemTrayIcon.hpp
* Copyright (C) 2017-2018 Belledonne Communications, Grenoble, France
*
* This program is free software; you can redistribute it and/or
......@@ -31,7 +31,7 @@
#include "utils/LinphoneUtils.hpp"
#include "utils/Utils.hpp"
#include "MessageCountNotifierSystemTrayIcon.hpp"
#include "EventCountNotifierSystemTrayIcon.hpp"
// =============================================================================
......@@ -46,7 +46,7 @@ namespace {
constexpr int IconCounterTextPixelSize = 144;
}
MessageCountNotifier::MessageCountNotifier (QObject *parent) : AbstractMessageCountNotifier(parent) {
EventCountNotifier::EventCountNotifier (QObject *parent) : AbstractEventCountNotifier(parent) {
QSvgRenderer renderer((QString(LinphoneUtils::WindowIconPath)));
if (!renderer.isValid())
qFatal("Invalid SVG Image.");
......@@ -62,20 +62,20 @@ MessageCountNotifier::MessageCountNotifier (QObject *parent) : AbstractMessageCo
mBlinkTimer = new QTimer(this);
mBlinkTimer->setInterval(IconCounterBlinkInterval);
QObject::connect(mBlinkTimer, &QTimer::timeout, this, &MessageCountNotifier::update);
QObject::connect(mBlinkTimer, &QTimer::timeout, this, &EventCountNotifier::update);
Utils::connectOnce(
App::getInstance(), &App::focusWindowChanged,
this, &MessageCountNotifier::updateUnreadMessageCount
this, &EventCountNotifier::updateUnreadMessageCount
);
}
MessageCountNotifier::~MessageCountNotifier () {
EventCountNotifier::~EventCountNotifier () {
delete mBuf;
delete mBufWithCounter;
}
void MessageCountNotifier::notifyUnreadMessageCount (int n) {
void EventCountNotifier::notifyEventCount (int n) {
QSystemTrayIcon *sysTrayIcon = App::getInstance()->getSystemTrayIcon();
if (!sysTrayIcon)
return;
......@@ -115,7 +115,7 @@ void MessageCountNotifier::notifyUnreadMessageCount (int n) {
update();
}
void MessageCountNotifier::update () {
void EventCountNotifier::update () {
QSystemTrayIcon *sysTrayIcon = App::getInstance()->getSystemTrayIcon();
Q_CHECK_PTR(sysTrayIcon);
sysTrayIcon->setIcon(QIcon(mDisplayCounter ? *mBufWithCounter : *mBuf));
......
/*
* MessageCountNotifierSystemTrayIcon.hpp
* EventCountNotifierSystemTrayIcon.hpp
* Copyright (C) 2017-2018 Belledonne Communications, Grenoble, France
*
* This program is free software; you can redistribute it and/or
......@@ -20,22 +20,22 @@
* Author: Ronan Abhamon
*/
#ifndef MESSAGE_COUNT_NOTIFIER_SYSTEM_TRAY_ICON_H_
#define MESSAGE_COUNT_NOTIFIER_SYSTEM_TRAY_ICON_H_
#ifndef EVENT_COUNT_NOTIFIER_SYSTEM_TRAY_ICON_H_
#define EVENT_COUNT_NOTIFIER_SYSTEM_TRAY_ICON_H_
#include "AbstractMessageCountNotifier.hpp"
#include "AbstractEventCountNotifier.hpp"
// =============================================================================
class QTimer;
class MessageCountNotifier : public AbstractMessageCountNotifier {
class EventCountNotifier : public AbstractEventCountNotifier {
public:
MessageCountNotifier (QObject *parent = Q_NULLPTR);
~MessageCountNotifier ();
EventCountNotifier (QObject *parent = Q_NULLPTR);
~EventCountNotifier ();
protected:
void notifyUnreadMessageCount (int n) override;
void notifyEventCount (int n) override;
private:
void update ();
......@@ -46,4 +46,4 @@ private:
bool mDisplayCounter = false;
};
#endif // MESSAGE_COUNT_NOTIFIER_SYSTEM_TRAY_ICON_H_
#endif // EVENT_COUNT_NOTIFIER_SYSTEM_TRAY_ICON_H_
......@@ -59,7 +59,7 @@ AccountSettingsModel::AccountSettingsModel (QObject *parent) : QObject(parent) {
coreManager->getHandlers().get(), &CoreHandlers::registrationStateChanged,
this, &AccountSettingsModel::handleRegistrationStateChanged
);
QObject::connect(coreManager, &CoreManager::unreadMessageCountChanged, this, [this]() { emit accountSettingsUpdated(); });
QObject::connect(coreManager, &CoreManager::eventCountChanged, this, [this]() { emit accountSettingsUpdated(); });
}
// -----------------------------------------------------------------------------
......
......@@ -20,8 +20,9 @@
*
*******************************************************************************/
#cmakedefine APPLICATION_NAME "${APPLICATION_NAME}"
#cmakedefine APPLICATION_DESCRIPTION "${APPLICATION_DESCRIPTION}"
#cmakedefine APPLICATION_ID "${APPLICATION_ID}"
#cmakedefine APPLICATION_NAME "${APPLICATION_NAME}"
#cmakedefine ENABLE_UPDATE_CHECK 1
#cmakedefine EXECUTABLE_NAME "${EXECUTABLE_NAME}"
#cmakedefine MSPLUGINS_DIR "${MSPLUGINS_DIR}"
......@@ -83,7 +83,7 @@ Item {
id: messageCounter
anchors.fill: parent
count: CoreManager.unreadMessageCount
count: CoreManager.eventCount
}
}
}
......
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