Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 15 additions & 13 deletions src/adaptors/UBExportDocumentSetAdaptor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,21 +25,9 @@
*/


#include "UBExportDocumentSetAdaptor.h"
#include "UBExportDocument.h"

#include "adaptors/UBPageMapper.h"

#include "frameworks/UBPlatformUtils.h"

#include "core/UBDocumentManager.h"
#include "core/UBApplication.h"

#include "document/UBDocumentProxy.h"
#include "document/UBDocumentController.h"
#include "document/UBDocumentToc.h"

#include "core/UBPersistenceManager.h"
#include "UBExportDocumentSetAdaptor.h"

#ifdef Q_OS_OSX
#include <quazip.h>
Expand All @@ -49,7 +37,21 @@
#include "quazipfile.h"
#endif

#include "adaptors/UBPageMapper.h"

#include "core/memcheck.h"
#include "core/UBApplication.h"
#include "core/UBDocumentManager.h"
#include "core/UBPersistenceManager.h"
#include "core/UBSettings.h"

#include "document/UBDocumentProxy.h"
#include "document/UBDocumentController.h"
#include "document/UBDocumentToc.h"

#include "frameworks/UBPlatformUtils.h"

#include "UBExportDocument.h"

UBExportDocumentSetAdaptor::UBExportDocumentSetAdaptor(QObject *parent)
: UBExportAdaptor(parent)
Expand Down
1 change: 1 addition & 0 deletions src/adaptors/UBSvgSubsetAdaptor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
#include "domain/UBGraphicsStrokesGroup.h"
#include "domain/UBGraphicsGroupContainerItem.h"
#include "domain/UBGraphicsGroupContainerItemDelegate.h"
#include "domain/UBGraphicsItem.h"
#include "domain/UBItem.h"

#include "gui/UBBackgroundRuling.h"
Expand Down
12 changes: 8 additions & 4 deletions src/adaptors/UBWidgetUpgradeAdaptor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,20 @@
*/


#include "UBWidgetUpgradeAdaptor.h"

#include "core/UBPersistenceManager.h"
#include "document/UBDocumentProxy.h"
#include "frameworks/UBPlatformUtils.h"

#include "UBWidgetUpgradeAdaptor.h"

#include <QCryptographicHash>
#include <QDomDocument>

#include "core/memcheck.h"
#include "core/UBPersistenceManager.h"
#include "core/UBSettings.h"

#include "document/UBDocumentProxy.h"

#include "frameworks/UBPlatformUtils.h"

