removed redundant OBCocoa files / namespace; moved functions to UBPlatformUtils, which serves the same purpose

preferencesAboutTextFull
Craig Watson 9 years ago
parent e1014a0138
commit b219655ac2
  1. 11
      src/core/OBCocoa.h
  2. 24
      src/core/OBCocoa.mm
  3. 6
      src/core/UBApplication.cpp
  4. 6
      src/core/core.pri
  5. 1
      src/frameworks/UBPlatformUtils.h
  6. 5
      src/frameworks/UBPlatformUtils_linux.cpp
  7. 14
      src/frameworks/UBPlatformUtils_mac.mm
  8. 4
      src/frameworks/UBPlatformUtils_win.cpp

@ -1,11 +0,0 @@
/*
OBCocoa.h
Header file permitting access to Mac OSX / Cocoa specific functions
*/
namespace OBCocoa {
void setFrontProcess();
}

@ -1,24 +0,0 @@
#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()
{
}

Loading…
Cancel
Save