Commit 250951d5 authored by shibakaneki's avatar shibakaneki

Merge branch 'develop' into shiba-dev

parents 3fb1e75c 1b3a3a61
No preview for this file type
......@@ -11,7 +11,7 @@ CONFIG += debug_and_release \
VERSION_MAJ = 2
VERSION_MIN = 00
VERSION_TYPE = b # a = alpha, b = beta, r = release, other => error
VERSION_PATCH = 04
VERSION_PATCH = 05
VERSION = "$${VERSION_MAJ}.$${VERSION_MIN}.$${VERSION_TYPE}.$${VERSION_PATCH}"
VERSION = $$replace(VERSION, "\\.r", "")
......
......@@ -214,7 +214,7 @@ UBBoardView::keyPressEvent (QKeyEvent *event)
case Qt::Key_Control:
case Qt::Key_Shift:
{
mMultipleSelectionIsEnabled = true;
setMultiselection(true);
}break;
}
......@@ -274,6 +274,10 @@ UBBoardView::keyPressEvent (QKeyEvent *event)
}
}
}
// if ctrl of shift was pressed combined with other keys - we need to disable multiple selection.
if (event->isAccepted())
setMultiselection(false);
}
......@@ -284,7 +288,7 @@ void UBBoardView::keyReleaseEvent(QKeyEvent *event)
if (Qt::Key_Shift == event->key()
||Qt::Key_Control == event->key())
{
mMultipleSelectionIsEnabled = false;
setMultiselection(false);
}
}
......@@ -459,7 +463,7 @@ void UBBoardView::handleItemsSelection(QGraphicsItem *item)
// if we need to uwe multiple selection - we shouldn't deselect other items.
if (!mMultipleSelectionIsEnabled)
if (!isMultipleSelectionEnabled())
{
// here we need to determine what item is pressed. We should work
// only with UB items.
......@@ -520,14 +524,13 @@ Here we determines cases when items should to get mouse press event at pressing
break;
// Groups shouldn't reacts on any presses and moves for Play tool.
case UBGraphicsStrokesGroup::Type:
case UBGraphicsGroupContainerItem::Type:
if(currentTool == UBStylusTool::Play)
{
movingItem = NULL;
return false;
}
else
return true;
return false;
break;
case QGraphicsWebView::Type:
......@@ -570,10 +573,8 @@ bool UBBoardView::itemShouldReceiveSuspendedMousePressEvent(QGraphicsItem *item)
return true;
}
if (!dynamic_cast<UBGraphicsItem*>(item))
return true;
else
return false;
}
bool UBBoardView::itemShouldBeMoved(QGraphicsItem *item)
......@@ -631,8 +632,11 @@ QGraphicsItem* UBBoardView::determineItemToPress(QGraphicsItem *item)
if (item->parentItem() && UBGraphicsStrokesGroup::Type == item->type())
return item->parentItem();
// if item is on group and froup is not selected - group should take press.
if (UBStylusTool::Selector == currentTool && item->parentItem() && UBGraphicsGroupContainerItem::Type == item->parentItem()->type() && !item->parentItem()->isSelected())
// if item is on group and group is not selected - group should take press.
if (UBStylusTool::Selector == currentTool
&& item->parentItem()
&& UBGraphicsGroupContainerItem::Type == item->parentItem()->type()
&& !item->parentItem()->isSelected())
return item->parentItem();
// items like polygons placed in two groups nested, so we need to recursive call.
......@@ -690,11 +694,10 @@ void UBBoardView::handleItemMousePress(QMouseEvent *event)
// Determining item who will take mouse press event
//all other items will be deselected and if all item will be deselected, then
// wrong item can catch mouse press. because selected items placed on the top
QGraphicsItem *pressedItem = determineItemToPress(movingItem);
movingItem = determineItemToPress(movingItem);
handleItemsSelection(movingItem);
if (mMultipleSelectionIsEnabled)
if (isMultipleSelectionEnabled())
return;
if (itemShouldReceiveMousePressEvent(movingItem))
......@@ -792,6 +795,11 @@ void UBBoardView::moveRubberedItems(QPointF movingVector)
scene()->invalidate(invalidateRect);
}
void UBBoardView::setMultiselection(bool enable)
{
mMultipleSelectionIsEnabled = enable;
}
void UBBoardView::longPressEvent()
{
UBDrawingController *drawingController = UBDrawingController::drawingController();
......@@ -1087,12 +1095,15 @@ UBBoardView::mouseReleaseEvent (QMouseEvent *event)
UBGraphicsDelegateFrame::Type != movingItem->type() &&
UBToolWidget::Type != movingItem->type() &&
QGraphicsWebView::Type != movingItem->type() && // for W3C widgets as Tools.
!(movingItem->parentItem() && UBGraphicsW3CWidgetItem::Type == movingItem->type() && UBGraphicsGroupContainerItem::Type == movingItem->parentItem()->type()))
!(!isMultipleSelectionEnabled() && movingItem->parentItem() && UBGraphicsWidgetItem::Type == movingItem->type() && UBGraphicsGroupContainerItem::Type == movingItem->parentItem()->type()))
{
bReleaseIsNeed = false;
if (movingItem->isSelected() && mMultipleSelectionIsEnabled)
if (movingItem->isSelected() && isMultipleSelectionEnabled())
movingItem->setSelected(false);
else
if (movingItem->parentItem() && movingItem->parentItem()->isSelected() && isMultipleSelectionEnabled())
movingItem->parentItem()->setSelected(false);
else
{
if (movingItem->isSelected())
bReleaseIsNeed = true;
......@@ -1308,14 +1319,20 @@ void UBBoardView::dragMoveEvent(QDragMoveEvent *event)
void UBBoardView::dropEvent (QDropEvent *event)
{
if (!itemAt(event->pos().x(),event->pos().y())) {
if (!event->source() || dynamic_cast<UBThumbnailWidget *>(event->source()) || dynamic_cast<QWebView*>(event->source()) || dynamic_cast<UBTGMediaWidget*>(event->source()) || dynamic_cast<QListView *>(event->source()) || dynamic_cast<UBTGDraggableTreeItem*>(event->source())) {
QGraphicsItem *onItem = itemAt(event->pos().x(),event->pos().y());
if (onItem && onItem->type() == UBGraphicsWidgetItem::Type) {
QGraphicsView::dropEvent(event);
} else {
if (!event->source()
|| qobject_cast<UBThumbnailWidget *>(event->source())
|| qobject_cast<QWebView*>(event->source())
|| qobject_cast<UBTGMediaWidget*>(event->source())
|| qobject_cast<QListView *>(event->source())
|| qobject_cast<UBTGDraggableTreeItem*>(event->source())) {
mController->processMimeData (event->mimeData (), mapToScene (event->pos ()));
event->acceptProposedAction();
}
}
else
QGraphicsView::dropEvent(event);
}
void
......
......@@ -44,6 +44,9 @@ class UBBoardView : public QGraphicsView
void rubberItems();
void moveRubberedItems(QPointF movingVector);
void setMultiselection(bool enable);
bool isMultipleSelectionEnabled() { return mMultipleSelectionIsEnabled; }
signals:
void resized(QResizeEvent* event);
......
......@@ -582,6 +582,12 @@ bool UBApplication::eventFilter(QObject *obj, QEvent *event)
boardController->controlView()->forcedTabletRelease();
}
if (event->type() == QEvent::ApplicationActivate)
{
boardController->controlView()->setMultiselection(false);
}
#ifdef Q_WS_MAC
if (bIsMinimized && event->type() == QEvent::ApplicationActivate){
if (mainWindow->isHidden()) mainWindow->show();
......
......@@ -66,7 +66,7 @@ UBDesktopAnnotationController::UBDesktopAnnotationController(QObject *parent)
, mDesktopStylusTool(UBDrawingController::drawingController()->stylusTool())
{
mTransparentDrawingView = new UBBoardView(UBApplication::boardController, 0); // deleted in UBDesktopAnnotationController::destructor
mTransparentDrawingView = new UBBoardView(UBApplication::boardController, NULL, true); // deleted in UBDesktopAnnotationController::destructor
mTransparentDrawingView->setAttribute(Qt::WA_TranslucentBackground, true);
#ifdef Q_WS_MAC
......
......@@ -249,6 +249,11 @@ itemLayerType::Enum UBZLayerController::typeForData(QGraphicsItem *item) const
return result;
}
void UBZLayerController::setLayerType(QGraphicsItem *pItem, itemLayerType::Enum pNewType)
{
pItem->setData(UBGraphicsItemData::itemLayerType, QVariant(pNewType));
}
UBGraphicsScene::UBGraphicsScene(UBDocumentProxy* parent)
: UBCoreGraphicsScene(parent)
, mEraser(0)
......@@ -1637,8 +1642,6 @@ QGraphicsItem* UBGraphicsScene::setAsBackgroundObject(QGraphicsItem* item, bool
item->setAcceptedMouseButtons(Qt::NoButton);
item->setData(UBGraphicsItemData::ItemLayerType, UBItemLayerType::FixedBackground);
UBGraphicsItem::assignZValue(item, mZLayerController->generateZLevel(itemLayerType::BackgroundItem));
if (pAdaptTransformation)
{
item = scaleToFitDocumentSize(item, true, 0, pExpand);
......@@ -1647,6 +1650,9 @@ QGraphicsItem* UBGraphicsScene::setAsBackgroundObject(QGraphicsItem* item, bool
if (item->scene() != this)
addItem(item);
mZLayerController->setLayerType(item, itemLayerType::BackgroundItem);
UBGraphicsItem::assignZValue(item, mZLayerController->generateZLevel(item));
mBackgroundObject = item;
}
......
......@@ -87,6 +87,7 @@ public:
qreal changeZLevelTo(QGraphicsItem *item, moveDestination dest);
itemLayerType::Enum typeForData(QGraphicsItem *item) const;
void setLayerType(QGraphicsItem *pItem, itemLayerType::Enum pNewType);
private:
ScopeMap scopeMap;
......
......@@ -64,6 +64,11 @@ UBWebController::UBWebController(UBMainWindow* mainWindow)
{
connect(mMainWindow->actionWebTools, SIGNAL(toggled(bool)), this, SLOT(toggleWebToolsPalette(bool)));
mStackedWidget = new QStackedWidget();
mStackedWidget->addWidget(new QWidget(mStackedWidget));
mStackedWidget->addWidget(new QWidget(mStackedWidget));
mStackedWidget->addWidget(new QWidget(mStackedWidget));
mMainWindow->addWebWidget(mStackedWidget);
for (int i = 0; i < TotalNumberOfWebInstances; i += 1){
......@@ -76,13 +81,15 @@ UBWebController::UBWebController(UBMainWindow* mainWindow)
// TODO : Comment the next line to continue the Youtube button bugfix
initialiazemOEmbedProviders();
}
UBWebController::~UBWebController()
{
// NOOP
if (mStackedWidget) {
delete mStackedWidget;
}
}
void UBWebController::initialiazemOEmbedProviders()
......@@ -119,6 +126,7 @@ void UBWebController::webBrowserInstance()
mCurrentWebBrowser = &mWebBrowserList[WebBrowser];
mToolsCurrentPalette = &mToolsPaletteList[WebBrowser];
mToolsPalettePositionned = mToolsPalettePositionnedList[WebBrowser];
if (!(*mCurrentWebBrowser))
{
(*mCurrentWebBrowser) = new WBBrowserWindow(mMainWindow->centralWidget(), mMainWindow);
......@@ -134,6 +142,10 @@ void UBWebController::webBrowserInstance()
mMainWindow->actionBookmarks->setVisible(showAddBookmarkButtons);
mMainWindow->actionAddBookmark->setVisible(showAddBookmarkButtons);
mStackedWidget->setCurrentIndex(WebBrowser);
if (mStackedWidget->currentWidget()) {
mStackedWidget->removeWidget(mStackedWidget->currentWidget());
}
mStackedWidget->insertWidget(WebBrowser, (*mCurrentWebBrowser));
showTabAtTop(UBSettings::settings()->appToolBarPositionedAtTop->get().toBool());
......@@ -150,9 +162,8 @@ void UBWebController::webBrowserInstance()
(*mCurrentWebBrowser)->tabWidget()->lineEdits()->show();
}
UBApplication::applicationController->setMirrorSourceWidget((*mCurrentWebBrowser)->paintWidget());
mStackedWidget->setCurrentIndex(WebBrowser);
UBApplication::applicationController->setMirrorSourceWidget((*mCurrentWebBrowser)->paintWidget());
mMainWindow->switchToWebWidget();
setupPalettes();
......@@ -165,7 +176,6 @@ void UBWebController::webBrowserInstance()
if (mDownloadViewIsVisible)
WBBrowserWindow::downloadManager()->show();
}
void UBWebController::tutorialWebInstance()
......@@ -191,13 +201,17 @@ void UBWebController::tutorialWebInstance()
{
mCurrentWebBrowser = &mWebBrowserList[Tutorial];
mToolsPalettePositionned = &mToolsPalettePositionnedList[Tutorial];
if (!(*mCurrentWebBrowser))
{
(*mCurrentWebBrowser) = new WBBrowserWindow(mMainWindow->centralWidget(), mMainWindow, true);
connect((*mCurrentWebBrowser), SIGNAL(activeViewChange(QWidget*)), this, SLOT(setSourceWidget(QWidget*)));
mStackedWidget->setCurrentIndex(Tutorial);
if (mStackedWidget->currentWidget()) {
mStackedWidget->removeWidget(mStackedWidget->currentWidget());
}
mStackedWidget->insertWidget(Tutorial, (*mCurrentWebBrowser));
adaptToolBar();
mTrapFlashController = new UBTrapFlashController((*mCurrentWebBrowser));
......@@ -212,12 +226,9 @@ void UBWebController::tutorialWebInstance()
else
(*mCurrentWebBrowser)->loadUrl(currentUrl);
UBApplication::applicationController->setMirrorSourceWidget((*mCurrentWebBrowser)->paintWidget());
mStackedWidget->setCurrentIndex(Tutorial);
UBApplication::applicationController->setMirrorSourceWidget((*mCurrentWebBrowser)->paintWidget());
mMainWindow->switchToWebWidget();
screenLayoutChanged();
bool mirroring = UBSettings::settings()->webShowPageImmediatelyOnMirroredScreen->get().toBool();
......@@ -246,6 +257,7 @@ void UBWebController::paraschoolWebInstance()
if (UBSettings::settings()->webUseExternalBrowser->get().toBool()){
QDesktopServices::openUrl(currentUrl);
}
else {
mCurrentWebBrowser = &mWebBrowserList[Paraschool];
mToolsCurrentPalette = &mToolsPaletteList[Paraschool];
......@@ -254,6 +266,10 @@ void UBWebController::paraschoolWebInstance()
(*mCurrentWebBrowser) = new WBBrowserWindow(mMainWindow->centralWidget(), mMainWindow, true);
connect((*mCurrentWebBrowser), SIGNAL(activeViewChange(QWidget*)), this, SLOT(setSourceWidget(QWidget*)));
mStackedWidget->setCurrentIndex(Paraschool);
if (mStackedWidget->currentWidget()) {
mStackedWidget->removeWidget(mStackedWidget->currentWidget());
}
mStackedWidget->insertWidget(Paraschool, (*mCurrentWebBrowser));
adaptToolBar();
......@@ -267,11 +283,9 @@ void UBWebController::paraschoolWebInstance()
}
UBApplication::applicationController->setMirrorSourceWidget((*mCurrentWebBrowser)->paintWidget());
mStackedWidget->setCurrentIndex(Paraschool);
UBApplication::applicationController->setMirrorSourceWidget((*mCurrentWebBrowser)->paintWidget());
mMainWindow->switchToWebWidget();
screenLayoutChanged();
bool mirroring = UBSettings::settings()->webShowPageImmediatelyOnMirroredScreen->get().toBool();
......
......@@ -104,7 +104,7 @@ class UBWebController : public QObject
void lookForEmbedContent(QString* pHtml, QString tag, QString attribute, QList<QUrl>* pList);
void checkForOEmbed(QString* pHtml);
QStackedWidget mStackedWidget[TotalNumberOfWebInstances];
QStackedWidget *mStackedWidget;
UBMainWindow *mMainWindow;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment