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
4ace295a
Commit
4ace295a
authored
Mar 11, 2013
by
Claudio Valerio
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
imported some fixes by hand from 2.10.b.04
parent
43929f15
Changes
17
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
17 changed files
with
711 additions
and
690 deletions
+711
-690
UBSvgSubsetAdaptor.cpp
src/adaptors/UBSvgSubsetAdaptor.cpp
+11
-18
UBBoardController.cpp
src/board/UBBoardController.cpp
+1
-3
UBBoardView.cpp
src/board/UBBoardView.cpp
+495
-506
UBDrawingController.cpp
src/board/UBDrawingController.cpp
+0
-12
UB.h
src/core/UB.h
+17
-17
UBGraphicsItemDelegate.cpp
src/domain/UBGraphicsItemDelegate.cpp
+82
-66
UBGraphicsItemDelegate.h
src/domain/UBGraphicsItemDelegate.h
+15
-2
UBGraphicsMediaItem.cpp
src/domain/UBGraphicsMediaItem.cpp
+10
-11
UBGraphicsMediaItemDelegate.cpp
src/domain/UBGraphicsMediaItemDelegate.cpp
+5
-0
UBGraphicsScene.cpp
src/domain/UBGraphicsScene.cpp
+17
-28
UBGraphicsWidgetItem.cpp
src/domain/UBGraphicsWidgetItem.cpp
+3
-1
UBCoreGraphicsScene.cpp
src/frameworks/UBCoreGraphicsScene.cpp
+4
-10
UBNavigatorPalette.cpp
src/gui/UBNavigatorPalette.cpp
+4
-4
UBTeacherGuideWidget.cpp
src/gui/UBTeacherGuideWidget.cpp
+2
-2
UBTeacherGuideWidgetsTools.cpp
src/gui/UBTeacherGuideWidgetsTools.cpp
+42
-3
UBTeacherGuideWidgetsTools.h
src/gui/UBTeacherGuideWidgetsTools.h
+2
-0
UBThumbnailWidget.cpp
src/gui/UBThumbnailWidget.cpp
+1
-7
No files found.
src/adaptors/UBSvgSubsetAdaptor.cpp
View file @
4ace295a
...
...
@@ -597,12 +597,12 @@ UBGraphicsScene* UBSvgSubsetAdaptor::UBSvgSubsetReader::loadScene()
QList
<
UBGraphicsPolygonItem
*>
polygonItems
=
polygonItemsFromPolylineSvg
(
mScene
->
isDarkBackground
()
?
Qt
::
white
:
Qt
::
black
);
QString
newParentId
=
QUuid
::
createUuid
().
toString
();
foreach
(
UBGraphicsPolygonItem
*
polygonItem
,
polygonItems
)
{
if
(
annotationGroup
)
{
polygonItem
->
setStroke
(
annotationGroup
);
}
if
(
strokesGroup
){
...
...
@@ -614,6 +614,10 @@ UBGraphicsScene* UBSvgSubsetAdaptor::UBSvgSubsetReader::loadScene()
polygonItem
->
setData
(
UBGraphicsItemData
::
ItemLayerType
,
QVariant
(
UBItemLayerType
::
Graphic
));
QString
parentId
=
mXmlReader
.
attributes
().
value
(
mNamespaceUri
,
"parent"
).
toString
();
if
(
parentId
.
isEmpty
())
parentId
=
newParentId
;
Q_ASSERT
(
!
parentId
.
isEmpty
());
UBGraphicsStrokesGroup
*
group
;
if
(
!
mStrokesList
.
contains
(
parentId
)){
...
...
@@ -623,8 +627,10 @@ UBGraphicsScene* UBSvgSubsetAdaptor::UBSvgSubsetReader::loadScene()
else
group
=
mStrokesList
.
value
(
parentId
);
group
->
addToGroup
(
polygonItem
);
polygonItem
->
show
();
}
}
else
if
(
mXmlReader
.
name
()
==
"image"
)
{
...
...
@@ -984,10 +990,6 @@ UBGraphicsScene* UBSvgSubsetAdaptor::UBSvgSubsetReader::loadScene()
{
if
(
mXmlReader
.
name
()
==
"g"
)
{
// if(strokesGroup && mScene){
// mScene->addItem(strokesGroup);
// }
if
(
annotationGroup
)
{
if
(
!
annotationGroup
->
polygons
().
empty
())
...
...
@@ -1010,12 +1012,12 @@ UBGraphicsScene* UBSvgSubsetAdaptor::UBSvgSubsetReader::loadScene()
QMapIterator
<
QString
,
UBGraphicsStrokesGroup
*>
iterator
(
mStrokesList
);
while
(
iterator
.
hasNext
())
{
iterator
.
next
();
qDebug
()
<<
"Number of polygons : "
<<
(
int
)(((
UBGraphicsStrokesGroup
*
)
iterator
.
value
())
->
childItems
().
count
());
mScene
->
addItem
(
iterator
.
value
());
}
if
(
mScene
)
{
if
(
mScene
)
mScene
->
setModified
(
false
);
}
if
(
annotationGroup
&&
annotationGroup
->
polygons
().
empty
()){
delete
annotationGroup
;
...
...
@@ -1557,17 +1559,8 @@ void UBSvgSubsetAdaptor::UBSvgSubsetWriter::persistGroupToDom(QGraphicsItem *gro
foreach
(
QGraphicsItem
*
item
,
groupItem
->
childItems
())
{
QUuid
tmpUuid
=
UBGraphicsScene
::
getPersonalUuid
(
item
);
if
(
!
tmpUuid
.
isNull
())
{
if
(
item
->
type
()
==
UBGraphicsGroupContainerItem
::
Type
&&
item
->
childItems
().
count
())
{
if
(
item
->
type
()
==
UBGraphicsGroupContainerItem
::
Type
&&
item
->
childItems
().
count
())
persistGroupToDom
(
item
,
curParent
,
groupDomDocument
);
}
// else if (item->type() == UBGraphicsStrokesGroup::Type) {
// foreach (QGraphicsItem *polygonItem, item->childItems()) {
// QDomElement curPolygonElement = groupDomDocument->createElement(tElement);
// curPolygonElement.setAttribute(aId, tmpUuid.toString()
// + UBGraphicsItem::getOwnUuid(polygonItem).toString());
// curGroupElement.appendChild(curPolygonElement);
// }
// }
else
{
QDomElement
curSubElement
=
groupDomDocument
->
createElement
(
tElement
);
...
...
src/board/UBBoardController.cpp
View file @
4ace295a
...
...
@@ -357,9 +357,7 @@ void UBBoardController::setupToolbar()
void
UBBoardController
::
setToolCursor
(
int
tool
)
{
if
(
mActiveScene
)
{
mActiveScene
->
setToolCursor
(
tool
);
}
mControlView
->
setToolCursor
(
tool
);
}
...
...
@@ -648,7 +646,7 @@ UBGraphicsItem *UBBoardController::duplicateItem(UBItem *item, bool bAsync)
QList
<
QGraphicsItem
*>
duplicatedItems
;
QList
<
QGraphicsItem
*>
children
=
groupItem
->
childItems
();
mActiveScene
->
setURStackEnable
(
false
);
foreach
(
QGraphicsItem
*
pIt
,
children
){
UBItem
*
pItem
=
dynamic_cast
<
UBItem
*>
(
pIt
);
...
...
src/board/UBBoardView.cpp
View file @
4ace295a
This diff is collapsed.
Click to expand it.
src/board/UBDrawingController.cpp
View file @
4ace295a
...
...
@@ -159,35 +159,23 @@ bool UBDrawingController::isDrawingTool()
int
UBDrawingController
::
currentToolWidthIndex
()
{
if
(
stylusTool
()
==
UBStylusTool
::
Pen
||
stylusTool
()
==
UBStylusTool
::
Line
)
{
return
UBSettings
::
settings
()
->
penWidthIndex
();
}
else
if
(
stylusTool
()
==
UBStylusTool
::
Marker
)
{
return
UBSettings
::
settings
()
->
markerWidthIndex
();
}
else
{
return
-
1
;
}
}
qreal
UBDrawingController
::
currentToolWidth
()
{
if
(
stylusTool
()
==
UBStylusTool
::
Pen
||
stylusTool
()
==
UBStylusTool
::
Line
)
{
return
UBSettings
::
settings
()
->
currentPenWidth
();
}
else
if
(
stylusTool
()
==
UBStylusTool
::
Marker
)
{
return
UBSettings
::
settings
()
->
currentMarkerWidth
();
}
else
{
//failsafe
return
UBSettings
::
settings
()
->
currentPenWidth
();
}
}
...
...
src/core/UB.h
View file @
4ace295a
...
...
@@ -50,17 +50,17 @@ struct UBStylusTool
{
enum
Enum
{
Pen
=
0
,
Eraser
,
Marker
,
Selector
,
Pen
=
0
,
Eraser
,
Marker
,
Selector
,
Play
,
Hand
,
ZoomIn
,
ZoomOut
,
Pointer
,
Line
,
Text
,
Hand
,
ZoomIn
,
ZoomOut
,
Pointer
,
Line
,
Text
,
Capture
};
};
...
...
@@ -138,17 +138,17 @@ struct UBGraphicsItemType
{
enum
Enum
{
PolygonItemType
=
QGraphicsItem
::
UserType
+
1
,
PolygonItemType
=
QGraphicsItem
::
UserType
+
1
,
PixmapItemType
,
SvgItemType
,
SvgItemType
,
DelegateButtonType
,
MediaItemType
,
PDFItemType
,
MediaItemType
,
PDFItemType
,
TextItemType
,
CurtainItemType
,
RulerItemType
,
CompassItemType
,
ProtractorItemType
,
RulerItemType
,
CompassItemType
,
ProtractorItemType
,
StrokeItemType
,
TriangleItemType
,
MagnifierItemType
,
...
...
src/domain/UBGraphicsItemDelegate.cpp
View file @
4ace295a
This diff is collapsed.
Click to expand it.
src/domain/UBGraphicsItemDelegate.h
View file @
4ace295a
...
...
@@ -104,10 +104,12 @@ public:
MediaTimer
(
QGraphicsItem
*
parent
=
0
);
~
MediaTimer
();
void
positionHandles
();
void
paint
(
QPainter
*
painter
,
const
QStyleOptionGraphicsItem
*
option
,
QWidget
*
widget
);
void
display
(
const
QString
&
str
);
void
setNumDigits
(
int
nDigits
);
private
:
...
...
@@ -117,7 +119,6 @@ private:
void
drawSegment
(
const
QPoint
&
,
char
,
QPainter
&
,
int
,
bool
=
false
);
void
addPoint
(
QPolygon
&
,
const
QPoint
&
);
void
internalSetString
(
const
QString
&
s
);
void
setNumDigits
(
int
nDigits
);
static
char
segments
[][
8
];
...
...
@@ -128,6 +129,14 @@ private:
uint
shadow
:
1
;
uint
smallPoint
:
1
;
int
digitSpace
;
int
xSegLen
;
int
ySegLen
;
int
segLen
;
int
xAdvance
;
int
xOffset
;
int
yOffset
;
};
class
DelegateMediaControl
:
public
QObject
,
public
QGraphicsRectItem
...
...
@@ -178,6 +187,8 @@ class DelegateMediaControl: public QObject, public QGraphicsRectItem
QRectF
mLCDTimerArea
;
MediaTimer
*
lcdTimer
;
QString
mDisplayFormat
;
};
class
UBGraphicsToolBarItem
:
public
QGraphicsRectItem
,
public
QObject
...
...
@@ -189,7 +200,7 @@ class UBGraphicsToolBarItem : public QGraphicsRectItem, public QObject
bool
isVisibleOnBoard
()
const
{
return
mVisible
;
}
void
setVisibleOnBoard
(
bool
visible
)
{
mVisible
=
visible
;
}
bool
isShifting
()
const
{
return
mShifting
;
}
void
setShifting
(
bool
shifting
)
{
mShifting
=
shifting
;
}
void
setShifting
(
bool
shifting
)
{
mShifting
=
shifting
;
}
QList
<
QGraphicsItem
*>
itemsOnToolBar
()
const
{
return
mItemsOnToolBar
;
}
void
setItemsOnToolBar
(
QList
<
QGraphicsItem
*>
itemsOnToolBar
)
{
mItemsOnToolBar
=
itemsOnToolBar
;}
int
minWidth
()
{
return
mMinWidth
;
}
...
...
@@ -340,6 +351,8 @@ private:
bool
mToolBarUsed
;
bool
mShowGoContentButton
;
bool
mMoved
;
};
...
...
src/domain/UBGraphicsMediaItem.cpp
View file @
4ace295a
...
...
@@ -85,7 +85,7 @@ UBGraphicsMediaItem::UBGraphicsMediaItem(const QUrl& pMediaFileUrl, QGraphicsIte
if
(
""
==
mediaPath
)
mediaPath
=
pMediaFileUrl
.
toLocalFile
();
if
(
mediaPath
.
toLower
().
contains
(
"videos"
))
if
(
mediaPath
.
toLower
().
contains
(
"videos"
))
{
mMediaType
=
mediaType_Video
;
...
...
@@ -102,8 +102,7 @@ UBGraphicsMediaItem::UBGraphicsMediaItem(const QUrl& pMediaFileUrl, QGraphicsIte
haveLinkedImage
=
true
;
}
else
if
(
mediaPath
.
toLower
().
contains
(
"audios"
))
else
if
(
mediaPath
.
toLower
().
contains
(
"audios"
))
{
mMediaType
=
mediaType_Audio
;
mAudioOutput
=
new
Phonon
::
AudioOutput
(
Phonon
::
MusicCategory
,
this
);
...
...
@@ -117,20 +116,20 @@ UBGraphicsMediaItem::UBGraphicsMediaItem(const QUrl& pMediaFileUrl, QGraphicsIte
borderSize
=
pAudioWidget
->
borderSize
();
}
mAudioWidget
->
resize
(
320
,
26
+
3
*
borderSize
);
mAudioWidget
->
resize
(
320
,
26
+
2
*
borderSize
);
//3*border size with enabled title
mAudioWidget
->
setMinimumSize
(
150
,
26
+
borderSize
);
haveLinkedImage
=
false
;
}
Phonon
::
createPath
(
mMediaObject
,
mAudioOutput
);
mSource
=
Phonon
::
MediaSource
(
pMediaFileUrl
);
mMediaObject
->
setCurrentSource
(
mSource
);
// we should create delegate after media objects because delegate uses his properties at creation.
setDelegate
(
new
UBGraphicsMediaItemDelegate
(
this
,
mMediaObject
));
// delegate should be created earler because we setWidget calls resize event for graphics proxy widgt.
// resize uses delegate.
if
(
mediaType_Video
==
mMediaType
)
...
...
@@ -320,13 +319,13 @@ void UBGraphicsMediaItem::mousePressEvent(QGraphicsSceneMouseEvent *event)
{
QGraphicsItem
*
curItem
=
group
->
getCurrentItem
();
if
(
curItem
&&
this
!=
curItem
)
{
group
->
deselectCurrentItem
();
}
{
group
->
deselectCurrentItem
();
}
group
->
setCurrentItem
(
this
);
this
->
setSelected
(
true
);
Delegate
()
->
positionHandles
();
}
}
}
}
...
...
@@ -339,7 +338,7 @@ void UBGraphicsMediaItem::mousePressEvent(QGraphicsSceneMouseEvent *event)
event
->
accept
();
}
}
else
else
{
mShouldMove
=
(
event
->
buttons
()
&
Qt
::
LeftButton
);
mMousePressPos
=
event
->
scenePos
();
...
...
src/domain/UBGraphicsMediaItemDelegate.cpp
View file @
4ace295a
...
...
@@ -255,6 +255,11 @@ void UBGraphicsMediaItemDelegate::mediaStateChanged ( Phonon::State newstate, Ph
{
Q_UNUSED
(
newstate
);
Q_UNUSED
(
oldstate
);
if
(
oldstate
==
Phonon
::
LoadingState
)
{
mMediaControl
->
totalTimeChanged
(
delegated
()
->
mediaObject
()
->
totalTime
());
}
updatePlayPauseState
();
}
...
...
src/domain/UBGraphicsScene.cpp
View file @
4ace295a
...
...
@@ -335,8 +335,8 @@ void UBGraphicsScene::updateGroupButtonState()
{
UBStylusTool
::
Enum
currentTool
=
(
UBStylusTool
::
Enum
)
UBDrawingController
::
drawingController
()
->
stylusTool
();
if
(
UBStylusTool
::
Selector
!=
currentTool
)
UBDrawingController
::
drawingController
()
->
setStylusTool
(
UBStylusTool
::
Selector
)
;
if
(
UBStylusTool
::
Selector
!=
currentTool
&&
UBStylusTool
::
Play
!=
currentTool
)
return
;
QAction
*
groupAction
=
UBApplication
::
mainWindow
->
actionGroupItems
;
QList
<
QGraphicsItem
*>
selItems
=
selectedItems
();
...
...
@@ -362,24 +362,18 @@ void UBGraphicsScene::updateGroupButtonState()
bool
UBGraphicsScene
::
inputDevicePress
(
const
QPointF
&
scenePos
,
const
qreal
&
pressure
)
{
//mMesure1Ms = 0;
//mMesure2Ms = 0;
bool
accepted
=
false
;
if
(
mInputDeviceIsPressed
)
{
if
(
mInputDeviceIsPressed
)
{
qWarning
()
<<
"scene received input device pressed, without input device release, muting event as input device move"
;
accepted
=
inputDeviceMove
(
scenePos
,
pressure
);
}
else
{
else
{
mInputDeviceIsPressed
=
true
;
UBStylusTool
::
Enum
currentTool
=
(
UBStylusTool
::
Enum
)
UBDrawingController
::
drawingController
()
->
stylusTool
();
if
(
UBDrawingController
::
drawingController
()
->
isDrawingTool
())
{
if
(
UBDrawingController
::
drawingController
()
->
isDrawingTool
())
{
// -----------------------------------------------------------------
// We fall here if we are using the Pen, the Marker or the Line tool
// -----------------------------------------------------------------
...
...
@@ -399,7 +393,8 @@ bool UBGraphicsScene::inputDevicePress(const QPointF& scenePos, const qreal& pre
if
(
currentTool
!=
UBStylusTool
::
Line
){
// Handle the pressure
width
=
UBDrawingController
::
drawingController
()
->
currentToolWidth
()
*
pressure
;
}
else
{
}
else
{
// Ignore pressure for the line tool
width
=
UBDrawingController
::
drawingController
()
->
currentToolWidth
();
}
...
...
@@ -411,18 +406,14 @@ bool UBGraphicsScene::inputDevicePress(const QPointF& scenePos, const qreal& pre
mRemovedItems
.
clear
();
if
(
UBDrawingController
::
drawingController
()
->
mActiveRuler
)
{
UBDrawingController
::
drawingController
()
->
mActiveRuler
->
StartLine
(
scenePos
,
width
);
}
else
{
else
{
moveTo
(
scenePos
);
drawLineTo
(
scenePos
,
width
,
UBDrawingController
::
drawingController
()
->
stylusTool
()
==
UBStylusTool
::
Line
);
}
accepted
=
true
;
}
else
if
(
currentTool
==
UBStylusTool
::
Eraser
)
{
else
if
(
currentTool
==
UBStylusTool
::
Eraser
)
{
mAddedItems
.
clear
();
mRemovedItems
.
clear
();
moveTo
(
scenePos
);
...
...
@@ -436,8 +427,7 @@ bool UBGraphicsScene::inputDevicePress(const QPointF& scenePos, const qreal& pre
accepted
=
true
;
}
else
if
(
currentTool
==
UBStylusTool
::
Pointer
)
{
else
if
(
currentTool
==
UBStylusTool
::
Pointer
)
{
drawPointer
(
scenePos
,
true
);
accepted
=
true
;
}
...
...
@@ -516,7 +506,8 @@ bool UBGraphicsScene::inputDeviceMove(const QPointF& scenePos, const qreal& pres
if
(
dc
->
mActiveRuler
){
dc
->
mActiveRuler
->
DrawLine
(
position
,
width
);
}
else
{
}
else
{
drawLineTo
(
position
,
width
,
UBDrawingController
::
drawingController
()
->
stylusTool
()
==
UBStylusTool
::
Line
);
}
}
...
...
@@ -1487,15 +1478,14 @@ UBGraphicsTextItem* UBGraphicsScene::textForObjectName(const QString& pString, c
if
(
!
textItem
){
textItem
=
addTextWithFont
(
pString
,
QPointF
(
0
,
0
)
,
72
,
UBSettings
::
settings
()
->
fontFamily
(),
true
,
false
);
textItem
->
setObjectName
(
objectName
);
QSizeF
size
=
textItem
->
size
();
textItem
->
setPos
(
QPointF
(
-
size
.
width
()
/
2.0
,
-
size
.
height
()
/
2.0
));
textItem
->
setData
(
UBGraphicsItemData
::
ItemEditable
,
QVariant
(
false
));
textItem
->
adjustSize
();
textItem
->
setTextInteractionFlags
(
Qt
::
TextSelectableByMouse
|
Qt
::
TextSelectableByKeyboard
);
}
textItem
->
setPlainText
(
pString
);
textItem
->
adjustSize
();
textItem
->
clearFocus
();
textItem
->
setTextInteractionFlags
(
Qt
::
TextSelectableByMouse
|
Qt
::
TextSelectableByKeyboard
);
return
textItem
;
}
...
...
@@ -2286,9 +2276,8 @@ void UBGraphicsScene::createPointer()
void
UBGraphicsScene
::
setToolCursor
(
int
tool
)
{
if
(
tool
==
(
int
)
UBStylusTool
::
Selector
||
tool
==
(
int
)
UBStylusTool
::
Text
||
tool
==
(
int
)
UBStylusTool
::
Play
)
{
tool
==
(
int
)
UBStylusTool
::
Text
||
tool
==
(
int
)
UBStylusTool
::
Play
)
{
deselectAllItems
();
}
...
...
src/domain/UBGraphicsWidgetItem.cpp
View file @
4ace295a
...
...
@@ -609,7 +609,9 @@ void UBGraphicsWidgetItem::mainFrameLoadFinished (bool ok)
{
mLoadIsErronous
=
!
ok
;
update
(
boundingRect
());
takeSnapshot
();
if
(
mInitialLoadDone
&&
scene
()
&&
scene
()
->
renderingContext
()
==
UBGraphicsScene
::
Screen
)
takeSnapshot
();
}
void
UBGraphicsWidgetItem
::
wheelEvent
(
QGraphicsSceneWheelEvent
*
event
)
...
...
src/frameworks/UBCoreGraphicsScene.cpp
View file @
4ace295a
...
...
@@ -40,15 +40,9 @@ UBCoreGraphicsScene::~UBCoreGraphicsScene()
{
//we must delete removed items that are no more in any scene
//at groups deleting some items can be added to mItemsToDelete, so we need to use iterators.
foreach
(
QGraphicsItem
*
item
,
mItemsToDelete
)
{
if
(
item
)
{
if
(
item
->
scene
()
==
NULL
||
item
->
scene
()
==
this
)
{
delete
item
;
}
}
foreach
(
QGraphicsItem
*
item
,
mItemsToDelete
){
if
(
item
&&
item
->
type
()
!=
UBGraphicsItemType
::
PolygonItemType
&&
item
->
type
()
!=
QGraphicsItem
::
UserType
&&
item
->
type
()
!=
UBGraphicsItemType
::
groupContainerType
&&
(
item
->
scene
()
==
NULL
||
item
->
scene
()
==
this
))
delete
item
;
}
mItemsToDelete
.
clear
();
}
...
...
@@ -62,7 +56,7 @@ void UBCoreGraphicsScene::addItem(QGraphicsItem* item)
removeItemFromDeletion
(
curItem
);
}
}
if
(
item
->
scene
()
!=
this
)
QGraphicsScene
::
addItem
(
item
);
...
...
src/gui/UBNavigatorPalette.cpp
View file @
4ace295a
...
...
@@ -98,13 +98,13 @@ UBNavigatorPalette::~UBNavigatorPalette()
}
if
(
NULL
!=
mLayout
)
{
delete
mLayout
;
mLayout
=
NULL
;
delete
mLayout
;
mLayout
=
NULL
;
}
if
(
NULL
!=
mNavigator
)
{
delete
mNavigator
;
mNavigator
=
NULL
;
delete
mNavigator
;
mNavigator
=
NULL
;
}
}
...
...
src/gui/UBTeacherGuideWidget.cpp
View file @
4ace295a
...
...
@@ -273,8 +273,8 @@ void UBTeacherGuideEditionWidget::onActiveSceneChanged()
void
UBTeacherGuideEditionWidget
::
cleanData
()
{
mpPageTitle
->
setText
(
""
);
mpComment
->
setText
(
""
);
mpPageTitle
->
resetText
(
);
mpComment
->
resetText
(
);
QList
<
QTreeWidgetItem
*>
children
=
mpAddAnActionItem
->
takeChildren
();
children
<<
mpAddAMediaItem
->
takeChildren
();
children
<<
mpAddALinkItem
->
takeChildren
();
...
...
src/gui/UBTeacherGuideWidgetsTools.cpp
View file @
4ace295a
...
...
@@ -224,6 +224,19 @@ void UBTGAdaptableText::setInitialText(const QString& text)
onTextChanged
();
}
void
UBTGAdaptableText
::
resetText
()
{
if
(
mHasPlaceHolder
&&
!
mPlaceHolderText
.
isEmpty
()){
setTextColor
(
QColor
(
Qt
::
lightGray
));
setText
(
mPlaceHolderText
);
}
else
{
setText
(
""
);
setTextColor
(
QColor
(
Qt
::
black
));
}
onTextChanged
();
}
void
UBTGAdaptableText
::
showText
(
const
QString
&
text
)
{
setText
(
text
);
...
...
@@ -252,14 +265,40 @@ void UBTGAdaptableText::focusOutEvent(QFocusEvent* e)
QTextEdit
::
focusOutEvent
(
e
);
}
void
UBTGAdaptableText
::
insertFromMimeData
(
const
QMimeData
*
source
)
{
QMimeData
editedMimeData
;
QTextDocument
textDoc
;
QString
plainText
;
if
(
source
->
hasHtml
())
{
textDoc
.
setHtml
(
source
->
html
());
plainText
+=
textDoc
.
toPlainText
();
}
if
(
source
->
hasText
())
if
(
textDoc
.
toPlainText
()
!=
source
->
text
())
plainText
+=
source
->
text
();
if
(
source
->
hasUrls
())
{
foreach
(
QUrl
url
,
source
->
urls
())
{
plainText
+=
url
.
toString
();
}
}
editedMimeData
.
setText
(
plainText
);
QTextEdit
::
insertFromMimeData
(
&
editedMimeData
);
}
void
UBTGAdaptableText
::
managePlaceholder
(
bool
focus
)
{
if
(
focus
){
if
(
toPlainText
()
==
mPlaceHolderText
){
setTextColor
(
QColor
(
Qt
::
black
));
setPlainText
(
""
);
setCursorToTheEnd
();
}
setCursorToTheEnd
();
}
else
{
if
(
toPlainText
().
isEmpty
()){
...
...
@@ -537,9 +576,9 @@ void UBTGMediaWidget::createWorkWidget(bool forceFlashMediaType)
mpMediaLayout
=
new
QHBoxLayout
(
mpWorkWidget
);
mpWorkWidget
->
setLayout
(
mpMediaLayout
);
}
mpMediaLayout
->
addStretch
(
1
);
if
(
mpMediaLabelWidget
){
mpMediaLabelWidget
->
setFixedHeight
(
mMediaWidgetHeight
);
mpMediaLabelWidget
->
setParent
(
mpWorkWidget
);
...
...
src/gui/UBTeacherGuideWidgetsTools.h
View file @
4ace295a
...
...
@@ -103,6 +103,7 @@ class UBTGAdaptableText : public QTextEdit
public
:
explicit
UBTGAdaptableText
(
QTreeWidgetItem
*
widget
=
0
,
QWidget
*
parent
=
0
,
const
char
*
name
=
"UBTGAdaptableText"
);
void
showText
(
const
QString
&
text
);
void
resetText
();
void
bottomMargin
(
int
newValue
);
void
setPlaceHolderText
(
QString
text
);
QString
text
();
...
...
@@ -118,6 +119,7 @@ protected:
void
showEvent
(
QShowEvent
*
e
);
void
focusInEvent
(
QFocusEvent
*
e
);
void
focusOutEvent
(
QFocusEvent
*
e
);
virtual
void
insertFromMimeData
(
const
QMimeData
*
source
);
private
:
void
setCursorToTheEnd
();
...
...
src/gui/UBThumbnailWidget.cpp
View file @
4ace295a
...
...
@@ -87,6 +87,7 @@ void UBThumbnailWidget::setGraphicsItems(const QList<QGraphicsItem*>& pGraphicsI
,
const
QStringList
pLabels
,
const
QString
&
pMimeType
)
{
Q_ASSERT
(
pItemsPaths
.
count
()
==
pLabels
.
count
());
mGraphicItems
=
pGraphicsItems
;
mItemsPaths
=
pItemsPaths
;
mMimeType
=
pMimeType
;
...
...
@@ -224,13 +225,6 @@ void UBThumbnailWidget::mousePressEvent(QMouseEvent *event)
event
->
ignore
();
return
;
}
//if(sceneItem){
// int pageIndex = UBDocumentContainer::pageFromSceneIndex(sceneItem->sceneIndex());
// if(pageIndex == 0){
// event->ignore();
// return;
// }
//}
mMousePressScenePos
=
mapToScene
(
mMousePressPos
);
QGraphicsItem
*
underlyingItem
=
itemAt
(
mMousePressPos
);
...
...
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