Merge branch 'master' into widget_fix

preferencesAboutTextFull
Yimgo 12 years ago
commit 244c5c07b9
  1. BIN
      JournalDesModifications.pdf
  2. BIN
      ReleaseNotes.pdf
  3. 14
      Sankore_3.1.pro
  4. 23
      release.win7.vc9.bat
  5. 16
      resources/etc/freezedWidgetWrapper.html
  6. BIN
      resources/etc/img/loading.gif
  7. 33
      resources/library/applications/Calculatrice.wgt/js/ubw-main.js
  8. 13
      resources/library/interactivities/Ass images.wgt/css/basic.css
  9. 1
      resources/library/interactivities/Ass sons.wgt/css/basic.css
  10. 6
      resources/library/interactivities/Cat images.wgt/css/basic.css
  11. BIN
      resources/library/interactivities/Cat images.wgt/img/minus.png
  12. BIN
      resources/library/interactivities/Cat images.wgt/img/plus.png
  13. 15
      resources/library/interactivities/Cat images.wgt/js/script.js
  14. 12
      resources/library/interactivities/Cat images.wgt/locales/fr/js/script.js
  15. 12
      resources/library/interactivities/Cat images.wgt/locales/ru/js/script.js
  16. 10
      resources/library/interactivities/Choisir.wgt/css/basic.css
  17. 3
      resources/library/interactivities/Ordre images.wgt/css/basic.css
  18. 8
      resources/library/interactivities/Ordre lettres.wgt/css/basic.css
  19. 2
      resources/library/interactivities/Ordre lettres.wgt/js/script.js
  20. 2
      resources/library/interactivities/Ordre lettres.wgt/locales/fr/js/script.js
  21. BIN
      resources/library/interactivities/Ordre lettres.wgt/locales/fr/objects/exemple.mp3
  22. 2
      resources/library/interactivities/Ordre lettres.wgt/locales/ru/js/script.js
  23. BIN
      resources/library/interactivities/Ordre lettres.wgt/locales/ru/objects/example.mp3
  24. BIN
      resources/library/interactivities/Ordre lettres.wgt/objects/beep.mp3
  25. 1
      resources/library/interactivities/Selectionner.wgt/css/basic.css
  26. 4
      src/board/UBBoardPaletteManager.cpp
  27. 225
      src/board/UBFeaturesController.cpp
  28. 14
      src/board/UBFeaturesController.h
  29. 6
      src/domain/UBAbstractWidget.cpp
  30. 1
      src/gui/UBDocumentNavigator.cpp
  31. 61
      src/gui/UBFeaturesWidget.cpp
  32. 5
      src/gui/UBFeaturesWidget.h
  33. 16
      src/gui/UBLibraryWidget.cpp
  34. 1
      src/gui/UBLibraryWidget.h
  35. 2
      src/gui/UBTeacherGuideWidget.cpp

Binary file not shown.

Binary file not shown.

