diff --git a/OpenBoard.pro b/OpenBoard.pro index 5f073bea..4ba4b151 100644 --- a/OpenBoard.pro +++ b/OpenBoard.pro @@ -128,32 +128,34 @@ win32 { macx { LIBS += -framework Foundation + LIBS += -framework Cocoa + LIBS += -framework Carbon LIBS += -lcrypto - CONFIG(release, debug|release):CONFIG += x86 + CONFIG(release, debug|release):CONFIG += x86_64 + CONFIG(debug, debug|release):CONFIG += x86_64 - # [03-02-2011] We must use the 32bit version for the moment - # because the Quicktime components used by this application - # are not yet available in 64bits. - CONFIG(debug, debug|release):CONFIG += x86 + # TODO Craig: switch to 64bit - QMAKE_MAC_SDK = "/Developer/SDKs/MacOSX10.6.sdk" - QMAKE_MACOSX_DEPLOYMENT_TARGET = "10.5" + QMAKE_MAC_SDK = macosx + QMAKE_MACOSX_DEPLOYMENT_TARGET = "10.10" - VERSION_RC_PATH = "$$BUILD_DIR/version_rc" + QMAKE_CXXFLAGS += -Wno-overloaded-virtual + #VERSION_RC_PATH = "$$BUILD_DIR/version_rc" + # No references to breakpad in the code =>is this still used? # Embed version into executable for breakpad - QMAKE_LFLAGS += -sectcreate \ - __DATA \ - __version \ - $$VERSION_RC_PATH + #QMAKE_LFLAGS += -sectcreate \ + # __DATA \ + # __version \ + # $$VERSION_RC_PATH QMAKE_CXXFLAGS_RELEASE += -gdwarf-2 \ -mdynamic-no-pic - QMAKE_CFLAGS += -fopenmp - QMAKE_CXXFLAGS += -fopenmp - QMAKE_LFLAGS += -fopenmp +# QMAKE_CFLAGS += -fopenmp + # QMAKE_CXXFLAGS += -fopenmp + # QMAKE_LFLAGS += -fopenmp CONTENTS_DIR = "Contents" RESOURCES_DIR = "Contents/Resources" @@ -364,7 +366,7 @@ macx { system(mkdir -p $$BUILD_DIR) system(printf \""$$OSX_VERSION"\" > $$BUILD_DIR/osx_version) system(printf \""$$VERSION"\" > $$BUILD_DIR/version) - system(printf "%02x%02x%02x%02x" `printf $$VERSION_RC | cut -d ',' -f 1` `printf $$VERSION_RC | cut -d ',' -f 2` `printf $$VERSION_RC | cut -d ',' -f 3` `printf $$VERSION_RC | cut -d ',' -f 4` | xxd -r -p > "$$VERSION_RC_PATH") + # system(printf "%02x%02x%02x%02x" `printf $$VERSION_RC | cut -d ',' -f 1` `printf $$VERSION_RC | cut -d ',' -f 2` `printf $$VERSION_RC | cut -d ',' -f 3` `printf $$VERSION_RC | cut -d ',' -f 4` | xxd -r -p > "$$VERSION_RC_PATH") } linux-g++* { diff --git a/src/adaptors/UBThumbnailAdaptor.cpp b/src/adaptors/UBThumbnailAdaptor.cpp index 96545d0f..660e3a7f 100644 --- a/src/adaptors/UBThumbnailAdaptor.cpp +++ b/src/adaptors/UBThumbnailAdaptor.cpp @@ -98,7 +98,7 @@ const QPixmap* UBThumbnailAdaptor::get(UBDocumentProxy* proxy, int pageIndex) #ifdef Q_OS_LINUX pix->load(fileName, 0, Qt::AutoColor); #else - pix->load(fileName, 0, Qt::AutoColor, false); + pix->load(fileName, 0, Qt::AutoColor); #endif } return pix; diff --git a/src/board/UBBoardView.cpp b/src/board/UBBoardView.cpp index 6024b07a..57b61d6f 100644 --- a/src/board/UBBoardView.cpp +++ b/src/board/UBBoardView.cpp @@ -872,7 +872,6 @@ bool UBBoardView::directTabletEvent(QEvent *event) tEvent = new QTabletEvent(tEvent->type() , mapFromGlobal(tEvent->pos()) , tEvent->globalPos() - , tEvent->hiResGlobalPos() , tEvent->device() , tEvent->pointerType() , tEvent->pressure() @@ -905,7 +904,7 @@ QWidget *UBBoardView::widgetForTabletEvent(QWidget *w, const QPoint &pos) QWidget *childAtPos = NULL; - QList childs = w->childItems(); + QList childs = w->children(); foreach(QObject *child, childs) { QWidget *childWidget = qobject_cast(child); diff --git a/src/core/UBApplication.cpp b/src/core/UBApplication.cpp index 5225655b..24558e59 100644 --- a/src/core/UBApplication.cpp +++ b/src/core/UBApplication.cpp @@ -33,10 +33,6 @@ #include #include -#if defined(Q_OS_OSX) -#include -#endif - #include "frameworks/UBPlatformUtils.h" #include "frameworks/UBFileSystemUtils.h" #include "frameworks/UBStringUtils.h" @@ -91,27 +87,6 @@ bool bIsMinimized = false; QObject* UBApplication::staticMemoryCleaner = 0; -#if defined(Q_OS_OSX) -static OSStatus ub_appleEventProcessor(const AppleEvent *ae, AppleEvent *event, long handlerRefCon) -{ - Q_UNUSED(event); - OSType aeID = typeWildCard; - OSType aeClass = typeWildCard; - - AEGetAttributePtr(ae, keyEventClassAttr, typeType, 0, &aeClass, sizeof(aeClass), 0); - AEGetAttributePtr(ae, keyEventIDAttr, typeType, 0, &aeID, sizeof(aeID), 0); - - if (aeClass == kCoreEventClass && aeID == kAEReopenApplication) - { - // User clicked on Uniboard in the Dock - ((UBApplicationController*)handlerRefCon)->hideDesktop(); - return noErr; - } - - return eventNotHandledErr; -} -#endif - UBApplication::UBApplication(const QString &id, int &argc, char **argv) : QtSingleApplication(id, argc, argv) , mPreferencesController(NULL) @@ -368,11 +343,6 @@ int UBApplication::exec(const QString& pFileToImport) if (pFileToImport.length() > 0) UBApplication::applicationController->importFile(pFileToImport); -#if defined(Q_OS_OSX) - static AEEventHandlerUPP ub_proc_ae_handlerUPP = AEEventHandlerUPP(ub_appleEventProcessor); - AEInstallEventHandler(kCoreEventClass, kAEReopenApplication, ub_proc_ae_handlerUPP, SRefCon(UBApplication::applicationController), true); -#endif - if (UBSettings::settings()->appStartMode->get().toInt()) applicationController->showDesktop(); else @@ -390,14 +360,14 @@ void UBApplication::onScreenCountChanged(int newCount) mainWindow->actionMultiScreen->setEnabled(displayManager.numScreens() > 1); } -#ifdef Q_OS_OSX void UBApplication::showMinimized() { +#ifdef Q_OS_OSX mainWindow->hide(); bIsMinimized = true; +#endif } -#endif void UBApplication::startScript() { @@ -590,11 +560,7 @@ bool UBApplication::eventFilter(QObject *obj, QEvent *event) { QFileOpenEvent *fileToOpenEvent = static_cast(event); -#if defined(Q_OS_OSX) - ProcessSerialNumber psn; - GetCurrentProcess(&psn); - SetFrontProcess(&psn); -#endif + UBPlatformUtils::setFrontProcess(); applicationController->importFile(fileToOpenEvent->file()); } diff --git a/src/core/UBApplication.h b/src/core/UBApplication.h index 2ab2c65a..ccb8f605 100644 --- a/src/core/UBApplication.h +++ b/src/core/UBApplication.h @@ -124,9 +124,9 @@ class UBApplication : public QtSingleApplication private slots: void closing(); -#ifdef Q_OS_OSX +//#ifdef Q_OS_OSX // for some reason this is not compiled if the ifdef is uncommented void showMinimized(); -#endif +//#endif void onScreenCountChanged(int newCount); private: @@ -136,10 +136,11 @@ class UBApplication : public QtSingleApplication bool mIsVerbose; QString checkLanguageAvailabilityForSankore(QString& language); protected: - -#if defined(Q_OS_OSX) && !defined(QT_MAC_USE_COCOA) +/* +#if defined(Q_OS_MAC) && !defined(QT_MAC_USE_COCOA) bool macEventFilter(EventHandlerCallRef caller, EventRef event); #endif + */ UBPreferencesController* mPreferencesController; QTranslator* mApplicationTranslator; diff --git a/src/core/UBApplicationController.cpp b/src/core/UBApplicationController.cpp index b4ae6a28..203aad85 100644 --- a/src/core/UBApplicationController.cpp +++ b/src/core/UBApplicationController.cpp @@ -67,9 +67,6 @@ #include "ui_mainWindow.h" -#ifdef Q_OS_OSX -#include -#endif #include "core/memcheck.h" diff --git a/src/core/core.pri b/src/core/core.pri index fedfde3f..a60978ad 100644 --- a/src/core/core.pri +++ b/src/core/core.pri @@ -34,5 +34,3 @@ SOURCES += src/core/main.cpp \ src/core/UBOpenSankoreImporter.cpp \ src/core/UBTextTools.cpp \ src/core/UBPersistenceWorker.cpp - - diff --git a/src/desktop/UBWindowCapture_mac.mm b/src/desktop/UBWindowCapture_mac.mm index 9e39b3b6..1de369fe 100644 --- a/src/desktop/UBWindowCapture_mac.mm +++ b/src/desktop/UBWindowCapture_mac.mm @@ -26,9 +26,10 @@ #include "UBWindowCapture.h" #include "UBDesktopAnnotationController.h" +#include #import -#import +#import UBWindowCapture::UBWindowCapture(UBDesktopAnnotationController *parent) diff --git a/src/frameworks/UBPlatformUtils.h b/src/frameworks/UBPlatformUtils.h index c7b99bc1..e0b3f4ff 100644 --- a/src/frameworks/UBPlatformUtils.h +++ b/src/frameworks/UBPlatformUtils.h @@ -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); diff --git a/src/frameworks/UBPlatformUtils_linux.cpp b/src/frameworks/UBPlatformUtils_linux.cpp index 73e901a0..17011217 100644 --- a/src/frameworks/UBPlatformUtils_linux.cpp +++ b/src/frameworks/UBPlatformUtils_linux.cpp @@ -429,3 +429,8 @@ QString UBPlatformUtils::urlFromClipboard() return qsRet; } + + +void UBPlatformUtils::setFrontProcess() +{ +} diff --git a/src/frameworks/UBPlatformUtils_mac.mm b/src/frameworks/UBPlatformUtils_mac.mm index 9b73b850..b2623080 100644 --- a/src/frameworks/UBPlatformUtils_mac.mm +++ b/src/frameworks/UBPlatformUtils_mac.mm @@ -33,6 +33,7 @@ #include #import +#import #import #import @@ -51,7 +52,7 @@ OSStatus emptySetSystemUIMode ( return noErr; } -void *originalSetSystemUIMode = 0; +//void *originalSetSystemUIMode = 0; void UBPlatformUtils::init() { @@ -62,7 +63,7 @@ void UBPlatformUtils::init() // http://developer.apple.com/mac/library/documentation/Carbon/Reference/Dock_Manager/Reference/reference.html#//apple_ref/c/func/SetSystemUIMode // - originalSetSystemUIMode = APEPatchCreate((const void *)SetSystemUIMode, (const void *)emptySetSystemUIMode); + //originalSetSystemUIMode = APEPatchCreate((const void *)SetSystemUIMode, (const void *)emptySetSystemUIMode); setDesktopMode(false); @@ -92,9 +93,9 @@ void UBPlatformUtils::init() void UBPlatformUtils::setDesktopMode(bool desktop) -{ +{ /* #ifndef OS_NEWER_THAN_OR_EQUAL_TO_1010 - OSStatus (*functor)(SystemUIMode, SystemUIOptions) = (OSStatus (*)(SystemUIMode, SystemUIOptions))originalSetSystemUIMode; + //OSStatus (*functor)(SystemUIMode, SystemUIOptions) = (OSStatus (*)(SystemUIMode, SystemUIOptions))originalSetSystemUIMode; if (desktop) { @@ -105,6 +106,7 @@ void UBPlatformUtils::setDesktopMode(bool desktop) functor(kUIModeAllHidden, 0); } #endif +*/ } @@ -533,13 +535,16 @@ void UBPlatformUtils::SetMacLocaleByIdentifier(const QString& id) { NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; - const char * strName = id.toAscii().data(); + const char * strName = id.toLatin1().data(); + + CFStringRef iName = CFStringCreateWithCString(NULL, strName, kCFStringEncodingISOLatin1 ); - CFStringRef iName = CFStringCreateWithCString(NULL, strName, kCFStringEncodingMacRoman ); CFStringRef keys[] = { kTISPropertyInputSourceCategory, kTISPropertyInputSourceID }; CFStringRef values[] = { kTISCategoryKeyboardInputSource, iName }; CFDictionaryRef dict = CFDictionaryCreate(NULL, (const void **)keys, (const void **)values, 2, NULL, NULL); + + // get list of current enabled keyboard layouts. dict filters the list CFArrayRef kbds = TISCreateInputSourceList(dict, true); if (kbds!=NULL) { @@ -552,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 +} diff --git a/src/frameworks/UBPlatformUtils_win.cpp b/src/frameworks/UBPlatformUtils_win.cpp index 1d46586a..ed698a39 100644 --- a/src/frameworks/UBPlatformUtils_win.cpp +++ b/src/frameworks/UBPlatformUtils_win.cpp @@ -424,3 +424,7 @@ QString UBPlatformUtils::urlFromClipboard() // Not implemented yet return qsRet; } + +void UBPlatformUtils::setFrontProcess() +{ +} diff --git a/src/gui/UBFloatingPalette.cpp b/src/gui/UBFloatingPalette.cpp index 749320c2..0aa19233 100644 --- a/src/gui/UBFloatingPalette.cpp +++ b/src/gui/UBFloatingPalette.cpp @@ -60,7 +60,7 @@ UBFloatingPalette::UBFloatingPalette(Qt::Corner position, QWidget *parent) #endif #ifdef Q_OS_OSX setAttribute(Qt::WA_MacAlwaysShowToolWindow); - setAttribute(Qt::WA_MacNonActivatingToolWindow); + //setAttribute(Qt::WA_MacNonActivatingToolWindow); // no longer exists setAttribute(Qt::WA_MacNoShadow); #endif } diff --git a/src/gui/UBKeyboardPalette_mac.cpp b/src/gui/UBKeyboardPalette_mac.mm similarity index 98% rename from src/gui/UBKeyboardPalette_mac.cpp rename to src/gui/UBKeyboardPalette_mac.mm index 401242bb..f5d12959 100644 --- a/src/gui/UBKeyboardPalette_mac.cpp +++ b/src/gui/UBKeyboardPalette_mac.mm @@ -30,7 +30,9 @@ #include #include #include -#include + +#import +#import #include #include @@ -74,6 +76,7 @@ void UBKeyboardPalette::createCtrlButtons() void UBKeyboardPalette::checkLayout() { + TISInputSourceRef selectedLocale = TISCopyCurrentKeyboardInputSource(); CFStringRef sr = (CFStringRef) TISGetInputSourceProperty(selectedLocale, @@ -96,6 +99,7 @@ void UBKeyboardPalette::checkLayout() } } } + } void UBKeyboardPalette::onActivated(bool) diff --git a/src/gui/UBMagnifer.cpp b/src/gui/UBMagnifer.cpp index b6ce41cf..0d492655 100644 --- a/src/gui/UBMagnifer.cpp +++ b/src/gui/UBMagnifer.cpp @@ -85,7 +85,7 @@ UBMagnifier::UBMagnifier(QWidget *parent, bool isInteractive) #endif #ifdef Q_OS_OSX setAttribute(Qt::WA_MacAlwaysShowToolWindow); - setAttribute(Qt::WA_MacNonActivatingToolWindow); + //setAttribute(Qt::WA_MacNonActivatingToolWindow); setAttribute(Qt::WA_MacNoShadow); #endif } diff --git a/src/gui/UBRubberBand.cpp b/src/gui/UBRubberBand.cpp index a6c36e98..8fdd3117 100644 --- a/src/gui/UBRubberBand.cpp +++ b/src/gui/UBRubberBand.cpp @@ -31,15 +31,11 @@ #include #include -#ifdef Q_OS_OSX -#include -#endif - -#include "core/UBApplication.h" -#include "board/UBBoardController.h" #include "board/UBBoardView.h" #include "core/memcheck.h" +#include "core/UBApplication.h" +#include "board/UBBoardController.h" UBRubberBand::UBRubberBand(Shape s, QWidget * p) : QRubberBand(s, p) @@ -53,7 +49,7 @@ UBRubberBand::UBRubberBand(Shape s, QWidget * p) #ifdef Q_OS_WIN customStyle = new QWindowsXPStyle(); #elif defined(Q_OS_OSX) - customStyle = new QMacStyle(); + customStyle = QStyleFactory::create("macintosh"); #elif defined(Q_OS_LINUX) customStyle = QStyleFactory::create("oxygen"); #endif diff --git a/src/gui/gui.pri b/src/gui/gui.pri index dd1fd260..38f5f654 100644 --- a/src/gui/gui.pri +++ b/src/gui/gui.pri @@ -85,7 +85,8 @@ SOURCES += src/gui/UBThumbnailView.cpp \ src/gui/UBOpenSankoreImporterWidget.cpp \ src/gui/UBStartupHintsPalette.cpp win32:SOURCES += src/gui/UBKeyboardPalette_win.cpp -macx:SOURCES += src/gui/UBKeyboardPalette_mac.cpp +macx:OBJECTIVE_SOURCES += src/gui/UBKeyboardPalette_mac.mm linux-g++:SOURCES += src/gui/UBKeyboardPalette_linux.cpp linux-g++-32:SOURCES += src/gui/UBKeyboardPalette_linux.cpp linux-g++-64:SOURCES += src/gui/UBKeyboardPalette_linux.cpp + diff --git a/src/podcast/UBPodcastController.cpp b/src/podcast/UBPodcastController.cpp index 12641434..45a5e435 100644 --- a/src/podcast/UBPodcastController.cpp +++ b/src/podcast/UBPodcastController.cpp @@ -59,9 +59,9 @@ #ifdef Q_OS_WIN #include "windowsmedia/UBWindowsMediaVideoEncoder.h" #include "windowsmedia/UBWaveRecorder.h" -#elif defined(Q_OS_OSX) - #include "quicktime/UBQuickTimeVideoEncoder.h" - #include "quicktime/UBAudioQueueRecorder.h" +//#elif defined(Q_OS_OSX) +// #include "quicktime/UBQuickTimeVideoEncoder.h" +// #include "quicktime/UBAudioQueueRecorder.h" #endif #include "core/memcheck.h" @@ -305,8 +305,8 @@ void UBPodcastController::start() #ifdef Q_OS_WIN mVideoEncoder = new UBWindowsMediaVideoEncoder(this); //deleted on stop -#elif defined(Q_OS_OSX) - mVideoEncoder = new UBQuickTimeVideoEncoder(this); //deleted on stop +//#elif defined(Q_OS_OSX) +// mVideoEncoder = new UBQuickTimeVideoEncoder(this); //deleted on stop #endif if (mVideoEncoder) @@ -795,8 +795,8 @@ QStringList UBPodcastController::audioRecordingDevices() #ifdef Q_OS_WIN devices = UBWaveRecorder::waveInDevices(); -#elif defined(Q_OS_OSX) - devices = UBAudioQueueRecorder::waveInDevices(); +//#elif defined(Q_OS_OSX) +// devices = UBAudioQueueRecorder::waveInDevices(); #endif return devices; diff --git a/src/podcast/podcast.pri b/src/podcast/podcast.pri index 88943d78..d6d5aa94 100644 --- a/src/podcast/podcast.pri +++ b/src/podcast/podcast.pri @@ -22,13 +22,13 @@ win32 { src/podcast/windowsmedia/UBWaveRecorder.h } -macx { +#macx { - SOURCES += src/podcast/quicktime/UBQuickTimeVideoEncoder.cpp \ - src/podcast/quicktime/UBQuickTimeFile.cpp \ - src/podcast/quicktime/UBAudioQueueRecorder.cpp +# SOURCES += src/podcast/quicktime/UBQuickTimeVideoEncoder.cpp \ +# src/podcast/quicktime/UBQuickTimeFile.cpp \ +# src/podcast/quicktime/UBAudioQueueRecorder.cpp - HEADERS += src/podcast/quicktime/UBQuickTimeVideoEncoder.h \ - src/podcast/quicktime/UBQuickTimeFile.h \ - src/podcast/quicktime/UBAudioQueueRecorder.h -} \ No newline at end of file +# HEADERS += src/podcast/quicktime/UBQuickTimeVideoEncoder.h \ +# src/podcast/quicktime/UBQuickTimeFile.h \ +# src/podcast/quicktime/UBAudioQueueRecorder.h +#}