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
2a30387e
Commit
2a30387e
authored
Mar 13, 2012
by
Ivan Ilin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Sankore284
parent
ff90ddf3
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
87 additions
and
14 deletions
+87
-14
freezedWidgetWrapper.html
resources/etc/freezedWidgetWrapper.html
+47
-0
UBBoardController.cpp
src/board/UBBoardController.cpp
+13
-14
UBW3CWidget.cpp
src/domain/UBW3CWidget.cpp
+25
-0
UBW3CWidget.h
src/domain/UBW3CWidget.h
+2
-0
No files found.
resources/etc/freezedWidgetWrapper.html
0 → 100644
View file @
2a30387e
<html>
<head>
<title>
ololo
</title>
<style>
html
,
body
{
margin
:
0
;
padding
:
0
;
height
:
100%
;
width
:
100%
;
}
div
{
text-align
:
center
;
border
:
5px
#ccc
outset
;
}
</style>
<script
type=
"text/javascript"
>
window
.
onload
=
function
(){
var
div
=
document
.
getElementById
(
"freezed"
);
div
.
style
.
width
=
getDocWidth
()
-
10
;
div
.
style
.
height
=
getDocHeight
()
/
2
-
10
;
div
.
style
.
paddingTop
=
getDocHeight
()
/
2
function
getDocHeight
()
{
var
D
=
document
;
return
Math
.
max
(
Math
.
max
(
D
.
body
.
scrollHeight
,
D
.
documentElement
.
scrollHeight
),
Math
.
max
(
D
.
body
.
offsetHeight
,
D
.
documentElement
.
offsetHeight
),
Math
.
max
(
D
.
body
.
clientHeight
,
D
.
documentElement
.
clientHeight
)
);
}
function
getDocWidth
()
{
var
D
=
document
;
return
Math
.
max
(
Math
.
max
(
D
.
body
.
scrollWidth
,
D
.
documentElement
.
scrollWidth
),
Math
.
max
(
D
.
body
.
offsetWidth
,
D
.
documentElement
.
offsetWidth
),
Math
.
max
(
D
.
body
.
clientWidth
,
D
.
documentElement
.
clientWidth
)
);
}
}
</script>
</head>
<body>
<div
id=
"freezed"
>
Widget freezed.
</div>
</body>
</html>
\ No newline at end of file
src/board/UBBoardController.cpp
View file @
2a30387e
...
...
@@ -365,7 +365,7 @@ void UBBoardController::connectToolbar()
void
UBBoardController
::
startScript
()
{
freezeW3CWidgets
(
fals
e
);
freezeW3CWidgets
(
tru
e
);
}
void
UBBoardController
::
stopScript
()
...
...
@@ -2160,16 +2160,15 @@ void UBBoardController::freezeW3CWidgets(bool freeze)
void
UBBoardController
::
freezeW3CWidget
(
QGraphicsItem
*
item
,
bool
freeze
)
{
if
(
item
->
type
()
==
UBGraphicsW3CWidgetItem
::
Type
)
{
QString
scriptString
;
if
(
freeze
)
scriptString
=
"setfreezed(true);"
;
else
scriptString
=
"setfreezed(false);"
;
UBGraphicsW3CWidgetItem
*
item_casted
=
dynamic_cast
<
UBGraphicsW3CWidgetItem
*>
(
item
);
if
(
0
==
item_casted
)
return
;
item_casted
->
widgetWebView
()
->
page
()
->
mainFrame
()
->
evaluateJavaScript
(
scriptString
);
}
}
\ No newline at end of file
if
(
item
->
type
()
==
UBGraphicsW3CWidgetItem
::
Type
)
{
UBGraphicsW3CWidgetItem
*
item_casted
=
dynamic_cast
<
UBGraphicsW3CWidgetItem
*>
(
item
);
if
(
0
==
item_casted
)
return
;
if
(
freeze
)
{
item_casted
->
widgetWebView
()
->
page
()
->
mainFrame
()
->
setContent
(
UBW3CWidget
::
freezedWidgetPage
().
toAscii
());
}
else
item_casted
->
widgetWebView
()
->
loadMainHtml
();
}
}
src/domain/UBW3CWidget.cpp
View file @
2a30387e
...
...
@@ -29,6 +29,8 @@
#include "core/memcheck.h"
const
QString
freezedWidgetDefaultContentFilePath
=
"./etc/freezedWidgetWrapper.html"
;
bool
UBW3CWidget
::
sTemplateLoaded
=
false
;
QMap
<
QString
,
QString
>
UBW3CWidget
::
sNPAPIWrapperTemplates
;
QString
UBW3CWidget
::
sNPAPIWrappperConfigTemplate
;
...
...
@@ -416,6 +418,29 @@ QString UBW3CWidget::createHtmlWrapperInDir(const QString& html, const QDir& pDi
}
QString
UBW3CWidget
::
freezedWidgetPage
()
{
static
QString
defaultcontent
;
if
(
defaultcontent
.
isNull
())
{
QFile
wrapperFile
(
freezedWidgetDefaultContentFilePath
);
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
);
}
else
{
qDebug
()
<<
"content of "
+
freezedWidgetDefaultContentFilePath
+
"is empty"
;
defaultcontent
=
""
;
}
}
}
return
defaultcontent
;
}
void
UBW3CWidget
::
loadNPAPIWrappersTemplates
()
{
if
(
!
sTemplateLoaded
)
...
...
src/domain/UBW3CWidget.h
View file @
2a30387e
...
...
@@ -48,6 +48,8 @@ class UBW3CWidget : public UBAbstractWidget
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
PreferenceValue
...
...
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