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

preferencesAboutTextFull
Ivan Ilin 13 years ago
commit 96d942c8cc
  1. 2
      Sankore_3.1.pro
  2. 2
      release.linux.sh
  3. BIN
      resources/i18n/sankore_es.qm
  4. 2860
      resources/i18n/sankore_es.ts
  5. 240
      resources/images/libpalette/WebSearchCategory.svg
  6. 219
      resources/library/sankoreInteractivities/ord-phrases.wgt/template/scripts/template2.js
  7. 257
      resources/library/sankoreInteractivities/ord-words.wgt/template/scripts/template2.js
  8. 260
      resources/library/sankoreInteractivities/spl-phrase.wgt/scripts/app.js
  9. 270
      resources/library/sankoreInteractivities/spl-text.wgt/scripts/app2.js
  10. 170
      resources/library/sankoreInteractivities/spl-word.wgt/scripts/spl-word.js
  11. 3
      resources/sankore.qrc
  12. 21
      resources/style.qss
  13. 180
      src/board/UBBoardPaletteManager.cpp
  14. 1
      src/board/UBBoardPaletteManager.h
  15. 35
      src/board/UBLibraryController.cpp
  16. 3
      src/board/UBLibraryController.h
  17. 11
      src/core/UBApplicationController.cpp
  18. 7
      src/core/UBPersistenceManager.cpp
  19. 2
      src/core/UBPersistenceManager.h
  20. 9
      src/core/UBSettings.cpp
  21. 1
      src/core/UBSettings.h
  22. 88
      src/desktop/UBDesktopAnnotationController.cpp
  23. 8
      src/desktop/UBDesktopAnnotationController.h
  24. 18
      src/document/UBDocumentController.cpp
  25. 6
      src/document/UBDocumentController.h
  26. 1
      src/domain/UBGraphicsItemDelegate.cpp
  27. 3
      src/frameworks/UBFileSystemUtils.cpp
  28. 29
      src/gui/UBCachePropertiesWidget.cpp
  29. 5
      src/gui/UBDocumentNavigator.cpp
  30. 57
      src/gui/UBKeyboardPalette.cpp
  31. 9
      src/gui/UBKeyboardPalette.h
  32. 63
      src/gui/UBLibItemProperties.cpp
  33. 6
      src/gui/UBLibItemProperties.h
  34. 61
      src/gui/UBLibNavigatorWidget.cpp
  35. 8
      src/gui/UBLibNavigatorWidget.h
  36. 45
      src/gui/UBLibPathViewer.cpp
  37. 8
      src/gui/UBLibPathViewer.h
  38. 86
      src/gui/UBLibWebView.cpp
  39. 27
      src/gui/UBLibWebView.h
  40. 66
      src/gui/UBLibWidget.cpp
  41. 14
      src/gui/UBLibWidget.h
  42. 26
      src/gui/UBLibraryWidget.cpp
  43. 3
      src/gui/UBLibraryWidget.h
  44. 24
      src/gui/UBMainWindow.cpp
  45. 5
      src/gui/UBMainWindow.h
  46. 41
      src/gui/UBUpdateDlg.cpp
  47. 6
      src/gui/gui.pri
  48. 20
      src/network/UBNetworkAccessManager.cpp
  49. 2
      src/tools/UBGraphicsCache.cpp
  50. 31
      src/web/UBWebController.cpp
  51. 14
      src/web/UBWebController.h
  52. 3
      src/web/browser/WBWebView.cpp

@ -7,7 +7,7 @@ CONFIG += debug_and_release \
no_include_pwd no_include_pwd
VERSION_MAJ = 1 VERSION_MAJ = 1
VERSION_MIN = 28 VERSION_MIN = 35
VERSION_TYPE = b # a = alpha, b = beta, r = release, other => error VERSION_TYPE = b # a = alpha, b = beta, r = release, other => error
VERSION_PATCH = 00 VERSION_PATCH = 00

@ -19,7 +19,7 @@ make clean
rm -rf build/linux/release/ rm -rf build/linux/release/
rm -rf install rm -rf install
QT_PATH="/usr/local/Trolltech/Qt-4.7.3" QT_PATH="../Qt-sankore3.1"
PLUGINS_PATH="$QT_PATH/plugins" PLUGINS_PATH="$QT_PATH/plugins"
QMAKE_PATH="$QT_PATH/bin/qmake" QMAKE_PATH="$QT_PATH/bin/qmake"

Binary file not shown.

File diff suppressed because it is too large Load Diff

@ -0,0 +1,240 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Generator: Adobe Illustrator 15.0.0, SVG Export Plug-In -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
version="1.2"
x="0px"
y="0px"
width="96px"
height="96px"
viewBox="0 -8.898 96 96"
overflow="visible"
xml:space="preserve"
id="svg2"
inkscape:version="0.48.1 r9760"
sodipodi:docname="folder.svg"><metadata
id="metadata70"><rdf:RDF><cc:Work
rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" /><dc:title></dc:title></cc:Work></rdf:RDF></metadata><sodipodi:namedview
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1"
objecttolerance="10"
gridtolerance="10"
guidetolerance="10"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="1280"
inkscape:window-height="776"
id="namedview68"
showgrid="false"
inkscape:zoom="3"
inkscape:cx="-12.833333"
inkscape:cy="48"
inkscape:window-x="0"
inkscape:window-y="24"
inkscape:window-maximized="1"
inkscape:current-layer="svg2" />
<defs
id="defs4"><linearGradient
id="linearGradient3819"><stop
style="stop-color:#bcd8dc;stop-opacity:1;"
offset="0"
id="stop3821" /><stop
style="stop-color:#7ecbdc;stop-opacity:0;"
offset="1"
id="stop3823" /></linearGradient>
<radialGradient
inkscape:collect="always"
xlink:href="#linearGradient3819"
id="radialGradient3825"
cx="71.333336"
cy="70.5"
fx="71.333336"
fy="70.5"
r="7.6666665"
gradientTransform="matrix(1,0,0,0.97826089,0,1.5326073)"
gradientUnits="userSpaceOnUse" /></defs>
<g
id="g6">
<path
fill="none"
stroke="#000000"
stroke-miterlimit="10"
d="M0.75,63.903"
id="path8" />
<linearGradient
id="SVGID_1_"
gradientUnits="userSpaceOnUse"
x1="38.2183"
y1="69.7495"
x2="38.2183"
y2="0.7495">
<stop
offset="0"
style="stop-color:#B8B6B7"
id="stop11" />
<stop
offset="1"
style="stop-color:#D9D9DE"
id="stop13" />
</linearGradient>
<path
fill="url(#SVGID_1_)"
d="M75.687,17.069v-5.114c0-1.247-1.021-2.268-2.268-2.268h-42.67V3.75c0-1.657-1.343-3-3-3H3.75 c-1.657,0-3,1.343-3,3v60c0,3.313,1.116,6,2.772,6c1.657,0,2.657-2.682,3.228-6l5.71-44.432c0.159-1.237,1.31-2.249,2.557-2.249 H75.687"
id="path15" />
<path
fill="none"
stroke="#000000"
stroke-miterlimit="10"
d="M0.75,63.903"
id="path17" />
<linearGradient
id="SVGID_2_"
gradientUnits="userSpaceOnUse"
x1="45.7817"
y1="69.7837"
x2="45.7817"
y2="17.0342">
<stop
offset="0"
style="stop-color:#EBEBED"
id="stop20" />
<stop
offset="1"
style="stop-color:#FFFFFF"
id="stop22" />
</linearGradient>
<path
fill="url(#SVGID_2_)"
d="M3.493,69.703c1.657,0.001,2.66-2.679,3.235-5.997l5.76-44.425c0.161-1.237,1.312-2.248,2.559-2.246 l71.136,0.08c1.246,0.001,2.079,1.006,1.851,2.232l-7.891,42.213c-0.229,1.226-0.789,3.18-1.244,4.341c0,0-1.522,3.886-3.18,3.884 l-71.45-0.08L3.493,69.703z"
id="path24" />
<linearGradient
id="SVGID_3_"
gradientUnits="userSpaceOnUse"
x1="47.1133"
y1="69.7495"
x2="47.1133"
y2="19.7071">
<stop
offset="0"
style="stop-color:#C8C8CC"
id="stop27" />
<stop
offset="0.0241"
style="stop-color:#CBCBCF"
id="stop29" />
<stop
offset="0.1455"
style="stop-color:#D6D6DB"
id="stop31" />
<stop
offset="0.2577"
style="stop-color:#D9D9DE"
id="stop33" />
<stop
offset="1"
style="stop-color:#E5E5E9"
id="stop35" />
</linearGradient>
<path
fill="url(#SVGID_3_)"
d="M6.184,69.75c1.605,0,2.574-2.547,3.126-5.699l5.53-42.207c0.154-1.175,1.268-2.136,2.476-2.136 h68.896c1.208,0,2.016,0.953,1.795,2.118l-7.596,40.108c-0.22,1.164-0.761,3.021-1.2,4.124c0,0-1.47,3.692-3.075,3.692H6.935H6.184 z"
id="path37" />
<g
id="g39">
<linearGradient
id="SVGID_4_"
gradientUnits="userSpaceOnUse"
x1="3.6626"
y1="43.4028"
x2="75.8658"
y2="43.4028">
<stop
offset="0"
style="stop-color:#848685"
id="stop42" />
<stop
offset="0.0053"
style="stop-color:#888A89"
id="stop44" />
<stop
offset="0.0344"
style="stop-color:#9A9C9B"
id="stop46" />
<stop
offset="0.0687"
style="stop-color:#A7A9A9"
id="stop48" />
<stop
offset="0.113"
style="stop-color:#AFB0B1"
id="stop50" />
<stop
offset="0.2025"
style="stop-color:#B1B3B4"
id="stop52" />
<stop
offset="0.4988"
style="stop-color:#AFB0B1"
id="stop54" />
<stop
offset="0.6946"
style="stop-color:#A6A7A7"
id="stop56" />
<stop
offset="0.8607"
style="stop-color:#979898"
id="stop58" />
<stop
offset="1"
style="stop-color:#848685"
id="stop60" />
</linearGradient>
<path
fill="url(#SVGID_4_)"
d="M3.663,69.047c0.725-0.279,1.739-1.881,2.349-5.424l5.705-44.401 c0.209-1.628,1.659-2.903,3.3-2.903h60.849v1.5H15.017c-0.871,0-1.701,0.73-1.813,1.594l-5.71,44.433 c-0.735,4.274-1.954,6.455-3.722,6.642L3.663,69.047z"
id="path62" />
</g>
<path
fill="none"
stroke="#848685"
stroke-width="1.5"
stroke-miterlimit="10"
d="M75.687,17.069v-5.114 c0-1.247-1.021-2.268-2.268-2.268h-42.67V3.75c0-1.657-1.343-3-3-3H3.75c-1.657,0-3,1.343-3,3v60c0,3.313,1.116,6,2.772,6"
id="path64" />
<path
fill="none"
stroke="#848685"
stroke-width="1.5"
stroke-miterlimit="10"
d="M75.819,17.069h10.333 c1.247,0,2.081,1.003,1.853,2.229l-7.842,42.223c-0.228,1.226-0.785,3.18-1.239,4.342c0,0-1.519,3.887-3.175,3.887H3.522"
id="path66" />
</g>
<path
sodipodi:type="arc"
style="opacity:1;fill:#00a9dc;fill-opacity:1;stroke:#0078c5;stroke-opacity:1;stroke-width:1.60000000000000009;stroke-miterlimit:4;stroke-dasharray:none"
id="path3047"
sodipodi:cx="70.833336"
sodipodi:cy="71.5"
sodipodi:rx="15.166667"
sodipodi:ry="15.166667"
d="m 86.000003,71.5 a 15.166667,15.166667 0 1 1 -30.333334,0 15.166667,15.166667 0 1 1 30.333334,0 z"
transform="translate(2.3333333,-7.2313333)" /><path
sodipodi:type="arc"
style="fill:url(#radialGradient3825);fill-opacity:1.0;stroke:none"
id="path3817"
sodipodi:cx="71.333336"
sodipodi:cy="70.5"
sodipodi:rx="7.6666665"
sodipodi:ry="7.5"
d="m 79.000002,70.5 a 7.6666665,7.5 0 1 1 -15.333333,0 7.6666665,7.5 0 1 1 15.333333,0 z"
transform="matrix(1.8043479,0,0,1.7111112,-55.876816,-57.031334)" /></svg>

After

Width:  |  Height:  |  Size: 6.7 KiB

@ -5,12 +5,12 @@
function startEditing() function startEditing()
{ {
modeEdit(); modeEdit();
} }
function stopEditing() function stopEditing()
{ {
modeView(); modeView();
} }
function initialize() function initialize()
@ -20,7 +20,7 @@ function initialize()
function checkResponse() function checkResponse()
{ {
checkWord(); checkWord();
} }
/* /*
/ END sankore api / END sankore api
@ -28,7 +28,16 @@ function checkResponse()
var sentence = "this is\nan example\nsentence"; var sentence = "";
var curSentence = "";
if(window.sankore){
sentence = (sankore.preference("rightOrdPhrases", ""))?sankore.preference("rightOrdPhrases", ""):"this is\nan example\nsentence";
curSentence = (sankore.preference("currentOrdPhrases", ""))?sankore.preference("currentOrdPhrases", ""):"";
} else {
sentence = "this is\nan example\nsentence";
}
var doCheck = true; var doCheck = true;
// array of dom elements // array of dom elements
@ -47,10 +56,10 @@ var widget_padding = 100;
function str_replace( w, b, s ){ function str_replace( w, b, s ){
while( s.indexOf( w ) != -1 ){ while( s.indexOf( w ) != -1 ){
s = s.replace( w, b ); s = s.replace( w, b );
} }
return s; return s;
} }
/* /*
@ -61,16 +70,16 @@ shuffles an array
*/ */
function shuffle( arr ) function shuffle( arr )
{ {
var pos, tmp; var pos, tmp;
for( var i = 0; i < arr.length; i++ ) for( var i = 0; i < arr.length; i++ )
{ {
pos = Math.round( Math.random() * ( arr.length - 1 ) ); pos = Math.round( Math.random() * ( arr.length - 1 ) );
tmp = arr[pos]; tmp = arr[pos];
arr[pos] = arr[i]; arr[pos] = arr[i];
arr[i] = tmp; arr[i] = tmp;
} }
return arr; return arr;
} }
/* /*
@ -81,34 +90,34 @@ returns array of dom elements
*/ */
function createElements( sentence ) function createElements( sentence )
{ {
var el; var el;
var elements = []; var elements = [];
var phrases = sentence.split( "\n" ); var phrases = sentence.split( "\n" );
for( i in phrases ) for( i in phrases )
{ {
el = document.createElement( "div" ); el = document.createElement( "div" );
$( el ).addClass( "phrase" ).text( phrases[i] ); $( el ).addClass( "phrase" ).text( phrases[i] );
elements.push( el ); elements.push( el );
} }
return elements; return elements;
} }
function checkSentence() function checkSentence()
{ {
if( !doCheck ) if( !doCheck )
return; return;
var ph = []; var ph = [];
$( "#mp_word .phrase" ).each( function() $( "#mp_word .phrase" ).each( function()
{ {
ph.push( $( this ).text() ); ph.push( $( this ).text() );
}); });
if( ph.join( "\n" ) == str_replace( "\r", "", sentence ) ){ if( ph.join( "\n" ) == str_replace( "\r", "", sentence ) ){
$( "#mp_word .phrase" ).addClass( "right" ); $( "#mp_word .phrase" ).addClass( "right" );
} }
} }
/* /*
@ -119,49 +128,56 @@ turns the widget into the view mode
*/ */
function modeView() function modeView()
{ {
if( editMode ){ if( editMode ){
sentence = str_replace( "\r", "", $( "#mp_word textarea" ).attr( "value" ) ); sentence = str_replace( "\r", "", $( "#mp_word textarea" ).attr( "value" ) );
var p = sentence.split( "\n" ); var p = sentence.split( "\n" );
var p2 = []; var p2 = [];
var t; var t;
for( var i in p ) for( var i in p )
{ {
t = jQuery.trim( p[i] ); t = jQuery.trim( p[i] );
if( t ) p2.push( t ); if( t ) p2.push( t );
} }
sentence = p2.join( "\n" ); sentence = p2.join( "\n" );
} }
// if no sankore api, insert edit button // if no sankore api, insert edit button
if( !isSankore ){ if( !isSankore ){
$( "#mp_setup" ).empty().append( '<input type="button" value="Edit">' ); $( "#mp_setup" ).empty().append( '<input type="button" value="Edit">' );
$( "#mp_setup input:button" ).click( function(){ $( "#mp_setup input:button" ).click( function(){
modeEdit(); modeEdit();
}); });
} }
// clean the previous word // clean the previous word
$( "#mp_word" ).empty(); $( "#mp_word" ).empty();
// create new set of elements var phrases;
var phrases = shuffle( createElements( sentence ) ); // create new set of elements
for( i in phrases ){ if(window.sankore && curSentence && !editMode)
$("#mp_word").append( phrases[i] ); phrases = createElements( curSentence );
} else
phrases = shuffle( createElements( sentence ) );
for( i in phrases ){
$("#mp_word").append( phrases[i] );
}
// in sankore api there would be a function to check // in sankore api there would be a function to check
// the answer, so no update parameter would be needed // the answer, so no update parameter would be needed
$( "#mp_word" ).sortable(); $( "#mp_word" ).sortable();
if( !isSankore ){ if( !isSankore ){
$( "#mp_word" ).sortable( { update: checkSentence } ); $( "#mp_word" ).sortable( {
} else update: checkSentence
$( "#mp_word" ).sortable(); } );
} else
// adjustHeight $( "#mp_word" ).sortable();
var aHeight = $( phrases[0] ).outerHeight( true );
// adjustHeight
var aHeight = $( phrases[0] ).outerHeight( true );
// apply new width // apply new width
adjust( aHeight * phrases.length ); adjust( aHeight * phrases.length );
} }
@ -172,11 +188,13 @@ adjust width or height
*/ */
function adjust( height ) function adjust( height )
{ {
$( "#mp_word" ).animate( {height: height } ); $( "#mp_word" ).animate( {
// if viewed as a widget, resize the window height: height
if( !isBrowser ){ } );
window.resizeTo( widget.width, height + widget_padding ); // if viewed as a widget, resize the window
} if( !isBrowser ){
window.resizeTo( widget.width, height + widget_padding );
}
} }
/* /*
@ -186,26 +204,39 @@ modeEdit
*/ */
function modeEdit() function modeEdit()
{ {
editMode = true; editMode = true;
// if no sankore api, insert ok button // if no sankore api, insert ok button
if( !isSankore ) if( !isSankore )
{ {
$( "#mp_setup" ).empty().append( '<input type="button" value="OK">' ); $( "#mp_setup" ).empty().append( '<input type="button" value="OK">' );
$( "#mp_setup input:button" ).click( function(){ $( "#mp_setup input:button" ).click( function(){
modeView(); modeView();
}); });
} }
$( "#mp_word").css( "margin-left", 0 ).empty() $( "#mp_word").css( "margin-left", 0 ).empty()
.append('<textarea cols="50" rows="5">'+sentence+'</textarea>'); .append('<textarea cols="50" rows="5">'+sentence+'</textarea>');
adjust( $( "#mp_word textarea" ).outerHeight() ); adjust( $( "#mp_word textarea" ).outerHeight() );
} }
$(window).mouseout(function(){
if(window.sankore){
var ph = [];
$( "#mp_word .phrase" ).each( function()
{
ph.push( $( this ).text() );
});
sankore.setPreference("currentOrdPhrases", ph.join( "\n" ));
sankore.setPreference("rightOrdPhrases", sentence);
}
});
$(document).ready(function() $(document).ready(function()
{ {
$("#ub-widget").append( '\ $("#ub-widget").append( '\
<div id="mp_setup"></div>\ <div id="mp_setup"></div>\
<div id="mp_word"></div>\ <div id="mp_word"></div>\
'); ');
modeView(); modeView();
}); });

