Commit b219655a authored by Craig Watson's avatar Craig Watson

removed redundant OBCocoa files / namespace; moved functions to...

removed redundant OBCocoa files / namespace; moved functions to UBPlatformUtils, which serves the same purpose
parent e1014a01
/*
OBCocoa.h
Header file permitting access to Mac OSX / Cocoa specific functions
*/
namespace OBCocoa {
void setFrontProcess();
}
#include "OBCocoa.h"
#include "UBApplicationController.h"
#include <QDebug>
#import <Cocoa/Cocoa.h>
namespace OBCocoa {
/**
* @brief Activate the current application
*/
void setFrontProcess()
{
NSRunningApplication* app = [NSRunningApplication currentApplication];
// activate the application, forcing focus on it
[app activateWithOptions: NSApplicationActivateIgnoringOtherApps];
// other option:NSApplicationActivateAllWindows. This won't steal focus from another app, e.g
// if the user is doing something else while waiting for OpenBoard to load
}
} // namespace OBCocoa
......@@ -33,10 +33,6 @@
#include <QFontDatabase>
#include <QStyleFactory>
#if defined(Q_OS_OSX)
#include "OBCocoa.h"
#endif
#include "frameworks/UBPlatformUtils.h"
#include "frameworks/UBFileSystemUtils.h"
#include "frameworks/UBStringUtils.h"
......@@ -564,7 +560,7 @@ bool UBApplication::eventFilter(QObject *obj, QEvent *event)
{
QFileOpenEvent *fileToOpenEvent = static_cast<QFileOpenEvent *>(event);
OBCocoa::setFrontProcess();
UBPlatformUtils::setFrontProcess();
applicationController->importFile(fileToOpenEvent->file());
}
......
......@@ -34,9 +34,3 @@ SOURCES += src/core/main.cpp \
src/core/UBOpenSankoreImporter.cpp \
src/core/UBTextTools.cpp \
src/core/UBPersistenceWorker.cpp
macx {
HEADERS += src/core/OBCocoa.h
OBJECTIVE_SOURCES += src/core/OBCocoa.mm
}
......@@ -203,6 +203,7 @@ public:
static UBKeyboardLocale** getKeyboardLayouts(int& nCount);
static QString urlFromClipboard();
static QStringList availableTranslations();
static void setFrontProcess();
#ifdef Q_OS_OSX
static void SetMacLocaleByIdentifier(const QString& id);
......
......@@ -429,3 +429,8 @@ QString UBPlatformUtils::urlFromClipboard()
return qsRet;
}
void UBPlatformUtils::setFrontProcess()
{
}
......@@ -557,3 +557,17 @@ void UBPlatformUtils::SetMacLocaleByIdentifier(const QString& id)
}
[pool drain];
}
/**
* @brief Activate the current application
*/
void UBPlatformUtils::setFrontProcess()
{
NSRunningApplication* app = [NSRunningApplication currentApplication];
// activate the application, forcing focus on it
[app activateWithOptions: NSApplicationActivateIgnoringOtherApps];
// other option:NSApplicationActivateAllWindows. This won't steal focus from another app, e.g
// if the user is doing something else while waiting for OpenBoard to load
}
......@@ -424,3 +424,7 @@ QString UBPlatformUtils::urlFromClipboard()
// Not implemented yet
return qsRet;
}
void UBPlatformUtils::setFrontProcess()
{
}
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