diff --git a/Sankore_3.1.pro b/Sankore_3.1.pro index 5620eb7b..3786f0b3 100644 --- a/Sankore_3.1.pro +++ b/Sankore_3.1.pro @@ -3,6 +3,7 @@ TEMPLATE = app THIRD_PARTY_PATH=../Sankore-ThirdParty +CONFIG -= flat CONFIG += debug_and_release \ no_include_pwd @@ -133,8 +134,9 @@ win32 { macx { LIBS += -framework Foundation LIBS += -lcrypto - LIBS += -framework AppKit - LIBS += -framework WebKit + #commented because Sankore crashes on Java Script. It seems to backends dependencies. + #LIBS += -framework AppKit + #LIBS += -framework WebKit CONFIG(release, debug|release):CONFIG += x86 diff --git a/Subdirs.pro b/Subdirs.pro new file mode 100644 index 00000000..78497229 --- /dev/null +++ b/Subdirs.pro @@ -0,0 +1,33 @@ +TEMPLATE = subdirs +CONFIG += recursive +CONFIG += debug_and_release + +win32: SUB_DIR = win32 +macx: SUB_DIR = macx +linux-g++: SUB_DIR = linux +linux-g++-32: SUB_DIR = linux +linux-g++-64: SUB_DIR = linux + +BUILD_DIR = build/$$SUB_DIR + +CONFIG(debug, debug|release):BUILD_DIR = $$BUILD_DIR/debug +CONFIG(release, debug|release) { + BUILD_DIR = $$BUILD_DIR/release + CONFIG += warn_off +} + +SANKORE_DIR = $$PWD +SANKORE_PRO = $$SANKORE_DIR/Sankore_3.1.pro +THIRD_PARTY_DIR = $$PWD/Sankore-ThirdParty +SANKORE_PLUGINS_DIR = $$SANKORE_DIR/plugins +PLUGIN_CFF_ADAPTOR_DIR = $$SANKORE_PLUGINS_DIR/cffadaptor +PLUGIN_CFF_ADAPTOR_PRO = $$PLUGIN_CFF_ADAPTOR_DIR/UBCFFAdaptor.pro + +if(exists($$PLUGIN_CFF_ADAPTOR_DIR)){ + SUBDIRS += $$PLUGIN_CFF_ADAPTOR_PRO + $$SANKORE_PRO.depends = $$PLUGIN_CFF_ADAPTOR_PRO +} +SUBDIRS += $$SANKORE_PRO + +recurse_target = $$SANKORE_PRO + diff --git a/plugins/cffadaptor/UBCFFAdaptor.pro b/plugins/cffadaptor/UBCFFAdaptor.pro index 079de115..f8214d5d 100644 --- a/plugins/cffadaptor/UBCFFAdaptor.pro +++ b/plugins/cffadaptor/UBCFFAdaptor.pro @@ -16,7 +16,7 @@ linux-g++-64: SUB_DIR = linux THIRD_PARTY_PATH = ../../../Sankore-ThirdParty QUAZIP_DIR = "$$PWD/../../../Sankore-ThirdParty/quazip/quazip-0.3" -BUILD_DIR = $$PWD/build/$$SUB_DIR +BUILD_DIR = build/$$SUB_DIR CONFIG(debug, debug|release):BUILD_DIR = $$BUILD_DIR/debug CONFIG(release, debug|release) { BUILD_DIR = $$BUILD_DIR/release @@ -31,12 +31,19 @@ OBJECTS_DIR = $$BUILD_DIR/objects MOC_DIR = $$BUILD_DIR/moc DESTDIR = $$BUILD_DIR/lib RCC_DIR = $$BUILD_DIR/rcc +SANKORE_DIR = ../.. +win32:{ + QMAKE_POST_LINK += copy $$replace(DESTDIR,/,\\)\\CFF_Adaptor.dll" $$replace(SANKORE_DIR,/,\\)\\CFF_Adaptor.dll /y" +} +macx:{ + QMAKE_POST_LINK += bash postScript_mac.sh "$$DESTDIR" "$$SANKORE_DIR/$$BUILD_DIR/product/Open-Sankore.app/Contents/MacOS" +} LIBS += "-L$$THIRD_PARTY_PATH/quazip/lib/$$SUB_DIR" "-lquazip" QT += xml xmlpatterns core QT += gui -QT += svg +QT += svg DEFINES += UBCFFADAPTOR_LIBRARY @@ -59,4 +66,4 @@ HEADERS +=\ src/UBCFFConstants.h RESOURCES += \ - resources/resources.qrc + resources/resources.qrc \ No newline at end of file diff --git a/plugins/cffadaptor/postScript_mac.sh b/plugins/cffadaptor/postScript_mac.sh new file mode 100644 index 00000000..dfe0fb63 --- /dev/null +++ b/plugins/cffadaptor/postScript_mac.sh @@ -0,0 +1,5 @@ +#!/bin/bash +SOURCE=$1 +DESTINATION=$2 +mkdir -p $DESTINATION +cp -R $SOURCE/ $DESTINATION \ No newline at end of file diff --git a/src/board/UBBoardPaletteManager.cpp b/src/board/UBBoardPaletteManager.cpp index 2173de6b..ca124809 100644 --- a/src/board/UBBoardPaletteManager.cpp +++ b/src/board/UBBoardPaletteManager.cpp @@ -29,6 +29,7 @@ #include "gui/UBKeyboardPalette.h" #include "gui/UBToolWidget.h" #include "gui/UBZoomPalette.h" +#include "gui/UBWebToolsPalette.h" #include "gui/UBActionPalette.h" #include "gui/UBFavoriteToolPalette.h" #include "gui/UBDockTeacherGuideWidget.h" @@ -73,6 +74,7 @@ UBBoardPaletteManager::UBBoardPaletteManager(QWidget* container, UBBoardControll , mRightPalette(NULL) , mBackgroundsPalette(0) , mToolsPalette(0) + , mWebToolsCurrentPalette(0) , mAddItemPalette(0) , mErasePalette(NULL) , mPagePalette(NULL) @@ -683,6 +685,8 @@ void UBBoardPaletteManager::changeMode(eUBDockPaletteWidgetMode newMode, bool is if( !isInit ) containerResized(); + if (mWebToolsCurrentPalette) + mWebToolsCurrentPalette->hide(); } break; @@ -723,6 +727,9 @@ void UBBoardPaletteManager::changeMode(eUBDockPaletteWidgetMode newMode, bool is if( !isInit ) UBApplication::applicationController->uninotesController()->TransparentWidgetResized(); + + if (mWebToolsCurrentPalette) + mWebToolsCurrentPalette->hide(); } break; @@ -764,6 +771,8 @@ void UBBoardPaletteManager::changeMode(eUBDockPaletteWidgetMode newMode, bool is else mKeyboardPalette->setParent(UBApplication::documentController->controlView()); } + if (mWebToolsCurrentPalette) + mWebToolsCurrentPalette->hide(); } break; diff --git a/src/board/UBBoardPaletteManager.h b/src/board/UBBoardPaletteManager.h index 86ef4355..cdb02870 100644 --- a/src/board/UBBoardPaletteManager.h +++ b/src/board/UBBoardPaletteManager.h @@ -30,6 +30,7 @@ #include "gui/UBFeaturesWidget.h" +class UBWebToolsPalette; class UBStylusPalette; class UBClockPalette; class UBPageNumberPalette; @@ -66,6 +67,9 @@ class UBBoardPaletteManager : public QObject UBKeyboardPalette *mKeyboardPalette; + void setCurrentWebToolsPalette(UBWebToolsPalette *palette) {mWebToolsCurrentPalette = palette;} + UBWebToolsPalette* mWebToolsCurrentPalette; + void processPalettersWidget(UBDockPalette *paletter, eUBDockPaletteWidgetMode mode); void changeMode(eUBDockPaletteWidgetMode newMode, bool isInit = false); void startDownloads(); diff --git a/src/document/UBDocumentController.cpp b/src/document/UBDocumentController.cpp index 96650d07..7f7bf5a3 100644 --- a/src/document/UBDocumentController.cpp +++ b/src/document/UBDocumentController.cpp @@ -122,6 +122,9 @@ UBDocumentProxyTreeItem* UBDocumentController::findDocument(UBDocumentProxy* pro void UBDocumentController::selectDocument(UBDocumentProxy* proxy, bool setAsCurrentDocument) { + if (!proxy) + return; + QTreeWidgetItemIterator it(mDocumentUI->documentTreeWidget); mDocumentUI->documentTreeWidget->clearSelection(); diff --git a/src/domain/UBGraphicsDelegateFrame.cpp b/src/domain/UBGraphicsDelegateFrame.cpp index f5ad3016..3270abf9 100644 --- a/src/domain/UBGraphicsDelegateFrame.cpp +++ b/src/domain/UBGraphicsDelegateFrame.cpp @@ -249,6 +249,9 @@ bool UBGraphicsDelegateFrame::canResizeBottomRight(qreal width, qreal height, qr void UBGraphicsDelegateFrame::mouseMoveEvent(QGraphicsSceneMouseEvent *event) { + if (mDelegate->delegated()->data(UBGraphicsItemData::ItemLocked).toBool()) + return; + QLineF move(mStartingPoint, event->scenePos()); qreal moveX = move.length() * cos((move.angle() - mAngle) * PI / 180); qreal moveY = -move.length() * sin((move.angle() - mAngle) * PI / 180); @@ -390,9 +393,6 @@ void UBGraphicsDelegateFrame::mouseMoveEvent(QGraphicsSceneMouseEvent *event) QSizeF newSize = resizableItem->size() + incVector; - if (!(mDelegate->getToolBarItem()->isVisibleOnBoard() - && (newSize.width() < mDelegate->getToolBarItem()->minWidth() / mDelegate->antiScaleRatio() - || newSize.height() < mDelegate->getToolBarItem()->minWidth() / mDelegate->antiScaleRatio() * 3/4))) resizableItem->resize(newSize); } } diff --git a/src/domain/UBGraphicsMediaItem.cpp b/src/domain/UBGraphicsMediaItem.cpp index 8a25a217..08c8bd52 100644 --- a/src/domain/UBGraphicsMediaItem.cpp +++ b/src/domain/UBGraphicsMediaItem.cpp @@ -223,14 +223,6 @@ UBItem* UBGraphicsMediaItem::deepCopy() const void UBGraphicsMediaItem::mousePressEvent(QGraphicsSceneMouseEvent *event) { -// QDrag* mDrag = new QDrag(event->widget()); -// QMimeData* pMime = new QMimeData(); -// mDrag->setMimeData(pMime); -// mDrag->start(); - -// UBApplication::boardController->activeScene()->setActiveItem(this); - - if (mDelegate) { mDelegate->mousePressEvent(event); @@ -279,6 +271,9 @@ void UBGraphicsMediaItem::mousePressEvent(QGraphicsSceneMouseEvent *event) void UBGraphicsMediaItem::mouseMoveEvent(QGraphicsSceneMouseEvent *event) { + if (data(UBGraphicsItemData::ItemLocked).toBool()) + return; + if(mShouldMove && (event->buttons() & Qt::LeftButton)) { QPointF offset = event->scenePos() - mMousePressPos; diff --git a/src/frameworks/UBPlatformUtils_mac.mm b/src/frameworks/UBPlatformUtils_mac.mm index 78f41d21..e94d254b 100644 --- a/src/frameworks/UBPlatformUtils_mac.mm +++ b/src/frameworks/UBPlatformUtils_mac.mm @@ -10,8 +10,12 @@ #import #import #import + +/* +// commented because Sankore crashes on Java Script. It seems to backends dependencies. #import #import +*/ NSString* bundleShortVersion(NSBundle *bundle) @@ -543,13 +547,14 @@ void UBPlatformUtils::destroyKeyboardLayouts() QString UBPlatformUtils::urlFromClipboard() { QString qsRet; - +/* + // commented because Sankore crashes on Java Script. It seems to backends dependencies. NSPasteboard* pPasteboard = [NSPasteboard pasteboardWithName:@"Apple CFPasteboard drag"]; WebArchive* pArchive = [[WebArchive alloc] initWithData:[pPasteboard dataForType:@"com.apple.webarchive"]]; qsRet = [[[[pArchive mainResource] URL] absoluteString] UTF8String]; [pArchive release]; - +*/ return qsRet; } diff --git a/src/web/UBWebController.cpp b/src/web/UBWebController.cpp index 2e975868..96a11de7 100644 --- a/src/web/UBWebController.cpp +++ b/src/web/UBWebController.cpp @@ -424,7 +424,7 @@ void UBWebController::setupPalettes() if(!(*mToolsCurrentPalette)) { (*mToolsCurrentPalette) = new UBWebToolsPalette(UBApplication::mainWindow, false); - + UBApplication::boardController->paletteManager()->setCurrentWebToolsPalette(*mToolsCurrentPalette); #ifndef Q_WS_WIN if (UBPlatformUtils::hasVirtualKeyboard() && UBApplication::boardController->paletteManager()->mKeyboardPalette) connect(UBApplication::boardController->paletteManager()->mKeyboardPalette, SIGNAL(closed()),