@ -5,12 +5,12 @@
function startEditing() function startEditing()
{ {
modeEdit(); modeEdit();
} }
function stopEditing() function stopEditing()
{ {
modeView(); modeView();
} }
function initialize() function initialize()
@ -20,7 +20,7 @@ function initialize()
function checkResponse() function checkResponse()
{ {
checkWord(); checkWord();
} }
/* /*
/ END sankore api / END sankore api
@ -28,7 +28,16 @@ function checkResponse()
var word = "a*long*,*long*time*ago*..."; var word = "";
var curWord = "";
if(window.sankore){
word = (sankore.preference("rightOrdWords", ""))?sankore.preference("rightOrdWords", ""):"a*long*,*long*time*ago*...";
curWord = (sankore.preference("currentOrdWords", ""))?sankore.preference("currentOrdWords", ""):"";
} else {
word = "a*long*,*long*time*ago*...";
}
var img = "template/images/horse.png"; var img = "template/images/horse.png";
var doCheckWord = true; var doCheckWord = true;
@ -55,31 +64,31 @@ returns array of dom elements
*/ */
function createWordLetters( word ) function createWordLetters( word )
{ {
var ch, el; var ch, el;
var letters = []; var letters = [];
if( word.indexOf( '*' ) != -1 ) if( word.indexOf( '*' ) != -1 )
{ {
var tmp = word.split( '*' ); var tmp = word.split( '*' );
for( i in tmp ) for( i in tmp )
{ {
ch = tmp[i]; ch = tmp[i];
el = document.createElement( "div" ); el = document.createElement( "div" );
$(el).addClass( "letter" ).text( ch ); $(el).addClass( "letter" ).text( ch );
letters.push( el ); letters.push( el );
} }
} }
else else
{ {
for( var i = 0; i < word.length; i++ ) for( var i = 0; i < word.length; i++ )
{ {
ch = word.charAt( i ); ch = word.charAt( i );
el = document.createElement( "div" ); el = document.createElement( "div" );
$(el).addClass( "letter" ).text( ch ); $(el).addClass( "letter" ).text( ch );
letters.push( el ); letters.push( el );
} }
} }
return letters; return letters;
} }
@ -92,22 +101,22 @@ if they are in the right order
*/ */
function checkWord() function checkWord()
{ {
if( !doCheckWord ) if( !doCheckWord )
return; return;
var str = ""; var str = "";
$( "#mp_word .letter" ).each( function(){ $( "#mp_word .letter" ).each( function(){
str += $(this).text(); str += $(this).text();
}); });
var w = word; var w = word;
while( w.indexOf( '*' ) != -1 ) while( w.indexOf( '*' ) != -1 )
{ {
w = w.replace( '*', '' ); w = w.replace( '*', '' );
} }
if( str == w ){ if( str == w ){
$( "#mp_word .letter" ).addClass( "right" ); $( "#mp_word .letter" ).addClass( "right" );
//message( "Right!" ); //message( "Right!" );
} }
} }
/* /*
@ -118,16 +127,16 @@ shuffles an array
*/ */
function shuffle( arr ) function shuffle( arr )
{ {
var pos, tmp; var pos, tmp;
for( var i = 0; i < arr.length; i++ ) for( var i = 0; i < arr.length; i++ )
{ {
pos = Math.round( Math.random() * ( arr.length - 1 ) ); pos = Math.round( Math.random() * ( arr.length - 1 ) );
tmp = arr[pos]; tmp = arr[pos];
arr[pos] = arr[i]; arr[pos] = arr[i];
arr[i] = tmp; arr[i] = tmp;
} }
return arr; return arr;
} }
@ -140,56 +149,63 @@ turns the widget into the view mode
*/ */
function modeView() function modeView()
{ {
if( editMode ){ if( editMode ){
word = $( "#mp_word input:text" ).attr( "value" ); word = $( "#mp_word input:text" ).attr( "value" );
} }
// if no sankore api, insert edit button // if no sankore api, insert edit button
if( !isSankore ){ if( !isSankore ){
$( "#mp_setup" ).empty().append( '<input type="button" value="Edit">' ); $( "#mp_setup" ).empty().append( '<input type="button" value="Edit">' );
$( "#mp_setup input:button" ).click( function(){ $( "#mp_setup input:button" ).click( function(){
modeEdit(); modeEdit();
}); });
} }
// clean the previous word // clean the previous word
$( "#mp_word" ).empty(); $( "#mp_word" ).empty();
// create new set of letters // create new set of letters
var letters = shuffle( createWordLetters( word ) ); var letters;
for( i in letters ){ if(window.sankore && curWord && !editMode)
$("#mp_word").append( letters[i] ); letters = createWordLetters( curWord );
} else
letters = shuffle( createWordLetters( word ) );
for( i in letters ){
$("#mp_word").append( letters[i] );
}
// in sankore api there would be a function to check // in sankore api there would be a function to check
// the answer, so no update parameter would be needed // the answer, so no update parameter would be needed
if( !isSankore ){ if( !isSankore ){
$( "#mp_word" ).sortable( { update: checkWord } ); $( "#mp_word" ).sortable( {
} else $( "#mp_word" ).sortable(); update: checkWord
} );
// adjustWidth } else $( "#mp_word" ).sortable();
var totalLettersWidth = 0;
for( i in letters ){ // adjustWidth
var currentWidth = $( letters[i] ).outerWidth( true ); var totalLettersWidth = 0;
totalLettersWidth += currentWidth; for( i in letters ){
} var currentWidth = $( letters[i] ).outerWidth( true );
totalLettersWidth += 1; totalLettersWidth += currentWidth;
}
var width = Math.max( totalLettersWidth += 1;
totalLettersWidth,
min_view_width var width = Math.max(
); totalLettersWidth,
min_view_width
);
// shift the words to the right to center them // shift the words to the right to center them
if( width > totalLettersWidth ){ if( width > totalLettersWidth ){
$( "#mp_word" ).css( "margin-left", Math.round( (width - totalLettersWidth)/2 ) ); $( "#mp_word" ).css( "margin-left", Math.round( (width - totalLettersWidth)/2 ) );
} }
else{ else{
$( "#mp_word" ).css( "margin-left", 0 ); $( "#mp_word" ).css( "margin-left", 0 );
} }
// apply new width // apply new width
adjustWidth( width ); adjustWidth( width );
} }
@ -200,11 +216,13 @@ adjustWidth
*/ */
function adjustWidth( width ) function adjustWidth( width )
{ {
$( "#ub-widget" ).animate( {width: width } ); $( "#ub-widget" ).animate( {
// if viewed as a widget, resize the window width: width
if( !isBrowser ){ } );
window.resizeTo( width + widget_padding, widget.height ); // if viewed as a widget, resize the window
} if( !isBrowser ){
window.resizeTo( width + widget_padding, widget.height );
}
} }
/* /*
@ -214,25 +232,36 @@ modeEdit
*/ */
function modeEdit() function modeEdit()
{ {
editMode = true; editMode = true;
// if no sankore api, insert ok button // if no sankore api, insert ok button
if( !isSankore ) if( !isSankore )
{ {
$( "#mp_setup" ).empty().append( '<input type="button" value="OK">' ); $( "#mp_setup" ).empty().append( '<input type="button" value="OK">' );
$( "#mp_setup input:button" ).click( function(){ $( "#mp_setup input:button" ).click( function(){
modeView(); modeView();
}); });
} }
$( "#mp_word").css( "margin-left", 0 ).empty().append('<input value="'+word+'">'); $( "#mp_word").css( "margin-left", 0 ).empty().append('<input value="'+word+'">');
adjustWidth( input_width ); adjustWidth( input_width );
} }
$(window).mouseout(function(){
if(window.sankore){
var str = "";
$( "#mp_word .letter" ).each( function(){
str += $(this).text();
});
sankore.setPreference("currentOrdWords", str);
sankore.setPreference("rightOrdWords", word);
}
});
$(document).ready(function() $(document).ready(function()
{ {
$("#ub-widget").append( '\ $("#ub-widget").append( '\
<div id="mp_setup"></div>\ <div id="mp_setup"></div>\
<div id="mp_word"></div>\ <div id="mp_word"></div>\
'); ');
modeView(); modeView();
}); });

@ -3,162 +3,178 @@
function createElements( phrase ) function createElements( phrase )
{ {
var s = ''; var s = '';
for( var i = 0; i < phrase.length; i++ ) for( var i = 0; i < phrase.length; i++ )
{ {
ch = phrase.charAt( i ); ch = phrase.charAt( i );
if( ch == " " ){ if( ch == " " ){
ch = "&nbsp;"; ch = "&nbsp;";
} }
s += '<div class="letter">' + ch + '</div>' + s += '<div class="letter">' + ch + '</div>' +
'<div class="dash">&nbsp;</div>'; '<div class="dash">&nbsp;</div>';
} }
return s; return s;
} }
$(document).ready(function() $(document).ready(function()
{ {
var w = new wcontainer( "#ub-widget" ); var w = new wcontainer( "#ub-widget" );
var sentence = "";
if(window.sankore)
sentence = (sankore.preference("ordSplPhrases", ""))?sankore.preference("ordSplPhrases", ""):"this is a bunch of words which should be split apart";
else
sentence = "this is a bunch of words which should be split apart";
w.maxWidth = 600; w.maxWidth = 600;
w.setEditContent( '<div class="inputwrap"><textarea class="percent">this is a bunch of words which should be split apart</textarea></div>' ); w.setEditContent( '<div class="inputwrap"><textarea class="percent">' + sentence + '</textarea></div>' );
w.setViewContent( '<div class="upper"><div class="dash fixed">. </div></div>' ); w.setViewContent( '<div class="upper"><div class="dash fixed">. </div></div>' );
w.setData( "dashWidth", w.elements.container.find( ".dash" ).outerWidth() ); w.setData( "dashWidth", w.elements.container.find( ".dash" ).outerWidth() );
w.setViewContent( '<div class="upper"><div class="dash fixed">M</div></div>' ); w.setViewContent( '<div class="upper"><div class="dash fixed">M</div></div>' );
w.setData( "lineHeight", w.elements.container.find( ".dash" ).outerHeight() ); w.setData( "lineHeight", w.elements.container.find( ".dash" ).outerHeight() );
w.setViewContent( "" ); w.setViewContent( "" );
// onViewMode // onViewMode
w.onViewMode = function() w.onViewMode = function()
{ {
// clean up the text // clean up the text
var phrase = w.elements.container.find( "textarea" ).val() var phrase = w.elements.container.find( "textarea" ).val()
.replace( /\r/g, '' ).replace( /\n/g, ' ' ).replace( / /g, ' ' ).trim(); .replace( /\r/g, '' ).replace( /\n/g, ' ' ).replace( / /g, ' ' ).trim();
// store the text // store the text
w.setData( "phrase", phrase ); w.setData( "phrase", phrase );
// remove all dots (they are to be set during the exercise) // remove all dots (they are to be set during the exercise)
phrase = phrase.replace( / /g, '' ); phrase = phrase.replace( / /g, '' );
// create the html // create the html
w.setViewContent( createElements( phrase ) ); w.setViewContent( createElements( phrase ) );
// the behaviour // the behaviour
w.elements.containerView.find( ".letter" ) w.elements.containerView.find( ".letter" )
.mouseover( function() .mouseover( function()
{ {
var el = $( this ).next(); var el = $( this ).next();
// determine new hover class // determine new hover class
var is_fixed = ( el.get( 0 ).className.indexOf( "fixed" ) != -1 ); var is_fixed = ( el.get( 0 ).className.indexOf( "fixed" ) != -1 );
var hover_class = is_fixed? var hover_class = is_fixed?
"dash_hover_fixed" : "dash_hover"; "dash_hover_fixed" : "dash_hover";
// assign new hover class // assign new hover class
el.addClass( hover_class ) el.addClass( hover_class )
.data( "hc", hover_class ); .data( "hc", hover_class );
}) })
.mouseout( function() .mouseout( function()
{ {
var el = $( this ).next(); var el = $( this ).next();
// remove current hover class // remove current hover class
var hc = el.data( "hc" ); var hc = el.data( "hc" );
el.removeClass( hc ); el.removeClass( hc );
}) })
.click( function() .click( function()
{ {
var el = $( this ).next(); var el = $( this ).next();
// remove current hover class // remove current hover class
$( this ).trigger( "mouseout" ); $( this ).trigger( "mouseout" );
// toggle fixed class // toggle fixed class
el.toggleClass( "fixed" ); el.toggleClass( "fixed" );
// determine new hover class // determine new hover class
// assign new hover class // assign new hover class
$( this ).trigger( "mouseover" ); $( this ).trigger( "mouseover" );
w.checkAnswer(); w.checkAnswer();
w.adjustSize(); w.adjustSize();
}); });
w.checkAnswer(); w.checkAnswer();
}; };
// viewSize // viewSize
w.viewSize = function() w.viewSize = function()
{ {
var w = 0; var w = 0;
var h = 0; var h = 0;
var dh = winstance.getData( "lineHeight" ); var dh = winstance.getData( "lineHeight" );
var dw = winstance.getData( "dashWidth" ); var dw = winstance.getData( "dashWidth" );
winstance.elements.containerView.find( "div:visible" ).each( function() winstance.elements.containerView.find( "div:visible" ).each( function()
{ {
w += $( this ).outerWidth(); w += $( this ).outerWidth();
h = Math.max( h, $( this ).outerHeight( true ) ); h = Math.max( h, $( this ).outerHeight( true ) );
}); });
var square = w*h; var square = w*h;
h = Math.max( h, $( winstance.elements.containerView ).height() ); h = Math.max( h, $( winstance.elements.containerView ).height() );
if( winstance.maxWidth ) if( winstance.maxWidth )
{ {
w = Math.min( w, winstance.maxWidth ); w = Math.min( w, winstance.maxWidth );
h = parseInt( square / w ); h = parseInt( square / w );
} }
return { w: w, h: h+dh }; return {
}; w: w,
h: h+dh
};
};
// editSize // editSize
w.editSize = function() w.editSize = function()
{ {
return { return {
w: winstance.elements.containerEdit.find( "textarea" ).parent().outerWidth( true ), w: winstance.elements.containerEdit.find( "textarea" ).parent().outerWidth( true ),
h: winstance.elements.containerEdit.find( "textarea" ).parent().outerHeight( true ), h: winstance.elements.containerEdit.find( "textarea" ).parent().outerHeight( true ),
}; };
}; };
w.checkAnswer = function() w.checkAnswer = function()
{ {
var phrase = ""; var phrase = "";
var ch = ""; var ch = "";
this.elements.containerView.find( "div:visible" ).each( function() this.elements.containerView.find( "div:visible" ).each( function()
{ {
if( this.className.indexOf( "fixed" ) != -1 ){ if( this.className.indexOf( "fixed" ) != -1 ){
phrase += ' '; phrase += ' ';
} }
else if( this.className.indexOf( "dash" ) != -1 ){ else if( this.className.indexOf( "dash" ) != -1 ){
return; return;
} }
else{ else{
ch = $( this ).html(); ch = $( this ).html();
phrase += ch; phrase += ch;
} }
}); });
if( phrase == this.getData( "phrase" ) ){ if( phrase == this.getData( "phrase" ) ){
this.elements.containerView.addClass( "answerRight" ); this.elements.containerView.addClass( "answerRight" );
} }
else{ else{
this.elements.containerView.removeClass( "answerRight" ); this.elements.containerView.removeClass( "answerRight" );
} }
}; };
window.w = w; window.w = w;
window.winstance = w; window.winstance = w;
w.modeView(); w.modeView();
$(window).mouseout(function(){
if(window.sankore){
sankore.setPreference("ordSplPhrases", w.getData("phrase"));
}
});
}); });

@ -3,168 +3,182 @@
function createElements( text ) function createElements( text )
{ {
var s = ''; var s = '';
var words = text.split( " " ); var words = text.split( " " );
for( var i = 0; i < words.length; i++ ) for( var i = 0; i < words.length; i++ )
{ {
if( i ){ if( i ){
s += '<div>&nbsp;</div>'; s += '<div>&nbsp;</div>';
} }
s += '<div class="letter">' + words[i] + '</div>' + s += '<div class="letter">' + words[i] + '</div>' +
'<div class="dash">.</div>'; '<div class="dash">.</div>';
} }
return s; return s;
} }
$(document).ready(function() $(document).ready(function()
{ {
var w = new wcontainer( "#ub-widget" ); var w = new wcontainer( "#ub-widget" );
var sentences = "";
if(window.sankore)
sentences = (sankore.preference("ordSplText", ""))?sankore.preference("ordSplText", ""):"hello, this is the first sentence. hi, this is the second sentence. hello again, this is the third sentence. good morning, this is the fifth sentence. hi, sorry, i\'m late, i\'m the fourth sentence.";
else
sentences = "hello, this is the first sentence. hi, this is the second sentence. hello again, this is the third sentence. good morning, this is the fifth sentence. hi, sorry, i\'m late, i\'m the fourth sentence.";
w.maxWidth = 600;
w.maxWidth = 600; w.setEditContent( '<div class="inputwrap"><textarea class="percent">' + sentences + '</textarea></div>' );
w.setViewContent( '<div class="upper"><div class="dash fixed">. </div></div>' );
w.setData( "dashWidth", w.elements.container.find( ".dash" ).outerWidth() );
w.setViewContent( '<div class="upper"><div class="dash fixed">M</div></div>' );
w.setData( "lineHeight", w.elements.container.find( ".dash" ).outerHeight() );
w.setViewContent( "" );
w.setEditContent( '<div class="inputwrap"><textarea class="percent">hello, this is the first sentence. hi, this is the second sentence. hello again, this is the third sentence. good morning, this is the fifth sentence. hi, sorry, i\'m late, i\'m the fourth sentence.</textarea></div>' );
w.setViewContent( '<div class="upper"><div class="dash fixed">. </div></div>' );
w.setData( "dashWidth", w.elements.container.find( ".dash" ).outerWidth() );
w.setViewContent( '<div class="upper"><div class="dash fixed">M</div></div>' );
w.setData( "lineHeight", w.elements.container.find( ".dash" ).outerHeight() );
w.setViewContent( "" );
// onViewMode
// onViewMode w.onViewMode = function()
w.onViewMode = function() {
{ // clean up the text
// clean up the text var text = w.elements.container.find( "textarea" ).val()
var text = w.elements.container.find( "textarea" ).val() .replace( /\r/g, '' ).replace( /\n/g, ' ' ).replace( / /g, ' ' );
.replace( /\r/g, '' ).replace( /\n/g, ' ' ).replace( / /g, ' ' );
// store the text // store the text
w.setData( "text", text ); w.setData( "text", text );
// remove all dots (they are to be set during the exercise) // remove all dots (they are to be set during the exercise)
text = text.replace( /\. /g, ' ' ).trim( ["."] ); text = text.replace( /\. /g, ' ' ).trim( ["."] );
// create the html // create the html
w.setViewContent( createElements( text ) ); w.setViewContent( createElements( text ) );
// the behaviour // the behaviour
w.elements.containerView.find( ".letter" ) w.elements.containerView.find( ".letter" )
.mouseover( function() .mouseover( function()
{ {
var el = $( this ).next(); var el = $( this ).next();
// determine new hover class // determine new hover class
var is_fixed = ( el.get( 0 ).className.indexOf( "fixed" ) != -1 ); var is_fixed = ( el.get( 0 ).className.indexOf( "fixed" ) != -1 );
var hover_class = is_fixed? var hover_class = is_fixed?
"dash_hover_fixed" : "dash_hover"; "dash_hover_fixed" : "dash_hover";
// assign new hover class // assign new hover class
el.addClass( hover_class ) el.addClass( hover_class )
.data( "hc", hover_class ); .data( "hc", hover_class );
}) })
.mouseout( function() .mouseout( function()
{ {
var el = $( this ).next(); var el = $( this ).next();
// remove current hover class // remove current hover class
var hc = el.data( "hc" ); var hc = el.data( "hc" );
el.removeClass( hc ); el.removeClass( hc );
}) })
.click( function() .click( function()
{ {
var el = $( this ).next(); var el = $( this ).next();
// remove current hover class // remove current hover class
$( this ).trigger( "mouseout" ); $( this ).trigger( "mouseout" );
// toggle fixed class // toggle fixed class
el.toggleClass( "fixed" ); el.toggleClass( "fixed" );
// determine new hover class // determine new hover class
// assign new hover class // assign new hover class
$( this ).trigger( "mouseover" ); $( this ).trigger( "mouseover" );
w.checkAnswer(); w.checkAnswer();
w.adjustSize(); w.adjustSize();
}); });
w.checkAnswer(); w.checkAnswer();
}; };
// viewSize // viewSize
w.viewSize = function() w.viewSize = function()
{ {
var w = 0; var w = 0;
var h = 0; var h = 0;
var dh = winstance.getData( "lineHeight" ); var dh = winstance.getData( "lineHeight" );
var dw = winstance.getData( "dashWidth" ); var dw = winstance.getData( "dashWidth" );
winstance.elements.containerView.find( "div:visible" ).each( function() winstance.elements.containerView.find( "div:visible" ).each( function()
{ {
w += $( this ).outerWidth(); w += $( this ).outerWidth();
h = Math.max( h, $( this ).outerHeight( true ) ); h = Math.max( h, $( this ).outerHeight( true ) );
}); });
var square = w*h; var square = w*h;
h = Math.max( h, $( winstance.elements.containerView ).height() ); h = Math.max( h, $( winstance.elements.containerView ).height() );
if( winstance.maxWidth ) if( winstance.maxWidth )
{ {
w = Math.min( w, winstance.maxWidth ); w = Math.min( w, winstance.maxWidth );
h = parseInt( square / w ); h = parseInt( square / w );
} }
return { w: w, h: h+dh }; return {
}; w: w,
h: h+dh
};
};
// editSize // editSize
w.editSize = function() w.editSize = function()
{ {
return { return {
w: winstance.elements.containerEdit.find( "textarea" ).parent().outerWidth( true ), w: winstance.elements.containerEdit.find( "textarea" ).parent().outerWidth( true ),
h: winstance.elements.containerEdit.find( "textarea" ).parent().outerHeight( true ), h: winstance.elements.containerEdit.find( "textarea" ).parent().outerHeight( true ),
}; };
}; };
w.checkAnswer = function() w.checkAnswer = function()
{ {
var text = ""; var text = "";
var ch = ""; var ch = "";
this.elements.containerView.find( "div:visible" ).each( function() this.elements.containerView.find( "div:visible" ).each( function()
{ {
if( this.className.indexOf( "fixed" ) != -1 ){ if( this.className.indexOf( "fixed" ) != -1 ){
text += '.'; text += '.';
} }
else if( this.className.indexOf( "dash" ) != -1 ){ else if( this.className.indexOf( "dash" ) != -1 ){
return; return;
} }
else{ else{
ch = $( this ).html(); ch = $( this ).html();
if( ch == "&nbsp;" ){ if( ch == "&nbsp;" ){
ch = " "; ch = " ";
} }
text += ch; text += ch;
} }
}); });
console.log( text );
if( text == this.getData( "text" ) ){ if( text == this.getData( "text" ) ){
this.elements.containerView.addClass( "answerRight" ); this.elements.containerView.addClass( "answerRight" );
} }
else{ else{
this.elements.containerView.removeClass( "answerRight" ); this.elements.containerView.removeClass( "answerRight" );
} }
}; };
window.w = w; window.w = w;
window.winstance = w; window.winstance = w;
w.modeView(); w.modeView();
$(window).mouseout(function(){
if(window.sankore){
sankore.setPreference("ordSplText", w.getData( "text" ));
}
});
}); });

@ -1,99 +1,113 @@
function createWord( word ) function createWord( word )
{ {
var s = ''; var s = '';
for( var i = 0; i < word.length; i++ ) for( var i = 0; i < word.length; i++ )
{ {
ch = word.charAt( i ); ch = word.charAt( i );
s += s +=
'<span class="upper">' + '<span class="upper">' +
'<span>' + ch + '</span>' + '<span>' + ch + '</span>' +
(( i < word.length - 1 ) ? (( i < word.length - 1 ) ?
'<span class="dash">&ndash;</span>' : '' ) + '<span class="dash">&ndash;</span>' : '' ) +
'</span>'; '</span>';
} }
return s; return s;
} }
$(document).ready(function() $(document).ready(function()
{ {
var w = new wcontainer( "#ub-widget" ); var w = new wcontainer( "#ub-widget" );
var words = "";
if(window.sankore)
words = (sankore.preference("ordSplWords", ""))?sankore.preference("ordSplWords", ""):"so*phis*ti*ca*ted";
else
words = "so*phis*ti*ca*ted";
w.setEditContent( '<div class="inputwrap"><input class="percent" value="' + words + '"></div>' );
w.setViewContent( '<span class="upper"><span class="dash fixed">&mdash;</span></span>' );
w.setData( "dashWidth", w.elements.container.find( "span.dash" ).outerWidth() );
w.setViewContent( "" );
w.setEditContent( '<div class="inputwrap"><input class="percent" value="so*phis*ti*ca*ted"></div>' ); // onViewMode
w.setViewContent( '<span class="upper"><span class="dash fixed">&mdash;</span></span>' ); w.onViewMode = function()
w.setData( "dashWidth", w.elements.container.find( "span.dash" ).outerWidth() ); {
w.setViewContent( "" ); var word = w.elements.container.find( "input" ).val().trim( ['*'] );
// onViewMode
w.onViewMode = function()
{
var word = w.elements.container.find( "input" ).val().trim( ['*'] );
w.setData( "word", word ); w.setData( "word", word );
word = word.replace( /\*/g, '' ); word = word.replace( /\*/g, '' );
w.setViewContent( createWord( word ) ); w.setViewContent( createWord( word ) );
w.elements.container.find( "span.upper" ).click( function(){ w.elements.container.find( "span.upper" ).click( function(){
$( this ).find( "span.dash" ).toggleClass( "fixed" ); $( this ).find( "span.dash" ).toggleClass( "fixed" );
w.adjustSize(); w.adjustSize();
w.checkAnswer(); w.checkAnswer();
}); });
w.checkAnswer(); w.checkAnswer();
}; };
// viewSize // viewSize
w.viewSize = function() w.viewSize = function()
{ {
var w = 0; var w = 0;
var h = 0; var h = 0;
winstance.elements.containerView.find( "span.upper span:visible" ).each( function() winstance.elements.containerView.find( "span.upper span:visible" ).each( function()
{ {
w += $( this ).outerWidth(); w += $( this ).outerWidth();
h = Math.max( h, $( this ).outerHeight() ); h = Math.max( h, $( this ).outerHeight() );
}); });
var dw = winstance.getData( "dashWidth" ); var dw = winstance.getData( "dashWidth" );
return { w: w+dw, h: h }; return {
}; w: w+dw,
h: h
};
};
// editSize // editSize
w.editSize = function() w.editSize = function()
{ {
return { return {
w: winstance.elements.containerEdit.find( "input" ).outerWidth( true ), w: winstance.elements.containerEdit.find( "input" ).outerWidth( true ),
h: winstance.elements.containerEdit.find( "input" ).outerHeight( true ), h: winstance.elements.containerEdit.find( "input" ).outerHeight( true ),
}; };
}; };
w.checkAnswer = function() w.checkAnswer = function()
{ {
var word = ""; var word = "";
this.elements.container.find( "span.upper span:visible" ).each( function() this.elements.container.find( "span.upper span:visible" ).each( function()
{ {
if( this.className.indexOf( "fixed" ) != -1 ){ if( this.className.indexOf( "fixed" ) != -1 ){
word += '*'; word += '*';
} }
else if( this.className.indexOf( "dash" ) != -1 ){ else if( this.className.indexOf( "dash" ) != -1 ){
return; return;
} }
else{ else{
word += $( this ).text(); word += $( this ).text();
} }
}); });
if( word == this.getData( "word" ) ){ if( word == this.getData( "word" ) ){
this.elements.container.addClass( "answerRight" ); this.elements.container.addClass( "answerRight" );
} }
else{ else{
this.elements.container.removeClass( "answerRight" ); this.elements.container.removeClass( "answerRight" );
} }
}; };
window.w = w; window.w = w;
window.winstance = w; window.winstance = w;
w.modeView(); w.modeView();
$(window).mouseout(function(){
if(window.sankore){
sankore.setPreference("ordSplWords", w.getData("word"));
}
});
}); });

@ -319,7 +319,6 @@
<file>images/pages_open.png</file> <file>images/pages_open.png</file>
<file>images/cache_close.png</file> <file>images/cache_close.png</file>
<file>images/cache_open.png</file> <file>images/cache_open.png</file>
<file>style.qss</file>
<file>images/cache_circle.png</file> <file>images/cache_circle.png</file>
<file>images/cache_square.png</file> <file>images/cache_square.png</file>
<file>images/down_arrow.png</file> <file>images/down_arrow.png</file>
@ -333,6 +332,8 @@
<file>images/teacher_close.png</file> <file>images/teacher_close.png</file>
<file>images/teacher_open.png</file> <file>images/teacher_open.png</file>
<file>images/teacher_close_disabled.png</file> <file>images/teacher_close_disabled.png</file>
<file>style.qss</file>
<file>images/teacher_open_disabled.png</file> <file>images/teacher_open_disabled.png</file>
<file>images/libpalette/WebSearchCategory.svg</file>
</qresource> </qresource>
</RCC> </RCC>

@ -1,13 +1,25 @@
QWidget#DockPaletteWidgetBox, QWidget#DockPaletteWidgetBox,
QWidget#documentNavigator, QWidget#documentNavigator,
QWidget#UBLibraryWidget,
QWidget#UBLibPathViewer, QWidget#UBLibPathViewer,
QWidget#UBTeacherStudentAction QWidget#UBTeacherStudentAction,
QWidget#UBLibNavigatorWidget,
QWidget#UBLibItemProperties
{ {
background: #EEEEEE; background: #EEEEEE;
border-radius: 10px; border-radius: 10px;
border: 2px solid #999999; border: 2px solid #999999;
/* padding-bottom: -2px; */ }
QWidget#UBLibWebView
{
background: #EEEEEE;
border-radius : 10px;
border: 2px solid #999999;
}
QWebView#SearchEngineView
{
background:#EEEEEE;
} }
QColorDialog QColorDialog
@ -121,8 +133,6 @@ QScrollBar::add-page:vertical, QScrollBar::sub-page:vertical
background:transparent; background:transparent;
} }
QScrollBar::horizontal QScrollBar::horizontal
{ {
background:transparent; background:transparent;
@ -166,7 +176,6 @@ QScrollBar::add-page:horizontal, QScrollBar::sub-page:horizontal
background:transparent; background:transparent;
} }
QSlider::handle::horizontal QSlider::handle::horizontal
{ {
background-color:#EEEEEE; background-color:#EEEEEE;

@ -106,6 +106,11 @@ UBBoardPaletteManager::~UBBoardPaletteManager()
delete mpLibWidget; delete mpLibWidget;
mpLibWidget = NULL; mpLibWidget = NULL;
} }
if(NULL != mpTeacherBarWidget)
{
delete mpTeacherBarWidget;
mpTeacherBarWidget = NULL;
}
if(NULL != mpCachePropWidget) if(NULL != mpCachePropWidget)
{ {
delete mpCachePropWidget; delete mpCachePropWidget;
@ -163,20 +168,20 @@ void UBBoardPaletteManager::setupDockPaletteWidgets()
mpPageNavigWidget = new UBPageNavigationWidget(); mpPageNavigWidget = new UBPageNavigationWidget();
mpPageNavigWidget->registerMode(eUBDockPaletteWidget_BOARD); mpPageNavigWidget->registerMode(eUBDockPaletteWidget_BOARD);
// connect(this, SIGNAL(signal_changeMode(eUBDockPaletteWidgetMode)), mpPageNavigWidget, SLOT(slot_changeMode(eUBDockPaletteWidgetMode))); // connect(this, SIGNAL(signal_changeMode(eUBDockPaletteWidgetMode)), mpPageNavigWidget, SLOT(slot_changeMode(eUBDockPaletteWidgetMode)));
mpLibWidget = new UBLibWidget(); mpLibWidget = new UBLibWidget();
mpLibWidget ->registerMode(eUBDockPaletteWidget_BOARD); mpLibWidget ->registerMode(eUBDockPaletteWidget_BOARD);
mpLibWidget ->registerMode(eUBDockPaletteWidget_DESKTOP); mpLibWidget ->registerMode(eUBDockPaletteWidget_DESKTOP);
// connect(this, SIGNAL(signal_changeMode(eUBDockPaletteWidgetMode)), mpLibWidget, SLOT(slot_changeMode(eUBDockPaletteWidgetMode))); // connect(this, SIGNAL(signal_changeMode(eUBDockPaletteWidgetMode)), mpLibWidget, SLOT(slot_changeMode(eUBDockPaletteWidgetMode)));
mpCachePropWidget = new UBCachePropertiesWidget(); mpCachePropWidget = new UBCachePropertiesWidget();
mpCachePropWidget->registerMode(eUBDockPaletteWidget_BOARD); mpCachePropWidget->registerMode(eUBDockPaletteWidget_BOARD);
// connect(this, SIGNAL(signal_changeMode(eUBDockPaletteWidgetMode)), mpCachePropWidget, SLOT(slot_changeMode(eUBDockPaletteWidgetMode))); // connect(this, SIGNAL(signal_changeMode(eUBDockPaletteWidgetMode)), mpCachePropWidget, SLOT(slot_changeMode(eUBDockPaletteWidgetMode)));
mpTeacherBarWidget = new UBTeacherBarWidget(); mpTeacherBarWidget = new UBTeacherBarWidget();
mpTeacherBarWidget->registerMode(eUBDockPaletteWidget_BOARD); mpTeacherBarWidget->registerMode(eUBDockPaletteWidget_BOARD);
// connect(this, SIGNAL(signal_changeMode(eUBDockPaletteWidgetMode)), mpTeacherBarWidget, SLOT(slot_changeMode(eUBDockPaletteWidgetMode))); // connect(this, SIGNAL(signal_changeMode(eUBDockPaletteWidgetMode)), mpTeacherBarWidget, SLOT(slot_changeMode(eUBDockPaletteWidgetMode)));
//------------------------------------------------// //------------------------------------------------//
// Add the dock palettes // Add the dock palettes
@ -220,15 +225,38 @@ void UBBoardPaletteManager::setupDockPaletteWidgets()
void UBBoardPaletteManager::slot_changeMainMode(UBApplicationController::MainMode mainMode) void UBBoardPaletteManager::slot_changeMainMode(UBApplicationController::MainMode mainMode)
{ {
// Board = 0, Internet, Document, Tutorial, ParaschoolEditor, WebDocument
switch( mainMode ) switch( mainMode )
{ {
case UBApplicationController::Board: case UBApplicationController::Board:
// call changeMode only when switch NOT from desktop mode {
if(!UBApplication::applicationController->isShowingDesktop()) // call changeMode only when switch NOT from desktop mode
changeMode(eUBDockPaletteWidget_BOARD); if(!UBApplication::applicationController->isShowingDesktop())
changeMode(eUBDockPaletteWidget_BOARD);
}
break;
case UBApplicationController::Tutorial:
{
if (UBPlatformUtils::hasVirtualKeyboard() && mKeyboardPalette != NULL)
mKeyboardPalette->hide();
}
break;
case UBApplicationController::Internet:
changeMode(eUBDockPaletteWidget_WEB);
break;
case UBApplicationController::Document:
changeMode(eUBDockPaletteWidget_DOCUMENT);
break; break;
default: default:
{
if (UBPlatformUtils::hasVirtualKeyboard() && mKeyboardPalette != NULL)
mKeyboardPalette->hide();
}
break; break;
} }
} }
@ -236,8 +264,8 @@ void UBBoardPaletteManager::slot_changeMainMode(UBApplicationController::MainMod
void UBBoardPaletteManager::slot_changeDesktopMode(bool isDesktop) void UBBoardPaletteManager::slot_changeDesktopMode(bool isDesktop)
{ {
UBApplicationController::MainMode currMode = UBApplication::applicationController->displayMode(); UBApplicationController::MainMode currMode = UBApplication::applicationController->displayMode();
if(!isDesktop) if(!isDesktop)
{ {
switch( currMode ) switch( currMode )
{ {
case UBApplicationController::Board: case UBApplicationController::Board:
@ -246,34 +274,34 @@ void UBBoardPaletteManager::slot_changeDesktopMode(bool isDesktop)
default: default:
break; break;
} }
} }
else else
changeMode(eUBDockPaletteWidget_DESKTOP); changeMode(eUBDockPaletteWidget_DESKTOP);
} }
void UBBoardPaletteManager::setupPalettes() void UBBoardPaletteManager::setupPalettes()
{ {
setupDockPaletteWidgets();
// Add the other palettes
mStylusPalette = new UBStylusPalette(mContainer, UBSettings::settings()->appToolBarOrientationVertical->get().toBool() ? Qt::Vertical : Qt::Horizontal);
connect(mStylusPalette, SIGNAL(stylusToolDoubleClicked(int)), UBApplication::boardController, SLOT(stylusToolDoubleClicked(int)));
mStylusPalette->show(); // always show stylus palette at startup
if (UBPlatformUtils::hasVirtualKeyboard()) if (UBPlatformUtils::hasVirtualKeyboard())
{ {
mKeyboardPalette = UBKeyboardPalette::create(0); mKeyboardPalette = new UBKeyboardPalette(0);
#ifndef Q_WS_WIN #ifndef Q_WS_WIN
connect(mKeyboardPalette, SIGNAL(closed()), mKeyboardPalette, SLOT(onDeactivated())); connect(mKeyboardPalette, SIGNAL(closed()), mKeyboardPalette, SLOT(onDeactivated()));
#endif #endif
#ifndef Q_WS_MAC #ifndef Q_WS_MAC
mKeyboardPalette->setParent(mContainer); // mKeyboardPalette->setParent(mContainer);
#endif #endif
} }
setupDockPaletteWidgets();
// Add the other palettes
mStylusPalette = new UBStylusPalette(mContainer, UBSettings::settings()->appToolBarOrientationVertical->get().toBool() ? Qt::Vertical : Qt::Horizontal);
connect(mStylusPalette, SIGNAL(stylusToolDoubleClicked(int)), UBApplication::boardController, SLOT(stylusToolDoubleClicked(int)));
mStylusPalette->show(); // always show stylus palette at startup
mZoomPalette = new UBZoomPalette(mContainer); mZoomPalette = new UBZoomPalette(mContainer);
QList<QAction*> backgroundsActions; QList<QAction*> backgroundsActions;
@ -483,7 +511,7 @@ void UBBoardPaletteManager::connectPalettes()
} }
bool isFirstResized = true;
void UBBoardPaletteManager::containerResized() void UBBoardPaletteManager::containerResized()
{ {
int innerMargin = UBSettings::boardMargin; int innerMargin = UBSettings::boardMargin;
@ -493,25 +521,39 @@ void UBBoardPaletteManager::containerResized()
int userTop = innerMargin; int userTop = innerMargin;
int userHeight = mContainer->height() - (2 * innerMargin); int userHeight = mContainer->height() - (2 * innerMargin);
mStylusPalette->move(userLeft, userTop); if(mStylusPalette)
mStylusPalette->adjustSizeAndPosition(); {
mStylusPalette->initPosition(); mStylusPalette->move(userLeft, userTop);
mStylusPalette->adjustSizeAndPosition();
mStylusPalette->initPosition();
}
if(mZoomPalette)
{
mZoomPalette->move(userLeft + userWidth - mZoomPalette->width()
, userTop + userHeight /*- mPageNumberPalette->height()*/ - innerMargin - mZoomPalette->height());
mZoomPalette->adjustSizeAndPosition();
}
mZoomPalette->move(userLeft + userWidth - mZoomPalette->width() if (isFirstResized && mKeyboardPalette && mKeyboardPalette->parent() == UBApplication::boardController->controlContainer())
, userTop + userHeight /*- mPageNumberPalette->height()*/ - innerMargin - mZoomPalette->height()); {
mZoomPalette->adjustSizeAndPosition(); isFirstResized = false;
mKeyboardPalette->move(userLeft + (userWidth - mKeyboardPalette->width())/2,
userTop + (userHeight - mKeyboardPalette->height())/2);
mKeyboardPalette->adjustSizeAndPosition();
}
if (mKeyboardPalette) if(mLeftPalette)
{ {
mKeyboardPalette->move(userLeft + (userWidth - mKeyboardPalette->width())/2, mLeftPalette->resize(mLeftPalette->width()-1, mContainer->height());
userTop + userHeight - mKeyboardPalette->height()); mLeftPalette->resize(mLeftPalette->width(), mContainer->height());
mKeyboardPalette->adjustSizeAndPosition();
} }
mLeftPalette->resize(mLeftPalette->width()-1, mContainer->height()); if(mRightPalette)
mRightPalette->resize(mRightPalette->width()-1, mContainer->height()); {
mLeftPalette->resize(mLeftPalette->width(), mContainer->height()); mRightPalette->resize(mRightPalette->width()-1, mContainer->height());
mRightPalette->resize(mRightPalette->width(), mContainer->height()); mRightPalette->resize(mRightPalette->width(), mContainer->height());
}
} }
@ -683,6 +725,18 @@ void UBBoardPaletteManager::changeMode(eUBDockPaletteWidgetMode newMode, bool is
{ {
mLeftPalette->setParent(UBApplication::boardController->controlContainer()); mLeftPalette->setParent(UBApplication::boardController->controlContainer());
mRightPalette->setParent(UBApplication::boardController->controlContainer()); mRightPalette->setParent(UBApplication::boardController->controlContainer());
if (UBPlatformUtils::hasVirtualKeyboard() && mKeyboardPalette != NULL)
{
if(mKeyboardPalette->m_isVisible)
{
mKeyboardPalette->hide();
mKeyboardPalette->setParent(UBApplication::boardController->controlContainer());
mKeyboardPalette->show();
}
else
mKeyboardPalette->setParent(UBApplication::boardController->controlContainer());
}
mLeftPalette->setVisible(true); mLeftPalette->setVisible(true);
mRightPalette->setVisible(true); mRightPalette->setVisible(true);
@ -696,6 +750,18 @@ void UBBoardPaletteManager::changeMode(eUBDockPaletteWidgetMode newMode, bool is
{ {
mLeftPalette->setParent((QWidget*)UBApplication::applicationController->uninotesController()->drawingView()); mLeftPalette->setParent((QWidget*)UBApplication::applicationController->uninotesController()->drawingView());
mRightPalette->setParent((QWidget*)UBApplication::applicationController->uninotesController()->drawingView()); mRightPalette->setParent((QWidget*)UBApplication::applicationController->uninotesController()->drawingView());
if (UBPlatformUtils::hasVirtualKeyboard() && mKeyboardPalette != NULL)
{
if(mKeyboardPalette->m_isVisible)
{
mKeyboardPalette->hide();
mKeyboardPalette->setParent((QWidget*)UBApplication::applicationController->uninotesController()->drawingView());
mKeyboardPalette->show();
}
else
mKeyboardPalette->setParent((QWidget*)UBApplication::applicationController->uninotesController()->drawingView());
}
mLeftPalette->setVisible(false); mLeftPalette->setVisible(false);
mRightPalette->setVisible(true); mRightPalette->setVisible(true);
@ -705,12 +771,46 @@ void UBBoardPaletteManager::changeMode(eUBDockPaletteWidgetMode newMode, bool is
} }
break; break;
case eUBDockPaletteWidget_WEB:
{
if (UBPlatformUtils::hasVirtualKeyboard() && mKeyboardPalette != NULL)
{
WBBrowserWindow* brWnd = UBApplication::webController->GetCurrentWebBrowser();
if(mKeyboardPalette->m_isVisible)
{
mKeyboardPalette->hide();
mKeyboardPalette->setParent(brWnd);
mKeyboardPalette->show();
}
else
mKeyboardPalette->setParent(brWnd);
}
}
break;
default: default:
{ {
mLeftPalette->setVisible(false); mLeftPalette->setVisible(false);
mRightPalette->setVisible(false); mRightPalette->setVisible(false);
mLeftPalette->setParent(0); mLeftPalette->setParent(0);
mRightPalette->setParent(0); mRightPalette->setParent(0);
if (UBPlatformUtils::hasVirtualKeyboard() && mKeyboardPalette != NULL)
{
if(mKeyboardPalette->m_isVisible)
{
mKeyboardPalette->hide();
mKeyboardPalette->setParent(0);
mKeyboardPalette->show();
}
else
mKeyboardPalette->setParent(0);
// mKeyboardPalette->update();
}
} }
break; break;
} }
@ -899,4 +999,4 @@ void UBBoardPaletteManager::refreshPalettes()
{ {
mRightPalette->update(); mRightPalette->update();
mLeftPalette->update(); mLeftPalette->update();
} }

@ -26,7 +26,6 @@
#include "gui/UBLibWidget.h" #include "gui/UBLibWidget.h"
#include "gui/UBCachePropertiesWidget.h" #include "gui/UBCachePropertiesWidget.h"
#include "gui/UBTeacherBarWidget.h" #include "gui/UBTeacherBarWidget.h"
#include "core/UBApplicationController.h" #include "core/UBApplicationController.h"

@ -222,7 +222,6 @@ QList<UBLibElement*> UBLibraryController::rootCategoriesList()
element->setMoveable(false); element->setMoveable(false);
categories << element; categories << element;
element = new UBLibElement(eUBLibElementType_Folder, mInteractiveUserDirectoryPath, tr("Applications", "Applications category element")); element = new UBLibElement(eUBLibElementType_Folder, mInteractiveUserDirectoryPath, tr("Applications", "Applications category element"));
element->setThumbnail(QImage(":images/libpalette/ApplicationsCategory.svg")); element->setThumbnail(QImage(":images/libpalette/ApplicationsCategory.svg"));
element->setMoveable(false); element->setMoveable(false);
@ -239,11 +238,20 @@ QList<UBLibElement*> UBLibraryController::rootCategoriesList()
element->setMoveable(false); element->setMoveable(false);
categories << element; categories << element;
// Note : FEATURE IN DEVELOPMENT, DO NOT ERASE (or you will get problems) !!!!
// mSearchCategoryPath = QUrl::fromLocalFile(UBSettings::settings()->uniboardSearchDirectory());
// element = new UBLibElement(eUBLibElementType_Folder, mSearchCategoryPath, tr("Web Search", "Web search category element"));
// element->setThumbnail(QImage(":images/libpalette/WebSearchCategory.svg"));
// element->setMoveable(false);
// categories << element;
element = new UBLibElement(eUBLibElementType_Folder, mAnimationUserDirectoryPath, tr("Animations", "Animations category element")); element = new UBLibElement(eUBLibElementType_Folder, mAnimationUserDirectoryPath, tr("Animations", "Animations category element"));
element->setThumbnail(QImage(":images/libpalette/FlashCategory.svg")); element->setThumbnail(QImage(":images/libpalette/FlashCategory.svg"));
element->setMoveable(false); element->setMoveable(false);
categories << element; categories << element;
categories << UBLibElement::trashElement(); categories << UBLibElement::trashElement();
return categories; return categories;
@ -759,6 +767,31 @@ void UBChainedLibElement::setNextElement(UBChainedLibElement *nextElem)
mpNextElem = nextElem; mpNextElem = nextElem;
} }
UBChainedLibElement* UBChainedLibElement::lastElement()
{
UBChainedLibElement* pElem = NULL;
if(NULL != mpNextElem)
{
UBChainedLibElement* pLast = mpNextElem->lastElement();
if(NULL != pLast)
{
pElem = pLast;
}
else
{
pElem = mpNextElem;
}
}
return pElem;
}
QUrl UBChainedLibElement::lastItemPath()
{
return lastElement()->element()->path();
}
UBLibElement* UBLibElement::trashElement() UBLibElement* UBLibElement::trashElement()
{ {
UBLibElement *trashElement; UBLibElement *trashElement;

@ -82,8 +82,10 @@ public:
~UBChainedLibElement(); ~UBChainedLibElement();
UBChainedLibElement* nextElement(){return mpNextElem;} UBChainedLibElement* nextElement(){return mpNextElem;}
UBChainedLibElement* lastElement();
void setNextElement(UBChainedLibElement* nextElem); void setNextElement(UBChainedLibElement* nextElem);
UBLibElement* element(){return mpElem;} UBLibElement* element(){return mpElem;}
QUrl lastItemPath();
private: private:
UBLibElement* mpElem; UBLibElement* mpElem;
@ -160,6 +162,7 @@ class UBLibraryController : public QObject
QUrl mInteractiveUserDirectoryPath; QUrl mInteractiveUserDirectoryPath;
QUrl mInteractiveCategoryPath; QUrl mInteractiveCategoryPath;
QUrl mAnimationUserDirectoryPath; QUrl mAnimationUserDirectoryPath;
QUrl mSearchCategoryPath;
QStringList addItemsToCurrentLibrary(const QDir& pSelectedFolder, const QStringList& pExtensions); QStringList addItemsToCurrentLibrary(const QDir& pSelectedFolder, const QStringList& pExtensions);

@ -368,6 +368,8 @@ void UBApplicationController::showInternet()
if (UBSettings::settings()->webUseExternalBrowser->get().toBool()) if (UBSettings::settings()->webUseExternalBrowser->get().toBool())
{ {
showDesktop(true); showDesktop(true);
UBApplication::webController->show(UBWebController::WebBrowser);
// really no have emit mainModeChanged here ? potential problem with virtual keyboard ?
} }
else else
{ {
@ -382,10 +384,11 @@ void UBApplicationController::showInternet()
mMainWindow->show(); mMainWindow->show();
mUninoteController->hideWindow(); mUninoteController->hideWindow();
UBApplication::webController->show(UBWebController::WebBrowser);
emit mainModeChanged(Internet); emit mainModeChanged(Internet);
} }
UBApplication::webController->show(UBWebController::WebBrowser);
} }
@ -563,9 +566,7 @@ void UBApplicationController::downloadJsonFinished(QString currentJson)
} }
else { else {
if (isNoUpdateDisplayed) { if (isNoUpdateDisplayed) {
QMessageBox msgBox; mMainWindow->information(tr("Update"), tr("No update available"));
msgBox.setText (tr ("No update available"));
msgBox.exec();
} }
} }
} }

