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

preferencesAboutTextFull
Aleksei Kanash 12 years ago
commit 424f91dbb2
  1. 624
      resources/library/search/Image Planete.wgs/css/basic.css
  2. 0
      resources/library/search/Image Planete.wgs/images/down.png
  3. 0
      resources/library/search/Image Planete.wgs/images/greySquare.png
  4. 0
      resources/library/search/Image Planete.wgs/images/icon-close.png
  5. 0
      resources/library/search/Image Planete.wgs/images/popupBack.png
  6. 0
      resources/library/search/Image Planete.wgs/images/search.png
  7. 0
      resources/library/search/Image Planete.wgs/images/search_app.png
  8. 0
      resources/library/search/Image Planete.wgs/images/trgDown.png
  9. 0
      resources/library/search/Image Planete.wgs/images/trgUp.png
  10. 0
      resources/library/search/Image Planete.wgs/images/up.png
  11. 528
      resources/library/search/Image Planete.wgs/index.html
  12. 34
      resources/library/search/Image Planete.wgs/scripts/jquery-1.6.2.min.js
  13. 195
      src/board/UBFeaturesController.cpp
  14. 17
      src/board/UBFeaturesController.h
  15. 133
      src/gui/UBFeaturesWidget.cpp
  16. 30
      src/gui/UBFeaturesWidget.h

@ -1,310 +1,314 @@
html, body{
width: 100%;
padding: 0;
height: auto;
background-color: white;
margin: 0;
}
::-webkit-scrollbar {
width: 14px;
background-color:white;
}
::-webkit-scrollbar-thumb {
border-radius: 10px;
background-color:lightgray;
border: 2px solid gray;
}
::-webkit-scrollbar-button:vertical:start{
border-radius: 10px;
background-color:lightgray;
background-image: url(../images/trgUp.png);
background-size: 8px auto;
background-position: center;
background-repeat: no-repeat;
border: 2px solid gray;
}
::-webkit-scrollbar-button:vertical:end{
border-radius: 10px;
background-color:lightgray;
background-image: url(../images/trgDown.png);
background-size: 8px auto;
background-position: center;
background-repeat: no-repeat;
border: 2px solid gray;
}
a {
text-decoration: underline;
}
#disc_nav_cont{
height: auto;
position: fixed;
left: 0;
bottom: 0;
width: 100%;
}
.disclaimer{
padding: 5px;
text-align: center;
background-color: #BBBBBB;
border-top: solid 4px #EEEEEE;
border-bottom: none;
font-size: 12px;
}
.resultFooter{
width: 100%;
padding: 3px;
font-family: Verdana,Arial,Helvetica,sans-serif;
font-weight: bold;
font-size: x-large;
text-align: center;
background-color: white;
}
#searchResult {
overflow: hidden;
text-align: center;
margin-top: 50px;
margin-bottom: 50px;
}
.search{
position: fixed;
top: 0;
left: 0;
padding: 5px;
background-color: #BBBBBB;
border-bottom: solid 4px #EEEEEE;
}
.search,
.disclaimer {
width: 100%;
box-sizing: border-box;
-webkit-box-sizing: border-box;
}
.searchInput{
padding: 3px;
float: left;
width: 100%;
border-radius: 3px;
border-style: none;
height: 22px;
line-height: 18px;
vertical-align: middle;
box-sizing: border-box;
-webkit-box-sizing: border-box;
}
.searchButton{
background: url("../images/search_app.png") -38px -38px no-repeat;
width: 24px;
height: 24px;
overflow: hidden;
position: absolute;
right: 30px;
top: 9px;
margin-left: -2px;
cursor: pointer;
}
.subSearch{
margin: 0;
float: left;
}
#subSearchInput{
width: 100%;
float: left;
box-sizing: border-box;
-webkit-box-sizing: border-box;
padding: 5px;
padding-right: 26px;
}
#subSearchFilter{
width: 100%;
float: left;
display: none;
}
.searchResult{
width: 98%;
padding: 3px;
background-color:#123456;
}
.imgContainer{
display: inline-block;
padding: 3px;
margin: 3px;
text-align: center;
overflow: hidden;
font-size: small;
font-family: Verdana,Arial,Helvetica,sans-serif;
vertical-align: top;
}
.filterContainer{
float: left;
margin: 2px;
padding: 2px;
font-size: 14px;
}
.filterSelect{
border-style:none;
-webkit-border-top-right-radius: 15px;
-webkit-border-bottom-right-radius: 15px;
-moz-border-radius-topright: 15px;
-moz-border-radius-bottomright: 15px;
border-top-right-radius: 15px;
margin-top: 2px;
width: 100%;
}
span{
font-family: Verdana,Arial,Helvetica,sans-serif;
color: #666;
}
[draggable] {
-webkit-user-select: none;
user-select: none;
}
.toggleFilters{
margin: 0;
padding: 0;
background-position: center;
background-image: url(../images/down.png);
position: absolute;
top: 11px;
right: 6px;
width: 20px;
height: 20px;
cursor: pointer;
}
.colors_line {
float: left;
margin: 4px;
margin-right: 0;
clear: left;
}
.custom {
opacity: 0;
position: absolute;
left: -10000px;
}
.filter_button.button.color {
display: inline-block;
width: 15px;
height: 15px;
border: 1px solid #EBEBEB;
padding: 0;
margin: 0;
box-sizing: border-box;
-webkit-box-sizing: border-box;
}
.filter_button.button.color:hover {
border: 1px solid rgb(128,128,128);
cursor: pointer;
}
input[type="radio"]:checked + .filter_button.button.color {
border: 1px solid rgb(255,255,255);
box-shadow: 0 0 0px 1px #000;
-webkit-box-shadow: 0 0 0px 1px #000;
}
#allcolor {
background: white url('../images/search_app.png') -43px -144px no-repeat;
}
#colored {
background: white url('../images/search_app.png') -43px -244px no-repeat;
}
#grayed {
background: white url('../images/search_app.png') -45px -343px no-repeat;
}
#black{
background-color:#ffffff;
}
#blue{
background-color:#0000FF;
}
#brown{
background-color:rgba(139, 82, 16, 1);
}
#gray{
background-color:#999999;
}
#green{
background-color:#00CC00;
}
#orange{
background-color:#FB940B;
}
#pink{
background-color:#FF98BF;
}
#purple{
background-color:#762CA7;
}
#red{
background-color:#CC0000;
}
#teal{
background-color:#03C0C6;
}
#white{
background-color:#000000;
}
#yellow{
background-color:#FFFF00;
}
.selectBox-dropdown, .selectBox-options li a {
line-height: 1.3 !important;
font-size: 13px;
}
.pager_button {
padding: 3px 5px;
font-size: 16px;
color: black;
display: inline-block;
}
.pager_button.active {
border-radius: 3px;
-webkit-border-radius: 3px;
background-color: gray;
color: white;
}
html, body{
width: 100%;
padding: 0;
height: auto;
background-color: white;
margin: 0;
}
::-webkit-scrollbar {
width: 14px;
background-color:white;
}
::-webkit-scrollbar-thumb {
border-radius: 10px;
background-color:lightgray;
border: 2px solid gray;
}
::-webkit-scrollbar-button:vertical:start{
border-radius: 10px;
background-color:lightgray;
background-image: url(../images/trgUp.png);
background-size: 8px auto;
background-position: center;
background-repeat: no-repeat;
border: 2px solid gray;
}
::-webkit-scrollbar-button:vertical:end{
border-radius: 10px;
background-color:lightgray;
background-image: url(../images/trgDown.png);
background-size: 8px auto;
background-position: center;
background-repeat: no-repeat;
border: 2px solid gray;
}
a {
text-decoration: underline;
}
#disc_nav_cont{
height: auto;
position: fixed;
left: 0;
bottom: 0;
width: 100%;
}
.disclaimer{
padding: 5px;
text-align: center;
background-color: #BBBBBB;
border-top: solid 4px #EEEEEE;
border-bottom: none;
font-size: 12px;
}
.resultFooter{
width: 100%;
padding: 3px;
font-family: Verdana,Arial,Helvetica,sans-serif;
font-weight: bold;
font-size: x-large;
text-align: center;
background-color: white;
}
#searchResult {
overflow: hidden;
text-align: center;
margin-top: 50px;
margin-bottom: 50px;
}
.search{
position: fixed;
top: 0;
left: 0;
padding: 5px;
background-color: #BBBBBB;
border-bottom: solid 4px #EEEEEE;
}
.search,
.disclaimer {
width: 100%;
box-sizing: border-box;
-webkit-box-sizing: border-box;
}
.searchInput{
padding: 3px;
float: left;
width: 100%;
border-radius: 3px;
border-style: none;
height: 22px;
line-height: 18px;
vertical-align: middle;
box-sizing: border-box;
-webkit-box-sizing: border-box;
}
.searchButton{
background: url("../images/search_app.png") -38px -38px no-repeat;
width: 24px;
height: 24px;
overflow: hidden;
position: absolute;
right: 30px;
top: 9px;
margin-left: -2px;
cursor: pointer;
}
.subSearch{
margin: 0;
float: left;
}
#subSearchInput{
width: 100%;
float: left;
box-sizing: border-box;
-webkit-box-sizing: border-box;
padding: 5px;
padding-right: 26px;
}
#subSearchFilter{
width: 100%;
float: left;
display: none;
}
.searchResult{
width: 98%;
padding: 3px;
background-color:#123456;
}
.imgContainer{
display: inline-block;
padding: 3px;
margin: 3px;
text-align: center;
overflow: hidden;
font-size: small;
font-family: Verdana,Arial,Helvetica,sans-serif;
vertical-align: top;
}
.imgContainer img{
max-width: 150px;
max-height:150px;
}
.filterContainer{
float: left;
margin: 2px;
padding: 2px;
font-size: 14px;
}
.filterSelect{
border-style:none;
-webkit-border-top-right-radius: 15px;
-webkit-border-bottom-right-radius: 15px;
-moz-border-radius-topright: 15px;
-moz-border-radius-bottomright: 15px;
border-top-right-radius: 15px;
margin-top: 2px;
width: 100%;
}
span{
font-family: Verdana,Arial,Helvetica,sans-serif;
color: #666;
}
[draggable] {
-webkit-user-select: none;
user-select: none;
}
.toggleFilters{
margin: 0;
padding: 0;
background-position: center;
background-image: url(../images/down.png);
position: absolute;
top: 11px;
right: 6px;
width: 20px;
height: 20px;
cursor: pointer;
}
.colors_line {
float: left;
margin: 4px;
margin-right: 0;
clear: left;
}
.custom {
opacity: 0;
position: absolute;
left: -10000px;
}
.filter_button.button.color {
display: inline-block;
width: 15px;
height: 15px;
border: 1px solid #EBEBEB;
padding: 0;
margin: 0;
box-sizing: border-box;
-webkit-box-sizing: border-box;
}
.filter_button.button.color:hover {
border: 1px solid rgb(128,128,128);
cursor: pointer;
}
input[type="radio"]:checked + .filter_button.button.color {
border: 1px solid rgb(255,255,255);
box-shadow: 0 0 0px 1px #000;
-webkit-box-shadow: 0 0 0px 1px #000;
}
#allcolor {
background: white url('../images/search_app.png') -43px -144px no-repeat;
}
#colored {
background: white url('../images/search_app.png') -43px -244px no-repeat;
}
#grayed {
background: white url('../images/search_app.png') -45px -343px no-repeat;
}
#black{
background-color:#ffffff;
}
#blue{
background-color:#0000FF;
}
#brown{
background-color:rgba(139, 82, 16, 1);
}
#gray{
background-color:#999999;
}
#green{
background-color:#00CC00;
}
#orange{
background-color:#FB940B;
}
#pink{
background-color:#FF98BF;
}
#purple{
background-color:#762CA7;
}
#red{
background-color:#CC0000;
}
#teal{
background-color:#03C0C6;
}
#white{
background-color:#000000;
}
#yellow{
background-color:#FFFF00;
}
.selectBox-dropdown, .selectBox-options li a {
line-height: 1.3 !important;
font-size: 13px;
}
.pager_button {
padding: 3px 5px;
font-size: 16px;
color: black;
display: inline-block;
}
.pager_button.active {
border-radius: 3px;
-webkit-border-radius: 3px;
background-color: gray;
color: white;
}

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

