Merge branch 'master' of github.com:Sankore/Sankore-3.1

preferencesAboutTextFull
Anatoly Mihalchenko 13 years ago
commit c19e1f9467
  1. 2
      Sankore_3.1.pro
  2. 62
      resources/images/closeDisabled.svg
  3. 64
      resources/images/menuDisabled.svg
  4. 67
      resources/images/moveUp.svg
  5. 68
      resources/images/moveUpDisabled.svg
  6. 16
      resources/library/interactive/BlackYellow.wgt/config.xml
  7. 507
      resources/library/interactive/BlackYellow.wgt/css/basic.css
  8. BIN
      resources/library/interactive/BlackYellow.wgt/icon.png
  9. BIN
      resources/library/interactive/BlackYellow.wgt/images/greySquare.png
  10. BIN
      resources/library/interactive/BlackYellow.wgt/images/icon-close.png
  11. BIN
      resources/library/interactive/BlackYellow.wgt/images/popupBack.png
  12. 25
      resources/library/interactive/BlackYellow.wgt/index.html
  13. 398
      resources/library/interactive/BlackYellow.wgt/scripts/blackYellow.js
  14. 18
      resources/library/interactive/BlackYellow.wgt/scripts/jquery-1.6.2.min.js
  15. 62
      resources/library/interactive/BlackYellow.wgt/scripts/jquery.disable.text.select.js
  16. 4
      resources/sankore.qrc
  17. 1
      src/board/UBBoardController.h
  18. 5
      src/board/UBBoardPaletteManager.cpp
  19. 4
      src/board/UBBoardPaletteManager.h
  20. 8
      src/core/UBApplication.cpp
  21. 1
      src/core/UBApplicationController.h
  22. 111
      src/document/UBDocumentController.cpp
  23. 2
      src/document/UBDocumentController.h
  24. 34
      src/gui/UBDocumentNavigator.cpp
  25. 5
      src/gui/UBDocumentNavigator.h
  26. 160
      src/gui/UBThumbnailWidget.cpp
  27. 28
      src/gui/UBThumbnailWidget.h

@ -126,7 +126,7 @@ macx {
Foundation \
-lcrypto
CONFIG(release, debug|release):CONFIG += x86
CONFIG(release, debug|release):CONFIG += x86 ppc
# [03-02-2011] We must use the 32bit version for the moment
# because the Quicktime components used by this application

@ -0,0 +1,62 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Generator: Adobe Illustrator 13.0.2, SVG Export Plug-In . SVG Version: 6.00 Build 14948) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
version="1.1"
id="Layer_1"
x="0px"
y="0px"
width="26px"
height="26px"
viewBox="0 0 26 26"
style="enable-background:new 0 0 26 26;"
xml:space="preserve"
inkscape:version="0.48.1 r9760"
sodipodi:docname="close.svg"><metadata
id="metadata13"><rdf:RDF><cc:Work
rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" /><dc:title></dc:title></cc:Work></rdf:RDF></metadata><defs
id="defs11" /><sodipodi:namedview
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1"
objecttolerance="10"
gridtolerance="10"
guidetolerance="10"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="1280"
inkscape:window-height="776"
id="namedview9"
showgrid="false"
inkscape:zoom="11.076923"
inkscape:cx="13"
inkscape:cy="13"
inkscape:window-x="0"
inkscape:window-y="24"
inkscape:window-maximized="1"
inkscape:current-layer="Layer_1" />
<circle
style="fill:#CCCCCC;opacity:0.3"
cx="13"
cy="13"
r="13"
id="circle3" />
<circle
style="fill:#999999;opacity:0.3"
cx="13"
cy="13"
r="11"
id="circle5" />
<polygon
style="fill:#FFFFFF;opacity:0.3"
points="20,17 16,13 20,9 17,6 13,10 9,6 6,9 10,13 6,17 9,20 13,16 17,20 "
id="polygon7" />
</svg>

After

Width:  |  Height:  |  Size: 1.8 KiB

@ -0,0 +1,64 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Generator: Adobe Illustrator 14.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 43363) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
version="1.2"
id="Layer_1"
x="0px"
y="0px"
width="26px"
height="26px"
viewBox="0 0 26 26"
xml:space="preserve"
inkscape:version="0.48.1 r9760"
sodipodi:docname="menu.svg"><metadata
id="metadata13"><rdf:RDF><cc:Work
rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" /><dc:title></dc:title></cc:Work></rdf:RDF></metadata><defs
id="defs11" /><sodipodi:namedview
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1"
objecttolerance="10"
gridtolerance="10"
guidetolerance="10"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="1089"
inkscape:window-height="706"
id="namedview9"
showgrid="false"
inkscape:zoom="11.076923"
inkscape:cx="13"
inkscape:cy="13"
inkscape:window-x="7"
inkscape:window-y="0"
inkscape:window-maximized="0"
inkscape:current-layer="Layer_1" />
<circle
fill="#CCCCCC"
cx="13"
cy="13"
r="13"
id="circle3"
style="opacity:0.3" />
<circle
fill="#999999"
cx="13"
cy="13"
r="11"
id="circle5"
style="opacity:0.3" />
<polygon
fill="#FFFFFF"
points="5,11 21,11 13,19 "
id="polygon7"
style="opacity:0.3" />
</svg>

After

Width:  |  Height:  |  Size: 1.8 KiB

@ -0,0 +1,67 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Generator: Adobe Illustrator 14.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 43363) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
version="1.2"
id="Layer_1"
x="0px"
y="0px"
width="26px"
height="26px"
viewBox="0 0 26 26"
xml:space="preserve"
inkscape:version="0.48.1 r9760"
sodipodi:docname="menu.svg"><metadata
id="metadata13"><rdf:RDF><cc:Work
rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" /><dc:title></dc:title></cc:Work></rdf:RDF></metadata><defs
id="defs11" /><sodipodi:namedview
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1"
objecttolerance="10"
gridtolerance="10"
guidetolerance="10"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="640"
inkscape:window-height="480"
id="namedview9"
showgrid="false"
inkscape:zoom="11.076923"
inkscape:cx="13"
inkscape:cy="13"
inkscape:window-x="140"
inkscape:window-y="135"
inkscape:window-maximized="0"
inkscape:current-layer="Layer_1" />
<circle
fill="#CCCCCC"
cx="13"
cy="13"
r="13"
id="circle3" />
<circle
cx="13"
cy="13"
r="11"
id="circle5"
sodipodi:cx="13"
sodipodi:cy="13"
sodipodi:rx="11"
sodipodi:ry="11"
transform="matrix(1,0,0,-1,0,26)"
style="fill:#999999" />
<polygon
points="13,19 5,11 21,11 "
id="polygon7"
transform="matrix(1,0,0,-1,0,27.006942)"
style="fill:#ffffff" />
</svg>

After

Width:  |  Height:  |  Size: 1.9 KiB

@ -0,0 +1,68 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Generator: Adobe Illustrator 14.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 43363) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
version="1.2"
id="Layer_1"
x="0px"
y="0px"
width="26px"
height="26px"
viewBox="0 0 26 26"
xml:space="preserve"
inkscape:version="0.48.1 r9760"
sodipodi:docname="moveUp.svg"><metadata
id="metadata13"><rdf:RDF><cc:Work
rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" /><dc:title></dc:title></cc:Work></rdf:RDF></metadata><defs
id="defs11" /><sodipodi:namedview
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1"
objecttolerance="10"
gridtolerance="10"
guidetolerance="10"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="1280"
inkscape:window-height="776"
id="namedview9"
showgrid="false"
inkscape:zoom="11.076923"
inkscape:cx="-3.4756945"
inkscape:cy="13"
inkscape:window-x="0"
inkscape:window-y="24"
inkscape:window-maximized="1"
inkscape:current-layer="Layer_1" />
<circle
fill="#CCCCCC"
cx="13"
cy="13"
r="13"
id="circle3"
style="opacity:0.3" />
<circle
cx="13"
cy="13"
r="11"
id="circle5"
sodipodi:cx="13"
sodipodi:cy="13"
sodipodi:rx="11"
sodipodi:ry="11"
transform="matrix(1,0,0,-1,0,26)"
style="fill:#999999;opacity:0.3" />
<polygon
points="13,19 5,11 21,11 "
id="polygon7"
transform="matrix(1,0,0,-1,0,27.006942)"
style="fill:#ffffff;opacity:0.3" />
</svg>

After

Width:  |  Height:  |  Size: 1.9 KiB

@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<widget xmlns="http://www.w3.org/ns/widgets"
xmlns:ub="http://uniboard.mnemis.com/widgets"
id="http://uniboard.mnemis.com/widgets/webbrowser"
version="1.1"
width="700"
height="400"
ub:resizable="false">
<name>Choisir</name>
<author href="http://www.getuniboard.com"
email="info@mnemis.com">Mnemis SA</author>
<description>Choisir widget</description>
<content src="index.html"/>
</widget>