@ -14,6 +14,7 @@
*/ */
#include "UBPersistenceManager.h" #include "UBPersistenceManager.h"
#include "gui/UBMainWindow.h"
#include <QtXml> #include <QtXml>
@ -1005,11 +1006,7 @@ void UBPersistenceManager::checkIfDocumentRepositoryExists()
QString humanPath = QDir::cleanPath(mDocumentRepositoryPath); QString humanPath = QDir::cleanPath(mDocumentRepositoryPath);
humanPath = QDir::toNativeSeparators(humanPath); humanPath = QDir::toNativeSeparators(humanPath);
QMessageBox::question( UBApplication::mainWindow->warning(tr("Document Repository Loss"),tr("Sankore has lost access to the document repository '%1'. Unfortunately the application must shut down to avoid data corruption. Latest changes may be lost as well.").arg(humanPath));
QApplication::activeWindow(),
tr("Document Repository Loss"),
tr("Sankore has lost access to the document repository '%1'. Unfortunately the application must shut down to avoid data corruption. Latest changes may be lost as well.").arg(humanPath),
QMessageBox::Yes);
UBApplication::quit(); UBApplication::quit();
} }

@ -74,8 +74,8 @@ class UBPersistenceManager : public QObject
virtual void persistDocumentScene(UBDocumentProxy* pDocumentProxy, virtual void persistDocumentScene(UBDocumentProxy* pDocumentProxy,
UBGraphicsScene* pScene, const int pSceneIndex); UBGraphicsScene* pScene, const int pSceneIndex);
virtual void persistTeacherBar(UBDocumentProxy* pDocumentProxy, int page, sTeacherBarInfos infos); virtual void persistTeacherBar(UBDocumentProxy* pDocumentProxy, int page, sTeacherBarInfos infos);
sTeacherBarInfos getTeacherBarInfos(UBDocumentProxy* pDocumentProxy, int page); sTeacherBarInfos getTeacherBarInfos(UBDocumentProxy* pDocumentProxy, int page);
virtual UBGraphicsScene* createDocumentSceneAt(UBDocumentProxy* pDocumentProxy, int index); virtual UBGraphicsScene* createDocumentSceneAt(UBDocumentProxy* pDocumentProxy, int index);

