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
37149617
Commit
37149617
authored
Jul 27, 2012
by
Yimgo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
First modifications to move from QWebView to QGraphicsWebView.
This is not functional.
parent
46809871
Changes
18
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
18 changed files
with
1368 additions
and
256 deletions
+1368
-256
UBSvgSubsetAdaptor.cpp
src/adaptors/UBSvgSubsetAdaptor.cpp
+8
-8
UBDocumentPublisher.cpp
src/adaptors/publishing/UBDocumentPublisher.cpp
+17
-17
UBW3CWidgetAPI.cpp
src/api/UBW3CWidgetAPI.cpp
+35
-85
UBW3CWidgetAPI.h
src/api/UBW3CWidgetAPI.h
+4
-8
UBWidgetMessageAPI.cpp
src/api/UBWidgetMessageAPI.cpp
+7
-10
UBWidgetMessageAPI.h
src/api/UBWidgetMessageAPI.h
+2
-2
UBWidgetUniboardAPI.cpp
src/api/UBWidgetUniboardAPI.cpp
+2
-2
UBWidgetUniboardAPI.h
src/api/UBWidgetUniboardAPI.h
+1
-1
UBBoardController.cpp
src/board/UBBoardController.cpp
+7
-7
UBBoardView.cpp
src/board/UBBoardView.cpp
+1
-1
UBGraphicsScene.cpp
src/domain/UBGraphicsScene.cpp
+3
-3
UBGraphicsScene.h
src/domain/UBGraphicsScene.h
+1
-1
UBGraphicsWebView.cpp
src/domain/UBGraphicsWebView.cpp
+182
-0
UBGraphicsWebView.h
src/domain/UBGraphicsWebView.h
+64
-0
UBGraphicsWidgetItem.cpp
src/domain/UBGraphicsWidgetItem.cpp
+869
-92
UBGraphicsWidgetItem.h
src/domain/UBGraphicsWidgetItem.h
+159
-15
UBGraphicsWidgetItemDelegate.cpp
src/domain/UBGraphicsWidgetItemDelegate.cpp
+4
-4
domain.pri
src/domain/domain.pri
+2
-0
No files found.
src/adaptors/UBSvgSubsetAdaptor.cpp
View file @
37149617
...
...
@@ -2484,7 +2484,7 @@ void UBSvgSubsetAdaptor::UBSvgSubsetWriter::graphicsW3CWidgetToSvg(UBGraphicsW3C
void
UBSvgSubsetAdaptor
::
UBSvgSubsetWriter
::
graphicsWidgetToSvg
(
UBGraphicsWidgetItem
*
item
)
{
QUrl
widgetRootUrl
=
item
->
widget
WebView
()
->
widget
Url
();
QUrl
widgetRootUrl
=
item
->
widgetUrl
();
QString
uuid
=
UBStringUtils
::
toCanonicalUuid
(
item
->
uuid
());
QString
widgetDirectoryPath
=
UBPersistenceManager
::
widgetDirectory
;
if
(
widgetRootUrl
.
toString
().
startsWith
(
"file://"
))
...
...
@@ -2513,13 +2513,13 @@ void UBSvgSubsetAdaptor::UBSvgSubsetWriter::graphicsWidgetToSvg(UBGraphicsWidget
graphicsItemToSvg
(
item
);
if
(
item
->
widgetWebView
()
->
isFrozen
())
if
(
item
->
isFrozen
())
{
mXmlWriter
.
writeAttribute
(
UBSettings
::
uniboardDocumentNamespaceUri
,
"frozen"
,
xmlTrue
);
}
QString
snapshotPath
=
mDocumentPath
+
"/"
+
UBPersistenceManager
::
widgetDirectory
+
"/"
+
uuid
+
".png"
;
item
->
widgetWebView
()
->
takeSnapshot
().
save
(
snapshotPath
,
"PNG"
);
item
->
takeSnapshot
().
save
(
snapshotPath
,
"PNG"
);
mXmlWriter
.
writeStartElement
(
nsXHtml
,
"iframe"
);
...
...
@@ -2528,10 +2528,10 @@ void UBSvgSubsetAdaptor::UBSvgSubsetWriter::graphicsWidgetToSvg(UBGraphicsWidget
mXmlWriter
.
writeAttribute
(
"height"
,
QString
(
"%1"
).
arg
(
item
->
boundingRect
().
height
()));
QString
startFileUrl
;
if
(
item
->
widgetWebView
()
->
mainHtmlFileName
().
startsWith
(
"http://"
))
startFileUrl
=
item
->
widgetWebView
()
->
mainHtmlFileName
();
if
(
item
->
mainHtmlFileName
().
startsWith
(
"http://"
))
startFileUrl
=
item
->
mainHtmlFileName
();
else
startFileUrl
=
widgetRootUrl
.
toString
()
+
"/"
+
item
->
widgetWebView
()
->
mainHtmlFileName
();
startFileUrl
=
widgetRootUrl
.
toString
()
+
"/"
+
item
->
mainHtmlFileName
();
mXmlWriter
.
writeAttribute
(
"src"
,
startFileUrl
);
mXmlWriter
.
writeEndElement
();
//iFrame
...
...
@@ -2622,13 +2622,13 @@ UBGraphicsW3CWidgetItem* UBSvgSubsetAdaptor::UBSvgSubsetReader::graphicsW3CWidge
QPixmap
snapshot
(
pixPath
);
if
(
!
snapshot
.
isNull
())
widgetItem
->
w3cWidget
()
->
setSnapshot
(
snapshot
);
widgetItem
->
setSnapshot
(
snapshot
);
QStringRef
frozen
=
mXmlReader
.
attributes
().
value
(
mNamespaceUri
,
"frozen"
);
if
(
!
frozen
.
isNull
()
&&
frozen
.
toString
()
==
xmlTrue
&&
!
snapshot
.
isNull
())
{
widgetItem
->
w3cWidget
()
->
freeze
();
widgetItem
->
freeze
();
}
graphicsItemFromSvg
(
widgetItem
);
...
...
src/adaptors/publishing/UBDocumentPublisher.cpp
View file @
37149617
...
...
@@ -281,12 +281,12 @@ void UBDocumentPublisher::upgradeDocumentForPublishing()
jsonFile
.
write
(
QString
(
"
\"
uuid
\"
:
\"
%1
\"
,
\n
"
).
arg
(
UBStringUtils
::
toCanonicalUuid
(
widget
->
uuid
())).
toUtf8
());
jsonFile
.
write
(
QString
(
"
\"
id
\"
:
\"
%1
\"
,
\n
"
).
arg
(
widget
->
metadatas
().
id
).
toUtf8
());
jsonFile
.
write
(
QString
(
"
\"
name
\"
:
\"
%1
\"
,
\n
"
).
arg
(
widget
->
w3cWidget
()
->
metadatas
().
name
).
toUtf8
());
jsonFile
.
write
(
QString
(
"
\"
description
\"
:
\"
%1
\"
,
\n
"
).
arg
(
widget
->
w3cWidget
()
->
metadatas
().
description
).
toUtf8
());
jsonFile
.
write
(
QString
(
"
\"
author
\"
:
\"
%1
\"
,
\n
"
).
arg
(
widget
->
w3cWidget
()
->
metadatas
().
author
).
toUtf8
());
jsonFile
.
write
(
QString
(
"
\"
authorEmail
\"
:
\"
%1
\"
,
\n
"
).
arg
(
widget
->
w3cWidget
()
->
metadatas
().
authorEmail
).
toUtf8
());
jsonFile
.
write
(
QString
(
"
\"
authorHref
\"
:
\"
%1
\"
,
\n
"
).
arg
(
widget
->
w3cWidget
()
->
metadatas
().
authorHref
).
toUtf8
());
jsonFile
.
write
(
QString
(
"
\"
version
\"
:
\"
%1
\"
,
\n
"
).
arg
(
widget
->
w3cWidget
()
->
metadatas
().
authorHref
).
toUtf8
());
jsonFile
.
write
(
QString
(
"
\"
name
\"
:
\"
%1
\"
,
\n
"
).
arg
(
widget
->
metadatas
().
name
).
toUtf8
());
jsonFile
.
write
(
QString
(
"
\"
description
\"
:
\"
%1
\"
,
\n
"
).
arg
(
widget
->
metadatas
().
description
).
toUtf8
());
jsonFile
.
write
(
QString
(
"
\"
author
\"
:
\"
%1
\"
,
\n
"
).
arg
(
widget
->
metadatas
().
author
).
toUtf8
());
jsonFile
.
write
(
QString
(
"
\"
authorEmail
\"
:
\"
%1
\"
,
\n
"
).
arg
(
widget
->
metadatas
().
authorEmail
).
toUtf8
());
jsonFile
.
write
(
QString
(
"
\"
authorHref
\"
:
\"
%1
\"
,
\n
"
).
arg
(
widget
->
metadatas
().
authorHref
).
toUtf8
());
jsonFile
.
write
(
QString
(
"
\"
version
\"
:
\"
%1
\"
,
\n
"
).
arg
(
widget
->
metadatas
().
authorHref
).
toUtf8
());
jsonFile
.
write
(
QString
(
"
\"
x
\"
: %1,
\n
"
).
arg
(
widget
->
sceneBoundingRect
().
x
()).
toUtf8
());
jsonFile
.
write
(
QString
(
"
\"
y
\"
: %1,
\n
"
).
arg
(
widget
->
sceneBoundingRect
().
y
()).
toUtf8
());
...
...
@@ -298,7 +298,7 @@ void UBDocumentPublisher::upgradeDocumentForPublishing()
QString
url
=
UBPersistenceManager
::
widgetDirectory
+
"/"
+
widget
->
uuid
().
toString
()
+
".wgt"
;
jsonFile
.
write
(
QString
(
"
\"
src
\"
:
\"
%1
\"
,
\n
"
).
arg
(
url
).
toUtf8
());
QString
startFile
=
widget
->
w3cWidget
()
->
mainHtmlFileName
();
QString
startFile
=
widget
->
mainHtmlFileName
();
jsonFile
.
write
(
QString
(
"
\"
startFile
\"
:
\"
%1
\"
,
\n
"
).
arg
(
startFile
).
toUtf8
());
QMap
<
QString
,
QString
>
preferences
=
widget
->
preferences
();
...
...
@@ -363,7 +363,7 @@ void UBDocumentPublisher::generateWidgetPropertyScript(UBGraphicsW3CWidgetItem *
QMap
<
QString
,
QString
>
preferences
=
widgetItem
->
preferences
();
QMap
<
QString
,
QString
>
datastoreEntries
=
widgetItem
->
datastoreEntries
();
QString
startFileName
=
widgetItem
->
w3cWidget
()
->
mainHtmlFileName
();
QString
startFileName
=
widgetItem
->
mainHtmlFileName
();
if
(
!
startFileName
.
startsWith
(
"http://"
))
{
...
...
@@ -394,18 +394,18 @@ void UBDocumentPublisher::generateWidgetPropertyScript(UBGraphicsW3CWidgetItem *
lines
<<
" <script type=
\"
text/javascript
\"
>"
;
lines
<<
" var widget = {};"
;
lines
<<
" widget.id = '"
+
widgetItem
->
w3cWidget
()
->
metadatas
().
id
+
"';"
;
lines
<<
" widget.name = '"
+
widgetItem
->
w3cWidget
()
->
metadatas
().
name
+
"';"
;
lines
<<
" widget.description = '"
+
widgetItem
->
w3cWidget
()
->
metadatas
().
description
+
"';"
;
lines
<<
" widget.author = '"
+
widgetItem
->
w3cWidget
()
->
metadatas
().
author
+
"';"
;
lines
<<
" widget.authorEmail = '"
+
widgetItem
->
w3cWidget
()
->
metadatas
().
authorEmail
+
"';"
;
lines
<<
" widget.authorHref = '"
+
widgetItem
->
w3cWidget
()
->
metadatas
().
authorHref
+
"';"
;
lines
<<
" widget.version = '"
+
widgetItem
->
w3cWidget
()
->
metadatas
().
version
+
"';"
;
lines
<<
" widget.id = '"
+
widgetItem
->
metadatas
().
id
+
"';"
;
lines
<<
" widget.name = '"
+
widgetItem
->
metadatas
().
name
+
"';"
;
lines
<<
" widget.description = '"
+
widgetItem
->
metadatas
().
description
+
"';"
;
lines
<<
" widget.author = '"
+
widgetItem
->
metadatas
().
author
+
"';"
;
lines
<<
" widget.authorEmail = '"
+
widgetItem
->
metadatas
().
authorEmail
+
"';"
;
lines
<<
" widget.authorHref = '"
+
widgetItem
->
metadatas
().
authorHref
+
"';"
;
lines
<<
" widget.version = '"
+
widgetItem
->
metadatas
().
version
+
"';"
;
lines
<<
" widget.uuid = '"
+
UBStringUtils
::
toCanonicalUuid
(
widgetItem
->
uuid
())
+
"';"
;
lines
<<
" widget.width = "
+
QString
(
"%1"
).
arg
(
widgetItem
->
w3cWidget
()
->
width
())
+
";"
;
lines
<<
" widget.height = "
+
QString
(
"%1"
).
arg
(
widgetItem
->
w3cWidget
()
->
height
())
+
";"
;
lines
<<
" widget.width = "
+
QString
(
"%1"
).
arg
(
widgetItem
->
nominalSize
().
width
())
+
";"
;
lines
<<
" widget.height = "
+
QString
(
"%1"
).
arg
(
widgetItem
->
nominalSize
().
height
())
+
";"
;
lines
<<
" widget.openUrl = function(url) { window.open(url); }"
;
lines
<<
" widget.preferences = new Array()"
;
...
...
src/api/UBW3CWidgetAPI.cpp
View file @
37149617
...
...
@@ -30,25 +30,14 @@
#include "core/memcheck.h"
UBW3CWidgetAPI
::
UBW3CWidgetAPI
(
UBGraphicsW3CWidgetItem
*
graphicsWidget
)
:
QObject
(
graphicsWidge
t
)
UBW3CWidgetAPI
::
UBW3CWidgetAPI
(
UBGraphicsW3CWidgetItem
*
graphicsWidget
,
QObject
*
parent
)
:
QObject
(
paren
t
)
,
mGraphicsW3CWidget
(
graphicsWidget
)
,
mW3CWidget
(
mGraphicsW3CWidget
->
w3cWidget
())
{
mPreferencesAPI
=
new
UBW3CWidgetPreferenceAPI
(
graphicsWidget
);
mPreferencesAPI
=
new
UBW3CWidgetPreferenceAPI
(
graphicsWidget
,
parent
);
}
UBW3CWidgetAPI
::
UBW3CWidgetAPI
(
UBW3CWidget
*
widget
)
:
QObject
(
widget
)
,
mGraphicsW3CWidget
(
0
)
,
mW3CWidget
(
widget
)
{
mPreferencesAPI
=
new
UBW3CWidgetPreferenceAPI
(
widget
);
}
UBW3CWidgetAPI
::~
UBW3CWidgetAPI
()
{
// NOOP
...
...
@@ -66,55 +55,55 @@ QString UBW3CWidgetAPI::uuid()
int
UBW3CWidgetAPI
::
width
()
{
return
m
W3CWidget
->
geometry
().
width
();
return
m
GraphicsW3CWidget
->
nominalSize
().
width
();
}
int
UBW3CWidgetAPI
::
height
()
{
return
m
W3CWidget
->
geometry
().
height
();
return
m
GraphicsW3CWidget
->
nominalSize
().
height
();
}
QString
UBW3CWidgetAPI
::
id
()
{
return
mW3CWidget
->
metadatas
().
id
;
return
m
Graphics
W3CWidget
->
metadatas
().
id
;
}
QString
UBW3CWidgetAPI
::
name
()
{
return
mW3CWidget
->
metadatas
().
name
;
return
m
Graphics
W3CWidget
->
metadatas
().
name
;
}
QString
UBW3CWidgetAPI
::
description
()
{
return
mW3CWidget
->
metadatas
().
description
;
return
m
Graphics
W3CWidget
->
metadatas
().
description
;
}
QString
UBW3CWidgetAPI
::
author
()
{
return
mW3CWidget
->
metadatas
().
author
;
return
m
Graphics
W3CWidget
->
metadatas
().
author
;
}
QString
UBW3CWidgetAPI
::
authorEmail
()
{
return
mW3CWidget
->
metadatas
().
authorEmail
;
return
m
Graphics
W3CWidget
->
metadatas
().
authorEmail
;
}
QString
UBW3CWidgetAPI
::
authorHref
()
{
return
mW3CWidget
->
metadatas
().
authorHref
;
return
m
Graphics
W3CWidget
->
metadatas
().
authorHref
;
}
QString
UBW3CWidgetAPI
::
version
()
{
return
mW3CWidget
->
metadatas
().
version
;
return
m
Graphics
W3CWidget
->
metadatas
().
version
;
}
QObject
*
UBW3CWidgetAPI
::
preferences
()
...
...
@@ -129,24 +118,13 @@ void UBW3CWidgetAPI::openURL(const QString& url)
}
UBW3CWidgetPreferenceAPI
::
UBW3CWidgetPreferenceAPI
(
UBGraphicsW3CWidgetItem
*
graphicsWidget
)
:
UBW3CWebStorage
(
graphicsWidge
t
)
UBW3CWidgetPreferenceAPI
::
UBW3CWidgetPreferenceAPI
(
UBGraphicsW3CWidgetItem
*
graphicsWidget
,
QOBject
*
parent
)
:
UBW3CWebStorage
(
paren
t
)
,
mGraphicsW3CWidget
(
graphicsWidget
)
,
mW3CWidget
(
graphicsWidget
->
w3cWidget
())
{
// NOOP
}
UBW3CWidgetPreferenceAPI
::
UBW3CWidgetPreferenceAPI
(
UBW3CWidget
*
widget
)
:
UBW3CWebStorage
(
widget
)
,
mGraphicsW3CWidget
(
0
)
,
mW3CWidget
(
widget
)
{
// NOOP
}
UBW3CWidgetPreferenceAPI
::~
UBW3CWidgetPreferenceAPI
()
{
// NOOP
...
...
@@ -155,45 +133,30 @@ UBW3CWidgetPreferenceAPI::~UBW3CWidgetPreferenceAPI()
QString
UBW3CWidgetPreferenceAPI
::
key
(
int
index
)
{
QMap
<
QString
,
UBW3CWidget
::
PreferenceValue
>
w3CPrefs
=
m
W3CWidget
->
preferences
();
QMap
<
QString
,
UBGraphicsWidgetItem
::
PreferenceValue
>
w3CPrefs
=
mGraphics
W3CWidget
->
preferences
();
if
(
index
<
w3CPrefs
.
size
())
return
w3CPrefs
.
keys
().
at
(
index
);
else
return
""
;
}
QString
UBW3CWidgetPreferenceAPI
::
getItem
(
const
QString
&
key
)
{
if
(
mGraphicsW3CWidget
)
{
QMap
<
QString
,
QString
>
docPref
=
mGraphicsW3CWidget
->
preferences
();
if
(
mGraphicsW3CWidget
)
{
QMap
<
QString
,
UBGraphicsWidgetItem
::
PreferenceValue
>
w3cPref
=
mGraphicsW3CWidget
->
preferences
();
if
(
do
cPref
.
contains
(
key
))
return
docPref
.
value
(
key
)
;
if
(
w3
cPref
.
contains
(
key
))
return
w3cPref
.
value
(
key
).
value
;
}
QMap
<
QString
,
UBW3CWidget
::
PreferenceValue
>
w3cPrefs
=
mW3CWidget
->
preferences
();
if
(
w3cPrefs
.
contains
(
key
))
{
UBW3CWidget
::
PreferenceValue
pref
=
w3cPrefs
.
value
(
key
);
return
pref
.
value
;
}
else
{
return
""
;
}
}
int
UBW3CWidgetPreferenceAPI
::
length
()
{
QMap
<
QString
,
UB
W3CWidget
::
PreferenceValue
>
w3cPrefs
=
mW3CWidget
->
preferences
();
QMap
<
QString
,
UB
GraphicsWidgetItem
::
PreferenceValue
>
w3cPrefs
=
mGraphicsW3CWidget
-
->
preferences
();
return
w3cPrefs
.
size
();
}
...
...
@@ -201,17 +164,12 @@ int UBW3CWidgetPreferenceAPI::length()
void
UBW3CWidgetPreferenceAPI
::
setItem
(
const
QString
&
key
,
const
QString
&
value
)
{
if
(
mGraphicsW3CWidget
)
{
QMap
<
QString
,
UBW3CWidget
::
PreferenceValue
>
w3cPrefs
=
mW3CWidget
->
preferences
();
if
(
mGraphicsW3CWidget
)
{
QMap
<
QString
,
UBGraphicsWidgetItem
::
PreferenceValue
>
w3cPrefs
=
mGraphicsW3CWidget
->
preferences
();
if
(
w3cPrefs
.
contains
(
key
)
&&
!
w3cPrefs
.
value
(
key
).
readonly
)
mGraphicsW3CWidget
->
setPreference
(
key
,
value
);
}
else
{
// No state for non graphics widget (aka tool widget)
}
}
...
...
@@ -219,10 +177,6 @@ void UBW3CWidgetPreferenceAPI::removeItem(const QString& key)
{
if
(
mGraphicsW3CWidget
)
mGraphicsW3CWidget
->
removePreference
(
key
);
else
{
// No state for non graphics widget (aka tool widget)
}
}
...
...
@@ -230,10 +184,6 @@ void UBW3CWidgetPreferenceAPI::clear()
{
if
(
mGraphicsW3CWidget
)
mGraphicsW3CWidget
->
removeAllPreferences
();
else
{
// No state for non graphics widget (aka tool widget)
}
}
...
...
src/api/UBW3CWidgetAPI.h
View file @
37149617
...
...
@@ -47,8 +47,7 @@ class UBW3CWidgetAPI : public QObject
public
:
UBW3CWidgetAPI
(
UBGraphicsW3CWidgetItem
*
graphicsWidget
);
UBW3CWidgetAPI
(
UBW3CWidget
*
widget
);
UBW3CWidgetAPI
(
UBGraphicsW3CWidgetItem
*
graphicsWidget
,
QObject
*
parent
=
0
);
virtual
~
UBW3CWidgetAPI
();
...
...
@@ -72,7 +71,6 @@ class UBW3CWidgetAPI : public QObject
private
:
UBGraphicsW3CWidgetItem
*
mGraphicsW3CWidget
;
UBW3CWidget
*
mW3CWidget
;
UBW3CWidgetPreferenceAPI
*
mPreferencesAPI
;
...
...
@@ -88,8 +86,8 @@ class UBW3CWebStorage : public QObject
public
:
UBW3CWebStorage
(
QObject
*
parent
=
0
)
:
QObject
(
parent
){}
virtual
~
UBW3CWebStorage
(){}
:
QObject
(
parent
){
/* NOOP */
}
virtual
~
UBW3CWebStorage
(){
/* NOOP */
}
public
slots
:
...
...
@@ -110,8 +108,7 @@ class UBW3CWidgetPreferenceAPI : public UBW3CWebStorage
Q_OBJECT
;
public
:
UBW3CWidgetPreferenceAPI
(
UBGraphicsW3CWidgetItem
*
graphicsWidget
);
UBW3CWidgetPreferenceAPI
(
UBW3CWidget
*
widget
);
UBW3CWidgetPreferenceAPI
(
UBGraphicsW3CWidgetItem
*
graphicsWidget
,
QOBject
*
parent
=
0
);
virtual
~
UBW3CWidgetPreferenceAPI
();
...
...
@@ -129,7 +126,6 @@ class UBW3CWidgetPreferenceAPI : public UBW3CWebStorage
private
:
UBGraphicsW3CWidgetItem
*
mGraphicsW3CWidget
;
UBW3CWidget
*
mW3CWidget
;
};
...
...
src/api/UBWidgetMessageAPI.cpp
View file @
37149617
...
...
@@ -17,16 +17,15 @@
#include "core/UBApplication.h"
#include "domain/UB
Abstract
Widget.h"
#include "domain/UB
Graphics
Widget.h"
#include "core/memcheck.h"
UBWidgetMessageAPI
::
UBWidgetMessageAPI
(
UB
W3CWidget
*
widge
t
)
:
QObject
(
widge
t
)
,
m
WebWidget
(
widget
)
UBWidgetMessageAPI
::
UBWidgetMessageAPI
(
UB
GraphicsWidgetItem
*
graphicsWidgetItem
,
QObject
*
paren
t
)
:
QObject
(
paren
t
)
,
m
GraphicsWidgetItem
(
graphicsWidgetItem
)
{
connect
(
UBWidgetAPIMessageBroker
::
instance
(),
SIGNAL
(
newMessage
(
const
QString
&
,
const
QString
&
))
,
this
,
SLOT
(
onNewMessage
(
const
QString
&
,
const
QString
&
)),
Qt
::
QueuedConnection
);
connect
(
UBWidgetAPIMessageBroker
::
instance
(),
SIGNAL
(
newMessage
(
const
QString
&
,
const
QString
&
)),
this
,
SLOT
(
onNewMessage
(
const
QString
&
,
const
QString
&
)),
Qt
::
QueuedConnection
);
}
UBWidgetMessageAPI
::~
UBWidgetMessageAPI
()
...
...
@@ -45,9 +44,7 @@ void UBWidgetMessageAPI::onNewMessage(const QString& pTopicName, const QString&
{
if
(
mSubscribedTopics
.
contains
(
pTopicName
))
{
if
(
mWebWidget
&&
mWebWidget
->
page
()
&&
mWebWidget
->
page
()
->
mainFrame
())
if
(
mGraphicsWidgetItem
&&
mGraphicsWidgetItem
->
page
()
&&
mGraphicsWidgetItem
->
page
()
->
mainFrame
())
{
QString
js
;
...
...
@@ -55,7 +52,7 @@ void UBWidgetMessageAPI::onNewMessage(const QString& pTopicName, const QString&
js
+=
"{widget.messages.onmessage('"
;
js
+=
pMessage
+
"', '"
+
pTopicName
+
"')}"
;
m
WebWidget
->
page
()
->
m
GraphicsWidgetItem
->
page
()
->
mainFrame
()
->
evaluateJavaScript
(
js
);
}
...
...
src/api/UBWidgetMessageAPI.h
View file @
37149617
...
...
@@ -25,7 +25,7 @@ class UBWidgetMessageAPI : public QObject
Q_OBJECT
;
public
:
UBWidgetMessageAPI
(
UB
W3CWidget
*
widget
);
UBWidgetMessageAPI
(
UB
GraphicsWidgetItem
*
graphicsWidgetItem
,
QObject
*
parent
=
0
);
virtual
~
UBWidgetMessageAPI
();
public
slots
:
...
...
@@ -49,7 +49,7 @@ class UBWidgetMessageAPI : public QObject
private
:
QSet
<
QString
>
mSubscribedTopics
;
UB
W3CWidget
*
mWebWidget
;
UB
GraphicsWidgetItem
*
mGraphicsWidgetItem
;
};
...
...
src/api/UBWidgetUniboardAPI.cpp
View file @
37149617
...
...
@@ -736,9 +736,9 @@ void UBDocumentDatastoreAPI::removeItem(const QString& key)
{
mGraphicsW3CWidget
->
removeDatastoreEntry
(
key
);
}
void
void
UBDocumentDatastoreAPI
::
clear
()
UBDocumentDatastoreAPI
::
clear
()
{
mGraphicsW3CWidget
->
removeAllDatastoreEntries
();
}
...
...
src/api/UBWidgetUniboardAPI.h
View file @
37149617
...
...
@@ -57,7 +57,7 @@ class UBWidgetUniboardAPI : public QObject
*
* some potential values are
*
* en
* en
locale
* en-UK
* fr
* fr-CH
...
...
src/board/UBBoardController.cpp
View file @
37149617
...
...
@@ -1885,7 +1885,7 @@ UBGraphicsWidgetItem *UBBoardController::addW3cWidget(const QUrl &pUrl, const QP
w3cWidgetItem
->
setSnapshotPath
(
QUrl
::
fromLocalFile
(
snapshotPath
));
UBGraphicsWidgetItem
*
tmpItem
=
dynamic_cast
<
UBGraphicsWidgetItem
*>
(
w3cWidgetItem
);
if
(
tmpItem
)
tmpItem
->
widgetWebView
()
->
takeSnapshot
().
save
(
snapshotPath
,
"PNG"
);
tmpItem
->
takeSnapshot
().
save
(
snapshotPath
,
"PNG"
);
}
...
...
@@ -2092,7 +2092,7 @@ void UBBoardController::togglePodcast(bool checked)
void
UBBoardController
::
moveGraphicsWidgetToControlView
(
UBGraphicsWidgetItem
*
graphicsWidget
)
{
QPoint
controlViewPos
=
mControlView
->
mapFromScene
(
graphicsWidget
->
sceneBoundingRect
().
center
());
/*
QPoint controlViewPos = mControlView->mapFromScene(graphicsWidget->sceneBoundingRect().center());
graphicsWidget->setSelected(false);
...
...
@@ -2105,13 +2105,13 @@ void UBBoardController::moveGraphicsWidgetToControlView(UBGraphicsWidgetItem* gr
toolWidget->centerOn(mControlView->mapTo(mControlContainer, controlViewPos));
toolWidget
->
show
();
toolWidget->show();
*/
}
void
UBBoardController
::
moveToolWidgetToScene
(
UBToolWidget
*
toolWidget
)
{
int
xIsOdd
=
toolWidget
->
width
()
%
2
;
/*
int xIsOdd = toolWidget->width() % 2;
int yIsOdd = toolWidget->height() % 2;
QPoint mainWindowCenter = toolWidget->mapTo(mMainWindow, QPoint(toolWidget->width(), toolWidget->height()) / 2);
...
...
@@ -2141,7 +2141,7 @@ void UBBoardController::moveToolWidgetToScene(UBToolWidget* toolWidget)
mActiveScene->addGraphicsWidget(graphicsWidget, scenePos);
toolWidget->hide();
toolWidget
->
deleteLater
();
toolWidget->deleteLater();
*/
}
...
...
@@ -2227,8 +2227,8 @@ void UBBoardController::freezeW3CWidget(QGraphicsItem *item, bool freeze)
return
;
if
(
freeze
)
{
item_casted
->
widgetWebView
()
->
page
()
->
mainFrame
()
->
setContent
(
UBW3CWidget
::
freezedWidgetPage
().
toAscii
());
item_casted
->
page
()
->
mainFrame
()
->
setContent
(
UBW3CWidget
::
freezedWidgetPage
().
toAscii
());
}
else
item_casted
->
widgetWebView
()
->
loadMainHtml
();
item_casted
->
loadMainHtml
();
}
}
src/board/UBBoardView.cpp
View file @
37149617
...
...
@@ -1182,7 +1182,7 @@ void UBBoardView::dragMoveEvent (QDragMoveEvent *event)
}
QPoint
newPoint
(
graphicsWidget
->
mapFromScene
(
mapToScene
(
event
->
pos
())).
toPoint
());
QDragMoveEvent
newEvent
(
newPoint
,
event
->
dropAction
(),
event
->
mimeData
(),
event
->
mouseButtons
(),
event
->
keyboardModifiers
());
QApplication
::
sendEvent
(
graphicsWidget
->
widgetWebView
()
,
&
newEvent
);
QApplication
::
sendEvent
(
graphicsWidget
,
&
newEvent
);
}
else
{
mOkOnWidget
=
false
;
event
->
ignore
();
...
...
src/domain/UBGraphicsScene.cpp
View file @
37149617
...
...
@@ -1422,9 +1422,9 @@ UBGraphicsAppleWidgetItem* UBGraphicsScene::addAppleWidget(const QUrl& pWidgetUr
return
appleWidget
;
}
UBGraphicsW3CWidgetItem
*
UBGraphicsScene
::
addW3CWidget
(
const
QUrl
&
pWidgetUrl
,
const
QPointF
&
pPos
,
int
widgetType
)
UBGraphicsW3CWidgetItem
*
UBGraphicsScene
::
addW3CWidget
(
const
QUrl
&
pWidgetUrl
,
const
QPointF
&
pPos
)
{
UBGraphicsW3CWidgetItem
*
w3CWidget
=
new
UBGraphicsW3CWidgetItem
(
pWidgetUrl
,
0
,
widgetType
);
UBGraphicsW3CWidgetItem
*
w3CWidget
=
new
UBGraphicsW3CWidgetItem
(
pWidgetUrl
,
0
);
addGraphicsWidget
(
w3CWidget
,
pPos
);
...
...
@@ -1444,7 +1444,7 @@ void UBGraphicsScene::addGraphicsWidget(UBGraphicsWidgetItem* graphicsWidget, co
graphicsWidget
->
setPos
(
QPointF
(
pPos
.
x
()
-
graphicsWidget
->
boundingRect
().
width
()
/
2
,
pPos
.
y
()
-
graphicsWidget
->
boundingRect
().
height
()
/
2
));
if
(
graphicsWidget
->
widgetWebView
()
->
canBeContent
())
if
(
graphicsWidget
->
canBeContent
())
{
// graphicsWidget->widgetWebView()->loadMainHtml();
...
...
src/domain/UBGraphicsScene.h
View file @
37149617
...
...
@@ -130,7 +130,7 @@ class UBGraphicsScene: public UBCoreGraphicsScene, public UBItem
UBGraphicsWidgetItem
*
addWidget
(
const
QUrl
&
pWidgetUrl
,
const
QPointF
&
pPos
=
QPointF
(
0
,
0
));
UBGraphicsAppleWidgetItem
*
addAppleWidget
(
const
QUrl
&
pWidgetUrl
,
const
QPointF
&
pPos
=
QPointF
(
0
,
0
));
UBGraphicsW3CWidgetItem
*
addW3CWidget
(
const
QUrl
&
pWidgetUrl
,
const
QPointF
&
pPos
=
QPointF
(
0
,
0
)
,
int
widgetType
=
UBGraphicsItemType
::
W3CWidgetItemType
);
UBGraphicsW3CWidgetItem
*
addW3CWidget
(
const
QUrl
&
pWidgetUrl
,
const
QPointF
&
pPos
=
QPointF
(
0
,
0
));
void
addGraphicsWidget
(
UBGraphicsWidgetItem
*
graphicsWidget
,
const
QPointF
&
pPos
=
QPointF
(
0
,
0
));
UBGraphicsMediaItem
*
addMedia
(
const
QUrl
&
pMediaFileUrl
,
bool
shouldPlayAsap
,
const
QPointF
&
pPos
=
QPointF
(
0
,
0
));
...
...
src/domain/UBGraphicsWebView.cpp
0 → 100644
View file @
37149617
/*
* This program 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, either version 2 of the License, or
* (at your option) any later version.
*
* This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "UBGraphicsWebView.h"
#include <QtGui>
#include <QtWebKit>
#include "UBGraphicsScene.h"
#include "UBGraphicsItemDelegate.h"
#include "UBGraphicsDelegateFrame.h"
#include "core/memcheck.h"
UBGraphicsWebView
::
UBGraphicsWebView
(
QGraphicsItem
*
parent
)
:
QGraphicsWebView
(
parent
)
{
setData
(
UBGraphicsItemData
::
ItemLayerType
,
UBItemLayerType
::
Object
);
mDelegate
=
new
UBGraphicsItemDelegate
(
this
,
0
,
true
,
false
,
false
);
mDelegate
->
init
();
setFlag
(
QGraphicsItem
::
ItemSendsGeometryChanges
,
true
);
QGraphicsWebView
::
setAcceptHoverEvents
(
true
);
}
UBGraphicsWebView
::~
UBGraphicsWebView
()
{
if
(
mDelegate
)
delete
mDelegate
;
}
QVariant
UBGraphicsWebView
::
itemChange
(
GraphicsItemChange
change
,
const
QVariant
&
value
)
{
if
(
change
==
QGraphicsItem
::
ItemCursorHasChanged
&&
scene
())
{
unsetCursor
();
}
if
((
change
==
QGraphicsItem
::
ItemSelectedHasChanged
)
&&
scene
())
{
if
(
isSelected
())
{
scene
()
->
setActiveWindow
(
this
);
}
else
{
if
(
scene
()
->
activeWindow
()
==
this
)
{
scene
()
->
setActiveWindow
(
0
);
}
}
}
QVariant
newValue
=
mDelegate
->
itemChange
(
change
,
value
);
return
QGraphicsWebView
::
itemChange
(
change
,
newValue
);
}
void
UBGraphicsWebView
::
setUuid
(
const
QUuid
&
pUuid
)
{
UBItem
::
setUuid
(
pUuid
);
setData
(
UBGraphicsItemData
::
ItemUuid
,
QVariant
(
pUuid
));
//store item uuid inside the QGraphicsItem to fast operations with Items on the scene
}
void
UBGraphicsWebView
::
mousePressEvent
(
QGraphicsSceneMouseEvent
*
event
)
{
if
(
mDelegate
->
mousePressEvent
(
event
))
{
//NOOP
}
else
{
// QT Proxy Widget is a bit lazy, we force the selection ...
setSelected
(
true
);
}
QGraphicsWebView
::
mousePressEvent
(
event
);
}
void
UBGraphicsWebView
::
mouseMoveEvent
(
QGraphicsSceneMouseEvent
*
event
)
{
if
(
mDelegate
->
mouseMoveEvent
(
event
))
{
// NOOP;
}
else
{
QGraphicsWebView
::
mouseMoveEvent
(
event
);
}
}
void
UBGraphicsWebView
::
mouseReleaseEvent
(
QGraphicsSceneMouseEvent
*
event
)
{
mDelegate
->
mouseReleaseEvent
(
event
);
QGraphicsWebView
::
mouseReleaseEvent
(
event
);
}
void
UBGraphicsWebView
::
wheelEvent
(
QGraphicsSceneWheelEvent
*
event
)
{
if
(
mDelegate
->
weelEvent
(
event
)
)
{
QGraphicsWebView
::
wheelEvent
(
event
);
event
->
accept
();
}
}
void
UBGraphicsWebView
::
hoverEnterEvent
(
QGraphicsSceneHoverEvent
*
event
)
{
Q_UNUSED
(
event
)
// NOOP
}
void
UBGraphicsWebView
::
hoverLeaveEvent
(
QGraphicsSceneHoverEvent
*
event
)
{
Q_UNUSED
(
event
)
// NOOP
}
void
UBGraphicsWebView
::
setDelegate
(
UBGraphicsItemDelegate
*
pDelegate
)
{
if
(
mDelegate
)
{
delete
mDelegate
;
}
mDelegate
=
pDelegate
;
}
void
UBGraphicsWebView
::
resize
(
qreal
w
,
qreal
h
)
{
UBGraphicsWebView
::
resize
(
QSizeF
(
w
,
h
));
}
void
UBGraphicsWebView
::
resize
(
const
QSizeF
&
pSize
)
{
if
(
pSize
!=
size
())
{
QGraphicsWebView
::
setMaximumSize
(
pSize
.
width
(),
pSize
.
height
());
QGraphicsWebView
::
resize
(
pSize
.
width
(),
pSize
.
height
());
if
(
mDelegate
)
mDelegate
->
positionHandles
();
if
(
scene
())
scene
()
->
setModified
(
true
);
}
}
QSizeF
UBGraphicsWebView
::
size
()
const
{
return
QGraphicsWebView
::
size
();
}
UBGraphicsScene
*
UBGraphicsWebView
::
scene
()
{
return
static_cast
<
UBGraphicsScene
*>
(
QGraphicsItem
::
scene
());
}
void
UBGraphicsWebView
::
remove
()
{
if
(
mDelegate
)
mDelegate
->
remove
(
true
);
}
src/domain/UBGraphicsWebView.h
0 → 100644
View file @
37149617
/*
* This program 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, either version 2 of the License, or
* (at your option) any later version.
*
* This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef UBGRAPHICSWEBVIEW_H_
#define UBGRAPHICSWEBVIEW_H_
#include <QtGui>
#include <QtWebKit>
#include "UBItem.h"
#include "UBResizableGraphicsItem.h"
class
UBGraphicsItemDelegate
;
class
UBGraphicsWebView
:
public
QGraphicsWebView
,
public
UBItem
,
public
UBResizableGraphicsItem
,
public
UBGraphicsItem
{
public
:
UBGraphicsWebView
(
QGraphicsItem
*
parent
=
0
);
virtual
~
UBGraphicsWebView
();
virtual
void
resize
(
qreal
w
,
qreal
h
);
virtual
void
resize
(
const
QSizeF
&
size
);
virtual
QSizeF
size
()
const
;
void
setDelegate
(
UBGraphicsItemDelegate
*
pDelegate
);
virtual
UBGraphicsScene
*
scene
();
virtual
void
remove
();
virtual
UBGraphicsItemDelegate
*
Delegate
()
const
{
return
mDelegate
;}
virtual
void
clearSource
(){;}
virtual
void
setUuid
(
const
QUuid
&
pUuid
);
protected
:
virtual
void
mousePressEvent
(
QGraphicsSceneMouseEvent
*
event
);
virtual
void
mouseMoveEvent
(
QGraphicsSceneMouseEvent
*
event
);
virtual
void
mouseReleaseEvent
(
QGraphicsSceneMouseEvent
*
event
);
virtual
void
wheelEvent
(
QGraphicsSceneWheelEvent
*
event
);
virtual
void
hoverEnterEvent
(
QGraphicsSceneHoverEvent
*
event
);
virtual
void
hoverLeaveEvent
(
QGraphicsSceneHoverEvent
*
event
);
virtual
QVariant
itemChange
(
GraphicsItemChange
change
,
const
QVariant
&
value
);
};
#endif
/* UBGRAPHICSWEBVIEW_H_ */
src/domain/UBGraphicsWidgetItem.cpp
View file @
37149617
This diff is collapsed.
Click to expand it.
src/domain/UBGraphicsWidgetItem.h
View file @
37149617
...
...
@@ -20,7 +20,7 @@
#include "core/UB.h"
#include "UBGraphics
ProxyWidget
.h"
#include "UBGraphics
WebView
.h"
#include "UBW3CWidget.h"
#include "UBAppleWidget.h"
...
...
@@ -32,7 +32,7 @@ class UBW3CWidgetWebStorageAPI;
class
UBGraphiscItem
;
class
UBGraphiscItemDelegate
;
class
UBGraphicsWidgetItem
:
public
UBGraphics
ProxyWidget
class
UBGraphicsWidgetItem
:
public
UBGraphics
WebView
{
Q_OBJECT
...
...
@@ -42,26 +42,25 @@ class UBGraphicsWidgetItem : public UBGraphicsProxyWidget
virtual
UBGraphicsScene
*
scene
();
UBAbstractWidget
*
widgetWebView
();
virtual
void
initialize
();
virtual
UBItem
*
deepCopy
()
const
=
0
;
virtual
void
resize
(
qreal
w
,
qreal
h
);
virtual
void
resize
(
const
QSizeF
&
size
);
/* preferences */
void
setPreference
(
const
QString
&
key
,
QString
value
);
QString
preference
(
const
QString
&
key
)
const
;
QMap
<
QString
,
QString
>
preferences
()
const
;
void
removePreference
(
const
QString
&
key
);
void
removeAllPreferences
();
/* datastore */
void
setDatastoreEntry
(
const
QString
&
key
,
QString
value
);
QString
datastoreEntry
(
const
QString
&
key
)
const
;
QMap
<
QString
,
QString
>
datastoreEntries
()
const
;
void
removeDatastoreEntry
(
const
QString
&
key
);
void
removeAllDatastoreEntries
();
virtual
UBGraphicsItemDelegate
*
Delegate
()
const
{
return
mDelegate
;
}
virtual
void
remove
();
...
...
@@ -80,6 +79,73 @@ class UBGraphicsWidgetItem : public UBGraphicsProxyWidget
virtual
void
clearSource
();
virtual
void
setUuid
(
const
QUuid
&
pUuid
);
/* from UBAbstractWidget */
void
loadMainHtml
();
QUrl
mainHtml
()
{
return
mMainHtmlUrl
;
}
QUrl
widgetUrl
()
{
return
mWidgetUrl
;
}
QString
mainHtmlFileName
()
{
return
mMainHtmlFileName
;
}
bool
hasEmbededObjects
();
bool
hasEmbededFlash
();
void
resize
(
qreal
width
,
qreal
height
);
QSize
nominalSize
()
const
{
return
mNominalSize
;
}
bool
canBeContent
();
bool
canBeTool
();
bool
hasLoadedSuccessfully
()
const
{
return
(
mInitialLoadDone
&&
!
mLoadIsErronous
);
}
bool
freezable
()
{
return
mIsFreezable
;
}
bool
resizable
()
{
return
mIsResizable
;
}
static
QString
iconFilePath
(
const
QUrl
&
pUrl
);
static
QString
widgetName
(
const
QUrl
&
pUrl
);
static
int
widgetType
(
const
QUrl
&
pUrl
);
bool
isFrozen
()
{
return
mIsFrozen
;
}
QPixmap
snapshot
(){
return
mSnapshot
;
}
void
setSnapshot
(
const
QPixmap
&
pix
);
QPixmap
takeSnapshot
();
public
slots
:
void
freeze
();
void
unFreeze
();
/* end from */
protected
:
...
...
@@ -96,14 +162,44 @@ class UBGraphicsWidgetItem : public UBGraphicsProxyWidget
virtual
void
sendJSEnterEvent
();
virtual
void
sendJSLeaveEvent
();
UBAbstractWidget
*
mWebKitWidget
;
QMap
<
QString
,
QString
>
mPreferences
;
QMap
<
QString
,
QString
>
mDatastore
;
/* from UBAbstractWidget*/
bool
mMouseIsPressed
;
bool
mFirstReleaseAfterMove
;
QUrl
mMainHtmlUrl
;
QString
mMainHtmlFileName
;
QUrl
mWidgetUrl
;
QSize
mNominalSize
;
bool
mIsResizable
;
bool
mInitialLoadDone
;
bool
mLoadIsErronous
;
bool
mIsFreezable
;
int
mCanBeContent
;
int
mCanBeTool
;
enum
OSType
{
type_NONE
=
0
,
// 0000
type_WIN
=
1
,
// 0001
type_MAC
=
2
,
// 0010
type_UNIX
=
4
,
// 0100
type_ALL
=
7
,
// 0111
};
virtual
void
injectInlineJavaScript
();
virtual
void
paint
(
QPainter
*
painter
,
const
QStyleOptionGraphicsItem
*
option
,
QWidget
*
widget
=
0
);
virtual
void
dropEvent
(
QDropEvent
*
);
/* end from */
protected
slots
:
void
geometryChangeRequested
(
const
QRect
&
geom
);
virtual
void
javaScriptWindowObjectCleared
();
/* from UBAbstractWidget*/
void
mainFrameLoadFinished
(
bool
ok
);
/* end from */
private
:
QPointF
mLastMousePos
;
...
...
@@ -111,6 +207,14 @@ class UBGraphicsWidgetItem : public UBGraphicsProxyWidget
UBWidgetUniboardAPI
*
mUniboardAPI
;
QUrl
ownFolder
;
QUrl
SnapshotFile
;
/* from UBAbstractWidget*/
static
QStringList
sInlineJavaScripts
;
static
bool
sInlineJavaScriptLoaded
;
bool
mIsFrozen
;
QPixmap
mSnapshot
;
bool
mIsTakingSnapshot
;
/* end from */
};
class
UBGraphicsAppleWidgetItem
:
public
UBGraphicsWidgetItem
...
...
@@ -119,7 +223,6 @@ class UBGraphicsAppleWidgetItem : public UBGraphicsWidgetItem
public
:
UBGraphicsAppleWidgetItem
(
const
QUrl
&
pWidgetUrl
,
QGraphicsItem
*
parent
=
0
);
UBGraphicsAppleWidgetItem
(
UBAppleWidget
*
appleWidget
,
QGraphicsItem
*
parent
=
0
);
~
UBGraphicsAppleWidgetItem
();
enum
{
Type
=
UBGraphicsItemType
::
AppleWidgetItemType
};
...
...
@@ -139,8 +242,7 @@ class UBGraphicsW3CWidgetItem : public UBGraphicsWidgetItem
Q_OBJECT
public
:
UBGraphicsW3CWidgetItem
(
const
QUrl
&
pWidgetUrl
,
QGraphicsItem
*
parent
=
0
,
int
widgetType
=
UBGraphicsItemType
::
W3CWidgetItemType
);
UBGraphicsW3CWidgetItem
(
UBW3CWidget
*
w3cWidget
,
QGraphicsItem
*
parent
=
0
,
int
widgetType
=
UBGraphicsItemType
::
W3CWidgetItemType
);
UBGraphicsW3CWidgetItem
(
const
QUrl
&
pWidgetUrl
,
QGraphicsItem
*
parent
=
0
);
~
UBGraphicsW3CWidgetItem
();
enum
{
Type
=
UBGraphicsItemType
::
W3CWidgetItemType
};
...
...
@@ -152,22 +254,64 @@ class UBGraphicsW3CWidgetItem : public UBGraphicsWidgetItem
virtual
UBItem
*
deepCopy
()
const
;
UBW3CWidget
::
Metadata
metadatas
()
const
;
UBW3CWidget
*
w3cWidget
()
const
;
virtual
void
paint
(
QPainter
*
painter
,
const
QStyleOptionGraphicsItem
*
option
,
QWidget
*
widget
);
virtual
void
setUuid
(
const
QUuid
&
pUuid
);
static
QString
createNPAPIWrapper
(
const
QString
&
url
,
const
QString
&
pMimeType
=
QString
(),
const
QSize
&
sizeHint
=
QSize
(
300
,
150
),
const
QString
&
pName
=
QString
());
static
QString
createNPAPIWrapperInDir
(
const
QString
&
url
,
const
QDir
&
pDir
,
const
QString
&
pMimeType
=
QString
(),
const
QSize
&
sizeHint
=
QSize
(
300
,
150
),
const
QString
&
pName
=
QString
());
static
QString
createHtmlWrapperInDir
(
const
QString
&
html
,
const
QDir
&
pDir
,
const
QSize
&
sizeHint
,
const
QString
&
pName
);
static
QString
freezedWidgetPage
();
static
bool
hasNPAPIWrapper
(
const
QString
&
pMimeType
);
class
Metadata
{
public
:
QString
id
;
QString
name
;
QString
description
;
QString
author
;
QString
authorEmail
;
QString
authorHref
;
QString
version
;
};
Metadata
metadatas
()
const
{
return
mMetadatas
;
}
Metadata
mMetadatas
;
private
slots
:
virtual
void
javaScriptWindowObjectCleared
();
private
:
UBW3CWidget
*
mW3CWidget
;
UBW3CWidgetAPI
*
mW3CWidgetAPI
;
static
bool
sTemplateLoaded
;
static
QMap
<
QString
,
QString
>
sNPAPIWrapperTemplates
;
static
QString
sNPAPIWrappperConfigTemplate
;
static
void
loadNPAPIWrappersTemplates
();
static
QString
textForSubElementByLocale
(
QDomElement
rootElement
,
QString
subTagName
,
QLocale
locale
);
};
...
...
src/domain/UBGraphicsWidgetItemDelegate.cpp
View file @
37149617
...
...
@@ -55,7 +55,7 @@ void UBGraphicsWidgetItemDelegate::updateMenuActionState()
UBGraphicsItemDelegate
::
updateMenuActionState
();
if
(
freezeAction
)
freezeAction
->
setChecked
(
delegated
()
->
widgetWebView
()
->
isFrozen
());
freezeAction
->
setChecked
(
delegated
()
->
isFrozen
());
}
void
UBGraphicsWidgetItemDelegate
::
decorateMenu
(
QMenu
*
menu
)
...
...
@@ -71,7 +71,7 @@ void UBGraphicsWidgetItemDelegate::decorateMenu(QMenu* menu)
freezeAction
->
setCheckable
(
true
);
if
(
delegated
()
->
widgetWebView
()
->
canBeTool
())
if
(
delegated
()
->
canBeTool
())
{
setAsToolAction
=
mMenu
->
addAction
(
tr
(
"Transform as Tool "
),
this
,
SLOT
(
pin
()));
QIcon
pinIcon
;
...
...
@@ -86,11 +86,11 @@ void UBGraphicsWidgetItemDelegate::freeze(bool frozen)
{
if
(
frozen
)
{
delegated
()
->
widgetWebView
()
->
freeze
();
delegated
()
->
freeze
();
}
else
{
delegated
()
->
widgetWebView
()
->
unFreeze
();
delegated
()
->
unFreeze
();
}
}
...
...
src/domain/domain.pri
View file @
37149617
...
...
@@ -7,6 +7,7 @@ HEADERS += src/domain/UBGraphicsScene.h \
src/domain/UBDocumentUndoCommand.h \
src/domain/UBPageSizeUndoCommand.h \
src/domain/UBGraphicsProxyWidget.h \
src/domain/UBGraphicsWebView.h \
src/domain/UBGraphicsSvgItem.h \
src/domain/UBGraphicsPolygonItem.h \
src/domain/UBItem.h \
...
...
@@ -40,6 +41,7 @@ SOURCES += src/domain/UBGraphicsScene.cpp \
src/domain/UBDocumentUndoCommand.cpp \
src/domain/UBPageSizeUndoCommand.cpp \
src/domain/UBGraphicsProxyWidget.cpp \
src/domain/UBGraphicsWebView.cpp \
src/domain/UBGraphicsSvgItem.cpp \
src/domain/UBGraphicsPolygonItem.cpp \
src/domain/UBItem.cpp \
...
...
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