Before

Width:  |  Height:  |  Size: 214 B

After

Width:  |  Height:  |  Size: 214 B

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 1.5 KiB

Before

Width:  |  Height:  |  Size: 931 B

After

Width:  |  Height:  |  Size: 931 B

Before

Width:  |  Height:  |  Size: 1.8 KiB

After

Width:  |  Height:  |  Size: 1.8 KiB

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

Before

Width:  |  Height:  |  Size: 475 B

After

Width:  |  Height:  |  Size: 475 B

Before

Width:  |  Height:  |  Size: 448 B

After

Width:  |  Height:  |  Size: 448 B

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

@ -1,264 +1,264 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Planete Sankore Image Search</title>
<link rel="stylesheet" type="text/css" href="css/basic.css"/>
<script type="text/javascript" src="scripts/jquery-1.6.2.min.js"></script>
<script type="text/javascript">
var category = "image";
var thumbnails = true;
var minHeight = 180;
var minWidth = 150;
var currentIndex = 0;
var currentTerm = "";
var limit = 10;
var filtersDisplayed = false; //display or hide filters
function addPaginationLinks(totalResults) {
var curPage = currentIndex; // check what page the app is on
var pagesDiv = $("<div id='resultFooter' class='resultFooter'>");
for (var i = 0; i < 8; i++) {
if (i * limit < totalResults) {
var link = $("<a class='pager_button'></a>").attr('href', 'javascript:gotoPage('+i+');').html(i+1).appendTo(pagesDiv);
if (curPage == i) {
link.addClass('active');
}
}
}
$("#disc_nav_cont #resultFooter").remove();
pagesDiv.insertBefore($('#disclaimer'));
$(".imgContainer").each(function(){
this.addEventListener("dragstart", imageDragging, false);
})
$(".imgContainer").each(function(){
this.addEventListener("dragenter", imageDragenter, false);
})
$(".imgContainer").each(function(){
this.addEventListener("dragleave", imageDragleave, false);
})
$(".imgContainer").each(function(){
this.addEventListener("dragover", imageDragover, false);
})
}
function searchFail(jqXHR, textStatus, errorThrown) {
alert('Impossible to connect to Planete Sankore: ' + textStatus + ' ' + errorThrown);
}
function searchComplete(json) {
// Grab our content div, clear it.
var totalResults = json.totalResults;
var contentDiv = $('#searchResult').empty();
// Loop through our results, printing them to the page.
var results = json.rows;
for (var i = 0; i < results.length; i++) {
// For each result write it's title and image to the screen
var result = results[i];
var imgContainer = $("<div class='imgContainer' draggable='true'>");
//var title = document.createElement('div');
var iUrl = $("<input type='hidden'/>");
var iContent = $("<input type='hidden'/>");
var iHeight = $("<input type='hidden'/>");
var iWidth = $("<input type='hidden'/>");
var iTitle = $("<input type='hidden'/>");
// We use titleNoFormatting so that no HTML tags are left in the
// title
//title.innerHTML = result.title;
var newImg = document.createElement('img');
// There is also a result.file property which has the escaped version
if (thumbnails) {
newImg.src = result.file;
if(result.height >= result.width)
newImg.height = minHeight;
else{
newImg.width = minWidth;
//newImg.style.margin = (120 - result.height)/2 + "px 0";
}
} else {
newImg.src = "./images/thumbnail_icon.png";
}
var imgWidth = (result.tbWidth > minWidth)?result.tbWidth:minWidth;
var imgHeight = (result.tbHeight > minHeight)?result.tbHeight:minHeight;
imgContainer.width(imgWidth).height(imgHeight);
imgContainer.append($(newImg));
iUrl.attr("value", result.file);
iContent.attr("value", result.title);
iHeight.attr("value", result.height);
iWidth.attr("value", result.width);
iTitle.attr("value",result.title);
//imgContainer.append($(title));
imgContainer.append(iUrl);
imgContainer.append(iContent);
imgContainer.append(iHeight);
imgContainer.append(iWidth);
imgContainer.append(iTitle);
// Put our title + image in the content
imgContainer.appendTo(contentDiv);
}
// Now add links to additional pages of search results.
addPaginationLinks(totalResults);
}
function imageDragging(e){
e.dataTransfer.setData("text/plain",$(this).find("input:hidden").eq(0).val());
// alert($(this).find("input:hidden").eq(0).val());
}
function imageDragleave(e){
return false;
}
function imageDragover(e){
return false;
}
function imageDragenter(e){
return false;
}
$(document).ready(function(){
//variables
var mode = false; //search or view mode
var hide = false; //hide or no main panel
//basic containers and elements
var disc_nav_cont = $("<div id='disc_nav_cont' class='disc_nav_cont'>").appendTo("body");
var disclaimer = $("<div id='disclaimer' class='disclaimer'>Recherche d'images sur Planète Sankoré<div>").appendTo(disc_nav_cont);
var search = $("<div id='search' class='search'>").appendTo("body");
var togglePages = $("<div id='togglePages' class='togglePages'>").appendTo(search);
var toggleIcon = $("<div id='toggleIcon' class='toggleIcon'>").appendTo(togglePages);
var subSearchInput = $("<div id='subSearchInput' class='subSearch'>").appendTo(search);
var subSearchFilter = $("<div id='subSearchFilter' class='subSearch'>").appendTo(search);
var searchInput = $("<input id='searchInput' class='searchInput' type='text'/>").appendTo(subSearchInput);
var searchButton = $("<div id='searchButton' class='searchButton'>").appendTo(subSearchInput);
// var toggleFilters = $("<div id='toggleFilters' class='toggleFilters'>").appendTo(subSearchInput);
//adding filters to the wgt
var selectFilter = $("<select id='sizeFilter' class='filterSelect'>")
.append($("<option value='0'>Any</option>"))
.append($("<option value='1'>Small</option>"))
.append($("<option value='2'>Medium</option>"))
.append($("<option value='3'>Large</option>"))
.append($("<option value='4'>Extra large</option>"));
$("<div class='filterContainer'>").append("<span>Size:</span>").append(selectFilter).appendTo(subSearchFilter);
//mouse click actions
/*
toggleFilters.click(function(){
if(filtersDisplayed){
subSearchFilter.hide();
toggleFilters.css("background-image","url(images/down.png)");
filtersDisplayed = false;
} else {
subSearchFilter.show();
toggleFilters.css("background-image","url(images/up.png)");
filtersDisplayed = true;
}
});
*/
/*togglePages.click(function(event){
if(mode){
hide = false;
$("#search, #disclaimer").slideDown('slow', function(){
toggleIcon.css("background-image","url(images/trgUp.png)");
togglePages.appendTo("#search").css("top","").css("bottom","-14px");
});
mode = false;
} else {
hide = true;
$("#search, #disclaimer").slideUp('slow', function(){
toggleIcon.css("background-image","url(images/trgDown.png)");
togglePages.appendTo("body").css("top","0");
});
mode = true;
}
});*/
searchButton.click(function(){
if(!hide){
runSearch(searchInput.val(), 0);
//togglePages.trigger("click");
}
});
searchInput.keydown(function(event){
if(!hide){
if((event.keyCode == 0xA)||(event.keyCode == 0xD)){
runSearch(searchInput.val(), 0);
//togglePages.trigger("click");
}
}
});
(
$(".imgContainer").live("click",function(){
sankore.sendFileMetadata(createMetaData($(this)));
}));
/*$(window).resize(function(){
disclaimer.width($("body").width()-20);
search.width($("body").width()-20);
toggleIcon.css("margin-left",(togglePages.width()/2 - 7));
})*/
});
function gotoPage(i) {
runSearch(currentTerm, i);
}
// launching the search on planete sankore
function runSearch(term, index) {
currentTerm = term;
currentIndex = index;
var start = index * limit;
var url = "http://planete.sankore.org/xwiki/bin/view/Search/Resources?xpage=plain&category=" + category + "&level=&sort=title&dir=ASC&terms=" + escape(term) + "&start=" + start + "&limit=" + limit;
$.ajax({
url: url,
success: searchComplete,
error: searchFail,
dataType: "json"
});
}
function createMetaData(parent){
var meta = "";
//alert($(this).find("input:hidden").eq(0).val());
meta = "<metadata><data><key>Type</key><value>Image</value></data><data><key>Url</key><value>" +
parent.find("input:hidden").eq(0).val() +
"</value></data><data><key>Content</key><value>" +
parent.find("input:hidden").eq(1).val() +
"</value></data><data><key>Height</key><value>" +
parent.find("input:hidden").eq(2).val() +
"</value></data><data><key>Width</key><value>" +
parent.find("input:hidden").eq(3).val() +
"</value></data><data><key>Title</key><value>" +
parent.find("input:hidden").eq(4).val() +
"</value></data></metadata>";
return meta;
}
</script>
</head>
<body style="font-family: Arial;border: 0 none;">
<div id="searchResult"></div>
</body>
</html>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Planete Sankore Image Search</title>
<link rel="stylesheet" type="text/css" href="css/basic.css"/>
<script type="text/javascript" src="scripts/jquery-1.6.2.min.js"></script>
<script type="text/javascript">
var category = "image";
var thumbnails = true;
var minHeight = 150;
var minWidth = 150;
var currentIndex = 0;
var currentTerm = "";
var limit = 10;
var filtersDisplayed = false; //display or hide filters
function addPaginationLinks(totalResults) {
var curPage = currentIndex; // check what page the app is on
var pagesDiv = $("<div id='resultFooter' class='resultFooter'>");
for (var i = 0; i < 8; i++) {
if (i * limit < totalResults) {
var link = $("<a class='pager_button'></a>").attr('href', 'javascript:gotoPage('+i+');').html(i+1).appendTo(pagesDiv);
if (curPage == i) {
link.addClass('active');
}
}
}
$("#disc_nav_cont #resultFooter").remove();
pagesDiv.insertBefore($('#disclaimer'));
$(".imgContainer").each(function(){
this.addEventListener("dragstart", imageDragging, false);
})
$(".imgContainer").each(function(){
this.addEventListener("dragenter", imageDragenter, false);
})
$(".imgContainer").each(function(){
this.addEventListener("dragleave", imageDragleave, false);
})
$(".imgContainer").each(function(){
this.addEventListener("dragover", imageDragover, false);
})
}
function searchFail(jqXHR, textStatus, errorThrown) {
alert('Impossible to connect to Planete Sankore: ' + textStatus + ' ' + errorThrown);
}
function searchComplete(json) {
// Grab our content div, clear it.
var totalResults = json.totalResults;
var contentDiv = $('#searchResult').empty();
// Loop through our results, printing them to the page.
var results = json.rows;
for (var i = 0; i < results.length; i++) {
// For each result write it's title and image to the screen
var result = results[i];
var imgContainer = $("<div class='imgContainer' draggable='true'>");
//var title = document.createElement('div');
var iUrl = $("<input type='hidden'/>");
var iContent = $("<input type='hidden'/>");
var iHeight = $("<input type='hidden'/>");
var iWidth = $("<input type='hidden'/>");
var iTitle = $("<input type='hidden'/>");
// We use titleNoFormatting so that no HTML tags are left in the
// title
//title.innerHTML = result.title;
var newImg = document.createElement('img');
// There is also a result.file property which has the escaped version
if (thumbnails) {
newImg.src = result.file;
/*if(result.height >= result.width)
newImg.height = minHeight;
else{
newImg.width = minWidth;
//newImg.style.margin = (120 - result.height)/2 + "px 0";
}*/
} else {
newImg.src = "./images/thumbnail_icon.png";
}
var imgWidth = (result.tbWidth > minWidth)?result.tbWidth:minWidth;
var imgHeight = (result.tbHeight > minHeight)?result.tbHeight:minHeight;
imgContainer.width(imgWidth).height(imgHeight);
imgContainer.append($(newImg));
iUrl.attr("value", result.file);
iContent.attr("value", result.title);
iHeight.attr("value", result.height);
iWidth.attr("value", result.width);
iTitle.attr("value",result.title);
//imgContainer.append($(title));
imgContainer.append(iUrl);
imgContainer.append(iContent);
imgContainer.append(iHeight);
imgContainer.append(iWidth);
imgContainer.append(iTitle);
// Put our title + image in the content
imgContainer.appendTo(contentDiv);
}
// Now add links to additional pages of search results.
addPaginationLinks(totalResults);
}
function imageDragging(e){
e.dataTransfer.setData("text/plain",$(this).find("input:hidden").eq(0).val());
// alert($(this).find("input:hidden").eq(0).val());
}
function imageDragleave(e){
return false;
}
function imageDragover(e){
return false;
}
function imageDragenter(e){
return false;
}
$(document).ready(function(){
//variables
var mode = false; //search or view mode
var hide = false; //hide or no main panel
//basic containers and elements
var disc_nav_cont = $("<div id='disc_nav_cont' class='disc_nav_cont'>").appendTo("body");
var disclaimer = $("<div id='disclaimer' class='disclaimer'>Recherche d'images sur Planète Sankoré<div>").appendTo(disc_nav_cont);
var search = $("<div id='search' class='search'>").appendTo("body");
var togglePages = $("<div id='togglePages' class='togglePages'>").appendTo(search);
var toggleIcon = $("<div id='toggleIcon' class='toggleIcon'>").appendTo(togglePages);
var subSearchInput = $("<div id='subSearchInput' class='subSearch'>").appendTo(search);
var subSearchFilter = $("<div id='subSearchFilter' class='subSearch'>").appendTo(search);
var searchInput = $("<input id='searchInput' class='searchInput' type='text'/>").appendTo(subSearchInput);
var searchButton = $("<div id='searchButton' class='searchButton'>").appendTo(subSearchInput);
// var toggleFilters = $("<div id='toggleFilters' class='toggleFilters'>").appendTo(subSearchInput);
//adding filters to the wgt
var selectFilter = $("<select id='sizeFilter' class='filterSelect'>")
.append($("<option value='0'>Any</option>"))
.append($("<option value='1'>Small</option>"))
.append($("<option value='2'>Medium</option>"))
.append($("<option value='3'>Large</option>"))
.append($("<option value='4'>Extra large</option>"));
$("<div class='filterContainer'>").append("<span>Size:</span>").append(selectFilter).appendTo(subSearchFilter);
//mouse click actions
/*
toggleFilters.click(function(){
if(filtersDisplayed){
subSearchFilter.hide();
toggleFilters.css("background-image","url(images/down.png)");
filtersDisplayed = false;
} else {
subSearchFilter.show();
toggleFilters.css("background-image","url(images/up.png)");
filtersDisplayed = true;
}
});
*/
/*togglePages.click(function(event){
if(mode){
hide = false;
$("#search, #disclaimer").slideDown('slow', function(){
toggleIcon.css("background-image","url(images/trgUp.png)");
togglePages.appendTo("#search").css("top","").css("bottom","-14px");
});
mode = false;
} else {
hide = true;
$("#search, #disclaimer").slideUp('slow', function(){
toggleIcon.css("background-image","url(images/trgDown.png)");
togglePages.appendTo("body").css("top","0");
});
mode = true;
}
});*/
searchButton.click(function(){
if(!hide){
runSearch(searchInput.val(), 0);
//togglePages.trigger("click");
}
});
searchInput.keydown(function(event){
if(!hide){
if((event.keyCode == 0xA)||(event.keyCode == 0xD)){
runSearch(searchInput.val(), 0);
//togglePages.trigger("click");
}
}
});
(
$(".imgContainer").live("click",function(){
sankore.sendFileMetadata(createMetaData($(this)));
}));
/*$(window).resize(function(){
disclaimer.width($("body").width()-20);
search.width($("body").width()-20);
toggleIcon.css("margin-left",(togglePages.width()/2 - 7));
})*/
});
function gotoPage(i) {
runSearch(currentTerm, i);
}
// launching the search on planete sankore
function runSearch(term, index) {
currentTerm = term;
currentIndex = index;
var start = index * limit;
var url = "http://planete.sankore.org/xwiki/bin/view/Search/Resources?xpage=plain&category=" + category + "&level=&sort=title&dir=ASC&terms=" + escape(term) + "&start=" + start + "&limit=" + limit;
$.ajax({
url: url,
success: searchComplete,
error: searchFail,
dataType: "json"
});
}
function createMetaData(parent){
var meta = "";
//alert($(this).find("input:hidden").eq(0).val());
meta = "<metadata><data><key>Type</key><value>Image</value></data><data><key>Url</key><value>" +
parent.find("input:hidden").eq(0).val() +
"</value></data><data><key>Content</key><value>" +
parent.find("input:hidden").eq(1).val() +
"</value></data><data><key>Height</key><value>" +
parent.find("input:hidden").eq(2).val() +
"</value></data><data><key>Width</key><value>" +
parent.find("input:hidden").eq(3).val() +
"</value></data><data><key>Title</key><value>" +
parent.find("input:hidden").eq(4).val() +
"</value></data></metadata>";
return meta;
}
</script>
</head>
<body style="font-family: Arial;border: 0 none;">
<div id="searchResult"></div>
</body>
</html>

