Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
O
OpenBoard
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lifo
Nicolas Ollinger
OpenBoard
Commits
46e6b57e
Commit
46e6b57e
authored
May 21, 2012
by
Ivan Ilyin
Browse files
Options
Browse Files
Download
Plain Diff
group fixes conflict merged
parents
408811c5
70db4955
Changes
13
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
105 additions
and
163 deletions
+105
-163
release.win7.vc9.bat
release.win7.vc9.bat
+2
-1
UBSvgSubsetAdaptor.cpp
src/adaptors/UBSvgSubsetAdaptor.cpp
+2
-2
UBThumbnailAdaptor.cpp
src/adaptors/UBThumbnailAdaptor.cpp
+38
-72
UBThumbnailAdaptor.h
src/adaptors/UBThumbnailAdaptor.h
+1
-0
UBDrawingController.cpp
src/board/UBDrawingController.cpp
+2
-2
UBPersistenceManager.cpp
src/core/UBPersistenceManager.cpp
+7
-2
UBGraphicsAudioItem.cpp
src/domain/UBGraphicsAudioItem.cpp
+2
-0
UBGraphicsScene.cpp
src/domain/UBGraphicsScene.cpp
+27
-78
UBGraphicsVideoItem.cpp
src/domain/UBGraphicsVideoItem.cpp
+2
-0
UBW3CWidget.cpp
src/domain/UBW3CWidget.cpp
+5
-2
UBTeacherGuideWidget.cpp
src/gui/UBTeacherGuideWidget.cpp
+7
-1
UBTeacherGuideWidgetsTools.cpp
src/gui/UBTeacherGuideWidgetsTools.cpp
+9
-2
UBThumbnailWidget.cpp
src/gui/UBThumbnailWidget.cpp
+1
-1
No files found.
release.win7.vc9.bat
View file @
46e6b57e
...
...
@@ -62,7 +62,8 @@ nmake release-install
copy %BASE_QT_TRANSLATIONS_DIRECTORY%\qt_*.qm build\win32\release\product\i18n\
copy resources\customizations build\win32\release\product\
mkdir build\win32\release\product\customizations
xcopy /s resources\customizations\* build\win32\release\product\customizations
del build\win32\release\product\i18n\qt_help*
...
...
src/adaptors/UBSvgSubsetAdaptor.cpp
View file @
46e6b57e
...
...
@@ -1961,7 +1961,7 @@ void UBSvgSubsetAdaptor::UBSvgSubsetWriter::audioItemToLinkedAudio(UBGraphicsAud
mXmlWriter
.
writeAttribute
(
UBSettings
::
uniboardDocumentNamespaceUri
,
"position"
,
QString
(
"%1"
).
arg
(
pos
));
}
QString
audioFileHref
=
audioItem
->
mediaFileUrl
().
to
String
();
QString
audioFileHref
=
audioItem
->
mediaFileUrl
().
to
LocalFile
();
mXmlWriter
.
writeAttribute
(
nsXLink
,
"href"
,
audioFileHref
);
mXmlWriter
.
writeEndElement
();
}
...
...
@@ -1986,7 +1986,7 @@ void UBSvgSubsetAdaptor::UBSvgSubsetWriter::videoItemToLinkedVideo(UBGraphicsVid
mXmlWriter
.
writeAttribute
(
UBSettings
::
uniboardDocumentNamespaceUri
,
"position"
,
QString
(
"%1"
).
arg
(
pos
));
}
QString
videoFileHref
=
videoItem
->
mediaFileUrl
().
to
String
();
QString
videoFileHref
=
videoItem
->
mediaFileUrl
().
to
LocalFile
();
mXmlWriter
.
writeAttribute
(
nsXLink
,
"href"
,
videoFileHref
);
mXmlWriter
.
writeEndElement
();
}
...
...
src/adaptors/UBThumbnailAdaptor.cpp
View file @
46e6b57e
...
...
@@ -33,29 +33,23 @@
#include "core/memcheck.h"
QList
<
QPixmap
>
UBThumbnailAdaptor
::
load
(
UBDocumentProxy
*
proxy
)
void
UBThumbnailAdaptor
::
generateMissingThumbnails
(
UBDocumentProxy
*
proxy
)
{
QList
<
QPixmap
>
thumbnails
;
if
(
!
proxy
||
proxy
->
persistencePath
().
isEmpty
())
return
thumbnails
;
//compatibility with older formats (<= 4.0.b.2.0) : generate missing thumbnails
int
existingPageCount
=
proxy
->
pageCount
();
QString
thumbFileName
=
proxy
->
persistencePath
()
+
UBFileSystemUtils
::
digitFileFormat
(
"/page%1.thumbnail.jpg"
,
existingPageCount
);
QFile
thumbFile
(
thumbFileName
);
if
(
!
thumbFile
.
exists
())
for
(
int
iPageNo
=
0
;
iPageNo
<
existingPageCount
;
++
iPageNo
)
{
bool
displayMessage
=
(
existingPageCount
>
5
);
QString
thumbFileName
=
proxy
->
persistencePath
()
+
UBFileSystemUtils
::
digitFileFormat
(
"/page%1.thumbnail.jpg"
,
iPageNo
);
int
thumbCount
=
0
;
QFile
thumbFile
(
thumbFileName
)
;
for
(
int
i
=
0
;
i
<
existingPageCount
;
i
++
)
if
(
!
thumbFile
.
exists
()
)
{
UBGraphicsScene
*
scene
=
UBSvgSubsetAdaptor
::
loadScene
(
proxy
,
i
);
bool
displayMessage
=
(
existingPageCount
>
5
);
int
thumbCount
=
0
;
UBGraphicsScene
*
scene
=
UBSvgSubsetAdaptor
::
loadScene
(
proxy
,
iPageNo
);
if
(
scene
)
{
...
...
@@ -64,24 +58,25 @@ QList<QPixmap> UBThumbnailAdaptor::load(UBDocumentProxy* proxy)
if
(
displayMessage
&&
thumbCount
==
1
)
UBApplication
::
showMessage
(
tr
(
"Generating preview thumbnails ..."
));
persistScene
(
proxy
->
persistencePath
(),
scene
,
i
);
persistScene
(
proxy
->
persistencePath
(),
scene
,
i
PageNo
);
}
else
{
if
(
i
==
0
){
// we are working a document without zero page but on a system that enable it
// we have to create an empty zero scene
scene
=
new
UBGraphicsScene
(
proxy
);
UBSvgSubsetAdaptor
::
persistScene
(
proxy
,
scene
,
0
);
persistScene
(
proxy
->
persistencePath
(),
scene
,
i
);
thumbCount
++
;
}
}
}
if
(
displayMessage
&&
thumbCount
>
0
)
UBApplication
::
showMessage
(
tr
(
"%1 thumbnails generated ..."
).
arg
(
thumbCount
));
if
(
displayMessage
&&
thumbCount
>
0
)
UBApplication
::
showMessage
(
tr
(
"%1 thumbnails generated ..."
).
arg
(
thumbCount
));
}
}
}
QList
<
QPixmap
>
UBThumbnailAdaptor
::
load
(
UBDocumentProxy
*
proxy
)
{
QList
<
QPixmap
>
thumbnails
;
if
(
!
proxy
||
proxy
->
persistencePath
().
isEmpty
())
return
thumbnails
;
//compatibility with older formats (<= 4.0.b.2.0) : generate missing thumbnails
generateMissingThumbnails
(
proxy
);
//end compatibility with older format
...
...
@@ -113,56 +108,27 @@ QPixmap UBThumbnailAdaptor::load(UBDocumentProxy* proxy, int index)
{
int
existingPageCount
=
proxy
->
pageCount
();
if
(
!
proxy
||
proxy
->
persistencePath
().
size
()
==
0
||
index
<
0
||
index
>
=
existingPageCount
)
if
(
!
proxy
||
proxy
->
persistencePath
().
size
()
==
0
||
index
<
0
||
index
>
existingPageCount
)
return
QPixmap
();
//compatibility with older formats (<= 4.0.b.2.0) : generate missing thumbnails
QString
thumbFileName
=
proxy
->
persistencePath
()
+
UBFileSystemUtils
::
digitFileFormat
(
"/page%1.thumbnail.jpg"
,
existingPageCount
);
QFile
thumbFile
(
thumbFileName
);
if
(
!
thumbFile
.
exists
())
{
bool
displayMessage
=
(
existingPageCount
>
5
);
int
thumbCount
=
0
;
for
(
int
i
=
0
;
i
<
existingPageCount
;
i
++
)
{
UBGraphicsScene
*
scene
=
UBSvgSubsetAdaptor
::
loadScene
(
proxy
,
i
);
if
(
scene
)
{
thumbCount
++
;
if
(
displayMessage
&&
thumbCount
==
1
)
UBApplication
::
showMessage
(
tr
(
"Generating preview thumbnails ..."
));
persistScene
(
proxy
->
persistencePath
(),
scene
,
i
);
}
}
if
(
displayMessage
&&
thumbCount
>
0
)
UBApplication
::
showMessage
(
tr
(
"%1 thumbnails generated ..."
).
arg
(
thumbCount
));
}
generateMissingThumbnails
(
proxy
);
//end compatibility with older format
QString
fileName
=
proxy
->
persistencePath
()
+
UBFileSystemUtils
::
digitFileFormat
(
"/page%1.thumbnail.jpg"
,
index
);
QString
fileName
=
proxy
->
persistencePath
()
+
UBFileSystemUtils
::
digitFileFormat
(
"/page%1.thumbnail.jpg"
,
index
);
QFile
file
(
fileName
);
if
(
file
.
exists
())
{
QPixmap
pix
;
//Warning. Works only with modified Qt
QFile
file
(
fileName
);
if
(
file
.
exists
())
{
QPixmap
pix
;
//Warning. Works only with modified Qt
#ifdef Q_WS_X11
pix
.
load
(
fileName
,
0
,
Qt
::
AutoColor
);
pix
.
load
(
fileName
,
0
,
Qt
::
AutoColor
);
#else
pix
.
load
(
fileName
,
0
,
Qt
::
AutoColor
,
false
);
pix
.
load
(
fileName
,
0
,
Qt
::
AutoColor
,
false
);
#endif
return
pix
;
}
return
QPixmap
();
return
pix
;
}
return
QPixmap
();
}
void
UBThumbnailAdaptor
::
persistScene
(
const
QString
&
pDocPath
,
UBGraphicsScene
*
pScene
,
int
pageIndex
,
bool
overrideModified
)
...
...
src/adaptors/UBThumbnailAdaptor.h
View file @
46e6b57e
...
...
@@ -29,6 +29,7 @@ private: UBThumbnailAdaptor() {}
public
:
static
void
persistScene
(
const
QString
&
pDocPath
,
UBGraphicsScene
*
pScene
,
int
pageIndex
,
bool
overrideModified
=
false
);
static
void
generateMissingThumbnails
(
UBDocumentProxy
*
proxy
);
static
QList
<
QPixmap
>
load
(
UBDocumentProxy
*
proxy
);
static
QPixmap
load
(
UBDocumentProxy
*
proxy
,
int
index
);
...
...
src/board/UBDrawingController.cpp
View file @
46e6b57e
...
...
@@ -45,7 +45,7 @@ UBDrawingController::UBDrawingController(QObject * parent)
,
mActiveRuler
(
NULL
)
,
mStylusTool
((
UBStylusTool
::
Enum
)
-
1
)
,
mLatestDrawingTool
((
UBStylusTool
::
Enum
)
-
1
)
,
mDrawingMode
(
/*DRAWING_MODE*/
eDrawingMode_Vector
)
,
mDrawingMode
(
DRAWING_MODE
)
{
connect
(
UBSettings
::
settings
(),
SIGNAL
(
colorContextChanged
()),
this
,
SIGNAL
(
colorPaletteChanged
()));
...
...
@@ -114,7 +114,7 @@ void UBDrawingController::setStylusTool(int tool)
UBApplication
::
mainWindow
->
actionPen
->
setChecked
(
true
);
else
if
(
mStylusTool
==
UBStylusTool
::
Eraser
){
UBApplication
::
mainWindow
->
actionEraser
->
setChecked
(
true
);
//
mDrawingMode = eDrawingMode_Artistic;
mDrawingMode
=
eDrawingMode_Artistic
;
}
else
if
(
mStylusTool
==
UBStylusTool
::
Marker
)
UBApplication
::
mainWindow
->
actionMarker
->
setChecked
(
true
);
...
...
src/core/UBPersistenceManager.cpp
View file @
46e6b57e
...
...
@@ -848,7 +848,12 @@ QString UBPersistenceManager::teacherGuideAbsoluteObjectPath(UBDocumentProxy* pD
QString
UBPersistenceManager
::
addObjectToTeacherGuideDirectory
(
UBDocumentProxy
*
pDocumentProxy
,
QString
pPath
)
{
QFileInfo
fi
(
pPath
.
replace
(
"file://"
,
""
));
QString
path
=
pPath
;
//windows
path
.
replace
(
"file:///"
,
""
);
//others
path
.
replace
(
"file://"
,
""
);
QFileInfo
fi
(
path
);
QString
uuid
=
QUuid
::
createUuid
();
if
(
!
fi
.
exists
()
||
!
pDocumentProxy
)
...
...
@@ -862,7 +867,7 @@ QString UBPersistenceManager::addObjectToTeacherGuideDirectory(UBDocumentProxy*
QDir
dir
;
dir
.
mkdir
(
pDocumentProxy
->
persistencePath
()
+
"/"
+
UBPersistenceManager
::
teacherGuideDirectory
);
QFile
source
(
p
P
ath
);
QFile
source
(
path
);
source
.
copy
(
destPath
);
}
...
...
src/domain/UBGraphicsAudioItem.cpp
View file @
46e6b57e
...
...
@@ -96,6 +96,8 @@ UBItem* UBGraphicsAudioItem::deepCopy() const
UBGraphicsAudioItem
*
copy
=
new
UBGraphicsAudioItem
(
audioUrl
,
parentItem
());
connect
(
UBApplication
::
boardController
,
SIGNAL
(
activeSceneChanged
()),
copy
,
SLOT
(
activeSceneChanged
()));
copy
->
setPos
(
this
->
pos
());
copy
->
setTransform
(
this
->
transform
());
copy
->
setFlag
(
QGraphicsItem
::
ItemIsMovable
,
true
);
...
...
src/domain/UBGraphicsScene.cpp
View file @
46e6b57e
...
...
@@ -313,6 +313,7 @@ void UBGraphicsScene::selectionChangedProcessing()
+
QString
::
number
(
selectedItems
().
first
()
->
data
(
UBGraphicsItemData
::
ItemOwnZValue
).
toReal
(),
'f'
));
}
}
void
UBGraphicsScene
::
updateGroupButtonState
()
{
QAction
*
groupAction
=
UBApplication
::
mainWindow
->
actionGroupItems
;
...
...
@@ -337,9 +338,6 @@ void UBGraphicsScene::updateGroupButtonState()
}
}
// MARK: -
// MARK: Mouse/Tablet events handling
bool
UBGraphicsScene
::
inputDevicePress
(
const
QPointF
&
scenePos
,
const
qreal
&
pressure
)
{
//mMesure1Ms = 0;
...
...
@@ -509,7 +507,6 @@ bool UBGraphicsScene::inputDeviceMove(const QPointF& scenePos, const qreal& pres
return
accepted
;
}
bool
UBGraphicsScene
::
inputDeviceRelease
()
{
/*
...
...
@@ -608,8 +605,6 @@ bool UBGraphicsScene::inputDeviceRelease()
return
accepted
;
}
// MARK: -
void
UBGraphicsScene
::
drawEraser
(
const
QPointF
&
pPoint
,
bool
isFirstDraw
)
{
qreal
eraserWidth
=
UBSettings
::
settings
()
->
currentEraserWidth
();
...
...
@@ -685,7 +680,6 @@ void UBGraphicsScene::moveTo(const QPointF &pPoint)
mDrawWithCompass
=
false
;
}
void
UBGraphicsScene
::
drawLineTo
(
const
QPointF
&
pEndPoint
,
const
qreal
&
pWidth
,
bool
bLineStyle
)
{
if
(
mPreviousWidth
==
-
1.0
)
...
...
@@ -737,11 +731,8 @@ void UBGraphicsScene::drawLineTo(const QPointF &pEndPoint, const qreal &pWidth,
}
}
void
UBGraphicsScene
::
eraseLineTo
(
const
QPointF
&
pEndPoint
,
const
qreal
&
pWidth
)
{
// QList<QGraphicsItem*> itemList;
const
QLineF
line
(
mPreviousPoint
,
pEndPoint
);
const
QPolygonF
eraserPolygon
=
UBGeometryUtils
::
lineToPolygon
(
line
,
pWidth
);
...
...
@@ -778,7 +769,6 @@ void UBGraphicsScene::eraseLineTo(const QPointF &pEndPoint, const qreal &pWidth)
}
}
}
}
else
{
QSet
<
QGraphicsItem
*>
toBeAddedItems
;
QSet
<
QGraphicsItem
*>
toBeRemovedItems
;
...
...
@@ -788,23 +778,19 @@ void UBGraphicsScene::eraseLineTo(const QPointF &pEndPoint, const qreal &pWidth)
if
(
mShouldUseOMP
)
{
//
#pragma omp parallel for
#pragma omp parallel for
for
(
int
i
=
0
;
i
<
collidItemsSize
;
i
++
)
{
UBGraphicsPolygonItem
*
collidingPolygonItem
=
qgraphicsitem_cast
<
UBGraphicsPolygonItem
*>
(
collidItems
.
at
(
i
));
if
(
NULL
!=
collidingPolygonItem
)
{
collidingPolygonItem
->
setColor
(
QColor
(
Qt
::
green
));
UBGraphicsStrokesGroup
*
pGroup
=
collidingPolygonItem
->
strokesGroup
();
if
(
eraserInnerRect
.
contains
(
collidingPolygonItem
->
boundingRect
()))
{
// #pragma omp critical
qDebug
()
<<
"case 1"
;
#pragma omp critical
// Put the entire polygon into the remove list
collidingPolygonItem
->
setColor
(
QColor
(
Qt
::
blue
));
toBeRemovedItems
<<
collidingPolygonItem
;
}
else
...
...
@@ -816,43 +802,50 @@ void UBGraphicsScene::eraseLineTo(const QPointF &pEndPoint, const qreal &pWidth)
collidingPath
.
addPolygon
(
collidingPolygon
);
// Then we substract the eraser path to the polygon and we simplify it
QPainterPath
croppedPath
=
collidingPath
.
subtracted
(
eraserPath
);
/**/
QTransform
polyTransform
=
collidingPolygonItem
->
sceneTransform
().
inverted
();
QPointF
mTrPrevPoint
=
polyTransform
.
map
(
mPreviousPoint
);
QPointF
mTrEndPoint
=
polyTransform
.
map
(
pEndPoint
);
const
QLineF
trLine
(
mTrPrevPoint
,
mTrEndPoint
);
const
QPolygonF
trEraserPolygon
=
UBGeometryUtils
::
lineToPolygon
(
trLine
,
pWidth
);
QPainterPath
trEraser
;
trEraser
.
addPolygon
(
trEraserPolygon
);
QPainterPath
croppedPath
=
collidingPath
.
subtracted
(
trEraser
);
/**/
// Original
//QPainterPath croppedPath = collidingPath.subtracted(eraserPath);
QPainterPath
croppedPathSimplified
=
croppedPath
.
simplified
();
/*if (croppedPath == collidingPath)
{
// NOOP
qDebug() << "case 2";
toBeRemovedItems << collidingPolygonItem;
}
else */
if
(
croppedPathSimplified
.
isEmpty
())
{
// #pragma omp critical
qDebug
()
<<
"case 3"
;
#pragma omp critical
// Put the entire polygon into the remove list if the eraser removes all its visible content
collidingPolygonItem
->
setColor
(
QColor
(
Qt
::
blue
));
toBeRemovedItems
<<
collidingPolygonItem
;
}
else
{
//qDebug() << "case 4";
// Then we convert the remaining path to a list of polygons that will be converted in
// UBGraphicsPolygonItems and added to the scene
foreach
(
const
QPolygonF
&
pol
,
croppedPathSimplified
.
toFillPolygons
())
{
UBGraphicsPolygonItem
*
croppedPolygonItem
=
collidingPolygonItem
->
deepCopy
(
pol
);
croppedPolygonItem
->
setColor
(
QColor
(
Qt
::
black
));
// #pragma omp critical
#pragma omp critical
if
(
NULL
!=
pGroup
){
croppedPolygonItem
->
setStrokesGroup
(
pGroup
);
// croppedPolygonItem->setTransform(pGroup->sceneTransform().inverted());
}
// Add this new polygon to the 'added' list
toBeAddedItems
<<
croppedPolygonItem
;
}
//
#pragma omp critical
#pragma omp critical
// Remove the original polygonitem because it has been replaced by many smaller polygons
collidingPolygonItem
->
setColor
(
QColor
(
Qt
::
blue
));
toBeRemovedItems
<<
collidingPolygonItem
;
}
}
...
...
@@ -925,30 +918,14 @@ void UBGraphicsScene::eraseLineTo(const QPointF &pEndPoint, const qreal &pWidth)
mRemovedItems
+=
toBeRemovedItems
;
}
// bool hack = false;
// UBGraphicsStrokesGroup* pG = new UBGraphicsStrokesGroup();
if
(
eDrawingMode_Vector
==
DRAWING_MODE
){
foreach
(
QGraphicsItem
*
item
,
toBeAddedItems
){
UBGraphicsPolygonItem
*
poly
=
dynamic_cast
<
UBGraphicsPolygonItem
*>
(
item
);
if
(
NULL
!=
poly
&&
NULL
!=
poly
->
strokesGroup
()){
// if(!hack){
// itemList = poly->strokesGroup()->childItems();
// removeItem(poly->strokesGroup());
// foreach(QGraphicsItem* it, itemList){
// pG->addToGroup(it);
// }
// hack = true;
// }
qreal
dx
=
-
poly
->
strokesGroup
()
->
sceneTransform
().
inverted
().
dx
();
qreal
dy
=
-
poly
->
strokesGroup
()
->
sceneTransform
().
inverted
().
dy
();
//poly->setTransform(QTransform().translate(20, 0));
poly
->
setTransform
(
QTransform
().
translate
(
dx
,
dy
));
poly
->
strokesGroup
()
/*pG*/
->
addToGroup
(
poly
);
poly
->
setTransform
(
poly
->
strokesGroup
()
->
transform
());
poly
->
strokesGroup
()
->
addToGroup
(
poly
);
}
}
//addItem(pG);
}
else
{
addItems
(
toBeAddedItems
);
mAddedItems
+=
toBeAddedItems
;
...
...
@@ -958,7 +935,6 @@ void UBGraphicsScene::eraseLineTo(const QPointF &pEndPoint, const qreal &pWidth)
mPreviousPoint
=
pEndPoint
;
}
void
UBGraphicsScene
::
drawArcTo
(
const
QPointF
&
pCenterPoint
,
qreal
pSpanAngle
)
{
mDrawWithCompass
=
true
;
...
...
@@ -1070,7 +1046,6 @@ void UBGraphicsScene::recolorAllItems()
}
}
UBGraphicsPolygonItem
*
UBGraphicsScene
::
lineToPolygonItem
(
const
QLineF
&
pLine
,
const
qreal
&
pWidth
)
{
UBGraphicsPolygonItem
*
polygonItem
=
new
UBGraphicsPolygonItem
(
pLine
,
pWidth
);
...
...
@@ -1080,7 +1055,6 @@ UBGraphicsPolygonItem* UBGraphicsScene::lineToPolygonItem(const QLineF &pLine, c
return
polygonItem
;
}
void
UBGraphicsScene
::
initPolygonItem
(
UBGraphicsPolygonItem
*
polygonItem
)
{
QColor
colorOnDarkBG
;
...
...
@@ -1112,7 +1086,6 @@ void UBGraphicsScene::initPolygonItem(UBGraphicsPolygonItem* polygonItem)
polygonItem
->
setData
(
UBGraphicsItemData
::
ItemLayerType
,
QVariant
(
UBItemLayerType
::
Graphic
));
}
UBGraphicsPolygonItem
*
UBGraphicsScene
::
arcToPolygonItem
(
const
QLineF
&
pStartRadius
,
qreal
pSpanAngle
,
qreal
pWidth
)
{
QPolygonF
polygon
=
UBGeometryUtils
::
arcToPolygon
(
pStartRadius
,
pSpanAngle
,
pWidth
);
...
...
@@ -1120,7 +1093,6 @@ UBGraphicsPolygonItem* UBGraphicsScene::arcToPolygonItem(const QLineF& pStartRad
return
polygonToPolygonItem
(
polygon
);
}
UBGraphicsPolygonItem
*
UBGraphicsScene
::
polygonToPolygonItem
(
const
QPolygonF
pPolygon
)
{
UBGraphicsPolygonItem
*
polygonItem
=
new
UBGraphicsPolygonItem
(
pPolygon
);
...
...
@@ -1130,14 +1102,12 @@ UBGraphicsPolygonItem* UBGraphicsScene::polygonToPolygonItem(const QPolygonF pPo
return
polygonItem
;
}
void
UBGraphicsScene
::
hideEraser
()
{
if
(
mEraser
)
mEraser
->
hide
();
}
void
UBGraphicsScene
::
leaveEvent
(
QEvent
*
event
)
{
Q_UNUSED
(
event
);
...
...
@@ -1212,13 +1182,11 @@ UBGraphicsScene* UBGraphicsScene::sceneDeepCopy() const
return
copy
;
}
UBItem
*
UBGraphicsScene
::
deepCopy
()
const
{
return
sceneDeepCopy
();
}
void
UBGraphicsScene
::
clearItemsAndAnnotations
()
{
deselectAllItems
();
...
...
@@ -1250,7 +1218,6 @@ void UBGraphicsScene::clearItemsAndAnnotations()
setDocumentUpdated
();
}
void
UBGraphicsScene
::
clearItems
()
{
deselectAllItems
();
...
...
@@ -1288,7 +1255,6 @@ void UBGraphicsScene::clearItems()
setDocumentUpdated
();
}
void
UBGraphicsScene
::
clearAnnotations
()
{
QSet
<
QGraphicsItem
*>
emptyList
;
...
...
@@ -1319,7 +1285,6 @@ void UBGraphicsScene::clearAnnotations()
setDocumentUpdated
();
}
UBGraphicsPixmapItem
*
UBGraphicsScene
::
addPixmap
(
const
QPixmap
&
pPixmap
,
const
QPointF
&
pPos
,
qreal
pScaleFactor
,
bool
pUseAnimation
)
{
UBGraphicsPixmapItem
*
pixmapItem
=
new
UBGraphicsPixmapItem
();
...
...
@@ -1359,7 +1324,6 @@ UBGraphicsPixmapItem* UBGraphicsScene::addPixmap(const QPixmap& pPixmap, const Q
return
pixmapItem
;
}
void
UBGraphicsScene
::
textUndoCommandAdded
(
UBGraphicsTextItem
*
textItem
)
{
if
(
enableUndoRedoStack
)
{
//should be deleted after scene own undo stack implemented
...
...
@@ -1368,7 +1332,6 @@ void UBGraphicsScene::textUndoCommandAdded(UBGraphicsTextItem *textItem)
}
}
UBGraphicsVideoItem
*
UBGraphicsScene
::
addVideo
(
const
QUrl
&
pVideoFileUrl
,
bool
shouldPlayAsap
,
const
QPointF
&
pPos
)
{
UBGraphicsVideoItem
*
videoItem
=
new
UBGraphicsVideoItem
(
pVideoFileUrl
);
...
...
@@ -1431,7 +1394,6 @@ UBGraphicsAudioItem* UBGraphicsScene::addAudio(const QUrl& pAudioFileUrl, bool s
return
audioItem
;
}
UBGraphicsWidgetItem
*
UBGraphicsScene
::
addWidget
(
const
QUrl
&
pWidgetUrl
,
const
QPointF
&
pPos
)
{
int
widgetType
=
UBAbstractWidget
::
widgetType
(
pWidgetUrl
);
...
...
@@ -1451,7 +1413,6 @@ UBGraphicsWidgetItem* UBGraphicsScene::addWidget(const QUrl& pWidgetUrl, const Q
}
}
UBGraphicsAppleWidgetItem
*
UBGraphicsScene
::
addAppleWidget
(
const
QUrl
&
pWidgetUrl
,
const
QPointF
&
pPos
)
{
UBGraphicsAppleWidgetItem
*
appleWidget
=
new
UBGraphicsAppleWidgetItem
(
pWidgetUrl
);
...
...
@@ -1461,7 +1422,6 @@ UBGraphicsAppleWidgetItem* UBGraphicsScene::addAppleWidget(const QUrl& pWidgetUr
return
appleWidget
;
}
UBGraphicsW3CWidgetItem
*
UBGraphicsScene
::
addW3CWidget
(
const
QUrl
&
pWidgetUrl
,
const
QPointF
&
pPos
,
int
widgetType
)
{
UBGraphicsW3CWidgetItem
*
w3CWidget
=
new
UBGraphicsW3CWidgetItem
(
pWidgetUrl
,
0
,
widgetType
);
...
...
@@ -1502,7 +1462,6 @@ void UBGraphicsScene::addGraphicsWidget(UBGraphicsWidgetItem* graphicsWidget, co
}
}
UBGraphicsW3CWidgetItem
*
UBGraphicsScene
::
addOEmbed
(
const
QUrl
&
pContentUrl
,
const
QPointF
&
pPos
)
{
QStringList
widgetPaths
=
UBPersistenceManager
::
persistenceManager
()
->
allWidgets
(
UBSettings
::
settings
()
->
applicationApplicationsLibraryDirectory
());
...
...
@@ -1588,7 +1547,6 @@ UBGraphicsSvgItem* UBGraphicsScene::addSvg(const QUrl& pSvgFileUrl, const QPoint
return
svgItem
;
}
UBGraphicsTextItem
*
UBGraphicsScene
::
addText
(
const
QString
&
pString
,
const
QPointF
&
pTopLeft
)
{
return
addTextWithFont
(
pString
,
pTopLeft
,
UBSettings
::
settings
()
->
fontPixelSize
()
...
...
@@ -1680,6 +1638,7 @@ UBGraphicsTextItem* UBGraphicsScene::addTextWithFont(const QString& pString, con
return
textItem
;
}
UBGraphicsTextItem
*
UBGraphicsScene
::
addTextHtml
(
const
QString
&
pString
,
const
QPointF
&
pTopLeft
)
{
UBGraphicsTextItem
*
textItem
=
new
UBGraphicsTextItem
();
...
...
@@ -1743,7 +1702,6 @@ void UBGraphicsScene::removeItem(QGraphicsItem* item)
mFastAccessItems
.
removeAll
(
item
);
}
void
UBGraphicsScene
::
removeItems
(
const
QSet
<
QGraphicsItem
*>&
items
)
{
setModified
(
true
);
...
...
@@ -1757,7 +1715,6 @@ void UBGraphicsScene::removeItems(const QSet<QGraphicsItem*>& items)
mFastAccessItems
.
removeAll
(
item
);
}
void
UBGraphicsScene
::
deselectAllItems
()
{
foreach
(
QGraphicsItem
*
gi
,
selectedItems
())
...
...
@@ -1803,7 +1760,6 @@ QGraphicsItem* UBGraphicsScene::setAsBackgroundObject(QGraphicsItem* item, bool
return
item
;
}
QRectF
UBGraphicsScene
::
normalizedSceneRect
(
qreal
ratio
)
{
...
...
@@ -1843,7 +1799,6 @@ QRectF UBGraphicsScene::normalizedSceneRect(qreal ratio)
return
normalizedRect
;
}
void
UBGraphicsScene
::
setDocument
(
UBDocumentProxy
*
pDocument
)
{
if
(
pDocument
!=
mDocument
)
...
...
@@ -1858,7 +1813,6 @@ void UBGraphicsScene::setDocument(UBDocumentProxy* pDocument)
}
}
QGraphicsItem
*
UBGraphicsScene
::
scaleToFitDocumentSize
(
QGraphicsItem
*
item
,
bool
center
,
int
margin
,
bool
expand
)
{
int
maxWidth
=
mNominalSize
.
width
()
-
(
margin
*
2
);
...
...
@@ -1897,7 +1851,6 @@ void UBGraphicsScene::addRuler(QPointF center)
setModified
(
true
);
}
void
UBGraphicsScene
::
addProtractor
(
QPointF
center
)
{
// Protractor
...
...
@@ -2089,7 +2042,6 @@ void UBGraphicsScene::addMask(const QPointF ¢er)
setModified
(
true
);
}
void
UBGraphicsScene
::
setRenderingQuality
(
UBItem
::
RenderingQuality
pRenderingQuality
)
{
QListIterator
<
QGraphicsItem
*>
itItems
(
mFastAccessItems
);
...
...
@@ -2107,7 +2059,6 @@ void UBGraphicsScene::setRenderingQuality(UBItem::RenderingQuality pRenderingQua
}
}
QList
<
QUrl
>
UBGraphicsScene
::
relativeDependencies
()
const
{
QList
<
QUrl
>
relativePathes
;
...
...
@@ -2127,7 +2078,6 @@ QList<QUrl> UBGraphicsScene::relativeDependencies() const
return
relativePathes
;
}
QSize
UBGraphicsScene
::
nominalSize
()
{
if
(
mDocument
&&
!
mNominalSize
.
isValid
())
...
...
@@ -2138,7 +2088,6 @@ QSize UBGraphicsScene::nominalSize()
return
mNominalSize
;
}
void
UBGraphicsScene
::
setNominalSize
(
const
QSize
&
pSize
)
{
if
(
nominalSize
()
!=
pSize
)
...
...
@@ -2152,7 +2101,6 @@ void UBGraphicsScene::setNominalSize(const QSize& pSize)
}
}
void
UBGraphicsScene
::
setNominalSize
(
int
pWidth
,
int
pHeight
)
{
setNominalSize
(
QSize
(
pWidth
,
pHeight
));
...
...
@@ -2162,6 +2110,7 @@ void UBGraphicsScene::setSelectedZLevel(QGraphicsItem * item)
{
item
->
setZValue
(
mZLayerController
->
generateZLevel
(
itemLayerType
::
SelectedItem
));
}
void
UBGraphicsScene
::
setOwnZlevel
(
QGraphicsItem
*
item
)
{
item
->
setZValue
(
item
->
data
(
UBGraphicsItemData
::
ItemOwnZValue
).
toReal
());
...
...
@@ -2184,7 +2133,6 @@ QGraphicsItem* UBGraphicsScene::rootItem(QGraphicsItem* item) const
return
root
;
}
void
UBGraphicsScene
::
drawItems
(
QPainter
*
painter
,
int
numItems
,
QGraphicsItem
*
items
[],
const
QStyleOptionGraphicsItem
options
[],
QWidget
*
widget
)
{
...
...
@@ -2359,13 +2307,13 @@ void UBGraphicsScene::keyReleaseEvent(QKeyEvent * keyEvent)
QGraphicsScene
::
keyReleaseEvent
(
keyEvent
);
}
void
UBGraphicsScene
::
setDocumentUpdated
()
{
if
(
document
())
document
()
->
setMetaData
(
UBSettings
::
documentUpdatedAt
,
UBStringUtils
::
toUtcIsoDateTime
(
QDateTime
::
currentDateTime
()));
}
void
UBGraphicsScene
::
createEraiser
()
{
mEraser
=
new
QGraphicsEllipseItem
();
// mem : owned and destroyed by the scene
...
...
@@ -2379,6 +2327,7 @@ void UBGraphicsScene::createEraiser()
addItem
(
mEraser
);
}
void
UBGraphicsScene
::
createPointer
()
{
mPointer
=
new
QGraphicsEllipseItem
();
// mem : owned and destroyed by the scene
...
...
src/domain/UBGraphicsVideoItem.cpp
View file @
46e6b57e
...
...
@@ -69,6 +69,8 @@ UBItem* UBGraphicsVideoItem::deepCopy() const
UBGraphicsVideoItem
*
copy
=
new
UBGraphicsVideoItem
(
videoUrl
,
parentItem
());
connect
(
UBApplication
::
boardController
,
SIGNAL
(
activeSceneChanged
()),
copy
,
SLOT
(
activeSceneChanged
()));
copy
->
setPos
(
this
->
pos
());
copy
->
setTransform
(
this
->
transform
());
copy
->
setFlag
(
QGraphicsItem
::
ItemIsMovable
,
true
);
...
...
src/domain/UBW3CWidget.cpp
View file @
46e6b57e
...
...
@@ -247,7 +247,9 @@ QString UBW3CWidget::createNPAPIWrapperInDir(const QString& pUrl, const QDir& pD
{
QString
url
=
pUrl
;
// if the file name start with file:// it has be removed because QFileInfo doesn't support this form
url
=
url
.
replace
(
"file://"
,
""
);
//
url
=
url
.
replace
(
"file:///"
,
""
);
url
=
url
.
replace
(
"file://"
,
""
);
QString
name
=
pName
;
QFileInfo
fi
(
url
);
...
...
@@ -304,7 +306,8 @@ QString UBW3CWidget::createNPAPIWrapperInDir(const QString& pUrl, const QDir& pD
if
(
fi
.
exists
()){
QString
target
=
widgetLibraryPath
+
"/"
+
fi
.
fileName
();
QString
source
=
pUrl
;
source
.
replace
(
"file://"
,
""
);
source
.
replace
(
"file:///"
,
""
);
source
.
replace
(
"file://"
,
""
);
QFile
::
copy
(
source
,
target
);
}
...
...
src/gui/UBTeacherGuideWidget.cpp
View file @
46e6b57e
...
...
@@ -533,7 +533,13 @@ void UBTeacherGuidePresentationWidget::showData(QVector<tUBGEElementNode*> data)
newWidgetItem
->
setText
(
0
,
element
->
attributes
.
value
(
"title"
));
newWidgetItem
->
setData
(
0
,
tUBTGTreeWidgetItemRole_HasAnAction
,
tUBTGActionAssociateOnClickItem_MEDIA
);
newWidgetItem
->
setData
(
0
,
Qt
::
FontRole
,
QVariant
(
QFont
(
QApplication
::
font
().
family
(),
11
)));
newWidgetItem
->
setData
(
0
,
TG_USER_ROLE_MIME_TYPE
,
UBApplication
::
boardController
->
activeDocument
()
->
persistencePath
()
+
"/"
+
element
->
attributes
.
value
(
"relativePath"
));
QString
mimeTypeString
;
#ifdef Q_WS_WIN
mimeTypeString
=
QUrl
::
fromLocalFile
(
UBApplication
::
boardController
->
activeDocument
()
->
persistencePath
()
+
"/"
+
element
->
attributes
.
value
(
"relativePath"
)).
toString
();
#else
mimeTypeString
=
UBApplication
::
boardController
->
activeDocument
()
->
persistencePath
()
+
"/"
+
element
->
attributes
.
value
(
"relativePath"
);
#endif
newWidgetItem
->
setData
(
0
,
TG_USER_ROLE_MIME_TYPE
,
mimeTypeString
);
newWidgetItem
->
setFlags
(
Qt
::
ItemIsDragEnabled
|
Qt
::
ItemIsEnabled
|
Qt
::
ItemIsSelectable
);
mpRootWidgetItem
->
addChild
(
newWidgetItem
);
...
...
src/gui/UBTeacherGuideWidgetsTools.cpp
View file @
46e6b57e
...
...
@@ -230,11 +230,14 @@ void UBTGAdaptableText::bottomMargin(int newValue)
* class UBTGDraggableWeb *
***************************************************************************/
UBDraggableWeb
::
UBDraggableWeb
(
QString
&
relativePath
,
QWidget
*
parent
)
:
QWebView
(
parent
)
,
mRelativePath
(
relativePath
)
,
mDragStartPosition
(
QPoint
(
-
1
,
-
1
))
,
mDragStarted
(
false
)
{
if
(
!
relativePath
.
startsWith
(
"file://"
))
mRelativePath
=
QUrl
::
fromLocalFile
(
relativePath
).
toString
();
else
mRelativePath
=
relativePath
;
//NOOP
}
...
...
@@ -372,7 +375,7 @@ tUBGEElementNode* UBTGMediaWidget::saveData()
tUBGEElementNode
*
result
=
new
tUBGEElementNode
();
QString
relativePath
=
mMediaPath
;
relativePath
=
relativePath
.
replace
(
UBApplication
::
boardController
->
activeDocument
()
->
persistencePath
()
+
"/"
,
""
);
result
->
name
=
"media"
;
result
->
name
=
"media"
;
result
->
attributes
.
insert
(
"title"
,
mpTitle
->
text
());
result
->
attributes
.
insert
(
"relativePath"
,
relativePath
);
result
->
attributes
.
insert
(
"mediaType"
,
mMediaType
);
...
...
@@ -499,7 +502,11 @@ void UBTGMediaWidget::mousePressEvent(QMouseEvent *event)
QDrag
*
drag
=
new
QDrag
(
this
);
QMimeData
*
mimeData
=
new
QMimeData
();
QList
<
QUrl
>
urlList
;
#ifdef Q_WS_WIN
urlList
<<
QUrl
::
fromLocalFile
(
mMediaPath
);
#else
urlList
<<
QUrl
(
mMediaPath
);
#endif
mimeData
->
setUrls
(
urlList
);
drag
->
setMimeData
(
mimeData
);
...
...
src/gui/UBThumbnailWidget.cpp
View file @
46e6b57e
...
...
@@ -842,7 +842,7 @@ void UBSceneThumbnailNavigPixmap::updateButtonsState()
}
}
}
if
(
UBSettings
::
settings
()
->
teacherGuidePageZeroActivated
and
sceneIndex
()
<=
1
)
if
(
UBSettings
::
settings
()
->
teacherGuidePageZeroActivated
&&
sceneIndex
()
<=
1
)
bCanMoveUp
=
false
;
if
(
bCanDelete
||
bCanMoveUp
||
bCanMoveDown
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment