mirror of
https://gitlab.linphone.org/BC/public/linphone-desktop.git
synced 2026-05-07 14:44:01 +00:00
Implement display of unread messages count on the application icon in the dock on Mac OS X.
This commit is contained in:
parent
5a29621141
commit
3893e2882f
4 changed files with 73 additions and 2 deletions
|
|
@ -203,6 +203,9 @@ set(HEADERS
|
|||
src/utils/Utils.hpp
|
||||
)
|
||||
|
||||
if(APPLE)
|
||||
list(APPEND SOURCES src/components/core/MessagesCountNotifierMacOS.m)
|
||||
endif()
|
||||
if(ENABLE_DBUS)
|
||||
list(APPEND SOURCES src/app/single-application/SingleApplicationDBus.cpp)
|
||||
list(APPEND HEADERS src/app/single-application/SingleApplicationDBusPrivate.hpp)
|
||||
|
|
@ -348,6 +351,9 @@ foreach (package ${QT5_PACKAGES_OPTIONAL})
|
|||
endforeach ()
|
||||
|
||||
target_link_libraries(${TARGET_NAME} ${BCTOOLBOX_CORE_LIBRARIES} ${BELCARD_LIBRARIES} ${LINPHONE_LIBRARIES} ${LINPHONECXX_LIBRARIES})
|
||||
if(APPLE)
|
||||
target_link_libraries(${TARGET_NAME} "-framework Cocoa")
|
||||
endif()
|
||||
|
||||
install(TARGETS ${TARGET_NAME}
|
||||
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
|
||||
|
|
|
|||
|
|
@ -24,6 +24,14 @@
|
|||
|
||||
#include "MessagesCountNotifier.hpp"
|
||||
|
||||
#if defined(Q_OS_LINUX)
|
||||
// TODO.
|
||||
#elif defined(Q_OS_MACOS)
|
||||
#include "MessagesCountNotifierMacOS.h"
|
||||
#elif defined(Q_OS_WIN)
|
||||
// TODO.
|
||||
#endif
|
||||
|
||||
using namespace std;
|
||||
|
||||
// =============================================================================
|
||||
|
|
@ -58,10 +66,10 @@ void MessagesCountNotifier::notifyUnreadMessagesCount () {
|
|||
#if defined(Q_OS_LINUX)
|
||||
// TODO.
|
||||
#elif defined(Q_OS_MACOS)
|
||||
// TODO.
|
||||
::notifyUnreadMessagesCountMacOS(mUnreadMessagesCount);
|
||||
#elif defined(Q_OS_WIN)
|
||||
// TODO.
|
||||
#endif // ifdef Q_OS_LINUX
|
||||
#endif
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
|
|
|||
26
src/components/core/MessagesCountNotifierMacOS.h
Normal file
26
src/components/core/MessagesCountNotifierMacOS.h
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
/*
|
||||
* MessagesCountNotifierMacOS.h
|
||||
* Copyright (C) 2017 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 30, 2017
|
||||
* Author: Ghislain MARY
|
||||
*/
|
||||
|
||||
// =============================================================================
|
||||
|
||||
extern "C" void notifyUnreadMessagesCountMacOS(int count);
|
||||
|
||||
31
src/components/core/MessagesCountNotifierMacOS.m
Normal file
31
src/components/core/MessagesCountNotifierMacOS.m
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
/*
|
||||
* MessagesCountNotifierMacOS.m
|
||||
* Copyright (C) 2017 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 30, 2017
|
||||
* Author: Ghislain MARY
|
||||
*/
|
||||
|
||||
#import <Cocoa/Cocoa.h>
|
||||
|
||||
// =============================================================================
|
||||
|
||||
void notifyUnreadMessagesCountMacOS(int count) {
|
||||
NSString *badgeStr = (count > 0) ? [NSString stringWithFormat:@"%d", count] : @"";
|
||||
[[NSApp dockTile] setBadgeLabel:badgeStr];
|
||||
}
|
||||
|
||||
Loading…
Add table
Reference in a new issue