File diff suppressed because one or more lines are too long

@ -21,7 +21,7 @@
const QString UBFeaturesController::virtualRootName = "root";
void UBFeaturesComputingThread::scanFS(const QUrl & currentPath, const QString & currVirtualPath)
void UBFeaturesComputingThread::scanFS(const QUrl & currentPath, const QString & currVirtualPath, const QSet<QUrl> &pFavoriteSet)
{
Q_ASSERT(QFileInfo(currentPath.toLocalFile()).exists());
@ -47,27 +47,29 @@ void UBFeaturesComputingThread::scanFS(const QUrl & currentPath, const QString &
emit sendFeature(testFeature);
emit featureSent();
emit scanPath(fullFileName);
// featuresList->append(testFeature);
// if ( favoriteSet->find( QUrl::fromLocalFile( fullFileName ) ) != favoriteSet->end() ) {
// featuresList->append( UBFeature( favoritePath, icon, fileName, QUrl::fromLocalFile( fullFileName ), featureType ) );
// }
if ( pFavoriteSet.find(QUrl::fromLocalFile(fullFileName)) != pFavoriteSet.end()) {
//TODO send favoritePath from the controller or make favoritePath public and static
emit sendFeature(UBFeature( "/root/Favorites", icon, fileName, QUrl::fromLocalFile(fullFileName), featureType));
}
if (featureType == FEATURE_FOLDER) {
scanFS(QUrl::fromLocalFile(fullFileName), currVirtualPath + "/" + fileName);
scanFS(QUrl::fromLocalFile(fullFileName), currVirtualPath + "/" + fileName, pFavoriteSet);
}
}
}
void UBFeaturesComputingThread::scanAll(QList<QPair<QUrl, QString> > pScanningData)
void UBFeaturesComputingThread::scanAll(QList<QPair<QUrl, QString> > pScanningData, const QSet<QUrl> &pFavoriteSet)
{
for (int i = 0; i < pScanningData.count(); i++) {
if (abort) {
return;
}
QPair<QUrl, QString> curPair = pScanningData.at(i);
scanFS(curPair.first, curPair.second);
emit scanCategory(UBFeaturesController::categoryNameForVirtualPath(curPair.second));
scanFS(curPair.first, curPair.second, pFavoriteSet);
}
}
@ -84,8 +86,6 @@ int UBFeaturesComputingThread::featuresCount(const QUrl &pPath)
if (featureType != FEATURE_INVALID && !fullFileName.contains(".thumbnail.")) {
noItems++;
} else {
continue;
}
if (featureType == FEATURE_FOLDER) {
@ -114,11 +114,12 @@ QThread(parent)
abort = false;
}
void UBFeaturesComputingThread::compute(const QList<QPair<QUrl, QString> > &pScanningData)
void UBFeaturesComputingThread::compute(const QList<QPair<QUrl, QString> > &pScanningData, QSet<QUrl> *pFavoritesSet)
{
QMutexLocker curLocker(&mMutex);
mScanningData = pScanningData;
mFavoriteSet = *pFavoritesSet;
if (!isRunning()) {
start(LowPriority);
@ -135,6 +136,7 @@ void UBFeaturesComputingThread::run()
mMutex.lock();
QList<QPair<QUrl, QString> > searchData = mScanningData;
QSet<QUrl> favoriteSet = mFavoriteSet;
mMutex.unlock();
if (abort) {
@ -152,7 +154,7 @@ void UBFeaturesComputingThread::run()
emit maxFilesCountEvaluated(fsCnt);
emit scanStarted();
scanAll(searchData);
scanAll(searchData, favoriteSet);
emit scanFinished();
mMutex.lock();
@ -210,9 +212,12 @@ bool UBFeature::isFolder() const
|| elementType == FEATURE_FOLDER;
}
bool UBFeature::isDeletable()const
bool UBFeature::isDeletable() const
{
return elementType == FEATURE_ITEM
|| elementType == FEATURE_AUDIO
|| elementType == FEATURE_VIDEO
|| elementType == FEATURE_IMAGE
|| elementType == FEATURE_FOLDER;
}
@ -238,6 +243,7 @@ UBFeaturesController::UBFeaturesController(QWidget *pParentWidget) :
shapesPath = rootPath + "/Shapes";
trashPath = rootPath + "/Trash";
favoritePath = rootPath + "/Favorites";
webSearchPath = rootPath + "/Web search";
//Initializing physical directories from UBSettings
mUserAudioDirectoryPath = QUrl::fromLocalFile(UBSettings::settings()->userAudioDirectory());
@ -295,11 +301,10 @@ UBFeaturesController::UBFeaturesController(QWidget *pParentWidget) :
connect(&mCThread, SIGNAL(scanStarted()), this, SIGNAL(scanStarted()));
connect(&mCThread, SIGNAL(scanFinished()), this, SIGNAL(scanFinished()));
connect(&mCThread, SIGNAL(maxFilesCountEvaluated(int)), this, SIGNAL(maxFilesCountEvaluated(int)));
//Very unsafe function. Considering using deleteLater() instead
// connect(qApp, SIGNAL(aboutToQuit()), &mCThread, SLOT(terminate()));
connect(&mCThread, SIGNAL(scanCategory(QString)), this, SIGNAL(scanCategory(QString)));
connect(&mCThread, SIGNAL(scanPath(QString)), this, SIGNAL(scanPath(QString)));
QTimer::singleShot(0, this, SLOT(startThread()));
// startThread();
}
void UBFeaturesController::startThread()
@ -323,7 +328,7 @@ void UBFeaturesController::startThread()
<< QPair<QUrl, QString>(trashDirectoryPath, trashPath)
<< QPair<QUrl, QString>(mLibSearchDirectoryPath, rootPath + "/" + "Web search" );
mCThread.compute(computingData);
mCThread.compute(computingData, favoriteSet);
}
void UBFeaturesController::scanFS()
@ -342,6 +347,7 @@ void UBFeaturesController::scanFS()
<< webSearchElement
<< trashElement;
//filling favoriteList
loadFavoriteList();
QList <UBToolsManager::UBToolDescriptor> tools = UBToolsManager::manager()->allTools();
@ -350,54 +356,9 @@ void UBFeaturesController::scanFS()
featuresList->append(UBFeature(appPath, tool.icon.toImage(), tool.label, QUrl(tool.id), FEATURE_INTERNAL));
if (favoriteSet->find(QUrl(tool.id)) != favoriteSet->end()) {
featuresList->append(UBFeature(favoritePath, tool.icon.toImage(), tool.label, QUrl(tool.id), FEATURE_INTERNAL));
}
}
QTime time = QTime::currentTime();
//Claudio:
// don't change the order of the scans
// fileSystemScan( mLibAudiosDirectoryPath, audiosPath);
// fileSystemScan( mLibVideosDirectoryPath, moviesPath);
// fileSystemScan( mLibAnimationsDirectoryPath, flashPath);
// fileSystemScan( mLibPicturesDirectoryPath, picturesPath );
// fileSystemScan( mUserInteractiveDirectoryPath, appPath );
// fileSystemScan( mUserAudioDirectoryPath, audiosPath );
// fileSystemScan( mUserPicturesDirectoryPath, picturesPath );
// fileSystemScan( mUserVideoDirectoryPath, moviesPath );
// fileSystemScan( mUserAnimationDirectoryPath, flashPath );
// fileSystemScan( mLibApplicationsDirectoryPath, appPath );
// fileSystemScan( mLibShapesDirectoryPath, shapesPath );
// fileSystemScan( mLibInteractiveDirectoryPath, interactPath );
// fileSystemScan( trashDirectoryPath, trashPath );
// fileSystemScan( mLibSearchDirectoryPath, rootPath + "/" + "Web search" );
int i =0;
i += featuresCount(mLibAudiosDirectoryPath);
i += featuresCount(mLibVideosDirectoryPath);
i += featuresCount(mLibAnimationsDirectoryPath);
i += featuresCount(mLibPicturesDirectoryPath);
i += featuresCount(mUserInteractiveDirectoryPath);
i += featuresCount(mUserAudioDirectoryPath);
i += featuresCount(mUserPicturesDirectoryPath);
i += featuresCount(mUserVideoDirectoryPath);
i += featuresCount(mUserAnimationDirectoryPath);
i += featuresCount(mLibApplicationsDirectoryPath);
i += featuresCount(mLibShapesDirectoryPath);
i += featuresCount(mLibInteractiveDirectoryPath);
i += featuresCount(trashDirectoryPath);
i += featuresCount(mLibSearchDirectoryPath);
int msecs = QTime(time).msecsTo(QTime::currentTime());
qDebug() << "Loading library" << msecs << "msecs\nNumber of elements" << i;
// emit TopIndexingLimitSet(i);
// emit indexingProgressValueChanged(i / 4);
}
}
}
void UBFeaturesController::fileSystemScan(const QUrl & currentPath, const QString & currVirtualPath)
{
QFileInfoList fileInfoList = UBFileSystemUtils::allElementsInDirectory(currentPath.toLocalFile());
@ -492,7 +453,8 @@ void UBFeaturesController::addToFavorite( const QUrl &path )
{
QFileInfo fileInfo( filePath );
QString fileName = fileInfo.fileName();
UBFeature elem(favoritePath, getIcon( filePath, FEATURE_CATEGORY ), fileName, path, fileTypeFromUrl(filePath) );
UBFeatureElementType type = fileTypeFromUrl(fileInfo.absoluteFilePath());
UBFeature elem(favoritePath, getIcon(filePath, type), fileName, path, fileTypeFromUrl(filePath) );
favoriteSet->insert( path );
saveFavoriteList();
@ -524,7 +486,7 @@ QString UBFeaturesController::fileNameFromUrl( const QUrl &url )
}
UBFeatureElementType UBFeaturesController::fileTypeFromUrl( const QString &path )
UBFeatureElementType UBFeaturesController::fileTypeFromUrl(const QString &path)
{
QFileInfo fileInfo(path);
@ -535,7 +497,7 @@ UBFeatureElementType UBFeaturesController::fileTypeFromUrl( const QString &path
QString fileName = fileInfo.fileName();
QString mimeString = UBFileSystemUtils::mimeTypeFromFileName(fileName);
UBFeatureElementType fileType = fileInfo.isDir() ? FEATURE_FOLDER : FEATURE_ITEM;
UBFeatureElementType fileType = FEATURE_INVALID;
if ( mimeString.contains("application")) {
if (mimeString.contains("application/search")) {
@ -545,7 +507,17 @@ UBFeatureElementType UBFeaturesController::fileTypeFromUrl( const QString &path
}
} else if ( path.contains("uniboardTool://")) {
fileType = FEATURE_INTERNAL;
}
} else if (mimeString.contains("audio")) {
fileType = FEATURE_AUDIO;
} else if (mimeString.contains("video")) {
fileType = FEATURE_VIDEO;
} else if (mimeString.contains("image")) {
fileType = FEATURE_IMAGE;
} else if (fileInfo.isDir()) {
fileType = FEATURE_FOLDER;
} else {
fileType = FEATURE_INVALID;
}
return fileType;
}
@ -554,64 +526,65 @@ QImage UBFeaturesController::getIcon(const QString &path, UBFeatureElementType p
{
if (pFType == FEATURE_FOLDER) {
return QImage(":images/libpalette/folder.svg");
} else if (pFType == FEATURE_INTERACTIVE) {
} else if (pFType == FEATURE_INTERACTIVE || pFType == FEATURE_SEARCH) {
return QImage(UBGraphicsWidgetItem::iconFilePath(QUrl::fromLocalFile(path)));
} else if (pFType == FEATURE_INTERNAL) {
return QImage(UBToolsManager::manager()->iconFromToolId(path));
} else if (pFType == FEATURE_AUDIO) {
return QImage(":images/libpalette/soundIcon.svg");
} else if (pFType == FEATURE_VIDEO) {
return QImage(":images/libpalette/movieIcon.svg");
} else if (pFType == FEATURE_IMAGE) {
QImage pix(path);
if (pix.isNull()) {
pix = QImage(":images/libpalette/notFound.png");
} else {
pix = pix.scaledToWidth(qMin(UBSettings::maxThumbnailWidth, pix.width()));
}
return pix;
}
if ( path.contains("uniboardTool://") ) {
return QImage( UBToolsManager::manager()->iconFromToolId(path) );
} if ( UBFileSystemUtils::mimeTypeFromFileName(path).contains("application")) {
return QImage( UBGraphicsWidgetItem::iconFilePath( QUrl::fromLocalFile(path) ) );
}
QImage thumb;
QString thumbnailPath = UBFileSystemUtils::thumbnailPath(path);
if ( QFileInfo( thumbnailPath ).exists() )
thumb = QImage( thumbnailPath );
else thumb = createThumbnail( path );
return thumb;
return QImage(":images/libpalette/notFound.png");
}
bool UBFeaturesController::isDeletable( const QUrl &url )
{
UBFeatureElementType type = fileTypeFromUrl( fileNameFromUrl(url) );
return type == FEATURE_ITEM;
UBFeatureElementType type = fileTypeFromUrl(fileNameFromUrl(url));
return type == FEATURE_AUDIO
|| type == FEATURE_VIDEO
|| type == FEATURE_IMAGE
|| type == FEATURE_ITEM;
}
QString UBFeaturesController::categoryNameForVirtualPath(const QString &str)
{
QString result;
int ind = str.lastIndexOf("/");
if (ind != -1) {
result = str.right(str.count() - ind - 1);
}
return result;
}
QImage UBFeaturesController::createThumbnail(const QString &path)
{
QString thumbnailPath = UBFileSystemUtils::thumbnailPath(path);
QString thumbnailPath = path;
QString mimetype = UBFileSystemUtils::mimeTypeFromFileName(path);
QString extension = QFileInfo(path).completeSuffix();
if ( mimetype.contains("audio" ))
if ( mimetype.contains("audio" )) {
thumbnailPath = ":images/libpalette/soundIcon.svg";
else if ( mimetype.contains("video") )
} else if ( mimetype.contains("video")) {
thumbnailPath = ":images/libpalette/movieIcon.svg";
else
{
if ( extension.startsWith("svg", Qt::CaseInsensitive) || extension.startsWith("svgz", Qt::CaseInsensitive) )
{
thumbnailPath = path;
}
else
{
QImage pix(path);
if (!pix.isNull())
{
pix = pix.scaledToWidth(qMin(UBSettings::maxThumbnailWidth, pix.width()), Qt::SmoothTransformation);
pix.save(thumbnailPath);
UBPlatformUtils::hideFile(thumbnailPath);
}
else{
thumbnailPath = ":images/libpalette/notFound.png";
}
} else {
QImage pix(path);
if (!pix.isNull()) {
pix = pix.scaledToWidth(qMin(UBSettings::maxThumbnailWidth, pix.width()), Qt::SmoothTransformation);
return pix;
} else {
thumbnailPath = ":images/libpalette/notFound.png";
}
}
return QImage(thumbnailPath);

@ -33,7 +33,7 @@ class UBFeaturesComputingThread : public QThread
public:
explicit UBFeaturesComputingThread(QObject *parent = 0);
virtual ~UBFeaturesComputingThread();
void compute(const QList<QPair<QUrl, QString> > &pScanningData);
void compute(const QList<QPair<QUrl, QString> > &pScanningData, QSet<QUrl> *pFavoritesSet);
protected:
void run();
@ -44,12 +44,14 @@ signals:
void scanStarted();
void scanFinished();
void maxFilesCountEvaluated(int max);
void scanCategory(const QString &str);
void scanPath(const QString &str);
public slots:
private:
void scanFS(const QUrl & currentPath, const QString & currVirtualPath);
void scanAll(QList<QPair<QUrl, QString> > pScanningData);
void scanFS(const QUrl & currentPath, const QString & currVirtualPath, const QSet<QUrl> &pFavoriteSet);
void scanAll(QList<QPair<QUrl, QString> > pScanningData, const QSet<QUrl> &pFavoriteSet);
int featuresCount(const QUrl &pPath);
int featuresCountAll(QList<QPair<QUrl, QString> > pScanningData);
@ -59,6 +61,7 @@ private:
QUrl mScanningPath;
QString mScanningVirtualPath;
QList<QPair<QUrl, QString> > mScanningData;
QSet<QUrl> mFavoriteSet;
bool restart;
bool abort;
};
@ -72,6 +75,9 @@ enum UBFeatureElementType
FEATURE_INTERACTIVE,
FEATURE_INTERNAL,
FEATURE_ITEM,
FEATURE_AUDIO,
FEATURE_VIDEO,
FEATURE_IMAGE,
FEATURE_TRASH,
FEATURE_FAVORITE,
FEATURE_SEARCH,
@ -107,6 +113,7 @@ public:
private:
QString virtualDir;
QString virtualPath;
QImage mThumbnail;
QString mName;
QUrl mPath;
@ -167,6 +174,7 @@ public:
static QImage getIcon( const QString &path, UBFeatureElementType pFType );
static bool isDeletable( const QUrl &url );
static char featureTypeSplitter() {return ':';}
static QString categoryNameForVirtualPath(const QString &str);
static const QString virtualRootName;
@ -178,6 +186,8 @@ signals:
void scanStarted();
void scanFinished();
void featureAddedFromThread();
void scanCategory(const QString &);
void scanPath(const QString &);
private slots:
void addNewFolder(QString name);
@ -233,6 +243,7 @@ private:
QString interactPath;
QString trashPath;
QString favoritePath;
QString webSearchPath;
int mLastItemOffsetIndex;
UBFeature currentElement;

@ -81,7 +81,9 @@ UBFeaturesWidget::UBFeaturesWidget(QWidget *parent, const char *name)
connect(controller, SIGNAL(scanStarted()), mActionBar, SLOT(lockIt()));
connect(controller, SIGNAL(scanFinished()), mActionBar, SLOT(unlockIt()));
connect(controller, SIGNAL(maxFilesCountEvaluated(int)), centralWidget, SIGNAL(maxFilesCountEvaluated(int)));
connect(controller, SIGNAL(featureAddedFromThread()), centralWidget, SLOT(increaseStatusBarValue()));
connect(controller, SIGNAL(featureAddedFromThread()), centralWidget, SIGNAL(increaseStatusBarValue()));
connect(controller, SIGNAL(scanCategory(QString)), centralWidget, SIGNAL(scanCategory(QString)));
connect(controller, SIGNAL(scanPath(QString)), centralWidget, SIGNAL(scanPath(QString)));
}
UBFeaturesWidget::~UBFeaturesWidget()
@ -497,15 +499,14 @@ UBFeaturesCentralWidget::UBFeaturesCentralWidget(QWidget *parent) : QWidget(pare
connect(this, SIGNAL(sendFileNameList(QStringList)), dlg, SLOT(setFileNameList(QStringList)));
//Progress bar to show scanning progress
QProgressBar *progressBar = new QProgressBar();
UBFeaturesProgressInfo *progressBar = new UBFeaturesProgressInfo();
mAdditionalDataContainer->addWidget(progressBar);
mAdditionalDataContainer->setCurrentIndex(ProgressBarWidget);
progressBar->setMinimum(0);
progressBar->setValue(0);
progressBar->setMaximum(10000);
connect(this, SIGNAL(maxFilesCountEvaluated(int)), progressBar, SLOT(setMaximum(int)));
connect(this, SIGNAL(maxFilesCountEvaluated(int)), progressBar, SLOT(setProgressMax(int)));
connect(this, SIGNAL(increaseStatusBarValue()), progressBar, SLOT(increaseProgressValue()));
connect(this, SIGNAL(scanCategory(QString)), progressBar, SLOT(setCommmonInfoText(QString)));
connect(this, SIGNAL(scanPath(QString)), progressBar, SLOT(setDetailedInfoText(QString)));
mLayout->addWidget(mStackedWidget, 1);
mLayout->addWidget(mAdditionalDataContainer, 0);
@ -546,6 +547,11 @@ UBFeature UBFeaturesCentralWidget::getCurElementFromProperties()
void UBFeaturesCentralWidget::showAdditionalData(AddWidget pWidgetType, AddWidgetState pState)
{
if (!mAdditionalDataContainer->widget(pWidgetType)) {
qDebug() << "can't find widget specified by UBFeaturesCentralWidget::showAdditionalData(AddWidget pWidgetType, AddWidgetState pState)";
return;
}
mAdditionalDataContainer->setMaximumHeight(mAdditionalDataContainer->widget(pWidgetType)->sizeHint().height());
mAdditionalDataContainer->setCurrentIndex(pWidgetType);
@ -573,46 +579,21 @@ void UBFeaturesCentralWidget::hideAdditionalData()
void UBFeaturesCentralWidget::scanStarted()
{
if (!mAdditionalDataContainer->widget(ProgressBarWidget)) {
return;
}
QProgressBar *progressBar = qobject_cast<QProgressBar*>(mAdditionalDataContainer->widget(ProgressBarWidget));
if (progressBar && !progressBar->isVisible()) {
showAdditionalData((AddWidget)1);
}
showAdditionalData(ProgressBarWidget);
}
void UBFeaturesCentralWidget::scanFinished()
{
if (!mAdditionalDataContainer->widget(ProgressBarWidget)) {
return;
}
QProgressBar *progressBar = qobject_cast<QProgressBar*>(mAdditionalDataContainer->widget(ProgressBarWidget));
if (progressBar && progressBar->isVisible()) {
hideAdditionalData();
qDebug() << "progressBar max value is " << progressBar->maximum();
}
}
void UBFeaturesCentralWidget::increaseStatusBarValue()
{
if (!mAdditionalDataContainer->widget(ProgressBarWidget)) {
return;
}
QProgressBar *progressBar = qobject_cast<QProgressBar*>(mAdditionalDataContainer->widget(ProgressBarWidget));
if (progressBar) {
progressBar->setValue(progressBar->value() + 1);
}
hideAdditionalData();
}
UBFeaturesNewFolderDialog::UBFeaturesNewFolderDialog(QWidget *parent) : QWidget(parent)
{
this->setStyleSheet("background:white;");
QVBoxLayout *mainLayout = new QVBoxLayout();
setLayout(mainLayout);
QVBoxLayout *mainLayout = new QVBoxLayout(this);
QVBoxLayout *labelLayout = new QVBoxLayout(this);
QVBoxLayout *labelLayout = new QVBoxLayout();
QLabel *mLabel = new QLabel(labelText, this);
mLineEdit = new QLineEdit(this);
@ -622,7 +603,7 @@ UBFeaturesNewFolderDialog::UBFeaturesNewFolderDialog(QWidget *parent) : QWidget(
labelLayout->addWidget(mLabel);
labelLayout->addWidget(mLineEdit);
QHBoxLayout *buttonLayout = new QHBoxLayout(this);
QHBoxLayout *buttonLayout = new QHBoxLayout();
acceptButton = new QPushButton(acceptText, this);
QPushButton *cancelButton = new QPushButton(cancelText, this);
@ -676,6 +657,64 @@ void UBFeaturesNewFolderDialog::reactOnTextChanged(const QString &pStr)
}
}
UBFeaturesProgressInfo::UBFeaturesProgressInfo(QWidget *parent) :
QWidget(parent),
mProgressBar(0),
mCommonInfoLabel(0),
mDetailedInfoLabel(0)
{
QVBoxLayout *mainLayer = new QVBoxLayout(this);
mProgressBar = new QProgressBar(this);
// setting defaults
mProgressBar->setMinimum(0);
mProgressBar->setMaximum(100000);
mProgressBar->setValue(0);
mProgressBar->setStyleSheet("background:white");
mCommonInfoLabel = new QLabel(this);
mDetailedInfoLabel = new QLabel(this);
mDetailedInfoLabel->setAlignment(Qt::AlignRight);
mCommonInfoLabel->hide();
mDetailedInfoLabel->hide();
mainLayer->addWidget(mCommonInfoLabel);
mainLayer->addWidget(mDetailedInfoLabel);
mainLayer->addWidget(mProgressBar);
}
void UBFeaturesProgressInfo::setCommmonInfoText(const QString &str)
{
mProgressBar->setFormat(str + tr(" load") + "(%p%)");
}
void UBFeaturesProgressInfo::setDetailedInfoText(const QString &str)
{
mDetailedInfoLabel->setText(str);
}
void UBFeaturesProgressInfo::setProgressMax(int pValue)
{
mProgressBar->setMaximum(pValue);
}
void UBFeaturesProgressInfo::setProgressMin(int pValue)
{
mProgressBar->setMinimum(pValue);
}
void UBFeaturesProgressInfo::increaseProgressValue()
{
mProgressBar->setValue(mProgressBar->value() + 1);
}
void UBFeaturesProgressInfo::sendFeature(UBFeature pFeature)
{
Q_UNUSED(pFeature);
}
UBFeaturesWebView::UBFeaturesWebView(QWidget* parent, const char* name):QWidget(parent)
, mpView(NULL)
, mpWebSettings(NULL)
@ -1294,9 +1333,12 @@ Qt::ItemFlags UBFeaturesModel::flags( const QModelIndex &index ) const
{
UBFeature item = index.data( Qt::UserRole + 1 ).value<UBFeature>();
if ( item.getType() == FEATURE_INTERACTIVE
|| item.getType() == FEATURE_ITEM
|| item.getType() == FEATURE_INTERNAL
|| item.getType() == FEATURE_FOLDER)
|| item.getType() == FEATURE_ITEM
|| item.getType() == FEATURE_AUDIO
|| item.getType() == FEATURE_VIDEO
|| item.getType() == FEATURE_IMAGE
|| item.getType() == FEATURE_INTERNAL
|| item.getType() == FEATURE_FOLDER)
resultFlags |= Qt::ItemIsDragEnabled;
@ -1337,12 +1379,15 @@ bool UBFeaturesSearchProxyModel::filterAcceptsRow( int sourceRow, const QModelIn
/*QString name = sourceModel()->data(index, Qt::DisplayRole).toString();
eUBLibElementType type = (eUBLibElementType)sourceModel()->data(index, Qt::UserRole + 1).toInt();*/
UBFeature feature = sourceModel()->data(index, Qt::UserRole + 1).value<UBFeature>();
UBFeature feature = sourceModel()->data(index, Qt::UserRole + 1).value<UBFeature>();
bool isFile = feature.getType() == FEATURE_INTERACTIVE
|| feature.getType() == FEATURE_INTERNAL
|| feature.getType() == FEATURE_ITEM;
|| feature.getType() == FEATURE_INTERNAL
|| feature.getType() == FEATURE_ITEM
|| feature.getType() == FEATURE_AUDIO
|| feature.getType() == FEATURE_VIDEO
|| feature.getType() == FEATURE_IMAGE;
return isFile && filterRegExp().exactMatch( feature.getName() );
return isFile && filterRegExp().exactMatch( feature.getName() );
}
bool UBFeaturesPathProxyModel::filterAcceptsRow( int sourceRow, const QModelIndex & sourceParent )const

@ -45,6 +45,7 @@ class UBFeaturesNavigatorWidget;
class UBFeaturesMimeData;
class UBFeaturesCentralWidget;
class UBFeaturesNewFolderDialog;
class UBFeaturesProgressBar;
class UBFeaturesWidget : public UBDockPaletteWidget
{
@ -189,7 +190,6 @@ public:
void setPropertiesThumbnail(const QPixmap &pix);
StackElement currentView() const {return static_cast<StackElement>(mStackedWidget->currentIndex());}
UBFeature getCurElementFromProperties();
void showAdditionalData(AddWidget pWidgetType, AddWidgetState pState = NonModal);
void setLockedExcludingAdditional(bool pLock);
@ -207,6 +207,12 @@ signals:
// progressbar widget related signals
void maxFilesCountEvaluated(int pValue);
void increaseStatusBarValue();
void scanCategory(const QString &);
void scanPath(const QString &);
public slots:
void showAdditionalData(AddWidget pWidgetType, AddWidgetState pState = NonModal);
private slots:
void createNewFolderSlot(QString pStr);
@ -214,7 +220,6 @@ private slots:
void scanStarted();
void scanFinished();
void increaseStatusBarValue();
private:
@ -252,6 +257,27 @@ private:
};
class UBFeaturesProgressInfo: public QWidget {
Q_OBJECT
public:
UBFeaturesProgressInfo(QWidget *parent = 0);
private slots:
void setCommmonInfoText(const QString &str);
void setDetailedInfoText(const QString &str);
void setProgressMin(int pValue);
void setProgressMax(int pValue);
void increaseProgressValue();
void sendFeature(UBFeature pFeature);
private:
QProgressBar *mProgressBar;
QLabel *mCommonInfoLabel;
QLabel *mDetailedInfoLabel;
};
class UBFeaturesWebView : public QWidget
{
Q_OBJECT

Loading…
Cancel
Save