Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/owncloud/client.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorFabian Müller <fmueller@owncloud.com>2022-10-26 15:46:06 +0300
committerFabian Müller <80399010+fmoc@users.noreply.github.com>2022-11-11 19:06:54 +0300
commit33b2171b683cf641ba6d1ef95dff38eb47771c06 (patch)
treefab16d3c011a16166473a6fba198a9dee0fe8ccd /src
parentbae220b190cfaf0472986e0dcd3775540018e1dc (diff)
Move mac platform stuff, too
Diffstat (limited to 'src')
-rw-r--r--src/gui/CMakeLists.txt2
-rw-r--r--src/gui/application.h2
-rw-r--r--src/libsync/CMakeLists.txt8
-rw-r--r--src/libsync/platform.cpp7
-rw-r--r--src/libsync/platform_mac.h39
-rw-r--r--src/libsync/platform_mac.mm (renamed from src/gui/platform_mac.mm)52
-rw-r--r--src/libsync/platform_mac_deprecated.mm (renamed from src/gui/platform_mac_deprecated.mm)0
7 files changed, 79 insertions, 31 deletions
diff --git a/src/gui/CMakeLists.txt b/src/gui/CMakeLists.txt
index fc6ba6a5c..399a419fb 100644
--- a/src/gui/CMakeLists.txt
+++ b/src/gui/CMakeLists.txt
@@ -139,8 +139,6 @@ IF( APPLE )
target_link_libraries(owncloudCore PUBLIC Qt5::MacExtras)
target_sources(owncloudCore PRIVATE
- platform_mac.mm
- platform_mac_deprecated.mm
systray.mm
settingsdialog_mac.mm
guiutility_mac.mm
diff --git a/src/gui/application.h b/src/gui/application.h
index 4a79cfd18..b17b0a280 100644
--- a/src/gui/application.h
+++ b/src/gui/application.h
@@ -61,7 +61,7 @@ public:
bool debugMode();
- void showSettingsDialog();
+ Q_INVOKABLE void showSettingsDialog();
ownCloudGui *gui() const;
diff --git a/src/libsync/CMakeLists.txt b/src/libsync/CMakeLists.txt
index ce4926765..d97407de9 100644
--- a/src/libsync/CMakeLists.txt
+++ b/src/libsync/CMakeLists.txt
@@ -68,8 +68,12 @@ set(libsync_SRCS
if(WIN32)
list(APPEND libsync_SRCS platform_win.cpp)
-elseif(UNIX AND NOT APPLE)
- list(APPEND libsync_SRCS platform_unix.cpp)
+elseif(UNIX)
+ if (APPLE)
+ list(APPEND libsync_SRCS platform_mac.mm platform_mac_deprecated.mm)
+ else()
+ list(APPEND libsync_SRCS platform_unix.cpp)
+ endif()
endif()
set(libsync_SRCS ${libsync_SRCS} creds/httpcredentials.cpp)
diff --git a/src/libsync/platform.cpp b/src/libsync/platform.cpp
index 44cc00025..1a2f894f6 100644
--- a/src/libsync/platform.cpp
+++ b/src/libsync/platform.cpp
@@ -13,9 +13,14 @@
*/
#include "platform.h"
+
#include "platform_unix.h"
#include "platform_win.h"
+#if defined(Q_OS_MAC)
+#include "platform_mac.h"
+#endif
+
namespace OCC {
Platform::~Platform()
@@ -41,6 +46,8 @@ std::unique_ptr<Platform> Platform::create()
return std::make_unique<WinPlatform>();
#elif defined(Q_OS_LINUX)
return std::make_unique<UnixPlatform>();
+#elif defined(Q_OS_MAC)
+ return std::make_unique<MacPlatform>();
#else
Q_UNREACHABLE();
#endif
diff --git a/src/libsync/platform_mac.h b/src/libsync/platform_mac.h
new file mode 100644
index 000000000..33c5cae04
--- /dev/null
+++ b/src/libsync/platform_mac.h
@@ -0,0 +1,39 @@
+/*
+ * Copyright (C) by Fabian Müller <fmueller@owncloud.com>
+ *
+ * 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.
+ */
+
+#pragma once
+
+#include "platform.h"
+
+#include <QProcess>
+#include <qglobal.h>
+
+namespace OCC {
+
+class MacPlatformPrivate;
+
+class MacPlatform : public Platform
+{
+public:
+ MacPlatform();
+ ~MacPlatform() override;
+
+ void migrate() override;
+
+private:
+ Q_DECLARE_PRIVATE(MacPlatform);
+ QScopedPointer<MacPlatformPrivate> d_ptr;
+};
+
+} // namespace OCC
diff --git a/src/gui/platform_mac.mm b/src/libsync/platform_mac.mm
index da8c27c7f..f13a326b4 100644
--- a/src/gui/platform_mac.mm
+++ b/src/libsync/platform_mac.mm
@@ -13,12 +13,19 @@
* for more details.
*/
-#include "application.h"
-#include "platform.h"
+#include "platform_mac.h"
+
+#include <QApplication>
+#include <QLoggingCategory>
#import <AppKit/NSApplication.h>
-#include <QProcess>
+// defined in platform_mac_deprecated.mm
+namespace OCC {
+
+void migrateLaunchOnStartup();
+
+}
@interface OwnAppDelegate : NSObject <NSApplicationDelegate>
- (BOOL)applicationShouldHandleReopen:(NSApplication *)sender hasVisibleWindows:(BOOL)flag;
@@ -29,8 +36,11 @@
- (BOOL)applicationShouldHandleReopen:(NSApplication *)sender hasVisibleWindows:(BOOL)flag
{
- if (auto app = qobject_cast<OCC::Application *>(QApplication::instance()))
- app->showSettingsDialog();
+ if (auto *app = QApplication::instance()) {
+ QMetaObject::invokeMethod(app, "showSettingsWindow", Qt::QueuedConnection);
+ } else {
+ qDebug() << "Failed to call showSettingsWindow slot";
+ }
return YES;
}
@@ -38,44 +48,34 @@
namespace OCC {
-// implemented in platform_mac_deprecated.mm
-void migrateLaunchOnStartup();
-
-class MacPlatform : public Platform
+class MacPlatformPrivate
{
public:
- MacPlatform();
- ~MacPlatform() override;
-
- void migrate() override;
-
-private:
- QMacAutoReleasePool _autoReleasePool;
- OwnAppDelegate *_appDelegate;
+ QMacAutoReleasePool autoReleasePool;
+ OwnAppDelegate *appDelegate;
};
MacPlatform::MacPlatform()
+ : d_ptr(new MacPlatformPrivate)
{
+ Q_D(MacPlatform);
+
NSApplicationLoad();
- _appDelegate = [[OwnAppDelegate alloc] init];
- [[NSApplication sharedApplication] setDelegate:_appDelegate];
+ d->appDelegate = [[OwnAppDelegate alloc] init];
+ [[NSApplication sharedApplication] setDelegate:d->appDelegate];
signal(SIGPIPE, SIG_IGN);
}
MacPlatform::~MacPlatform()
{
- [_appDelegate release];
+ Q_D(MacPlatform);
+ [d->appDelegate release];
}
void MacPlatform::migrate()
{
- migrateLaunchOnStartup();
-}
-
-std::unique_ptr<Platform> Platform::create()
-{
- return std::make_unique<MacPlatform>();
+ Platform::migrate();
}
} // namespace OCC
diff --git a/src/gui/platform_mac_deprecated.mm b/src/libsync/platform_mac_deprecated.mm
index 188b0378a..188b0378a 100644
--- a/src/gui/platform_mac_deprecated.mm
+++ b/src/libsync/platform_mac_deprecated.mm