@ -11,10 +11,20 @@ linux-g++-64 {
CONFIG += link_prl CONFIG += link_prl
} }
linux-g++-32 {
CONFIG += link_prl
}
linux-g++ {
CONFIG += link_prl
}
VERSION_MAJ = 2 VERSION_MAJ = 2
VERSION_MIN = 00 VERSION_MIN = 00
VERSION_TYPE = b # a = alpha, b = beta, r = release, other => error VERSION_TYPE = b # a = alpha, b = beta, r = release, other => error
VERSION_PATCH = 01 VERSION_PATCH = 02
VERSION = "$${VERSION_MAJ}.$${VERSION_MIN}.$${VERSION_TYPE}.$${VERSION_PATCH}" VERSION = "$${VERSION_MAJ}.$${VERSION_MIN}.$${VERSION_TYPE}.$${VERSION_PATCH}"
VERSION = $$replace(VERSION, "\\.r", "") VERSION = $$replace(VERSION, "\\.r", "")
@ -352,6 +362,7 @@ macx {
linux-g++ { linux-g++ {
LIBS += -lcrypto LIBS += -lcrypto
LIBS += -lX11
QMAKE_CFLAGS += -fopenmp QMAKE_CFLAGS += -fopenmp
QMAKE_CXXFLAGS += -fopenmp QMAKE_CXXFLAGS += -fopenmp
QMAKE_LFLAGS += -fopenmp QMAKE_LFLAGS += -fopenmp
@ -367,6 +378,7 @@ linux-g++ {
linux-g++-32 { linux-g++-32 {
LIBS += -lcrypto LIBS += -lcrypto
LIBS += -lX11
QMAKE_CFLAGS += -fopenmp QMAKE_CFLAGS += -fopenmp
QMAKE_CXXFLAGS += -fopenmp QMAKE_CXXFLAGS += -fopenmp
QMAKE_LFLAGS += -fopenmp QMAKE_LFLAGS += -fopenmp

@ -1,7 +1,7 @@
REM -------------------------------------------------------------------- REM --------------------------------------------------------------------
REM This program is free software: you can redistribute it and/or modify REM This program is free software: you can redistribute it and/or modify
REM it under the terms of the GNU General Public License as published by REM it under the terms of the GNU General Public License as published by
REM the Free Software Foundation, either version 3 of the License, or REM the Free Software Foundation, either version 2 of the License, or
REM (at your option) any later version. REM (at your option) any later version.
REM REM
REM This program is distributed in the hope that it will be useful, REM This program is distributed in the hope that it will be useful,
@ -18,6 +18,7 @@ set QT_BIN=%QT_DIR%\bin
set PROGRAMS_FILE_PATH=C:\Program Files set PROGRAMS_FILE_PATH=C:\Program Files
set SEVEN_ZIP_EXE="%PROGRAMS_FILE_PATH%\7-Zip\7z.exe"
set GIT_BIN=%PROGRAMS_FILE_PATH%\Git\bin set GIT_BIN=%PROGRAMS_FILE_PATH%\Git\bin
set VS_BIN=%PROGRAMS_FILE_PATH%\Microsoft Visual Studio 9.0\VC\bin set VS_BIN=%PROGRAMS_FILE_PATH%\Microsoft Visual Studio 9.0\VC\bin
set WIN_SDK_BIN=%PROGRAMS_FILE_PATH%\Microsoft SDKs\Windows\v6.0A\Bin set WIN_SDK_BIN=%PROGRAMS_FILE_PATH%\Microsoft SDKs\Windows\v6.0A\Bin
@ -46,7 +47,9 @@ set EDITION=MNEMIS_EDITION
%LRELEASE% Sankore_3.1.pro %LRELEASE% Sankore_3.1.pro
%LRELEASE% %BASE_QT_TRANSLATIONS_DIRECTORY%\translations.pro %LRELEASE% %BASE_QT_TRANSLATIONS_DIRECTORY%\translations.pro
REM set /p VERSION= < build\win32\release\version set /p VERSION= < build\win32\release\version
REM remove the last character that is a space
set VERSION=%VERSION: =%
REM git rev-list --tags --max-count=1 > tmp REM git rev-list --tags --max-count=1 > tmp
REM set /p LAST_TAG= < tmp REM set /p LAST_TAG= < tmp
REM erase tmp REM erase tmp
@ -78,3 +81,19 @@ set INSTALLER_PATH=.\install\win32\%INSTALLER_NAME%.exe
call "%INNO_EXE%" "Sankore 3.1.iss" /F"%INSTALLER_NAME%" call "%INNO_EXE%" "Sankore 3.1.iss" /F"%INSTALLER_NAME%"
set INSTALL_DIRECTORY=install\win32\
xcopy *.pdf %INSTALL_DIRECTORY%
cd %INSTALL_DIRECTORY%
call %SEVEN_ZIP_EXE% a Open-Sankor‚_Windows_%VERSION%.zip *.exe *.pdf
cd ..\..\
GOTO END
:EXIT_WITH_ERROR
echo "Error found"
GOTO :EOF
:END
echo "Open-Sankore's build finished"
:EOF

@ -9,9 +9,19 @@
width: 100%; width: 100%;
} }
div{ #freezed{
text-align: center; text-align: center;
border: 5px #ccc outset; border: 5px solid #ccc;
border-radius: 80px;
box-shadow: inset 0 0 30px rgba(66,66,66,0.5);
}
.loading{
color: #999;
font-weight: bold;
font-size: large;
margin-top: 5px;
margin-left: 5px;
} }
</style> </style>
<script type="text/javascript"> <script type="text/javascript">
@ -42,6 +52,6 @@
</script> </script>
</head> </head>
<body> <body>
<div id="freezed">Widget freezed.</div> <div id="freezed"><img src="img/loading.gif"/><div class="loading">Loading ...</div></div>
</body> </body>
</html> </html>

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

@ -350,7 +350,6 @@ function init(){
function compute(){ function compute(){
var result; var result;
//alert(calc)
if(calc.length <= 1) if(calc.length <= 1)
result = eval(calc); result = eval(calc);
else{ else{
@ -362,7 +361,6 @@ function init(){
operation = (calc.indexOf("+", 0) != -1)?calc.charAt(calc.indexOf("+", 0)):((calc.indexOf("*", 0) != -1)?calc.charAt(calc.indexOf("*", 0)):((calc.indexOf("/", 0) != -1)?calc.charAt(calc.indexOf("/", 0)):((calc.indexOf("-", 0) != -1)?calc.charAt(calc.indexOf("-", 0)):""))); operation = (calc.indexOf("+", 0) != -1)?calc.charAt(calc.indexOf("+", 0)):((calc.indexOf("*", 0) != -1)?calc.charAt(calc.indexOf("*", 0)):((calc.indexOf("/", 0) != -1)?calc.charAt(calc.indexOf("/", 0)):((calc.indexOf("-", 0) != -1)?calc.charAt(calc.indexOf("-", 0)):"")));
fNumber = fMinus + calc.substring(0, calc.indexOf(operation, 0)); fNumber = fMinus + calc.substring(0, calc.indexOf(operation, 0));
lNumber = calc.substring(calc.indexOf(operation, 0)+1, calc.length); lNumber = calc.substring(calc.indexOf(operation, 0)+1, calc.length);
//alert(fNumber + " | " + operation + " | " + lNumber)
result = calcIt(fNumber, operation, lNumber); result = calcIt(fNumber, operation, lNumber);
} }
@ -391,10 +389,10 @@ function init(){
lCount = (lNumber.indexOf(".", 0) != -1)?lNumber.substring(lNumber.indexOf(".", 0)+1, lNumber.length):""; lCount = (lNumber.indexOf(".", 0) != -1)?lNumber.substring(lNumber.indexOf(".", 0)+1, lNumber.length):"";
length = (fCount.length >= lCount.length)?fCount.length:lCount.length; length = (fCount.length >= lCount.length)?fCount.length:lCount.length;
length = Math.pow(10, length); length = Math.pow(10, length);
fNumber = fNumber * length; fNumber = Math.round(fNumber * length);
lNumber = lNumber * length; lNumber = Math.round(lNumber * length);
switch(operation){ switch(operation){
case "+": case "+":
result = (fNumber + lNumber)/length; result = (fNumber + lNumber)/length;
break; break;
case "-": case "-":
@ -516,10 +514,27 @@ function init(){
displayTrunk = displayTrunk.substr(0, displayTrunk.length-1); displayTrunk = displayTrunk.substr(0, displayTrunk.length-1);
}; };
calc += String(char); if(calc == "0"){
displayTrunk += String(char); if(char != "0"){
historyTrunk += String(char); if(char != "."){
lastchar.type = "Number"; calc = String(char);
displayTrunk = String(char);
historyTrunk = String(char);
lastchar.type = "Number";
} else{
calc += String(char);
displayTrunk += String(char);
historyTrunk += String(char);
lastchar.type = "Number";
}
}
} else {
char = (char == ".")?((displayTrunk.indexOf(".", 0) != -1)?"":"."):char;
calc += String(char);
displayTrunk += String(char);
historyTrunk += String(char);
lastchar.type = "Number";
}
} }
// char is an operator // char is an operator
else { else {

@ -64,7 +64,7 @@ body{
.sub_cont{ .sub_cont{
width: 100%; width: 100%;
padding: 0; padding: 0;
margin: 20px 0 0 0; margin: 20px 0 5px 0;
min-height: 60px; min-height: 60px;
} }
@ -84,7 +84,7 @@ body{
} }
.imgs_answers_gray{ .imgs_answers_gray{
} }
.imgs_answers_green{ .imgs_answers_green{
@ -114,11 +114,12 @@ body{
min-height: 40px; min-height: 40px;
max-height: 60px; max-height: 60px;
float: right; float: right;
overflow: auto; overflow-x: hidden;
background-color: #ccc; background-color: #ccc;
border-top-left-radius: 10px; border-top-left-radius: 10px;
border-bottom-left-radius: 10px; border-bottom-left-radius: 10px;
padding-left: 10px; padding-left: 10px;
word-break: break-all;
} }
.close_cont{ .close_cont{
@ -207,7 +208,7 @@ body{
} }
.dropBack{ .dropBack{
} }
/* new design */ /* new design */
@ -417,5 +418,5 @@ body{
} }
.open{ .open{
} }

@ -218,6 +218,7 @@ body{
overflow-x: hidden; overflow-x: hidden;
float: right; float: right;
margin-left: 20px; margin-left: 20px;
word-break: break-all;
} }
.play, .stop{ .play, .stop{

@ -150,16 +150,16 @@ body{
height: 30px; height: 30px;
float: right; float: right;
cursor: pointer; cursor: pointer;
background-color: white; background-color: transparent;
border: none; border: none;
} }
.del_category{ .del_category{
background-image: url(../img/minus.png);
} }
.add_category{ .add_category{
background-image: url(../img/plus.png);
} }
.cat_desc{ .cat_desc{

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

@ -5,7 +5,7 @@ var sankoreLang = {
second_desc: "Even numbers", second_desc: "Even numbers",
enter: "Enter your category name here ...", enter: "Enter your category name here ...",
add: "Add new block", add: "Add new block",
wgt_name: "Order images", wgt_name: "Categorize images",
reload: "Reload", reload: "Reload",
slate: "Wood", slate: "Wood",
pad: "Pad", pad: "Pad",
@ -160,8 +160,8 @@ function start(){
$("<div class='close_cont'>").appendTo(container); $("<div class='close_cont'>").appendTo(container);
container.find(".imgs_cont").each(function(){ container.find(".imgs_cont").each(function(){
$("<button class='del_category'>-</button>").appendTo($(this)); $("<button class='del_category'></button>").appendTo($(this));
$("<button class='add_category'>+</button>").appendTo($(this)); $("<button class='add_category'></button>").appendTo($(this));
$(this).attr("ondragenter", "return false;") $(this).attr("ondragenter", "return false;")
.attr("ondragleave", "$(this).css(\"background-color\",\"#E6F6FF\"); return false;") .attr("ondragleave", "$(this).css(\"background-color\",\"#E6F6FF\"); return false;")
.attr("ondragover", "$(this).css(\"background-color\",\"#C3E9FF\"); return false;") .attr("ondragover", "$(this).css(\"background-color\",\"#C3E9FF\"); return false;")
@ -558,8 +558,8 @@ function addCategory(obj){
$("<input type='hidden' name='count' value=''/>").appendTo(imgs_container); $("<input type='hidden' name='count' value=''/>").appendTo(imgs_container);
var tmp_div = $("<div style='width: 100%; overflow: hidden;'>").appendTo(imgs_container); var tmp_div = $("<div style='width: 100%; overflow: hidden;'>").appendTo(imgs_container);
$("<input type='text' class='cat_desc' value='" + sankoreLang.enter + "'>").appendTo(tmp_div); $("<input type='text' class='cat_desc' value='" + sankoreLang.enter + "'>").appendTo(tmp_div);
$("<button class='del_category'>-</button>").appendTo(imgs_container); $("<button class='del_category'></button>").appendTo(imgs_container);
$("<button class='add_category'>+</button>").appendTo(imgs_container); $("<button class='add_category'></button>").appendTo(imgs_container);
imgs_container.attr("ondragenter", "return false;") imgs_container.attr("ondragenter", "return false;")
.attr("ondragleave", "$(this).css(\"background-color\",\"\"); return false;") .attr("ondragleave", "$(this).css(\"background-color\",\"\"); return false;")
.attr("ondragover", "$(this).css(\"background-color\",\"\"); return false;") .attr("ondragover", "$(this).css(\"background-color\",\"\"); return false;")
@ -579,8 +579,8 @@ function addContainer(){
$("<input type='hidden' name='count' value=''/>").appendTo(imgs_container); $("<input type='hidden' name='count' value=''/>").appendTo(imgs_container);
var tmp_div = $("<div style='width: 100%; overflow: hidden;'>").appendTo(imgs_container); var tmp_div = $("<div style='width: 100%; overflow: hidden;'>").appendTo(imgs_container);
$("<input type='text' class='cat_desc' value='" + sankoreLang.enter + "'/>").appendTo(tmp_div); $("<input type='text' class='cat_desc' value='" + sankoreLang.enter + "'/>").appendTo(tmp_div);
$("<button class='del_category'>-</button>").appendTo(imgs_container); $("<button class='del_category'></button>").appendTo(imgs_container);
$("<button class='add_category'>+</button>").appendTo(imgs_container); $("<button class='add_category'></button>").appendTo(imgs_container);
imgs_container.attr("ondragenter", "return false;") imgs_container.attr("ondragenter", "return false;")
.attr("ondragleave", "$(this).css(\"background-color\",\"#e6f6ff\"); return false;") .attr("ondragleave", "$(this).css(\"background-color\",\"#e6f6ff\"); return false;")
.attr("ondragover", "$(this).css(\"background-color\",\"#c3e9ff\"); return false;") .attr("ondragover", "$(this).css(\"background-color\",\"#c3e9ff\"); return false;")
@ -787,7 +787,6 @@ function onDropTarget(obj, event) {
} }
} }
} }
exportData();
} }
else { else {
alert ("Your browser does not support the dataTransfer object."); alert ("Your browser does not support the dataTransfer object.");

@ -158,8 +158,8 @@ function start(){
$("<div class='close_cont'>").appendTo(container); $("<div class='close_cont'>").appendTo(container);
container.find(".imgs_cont").each(function(){ container.find(".imgs_cont").each(function(){
$("<button class='del_category'>-</button>").appendTo($(this)); $("<button class='del_category'></button>").appendTo($(this));
$("<button class='add_category'>+</button>").appendTo($(this)); $("<button class='add_category'></button>").appendTo($(this));
$(this).attr("ondragenter", "return false;") $(this).attr("ondragenter", "return false;")
.attr("ondragleave", "$(this).css(\"background-color\",\"#E6F6FF\"); return false;") .attr("ondragleave", "$(this).css(\"background-color\",\"#E6F6FF\"); return false;")
.attr("ondragover", "$(this).css(\"background-color\",\"#C3E9FF\"); return false;") .attr("ondragover", "$(this).css(\"background-color\",\"#C3E9FF\"); return false;")
@ -556,8 +556,8 @@ function addCategory(obj){
$("<input type='hidden' name='count' value=''/>").appendTo(imgs_container); $("<input type='hidden' name='count' value=''/>").appendTo(imgs_container);
var tmp_div = $("<div style='width: 100%; overflow: hidden;'>").appendTo(imgs_container); var tmp_div = $("<div style='width: 100%; overflow: hidden;'>").appendTo(imgs_container);
$("<input type='text' class='cat_desc' value='" + sankoreLang.enter + "'>").appendTo(tmp_div); $("<input type='text' class='cat_desc' value='" + sankoreLang.enter + "'>").appendTo(tmp_div);
$("<button class='del_category'>-</button>").appendTo(imgs_container); $("<button class='del_category'></button>").appendTo(imgs_container);
$("<button class='add_category'>+</button>").appendTo(imgs_container); $("<button class='add_category'></button>").appendTo(imgs_container);
imgs_container.attr("ondragenter", "return false;") imgs_container.attr("ondragenter", "return false;")
.attr("ondragleave", "$(this).css(\"background-color\",\"\"); return false;") .attr("ondragleave", "$(this).css(\"background-color\",\"\"); return false;")
.attr("ondragover", "$(this).css(\"background-color\",\"\"); return false;") .attr("ondragover", "$(this).css(\"background-color\",\"\"); return false;")
@ -577,8 +577,8 @@ function addContainer(){
$("<input type='hidden' name='count' value=''/>").appendTo(imgs_container); $("<input type='hidden' name='count' value=''/>").appendTo(imgs_container);
var tmp_div = $("<div style='width: 100%; overflow: hidden;'>").appendTo(imgs_container); var tmp_div = $("<div style='width: 100%; overflow: hidden;'>").appendTo(imgs_container);
$("<input type='text' class='cat_desc' value='" + sankoreLang.enter + "'/>").appendTo(tmp_div); $("<input type='text' class='cat_desc' value='" + sankoreLang.enter + "'/>").appendTo(tmp_div);
$("<button class='del_category'>-</button>").appendTo(imgs_container); $("<button class='del_category'></button>").appendTo(imgs_container);
$("<button class='add_category'>+</button>").appendTo(imgs_container); $("<button class='add_category'></button>").appendTo(imgs_container);
imgs_container.attr("ondragenter", "return false;") imgs_container.attr("ondragenter", "return false;")
.attr("ondragleave", "$(this).css(\"background-color\",\"\"); return false;") .attr("ondragleave", "$(this).css(\"background-color\",\"\"); return false;")
.attr("ondragover", "$(this).css(\"background-color\",\"\"); return false;") .attr("ondragover", "$(this).css(\"background-color\",\"\"); return false;")

@ -158,8 +158,8 @@ function start(){
$("<div class='close_cont'>").appendTo(container); $("<div class='close_cont'>").appendTo(container);
container.find(".imgs_cont").each(function(){ container.find(".imgs_cont").each(function(){
$("<button class='del_category'>-</button>").appendTo($(this)); $("<button class='del_category'></button>").appendTo($(this));
$("<button class='add_category'>+</button>").appendTo($(this)); $("<button class='add_category'></button>").appendTo($(this));
$(this).attr("ondragenter", "return false;") $(this).attr("ondragenter", "return false;")
.attr("ondragleave", "$(this).css(\"background-color\",\"#E6F6FF\"); return false;") .attr("ondragleave", "$(this).css(\"background-color\",\"#E6F6FF\"); return false;")
.attr("ondragover", "$(this).css(\"background-color\",\"#C3E9FF\"); return false;") .attr("ondragover", "$(this).css(\"background-color\",\"#C3E9FF\"); return false;")
@ -559,8 +559,8 @@ function addCategory(obj){
$("<input type='hidden' name='count' value=''/>").appendTo(imgs_container); $("<input type='hidden' name='count' value=''/>").appendTo(imgs_container);
var tmp_div = $("<div style='width: 100%; overflow: hidden;'>").appendTo(imgs_container); var tmp_div = $("<div style='width: 100%; overflow: hidden;'>").appendTo(imgs_container);
$("<input type='text' class='cat_desc' value='" + sankoreLang.enter + "'>").appendTo(tmp_div); $("<input type='text' class='cat_desc' value='" + sankoreLang.enter + "'>").appendTo(tmp_div);
$("<button class='del_category'>-</button>").appendTo(imgs_container); $("<button class='del_category'></button>").appendTo(imgs_container);
$("<button class='add_category'>+</button>").appendTo(imgs_container); $("<button class='add_category'></button>").appendTo(imgs_container);
imgs_container.attr("ondragenter", "return false;") imgs_container.attr("ondragenter", "return false;")
.attr("ondragleave", "$(this).css(\"background-color\",\"\"); return false;") .attr("ondragleave", "$(this).css(\"background-color\",\"\"); return false;")
.attr("ondragover", "$(this).css(\"background-color\",\"\"); return false;") .attr("ondragover", "$(this).css(\"background-color\",\"\"); return false;")
@ -580,8 +580,8 @@ function addContainer(){
$("<input type='hidden' name='count' value=''/>").appendTo(imgs_container); $("<input type='hidden' name='count' value=''/>").appendTo(imgs_container);
var tmp_div = $("<div style='width: 100%; overflow: hidden;'>").appendTo(imgs_container); var tmp_div = $("<div style='width: 100%; overflow: hidden;'>").appendTo(imgs_container);
$("<input type='text' class='cat_desc' value='" + sankoreLang.enter + "'/>").appendTo(tmp_div); $("<input type='text' class='cat_desc' value='" + sankoreLang.enter + "'/>").appendTo(tmp_div);
$("<button class='del_category'>-</button>").appendTo(imgs_container); $("<button class='del_category'></button>").appendTo(imgs_container);
$("<button class='add_category'>+</button>").appendTo(imgs_container); $("<button class='add_category'></button>").appendTo(imgs_container);
imgs_container.attr("ondragenter", "return false;") imgs_container.attr("ondragenter", "return false;")
.attr("ondragleave", "$(this).css(\"background-color\",\"\"); return false;") .attr("ondragleave", "$(this).css(\"background-color\",\"\"); return false;")
.attr("ondragover", "$(this).css(\"background-color\",\"\"); return false;") .attr("ondragover", "$(this).css(\"background-color\",\"\"); return false;")

@ -149,12 +149,10 @@ body{
font-family: Verdana,Arial,Helvetica,sans-serif; font-family: Verdana,Arial,Helvetica,sans-serif;
font-size: small; font-size: small;
border: 3px solid #ccc; border: 3px solid #ccc;
-webkit-border-radius: 5px;
border-radius: 5px; border-radius: 5px;
-moz-box-shadow: #dadada -1px 0 4px;
-webkit-box-shadow: #dadada -1px 0 4px;
box-shadow: #dadada -1px 0 4px; box-shadow: #dadada -1px 0 4px;
color: white; color: white;
word-break: break-all;
} }
.qstContentDisplay{ .qstContentDisplay{
@ -169,6 +167,7 @@ body{
border: 1px solid #DFDFDE; border: 1px solid #DFDFDE;
border-top-left-radius: 10px; border-top-left-radius: 10px;
border-bottom-left-radius: 10px; border-bottom-left-radius: 10px;
word-break: break-all;
} }
.ansDiv{ .ansDiv{
@ -222,12 +221,10 @@ body{
overflow-x: hidden; overflow-x: hidden;
float: left; float: left;
border: 3px solid #ccc; border: 3px solid #ccc;
-webkit-border-radius: 5px;
border-radius: 5px; border-radius: 5px;
-moz-box-shadow: #dadada -1px 0 4px;
-webkit-box-shadow: #dadada -1px 0 4px;
box-shadow: #dadada -1px 0 4px; box-shadow: #dadada -1px 0 4px;
color: white; color: white;
word-break: break-all;
} }
.ansContentDisplay{ .ansContentDisplay{
@ -244,6 +241,7 @@ body{
border-top-left-radius: 10px; border-top-left-radius: 10px;
border-bottom-left-radius: 10px; border-bottom-left-radius: 10px;
color: white; color: white;
word-break: break-all;
} }
.ansDelete{ .ansDelete{

@ -60,7 +60,7 @@ body{
.sub_cont{ .sub_cont{
width: 100%; width: 100%;
padding: 0; padding: 0;
margin: 20px 0 0 0; margin: 20px 0 5px 0;
min-height: 60px; min-height: 60px;
} }
@ -93,6 +93,7 @@ body{
border-top-left-radius: 10px; border-top-left-radius: 10px;
border-bottom-left-radius: 10px; border-bottom-left-radius: 10px;
padding-left: 10px; padding-left: 10px;
word-break: break-all;
} }
.close_cont{ .close_cont{

@ -172,6 +172,7 @@ body{
overflow-x: hidden; overflow-x: hidden;
float: right; float: right;
margin-left: 20px; margin-left: 20px;
word-break: break-all;
} }
.play, .stop{ .play, .stop{
@ -205,16 +206,15 @@ body{
.audio_answer{ .audio_answer{
min-height: 50px; min-height: 50px;
min-width: 200px;
max-width: 700px;
margin: 5px 10px; margin: 5px 10px;
padding: 0 10px; padding: 0 10px;
background-color: white; background-color: white;
display: inline-block;
position: relative;
border: 1px solid #ccc; border: 1px solid #ccc;
-moz-box-shadow: #ccc -1px 0 4px;
-webkit-box-shadow: #ccc -1px 0 4px;
box-shadow: #ccc -1px 0 4px; box-shadow: #ccc -1px 0 4px;
font-size: 230%; font-size: 230%;
word-wrap: break-word;
} }
/*new design*/ /*new design*/

@ -337,7 +337,7 @@ function showExample(){
var audio_block = $("<div class='audio_block'>").appendTo(text); var audio_block = $("<div class='audio_block'>").appendTo(text);
$("<div class='play'>").appendTo(audio_block); $("<div class='play'>").appendTo(audio_block);
$("<div class='replay'>").appendTo(audio_block); $("<div class='replay'>").appendTo(audio_block);
var source = $("<source/>").attr("src", "objects/beep.wav"); var source = $("<source/>").attr("src", "objects/beep.mp3");
var audio = $("<audio>").appendTo(audio_block); var audio = $("<audio>").appendTo(audio_block);
audio.append(source); audio.append(source);
$("<input type='hidden'/>").appendTo(audio_block); $("<input type='hidden'/>").appendTo(audio_block);

@ -331,7 +331,7 @@ function showExample(){
var audio_block = $("<div class='audio_block'>").appendTo(text); var audio_block = $("<div class='audio_block'>").appendTo(text);
$("<div class='play'>").appendTo(audio_block); $("<div class='play'>").appendTo(audio_block);
$("<div class='replay'>").appendTo(audio_block); $("<div class='replay'>").appendTo(audio_block);
var source = $("<source/>").attr("src", "../../objects/beep.wav"); var source = $("<source/>").attr("src", "objects/exemple.mp3");
var audio = $("<audio>").appendTo(audio_block); var audio = $("<audio>").appendTo(audio_block);
audio.append(source); audio.append(source);
$("<input type='hidden'/>").appendTo(audio_block); $("<input type='hidden'/>").appendTo(audio_block);

@ -332,7 +332,7 @@ function showExample(){
var audio_block = $("<div class='audio_block'>").appendTo(text); var audio_block = $("<div class='audio_block'>").appendTo(text);
$("<div class='play'>").appendTo(audio_block); $("<div class='play'>").appendTo(audio_block);
$("<div class='replay'>").appendTo(audio_block); $("<div class='replay'>").appendTo(audio_block);
var source = $("<source/>").attr("src", "../../objects/beep.wav"); var source = $("<source/>").attr("src", "objects/example.mp3");
var audio = $("<audio>").appendTo(audio_block); var audio = $("<audio>").appendTo(audio_block);
audio.append(source); audio.append(source);
$("<input type='hidden'/>").appendTo(audio_block); $("<input type='hidden'/>").appendTo(audio_block);

@ -94,6 +94,7 @@ body{
border-bottom-left-radius: 10px; border-bottom-left-radius: 10px;
padding-left: 10px; padding-left: 10px;
display: block; display: block;
word-break: break-all;
} }
.close_cont{ .close_cont{

@ -884,6 +884,10 @@ void UBBoardPaletteManager::addItemToLibrary()
#ifdef USE_WEB_WIDGET #ifdef USE_WEB_WIDGET
mpLibWidget->libNavigator()->libraryWidget()->libraryController()->importImageOnLibrary(image); mpLibWidget->libNavigator()->libraryWidget()->libraryController()->importImageOnLibrary(image);
#else
QDateTime now = QDateTime::currentDateTime();
QString capturedName = tr("CapturedImage") + "-" + now.toString("dd-MM-yyyy hh-mm-ss") + ".png";
mpFeaturesWidget->importImage(image, capturedName);
#endif #endif
} }

@ -99,6 +99,9 @@ UBFeaturesController::UBFeaturesController(QWidget *pParentWidget) :
mUserAnimationDirectoryPath = QUrl::fromLocalFile(UBSettings::settings()->userAnimationDirectory()); mUserAnimationDirectoryPath = QUrl::fromLocalFile(UBSettings::settings()->userAnimationDirectory());
mLibPicturesDirectoryPath = QUrl::fromLocalFile(UBSettings::settings()->applicationImageLibraryDirectory()); mLibPicturesDirectoryPath = QUrl::fromLocalFile(UBSettings::settings()->applicationImageLibraryDirectory());
mLibAudiosDirectoryPath = QUrl::fromLocalFile(UBSettings::settings()->applicationAudiosLibraryDirectory());
mLibVideosDirectoryPath = QUrl::fromLocalFile(UBSettings::settings()->applicationVideosLibraryDirectory());
mLibAnimationsDirectoryPath = QUrl::fromLocalFile(UBSettings::settings()->applicationAnimationsLibraryDirectory());
mLibInteractiveDirectoryPath = QUrl::fromLocalFile(UBSettings::settings()->applicationInteractivesDirectory()); mLibInteractiveDirectoryPath = QUrl::fromLocalFile(UBSettings::settings()->applicationInteractivesDirectory());
mLibApplicationsDirectoryPath = QUrl::fromLocalFile(UBSettings::settings()->applicationApplicationsLibraryDirectory()); mLibApplicationsDirectoryPath = QUrl::fromLocalFile(UBSettings::settings()->applicationApplicationsLibraryDirectory());
mLibShapesDirectoryPath = QUrl::fromLocalFile(UBSettings::settings()->applicationShapeLibraryDirectory()); mLibShapesDirectoryPath = QUrl::fromLocalFile(UBSettings::settings()->applicationShapeLibraryDirectory());
@ -162,15 +165,12 @@ void UBFeaturesController::scanFS()
QList <UBToolsManager::UBToolDescriptor> tools = UBToolsManager::manager()->allTools(); QList <UBToolsManager::UBToolDescriptor> tools = UBToolsManager::manager()->allTools();
foreach (UBToolsManager::UBToolDescriptor tool, tools) foreach (UBToolsManager::UBToolDescriptor tool, tools) {
{ featuresList->append(UBFeature(appPath, tool.icon, tool.label, QUrl(tool.id), FEATURE_INTERNAL));
featuresList->append( UBFeature( appPath, tool.icon, tool.label, QUrl( tool.id ), FEATURE_INTERNAL ) ); if (favoriteSet->find(QUrl(tool.id)) != favoriteSet->end()) {
if ( favoriteSet->find( QUrl( tool.id ) ) != favoriteSet->end() ) featuresList->append(UBFeature(favoritePath, tool.icon, tool.label, QUrl(tool.id), FEATURE_INTERNAL));
{
featuresList->append( UBFeature( favoritePath, tool.icon, tool.label, QUrl( tool.id ), FEATURE_INTERNAL ) );
} }
} }
//Claudio: //Claudio:
// don't change the order of the scans // don't change the order of the scans
fileSystemScan( mLibAudiosDirectoryPath, audiosPath); fileSystemScan( mLibAudiosDirectoryPath, audiosPath);
@ -189,7 +189,6 @@ void UBFeaturesController::scanFS()
fileSystemScan( mLibInteractiveDirectoryPath, interactPath ); fileSystemScan( mLibInteractiveDirectoryPath, interactPath );
fileSystemScan( trashDirectoryPath, trashPath ); fileSystemScan( trashDirectoryPath, trashPath );
fileSystemScan( mLibSearchDirectoryPath, rootPath + "/" + "Web search" ); fileSystemScan( mLibSearchDirectoryPath, rootPath + "/" + "Web search" );
} }
void UBFeaturesController::fileSystemScan(const QUrl & currentPath, const QString & currVirtualPath) void UBFeaturesController::fileSystemScan(const QUrl & currentPath, const QString & currVirtualPath)
@ -197,63 +196,28 @@ void UBFeaturesController::fileSystemScan(const QUrl & currentPath, const QStrin
QFileInfoList fileInfoList = UBFileSystemUtils::allElementsInDirectory(currentPath.toLocalFile()); QFileInfoList fileInfoList = UBFileSystemUtils::allElementsInDirectory(currentPath.toLocalFile());
QFileInfoList::iterator fileInfo; QFileInfoList::iterator fileInfo;
for ( fileInfo = fileInfoList.begin(); fileInfo != fileInfoList.end(); fileInfo += 1) for ( fileInfo = fileInfoList.begin(); fileInfo != fileInfoList.end(); fileInfo += 1) {
{ QString fullFileName = fileInfo->absoluteFilePath();
UBFeatureElementType fileType = fileInfo->isDir() ? FEATURE_FOLDER : FEATURE_ITEM; UBFeatureElementType featureType = fileTypeFromUrl(fullFileName);
QString fileName = fileInfo->fileName(); QString fileName = fileInfo->fileName();
if ( UBFileSystemUtils::mimeTypeFromFileName(fileName).contains("application") )
{
if ( UBFileSystemUtils::mimeTypeFromFileName(fileName).contains("application/search") )
{
fileType = FEATURE_SEARCH;
}
else
fileType = FEATURE_INTERACTIVE;
}
QString itemName = (fileType != FEATURE_ITEM) ? fileName : fileInfo->completeBaseName();
QPixmap icon = QPixmap(":images/libpalette/soundIcon.svg");
QString fullFileName = fileInfo->filePath();
if ( fileType == FEATURE_FOLDER )
{
icon = QPixmap(":images/libpalette/folder.svg");
}
else if ( fileType == FEATURE_INTERACTIVE )
{
icon = QPixmap( UBAbstractWidget::iconFilePath( QUrl::fromLocalFile(fullFileName) ) );
}
else
{
if ( fullFileName.contains(".thumbnail.") )
continue;
icon = thumbnailForFile( fullFileName );
/*QString thumbnailPath = UBFileSystemUtils::thumbnailPath( fullFileName );
if (QFileInfo( thumbnailPath).exists() )
icon = QPixmap( thumbnailPath );
else icon = createThumbnail( fullFileName );*/
}
UBFeature testFeature(currVirtualPath, icon, fileName, QUrl::fromLocalFile(fullFileName), fileType); QPixmap icon(getIcon(fullFileName, featureType));
if (featuresList->contains(testFeature)) { if ( fullFileName.contains(".thumbnail."))
qDebug() << "the same feature found"; continue;
}
UBFeature testFeature(currVirtualPath, icon, fileName, QUrl::fromLocalFile(fullFileName), featureType);
featuresList->append(testFeature); featuresList->append(testFeature);
if ( favoriteSet->find( QUrl::fromLocalFile( fullFileName ) ) != favoriteSet->end() )
{
featuresList->append( UBFeature( favoritePath, icon, fileName, QUrl::fromLocalFile( fullFileName ), fileType ) );
}
if ( fileType == FEATURE_FOLDER ) if ( favoriteSet->find( QUrl::fromLocalFile( fullFileName ) ) != favoriteSet->end() ) {
{ featuresList->append( UBFeature( favoritePath, icon, fileName, QUrl::fromLocalFile( fullFileName ), featureType ) );
fileSystemScan( QUrl::fromLocalFile( fullFileName ), currVirtualPath + "/" + fileName );
} }
} if (featureType == FEATURE_FOLDER) {
fileSystemScan(QUrl::fromLocalFile(fullFileName), currVirtualPath + "/" + fileName);
}
}
} }
void UBFeaturesController::loadFavoriteList() void UBFeaturesController::loadFavoriteList()
@ -296,7 +260,7 @@ void UBFeaturesController::addToFavorite( const QUrl &path )
{ {
QFileInfo fileInfo( filePath ); QFileInfo fileInfo( filePath );
QString fileName = fileInfo.fileName(); QString fileName = fileInfo.fileName();
UBFeature elem( favoritePath, thumbnailForFile( filePath ), fileName, path, fileTypeFromUrl(filePath) ); UBFeature elem( favoritePath, getIcon( filePath, FEATURE_CATEGORY ), fileName, path, fileTypeFromUrl(filePath) );
favoriteSet->insert( path ); favoriteSet->insert( path );
saveFavoriteList(); saveFavoriteList();
@ -330,44 +294,63 @@ QString UBFeaturesController::fileNameFromUrl( const QUrl &url )
UBFeatureElementType UBFeaturesController::fileTypeFromUrl( const QString &path ) UBFeatureElementType UBFeaturesController::fileTypeFromUrl( const QString &path )
{ {
QFileInfo fileInfo( path ); QFileInfo fileInfo(path);
QString fileName = fileInfo.fileName();
UBFeatureElementType fileType = fileInfo.isDir() ? FEATURE_FOLDER : FEATURE_ITEM; if (!fileInfo.exists()) {
if ( UBFileSystemUtils::mimeTypeFromFileName(fileName).contains("application") ) return FEATURE_INVALID;
{ }
fileType = FEATURE_INTERACTIVE;
} QString fileName = fileInfo.fileName();
else if ( path.contains("uniboardTool://") ) QString mimeString = UBFileSystemUtils::mimeTypeFromFileName(fileName);
{
UBFeatureElementType fileType = fileInfo.isDir() ? FEATURE_FOLDER : FEATURE_ITEM;
if ( mimeString.contains("application")) {
if (mimeString.contains("application/search")) {
fileType = FEATURE_SEARCH;
} else {
fileType = FEATURE_INTERACTIVE;
}
} else if ( path.contains("uniboardTool://")) {
fileType = FEATURE_INTERNAL; fileType = FEATURE_INTERNAL;
} }
return fileType; return fileType;
} }
QPixmap UBFeaturesController::thumbnailForFile(const QString &path) QPixmap UBFeaturesController::getIcon(const QString &path, UBFeatureElementType pFType = FEATURE_INVALID)
{ {
if ( path.contains("uniboardTool://") ) if ( pFType == FEATURE_FOLDER )
{ {
return QPixmap(":images/libpalette/folder.svg");
}
else if ( pFType == FEATURE_INTERACTIVE )
{
return QPixmap( UBAbstractWidget::iconFilePath( QUrl::fromLocalFile(path) ) );
}
if ( path.contains("uniboardTool://") )
{
return QPixmap( UBToolsManager::manager()->iconFromToolId(path) ); return QPixmap( UBToolsManager::manager()->iconFromToolId(path) );
} }
if ( UBFileSystemUtils::mimeTypeFromFileName(path).contains("application") ) if ( UBFileSystemUtils::mimeTypeFromFileName(path).contains("application") )
{ {
return QPixmap( UBAbstractWidget::iconFilePath( QUrl::fromLocalFile(path) ) ); return QPixmap( UBAbstractWidget::iconFilePath( QUrl::fromLocalFile(path) ) );
} }
QPixmap thumb; QPixmap thumb;
QString thumbnailPath = UBFileSystemUtils::thumbnailPath( path ); QString thumbnailPath = UBFileSystemUtils::thumbnailPath( path );
if ( QFileInfo( thumbnailPath ).exists() ) if ( QFileInfo( thumbnailPath ).exists() )
thumb = QPixmap( thumbnailPath ); thumb = QPixmap( thumbnailPath );
else thumb = createThumbnail( path ); else thumb = createThumbnail( path );
return thumb; return thumb;
} }
bool UBFeaturesController::isDeletable( const QUrl &url ) bool UBFeaturesController::isDeletable( const QUrl &url )
{ {
UBFeatureElementType type = fileTypeFromUrl( fileNameFromUrl(url) ); UBFeatureElementType type = fileTypeFromUrl( fileNameFromUrl(url) );
return type == FEATURE_ITEM; return type == FEATURE_ITEM;
} }
@ -406,10 +389,18 @@ QPixmap UBFeaturesController::createThumbnail(const QString &path)
return QPixmap(thumbnailPath); return QPixmap(thumbnailPath);
} }
UBFeature UBFeaturesController::importImage( const QImage &image, const UBFeature &destination ) void UBFeaturesController::importImage(const QImage &image, const QString &fileName)
{ {
QDateTime now = QDateTime::currentDateTime(); importImage(image, currentElement, fileName);
QString fileName = tr("ImportedImage") + "-" + now.toString("dd-MM-yyyy hh-mm-ss") + ".png"; }
void UBFeaturesController::importImage( const QImage &image, const UBFeature &destination, const QString &fileName )
{
QString mFileName = fileName;
if (mFileName.isNull()) {
QDateTime now = QDateTime::currentDateTime();
mFileName = tr("ImportedImage") + "-" + now.toString("dd-MM-yyyy hh-mm-ss") + ".png";
}
UBFeature dest = destination; UBFeature dest = destination;
@ -418,19 +409,26 @@ UBFeature UBFeaturesController::importImage( const QImage &image, const UBFeatur
dest = picturesElement; dest = picturesElement;
} }
QString filePath = dest.getFullPath().toLocalFile() + "/" + fileName; QString filePath = dest.getFullPath().toLocalFile() + "/" + mFileName;
image.save(filePath); image.save(filePath);
QPixmap thumb = createThumbnail( filePath ); QPixmap thumb = createThumbnail( filePath );
return UBFeature( dest.getFullVirtualPath(), thumb, fileName, UBFeature resultItem = UBFeature( dest.getFullVirtualPath(), thumb, mFileName,
QUrl::fromLocalFile( filePath ), FEATURE_ITEM ); QUrl::fromLocalFile( filePath ), FEATURE_ITEM );
featuresModel->addItem(resultItem);
} }
void UBFeaturesController::addNewFolder(const QString &name) void UBFeaturesController::addNewFolder(const QString &name)
{ {
QString path = currentElement.getFullPath().toLocalFile() + "/" + name; QString path = currentElement.getFullPath().toLocalFile() + "/" + name;
if ("/root" == currentElement.getFullVirtualPath())
{
return;
}
if(!QFileInfo(path).exists()) { if(!QFileInfo(path).exists()) {
QDir().mkpath(path); QDir().mkpath(path);
} }
@ -451,7 +449,7 @@ void UBFeaturesController::addItemAsBackground(const UBFeature &item)
UBApplication::boardController->downloadURL( item.getFullPath(), QPointF(), QSize(), true ); UBApplication::boardController->downloadURL( item.getFullPath(), QPointF(), QSize(), true );
} }
UBFeature UBFeaturesController::getParentFeatureForUrl( const QUrl &url ) UBFeature UBFeaturesController::getDestinationFeatureForUrl( const QUrl &url )
{ {
QString mimetype = UBFileSystemUtils::mimeTypeFromFileName( url.toString() ); QString mimetype = UBFileSystemUtils::mimeTypeFromFileName( url.toString() );
@ -473,7 +471,7 @@ UBFeature UBFeaturesController::getParentFeatureForUrl( const QUrl &url )
void UBFeaturesController::addDownloadedFile(const QUrl &sourceUrl, const QByteArray &pData) void UBFeaturesController::addDownloadedFile(const QUrl &sourceUrl, const QByteArray &pData)
{ {
UBFeature dest = getParentFeatureForUrl( sourceUrl ); UBFeature dest = getDestinationFeatureForUrl( sourceUrl );
if ( dest == UBFeature() ) if ( dest == UBFeature() )
return; return;
@ -487,7 +485,7 @@ void UBFeaturesController::addDownloadedFile(const QUrl &sourceUrl, const QByteA
file.write(pData); file.write(pData);
file.close(); file.close();
UBFeature downloadedFeature = UBFeature( dest.getFullVirtualPath(), thumbnailForFile( filePath ), UBFeature downloadedFeature = UBFeature( dest.getFullVirtualPath(), getIcon( filePath ),
fileName, QUrl::fromLocalFile(filePath), FEATURE_ITEM); fileName, QUrl::fromLocalFile(filePath), FEATURE_ITEM);
if (downloadedFeature != UBFeature()) { if (downloadedFeature != UBFeature()) {
featuresModel->addItem(downloadedFeature); featuresModel->addItem(downloadedFeature);
@ -505,7 +503,7 @@ UBFeature UBFeaturesController::moveItemToFolder( const QUrl &url, const UBFeatu
Q_ASSERT( QFileInfo( sourcePath ).exists() ); Q_ASSERT( QFileInfo( sourcePath ).exists() );
UBFeature possibleDest = getParentFeatureForUrl( url ); UBFeature possibleDest = getDestinationFeatureForUrl( url );
UBFeature dest = destination; UBFeature dest = destination;
@ -525,7 +523,7 @@ UBFeature UBFeaturesController::moveItemToFolder( const QUrl &url, const UBFeatu
deleteItem( url ); deleteItem( url );
} }
QPixmap thumb = thumbnailForFile( newFullPath ); QPixmap thumb = getIcon( newFullPath );
UBFeatureElementType type = FEATURE_ITEM; UBFeatureElementType type = FEATURE_ITEM;
if ( UBFileSystemUtils::mimeTypeFromFileName( newFullPath ).contains("application") ) if ( UBFileSystemUtils::mimeTypeFromFileName( newFullPath ).contains("application") )
@ -584,7 +582,7 @@ UBFeature UBFeaturesController::copyItemToFolder( const QUrl &url, const UBFeatu
Q_ASSERT( QFileInfo( sourcePath ).exists() ); Q_ASSERT( QFileInfo( sourcePath ).exists() );
UBFeature possibleDest = getParentFeatureForUrl( url ); UBFeature possibleDest = getDestinationFeatureForUrl( url );
UBFeature dest = destination; UBFeature dest = destination;
@ -594,22 +592,61 @@ UBFeature UBFeaturesController::copyItemToFolder( const QUrl &url, const UBFeatu
dest = possibleDest; dest = possibleDest;
} }
QString name = QFileInfo( sourcePath ).fileName(); QString name = QFileInfo(sourcePath).fileName();
QString destPath = dest.getFullPath().toLocalFile(); QString destPath = dest.getFullPath().toLocalFile();
QString destVirtualPath = dest.getFullVirtualPath(); QString destVirtualPath = dest.getFullVirtualPath();
QString newFullPath = destPath + "/" + name; QString newFullPath = destPath + "/" + name;
if ( !sourcePath.compare( newFullPath, Qt::CaseInsensitive ) ) if (!sourcePath.compare(newFullPath, Qt::CaseInsensitive))
QFile( sourcePath ).copy( newFullPath ); QFile(sourcePath).copy(newFullPath);
QPixmap thumb = thumbnailForFile( newFullPath ); QPixmap thumb = getIcon(newFullPath);
UBFeatureElementType type = FEATURE_ITEM; UBFeatureElementType type = FEATURE_ITEM;
if ( UBFileSystemUtils::mimeTypeFromFileName( newFullPath ).contains("application") ) if (UBFileSystemUtils::mimeTypeFromFileName(newFullPath).contains("application"))
type = FEATURE_INTERACTIVE; type = FEATURE_INTERACTIVE;
UBFeature newElement( destVirtualPath, thumb, name, QUrl::fromLocalFile( newFullPath ), type ); UBFeature newElement( destVirtualPath, thumb, name, QUrl::fromLocalFile( newFullPath ), type );
return newElement; return newElement;
} }
void UBFeaturesController::moveExternalData(const QUrl &url, const UBFeature &destination)
{
QString sourcePath = url.toLocalFile();
Q_ASSERT( QFileInfo( sourcePath ).exists() );
UBFeature possibleDest = getDestinationFeatureForUrl(url);
UBFeature dest = destination;
if ( destination != trashElement &&
!destination.getFullVirtualPath().startsWith( possibleDest.getFullVirtualPath(), Qt::CaseInsensitive ) )
{
dest = possibleDest;
}
UBFeatureElementType type = fileTypeFromUrl(sourcePath);
if (type == FEATURE_FOLDER) {
return;
}
QString name = QFileInfo(sourcePath).fileName();
QString destPath = dest.getFullPath().toLocalFile();
QString destVirtualPath = dest.getFullVirtualPath();
QString newFullPath = destPath + "/" + name;
if (!sourcePath.compare(newFullPath, Qt::CaseInsensitive) || !UBFileSystemUtils::copy(sourcePath, newFullPath)) {
return;
}
Q_ASSERT(QFileInfo(newFullPath).exists());
QPixmap thumb = getIcon(newFullPath, type);
UBFeature newElement(destVirtualPath, thumb, name, QUrl::fromLocalFile(newFullPath), type);
featuresModel->addItem(newElement);
}
void UBFeaturesController::deleteItem(const QUrl &url) void UBFeaturesController::deleteItem(const QUrl &url)
{ {
QString path = url.toLocalFile(); QString path = url.toLocalFile();

@ -33,7 +33,8 @@ enum UBFeatureElementType
FEATURE_ITEM, FEATURE_ITEM,
FEATURE_TRASH, FEATURE_TRASH,
FEATURE_FAVORITE, FEATURE_FAVORITE,
FEATURE_SEARCH FEATURE_SEARCH,
FEATURE_INVALID
}; };
class UBFeature class UBFeature
@ -105,6 +106,7 @@ public:
UBFeature moveItemToFolder( const QUrl &url, const UBFeature &destination ); UBFeature moveItemToFolder( const QUrl &url, const UBFeature &destination );
UBFeature copyItemToFolder( const QUrl &url, const UBFeature &destination ); UBFeature copyItemToFolder( const QUrl &url, const UBFeature &destination );
void moveExternalData(const QUrl &url, const UBFeature &destination);
void rescanModel(); void rescanModel();
void siftElements(const QString &pSiftValue); void siftElements(const QString &pSiftValue);
@ -120,13 +122,15 @@ public:
void addNewFolder(const QString &name); void addNewFolder(const QString &name);
void addToFavorite( const QUrl &path ); void addToFavorite( const QUrl &path );
void removeFromFavorite(const QUrl &path, bool deleteManualy = false); void removeFromFavorite(const QUrl &path, bool deleteManualy = false);
UBFeature importImage( const QImage &image, const UBFeature &destination ); void importImage(const QImage &image, const QString &fileName = QString());
void importImage( const QImage &image, const UBFeature &destination, const QString &fileName = QString() );
void fileSystemScan(const QUrl &currPath, const QString & currVirtualPath); void fileSystemScan(const QUrl &currPath, const QString & currVirtualPath);
static UBFeatureElementType fileTypeFromUrl( const QString &path );
static QString fileNameFromUrl( const QUrl &url ); static QString fileNameFromUrl( const QUrl &url );
static QPixmap thumbnailForFile( const QString &path ); static QPixmap getIcon( const QString &path, UBFeatureElementType pFType );
static bool isDeletable( const QUrl &url ); static bool isDeletable( const QUrl &url );
static char featureTypeSplitter() {return ':';} static char featureTypeSplitter() {return ':';}
@ -153,7 +157,7 @@ private:
void loadFavoriteList(); void loadFavoriteList();
void saveFavoriteList(); void saveFavoriteList();
static UBFeatureElementType fileTypeFromUrl( const QString &path );
QList <UBFeature> *featuresList; QList <UBFeature> *featuresList;
@ -204,7 +208,7 @@ private:
public: public:
UBFeature trashElement; UBFeature trashElement;
UBFeature getParentFeatureForUrl( const QUrl &url ); UBFeature getDestinationFeatureForUrl( const QUrl &url );
}; };

@ -172,8 +172,10 @@ bool UBAbstractWidget::hasEmbededFlash()
void UBAbstractWidget::resize(qreal width, qreal height) void UBAbstractWidget::resize(qreal width, qreal height)
{ {
QWebView::page()->setViewportSize(QSize(width, height)); qreal w = qMax((qreal)mNominalSize.width(), width);
QWebView::setFixedSize(QSize(width, height)); qreal h = qMax((qreal)mNominalSize.height(), height);
QWebView::page()->setViewportSize(QSize(w, h));
QWebView::setFixedSize(QSize(w, h));
} }

@ -161,6 +161,7 @@ void UBDocumentNavigator::refreshScene()
int rowIndex = i / mNbColumns; int rowIndex = i / mNbColumns;
item.Place(rowIndex, columnIndex, mThumbnailWidth, thumbnailHeight); item.Place(rowIndex, columnIndex, mThumbnailWidth, thumbnailHeight);
} }
scene()->setSceneRect(scene()->itemsBoundingRect());
} }
/** /**

@ -3,7 +3,6 @@
#include "UBFeaturesWidget.h" #include "UBFeaturesWidget.h"
#include "domain/UBAbstractWidget.h" #include "domain/UBAbstractWidget.h"
#include "gui/UBThumbnailWidget.h" #include "gui/UBThumbnailWidget.h"
#include "gui/UBLibraryWidget.h"
#include "frameworks/UBFileSystemUtils.h" #include "frameworks/UBFileSystemUtils.h"
#include "core/UBApplication.h" #include "core/UBApplication.h"
#include "core/UBDownloadManager.h" #include "core/UBDownloadManager.h"
@ -18,7 +17,10 @@ const int FeatureListBorderOffset = 10;
const char featureTypeSplitter = ':'; const char featureTypeSplitter = ':';
static const QString mimeSankoreFeatureTypes = "Sankore/featureTypes"; static const QString mimeSankoreFeatureTypes = "Sankore/featureTypes";
UBFeaturesWidget::UBFeaturesWidget(QWidget *parent, const char *name):UBDockPaletteWidget(parent), imageGatherer(NULL) UBFeaturesWidget::UBFeaturesWidget(QWidget *parent, const char *name)
: UBDockPaletteWidget(parent)
, imageGatherer(NULL)
, mkFolderDlg(NULL)
{ {
setObjectName(name); setObjectName(name);
@ -108,6 +110,9 @@ void UBFeaturesWidget::currentSelected(const QModelIndex &current)
return; return;
} }
//Calling to reset the model for listView. Maybe separate function needed
controller->searchStarted("", mNavigator->listView());
QString objName = sender()->objectName(); QString objName = sender()->objectName();
if (objName.isEmpty()) { if (objName.isEmpty()) {
@ -159,10 +164,22 @@ void UBFeaturesWidget::currentSelected(const QModelIndex &current)
void UBFeaturesWidget::createNewFolder() void UBFeaturesWidget::createNewFolder()
{ {
UBNewFolderDlg dlg; if (!mkFolderDlg)
if(QDialog::Accepted == dlg.exec()) { {
controller->addNewFolder(dlg.folderName()); mkFolderDlg = new UBNewFolderDlg(this);
connect (mkFolderDlg, SIGNAL(accepted()), this, SLOT(addFolder()));
} }
mkFolderDlg->setWindowFlags(Qt::WindowStaysOnTopHint);
mkFolderDlg->resize(this->size().width()-20 ,80);
mkFolderDlg->move(5,this->size().height()-200);
mkFolderDlg->show();
}
void UBFeaturesWidget::addFolder()
{
if (mkFolderDlg)
controller->addNewFolder(mkFolderDlg->folderName());
} }
void UBFeaturesWidget::deleteElements( const UBFeaturesMimeData * mimeData ) void UBFeaturesWidget::deleteElements( const UBFeaturesMimeData * mimeData )
@ -334,6 +351,16 @@ void UBFeaturesWidget::removeElementsFromFavorite()
controller->refreshModels(); controller->refreshModels();
} }
void UBFeaturesWidget::resizeEvent(QResizeEvent *event)
{
UBDockPaletteWidget::resizeEvent(event);
if (mkFolderDlg)
{
mkFolderDlg->resize(this->size().width()-20 ,80);
mkFolderDlg->move(5,this->size().height()-200);
}
}
void UBFeaturesWidget::switchToListView() void UBFeaturesWidget::switchToListView()
{ {
stackedWidget->setCurrentIndex(ID_LISTVIEW); stackedWidget->setCurrentIndex(ID_LISTVIEW);
@ -357,6 +384,10 @@ QStringList UBFeaturesMimeData::formats() const
return QMimeData::formats(); return QMimeData::formats();
} }
void UBFeaturesWidget::importImage(const QImage &image, const QString &fileName)
{
controller->importImage(image, fileName);
}
UBFeaturesListView::UBFeaturesListView( QWidget* parent, const char* name ) UBFeaturesListView::UBFeaturesListView( QWidget* parent, const char* name )
: QListView(parent) : QListView(parent)
@ -862,6 +893,8 @@ bool UBFeaturesModel::dropMimeData(const QMimeData *mimeData, Qt::DropAction act
Q_UNUSED(row) Q_UNUSED(row)
const UBFeaturesMimeData *fMimeData = qobject_cast<const UBFeaturesMimeData*>(mimeData); const UBFeaturesMimeData *fMimeData = qobject_cast<const UBFeaturesMimeData*>(mimeData);
UBFeaturesController *curController = qobject_cast<UBFeaturesController *>(QObject::parent());
bool dataFromSameModel = false; bool dataFromSameModel = false;
if (fMimeData) if (fMimeData)
@ -876,12 +909,12 @@ bool UBFeaturesModel::dropMimeData(const QMimeData *mimeData, Qt::DropAction act
UBFeature parentFeature; UBFeature parentFeature;
if (!parent.isValid()) { if (!parent.isValid()) {
parentFeature = dynamic_cast<UBFeaturesWidget *>(QObject::parent())->getFeaturesController()->getCurrentElement(); parentFeature = curController->getCurrentElement();
} else { } else {
parentFeature = parent.data( Qt::UserRole + 1).value<UBFeature>(); parentFeature = parent.data( Qt::UserRole + 1).value<UBFeature>();
} }
if (mimeData->hasUrls()) { if (dataFromSameModel) {
QList<UBFeature> featList = fMimeData->features(); QList<UBFeature> featList = fMimeData->features();
for (int i = 0; i < featList.count(); i++) { for (int i = 0; i < featList.count(); i++) {
UBFeature sourceElement; UBFeature sourceElement;
@ -890,10 +923,16 @@ bool UBFeaturesModel::dropMimeData(const QMimeData *mimeData, Qt::DropAction act
moveData(sourceElement, parentFeature, Qt::MoveAction); moveData(sourceElement, parentFeature, Qt::MoveAction);
} }
} }
} else if ( mimeData->hasImage() ) { } else if (mimeData->hasUrls()) {
QList<QUrl> urlList = mimeData->urls();
foreach (QUrl curUrl, urlList) {
qDebug() << "URl catched is " << curUrl.toLocalFile();
curController->moveExternalData(curUrl, parentFeature);
}
} else if (mimeData->hasImage()) {
QImage image = qvariant_cast<QImage>( mimeData->imageData() ); QImage image = qvariant_cast<QImage>( mimeData->imageData() );
UBFeature element = dynamic_cast<UBFeaturesWidget *>(QObject::parent())->getFeaturesController()->importImage( image, parentFeature ); curController->importImage( image, parentFeature );
addItem( element );
} }
return true; return true;
@ -1019,7 +1058,7 @@ void UBFeaturesModel::moveData(const UBFeature &source, const UBFeature &destina
curFeature.setFullPath(newPath); curFeature.setFullPath(newPath);
} }
} }
// processing copy or move action for real FS // processing copy or move action for virtual FS
if (action == Qt::CopyAction) { if (action == Qt::CopyAction) {
copyFeature.setFullVirtualPath(newVirtualPath); copyFeature.setFullVirtualPath(newVirtualPath);
} else { } else {

@ -21,6 +21,7 @@
#include "api/UBWidgetUniboardAPI.h" #include "api/UBWidgetUniboardAPI.h"
#include "UBFeaturesActionBar.h" #include "UBFeaturesActionBar.h"
#include "UBRubberBand.h" #include "UBRubberBand.h"
#include "gui/UBLibraryWidget.h"
#define THUMBNAIL_WIDTH 400 #define THUMBNAIL_WIDTH 400
#define ID_LISTVIEW 0 #define ID_LISTVIEW 0
@ -56,6 +57,7 @@ public:
|| mode == eUBDockPaletteWidget_DESKTOP; || mode == eUBDockPaletteWidget_DESKTOP;
} }
UBFeaturesController * getFeaturesController() const { return controller; } UBFeaturesController * getFeaturesController() const { return controller; }
void importImage(const QImage &image, const QString &fileName = QString());
static const int minThumbnailSize = 20; static const int minThumbnailSize = 20;
static const int maxThumbnailSize = 100; static const int maxThumbnailSize = 100;
@ -70,6 +72,7 @@ private slots:
void currentSelected( const QModelIndex & ); void currentSelected( const QModelIndex & );
void searchStarted( const QString & ); void searchStarted( const QString & );
void createNewFolder(); void createNewFolder();
void addFolder();
void deleteElements( const UBFeaturesMimeData * ); void deleteElements( const UBFeaturesMimeData * );
void addToFavorite( const UBFeaturesMimeData *); void addToFavorite( const UBFeaturesMimeData *);
void removeFromFavorite( const UBFeaturesMimeData * ); void removeFromFavorite( const UBFeaturesMimeData * );
@ -81,6 +84,7 @@ private slots:
void rescanModel(); void rescanModel();
private: private:
void resizeEvent(QResizeEvent *event);
void switchToListView(); void switchToListView();
void switchToProperties(); void switchToProperties();
void switchToWebView(); void switchToWebView();
@ -96,6 +100,7 @@ private:
QStackedWidget *stackedWidget; QStackedWidget *stackedWidget;
int currentStackedWidget; int currentStackedWidget;
UBDownloadHttpFile* imageGatherer; UBDownloadHttpFile* imageGatherer;
UBNewFolderDlg *mkFolderDlg;
}; };

@ -547,7 +547,6 @@ UBNewFolderDlg::UBNewFolderDlg(QWidget *parent, const char *name):QDialog(parent
, mpAddButton(NULL) , mpAddButton(NULL)
, mpCancelButton(NULL) , mpCancelButton(NULL)
, mpLayout(NULL) , mpLayout(NULL)
, mpHLayout(NULL)
{ {
setObjectName(name); setObjectName(name);
setWindowTitle(tr("Add new folder")); setWindowTitle(tr("Add new folder"));
@ -562,15 +561,14 @@ UBNewFolderDlg::UBNewFolderDlg(QWidget *parent, const char *name):QDialog(parent
mpButtons = new QDialogButtonBox(Qt::Horizontal, this); mpButtons = new QDialogButtonBox(Qt::Horizontal, this);
mpLayout = new QVBoxLayout(this); mpLayout = new QVBoxLayout(this);
mpHLayout = new QHBoxLayout(0);
setLayout(mpLayout); setLayout(mpLayout);
mpLayout->addLayout(mpHLayout, 0);
mpHLayout->addWidget(mpLabel, 0); mpLayout->addWidget(mpLabel, 1);
mpHLayout->addWidget(mpLineEdit, 1); mpLayout->addWidget(mpLineEdit);
mpButtons->addButton(mpAddButton,QDialogButtonBox::ActionRole); mpButtons->addButton(mpAddButton,QDialogButtonBox::ActionRole);
mpButtons->addButton(mpCancelButton,QDialogButtonBox::ActionRole); mpButtons->addButton(mpCancelButton,QDialogButtonBox::ActionRole);
mpLayout->addWidget(mpButtons); mpLayout->addWidget(mpButtons, 1,Qt::AlignJustify);
connect(mpAddButton, SIGNAL(clicked()), this, SLOT(accept())); connect(mpAddButton, SIGNAL(clicked()), this, SLOT(accept()));
connect(mpCancelButton, SIGNAL(clicked()), this, SLOT(reject())); connect(mpCancelButton, SIGNAL(clicked()), this, SLOT(reject()));
@ -612,11 +610,7 @@ UBNewFolderDlg::~UBNewFolderDlg()
delete mpLabel; delete mpLabel;
mpLabel = NULL; mpLabel = NULL;
} }
if(NULL != mpHLayout)
{
delete mpHLayout;
mpHLayout = NULL;
}
if(NULL != mpLayout) if(NULL != mpLayout)
{ {
delete mpLayout; delete mpLayout;

@ -119,7 +119,6 @@ private:
QPushButton* mpAddButton; QPushButton* mpAddButton;
QPushButton* mpCancelButton; QPushButton* mpCancelButton;
QVBoxLayout* mpLayout; QVBoxLayout* mpLayout;
QHBoxLayout* mpHLayout;
}; };
#endif // UBLIBRARYWIDGET_H #endif // UBLIBRARYWIDGET_H

@ -1163,7 +1163,7 @@ void UBTeacherGuideWidget::connectToStylusPalette()
connect(UBApplication::mainWindow->actionPlay, SIGNAL(triggered(bool)), this, SLOT(onTriggeredAction(bool))); connect(UBApplication::mainWindow->actionPlay, SIGNAL(triggered(bool)), this, SLOT(onTriggeredAction(bool)));
connect(UBApplication::mainWindow->actionZoomIn, SIGNAL(triggered(bool)), this, SLOT(onTriggeredAction(bool))); connect(UBApplication::mainWindow->actionZoomIn, SIGNAL(triggered(bool)), this, SLOT(onTriggeredAction(bool)));
connect(UBApplication::mainWindow->actionZoomOut, SIGNAL(triggered(bool)), this, SLOT(onTriggeredAction(bool))); connect(UBApplication::mainWindow->actionZoomOut, SIGNAL(triggered(bool)), this, SLOT(onTriggeredAction(bool)));
connect(UBApplication::mainWindow->actionCapture, SIGNAL(triggered(bool)), this, SLOT(onTriggeredAction(bool))); connect(UBApplication::mainWindow->actionCapture, SIGNAL(triggered(bool)), this, SLOT(onTriggeredAction(bool)));
connect(UBApplication::mainWindow->actionHand, SIGNAL(triggered(bool)), this, SLOT(onTriggeredAction(bool))); connect(UBApplication::mainWindow->actionHand, SIGNAL(triggered(bool)), this, SLOT(onTriggeredAction(bool)));
connect(UBApplication::mainWindow->actionLine, SIGNAL(triggered(bool)), this, SLOT(onTriggeredAction(bool))); connect(UBApplication::mainWindow->actionLine, SIGNAL(triggered(bool)), this, SLOT(onTriggeredAction(bool)));
connect(UBApplication::mainWindow->actionText, SIGNAL(triggered(bool)), this, SLOT(onTriggeredAction(bool))); connect(UBApplication::mainWindow->actionText, SIGNAL(triggered(bool)), this, SLOT(onTriggeredAction(bool)));

Loading…
Cancel
Save