UBWidgetUpgradeAdaptor::UBWidgetUpgradeAdaptor()
{
Expand Down
1 change: 1 addition & 0 deletions src/board/UBBoardController.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@
#include "document/UBDocumentProxy.h"

#include "domain/UBGraphicsGroupContainerItem.h"
#include "domain/UBGraphicsItem.h"
#include "domain/UBGraphicsItemUndoCommand.h"
#include "domain/UBGraphicsMediaItem.h"
#include "domain/UBGraphicsPDFItem.h"
Expand Down
9 changes: 6 additions & 3 deletions src/board/UBBoardController.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,18 @@

#include "core/UB.h"
#include "core/UBApplicationController.h"

#include "document/UBDocumentContainer.h"

#include "domain/UBGraphicsMediaItem.h"

#include "gui/UBBackgroundRuling.h"
#include "gui/UBToolWidget.h"

class UBMainWindow;
class UBApplication;
class UBBoardView;

class UBBackgroundRuling;
class UBBackgroundManager;
class UBDocument;
class UBDocumentController;
Expand All @@ -54,11 +59,9 @@ class UBGraphicsScene;
class UBDocumentProxy;
class UBEmbedController;
class UBBlackoutWidget;
class UBToolWidget;
class UBVersion;
class UBSoftwareUpdate;
class UBSoftwareUpdateDialog;
class UBGraphicsMediaItem;
class UBGraphicsWidgetItem;
class UBBoardPaletteManager;
class UBItem;
Expand Down
2 changes: 1 addition & 1 deletion src/board/UBBoardView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@
#include "domain/UBGraphicsWidgetItem.h"
#include "domain/UBGraphicsPDFItem.h"
#include "domain/UBGraphicsPolygonItem.h"
#include "domain/UBItem.h"
#include "domain/UBGraphicsItem.h"
#include "domain/UBGraphicsMediaItem.h"
#include "domain/UBGraphicsSvgItem.h"
#include "domain/UBGraphicsGroupContainerItem.h"
Expand Down
2 changes: 2 additions & 0 deletions src/domain/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ target_sources(${PROJECT_NAME} PRIVATE
UBGraphicsGroupContainerItem.h
UBGraphicsGroupContainerItemDelegate.cpp
UBGraphicsGroupContainerItemDelegate.h
UBGraphicsItem.cpp
UBGraphicsItem.h
UBGraphicsItemDelegate.cpp
UBGraphicsItemDelegate.h
UBGraphicsItemGroupUndoCommand.cpp
Expand Down
1 change: 1 addition & 0 deletions src/domain/UBGraphicsDelegateFrame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
#include "board/UBBoardController.h"
#include "board/UBBoardView.h"

#include "domain/UBGraphicsItem.h"
#include "domain/UBGraphicsItemDelegate.h"
#include "domain/UBGraphicsScene.h"
#include "domain/UBResizableGraphicsItem.h"
Expand Down
8 changes: 5 additions & 3 deletions src/domain/UBGraphicsGroupContainerItem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,15 @@

#include <QtGui>

#include "UBGraphicsMediaItem.h"
#include "UBGraphicsTextItem.h"
#include "core/memcheck.h"
#include "core/UB.h"

#include "domain/UBGraphicsItemDelegate.h"
#include "domain/UBGraphicsGroupContainerItemDelegate.h"
#include "domain/UBGraphicsScene.h"

#include "core/memcheck.h"
#include "UBGraphicsMediaItem.h"
#include "UBGraphicsTextItem.h"

UBGraphicsGroupContainerItem::UBGraphicsGroupContainerItem(QGraphicsItem *parent)
: QGraphicsItem(parent)
Expand Down
10 changes: 10 additions & 0 deletions src/domain/UBGraphicsGroupContainerItem.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,18 @@
#define UBGRAPHICSGROUPCONTAINERITEM_H

#include <QGraphicsItem>
#include <QGraphicsSceneMouseEvent>
#include <QPainter>
#include <QRectF>
#include <QStyleOptionGraphicsItem>
#include <QWidget>
#include <QVariant>

#include "core/UB.h"

#include "domain/UBGraphicsItem.h"
#include "domain/UBItem.h"

#include "frameworks/UBCoreGraphicsScene.h"

class UBGraphicsGroupContainerItem : public QGraphicsItem, public UBItem, public UBGraphicsItem
Expand Down
128 changes: 128 additions & 0 deletions src/domain/UBGraphicsItem.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
/*
* Copyright (C) 2015-2022 Département de l'Instruction Publique (DIP-SEM)
*
* Copyright (C) 2013 Open Education Foundation
*
* Copyright (C) 2010-2013 Groupement d'Intérêt Public pour
* l'Education Numérique en Afrique (GIP ENA)
*
* This file is part of OpenBoard.
*
* OpenBoard is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, version 3 of the License,
* with a specific linking exception for the OpenSSL project's
* "OpenSSL" library (or with modified versions of it that use the
* same license as the "OpenSSL" library).
*
* OpenBoard is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with OpenBoard. If not, see <http://www.gnu.org/licenses/>.
*/




#include "UBGraphicsItem.h"

#include "core/memcheck.h"

#include "domain/UBGraphicsPixmapItem.h"
#include "domain/UBGraphicsTextItem.h"
#include "domain/UBGraphicsSvgItem.h"
#include "domain/UBGraphicsMediaItem.h"
#include "domain/UBGraphicsStrokesGroup.h"
#include "domain/UBGraphicsGroupContainerItem.h"
#include "domain/UBGraphicsWidgetItem.h"
#include "domain/UBGraphicsScene.h"
#include "tools/UBGraphicsCurtainItem.h"
#include "domain/UBGraphicsItemDelegate.h"

UBGraphicsItem::~UBGraphicsItem()
{
if (mDelegate!=NULL)
delete mDelegate;
}

void UBGraphicsItem::setDelegate(UBGraphicsItemDelegate* delegate)
{
Q_ASSERT(mDelegate==NULL);
mDelegate = delegate;
}

UBGraphicsItemDelegate *UBGraphicsItem::Delegate() const
{
return mDelegate;
}

void UBGraphicsItem::assignZValue(QGraphicsItem *item, qreal value)
{
item->setZValue(value);
item->setData(UBGraphicsItemData::ItemOwnZValue, value);
}

bool UBGraphicsItem::isFlippable(QGraphicsItem *item)
{
return item->data(UBGraphicsItemData::ItemFlippable).toBool();
}

bool UBGraphicsItem::isRotatable(QGraphicsItem *item)
{
return item->data(UBGraphicsItemData::ItemRotatable).toBool();
}

bool UBGraphicsItem::isLocked(QGraphicsItem *item)
{
return item->data(UBGraphicsItemData::ItemLocked).toBool();
}

bool UBGraphicsItem::isHiddenOnDisplay(QGraphicsItem *item)
{
return item->data(UBGraphicsItemData::ItemIsHiddenOnDisplay).toBool();
}

void UBGraphicsItem::remove(bool canUndo)
{
if (Delegate())
Delegate()->remove(canUndo);
}

UBGraphicsItemDelegate *UBGraphicsItem::Delegate(QGraphicsItem *pItem)
{
UBGraphicsItemDelegate *result = 0;

switch (static_cast<int>(pItem->type())) {
case UBGraphicsPixmapItem::Type :
result = (static_cast<UBGraphicsPixmapItem*>(pItem))->Delegate();
break;
case UBGraphicsTextItem::Type :
result = (static_cast<UBGraphicsTextItem*>(pItem))->Delegate();
break;
case UBGraphicsSvgItem::Type :
result = (static_cast<UBGraphicsSvgItem*>(pItem))->Delegate();
break;
case UBGraphicsMediaItem::Type:
case UBGraphicsVideoItem::Type:
case UBGraphicsAudioItem::Type:
result = (static_cast<UBGraphicsMediaItem*>(pItem))->Delegate();
break;
case UBGraphicsStrokesGroup::Type :
result = (static_cast<UBGraphicsStrokesGroup*>(pItem))->Delegate();
break;
case UBGraphicsGroupContainerItem::Type :
result = (static_cast<UBGraphicsGroupContainerItem*>(pItem))->Delegate();
break;
case UBGraphicsWidgetItem::Type :
result = (static_cast<UBGraphicsWidgetItem*>(pItem))->Delegate();
break;
case UBGraphicsCurtainItem::Type :
result = (static_cast<UBGraphicsCurtainItem*>(pItem))->Delegate();
break;
}

return result;
}
66 changes: 66 additions & 0 deletions src/domain/UBGraphicsItem.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
/*
* Copyright (C) 2015-2022 Département de l'Instruction Publique (DIP-SEM)
*
* Copyright (C) 2013 Open Education Foundation
*
* Copyright (C) 2010-2013 Groupement d'Intérêt Public pour
* l'Education Numérique en Afrique (GIP ENA)
*
* This file is part of OpenBoard.
*
* OpenBoard is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, version 3 of the License,
* with a specific linking exception for the OpenSSL project's
* "OpenSSL" library (or with modified versions of it that use the
* same license as the "OpenSSL" library).
*
* OpenBoard is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with OpenBoard. If not, see <http://www.gnu.org/licenses/>.
*/




#ifndef UBGRAPHICSITEM_H
#define UBGRAPHICSITEM_H

#include <QGraphicsItem>

#include "UBGraphicsItemDelegate.h"

class UBGraphicsItem
{
protected:
UBGraphicsItem() : mDelegate(NULL)
{
// NOOP
}
virtual ~UBGraphicsItem();
void setDelegate(UBGraphicsItemDelegate* mDelegate);

public:
virtual int type() const = 0;

UBGraphicsItemDelegate *Delegate() const;

static void assignZValue(QGraphicsItem*, qreal value);
static bool isRotatable(QGraphicsItem *item);
static bool isFlippable(QGraphicsItem *item);
static bool isLocked(QGraphicsItem *item);
static bool isHiddenOnDisplay(QGraphicsItem *item);

static UBGraphicsItemDelegate *Delegate(QGraphicsItem *pItem);

void remove(bool canUndo = true);

private:
UBGraphicsItemDelegate* mDelegate;
};

#endif // UBGRAPHICSITEM_H
7 changes: 4 additions & 3 deletions src/domain/UBGraphicsItemTransformUndoCommand.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,13 @@


#include "UBGraphicsItemTransformUndoCommand.h"
#include "UBResizableGraphicsItem.h"
#include "domain/UBItem.h"
#include "domain/UBGraphicsScene.h"

#include "core/memcheck.h"

#include "domain/UBGraphicsScene.h"

#include "UBResizableGraphicsItem.h"

UBGraphicsItemTransformUndoCommand::UBGraphicsItemTransformUndoCommand(QGraphicsItem* pItem,
const QPointF& prevPos, const QTransform& prevTransform, const qreal& prevZValue,
const QSizeF& prevSize, bool setToBackground)
Expand Down
Loading