@ -0,0 +1,507 @@
body{
width: 100%;
padding: 0;
margin: 0 auto;
height: auto;
background-color: #666;
overflow: hidden;
}
.toggleButton, .addButton{
width: 20px;
height: 28px;
border: none;
background-image: url(../images/greySquare.png);
font-weight: bold;
font-family: Verdana;
color: yellow;
cursor: pointer;
-webkit-border-top-left-radius: 5px;
-webkit-border-bottom-left-radius: 5px;
border-top-left-radius: 5px;
border-bottom-left-radius: 5px;
}
.buttonDiv, .addButtonDiv{
position: fixed;
float: right;
z-index: 1;
}
.addButtonDiv{
display: none;
}
.leftDiv{
width: 50%;
float: left;
background-color: black;
-webkit-border-top-left-radius: 3px;
-webkit-border-bottom-left-radius: 3px;
border-top-left-radius: 3px;
border-bottom-left-radius: 3px;
}
.rightDiv{
width: 50%;
float: right;
background-color: yellow;
-webkit-border-top-right-radius: 3px;
-webkit-border-bottom-right-radius: 3px;
border-top-right-radius: 3px;
border-bottom-right-radius: 3px;
}
.shadowDiv{
width: 100%;
display: none;
opacity: 0.7;
background-color: black;
-webkit-border-radius: 3px;
-webkit-border-radius: 3px;
border-radius: 3px;
border-radius: 3px;
z-index: 100;
}
.popupBack{
width: 360px;
height: 138px;
position: absolute;
background-image: url(../images/popupBack.png);
background-repeat: repeat;
-webkit-border-radius: 10px;
-webkit-border-radius: 10px;
border-radius: 10px;
border-radius: 10px;
display: none;
z-index: 500;
}
.popupContainers{
float: left;
width: 98%;
height: 36px;
padding: 5px 3px 5px 0;
overflow: hidden;
}
.popupLabels{
color: yellow;
margin: 0 5px;
}
.expresionInput{
float: right;
width: 70%;
border: none;
font-family: Verdana,Arial,Helvetica,sans-serif;
background-color: #ffc;
-webkit-border-radius: 5px;
-webkit-border-radius: 5px;
border-radius: 5px;
border-radius: 5px;
}
.popupButtons{
float: right;
width: 74px;
height: 28px;
margin: 4px 5px;
border: none;
background-image: url(../images/greySquare.png);
font-weight: bold;
font-family: Verdana;
color: yellow;
cursor: pointer;
-webkit-border-radius: 5px;
-webkit-border-radius: 5px;
border-radius: 5px;
border-radius: 5px;
}
.readyTask{
margin: 2px;
padding: 2px;
width: 100%;
height: 100%;
overflow: hidden;
z-index: 100;
}
.taskContainer{
width: 96%;
padding: 2px;
float: left;
text-align: center;
font-family: Verdana,Arial,Helvetica,sans-serif;
font-weight: bold;
}
.editContainer{
position: absolute;
border: 5px solid #c7c7c7;
-webkit-border-radius: 5px;
-webkit-border-radius: 5px;
border-radius: 5px;
border-radius: 5px;
}
.closeItem{
width: 30px;
height: 30px;
position: absolute;
background-image: url(../images/icon-close.png);
right: -15px;
top: -15px;
}
.rightResize{
width: 10px;
height: 65%;
cursor: e-resize;
position: absolute;
background: none;
right: -10px;
top: 20%;
}
.bottomResize{
width: 65%;
height: 10px;
cursor: n-resize;
position: absolute;
background: none;
bottom: -10px;
left: 20%;
}
/*
.addQstDiv{
float: left;
padding: 5px;
margin: 2px;
font-family: Verdana,Arial,Helvetica,sans-serif;
font-size: large;
}
.addQstButton{
margin: 0;
border: none;
background: none;
color: #99ccff;
cursor: pointer;
}
#addQsqSpan1{
font-size: 30px;
margin-right: 10px !important;
}
.qstDiv{
width: 90%;
margin: 2px auto;
padding: 5px;
float: left;
font-family: Verdana,Arial,Helvetica,sans-serif;
}
.qstDivDisplay{
width: 90%;
margin: 5px 5%;
padding: 5px;
float: left;
font-family: Verdana,Arial,Helvetica,sans-serif;
border: 2px solid #cccccc;
-moz-border-radius: 5px;
-webkit-border-radius: 5px;
border-radius: 5px;
-moz-box-shadow: #dadada -1px 0 4px;
-webkit-box-shadow: #dadada -1px 0 4px;
box-shadow: #dadada -1px 0 4px;
}
.spanOptConn{
float: left;
width: 100%;
}
.qstNumber{
float: left;
font-size: 30px;
margin-left: 10px !important;
color: #00C6FF;
}
.qstOptions{
float: right;
}
.changeOptions{
border: none;
background-image: url(../images/grayClose.png);
background-color: white;
background-repeat: no-repeat;
background-position: 0 50%;
width: auto;
padding-left: 18px;
color: #00C6FF;
cursor: pointer;
}
.applyChanges{
border: none;
background-image: url(../images/blueClose.png);
background-color: white;
background-repeat: no-repeat;
background-position: 0 50%;
width: auto;
padding-left: 18px;
color: #00C6FF;
cursor: pointer;
}
.qstDelete{
border: none;
background-image: url(../images/boldClose.png);
background-color: white;
background-repeat: no-repeat;
background-position: 0 50%;
width: auto;
padding-left: 28px;
line-height: 35px;
cursor: pointer;
}
.qstContent{
float: left;
padding: 3px;
margin-left: 10px;
margin-bottom: 10px;
width: 95%;
font-family: Verdana,Arial,Helvetica,sans-serif;
font-size: small;
border: 3px solid #ccc;
-webkit-border-radius: 5px;
border-radius: 5px;
-moz-box-shadow: #dadada -1px 0 4px;
-webkit-box-shadow: #dadada -1px 0 4px;
box-shadow: #dadada -1px 0 4px;
}
.qstContentDisplay{
float: left;
padding: 5px;
margin: 10px;
width: 100%;
font-family: Verdana,Arial,Helvetica,sans-serif;
color:#333333;
}
.ansDiv{
float: left;
margin-left: 100px;
width: 80%;
}
.ansAdd{
border: none;
background: url(../images/blueClose.png) -0px -0px no-repeat;
background-color: white;
width: auto;
padding-left: 20px;
line-height: 24px;
color: #99ccff;
cursor: pointer;
}
.newAnswer{
float: left;
width: 100%;
margin: 3px;
-webkit-border-radius: 5px;
border-radius: 5px;
}
.ansSpan{
border: none;
background-color: white;
color: #00C6FF;
font-size: 14px;
float: left;
margin: 0 3px;
width: 20px;
}
.ansSpanDisplay{
color: #00C6FF;
font-size: 14px;
float: left;
}
.ansContent{
padding: 1px 3px 3px 3px;
margin-left: 5px;
font-family: Verdana,Arial,Helvetica,sans-serif;
font-size: small;
width: 80%;
float: left;
border: 3px solid #ccc;
-webkit-border-radius: 5px;
border-radius: 5px;
-moz-box-shadow: #dadada -1px 0 4px;
-webkit-box-shadow: #dadada -1px 0 4px;
box-shadow: #dadada -1px 0 4px;
}
.ansContentDisplay{
padding: 1px 3px 3px 3px;
margin-left: 5px;
font-family: Verdana,Arial,Helvetica,sans-serif;
font-size: small;
width: 90%;
float: left;
-webkit-border-radius: 5px;
border-radius: 5px;
}
.ansDelete{
float: left;
border: none;
background-image: url(../images/boldGreyClose.png);
background-color: white;
background-repeat: no-repeat;
background-position: 0 50%;
cursor: pointer;
margin: 0 5px;
}
.qstOptChoice{
width: 80%;
margin: 10px 10%;
float: left;
background-color: #F3F3F2;
border-top-width: 1px;
border-right-width: 1px;
border-bottom-width: 1px;
border-left-width: 1px;
border-top-style: solid;
border-right-style: solid;
border-bottom-style: solid;
border-left-style: solid;
border-top-color: #ECECEB;
border-right-color: #ECECEB;
border-bottom-color: #ECECEB;
border-left-color: #ECECEB;
border-top-left-radius: 5px 5px;
border-top-right-radius: 5px 5px;
border-bottom-right-radius: 5px 5px;
border-bottom-left-radius: 5px 5px;
-webkit-box-shadow: #dededd 0 0 2px inset;
padding: 0;
}
.optDescImg{
padding: 2px;
margin: 5px;
background: url(../images/tool.png) -0px -0px no-repeat;
float: left;
margin-left: 20px;
width: 56px;
height: 51px;
}
.optDescText{
text-align: center;
width: 70%;
color: #666666;
float: left;
font-size: small;
font-family: Verdana,Arial,Helvetica,sans-serif;
margin: 3px 5px;
padding: 5px;
}
.type{
float: left;
margin: 10px;
padding: 5px;
-webkit-border-radius: 5px;
border-radius: 5px;
-moz-box-shadow: #dadada -1px 0 4px;
-webkit-box-shadow: #dadada -1px 0 4px;
box-shadow: #dadada -1px 0 4px;
}
.contentType{
width: 100%;
padding: 0;
margin: 0;
background-color: white;
border-bottom: 1px solid #DFDFDE;
border-top-left-radius: 5px 5px;
border-top-right-radius: 5px 5px;
}
.divType1, .divType2, .divType3 {
width: 122px;
height: 97px;
padding: 0 15px;
margin-left: 30px;
}
.divType1{
background: url(../images/1thOption.png)-0px -0px no-repeat;
}
.divType2{
background: url(../images/2thOption.png)-0px -0px no-repeat;
}
.divType3{
background: url(../images/3thOption.png)-0px -0px no-repeat;
}
.textType{
width: 160px;
font-size: small;
font-family: Verdana,Arial,Helvetica,sans-serif;
color: #666;
padding: 3px;
margin-left: 20px;
}
.radioDiv{
background-color: #F5F5F5;
border-top: 1px solid white;
width: 100%;
padding: 0;
margin: 0;
height: 30px;
border-bottom-right-radius: 5px 5px;
border-bottom-left-radius: 5px 5px;
}
.radioType{
float: right;
margin: 2px;
padding: 3px;
}
.popupWordInfo{
position: absolute;
display: none;
width: 100px;
height: 20px;
top: 0;
left: 0;
text-align: center;
border: 1px solid #B9B9B9;
background-color: #eaebeb;
color: #666;
-webkit-border-radius: 5px;
border-radius: 5px;
-webkit-box-shadow: #dadada -1px 0 4px;
box-shadow: #dadada -1px 0 4px;
z-index: 100;
}
*/

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 214 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 861 B

@ -0,0 +1,25 @@
<!--
To change this template, choose Tools | Templates
and open the template in the editor.
-->
<!DOCTYPE html>
<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" type="text/css" href="css/basic.css"/>
<script type="text/javascript" src="scripts/jquery-1.6.2.min.js"></script>
<script src="scripts/jquery.disable.text.select.js" type="text/javascript"></script>
<script type="text/javascript" src="scripts/blackYellow.js"></script>
<script type="text/javascript">
$(document).ready(function(){
init();
});
</script>
</head>
<body>
</body>
</html>

