Commit 7e228ad8 authored by ivan.ilyin's avatar ivan.ilyin

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

parents d86e3c01 a527e338
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -6,13 +6,8 @@
<title>ubwidget</title>
<script src="js/jquery-1.3.2.min.js" type="text/javascript"></script>
<script src="js/jquery-ui-1.7.2.custom.min.js" type="text/javascript"></script>
<script src="js/jquery.disable.text.select.js" type="text/javascript"></script>
<script src="js/jquery.ubwidget.js" type="text/javascript"></script>
<script src="js/jquery.center.js" type="text/javascript"></script>
<script src="js/DD_roundies_0.0.2a.js" type="text/javascript"></script>
<script src="js/ubw-main.js" type="text/javascript"></script>
<script src="js/calculate.js" type="text/javascript"></script>
<link rel="stylesheet" type="text/css" href="css/ubwidget.css" />
......@@ -27,7 +22,6 @@
</script>
<audio id='audio'></audio>
<div id="ubwidget"></div>
</body>
</html>
\ No newline at end of file
/*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
function init(){
var embed;
......@@ -50,15 +64,18 @@ function init(){
submit.click(function(){
$("#ubwidget").append(loadWindow)
embed = inputBox.val();
////////////!!!1/////////
searchWrap.hide();
loadWindow.append(embed);
//alert($("#ubwidget").html());
$("#ubwidget embed").attr("wmode", "transparent");
var ubwidget_html = $("#ubwidget").html();
alert(ubwidget_html);
setTimeOut(alert);
$("#ubwidget").empty().html(ubwidget_html);
if(/<object/.test(embed)){
loadWindow.append(embed);
loadWindow.find("embed").attr("wmode","transparent");
var loadWindow_content = loadWindow.html();
loadWindow.empty().html(loadWindow_content);
}
else {
loadWindow.append(embed);
}
if(window.sankore){
window.sankore.resize($(document).width(),$(document).height());
window.sankore.setPreference("embed", escape(embed));
......
/*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
function addChar(input, character) {
if(input.value == null || input.value == "0")
input.value = character
......
/*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
function init(){
var h = 292;
var w = 160;
......
......@@ -15,6 +15,21 @@
<script type="text/javascript">
/*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
google.load("maps", "2");
google.load("elements", "1", {
packages : ["localsearch"]
......@@ -30,12 +45,12 @@
var zoom = 2;
var latlng = new google.maps.LatLng(lat, lng);
if (window.uniboard)
if (window.sankore)
{
lat = parseFloat(window.uniboard.preference('latitude', lat));
lng = parseFloat(window.uniboard.preference('longitude', lng));
zoom = parseFloat(window.uniboard.preference('zoom', zoom));
mapType = window.uniboard.preference('mapType', mapType);
lat = parseFloat(window.sankore.preference('latitude', lat));
lng = parseFloat(window.sankore.preference('longitude', lng));
zoom = parseFloat(window.sankore.preference('zoom', zoom));
mapType = window.sankore.preference('mapType', mapType);
latlng = new google.maps.LatLng(lat, lng);
};
......@@ -54,17 +69,17 @@
new GControlPosition(G_ANCHOR_BOTTOM_RIGHT, new GSize(5,30)));
// Add persistence
if (window.uniboard)
if (window.sankore)
{
GEvent.addListener(map,'zoomend',function()
{
window.uniboard.setPreference('zoom', map.getZoom());
window.sankore.setPreference('zoom', map.getZoom());
});
GEvent.addListener(map,'moveend',function()
{
window.uniboard.setPreference('latitude', map.getCenter().lat());
window.uniboard.setPreference('longitude', map.getCenter().lng());
window.sankore.setPreference('latitude', map.getCenter().lat());
window.sankore.setPreference('longitude', map.getCenter().lng());
});
GEvent.addListener(map,'maptypechanged',function()
......@@ -77,7 +92,7 @@
break;
}
}
window.uniboard.setPreference('mapType', newMapType);
window.sankore.setPreference('mapType', newMapType);
});
};
}
......
......@@ -26,11 +26,23 @@
.height(($(window).height())-(40));
$('iframe').width($(window).width()-24)
.height($(window).height()-46);
if(window.uniboard){
var html = window.uniboard.preference("html", "Welcome to HTML EDITOR");
if(window.sankore){
var html = window.sankore.preference("iHtml", "Welcome to HTML EDITOR");
$("#markItUp").val(html);
};
$("#markItUp").keyup(function(){
if(window.sankore){
window.sankore.setPreference("iHtml", $("#markItUp").val());
}
});
$("li").mouseout(function(){
if(window.sankore){
window.sankore.setPreference("iHtml", $("#markItUp").val());
}
});
$("#reset-btn").click(function(){
$(this).data("hidden", true).hide();
$('textarea').show();
......
/*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
function init(){
var ubwidget = $("#ubwidget").ubwidget({
......@@ -126,7 +141,7 @@ function init(){
.attr('contentEditable','true')
.keyup(function(){
if(window.sankore){
window.sankore.setPreference("text", textField.html());
window.sankore.setPreference("noteText", textField.html());
}
controlTextField();
//$('#headtitle').hide();
......@@ -164,7 +179,7 @@ function init(){
$('#headtitle').hide();
if(window.sankore){
text = window.sankore.preference('text', text);
text = window.sankore.preference('noteText', text);
currentFontSize = window.sankore.preference('fontSize', defaultFontSize);
$('.ubw-container').css({
width:window.innerWidth - 2,
......
function init(){
var ubwidget = $("#ubwidget").ubwidget({
width:300,
height:240
});
var text = "";
var winwidth;
var minimizedHeight;
var winheight;
var scroll = false;
var defaultFontSize = 35;
var currentFontSize = defaultFontSize;
var header = $('<div id="head"><input id="headtitle" class="stickytitle" readonly="readonly"></input></div>');
var fontUp = $('<img src="images/stick-but-aplus.png">');
var fontDown = $('<img src="images/stick-but-aminus.png">');
var minimize = $('<img src="images/stick-but-minimize.png">');
var maximize = $('<img src="images/stick-but-maximize.png">');
var title = $('<div id="menu"></div>');
var textField = $('<div id="txt"></div>');
var shadow = $("<table width='100%' height='18' border='0' cellspacing='0' cellpadding='0'><tr><td id='sl' width='139'></td><td id='sc' style='background-image:url(images/shadowcenter.png)'>&nbsp;</td><td id='sr' width='139'></td></tr></table>")
.appendTo("body");
var shadowleft = $("<img src='images/shadowleft.png'>")
.appendTo($("#sl"));
var shadowright = $("<img src='images/shadowright.png'>")
.appendTo($("#sr"));
$("#ubwidget")
.append(header)
.append(textField);
fontUp.addClass('menuElement');
fontDown.addClass('menuElement');
minimize.addClass('menuElement');
maximize.addClass('menuElement')
.hide();
header.append(maximize)
.append(minimize)
.append(fontUp)
.append(fontDown);
var titletext = header.find('textarea');
titletext.click(
function(){
titletext.focus();
});
fontDown.click(
function(){
var newFontSize = parseInt(currentFontSize) - 3;
textField.css({
fontSize : newFontSize
})
controlTextField();
if(window.sankore){
window.sankore.setPreference("fontSize", newFontSize);
};
//textField.focus();
});
fontUp.click(
function(){
var newFontSize = parseInt(currentFontSize) + 3;
textField.css({
fontSize : newFontSize
})
controlTextField();
if(window.sankore){
window.sankore.setPreference("fontSize", newFontSize);
};
//textField.focus();
});
minimize.click(
function(){
$('.ubw-container').animate({height:"26px"},100);
minimizedHeight = $('.ubw-container').height() ;
minimize.hide();
maximize.show();
$('#headtitle').show();
window.resizeTo($('.ubw-container').width(),0);
if(window.sankore){
window.sankore.setPreference("minimized", "true");
};
});
maximize.click(
function(){
var lastHeight = String(minimizedHeight)+'px';
$('.ubw-container').animate({height: lastHeight},100);
maximize.hide();
minimize.show();
$('#headtitle').hide();
window.resizeTo($('.ubw-container').width()+15,minimizedHeight+20);
if(window.sankore){
window.sankore.setPreference("minimized", "false");
};
});
header
.append(title);
title
.addClass('menu');
header
.addClass('head');
textField
.addClass("textField")
.css("fontSize",currentFontSize)
.attr('contentEditable','true')
.keyup(function(){
if(window.sankore){
window.sankore.setPreference("text", textField.html());
}
controlTextField();
$('#headtitle').hide();
});
if(textField.html().length === 0){
textField.focus();
}
titletext
.attr('rows','1');
function controlTextField(){
if(textField.text().length < 25){
var titleStr = textField.text() + '...';
$('#headtitle').val(titleStr);
}
textField.css({
height : $('.ubw-container').height()-28,
})
if(textField.text().length == 0){
textField.css({
fontSize: defaultFontSize,
});
}
currentFontSize = textField.css('fontSize').replace('px','');
}
textField.bind('paste', function(e) {
controlTextField();
});
$('#headtitle').hide();
if(window.sankore){
text = window.sankore.preference('text', text);
currentFontSize = window.sankore.preference('fontSize', defaultFontSize);
$('.ubw-container').css({
width:parseInt(window.sankore.preference('width', "300")),
height:parseInt(window.sankore.preference('height', "240"))
});
if(window.sankore.preference('minimized', "false") == "true"){
minimize.trigger("click");
};
textField.css({
fontSize : parseInt(currentFontSize)
})
textField.html(text);
}
window.onresize = function(){
winwidth = window.innerWidth;
winheight = window.innerHeight;
if(winwidth <= 290)
{
window.resizeTo(290,winheight);
}
if(winheight <= 100)
{
window.resizeTo(winwidth,100);
}
if(winheight > 600)
{
window.resizeTo(winwidth,600);
}
$('.ubw-container').width(winwidth-2) ;
$('.ubw-container').height(winheight-20) ;
if(window.sankore){
window.sankore.setPreference("width", winwidth-2);
window.sankore.setPreference("height", winheight-20);
}
controlTextField();
}
}
\ No newline at end of file
......@@ -12,7 +12,6 @@
<script src="js/jquery.center.js" type="text/javascript"></script>
<script src="js/DD_roundies_0.0.2a.js" type="text/javascript"></script>
<script src="js/ubw-main.js" type="text/javascript"></script>
<script src="js/calculate.js" type="text/javascript"></script>
<link rel="stylesheet" type="text/css" href="css/ubwidget.css" />
......
/*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
function init(){
var tempHours;
var tempMinutes;
var tempSeconds;
if(window.sankore){
tempHours = window.sankore.preference("hours","00");
tempMinutes = window.sankore.preference("minutes","00");
tempSeconds = window.sankore.preference("seconds","00");
} else {
tempHours = "00";
tempMinutes = "00";
tempSeconds = "00";
}
var ubwidget = $("#ubwidget").ubwidget({
width:252,
height:89
......@@ -32,8 +60,8 @@ function init(){
borderRight:"none"
});
spacec.find(".ubw-button-canvas").unbind("mouseenter");
var hours = $("<div class='scroll' id='hours'>00</div>").ubwbutton({
var hours = $("<div class='scroll' id='hours'>" + tempHours + "</div>").ubwbutton({
w:52,
h:68
}, {
......@@ -45,7 +73,7 @@ function init(){
hours.find(".ubw-button-body").css({
borderRight:"none"
});
var minutes = $("<div class='scroll' id='minutes'>00</div>").ubwbutton({
var minutes = $("<div class='scroll' id='minutes'>" + tempMinutes + "</div>").ubwbutton({
w:52,
h:68
}, {
......@@ -58,7 +86,7 @@ function init(){
borderLeft:"none",
borderRight:"none"
});
var seconds = $("<div class='scroll' id='seconds'>00</div>").ubwbutton({
var seconds = $("<div class='scroll' id='seconds'>" + tempSeconds + "</div>").ubwbutton({
w:52,
h:68
}, {
......@@ -67,6 +95,7 @@ function init(){
right:0,
left:0
});
seconds.find(".ubw-button-body").css({
borderLeft:"none",
borderRight:"none"
......@@ -239,12 +268,26 @@ function init(){
}
function timeButtonDownHandler(m){
var button = m.data.button;
var mouseStart = {
var button = m.data.button;
var content = button.find(".ubw-button-content");
if(window.sankore){
var temp = button.attr("id");
switch(temp){
case "seconds":
window.sankore.setPreference("seconds", content.text());
break;
case "minutes":
window.sankore.setPreference("minutes", content.text());
break;
case "hours":
window.sankore.setPreference("hours", content.text());
break;
}
}
/*var mouseStart = {
pageX:m.pageX,
pageY:m.pageY
};
var content = button.find(".ubw-button-content");
};*/
var val = content.text();
isScrolling = true;
reverse = true;
......@@ -332,6 +375,12 @@ function init(){
minutesValue.text(formatTime(currentMinute));
secondsValue.text(formatTime(currentSecond));
if(window.sankore){
window.sankore.setPreference("hours", hoursValue.text());
window.sankore.setPreference("minutes", minutesValue.text());
window.sankore.setPreference("seconds", secondsValue.text());
}
}
function formatTime(time){
......
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Video Picker</title>
<link rel="stylesheet" type="text/css" href="css/main.css">
<script src="scripts/jquery-1.3.2.min.js" type="text/javascript"></script>
<script src="scripts/jquery.oembed.js" type="text/javascript"></script>
<!--DEFAULT FR-->
</head>
<body>
<script type="text/javascript">
var oembedUrl = "";
var language = "en";
function initialize() {
if(window.sankore){
oembedUrl = window.sankore.preference("oembedUrl", "");
}
if(oembedUrl.length > 0){
$("#textbox").val(oembedUrl);
$("#search-button").trigger("click");
}else{
//var language = navigator.userAgent.split(";");
//language = language[3].replace(/\s/g, "").substr(0, 2);
$("#embeded-content").load("locales/" + language + "/howto.html"); // Welcome note with some explanations
};
};
$(document).ready(function(){
var resizer; // Timer
var resizerIndex;
resizerIndex = 0;
//language = navigator.userAgent.split(";");
//language = language[3].replace(/\s/g, "").substr(0, 2);
$("#search-button")
.click(function(){
window.resizeTo(385, 80);
$("#container")
.removeClass("welcome")
.removeClass("change")
.removeClass("error")
.addClass("load");
$("#container-shadow")
.hide();
$("#arrow")
.hide();
$("#embeded-content")
.css({
marginLeft:-9000,
marginTop:-9000
})
.empty()
.oembed($("#textbox").val());
checkcontent();
})
.mouseenter(function(){
$(this)
.addClass("over");
})
.mouseleave(function(){
$(this)
.removeClass("over");
});
/*$("#ubwidget").mouseenter(function(){
$("#show-area").fadeIn(1000);
});
$("#ubwidget").mouseout(function(){
$("#show-area").fadeOut(600);
});*/
$('#textbox').keypress(function(e){
if (e.which == 13){
$('#search-button').click();
};
});
$("#show-inputfield-button")
.click(
function(){
$("#show-area").fadeOut(0);
$("#inputfield").show();
$("#shadow").show();
$("#container")
.removeClass("show").addClass("change");
adaptWidgetSize(18, 88);
})
.mouseenter(function(){
$(this)
.addClass("over");
})
.mouseleave(function(){
$(this)
.removeClass("over");
});
function checkcontent(){
if($("#embeded-content").html().length != 0 && $("#embeded-content").children(":first").width() > 0){
clearTimeout(resizer);
resizerIndex = 0;
if(window.sankore){
window.sankore.setPreference("oembedUrl", $("#textbox").val());
};
$("#inputfield")
.hide();
$("#shadow")
.hide();
$("#embeded-content")
.css({
marginLeft:0,
marginTop:0
})
.width($("#embeded-content").children(":first").width())
.height($("#embeded-content").children(":first").height());
$("#container")
.removeClass("load").addClass("show");
$("#show-area")
.fadeIn(2000)
.css({
left:$("#embeded-content").children(":first").width()-25,
top:($("#embeded-content").children(":first").height()-35)/2
});
adaptWidgetSize(5, 13);
return false;
};
if(resizerIndex > 30){
resizerIndex = 0;
$("#container")
.removeClass("show").addClass("error");
$("#arrow")
.show();
$("#embeded-content")
.css({
marginTop:0,
marginLeft:0
})
.width(395)
.load("locales/" + language + "/error.html",
function(){
adaptWidgetSize(20, 125);
});
$("#container-shadow")
.show();
}else{
resizer = setTimeout(function(){checkcontent()}, 100);
resizerIndex++;
};
};
function adaptWidgetSize(adjustmentX, adjustmentY){
var margins = {
top: cssToInt($("body").css("margin-top")),
right: cssToInt($("body").css("margin-right")),
bottom: cssToInt($("body").css("margin-bottom")),
left: cssToInt($("body").css("margin-left"))
};
var widgetWidth = $("#embeded-content").width() + margins.right + margins.left + adjustmentX;
var widgetHeight = $("#embeded-content").position().top + $("#embeded-content").height() + margins.bottom + adjustmentY;
window.resizeTo(widgetWidth, $(window).height());
window.resizeTo($(window).width(), widgetHeight);
window.sankore.resize(widgetWidth, widgetHeight);
};
function cssToInt(cssvalue){
return(parseInt(cssvalue.replace("px", "")));
};
if (window.widget) {
window.widget.onremove = function(){
//$("#show-inputfield-button").trigger("click");
$("#embeded-content")
.empty()
.oembed($("#textbox").val());
}
}
window.initialize();
});
</script>
<div id="ubwidget">
<div id="shadow"></div>
<div id="inputfield">
<input id="textbox" type="text">
<div id="search-button" class="button">Show</div>
</div>
<div id="container" class="welcome">
<div id="arrow"><img src="imgs/arrow.png" alt="arrow-top"></div>
<div id="show-container">
<div id="embeded-content"></div>
<div id="show-area">
<img id="show-inputfield-button" src="imgs/bts.png">
</div>
</div>
<table cellspacing="0" cellpadding="0" id="container-shadow">
<tr>
<td id="shadow-left"></td>
<td id="shadow-center">&nbsp;</td>
<td id="shadow-right"></td>
</tr>
</table>
</div>
</div>
</body>
</html>
\ No newline at end of file
......@@ -33,11 +33,11 @@
//resizerIndex = 0;
/*if(window.sankore){
if(window.sankore){
url = window.sankore.preference("url", "");
}else{
url = "";
}; */
};
language = navigator.userAgent.split(";");
language = language[3].replace(/\s/g, "").substr(0, 2);
......@@ -157,9 +157,9 @@
//clearTimeout(resizer);
//resizerIndex = 0;
/*if(window.sankore){
if(window.sankore){
window.sankore.setPreference("url", $("#textbox").val());
};*/
};
$("#embeded-content").hide();
$("#container").removeClass("load").addClass("show");
......
......@@ -4,13 +4,13 @@
xmlns:ub="http://uniboard.mnemis.com/widgets"
id="http://www.example.net/widgets/helloworld"
version="1.0"
width="200"
height="700"
width="660"
height="410"
ub:resizable="true">
<name>Rich Note</name>
<description>Allows the teacher to attach a rich note to the page.</description>
<name>Rich Text Editor</name>
<description>Allows the teacher to attach a text editor to the page.</description>
<preference name="skin"
value="uniboard"/>
value="sankore"/>
<content src="index.html"/>
</widget>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!--
Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
-->
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Template</title>
<!--Styles-->
<link rel="stylesheet" type="text/css" href="styles/master.css">
<link rel="stylesheet" type="text/css" href="styles/wcontainer.css">
<link rel="stylesheet" type="text/css" href="styles/app.css">
<!--Scripts-->
<script type="text/javascript" src="scripts/jquery144.js"></script>
<script type="text/javascript" src="scripts/ext.js"></script>
<script type="text/javascript" src="scripts/wcontainer.js"></script>
<!-- <script type="text/javascript" src="scripts/tpl.js"></script> -->
<script type="text/javascript" src="scripts/app.js"></script>
<!-- Load TinyMCE -->
<script type="text/javascript" src="tinymcejq/jquery.tinymce.js"></script>
<!-- /TinyMCE -->
<title>Very nice text editor!!11</title>
<meta content="text/html; charset=utf-8" http-equiv="content-type" />
<script type="text/javascript" src="scripts/ckeditor.js"></script>
<link href="styles/sample.css" rel="stylesheet" type="text/css" />
<script>
window.onload = function() {
CKEDITOR.replace( 'fineEditor',
{
language : 'en',
toolbar :
[
{ name: 'document', items : [ 'Source','-','Save','NewPage','Preview' ] },
{ name: 'clipboard', items : [ 'Cut','Copy','Paste','PasteText','PasteFromWord','-','Undo','Redo' ] },
{ name: 'editing', items : [ 'Find','Replace','-','SelectAll' ] },
,'/',
{ name: 'basicstyles', items : [ 'Bold','Italic','Underline','Strike','Subscript','Superscript','-','RemoveFormat' ] },
{ name: 'paragraph', items : [ 'NumberedList','BulletedList','-','Outdent','Indent','-','Blockquote','-','JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock','-','BidiLtr','BidiRtl' ] },
{ name: 'links', items : [ 'Link','Unlink','Anchor' ] },
{ name: 'insert', items : [ 'Image','HorizontalRule','SpecialChar','PageBreak','Iframe' ] },
'/',
{ name: 'styles', items : [ 'Styles','Format','Font','FontSize' ] },
{ name: 'colors', items : [ 'TextColor','BGColor' ] },
{ name: 'tools', items : [ 'ShowBlocks', 'About' ] }
]
});
/*window.onresize(function(){
globalWidth = $(window).width();
globalHeight = $(window).height();
$("#web-content")
.attr("width", globalWidth - 25)
.attr("height", globalHeight - 90);
});*/
}
</script>
</head>
<body>
<div id="ub-widget"></div>
<textarea cols="80" id="fineEditor" name="fineEditor" rows="10">&lt;p&gt;This is some &lt;strong&gt;sample text&lt;/strong&gt;.</textarea>
</body>
</html>
\ No newline at end of file
</html>
......@@ -44,6 +44,7 @@
#include "UBSvgSubsetRasterizer.h"
#include "core/memcheck.h"
#include "../../core/UBApplication.h"
UBDocumentPublisher::UBDocumentPublisher(UBDocumentProxy* pDocument, QObject *parent)
......@@ -54,90 +55,52 @@ UBDocumentPublisher::UBDocumentPublisher(UBDocumentProxy* pDocument, QObject *pa
, mPassword("")
, bLoginCookieSet(false)
{
mpWebView = new QWebView(0);
UBApplication::mainWindow->addSankoreWebDocumentWidget(mpWebView);
mpWebView->setWindowTitle(tr("Sankore Uploading Page"));
mpWebView->setAcceptDrops(false);
connect(mpWebView, SIGNAL(loadFinished(bool)), this, SLOT(onLoadFinished(bool)));
connect(mpWebView, SIGNAL(linkClicked(QUrl)), this, SLOT(onLinkClicked(QUrl)));
connect(this, SIGNAL(loginDone()), this, SLOT(onLoginDone()));
init();
}
UBDocumentPublisher::~UBDocumentPublisher()
{
//delete mpWebView;
//delete mPublishingDocument;
if(mSourceDocument){
delete mSourceDocument;
mSourceDocument = NULL;
}
if(mPublishingDocument){
delete mPublishingDocument;
mPublishingDocument = NULL;
}
}
void UBDocumentPublisher::publish()
{
//check that the username and password are stored on preferences
UBSettings* settings = UBSettings::settings();
if(settings->communityUsername().isEmpty() || settings->communityPassword().isEmpty()){
UBApplication::showMessage(tr("Credentials has to not been filled out yet."));
qDebug() << "trying to connect to community without the required credentials";
return;
}
mUsername = settings->communityUsername();
mPassword = settings->communityPassword();
UBPublicationDlg dlg;
if(QDialog::Accepted == dlg.exec())
{
mDocInfos.title = dlg.title();
mDocInfos.description = dlg.description();
//check that the username and password are stored on preferences
UBSettings* settings = UBSettings::settings();
mUsername = settings->communityUsername();
mPassword = settings->communityPassword();
buildUbwFile();
UBApplication::showMessage(tr("Uploading Sankore File on Web."));
login(mUsername, mPassword);
//sendUbw();
sendUbw(mUsername, mPassword);
}
}
void UBDocumentPublisher::onLoginDone()
{
sendUbw();
}
void UBDocumentPublisher::login(QString username, QString password)
{
QString data,crlf;
QByteArray datatoSend;
// Create the request body
data="srid=&j_username=" +username +"&j_password=" +password +crlf+crlf;
datatoSend=data.toAscii(); // convert data string to byte array for request
// Create the request header
QString qsLoginURL = QString("http://sankore.devxwiki.com/xwiki/bin/loginsubmit/XWiki/XWikiLogin?xredirect=%0").arg(DOCPUBLICATION_URL);
QNetworkRequest request(QUrl(qsLoginURL.toAscii().constData()));
request.setRawHeader("Origin", "http://sankore.devxwiki.com");
request.setHeader(QNetworkRequest::ContentTypeHeader, "application/x-www-form-urlencoded");
request.setRawHeader("Accept", "application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5");
request.setRawHeader("Referer", DOCPUBLICATION_URL);
request.setHeader(QNetworkRequest::ContentLengthHeader,datatoSend.size());
request.setRawHeader("Accept-Language", "en-US,*");
// Generate a session id
//mSessionID = getSessionID();
// Create the cookie
//QList<QNetworkCookie> cookiesList;
//QString qsCookieValue;
//qsCookieValue = mSessionID;
//qsCookieValue += "; language=en";
//QNetworkCookie cookie("JSESSIONID", qsCookieValue.toAscii().constData());
//cookiesList << cookie;
//request.setHeader(QNetworkRequest::CookieHeader, QVariant::fromValue(cookiesList));
// Send the request
mpNetworkMgr->post(request,datatoSend);
}
void UBDocumentPublisher::buildUbwFile()
{
QDir d;
......@@ -164,7 +127,6 @@ void UBDocumentPublisher::buildUbwFile()
ubzExporter.setVerbode(false);
ubzExporter.persistsDocument(mSourceDocument, mPublishingDocument->persistencePath() + "/" + UBStringUtils::toCanonicalUuid(publishingUuid) + ".ubz");
// remove all useless files
for (int pageIndex = 0; pageIndex < mPublishingDocument->pageCount(); pageIndex++) {
......@@ -586,9 +548,6 @@ void UBDocumentPublisher::generateWidgetPropertyScript(UBGraphicsW3CWidgetItem *
}
}
void UBDocumentPublisher::init()
{
mCrlf=0x0d;
......@@ -599,21 +558,11 @@ void UBDocumentPublisher::init()
mpNetworkMgr = new QNetworkAccessManager(this);
mpCookieJar = new QNetworkCookieJar();
// QNetworkProxy* pProxy = UBSettings::settings()->httpProxy();
// if(NULL != pProxy)
// {
// mpNetworkMgr->setProxy(*pProxy);
// qDebug() << "Proxy set!";
// }
connect(mpNetworkMgr, SIGNAL(finished(QNetworkReply*)), this, SLOT(onFinished(QNetworkReply*)));
connect(mpNetworkMgr, SIGNAL(proxyAuthenticationRequired(QNetworkProxy,QAuthenticator*)), this, SLOT(onProxyAuthenticationRequired(QNetworkProxy,QAuthenticator*)));
}
void UBDocumentPublisher::onFinished(QNetworkReply *reply)
{
QByteArray response = reply->readAll();
QVariant cookieHeader = reply->rawHeader("Set-Cookie");
// First we concatenate all the Set-Cookie values (the packet can contains many of them)
QStringList qslCookie = cookieHeader.toString().split("\n");
......@@ -625,49 +574,6 @@ void UBDocumentPublisher::onFinished(QNetworkReply *reply)
// Now we isolate every cookie value
QStringList qslCookieVals = qsCookieValue.split("; ");
if (!bLoginCookieSet)
{
// Finally we create the cookies
for (int i = 0; i < qslCookieVals.size(); i++)
{
QString cookieString = qslCookieVals.at(i);
QStringList qslCrntCookie = cookieString.split("=");
QNetworkCookie crntCookie;
if (qslCrntCookie.length() == 2)
{
QString qsValue = qslCrntCookie.at(1);
qsValue.remove("\"");
crntCookie = QNetworkCookie(qslCrntCookie.at(0).toAscii().constData(), qsValue.toAscii().constData());
}
else
{
crntCookie = QNetworkCookie(qslCrntCookie.at(0).toAscii().constData());
}
// HACK : keep only the same cookies as the XWiki website does.
if(crntCookie.name() == "JSESSIONID" ||
crntCookie.name() == "username" ||
crntCookie.name() == "password" ||
crntCookie.name() == "rememberme" ||
crntCookie.name() == "validation")
{
mCookies << crntCookie;
}
}
QNetworkCookie langCookie("language", "en");
mCookies << langCookie;
// Set the cookiejar : it set the cookies that will be sent with every packet.
mpCookieJar->setCookiesFromUrl(mCookies, QUrl(DOCPUBLICATION_URL)/*reply->url()*/);
mpNetworkMgr->setCookieJar(mpCookieJar);
bLoginCookieSet = true;
emit loginDone();
}
else
{
if (response.isEmpty())
{
// Verify that the UBW file has been sent correctly
bool bTransferOk = false;
for(int j = 0; j <= qslCookieVals.size(); j++)
{
......@@ -689,12 +595,10 @@ void UBDocumentPublisher::onFinished(QNetworkReply *reply)
{
UBApplication::showMessage(tr("Failed to upload document on the web."));
}
}
}
reply->deleteLater();
}
void UBDocumentPublisher::sendUbw()
void UBDocumentPublisher::sendUbw(QString username, QString password)
{
if (QFile::exists(mTmpZipFile))
{
......@@ -710,6 +614,10 @@ void UBDocumentPublisher::sendUbw()
multipartHeader = "multipart/form-data; boundary="+boundary;
data="--"+boundary+mCrlf;
data+="Content-Disposition: form-data; name=\"title\"" + mCrlf + mCrlf + mDocInfos.title + mCrlf;
data+="--"+boundary+mCrlf;
data+="Content-Disposition: form-data; name=\"description\"" + mCrlf + mCrlf + mDocInfos.description.remove("\n") + mCrlf;
data+="--"+boundary+mCrlf;
data+="Content-Disposition: form-data; name=\"file\"; filename=\""+ fi.fileName() +"\""+mCrlf;
data+="Content-Type: application/octet-stream"+mCrlf+mCrlf;
datatoSend=data.toAscii(); // convert data string to byte array for request
......@@ -717,18 +625,15 @@ void UBDocumentPublisher::sendUbw()
datatoSend += mCrlf;
datatoSend += QString("--%0--%1").arg(boundary).arg(mCrlf);
QNetworkRequest request(QUrl(DOCPUBLICATION_URL));
QNetworkRequest request(QUrl(QString(DOCPUBLICATION_URL).toAscii().constData()));
request.setHeader(QNetworkRequest::ContentTypeHeader, multipartHeader);
request.setHeader(QNetworkRequest::ContentLengthHeader,datatoSend.size());
request.setRawHeader("Accept", "application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5");
QString b64Auth = getBase64Of(QString("%0:%1").arg(username).arg(password));
request.setRawHeader("Authorization", QString("Basic %0").arg(b64Auth).toAscii().constData());
request.setRawHeader("Host", "sankore.devxwiki.com");
request.setRawHeader("Accept", "*/*");
request.setRawHeader("Accept-Language", "en-US,*");
request.setRawHeader("Referer", DOCPUBLICATION_URL);
QNetworkCookie titleCookie("title", mDocInfos.title.toAscii().constData());
QNetworkCookie descCookie("description", mDocInfos.description.remove("\n").toAscii().constData());
mCookies << titleCookie;
mCookies << descCookie;
mpCookieJar->setCookiesFromUrl(mCookies, QUrl(DOCPUBLICATION_URL));
mpNetworkMgr->setCookieJar(mpCookieJar);
......@@ -744,37 +649,6 @@ QString UBDocumentPublisher::getBase64Of(QString stringToEncode)
return stringToEncode.toAscii().toBase64();
}
void UBDocumentPublisher::onLinkClicked(const QUrl &url)
{
// [Basic Auth] Here we interpret the link and send the request with the basic auth header.
QNetworkRequest request;
request.setUrl(url);
QString b64Auth = getBase64Of(QString("%0:%1").arg(mUsername).arg(mPassword));
request.setRawHeader("Authorization", QString("Basic %0").arg(b64Auth).toAscii().constData());
mpNetworkMgr->get(request);
}
void UBDocumentPublisher::onLoadFinished(bool result)
{
Q_UNUSED(result);
// [Basic Auth] This line says: if the user click on a link, do not interpret it.
//mpWebView->page()->setLinkDelegationPolicy(QWebPage::DelegateAllLinks);
mpWebView->page()->setNetworkAccessManager(mpNetworkMgr);
}
void UBDocumentPublisher::onProxyAuthenticationRequired(const QNetworkProxy &proxy, QAuthenticator *authenticator)
{
Q_UNUSED(proxy);
UBProxyLoginDlg dlg;
if(QDialog::Accepted == dlg.exec())
{
authenticator->setUser(dlg.username());
authenticator->setPassword(dlg.password());
}
}
// ---------------------------------------------------------
UBProxyLoginDlg::UBProxyLoginDlg(QWidget *parent, const char *name):QDialog(parent)
, mpLayout(NULL)
......
......@@ -21,7 +21,7 @@
#include "ui_webPublishing.h"
#include "UBAbstractPublisher.h"
#define DOCPUBLICATION_URL "http://sankore.devxwiki.com/xwiki/bin/view/CreateResources/UniboardUpload"
#define DOCPUBLICATION_URL "http://sankore.devxwiki.com/xwiki/bin/view/CreateResources/UniboardUpload?xpage=plain&outputSyntax=plain"
#define XWIKI_ORIGIN_HEADER "http://sankore.devxwiki.com"
typedef struct
......@@ -104,21 +104,15 @@ protected:
private slots:
void onFinished(QNetworkReply* reply);
void onLinkClicked(const QUrl& url);
void onLoadFinished(bool result);
void onLoginDone();
void onProxyAuthenticationRequired(const QNetworkProxy & proxy, QAuthenticator * authenticator);
private:
UBDocumentProxy *mSourceDocument;
UBDocumentProxy *mPublishingDocument;
void init();
void sendUbw();
void sendUbw(QString username, QString password);
QString getBase64Of(QString stringToEncode);
QWebView* mpWebView;
QHBoxLayout* mpLayout;
QNetworkAccessManager* mpNetworkMgr;
QNetworkCookieJar* mpCookieJar;
......@@ -128,7 +122,6 @@ private:
bool bLoginCookieSet;
void buildUbwFile();
void login(QString username, QString password);
QString mTmpZipFile;
QList<QNetworkCookie> mCookies;
sDocumentInfos mDocInfos;
......
......@@ -349,11 +349,6 @@ void UBApplication::showDocument()
applicationController->showDocument();
}
void UBApplication::showSankoreWebDocument()
{
applicationController->showSankoreWebDocument();
}
int UBApplication::toolBarHeight()
{
return mainWindow->boardToolBar->rect().height();
......
......@@ -96,7 +96,6 @@ class UBApplication : public QtSingleApplication
void showBoard();
void showInternet();
void showDocument();
void showSankoreWebDocument();
void toolBarPositionChanged(QVariant topOrBottom);
void toolBarDisplayTextChanged(QVariant display);
......
/*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "UBApplicationController.h"
#include "frameworks/UBPlatformUtils.h"
......@@ -365,7 +365,7 @@ void UBApplicationController::showInternet()
{
showDesktop(true);
}
else
else
{
mMainWindow->boardToolBar->hide();
mMainWindow->documentToolBar->hide();
......@@ -417,33 +417,6 @@ void UBApplicationController::showDocument()
emit mainModeChanged(Document);
}
void UBApplicationController::showSankoreWebDocument()
{
mMainWindow->webToolBar->hide();
mMainWindow->boardToolBar->hide();
mMainWindow->tutorialToolBar->hide();
mMainWindow->documentToolBar->show();
mMainMode = WebDocument;
adaptToolBar();
mirroringEnabled(false);
mMainWindow->switchToSankoreWebDocumentWidget();
UBApplication::documentController->hide();
mMainWindow->show();
mUninoteController->hideWindow();
emit mainModeChanged(WebDocument);
}
void UBApplicationController::showDesktop(bool dontSwitchFrontProcess)
{
int desktopWidgetIndex = qApp->desktop()->screenNumber(mMainWindow);
......
......@@ -66,8 +66,6 @@ class UBApplicationController : public QObject
void showDocument();
void showSankoreWebDocument();
void showMessage(const QString& message, bool showSpinningWheel);
void importFile(const QString& pFilePath);
......
......@@ -36,6 +36,27 @@ qreal UBPreferencesController::sSliderRatio = 10.0;
qreal UBPreferencesController::sMinPenWidth = 0.5;
qreal UBPreferencesController::sMaxPenWidth = 50.0;
UBPreferencesDialog::UBPreferencesDialog(UBPreferencesController* prefController, QWidget* parent,Qt::WindowFlags f)
:QDialog(parent,f)
,mPreferencesController(prefController)
{
}
UBPreferencesDialog::~UBPreferencesDialog()
{
}
void UBPreferencesDialog::closeEvent(QCloseEvent* e)
{
if(mPreferencesController->inputValuesConsistence())
e->accept();
else
e->ignore();
}
UBPreferencesController::UBPreferencesController(QWidget *parent)
: QObject(parent)
, mPreferencesWindow(0)
......@@ -43,8 +64,9 @@ UBPreferencesController::UBPreferencesController(QWidget *parent)
, mPenProperties(0)
, mMarkerProperties(0)
{
mPreferencesWindow = new QDialog(parent, Qt::Dialog);
mPreferencesUI = new Ui::preferencesDialog(); // deleted in UBPreferencesController::destructor
mPreferencesWindow = new UBPreferencesDialog(this,parent, Qt::Dialog);
// mPreferencesWindow = new QDialog(parent, Qt::Dialog);
mPreferencesUI = new Ui::preferencesDialog(); // deleted in
mPreferencesUI->setupUi(mPreferencesWindow);
connect(mPreferencesUI->Username_textBox, SIGNAL(editingFinished()), this, SLOT(onCommunityUsernameChanged()));
connect(mPreferencesUI->Password_textEdit, SIGNAL(editingFinished()), this, SLOT(onCommunityPasswordChanged()));
......@@ -108,8 +130,8 @@ void UBPreferencesController::wire()
QList<QColor> penDarkBackgroundSelectedColors = settings->boardPenDarkBackgroundSelectedColors->colors();
mPenProperties = new UBBrushPropertiesFrame(mPreferencesUI->penFrame,
penLightBackgroundColors, penDarkBackgroundColors, penLightBackgroundSelectedColors,
penDarkBackgroundSelectedColors, this);
penLightBackgroundColors, penDarkBackgroundColors, penLightBackgroundSelectedColors,
penDarkBackgroundSelectedColors, this);
mPenProperties->opacityFrame->hide();
......@@ -125,8 +147,8 @@ void UBPreferencesController::wire()
QList<QColor> markerDarkBackgroundSelectedColors = settings->boardMarkerDarkBackgroundSelectedColors->colors();
mMarkerProperties = new UBBrushPropertiesFrame(mPreferencesUI->markerFrame, markerLightBackgroundColors,
markerDarkBackgroundColors, markerLightBackgroundSelectedColors,
markerDarkBackgroundSelectedColors, this);
markerDarkBackgroundColors, markerLightBackgroundSelectedColors,
markerDarkBackgroundSelectedColors, this);
mMarkerProperties->pressureSensitiveCheckBox->setText(tr("Marker is pressure sensitive"));
......@@ -151,7 +173,7 @@ void UBPreferencesController::init()
mPreferencesUI->keyboardPaletteAutoMinimize->setChecked(settings->boardKeyboardPaletteAutoMinimize->get().toBool());
for(int i=0; i<mPreferencesUI->keyboardPaletteKeyButtonSize->count(); i++)
if (mPreferencesUI->keyboardPaletteKeyButtonSize->itemText(i) ==
settings->boardKeyboardPaletteKeyBtnSize->get().toString())
settings->boardKeyboardPaletteKeyBtnSize->get().toString())
{
mPreferencesUI->keyboardPaletteKeyButtonSize->setCurrentIndex(i);
break;
......@@ -201,15 +223,48 @@ void UBPreferencesController::onCommunityPasswordChanged()
settings->setCommunityPassword(mPreferencesUI->Password_textEdit->text());
}
bool UBPreferencesController::inputValuesConsistence()
{
QString backgroundStyle = "QWidget {background-color: white}";
mPreferencesUI->Username_textBox->setStyleSheet(backgroundStyle);
mPreferencesUI->Password_textEdit->setStyleSheet(backgroundStyle);
QString username = mPreferencesUI->Username_textBox->text();
QString password = mPreferencesUI->Password_textEdit->text();
bool isConsistent = true;
if (username.length() + password.length()){
backgroundStyle = "QWidget {background-color: magenta}";
if(username.isEmpty()){
isConsistent = false;
mPreferencesUI->mainTabWidget->setCurrentWidget(mPreferencesUI->networkTab);
mPreferencesUI->Username_textBox->setStyleSheet(backgroundStyle);
mPreferencesUI->Username_textBox->setFocus();
mPreferencesUI->Username_textBox->setCursorPosition(0);
}
else if(password.isEmpty()){
isConsistent = false;
mPreferencesUI->mainTabWidget->setCurrentWidget(mPreferencesUI->networkTab);
mPreferencesUI->Password_textEdit->setStyleSheet(backgroundStyle);
mPreferencesUI->Password_textEdit->setFocus();
mPreferencesUI->Password_textEdit->setCursorPosition(0);
}
}
return isConsistent;
}
void UBPreferencesController::close()
{
//web
QString homePage = mPreferencesUI->webHomePage->text();
UBSettings::settings()->webHomePage->set(homePage);
UBSettings::settings()->webHomePage->set(homePage);
UBSettings::settings()->setProxyUsername(mPreferencesUI->proxyUsername->text());
UBSettings::settings()->setProxyPassword(mPreferencesUI->proxyPassword->text());
if (!inputValuesConsistence())
return;
mPreferencesWindow->accept();
}
......@@ -253,8 +308,8 @@ void UBPreferencesController::defaultSettings()
for (int i = 0 ; i < settings->colorPaletteSize ; i++)
{
mPenProperties->lightBackgroundColorPickers[i]->setSelectedColorIndex(lightBackgroundSelectedColors.indexOf(settings->penColors(false).at(i)));
mPenProperties->darkBackgroundColorPickers[i]->setSelectedColorIndex(darkBackgroundSelectedColors.indexOf(settings->penColors(true).at(i)));
mPenProperties->lightBackgroundColorPickers[i]->setSelectedColorIndex(lightBackgroundSelectedColors.indexOf(settings->penColors(false).at(i)));
mPenProperties->darkBackgroundColorPickers[i]->setSelectedColorIndex(darkBackgroundSelectedColors.indexOf(settings->penColors(true).at(i)));
}
}
else if (mPreferencesUI->mainTabWidget->currentWidget() == mPreferencesUI->markerTab)
......@@ -274,8 +329,8 @@ void UBPreferencesController::defaultSettings()
for (int i = 0 ; i < settings->colorPaletteSize ; i++)
{
mMarkerProperties->lightBackgroundColorPickers[i]->setSelectedColorIndex(lightBackgroundSelectedColors.indexOf(settings->markerColors(false).at(i)));
mMarkerProperties->darkBackgroundColorPickers[i]->setSelectedColorIndex(darkBackgroundSelectedColors.indexOf(settings->markerColors(true).at(i)));
mMarkerProperties->lightBackgroundColorPickers[i]->setSelectedColorIndex(lightBackgroundSelectedColors.indexOf(settings->markerColors(false).at(i)));
mMarkerProperties->darkBackgroundColorPickers[i]->setSelectedColorIndex(darkBackgroundSelectedColors.indexOf(settings->markerColors(true).at(i)));
}
}
else if (mPreferencesUI->mainTabWidget->currentWidget() == mPreferencesUI->aboutTab)
......@@ -412,8 +467,8 @@ void UBPreferencesController::toolbarOrientationHorizontal(bool checked)
}
UBBrushPropertiesFrame::UBBrushPropertiesFrame(QFrame* owner, const QList<QColor>& lightBackgroundColors,
const QList<QColor>& darkBackgroundColors, const QList<QColor>& lightBackgroundSelectedColors,
const QList<QColor>& darkBackgroundSelectedColors, UBPreferencesController* controller)
const QList<QColor>& darkBackgroundColors, const QList<QColor>& lightBackgroundSelectedColors,
const QList<QColor>& darkBackgroundSelectedColors, UBPreferencesController* controller)
{
setupUi(owner);
......@@ -485,4 +540,3 @@ UBBrushPropertiesFrame::UBBrushPropertiesFrame(QFrame* owner, const QList<QColor
}
}
......@@ -21,6 +21,7 @@
class UBColorPicker;
class UBApplication;
class UBSettings;
class UBPreferencesController;
namespace Ui
{
......@@ -31,6 +32,21 @@ namespace Ui
class UBBrushPropertiesFrame;
class UBPreferencesDialog : public QDialog
{
Q_OBJECT;
public:
UBPreferencesDialog(UBPreferencesController* prefController, QWidget* parent = 0,Qt::WindowFlags f = 0 );
~UBPreferencesDialog();
protected:
void closeEvent(QCloseEvent* e);
UBPreferencesController *mPreferencesController;
};
class UBPreferencesController : public QObject
{
Q_OBJECT;
......@@ -39,6 +55,8 @@ class UBPreferencesController : public QObject
UBPreferencesController(QWidget *parent);
virtual ~UBPreferencesController();
bool inputValuesConsistence();
public slots:
void show();
......@@ -48,7 +66,7 @@ class UBPreferencesController : public QObject
void wire();
void init();
QDialog* mPreferencesWindow;
UBPreferencesDialog* mPreferencesWindow;
Ui::preferencesDialog* mPreferencesUI;
UBBrushPropertiesFrame* mPenProperties;
UBBrushPropertiesFrame* mMarkerProperties;
......@@ -78,9 +96,7 @@ class UBBrushPropertiesFrame : public Ui::brushProperties
{
public:
UBBrushPropertiesFrame(QFrame* owner, const QList<QColor>& lightBackgroundColors,
const QList<QColor>& darkBackgroundColors, const QList<QColor>& lightBackgroundSelectedColors,
const QList<QColor>& darkBackgroundSelectedColors, UBPreferencesController* controller);
UBBrushPropertiesFrame(QFrame* owner, const QList<QColor>& lightBackgroundColors,const QList<QColor>& darkBackgroundColors, const QList<QColor>& lightBackgroundSelectedColors,const QList<QColor>& darkBackgroundSelectedColors, UBPreferencesController* controller);
virtual ~UBBrushPropertiesFrame(){}
......
......@@ -43,7 +43,7 @@ UBMainWindow::UBMainWindow(QWidget *parent, Qt::WindowFlags flags)
actionPreferences->setShortcut(QKeySequence(Qt::ALT + Qt::Key_Return));
actionQuit->setShortcut(QKeySequence(Qt::ALT + Qt::Key_F4));
#else
// No shortcut on Linux (like GEdit/Nautilius)
actionQuit->setShortcut(QKeySequence(Qt::ALT + Qt::Key_F4));
#endif
}
......@@ -106,19 +106,6 @@ void UBMainWindow::switchToDocumentsWidget()
}
}
void UBMainWindow::addSankoreWebDocumentWidget(QWebView* pWidget)
{
if(!mSankoreWebDocumentWidget){
mSankoreWebDocumentWidget = pWidget;
mStackedLayout->addWidget(mSankoreWebDocumentWidget);
}
}
void UBMainWindow::switchToSankoreWebDocumentWidget()
{
if(mSankoreWebDocumentWidget)
mStackedLayout->setCurrentWidget(mSankoreWebDocumentWidget);
}
void UBMainWindow::keyPressEvent(QKeyEvent *event)
{
QMainWindow::keyPressEvent(event);
......
......@@ -42,9 +42,6 @@ class UBMainWindow : public QMainWindow, public Ui::MainWindow
void addDocumentsWidget(QWidget *pWidget);
void switchToDocumentsWidget();
void addSankoreWebDocumentWidget(QWebView* pWidget);
void switchToSankoreWebDocumentWidget();
public slots:
void onExportDone();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment