feat: MACOS_NE systray menu support
This commit is contained in:
parent
4fcf3c13dd
commit
9b89237f54
7 changed files with 31 additions and 18 deletions
|
|
@ -53,8 +53,11 @@ endif()
|
||||||
|
|
||||||
qt_standard_project_setup()
|
qt_standard_project_setup()
|
||||||
qt_add_executable(${PROJECT} MANUAL_FINALIZATION)
|
qt_add_executable(${PROJECT} MANUAL_FINALIZATION)
|
||||||
|
target_include_directories(${PROJECT} PUBLIC
|
||||||
|
$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}>
|
||||||
|
)
|
||||||
|
|
||||||
if(WIN32 OR (APPLE AND NOT IOS AND NOT MACOS_NE) OR (LINUX AND NOT ANDROID))
|
if(WIN32 OR (APPLE AND NOT IOS) OR (LINUX AND NOT ANDROID))
|
||||||
qt_add_repc_replicas(${PROJECT} ${CMAKE_CURRENT_LIST_DIR}/../ipc/ipc_interface.rep)
|
qt_add_repc_replicas(${PROJECT} ${CMAKE_CURRENT_LIST_DIR}/../ipc/ipc_interface.rep)
|
||||||
qt_add_repc_replicas(${PROJECT} ${CMAKE_CURRENT_LIST_DIR}/../ipc/ipc_process_interface.rep)
|
qt_add_repc_replicas(${PROJECT} ${CMAKE_CURRENT_LIST_DIR}/../ipc/ipc_process_interface.rep)
|
||||||
qt_add_repc_replicas(${PROJECT} ${CMAKE_CURRENT_LIST_DIR}/../ipc/ipc_process_tun2socks.rep)
|
qt_add_repc_replicas(${PROJECT} ${CMAKE_CURRENT_LIST_DIR}/../ipc/ipc_process_tun2socks.rep)
|
||||||
|
|
|
||||||
|
|
@ -6,10 +6,10 @@
|
||||||
#include <QQmlApplicationEngine>
|
#include <QQmlApplicationEngine>
|
||||||
#include <QQmlContext>
|
#include <QQmlContext>
|
||||||
#include <QThread>
|
#include <QThread>
|
||||||
#if defined(Q_OS_ANDROID) || defined(Q_OS_IOS) || defined(MACOS_NE)
|
#if defined(Q_OS_ANDROID) || defined(Q_OS_IOS)
|
||||||
#include <QGuiApplication>
|
#include <QGuiApplication>
|
||||||
#else
|
#else
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
#endif
|
#endif
|
||||||
#include <QClipboard>
|
#include <QClipboard>
|
||||||
|
|
||||||
|
|
@ -19,10 +19,10 @@
|
||||||
|
|
||||||
#define amnApp (static_cast<AmneziaApplication *>(QCoreApplication::instance()))
|
#define amnApp (static_cast<AmneziaApplication *>(QCoreApplication::instance()))
|
||||||
|
|
||||||
#if defined(Q_OS_ANDROID) || defined(Q_OS_IOS) || defined(MACOS_NE)
|
#if defined(Q_OS_ANDROID) || defined(Q_OS_IOS)
|
||||||
#define AMNEZIA_BASE_CLASS QGuiApplication
|
#define AMNEZIA_BASE_CLASS QGuiApplication
|
||||||
#else
|
#else
|
||||||
#define AMNEZIA_BASE_CLASS QApplication
|
#define AMNEZIA_BASE_CLASS QApplication
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
class AmneziaApplication : public AMNEZIA_BASE_CLASS
|
class AmneziaApplication : public AMNEZIA_BASE_CLASS
|
||||||
|
|
|
||||||
|
|
@ -15,6 +15,7 @@ find_library(FW_AUTHENTICATIONSERVICES AuthenticationServices)
|
||||||
find_library(FW_AVFOUNDATION AVFoundation)
|
find_library(FW_AVFOUNDATION AVFoundation)
|
||||||
find_library(FW_FOUNDATION Foundation)
|
find_library(FW_FOUNDATION Foundation)
|
||||||
find_library(FW_STOREKIT StoreKit)
|
find_library(FW_STOREKIT StoreKit)
|
||||||
|
find_library(FW_SERVICEMGMT ServiceManagement)
|
||||||
find_library(FW_USERNOTIFICATIONS UserNotifications)
|
find_library(FW_USERNOTIFICATIONS UserNotifications)
|
||||||
find_library(FW_NETWORKEXTENSION NetworkExtension)
|
find_library(FW_NETWORKEXTENSION NetworkExtension)
|
||||||
|
|
||||||
|
|
@ -23,6 +24,7 @@ set(LIBS ${LIBS}
|
||||||
${FW_AVFOUNDATION}
|
${FW_AVFOUNDATION}
|
||||||
${FW_FOUNDATION}
|
${FW_FOUNDATION}
|
||||||
${FW_STOREKIT}
|
${FW_STOREKIT}
|
||||||
|
${FW_SERVICEMGMT}
|
||||||
${FW_USERNOTIFICATIONS}
|
${FW_USERNOTIFICATIONS}
|
||||||
${FW_NETWORKEXTENSION}
|
${FW_NETWORKEXTENSION}
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -95,6 +95,18 @@ if(NOT IOS AND NOT MACOS_NE)
|
||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
# Include native macOS platform helpers (dock/status-item)
|
||||||
|
if(APPLE AND NOT IOS)
|
||||||
|
list(APPEND HEADERS
|
||||||
|
${CLIENT_ROOT_DIR}/platforms/macos/macosutils.h
|
||||||
|
${CLIENT_ROOT_DIR}/platforms/macos/macosstatusicon.h
|
||||||
|
)
|
||||||
|
list(APPEND SOURCES
|
||||||
|
${CLIENT_ROOT_DIR}/platforms/macos/macosutils.mm
|
||||||
|
${CLIENT_ROOT_DIR}/platforms/macos/macosstatusicon.mm
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
|
||||||
if(NOT ANDROID)
|
if(NOT ANDROID)
|
||||||
set(SOURCES ${SOURCES}
|
set(SOURCES ${SOURCES}
|
||||||
${CLIENT_ROOT_DIR}/ui/notificationhandler.cpp
|
${CLIENT_ROOT_DIR}/ui/notificationhandler.cpp
|
||||||
|
|
@ -161,7 +173,7 @@ if(WIN32)
|
||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(WIN32 OR (APPLE AND NOT IOS AND NOT MACOS_NE) OR (LINUX AND NOT ANDROID))
|
if(WIN32 OR (APPLE AND NOT IOS) OR (LINUX AND NOT ANDROID))
|
||||||
message("Client desktop build")
|
message("Client desktop build")
|
||||||
add_compile_definitions(AMNEZIA_DESKTOP)
|
add_compile_definitions(AMNEZIA_DESKTOP)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@
|
||||||
#include "Windows.h"
|
#include "Windows.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(Q_OS_IOS) || defined(MACOS_NE)
|
#if defined(Q_OS_IOS)
|
||||||
#include "platforms/ios/QtAppDelegate-C-Interface.h"
|
#include "platforms/ios/QtAppDelegate-C-Interface.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#include "notificationhandler.h"
|
#include "notificationhandler.h"
|
||||||
|
|
||||||
#if defined(Q_OS_IOS) || defined(MACOS_NE)
|
#if defined(Q_OS_IOS)
|
||||||
# include "platforms/ios/iosnotificationhandler.h"
|
# include "platforms/ios/iosnotificationhandler.h"
|
||||||
#else
|
#else
|
||||||
# include "systemtray_notificationhandler.h"
|
# include "systemtray_notificationhandler.h"
|
||||||
|
|
@ -14,16 +14,9 @@
|
||||||
|
|
||||||
// static
|
// static
|
||||||
NotificationHandler* NotificationHandler::create(QObject* parent) {
|
NotificationHandler* NotificationHandler::create(QObject* parent) {
|
||||||
#if defined(Q_OS_IOS) || defined(MACOS_NE)
|
#if defined(Q_OS_IOS)
|
||||||
return new IOSNotificationHandler(parent);
|
return new IOSNotificationHandler(parent);
|
||||||
#else
|
#else
|
||||||
|
|
||||||
# if defined(Q_OS_LINUX)
|
|
||||||
//if (LinuxSystemTrayNotificationHandler::requiredCustomImpl()) {
|
|
||||||
// return new LinuxSystemTrayNotificationHandler(parent);
|
|
||||||
//}
|
|
||||||
# endif
|
|
||||||
|
|
||||||
return new SystemTrayNotificationHandler(parent);
|
return new SystemTrayNotificationHandler(parent);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -22,6 +22,9 @@ SystemTrayNotificationHandler::SystemTrayNotificationHandler(QObject* parent) :
|
||||||
m_systemTrayIcon(parent)
|
m_systemTrayIcon(parent)
|
||||||
|
|
||||||
{
|
{
|
||||||
|
#ifdef MACOS_NE
|
||||||
|
MacOSUtils::hideDockIcon();
|
||||||
|
#endif
|
||||||
m_systemTrayIcon.show();
|
m_systemTrayIcon.show();
|
||||||
connect(&m_systemTrayIcon, &QSystemTrayIcon::activated, this, &SystemTrayNotificationHandler::onTrayActivated);
|
connect(&m_systemTrayIcon, &QSystemTrayIcon::activated, this, &SystemTrayNotificationHandler::onTrayActivated);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue