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

preferencesAboutTextFull
Ivan Ilin 13 years ago
commit 2984f83c1a
  1. 2
      Sankore_3.1.pro
  2. 6
      buildDebianPackage
  3. 31
      resources/library/sankoreInteractivities/ordonner_des_images.wgt/css/basic.css
  4. BIN
      resources/library/sankoreInteractivities/ordonner_des_images.wgt/img/1.jpg
  5. BIN
      resources/library/sankoreInteractivities/ordonner_des_images.wgt/img/1.png
  6. BIN
      resources/library/sankoreInteractivities/ordonner_des_images.wgt/img/2.png
  7. BIN
      resources/library/sankoreInteractivities/ordonner_des_images.wgt/img/clear_img.png
  8. BIN
      resources/library/sankoreInteractivities/ordonner_des_images.wgt/img/drop_img.png
  9. BIN
      resources/library/sankoreInteractivities/ordonner_des_images.wgt/img/numb_img.png
  10. 26
      resources/library/sankoreInteractivities/ordonner_des_images.wgt/index.html
  11. 54
      resources/library/sankoreInteractivities/ordonner_des_images.wgt/js/script.js
  12. 8
      resources/library/sankoreInteractivities/ordonner_des_images.wgt/js/translation/en.js
  13. 8
      resources/library/sankoreInteractivities/ordonner_des_images.wgt/js/translation/fr.js
  14. 8
      resources/library/sankoreInteractivities/ordonner_des_images.wgt/js/translation/ru.js
  15. BIN
      resources/library/sankoreInteractivities/ordonner_des_images.wgt/locales/fr/img/drop_img.png
  16. 45
      resources/library/sankoreInteractivities/ordonner_des_images.wgt/locales/fr/index.html
  17. 392
      resources/library/sankoreInteractivities/ordonner_des_images.wgt/locales/fr/js/script.js
  18. BIN
      resources/library/sankoreInteractivities/ordonner_des_images.wgt/locales/ru/img/drop_img.png
  19. 45
      resources/library/sankoreInteractivities/ordonner_des_images.wgt/locales/ru/index.html
  20. 392
      resources/library/sankoreInteractivities/ordonner_des_images.wgt/locales/ru/js/script.js
  21. 3
      resources/style.qss
  22. 4
      src/adaptors/UBExportDocument.cpp
  23. 3
      src/adaptors/UBExportFullPDF.cpp
  24. 4
      src/adaptors/UBExportWeb.cpp
  25. 4
      src/adaptors/UBImportCFF.cpp
  26. 4
      src/adaptors/UBImportDocument.cpp
  27. 3
      src/adaptors/UBMetadataDcSubsetAdaptor.cpp
  28. 4
      src/adaptors/publishing/UBDocumentPublisher.cpp
  29. 35
      src/board/UBBoardPaletteManager.cpp
  30. 1
      src/core/UBSettings.cpp
  31. 1
      src/core/UBSettings.h
  32. 71
      src/customWidgets/UBActionableWidget.cpp
  33. 35
      src/customWidgets/UBActionableWidget.h
  34. 2
      src/customWidgets/UBDraggableMedia.cpp
  35. 9
      src/customWidgets/UBGlobals.h
  36. 7
      src/customWidgets/UBMediaWidget.cpp
  37. 3
      src/customWidgets/UBMediaWidget.h
  38. 53
      src/customWidgets/UBWidgetList.cpp
  39. 9
      src/customWidgets/UBWidgetList.h
  40. 8
      src/customWidgets/customWidgets.pri
  41. 2
      src/desktop/UBDesktopAnnotationController.cpp
  42. 5
      src/document/UBDocumentController.cpp
  43. 9
      src/document/UBDocumentProxy.cpp
  44. 1
      src/document/UBDocumentProxy.h
  45. 3
      src/domain/UBGraphicsScene.cpp
  46. 10
      src/domain/UBGraphicsTextItemDelegate.cpp
  47. 2
      src/frameworks/UBBase32.cpp
  48. 4
      src/frameworks/UBFileSystemUtils.cpp
  49. 47
      src/globals/UBGlobals.h
  50. 2
      src/gui/UBDockPalette.cpp
  51. 2
      src/gui/UBDockPalette.h
  52. 7
      src/gui/UBDocumentNavigator.cpp
  53. 2
      src/gui/UBLibPathViewer.cpp
  54. 5
      src/gui/UBLibraryWidget.cpp
  55. 1
      src/gui/UBResources.cpp
  56. 1
      src/gui/UBResources.h
  57. 11
      src/gui/UBTBDocumentEditWidget.cpp
  58. 2
      src/gui/UBTBDocumentEditWidget.h
  59. 136
      src/gui/UBTBDocumentPreviewWidget.cpp
  60. 29
      src/gui/UBTBDocumentPreviewWidget.h
  61. 75
      src/gui/UBTBPageEditWidget.cpp
  62. 22
      src/gui/UBTBPageEditWidget.h
  63. 14
      src/gui/UBTeacherBarDataMgr.cpp
  64. 9
      src/gui/UBTeacherBarDataMgr.h
  65. 47
      src/gui/UBTeacherBarPreviewWidget.cpp
  66. 7
      src/gui/UBTeacherBarPreviewWidget.h
  67. 8
      src/gui/UBTeacherBarWidget.cpp
  68. 1
      src/gui/UBTeacherBarWidget.h
  69. 63
      src/gui/UBThumbnailWidget.cpp
  70. 2
      src/gui/UBThumbnailWidget.h
  71. 13
      src/pdf-merger/ASCII85Decode.cpp
  72. 4
      src/pdf-merger/ASCII85Decode.h
  73. 13
      src/pdf-merger/ASCIIHexDecode.cpp
  74. 4
      src/pdf-merger/ASCIIHexDecode.h
  75. 36
      src/pdf-merger/CCITTFaxDecode.cpp
  76. 8
      src/pdf-merger/CCITTFaxDecode.h
  77. 1
      src/pdf-merger/ContentHandler.cpp
  78. 36
      src/pdf-merger/DCTDecode.cpp
  79. 8
      src/pdf-merger/DCTDecode.h
  80. 3
      src/pdf-merger/Document.cpp
  81. 7
      src/pdf-merger/FilterPredictor.cpp
  82. 2
      src/pdf-merger/FilterPredictor.h
  83. 36
      src/pdf-merger/JBIG2Decode.cpp
  84. 7
      src/pdf-merger/JBIG2Decode.h
  85. 12
      src/pdf-merger/LZWDecode.cpp
  86. 4
      src/pdf-merger/LZWDecode.h
  87. 7
      src/pdf-merger/OverlayDocumentParser.cpp
  88. 2
      src/pdf-merger/OverlayDocumentParser.h
  89. 2
      src/pdf-merger/Page.cpp
  90. 8
      src/pdf-merger/PageElementHandler.cpp
  91. 4
      src/pdf-merger/PageElementHandler.h
  92. 6
      src/pdf-merger/Rectangle.cpp
  93. 2
      src/pdf-merger/Rectangle.h
  94. 4
      src/pdf-merger/RotationHandler.h
  95. 14
      src/pdf-merger/RunLengthDecode.cpp
  96. 4
      src/pdf-merger/RunLengthDecode.h
  97. 3
      src/pdf-merger/Utils.cpp
  98. 8
      src/pdf-merger/pdfMerger.pri
  99. 5
      src/pdf/XPDFRenderer.h
  100. 3
      src/podcast/youtube/UBYouTubePublisher.cpp
  101. Some files were not shown because too many files have changed in this diff Show More

@ -35,6 +35,7 @@ QT += script
QT += xmlpatterns
INCLUDEPATH += src
INCLUDEPATH += globals
include($$THIRD_PARTY_PATH/libs.pri)
include(src/adaptors/adaptors.pri)
@ -83,6 +84,7 @@ UB_LIBRARY.files = resources/library
UB_FONTS.files = resources/fonts
UB_THIRDPARTY_INTERACTIVE.files = thirdparty/interactive
DEFINES += NO_THIRD_PARTY_WARNINGS
DEFINES += UBVERSION=\"\\\"$${LONG_VERSION}\"\\\" \
UBVERSION_RC=$$VERSION_RC
ALPHA_BETA_STR = $$find(VERSION, "[ab]")

@ -49,8 +49,8 @@ else
LAST_COMMITED_VERSION="`git describe $(git rev-list --tags --max-count=1)`"
if [ "v$VERSION" != "$LAST_COMMITED_VERSION" ]; then
echo creating a tag with the version $VERSION
git tag -a "v$VERSION" -m "Generating setup for v$VERSION"
git push origin --tags
# git tag -a "v$VERSION" -m "Generating setup for v$VERSION"
# git push origin --tags
fi
fi
@ -191,7 +191,7 @@ CHANGE_LOG_FILE="$BASE_WORKING_DIR/DEBIAN/changelog-sankore-$VERSION.txt"
CONTROL_FILE="$BASE_WORKING_DIR/DEBIAN/control"
CHANGE_LOG_TEXT="changelog.txt"
ARCHITECTURE=`uname -i`
ARCHITECTURE=`uname -m`
if [ "$ARCHITECTURE" == "x86_64" ]; then
ARCHITECTURE="amd64"
fi

@ -3,6 +3,7 @@ html, body{
height: 100%;
margin: 0;
padding: 0;
background-color: white;
}
.toggle_mode{
@ -122,29 +123,35 @@ html, body{
background-color: white;
}
.close_img{
.close_img, .clear_img, .numb_img {
width: 30px;
height: 30px;
background-image: url(../img/close_img.png);
background-repeat: no-repeat;
position: absolute;
top: -15px;
right: -15px;
cursor: pointer;
}
.close_img{
background-image: url(../img/close_img.png);
top: -15px;
}
.clear_img{
width: 30px;
height: 30px;
background-image: url(../img/clear_img.png);
background-repeat: no-repeat;
position: absolute;
top: 15px;
right: -15px;
cursor: pointer;
}
.fill_img{
.numb_img{
background-image: url(../img/numb_img.png);
left: -15px;
top: -15px;
color: white;
font-weight: bold;
font-size: 130%;
}
/*.fill_img{
width: 30px;
height: 30px;
background-image: url(../img/fill_hor.png);
@ -153,7 +160,9 @@ html, body{
top: -15px;
right: 17px;
cursor: pointer;
}
}*/
.add_block{
margin: 20px 0 0 20px;

Binary file not shown.

Before

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 54 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 37 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

@ -15,10 +15,26 @@
lang = sankore.locale().substr(0,2);
} else
lang = "en";
$("<script type='text/javascript' src='js/translation/" + lang + ".js'>").appendTo("head");
if((typeof sankoreLang) == "undefined")
$("<script type='text/javascript' src='js/translation/en.js'>").appendTo("head");
if(lang == "en")
start();
else{
returnStatus(lang);
}
function returnStatus(lang){
$.ajax({
type: 'POST',
url:'locales/' + lang + '/index.html',
statusCode: {
404: function() {
start();
},
200: function(){
window.location.href = 'locales/' + lang + '/index.html';
}
}
});
}
//here you can put your code
if(window.sankore)
sankore.enableDropOnWidget();
@ -38,13 +54,13 @@
<div style="width: 50%; height: 100%; float: left;">
<div id="display" style="float: right; width: 90px; cursor: pointer;" class="selected">
<div id="display_img" style="float: right;" class="green_point"></div>
<div id="display_text" style="float: right;">Display</div>
<div id="display_text" style="float: right;"></div>
</div>
</div>
<div style="width: 50%; height: 100%; float: right;">
<div id="edit" style="float: left; width: 90px; cursor: pointer;">
<div id="edit_img" style="float: left;" class="red_point"></div>
<div id="edit_text" style="float: left;">Edit</div>
<div id="edit_text" style="float: left;"></div>
</div>
</div>
</div>

@ -1,3 +1,5 @@
var sankoreLang = {display: "Display", edit: "Edit", short_desc: "Place the pictures in ascending order.", add: "Add new block"};
//main function
function start(){
@ -40,9 +42,10 @@ function start(){
container.find(".add_img").remove();
container.find(".close_cont").remove();
container.find(".img_block").each(function(){
if($(this).html().match(/<img/)){
if($(this).find("img").attr("src") != "img/drop_img.png"){
$(this).find(".close_img").remove();
$(this).find(".clear_img").remove();
$(this).find(".numb_img").remove();
$(this).removeAttr("ondragenter")
.removeAttr("ondragleave")
.removeAttr("ondragover")
@ -78,7 +81,7 @@ function start(){
$("<div class='close_cont'>").appendTo(container);
container.find(".text_cont").attr("contenteditable","true");
container.find(".imgs_cont").sortable("destroy");
//container.find(".imgs_cont").sortable("destroy");
container.find(".imgs_cont").css("background-color", "white");
var add_img = $("<div class='add_img'>");
@ -87,10 +90,12 @@ function start(){
.attr("ondragleave", "$(this).css(\"background-color\",\"white\"); return false;")
.attr("ondragover", "$(this).css(\"background-color\",\"#ccc\"); return false;")
.attr("ondrop", "$(this).css(\"background-color\",\"white\"); return onDropTarget(this,event);")
.css("float","left");
//.css("float","left");
$("<div class='close_img'>").appendTo($(this));
$("<div class='clear_img'>").appendTo($(this));
$("<div class='numb_img'>" + $(this).find("input").val() + "</div>").appendTo($(this));
});
rightOrder(container.find(".imgs_cont"));
container.find(".imgs_cont").append(add_img)
});
@ -130,9 +135,7 @@ function start(){
var tmp_obj = $(this).parent().parent();
$(this).parent().remove();
if(tmp_obj.find(".img_block").size() > 0){
tmp_obj.find(".img_block").each(function(){
$(this).find("input").val(++i);
});
refreshImgNumbers(tmp_obj);
}
});
@ -154,7 +157,7 @@ function start(){
//cleaning an image
$(".clear_img").live("click",function(){
//$(this).parent().find(".fill_img").remove();
$(this).parent().find("img").remove();
$(this).parent().find("img").attr("src","img/drop_img.png");
});
}
@ -274,6 +277,7 @@ function showExample(){
//check result
function checkResult(event)
{
if($("#display").hasClass("selected")){
var str = "";
var right_str = $(event.target).find("input").val();
$(event.target).find(".img_block").each(function(){
@ -281,6 +285,9 @@ function checkResult(event)
});
if(str == right_str)
$(event.target).css("background-color","#9f9");
} else {
refreshImgNumbers($(event.target));
}
}
//add new container
@ -300,11 +307,13 @@ function addContainer(){
//add new img block
function addImgBlock(dest){
var img_block = $("<div class='img_block' ondragenter='return false;' ondragleave='$(this).css(\"background-color\",\"white\"); return false;' ondragover='$(this).css(\"background-color\",\"#ccc\"); return false;' ondrop='$(this).css(\"background-color\",\"white\"); return onDropTarget(this,event);' style='text-align: center; float: left;'></div>").insertBefore(dest);
var img_block = $("<div class='img_block' ondragenter='return false;' ondragleave='$(this).css(\"background-color\",\"white\"); return false;' ondragover='$(this).css(\"background-color\",\"#ccc\"); return false;' ondrop='$(this).css(\"background-color\",\"white\"); return onDropTarget(this,event);' style='text-align: center;'></div>").insertBefore(dest);
var tmp_counter = dest.parent().find(".img_block").size();
$("<div class='close_img'>").appendTo(img_block);
$("<div class='clear_img'>").appendTo(img_block);
$("<div class='numb_img'>" + tmp_counter + "</div>").appendTo(img_block);
$("<input type='hidden' value='" + tmp_counter + "'/>").appendTo(img_block);
$("<img src='img/drop_img.png' height='120'/>").appendTo(img_block);
}
function refreshBlockNumbers(){
@ -329,6 +338,35 @@ function shuffle( arr )
return arr;
}
//regulation the images in right order
function rightOrder(source){
var tmp_arr = [];
var tmp_var;
source.find(".img_block").each(function(){
tmp_arr.push($(this));
$(this).remove();
});
for(var i = 0; i < tmp_arr.length; i++)
for(var j = 0; j < tmp_arr.length - 1; j++){
if(tmp_arr[j].find("input").val() > tmp_arr[j+1].find("input").val()){
tmp_var = tmp_arr[j];
tmp_arr[j] = tmp_arr[j+1];
tmp_arr[j+1] = tmp_var;
}
}
for(i in tmp_arr)
source.append(tmp_arr[i]);
}
//refresh the numbers of the images
function refreshImgNumbers(source){
var tmp = 1;
source.find(".img_block").each(function(){
$(this).find("input").val(tmp);
$(this).find(".numb_img").text(tmp);
tmp++;
});
}
function stringToXML(text){
if (window.ActiveXObject){

@ -1,8 +0,0 @@
var sankoreLang = {
short_desc: "Place the pictures in ascending order.",
display:"Display",
edit:"Edit",
add:"Add new block"
};

@ -1,8 +0,0 @@
var sankoreLang = {
short_desc: "Placez les photos dans l'ordre croissant.",
display:"D'affichage",
edit:"Modifier",
add:"Ajouter nouveau bloc"
};

@ -1,8 +0,0 @@
var sankoreLang = {
short_desc: "Расположите картинки в порядке возрастания цифр.",
display:"Показать",
edit:"Изменить",
add:"Добавить новый блок"
};

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

@ -0,0 +1,45 @@
<!DOCTYPE html>
<html>
<head>
<title>D'n'd</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="../../js/jquery-1.6.2.min.js"></script>
<script type="text/javascript" src="../../js/jquery-ui-1.8.9.custom.min.js"></script>
<script type="text/javascript" src="js/script.js"></script>
<script type="text/javascript">
$(document).ready(function(){
start();
//here you can put your code
if(window.sankore)
sankore.enableDropOnWidget();
});
</script>
</head>
<body>
<!--<div class="dnd_container">
<div class="dnd_1" id="dnd_1" ondragenter="return false;" ondragleave="$(this).css('border-color','#ccc'); return false;" ondragover="$(this).css('border-color','orange'); return false;" ondrop="$(this).css('border-color','#ccc'); return onDropTarget1(event);">Drop the item here ...</div>
<div class="dnd_2" id="dnd_2" ondragenter="return false;" ondragleave="$(this).css('border-color','#ccc'); return false;" ondragover="$(this).css('border-color','orange'); return false;" ondrop="$(this).css('border-color','#ccc'); return onDropTarget2(event);">Drop the item here ...</div>
</div>
<div class='black_overlay' id='fade'></div>
<a href = "javascript:void(0)" onclick = "document.getElementById('light').style.display='block';document.getElementById('fade').style.display='block'">открыть</a></p>
<div id="light" class="white_content">
Содержание<a href = "javascript:void(0)" onclick = "document.getElementById('light').style.display='none';document.getElementById('fade').style.display='none'">закрыть</a></div>-->
<div class="toggle_mode">
<div style="width: 50%; height: 100%; float: left;">
<div id="display" style="float: right; width: 130px; cursor: pointer;" class="selected">
<div id="display_img" style="float: right;" class="green_point"></div>
<div id="display_text" style="float: right;"></div>
</div>
</div>
<div style="width: 50%; height: 100%; float: right;">
<div id="edit" style="float: left; width: 130px; cursor: pointer;">
<div id="edit_img" style="float: left;" class="red_point"></div>
<div id="edit_text" style="float: left;"></div>
</div>
</div>
</div>
<div style="width: 100%; height: 25px;"></div>
</body>
</html>

@ -0,0 +1,392 @@
var sankoreLang = {display: "D'affichage", edit: "Modifier", short_desc: "Placez les photos dans l'ordre croissant.", add: "Nouveau bloc"};
//main function
function start(){
$("#display_text").text(sankoreLang.display);
$("#edit_text").text(sankoreLang.edit);
if(window.sankore){
if(sankore.preference("odr_des_imgs","")){
var data = jQuery.parseJSON(sankore.preference("odr_des_imgs",""));
importData(data);
} else {
showExample();
}
}
else
showExample();
//events
$("body").live("mouseout",function(){
if(event.target.tagName == "BODY")
if(window.sankore)
exportData();
})
$("#display, #edit").click(function(event){
if(this.id == "display"){
if(!$(this).hasClass("selected")){
$(this).addClass("selected");
$("#display_img").removeClass("red_point").addClass("green_point");
$("#edit_img").removeClass("green_point").addClass("red_point");
$("#edit").removeClass("selected");
$(".add_block").remove();
$(".cont").each(function(){
var container = $(this);
var tmp_i = 0;
var tmp_right = "";
var tmp_array = [];
container.find(".text_cont").removeAttr("contenteditable");
container.find(".add_img").remove();
container.find(".close_cont").remove();
container.find(".img_block").each(function(){
if($(this).find("img").attr("src") != "img/drop_img.png"){
$(this).find(".close_img").remove();
$(this).find(".clear_img").remove();
$(this).find(".numb_img").remove();
$(this).removeAttr("ondragenter")
.removeAttr("ondragleave")
.removeAttr("ondragover")
.removeAttr("ondrop");
$(this).find("input").val(++tmp_i)
tmp_right += tmp_i + "*";
} else
$(this).remove();
});
container.find(".imgs_cont>input").val(tmp_right);
container.find(".img_block").each(function(){
$(this).css("float","");
tmp_array.push($(this));
});
tmp_array = shuffle(tmp_array);
for(var i = 0; i<tmp_array.length;i++)
tmp_array[i].appendTo(container.find(".imgs_cont"));
container.find(".imgs_cont").sortable( {
update: checkResult
} );
});
}
} else {
if(!$(this).hasClass("selected")){
$(this).addClass("selected");
$("#edit_img").removeClass("red_point").addClass("green_point");
$("#display_img").removeClass("green_point").addClass("red_point");
$("#display").removeClass("selected");
$(".cont").each(function(){
var container = $(this);
$("<div class='close_cont'>").appendTo(container);
container.find(".text_cont").attr("contenteditable","true");
//container.find(".imgs_cont").sortable("destroy");
container.find(".imgs_cont").css("background-color", "white");
var add_img = $("<div class='add_img'>");
container.find(".img_block").each(function(){
$(this).attr("ondragenter", "return false;")
.attr("ondragleave", "$(this).css(\"background-color\",\"white\"); return false;")
.attr("ondragover", "$(this).css(\"background-color\",\"#ccc\"); return false;")
.attr("ondrop", "$(this).css(\"background-color\",\"white\"); return onDropTarget(this,event);")
//.css("float","left");
$("<div class='close_img'>").appendTo($(this));
$("<div class='clear_img'>").appendTo($(this));
$("<div class='numb_img'>" + $(this).find("input").val() + "</div>").appendTo($(this));
});
rightOrder(container.find(".imgs_cont"));
container.find(".imgs_cont").append(add_img)
});
$("<div class='add_block'>" + sankoreLang.add + "</div>").appendTo("body");
}
}
});
//add new block
$(".add_block").live("click", function(){
addContainer();
});
//adding new img
$(".add_img").live("click", function(){
addImgBlock($(this));
});
//deleting a block
$(".close_cont").live("click",function(){
$(this).parent().remove();
refreshBlockNumbers();
});
//deleting the img block
$(".close_img").live("click", function(){
var i = 0;
var tmp_obj = $(this).parent().parent();
$(this).parent().remove();
if(tmp_obj.find(".img_block").size() > 0){
refreshImgNumbers(tmp_obj);
}
});
//cleaning an image
$(".clear_img").live("click",function(){
//$(this).parent().find(".fill_img").remove();
$(this).parent().find("img").attr("src","img/drop_img.png");
});
}
//export
function exportData(){
var array_to_export = [];
if($("#edit").hasClass("selected")){
$(".cont").each(function(){
var container = $(this);
var tmp_right = "";
var tmp_i = 0;
container.find(".img_block").each(function(){
if($(this).html().match(/<img/)){
$(this).find("input").val(++tmp_i)
tmp_right += tmp_i + "*";
}
});
container.find(".imgs_cont>input").val(tmp_right);
});
}
$(".cont").each(function(){
var cont_obj = new Object();
cont_obj.text = $(this).find(".text_cont").text();
cont_obj.right = $(this).find(".imgs_cont>input").val();
cont_obj.imgs = [];
$(this).find(".img_block").each(function(){
var img_obj = new Object();
img_obj.value = $(this).find("input").val();
img_obj.link = $(this).find("img").attr("src").replace("../../","");
img_obj.ht = $(this).find("img").height();
img_obj.wd = $(this).find("img").width();
cont_obj.imgs.push(img_obj);
});
array_to_export.push(cont_obj);
});
sankore.setPreference("odr_des_imgs", JSON.stringify(array_to_export));
}
//import
function importData(data){
var tmp = 0;
for(var i in data){
var tmp_array = [];
var container = $("<div class='cont'>");
var sub_container = $("<div class='sub_cont'>").appendTo(container);
var imgs_container = $("<div class='imgs_cont'>").appendTo(container);
var number = $("<div class='number_cont'>"+ (++tmp) +"</div>").appendTo(sub_container);
var text = $("<div class='text_cont'>" + data[i].text + "</div>").appendTo(sub_container);
$("<input type='hidden' value='" + data[i].right + "'/>").appendTo(imgs_container);
for(var j in data[i].imgs){
var img_block = $("<div class='img_block' style='text-align: center;'>");
var img = $("<img src='../../" + data[i].imgs[j].link + "' style='display: inline;'>");
img.height(data[i].imgs[j].ht).width(data[i].imgs[j].wd);
if((120 - data[i].imgs[j].ht) > 0)
img.css("margin",(120 - data[i].imgs[j].ht)/2 + "px 0");
var hidden_input = $("<input type='hidden'>").val(data[i].imgs[j].value);
img_block.append(hidden_input).append(img);
tmp_array.push(img_block);
}
tmp_array = shuffle(tmp_array);
for(j = 0; j<tmp_array.length;j++)
tmp_array[j].appendTo(imgs_container);
imgs_container.sortable( {
update: checkResult
} );
container.appendTo("body");
}
}
//example
function showExample(){
var tmp_array = [];
var container = $("<div class='cont'>");
var sub_container = $("<div class='sub_cont'>").appendTo(container);
var imgs_container = $("<div class='imgs_cont'>").appendTo(container);
var number = $("<div class='number_cont'>1</div>").appendTo(sub_container);
var text = $("<div class='text_cont'>" + sankoreLang.short_desc + "</div>").appendTo(sub_container);
$("<input type='hidden' value='1*2*3*4*5*'/>").appendTo(imgs_container);
var img1 = $("<div class='img_block' style='text-align: center;'></div>");
$("<input type='hidden' value='1'/>").appendTo(img1);
$("<img src=\"../../objects/0.gif\" style=\"display: inline;\" height=\"120\"/>").appendTo(img1);
var img2 = $("<div class='img_block' style='text-align: center;'></div>");
$("<input type='hidden' value='2'/>").appendTo(img2);
$("<img src=\"../../objects/1.gif\" style=\"display: inline;\" height=\"120\"/>").appendTo(img2);
var img3 = $("<div class='img_block' style='text-align: center;'></div>");
$("<input type='hidden' value='3'/>").appendTo(img3);
$("<img src=\"../../objects/2.gif\" style=\"display: inline;\" height=\"120\"/>").appendTo(img3);
var img4 = $("<div class='img_block' style='text-align: center;'></div>");
$("<input type='hidden' value='4'/>").appendTo(img4);
$("<img src=\"../../objects/3.gif\" style=\"display: inline;\" height=\"120\"/>").appendTo(img4);
var img5 = $("<div class='img_block' style='text-align: center;'></div>");
$("<input type='hidden' value='5'/>").appendTo(img5);
$("<img src=\"../../objects/4.gif\" style=\"display: inline;\" height=\"120\"/>").appendTo(img5);
tmp_array.push(img1, img2, img3, img4, img5);
tmp_array = shuffle(tmp_array);
for(var i = 0; i<tmp_array.length;i++)
tmp_array[i].appendTo(imgs_container);
imgs_container.sortable( {
update: checkResult
} );
container.appendTo("body")
}
//check result
function checkResult(event)
{
if($("#display").hasClass("selected")){
var str = "";
var right_str = $(event.target).find("input").val();
$(event.target).find(".img_block").each(function(){
str += $(this).find("input").val() + "*";
});
if(str == right_str)
$(event.target).css("background-color","#9f9");
} else {
refreshImgNumbers($(event.target));
}
}
//add new container
function addContainer(){
var container = $("<div class='cont'>");
var sub_container = $("<div class='sub_cont'>").appendTo(container);
var imgs_container = $("<div class='imgs_cont'>").appendTo(container);
var close = $("<div class='close_cont'>").appendTo(container);
var number = $("<div class='number_cont'>"+ ($(".cont").size() + 1) +"</div>").appendTo(sub_container);
var text = $("<div class='text_cont' contenteditable>Enter your text here ... </div>").appendTo(sub_container);
$("<input type='hidden' value='1*2*3*4*5*'/>").appendTo(imgs_container);
var add_img = $("<div class='add_img'>").appendTo(imgs_container);
container.insertBefore($(".add_block"));
}
//add new img block
function addImgBlock(dest){
var img_block = $("<div class='img_block' ondragenter='return false;' ondragleave='$(this).css(\"background-color\",\"white\"); return false;' ondragover='$(this).css(\"background-color\",\"#ccc\"); return false;' ondrop='$(this).css(\"background-color\",\"white\"); return onDropTarget(this,event);' style='text-align: center;'></div>").insertBefore(dest);
var tmp_counter = dest.parent().find(".img_block").size();
$("<div class='close_img'>").appendTo(img_block);
$("<div class='clear_img'>").appendTo(img_block);
$("<div class='numb_img'>" + tmp_counter + "</div>").appendTo(img_block);
$("<input type='hidden' value='" + tmp_counter + "'/>").appendTo(img_block);
$("<img src='img/drop_img.png' height='120'/>").appendTo(img_block);
}
function refreshBlockNumbers(){
var i = 0;
$(".cont").each(function(){
$(this).find(".number_cont").text(++i);
})
}
//shuffles an array
function shuffle( arr )
{
var pos, tmp;
for( var i = 0; i < arr.length; i++ )
{
pos = Math.round( Math.random() * ( arr.length - 1 ) );
tmp = arr[pos];
arr[pos] = arr[i];
arr[i] = tmp;
}
return arr;
}
//regulation the images in right order
function rightOrder(source){
var tmp_arr = [];
var tmp_var;
source.find(".img_block").each(function(){
tmp_arr.push($(this));
$(this).remove();
});
for(var i = 0; i < tmp_arr.length; i++)
for(var j = 0; j < tmp_arr.length - 1; j++){
if(tmp_arr[j].find("input").val() > tmp_arr[j+1].find("input").val()){
tmp_var = tmp_arr[j];
tmp_arr[j] = tmp_arr[j+1];
tmp_arr[j+1] = tmp_var;
}
}
for(i in tmp_arr)
source.append(tmp_arr[i]);
}
//refresh the numbers of the images
function refreshImgNumbers(source){
var tmp = 1;
source.find(".img_block").each(function(){
$(this).find("input").val(tmp);
$(this).find(".numb_img").text(tmp);
tmp++;
});
}
function stringToXML(text){
if (window.ActiveXObject){
var doc=new ActiveXObject('Microsoft.XMLDOM');
doc.async='false';
doc.loadXML(text);
} else {
var parser=new DOMParser();
doc=parser.parseFromString(text,'text/xml');
}
return doc;
}
function onDropTarget(obj, event) {
$(obj).find("img").remove();
if (event.dataTransfer) {
var format = "text/plain";
var textData = event.dataTransfer.getData(format);
if (!textData) {
alert(":(");
}
textData = stringToXML(textData);
var tmp = textData.getElementsByTagName("path")[0].firstChild.textContent;
tmp = tmp.substr(1, tmp.length);
var tmp_img = $("<img/>").attr("src", "../../" + tmp);
$(obj).append(tmp_img);
setTimeout(function(){
if(tmp_img.height() >= tmp_img.width())
tmp_img.attr("height", "120");
else{
tmp_img.attr("width","120");
tmp_img.css("margin",(120 - tmp_img.height())/2 + "px 0");
}
}, 6)
}
else {
alert ("Your browser does not support the dataTransfer object.");
}
if (event.stopPropagation) {
event.stopPropagation ();
}
else {
event.cancelBubble = true;
}
return false;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

@ -0,0 +1,45 @@
<!DOCTYPE html>
<html>
<head>
<title>D'n'd</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="../../js/jquery-1.6.2.min.js"></script>
<script type="text/javascript" src="../../js/jquery-ui-1.8.9.custom.min.js"></script>
<script type="text/javascript" src="js/script.js"></script>
<script type="text/javascript">
$(document).ready(function(){
start();
//here you can put your code
if(window.sankore)
sankore.enableDropOnWidget();
});
</script>
</head>
<body>
<!--<div class="dnd_container">
<div class="dnd_1" id="dnd_1" ondragenter="return false;" ondragleave="$(this).css('border-color','#ccc'); return false;" ondragover="$(this).css('border-color','orange'); return false;" ondrop="$(this).css('border-color','#ccc'); return onDropTarget1(event);">Drop the item here ...</div>
<div class="dnd_2" id="dnd_2" ondragenter="return false;" ondragleave="$(this).css('border-color','#ccc'); return false;" ondragover="$(this).css('border-color','orange'); return false;" ondrop="$(this).css('border-color','#ccc'); return onDropTarget2(event);">Drop the item here ...</div>
</div>
<div class='black_overlay' id='fade'></div>
<a href = "javascript:void(0)" onclick = "document.getElementById('light').style.display='block';document.getElementById('fade').style.display='block'">открыть</a></p>
<div id="light" class="white_content">
Содержание<a href = "javascript:void(0)" onclick = "document.getElementById('light').style.display='none';document.getElementById('fade').style.display='none'">закрыть</a></div>-->
<div class="toggle_mode">
<div style="width: 50%; height: 100%; float: left;">
<div id="display" style="float: right; width: 120px; cursor: pointer;" class="selected">
<div id="display_img" style="float: right;" class="green_point"></div>
<div id="display_text" style="float: right;"></div>
</div>
</div>
<div style="width: 50%; height: 100%; float: right;">
<div id="edit" style="float: left; width: 120px; cursor: pointer;">
<div id="edit_img" style="float: left;" class="red_point"></div>
<div id="edit_text" style="float: left;"></div>
</div>
</div>
</div>
<div style="width: 100%; height: 25px;"></div>
</body>
</html>

@ -0,0 +1,392 @@
var sankoreLang = {display: "Показать", edit: "Изменить", short_desc: "Расположите картинки в порядке возрастания цифр.", add: "Новый блок"};
//main function
function start(){
$("#display_text").text(sankoreLang.display);
$("#edit_text").text(sankoreLang.edit);
if(window.sankore){
if(sankore.preference("odr_des_imgs","")){
var data = jQuery.parseJSON(sankore.preference("odr_des_imgs",""));
importData(data);
} else {
showExample();
}
}
else
showExample();
//events
$("body").live("mouseout",function(){
if(event.target.tagName == "BODY")
if(window.sankore)
exportData();
})
$("#display, #edit").click(function(event){
if(this.id == "display"){
if(!$(this).hasClass("selected")){
$(this).addClass("selected");
$("#display_img").removeClass("red_point").addClass("green_point");
$("#edit_img").removeClass("green_point").addClass("red_point");
$("#edit").removeClass("selected");
$(".add_block").remove();
$(".cont").each(function(){
var container = $(this);
var tmp_i = 0;
var tmp_right = "";
var tmp_array = [];
container.find(".text_cont").removeAttr("contenteditable");
container.find(".add_img").remove();
container.find(".close_cont").remove();
container.find(".img_block").each(function(){
if($(this).find("img").attr("src") != "img/drop_img.png"){
$(this).find(".close_img").remove();
$(this).find(".clear_img").remove();
$(this).find(".numb_img").remove();
$(this).removeAttr("ondragenter")
.removeAttr("ondragleave")
.removeAttr("ondragover")
.removeAttr("ondrop");
$(this).find("input").val(++tmp_i)
tmp_right += tmp_i + "*";
} else
$(this).remove();
});
container.find(".imgs_cont>input").val(tmp_right);
container.find(".img_block").each(function(){
$(this).css("float","");
tmp_array.push($(this));
});
tmp_array = shuffle(tmp_array);
for(var i = 0; i<tmp_array.length;i++)
tmp_array[i].appendTo(container.find(".imgs_cont"));
container.find(".imgs_cont").sortable( {
update: checkResult
} );
});
}
} else {
if(!$(this).hasClass("selected")){
$(this).addClass("selected");
$("#edit_img").removeClass("red_point").addClass("green_point");
$("#display_img").removeClass("green_point").addClass("red_point");
$("#display").removeClass("selected");
$(".cont").each(function(){
var container = $(this);
$("<div class='close_cont'>").appendTo(container);
container.find(".text_cont").attr("contenteditable","true");
//container.find(".imgs_cont").sortable("destroy");
container.find(".imgs_cont").css("background-color", "white");
var add_img = $("<div class='add_img'>");
container.find(".img_block").each(function(){
$(this).attr("ondragenter", "return false;")
.attr("ondragleave", "$(this).css(\"background-color\",\"white\"); return false;")
.attr("ondragover", "$(this).css(\"background-color\",\"#ccc\"); return false;")
.attr("ondrop", "$(this).css(\"background-color\",\"white\"); return onDropTarget(this,event);")
//.css("float","left");
$("<div class='close_img'>").appendTo($(this));
$("<div class='clear_img'>").appendTo($(this));
$("<div class='numb_img'>" + $(this).find("input").val() + "</div>").appendTo($(this));
});
rightOrder(container.find(".imgs_cont"));
container.find(".imgs_cont").append(add_img)
});
$("<div class='add_block'>" + sankoreLang.add + "</div>").appendTo("body");
}
}
});
//add new block
$(".add_block").live("click", function(){
addContainer();
});
//adding new img
$(".add_img").live("click", function(){
addImgBlock($(this));
});
//deleting a block
$(".close_cont").live("click",function(){
$(this).parent().remove();
refreshBlockNumbers();
});
//deleting the img block
$(".close_img").live("click", function(){
var i = 0;
var tmp_obj = $(this).parent().parent();
$(this).parent().remove();
if(tmp_obj.find(".img_block").size() > 0){
refreshImgNumbers(tmp_obj);
}
});
//cleaning an image
$(".clear_img").live("click",function(){
//$(this).parent().find(".fill_img").remove();
$(this).parent().find("img").attr("src","img/drop_img.png");
});
}
//export
function exportData(){
var array_to_export = [];
if($("#edit").hasClass("selected")){
$(".cont").each(function(){
var container = $(this);
var tmp_right = "";
var tmp_i = 0;
container.find(".img_block").each(function(){
if($(this).html().match(/<img/)){
$(this).find("input").val(++tmp_i)
tmp_right += tmp_i + "*";
}
});
container.find(".imgs_cont>input").val(tmp_right);
});
}
$(".cont").each(function(){
var cont_obj = new Object();
cont_obj.text = $(this).find(".text_cont").text();
cont_obj.right = $(this).find(".imgs_cont>input").val();
cont_obj.imgs = [];
$(this).find(".img_block").each(function(){
var img_obj = new Object();
img_obj.value = $(this).find("input").val();
img_obj.link = $(this).find("img").attr("src").replace("../../","");
img_obj.ht = $(this).find("img").height();
img_obj.wd = $(this).find("img").width();
cont_obj.imgs.push(img_obj);
});
array_to_export.push(cont_obj);
});
sankore.setPreference("odr_des_imgs", JSON.stringify(array_to_export));
}
//import
function importData(data){
var tmp = 0;
for(var i in data){
var tmp_array = [];
var container = $("<div class='cont'>");
var sub_container = $("<div class='sub_cont'>").appendTo(container);
var imgs_container = $("<div class='imgs_cont'>").appendTo(container);
var number = $("<div class='number_cont'>"+ (++tmp) +"</div>").appendTo(sub_container);
var text = $("<div class='text_cont'>" + data[i].text + "</div>").appendTo(sub_container);
$("<input type='hidden' value='" + data[i].right + "'/>").appendTo(imgs_container);
for(var j in data[i].imgs){
var img_block = $("<div class='img_block' style='text-align: center;'>");
var img = $("<img src='../../" + data[i].imgs[j].link + "' style='display: inline;'>");
img.height(data[i].imgs[j].ht).width(data[i].imgs[j].wd);
if((120 - data[i].imgs[j].ht) > 0)
img.css("margin",(120 - data[i].imgs[j].ht)/2 + "px 0");
var hidden_input = $("<input type='hidden'>").val(data[i].imgs[j].value);
img_block.append(hidden_input).append(img);
tmp_array.push(img_block);
}
tmp_array = shuffle(tmp_array);
for(j = 0; j<tmp_array.length;j++)
tmp_array[j].appendTo(imgs_container);
imgs_container.sortable( {
update: checkResult
} );
container.appendTo("body");
}
}
//example
function showExample(){
var tmp_array = [];
var container = $("<div class='cont'>");
var sub_container = $("<div class='sub_cont'>").appendTo(container);
var imgs_container = $("<div class='imgs_cont'>").appendTo(container);
var number = $("<div class='number_cont'>1</div>").appendTo(sub_container);
var text = $("<div class='text_cont'>" + sankoreLang.short_desc + "</div>").appendTo(sub_container);
$("<input type='hidden' value='1*2*3*4*5*'/>").appendTo(imgs_container);
var img1 = $("<div class='img_block' style='text-align: center;'></div>");
$("<input type='hidden' value='1'/>").appendTo(img1);
$("<img src=\"../../objects/0.gif\" style=\"display: inline;\" height=\"120\"/>").appendTo(img1);
var img2 = $("<div class='img_block' style='text-align: center;'></div>");
$("<input type='hidden' value='2'/>").appendTo(img2);
$("<img src=\"../../objects/1.gif\" style=\"display: inline;\" height=\"120\"/>").appendTo(img2);
var img3 = $("<div class='img_block' style='text-align: center;'></div>");
$("<input type='hidden' value='3'/>").appendTo(img3);
$("<img src=\"../../objects/2.gif\" style=\"display: inline;\" height=\"120\"/>").appendTo(img3);
var img4 = $("<div class='img_block' style='text-align: center;'></div>");
$("<input type='hidden' value='4'/>").appendTo(img4);
$("<img src=\"../../objects/3.gif\" style=\"display: inline;\" height=\"120\"/>").appendTo(img4);
var img5 = $("<div class='img_block' style='text-align: center;'></div>");
$("<input type='hidden' value='5'/>").appendTo(img5);
$("<img src=\"../../objects/4.gif\" style=\"display: inline;\" height=\"120\"/>").appendTo(img5);
tmp_array.push(img1, img2, img3, img4, img5);
tmp_array = shuffle(tmp_array);
for(var i = 0; i<tmp_array.length;i++)
tmp_array[i].appendTo(imgs_container);
imgs_container.sortable( {
update: checkResult
} );
container.appendTo("body")
}
//check result
function checkResult(event)
{
if($("#display").hasClass("selected")){
var str = "";
var right_str = $(event.target).find("input").val();
$(event.target).find(".img_block").each(function(){
str += $(this).find("input").val() + "*";
});
if(str == right_str)
$(event.target).css("background-color","#9f9");
} else {
refreshImgNumbers($(event.target));
}
}
//add new container
function addContainer(){
var container = $("<div class='cont'>");
var sub_container = $("<div class='sub_cont'>").appendTo(container);
var imgs_container = $("<div class='imgs_cont'>").appendTo(container);
var close = $("<div class='close_cont'>").appendTo(container);
var number = $("<div class='number_cont'>"+ ($(".cont").size() + 1) +"</div>").appendTo(sub_container);
var text = $("<div class='text_cont' contenteditable>Enter your text here ... </div>").appendTo(sub_container);
$("<input type='hidden' value='1*2*3*4*5*'/>").appendTo(imgs_container);
var add_img = $("<div class='add_img'>").appendTo(imgs_container);
container.insertBefore($(".add_block"));
}
//add new img block
function addImgBlock(dest){
var img_block = $("<div class='img_block' ondragenter='return false;' ondragleave='$(this).css(\"background-color\",\"white\"); return false;' ondragover='$(this).css(\"background-color\",\"#ccc\"); return false;' ondrop='$(this).css(\"background-color\",\"white\"); return onDropTarget(this,event);' style='text-align: center;'></div>").insertBefore(dest);
var tmp_counter = dest.parent().find(".img_block").size();
$("<div class='close_img'>").appendTo(img_block);
$("<div class='clear_img'>").appendTo(img_block);
$("<div class='numb_img'>" + tmp_counter + "</div>").appendTo(img_block);
$("<input type='hidden' value='" + tmp_counter + "'/>").appendTo(img_block);
$("<img src='img/drop_img.png' height='120'/>").appendTo(img_block);
}
function refreshBlockNumbers(){
var i = 0;
$(".cont").each(function(){
$(this).find(".number_cont").text(++i);
})
}
//shuffles an array
function shuffle( arr )
{
var pos, tmp;
for( var i = 0; i < arr.length; i++ )
{
pos = Math.round( Math.random() * ( arr.length - 1 ) );
tmp = arr[pos];
arr[pos] = arr[i];
arr[i] = tmp;
}
return arr;
}
//regulation the images in right order
function rightOrder(source){
var tmp_arr = [];
var tmp_var;
source.find(".img_block").each(function(){
tmp_arr.push($(this));
$(this).remove();
});
for(var i = 0; i < tmp_arr.length; i++)
for(var j = 0; j < tmp_arr.length - 1; j++){
if(tmp_arr[j].find("input").val() > tmp_arr[j+1].find("input").val()){
tmp_var = tmp_arr[j];
tmp_arr[j] = tmp_arr[j+1];
tmp_arr[j+1] = tmp_var;
}
}
for(i in tmp_arr)
source.append(tmp_arr[i]);
}
//refresh the numbers of the images
function refreshImgNumbers(source){
var tmp = 1;
source.find(".img_block").each(function(){
$(this).find("input").val(tmp);
$(this).find(".numb_img").text(tmp);
tmp++;
});
}
function stringToXML(text){
if (window.ActiveXObject){
var doc=new ActiveXObject('Microsoft.XMLDOM');
doc.async='false';
doc.loadXML(text);
} else {
var parser=new DOMParser();
doc=parser.parseFromString(text,'text/xml');
}
return doc;
}
function onDropTarget(obj, event) {
$(obj).find("img").remove();
if (event.dataTransfer) {
var format = "text/plain";
var textData = event.dataTransfer.getData(format);
if (!textData) {
alert(":(");
}
textData = stringToXML(textData);
var tmp = textData.getElementsByTagName("path")[0].firstChild.textContent;
tmp = tmp.substr(1, tmp.length);
var tmp_img = $("<img/>").attr("src", "../../" + tmp);
$(obj).append(tmp_img);
setTimeout(function(){
if(tmp_img.height() >= tmp_img.width())
tmp_img.attr("height", "120");
else{
tmp_img.attr("width","120");
tmp_img.css("margin",(120 - tmp_img.height())/2 + "px 0");
}
}, 6)
}
else {
alert ("Your browser does not support the dataTransfer object.");
}
if (event.stopPropagation) {
event.stopPropagation ();
}
else {
event.cancelBubble = true;
}
return false;
}

@ -27,7 +27,8 @@ QWidget#UBMediaVideoContainer
border: 2px solid #999999;
}
QWidget#UBTeacherBarPreviewWidget
QWidget#UBTBPreviewWidget
{
background: #FFFFFF;
border-radius: 10px;

@ -22,8 +22,12 @@
#include "document/UBDocumentProxy.h"
#include "globals/UBGlobals.h"
THIRD_PARTY_WARNINGS_DISABLE
#include "quazip.h"
#include "quazipfile.h"
THIRD_PARTY_WARNINGS_ENABLE
#include "transition/UniboardSankoreTransition.h"

@ -179,9 +179,6 @@ void UBExportFullPDF::persistsDocument(UBDocumentProxy* pDocumentProxy, const QS
QString pdfName = UBPersistenceManager::objectDirectory + "/" + pdfItem->fileUuid().toString() + ".pdf";
QString backgroundPath = pDocumentProxy->persistencePath() + "/" + pdfName;
QPointF boudingRectBottomLeft = scene->itemsBoundingRect().bottomLeft();
QPointF pdfItemBottomLeft = pdfItem->sceneBoundingRect().bottomLeft();
qDebug() << "scene->itemsBoundingRect()" << scene->itemsBoundingRect();
qDebug() << "pdfItem->boundingRect()" << pdfItem->boundingRect();
qDebug() << "pdfItem->sceneBoundingRect()" << pdfItem->sceneBoundingRect();

@ -23,8 +23,12 @@
#include "document/UBDocumentProxy.h"
#include "globals/UBGlobals.h"
THIRD_PARTY_WARNINGS_DISABLE
#include "quazip.h"
#include "quazipfile.h"
THIRD_PARTY_WARNINGS_ENABLE
#include "core/memcheck.h"

@ -27,9 +27,13 @@
#include "UBCFFSubsetAdaptor.h"
#include "UBImportCFF.h"
#include "globals/UBGlobals.h"
THIRD_PARTY_WARNINGS_DISABLE
#include "quazip.h"
#include "quazipfile.h"
#include "quazipfileinfo.h"
THIRD_PARTY_WARNINGS_ENABLE
#include "core/memcheck.h"

@ -22,9 +22,13 @@
#include "core/UBSettings.h"
#include "core/UBPersistenceManager.h"
#include "globals/UBGlobals.h"
THIRD_PARTY_WARNINGS_DISABLE
#include "quazip.h"
#include "quazipfile.h"
#include "quazipfileinfo.h"
THIRD_PARTY_WARNINGS_ENABLE
#include "core/memcheck.h"

@ -276,7 +276,6 @@ QMap<QString, QVariant> UBMetadataDcSubsetAdaptor::load(QString pPath)
qWarning() << "Document size not found, using default view size" << docSize;
metadata.insert(UBSettings::documentSize, QVariant(docSize));
}
if (!updatedAtFound)
@ -284,6 +283,8 @@ QMap<QString, QVariant> UBMetadataDcSubsetAdaptor::load(QString pPath)
metadata.insert(UBSettings::documentUpdatedAt, date + "T00:00:00Z");
}
metadata.insert(UBSettings::documentDate, QVariant(date));
return metadata;
}

@ -34,8 +34,12 @@
#include "domain/UBGraphicsWidgetItem.h"
#include "globals/UBGlobals.h"
THIRD_PARTY_WARNINGS_DISABLE
#include "quazip.h"
#include "quazipfile.h"
THIRD_PARTY_WARNINGS_ENABLE
#include "adaptors/UBExportFullPDF.h"
#include "adaptors/UBExportDocument.h"

@ -92,43 +92,8 @@ UBBoardPaletteManager::UBBoardPaletteManager(QWidget* container, UBBoardControll
UBBoardPaletteManager::~UBBoardPaletteManager()
{
if(NULL != mpDownloadWidget)
{
delete mpDownloadWidget;
mpDownloadWidget = NULL;
}
if(NULL != mpTeacherBarWidget)
{
delete mpTeacherBarWidget;
mpTeacherBarWidget = NULL;
}
if(NULL != mpPageNavigWidget)
{
delete mpPageNavigWidget;
mpPageNavigWidget = NULL;
}
if(NULL != mpLibWidget)
{
delete mpLibWidget;
mpLibWidget = NULL;
}
if(NULL != mpCachePropWidget)
{
delete mpCachePropWidget;
mpCachePropWidget = NULL;
}
delete mAddItemPalette;
if(NULL != mLeftPalette)
{
delete mLeftPalette;
mLeftPalette = NULL;
}
if(NULL != mRightPalette)
{
delete mRightPalette;
mRightPalette = NULL;
}
if(NULL != mStylusPalette)
{

@ -43,6 +43,7 @@ QString UBSettings::sessionKeywords = QString("sessionKeywords");
QString UBSettings::sessionLevel = QString("sessionLevel");
QString UBSettings::sessionTopic = QString("sessionTopic");
QString UBSettings::sessionAuthors = QString("sessionAuthors");
QString UBSettings::documentDate = QString("date");
QString UBSettings::trashedDocumentGroupNamePrefix = QString("_Trash:");

@ -160,6 +160,7 @@ class UBSettings : public QObject
static QString sessionLevel;
static QString sessionTopic;
static QString sessionAuthors;
static QString documentDate;
static QString trashedDocumentGroupNamePrefix;

@ -0,0 +1,71 @@
#include <QPainter>
#include <QDebug>
#include "UBActionableWidget.h"
UBActionableWidget::UBActionableWidget(QWidget *parent, const char *name):QWidget(parent)
, mShowActions(false)
{
setObjectName(name);
mActions.clear();
}
UBActionableWidget::~UBActionableWidget()
{
}
void UBActionableWidget::addAction(eAction act)
{
if(!mActions.contains(act)){
mActions << act;
}
}
void UBActionableWidget::removeAction(eAction act)
{
if(mActions.contains(act)){
mActions.remove(mActions.indexOf(act));
}
}
void UBActionableWidget::removeAllActions()
{
mActions.clear();
}
void UBActionableWidget::setActionsVisible(bool bVisible)
{
mShowActions = bVisible;
}
bool UBActionableWidget::shouldClose(QPoint p)
{
qDebug() << "Should close: " << p.x() << "," << p.y();
bool close = false;
if(mShowActions &&
p.x() >= 0 &&
p.x() <= ACTIONSIZE &&
p.y() >= 0 &&
p.y() <= ACTIONSIZE){
close = true;
}
return close;
}
void UBActionableWidget::paintEvent(QPaintEvent* ev)
{
Q_UNUSED(ev);
if(mShowActions){
QPainter p(this);
if(mActions.contains(eAction_Close)){
p.drawPixmap(0, 0, 16, 16, QPixmap(":images/close.svg"));
}else if(mActions.contains(eAction_MoveUp)){
// Implement me later
}else if(mActions.contains(eAction_MoveDown)){
// Implement me later
}
}
}

@ -0,0 +1,35 @@
#ifndef UBACTIONABLEWIDGET_H
#define UBACTIONABLEWIDGET_H
#include <QWidget>
#include <QPaintEvent>
#define ACTIONSIZE 16
typedef enum{
eAction_Close,
eAction_MoveUp,
eAction_MoveDown
}eAction;
class UBActionableWidget : public QWidget
{
Q_OBJECT
public:
UBActionableWidget(QWidget* parent=0, const char* name="UBActionableWidget");
~UBActionableWidget();
void addAction(eAction act);
void removeAction(eAction act);
void removeAllActions();
void setActionsVisible(bool bVisible);
bool shouldClose(QPoint p);
protected:
void paintEvent(QPaintEvent* ev);
QVector<eAction> mActions;
private:
bool mShowActions;
};
#endif // UBACTIONABLEWIDGET_H

@ -38,5 +38,5 @@ void UBDraggableMedia::mouseMoveEvent(QMouseEvent* ev)
drag->setMimeData(mimeData);
Qt::DropAction dropAction = drag->exec(Qt::CopyAction | Qt::MoveAction);
drag->exec(Qt::CopyAction | Qt::MoveAction);
}

@ -1,9 +0,0 @@
#ifndef UBGLOBALS_H
#define UBGLOBALS_H
#define DELETEPTR(ptr) if(NULL != ptr){ \
delete ptr; \
ptr = NULL; \
}
#endif // UBGLOBALS_H

@ -13,7 +13,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "core/UBApplication.h"
#include "UBGlobals.h"
#include "globals/UBGlobals.h"
#include "UBMediaWidget.h"
/**
@ -22,7 +22,7 @@
* @param parent as the parent widget
* @param name as the object name
*/
UBMediaWidget::UBMediaWidget(eMediaType type, QWidget *parent, const char *name):QWidget(parent)
UBMediaWidget::UBMediaWidget(eMediaType type, QWidget *parent, const char *name):UBActionableWidget(parent, name)
, mpMediaObject(NULL)
, mpVideoWidget(NULL)
, mpAudioOutput(NULL)
@ -35,11 +35,10 @@ UBMediaWidget::UBMediaWidget(eMediaType type, QWidget *parent, const char *name)
, mpMediaContainer(NULL)
, mpCover(NULL)
{
setObjectName(name);
setAttribute(Qt::WA_StyledBackground, true);
setStyleSheet(UBApplication::globalStyleSheet());
addAction(eAction_Close);
mType = type;
setLayout(&mLayout);

@ -27,6 +27,7 @@
#include <phonon/AudioOutput>
#include "interfaces/IResizeable.h"
#include "UBActionableWidget.h"
#define UBMEDIABUTTON_SIZE 32
#define TICK_INTERVAL 1000
@ -58,7 +59,7 @@ private:
bool mPressed;
};
class UBMediaWidget : public QWidget
class UBMediaWidget : public UBActionableWidget
{
Q_OBJECT
public:

@ -1,15 +1,19 @@
#include <QDebug>
#include <QScrollBar>
#include <QApplication>
#include <QPainter>
#include "UBGlobals.h"
#include "globals/UBGlobals.h"
#include "UBWidgetList.h"
UBWidgetList::UBWidgetList(QWidget* parent, eWidgetListOrientation orientation, const char* name):QScrollArea(parent)
, mCanRemove(true)
, mpLayout(NULL)
, mpContainer(NULL)
, mMargin(5)
, mListElementsSpacing(10)
, mpEmptyLabel(NULL)
, mpCurrentWidget(NULL)
{
setObjectName(name);
mOrientation = orientation;
@ -130,6 +134,53 @@ void UBWidgetList::resizeEvent(QResizeEvent *ev)
updateSizes();
}
void UBWidgetList::mousePressEvent(QMouseEvent *ev)
{
Q_UNUSED(ev);
if(mCanRemove){
QWidget* pWAt = widgetAt(ev->pos());
if(NULL != mpCurrentWidget){
if(pWAt == mpCurrentWidget){
QPoint p;
p.setX(ev->x());
p.setY(ev->y());
if(mpCurrentWidget->shouldClose(p)){
emit closeWidget(mpCurrentWidget);
return;
}
}else{
mpCurrentWidget->setActionsVisible(false);
}
}
mpCurrentWidget = dynamic_cast<UBActionableWidget*>(pWAt);
if(NULL != mpCurrentWidget){
mpCurrentWidget->setActionsVisible(true);
}
}
update();
}
QWidget* UBWidgetList::widgetAt(QPoint p)
{
QWidget* pW = NULL;
pW = childAt(p);
if(NULL != pW){
do{
if( "UBTeacherStudentAction" == pW->objectName() ||
"UBUrlWidget" == pW->objectName() ||
"UBTBMediaPicture" == pW->objectName() ||
"UBMediaWidget" == pW->objectName()){
return pW;
}else{
pW = pW->parentWidget();
}
}while(NULL != pW && this != pW);
}
return pW;
}
void UBWidgetList::updateSizes()
{
// Resize all the widgets

@ -11,6 +11,7 @@
#include <QLabel>
#include "interfaces/IResizeable.h"
#include "customWidgets/UBActionableWidget.h"
typedef enum{
eWidgetListOrientation_Vertical,
@ -40,10 +41,17 @@ public:
void setListElementSpacing(int margin) { mListElementsSpacing = margin; }
int listElementsSpacing() {return mListElementsSpacing; }
signals:
void closeWidget(QWidget* w);
protected:
bool mCanRemove;
void resizeEvent(QResizeEvent* ev);
void mousePressEvent(QMouseEvent* ev);
private:
QWidget* widgetAt(QPoint p);
int scaleWidgets(QSize pSize);
void scaleContainer(QSize pSize, int updateValue);
void updateView(QSize pSize);
@ -55,6 +63,7 @@ private:
int mListElementsSpacing;
QMap<QWidget*, QSize> mWidgetInfo;
QLabel* mpEmptyLabel;
UBActionableWidget* mpCurrentWidget;
};
#endif // UBWIDGETLIST_H

@ -2,10 +2,12 @@
HEADERS += src/customWidgets/UBWidgetList.h \
src/customWidgets/UBDraggableLabel.h \
src/customWidgets/UBMediaWidget.h \
src/customWidgets/UBGlobals.h \
src/customWidgets/UBDraggableMedia.h
src/globals/UBGlobals.h \
src/customWidgets/UBDraggableMedia.h \
src/customWidgets/UBActionableWidget.h
SOURCES += src/customWidgets/UBWidgetList.cpp \
src/customWidgets/UBDraggableLabel.cpp \
src/customWidgets/UBMediaWidget.cpp \
src/customWidgets/UBDraggableMedia.cpp
src/customWidgets/UBDraggableMedia.cpp \
src/customWidgets/UBActionableWidget.cpp

@ -81,7 +81,7 @@ UBDesktopAnnotationController::UBDesktopAnnotationController(QObject *parent)
mTransparentDrawingView->setMouseTracking(true);
mTransparentDrawingView->setAcceptDrops(false);
mTransparentDrawingView->setAcceptDrops(true);
QString backgroundStyle = "QWidget {background-color: rgba(127, 127, 127, 0)}";
mTransparentDrawingView->setStyleSheet(backgroundStyle);

@ -1150,11 +1150,10 @@ 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);
UBApplication::boardController->setActiveDocumentScene(proxy, target);
}

@ -295,6 +295,15 @@ QString UBDocumentProxy::sessionAuthors()
return QString();
}
QString UBDocumentProxy::documentDate()
{
if(mMetaDatas.contains(UBSettings::documentDate)){
return metaData(UBSettings::documentDate).toString();
}else{
return QString();
}
}
bool UBDocumentProxy::isModified() const
{
return mIsModified;

@ -59,6 +59,7 @@ class UBDocumentProxy : public QObject
QString sessionTopic();
void setSessionAuthor(const QString& authors);
QString sessionAuthors();
QString documentDate();
QSize defaultDocumentSize() const;

@ -1755,6 +1755,9 @@ void UBGraphicsScene::addCache()
mTools << cache;
addItem(cache);
cache->setData(UBGraphicsItemData::ItemLayerType, QVariant(UBItemLayerType::Tool));
cache->setVisible(true);
cache->setSelected(true);
UBApplication::boardController->notifyCache(true);

@ -305,10 +305,11 @@ void UBGraphicsTextItemDelegate::ChangeTextSize(int delta)
bool bEndofTheSameBlock;
int iBlockLen;
int iPointSize;
int inewPointSize;
int iNextPointSize;
int iCursorPos = startPos;
// we search continuous blocks of the text with the same PointSize and allpy new settings for them.
cursor.setPosition (startPos, QTextCursor::MoveAnchor);
while(iCursorPos < endPos)
{
bEndofTheSameBlock = false;
@ -326,17 +327,18 @@ void UBGraphicsTextItemDelegate::ChangeTextSize(int delta)
iBlockLen++;
cursor.setPosition (iCursorPos+iBlockLen+1, QTextCursor::KeepAnchor);
inewPointSize = cursor.charFormat().font().pointSize();
iNextPointSize = cursor.charFormat().font().pointSize();
cursor.setPosition (iCursorPos+iBlockLen, QTextCursor::KeepAnchor);
if ((iPointSize != inewPointSize)||(iCursorPos+iBlockLen >= endPos))
if ((iPointSize != iNextPointSize)||(iCursorPos+iBlockLen >= endPos))
bEndofTheSameBlock = true;
}while(!bEndofTheSameBlock);
//setting new parameners
curFont.setPointSize(iPointSize + delta);
int iNewPointSize = iPointSize + delta;
curFont.setPointSize( (iNewPointSize > 0)?iNewPointSize:1);
textFormat.setFont(curFont);
cursor.mergeCharFormat(textFormat);

@ -47,7 +47,7 @@ QByteArray UBBase32::decode(const QString& base32String)
if (lookup < 0 || lookup >= 80)
continue;
int digit = sBase32Lookup[lookup];
int digit = sBase32Lookup[(int)lookup];
/* If this digit is not in the table, ignore it */
if (digit == 0xFF)

@ -16,10 +16,12 @@
#include "UBFileSystemUtils.h"
#include <QtGui>
#include "globals/UBGlobals.h"
THIRD_PARTY_WARNINGS_DISABLE
#include "quazipfile.h"
#include <openssl/md5.h>
THIRD_PARTY_WARNINGS_ENABLE
#include "core/memcheck.h"

@ -0,0 +1,47 @@
#ifndef UBGLOBALS_H
#define UBGLOBALS_H
#define DELETEPTR(ptr) if(NULL != ptr){ \
delete ptr; \
ptr = NULL; \
}
#ifdef Q_WS_WIN
#define WARNINGS_DISABLE __pragma(warning(push, 0));
#define WARNINGS_ENABLE __pragma(warning(pop));
#ifdef NO_THIRD_PARTY_WARNINGS
// disabling warning level to 0 and save old state
#define THIRD_PARTY_WARNINGS_DISABLE WARNINGS_DISABLE
#else
// just save old state (needs for not empty define)
#define THIRD_PARTY_WARNINGS_DISABLE __pragma(warning(push));
#endif //#ifdef NO_THIRD_PARTY_WARNINGS
// anyway on WIN
#define THIRD_PARTY_WARNINGS_ENABLE WARNINGS_ENABLE
#else //#ifdef Q_WS_WIN
#define WARNINGS_DISABLE _Pragma("GCC diagnostic push"); \
_Pragma("GCC diagnostic ignored \"-Wunused-parameter\""); \
_Pragma("GCC diagnostic ignored \"-Wunused-variable\""); \
_Pragma("GCC diagnostic ignored \"-Wsign-compare\"");
#define WARNINGS_ENABLE _Pragma("GCC diagnostic pop");
#ifdef NO_THIRD_PARTY_WARNINGS
//disabling some warnings
#define THIRD_PARTY_WARNINGS_DISABLE WARNINGS_DISABLE
#define THIRD_PARTY_WARNINGS_ENABLE WARNINGS_ENABLE
#else
// just save old state (needs for not empty define)
#define THIRD_PARTY_WARNINGS_ENABLE WARNINGS_ENABLE
#endif //#ifdef NO_THIRD_PARTY_WARNINGS
#endif //#ifdef Q_WS_WIN
#endif // UBGLOBALS_H

@ -697,7 +697,7 @@ void UBDockPalette::moveTabs()
void UBDockPalette::resizeTabs()
{
int numTabs = mTabWidgets.size();
mTabPalette->resize(2 * border(), (numTabs * TABSIZE) + qMax(numTabs - 1, 0) * tabSpacing());
mTabPalette->setFixedSize(2 * border(), (numTabs * TABSIZE) + qMax(numTabs - 1, 0) * tabSpacing());
}
QRect UBDockPalette::getTabPaletteRect()
{

@ -191,8 +191,8 @@ private:
void resizeTabs();
private:
UBTabDockPalete *mTabPalette;
eUBDockPaletteType mPaletteType;
UBTabDockPalete *mTabPalette;
};
#endif // UBDOCKPALETTE_H

@ -391,17 +391,13 @@ void UBDocumentNavigator::mousePressEvent(QMouseEvent *event)
mCrntItem = pCrntItem;
}
// 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();
refreshScene();
}
bNavig = false;
}
QGraphicsView::mousePressEvent(event);
}
/**
@ -448,6 +444,7 @@ void UBDocumentNavigator::onMovedToIndex(int index)
UBSceneThumbnailNavigPixmap* pItem = dynamic_cast<UBSceneThumbnailNavigPixmap*>(mThumbnails.at(index));
if(NULL != pItem)
{
if(mCrntItem) mCrntItem->setSelected(false);//deselecting previous one
mCrntItem = pItem;
mCrntItem->setSelected(true);
centerOn(mCrntItem);

@ -284,7 +284,7 @@ void UBLibPathViewer::showBack()
if(NULL != pLastElem)
{
mpBackElem->setPath(pLastElem->element()->path());
mpBackElem->setType(eUBLibElementType_Folder);
mpBackElem->setType(pLastElem->element()->type());
mpBackElem->setName(pLastElem->element()->name());
}

@ -361,15 +361,12 @@ void UBLibraryWidget::dropEvent(QDropEvent *event)
QString filePath;
QString crntPath = urlList.at(i).toString();
#ifdef Q_WS_MACX
filePath = QUrl(urlList.at(i)).toString();
#else
if(crntPath.startsWith("file:") || crntPath.startsWith("/")){
filePath = QUrl(crntPath).toLocalFile();
}else{
filePath = crntPath;
}
#endif
mLibraryController->importItemOnLibrary(filePath);
bDropAccepted = true;
}

@ -51,7 +51,6 @@ void UBResources::init()
// Cursors
penCursor = QCursor(Qt::CrossCursor);
eraserCursor = QCursor(QPixmap(":/images/cursors/eraser.png"), 21, 21);
magnifierCursor = QCursor(QPixmap(":/images/cursors/magnifier.png"), 9, 9);
markerCursor = QCursor(QPixmap(":/images/cursors/marker.png"), 3, 30);
pointerCursor = QCursor(QPixmap(":/images/cursors/laser.png"), 2, 1);
handCursor = QCursor(Qt::OpenHandCursor);

@ -37,7 +37,6 @@ class UBResources : public QObject
QCursor penCursor;
QCursor eraserCursor;
QCursor magnifierCursor;
QCursor markerCursor;
QCursor pointerCursor;
QCursor handCursor;

@ -1,7 +1,7 @@
#include <QDebug>
#include "UBTBDocumentEditWidget.h"
#include "customWidgets/UBGlobals.h"
#include "globals/UBGlobals.h"
UBTBDocumentEditWidget::UBTBDocumentEditWidget(UBTeacherBarDataMgr* pDataMgr, QWidget *parent, const char *name):QWidget(parent)
, mpPageViewButton(NULL)
@ -62,8 +62,8 @@ UBTBDocumentEditWidget::UBTBDocumentEditWidget(UBTeacherBarDataMgr* pDataMgr, QW
mpKeywords->setObjectName("DockPaletteWidgetLineEdit");
mpLevel = new QComboBox(this);
mpLevel->setObjectName("DockPaletteWidgetComboBox");
mpTopic = new QComboBox(this);
mpTopic->setObjectName("DockPaletteWidgetComboBox");
mpTopic = new QLineEdit(this);
mpTopic->setObjectName("DockPaletteWidgetLineEdit");
mpAuthor = new QLineEdit(this);
mpAuthor->setObjectName("DockPaletteWidgetLineEdit");
mpKeywordLabel = new QLabel(tr("Keywords:"), this);
@ -120,7 +120,7 @@ UBTBDocumentEditWidget::UBTBDocumentEditWidget(UBTeacherBarDataMgr* pDataMgr, QW
connect(mpLicenseCombox, SIGNAL(currentIndexChanged(int)), this, SLOT(onLicenseCurrentIndexChanged(int)));
connect(mpKeywords, SIGNAL(textChanged(QString)), this, SLOT(onKeywordChanged(QString)));
connect(mpLevel, SIGNAL(currentIndexChanged(QString)), this, SLOT(onLevelChanged(QString)));
connect(mpTopic, SIGNAL(currentIndexChanged(QString)), this, SLOT(onTopicChanged(QString)));
connect(mpTopic, SIGNAL(textChanged(QString)), this, SLOT(onTopicChanged(QString)));
connect(mpAuthor, SIGNAL(textChanged(QString)), this, SLOT(onAuthorChanged(QString)));
}
@ -179,7 +179,7 @@ void UBTBDocumentEditWidget::updateFields()
mpTarget->setPlainText(mpDataMgr->sessionTarget());
mpKeywords->setText(mpDataMgr->keywords());
// TODO: retrieve the level
// TODO retrieve the topic
mpTopic->setText(mpDataMgr->topic());
mpAuthor->setText(mpDataMgr->authors());
}
@ -192,7 +192,6 @@ void UBTBDocumentEditWidget::clearFields()
void UBTBDocumentEditWidget::onKeywordChanged(const QString &kw)
{
mpDataMgr->setKeywords(kw);
qDebug() << ">>> KEYWORD CHANGED: " << kw;
emit valueChanged();
}

@ -60,7 +60,7 @@ private:
QComboBox* mpLicenseCombox;
QLineEdit* mpKeywords;
QComboBox* mpLevel;
QComboBox* mpTopic;
QLineEdit* mpTopic;
QLineEdit* mpAuthor;
QLabel* mpKeywordLabel;
QLabel* mpLevelLabel;

@ -1,30 +1,122 @@
#include "customWidgets/UBGlobals.h"
#include "globals/UBGlobals.h"
#include "UBTBDocumentPreviewWidget.h"
UBTBDocumentPreviewWidget::UBTBDocumentPreviewWidget(UBTeacherBarDataMgr *pDataMgr, QWidget *parent, const char *name):QWidget(parent)
, mpContainer(NULL)
, mpPageViewButton(NULL)
, mpEditButton(NULL)
, mpSessionLabel(NULL)
, mpSessionTitle(NULL)
, mpAuthorLabel(NULL)
, mpAuthors(NULL)
, mpCreationDate(NULL)
, mpTargetLabel(NULL)
, mpTarget(NULL)
, mpMetadataLabel(NULL)
, mpKeywordLabel(NULL)
, mpKeyword(NULL)
, mpLevelLabel(NULL)
, mpLevel(NULL)
, mpTopicLabel(NULL)
, mpTopic(NULL)
, mpLicense(NULL)
{
setObjectName(name);
mpDataMgr = pDataMgr;
setLayout(&mLayout);
mLayout.setContentsMargins(0, 0, 0, 0);
mpPageViewButton = new QPushButton(tr("Page View"), this);
mpPageViewButton->setObjectName("DockPaletteWidgetButton");
mPageLayout.addStretch(1);
mPageLayout.addWidget(mpPageViewButton, 0);
mPageLayout.addStretch(1);
mLayout.addLayout(&mPageLayout);
mpContainer = new QWidget(this);
mpContainer->setLayout(&mContainerLayout);
mpContainer->setObjectName("UBTBPreviewWidget");
// Session Title
mpSessionLabel = new QLabel(tr("Session"), mpContainer);
mpSessionLabel->setAlignment(Qt::AlignRight);
mpSessionLabel->setObjectName("UBTeacherBarPreviewSubtitle");
mContainerLayout.addWidget(mpSessionLabel, 0);
mpSessionTitle = new QLabel(mpContainer);
mpSessionTitle->setWordWrap(true);
mpSessionTitle->setAlignment(Qt::AlignRight);
mpSessionTitle->setObjectName("UBTeacherBarPreviewTitle");
mContainerLayout.addWidget(mpSessionTitle, 0);
mContainerLayout.addWidget(&mTitleSeparator, 0);
// Author(s)
mpAuthorLabel = new QLabel(tr("Author(s)"), mpContainer);
mpAuthorLabel->setObjectName("UBTeacherBarPreviewSubtitle");
mContainerLayout.addWidget(mpAuthorLabel, 0);
mpAuthors = new QLabel(mpContainer);
mpAuthors->setWordWrap(true);
mpAuthors->setStyleSheet("padding-left:5px;");
mContainerLayout.addWidget(mpAuthors, 0);
mContainerLayout.addWidget(&mAuthorSeparator, 0);
// Dates
mpCreationDate = new QLabel(tr("Created on: "), mpContainer);
mpCreationDate->setStyleSheet("padding-left:5px;");
mContainerLayout.addWidget(mpCreationDate);
mContainerLayout.addWidget(&mDateSeparator, 0);
// Target
mpTargetLabel = new QLabel(tr("Target"), mpContainer);
mpTargetLabel->setObjectName("UBTeacherBarPreviewSubtitle");
mContainerLayout.addWidget(mpTargetLabel,0);
mpTarget = new QTextEdit(mpContainer);
mpTarget->setReadOnly(true);
mContainerLayout.addWidget(mpTarget, 1);
mContainerLayout.addWidget(&mTargetSeparator, 0);
// Metadata
mpMetadataLabel = new QLabel(tr("Metadata"), mpContainer);
mpMetadataLabel->setObjectName("UBTeacherBarPreviewSubtitle");
mContainerLayout.addWidget(mpMetadataLabel, 0);
// Keyword
mpKeywordLabel = new QLabel(tr("<b>Keywords:</b>"), mpContainer);
mpKeywordLabel->setStyleSheet("padding-left:5px;");
mpKeyword = new QLabel(mpContainer);
mpKeyword->setWordWrap(true);
mKeywordLayout.addWidget(mpKeywordLabel, 0);
mKeywordLayout.addWidget(mpKeyword, 1);
mContainerLayout.addLayout(&mKeywordLayout, 0);
// Level
mpLevelLabel = new QLabel(tr("<b>Level:</b>"), mpContainer);
mpLevelLabel->setStyleSheet("padding-left:5px;");
mpLevel = new QLabel(mpContainer);
mpLevel->setWordWrap(true);
mLevelLayout.addWidget(mpLevelLabel, 0);
mLevelLayout.addWidget(mpLevel, 1);
mContainerLayout.addLayout(&mLevelLayout, 0);
// TODO : Add the elements here
// Topic
mpTopicLabel = new QLabel(tr("<b>Topic:</b>"), mpContainer);
mpTopicLabel->setStyleSheet("padding-left:5px;");
mpTopic = new QLabel(mpContainer);
mpTopic->setWordWrap(true);
mTopicLayout.addWidget(mpTopicLabel, 0);
mTopicLayout.addWidget(mpTopic, 1);
mContainerLayout.addLayout(&mTopicLayout, 0);
mContainerLayout.addWidget(&mMetadataSeparator, 0);
// License
mpLicense = new UBTBLicenseWidget(mpContainer);
mContainerLayout.addWidget(mpLicense, 0);
mLayout.addWidget(mpContainer, 1);
mpPageViewButton = new QPushButton(tr("Page View"), this);
mpPageViewButton->setObjectName("DockPaletteWidgetButton");
mpEditButton = new QPushButton(tr("Edit"), this);
mpEditButton->setObjectName("DockPaletteWidgetButton");
mPreviewLayout.addStretch(1);
mPreviewLayout.addWidget(mpEditButton, 0);
mPreviewLayout.addStretch(1);
mLayout.addLayout(&mPreviewLayout);
mButtonsLayout.addWidget(mpPageViewButton, 0);
mButtonsLayout.addWidget(mpEditButton, 0);
mButtonsLayout.addStretch(1);
mLayout.addLayout(&mButtonsLayout, 0);
connect(mpPageViewButton, SIGNAL(clicked()), this, SLOT(onPageView()));
connect(mpEditButton, SIGNAL(clicked()), this, SLOT(onEdit()));
@ -32,8 +124,7 @@ UBTBDocumentPreviewWidget::UBTBDocumentPreviewWidget(UBTeacherBarDataMgr *pDataM
UBTBDocumentPreviewWidget::~UBTBDocumentPreviewWidget()
{
DELETEPTR(mpPageViewButton);
DELETEPTR(mpEditButton);
}
void UBTBDocumentPreviewWidget::onEdit()
@ -48,10 +139,23 @@ void UBTBDocumentPreviewWidget::onPageView()
void UBTBDocumentPreviewWidget::updateFields()
{
mpSessionTitle->setText(mpDataMgr->sessionTitle());
mpAuthors->setText(mpDataMgr->authors());
mpCreationDate->setText(tr("<b>Creation Date:</b> %0").arg(mpDataMgr->creationDate()));
mpTarget->setText(mpDataMgr->sessionTarget());
mpLicense->setLicense(mpDataMgr->sessionLicence());
mpKeyword->setText(mpDataMgr->keywords());
mpLevel->setText(mpDataMgr->level());
mpTopic->setText(mpDataMgr->topic());
}
void UBTBDocumentPreviewWidget::clearFields()
{
mpSessionTitle->setText("");
mpAuthors->setText("");
mpCreationDate->setText("");
mpTarget->setText("");
mpKeyword->setText("");
mpLevel->setText("");
mpTopic->setText("");
}

@ -24,10 +24,35 @@ private slots:
private:
QVBoxLayout mLayout;
QHBoxLayout mPageLayout;
QHBoxLayout mPreviewLayout;
QHBoxLayout mButtonsLayout;
QWidget* mpContainer;
QVBoxLayout mContainerLayout;
QPushButton* mpPageViewButton;
QPushButton* mpEditButton;
QLabel* mpSessionLabel;
QLabel* mpSessionTitle;
UBTBSeparator mTitleSeparator;
QLabel* mpAuthorLabel;
QLabel* mpAuthors;
UBTBSeparator mAuthorSeparator;
QLabel* mpCreationDate;
UBTBSeparator mDateSeparator;
QLabel* mpTargetLabel;
QTextEdit* mpTarget;
UBTBSeparator mTargetSeparator;
QLabel* mpMetadataLabel;
QHBoxLayout mKeywordLayout;
QLabel* mpKeywordLabel;
QLabel* mpKeyword;
QHBoxLayout mLevelLayout;
QLabel* mpLevelLabel;
QLabel* mpLevel;
QHBoxLayout mTopicLayout;
QLabel* mpTopicLabel;
QLabel* mpTopic;
UBTBSeparator mMetadataSeparator;
UBTBLicenseWidget* mpLicense;
UBTeacherBarDataMgr* mpDataMgr;
};

@ -1,4 +1,4 @@
#include "customWidgets/UBGlobals.h"
#include "globals/UBGlobals.h"
#include "core/UBApplication.h"
#include "frameworks/UBFileSystemUtils.h"
#include "gui/UBMediaPlayer.h"
@ -100,6 +100,9 @@ UBTBPageEditWidget::UBTBPageEditWidget(UBTeacherBarDataMgr *pDataMgr, QWidget *p
connect(mpDocumentEditbutton, SIGNAL(clicked()), this, SLOT(onDocumentEditClicked()));
connect(mpPagePreviewButton, SIGNAL(clicked()), this, SLOT(onPagePreviewClicked()));
connect(mpMediaContainer, SIGNAL(mediaDropped(QString)), this, SLOT(onMediaDropped(QString)));
connect(mpActions, SIGNAL(closeWidget(QWidget*)), this, SLOT(onCloseWidget(QWidget*)));
connect(mpLinks, SIGNAL(closeWidget(QWidget*)), this, SLOT(onCloseWidget(QWidget*)));
connect(mpMediaContainer, SIGNAL(closeWidget(QWidget*)), this, SLOT(onCloseWidget(QWidget*)));
}
UBTBPageEditWidget::~UBTBPageEditWidget()
@ -271,15 +274,36 @@ void UBTBPageEditWidget::clearFields()
mClearingFields = false;
}
void UBTBPageEditWidget::onCloseWidget(QWidget *w)
{
if(NULL != w){
if("UBTeacherStudentAction" == w->objectName()){
UBTeacherStudentAction* pW = dynamic_cast<UBTeacherStudentAction*>(w);
mpActions->removeWidget(pW);
mActions.remove(mActions.indexOf(pW));
DELETEPTR(w);
}else if("UBUrlWidget" == w->objectName()){
UBUrlWidget* pW = dynamic_cast<UBUrlWidget*>(w);
mpLinks->removeWidget(pW);
mUrls.remove(mUrls.indexOf(pW));
DELETEPTR(w);
}else if("UBTBMediaPicture" == w->objectName() || "UBMediaWidget" == w->objectName()){
mpMediaContainer->removeWidget(w);
mMedias.remove(mMedias.indexOf(w));
DELETEPTR(w);
}
}
}
// ---------------------------------------------------------------------------------------------
UBUrlWidget::UBUrlWidget(QWidget *parent, const char *name):QWidget(parent)
UBUrlWidget::UBUrlWidget(QWidget *parent, const char *name):UBActionableWidget(parent, name)
, mpLayout(NULL)
, mpUrlLabel(NULL)
, mpUrl(NULL)
{
setObjectName(name);
setAttribute(Qt::WA_StyledBackground, true);
setStyleSheet(UBApplication::globalStyleSheet());
addAction(eAction_Close);
mpLayout = new QVBoxLayout(this);
setLayout(mpLayout);
@ -320,7 +344,7 @@ QString UBUrlWidget::url()
QString str;
if(NULL != mpUrl){
str = mpUrl->text() + ";" + mpTitle->text();
str = mpUrl->text();// + ";" + mpTitle->text();
}
return str;
@ -435,12 +459,13 @@ QWidget* UBTBMediaContainer::generateMediaWidget(const QString& url)
QString mimeType = UBFileSystemUtils::mimeTypeFromFileName(url);
if(mimeType.contains("image")){
QPixmap pix = QPixmap(url);
QLabel* label = new QLabel();
pix.scaledToWidth(label->width());
label->resize(pix.width(), pix.height());
label->setPixmap(pix);
label->setScaledContents(true);
pW = label;
UBPictureWidget* pic = new UBPictureWidget();
pix.scaledToWidth(pic->label()->width());
pic->label()->resize(pix.width(), pix.height());
pic->label()->setPixmap(pix);
pic->label()->setScaledContents(true);
pic->setObjectName("UBTBMediaPicture");
pW = pic;
}
else if(mimeType.contains("video") || mimeType.contains("audio")){
UBMediaWidget* mediaPlayer = new UBMediaWidget(mimeType.contains("audio")?eMediaType_Audio:eMediaType_Video);
@ -455,16 +480,15 @@ QWidget* UBTBMediaContainer::generateMediaWidget(const QString& url)
return pW;
}
UBTeacherStudentAction::UBTeacherStudentAction(QWidget *parent, const char *name):QWidget(parent)
UBTeacherStudentAction::UBTeacherStudentAction(QWidget *parent, const char *name):UBActionableWidget(parent, name)
, mpText(NULL)
, mpLayout(NULL)
, mpComboLayout(NULL)
, mpCombo(NULL)
{
setObjectName(name);
setAttribute(Qt::WA_StyledBackground, true);
setStyleSheet(UBApplication::globalStyleSheet());
addAction(eAction_Close);
// Create the GUI
mpLayout = new QHBoxLayout(this);
@ -532,3 +556,28 @@ void UBTeacherStudentAction::setText(const QString& text)
}
}
// -------------------------------------------------------------
UBPictureWidget::UBPictureWidget(QWidget *parent, const char *name):UBActionableWidget(parent, name)
, mpLayout(NULL)
, mpLabel(NULL)
{
addAction(eAction_Close);
mpLayout = new QVBoxLayout(this);
setLayout(mpLayout);
mpLayout->setContentsMargins(10, 0, 10, 0);
mpLabel = new QLabel(this);
mpLayout->addWidget(mpLabel);
mpLabel->setGeometry( 10, 10, width()-2*10, height());
}
UBPictureWidget::~UBPictureWidget()
{
DELETEPTR(mpLabel);
DELETEPTR(mpLayout);
}
void UBPictureWidget::resizeEvent(QResizeEvent *ev)
{
Q_UNUSED(ev);
mpLabel->setGeometry( 10, 10, width()-2*10, height());
}

@ -11,10 +11,11 @@
#include "core/UBPersistenceManager.h"
#include "customWidgets/UBWidgetList.h"
#include "customWidgets/UBActionableWidget.h"
#include "interfaces/IDropable.h"
#include "UBTeacherBarDataMgr.h"
class UBTeacherStudentAction : public QWidget
class UBTeacherStudentAction : public UBActionableWidget
{
Q_OBJECT
@ -33,7 +34,7 @@ private:
QComboBox* mpCombo;
};
class UBUrlWidget : public QWidget
class UBUrlWidget : public UBActionableWidget
{
public:
UBUrlWidget(QWidget* parent=0, const char* name="UBUrlWidget");
@ -56,6 +57,22 @@ private:
QLineEdit* mpTitle;
};
class UBPictureWidget : public UBActionableWidget
{
public:
UBPictureWidget(QWidget* parent=0, const char* name="UBPictureWidget");
~UBPictureWidget();
QLabel* label(){return mpLabel;}
protected:
void resizeEvent(QResizeEvent* ev);
private:
QVBoxLayout* mpLayout;
QLabel* mpLabel;
};
class UBTBMediaContainer : public UBWidgetList
, public IDropable
{
@ -104,6 +121,7 @@ private slots:
void onMediaDropped(const QString& url);
void onDocumentEditClicked();
void onPagePreviewClicked();
void onCloseWidget(QWidget* w);
private:
QVBoxLayout mLayout;

@ -1,3 +1,5 @@
#include <QDate>
#include "UBTeacherBarDataMgr.h"
#include "core/UBApplication.h"
@ -5,7 +7,7 @@
#include "board/UBBoardController.h"
#include "customWidgets/UBGlobals.h"
#include "globals/UBGlobals.h"
#include "adaptors/UBMetadataDcSubsetAdaptor.h"
@ -59,7 +61,6 @@ void UBTeacherBarDataMgr::saveContent()
documentProxy->setSessionTitle(mSessionTitle);
documentProxy->setSessionTarget(mSessionTarget);
documentProxy->setSessionLicence(QString("%0").arg(mSessionLicence));
qDebug() << "Saving keywords: " << mKeywords;
documentProxy->setSessionKeywords(mKeywords);
documentProxy->setSessionLevel(mLevel);
documentProxy->setSessionTopic(mTopic);
@ -73,6 +74,7 @@ void UBTeacherBarDataMgr::saveContent()
void UBTeacherBarDataMgr::loadContent(bool docChanged)
{
Q_UNUSED(docChanged);
clearLists();
UBDocumentProxy* documentProxy = UBApplication::boardController->activeDocument();
@ -82,10 +84,15 @@ void UBTeacherBarDataMgr::loadContent(bool docChanged)
mSessionTarget = documentProxy->sessionTarget();
mSessionLicence = (eLicense)documentProxy->sessionLicence().toInt();
mKeywords = documentProxy->sessionKeywords();
qDebug() << "Keywords loaded: " << mKeywords << " (" << documentProxy->sessionKeywords() << ")";
mLevel = documentProxy->sessionLevel();
mTopic = documentProxy->sessionTopic();
mAuthors = documentProxy->sessionAuthors();
if("" != documentProxy->documentDate()){
mCreationDate = documentProxy->documentDate();
}else{
mCreationDate = QDate::currentDate().toString("yyyy-MM-dd");
}
}
// Page Title
@ -126,6 +133,7 @@ void UBTeacherBarDataMgr::loadContent(bool docChanged)
// ------------------------------------------------------------------------------------
UBTBSeparator::UBTBSeparator(QWidget *parent, const char *name):QFrame(parent)
{
Q_UNUSED(name);
setObjectName("UBTBSeparator");
setMinimumHeight(5);
setMaximumHeight(5);

@ -115,6 +115,13 @@ public:
void setAuthors(const QString& authors){mAuthors = authors;}
QString authors(){return mAuthors;}
// Creation Date
void setCreationDate(const QString& date){mCreationDate = date;}
QString creationDate(){return mCreationDate;}
// Last Modification
void setLastModificationDate(const QString& date){mLastModif = date;}
QString lastModificationDate(){return mLastModif;}
// Others
void clearLists();
@ -131,6 +138,8 @@ private:
QString mLevel;
QString mTopic;
QString mAuthors;
QString mCreationDate;
QString mLastModif;
QVector<sAction> mActionList;
QVector<sLink> mUrlList;

@ -1,5 +1,5 @@
#include "core/UBApplication.h"
#include "customWidgets/UBGlobals.h"
#include "globals/UBGlobals.h"
#include "board/UBBoardController.h"
#include "frameworks/UBFileSystemUtils.h"
@ -37,6 +37,7 @@ void UBTeacherBarPreviewMedia::cleanMedia()
void UBTeacherBarPreviewMedia::loadWidgets(QList<QWidget*> pWidgetsList, bool isResizable)
{
Q_UNUSED(isResizable);
foreach(QWidget*eachWidget, pWidgetsList){
mWidget->addWidget(eachWidget);
mWidgetList[eachWidget]="DRAG UNAVAILABLE";
@ -134,6 +135,7 @@ void UBActionPreview::setContent(const QString &content)
UBTBPreviewContainer::UBTBPreviewContainer(QWidget *parent, const char *name):UBWidgetList(parent)
{
setObjectName(name);
mCanRemove = false;
}
UBTBPreviewContainer::~UBTBPreviewContainer()
@ -144,6 +146,7 @@ UBTBPreviewContainer::~UBTBPreviewContainer()
// ------------------------------------------------------------------------------------
UBTeacherBarPreviewWidget::UBTeacherBarPreviewWidget(UBTeacherBarDataMgr* pDataMgr, QWidget *parent, const char *name):QWidget(parent)
, mpEditButton(NULL)
, mpDocumentButton(NULL)
, mpSessionTitle(NULL)
, mpTitle(NULL)
, mpTitleLabel(NULL)
@ -155,20 +158,27 @@ UBTeacherBarPreviewWidget::UBTeacherBarPreviewWidget(UBTeacherBarDataMgr* pDataM
setObjectName(name);
mpDataMgr = pDataMgr;
setLayout(&mLayout);
mLayout.setContentsMargins(0, 0, 0, 0);
setAttribute(Qt::WA_StyledBackground, true);
setStyleSheet(UBApplication::globalStyleSheet());
// Build the Preview widget
mpContainer = new QWidget(this);
mpContainer->setObjectName("UBTBPreviewWidget");
mpContainer->setLayout(&mContainerLayout);
mLayout.addWidget(mpContainer, 1);
// Session Title
mpTitleContainer = new QWidget(this);
mpTitleContainer = new QWidget(mpContainer);
mpTitleContainer->setLayout(&mTitleLayout);
mpSessionTitle = new QLabel(this);
mpSessionTitle = new QLabel(mpContainer);
mpSessionTitle->setText(tr("Session: "));
mpSessionTitle->setWordWrap(true);
mpSessionTitle->setAlignment(Qt::AlignRight);
mpSessionTitle->setObjectName("UBTBPreviewSessionTitle");
mLayout.addWidget(mpSessionTitle);
mContainerLayout.addWidget(mpSessionTitle);
// Title
mpTitleContainer->setLayout(&mTitleLayout);
@ -187,27 +197,32 @@ UBTeacherBarPreviewWidget::UBTeacherBarPreviewWidget(UBTeacherBarDataMgr* pDataM
mpPageNbrLabel->setObjectName("UBTBPreviewSessionTitle");
mTitleLayout.addWidget(mpPageNbrLabel);
mTitleLayout.addWidget(&mTitleSeparator);
mLayout.addWidget(mpTitleContainer);
mContainerLayout.addWidget(mpTitleContainer);
// Content
mpContentContainer = new UBTBPreviewContainer(this);
mLayout.addWidget(mpContentContainer, 1);
mpContentContainer = new UBTBPreviewContainer(mpContainer);
mContainerLayout.addWidget(mpContentContainer, 1);
// License
mLayout.addWidget(&mLicenseSeparator);
mpLicenseLabel = new UBTBLicenseWidget(this);
mLayout.addWidget(mpLicenseLabel);
mContainerLayout.addWidget(&mLicenseSeparator);
mpLicenseLabel = new UBTBLicenseWidget(mpContainer);
mContainerLayout.addWidget(mpLicenseLabel);
// Edit button
mpEditButton = new QPushButton(tr("Edit infos"), this);
// Document Button
mpDocumentButton = new QPushButton(tr("Document View"), this);
mpDocumentButton->setObjectName("DockPaletteWidgetButton");
// Edit Button
mpEditButton = new QPushButton(tr("Edit"), this);
mpEditButton->setObjectName("DockPaletteWidgetButton");
mEditLayout.addStretch(1);
mEditLayout.addWidget(mpDocumentButton, 0);
mEditLayout.addWidget(mpEditButton, 0);
mEditLayout.addStretch(1);
mLayout.addLayout(&mEditLayout, 0);
connect(mpEditButton, SIGNAL(clicked()), this, SLOT(onEdit()));
connect(mpDocumentButton, SIGNAL(clicked()), this, SLOT(onDocumentClicked()));
connect(UBApplication::boardController, SIGNAL(activeSceneChanged()), this, SLOT(onActiveSceneChanged()));
}
@ -225,6 +240,11 @@ void UBTeacherBarPreviewWidget::onEdit()
emit showEditMode();
}
void UBTeacherBarPreviewWidget::onDocumentClicked()
{
emit showDocumentPreview();
}
void UBTeacherBarPreviewWidget::updateFields()
{
// Session Title
@ -343,6 +363,7 @@ void UBTeacherBarPreviewWidget::generateComments()
void UBTeacherBarPreviewWidget::showEvent(QShowEvent* ev)
{
Q_UNUSED(ev);
updateFields();
}

@ -62,6 +62,7 @@ public:
signals:
void showEditMode();
void showDocumentPreview();
protected:
void showEvent(QShowEvent* ev);
@ -69,6 +70,7 @@ protected:
private slots:
void onEdit();
void onActiveSceneChanged();
void onDocumentClicked();
private:
void generateActions();
@ -77,8 +79,12 @@ private:
void generateComments();
QVBoxLayout mLayout;
QVBoxLayout mContainerLayout;
QHBoxLayout mEditLayout;
QPushButton* mpEditButton;
QPushButton* mpDocumentButton;
QWidget* mpContainer;
// Titles
QVBoxLayout mTitleLayout;
@ -95,7 +101,6 @@ private:
// License
UBTBSeparator mLicenseSeparator;
// TODO : replace the QLabel of the license by a widget done for that!
UBTBLicenseWidget* mpLicenseLabel;

@ -15,7 +15,7 @@
#include "customWidgets/UBDraggableLabel.h"
#include "customWidgets/UBMediaWidget.h"
#include "customWidgets/UBGlobals.h"
#include "globals/UBGlobals.h"
#include "core/memcheck.h"
@ -57,6 +57,7 @@ UBTeacherBarWidget::UBTeacherBarWidget(QWidget *parent, const char *name):UBDock
connect(UBApplication::boardController, SIGNAL(activeDocumentChanged()), this, SLOT(onActiveDocumentChanged()));
connect(mpPreview, SIGNAL(showEditMode()), this, SLOT(onShowEditMode()));
connect(mpPreview, SIGNAL(showDocumentPreview()), this, SLOT(onShowDocumentPreview()));
connect(mpDocPreviewWidget, SIGNAL(changeTBState(eTeacherBarState)), this, SLOT(onTBStateChanged(eTeacherBarState)));
connect(mpDocEditWidget, SIGNAL(changeTBState(eTeacherBarState)), this, SLOT(onTBStateChanged(eTeacherBarState)));
connect(mpPageEditWidget, SIGNAL(changeTBState(eTeacherBarState)), this, SLOT(onTBStateChanged(eTeacherBarState)));
@ -150,6 +151,11 @@ void UBTeacherBarWidget::onShowEditMode()
onTBStateChanged(eTeacherBarState_PageEdit);
}
void UBTeacherBarWidget::onShowDocumentPreview()
{
onTBStateChanged(eTeacherBarState_DocumentPreview);
}
void UBTeacherBarWidget::onTBStateChanged(eTeacherBarState state)
{
switch(state){

@ -48,6 +48,7 @@ private slots:
void onShowEditMode();
void onTBStateChanged(eTeacherBarState state);
void onActiveDocumentChanged();
void onShowDocumentPreview();
private:
bool isEmpty();

@ -740,25 +740,21 @@ void UBSceneThumbnailNavigPixmap::paint(QPainter *painter, const QStyleOptionGra
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();
// }
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();
}
@ -809,32 +805,3 @@ 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;
}

@ -292,7 +292,6 @@ class UBSceneThumbnailNavigPixmap : public UBSceneThumbnailPixmap
public:
UBSceneThumbnailNavigPixmap(const QPixmap& pix, UBDocumentProxy* proxy, int pSceneIndex);
~UBSceneThumbnailNavigPixmap();
void notifyClick(QPointF clickedScenePos);
protected:
void hoverEnterEvent(QGraphicsSceneHoverEvent *event);
@ -305,7 +304,6 @@ class UBSceneThumbnailNavigPixmap : public UBSceneThumbnailPixmap
void deletePage();
void moveUpPage();
void moveDownPage();
QPointF clickedPos(QPointF clickedScenePos);
bool bButtonsVisible;
bool bCanDelete;

@ -13,7 +13,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <iostream>
#include <QtGlobal>
#include "ASCII85Decode.h"
#include "core/memcheck.h"
@ -51,6 +51,12 @@ void ASCII85Decode::_wput(std::string &cur,unsigned long tuple, int len)
}
}
bool ASCII85Decode::encode(std::string & decoded)
{
Q_UNUSED(decoded);
return false;
}
bool ASCII85Decode::decode(std::string &encoded)
{
unsigned long tuple = 0;
@ -58,7 +64,6 @@ bool ASCII85Decode::decode(std::string &encoded)
int count = 0;
int size = encoded.size();
int i = 0;
bool found = false;
for(;size;)
{
char ch = encoded[i++];
@ -121,3 +126,7 @@ bool ASCII85Decode::decode(std::string &encoded)
}
return true;
}
void ASCII85Decode::initialize(Object * objectWithStram)
{
Q_UNUSED(objectWithStram);
};

@ -26,9 +26,9 @@ namespace merge_lib
public:
ASCII85Decode(){};
virtual ~ASCII85Decode(){};
bool encode(std::string & decoded) {return false;}
bool encode(std::string & decoded);
bool decode(std::string & encoded);
void initialize(Object * objectWithStram){};
void initialize(Object * objectWithStram);
private:
void _wput(std::string &cur,unsigned long tuple, int len);

@ -13,7 +13,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "ASCIIHexDecode.h"
#include <QtGlobal>
#include <string>
#include "Utils.h"
@ -42,6 +42,12 @@ static unsigned int convertHexVal(unsigned char c)
return 0;
}
bool ASCIIHexDecode::encode(std::string & decoded)
{
Q_UNUSED(decoded);
return false;
}
bool ASCIIHexDecode::decode(std::string & encoded)
{
bool isLow = true;
@ -75,3 +81,8 @@ bool ASCIIHexDecode::decode(std::string & encoded)
encoded = decoded;
return true;
}
void ASCIIHexDecode::initialize(Object * objectWithStram)
{
Q_UNUSED(objectWithStram);
}

@ -26,9 +26,9 @@ namespace merge_lib
public:
ASCIIHexDecode(){};
virtual ~ASCIIHexDecode(){};
bool encode(std::string & decoded){return false;}
bool encode(std::string & decoded);
bool decode(std::string & encoded);
void initialize(Object * objectWithStram){};
void initialize(Object * objectWithStram);
};
}

@ -0,0 +1,36 @@
/*
* 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/>.
*/
#include <QtGlobal>
#include "CCITTFaxDecode.h"
using namespace merge_lib;
bool CCITTFaxDecode::encode(std::string & decoded)
{
Q_UNUSED(decoded);
return true;
}
bool CCITTFaxDecode::decode(std::string & encoded)
{
Q_UNUSED(encoded);
return true;
}
void CCITTFaxDecode::initialize(Object * objectWithStram)
{
Q_UNUSED(objectWithStram);
}

@ -16,6 +16,8 @@
#define CCITTFaxDecode_H
#include <string>
#include "Decoder.h"
namespace merge_lib
{
// this class provides method for FlateDecode encoding and decoding
@ -24,9 +26,9 @@ namespace merge_lib
public:
CCITTFaxDecode(){};
virtual ~CCITTFaxDecode(){};
bool encode(std::string & decoded) {return true;};
bool decode(std::string & encoded) {return true;};
void initialize(Object * objectWithStram){};
bool encode(std::string & decoded);
bool decode(std::string & encoded);
void initialize(Object * objectWithStram);
};
}

@ -12,6 +12,7 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "ContentHandler.h"
#include "Filter.h"
#include "FlateDecode.h"

@ -0,0 +1,36 @@
/*
* 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/>.
*/
#include <QtGlobal>
#include "DCTDecode.h"
using namespace merge_lib;
bool DCTDecode::encode(std::string & decoded)
{
Q_UNUSED(decoded);
return true;
}
bool DCTDecode::decode(std::string & encoded)
{
Q_UNUSED(encoded);
return true;
}
void DCTDecode::initialize(Object * objectWithStram)
{
Q_UNUSED(objectWithStram);
}

@ -16,7 +16,7 @@
#define DCTDecode_H
#include <string>
#include "Decoder.h"
namespace merge_lib
{
// this class provides method for FlateDecode encoding and decoding
@ -25,9 +25,9 @@ namespace merge_lib
public:
DCTDecode(){};
virtual ~DCTDecode(){};
bool encode(std::string & decoded) {return true;};
bool decode(std::string & encoded) {return true;};
void initialize(Object * objectWithStram){};
bool encode(std::string & decoded);
bool decode(std::string & encoded);
void initialize(Object * objectWithStram);
};
}

@ -28,7 +28,8 @@
using namespace merge_lib;
const std::string firstObj("%PDF-1.4\n1 0 obj\n<<\n/Title ()/Creator ()/Producer (Qt 4.5.0 (C) 1992-2009 Nokia Corporation and/or its subsidiary(-ies))/CreationDate (D:20090424120829)\n>>\nendobj\n");
const std::string zeroStr("0000000000");
Document::Document(const char * fileName): _pages(), _maxObjectNumber(0),_root(0),_documentName(fileName)
Document::Document(const char * fileName):
_root(0), _pages(), _documentName(fileName), _maxObjectNumber(0)
{
}

@ -15,6 +15,7 @@
#include "Config.h"
#include <iostream>
#include <map>
#include <QtGlobal>
#include "FilterPredictor.h"
#include "Utils.h"
@ -49,6 +50,12 @@ FilterPredictor::~FilterPredictor()
{
}
bool FilterPredictor::encode(std::string & decoded)
{
Q_UNUSED(decoded);
return false;
}
std::string FilterPredictor::getDictionaryContentStr(std::string & in, size_t &pos )
{
size_t beg = in.find(DICT_START_TOKEN,pos);

@ -27,7 +27,7 @@ namespace merge_lib
public:
FilterPredictor();
virtual ~FilterPredictor();
bool encode(std::string & decoded){return false;}
bool encode(std::string & decoded);
bool decode(std::string & encoded);
void initialize(Object * objectWithStream);

@ -0,0 +1,36 @@
/*
* 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/>.
*/
#include <QtGlobal>
#include "JBIG2Decode.h"
using namespace merge_lib;
bool JBIG2Decode::encode(std::string & decoded)
{
Q_UNUSED(decoded);
return true;
}
bool JBIG2Decode::decode(std::string & encoded)
{
Q_UNUSED(encoded);
return true;
}
void JBIG2Decode::initialize(Object * objectWithStram)
{
Q_UNUSED(objectWithStram);
}

@ -16,6 +16,7 @@
#define JBIG2Decode_H
#include <string>
#include "Decoder.h"
namespace merge_lib
{
@ -25,9 +26,9 @@ namespace merge_lib
public:
JBIG2Decode(){};
virtual ~JBIG2Decode(){};
bool encode(std::string & decoded) {return true;};
bool decode(std::string & encoded) {return true;};
void initialize(Object * objectWithStram){};
bool encode(std::string & decoded);
bool decode(std::string & encoded);
void initialize(Object * objectWithStram);
};
}

@ -13,6 +13,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <iostream>
#include <QtGlobal>
#include "LZWDecode.h"
#include "FilterPredictor.h"
@ -31,8 +32,9 @@ LZWDecode::LZWDecode():
_readBits(0),
_nextCode(0),
_bitsToRead(0),
_curSequenceLength(0),
_first(true)
_first(true),
_curSequenceLength(0)
{
clearTable();
}
@ -44,6 +46,12 @@ LZWDecode::~LZWDecode()
}
}
bool LZWDecode::encode(std::string & decoded)
{
Q_UNUSED(decoded);
return true;
}
void LZWDecode::initialize(Object * objectWithStream)
{
if( objectWithStream )

@ -27,7 +27,7 @@ namespace merge_lib
public:
LZWDecode();
virtual ~LZWDecode();
bool encode(std::string & decoded) {return true;};
bool encode(std::string & decoded);
bool decode(std::string & encoded);
void initialize(Object * objectWithStram);
private:
@ -37,8 +37,8 @@ namespace merge_lib
void clearTable();
int getCode();
std::string &_encoded;
std::string _dummy;
std::string &_encoded;
size_t _curSymbolIndex;
int _earlyChange; // early parameter

@ -15,6 +15,7 @@
#include "OverlayDocumentParser.h"
#include <fstream>
#include <string.h>
#include <QtGlobal>
#include "Exception.h"
#include "Object.h"
@ -74,7 +75,6 @@ void OverlayDocumentParser::_readXRefAndCreateObjects()
notEndOfFile = false;
}
unsigned long toReadAgain = 0;
for(objIter = objectsAndPositions.begin(); objIter != objectsAndPositions.end(); )
{
if((objectsAndSizes[objIter->first] + objIter->second <= nextPartStart) && (objIter->second >= partStart) && ((objIter->second < nextPartStart)))
@ -100,6 +100,11 @@ void OverlayDocumentParser::_readXRefAndCreateObjects()
while(notEndOfFile);
}
void OverlayDocumentParser::_getFileContent(const char * fileName)
{
Q_UNUSED(fileName);
}
void OverlayDocumentParser::_getPartOfFileContent(long startOfPart, unsigned int length)
{
ifstream pdfFile;

@ -38,7 +38,7 @@ namespace merge_lib
private:
//methods
void _getFileContent(const char * fileName){};
void _getFileContent(const char * fileName);
void _readXRefAndCreateObjects();
void _readXref(std::map<unsigned int, unsigned long> & objectsAndSizes);
void _getPartOfFileContent(long startOfPart, unsigned int length);

@ -37,7 +37,7 @@
using namespace merge_lib;
Page::Page(unsigned int pageNumber): _pageNumber(pageNumber),_root(NULL), _rotation(0)
Page::Page(unsigned int pageNumber): _root(NULL),_pageNumber(pageNumber), _rotation(0)
{
}

@ -12,8 +12,9 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "PageElementHandler.h"
#include "PageElementHandler.h"
#include <QtGlobal>
#include "core/memcheck.h"
using namespace merge_lib;
@ -88,3 +89,8 @@ unsigned int PageElementHandler::_findEndOfElementContent(unsigned int startOfPa
}
return _pageContent.rfind(">>");
}
void PageElementHandler::_processObjectContent(unsigned int startOfPageElement)
{
Q_UNUSED(startOfPageElement);
}

@ -73,14 +73,14 @@ namespace merge_lib
void _createAllPageFieldsSet();
//members
std::string & _pageContent;
Object * _page;
std::string & _pageContent;
std::string _handlerName;
PageElementHandler * _nextHandler;
private:
//methods
virtual void _processObjectContent(unsigned int startOfPageElement){};
virtual void _processObjectContent(unsigned int startOfPageElement);
virtual void _changeObjectContent(unsigned int startOfPageElement) = 0;
virtual void _pageElementNotFound() {};
unsigned int _findStartOfPageElement()

@ -24,21 +24,21 @@
using namespace merge_lib;
Rectangle::Rectangle(const char * rectangleName):
_rectangleName(rectangleName),
x1(0),
y1(0),
x2(0),
y2(0),
_rectangleName(rectangleName),
_tm()
{}
Rectangle::Rectangle(const char * rectangleName, const std::string content):
_rectangleName(rectangleName),
x1(0),
y1(0),
x2(0),
y2(0)
y2(0),
_rectangleName(rectangleName)
{
unsigned int rectanglePosition = Parser::findToken(content,rectangleName);

@ -40,7 +40,7 @@ namespace merge_lib
double getHeight();
//members
double x1, x2, y1, y2;
double x1, y1, x2, y2;
private:
//methods
const std::string _getRectangleAsString(const char * delimeter);

@ -15,6 +15,8 @@
#if !defined RotationHandler_h
#define RotationHandler_h
#include <QtGlobal>
#include "PageElementHandler.h"
#include "Page.h"
@ -55,7 +57,7 @@ namespace merge_lib
strin>>rotation;
_basePage.setRotation(rotation);
}
virtual void _changeObjectContent(unsigned int startOfPageElement) {};
virtual void _changeObjectContent(unsigned int startOfPageElement) {Q_UNUSED(startOfPageElement);};
//members
Page & _basePage;

@ -12,12 +12,19 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "RunLengthDecode.h"
#include "RunLengthDecode.h"
#include <QtGlobal>
#include "core/memcheck.h"
using namespace merge_lib;
bool RunLengthDecode::encode(std::string & decoded)
{
Q_UNUSED(decoded);
return false;
}
/* The encoded data is a sequence of
runs, where each run consists of a length byte followed by 1 to 128 bytes of data. If
the length byte is in the range 0 to 127, the following length + 1 (1 to 128) bytes
@ -57,3 +64,8 @@ bool RunLengthDecode::decode(std::string & encoded)
}
return true;
}
void RunLengthDecode::initialize(Object * objectWithStream)
{
Q_UNUSED(objectWithStream);
};

@ -26,9 +26,9 @@ namespace merge_lib
public:
RunLengthDecode(){};
virtual ~RunLengthDecode(){};
bool encode(std::string & decoded){return false;}
bool encode(std::string & decoded);
bool decode(std::string & encoded);
void initialize(Object * objectWithStream){};
void initialize(Object * objectWithStream);
};
}

@ -12,6 +12,8 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <QtGlobal>
#include "Config.h"
#include "Utils.h"
#include "Exception.h"
@ -101,6 +103,7 @@ bool Utils::doubleEquals(const double left, const double right, const double eps
double Utils::normalizeValue(double &val, const double epsilon )
{
Q_UNUSED(epsilon);
if( Utils::doubleEquals(val,0))
{
val = 0;

@ -54,7 +54,10 @@ SOURCES += \
RemoveHimselfHandler.cpp \
RunLengthDecode.cpp \
Utils.cpp \
OverlayDocumentParser.cpp
OverlayDocumentParser.cpp \
src/pdf-merger/CCITTFaxDecode.cpp \
src/pdf-merger/JBIG2Decode.cpp \
src/pdf-merger/DCTDecode.cpp
macx {
@ -82,3 +85,6 @@ linux-g++-64 {
LIBS += -lz
}

@ -18,10 +18,15 @@
#include <QImage>
#include "PDFRenderer.h"
#include <splash/SplashBitmap.h>
#include "globals/UBGlobals.h"
THIRD_PARTY_WARNINGS_DISABLE
#include <xpdf/Object.h>
#include <xpdf/GlobalParams.h>
#include <xpdf/SplashOutputDev.h>
#include <xpdf/PDFDoc.h>
THIRD_PARTY_WARNINGS_ENABLE
class PDFDoc;

@ -112,6 +112,7 @@ void UBYouTubePublisher::postClientLoginRequest(const QString& userName, const Q
void UBYouTubePublisher::postClientLoginResponse(bool success, const QByteArray& pPayload)
{
Q_UNUSED(success);
mAuthToken = "";
QString auth = QString::fromUtf8(pPayload);
@ -136,7 +137,7 @@ void UBYouTubePublisher::postClientLoginResponse(bool success, const QByteArray&
if(mAuthToken.length() == 0)
{
UBApplication::showMessage(tr("YouTube authentication failed."));
success = false;
// success = false;
deleteLater();
}
else

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save