Commit b79f1f8d authored by Ivan Ilin's avatar Ivan Ilin

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

parents 0f6d2057 a409f852
...@@ -196,6 +196,10 @@ if [ "$ARCHITECTURE" == "x86_64" ]; then ...@@ -196,6 +196,10 @@ if [ "$ARCHITECTURE" == "x86_64" ]; then
ARCHITECTURE="amd64" ARCHITECTURE="amd64"
fi fi
if [ "$ARCHITECTURE" == "i686" ]; then
ARCHITECTURE="i386"
fi
echo "Open-Sankore ($VERSION) $ARCHITECTURE; urgency=low" > "$CHANGE_LOG_FILE" echo "Open-Sankore ($VERSION) $ARCHITECTURE; urgency=low" > "$CHANGE_LOG_FILE"
echo >> "$CHANGE_LOG_FILE" echo >> "$CHANGE_LOG_FILE"
cat $CHANGE_LOG_TEXT >> "$CHANGE_LOG_FILE" cat $CHANGE_LOG_TEXT >> "$CHANGE_LOG_FILE"
......
...@@ -2511,7 +2511,7 @@ p, li { white-space: pre-wrap; } ...@@ -2511,7 +2511,7 @@ p, li { white-space: pre-wrap; }
</message> </message>
<message> <message>
<source>Stylus Palette</source> <source>Stylus Palette</source>
<translation>Barre d&apos;outil du stylet</translation> <translation>Barre d&apos;outils du stylet</translation>
</message> </message>
<message> <message>
<source>Horizontal</source> <source>Horizontal</source>
......
...@@ -10,12 +10,35 @@ and open the template in the editor. ...@@ -10,12 +10,35 @@ and open the template in the editor.
<link rel="stylesheet" type="text/css" href="css/basic.css"/> <link rel="stylesheet" type="text/css" href="css/basic.css"/>
<script type="text/javascript" src="scripts/jquery-1.6.2.min.js"></script> <script type="text/javascript" src="scripts/jquery-1.6.2.min.js"></script>
<script src="scripts/jquery.disable.text.select.js" type="text/javascript"></script> <script src="scripts/jquery.disable.text.select.js" type="text/javascript"></script>
<script src="scripts/languages.js" type="text/javascript"></script>
<script type="text/javascript" src="scripts/blackYellow.js"></script> <script type="text/javascript" src="scripts/blackYellow.js"></script>
<script type="text/javascript"> <script type="text/javascript">
$(document).ready(function(){ $(document).ready(function(){
init(); var lang = ""; //locale language
if(window.sankore){
lang = sankore.locale().substr(0,2);
} else
lang = "en";
if(lang == "en")
init();
else{
returnStatus(lang);
}
function returnStatus(lang){
$.ajax({
type: 'POST',
url:'locales/' + lang + '/index.html',
statusCode: {
404: function() {
init();
},
200: function(){
window.location.href = 'locales/' + lang + '/index.html';
}
}
});
}
}); });
</script> </script>
......
<!--
To change this template, choose Tools | Templates
and open the template in the editor.
-->
<!DOCTYPE html>
<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" type="text/css" href="../../css/basic.css"/>
<script type="text/javascript" src="../../scripts/jquery-1.6.2.min.js"></script>
<script src="../../scripts/jquery.disable.text.select.js" type="text/javascript"></script>
<script type="text/javascript" src="scripts/blackYellow.js"></script>
<script type="text/javascript">
$(document).ready(function(){
init();
});
</script>
</head>
<body>
</body>
</html>
<!--
To change this template, choose Tools | Templates
and open the template in the editor.
-->
<!DOCTYPE html>
<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" type="text/css" href="../../css/basic.css"/>
<script type="text/javascript" src="../../scripts/jquery-1.6.2.min.js"></script>
<script src="../../scripts/jquery.disable.text.select.js" type="text/javascript"></script>
<script type="text/javascript" src="scripts/blackYellow.js"></script>
<script type="text/javascript">
$(document).ready(function(){
init();
});
</script>
</head>
<body>
</body>
</html>
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
var sankoreLang = {display: "Display", edit: "Edit", add: "Add", enter_data: "Enter data:", enter_result: "Enter result:", ok: "Ok", cancel: "Cancel"};
function init(){ function init(){
...@@ -37,17 +38,7 @@ function init(){ ...@@ -37,17 +38,7 @@ function init(){
x:false, x:false,
width:0, width:0,
height:0 height:0
} }
if(window.sankore){
try{
lang = sankore.locale().substr(0,2);
sankoreLang[lang].edit;
} catch(e){
lang = "en";
}
} else
lang = "en";
var opacityChanged = false; var opacityChanged = false;
...@@ -148,9 +139,9 @@ function init(){ ...@@ -148,9 +139,9 @@ function init(){
},"fast",function(){ },"fast",function(){
toggleFlag = true; toggleFlag = true;
if(!mode) if(!mode)
toggleButton.text(sankoreLang[lang].edit); toggleButton.text(sankoreLang.edit);
else else
toggleButton.text(sankoreLang[lang].display); toggleButton.text(sankoreLang.display);
}); });
} }
} }
...@@ -196,7 +187,7 @@ function init(){ ...@@ -196,7 +187,7 @@ function init(){
width:"115px" width:"115px"
},"fast",function(){ },"fast",function(){
addToggleStart = true; addToggleStart = true;
addButton.text(sankoreLang[lang].add); addButton.text(sankoreLang.add);
}); });
} }
} }
...@@ -228,16 +219,16 @@ function init(){ ...@@ -228,16 +219,16 @@ function init(){
//input fields and buttons for a popup window //input fields and buttons for a popup window
var expressionDiv = $("<div id='expressionDiv' class='popupContainers'>").appendTo(popupBack); var expressionDiv = $("<div id='expressionDiv' class='popupContainers'>").appendTo(popupBack);
var experssionLabel = $("<span id='experssionLabel' class='popupLabels'><b>" + sankoreLang[lang].enter_data + "</b></span>").appendTo(expressionDiv); var experssionLabel = $("<span id='experssionLabel' class='popupLabels'><b>" + sankoreLang.enter_data + "</b></span>").appendTo(expressionDiv);
var expresionText = $("<input type='text' id='expresionText' class='expresionInput'/>").appendTo(expressionDiv); var expresionText = $("<input type='text' id='expresionText' class='expresionInput'/>").appendTo(expressionDiv);
var resultDiv = $("<div id='resultDiv' class='popupContainers'>").appendTo(popupBack); var resultDiv = $("<div id='resultDiv' class='popupContainers'>").appendTo(popupBack);
var resultLabel = $("<span id='resultLabel' class='popupLabels'><b>" + sankoreLang[lang].enter_result + "</b></span>").appendTo(resultDiv); var resultLabel = $("<span id='resultLabel' class='popupLabels'><b>" + sankoreLang.enter_result + "</b></span>").appendTo(resultDiv);
var resultText = $("<input type='text' id='resultText' class='expresionInput'/>").appendTo(resultDiv); var resultText = $("<input type='text' id='resultText' class='expresionInput'/>").appendTo(resultDiv);
var popupButtonsDiv= $("<div id='popupButtonsDiv' class='popupContainers'>").appendTo(popupBack); var popupButtonsDiv= $("<div id='popupButtonsDiv' class='popupContainers'>").appendTo(popupBack);
var cancelButton = $("<input type='button' id='cancelButton' class='popupButtons' value='" + sankoreLang[lang].cancel + "'/>").appendTo(popupButtonsDiv); var cancelButton = $("<input type='button' id='cancelButton' class='popupButtons' value='" + sankoreLang.cancel + "'/>").appendTo(popupButtonsDiv);
var okButton = $("<input type='button' id='okButton' class='popupButtons' value='" + sankoreLang[lang].ok + "'/>").appendTo(popupButtonsDiv); var okButton = $("<input type='button' id='okButton' class='popupButtons' value='" + sankoreLang.ok + "'/>").appendTo(popupButtonsDiv);
/* -------------- A WORK WITH POPUP BUTTONS AND FIELDS ---------------*/ /* -------------- A WORK WITH POPUP BUTTONS AND FIELDS ---------------*/
...@@ -345,20 +336,20 @@ function init(){ ...@@ -345,20 +336,20 @@ function init(){
}); });
// export data // export data
function exportToSankore(){ function exportToSankore(){
var objToExport = {
data1:"",
data2:"",
width:0,
height:0,
top:0,
left:0
}
var arrayToExport = new Array(); var arrayToExport = new Array();
if(mode){ if(mode){
if($(".editContainer").size() != 0){ if($(".editContainer").size() != 0){
$(".editContainer").each(function(index, domElem){ $(".editContainer").each(function(index, domElem){
var objToExport = {
data1:"",
data2:"",
width:0,
height:0,
top:0,
left:0
}
objToExport.data1 = $(domElem).find(".readyTask").find(":first-child").text(); objToExport.data1 = $(domElem).find(".readyTask").find(":first-child").text();
objToExport.data2 = $(domElem).find(".readyTask").find(":last-child").text(); objToExport.data2 = $(domElem).find(".readyTask").find(":last-child").text();
objToExport.width = $(domElem).width(); objToExport.width = $(domElem).width();
...@@ -371,6 +362,14 @@ function init(){ ...@@ -371,6 +362,14 @@ function init(){
} else { } else {
if($(".readyTask").size() != 0){ if($(".readyTask").size() != 0){
$(".readyTask").each(function(index, domElem){ $(".readyTask").each(function(index, domElem){
var objToExport = {
data1:"",
data2:"",
width:0,
height:0,
top:0,
left:0
}
objToExport.data1 = $(domElem).find(":first-child").text(); objToExport.data1 = $(domElem).find(":first-child").text();
objToExport.data2 = $(domElem).find(":last-child").text(); objToExport.data2 = $(domElem).find(":last-child").text();
objToExport.width = $(domElem).width(); objToExport.width = $(domElem).width();
......
var sankoreLang = {
"en":{
"edit": "Edit",
"display":"Display",
"add":"Add",
"enter_data":"Enter data:",
"enter_result":"Enter result:",
"ok":"Ok",
"cancel":"Cancel"
},
"ru":{
"edit": "Изменить",
"display":"Показать",
"add":"Добавить",
"enter_data":"Введите вопрос:",
"enter_result":"Введите ответ:",
"ok":"Ок",
"cancel":"Отмена"
},
"fr":{
"edit": "Modifier",
"display":"Afficher",
"add":"Ajouter",
"enter_data":"Entrer les données:",
"enter_result":"Entrez le résultat:",
"ok":"Ok",
"cancel":"Annuler"
}
};
...@@ -31,22 +31,8 @@ ...@@ -31,22 +31,8 @@
#include "core/memcheck.h" #include "core/memcheck.h"
UBThumbnailAdaptor::UBThumbnailAdaptor(QObject *parent)
: QObject(parent)
{
// NOOP
}
UBThumbnailAdaptor::~UBThumbnailAdaptor()
{
// NOOP
}
QList<QPixmap> UBThumbnailAdaptor::load(UBDocumentProxy* proxy) QList<QPixmap> UBThumbnailAdaptor::load(UBDocumentProxy* proxy)
{ {
QList<QPixmap> thumbnails; QList<QPixmap> thumbnails;
if (!proxy || proxy->persistencePath().size() == 0) if (!proxy || proxy->persistencePath().size() == 0)
...@@ -76,7 +62,7 @@ QList<QPixmap> UBThumbnailAdaptor::load(UBDocumentProxy* proxy) ...@@ -76,7 +62,7 @@ QList<QPixmap> UBThumbnailAdaptor::load(UBDocumentProxy* proxy)
thumbCount++; thumbCount++;
if (displayMessage && thumbCount == 1) if (displayMessage && thumbCount == 1)
UBApplication::showMessage(tr("Generating preview thumbnails ...")); UBApplication::showMessage(tr("Generating preview thumbnails ..."));
persistScene(proxy->persistencePath(), scene, i); persistScene(proxy->persistencePath(), scene, i);
} }
...@@ -114,8 +100,65 @@ QList<QPixmap> UBThumbnailAdaptor::load(UBDocumentProxy* proxy) ...@@ -114,8 +100,65 @@ QList<QPixmap> UBThumbnailAdaptor::load(UBDocumentProxy* proxy)
return thumbnails; return thumbnails;
} }
QPixmap UBThumbnailAdaptor::load(UBDocumentProxy* proxy, int index)
{
int existingPageCount = proxy->pageCount();
if (!proxy || proxy->persistencePath().size() == 0 || index < 0 || index >= existingPageCount)
return QPixmap();
//compatibility with older formats (<= 4.0.b.2.0) : generate missing thumbnails
QString thumbFileName = proxy->persistencePath() +
UBFileSystemUtils::digitFileFormat("/page%1.thumbnail.jpg", existingPageCount);
QFile thumbFile(thumbFileName);
if (!thumbFile.exists())
{
bool displayMessage = (existingPageCount > 5);
int thumbCount = 0;
for(int i = 0 ; i < existingPageCount; i++)
{
UBGraphicsScene* scene = UBSvgSubsetAdaptor::loadScene(proxy, i);
if (scene)
{
thumbCount++;
if (displayMessage && thumbCount == 1)
UBApplication::showMessage(tr("Generating preview thumbnails ..."));
persistScene(proxy->persistencePath(), scene, i);
}
}
if (displayMessage && thumbCount > 0)
UBApplication::showMessage(tr("%1 thumbnails generated ...").arg(thumbCount));
}
//end compatibility with older format
QString fileName = proxy->persistencePath() +
UBFileSystemUtils::digitFileFormat("/page%1.thumbnail.jpg", index + 1);
QFile file(fileName);
if (file.exists())
{
QPixmap pix;
//Warning. Works only with modified Qt
#ifdef Q_WS_X11
pix.load(fileName, 0, Qt::AutoColor);
#else
pix.load(fileName, 0, Qt::AutoColor, false);
#endif
return pix;
}
return QPixmap();
}
void UBThumbnailAdaptor::persistScene(const QString& pDocPath, UBGraphicsScene* pScene, const int pageIndex, const bool overrideModified) void UBThumbnailAdaptor::persistScene(const QString& pDocPath, UBGraphicsScene* pScene, int pageIndex, bool overrideModified)
{ {
QString fileName = pDocPath + UBFileSystemUtils::digitFileFormat("/page%1.thumbnail.jpg", pageIndex + 1); QString fileName = pDocPath + UBFileSystemUtils::digitFileFormat("/page%1.thumbnail.jpg", pageIndex + 1);
...@@ -161,7 +204,7 @@ void UBThumbnailAdaptor::persistScene(const QString& pDocPath, UBGraphicsScene* ...@@ -161,7 +204,7 @@ void UBThumbnailAdaptor::persistScene(const QString& pDocPath, UBGraphicsScene*
} }
QUrl UBThumbnailAdaptor::thumbnailUrl(UBDocumentProxy* proxy, const int pageIndex) QUrl UBThumbnailAdaptor::thumbnailUrl(UBDocumentProxy* proxy, int pageIndex)
{ {
QString fileName = proxy->persistencePath() + QString fileName = proxy->persistencePath() +
UBFileSystemUtils::digitFileFormat("/page%1.thumbnail.jpg", pageIndex + 1); UBFileSystemUtils::digitFileFormat("/page%1.thumbnail.jpg", pageIndex + 1);
......
...@@ -21,21 +21,18 @@ class UBDocument; ...@@ -21,21 +21,18 @@ class UBDocument;
class UBDocumentProxy; class UBDocumentProxy;
class UBGraphicsScene; class UBGraphicsScene;
class UBThumbnailAdaptor : public QObject class UBThumbnailAdaptor //static class
{ {
Q_OBJECT; Q_DECLARE_TR_FUNCTIONS(UBThumbnailAdaptor)
private: UBThumbnailAdaptor() {}
public: public:
static void persistScene(const QString& pDocPath, UBGraphicsScene* pScene, int pageIndex, bool overrideModified = false);
UBThumbnailAdaptor(QObject *parent = 0);
~UBThumbnailAdaptor();
static void persistScene(const QString& pDocPath, UBGraphicsScene* pScene, const int pageIndex, const bool overrideModified = false);
static QList<QPixmap> load(UBDocumentProxy* proxy); static QList<QPixmap> load(UBDocumentProxy* proxy);
static QPixmap load(UBDocumentProxy* proxy, int index);
static QUrl thumbnailUrl(UBDocumentProxy* proxy, const int pageIndex); static QUrl thumbnailUrl(UBDocumentProxy* proxy, int pageIndex);
}; };
#endif // UBTHUMBNAILADAPTOR_H #endif // UBTHUMBNAILADAPTOR_H
...@@ -1166,11 +1166,10 @@ void UBBoardController::setActiveDocumentScene(UBDocumentProxy* pDocumentProxy, ...@@ -1166,11 +1166,10 @@ void UBBoardController::setActiveDocumentScene(UBDocumentProxy* pDocumentProxy,
{ {
emit activeDocumentChanged(); emit activeDocumentChanged();
UBGraphicsTextItem::lastUsedTextColor = QColor(); UBGraphicsTextItem::lastUsedTextColor = QColor();
// Notify the navigator palette that the document has changed
emit setDocOnPageNavigator(pDocumentProxy);
} }
// Notify the navigator palette that the document has changed
emit setDocOnPageNavigator(pDocumentProxy);
if (sceneChange) if (sceneChange)
{ {
emit activeSceneChanged(); emit activeSceneChanged();
......
...@@ -99,7 +99,7 @@ void UBDocumentNavigator::setDocument(UBDocumentProxy *document) ...@@ -99,7 +99,7 @@ void UBDocumentNavigator::setDocument(UBDocumentProxy *document)
*/ */
void UBDocumentNavigator::generateThumbnails() void UBDocumentNavigator::generateThumbnails()
{ {
// Get the thumbnails // Get the thumbnails
QList<QPixmap> thumbs = UBThumbnailAdaptor::load(mCrntDoc); QList<QPixmap> thumbs = UBThumbnailAdaptor::load(mCrntDoc);
mThumbsWithLabels.clear(); mThumbsWithLabels.clear();
...@@ -155,9 +155,8 @@ void UBDocumentNavigator::updateSpecificThumbnail(int iPage) ...@@ -155,9 +155,8 @@ void UBDocumentNavigator::updateSpecificThumbnail(int iPage)
UBThumbnailAdaptor::persistScene(mCrntDoc->persistencePath(), pScene, iPage); UBThumbnailAdaptor::persistScene(mCrntDoc->persistencePath(), pScene, iPage);
// Load it // Load it
QList<QPixmap> thumbs = UBThumbnailAdaptor::load(mCrntDoc); QPixmap pix = UBThumbnailAdaptor::load(mCrntDoc, iPage);
QPixmap pix = thumbs.at(iPage); UBSceneThumbnailNavigPixmap* pixmapItem = new UBSceneThumbnailNavigPixmap(pix, mCrntDoc, iPage);
QGraphicsPixmapItem* pixmapItem = new UBSceneThumbnailNavigPixmap(pix, mCrntDoc, iPage);
if(pixmapItem) if(pixmapItem)
{ {
// Get the old thumbnail // Get the old thumbnail
...@@ -307,27 +306,29 @@ void UBDocumentNavigator::mousePressEvent(QMouseEvent *event) ...@@ -307,27 +306,29 @@ void UBDocumentNavigator::mousePressEvent(QMouseEvent *event)
} }
} }
} }
else else
{ {
if(NULL != mCrntItem && mCrntItem != pCrntItem) if(NULL != mCrntItem && mCrntItem != pCrntItem)
{ {
// Unselect the previous item // Unselect the previous item
int iOldPage = -1; mCrntItem->setSelected(false);
int iOldPage = -1;
for(int i = 0; i < mThumbsWithLabels.size(); i++) for(int i = 0; i < mThumbsWithLabels.size(); i++)
if (mThumbsWithLabels.at(i).getThumbnail() == mCrntItem) if (mThumbsWithLabels.at(i).getThumbnail() == mCrntItem)
{ {
iOldPage = i; iOldPage = i;
break; break;
} }
updateSpecificThumbnail(iOldPage); updateSpecificThumbnail(iOldPage);
mCrntItem = pCrntItem; mCrntItem = pCrntItem;
} }
// Then display the related page // Then display the related page
emit changeCurrentPage(); emit changeCurrentPage();
refreshScene(); refreshScene();
} }
bNavig = false;
bNavig = false;
} }
QGraphicsView::mousePressEvent(event); QGraphicsView::mousePressEvent(event);
} }
......
...@@ -58,7 +58,7 @@ private slots: ...@@ -58,7 +58,7 @@ private slots:
private: private:
void refreshScene(); void refreshScene();
void updateSpecificThumbnail(int iPage); void updateSpecificThumbnail(int iPage);
int border(); int border();
......
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