@ -0,0 +1,398 @@
/*
* 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 3 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/>.
*/
function init(){
//variables
var toggleFlag = false; // detects toggling in toggle button
var endFlag = false; // ending of toggling in toggle button
var addToggleStart = false; // detects toggling in add button
var addToggleEnd = false; // ending of toggling in add button
var shadowOver = false;
var mode = false;
var popupFlag = false
var flagForSelect = false;
var dragElement = null; //the element that must be dragging
var coords = {
left:0,
top:0
}
var resizeObj = {
y:false,
x:false,
width:0,
height:0
}
var opacityChanged = false;
if(window.sankore){
if(sankore.preference("blackYellowData","")){
var importArray = jQuery.parseJSON(sankore.preference("blackYellowData",""));
for(var i in importArray){
var tmpReadyTask = $("<div class='readyTask'>");
var exprContainer = $("<div class='taskContainer' style='color: yellow;'>" + importArray[i].data1 + "</div>").appendTo(tmpReadyTask);
var resContainer = $("<div class='taskContainer' style='color: black;'>"+ importArray[i].data2 + "</div>").appendTo(tmpReadyTask);
tmpReadyTask.width(importArray[i].width)
.height(importArray[i].height)
.css("position","absolute")
.css("top",importArray[i].top)
.css("left",importArray[i].left);
tmpReadyTask.appendTo("body");
}
}
$(document).disableTextSelect();
}
/* ------------- BUTTONS -------------*/
// toggle button
var buttonDiv = $("<div id='buttonDiv' class='buttonDiv'>").appendTo("body");
var toggleButton = $("<button id='toggleButton' class='toggleButton'><</button>").appendTo("#buttonDiv");
buttonDiv.css({
top:"10px",
right:0
});
//toggle mode
toggleButton.click(function(){
if(!shadowOver){
if(mode){
mode = false;
addButtonDiv.css("display","none");
$(".leftDiv, .rightDiv").animate({
"opacity":"1"
},"slow",function(){
if(opacityChanged){
if($(".editContainer").size() != 0){
$(".editContainer").each(function(index, domElem){
var tmpReadyTask = $(domElem).find(".readyTask");
tmpReadyTask.width($(domElem).width())
.height($(domElem).height())
.css("position","absolute")
.css("top",$(domElem).position().top)
.css("left",$(domElem).position().left)
.find(".taskContainer").removeAttr("contenteditable");
$(domElem).remove();
tmpReadyTask.appendTo("body");
});
}
opacityChanged = false;
}
});
$(document).disableTextSelect();
} else {
mode = true;
addButtonDiv.css("display","block");
$(document).enableTextSelect();
$(".leftDiv, .rightDiv").animate({
"opacity":"0.4"
},"slow",function(){
if(!opacityChanged){
if($(".readyTask").size() != 0){
$(".readyTask").each(function(index, domElem){
var editContent = $("<div class='editContainer'>").width($(domElem).width() + 10).height($(domElem) + 10).appendTo("body");
var closeItem = $("<div class='closeItem'>").appendTo(editContent);
var rightResize = $("<div class='rightResize'>").appendTo(editContent);
var bottomResize = $("<div class='bottomResize'>").appendTo(editContent);
editContent.css("top", $(domElem).position().top).css("left", $(domElem).position().left);
$(domElem).css("position","static")
.width("100%")
.height("100%")
.find(".taskContainer").attr("contenteditable", "true");
$(domElem).appendTo(editContent);
});
}
opacityChanged = true;
}
});
}
toggleButton.trigger("mouseout");
}
});
// toggle button events
toggleButton.mouseover(function(){
if(!shadowOver){
if(!toggleFlag && !endFlag){
endFlag = true;
toggleButton.animate({
width:"72px"
},"fast",function(){
toggleFlag = true;
if(!mode)
toggleButton.text("Edit");
else
toggleButton.text("Display");
});
}
}
});
toggleButton.mouseout(function(){
if(!shadowOver){
if(toggleFlag && endFlag){
endFlag = false;
toggleButton.animate({
width:"20px"
},"fast", function(){
toggleButton.text("<");
toggleFlag = false;
});
}
}
});
//add button
var addButtonDiv = $("<div id='addButtonDiv' class='addButtonDiv'>").appendTo("body");
var addButton = $("<button id='addButton' class='addButton'>+</button>").appendTo("#addButtonDiv");
addButtonDiv.css({
top:"47px",
right:0
});
// add button events
addButton.click(function(){
shadowDiv.show("fast", function(){
shadowOver = true;
popupBack.show("slow");
});
$(document).disableTextSelect();
addButton.trigger("mouseout");
});
addButton.mouseover(function(){
if(!shadowOver){
if(!addToggleStart && !addToggleEnd){
addToggleEnd = true;
addButton.animate({
width:"72px"
},"fast",function(){
addToggleStart = true;
addButton.text("Add");
});
}
}
});
addButton.mouseout(function(){
if(!shadowOver){
if(addToggleStart && addToggleEnd){
addToggleEnd = false;
addButton.animate({
width:"20px"
},"fast", function(){
addButton.text("+");
addToggleStart = false;
});
}
}
});
/* -------------- END OF WORK WITH BUTTONS ---------------*/
//basic divs
var leftDiv = $("<div id='leftDiv' class='leftDiv'>").appendTo("body");
var rightDiv = $("<div id='rightDiv' class='rightDiv'>").appendTo("body");
//divs for adding a new item
var shadowDiv = $("<div id='shadowDiv' class='shadowDiv'>").appendTo("body");
var popupBack = $("<div id='popupBack' class='popupBack'>").appendTo("body");
//input fields and buttons for a popup window
var expressionDiv = $("<div id='expressionDiv' class='popupContainers'>").appendTo(popupBack);
var experssionLabel = $("<span id='experssionLabel' class='popupLabels'><b>Enter data:</b></span>").appendTo(expressionDiv);
var expresionText = $("<input type='text' id='expresionText' class='expresionInput'/>").appendTo(expressionDiv);
var resultDiv = $("<div id='resultDiv' class='popupContainers'>").appendTo(popupBack);
var resultLabel = $("<span id='resultLabel' class='popupLabels'><b>Enter result:</b></span>").appendTo(resultDiv);
var resultText = $("<input type='text' id='resultText' class='expresionInput'/>").appendTo(resultDiv);
var popupButtonsDiv= $("<div id='popupButtonsDiv' class='popupContainers'>").appendTo(popupBack);
var cancelButton = $("<input type='button' id='cancelButton' class='popupButtons' value='Cancel'/>").appendTo(popupButtonsDiv);
var okButton = $("<input type='button' id='okButton' class='popupButtons' value='Ok'/>").appendTo(popupButtonsDiv);
/* -------------- A WORK WITH POPUP BUTTONS AND FIELDS ---------------*/
$("#resultText, #expresionText").keyup(function(){
if($(this).val()){
$(this).css("background-color", "#ff9");
}
});
cancelButton.click(function(){
$(document).enableTextSelect();
popupBack.hide("slow", function(){
$("#resultText, #expresionText").val("")
.css("background-color", "#ffc");
shadowDiv.hide("fast");
shadowOver = false;
});
});
okButton.click(function(){
$(document).enableTextSelect();
if(checkEmptyFields(expresionText) && checkEmptyFields(resultText)){
popupBack.hide("slow", function(){
shadowDiv.hide("fast");
shadowOver = false;
addTask(expresionText.val(), resultText.val());
$("#resultText, #expresionText").val("")
.css("background-color", "#ffc");
})
}
});
/* -------------- THE END OF WORK WITH POPUP BUTTONS AND FIELDS ---------------*/
// a work with dragging possibility
$("input:text").mouseover(function(){
$(document).enableTextSelect();
});
$("input:text").mouseout(function(){
$(document).disableTextSelect();
});
$(".readyTask, .editContainer").live("mousedown",function(event){
if(!shadowOver){
dragElement = $(this);
coords.left = event.pageX - $(this).position().left;
coords.top = event.pageY - $(this).position().top;
resizeObj.width = $(this).width();
resizeObj.height = $(this).height();
}
});
$(".rightResize").live("mousedown",function(event){
if(!shadowOver){
resizeObj.x = true;
}
});
$(".bottomResize").live("mousedown",function(event){
if(!shadowOver){
resizeObj.y = true;
}
});
$("body").mouseup(function(event){
if(!shadowOver){
dragElement = null;
resizeObj.x = false;
resizeObj.y = false;
}
});
$("body").mousemove(function(event){
if(dragElement && !shadowOver){
if(resizeObj.x)
dragElement.width(event.pageX - dragElement.position().left);
else if(resizeObj.y)
dragElement.height(event.pageY - dragElement.position().top);
else
dragElement.css("top",event.pageY - coords.top).css("left", event.pageX - coords.left);
}
});
//closing item
$(".closeItem").live("click", function(){
if(!shadowOver){
$(this).parent().remove();
}
});
$("#leftDiv,#rightDiv,#shadowDiv").css("height", $(window).height());
popupBack.css("top", ($(window).height() - 138)*50/$(window).height() + "%");
popupBack.css("left", ($(window).width() - 360)*50/$(window).width() + "%");
$(window).resize(function(){
$("#leftDiv,#rightDiv,#shadowDiv").css("height", $(window).height());
popupBack.css("top", ($(window).height() - 138)*50/$(window).height() + "%");
popupBack.css("left", ($(window).width() - 360)*50/$(window).width() + "%");
});
$("html").mouseout(function(){
if(window.sankore)
exportToSankore();
});
// export data
function exportToSankore(){
var objToExport = {
data1:"",
data2:"",
width:0,
height:0,
top:0,
left:0
}
var arrayToExport = new Array();
if(mode){
if($(".editContainer").size() != 0){
$(".editContainer").each(function(index, domElem){
objToExport.data1 = $(domElem).find(".readyTask").find(":first-child").text();
objToExport.data2 = $(domElem).find(".readyTask").find(":last-child").text();
objToExport.width = $(domElem).width();
objToExport.height = $(domElem).height();
objToExport.top = $(domElem).position().top;
objToExport.left = $(domElem).position().left;
arrayToExport.push(objToExport);
});
}
} else {
if($(".readyTask").size() != 0){
$(".readyTask").each(function(index, domElem){
objToExport.data1 = $(domElem).find(":first-child").text();
objToExport.data2 = $(domElem).find(":last-child").text();
objToExport.width = $(domElem).width();
objToExport.height = $(domElem).height();
objToExport.top = $(domElem).position().top;
objToExport.left = $(domElem).position().left;
arrayToExport.push(objToExport);
});
}
}
sankore.setPreference("blackYellowData", JSON.stringify(arrayToExport));
}
}
//checking empty fields
function checkEmptyFields(field){
if(field.val() == ""){
field.css("background-color", "red");
return false;
} else {
field.css("background-color", "#ff9");
return true;
}
}
//adding a new task to the page
function addTask(expression, result){
var editContent = $("<div class='editContainer'>").width(240).height(70).appendTo("body");
var closeItem = $("<div class='closeItem'>").appendTo(editContent);
var rightResize = $("<div class='rightResize'>").appendTo(editContent);
var bottomResize = $("<div class='bottomResize'>").appendTo(editContent);
var main = $("<div class='readyTask'>");
var exprContainer = $("<div class='taskContainer' style='color: yellow;' contenteditable='true'>" + expression + "</div>").appendTo(main);
var resContainer = $("<div class='taskContainer' style='color: black;' contenteditable='true'>"+ result + "</div>").appendTo(main);
main.appendTo(editContent);
}

File diff suppressed because one or more lines are too long

@ -0,0 +1,62 @@
/**
* .disableTextSelect - Disable Text Select Plugin
*
* Version: 1.1
* Updated: 2007-11-28
*
* Used to stop users from selecting text
*
* Copyright (c) 2007 James Dempster (letssurf@gmail.com, http://www.jdempster.com/category/jquery/disabletextselect/)
*
* Dual licensed under the MIT (MIT-LICENSE.txt)
* and GPL (GPL-LICENSE.txt) licenses.
**/
/**
* Requirements:
* - jQuery (John Resig, http://www.jquery.com/)
**/
(function($) {
if ($.browser.mozilla) {
$.fn.disableTextSelect = function() {
return this.each(function() {
$(this).css({
'MozUserSelect' : 'none'
});
});
};
$.fn.enableTextSelect = function() {
return this.each(function() {
$(this).css({
'MozUserSelect' : ''
});
});
};
} else if ($.browser.msie) {
$.fn.disableTextSelect = function() {
return this.each(function() {
$(this).bind('selectstart.disableTextSelect', function() {
return false;
});
});
};
$.fn.enableTextSelect = function() {
return this.each(function() {
$(this).unbind('selectstart.disableTextSelect');
});
};
} else {
$.fn.disableTextSelect = function() {
return this.each(function() {
$(this).bind('mousedown.disableTextSelect', function() {
return false;
});
});
};
$.fn.enableTextSelect = function() {
return this.each(function() {
$(this).unbind('mousedown.disableTextSelect');
});
};
}
})(jQuery);

@ -326,5 +326,9 @@
<file>images/up_arrow.png</file>
<file>images/left_arrow.png</file>
<file>images/right_arrow.png</file>
<file>images/moveUp.svg</file>
<file>images/closeDisabled.svg</file>
<file>images/menuDisabled.svg</file>
<file>images/moveUpDisabled.svg</file>
</qresource>
</RCC>

@ -262,6 +262,7 @@ class UBBoardController : public QObject
void cacheDisabled();
void pageChanged();
void setDocOnPageNavigator(UBDocumentProxy* doc);
void documentReorganized(int index);
protected:

@ -717,3 +717,8 @@ UBRightPalette* UBBoardPaletteManager::createDesktopRightPalette(QWidget* parent
return mDesktopRightPalette;
}
void UBBoardPaletteManager::connectToDocumentController()
{
emit connectToDocController();
}

@ -49,10 +49,14 @@ class UBBoardPaletteManager : public QObject
UBLeftPalette* leftPalette(){return mLeftPalette;}
void showVirtualKeyboard(bool show = true);
void initPalettesPosAtStartup();
void connectToDocumentController();
UBKeyboardPalette *mKeyboardPalette;
UBRightPalette* createDesktopRightPalette(QWidget* parent);
signals:
void connectToDocController();
public slots:
void activeSceneChanged();

