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
872e2ee9
Commit
872e2ee9
authored
Sep 26, 2012
by
Claudio Valerio
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/develop' into claudio-dev
parents
3e5e946a
57a2d141
Changes
26
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
26 changed files
with
508 additions
and
385 deletions
+508
-385
script.js
...urces/library/interactivities/Cat images.wgt/js/script.js
+33
-46
script.js
...ry/interactivities/Cat images.wgt/locales/fr/js/script.js
+35
-47
script.js
...ry/interactivities/Cat images.wgt/locales/ru/js/script.js
+35
-47
script.js
resources/library/interactivities/Cat text.wgt/js/script.js
+31
-44
script.js
...rary/interactivities/Cat text.wgt/locales/fr/js/script.js
+30
-42
script.js
...rary/interactivities/Cat text.wgt/locales/ru/js/script.js
+30
-42
UBSvgSubsetAdaptor.cpp
src/adaptors/UBSvgSubsetAdaptor.cpp
+1
-1
UBLibraryAPI.cpp
src/api/UBLibraryAPI.cpp
+1
-1
UBWidgetUniboardAPI.cpp
src/api/UBWidgetUniboardAPI.cpp
+2
-2
UBBoardController.cpp
src/board/UBBoardController.cpp
+88
-55
UBBoardController.h
src/board/UBBoardController.h
+4
-4
UBBoardPaletteManager.cpp
src/board/UBBoardPaletteManager.cpp
+1
-0
UBBoardView.cpp
src/board/UBBoardView.cpp
+5
-0
UBFeaturesController.cpp
src/board/UBFeaturesController.cpp
+1
-1
UBDownloadManager.cpp
src/core/UBDownloadManager.cpp
+127
-21
UBDownloadManager.h
src/core/UBDownloadManager.h
+28
-5
UBGraphicsDelegateFrame.cpp
src/domain/UBGraphicsDelegateFrame.cpp
+1
-2
UBGraphicsMediaItem.cpp
src/domain/UBGraphicsMediaItem.cpp
+7
-3
UBGraphicsScene.cpp
src/domain/UBGraphicsScene.cpp
+17
-9
UBFileSystemUtils.cpp
src/frameworks/UBFileSystemUtils.cpp
+1
-3
UBFileSystemUtils.h
src/frameworks/UBFileSystemUtils.h
+4
-1
UBFeaturesWidget.cpp
src/gui/UBFeaturesWidget.cpp
+2
-2
UBGraphicsCache.cpp
src/tools/UBGraphicsCache.cpp
+13
-2
UBGraphicsCache.h
src/tools/UBGraphicsCache.h
+9
-3
UBTrapFlashController.cpp
src/web/UBTrapFlashController.cpp
+1
-1
WBWebTrapWebView.cpp
src/web/browser/WBWebTrapWebView.cpp
+1
-1
No files found.
resources/library/interactivities/Cat images.wgt/js/script.js
View file @
872e2ee9
...
@@ -112,7 +112,7 @@ function start(){
...
@@ -112,7 +112,7 @@ function start(){
drop
:
function
(
event
,
ui
)
{
drop
:
function
(
event
,
ui
)
{
if
(
$
(
ui
.
draggable
).
parent
().
parent
().
html
()
==
$
(
this
).
parent
().
html
()){
if
(
$
(
ui
.
draggable
).
parent
().
parent
().
html
()
==
$
(
this
).
parent
().
html
()){
var
tmp_ui
=
$
(
ui
.
draggable
).
parent
();
var
tmp_ui
=
$
(
ui
.
draggable
).
parent
();
checkOnDrop
(
$
(
this
),
$
(
ui
.
draggable
));
$
(
this
).
append
(
$
(
ui
.
draggable
));
checkCorrectness
(
tmp_ui
);
checkCorrectness
(
tmp_ui
);
}
}
}
}
...
@@ -341,7 +341,7 @@ function importData(data){
...
@@ -341,7 +341,7 @@ function importData(data){
drop
:
function
(
event
,
ui
)
{
drop
:
function
(
event
,
ui
)
{
if
(
$
(
ui
.
draggable
).
parent
().
parent
().
html
()
==
$
(
this
).
parent
().
html
()){
if
(
$
(
ui
.
draggable
).
parent
().
parent
().
html
()
==
$
(
this
).
parent
().
html
()){
var
tmp_ui
=
$
(
ui
.
draggable
).
parent
();
var
tmp_ui
=
$
(
ui
.
draggable
).
parent
();
checkOnDrop
(
$
(
this
),
$
(
ui
.
draggable
));
$
(
this
).
append
(
$
(
ui
.
draggable
));
checkCorrectness
(
tmp_ui
);
checkCorrectness
(
tmp_ui
);
}
}
}
}
...
@@ -413,12 +413,11 @@ function importData(data){
...
@@ -413,12 +413,11 @@ function importData(data){
drop
:
function
(
event
,
ui
)
{
drop
:
function
(
event
,
ui
)
{
if
(
$
(
ui
.
draggable
).
parent
().
parent
().
html
()
==
$
(
this
).
parent
().
html
()){
if
(
$
(
ui
.
draggable
).
parent
().
parent
().
html
()
==
$
(
this
).
parent
().
html
()){
var
tmp_ui
=
$
(
ui
.
draggable
).
parent
();
var
tmp_ui
=
$
(
ui
.
draggable
).
parent
();
checkOnDrop
(
$
(
this
),
$
(
ui
.
draggable
));
$
(
this
).
append
(
$
(
ui
.
draggable
));
checkCorrectness
(
tmp_ui
);
checkCorrectness
(
tmp_ui
);
}
}
}
}
});
});
checkCorrectness
(
imgs_container
);
}
}
all_imgs
=
$
(
"<div class='all_imgs'>"
).
appendTo
(
container
);
all_imgs
=
$
(
"<div class='all_imgs'>"
).
appendTo
(
container
);
...
@@ -458,6 +457,7 @@ function importData(data){
...
@@ -458,6 +457,7 @@ function importData(data){
}
}
});
});
container
.
appendTo
(
"#data"
);
container
.
appendTo
(
"#data"
);
checkCorrectness
(
all_imgs
);
}
}
}
}
}
}
...
@@ -520,7 +520,7 @@ function showExample(){
...
@@ -520,7 +520,7 @@ function showExample(){
drop
:
function
(
event
,
ui
)
{
drop
:
function
(
event
,
ui
)
{
if
(
$
(
ui
.
draggable
).
parent
().
parent
().
html
()
==
$
(
this
).
parent
().
html
()){
if
(
$
(
ui
.
draggable
).
parent
().
parent
().
html
()
==
$
(
this
).
parent
().
html
()){
var
tmp_ui
=
$
(
ui
.
draggable
).
parent
();
var
tmp_ui
=
$
(
ui
.
draggable
).
parent
();
checkOnDrop
(
$
(
this
),
$
(
ui
.
draggable
));
$
(
this
).
append
(
$
(
ui
.
draggable
));
checkCorrectness
(
tmp_ui
);
checkCorrectness
(
tmp_ui
);
}
}
}
}
...
@@ -531,7 +531,7 @@ function showExample(){
...
@@ -531,7 +531,7 @@ function showExample(){
drop
:
function
(
event
,
ui
)
{
drop
:
function
(
event
,
ui
)
{
if
(
$
(
ui
.
draggable
).
parent
().
parent
().
html
()
==
$
(
this
).
parent
().
html
()){
if
(
$
(
ui
.
draggable
).
parent
().
parent
().
html
()
==
$
(
this
).
parent
().
html
()){
var
tmp_ui
=
$
(
ui
.
draggable
).
parent
();
var
tmp_ui
=
$
(
ui
.
draggable
).
parent
();
checkOnDrop
(
$
(
this
),
$
(
ui
.
draggable
));
$
(
this
).
append
(
$
(
ui
.
draggable
));
checkCorrectness
(
tmp_ui
);
checkCorrectness
(
tmp_ui
);
}
}
}
}
...
@@ -561,9 +561,9 @@ function addCategory(obj){
...
@@ -561,9 +561,9 @@ function addCategory(obj){
$
(
"<button class='del_category'></button>"
).
appendTo
(
imgs_container
);
$
(
"<button class='del_category'></button>"
).
appendTo
(
imgs_container
);
$
(
"<button class='add_category'></button>"
).
appendTo
(
imgs_container
);
$
(
"<button class='add_category'></button>"
).
appendTo
(
imgs_container
);
imgs_container
.
attr
(
"ondragenter"
,
"return false;"
)
imgs_container
.
attr
(
"ondragenter"
,
"return false;"
)
.
attr
(
"ondragleave"
,
"$(this).css(
\"
background-color
\"
,
\"\"
); return false;"
)
.
attr
(
"ondragleave"
,
"$(this).css(
\"
background-color
\"
,
\"
#e6f6ff
\"
); return false;"
)
.
attr
(
"ondragover"
,
"$(this).css(
\"
background-color
\"
,
\"\"
); return false;"
)
.
attr
(
"ondragover"
,
"$(this).css(
\"
background-color
\"
,
\"
#c3e9ff
\"
); return false;"
)
.
attr
(
"ondrop"
,
"$(this).css(
\"
background-color
\"
,
\"\"
); return onDropTarget(this,event);"
);
.
attr
(
"ondrop"
,
"$(this).css(
\"
background-color
\"
,
\"
#e6f6ff
\"
); return onDropTarget(this,event);"
);
}
}
//add new container
//add new container
...
@@ -686,8 +686,7 @@ function returnId(){
...
@@ -686,8 +686,7 @@ function returnId(){
}
}
//a func for checking when smth will drop
//a func for checking when smth will drop
function
checkOnDrop
(
dest
,
source
){
function
checkOnDrop
(
dest
){
dest
.
append
(
source
);
var
tmp_count
=
dest
.
find
(
"input[name='count']"
).
val
();
var
tmp_count
=
dest
.
find
(
"input[name='count']"
).
val
();
var
tmp_mask
=
dest
.
find
(
"input[name='mask']"
).
val
();
var
tmp_mask
=
dest
.
find
(
"input[name='mask']"
).
val
();
if
(
dest
.
find
(
".img_block"
).
size
()
==
tmp_count
){
if
(
dest
.
find
(
".img_block"
).
size
()
==
tmp_count
){
...
@@ -697,47 +696,35 @@ function checkOnDrop(dest, source){
...
@@ -697,47 +696,35 @@ function checkOnDrop(dest, source){
tmp_right
=
false
;
tmp_right
=
false
;
});
});
if
(
tmp_right
)
if
(
tmp_right
)
dest
.
removeClass
(
"def_cont"
)
dest
.
removeClass
(
"def_cont"
).
removeClass
(
"red_cont"
).
addClass
(
"green_cont"
);
.
removeClass
(
"red_cont"
)
.
addClass
(
"green_cont"
);
else
else
dest
.
removeClass
(
"def_cont"
)
dest
.
removeClass
(
"def_cont"
).
removeClass
(
"green_cont"
).
addClass
(
"red_cont"
);
.
removeClass
(
"green_cont"
)
.
addClass
(
"red_cont"
);
}
else
}
else
dest
.
removeClass
(
"def_cont"
)
dest
.
removeClass
(
"def_cont"
).
removeClass
(
"green_cont"
).
addClass
(
"red_cont"
);
.
removeClass
(
"green_cont"
)
.
addClass
(
"red_cont"
);
}
}
//checking source on correctness
//checking source on correctness
function
checkCorrectness
(
source
){
function
checkCorrectness
(
source
){
if
(
!
source
.
hasClass
(
"all_imgs"
)){
if
(
!
source
.
hasClass
(
"all_imgs"
)){
var
tmp_count
=
source
.
find
(
"input[name='count']"
).
val
();
if
(
source
.
parent
().
find
(
".all_imgs"
).
find
(
".img_block"
).
size
()
==
0
){
var
tmp_mask
=
source
.
find
(
"input[name='mask']"
).
val
();
source
.
parent
().
find
(
".imgs_cont"
).
each
(
function
(){
if
(
source
.
find
(
".img_block"
).
size
()
==
tmp_count
){
checkOnDrop
(
$
(
this
))
var
tmp_right
=
true
;
})
source
.
find
(
".img_block"
).
each
(
function
(){
}
else
{
if
(
$
(
this
).
find
(
"input"
).
val
()
!=
tmp_mask
)
source
.
parent
().
find
(
".imgs_cont"
).
each
(
function
(){
tmp_right
=
false
;
$
(
this
).
addClass
(
"def_cont"
).
removeClass
(
"green_cont"
).
removeClass
(
"red_cont"
);
});
})
}
if
(
tmp_right
)
}
else
{
source
.
removeClass
(
"def_cont"
)
if
(
source
.
find
(
".img_block"
).
size
()
>
0
){
.
removeClass
(
"red_cont"
)
source
.
parent
().
find
(
".imgs_cont"
).
each
(
function
(){
.
addClass
(
"green_cont"
);
$
(
this
).
addClass
(
"def_cont"
).
removeClass
(
"green_cont"
).
removeClass
(
"red_cont"
);
else
})
source
.
removeClass
(
"def_cont"
)
}
else
{
.
removeClass
(
"green_cont"
)
source
.
parent
().
find
(
".imgs_cont"
).
each
(
function
(){
.
addClass
(
"red_cont"
);
checkOnDrop
(
$
(
this
))
}
else
if
(
source
.
find
(
".img_block"
).
size
()
==
0
)
})
source
.
addClass
(
"def_cont"
)
}
.
removeClass
(
"green_cont"
)
.
removeClass
(
"red_cont"
);
else
source
.
removeClass
(
"def_cont"
)
.
removeClass
(
"green_cont"
)
.
addClass
(
"red_cont"
);
}
}
}
}
...
...
resources/library/interactivities/Cat images.wgt/locales/fr/js/script.js
View file @
872e2ee9
...
@@ -130,7 +130,7 @@ function start(){
...
@@ -130,7 +130,7 @@ function start(){
drop
:
function
(
event
,
ui
)
{
drop
:
function
(
event
,
ui
)
{
if
(
$
(
ui
.
draggable
).
parent
().
parent
().
html
()
==
$
(
this
).
parent
().
html
()){
if
(
$
(
ui
.
draggable
).
parent
().
parent
().
html
()
==
$
(
this
).
parent
().
html
()){
var
tmp_ui
=
$
(
ui
.
draggable
).
parent
();
var
tmp_ui
=
$
(
ui
.
draggable
).
parent
();
checkOnDrop
(
$
(
this
),
$
(
ui
.
draggable
));
$
(
this
).
append
(
$
(
ui
.
draggable
));
checkCorrectness
(
tmp_ui
);
checkCorrectness
(
tmp_ui
);
}
}
}
}
...
@@ -358,7 +358,7 @@ function importData(data){
...
@@ -358,7 +358,7 @@ function importData(data){
drop
:
function
(
event
,
ui
)
{
drop
:
function
(
event
,
ui
)
{
if
(
$
(
ui
.
draggable
).
parent
().
parent
().
html
()
==
$
(
this
).
parent
().
html
()){
if
(
$
(
ui
.
draggable
).
parent
().
parent
().
html
()
==
$
(
this
).
parent
().
html
()){
var
tmp_ui
=
$
(
ui
.
draggable
).
parent
();
var
tmp_ui
=
$
(
ui
.
draggable
).
parent
();
checkOnDrop
(
$
(
this
),
$
(
ui
.
draggable
));
$
(
this
).
append
(
$
(
ui
.
draggable
));
checkCorrectness
(
tmp_ui
);
checkCorrectness
(
tmp_ui
);
}
}
}
}
...
@@ -430,7 +430,7 @@ function importData(data){
...
@@ -430,7 +430,7 @@ function importData(data){
drop
:
function
(
event
,
ui
)
{
drop
:
function
(
event
,
ui
)
{
if
(
$
(
ui
.
draggable
).
parent
().
parent
().
html
()
==
$
(
this
).
parent
().
html
()){
if
(
$
(
ui
.
draggable
).
parent
().
parent
().
html
()
==
$
(
this
).
parent
().
html
()){
var
tmp_ui
=
$
(
ui
.
draggable
).
parent
();
var
tmp_ui
=
$
(
ui
.
draggable
).
parent
();
checkOnDrop
(
$
(
this
),
$
(
ui
.
draggable
));
$
(
this
).
append
(
$
(
ui
.
draggable
));
checkCorrectness
(
tmp_ui
);
checkCorrectness
(
tmp_ui
);
}
}
}
}
...
@@ -475,6 +475,7 @@ function importData(data){
...
@@ -475,6 +475,7 @@ function importData(data){
}
}
});
});
container
.
appendTo
(
"#data"
);
container
.
appendTo
(
"#data"
);
checkCorrectness
(
all_imgs
);
}
}
}
}
}
}
...
@@ -537,7 +538,7 @@ function showExample(){
...
@@ -537,7 +538,7 @@ function showExample(){
drop
:
function
(
event
,
ui
)
{
drop
:
function
(
event
,
ui
)
{
if
(
$
(
ui
.
draggable
).
parent
().
parent
().
html
()
==
$
(
this
).
parent
().
html
()){
if
(
$
(
ui
.
draggable
).
parent
().
parent
().
html
()
==
$
(
this
).
parent
().
html
()){
var
tmp_ui
=
$
(
ui
.
draggable
).
parent
();
var
tmp_ui
=
$
(
ui
.
draggable
).
parent
();
checkOnDrop
(
$
(
this
),
$
(
ui
.
draggable
));
$
(
this
).
append
(
$
(
ui
.
draggable
));
checkCorrectness
(
tmp_ui
);
checkCorrectness
(
tmp_ui
);
}
}
}
}
...
@@ -548,7 +549,7 @@ function showExample(){
...
@@ -548,7 +549,7 @@ function showExample(){
drop
:
function
(
event
,
ui
)
{
drop
:
function
(
event
,
ui
)
{
if
(
$
(
ui
.
draggable
).
parent
().
parent
().
html
()
==
$
(
this
).
parent
().
html
()){
if
(
$
(
ui
.
draggable
).
parent
().
parent
().
html
()
==
$
(
this
).
parent
().
html
()){
var
tmp_ui
=
$
(
ui
.
draggable
).
parent
();
var
tmp_ui
=
$
(
ui
.
draggable
).
parent
();
checkOnDrop
(
$
(
this
),
$
(
ui
.
draggable
));
$
(
this
).
append
(
$
(
ui
.
draggable
));
checkCorrectness
(
tmp_ui
);
checkCorrectness
(
tmp_ui
);
}
}
}
}
...
@@ -578,9 +579,9 @@ function addCategory(obj){
...
@@ -578,9 +579,9 @@ function addCategory(obj){
$
(
"<button class='del_category'></button>"
).
appendTo
(
imgs_container
);
$
(
"<button class='del_category'></button>"
).
appendTo
(
imgs_container
);
$
(
"<button class='add_category'></button>"
).
appendTo
(
imgs_container
);
$
(
"<button class='add_category'></button>"
).
appendTo
(
imgs_container
);
imgs_container
.
attr
(
"ondragenter"
,
"return false;"
)
imgs_container
.
attr
(
"ondragenter"
,
"return false;"
)
.
attr
(
"ondragleave"
,
"$(this).css(
\"
background-color
\"
,
\"\"
); return false;"
)
.
attr
(
"ondragleave"
,
"$(this).css(
\"
background-color
\"
,
\"
#e6f6ff
\"
); return false;"
)
.
attr
(
"ondragover"
,
"$(this).css(
\"
background-color
\"
,
\"\"
); return false;"
)
.
attr
(
"ondragover"
,
"$(this).css(
\"
background-color
\"
,
\"
#c3e9ff
\"
); return false;"
)
.
attr
(
"ondrop"
,
"$(this).css(
\"
background-color
\"
,
\"\"
); return onDropTarget(this,event);"
);
.
attr
(
"ondrop"
,
"$(this).css(
\"
background-color
\"
,
\"
#e6f6ff
\"
); return onDropTarget(this,event);"
);
}
}
//add new container
//add new container
...
@@ -599,9 +600,9 @@ function addContainer(){
...
@@ -599,9 +600,9 @@ function addContainer(){
$
(
"<button class='del_category'></button>"
).
appendTo
(
imgs_container
);
$
(
"<button class='del_category'></button>"
).
appendTo
(
imgs_container
);
$
(
"<button class='add_category'></button>"
).
appendTo
(
imgs_container
);
$
(
"<button class='add_category'></button>"
).
appendTo
(
imgs_container
);
imgs_container
.
attr
(
"ondragenter"
,
"return false;"
)
imgs_container
.
attr
(
"ondragenter"
,
"return false;"
)
.
attr
(
"ondragleave"
,
"$(this).css(
\"
background-color
\"
,
\"\"
); return false;"
)
.
attr
(
"ondragleave"
,
"$(this).css(
\"
background-color
\"
,
\"
#e6f6ff
\"
); return false;"
)
.
attr
(
"ondragover"
,
"$(this).css(
\"
background-color
\"
,
\"\"
); return false;"
)
.
attr
(
"ondragover"
,
"$(this).css(
\"
background-color
\"
,
\"
#c3e9ff
\"
); return false;"
)
.
attr
(
"ondrop"
,
"$(this).css(
\"
background-color
\"
,
\"\"
); return onDropTarget(this,event);"
);
.
attr
(
"ondrop"
,
"$(this).css(
\"
background-color
\"
,
\"
#e6f6ff
\"
); return onDropTarget(this,event);"
);
container
.
insertBefore
(
$
(
".add_block"
));
container
.
insertBefore
(
$
(
".add_block"
));
}
}
...
@@ -704,8 +705,7 @@ function returnId(){
...
@@ -704,8 +705,7 @@ function returnId(){
}
}
//a func for checking when smth will drop
//a func for checking when smth will drop
function
checkOnDrop
(
dest
,
source
){
function
checkOnDrop
(
dest
){
dest
.
append
(
source
);
var
tmp_count
=
dest
.
find
(
"input[name='count']"
).
val
();
var
tmp_count
=
dest
.
find
(
"input[name='count']"
).
val
();
var
tmp_mask
=
dest
.
find
(
"input[name='mask']"
).
val
();
var
tmp_mask
=
dest
.
find
(
"input[name='mask']"
).
val
();
if
(
dest
.
find
(
".img_block"
).
size
()
==
tmp_count
){
if
(
dest
.
find
(
".img_block"
).
size
()
==
tmp_count
){
...
@@ -715,47 +715,35 @@ function checkOnDrop(dest, source){
...
@@ -715,47 +715,35 @@ function checkOnDrop(dest, source){
tmp_right
=
false
;
tmp_right
=
false
;
});
});
if
(
tmp_right
)
if
(
tmp_right
)
dest
.
removeClass
(
"def_cont"
)
dest
.
removeClass
(
"def_cont"
).
removeClass
(
"red_cont"
).
addClass
(
"green_cont"
);
.
removeClass
(
"red_cont"
)
.
addClass
(
"green_cont"
);
else
else
dest
.
removeClass
(
"def_cont"
)
dest
.
removeClass
(
"def_cont"
).
removeClass
(
"green_cont"
).
addClass
(
"red_cont"
);
.
removeClass
(
"green_cont"
)
.
addClass
(
"red_cont"
);
}
else
}
else
dest
.
removeClass
(
"def_cont"
)
dest
.
removeClass
(
"def_cont"
).
removeClass
(
"green_cont"
).
addClass
(
"red_cont"
);
.
removeClass
(
"green_cont"
)
.
addClass
(
"red_cont"
);
}
}
//checking source on correctness
//checking source on correctness
function
checkCorrectness
(
source
){
function
checkCorrectness
(
source
){
if
(
!
source
.
hasClass
(
"all_imgs"
)){
if
(
!
source
.
hasClass
(
"all_imgs"
)){
var
tmp_count
=
source
.
find
(
"input[name='count']"
).
val
();
if
(
source
.
parent
().
find
(
".all_imgs"
).
find
(
".img_block"
).
size
()
==
0
){
var
tmp_mask
=
source
.
find
(
"input[name='mask']"
).
val
();
source
.
parent
().
find
(
".imgs_cont"
).
each
(
function
(){
if
(
source
.
find
(
".img_block"
).
size
()
==
tmp_count
){
checkOnDrop
(
$
(
this
))
var
tmp_right
=
true
;
})
source
.
find
(
".img_block"
).
each
(
function
(){
}
else
{
if
(
$
(
this
).
find
(
"input"
).
val
()
!=
tmp_mask
)
source
.
parent
().
find
(
".imgs_cont"
).
each
(
function
(){
tmp_right
=
false
;
$
(
this
).
addClass
(
"def_cont"
).
removeClass
(
"green_cont"
).
removeClass
(
"red_cont"
);
});
})
}
if
(
tmp_right
)
}
else
{
source
.
removeClass
(
"def_cont"
)
if
(
source
.
find
(
".img_block"
).
size
()
>
0
){
.
removeClass
(
"red_cont"
)
source
.
parent
().
find
(
".imgs_cont"
).
each
(
function
(){
.
addClass
(
"green_cont"
);
$
(
this
).
addClass
(
"def_cont"
).
removeClass
(
"green_cont"
).
removeClass
(
"red_cont"
);
else
})
source
.
removeClass
(
"def_cont"
)
}
else
{
.
removeClass
(
"green_cont"
)
source
.
parent
().
find
(
".imgs_cont"
).
each
(
function
(){
.
addClass
(
"red_cont"
);
checkOnDrop
(
$
(
this
))
}
else
if
(
source
.
find
(
".img_block"
).
size
()
==
0
)
})
source
.
addClass
(
"def_cont"
)
}
.
removeClass
(
"green_cont"
)
.
removeClass
(
"red_cont"
);
else
source
.
removeClass
(
"def_cont"
)
.
removeClass
(
"green_cont"
)
.
addClass
(
"red_cont"
);
}
}
}
}
...
...
resources/library/interactivities/Cat images.wgt/locales/ru/js/script.js
View file @
872e2ee9
...
@@ -111,7 +111,7 @@ function start(){
...
@@ -111,7 +111,7 @@ function start(){
drop
:
function
(
event
,
ui
)
{
drop
:
function
(
event
,
ui
)
{
if
(
$
(
ui
.
draggable
).
parent
().
parent
().
html
()
==
$
(
this
).
parent
().
html
()){
if
(
$
(
ui
.
draggable
).
parent
().
parent
().
html
()
==
$
(
this
).
parent
().
html
()){
var
tmp_ui
=
$
(
ui
.
draggable
).
parent
();
var
tmp_ui
=
$
(
ui
.
draggable
).
parent
();
checkOnDrop
(
$
(
this
),
$
(
ui
.
draggable
));
$
(
this
).
append
(
$
(
ui
.
draggable
));
checkCorrectness
(
tmp_ui
);
checkCorrectness
(
tmp_ui
);
}
}
}
}
...
@@ -342,7 +342,7 @@ function importData(data){
...
@@ -342,7 +342,7 @@ function importData(data){
drop
:
function
(
event
,
ui
)
{
drop
:
function
(
event
,
ui
)
{
if
(
$
(
ui
.
draggable
).
parent
().
parent
().
html
()
==
$
(
this
).
parent
().
html
()){
if
(
$
(
ui
.
draggable
).
parent
().
parent
().
html
()
==
$
(
this
).
parent
().
html
()){
var
tmp_ui
=
$
(
ui
.
draggable
).
parent
();
var
tmp_ui
=
$
(
ui
.
draggable
).
parent
();
checkOnDrop
(
$
(
this
),
$
(
ui
.
draggable
));
$
(
this
).
append
(
$
(
ui
.
draggable
));
checkCorrectness
(
tmp_ui
);
checkCorrectness
(
tmp_ui
);
}
}
}
}
...
@@ -414,7 +414,7 @@ function importData(data){
...
@@ -414,7 +414,7 @@ function importData(data){
drop
:
function
(
event
,
ui
)
{
drop
:
function
(
event
,
ui
)
{
if
(
$
(
ui
.
draggable
).
parent
().
parent
().
html
()
==
$
(
this
).
parent
().
html
()){
if
(
$
(
ui
.
draggable
).
parent
().
parent
().
html
()
==
$
(
this
).
parent
().
html
()){
var
tmp_ui
=
$
(
ui
.
draggable
).
parent
();
var
tmp_ui
=
$
(
ui
.
draggable
).
parent
();
checkOnDrop
(
$
(
this
),
$
(
ui
.
draggable
));
$
(
this
).
append
(
$
(
ui
.
draggable
));
checkCorrectness
(
tmp_ui
);
checkCorrectness
(
tmp_ui
);
}
}
}
}
...
@@ -459,6 +459,7 @@ function importData(data){
...
@@ -459,6 +459,7 @@ function importData(data){
}
}
});
});
container
.
appendTo
(
"#data"
);
container
.
appendTo
(
"#data"
);
checkCorrectness
(
all_imgs
);
}
}
}
}
}
}
...
@@ -521,7 +522,7 @@ function showExample(){
...
@@ -521,7 +522,7 @@ function showExample(){
drop
:
function
(
event
,
ui
)
{
drop
:
function
(
event
,
ui
)
{
if
(
$
(
ui
.
draggable
).
parent
().
parent
().
html
()
==
$
(
this
).
parent
().
html
()){
if
(
$
(
ui
.
draggable
).
parent
().
parent
().
html
()
==
$
(
this
).
parent
().
html
()){
var
tmp_ui
=
$
(
ui
.
draggable
).
parent
();
var
tmp_ui
=
$
(
ui
.
draggable
).
parent
();
checkOnDrop
(
$
(
this
),
$
(
ui
.
draggable
));
$
(
this
).
append
(
$
(
ui
.
draggable
));
checkCorrectness
(
tmp_ui
);
checkCorrectness
(
tmp_ui
);
}
}
}
}
...
@@ -532,7 +533,7 @@ function showExample(){
...
@@ -532,7 +533,7 @@ function showExample(){
drop
:
function
(
event
,
ui
)
{
drop
:
function
(
event
,
ui
)
{
if
(
$
(
ui
.
draggable
).
parent
().
parent
().
html
()
==
$
(
this
).
parent
().
html
()){
if
(
$
(
ui
.
draggable
).
parent
().
parent
().
html
()
==
$
(
this
).
parent
().
html
()){
var
tmp_ui
=
$
(
ui
.
draggable
).
parent
();
var
tmp_ui
=
$
(
ui
.
draggable
).
parent
();
checkOnDrop
(
$
(
this
),
$
(
ui
.
draggable
));
$
(
this
).
append
(
$
(
ui
.
draggable
));
checkCorrectness
(
tmp_ui
);
checkCorrectness
(
tmp_ui
);
}
}
}
}
...
@@ -562,9 +563,9 @@ function addCategory(obj){
...
@@ -562,9 +563,9 @@ function addCategory(obj){
$
(
"<button class='del_category'></button>"
).
appendTo
(
imgs_container
);
$
(
"<button class='del_category'></button>"
).
appendTo
(
imgs_container
);
$
(
"<button class='add_category'></button>"
).
appendTo
(
imgs_container
);
$
(
"<button class='add_category'></button>"
).
appendTo
(
imgs_container
);
imgs_container
.
attr
(
"ondragenter"
,
"return false;"
)
imgs_container
.
attr
(
"ondragenter"
,
"return false;"
)
.
attr
(
"ondragleave"
,
"$(this).css(
\"
background-color
\"
,
\"\"
); return false;"
)
.
attr
(
"ondragleave"
,
"$(this).css(
\"
background-color
\"
,
\"
#e6f6ff
\"
); return false;"
)
.
attr
(
"ondragover"
,
"$(this).css(
\"
background-color
\"
,
\"\"
); return false;"
)
.
attr
(
"ondragover"
,
"$(this).css(
\"
background-color
\"
,
\"
#c3e9ff
\"
); return false;"
)
.
attr
(
"ondrop"
,
"$(this).css(
\"
background-color
\"
,
\"\"
); return onDropTarget(this,event);"
);
.
attr
(
"ondrop"
,
"$(this).css(
\"
background-color
\"
,
\"
#e6f6ff
\"
); return onDropTarget(this,event);"
);
}
}
//add new container
//add new container
...
@@ -583,9 +584,9 @@ function addContainer(){
...
@@ -583,9 +584,9 @@ function addContainer(){
$
(
"<button class='del_category'></button>"
).
appendTo
(
imgs_container
);
$
(
"<button class='del_category'></button>"
).
appendTo
(
imgs_container
);
$
(
"<button class='add_category'></button>"
).
appendTo
(
imgs_container
);
$
(
"<button class='add_category'></button>"
).
appendTo
(
imgs_container
);
imgs_container
.
attr
(
"ondragenter"
,
"return false;"
)
imgs_container
.
attr
(
"ondragenter"
,
"return false;"
)
.
attr
(
"ondragleave"
,
"$(this).css(
\"
background-color
\"
,
\"\"
); return false;"
)
.
attr
(
"ondragleave"
,
"$(this).css(
\"
background-color
\"
,
\"
#e6f6ff
\"
); return false;"
)
.
attr
(
"ondragover"
,
"$(this).css(
\"
background-color
\"
,
\"\"
); return false;"
)
.
attr
(
"ondragover"
,
"$(this).css(
\"
background-color
\"
,
\"
#c3e9ff
\"
); return false;"
)
.
attr
(
"ondrop"
,
"$(this).css(
\"
background-color
\"
,
\"\"
); return onDropTarget(this,event);"
);
.
attr
(
"ondrop"
,
"$(this).css(
\"
background-color
\"
,
\"
#e6f6ff
\"
); return onDropTarget(this,event);"
);
container
.
insertBefore
(
$
(
".add_block"
));
container
.
insertBefore
(
$
(
".add_block"
));
}
}
...
@@ -688,8 +689,7 @@ function returnId(){
...
@@ -688,8 +689,7 @@ function returnId(){
}
}
//a func for checking when smth will drop
//a func for checking when smth will drop
function
checkOnDrop
(
dest
,
source
){
function
checkOnDrop
(
dest
){
dest
.
append
(
source
);
var
tmp_count
=
dest
.
find
(
"input[name='count']"
).
val
();
var
tmp_count
=
dest
.
find
(
"input[name='count']"
).
val
();
var
tmp_mask
=
dest
.
find
(
"input[name='mask']"
).
val
();
var
tmp_mask
=
dest
.
find
(
"input[name='mask']"
).
val
();
if
(
dest
.
find
(
".img_block"
).
size
()
==
tmp_count
){
if
(
dest
.
find
(
".img_block"
).
size
()
==
tmp_count
){
...
@@ -699,47 +699,35 @@ function checkOnDrop(dest, source){
...
@@ -699,47 +699,35 @@ function checkOnDrop(dest, source){
tmp_right
=
false
;
tmp_right
=
false
;
});
});
if
(
tmp_right
)
if
(
tmp_right
)
dest
.
removeClass
(
"def_cont"
)
dest
.
removeClass
(
"def_cont"
).
removeClass
(
"red_cont"
).
addClass
(
"green_cont"
);
.
removeClass
(
"red_cont"
)
.
addClass
(
"green_cont"
);
else
else
dest
.
removeClass
(
"def_cont"
)
dest
.
removeClass
(
"def_cont"
).
removeClass
(
"green_cont"
).
addClass
(
"red_cont"
);
.
removeClass
(
"green_cont"
)
.
addClass
(
"red_cont"
);
}
else
}
else
dest
.
removeClass
(
"def_cont"
)
dest
.
removeClass
(
"def_cont"
).
removeClass
(
"green_cont"
).
addClass
(
"red_cont"
);
.
removeClass
(
"green_cont"
)
.
addClass
(
"red_cont"
);
}
}
//checking source on correctness
//checking source on correctness
function
checkCorrectness
(
source
){
function
checkCorrectness
(
source
){
if
(
!
source
.
hasClass
(
"all_imgs"
)){
if
(
!
source
.
hasClass
(
"all_imgs"
)){
var
tmp_count
=
source
.
find
(
"input[name='count']"
).
val
();
if
(
source
.
parent
().
find
(
".all_imgs"
).
find
(
".img_block"
).
size
()
==
0
){
var
tmp_mask
=
source
.
find
(
"input[name='mask']"
).
val
();
source
.
parent
().
find
(
".imgs_cont"
).
each
(
function
(){
if
(
source
.
find
(
".img_block"
).
size
()
==
tmp_count
){
checkOnDrop
(
$
(
this
))
var
tmp_right
=
true
;
})
source
.
find
(
".img_block"
).
each
(
function
(){
}
else
{
if
(
$
(
this
).
find
(
"input"
).
val
()
!=
tmp_mask
)
source
.
parent
().
find
(
".imgs_cont"
).
each
(
function
(){
tmp_right
=
false
;
$
(
this
).
addClass
(
"def_cont"
).
removeClass
(
"green_cont"
).
removeClass
(
"red_cont"
);
});
})
}
if
(
tmp_right
)
}
else
{
source
.
removeClass
(
"def_cont"
)
if
(
source
.
find
(
".img_block"
).
size
()
>
0
){
.
removeClass
(
"red_cont"
)
source
.
parent
().
find
(
".imgs_cont"
).
each
(
function
(){
.
addClass
(
"green_cont"
);
$
(
this
).
addClass
(
"def_cont"
).
removeClass
(
"green_cont"
).
removeClass
(
"red_cont"
);
else
})
source
.
removeClass
(
"def_cont"
)
}
else
{
.
removeClass
(
"green_cont"
)
source
.
parent
().
find
(
".imgs_cont"
).
each
(
function
(){
.
addClass
(
"red_cont"
);
checkOnDrop
(
$
(
this
))
}
else
if
(
source
.
find
(
".img_block"
).
size
()
==
0
)
})
source
.
addClass
(
"def_cont"
)
}
.
removeClass
(
"green_cont"
)
.
removeClass
(
"red_cont"
);
else
source
.
removeClass
(
"def_cont"
)
.
removeClass
(
"green_cont"
)
.
addClass
(
"red_cont"
);
}
}
}
}
...
...
resources/library/interactivities/Cat text.wgt/js/script.js
View file @
872e2ee9
...
@@ -120,7 +120,7 @@ function start(){
...
@@ -120,7 +120,7 @@ function start(){
drop
:
function
(
event
,
ui
)
{
drop
:
function
(
event
,
ui
)
{
if
(
$
(
ui
.
draggable
).
parent
().
parent
().
html
()
==
$
(
this
).
parent
().
html
()){
if
(
$
(
ui
.
draggable
).
parent
().
parent
().
html
()
==
$
(
this
).
parent
().
html
()){
var
tmp_ui
=
$
(
ui
.
draggable
).
parent
();
var
tmp_ui
=
$
(
ui
.
draggable
).
parent
();
checkOnDrop
(
$
(
this
),
$
(
ui
.
draggable
));
$
(
this
).
append
(
$
(
ui
.
draggable
));
checkCorrectness
(
tmp_ui
);
checkCorrectness
(
tmp_ui
);
}
}
}
}
...
@@ -339,7 +339,7 @@ function importData(data){
...
@@ -339,7 +339,7 @@ function importData(data){
drop
:
function
(
event
,
ui
)
{
drop
:
function
(
event
,
ui
)
{
if
(
$
(
ui
.
draggable
).
parent
().
parent
().
html
()
==
$
(
this
).
parent
().
html
()){
if
(
$
(
ui
.
draggable
).
parent
().
parent
().
html
()
==
$
(
this
).
parent
().
html
()){
var
tmp_ui
=
$
(
ui
.
draggable
).
parent
();
var
tmp_ui
=
$
(
ui
.
draggable
).
parent
();
checkOnDrop
(
$
(
this
),
$
(
ui
.
draggable
));
$
(
this
).
append
(
$
(
ui
.
draggable
));
checkCorrectness
(
tmp_ui
);
checkCorrectness
(
tmp_ui
);
}
}
}
}
...
@@ -410,12 +410,11 @@ function importData(data){
...
@@ -410,12 +410,11 @@ function importData(data){
drop
:
function
(
event
,
ui
)
{
drop
:
function
(
event
,
ui
)
{
if
(
$
(
ui
.
draggable
).
parent
().
parent
().
html
()
==
$
(
this
).
parent
().
html
()){
if
(
$
(
ui
.
draggable
).
parent
().
parent
().
html
()
==
$
(
this
).
parent
().
html
()){
var
tmp_ui
=
$
(
ui
.
draggable
).
parent
();
var
tmp_ui
=
$
(
ui
.
draggable
).
parent
();
checkOnDrop
(
$
(
this
),
$
(
ui
.
draggable
));
$
(
this
).
append
(
$
(
ui
.
draggable
));
checkCorrectness
(
tmp_ui
);
checkCorrectness
(
tmp_ui
);
}
}
}
}
});
});
checkCorrectness
(
imgs_container
);
}
}
all_imgs
=
$
(
"<div class='all_imgs'>"
).
appendTo
(
container
);
all_imgs
=
$
(
"<div class='all_imgs'>"
).
appendTo
(
container
);
...
@@ -452,7 +451,8 @@ function importData(data){
...
@@ -452,7 +451,8 @@ function importData(data){
}
}
}
}
}
}
});
});
checkCorrectness
(
all_imgs
);
}
}
}
}
}
}
...
@@ -516,7 +516,7 @@ function showExample(){
...
@@ -516,7 +516,7 @@ function showExample(){
drop
:
function
(
event
,
ui
)
{
drop
:
function
(
event
,
ui
)
{
if
(
$
(
ui
.
draggable
).
parent
().
parent
().
html
()
==
$
(
this
).
parent
().
html
()){
if
(
$
(
ui
.
draggable
).
parent
().
parent
().
html
()
==
$
(
this
).
parent
().
html
()){
var
tmp_ui
=
$
(
ui
.
draggable
).
parent
();
var
tmp_ui
=
$
(
ui
.
draggable
).
parent
();
checkOnDrop
(
$
(
this
),
$
(
ui
.
draggable
));
$
(
this
).
append
(
$
(
ui
.
draggable
));
checkCorrectness
(
tmp_ui
);
checkCorrectness
(
tmp_ui
);
}
}
}
}
...
@@ -527,7 +527,7 @@ function showExample(){
...
@@ -527,7 +527,7 @@ function showExample(){
drop
:
function
(
event
,
ui
)
{
drop
:
function
(
event
,
ui
)
{
if
(
$
(
ui
.
draggable
).
parent
().
parent
().
html
()
==
$
(
this
).
parent
().
html
()){
if
(
$
(
ui
.
draggable
).
parent
().
parent
().
html
()
==
$
(
this
).
parent
().
html
()){
var
tmp_ui
=
$
(
ui
.
draggable
).
parent
();
var
tmp_ui
=
$
(
ui
.
draggable
).
parent
();
checkOnDrop
(
$
(
this
),
$
(
ui
.
draggable
));
$
(
this
).
append
(
$
(
ui
.
draggable
));
checkCorrectness
(
tmp_ui
);
checkCorrectness
(
tmp_ui
);
}
}
}
}
...
@@ -685,8 +685,7 @@ function changeStyle(val){
...
@@ -685,8 +685,7 @@ function changeStyle(val){
}
}
//a func for checking when smth will drop
//a func for checking when smth will drop
function
checkOnDrop
(
dest
,
source
){
function
checkOnDrop
(
dest
){
dest
.
append
(
source
);
var
tmp_count
=
dest
.
find
(
"input[name='count']"
).
val
();
var
tmp_count
=
dest
.
find
(
"input[name='count']"
).
val
();
var
tmp_mask
=
dest
.
find
(
"input[name='mask']"
).
val
();
var
tmp_mask
=
dest
.
find
(
"input[name='mask']"
).
val
();
if
(
dest
.
find
(
".img_block"
).
size
()
==
tmp_count
){
if
(
dest
.
find
(
".img_block"
).
size
()
==
tmp_count
){
...
@@ -696,46 +695,34 @@ function checkOnDrop(dest, source){
...
@@ -696,46 +695,34 @@ function checkOnDrop(dest, source){
tmp_right
=
false
;
tmp_right
=
false
;
});
});
if
(
tmp_right
)
if
(
tmp_right
)
dest
.
removeClass
(
"def_cont"
)
dest
.
removeClass
(
"def_cont"
).
removeClass
(
"red_cont"
).
addClass
(
"green_cont"
);
.
removeClass
(
"red_cont"
)
.
addClass
(
"green_cont"
);
else
else
dest
.
removeClass
(
"def_cont"
)
dest
.
removeClass
(
"def_cont"
).
removeClass
(
"green_cont"
).
addClass
(
"red_cont"
);
.
removeClass
(
"green_cont"
)
.
addClass
(
"red_cont"
);
}
else
}
else
dest
.
removeClass
(
"def_cont"
)
dest
.
removeClass
(
"def_cont"
).
removeClass
(
"green_cont"
).
addClass
(
"red_cont"
);
.
removeClass
(
"green_cont"
)
.
addClass
(
"red_cont"
);
}
}
//checking source on correctness
//checking source on correctness
function
checkCorrectness
(
source
){
function
checkCorrectness
(
source
){
if
(
!
source
.
hasClass
(
"all_imgs"
)){
if
(
!
source
.
hasClass
(
"all_imgs"
)){
var
tmp_count
=
source
.
find
(
"input[name='count']"
).
val
();
if
(
source
.
parent
().
find
(
".all_imgs"
).
find
(
".img_block"
).
size
()
==
0
){
var
tmp_mask
=
source
.
find
(
"input[name='mask']"
).
val
();
source
.
parent
().
find
(
".imgs_cont"
).
each
(
function
(){
if
(
source
.
find
(
".img_block"
).
size
()
==
tmp_count
){
checkOnDrop
(
$
(
this
))
var
tmp_right
=
true
;
})
source
.
find
(
".img_block"
).
each
(
function
(){
}
else
{
if
(
$
(
this
).
find
(
"input"
).
val
()
!=
tmp_mask
)
source
.
parent
().
find
(
".imgs_cont"
).
each
(
function
(){
tmp_right
=
false
;
$
(
this
).
addClass
(
"def_cont"
).
removeClass
(
"green_cont"
).
removeClass
(
"red_cont"
);
});
})
}
if
(
tmp_right
)
}
else
{
source
.
removeClass
(
"def_cont"
)
if
(
source
.
find
(
".img_block"
).
size
()
>
0
){
.
removeClass
(
"red_cont"
)
source
.
parent
().
find
(
".imgs_cont"
).
each
(
function
(){
.
addClass
(
"green_cont"
);
$
(
this
).
addClass
(
"def_cont"
).
removeClass
(
"green_cont"
).
removeClass
(
"red_cont"
);
else
})
source
.
removeClass
(
"def_cont"
)
}
else
{
.
removeClass
(
"green_cont"
)
source
.
parent
().
find
(
".imgs_cont"
).
each
(
function
(){
.
addClass
(
"red_cont"
);
checkOnDrop
(
$
(
this
))
}
else
if
(
source
.
find
(
".img_block"
).
size
()
==
0
)
})
source
.
addClass
(
"def_cont"
)
}
.
removeClass
(
"green_cont"
)
.
removeClass
(
"red_cont"
);
else
source
.
removeClass
(
"def_cont"
)
.
removeClass
(
"green_cont"
)
.
addClass
(
"red_cont"
);
}
}
}
}
resources/library/interactivities/Cat text.wgt/locales/fr/js/script.js
View file @
872e2ee9
...
@@ -141,7 +141,7 @@ function start(){
...
@@ -141,7 +141,7 @@ function start(){
drop
:
function
(
event
,
ui
)
{
drop
:
function
(
event
,
ui
)
{
if
(
$
(
ui
.
draggable
).
parent
().
parent
().
html
()
==
$
(
this
).
parent
().
html
()){
if
(
$
(
ui
.
draggable
).
parent
().
parent
().
html
()
==
$
(
this
).
parent
().
html
()){
var
tmp_ui
=
$
(
ui
.
draggable
).
parent
();
var
tmp_ui
=
$
(
ui
.
draggable
).
parent
();
checkOnDrop
(
$
(
this
),
$
(
ui
.
draggable
));
$
(
this
).
append
(
$
(
ui
.
draggable
));
checkCorrectness
(
tmp_ui
);
checkCorrectness
(
tmp_ui
);
}
}
}
}
...
@@ -360,7 +360,7 @@ function importData(data){
...
@@ -360,7 +360,7 @@ function importData(data){
drop
:
function
(
event
,
ui
)
{
drop
:
function
(
event
,
ui
)
{
if
(
$
(
ui
.
draggable
).
parent
().
parent
().
html
()
==
$
(
this
).
parent
().
html
()){
if
(
$
(
ui
.
draggable
).
parent
().
parent
().
html
()
==
$
(
this
).
parent
().
html
()){
var
tmp_ui
=
$
(
ui
.
draggable
).
parent
();
var
tmp_ui
=
$
(
ui
.
draggable
).
parent
();
checkOnDrop
(
$
(
this
),
$
(
ui
.
draggable
));
$
(
this
).
append
(
$
(
ui
.
draggable
));
checkCorrectness
(
tmp_ui
);
checkCorrectness
(
tmp_ui
);
}
}
}
}
...
@@ -431,7 +431,7 @@ function importData(data){
...
@@ -431,7 +431,7 @@ function importData(data){
drop
:
function
(
event
,
ui
)
{
drop
:
function
(
event
,
ui
)
{
if
(
$
(
ui
.
draggable
).
parent
().
parent
().
html
()
==
$
(
this
).
parent
().
html
()){
if
(
$
(
ui
.
draggable
).
parent
().
parent
().
html
()
==
$
(
this
).
parent
().
html
()){
var
tmp_ui
=
$
(
ui
.
draggable
).
parent
();
var
tmp_ui
=
$
(
ui
.
draggable
).
parent
();
checkOnDrop
(
$
(
this
),
$
(
ui
.
draggable
));
$
(
this
).
append
(
$
(
ui
.
draggable
));
checkCorrectness
(
tmp_ui
);
checkCorrectness
(
tmp_ui
);
}
}
}
}
...
@@ -473,7 +473,8 @@ function importData(data){
...
@@ -473,7 +473,8 @@ function importData(data){
}
}
}
}
}
}
});
});
checkCorrectness
(
all_imgs
);
}
}
}
}
}
}
...
@@ -537,7 +538,7 @@ function showExample(){
...
@@ -537,7 +538,7 @@ function showExample(){
drop
:
function
(
event
,
ui
)
{
drop
:
function
(
event
,
ui
)
{
if
(
$
(
ui
.
draggable
).
parent
().
parent
().
html
()
==
$
(
this
).
parent
().
html
()){
if
(
$
(
ui
.
draggable
).
parent
().
parent
().
html
()
==
$
(
this
).
parent
().
html
()){
var
tmp_ui
=
$
(
ui
.
draggable
).
parent
();
var
tmp_ui
=
$
(
ui
.
draggable
).
parent
();
checkOnDrop
(
$
(
this
),
$
(
ui
.
draggable
));
$
(
this
).
append
(
$
(
ui
.
draggable
));
checkCorrectness
(
tmp_ui
);
checkCorrectness
(
tmp_ui
);
}
}
}
}
...
@@ -548,7 +549,7 @@ function showExample(){
...
@@ -548,7 +549,7 @@ function showExample(){
drop
:
function
(
event
,
ui
)
{
drop
:
function
(
event
,
ui
)
{
if
(
$
(
ui
.
draggable
).
parent
().
parent
().
html
()
==
$
(
this
).
parent
().
html
()){
if
(
$
(
ui
.
draggable
).
parent
().
parent
().
html
()
==
$
(
this
).
parent
().
html
()){
var
tmp_ui
=
$
(
ui
.
draggable
).
parent
();
var
tmp_ui
=
$
(
ui
.
draggable
).
parent
();
checkOnDrop
(
$
(
this
),
$
(
ui
.
draggable
));
$
(
this
).
append
(
$
(
ui
.
draggable
));
checkCorrectness
(
tmp_ui
);
checkCorrectness
(
tmp_ui
);
}
}
}
}
...
@@ -706,8 +707,7 @@ function changeStyle(val){
...
@@ -706,8 +707,7 @@ function changeStyle(val){
}
}
//a func for checking when smth will drop
//a func for checking when smth will drop
function
checkOnDrop
(
dest
,
source
){
function
checkOnDrop
(
dest
){
dest
.
append
(
source
);
var
tmp_count
=
dest
.
find
(
"input[name='count']"
).
val
();
var
tmp_count
=
dest
.
find
(
"input[name='count']"
).
val
();
var
tmp_mask
=
dest
.
find
(
"input[name='mask']"
).
val
();
var
tmp_mask
=
dest
.
find
(
"input[name='mask']"
).
val
();
if
(
dest
.
find
(
".img_block"
).
size
()
==
tmp_count
){
if
(
dest
.
find
(
".img_block"
).
size
()
==
tmp_count
){
...
@@ -717,46 +717,34 @@ function checkOnDrop(dest, source){
...
@@ -717,46 +717,34 @@ function checkOnDrop(dest, source){
tmp_right
=
false
;
tmp_right
=
false
;
});
});
if
(
tmp_right
)
if
(
tmp_right
)
dest
.
removeClass
(
"def_cont"
)
dest
.
removeClass
(
"def_cont"
).
removeClass
(
"red_cont"
).
addClass
(
"green_cont"
);
.
removeClass
(
"red_cont"
)
.
addClass
(
"green_cont"
);
else
else
dest
.
removeClass
(
"def_cont"
)
dest
.
removeClass
(
"def_cont"
).
removeClass
(
"green_cont"
).
addClass
(
"red_cont"
);
.
removeClass
(
"green_cont"
)
.
addClass
(
"red_cont"
);
}
else
}
else
dest
.
removeClass
(
"def_cont"
)
dest
.
removeClass
(
"def_cont"
).
removeClass
(
"green_cont"
).
addClass
(
"red_cont"
);
.
removeClass
(
"green_cont"
)
.
addClass
(
"red_cont"
);
}
}
//checking source on correctness
//checking source on correctness
function
checkCorrectness
(
source
){
function
checkCorrectness
(
source
){
if
(
!
source
.
hasClass
(
"all_imgs"
)){
if
(
!
source
.
hasClass
(
"all_imgs"
)){
var
tmp_count
=
source
.
find
(
"input[name='count']"
).
val
();
if
(
source
.
parent
().
find
(
".all_imgs"
).
find
(
".img_block"
).
size
()
==
0
){
var
tmp_mask
=
source
.
find
(
"input[name='mask']"
).
val
();
source
.
parent
().
find
(
".imgs_cont"
).
each
(
function
(){
if
(
source
.
find
(
".img_block"
).
size
()
==
tmp_count
){
checkOnDrop
(
$
(
this
))
var
tmp_right
=
true
;
})
source
.
find
(
".img_block"
).
each
(
function
(){
}
else
{
if
(
$
(
this
).
find
(
"input"
).
val
()
!=
tmp_mask
)
source
.
parent
().
find
(
".imgs_cont"
).
each
(
function
(){
tmp_right
=
false
;
$
(
this
).
addClass
(
"def_cont"
).
removeClass
(
"green_cont"
).
removeClass
(
"red_cont"
);
});
})
}
if
(
tmp_right
)
}
else
{
source
.
removeClass
(
"def_cont"
)
if
(
source
.
find
(
".img_block"
).
size
()
>
0
){
.
removeClass
(
"red_cont"
)
source
.
parent
().
find
(
".imgs_cont"
).
each
(
function
(){
.
addClass
(
"green_cont"
);
$
(
this
).
addClass
(
"def_cont"
).
removeClass
(
"green_cont"
).
removeClass
(
"red_cont"
);
else
})
source
.
removeClass
(
"def_cont"
)
}
else
{
.
removeClass
(
"green_cont"
)
source
.
parent
().
find
(
".imgs_cont"
).
each
(
function
(){
.
addClass
(
"red_cont"
);
checkOnDrop
(
$
(
this
))
}
else
if
(
source
.
find
(
".img_block"
).
size
()
==
0
)
})
source
.
addClass
(
"def_cont"
)
}
.
removeClass
(
"green_cont"
)
.
removeClass
(
"red_cont"
);
else
source
.
removeClass
(
"def_cont"
)
.
removeClass
(
"green_cont"
)
.
addClass
(
"red_cont"
);
}
}
}
}
resources/library/interactivities/Cat text.wgt/locales/ru/js/script.js
View file @
872e2ee9
...
@@ -120,7 +120,7 @@ function start(){
...
@@ -120,7 +120,7 @@ function start(){
drop
:
function
(
event
,
ui
)
{
drop
:
function
(
event
,
ui
)
{
if
(
$
(
ui
.
draggable
).
parent
().
parent
().
html
()
==
$
(
this
).
parent
().
html
()){
if
(
$
(
ui
.
draggable
).
parent
().
parent
().
html
()
==
$
(
this
).
parent
().
html
()){
var
tmp_ui
=
$
(
ui
.
draggable
).
parent
();
var
tmp_ui
=
$
(
ui
.
draggable
).
parent
();
checkOnDrop
(
$
(
this
),
$
(
ui
.
draggable
));
$
(
this
).
append
(
$
(
ui
.
draggable
));
checkCorrectness
(
tmp_ui
);
checkCorrectness
(
tmp_ui
);
}
}
}
}
...
@@ -339,7 +339,7 @@ function importData(data){
...
@@ -339,7 +339,7 @@ function importData(data){
drop
:
function
(
event
,
ui
)
{
drop
:
function
(
event
,
ui
)
{
if
(
$
(
ui
.
draggable
).
parent
().
parent
().
html
()
==
$
(
this
).
parent
().
html
()){
if
(
$
(
ui
.
draggable
).
parent
().
parent
().
html
()
==
$
(
this
).
parent
().
html
()){
var
tmp_ui
=
$
(
ui
.
draggable
).
parent
();
var
tmp_ui
=
$
(
ui
.
draggable
).
parent
();
checkOnDrop
(
$
(
this
),
$
(
ui
.
draggable
));
$
(
this
).
append
(
$
(
ui
.
draggable
));
checkCorrectness
(
tmp_ui
);
checkCorrectness
(
tmp_ui
);
}
}
}
}
...
@@ -410,7 +410,7 @@ function importData(data){
...
@@ -410,7 +410,7 @@ function importData(data){
drop
:
function
(
event
,
ui
)
{
drop
:
function
(
event
,
ui
)
{
if
(
$
(
ui
.
draggable
).
parent
().
parent
().
html
()
==
$
(
this
).
parent
().
html
()){
if
(
$
(
ui
.
draggable
).
parent
().
parent
().
html
()
==
$
(
this
).
parent
().
html
()){
var
tmp_ui
=
$
(
ui
.
draggable
).
parent
();
var
tmp_ui
=
$
(
ui
.
draggable
).
parent
();
checkOnDrop
(
$
(
this
),
$
(
ui
.
draggable
));
$
(
this
).
append
(
$
(
ui
.
draggable
));
checkCorrectness
(
tmp_ui
);
checkCorrectness
(
tmp_ui
);
}
}
}
}
...
@@ -452,7 +452,8 @@ function importData(data){
...
@@ -452,7 +452,8 @@ function importData(data){
}
}
}
}
}
}
});
});
checkCorrectness
(
all_imgs
);
}
}
}
}
}
}
...
@@ -516,7 +517,7 @@ function showExample(){
...
@@ -516,7 +517,7 @@ function showExample(){
drop
:
function
(
event
,
ui
)
{
drop
:
function
(
event
,
ui
)
{
if
(
$
(
ui
.
draggable
).
parent
().
parent
().
html
()
==
$
(
this
).
parent
().
html
()){
if
(
$
(
ui
.
draggable
).
parent
().
parent
().
html
()
==
$
(
this
).
parent
().
html
()){
var
tmp_ui
=
$
(
ui
.
draggable
).
parent
();
var
tmp_ui
=
$
(
ui
.
draggable
).
parent
();
checkOnDrop
(
$
(
this
),
$
(
ui
.
draggable
));
$
(
this
).
append
(
$
(
ui
.
draggable
));
checkCorrectness
(
tmp_ui
);
checkCorrectness
(
tmp_ui
);
}
}
}
}
...
@@ -527,7 +528,7 @@ function showExample(){
...
@@ -527,7 +528,7 @@ function showExample(){
drop
:
function
(
event
,
ui
)
{
drop
:
function
(
event
,
ui
)
{
if
(
$
(
ui
.
draggable
).
parent
().
parent
().
html
()
==
$
(
this
).
parent
().
html
()){
if
(
$
(
ui
.
draggable
).
parent
().
parent
().
html
()
==
$
(
this
).
parent
().
html
()){
var
tmp_ui
=
$
(
ui
.
draggable
).
parent
();
var
tmp_ui
=
$
(
ui
.
draggable
).
parent
();
checkOnDrop
(
$
(
this
),
$
(
ui
.
draggable
));
$
(
this
).
append
(
$
(
ui
.
draggable
));
checkCorrectness
(
tmp_ui
);
checkCorrectness
(
tmp_ui
);
}
}
}
}
...
@@ -685,8 +686,7 @@ function changeStyle(val){
...
@@ -685,8 +686,7 @@ function changeStyle(val){
}
}
//a func for checking when smth will drop
//a func for checking when smth will drop
function
checkOnDrop
(
dest
,
source
){
function
checkOnDrop
(
dest
){
dest
.
append
(
source
);
var
tmp_count
=
dest
.
find
(
"input[name='count']"
).
val
();
var
tmp_count
=
dest
.
find
(
"input[name='count']"
).
val
();
var
tmp_mask
=
dest
.
find
(
"input[name='mask']"
).
val
();
var
tmp_mask
=
dest
.
find
(
"input[name='mask']"
).
val
();
if
(
dest
.
find
(
".img_block"
).
size
()
==
tmp_count
){
if
(
dest
.
find
(
".img_block"
).
size
()
==
tmp_count
){
...
@@ -696,46 +696,34 @@ function checkOnDrop(dest, source){
...
@@ -696,46 +696,34 @@ function checkOnDrop(dest, source){
tmp_right
=
false
;
tmp_right
=
false
;
});
});
if
(
tmp_right
)
if
(
tmp_right
)
dest
.
removeClass
(
"def_cont"
)
dest
.
removeClass
(
"def_cont"
).
removeClass
(
"red_cont"
).
addClass
(
"green_cont"
);
.
removeClass
(
"red_cont"
)
.
addClass
(
"green_cont"
);
else
else
dest
.
removeClass
(
"def_cont"
)
dest
.
removeClass
(
"def_cont"
).
removeClass
(
"green_cont"
).
addClass
(
"red_cont"
);
.
removeClass
(
"green_cont"
)
.
addClass
(
"red_cont"
);
}
else
}
else
dest
.
removeClass
(
"def_cont"
)
dest
.
removeClass
(
"def_cont"
).
removeClass
(
"green_cont"
).
addClass
(
"red_cont"
);
.
removeClass
(
"green_cont"
)
.
addClass
(
"red_cont"
);
}
}
//checking source on correctness
//checking source on correctness
function
checkCorrectness
(
source
){
function
checkCorrectness
(
source
){
if
(
!
source
.
hasClass
(
"all_imgs"
)){
if
(
!
source
.
hasClass
(
"all_imgs"
)){
var
tmp_count
=
source
.
find
(
"input[name='count']"
).
val
();
if
(
source
.
parent
().
find
(
".all_imgs"
).
find
(
".img_block"
).
size
()
==
0
){
var
tmp_mask
=
source
.
find
(
"input[name='mask']"
).
val
();
source
.
parent
().
find
(
".imgs_cont"
).
each
(
function
(){
if
(
source
.
find
(
".img_block"
).
size
()
==
tmp_count
){
checkOnDrop
(
$
(
this
))
var
tmp_right
=
true
;
})
source
.
find
(
".img_block"
).
each
(
function
(){
}
else
{
if
(
$
(
this
).
find
(
"input"
).
val
()
!=
tmp_mask
)
source
.
parent
().
find
(
".imgs_cont"
).
each
(
function
(){
tmp_right
=
false
;
$
(
this
).
addClass
(
"def_cont"
).
removeClass
(
"green_cont"
).
removeClass
(
"red_cont"
);
});
})
}
if
(
tmp_right
)
}
else
{
source
.
removeClass
(
"def_cont"
)
if
(
source
.
find
(
".img_block"
).
size
()
>
0
){
.
removeClass
(
"red_cont"
)
source
.
parent
().
find
(
".imgs_cont"
).
each
(
function
(){
.
addClass
(
"green_cont"
);
$
(
this
).
addClass
(
"def_cont"
).
removeClass
(
"green_cont"
).
removeClass
(
"red_cont"
);
else
})
source
.
removeClass
(
"def_cont"
)
}
else
{
.
removeClass
(
"green_cont"
)
source
.
parent
().
find
(
".imgs_cont"
).
each
(
function
(){
.
addClass
(
"red_cont"
);
checkOnDrop
(
$
(
this
))
}
else
if
(
source
.
find
(
".img_block"
).
size
()
==
0
)
})
source
.
addClass
(
"def_cont"
)
}
.
removeClass
(
"green_cont"
)
.
removeClass
(
"red_cont"
);
else
source
.
removeClass
(
"def_cont"
)
.
removeClass
(
"green_cont"
)
.
addClass
(
"red_cont"
);
}
}
}
}
\ No newline at end of file
src/adaptors/UBSvgSubsetAdaptor.cpp
View file @
872e2ee9
...
@@ -3090,7 +3090,7 @@ UBGraphicsTriangle* UBSvgSubsetAdaptor::UBSvgSubsetReader::triangleFromSvg()
...
@@ -3090,7 +3090,7 @@ UBGraphicsTriangle* UBSvgSubsetAdaptor::UBSvgSubsetReader::triangleFromSvg()
UBGraphicsCache
*
UBSvgSubsetAdaptor
::
UBSvgSubsetReader
::
cacheFromSvg
()
UBGraphicsCache
*
UBSvgSubsetAdaptor
::
UBSvgSubsetReader
::
cacheFromSvg
()
{
{
UBGraphicsCache
*
pCache
=
new
UBGraphicsCache
(
);
UBGraphicsCache
*
pCache
=
UBGraphicsCache
::
instance
(
mScene
);
pCache
->
setData
(
UBGraphicsItemData
::
ItemLayerType
,
QVariant
(
UBItemLayerType
::
Tool
));
pCache
->
setData
(
UBGraphicsItemData
::
ItemLayerType
,
QVariant
(
UBItemLayerType
::
Tool
));
graphicsItemFromSvg
(
pCache
);
graphicsItemFromSvg
(
pCache
);
...
...
src/api/UBLibraryAPI.cpp
View file @
872e2ee9
...
@@ -40,7 +40,7 @@ UBLibraryAPI::~UBLibraryAPI()
...
@@ -40,7 +40,7 @@ UBLibraryAPI::~UBLibraryAPI()
void
UBLibraryAPI
::
addObject
(
QString
pUrl
,
int
width
,
int
height
,
int
x
,
int
y
,
bool
background
)
void
UBLibraryAPI
::
addObject
(
QString
pUrl
,
int
width
,
int
height
,
int
x
,
int
y
,
bool
background
)
{
{
if
(
UBApplication
::
boardController
)
if
(
UBApplication
::
boardController
)
UBApplication
::
boardController
->
downloadURL
(
QUrl
(
pUrl
),
QPointF
(
x
,
y
),
QSize
(
width
,
height
),
background
);
UBApplication
::
boardController
->
downloadURL
(
QUrl
(
pUrl
),
Q
String
(),
Q
PointF
(
x
,
y
),
QSize
(
width
,
height
),
background
);
}
}
...
...
src/api/UBWidgetUniboardAPI.cpp
View file @
872e2ee9
...
@@ -201,7 +201,7 @@ void UBWidgetUniboardAPI::addObject(QString pUrl, int width, int height, int x,
...
@@ -201,7 +201,7 @@ void UBWidgetUniboardAPI::addObject(QString pUrl, int width, int height, int x,
if
(
UBApplication
::
boardController
->
activeScene
()
!=
mScene
)
if
(
UBApplication
::
boardController
->
activeScene
()
!=
mScene
)
return
;
return
;
UBApplication
::
boardController
->
downloadURL
(
QUrl
(
pUrl
),
QPointF
(
x
,
y
),
QSize
(
width
,
height
),
background
);
UBApplication
::
boardController
->
downloadURL
(
QUrl
(
pUrl
),
Q
String
(),
Q
PointF
(
x
,
y
),
QSize
(
width
,
height
),
background
);
}
}
...
@@ -506,7 +506,7 @@ void UBWidgetUniboardAPI::ProcessDropEvent(QGraphicsSceneDragDropEvent *event)
...
@@ -506,7 +506,7 @@ void UBWidgetUniboardAPI::ProcessDropEvent(QGraphicsSceneDragDropEvent *event)
sDownloadFileDesc
desc
;
sDownloadFileDesc
desc
;
desc
.
dest
=
sDownloadFileDesc
::
graphicsWidget
;
desc
.
dest
=
sDownloadFileDesc
::
graphicsWidget
;
desc
.
modal
=
true
;
desc
.
modal
=
true
;
desc
.
u
rl
=
url
;
desc
.
srcU
rl
=
url
;
desc
.
currentSize
=
0
;
desc
.
currentSize
=
0
;
desc
.
name
=
QFileInfo
(
url
).
fileName
();
desc
.
name
=
QFileInfo
(
url
).
fileName
();
desc
.
totalSize
=
0
;
// The total size will be retrieved during the download
desc
.
totalSize
=
0
;
// The total size will be retrieved during the download
...
...
src/board/UBBoardController.cpp
View file @
872e2ee9
This diff is collapsed.
Click to expand it.
src/board/UBBoardController.h
View file @
872e2ee9
...
@@ -193,8 +193,8 @@ class UBBoardController : public UBDocumentContainer
...
@@ -193,8 +193,8 @@ class UBBoardController : public UBDocumentContainer
void
firstScene
();
void
firstScene
();
void
lastScene
();
void
lastScene
();
void
groupButtonClicked
();
void
groupButtonClicked
();
void
downloadURL
(
const
QUrl
&
url
,
const
QPointF
&
pPos
=
QPointF
(
0
.
0
,
0
.
0
),
const
QSize
&
pSize
=
QSize
(),
bool
isBackground
=
false
,
bool
internalData
=
false
);
void
downloadURL
(
const
QUrl
&
url
,
QString
contentSourceUrl
=
QString
(),
const
QPointF
&
pPos
=
QPointF
(
0
.
0
,
0
.
0
),
const
QSize
&
pSize
=
QSize
(),
bool
isBackground
=
false
,
bool
internalData
=
false
);
UBItem
*
downloadFinished
(
bool
pSuccess
,
QUrl
sourceUrl
,
QString
pHeader
,
UBItem
*
downloadFinished
(
bool
pSuccess
,
QUrl
sourceUrl
,
Q
Url
contentUrl
,
Q
String
pHeader
,
QByteArray
pData
,
QPointF
pPos
,
QSize
pSize
,
QByteArray
pData
,
QPointF
pPos
,
QSize
pSize
,
bool
isBackground
=
false
,
bool
internalData
=
false
);
bool
isBackground
=
false
,
bool
internalData
=
false
);
void
changeBackground
(
bool
isDark
,
bool
isCrossed
);
void
changeBackground
(
bool
isDark
,
bool
isCrossed
);
...
@@ -210,8 +210,8 @@ class UBBoardController : public UBDocumentContainer
...
@@ -210,8 +210,8 @@ class UBBoardController : public UBDocumentContainer
void
setRegularPageSize
(
bool
checked
);
void
setRegularPageSize
(
bool
checked
);
void
stylusToolChanged
(
int
tool
);
void
stylusToolChanged
(
int
tool
);
void
grabScene
(
const
QRectF
&
pSceneRect
);
void
grabScene
(
const
QRectF
&
pSceneRect
);
UBGraphicsMediaItem
*
addVideo
(
const
QUrl
&
pUrl
,
bool
startPlay
,
const
QPointF
&
pos
);
UBGraphicsMediaItem
*
addVideo
(
const
QUrl
&
pUrl
,
bool
startPlay
,
const
QPointF
&
pos
,
bool
bUseSource
=
false
);
UBGraphicsMediaItem
*
addAudio
(
const
QUrl
&
pUrl
,
bool
startPlay
,
const
QPointF
&
pos
);
UBGraphicsMediaItem
*
addAudio
(
const
QUrl
&
pUrl
,
bool
startPlay
,
const
QPointF
&
pos
,
bool
bUseSource
=
false
);
UBGraphicsWidgetItem
*
addW3cWidget
(
const
QUrl
&
pUrl
,
const
QPointF
&
pos
);
UBGraphicsWidgetItem
*
addW3cWidget
(
const
QUrl
&
pUrl
,
const
QPointF
&
pos
);
void
cut
();
void
cut
();
...
...
src/board/UBBoardPaletteManager.cpp
View file @
872e2ee9
...
@@ -995,6 +995,7 @@ void UBBoardPaletteManager::startDownloads()
...
@@ -995,6 +995,7 @@ void UBBoardPaletteManager::startDownloads()
mDownloadInProgress
=
true
;
mDownloadInProgress
=
true
;
mpDownloadWidget
->
setVisibleState
(
true
);
mpDownloadWidget
->
setVisibleState
(
true
);
mRightPalette
->
addTab
(
mpDownloadWidget
);
mRightPalette
->
addTab
(
mpDownloadWidget
);
mpDownloadWidget
;
}
}
}
}
...
...
src/board/UBBoardView.cpp
View file @
872e2ee9
...
@@ -1366,6 +1366,11 @@ void UBBoardView::dropEvent (QDropEvent *event)
...
@@ -1366,6 +1366,11 @@ void UBBoardView::dropEvent (QDropEvent *event)
event
->
acceptProposedAction
();
event
->
acceptProposedAction
();
}
}
}
}
//prevent features in UBFeaturesWidget deletion from the model when event is processing inside
//Qt base classes
if
(
event
->
dropAction
()
==
Qt
::
MoveAction
)
{
event
->
setDropAction
(
Qt
::
CopyAction
);
}
}
}
void
void
...
...
src/board/UBFeaturesController.cpp
View file @
872e2ee9
...
@@ -711,7 +711,7 @@ void UBFeaturesController::addItemToPage(const UBFeature &item)
...
@@ -711,7 +711,7 @@ void UBFeaturesController::addItemToPage(const UBFeature &item)
void
UBFeaturesController
::
addItemAsBackground
(
const
UBFeature
&
item
)
void
UBFeaturesController
::
addItemAsBackground
(
const
UBFeature
&
item
)
{
{
UBApplication
::
boardController
->
downloadURL
(
item
.
getFullPath
(),
QPointF
(),
QSize
(),
true
);
UBApplication
::
boardController
->
downloadURL
(
item
.
getFullPath
(),
Q
String
(),
Q
PointF
(),
QSize
(),
true
);
}
}
UBFeature
UBFeaturesController
::
getDestinationFeatureForUrl
(
const
QUrl
&
url
)
UBFeature
UBFeaturesController
::
getDestinationFeatureForUrl
(
const
QUrl
&
url
)
...
...
src/core/UBDownloadManager.cpp
View file @
872e2ee9
...
@@ -14,12 +14,79 @@
...
@@ -14,12 +14,79 @@
*/
*/
#include "UBDownloadManager.h"
#include "UBDownloadManager.h"
#include "core/UBApplication.h"
#include "core/UBApplication.h"
#include "core/UBPersistenceManager.h"
#include "gui/UBMainWindow.h"
#include "gui/UBMainWindow.h"
#include "board/UBBoardController.h"
#include "board/UBBoardController.h"
#include "board/UBBoardPaletteManager.h"
#include "board/UBBoardPaletteManager.h"
#include "frameworks/UBFileSystemUtils.h"
#include "core/memcheck.h"
#include "core/memcheck.h"
UBAsyncLocalFileDownloader
::
UBAsyncLocalFileDownloader
(
sDownloadFileDesc
desc
,
QObject
*
parent
)
:
QThread
(
parent
)
,
mDesc
(
desc
)
,
m_bAborting
(
false
)
{
}
UBAsyncLocalFileDownloader
*
UBAsyncLocalFileDownloader
::
download
()
{
if
(
!
QFile
::
exists
(
QUrl
(
mDesc
.
srcUrl
).
toLocalFile
()))
{
qDebug
()
<<
"file"
<<
mDesc
.
srcUrl
<<
"does not present in fs"
;
return
this
;
}
start
();
return
this
;
}
void
UBAsyncLocalFileDownloader
::
run
()
{
QString
mimeType
=
UBFileSystemUtils
::
mimeTypeFromFileName
(
mDesc
.
srcUrl
);
int
position
=
mimeType
.
indexOf
(
";"
);
if
(
position
!=
-
1
)
mimeType
=
mimeType
.
left
(
position
);
UBMimeType
::
Enum
itemMimeType
=
UBFileSystemUtils
::
mimeTypeFromString
(
mimeType
);
QString
destDirectory
;
if
(
UBMimeType
::
Video
==
itemMimeType
)
destDirectory
=
UBPersistenceManager
::
videoDirectory
;
else
if
(
UBMimeType
::
Audio
==
itemMimeType
)
destDirectory
=
UBPersistenceManager
::
audioDirectory
;
if
(
mDesc
.
originalSrcUrl
.
isEmpty
())
mDesc
.
originalSrcUrl
=
mDesc
.
srcUrl
;
QString
uuid
=
QUuid
::
createUuid
();
UBPersistenceManager
::
persistenceManager
()
->
addFileToDocument
(
UBApplication
::
boardController
->
selectedDocument
(),
QUrl
(
mDesc
.
srcUrl
).
toLocalFile
(),
destDirectory
,
uuid
,
mTo
,
NULL
);
if
(
m_bAborting
)
{
if
(
QFile
::
exists
(
mTo
))
QFile
::
remove
(
mTo
);
}
else
emit
signal_asyncCopyFinished
(
mDesc
.
id
,
!
mTo
.
isEmpty
(),
QUrl
::
fromLocalFile
(
mTo
),
QUrl
::
fromLocalFile
(
mDesc
.
originalSrcUrl
),
""
,
NULL
,
mDesc
.
pos
,
mDesc
.
size
,
mDesc
.
isBackground
);
}
void
UBAsyncLocalFileDownloader
::
abort
()
{
m_bAborting
=
true
;
}
/** The unique instance of the download manager */
/** The unique instance of the download manager */
static
UBDownloadManager
*
pInstance
=
NULL
;
static
UBDownloadManager
*
pInstance
=
NULL
;
...
@@ -100,7 +167,7 @@ void UBDownloadManager::init()
...
@@ -100,7 +167,7 @@ void UBDownloadManager::init()
{
{
mCrntDL
.
clear
();
mCrntDL
.
clear
();
mPendingDL
.
clear
();
mPendingDL
.
clear
();
m
Replie
s
.
clear
();
m
Download
s
.
clear
();
mLastID
=
1
;
mLastID
=
1
;
mDLAvailability
.
clear
();
mDLAvailability
.
clear
();
for
(
int
i
=
0
;
i
<
SIMULTANEOUS_DOWNLOAD
;
i
++
)
for
(
int
i
=
0
;
i
<
SIMULTANEOUS_DOWNLOAD
;
i
++
)
...
@@ -193,7 +260,8 @@ void UBDownloadManager::onDownloadProgress(int id, qint64 received, qint64 total
...
@@ -193,7 +260,8 @@ void UBDownloadManager::onDownloadProgress(int id, qint64 received, qint64 total
* \brief Called when the download of the given file is finished
* \brief Called when the download of the given file is finished
* @param desc as the current downloaded file description
* @param desc as the current downloaded file description
*/
*/
void
UBDownloadManager
::
onDownloadFinished
(
int
id
,
bool
pSuccess
,
QUrl
sourceUrl
,
QString
pContentTypeHeader
,
QByteArray
pData
,
QPointF
pPos
,
QSize
pSize
,
bool
isBackground
)
void
UBDownloadManager
::
onDownloadFinished
(
int
id
,
bool
pSuccess
,
QUrl
sourceUrl
,
QUrl
contentUrl
,
QString
pContentTypeHeader
,
QByteArray
pData
,
QPointF
pPos
,
QSize
pSize
,
bool
isBackground
)
{
{
// Temporary data for dnd do not delete it please
// Temporary data for dnd do not delete it please
Q_UNUSED
(
pPos
)
Q_UNUSED
(
pPos
)
...
@@ -209,9 +277,9 @@ void UBDownloadManager::onDownloadFinished(int id, bool pSuccess, QUrl sourceUrl
...
@@ -209,9 +277,9 @@ void UBDownloadManager::onDownloadFinished(int id, bool pSuccess, QUrl sourceUrl
desc
.
contentTypeHeader
=
pContentTypeHeader
;
desc
.
contentTypeHeader
=
pContentTypeHeader
;
emit
downloadFinished
(
pSuccess
,
desc
,
pData
);
emit
downloadFinished
(
pSuccess
,
desc
,
pData
);
}
else
if
(
desc
.
modal
)
{
}
else
if
(
desc
.
dest
==
sDownloadFileDesc
::
board
)
{
// The downloaded file is modal so we must put it on the board
// The downloaded file is modal so we must put it on the board
emit
addDownloadedFileToBoard
(
pSuccess
,
sourceUrl
,
pContentTypeHeader
,
pData
,
pPos
,
pSize
,
isBackground
);
emit
addDownloadedFileToBoard
(
pSuccess
,
sourceUrl
,
contentUrl
,
pContentTypeHeader
,
pData
,
pPos
,
pSize
,
isBackground
);
}
}
else
else
{
{
...
@@ -259,7 +327,7 @@ void UBDownloadManager::updateFileCurrentSize(int id, qint64 received, qint64 to
...
@@ -259,7 +327,7 @@ void UBDownloadManager::updateFileCurrentSize(int id, qint64 received, qint64 to
mCrntDL
.
remove
(
i
);
mCrntDL
.
remove
(
i
);
// Here we don't forget to remove the reply related to the finished download
// Here we don't forget to remove the reply related to the finished download
m
Replie
s
.
remove
(
id
);
m
Download
s
.
remove
(
id
);
// Free the download slot used by the finished file
// Free the download slot used by the finished file
for
(
int
j
=
0
;
j
<
mDLAvailability
.
size
();
j
++
)
for
(
int
j
=
0
;
j
<
mDLAvailability
.
size
();
j
++
)
...
@@ -302,15 +370,28 @@ void UBDownloadManager::updateFileCurrentSize(int id, qint64 received, qint64 to
...
@@ -302,15 +370,28 @@ void UBDownloadManager::updateFileCurrentSize(int id, qint64 received, qint64 to
*/
*/
void
UBDownloadManager
::
startFileDownload
(
sDownloadFileDesc
desc
)
void
UBDownloadManager
::
startFileDownload
(
sDownloadFileDesc
desc
)
{
{
UBDownloadHttpFile
*
http
=
new
UBDownloadHttpFile
(
desc
.
id
,
this
);
if
(
desc
.
srcUrl
.
startsWith
(
"file://"
)
||
desc
.
srcUrl
.
startsWith
(
"/"
))
connect
(
http
,
SIGNAL
(
downloadProgress
(
int
,
qint64
,
qint64
)),
this
,
SLOT
(
onDownloadProgress
(
int
,
qint64
,
qint64
)));
{
connect
(
http
,
SIGNAL
(
downloadFinished
(
int
,
bool
,
QUrl
,
QString
,
QByteArray
,
QPointF
,
QSize
,
bool
)),
this
,
SLOT
(
onDownloadFinished
(
int
,
bool
,
QUrl
,
QString
,
QByteArray
,
QPointF
,
QSize
,
bool
)));
UBAsyncLocalFileDownloader
*
cpHelper
=
new
UBAsyncLocalFileDownloader
(
desc
,
this
);
connect
(
cpHelper
,
SIGNAL
(
signal_asyncCopyFinished
(
int
,
bool
,
QUrl
,
QUrl
,
QString
,
QByteArray
,
QPointF
,
QSize
,
bool
)),
this
,
SLOT
(
onDownloadFinished
(
int
,
bool
,
QUrl
,
QUrl
,
QString
,
QByteArray
,
QPointF
,
QSize
,
bool
)));
//the desc.url is encoded. So we have to decode it before.
QObject
*
res
=
dynamic_cast
<
QObject
*>
(
cpHelper
->
download
());
QUrl
url
;
if
(
!
res
)
url
.
setEncodedUrl
(
desc
.
url
.
toUtf8
());
delete
res
;
// We send here the request and store its reply in order to be able to cancel it if needed
else
mReplies
[
desc
.
id
]
=
http
->
get
(
url
,
desc
.
pos
,
desc
.
size
,
desc
.
isBackground
);
mDownloads
[
desc
.
id
]
=
res
;
}
else
{
UBDownloadHttpFile
*
http
=
new
UBDownloadHttpFile
(
desc
.
id
,
this
);
connect
(
http
,
SIGNAL
(
downloadProgress
(
int
,
qint64
,
qint64
)),
this
,
SLOT
(
onDownloadProgress
(
int
,
qint64
,
qint64
)));
connect
(
http
,
SIGNAL
(
downloadFinished
(
int
,
bool
,
QUrl
,
QUrl
,
QString
,
QByteArray
,
QPointF
,
QSize
,
bool
)),
this
,
SLOT
(
onDownloadFinished
(
int
,
bool
,
QUrl
,
QUrl
,
QString
,
QByteArray
,
QPointF
,
QSize
,
bool
)));
//the desc.srcUrl is encoded. So we have to decode it before.
QUrl
url
;
url
.
setEncodedUrl
(
desc
.
srcUrl
.
toUtf8
());
// We send here the request and store its reply in order to be able to cancel it if needed
mDownloads
[
desc
.
id
]
=
dynamic_cast
<
QObject
*>
(
http
->
get
(
url
,
desc
.
pos
,
desc
.
size
,
desc
.
isBackground
));
}
}
}
/**
/**
...
@@ -356,10 +437,18 @@ void UBDownloadManager::checkIfModalRemains()
...
@@ -356,10 +437,18 @@ void UBDownloadManager::checkIfModalRemains()
void
UBDownloadManager
::
cancelDownloads
()
void
UBDownloadManager
::
cancelDownloads
()
{
{
// Stop the current downloads
// Stop the current downloads
QMap
<
int
,
Q
NetworkReply
*>::
iterator
it
=
mReplie
s
.
begin
();
QMap
<
int
,
Q
Object
*>::
iterator
it
=
mDownload
s
.
begin
();
for
(;
it
!=
m
Replie
s
.
end
();
it
++
)
for
(;
it
!=
m
Download
s
.
end
();
it
++
)
{
{
dynamic_cast
<
QNetworkReply
*>
(
it
.
value
())
->
abort
();
QNetworkReply
*
netReply
=
dynamic_cast
<
QNetworkReply
*>
(
it
.
value
());
if
(
netReply
)
netReply
->
abort
();
else
{
UBAsyncLocalFileDownloader
*
localDownload
=
dynamic_cast
<
UBAsyncLocalFileDownloader
*>
(
it
.
value
());
if
(
localDownload
)
localDownload
->
abort
();
}
}
}
// Clear all the lists
// Clear all the lists
...
@@ -372,7 +461,8 @@ void UBDownloadManager::cancelDownloads()
...
@@ -372,7 +461,8 @@ void UBDownloadManager::cancelDownloads()
void
UBDownloadManager
::
onDownloadError
(
int
id
)
void
UBDownloadManager
::
onDownloadError
(
int
id
)
{
{
QNetworkReply
*
pReply
=
mReplies
.
value
(
id
);
QNetworkReply
*
pReply
=
dynamic_cast
<
QNetworkReply
*>
(
mDownloads
.
value
(
id
));
if
(
NULL
!=
pReply
)
if
(
NULL
!=
pReply
)
{
{
// Check which error occured:
// Check which error occured:
...
@@ -402,9 +492,25 @@ void UBDownloadManager::finishDownloads(bool cancel)
...
@@ -402,9 +492,25 @@ void UBDownloadManager::finishDownloads(bool cancel)
void
UBDownloadManager
::
cancelDownload
(
int
id
)
void
UBDownloadManager
::
cancelDownload
(
int
id
)
{
{
if
(
!
mDownloads
.
size
())
return
;
// Stop the download
// Stop the download
mReplies
[
id
]
->
abort
();
mReplies
.
remove
(
id
);
QNetworkReply
*
pNetworkDownload
=
dynamic_cast
<
QNetworkReply
*>
(
mDownloads
[
id
]);
if
(
pNetworkDownload
)
pNetworkDownload
->
abort
();
else
{
UBAsyncLocalFileDownloader
*
pLocalDownload
=
dynamic_cast
<
UBAsyncLocalFileDownloader
*>
(
mDownloads
[
id
]);
if
(
pLocalDownload
)
{
if
(
pLocalDownload
->
isRunning
())
pLocalDownload
->
abort
();
}
}
mDownloads
.
remove
(
id
);
// Remove the canceled download from the download lists
// Remove the canceled download from the download lists
bool
bFound
=
false
;
bool
bFound
=
false
;
...
@@ -494,7 +600,7 @@ void UBDownloadHttpFile::onDownloadFinished(bool pSuccess, QUrl sourceUrl, QStri
...
@@ -494,7 +600,7 @@ void UBDownloadHttpFile::onDownloadFinished(bool pSuccess, QUrl sourceUrl, QStri
if
(
pSuccess
)
if
(
pSuccess
)
{
{
// Notify the end of the download
// Notify the end of the download
emit
downloadFinished
(
mId
,
pSuccess
,
sourceUrl
,
pContentTypeHeader
,
pData
,
pPos
,
pSize
,
isBackground
);
emit
downloadFinished
(
mId
,
pSuccess
,
sourceUrl
,
sourceUrl
,
pContentTypeHeader
,
pData
,
pPos
,
pSize
,
isBackground
);
}
}
else
else
{
{
...
...
src/core/UBDownloadManager.h
View file @
872e2ee9
...
@@ -52,7 +52,8 @@ struct sDownloadFileDesc
...
@@ -52,7 +52,8 @@ struct sDownloadFileDesc
int
id
;
int
id
;
int
totalSize
;
int
totalSize
;
int
currentSize
;
int
currentSize
;
QString
url
;
QString
srcUrl
;
QString
originalSrcUrl
;
QString
contentTypeHeader
;
QString
contentTypeHeader
;
bool
modal
;
bool
modal
;
QPointF
pos
;
// For board drop only
QPointF
pos
;
// For board drop only
...
@@ -75,7 +76,7 @@ public:
...
@@ -75,7 +76,7 @@ public:
signals
:
signals
:
void
downloadProgress
(
int
id
,
qint64
current
,
qint64
total
);
void
downloadProgress
(
int
id
,
qint64
current
,
qint64
total
);
void
downloadFinished
(
int
id
,
bool
pSuccess
,
QUrl
sourceUrl
,
QString
pContentTypeHeader
,
QByteArray
pData
,
QPointF
pPos
,
QSize
pSize
,
bool
isBackground
);
void
downloadFinished
(
int
id
,
bool
pSuccess
,
QUrl
sourceUrl
,
Q
Url
contentUrl
,
Q
String
pContentTypeHeader
,
QByteArray
pData
,
QPointF
pPos
,
QSize
pSize
,
bool
isBackground
);
void
downloadError
(
int
id
);
void
downloadError
(
int
id
);
private
slots
:
private
slots
:
...
@@ -86,6 +87,28 @@ private:
...
@@ -86,6 +87,28 @@ private:
int
mId
;
int
mId
;
};
};
class
UBAsyncLocalFileDownloader
:
public
QThread
{
Q_OBJECT
public
:
UBAsyncLocalFileDownloader
(
sDownloadFileDesc
desc
,
QObject
*
parent
=
0
);
UBAsyncLocalFileDownloader
*
download
();
void
run
();
void
abort
();
signals
:
void
finished
(
QString
srcUrl
,
QString
resUrl
);
void
signal_asyncCopyFinished
(
int
id
,
bool
pSuccess
,
QUrl
sourceUrl
,
QUrl
contentUrl
,
QString
pContentTypeHeader
,
QByteArray
pData
,
QPointF
pPos
,
QSize
pSize
,
bool
isBackground
);
private
:
sDownloadFileDesc
mDesc
;
bool
m_bAborting
;
QString
mFrom
;
QString
mTo
;
};
class
UBDownloadManager
:
public
QObject
class
UBDownloadManager
:
public
QObject
{
{
Q_OBJECT
Q_OBJECT
...
@@ -108,7 +131,7 @@ signals:
...
@@ -108,7 +131,7 @@ signals:
void
downloadFinished
(
bool
pSuccess
,
int
id
,
QUrl
sourceUrl
,
QString
pContentTypeHeader
,
QByteArray
pData
);
void
downloadFinished
(
bool
pSuccess
,
int
id
,
QUrl
sourceUrl
,
QString
pContentTypeHeader
,
QByteArray
pData
);
void
downloadFinished
(
bool
pSuccess
,
sDownloadFileDesc
desc
,
QByteArray
pData
);
void
downloadFinished
(
bool
pSuccess
,
sDownloadFileDesc
desc
,
QByteArray
pData
);
void
downloadModalFinished
();
void
downloadModalFinished
();
void
addDownloadedFileToBoard
(
bool
pSuccess
,
QUrl
sourceUrl
,
QString
pContentTypeHeader
,
QByteArray
pData
,
QPointF
pPos
,
QSize
pSize
,
bool
isBackground
);
void
addDownloadedFileToBoard
(
bool
pSuccess
,
QUrl
sourceUrl
,
Q
Url
contentUrl
,
Q
String
pContentTypeHeader
,
QByteArray
pData
,
QPointF
pPos
,
QSize
pSize
,
bool
isBackground
);
void
addDownloadedFileToLibrary
(
bool
pSuccess
,
QUrl
sourceUrl
,
QString
pContentTypeHeader
,
QByteArray
pData
);
void
addDownloadedFileToLibrary
(
bool
pSuccess
,
QUrl
sourceUrl
,
QString
pContentTypeHeader
,
QByteArray
pData
);
void
cancelAllDownloads
();
void
cancelAllDownloads
();
void
allDownloadsFinished
();
void
allDownloadsFinished
();
...
@@ -116,7 +139,7 @@ signals:
...
@@ -116,7 +139,7 @@ signals:
private
slots
:
private
slots
:
void
onUpdateDownloadLists
();
void
onUpdateDownloadLists
();
void
onDownloadProgress
(
int
id
,
qint64
received
,
qint64
total
);
void
onDownloadProgress
(
int
id
,
qint64
received
,
qint64
total
);
void
onDownloadFinished
(
int
id
,
bool
pSuccess
,
QUrl
sourceUrl
,
QString
pContentTypeHeader
,
QByteArray
pData
,
QPointF
pPos
,
QSize
pSize
,
bool
isBackground
);
void
onDownloadFinished
(
int
id
,
bool
pSuccess
,
QUrl
sourceUrl
,
Q
Url
contentUrl
,
Q
String
pContentTypeHeader
,
QByteArray
pData
,
QPointF
pPos
,
QSize
pSize
,
bool
isBackground
);
void
onDownloadError
(
int
id
);
void
onDownloadError
(
int
id
);
private
:
private
:
...
@@ -138,7 +161,7 @@ private:
...
@@ -138,7 +161,7 @@ private:
/** The current download availability (-1 = free, otherwise the file ID is recorded)*/
/** The current download availability (-1 = free, otherwise the file ID is recorded)*/
QVector
<
int
>
mDLAvailability
;
QVector
<
int
>
mDLAvailability
;
/** A map containing the replies of the GET operations */
/** A map containing the replies of the GET operations */
QMap
<
int
,
Q
NetworkReply
*>
mReplie
s
;
QMap
<
int
,
Q
Object
*>
mDownload
s
;
};
};
#endif // UBDOWNLOADMANAGER_H
#endif // UBDOWNLOADMANAGER_H
src/domain/UBGraphicsDelegateFrame.cpp
View file @
872e2ee9
...
@@ -563,8 +563,7 @@ void UBGraphicsDelegateFrame::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
...
@@ -563,8 +563,7 @@ void UBGraphicsDelegateFrame::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
mTranslateX
+=
fixedPoint
.
x
()
-
bottomRight
.
x
();
mTranslateX
+=
fixedPoint
.
x
()
-
bottomRight
.
x
();
mTranslateY
+=
fixedPoint
.
y
()
-
bottomRight
.
y
();
mTranslateY
+=
fixedPoint
.
y
()
-
bottomRight
.
y
();
}
}
else
if
(
moving
()
||
rotating
())
delegated
()
->
setTransform
(
buildTransform
());
delegated
()
->
setTransform
(
tr
);
}
}
else
// resizing/resizing horizontally
else
// resizing/resizing horizontally
{
{
...
...
src/domain/UBGraphicsMediaItem.cpp
View file @
872e2ee9
...
@@ -73,7 +73,11 @@ UBGraphicsMediaItem::UBGraphicsMediaItem(const QUrl& pMediaFileUrl, QGraphicsIte
...
@@ -73,7 +73,11 @@ UBGraphicsMediaItem::UBGraphicsMediaItem(const QUrl& pMediaFileUrl, QGraphicsIte
mMediaObject
=
new
Phonon
::
MediaObject
(
this
);
mMediaObject
=
new
Phonon
::
MediaObject
(
this
);
if
(
pMediaFileUrl
.
toLocalFile
().
contains
(
"videos"
))
QString
mediaPath
=
pMediaFileUrl
.
toString
();
if
(
""
==
mediaPath
)
mediaPath
=
pMediaFileUrl
.
toLocalFile
();
if
(
mediaPath
.
toLower
().
contains
(
"videos"
))
{
{
mMediaType
=
mediaType_Video
;
mMediaType
=
mediaType_Video
;
...
@@ -91,7 +95,7 @@ UBGraphicsMediaItem::UBGraphicsMediaItem(const QUrl& pMediaFileUrl, QGraphicsIte
...
@@ -91,7 +95,7 @@ UBGraphicsMediaItem::UBGraphicsMediaItem(const QUrl& pMediaFileUrl, QGraphicsIte
haveLinkedImage
=
true
;
haveLinkedImage
=
true
;
}
}
else
else
if
(
pMediaFileUrl
.
toLocalFile
().
contains
(
"audios"
))
if
(
mediaPath
.
toLower
().
contains
(
"audios"
))
{
{
mMediaType
=
mediaType_Audio
;
mMediaType
=
mediaType_Audio
;
mAudioOutput
=
new
Phonon
::
AudioOutput
(
Phonon
::
MusicCategory
,
this
);
mAudioOutput
=
new
Phonon
::
AudioOutput
(
Phonon
::
MusicCategory
,
this
);
...
@@ -191,7 +195,7 @@ void UBGraphicsMediaItem::setSourceUrl(const QUrl &pSourceUrl)
...
@@ -191,7 +195,7 @@ void UBGraphicsMediaItem::setSourceUrl(const QUrl &pSourceUrl)
UBAudioPresentationWidget
*
pAudioWidget
=
dynamic_cast
<
UBAudioPresentationWidget
*>
(
mAudioWidget
);
UBAudioPresentationWidget
*
pAudioWidget
=
dynamic_cast
<
UBAudioPresentationWidget
*>
(
mAudioWidget
);
if
(
pAudioWidget
)
if
(
pAudioWidget
)
{
{
pAudioWidget
->
setTitle
(
UBFileSystemUtils
::
lastPathComponent
(
pSourceUrl
.
to
String
()));
pAudioWidget
->
setTitle
(
UBFileSystemUtils
::
lastPathComponent
(
pSourceUrl
.
to
LocalFile
()));
}
}
UBItem
::
setSourceUrl
(
pSourceUrl
);
UBItem
::
setSourceUrl
(
pSourceUrl
);
...
...
src/domain/UBGraphicsScene.cpp
View file @
872e2ee9
...
@@ -1217,6 +1217,11 @@ void UBGraphicsScene::textUndoCommandAdded(UBGraphicsTextItem *textItem)
...
@@ -1217,6 +1217,11 @@ void UBGraphicsScene::textUndoCommandAdded(UBGraphicsTextItem *textItem)
}
}
UBGraphicsMediaItem
*
UBGraphicsScene
::
addMedia
(
const
QUrl
&
pMediaFileUrl
,
bool
shouldPlayAsap
,
const
QPointF
&
pPos
)
UBGraphicsMediaItem
*
UBGraphicsScene
::
addMedia
(
const
QUrl
&
pMediaFileUrl
,
bool
shouldPlayAsap
,
const
QPointF
&
pPos
)
{
{
qDebug
()
<<
pMediaFileUrl
.
toLocalFile
();
if
(
!
QFile
::
exists
(
pMediaFileUrl
.
toLocalFile
()))
if
(
!
QFile
::
exists
(
pMediaFileUrl
.
toString
()))
return
NULL
;
UBGraphicsMediaItem
*
mediaItem
=
new
UBGraphicsMediaItem
(
pMediaFileUrl
);
UBGraphicsMediaItem
*
mediaItem
=
new
UBGraphicsMediaItem
(
pMediaFileUrl
);
if
(
mediaItem
){
if
(
mediaItem
){
connect
(
UBApplication
::
boardController
,
SIGNAL
(
activeSceneChanged
()),
mediaItem
,
SLOT
(
activeSceneChanged
()));
connect
(
UBApplication
::
boardController
,
SIGNAL
(
activeSceneChanged
()),
mediaItem
,
SLOT
(
activeSceneChanged
()));
...
@@ -1603,6 +1608,9 @@ void UBGraphicsScene::removeItem(QGraphicsItem* item)
...
@@ -1603,6 +1608,9 @@ void UBGraphicsScene::removeItem(QGraphicsItem* item)
--
mItemCount
;
--
mItemCount
;
mFastAccessItems
.
removeAll
(
item
);
mFastAccessItems
.
removeAll
(
item
);
/* delete the item if it is cache to allow its reinstanciation, because Cache implements design pattern Singleton. */
if
(
dynamic_cast
<
UBGraphicsCache
*>
(
item
))
UBCoreGraphicsScene
::
deleteItem
(
item
);
}
}
void
UBGraphicsScene
::
removeItems
(
const
QSet
<
QGraphicsItem
*>&
items
)
void
UBGraphicsScene
::
removeItems
(
const
QSet
<
QGraphicsItem
*>&
items
)
...
@@ -1956,17 +1964,17 @@ void UBGraphicsScene::addAristo(QPointF center)
...
@@ -1956,17 +1964,17 @@ void UBGraphicsScene::addAristo(QPointF center)
void
UBGraphicsScene
::
addCache
()
void
UBGraphicsScene
::
addCache
()
{
{
UBGraphicsCache
*
cache
=
new
UBGraphicsCache
();
UBGraphicsCache
*
cache
=
UBGraphicsCache
::
instance
(
this
);
mTools
<<
cache
;
if
(
!
items
().
contains
(
cache
))
{
addItem
(
cache
);
addItem
(
cache
);
cache
->
setData
(
UBGraphicsItemData
::
ItemLayerType
,
QVariant
(
UBItemLayerType
::
Tool
));
cache
->
setData
(
UBGraphicsItemData
::
ItemLayerType
,
QVariant
(
UBItemLayerType
::
Tool
));
cache
->
setVisible
(
true
);
cache
->
setVisible
(
true
);
cache
->
setSelected
(
true
);
cache
->
setSelected
(
true
);
UBApplication
::
boardController
->
notifyCache
(
true
);
UBApplication
::
boardController
->
notifyCache
(
true
);
UBApplication
::
boardController
->
notifyPageChanged
();
UBApplication
::
boardController
->
notifyPageChanged
();
}
}
}
void
UBGraphicsScene
::
addMask
(
const
QPointF
&
center
)
void
UBGraphicsScene
::
addMask
(
const
QPointF
&
center
)
...
...
src/frameworks/UBFileSystemUtils.cpp
View file @
872e2ee9
...
@@ -19,7 +19,6 @@
...
@@ -19,7 +19,6 @@
#include "core/UBApplication.h"
#include "core/UBApplication.h"
#include "board/UBBoardController.h"
#include "document/UBDocumentContainer.h"
#include "document/UBDocumentContainer.h"
#include "globals/UBGlobals.h"
#include "globals/UBGlobals.h"
...
@@ -854,5 +853,4 @@ QString UBFileSystemUtils::readTextFile(QString path)
...
@@ -854,5 +853,4 @@ QString UBFileSystemUtils::readTextFile(QString path)
}
}
return
""
;
return
""
;
}
}
\ No newline at end of file
src/frameworks/UBFileSystemUtils.h
View file @
872e2ee9
...
@@ -17,14 +17,17 @@
...
@@ -17,14 +17,17 @@
#define UBFILESYSTEMUTILS_H_
#define UBFILESYSTEMUTILS_H_
#include <QtCore>
#include <QtCore>
#include <QThread>
#include "core/UB.h"
#include "core/UB.h"
class
QuaZipFile
;
class
QuaZipFile
;
class
UBProcessingProgressListener
;
class
UBProcessingProgressListener
;
class
UBFileSystemUtils
class
UBFileSystemUtils
:
public
QObject
{
{
Q_OBJECT
public
:
public
:
UBFileSystemUtils
();
UBFileSystemUtils
();
...
...
src/gui/UBFeaturesWidget.cpp
View file @
872e2ee9
...
@@ -1048,8 +1048,8 @@ void UBFeatureProperties::onAddToLib()
...
@@ -1048,8 +1048,8 @@ void UBFeatureProperties::onAddToLib()
desc
.
modal
=
false
;
desc
.
modal
=
false
;
desc
.
name
=
QFileInfo
(
mpElement
->
getFullPath
().
toString
()).
fileName
();
desc
.
name
=
QFileInfo
(
mpElement
->
getFullPath
().
toString
()).
fileName
();
qDebug
()
<<
desc
.
name
;
qDebug
()
<<
desc
.
name
;
desc
.
u
rl
=
mpElement
->
getFullPath
().
toString
();
desc
.
srcU
rl
=
mpElement
->
getFullPath
().
toString
();
qDebug
()
<<
desc
.
u
rl
;
qDebug
()
<<
desc
.
srcU
rl
;
UBDownloadManager
::
downloadManager
()
->
addFileToDownload
(
desc
);
UBDownloadManager
::
downloadManager
()
->
addFileToDownload
(
desc
);
}
}
}
}
...
...
src/tools/UBGraphicsCache.cpp
View file @
872e2ee9
...
@@ -24,11 +24,21 @@
...
@@ -24,11 +24,21 @@
#include "core/memcheck.h"
#include "core/memcheck.h"
UBGraphicsCache
::
UBGraphicsCache
()
:
QGraphicsRectItem
()
QMap
<
UBGraphicsScene
*
,
UBGraphicsCache
*>
UBGraphicsCache
::
sInstances
;
UBGraphicsCache
*
UBGraphicsCache
::
instance
(
UBGraphicsScene
*
scene
)
{
if
(
!
sInstances
.
contains
(
scene
))
sInstances
.
insert
(
scene
,
new
UBGraphicsCache
(
scene
));
return
sInstances
[
scene
];
}
UBGraphicsCache
::
UBGraphicsCache
(
UBGraphicsScene
*
scene
)
:
QGraphicsRectItem
()
,
mMaskColor
(
Qt
::
black
)
,
mMaskColor
(
Qt
::
black
)
,
mMaskShape
(
eMaskShape_Circle
)
,
mMaskShape
(
eMaskShape_Circle
)
,
mShapeWidth
(
100
)
,
mShapeWidth
(
100
)
,
mDrawMask
(
false
)
,
mDrawMask
(
false
)
,
mScene
(
scene
)
{
{
// Get the board size and pass it to the shape
// Get the board size and pass it to the shape
QRect
boardRect
=
UBApplication
::
boardController
->
displayView
()
->
rect
();
QRect
boardRect
=
UBApplication
::
boardController
->
displayView
()
->
rect
();
...
@@ -39,11 +49,12 @@ UBGraphicsCache::UBGraphicsCache():QGraphicsRectItem()
...
@@ -39,11 +49,12 @@ UBGraphicsCache::UBGraphicsCache():QGraphicsRectItem()
UBGraphicsCache
::~
UBGraphicsCache
()
UBGraphicsCache
::~
UBGraphicsCache
()
{
{
sInstances
.
remove
(
mScene
);
}
}
UBItem
*
UBGraphicsCache
::
deepCopy
()
const
UBItem
*
UBGraphicsCache
::
deepCopy
()
const
{
{
UBGraphicsCache
*
copy
=
new
UBGraphicsCache
();
UBGraphicsCache
*
copy
=
new
UBGraphicsCache
(
mScene
);
copyItemParameters
(
copy
);
copyItemParameters
(
copy
);
...
...
src/tools/UBGraphicsCache.h
View file @
872e2ee9
...
@@ -30,7 +30,7 @@ typedef enum
...
@@ -30,7 +30,7 @@ typedef enum
class
UBGraphicsCache
:
public
QGraphicsRectItem
,
public
UBItem
class
UBGraphicsCache
:
public
QGraphicsRectItem
,
public
UBItem
{
{
public
:
public
:
UBGraphicsCache
(
);
static
UBGraphicsCache
*
instance
(
UBGraphicsScene
*
scene
);
~
UBGraphicsCache
();
~
UBGraphicsCache
();
enum
{
Type
=
UBGraphicsItemType
::
cacheItemType
};
enum
{
Type
=
UBGraphicsItemType
::
cacheItemType
};
...
@@ -55,8 +55,7 @@ protected:
...
@@ -55,8 +55,7 @@ protected:
void
mouseReleaseEvent
(
QGraphicsSceneMouseEvent
*
event
);
void
mouseReleaseEvent
(
QGraphicsSceneMouseEvent
*
event
);
private
:
private
:
void
init
();
static
QMap
<
UBGraphicsScene
*
,
UBGraphicsCache
*>
sInstances
;
QRectF
updateRect
(
QPointF
currentPoint
);
QColor
mMaskColor
;
QColor
mMaskColor
;
eMaskShape
mMaskShape
;
eMaskShape
mMaskShape
;
...
@@ -65,6 +64,13 @@ private:
...
@@ -65,6 +64,13 @@ private:
QPointF
mShapePos
;
QPointF
mShapePos
;
int
mOldShapeWidth
;
int
mOldShapeWidth
;
QPointF
mOldShapePos
;
QPointF
mOldShapePos
;
UBGraphicsScene
*
mScene
;
UBGraphicsCache
(
UBGraphicsScene
*
scene
);
void
init
();
QRectF
updateRect
(
QPointF
currentPoint
);
};
};
#endif // UBGRAPHICSCACHE_H
#endif // UBGRAPHICSCACHE_H
src/web/UBTrapFlashController.cpp
View file @
872e2ee9
...
@@ -200,7 +200,7 @@ void UBTrapFlashController::createWidget()
...
@@ -200,7 +200,7 @@ void UBTrapFlashController::createWidget()
// flash widget
// flash widget
UBWebKitUtils
::
HtmlObject
selectedObject
=
mAvailableFlashes
.
at
(
selectedIndex
-
1
);
UBWebKitUtils
::
HtmlObject
selectedObject
=
mAvailableFlashes
.
at
(
selectedIndex
-
1
);
UBApplication
::
applicationController
->
showBoard
();
UBApplication
::
applicationController
->
showBoard
();
UBApplication
::
boardController
->
downloadURL
(
QUrl
(
selectedObject
.
source
),
QPoint
(
0
,
0
),
QSize
(
selectedObject
.
width
,
selectedObject
.
height
));
UBApplication
::
boardController
->
downloadURL
(
QUrl
(
selectedObject
.
source
),
Q
String
(),
Q
Point
(
0
,
0
),
QSize
(
selectedObject
.
width
,
selectedObject
.
height
));
}
}
QString
freezedWidgetPath
=
UBPlatformUtils
::
applicationResourcesDirectory
()
+
"/etc/freezedWidgetWrapper.html"
;
QString
freezedWidgetPath
=
UBPlatformUtils
::
applicationResourcesDirectory
()
+
"/etc/freezedWidgetWrapper.html"
;
...
...
src/web/browser/WBWebTrapWebView.cpp
View file @
872e2ee9
...
@@ -281,7 +281,7 @@ void WBWebTrapWebView::trapElementAtPos(const QPoint& pos)
...
@@ -281,7 +281,7 @@ void WBWebTrapWebView::trapElementAtPos(const QPoint& pos)
emit
objectCaptured
(
QUrl
(
page
()
->
currentFrame
()
->
url
().
toString
()
+
"/"
+
source
),
type
,
emit
objectCaptured
(
QUrl
(
page
()
->
currentFrame
()
->
url
().
toString
()
+
"/"
+
source
),
type
,
htr
.
boundingRect
().
width
(),
htr
.
boundingRect
().
height
());
htr
.
boundingRect
().
width
(),
htr
.
boundingRect
().
height
());
UBApplication
::
boardController
->
downloadURL
(
QUrl
(
source
)
,
QPointF
(
0.0
,
0.0
)
);
UBApplication
::
boardController
->
downloadURL
(
QUrl
(
source
));
UBApplication
::
applicationController
->
showBoard
();
UBApplication
::
applicationController
->
showBoard
();
}
}
}
}
...
...
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