From e79ed88589f07876959e1a6f31be190d3786d061 Mon Sep 17 00:00:00 2001 From: Aleksei Kanash Date: Wed, 23 May 2012 12:41:19 +0300 Subject: [PATCH 1/6] Locked media items is not movable now. Locked items cannot be moved horizontally by its frame. Text items can be resized correctly now. --- src/domain/UBGraphicsDelegateFrame.cpp | 6 +++--- src/domain/UBGraphicsMediaItem.cpp | 11 +++-------- 2 files changed, 6 insertions(+), 11 deletions(-) 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; From c4f97bafedfde3a0c5cac96a2971ada69b21d62f Mon Sep 17 00:00:00 2001 From: Aleksei Kanash Date: Wed, 30 May 2012 17:05:35 +0300 Subject: [PATCH 2/6] Added Subdirs.pro. It allows us to build Sankore with it's plugins as one project. We can add Third-Party to it later. Changed cffAdaptor. Now generated library will be copyed to Sankore3.1 folder undwe windows and to Sankore3.1.app/Contents/MacOS folder under macx. Added postScript_mac.sh for copying libs under mac. Changed Sankore_3.1.pro - now all files placed in groups by it's place in project folders. --- Sankore_3.1.pro | 1 + Subdirs.pro | 34 ++++++++++++++++++++++++++++ plugins/cffadaptor/UBCFFAdaptor.pro | 13 ++++++++--- plugins/cffadaptor/postScript_mac.sh | 5 ++++ 4 files changed, 50 insertions(+), 3 deletions(-) create mode 100644 Subdirs.pro create mode 100644 plugins/cffadaptor/postScript_mac.sh diff --git a/Sankore_3.1.pro b/Sankore_3.1.pro index 5620eb7b..2fa4818d 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 diff --git a/Subdirs.pro b/Subdirs.pro new file mode 100644 index 00000000..8be79c88 --- /dev/null +++ b/Subdirs.pro @@ -0,0 +1,34 @@ +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 + +SUBDIRS += $$SANKORE_PRO + +if(exists($$PLUGIN_CFF_ADAPTOR_DIR)){ + SUBDIRS += $$PLUGIN_CFF_ADAPTOR_PRO + $$SANKORE_PRO.depends = $$PLUGIN_CFF_ADAPTOR_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 From 5047ab2d2b96dc3349bb9b864aa632a54d3b9ff9 Mon Sep 17 00:00:00 2001 From: Aleksei Kanash Date: Thu, 31 May 2012 09:41:58 +0300 Subject: [PATCH 3/6] Disabled using: framework AppKit framework WebKit It solves crashes JS on MAC with Qt 4.8. It was been used for parse urls from Safari. It seems to now that code is useless, so ti is disabled for a testing. --- Sankore_3.1.pro | 5 +++-- src/frameworks/UBPlatformUtils_mac.mm | 9 +++++++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/Sankore_3.1.pro b/Sankore_3.1.pro index 2fa4818d..3786f0b3 100644 --- a/Sankore_3.1.pro +++ b/Sankore_3.1.pro @@ -134,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/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; } From 50aea07ab600476a562f25dde1bceffbc98aeb23 Mon Sep 17 00:00:00 2001 From: Aleksei Kanash Date: Thu, 31 May 2012 10:07:16 +0300 Subject: [PATCH 4/6] Fix to build order. Actual for linux. --- Subdirs.pro | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Subdirs.pro b/Subdirs.pro index 8be79c88..78497229 100644 --- a/Subdirs.pro +++ b/Subdirs.pro @@ -23,12 +23,11 @@ SANKORE_PLUGINS_DIR = $$SANKORE_DIR/plugins PLUGIN_CFF_ADAPTOR_DIR = $$SANKORE_PLUGINS_DIR/cffadaptor PLUGIN_CFF_ADAPTOR_PRO = $$PLUGIN_CFF_ADAPTOR_DIR/UBCFFAdaptor.pro -SUBDIRS += $$SANKORE_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 From 19a3a78ed2eedb5e4143f57fbeff84c940faec5a Mon Sep 17 00:00:00 2001 From: Aleksei Kanash Date: Thu, 31 May 2012 11:22:26 +0300 Subject: [PATCH 5/6] Fix to SANKORE-640 (Document explorer(navigator):Folders can not be selected) --- src/document/UBDocumentController.cpp | 3 +++ 1 file changed, 3 insertions(+) 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(); From 9ac508f979040f441ab6c0e47448bbf49360f37e Mon Sep 17 00:00:00 2001 From: Aleksei Kanash Date: Thu, 31 May 2012 13:40:21 +0300 Subject: [PATCH 6/6] WebTools palette hides after switching mode from Internet to any other. --- src/board/UBBoardPaletteManager.cpp | 9 +++++++++ src/board/UBBoardPaletteManager.h | 4 ++++ src/web/UBWebController.cpp | 2 +- 3 files changed, 14 insertions(+), 1 deletion(-) 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/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()),