@ -39,7 +39,7 @@
#include "board/UBBoardController.h"
#include "board/UBDrawingController.h"
#include "board/UBBoardView.h"
#include "board/UBBoardPaletteManager.h"
#include "web/UBWebController.h"
#include "document/UBDocumentController.h"
@ -233,13 +233,15 @@ int UBApplication::exec(const QString& pFileToImport)
connect(mainWindow->actionDocument, SIGNAL(triggered()), this, SLOT(showDocument()));
connect(mainWindow->actionQuit, SIGNAL(triggered()), this, SLOT(closing()));
connect(mainWindow, SIGNAL(closeEvent_Signal(QCloseEvent*)), this, SLOT(closeEvent(QCloseEvent*)));
boardController = new UBBoardController(mainWindow);
boardController->init();
webController = new UBWebController(mainWindow);
documentController = new UBDocumentController(mainWindow);
boardController->paletteManager()->connectToDocumentController();
applicationController = new UBApplicationController(boardController->controlView(), boardController->displayView(), mainWindow, staticMemoryCleaner);
connect(mainWindow->actionDesktop, SIGNAL(triggered(bool)), applicationController, SLOT(showDesktop(bool)));
@ -249,6 +251,8 @@ int UBApplication::exec(const QString& pFileToImport)
connect(mainWindow->actionHideApplication, SIGNAL(triggered()), this, SLOT(showMinimized()));
#endif
connect(documentController, SIGNAL(movedToIndex(int)), boardController, SIGNAL(documentReorganized(int)));
mPreferencesController = new UBPreferencesController(mainWindow);
connect(mainWindow->actionPreferences, SIGNAL(triggered()), mPreferencesController, SLOT(show()));

@ -102,7 +102,6 @@ class UBApplicationController : public QObject
signals:
void mainModeChanged(UBApplicationController::MainMode pMode);
void desktopMode(bool displayed);
public slots:

@ -620,40 +620,42 @@ void UBDocumentController::deleteSelectedItem()
{
QList<QGraphicsItem*> selectedItems = mDocumentUI->thumbnailWidget->selectedItems();
if (selectedItems.count() > 0)
{
QList<int> sceneIndexes;
UBDocumentProxy* proxy = 0;
foreach (QGraphicsItem* item, selectedItems)
{
UBSceneThumbnailPixmap* thumb = dynamic_cast<UBSceneThumbnailPixmap*> (item);
if (thumb)
{
proxy = thumb->proxy();
if (proxy)
{
sceneIndexes.append(thumb->sceneIndex());
}
}
}
if(UBApplication::mainWindow->yesNoQuestion(tr("Remove Page"), tr("Are you sure you want to remove %n page(s) from the selected document '%1'?", "", sceneIndexes.count()).arg(proxy->metaData(UBSettings::documentName).toString())))
{
UBPersistenceManager::persistenceManager()->deleteDocumentScenes(proxy, sceneIndexes);
proxy->setMetaData(UBSettings::documentUpdatedAt, UBStringUtils::toUtcIsoDateTime(QDateTime::currentDateTime()));
UBMetadataDcSubsetAdaptor::persist(proxy);
refreshDocumentThumbnailsView();
int minIndex = proxy->pageCount() - 1;
foreach (int i, sceneIndexes)
minIndex = qMin(i, minIndex);
mDocumentUI->thumbnailWidget->selectItemAt(minIndex);
}
}
deletePages(selectedItems);
// if (selectedItems.count() > 0)
// {
// QList<int> sceneIndexes;
// UBDocumentProxy* proxy = 0;
// foreach (QGraphicsItem* item, selectedItems)
// {
// UBSceneThumbnailPixmap* thumb = dynamic_cast<UBSceneThumbnailPixmap*> (item);
// if (thumb)
// {
// proxy = thumb->proxy();
// if (proxy)
// {
// sceneIndexes.append(thumb->sceneIndex());
// }
// }
// }
// if(UBApplication::mainWindow->yesNoQuestion(tr("Remove Page"), tr("Are you sure you want to remove %n page(s) from the selected document '%1'?", "", sceneIndexes.count()).arg(proxy->metaData(UBSettings::documentName).toString())))
// {
// UBPersistenceManager::persistenceManager()->deleteDocumentScenes(proxy, sceneIndexes);
// proxy->setMetaData(UBSettings::documentUpdatedAt, UBStringUtils::toUtcIsoDateTime(QDateTime::currentDateTime()));
// UBMetadataDcSubsetAdaptor::persist(proxy);
// refreshDocumentThumbnailsView();
// int minIndex = proxy->pageCount() - 1;
// foreach (int i, sceneIndexes)
// minIndex = qMin(i, minIndex);
// mDocumentUI->thumbnailWidget->selectItemAt(minIndex);
// }
// }
}
else
{
@ -1164,7 +1166,11 @@ void UBDocumentController::moveSceneToIndex(UBDocumentProxy* proxy, int source,
UBMetadataDcSubsetAdaptor::persist(proxy);
refreshDocumentThumbnailsView();
// NOTE [Didier]: I think that selecting the thumbnail is not the role of the documentController
mDocumentUI->thumbnailWidget->selectItemAt(target);
// Notify the move to anyone interested in knowing it
emit movedToIndex(target);
}
@ -1630,3 +1636,40 @@ void UBDocumentController::focusChanged(QWidget *old, QWidget *current)
selectionChanged();
}
void UBDocumentController::deletePages(QList<QGraphicsItem *> itemsToDelete)
{
if (itemsToDelete.count() > 0)
{
QList<int> sceneIndexes;
UBDocumentProxy* proxy = 0;
foreach (QGraphicsItem* item, itemsToDelete)
{
UBSceneThumbnailPixmap* thumb = dynamic_cast<UBSceneThumbnailPixmap*> (item);
if (thumb)
{
proxy = thumb->proxy();
if (proxy)
{
sceneIndexes.append(thumb->sceneIndex());
}
}
}
if(UBApplication::mainWindow->yesNoQuestion(tr("Remove Page"), tr("Are you sure you want to remove %n page(s) from the selected document '%1'?", "", sceneIndexes.count()).arg(proxy->metaData(UBSettings::documentName).toString())))
{
UBPersistenceManager::persistenceManager()->deleteDocumentScenes(proxy, sceneIndexes);
proxy->setMetaData(UBSettings::documentUpdatedAt, UBStringUtils::toUtcIsoDateTime(QDateTime::currentDateTime()));
UBMetadataDcSubsetAdaptor::persist(proxy);
refreshDocumentThumbnailsView();
int minIndex = proxy->pageCount() - 1;
foreach (int i, sceneIndexes)
minIndex = qMin(i, minIndex);
mDocumentUI->thumbnailWidget->selectItemAt(minIndex);
}
}
}

@ -49,10 +49,12 @@ class UBDocumentController : public QObject
UBDocumentProxyTreeItem* findDocument(UBDocumentProxy* proxy);
bool addFileToDocument(UBDocumentProxy* document);
UBDocumentProxy* getCurrentDocument();
void deletePages(QList<QGraphicsItem*> itemsToDelete);
signals:
void refreshThumbnails();
void exportDone();
void movedToIndex(int index);
public slots:
void createNewDocument();

@ -28,6 +28,8 @@
#include "adaptors/UBSvgSubsetAdaptor.h"
#include "document/UBDocumentController.h"
#include "domain/UBGraphicsScene.h"
#include "board/UBBoardPaletteManager.h"
#include "core/UBApplicationController.h"
#include "core/memcheck.h"
@ -56,6 +58,7 @@ UBDocumentNavigator::UBDocumentNavigator(QWidget *parent, const char *name):QGra
connect(UBApplication::boardController, SIGNAL(activeSceneChanged()), this, SLOT(addNewPage()));
connect(UBApplication::boardController, SIGNAL(setDocOnPageNavigator(UBDocumentProxy*)), this, SLOT(generateThumbnails()));
connect(mScene, SIGNAL(selectionChanged()), this, SLOT(onSelectionChanged()));
connect(UBApplication::boardController, SIGNAL(documentReorganized(int)), this, SLOT(onMovedToIndex(int)));
}
/**
@ -107,13 +110,13 @@ void UBDocumentNavigator::generateThumbnails()
for(int i = 0; i < thumbs.count(); i++)
{
QPixmap pix = thumbs.at(i);
QGraphicsPixmapItem* pixmapItem = new UBSceneThumbnailPixmap(pix, mCrntDoc, i);
QGraphicsPixmapItem* pixmapItem = new UBSceneThumbnailNavigPixmap(pix, mCrntDoc, i);
// Get the selected item
if(UBApplication::boardController->activeSceneIndex() == i)
{
selection = pixmapItem;
mCrntItem = dynamic_cast<UBSceneThumbnailPixmap*>(pixmapItem);
mCrntItem = dynamic_cast<UBSceneThumbnailNavigPixmap*>(pixmapItem);
mCrntItem->setSelected(true);
}
@ -145,7 +148,7 @@ void UBDocumentNavigator::updateSpecificThumbnail(int iPage)
// Load it
QList<QPixmap> thumbs = UBThumbnailAdaptor::load(mCrntDoc);
QPixmap pix = thumbs.at(iPage);
QGraphicsPixmapItem* pixmapItem = new UBSceneThumbnailPixmap(pix, mCrntDoc, iPage);
QGraphicsPixmapItem* pixmapItem = new UBSceneThumbnailNavigPixmap(pix, mCrntDoc, iPage);
if(pixmapItem)
{
// Get the old thumbnail
@ -370,7 +373,7 @@ void UBDocumentNavigator::mousePressEvent(QMouseEvent *event)
bNavig = true;
// First, select the clicked item
UBSceneThumbnailPixmap* pCrntItem = dynamic_cast<UBSceneThumbnailPixmap*>(pClickedItem);
UBSceneThumbnailNavigPixmap* pCrntItem = dynamic_cast<UBSceneThumbnailNavigPixmap*>(pClickedItem);
if(NULL == pCrntItem)
{
@ -378,7 +381,7 @@ void UBDocumentNavigator::mousePressEvent(QMouseEvent *event)
UBThumbnailTextItem* pTextItem = dynamic_cast<UBThumbnailTextItem*>(pClickedItem);
if(NULL != pTextItem)
{
pCrntItem = dynamic_cast<UBSceneThumbnailPixmap*>(mThumbnails.at(mLabels.indexOf(pTextItem)));
pCrntItem = dynamic_cast<UBSceneThumbnailNavigPixmap*>(mThumbnails.at(mLabels.indexOf(pTextItem)));
}
}
else
@ -387,12 +390,14 @@ void UBDocumentNavigator::mousePressEvent(QMouseEvent *event)
{
// Unselect the previous item
int iOldPage = mThumbnails.indexOf(mCrntItem);
mCrntItem->setSelected(false);
updateSpecificThumbnail(iOldPage);
mCrntItem = pCrntItem;
}
pCrntItem->setSelected(true);
// HACK: for an unknown reason, the mousePressEvent of the item is not
// called when a click occurs on it. So I created this method in
// order to handle the click.
mCrntItem->notifyClick(mapToScene(event->pos()));
// Then display the related page
emit changeCurrentPage();
@ -435,3 +440,18 @@ void UBDocumentNavigator::onSelectionChanged()
// QList<QGraphicsItem*> qlItems = mScene->selectedItems();
// qDebug() << "The number of selected items is " << qlItems.count();
}
/**
* \brief Occurs when a page has been moved to another index in the document
* @param index as the new index
*/
void UBDocumentNavigator::onMovedToIndex(int index)
{
UBSceneThumbnailNavigPixmap* pItem = dynamic_cast<UBSceneThumbnailNavigPixmap*>(mThumbnails.at(index));
if(NULL != pItem)
{
mCrntItem = pItem;
mCrntItem->setSelected(true);
centerOn(mCrntItem);
}
}

@ -44,6 +44,9 @@ public:
signals:
void changeCurrentPage();
public slots:
void onMovedToIndex(int index);
protected:
virtual void resizeEvent(QResizeEvent *event);
virtual void mousePressEvent(QMouseEvent *event);
@ -63,7 +66,7 @@ private:
/** The scene */
QGraphicsScene* mScene;
/** The current selected item */
UBSceneThumbnailPixmap* mCrntItem;
UBSceneThumbnailNavigPixmap* mCrntItem;
/** The current document */
UBDocumentProxy* mCrntDoc;
/** The list of current thumbnails */

