diff --git a/.qmake.stash b/.qmake.stash deleted file mode 100644 index d6e97efd..00000000 --- a/.qmake.stash +++ /dev/null @@ -1,23 +0,0 @@ -QMAKE_CXX.QT_COMPILER_STDCXX = 201402L -QMAKE_CXX.QMAKE_GCC_MAJOR_VERSION = 9 -QMAKE_CXX.QMAKE_GCC_MINOR_VERSION = 3 -QMAKE_CXX.QMAKE_GCC_PATCH_VERSION = 0 -QMAKE_CXX.COMPILER_MACROS = \ - QT_COMPILER_STDCXX \ - QMAKE_GCC_MAJOR_VERSION \ - QMAKE_GCC_MINOR_VERSION \ - QMAKE_GCC_PATCH_VERSION -QMAKE_CXX.INCDIRS = \ - /usr/include/c++/9 \ - /usr/include/x86_64-linux-gnu/c++/9 \ - /usr/include/c++/9/backward \ - /usr/lib/gcc/x86_64-linux-gnu/9/include \ - /usr/local/include \ - /usr/include/x86_64-linux-gnu \ - /usr/include -QMAKE_CXX.LIBDIRS = \ - /usr/lib/gcc/x86_64-linux-gnu/9 \ - /usr/lib/x86_64-linux-gnu \ - /usr/lib \ - /lib/x86_64-linux-gnu \ - /lib diff --git a/src/board/UBBoardController.cpp b/src/board/UBBoardController.cpp index 62dcd073..8ba62e58 100644 --- a/src/board/UBBoardController.cpp +++ b/src/board/UBBoardController.cpp @@ -2020,7 +2020,7 @@ void UBBoardController::persistCurrentScene(bool isAnAutomaticBackup, bool force && (mActiveSceneIndex >= 0) && mActiveSceneIndex != mMovingSceneIndex && (mActiveScene->isModified())) { - UBPersistenceManager::persistenceManager()->persistDocumentScene(selectedDocument(), mActiveScene, mActiveSceneIndex); + UBPersistenceManager::persistenceManager()->persistDocumentScene(selectedDocument(), mActiveScene, mActiveSceneIndex, isAnAutomaticBackup); updatePage(mActiveSceneIndex); } } diff --git a/src/core/UBDisplayManager.cpp b/src/core/UBDisplayManager.cpp index cd9db4ec..f24e9211 100644 --- a/src/core/UBDisplayManager.cpp +++ b/src/core/UBDisplayManager.cpp @@ -180,7 +180,7 @@ void UBDisplayManager::setDisplayWidget(QWidget* pDisplayWidget) } mDisplayWidget = pDisplayWidget; mDisplayWidget->setGeometry(mDesktop->screenGeometry(mDisplayScreenIndex)); - if (UBSettings::settings()->appUseMultiscreen->get().toBool()) + if (numScreens() > 1 && UBSettings::settings()->appUseMultiscreen->get().toBool()) UBPlatformUtils::showFullScreen(mDisplayWidget); } } diff --git a/src/core/UBPersistenceManager.cpp b/src/core/UBPersistenceManager.cpp index 70a6ceb8..a53342a4 100644 --- a/src/core/UBPersistenceManager.cpp +++ b/src/core/UBPersistenceManager.cpp @@ -931,11 +931,12 @@ void UBPersistenceManager::reassignDocProxy(UBDocumentProxy *newDocument, UBDocu return mSceneCache.reassignDocProxy(newDocument, oldDocument); } -void UBPersistenceManager::persistDocumentScene(UBDocumentProxy* pDocumentProxy, UBGraphicsScene* pScene, const int pSceneIndex) +void UBPersistenceManager::persistDocumentScene(UBDocumentProxy* pDocumentProxy, UBGraphicsScene* pScene, const int pSceneIndex, bool isAnAutomaticBackup) { checkIfDocumentRepositoryExists(); - pScene->deselectAllItems(); + if (!isAnAutomaticBackup) + pScene->deselectAllItems(); generatePathIfNeeded(pDocumentProxy); diff --git a/src/core/UBPersistenceManager.h b/src/core/UBPersistenceManager.h index 93492def..8a1462ce 100644 --- a/src/core/UBPersistenceManager.h +++ b/src/core/UBPersistenceManager.h @@ -103,8 +103,7 @@ class UBPersistenceManager : public QObject virtual void copyDocumentScene(UBDocumentProxy *from, int fromIndex, UBDocumentProxy *to, int toIndex); - virtual void persistDocumentScene(UBDocumentProxy* pDocumentProxy, - UBGraphicsScene* pScene, const int pSceneIndex); + virtual void persistDocumentScene(UBDocumentProxy* pDocumentProxy, UBGraphicsScene* pScene, const int pSceneIndex, bool isAnAutomaticBackup = false); virtual UBGraphicsScene* createDocumentSceneAt(UBDocumentProxy* pDocumentProxy, int index, bool useUndoRedoStack = true); diff --git a/src/document/UBDocumentContainer.cpp b/src/document/UBDocumentContainer.cpp index 456c37a7..481a415a 100644 --- a/src/document/UBDocumentContainer.cpp +++ b/src/document/UBDocumentContainer.cpp @@ -106,7 +106,6 @@ void UBDocumentContainer::addPage(int index) void UBDocumentContainer::addPixmapAt(const QPixmap *pix, int index) { mDocumentThumbs.insert(index, pix); - emit documentThumbnailsUpdated(this); } diff --git a/src/document/UBDocumentController.cpp b/src/document/UBDocumentController.cpp index dffa1be2..22eda173 100644 --- a/src/document/UBDocumentController.cpp +++ b/src/document/UBDocumentController.cpp @@ -664,7 +664,7 @@ QMimeData *UBDocumentTreeModel::mimeData (const QModelIndexList &indexes) const #if defined(Q_OS_OSX) #if (QT_VERSION < QT_VERSION_CHECK(5, 15, 0)) - if (QOperatingSystemVersion::current().minorVersion() < 15) /* < Mojave */ + if (QOperatingSystemVersion::current().majorVersion() == 10 && QOperatingSystemVersion::current().minorVersion() < 15) /* <= Mojave */ mimeData->setUrls(urlList); #endif #else @@ -1548,7 +1548,6 @@ void UBDocumentTreeView::dropEvent(QDropEvent *event) const QPixmap *pix = new QPixmap(thumbTmp); UBDocumentController *ctrl = UBApplication::documentController; ctrl->addPixmapAt(pix, toIndex); - ctrl->TreeViewSelectionChanged(ctrl->firstSelectedTreeIndex(), QModelIndex()); } QApplication::restoreOverrideCursor(); @@ -1557,6 +1556,8 @@ void UBDocumentTreeView::dropEvent(QDropEvent *event) docModel->setHighLighted(QModelIndex()); } + UBApplication::documentController->TreeViewSelectionChanged(UBApplication::documentController->firstSelectedTreeIndex(), QModelIndex()); + } else { diff --git a/src/domain/UBGraphicsScene.cpp b/src/domain/UBGraphicsScene.cpp index 5b5c59e8..0336a63c 100644 --- a/src/domain/UBGraphicsScene.cpp +++ b/src/domain/UBGraphicsScene.cpp @@ -2380,6 +2380,9 @@ void UBGraphicsScene::changeMagnifierMode(int mode) { if(magniferControlViewWidget) magniferControlViewWidget->setDrawingMode(mode); + + if(magniferDisplayViewWidget) + magniferDisplayViewWidget->setDrawingMode(mode); } void UBGraphicsScene::resizedMagnifier(qreal newPercent) diff --git a/src/frameworks/UBPlatformUtils_mac.mm b/src/frameworks/UBPlatformUtils_mac.mm index ae5c5956..fa43bcb1 100644 --- a/src/frameworks/UBPlatformUtils_mac.mm +++ b/src/frameworks/UBPlatformUtils_mac.mm @@ -31,6 +31,7 @@ #include "core/UBApplication.h" #include "core/UBSettings.h" #include "frameworks/UBFileSystemUtils.h" +#include "gui/UBMainWindow.h" #include @@ -622,35 +623,93 @@ void UBPlatformUtils::showFullScreen(QWidget *pWidget) void UBPlatformUtils::showOSK(bool show) { - @autoreleasepool { - CFDictionaryRef properties = (CFDictionaryRef)[NSDictionary - dictionaryWithObject: @"com.apple.KeyboardViewer" - forKey: (NSString *)kTISPropertyInputSourceID]; + if (QOperatingSystemVersion::current().majorVersion() == 10 && QOperatingSystemVersion::current().minorVersion() < 15) /* < Catalina */ + { + @autoreleasepool { + CFDictionaryRef properties = (CFDictionaryRef)[NSDictionary + dictionaryWithObject: @"com.apple.keyboardViewer" + forKey: (NSString *)kTISPropertyInputSourceID]; - NSArray *sources = (NSArray *)TISCreateInputSourceList(properties, true); + NSArray *sources = (NSArray *)TISCreateInputSourceList(properties, true); - if ([sources count] > 0) { - TISInputSourceRef osk = (TISInputSourceRef)[sources objectAtIndex: 0]; + if ([sources count] > 0) { + TISInputSourceRef osk = (TISInputSourceRef)[sources objectAtIndex: 0]; - OSStatus result; - if (show) { - TISEnableInputSource(osk); - result = TISSelectInputSource(osk); - } - else { - TISDisableInputSource(osk); - result = TISDeselectInputSource(osk); + OSStatus result; + if (show) { + TISEnableInputSource(osk); + result = TISSelectInputSource(osk); + } + else { + TISDisableInputSource(osk); + result = TISDeselectInputSource(osk); + } + + if (result == paramErr) { + qWarning() << "Unable to select input source"; + UBApplication::showMessage(tr("Unable to activate system on-screen keyboard")); + } } - if (result == paramErr) { - qWarning() << "Unable to select input source"; - UBApplication::showMessage(tr("Unable to activate system on-screen keyboard")); + else { + qWarning() << "System OSK not found"; + UBApplication::showMessage(tr("System on-screen keyboard not found")); } } + } + else + { + NSString *source = + @"tell application \"System Events\"\n\ + if application process \"TextInputMenuAgent\" exists then\n\ + tell application process \"TextInputMenuAgent\"\n\ + tell menu bar item 1 of menu bar 2\n\ + ignoring application responses\n\ + click\n\ + end ignoring\n\ + end tell\n\ + end tell\n\ + end if\n\ + end tell\n\ + do shell script \"killall 'System Events'\"\n"; + + source = [source stringByAppendingString:@"if application \"Assistive Control\" is"]; + + if (show) + { + source = [source stringByAppendingString:@" not"]; + } - else { - qWarning() << "System OSK not found"; - UBApplication::showMessage(tr("System on-screen keyboard not found")); + source = [source stringByAppendingString:@" running then\n\ + tell application \"System Events\"\n\ + tell application process \"TextInputMenuAgent\"\n\ + tell menu 1 of menu bar item 1 of menu bar 2\n\ + click menu item 2\n\ + end tell\n\ + end tell\n\ + end tell\n\ + end if"]; + + NSAppleScript *script = [[[NSAppleScript alloc] initWithSource:source] autorelease]; + NSDictionary *errorInfo = nil; + [script executeAndReturnError:&errorInfo]; + + if(errorInfo!=nil) + { + NSAlert *alert = [[NSAlert alloc] init]; + + if (alert != nil) + { + alert.messageText = errorInfo.allValues[0]; + [alert runModal]; + [alert release]; + + //restore action state to previous one as it failed + if (show) + UBApplication::mainWindow->actionVirtualKeyboard->setChecked(false); + else + UBApplication::mainWindow->actionVirtualKeyboard->setChecked(true); + } } } }