@ -1020,6 +1020,15 @@ QString UBSettings::uniboardGipLibraryDirectory()
return dirPath; return dirPath;
} }
QString UBSettings::uniboardSearchDirectory()
{
QString dirPath = UBPlatformUtils::applicationResourcesDirectory() + "/library/search";
if (!QDir(dirPath).exists())
QDir().mkpath(dirPath);
return dirPath;
}
QString UBSettings::uniboardImageLibraryDirectory() QString UBSettings::uniboardImageLibraryDirectory()
{ {
QString defaultRelativePath = QString("./library/image"); QString defaultRelativePath = QString("./library/image");

@ -112,6 +112,7 @@ class UBSettings : public QObject
QString uniboardImageLibraryDirectory(); QString uniboardImageLibraryDirectory();
QString uniboardUserImageDirectory(); QString uniboardUserImageDirectory();
QString defaultUserImagesDirectory(); QString defaultUserImagesDirectory();
QString uniboardSearchDirectory();
QString uniboardUserVideoDirectory(); QString uniboardUserVideoDirectory();
QString uniboardDefaultUserImageLibraryDirectory(); QString uniboardDefaultUserImageLibraryDirectory();

@ -52,7 +52,7 @@ UBDesktopAnnotationController::UBDesktopAnnotationController(QObject *parent)
, mTransparentDrawingView(0) , mTransparentDrawingView(0)
, mTransparentDrawingScene(0) , mTransparentDrawingScene(0)
, mDesktopPalette(NULL) , mDesktopPalette(NULL)
, mKeyboardPalette(0) // , mKeyboardPalette(0)
, mDesktopPenPalette(NULL) , mDesktopPenPalette(NULL)
, mDesktopMarkerPalette(NULL) , mDesktopMarkerPalette(NULL)
, mDesktopEraserPalette(NULL) , mDesktopEraserPalette(NULL)
@ -64,7 +64,7 @@ UBDesktopAnnotationController::UBDesktopAnnotationController(QObject *parent)
, mPendingMarkerButtonPressed(false) , mPendingMarkerButtonPressed(false)
, mPendingEraserButtonPressed(false) , mPendingEraserButtonPressed(false)
, mbArrowClicked(false) , mbArrowClicked(false)
, mBoardStylusTool(UBStylusTool::Pen) , mBoardStylusTool(UBStylusTool::Selector /*UBStylusTool::Pen*/)
, mDesktopStylusTool(UBStylusTool::Selector) , mDesktopStylusTool(UBStylusTool::Selector)
{ {
@ -101,10 +101,15 @@ UBDesktopAnnotationController::UBDesktopAnnotationController(QObject *parent)
connect(mTransparentDrawingView, SIGNAL(hidden()), mKeyboardPalette, SLOT(hide())); connect(mTransparentDrawingView, SIGNAL(hidden()), mKeyboardPalette, SLOT(hide()));
connect(mTransparentDrawingView, SIGNAL(shown()), this, SLOT(showKeyboard())); connect(mTransparentDrawingView, SIGNAL(shown()), this, SLOT(showKeyboard()));
#else #else
mKeyboardPalette = UBKeyboardPalette::create(mTransparentDrawingView); // mKeyboardPalette = UBKeyboardPalette::create(mTransparentDrawingView);
mKeyboardPalette->setParent(mTransparentDrawingView); // mKeyboardPalette->setParent(mTransparentDrawingView);
#endif #endif
connect(mKeyboardPalette, SIGNAL(keyboardActivated(bool)), mTransparentDrawingView, SLOT(virtualKeyboardActivated(bool))); connect( UBApplication::boardController->paletteManager()->mKeyboardPalette, SIGNAL(keyboardActivated(bool)),
mTransparentDrawingView, SLOT(virtualKeyboardActivated(bool)));
// connect(UBApplication::mainWindow->actionVirtualKeyboard, SIGNAL(triggered(bool)),
// mTransparentDrawingView, SLOT(virtualKeyboardActivated(bool)));
#ifdef Q_WS_X11 #ifdef Q_WS_X11
connect(mKeyboardPalette, SIGNAL(moved(QPoint)), this, SLOT(refreshMask())); connect(mKeyboardPalette, SIGNAL(moved(QPoint)), this, SLOT(refreshMask()));
connect(mDesktopPalette,SIGNAL(refreshMask()), this, SLOT(refreshMask())); connect(mDesktopPalette,SIGNAL(refreshMask()), this, SLOT(refreshMask()));
@ -117,7 +122,7 @@ UBDesktopAnnotationController::UBDesktopAnnotationController(QObject *parent)
connect(mDesktopPalette, SIGNAL(screenClick()), this, SLOT(screenCapture())); connect(mDesktopPalette, SIGNAL(screenClick()), this, SLOT(screenCapture()));
connect(mDesktopPalette, SIGNAL(maximized()), this, SLOT(onDesktopPaletteMaximized())); connect(mDesktopPalette, SIGNAL(maximized()), this, SLOT(onDesktopPaletteMaximized()));
connect(mDesktopPalette, SIGNAL(minimizeStart(eMinimizedLocation)), this, SLOT(onDesktopPaletteMinimize())); connect(mDesktopPalette, SIGNAL(minimizeStart(eMinimizedLocation)), this, SLOT(onDesktopPaletteMinimize()));
connect(UBApplication::mainWindow->actionVirtualKeyboard, SIGNAL(triggered(bool)), this, SLOT(showKeyboard(bool))); // connect(UBApplication::mainWindow->actionVirtualKeyboard, SIGNAL(triggered(bool)), this, SLOT(showKeyboard(bool)));
connect(mTransparentDrawingView, SIGNAL(resized(QResizeEvent*)), this, SLOT(onTransparentWidgetResized())); connect(mTransparentDrawingView, SIGNAL(resized(QResizeEvent*)), this, SLOT(onTransparentWidgetResized()));
@ -164,31 +169,32 @@ UBDesktopAnnotationController::UBDesktopAnnotationController(QObject *parent)
onDesktopPaletteMaximized(); onDesktopPaletteMaximized();
} }
void UBDesktopAnnotationController::showKeyboard(bool show) // void UBDesktopAnnotationController::showKeyboard(bool show)
{ // {
#ifdef Q_WS_X11 // #ifdef Q_WS_X11
if (!mTransparentDrawingView->isVisible()) // if (!mTransparentDrawingView->isVisible())
return; // return;
#endif // #endif
//
if(mKeyboardPalette) // if(mKeyboardPalette)
{ // {
if(show) // if(show)
UBDrawingController::drawingController()->setStylusTool(UBStylusTool::Selector); // UBDrawingController::drawingController()->setStylusTool(UBStylusTool::Selector);
mKeyboardPalette->setVisible(show); // mKeyboardPalette->setVisible(show);
//
#ifdef Q_WS_X11 // #ifdef Q_WS_X11
updateMask(true); // updateMask(true);
#endif // #endif
//
} // }
//
} // }
void UBDesktopAnnotationController::showKeyboard()
{ // void UBDesktopAnnotationController::showKeyboard()
if (UBApplication::mainWindow->actionVirtualKeyboard->isChecked()) // {
mKeyboardPalette->show(); // if (UBApplication::mainWindow->actionVirtualKeyboard->isChecked())
} // mKeyboardPalette->show();
// }
UBDesktopAnnotationController::~UBDesktopAnnotationController() UBDesktopAnnotationController::~UBDesktopAnnotationController()
{ {
@ -366,12 +372,12 @@ void UBDesktopAnnotationController::close()
void UBDesktopAnnotationController::stylusToolChanged(int tool) void UBDesktopAnnotationController::stylusToolChanged(int tool)
{ {
UBStylusTool::Enum eTool = (UBStylusTool::Enum)tool; // UBStylusTool::Enum eTool = (UBStylusTool::Enum)tool;
if(eTool != UBStylusTool::Selector && eTool != UBStylusTool::Text) // if(eTool != UBStylusTool::Selector && eTool != UBStylusTool::Text)
{ // {
if(mKeyboardPalette->m_isVisible) // if(mKeyboardPalette->m_isVisible)
UBApplication::mainWindow->actionVirtualKeyboard->activate(QAction::Trigger); // UBApplication::mainWindow->actionVirtualKeyboard->activate(QAction::Trigger);
} // }
updateBackground(); updateBackground();
} }
@ -910,15 +916,15 @@ void UBDesktopAnnotationController::updateMask(bool bTransparent)
{ {
p.drawRect(mDesktopPalette->geometry().x(), mDesktopPalette->geometry().y(), mDesktopPalette->width(), mDesktopPalette->height()); p.drawRect(mDesktopPalette->geometry().x(), mDesktopPalette->geometry().y(), mDesktopPalette->width(), mDesktopPalette->height());
} }
if(mKeyboardPalette->isVisible()) if(UBApplication::boardController->paletteManager()->mKeyboardPalette->isVisible())
{ {
p.drawRect(mKeyboardPalette->geometry().x(), mKeyboardPalette->geometry().y(), mKeyboardPalette->width(), mKeyboardPalette->height()); p.drawRect(UBApplication::boardController->paletteManager()->mKeyboardPalette->geometry().x(), UBApplication::boardController->paletteManager()->mKeyboardPalette->geometry().y(),
UBApplication::boardController->paletteManager()->mKeyboardPalette->width(), UBApplication::boardController->paletteManager()->mKeyboardPalette->height());
} }
// UBApplication::boardController->paletteManager()->mDesktopRightPalette // UBApplication::boardController->paletteManager()->mDesktopRightPalette
if(UBApplication::boardController->paletteManager()->rightPalette()->isVisible()) if(UBApplication::boardController->paletteManager()->rightPalette()->isVisible())
{ {
qDebug() << ">>>>>> Drawing the mask for the right palette";
p.drawRect(UBApplication::boardController->paletteManager()->rightPalette()->geometry().x(), p.drawRect(UBApplication::boardController->paletteManager()->rightPalette()->geometry().x(),
UBApplication::boardController->paletteManager()->rightPalette()->geometry().y(), UBApplication::boardController->paletteManager()->rightPalette()->geometry().y(),
UBApplication::boardController->paletteManager()->rightPalette()->width(), UBApplication::boardController->paletteManager()->rightPalette()->width(),
@ -979,4 +985,4 @@ void UBDesktopAnnotationController::refreshMask()
{ {
updateMask(true); updateMask(true);
} }
} }

@ -29,7 +29,7 @@ class UBDesktopPenPalette;
class UBDesktopMarkerPalette; class UBDesktopMarkerPalette;
class UBDesktopEraserPalette; class UBDesktopEraserPalette;
class UBActionPalette; class UBActionPalette;
class UBKeyboardPalette; //class UBKeyboardPalette;
class UBMainWindow; class UBMainWindow;
#define PROPERTY_PALETTE_TIMER 1000 #define PROPERTY_PALETTE_TIMER 1000
@ -72,8 +72,8 @@ class UBDesktopAnnotationController : public QObject
void stylusToolChanged(int tool); void stylusToolChanged(int tool);
void updateBackground(); void updateBackground();
void showKeyboard(bool show); // void showKeyboard(bool show);
void showKeyboard(); //X11 virtual keyboard working only needed // void showKeyboard(); //X11 virtual keyboard working only needed
signals: signals:
/** /**
@ -118,7 +118,7 @@ class UBDesktopAnnotationController : public QObject
void updateMask(bool bTransparent); void updateMask(bool bTransparent);
UBDesktopPalette *mDesktopPalette; UBDesktopPalette *mDesktopPalette;
UBKeyboardPalette *mKeyboardPalette; //UBKeyboardPalette *mKeyboardPalette;
UBDesktopPenPalette* mDesktopPenPalette; UBDesktopPenPalette* mDesktopPenPalette;
UBDesktopMarkerPalette* mDesktopMarkerPalette; UBDesktopMarkerPalette* mDesktopMarkerPalette;
UBDesktopEraserPalette* mDesktopEraserPalette; UBDesktopEraserPalette* mDesktopEraserPalette;

@ -38,7 +38,7 @@
#include "board/UBBoardPaletteManager.h" #include "board/UBBoardPaletteManager.h"
#include "board/UBDrawingController.h" #include "board/UBDrawingController.h"
#include "gui/UBKeyboardPalette.h" //#include "gui/UBKeyboardPalette.h"
#include "gui/UBThumbnailView.h" #include "gui/UBThumbnailView.h"
#include "gui/UBDocumentTreeWidget.h" #include "gui/UBDocumentTreeWidget.h"
@ -70,7 +70,7 @@ UBDocumentController::UBDocumentController(UBMainWindow* mainWindow)
, mToolsPalette(0) , mToolsPalette(0)
, mToolsPalettePositionned(false) , mToolsPalettePositionned(false)
, mTrashTi(0) , mTrashTi(0)
, mKeyboardPalette(0) // , mKeyboardPalette(0)
{ {
setupViews(); setupViews();
setupToolbar(); setupToolbar();
@ -444,12 +444,12 @@ void UBDocumentController::setupViews()
mMessageWindow = new UBMessageWindow(mDocumentUI->thumbnailWidget); mMessageWindow = new UBMessageWindow(mDocumentUI->thumbnailWidget);
mMessageWindow->hide(); mMessageWindow->hide();
if (UBPlatformUtils::hasVirtualKeyboard()) // if (UBPlatformUtils::hasVirtualKeyboard())
{ // {
mKeyboardPalette = UBKeyboardPalette::create(0); // mKeyboardPalette = UBKeyboardPalette::create(0);
mKeyboardPalette->setParent(controlView()); // mKeyboardPalette->setParent(controlView());
connect(mMainWindow->actionVirtualKeyboard, SIGNAL(triggered(bool)), this, SLOT(showKeyboard(bool))); // connect(mMainWindow->actionVirtualKeyboard, SIGNAL(triggered(bool)), this, SLOT(showKeyboard(bool)));
} // }
} }
} }
@ -467,6 +467,7 @@ void UBDocumentController::setupToolbar()
connect(mMainWindow->actionDocumentTools, SIGNAL(triggered()), this, SLOT(toggleDocumentToolsPalette())); connect(mMainWindow->actionDocumentTools, SIGNAL(triggered()), this, SLOT(toggleDocumentToolsPalette()));
} }
/*
void UBDocumentController::showKeyboard(bool show) void UBDocumentController::showKeyboard(bool show)
{ {
if(mKeyboardPalette) if(mKeyboardPalette)
@ -477,6 +478,7 @@ void UBDocumentController::showKeyboard(bool show)
} }
} }
*/
void UBDocumentController::setupPalettes() void UBDocumentController::setupPalettes()
{ {

@ -34,7 +34,7 @@ class UBDocumentGroupTreeItem;
class UBDocumentProxyTreeItem; class UBDocumentProxyTreeItem;
class UBMainWindow; class UBMainWindow;
class UBDocumentToolsPalette; class UBDocumentToolsPalette;
class UBKeyboardPalette; //class UBKeyboardPalette;
class UBDocumentController : public QObject class UBDocumentController : public QObject
{ {
@ -76,7 +76,7 @@ class UBDocumentController : public QObject
void paste(); void paste();
void focusChanged(QWidget *old, QWidget *current); void focusChanged(QWidget *old, QWidget *current);
void showKeyboard(bool show); // void showKeyboard(bool show);
protected: protected:
virtual void setupViews(); virtual void setupViews();
@ -112,7 +112,7 @@ class UBDocumentController : public QObject
UBDocumentGroupTreeItem* mTrashTi; UBDocumentGroupTreeItem* mTrashTi;
UBDocumentProxy* mCurrentDocument; UBDocumentProxy* mCurrentDocument;
UBKeyboardPalette *mKeyboardPalette; // UBKeyboardPalette *mKeyboardPalette;
private slots: private slots:

@ -193,6 +193,7 @@ bool UBGraphicsItemDelegate::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
bool UBGraphicsItemDelegate::weelEvent(QGraphicsSceneWheelEvent *event) bool UBGraphicsItemDelegate::weelEvent(QGraphicsSceneWheelEvent *event)
{ {
Q_UNUSED(event);
if( mDelegated->isSelected() ) if( mDelegated->isSelected() )
{ {
// event->accept(); // event->accept();

@ -334,7 +334,7 @@ QString UBFileSystemUtils::mimeTypeFromFileName(const QString& fileName)
{ {
QString ext = extension(fileName); QString ext = extension(fileName);
if (ext == "xls" || ext == "xlsx") return "application/msexcel"; if (ext == "xls" || ext == "xlsx") return "application/msexcel";
if (ext == "ppt" || ext == "pptx") return "application/mspowerpoint"; if (ext == "ppt" || ext == "pptx") return "application/mspowerpoint";
if (ext == "ief") return "image/ief"; if (ext == "ief") return "image/ief";
if (ext == "m3u") return "audio/x-mpegurl"; if (ext == "m3u") return "audio/x-mpegurl";
@ -396,6 +396,7 @@ QString UBFileSystemUtils::mimeTypeFromFileName(const QString& fileName)
if (ext == "m4v") return "video/x-m4v"; if (ext == "m4v") return "video/x-m4v";
// W3C widget // W3C widget
if (ext == "wgt") return "application/widget"; if (ext == "wgt") return "application/widget";
if (ext == "wgs") return "application/search";
// Apple widget // Apple widget
if (ext == "wdgt") return "application/vnd.apple-widget"; //mime type invented by us :-( if (ext == "wdgt") return "application/vnd.apple-widget"; //mime type invented by us :-(
if (ext == "swf") return "application/x-shockwave-flash"; if (ext == "swf") return "application/x-shockwave-flash";

@ -92,7 +92,7 @@ UBCachePropertiesWidget::UBCachePropertiesWidget(QWidget *parent, const char *na
mpSizeLabel = new QLabel(tr("Size:"), mpProperties); mpSizeLabel = new QLabel(tr("Size:"), mpProperties);
mpSizeSlider = new QSlider(Qt::Horizontal, mpProperties); mpSizeSlider = new QSlider(Qt::Horizontal, mpProperties);
mpSizeSlider->setMinimumHeight(20); mpSizeSlider->setMinimumHeight(20);
mpSizeSlider->setMinimum(0); mpSizeSlider->setMinimum(50);
mpSizeSlider->setMaximum(MAX_SHAPE_WIDTH); mpSizeSlider->setMaximum(MAX_SHAPE_WIDTH);
mpSizeLayout->addWidget(mpSizeLabel, 0); mpSizeLayout->addWidget(mpSizeLabel, 0);
mpSizeLayout->addWidget(mpSizeSlider, 1); mpSizeLayout->addWidget(mpSizeSlider, 1);
@ -205,16 +205,21 @@ UBCachePropertiesWidget::~UBCachePropertiesWidget()
void UBCachePropertiesWidget::onCloseClicked() void UBCachePropertiesWidget::onCloseClicked()
{ {
// Remove the current cache from the list if(!mCaches.empty())
mCaches.remove(mCaches.indexOf(mpCurrentCache)); {
// Remove the current cache from the list
mCaches.remove(mCaches.indexOf(mpCurrentCache));
// Remove the cache from the board // Remove the cache from the board
UBApplication::boardController->activeScene()->removeItem(mpCurrentCache); UBApplication::boardController->activeScene()->removeItem(mpCurrentCache);
mpCurrentCache = NULL; mpCurrentCache = NULL;
if(mCaches.empty()) if(mCaches.empty())
{ {
emit cacheListEmpty(); emit cacheListEmpty();
}
emit hideTab(name());
} }
} }
@ -321,8 +326,8 @@ void UBCachePropertiesWidget::updateCurrentCache()
// If we fall here, that means: // If we fall here, that means:
// 1 - that this page has no cache // 1 - that this page has no cache
// 2 - we do not on Board page // 2 - we are not in Board mode
// 3 - we in board mode, but show desktop (as really - desktop mode) // 3 - we are in Board mode, but show desktop (as really - Desktop mode)
emit hideTab(name()); emit hideTab(name());
mpCurrentCache = NULL; mpCurrentCache = NULL;
setDisabled(true); setDisabled(true);
@ -340,4 +345,4 @@ void UBCachePropertiesWidget::onCacheEnabled()
{ {
emit showTab(name()); emit showTab(name());
} }

@ -141,7 +141,10 @@ void UBDocumentNavigator::updateSpecificThumbnail(int iPage)
{ {
// Save the current state of the scene // Save the current state of the scene
pScene->setModified(true); pScene->setModified(true);
UBSvgSubsetAdaptor::persistScene(mCrntDoc,pScene, iPage); if(UBApplication::boardController)
{
UBApplication::boardController->persistCurrentScene();
}
UBThumbnailAdaptor::persistScene(mCrntDoc->persistencePath(), pScene, iPage); UBThumbnailAdaptor::persistScene(mCrntDoc->persistencePath(), pScene, iPage);

@ -27,6 +27,9 @@
UBKeyboardPalette::UBKeyboardPalette(QWidget *parent) UBKeyboardPalette::UBKeyboardPalette(QWidget *parent)
: UBActionPalette(Qt::TopRightCorner, parent) : UBActionPalette(Qt::TopRightCorner, parent)
{ {
// setWindowFlags(/*Qt::CustomizeWindowHint|*/Qt::WindowStaysOnTopHint|Qt::FramelessWindowHint);
setCustomCloseProcessing(true); setCustomCloseProcessing(true);
setCustomPosition(true); setCustomPosition(true);
setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum); setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum);
@ -56,57 +59,25 @@ UBKeyboardPalette::UBKeyboardPalette(QWidget *parent)
setContentsMargins( 22, 22, 22, 22 ); setContentsMargins( 22, 22, 22, 22 );
connect(this, SIGNAL(keyboardActivated(bool)), this, SLOT(onActivated(bool))); init();
} }
QList<UBKeyboardPalette*> UBKeyboardPalette::instances; //QList<UBKeyboardPalette*> UBKeyboardPalette::instances;
UBKeyboardPalette* UBKeyboardPalette::create(QWidget *parent) void UBKeyboardPalette::init()
{ {
//------------------------------// m_isVisible = false;
setVisible(false);
if (!UBPlatformUtils::hasVirtualKeyboard())
return NULL;
//------------------------------//
UBKeyboardPalette* firstKeyboard = NULL;
// if we already have keyboards inside, get it position and show/hide status, for new keyboard
if(instances.size() > 0)
firstKeyboard = instances.at(0);
//------------------------------//
UBKeyboardPalette* instance = new UBKeyboardPalette(parent); setKeyButtonSize(UBSettings::settings()->boardKeyboardPaletteKeyBtnSize->get().toString());
instance->setKeyButtonSize(UBSettings::settings()->boardKeyboardPaletteKeyBtnSize->get().toString());
instance->m_isVisible = firstKeyboard ? firstKeyboard->m_isVisible : false; connect(this, SIGNAL(keyboardActivated(bool)), this, SLOT(onActivated(bool)));
instance->setVisible(instance->m_isVisible); connect(UBSettings::settings()->boardKeyboardPaletteKeyBtnSize, SIGNAL(changed(QVariant)), this, SLOT(keyboardPaletteButtonSizeChanged(QVariant)));
connect(UBApplication::mainWindow->actionVirtualKeyboard, SIGNAL(triggered(bool)), this, SLOT(showKeyboard(bool)));
if( firstKeyboard ) connect(this, SIGNAL(closed()), this, SLOT(hideKeyboard()));
instance->move(firstKeyboard->m_pos);
connect(UBSettings::settings()->boardKeyboardPaletteKeyBtnSize, SIGNAL(changed(QVariant)), instance, SLOT(keyboardPaletteButtonSizeChanged(QVariant)));
connect(UBApplication::mainWindow->actionVirtualKeyboard, SIGNAL(triggered(bool)), instance, SLOT(showKeyboard(bool)));
// connect(instance, SIGNAL(moved(const QPoint&)), instance, SLOT(syncPosition(const QPoint&)));
connect(instance, SIGNAL(closed()), instance, SLOT(hideKeyboard()));
//------------------------------//
instances.append(instance);
foreach(UBKeyboardPalette* inst, instances)
{
connect(inst, SIGNAL(moved(const QPoint&)), instance, SLOT(syncPosition(const QPoint&)));
connect(instance, SIGNAL(moved(const QPoint&)), inst, SLOT(syncPosition(const QPoint&)));
connect(inst, SIGNAL(localeChanged(int)), instance, SLOT(syncLocale(int)));
connect(instance, SIGNAL(localeChanged(int)), inst, SLOT(syncLocale(int)));
// connect(instance, SIGNAL(closed()), inst, )
}
//------------------------------// //------------------------------//
return instance; UBPlatformUtils::setWindowNonActivableFlag(this, true);
} }
void UBKeyboardPalette::showKeyboard(bool show) void UBKeyboardPalette::showKeyboard(bool show)

@ -67,6 +67,7 @@ friend class UBCapsLockButton;
friend class UBLocaleButton; friend class UBLocaleButton;
public: public:
UBKeyboardPalette(QWidget *parent);
~UBKeyboardPalette(); ~UBKeyboardPalette();
BTNImages *currBtnImages; BTNImages *currBtnImages;
@ -77,8 +78,6 @@ public:
QString getKeyButtonSize() const {QString res; res.sprintf("%dx%d", btnWidth, btnHeight); return res;} QString getKeyButtonSize() const {QString res; res.sprintf("%dx%d", btnWidth, btnHeight); return res;}
void setKeyButtonSize(const QString& strSize); void setKeyButtonSize(const QString& strSize);
static UBKeyboardPalette* create(QWidget *parent);
static QList<UBKeyboardPalette*> instances;
bool m_isVisible; bool m_isVisible;
QPoint m_pos; QPoint m_pos;
@ -119,10 +118,10 @@ protected:
void setLocale(int nLocale); void setLocale(int nLocale);
const QString* getLocaleName(); const QString* getLocaleName();
private:
UBKeyboardPalette(QWidget *parent); void init();
private:
QRect originalRect; QRect originalRect;

@ -38,38 +38,16 @@ UBLibItemProperties::UBLibItemProperties(QWidget *parent, const char *name):QWid
, mpThumbnail(NULL) , mpThumbnail(NULL)
, mpOrigPixmap(NULL) , mpOrigPixmap(NULL)
, mpElement(NULL) , mpElement(NULL)
, mpNavigBar(NULL)
, mpNavigLayout(NULL)
, mpNavigBack(NULL)
, mpNavigBackAction(NULL)
{ {
setObjectName(name); setObjectName(name);
setAttribute(Qt::WA_StyledBackground, true);
setStyleSheet(UBApplication::globalStyleSheet());
// Create the GUI // Create the GUI
mpLayout = new QVBoxLayout(this); mpLayout = new QVBoxLayout(this);
setLayout(mpLayout); setLayout(mpLayout);
mpNavigBar = new QWidget(this);
mpNavigLayout = new QHBoxLayout(mpNavigBar);
mpNavigBar->setLayout(mpNavigLayout);
mpNavigBar->setStyleSheet(QString("background-color : white; border-radius : 10px;"));
mpNavigBar->setMaximumHeight(42);
mpNavigBackAction = new QAction(QIcon(":/images/libpalette/back.png"), tr("Back"), mpNavigBar);
mpNavigBack = new QToolButton(mpNavigBar);
mpNavigBar->addAction(mpNavigBackAction);
mpNavigBack->setDefaultAction(mpNavigBackAction);
mpNavigBack->setIconSize(QSize(32,32));
mpNavigBack->setToolButtonStyle(Qt::ToolButtonIconOnly);
mpNavigBack->setStyleSheet(QString("QToolButton {color: white; font-weight: bold; font-family: Arial; background-color: transparent; border: none}"));
mpNavigBack->setFocusPolicy(Qt::NoFocus);
mpNavigLayout->addWidget(mpNavigBack, 0);
connect(mpNavigBackAction, SIGNAL(triggered()), this, SLOT(onBack()));
mpNavigLayout->addStretch(1);
mpLayout->addWidget(mpNavigBar);
maxThumbHeight = height() / 4; maxThumbHeight = height() / 4;
mpThumbnail = new QLabel(); mpThumbnail = new QLabel();
@ -77,7 +55,8 @@ UBLibItemProperties::UBLibItemProperties(QWidget *parent, const char *name):QWid
icon.scaledToWidth(THUMBNAIL_WIDTH); icon.scaledToWidth(THUMBNAIL_WIDTH);
mpThumbnail->setPixmap(icon); mpThumbnail->setPixmap(icon);
mpThumbnail->setStyleSheet(QString("background-color : white; padding : 10 px; border-radius : 10px;")); mpThumbnail->setObjectName("DockPaletteWidgetBox");
mpThumbnail->setStyleSheet("background:white;");
mpThumbnail->setAlignment(Qt::AlignHCenter); mpThumbnail->setAlignment(Qt::AlignHCenter);
mpLayout->addWidget(mpThumbnail, 0); mpLayout->addWidget(mpThumbnail, 0);
@ -104,7 +83,8 @@ UBLibItemProperties::UBLibItemProperties(QWidget *parent, const char *name):QWid
mpObjInfos = new QTextEdit(this); mpObjInfos = new QTextEdit(this);
mpObjInfos->setReadOnly(true); mpObjInfos->setReadOnly(true);
mpObjInfos->setStyleSheet(QString("background-color: white; border-radius : 10px;")); mpObjInfos->setObjectName("DockPaletteWidgetBox");
mpObjInfos->setStyleSheet("background:white;");
mpLayout->addWidget(mpObjInfos, 1); mpLayout->addWidget(mpObjInfos, 1);
connect(mpAddPageButton, SIGNAL(clicked()), this, SLOT(onAddToPage())); connect(mpAddPageButton, SIGNAL(clicked()), this, SLOT(onAddToPage()));
@ -118,26 +98,6 @@ UBLibItemProperties::UBLibItemProperties(QWidget *parent, const char *name):QWid
*/ */
UBLibItemProperties::~UBLibItemProperties() UBLibItemProperties::~UBLibItemProperties()
{ {
if(NULL != mpNavigBackAction)
{
delete mpNavigBackAction;
mpNavigBackAction = NULL;
}
if(NULL != mpNavigBack)
{
delete mpNavigBack;
mpNavigBack = NULL;
}
if(NULL != mpNavigLayout)
{
delete mpNavigLayout;
mpNavigLayout = NULL;
}
if(NULL != mpNavigBar)
{
delete mpNavigLayout;
mpNavigLayout = NULL;
}
if(NULL != mpOrigPixmap) if(NULL != mpOrigPixmap)
{ {
delete mpOrigPixmap; delete mpOrigPixmap;
@ -148,11 +108,6 @@ UBLibItemProperties::~UBLibItemProperties()
delete mpLayout; delete mpLayout;
mpLayout = NULL; mpLayout = NULL;
} }
//if(NULL != mpButtonLayout)
//{
// delete mpButtonLayout;
// mpButtonLayout = NULL;
//}
if(NULL != mpSetAsBackgroundButton) if(NULL != mpSetAsBackgroundButton)
{ {
delete mpSetAsBackgroundButton; delete mpSetAsBackgroundButton;
@ -211,10 +166,6 @@ void UBLibItemProperties::adaptSize()
mpThumbnail->setPixmap(mpOrigPixmap->scaledToWidth(THUMBNAIL_WIDTH)); mpThumbnail->setPixmap(mpOrigPixmap->scaledToWidth(THUMBNAIL_WIDTH));
} }
} }
if(NULL != mpNavigBar)
{
mpNavigBar->resize(width(), mpNavigBar->height());
}
} }
/** /**

@ -73,12 +73,6 @@ private:
QPixmap* mpOrigPixmap; QPixmap* mpOrigPixmap;
int maxThumbHeight; int maxThumbHeight;
UBLibElement* mpElement; UBLibElement* mpElement;
// Navigation bar
QWidget* mpNavigBar;
QHBoxLayout* mpNavigLayout;
QToolButton* mpNavigBack;
QAction* mpNavigBackAction;
}; };

@ -15,6 +15,7 @@
#include "UBLibNavigatorWidget.h" #include "UBLibNavigatorWidget.h"
#include "UBLibWidget.h" #include "UBLibWidget.h"
#include "core/UBApplication.h"
#include "core/memcheck.h" #include "core/memcheck.h"
static int lowBoundForSlider = 40; static int lowBoundForSlider = 40;
@ -29,22 +30,20 @@ static int tickIntervalForSlider = 10;
UBLibNavigatorWidget::UBLibNavigatorWidget(QWidget *parent, const char *name):QWidget(parent) UBLibNavigatorWidget::UBLibNavigatorWidget(QWidget *parent, const char *name):QWidget(parent)
, mLayout(NULL) , mLayout(NULL)
, mLibWidget(NULL) , mLibWidget(NULL)
, mPathViewer(NULL)
, mSlider(NULL) , mSlider(NULL)
, mSliderWidthSetting(NULL) , mSliderWidthSetting(NULL)
{ {
setObjectName(name); setObjectName(name);
setAttribute(Qt::WA_StyledBackground, true);
setStyleSheet(UBApplication::globalStyleSheet());
setAcceptDrops(true); setAcceptDrops(true);
UBLibWidget* libWidget = dynamic_cast<UBLibWidget*>(parentWidget()); UBLibWidget* libWidget = dynamic_cast<UBLibWidget*>(parentWidget());
mLayout = new QVBoxLayout(this); mLayout = new QVBoxLayout(this);
setLayout(mLayout); setLayout(mLayout);
mPathViewer = new UBLibPathViewer(this);
mPathViewer->setMaximumHeight(62);
mLayout->addWidget(mPathViewer, 0);
mLibWidget = new UBLibraryWidget(this); mLibWidget = new UBLibraryWidget(this);
mLayout->addWidget(mLibWidget, 1); mLayout->addWidget(mLibWidget, 1);
@ -56,27 +55,25 @@ UBLibNavigatorWidget::UBLibNavigatorWidget(QWidget *parent, const char *name):QW
mSlider->setValue(defaultWidth); mSlider->setValue(defaultWidth);
mSlider->setTickInterval(tickIntervalForSlider); mSlider->setTickInterval(tickIntervalForSlider);
mLayout->addWidget(mSlider, 0); mLayout->addWidget(mSlider, 0);
mLibWidget->updateThumbnailsSize(defaultWidth);
connect(mLibWidget, SIGNAL(navigBarUpdate(UBLibElement*)), this, SLOT(onNavigbarUpate(UBLibElement*))); connect(mLibWidget, SIGNAL(navigBarUpdate(UBLibElement*)), this, SLOT(onNavigbarUpate(UBLibElement*)));
connect(mLibWidget, SIGNAL(propertiesRequested(UBLibElement*)), this, SLOT(onPropertiesRequested(UBLibElement*))); connect(this, SIGNAL(updateNavigBar(UBChainedLibElement*)), libWidget, SLOT(onUpdateNavigBar(UBChainedLibElement*)));
connect(mPathViewer, SIGNAL(mouseClick(UBChainedLibElement*)), this, SLOT(onPathItemClicked(UBChainedLibElement*))); mLibWidget->updateThumbnailsSize(defaultWidth);
connect(mSlider,SIGNAL(valueChanged(int)),this,SLOT(updateThumbnailsSize(int)));
connect(mPathViewer, SIGNAL(elementsDropped(QList<QString>,UBLibElement*)), mLibWidget, SLOT(onElementsDropped(QList<QString>,UBLibElement*)));
connect(mLibWidget, SIGNAL(propertiesRequested(UBLibElement*)), this, SLOT(onPropertiesRequested(UBLibElement*)));
connect(mLibWidget, SIGNAL(displaySearchEngine(UBLibElement*)), this, SLOT(onDisplaySearchEngine(UBLibElement*)));
connect(mSlider,SIGNAL(valueChanged(int)),this,SLOT(updateThumbnailsSize(int)));
connect(libWidget->pathViewer(), SIGNAL(mouseClick(UBChainedLibElement*)), this, SLOT(onPathItemClicked(UBChainedLibElement*)));
connect(libWidget->pathViewer(), SIGNAL(elementsDropped(QList<QString>,UBLibElement*)), mLibWidget, SLOT(onElementsDropped(QList<QString>,UBLibElement*)));
connect(mLibWidget, SIGNAL(navigBarUpdate(UBLibElement*)), libWidget->actionBar(), SLOT(onNavigbarUpdate(UBLibElement*))); connect(mLibWidget, SIGNAL(navigBarUpdate(UBLibElement*)), libWidget->actionBar(), SLOT(onNavigbarUpdate(UBLibElement*)));
connect(mLibWidget, SIGNAL(itemsSelected(QList<UBLibElement*>, bool)), libWidget->actionBar(), SLOT(onSelectionChanged(QList<UBLibElement*>, bool))); connect(mLibWidget, SIGNAL(itemsSelected(QList<UBLibElement*>, bool)), libWidget->actionBar(), SLOT(onSelectionChanged(QList<UBLibElement*>, bool)));
connect(libWidget->actionBar(), SIGNAL(deleteDone()), mLibWidget, SLOT(onRefreshCurrentFolder())); connect(libWidget->actionBar(), SIGNAL(deleteDone()), mLibWidget, SLOT(onRefreshCurrentFolder()));
connect(mLibWidget, SIGNAL(favoritesEntered(bool)), libWidget->actionBar(), SLOT(onFavoritesEntered(bool))); connect(mLibWidget, SIGNAL(favoritesEntered(bool)), libWidget->actionBar(), SLOT(onFavoritesEntered(bool)));
connect(libWidget->actionBar(), SIGNAL(searchElement(QString)), mLibWidget, SLOT(onSearchElement(QString))); connect(libWidget->actionBar(), SIGNAL(searchElement(QString)), mLibWidget, SLOT(onSearchElement(QString)));
connect(libWidget->actionBar(), SIGNAL(newFolderToCreate()), mLibWidget, SLOT(onNewFolderToCreate())); connect(libWidget->actionBar(), SIGNAL(newFolderToCreate()), mLibWidget, SLOT(onNewFolderToCreate()));
/*** to update the search bar **/
connect(mLibWidget, SIGNAL(itemClicked()),libWidget->actionBar(), SLOT(onItemChanged())); connect(mLibWidget, SIGNAL(itemClicked()),libWidget->actionBar(), SLOT(onItemChanged()));
connect(mPathViewer, SIGNAL(mouseClick(UBChainedLibElement*)),libWidget->actionBar(), SLOT(onItemChanged())); connect(libWidget->pathViewer(), SIGNAL(mouseClick(UBChainedLibElement*)),libWidget->actionBar(), SLOT(onItemChanged()));
mLibWidget->init(); mLibWidget->init();
} }
@ -85,10 +82,10 @@ UBLibNavigatorWidget::UBLibNavigatorWidget(QWidget *parent, const char *name):QW
*/ */
UBLibNavigatorWidget::~UBLibNavigatorWidget() UBLibNavigatorWidget::~UBLibNavigatorWidget()
{ {
if(NULL != mPathViewer) if(NULL != mLibWidget)
{ {
delete mPathViewer; delete mLibWidget;
mPathViewer = NULL; mLibWidget = NULL;
} }
if(NULL != mSlider) if(NULL != mSlider)
{ {
@ -100,6 +97,11 @@ UBLibNavigatorWidget::~UBLibNavigatorWidget()
delete mSliderWidthSetting; delete mSliderWidthSetting;
mSliderWidthSetting = NULL; mSliderWidthSetting = NULL;
} }
if(NULL != mLayout)
{
delete mLayout;
mLayout = NULL;
}
} }
void UBLibNavigatorWidget::dropMe(const QMimeData *_data) void UBLibNavigatorWidget::dropMe(const QMimeData *_data)
@ -114,14 +116,8 @@ void UBLibNavigatorWidget::dropMe(const QMimeData *_data)
*/ */
void UBLibNavigatorWidget::onNavigbarUpate(UBLibElement *pElem) void UBLibNavigatorWidget::onNavigbarUpate(UBLibElement *pElem)
{ {
if(NULL != pElem) Q_UNUSED(pElem);
{ emit updateNavigBar(mLibWidget->chainedElements);
// Refresh the path navigator
mPathViewer->displayPath(mLibWidget->chainedElements);
// Show the path navigator
mPathViewer->show();
}
} }
/** /**
@ -157,13 +153,22 @@ void UBLibNavigatorWidget::removeNextChainedElements(UBChainedLibElement *fromEl
/** /**
* \brief Handles the properties requested event * \brief Handles the properties requested event
* @param elem as tje related element * @param elem as the related element
*/ */
void UBLibNavigatorWidget::onPropertiesRequested(UBLibElement *elem) void UBLibNavigatorWidget::onPropertiesRequested(UBLibElement *elem)
{ {
emit propertiesRequested(elem); emit propertiesRequested(elem);
} }
/**
* \brief Handles the display search engine requested event
* @param elem as the related element
*/
void UBLibNavigatorWidget::onDisplaySearchEngine(UBLibElement *elem)
{
emit displaySearchEngine(elem);
}
/** /**
* \brief Update the thumbnails size * \brief Update the thumbnails size
* @param newSize as the given thumbnails size * @param newSize as the given thumbnails size

@ -21,7 +21,6 @@
#include <QDropEvent> #include <QDropEvent>
#include "UBLibraryWidget.h" #include "UBLibraryWidget.h"
#include "UBLibPathViewer.h"
#include "core/UBSetting.h" #include "core/UBSetting.h"
class UBLibNavigatorWidget : public QWidget class UBLibNavigatorWidget : public QWidget
@ -32,24 +31,25 @@ public:
~UBLibNavigatorWidget(); ~UBLibNavigatorWidget();
void dropMe(const QMimeData* _data); void dropMe(const QMimeData* _data);
UBLibraryWidget* libraryWidget(){return mLibWidget;}; UBLibraryWidget* libraryWidget(){return mLibWidget;}
signals: signals:
void propertiesRequested(UBLibElement* elem); void propertiesRequested(UBLibElement* elem);
void displaySearchEngine(UBLibElement* elem);
void updateNavigBar(UBChainedLibElement* elem);
private slots: private slots:
void onNavigbarUpate(UBLibElement* pElem); void onNavigbarUpate(UBLibElement* pElem);
void onPathItemClicked(UBChainedLibElement *elem); void onPathItemClicked(UBChainedLibElement *elem);
void onPropertiesRequested(UBLibElement* elem); void onPropertiesRequested(UBLibElement* elem);
void updateThumbnailsSize(int newSize); void updateThumbnailsSize(int newSize);
void onDisplaySearchEngine(UBLibElement* elem);
private: private:
void removeNextChainedElements(UBChainedLibElement* fromElem); void removeNextChainedElements(UBChainedLibElement* fromElem);
QVBoxLayout* mLayout; QVBoxLayout* mLayout;
UBLibraryWidget* mLibWidget; UBLibraryWidget* mLibWidget;
UBLibPathViewer* mPathViewer;
QSlider* mSlider; QSlider* mSlider;
UBSetting* mSliderWidthSetting; UBSetting* mSliderWidthSetting;
}; };

@ -29,15 +29,21 @@
*/ */
UBLibPathViewer::UBLibPathViewer(QWidget *parent, const char *name):QGraphicsView(parent) UBLibPathViewer::UBLibPathViewer(QWidget *parent, const char *name):QGraphicsView(parent)
, mpElems(NULL) , mpElems(NULL)
, mpElemsBackup(NULL)
, mpScene(NULL) , mpScene(NULL)
, mpLayout(NULL) , mpLayout(NULL)
, mpContainer(NULL) , mpContainer(NULL)
, mpBackElem(NULL)
{ {
setObjectName(name); setObjectName(name);
setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOn); setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOn);
setAcceptDrops(true); setAcceptDrops(true);
mpBackElem = new UBLibElement();
mpBackElem->setThumbnail(QPixmap(":images/libpalette/back.png").toImage());
mpBackElem->setDeletable(false);
mpScene = new UBPathScene(this); mpScene = new UBPathScene(this);
setScene(mpScene); setScene(mpScene);
@ -57,21 +63,31 @@ UBLibPathViewer::UBLibPathViewer(QWidget *parent, const char *name):QGraphicsVie
*/ */
UBLibPathViewer::~UBLibPathViewer() UBLibPathViewer::~UBLibPathViewer()
{ {
// if(NULL != mpLayout)
// {
// delete mpLayout;
// mpLayout = NULL;
// }
if(NULL != mpContainer) if(NULL != mpContainer)
{ {
delete mpContainer; delete mpContainer;
mpContainer = NULL; mpContainer = NULL;
} }
if(NULL != mpBackElem)
{
delete mpBackElem;
mpBackElem = NULL;
}
if(NULL != mpElems) if(NULL != mpElems)
{ {
delete mpElems; delete mpElems;
mpElems = NULL; mpElems = NULL;
} }
if(NULL != mpElemsBackup)
{
delete mpElemsBackup;
mpElemsBackup = NULL;
}
if(NULL != mpLayout)
{
delete mpLayout;
mpLayout = NULL;
}
if(NULL != mpScene) if(NULL != mpScene)
{ {
delete mpScene; delete mpScene;
@ -255,6 +271,24 @@ void UBLibPathViewer::onElementsDropped(QList<QString> elements, UBLibElement *t
emit elementsDropped(elements, target); emit elementsDropped(elements, target);
} }
void UBLibPathViewer::showBack()
{
// Backup the current path so we can go back by clicking on the back button
mpElemsBackup = mpElems;
// Set the correct path to the backElem
UBChainedLibElement* pLastElem = mpElemsBackup->lastElement();
if(NULL != pLastElem)
{
mpBackElem->setPath(pLastElem->element()->path());
mpBackElem->setType(eUBLibElementType_Folder);
mpBackElem->setName(pLastElem->element()->name());
}
// Display the 'back' element
displayPath(new UBChainedLibElement(mpBackElem));
}
UBFolderPath::UBFolderPath():QGraphicsProxyWidget() UBFolderPath::UBFolderPath():QGraphicsProxyWidget()
{ {
@ -422,7 +456,6 @@ void UBPathScene::dragMoveEvent(QGraphicsSceneDragDropEvent *event)
void UBPathScene::dropEvent(QGraphicsSceneDragDropEvent *event) void UBPathScene::dropEvent(QGraphicsSceneDragDropEvent *event)
{ {
const QMimeData* pMimeData = event->mimeData(); const QMimeData* pMimeData = event->mimeData();
qDebug() << " Drop source : " << event->source()->metaObject()->className();
if(0 == QString::compare(event->source()->metaObject()->className(), "UBLibraryWidget")) if(0 == QString::compare(event->source()->metaObject()->className(), "UBLibraryWidget"))
{ {

@ -79,6 +79,10 @@ public:
void displayPath(UBChainedLibElement* elementsChain); void displayPath(UBChainedLibElement* elementsChain);
int widgetAt(QPointF p); int widgetAt(QPointF p);
void updateScrolls(); void updateScrolls();
public slots:
void showBack();
signals: signals:
void mouseClick(UBChainedLibElement* elem); void mouseClick(UBChainedLibElement* elem);
void elementsDropped(QList<QString> elements, UBLibElement* target); void elementsDropped(QList<QString> elements, UBLibElement* target);
@ -99,6 +103,8 @@ private:
/** The chained path elements */ /** The chained path elements */
UBChainedLibElement* mpElems; UBChainedLibElement* mpElems;
/** The backup chained path elements */
UBChainedLibElement* mpElemsBackup;
/** The scene */ /** The scene */
UBPathScene* mpScene; UBPathScene* mpScene;
//QGraphicsScene* mpScene; //QGraphicsScene* mpScene;
@ -110,6 +116,8 @@ private:
QVector<QGraphicsWidget*> mVItems; QVector<QGraphicsWidget*> mVItems;
/** The total width of the element in the scene */ /** The total width of the element in the scene */
int mSceneWidth; int mSceneWidth;
/** The back element */
UBLibElement* mpBackElem;
}; };

@ -0,0 +1,86 @@
#include <QDomDocument>
#include "core/UBApplication.h"
#include "UBLibWebView.h"
UBLibWebView::UBLibWebView(QWidget* parent, const char* name):QWidget(parent)
, mpView(NULL)
, mpWebSettings(NULL)
, mpLayout(NULL)
{
setObjectName(name);
setAttribute(Qt::WA_StyledBackground, true);
setStyleSheet(UBApplication::globalStyleSheet());
mpLayout = new QVBoxLayout();
setLayout(mpLayout);
mpView = new QWebView(this);
mpView->setObjectName("SearchEngineView");
//mpView->setStyleSheet(QString("background-color:white;"));
mpWebSettings = QWebSettings::globalSettings();
mpWebSettings->setAttribute(QWebSettings::JavaEnabled, true);
mpWebSettings->setAttribute(QWebSettings::PluginsEnabled, true);
mpWebSettings->setAttribute(QWebSettings::JavaEnabled, true);
mpWebSettings->setAttribute(QWebSettings::LocalStorageDatabaseEnabled, true);
mpWebSettings->setAttribute(QWebSettings::OfflineWebApplicationCacheEnabled, true);
mpWebSettings->setAttribute(QWebSettings::OfflineStorageDatabaseEnabled, true);
mpWebSettings->setAttribute(QWebSettings::JavascriptCanAccessClipboard, true);
mpWebSettings->setAttribute(QWebSettings::DnsPrefetchEnabled, true);
mpLayout->addWidget(mpView);
}
UBLibWebView::~UBLibWebView()
{
if(NULL != mpView)
{
delete mpView;
mpView = NULL;
}
if(NULL != mpLayout)
{
delete mpLayout;
mpLayout = NULL;
}
}
void UBLibWebView::setElement(UBLibElement *elem)
{
if(NULL != elem)
{
QString qsWidgetName;
QString path = elem->path().toLocalFile();
QString qsConfigPath = QString("%0/config.xml").arg(path);
if(QFile::exists(qsConfigPath))
{
QFile f(qsConfigPath);
if(f.open(QIODevice::ReadOnly))
{
QDomDocument domDoc;
domDoc.setContent(QString(f.readAll()));
QDomElement root = domDoc.documentElement();
QDomNode node = root.firstChild();
while(!node.isNull())
{
if(node.toElement().tagName() == "content")
{
QDomAttr srcAttr = node.toElement().attributeNode("src");
qsWidgetName = srcAttr.value();
break;
}
node = node.nextSibling();
}
f.close();
}
}
mpView->load(QUrl::fromLocalFile(QString("%0/%1").arg(path).arg(qsWidgetName)));
}
}

@ -0,0 +1,27 @@
#ifndef UBLIBWEBVIEW_H
#define UBLIBWEBVIEW_H
#include <QWidget>
#include <QWebView>
#include <QWebSettings>
#include <QVBoxLayout>
#include "board/UBLibraryController.h"
class UBLibWebView : public QWidget
{
Q_OBJECT
public:
UBLibWebView(QWidget* parent = 0, const char* name = "UBLibWebView");
~UBLibWebView();
void setElement(UBLibElement* elem);
private:
QWebView* mpView;
QWebSettings* mpWebSettings;
QVBoxLayout* mpLayout;
};
#endif // UBLIBWEBVIEW_H

@ -29,6 +29,8 @@ UBLibWidget::UBLibWidget(QWidget *parent, const char *name):UBDockPaletteWidget(
, mNavigator(NULL) , mNavigator(NULL)
, mProperties(NULL) , mProperties(NULL)
, mActionBar(NULL) , mActionBar(NULL)
, mpWebView(NULL)
, mpPathViewer(NULL)
{ {
setObjectName(name); setObjectName(name);
mName = "LibWidget"; mName = "LibWidget";
@ -43,23 +45,37 @@ UBLibWidget::UBLibWidget(QWidget *parent, const char *name):UBDockPaletteWidget(
mLayout = new QVBoxLayout(this); mLayout = new QVBoxLayout(this);
setLayout(mLayout); setLayout(mLayout);
// -------------
// Build the GUI // Build the GUI
// -------------
// The 'global' widgets
mStackedWidget = new QStackedWidget(this); mStackedWidget = new QStackedWidget(this);
mActionBar = new UBLibActionBar(this); mActionBar = new UBLibActionBar(this);
mpPathViewer = new UBLibPathViewer(this);
mpPathViewer->setMaximumHeight(62);
// The internal widgets
mNavigator = new UBLibNavigatorWidget(this); mNavigator = new UBLibNavigatorWidget(this);
mProperties = new UBLibItemProperties(this); mProperties = new UBLibItemProperties(this);
mpWebView = new UBLibWebView(this);
mLayout->addWidget(mpPathViewer, 0);
mLayout->addWidget(mStackedWidget, 1); mLayout->addWidget(mStackedWidget, 1);
mLayout->addWidget(mActionBar, 0); mLayout->addWidget(mActionBar, 0);
mStackedWidget->addWidget(mNavigator); mStackedWidget->addWidget(mNavigator);
mStackedWidget->addWidget(mProperties); mStackedWidget->addWidget(mProperties);
mStackedWidget->addWidget(mpWebView);
mStackedWidget->setCurrentIndex(ID_NAVIGATOR); mStackedWidget->setCurrentIndex(ID_NAVIGATOR);
miCrntStackWidget = ID_NAVIGATOR; miCrntStackWidget = ID_NAVIGATOR;
connect(mNavigator, SIGNAL(updateNavigBar(UBChainedLibElement*)), this, SLOT(onUpdateNavigBar(UBChainedLibElement*)));
connect(mNavigator, SIGNAL(propertiesRequested(UBLibElement*)), this, SLOT(showProperties(UBLibElement*))); connect(mNavigator, SIGNAL(propertiesRequested(UBLibElement*)), this, SLOT(showProperties(UBLibElement*)));
connect(mNavigator, SIGNAL(displaySearchEngine(UBLibElement*)), this, SLOT(showSearchEngine(UBLibElement*)));
connect(mProperties, SIGNAL(showFolderContent()), this, SLOT(showFolder())); connect(mProperties, SIGNAL(showFolderContent()), this, SLOT(showFolder()));
connect(this, SIGNAL(showLibElemProperties()), mpPathViewer, SLOT(showBack()));
connect(this, SIGNAL(showLibSearchEngine()), mpPathViewer, SLOT(showBack()));
} }
/** /**
@ -67,16 +83,41 @@ UBLibWidget::UBLibWidget(QWidget *parent, const char *name):UBDockPaletteWidget(
*/ */
UBLibWidget::~UBLibWidget() UBLibWidget::~UBLibWidget()
{ {
if(NULL != mpPathViewer)
{
delete mpPathViewer;
mpPathViewer = NULL;
}
if(NULL != mNavigator)
{
delete mNavigator;
mNavigator = NULL;
}
if(NULL != mpWebView)
{
delete mpWebView;
mpWebView = NULL;
}
if(NULL != mProperties) if(NULL != mProperties)
{ {
delete mProperties; delete mProperties;
mProperties = NULL; mProperties = NULL;
} }
if(NULL != mStackedWidget)
{
delete mStackedWidget;
mStackedWidget = NULL;
}
if(NULL != mActionBar) if(NULL != mActionBar)
{ {
delete mActionBar; delete mActionBar;
mActionBar = NULL; mActionBar = NULL;
} }
if(NULL != mLayout)
{
delete mLayout;
mLayout = NULL;
}
} }
/** /**
@ -133,14 +174,26 @@ void UBLibWidget::showProperties(UBLibElement *elem)
{ {
if(NULL != elem) if(NULL != elem)
{ {
emit showLibElemProperties();
mActionBar->setButtons(eButtonSet_Properties); mActionBar->setButtons(eButtonSet_Properties);
// Show the properties of this object
mProperties->showElement(elem); mProperties->showElement(elem);
mStackedWidget->setCurrentIndex(ID_PROPERTIES); mStackedWidget->setCurrentIndex(ID_PROPERTIES);
miCrntStackWidget = ID_PROPERTIES; miCrntStackWidget = ID_PROPERTIES;
} }
} }
void UBLibWidget::showSearchEngine(UBLibElement *elem)
{
if(NULL != elem)
{
emit showLibSearchEngine();
mActionBar->hide();
mpWebView->setElement(elem);
mStackedWidget->setCurrentIndex(ID_WEBVIEW);
miCrntStackWidget = ID_WEBVIEW;
}
}
void UBLibWidget::showFolder() void UBLibWidget::showFolder()
{ {
mActionBar->setButtons(mActionBar->previousButtonSet()); mActionBar->setButtons(mActionBar->previousButtonSet());
@ -157,3 +210,14 @@ int UBLibWidget::border()
{ {
return 15; return 15;
} }
void UBLibWidget::onUpdateNavigBar(UBChainedLibElement *elem)
{
mpPathViewer->displayPath(elem);
mpPathViewer->show();
if(ID_NAVIGATOR != miCrntStackWidget)
{
showFolder();
}
}

@ -30,9 +30,12 @@
#include "UBLibNavigatorWidget.h" #include "UBLibNavigatorWidget.h"
#include "UBLibItemProperties.h" #include "UBLibItemProperties.h"
#include "UBLibActionBar.h" #include "UBLibActionBar.h"
#include "UBLibWebView.h"
#include "UBLibPathViewer.h"
#define ID_NAVIGATOR 0 #define ID_NAVIGATOR 0
#define ID_PROPERTIES 1 #define ID_PROPERTIES 1
#define ID_WEBVIEW 2
class UBLibWidget : public UBDockPaletteWidget class UBLibWidget : public UBDockPaletteWidget
{ {
@ -42,10 +45,13 @@ public:
~UBLibWidget(); ~UBLibWidget();
UBLibActionBar* actionBar(){return mActionBar;} UBLibActionBar* actionBar(){return mActionBar;}
UBLibNavigatorWidget* libNavigator() {return mNavigator;}; UBLibNavigatorWidget* libNavigator() {return mNavigator;}
UBLibPathViewer* pathViewer() {return mpPathViewer;}
signals: signals:
void resized(); void resized();
void showLibElemProperties();
void showLibSearchEngine();
protected: protected:
void dragEnterEvent(QDragEnterEvent* pEvent); void dragEnterEvent(QDragEnterEvent* pEvent);
@ -55,7 +61,9 @@ protected:
private slots: private slots:
void showProperties(UBLibElement* elem); void showProperties(UBLibElement* elem);
void showSearchEngine(UBLibElement* elem);
void showFolder(); void showFolder();
void onUpdateNavigBar(UBChainedLibElement* elem);
private: private:
void processMimeData(const QMimeData* pData); void processMimeData(const QMimeData* pData);
@ -74,6 +82,10 @@ private:
UBLibActionBar* mActionBar; UBLibActionBar* mActionBar;
/** The current stack widget index*/ /** The current stack widget index*/
int miCrntStackWidget; int miCrntStackWidget;
/** The webview used to display the search engines */
UBLibWebView* mpWebView;
/** The path navigation widget */
UBLibPathViewer* mpPathViewer;
}; };
#endif // UBLIBWIDGET_H #endif // UBLIBWIDGET_H

@ -25,15 +25,18 @@
#include "core/memcheck.h" #include "core/memcheck.h"
#include "frameworks/UBFileSystemUtils.h"
/** /**
* \brief Constructor * \brief Constructor
* @param parent as the parent widget * @param parent as the parent widget
* @param name as the widget object name * @param name as the widget object name
*/ */
UBLibraryWidget::UBLibraryWidget(QWidget *parent, const char *name):UBThumbnailWidget(parent) UBLibraryWidget::UBLibraryWidget(QWidget *parent, const char *name):UBThumbnailWidget(parent)
, chainedElements(NULL) , chainedElements(NULL)
, mpCrntDir(NULL) , mpCrntDir(NULL)
, mpCrntElem(NULL) , mpCrntElem(NULL)
, mLibraryController(NULL)
{ {
setObjectName(name); setObjectName(name);
setSpacing(5); setSpacing(5);
@ -45,7 +48,8 @@ UBLibraryWidget::UBLibraryWidget(QWidget *parent, const char *name):UBThumbnailW
*/ */
UBLibraryWidget::~UBLibraryWidget() UBLibraryWidget::~UBLibraryWidget()
{ {
if(mLibraryController){ if(NULL != mLibraryController)
{
delete mLibraryController; delete mLibraryController;
mLibraryController = NULL; mLibraryController = NULL;
} }
@ -148,7 +152,8 @@ void UBLibraryWidget::onItemClicked(QGraphicsItem *item, int index)
{ {
delete mpCrntElem; delete mpCrntElem;
mpCrntElem = new UBLibElement(pElem); mpCrntElem = new UBLibElement(pElem);
if(eUBLibElementType_Folder == pElem->type() || eUBLibElementType_VirtualFolder == pElem->type()) { if(eUBLibElementType_Folder == pElem->type() || eUBLibElementType_VirtualFolder == pElem->type())
{
// Add the clicked element to the end of the elements list // Add the clicked element to the end of the elements list
// (at this level, the user can only go down in the path) // (at this level, the user can only go down in the path)
UBChainedLibElement* pNextElem = new UBChainedLibElement(pElem); UBChainedLibElement* pNextElem = new UBChainedLibElement(pElem);
@ -162,8 +167,15 @@ void UBLibraryWidget::onItemClicked(QGraphicsItem *item, int index)
} }
else else
{ {
// Display the properties view if ("application/search" == UBFileSystemUtils::mimeTypeFromFileName(pElem->path().toLocalFile()))
emit propertiesRequested(pElem); {
emit displaySearchEngine(pElem);
}
else
{
// Display the properties view
emit propertiesRequested(pElem);
}
} }
} }
emit itemClicked(); emit itemClicked();

@ -47,7 +47,7 @@ public:
void updateThumbnailsSize(int newSize); void updateThumbnailsSize(int newSize);
void init(); void init();
UBLibraryController* libraryController() {return mLibraryController;}; UBLibraryController* libraryController() {return mLibraryController;}
public slots: public slots:
void onRefreshCurrentFolder(); void onRefreshCurrentFolder();
@ -59,6 +59,7 @@ signals:
void navigBarUpdate(UBLibElement* pElem); void navigBarUpdate(UBLibElement* pElem);
void itemsSelected(QList<UBLibElement*> elemList, bool inTrash); void itemsSelected(QList<UBLibElement*> elemList, bool inTrash);
void propertiesRequested(UBLibElement* pElem); void propertiesRequested(UBLibElement* pElem);
void displaySearchEngine(UBLibElement* pElem);
void favoritesEntered(bool bFav); void favoritesEntered(bool bFav);
void itemClicked(); void itemClicked();

@ -16,7 +16,6 @@
#include <QtGui> #include <QtGui>
#include "UBMainWindow.h" #include "UBMainWindow.h"
#include "core/UBApplication.h" #include "core/UBApplication.h"
#include "core/UBApplicationController.h" #include "core/UBApplicationController.h"
#include "board/UBBoardController.h" #include "board/UBBoardController.h"
@ -160,3 +159,26 @@ bool UBMainWindow::yesNoQuestion(QString windowTitle, QString text)
return messageBox.clickedButton() == yesButton; return messageBox.clickedButton() == yesButton;
} }
void UBMainWindow::oneButtonMessageBox(QString windowTitle, QString text, QMessageBox::Icon type)
{
QMessageBox messageBox;
messageBox.setParent(this);
messageBox.setWindowFlags(Qt::Dialog);
messageBox.setWindowTitle(windowTitle);
messageBox.setText(text);
messageBox.addButton(tr("Ok"),QMessageBox::YesRole);
messageBox.setIcon(type);
messageBox.exec();
}
void UBMainWindow::warning(QString windowTitle, QString text)
{
oneButtonMessageBox(windowTitle,text, QMessageBox::Warning);
}
void UBMainWindow::information(QString windowTitle, QString text)
{
oneButtonMessageBox(windowTitle, text, QMessageBox::Information);
}

@ -20,6 +20,7 @@
#include <QMainWindow> #include <QMainWindow>
#include <QWidget> #include <QWidget>
#include <QWebView> #include <QWebView>
#include <QMessageBox>
class QStackedLayout; class QStackedLayout;
@ -41,7 +42,10 @@ class UBMainWindow : public QMainWindow, public Ui::MainWindow
void addDocumentsWidget(QWidget *pWidget); void addDocumentsWidget(QWidget *pWidget);
void switchToDocumentsWidget(); void switchToDocumentsWidget();
bool yesNoQuestion(QString windowTitle, QString text); bool yesNoQuestion(QString windowTitle, QString text);
void warning(QString windowTitle, QString text);
void information(QString windowTitle, QString text);
signals: signals:
void closeEvent_Signal( QCloseEvent *event ); void closeEvent_Signal( QCloseEvent *event );
@ -50,6 +54,7 @@ class UBMainWindow : public QMainWindow, public Ui::MainWindow
void onExportDone(); void onExportDone();
protected: protected:
void oneButtonMessageBox(QString windowTitle, QString text, QMessageBox::Icon type);
virtual void keyPressEvent(QKeyEvent *event); virtual void keyPressEvent(QKeyEvent *event);
virtual void closeEvent (QCloseEvent *event); virtual void closeEvent (QCloseEvent *event);

@ -12,28 +12,29 @@
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include <QMessageBox>
#include <QFileDialog> #include <QFileDialog>
#include "UBUpdateDlg.h" #include "UBUpdateDlg.h"
#include "core/UBApplication.h"
#include "UBMainWindow.h"
#include "core/memcheck.h" #include "core/memcheck.h"
UBUpdateDlg::UBUpdateDlg(QWidget *parent, int nbFiles, const QString& bkpPath) UBUpdateDlg::UBUpdateDlg(QWidget *parent, int nbFiles, const QString& bkpPath)
: QDialog(parent) : QDialog(parent)
, mMainLayout(NULL) , mMainLayout(NULL)
, mNbFilesLabel(NULL) , mNbFilesLabel(NULL)
, mBkpLabel(NULL) , mBkpLabel(NULL)
, mBkpPath(NULL) , mBkpPath(NULL)
, mBrowseBttn(NULL) , mBrowseBttn(NULL)
, mpDlgBttn(NULL) , mpDlgBttn(NULL)
, mLayout(NULL) , mLayout(NULL)
, mHLayout(NULL) , mHLayout(NULL)
, mStackedWidget(NULL) , mStackedWidget(NULL)
, mDialogWidget(NULL) , mDialogWidget(NULL)
, mProgressWidget(NULL) , mProgressWidget(NULL)
, mProgressLayout(NULL) , mProgressLayout(NULL)
, mProgressLabel(NULL) , mProgressLabel(NULL)
{ {
mDialogWidget = new QWidget(this); mDialogWidget = new QWidget(this);
@ -178,18 +179,16 @@ void UBUpdateDlg::onUpdate()
void UBUpdateDlg::onFilesUpdated(bool bResult) void UBUpdateDlg::onFilesUpdated(bool bResult)
{ {
this->hide(); this->hide();
QString qsMsg; QString qsMsg;
if (bResult) if (bResult) {
{
qsMsg = tr("Files update successful!\nPlease reboot the application to access the updated documents."); qsMsg = tr("Files update successful!\nPlease reboot the application to access the updated documents.");
} }
else else {
{
qsMsg = tr("An error occured during the update. The files have not been affected."); qsMsg = tr("An error occured during the update. The files have not been affected.");
} }
QMessageBox::information(this, tr("Files update results"), qsMsg, QMessageBox::Ok); UBApplication::mainWindow->information(tr("Files update results"), qsMsg);
} }
QString UBUpdateDlg::backupPath() QString UBUpdateDlg::backupPath()

@ -43,7 +43,8 @@ HEADERS += src/gui/UBThumbnailView.h \
src/gui/UBLibWidget.h \ src/gui/UBLibWidget.h \
src/gui/UBMagnifer.h \ src/gui/UBMagnifer.h \
src/gui/UBCachePropertiesWidget.h \ src/gui/UBCachePropertiesWidget.h \
src/gui/UBTeacherBarWidget.h src/gui/UBTeacherBarWidget.h \
src/gui/UBLibWebView.h
SOURCES += src/gui/UBThumbnailView.cpp \ SOURCES += src/gui/UBThumbnailView.cpp \
src/gui/UBFloatingPalette.cpp \ src/gui/UBFloatingPalette.cpp \
@ -89,7 +90,8 @@ SOURCES += src/gui/UBThumbnailView.cpp \
src/gui/UBLibWidget.cpp \ src/gui/UBLibWidget.cpp \
src/gui/UBMagnifer.cpp \ src/gui/UBMagnifer.cpp \
src/gui/UBCachePropertiesWidget.cpp \ src/gui/UBCachePropertiesWidget.cpp \
src/gui/UBTeacherBarWidget.cpp src/gui/UBTeacherBarWidget.cpp \
src/gui/UBLibWebView.cpp
win32 { win32 {

@ -160,14 +160,18 @@ void UBNetworkAccessManager::sslErrors(QNetworkReply *reply, const QList<QSslErr
QString errors = errorStrings.join(QLatin1String("\n")); QString errors = errorStrings.join(QLatin1String("\n"));
int ret = QMessageBox::warning(mainWindow, QCoreApplication::applicationName(), QMessageBox messageBox;
tr("SSL Errors:\n\n%1\n\n%2\n\n" messageBox.setParent(mainWindow);
"Do you want to ignore these errors for this host?").arg(reply->url().toString()).arg(errors), messageBox.setWindowFlags(Qt::Dialog);
QMessageBox::Yes | QMessageBox::No, messageBox.setWindowTitle(QCoreApplication::applicationName());
QMessageBox::No); messageBox.setText(tr("SSL Errors:\n\n%1\n\n%2\n\n"
"Do you want to ignore these errors for this host?").arg(reply->url().toString()).arg(errors));
if (ret == QMessageBox::Yes) QPushButton* yesButton = messageBox.addButton(tr("Yes"),QMessageBox::YesRole);
{ messageBox.addButton(tr("No"),QMessageBox::NoRole);
messageBox.setIcon(QMessageBox::Question);
messageBox.exec();
if(messageBox.clickedButton() == yesButton) {
reply->ignoreSslErrors(); reply->ignoreSslErrors();
sslTrustedHostList.append(replyHost); sslTrustedHostList.append(replyHost);
} }

@ -105,7 +105,7 @@ void UBGraphicsCache::paint(QPainter *painter, const QStyleOptionGraphicsItem *o
} }
else if(eMaskShap_Rectangle == mMaskShape) else if(eMaskShap_Rectangle == mMaskShape)
{ {
path.addRect(mShapePos.x() - mShapeWidth / 2, mShapePos.y() - mShapeWidth / 2, mShapeWidth, mShapeWidth); path.addRect(mShapePos.x() - mShapeWidth, mShapePos.y() - mShapeWidth, 2*mShapeWidth, 2*mShapeWidth);
} }
path.setFillRule(Qt::OddEvenFill); path.setFillRule(Qt::OddEvenFill);
} }

@ -32,7 +32,7 @@
#include "gui/UBScreenMirror.h" #include "gui/UBScreenMirror.h"
#include "gui/UBMainWindow.h" #include "gui/UBMainWindow.h"
#include "gui/UBWebToolsPalette.h" #include "gui/UBWebToolsPalette.h"
#include "gui/UBKeyboardPalette.h" //#include "gui/UBKeyboardPalette.h"
#include "core/UBSettings.h" #include "core/UBSettings.h"
#include "core/UBSetting.h" #include "core/UBSetting.h"
@ -55,7 +55,7 @@ UBWebController::UBWebController(UBMainWindow* mainWindow)
, mBrowserWidget(0) , mBrowserWidget(0)
, mTrapFlashController(0) , mTrapFlashController(0)
, mToolsCurrentPalette(0) , mToolsCurrentPalette(0)
, mKeyboardCurrentPalette(0) // , mKeyboardCurrentPalette(0)
, mToolsPalettePositionned(false) , mToolsPalettePositionned(false)
, mDownloadViewIsVisible(false) , mDownloadViewIsVisible(false)
@ -113,7 +113,7 @@ void UBWebController::webBrowserInstance()
{ {
mCurrentWebBrowser = &mWebBrowserList[WebBrowser]; mCurrentWebBrowser = &mWebBrowserList[WebBrowser];
mToolsCurrentPalette = &mToolsPaletteList[WebBrowser]; mToolsCurrentPalette = &mToolsPaletteList[WebBrowser];
mKeyboardCurrentPalette = &mKeyboardPaletteList[WebBrowser]; // mKeyboardCurrentPalette = &mKeyboardPaletteList[WebBrowser];
mToolsPalettePositionned = mToolsPalettePositionnedList[WebBrowser]; mToolsPalettePositionned = mToolsPalettePositionnedList[WebBrowser];
if (!(*mCurrentWebBrowser)) if (!(*mCurrentWebBrowser))
{ {
@ -191,7 +191,7 @@ void UBWebController::tutorialWebInstance()
{ {
mCurrentWebBrowser = &mWebBrowserList[Tutorial]; mCurrentWebBrowser = &mWebBrowserList[Tutorial];
mToolsCurrentPalette = &mToolsPaletteList[Tutorial]; mToolsCurrentPalette = &mToolsPaletteList[Tutorial];
mKeyboardCurrentPalette = &mKeyboardPaletteList[Tutorial]; // mKeyboardCurrentPalette = &mKeyboardPaletteList[Tutorial];
mToolsPalettePositionned = &mToolsPalettePositionnedList[Tutorial]; mToolsPalettePositionned = &mToolsPalettePositionnedList[Tutorial];
if (!(*mCurrentWebBrowser)) if (!(*mCurrentWebBrowser))
{ {
@ -249,7 +249,7 @@ void UBWebController::paraschoolWebInstance()
else { else {
mCurrentWebBrowser = &mWebBrowserList[Paraschool]; mCurrentWebBrowser = &mWebBrowserList[Paraschool];
mToolsCurrentPalette = &mToolsPaletteList[Paraschool]; mToolsCurrentPalette = &mToolsPaletteList[Paraschool];
mKeyboardCurrentPalette = &mKeyboardPaletteList[Paraschool]; // mKeyboardCurrentPalette = &mKeyboardPaletteList[Paraschool];
mToolsPalettePositionned = &mToolsPalettePositionnedList[Paraschool]; mToolsPalettePositionned = &mToolsPalettePositionnedList[Paraschool];
if (!(*mCurrentWebBrowser)){ if (!(*mCurrentWebBrowser)){
(*mCurrentWebBrowser) = new WBBrowserWindow(mMainWindow->centralWidget(), mMainWindow, true); (*mCurrentWebBrowser) = new WBBrowserWindow(mMainWindow->centralWidget(), mMainWindow, true);
@ -391,7 +391,7 @@ void UBWebController::setupPalettes()
{ {
(*mToolsCurrentPalette) = new UBWebToolsPalette((*mCurrentWebBrowser),false); (*mToolsCurrentPalette) = new UBWebToolsPalette((*mCurrentWebBrowser),false);
(*mKeyboardCurrentPalette) = UBKeyboardPalette::create(*mCurrentWebBrowser); // (*mKeyboardCurrentPalette) = UBKeyboardPalette::create(*mCurrentWebBrowser);
#ifndef Q_WS_WIN #ifndef Q_WS_WIN
if (*mKeyboardCurrentPalette) if (*mKeyboardCurrentPalette)
connect(*mKeyboardCurrentPalette, SIGNAL(closed()), *mKeyboardCurrentPalette, SLOT(onDeactivated())); connect(*mKeyboardCurrentPalette, SIGNAL(closed()), *mKeyboardCurrentPalette, SLOT(onDeactivated()));
@ -411,7 +411,7 @@ void UBWebController::setupPalettes()
(*mToolsCurrentPalette)->hide(); (*mToolsCurrentPalette)->hide();
(*mToolsCurrentPalette)->adjustSizeAndPosition(); (*mToolsCurrentPalette)->adjustSizeAndPosition();
(*mKeyboardCurrentPalette)->adjustSizeAndPosition(); // (*mKeyboardCurrentPalette)->adjustSizeAndPosition();
if (controlView()){ if (controlView()){
int left = controlView()->width() - 20 - (*mToolsCurrentPalette)->width(); int left = controlView()->width() - 20 - (*mToolsCurrentPalette)->width();
@ -435,15 +435,14 @@ void UBWebController::toggleWebTrap(bool checked)
} }
} }
void UBWebController::showKeyboard(bool checked) // void UBWebController::showKeyboard(bool checked)
{ // {
if (mKeyboardCurrentPalette // if (mKeyboardCurrentPalette
&& (*mKeyboardCurrentPalette)) // && (*mKeyboardCurrentPalette))
{ // {
(*mKeyboardCurrentPalette)->setVisible(checked); // (*mKeyboardCurrentPalette)->setVisible(checked);
} // }
} // }
void UBWebController::toggleWebToolsPalette(bool checked) void UBWebController::toggleWebToolsPalette(bool checked)
{ {

@ -28,7 +28,7 @@ class UBMainWindow;
class UBWebToolsPalette; class UBWebToolsPalette;
class WBWebView; class WBWebView;
class UBServerXMLHttpRequest; class UBServerXMLHttpRequest;
class UBKeyboardPalette; //class UBKeyboardPalette;
class UBWebController : public QObject class UBWebController : public QObject
@ -58,6 +58,12 @@ class UBWebController : public QObject
void show(WebInstance type = UBWebController::WebBrowser); void show(WebInstance type = UBWebController::WebBrowser);
WBBrowserWindow* GetCurrentWebBrowser()
{
if( mCurrentWebBrowser != NULL ) return *mCurrentWebBrowser;
else return NULL;
};
protected: protected:
void setupPalettes(); void setupPalettes();
@ -101,8 +107,8 @@ class UBWebController : public QObject
UBTrapFlashController* mTrapFlashController; UBTrapFlashController* mTrapFlashController;
UBWebToolsPalette** mToolsCurrentPalette; UBWebToolsPalette** mToolsCurrentPalette;
UBWebToolsPalette* mToolsPaletteList[TotalNumberOfWebInstances]; UBWebToolsPalette* mToolsPaletteList[TotalNumberOfWebInstances];
UBKeyboardPalette** mKeyboardCurrentPalette; // UBKeyboardPalette** mKeyboardCurrentPalette;
UBKeyboardPalette* mKeyboardPaletteList[TotalNumberOfWebInstances]; // UBKeyboardPalette* mKeyboardPaletteList[TotalNumberOfWebInstances];
bool mToolsPalettePositionned; bool mToolsPalettePositionned;
bool mToolsPalettePositionnedList[TotalNumberOfWebInstances]; bool mToolsPalettePositionnedList[TotalNumberOfWebInstances];
@ -124,7 +130,7 @@ class UBWebController : public QObject
void toggleWebTrap(bool checked); void toggleWebTrap(bool checked);
void showKeyboard(bool checked); // void showKeyboard(bool checked);
signals: signals:
/** /**

@ -168,8 +168,7 @@ void WBWebPage::handleUnsupportedContent(QNetworkReply *reply)
messageBox.setText(tr("Download PDF Document: would you prefer to download the PDF file or add it to the current Sankore document?")); messageBox.setText(tr("Download PDF Document: would you prefer to download the PDF file or add it to the current Sankore document?"));
messageBox.addButton(tr("Download"), QMessageBox::AcceptRole); messageBox.addButton(tr("Download"), QMessageBox::AcceptRole);
QAbstractButton *addButton = QAbstractButton *addButton = messageBox.addButton(tr("Add to Current Document"), QMessageBox::AcceptRole);
messageBox.addButton(tr("Add to Current Document"), QMessageBox::AcceptRole);
messageBox.exec(); messageBox.exec();
if (messageBox.clickedButton() == addButton) if (messageBox.clickedButton() == addButton)

Loading…
Cancel
Save