@ -13,14 +13,19 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <QString>
#include <QCursor>
#include "UBThumbnailWidget.h"
#include "UBRubberBand.h"
#include "core/UBSettings.h"
#include "core/UBApplication.h"
#include "core/memcheck.h"
#include "document/UBDocumentProxy.h"
#include "document/UBDocumentController.h"
UBThumbnailWidget::UBThumbnailWidget(QWidget* parent)
: QGraphicsView(parent)
, mThumbnailWidth(UBSettings::defaultThumbnailWidth)
@ -681,3 +686,158 @@ UBThumbnail::~UBThumbnail()
if (mSelectionItem && !mAddedToScene)
delete mSelectionItem;
}
UBSceneThumbnailNavigPixmap::UBSceneThumbnailNavigPixmap(const QPixmap& pix, UBDocumentProxy* proxy, int pSceneIndex)
: UBSceneThumbnailPixmap(pix, proxy, pSceneIndex)
, bButtonsVisible(false)
, bCanDelete(false)
, bCanMoveUp(false)
, bCanMoveDown(false)
{
setAcceptsHoverEvents(true);
setFlag(QGraphicsItem::ItemIsSelectable, true);
}
UBSceneThumbnailNavigPixmap::~UBSceneThumbnailNavigPixmap()
{
}
void UBSceneThumbnailNavigPixmap::hoverEnterEvent(QGraphicsSceneHoverEvent *event)
{
event->accept();
updateButtonsState();
update();
}
void UBSceneThumbnailNavigPixmap::hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
{
event->accept();
bButtonsVisible = false;
update();
}
void UBSceneThumbnailNavigPixmap::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
{
Q_UNUSED(option);
Q_UNUSED(widget);
UBSceneThumbnailPixmap::paint(painter, option, widget);
if(bButtonsVisible)
{
if(bCanDelete)
painter->drawPixmap(0, 0, BUTTONSIZE, BUTTONSIZE, QPixmap(":images/close.svg"));
else
painter->drawPixmap(0, 0, BUTTONSIZE, BUTTONSIZE, QPixmap(":images/closeDisabled.svg"));
if(bCanMoveUp)
painter->drawPixmap(BUTTONSIZE + BUTTONSPACING, 0, BUTTONSIZE, BUTTONSIZE, QPixmap(":images/moveUp.svg"));
else
painter->drawPixmap(BUTTONSIZE + BUTTONSPACING, 0, BUTTONSIZE, BUTTONSIZE, QPixmap(":images/moveUpDisabled.svg"));
if(bCanMoveDown)
painter->drawPixmap(2*(BUTTONSIZE + BUTTONSPACING), 0, BUTTONSIZE, BUTTONSIZE, QPixmap(":images/menu.svg"));
else
painter->drawPixmap(2*(BUTTONSIZE + BUTTONSPACING), 0, BUTTONSIZE, BUTTONSIZE, QPixmap(":images/menuDisabled.svg"));
}
}
void UBSceneThumbnailNavigPixmap::mousePressEvent(QGraphicsSceneMouseEvent *event)
{
// INFO: This implementation should work but this method is not called on a mousePressEvent, why?
// PLEASE DO NOT REMOVE THIS METHOD! We should reactivate this code when we will fix
// the mousePressEvent-not-called issue!
// QPointF p = event->pos();
// // Here we check the position of the click and verify if it has to trig an action or not.
// if(bCanDelete && p.x() >= 0 && p.x() <= BUTTONSIZE && p.y() >= 0 && p.y() <= BUTTONSIZE)
// {
// deletePage();
// }
// if(bCanMoveUp && p.x() >= BUTTONSIZE + BUTTONSPACING && p.x() <= 2*BUTTONSIZE + BUTTONSPACING && p.y() >= 0 && p.y() <= BUTTONSIZE)
// {
// moveUpPage();
// }
// if(bCanMoveDown && p.x() >= 2*(BUTTONSIZE + BUTTONSPACING) && p.x() <= 2*(BUTTONSIZE + BUTTONSPACING) + BUTTONSIZE && p.y() >= 0 && p.y() <= BUTTONSIZE)
// {
// moveDownPage();
// }
event->accept();
}
void UBSceneThumbnailNavigPixmap::updateButtonsState()
{
bCanDelete = false;
bCanMoveUp = false;
bCanMoveDown = false;
UBDocumentProxy* p = proxy();
if(NULL != p)
{
int iNbPages = p->pageCount();
if(1 < iNbPages)
{
bCanDelete = true;
if(sceneIndex() > 0)
{
bCanMoveUp = true;
}
if(sceneIndex() != iNbPages - 1)
{
bCanMoveDown = true;
}
}
}
if(bCanDelete || bCanMoveUp || bCanMoveDown)
{
bButtonsVisible = true;
}
}
void UBSceneThumbnailNavigPixmap::deletePage()
{
QList<QGraphicsItem*> itemsToDelete;
itemsToDelete << this;
UBApplication::documentController->deletePages(itemsToDelete);
}
void UBSceneThumbnailNavigPixmap::moveUpPage()
{
UBApplication::documentController->moveSceneToIndex(proxy(), sceneIndex(), sceneIndex() - 1);
}
void UBSceneThumbnailNavigPixmap::moveDownPage()
{
UBApplication::documentController->moveSceneToIndex(proxy(), sceneIndex(), sceneIndex() + 1);
}
void UBSceneThumbnailNavigPixmap::notifyClick(QPointF clickedScenePos)
{
QPointF p = clickedPos(clickedScenePos);
// Here we check the position of the click and verify if it has to trig an action or not.
if(bCanDelete && p.x() >= 0 && p.x() <= BUTTONSIZE/2 && p.y() >= 0 && p.y() <= BUTTONSIZE/2)
{
deletePage();
}
if(bCanMoveUp && p.x() >= (BUTTONSIZE + BUTTONSPACING)/2 && p.x() <= BUTTONSIZE + BUTTONSPACING && p.y() >= 0 && p.y() <= BUTTONSIZE/2)
{
moveUpPage();
}
if(bCanMoveDown && p.x() >= BUTTONSIZE + BUTTONSPACING && p.x() <= BUTTONSIZE + BUTTONSPACING + BUTTONSIZE/2 && p.y() >= 0 && p.y() <= BUTTONSIZE/2)
{
moveDownPage();
}
}
QPointF UBSceneThumbnailNavigPixmap::clickedPos(QPointF clickedScenePos)
{
QPointF p;
p.setX(clickedScenePos.x() - scenePos().x());
p.setY(clickedScenePos.y() - scenePos().y());
return p;
}

@ -19,11 +19,14 @@
#include <QtGui>
#include <QtSvg>
#include <QTime>
#include <QGraphicsSceneHoverEvent>
#include "frameworks/UBCoreGraphicsScene.h"
#include "core/UBSettings.h"
#define STARTDRAGTIME 1000000
#define BUTTONSIZE 48
#define BUTTONSPACING 5
class UBDocumentProxy;
class UBThumbnailTextItem;
@ -282,6 +285,31 @@ class UBSceneThumbnailPixmap : public UBThumbnailPixmap
int mSceneIndex;
};
class UBSceneThumbnailNavigPixmap : public UBSceneThumbnailPixmap
{
public:
UBSceneThumbnailNavigPixmap(const QPixmap& pix, UBDocumentProxy* proxy, int pSceneIndex);
~UBSceneThumbnailNavigPixmap();
void notifyClick(QPointF clickedScenePos);
protected:
void hoverEnterEvent(QGraphicsSceneHoverEvent *event);
void hoverLeaveEvent(QGraphicsSceneHoverEvent *event);
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
void mousePressEvent(QGraphicsSceneMouseEvent *event);
private:
void updateButtonsState();
void deletePage();
void moveUpPage();
void moveDownPage();
QPointF clickedPos(QPointF clickedScenePos);
bool bButtonsVisible;
bool bCanDelete;
bool bCanMoveUp;
bool bCanMoveDown;
};
class UBThumbnailVideo : public UBThumbnailPixmap
{

Loading…
Cancel
Save