Remove manual menu bar mangling on macos

This is causing probably more issues nowadays than it fixes. Qt should
be adding those menus for us now, so let's remove it and see, what
breaks!
This commit is contained in:
Nicolas Werner 2024-09-25 12:11:01 +02:00
parent cc4ace3c12
commit 048af42780
No known key found for this signature in database
GPG key ID: C8D75E610773F2D9
4 changed files with 2 additions and 47 deletions

View file

@ -648,9 +648,9 @@ qt_add_resources(QRC resources/res.qrc)
if(APPLE)
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -framework Foundation -framework Cocoa -framework UserNotifications")
set(SRC_FILES ${SRC_FILES} src/notifications/NotificationManagerProxy.h src/notifications/MacNotificationDelegate.h src/notifications/MacNotificationDelegate.mm src/notifications/ManagerMac.mm src/notifications/ManagerMac.cpp src/emoji/MacHelper.mm src/emoji/MacHelper.h)
set(SRC_FILES ${SRC_FILES} src/notifications/NotificationManagerProxy.h src/notifications/MacNotificationDelegate.h src/notifications/MacNotificationDelegate.mm src/notifications/ManagerMac.mm src/notifications/ManagerMac.cpp)
if(${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.16.0")
set_source_files_properties( src/notifications/NotificationManagerProxy.h src/notifications/MacNotificationDelegate.h src/notifications/MacNotificationDelegate.mm src/notifications/ManagerMac.mm src/emoji/MacHelper.mm src/emoji/MacHelper.h PROPERTIES SKIP_PRECOMPILE_HEADERS ON)
set_source_files_properties( src/notifications/NotificationManagerProxy.h src/notifications/MacNotificationDelegate.h src/notifications/MacNotificationDelegate.mm src/notifications/ManagerMac.mm PROPERTIES SKIP_PRECOMPILE_HEADERS ON)
endif()
elseif(WIN32)
file(DOWNLOAD

View file

@ -1,14 +0,0 @@
// SPDX-FileCopyrightText: Nheko Contributors
//
// SPDX-License-Identifier: GPL-3.0-or-later
#pragma once
#include <QMenuBar>
class MacHelper
{
public:
static void showEmojiWindow();
static void initializeMenus();
};

View file

@ -1,26 +0,0 @@
#include "MacHelper.h"
#include <Cocoa/Cocoa.h>
#include <Foundation/Foundation.h>
#include <Foundation/NSString.h>
#include <QCoreApplication>
void
MacHelper::showEmojiWindow()
{
NSApplication *theNSApplication = [NSApplication sharedApplication];
[theNSApplication orderFrontCharacterPalette:nil];
}
void
MacHelper::initializeMenus()
{
NSApplication *theNSApplication = [NSApplication sharedApplication];
NSArray<NSMenuItem *> *menus = [theNSApplication mainMenu].itemArray;
NSUInteger size = menus.count;
for (NSUInteger i = 0; i < size; i++) {
NSMenuItem *item = [menus objectAtIndex:i];
[item setTitle:@"Edit"];
}
}

View file

@ -37,7 +37,6 @@
#include "config/nheko.h"
#if defined(Q_OS_MACOS)
#include "emoji/MacHelper.h"
#include "notifications/Manager.h"
#endif
@ -466,10 +465,6 @@ main(int argc, char *argv[])
QStringLiteral("matrix"), ChatPage::instance(), "handleMatrixUri");
#if defined(Q_OS_MACOS)
// Temporary solution for the emoji picker until
// nheko has a proper menu bar with more functionality.
MacHelper::initializeMenus();
// Need to set up notification delegate so users can respond to messages from within the
// notification itself.
NotificationsManager::attachToMacNotifCenter();