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
dc272ce3
Commit
dc272ce3
authored
Oct 08, 2012
by
Claudio Valerio
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed issue 1131 and 1161
parent
3607318f
Changes
4
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
87 additions
and
113 deletions
+87
-113
UBBoardView.cpp
src/board/UBBoardView.cpp
+48
-49
UBGraphicsScene.cpp
src/domain/UBGraphicsScene.cpp
+9
-11
UBGraphicsWidgetItem.cpp
src/domain/UBGraphicsWidgetItem.cpp
+14
-34
UBGraphicsWidgetItem.h
src/domain/UBGraphicsWidgetItem.h
+16
-19
No files found.
src/board/UBBoardView.cpp
View file @
dc272ce3
This diff is collapsed.
Click to expand it.
src/domain/UBGraphicsScene.cpp
View file @
dc272ce3
...
...
@@ -303,12 +303,10 @@ UBGraphicsScene::UBGraphicsScene(UBDocumentProxy* parent, bool enableUndoRedoSta
UBGraphicsScene
::~
UBGraphicsScene
()
{
if
(
mCurrentStroke
)
if
(
mCurrentStroke
->
polygons
().
empty
())
{
delete
mCurrentStroke
;
mCurrentStroke
=
NULL
;
}
if
(
mCurrentStroke
&&
mCurrentStroke
->
polygons
().
empty
()){
delete
mCurrentStroke
;
mCurrentStroke
=
NULL
;
}
if
(
mZLayerController
)
delete
mZLayerController
;
...
...
@@ -437,7 +435,7 @@ bool UBGraphicsScene::inputDevicePress(const QPointF& scenePos, const qreal& pre
}
if
(
mCurrentStroke
&&
mCurrentStroke
->
polygons
().
empty
()){
delete
mCurrentStroke
;
delete
mCurrentStroke
;
mCurrentStroke
=
NULL
;
}
...
...
@@ -800,7 +798,7 @@ void UBGraphicsScene::eraseLineTo(const QPointF &pEndPoint, const qreal &pWidth)
}
}
else
if
(
eraserPath
.
intersects
(
itemPainterPath
))
{
{
QPainterPath
newPath
=
itemPainterPath
.
subtracted
(
eraserPath
);
#pragma omp critical
...
...
@@ -820,7 +818,7 @@ void UBGraphicsScene::eraseLineTo(const QPointF &pEndPoint, const qreal &pWidth)
else
{
UBGraphicsPolygonItem
*
pi
=
intersectedItems
[
i
];
for
(
int
j
=
0
;
j
<
intersectedPolygons
[
i
].
size
();
j
++
)
{
QPolygonF
p
=
intersectedPolygons
[
i
][
j
];
...
...
@@ -2295,7 +2293,7 @@ void UBGraphicsScene::createPointer()
void
UBGraphicsScene
::
setToolCursor
(
int
tool
)
{
if
(
tool
==
(
int
)
UBStylusTool
::
Selector
||
tool
==
(
int
)
UBStylusTool
::
Text
||
tool
==
(
int
)
UBStylusTool
::
Text
||
tool
==
(
int
)
UBStylusTool
::
Play
)
{
deselectAllItems
();
...
...
@@ -2310,5 +2308,5 @@ void UBGraphicsScene::setToolCursor(int tool)
void
UBGraphicsScene
::
initStroke
()
{
mCurrentStroke
=
new
UBGraphicsStroke
();
mCurrentStroke
=
new
UBGraphicsStroke
();
}
src/domain/UBGraphicsWidgetItem.cpp
View file @
dc272ce3
...
...
@@ -48,7 +48,7 @@ UBGraphicsWidgetItem::UBGraphicsWidgetItem(const QUrl &pWidgetUrl, QGraphicsItem
:
QGraphicsWebView
(
parent
)
,
mInitialLoadDone
(
false
)
,
mIsFreezable
(
true
)
,
mIsResizable
(
false
)
,
mIsResizable
(
false
)
,
mLoadIsErronous
(
false
)
,
mCanBeContent
(
0
)
,
mCanBeTool
(
0
)
...
...
@@ -56,7 +56,7 @@ UBGraphicsWidgetItem::UBGraphicsWidgetItem(const QUrl &pWidgetUrl, QGraphicsItem
,
mIsFrozen
(
false
)
,
mIsTakingSnapshot
(
false
)
,
mShouldMoveWidget
(
false
)
,
mUniboardAPI
(
0
)
,
mUniboardAPI
(
0
)
{
setData
(
UBGraphicsItemData
::
ItemLayerType
,
QVariant
(
itemLayerType
::
ObjectItem
));
//Necessary to set if we want z value to be assigned correctly
...
...
@@ -119,7 +119,8 @@ void UBGraphicsWidgetItem::initialize()
void
UBGraphicsWidgetItem
::
onLinkClicked
(
const
QUrl
&
url
)
{
UBApplication
::
webController
->
loadUrl
(
url
);
//UBApplication::webController->loadUrl(url);
load
(
url
);
}
void
UBGraphicsWidgetItem
::
initialLayoutCompleted
()
...
...
@@ -147,24 +148,6 @@ QString UBGraphicsWidgetItem::mainHtmlFileName()
return
mMainHtmlFileName
;
}
bool
UBGraphicsWidgetItem
::
hasEmbededObjects
()
{
if
(
page
()
->
mainFrame
())
{
QList
<
UBWebKitUtils
::
HtmlObject
>
htmlObjects
=
UBWebKitUtils
::
objectsInFrame
(
page
()
->
mainFrame
());
return
htmlObjects
.
length
()
>
0
;
}
return
false
;
}
bool
UBGraphicsWidgetItem
::
hasEmbededFlash
()
{
if
(
hasEmbededObjects
())
return
page
()
->
mainFrame
()
->
toHtml
().
contains
(
"application/x-shockwave-flash"
);
else
return
false
;
}
bool
UBGraphicsWidgetItem
::
canBeContent
()
{
// if we under MAC OS
...
...
@@ -324,18 +307,18 @@ bool UBGraphicsWidgetItem::hasLoadedSuccessfully() const
return
(
mInitialLoadDone
&&
!
mLoadIsErronous
);
}
bool
UBGraphicsWidgetItem
::
freezable
()
{
bool
UBGraphicsWidgetItem
::
freezable
()
{
return
mIsFreezable
;
}
bool
UBGraphicsWidgetItem
::
resizable
()
{
{
return
mIsResizable
;
}
}
bool
UBGraphicsWidgetItem
::
isFrozen
()
{
{
return
mIsFrozen
;
}
...
...
@@ -351,7 +334,7 @@ QPixmap UBGraphicsWidgetItem::takeSnapshot()
QPixmap
pixmap
(
size
().
toSize
());
pixmap
.
fill
(
Qt
::
transparent
);
QPainter
painter
(
&
pixmap
);
QStyleOptionGraphicsItem
options
;
paint
(
&
painter
,
&
options
);
...
...
@@ -497,7 +480,7 @@ bool UBGraphicsWidgetItem::event(QEvent *event)
event
->
accept
();
return
true
;
}
}
}
else
if
(
event
->
type
()
==
QEvent
::
ShortcutOverride
)
event
->
accept
();
...
...
@@ -813,7 +796,7 @@ UBGraphicsW3CWidgetItem::UBGraphicsW3CWidgetItem(const QUrl& pWidgetUrl, QGraphi
if
(
roles
.
contains
(
"tmac"
))
mCanBeTool
|=
UBGraphicsWidgetItem
::
type_MAC
;
if
(
roles
.
contains
(
"tunix"
))
mCanBeTool
|=
UBGraphicsWidgetItem
::
type_UNIX
;
...
...
@@ -886,9 +869,6 @@ UBGraphicsW3CWidgetItem::UBGraphicsW3CWidgetItem(const QUrl& pWidgetUrl, QGraphi
/* is it a valid local file ? */
QFile
f
(
mMainHtmlUrl
.
toLocalFile
());
qDebug
()
<<
mMainHtmlFileName
;
qDebug
()
<<
mMainHtmlUrl
.
toLocalFile
();
if
(
!
f
.
exists
())
mMainHtmlUrl
=
QUrl
(
mMainHtmlFileName
);
...
...
@@ -1108,11 +1088,11 @@ QString UBGraphicsW3CWidgetItem::freezedWidgetPage()
if
(
!
wrapperFile
.
open
(
QIODevice
::
ReadOnly
|
QIODevice
::
Text
))
{
qDebug
()
<<
"can't open wrapper file "
+
freezedWidgetDefaultContentFilePath
;
defaultcontent
=
""
;
}
}
else
{
QByteArray
arr
=
wrapperFile
.
readAll
();
if
(
!
arr
.
isEmpty
())
defaultcontent
=
QString
(
arr
);
defaultcontent
=
QString
(
arr
);
else
{
qDebug
()
<<
"content of "
+
freezedWidgetDefaultContentFilePath
+
"is empty"
;
defaultcontent
=
QString
();
...
...
src/domain/UBGraphicsWidgetItem.h
View file @
dc272ce3
...
...
@@ -62,14 +62,11 @@ class UBGraphicsWidgetItem : public QGraphicsWebView, public UBItem, public UBRe
QUrl
widgetUrl
();
QString
mainHtmlFileName
();
bool
hasEmbededObjects
();
bool
hasEmbededFlash
();
bool
canBeContent
();
bool
canBeTool
();
QString
preference
(
const
QString
&
key
)
const
;
void
setPreference
(
const
QString
&
key
,
QString
value
);
void
setPreference
(
const
QString
&
key
,
QString
value
);
QMap
<
QString
,
QString
>
preferences
()
const
;
void
removePreference
(
const
QString
&
key
);
void
removeAllPreferences
();
...
...
@@ -94,7 +91,7 @@ class UBGraphicsWidgetItem : public QGraphicsWebView, public UBItem, public UBRe
virtual
void
setUuid
(
const
QUuid
&
pUuid
);
QSize
nominalSize
()
const
;
QSize
nominalSize
()
const
;
bool
hasLoadedSuccessfully
()
const
;
...
...
@@ -110,7 +107,7 @@ class UBGraphicsWidgetItem : public QGraphicsWebView, public UBItem, public UBRe
virtual
UBGraphicsScene
*
scene
();
static
int
widgetType
(
const
QUrl
&
pUrl
);
static
QString
widgetName
(
const
QUrl
&
pUrl
);
static
QString
widgetName
(
const
QUrl
&
pUrl
);
static
QString
iconFilePath
(
const
QUrl
&
pUrl
);
public
slots
:
...
...
@@ -127,7 +124,7 @@ class UBGraphicsWidgetItem : public QGraphicsWebView, public UBItem, public UBRe
type_ALL
=
7
,
// 0111
};
bool
mFirstReleaseAfterMove
;
bool
mFirstReleaseAfterMove
;
bool
mInitialLoadDone
;
bool
mIsFreezable
;
bool
mIsResizable
;
...
...
@@ -137,7 +134,7 @@ class UBGraphicsWidgetItem : public QGraphicsWebView, public UBItem, public UBRe
int
mCanBeTool
;
QSize
mNominalSize
;
QString
mMainHtmlFileName
;
QUrl
mMainHtmlUrl
;
QUrl
mMainHtmlUrl
;
QUrl
mWidgetUrl
;
QMap
<
QString
,
QString
>
mDatastore
;
QMap
<
QString
,
QString
>
mPreferences
;
...
...
@@ -162,21 +159,21 @@ class UBGraphicsWidgetItem : public QGraphicsWebView, public UBItem, public UBRe
void
mainFrameLoadFinished
(
bool
ok
);
private
slots
:
void
onLinkClicked
(
const
QUrl
&
url
);
void
onLinkClicked
(
const
QUrl
&
url
);
void
initialLayoutCompleted
();
private
:
bool
mIsFrozen
;
bool
mIsTakingSnapshot
;
bool
mShouldMoveWidget
;
bool
mShouldMoveWidget
;
UBWidgetUniboardAPI
*
mUniboardAPI
;
QPixmap
mSnapshot
;
QPointF
mLastMousePos
;
QUrl
ownFolder
;
QUrl
SnapshotFile
;
QUrl
SnapshotFile
;
static
bool
sInlineJavaScriptLoaded
;
static
QStringList
sInlineJavaScripts
;
static
QStringList
sInlineJavaScripts
;
};
class
UBGraphicsAppleWidgetItem
:
public
UBGraphicsWidgetItem
...
...
@@ -185,11 +182,11 @@ class UBGraphicsAppleWidgetItem : public UBGraphicsWidgetItem
public
:
UBGraphicsAppleWidgetItem
(
const
QUrl
&
pWidgetUrl
,
QGraphicsItem
*
parent
=
0
);
~
UBGraphicsAppleWidgetItem
();
~
UBGraphicsAppleWidgetItem
();
virtual
void
copyItemParameters
(
UBItem
*
copy
)
const
;
virtual
void
setUuid
(
const
QUuid
&
pUuid
);
virtual
UBItem
*
deepCopy
()
const
;
virtual
UBItem
*
deepCopy
()
const
;
};
class
UBGraphicsW3CWidgetItem
:
public
UBGraphicsWidgetItem
...
...
@@ -205,7 +202,7 @@ class UBGraphicsW3CWidgetItem : public UBGraphicsWidgetItem
{
/* NOOP */
}
PreferenceValue
(
const
QString
&
pValue
,
bool
pReadonly
)
{
...
...
@@ -230,13 +227,13 @@ class UBGraphicsW3CWidgetItem : public UBGraphicsWidgetItem
};
UBGraphicsW3CWidgetItem
(
const
QUrl
&
pWidgetUrl
,
QGraphicsItem
*
parent
=
0
);
~
UBGraphicsW3CWidgetItem
();
~
UBGraphicsW3CWidgetItem
();
virtual
void
setUuid
(
const
QUuid
&
pUuid
);
virtual
UBItem
*
deepCopy
()
const
;
virtual
void
copyItemParameters
(
UBItem
*
copy
)
const
;
QMap
<
QString
,
PreferenceValue
>
preferences
();
Metadata
metadatas
()
const
;
Metadata
metadatas
()
const
;
static
QString
freezedWidgetFilePath
();
static
QString
createNPAPIWrapper
(
const
QString
&
url
,
const
QString
&
pMimeType
=
QString
(),
const
QSize
&
sizeHint
=
QSize
(
300
,
150
),
const
QString
&
pName
=
QString
());
...
...
@@ -255,11 +252,11 @@ class UBGraphicsW3CWidgetItem : public UBGraphicsWidgetItem
static
QString
textForSubElementByLocale
(
QDomElement
rootElement
,
QString
subTagName
,
QLocale
locale
);
UBW3CWidgetAPI
*
mW3CWidgetAPI
;
QMap
<
QString
,
PreferenceValue
>
mPreferences
;
QMap
<
QString
,
PreferenceValue
>
mPreferences
;
static
bool
sTemplateLoaded
;
static
QString
sNPAPIWrappperConfigTemplate
;
static
QMap
<
QString
,
QString
>
sNPAPIWrapperTemplates
;
static
QMap
<
QString
,
QString
>
sNPAPIWrapperTemplates
;
};
#endif // UBGRAPHICSWIDGETITEM_H
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