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

preferencesAboutTextFull
shibakaneki 13 years ago
commit 40be502737
  1. 2
      Sankore_3.1.pro
  2. 19
      buildDebianPackage
  3. 0
      release.linux.sh
  4. 8
      resources/library/sankoreInteractivities/ordonner_des_images.wgt/index.html
  5. 20
      resources/library/sankoreInteractivities/ordonner_des_images.wgt/js/languages.js
  6. 19
      resources/library/sankoreInteractivities/ordonner_des_images.wgt/js/script.js
  7. 8
      resources/library/sankoreInteractivities/ordonner_des_images.wgt/js/translation/en.js
  8. 8
      resources/library/sankoreInteractivities/ordonner_des_images.wgt/js/translation/fr.js
  9. 8
      resources/library/sankoreInteractivities/ordonner_des_images.wgt/js/translation/ru.js
  10. 5
      resources/library/sankoreInteractivities/ordonner_des_images.wgt/nbproject/private/private.properties
  11. 4
      resources/library/sankoreInteractivities/ordonner_des_images.wgt/nbproject/private/private.xml
  12. 7
      resources/library/sankoreInteractivities/ordonner_des_images.wgt/nbproject/project.properties
  13. 9
      resources/library/sankoreInteractivities/ordonner_des_images.wgt/nbproject/project.xml
  14. 91
      src/adaptors/UBExportFullPDF.cpp
  15. 7
      src/adaptors/UBExportFullPDF.h
  16. 1
      src/adaptors/UBExportPDF.cpp
  17. 1
      src/board/UBBoardPaletteManager.cpp
  18. 1
      src/core/UBApplicationController.cpp

@ -13,7 +13,7 @@ linux-g++-64 {
VERSION_MAJ = 1 VERSION_MAJ = 1
VERSION_MIN = 40 VERSION_MIN = 40
VERSION_TYPE = b # a = alpha, b = beta, r = release, other => error VERSION_TYPE = b # a = alpha, b = beta, r = release, other => error
VERSION_PATCH = 02 VERSION_PATCH = 03
VERSION = "$${VERSION_MAJ}.$${VERSION_MIN}.$${VERSION_TYPE}.$${VERSION_PATCH}" VERSION = "$${VERSION_MAJ}.$${VERSION_MIN}.$${VERSION_TYPE}.$${VERSION_PATCH}"
VERSION = $$replace(VERSION, "\\.r", "") VERSION = $$replace(VERSION, "\\.r", "")

@ -49,8 +49,8 @@ else
LAST_COMMITED_VERSION="`git describe $(git rev-list --tags --max-count=1)`" LAST_COMMITED_VERSION="`git describe $(git rev-list --tags --max-count=1)`"
if [ "v$VERSION" != "$LAST_COMMITED_VERSION" ]; then if [ "v$VERSION" != "$LAST_COMMITED_VERSION" ]; then
echo creating a tag with the version $VERSION echo creating a tag with the version $VERSION
# git tag -a "v$VERSION" -m "Generating setup for v$VERSION" git tag -a "v$VERSION" -m "Generating setup for v$VERSION"
# git push origin --tags git push origin --tags
fi fi
fi fi
@ -192,6 +192,9 @@ CONTROL_FILE="$BASE_WORKING_DIR/DEBIAN/control"
CHANGE_LOG_TEXT="changelog.txt" CHANGE_LOG_TEXT="changelog.txt"
ARCHITECTURE=`uname -i` ARCHITECTURE=`uname -i`
if [ "$ARCHITECTURE" == "x86_64" ]; then
ARCHITECTURE="amd64"
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"
@ -206,8 +209,8 @@ echo "Priority: optional" >> "$CONTROL_FILE"
echo "Architecture: $ARCHITECTURE" >> "$CONTROL_FILE" echo "Architecture: $ARCHITECTURE" >> "$CONTROL_FILE"
echo "Essential: no" >> "$CONTROL_FILE" echo "Essential: no" >> "$CONTROL_FILE"
echo "Installed-Size: `du -s $SANKORE_PACKAGE_DIRECTORY | awk '{ print $1 }'`" >> "$CONTROL_FILE" echo "Installed-Size: `du -s $SANKORE_PACKAGE_DIRECTORY | awk '{ print $1 }'`" >> "$CONTROL_FILE"
echo "Maintainer: Claudio VALERIO <claudio@open-sankore.org>" >> "$CONTROL_FILE" echo "Maintainer: Open-Sankoré Developers team <dev@open-sankore.org>" >> "$CONTROL_FILE"
echo "Homepage: http://www.open-sankore.org" >> "$CONTROL_FILE" echo "Homepage: http://dev.open-sankore.org" >> "$CONTROL_FILE"
echo -n "Depends: " >> "$CONTROL_FILE" echo -n "Depends: " >> "$CONTROL_FILE"
unset tab unset tab
declare -a tab declare -a tab
@ -223,6 +226,10 @@ for l in `objdump -p $SANKORE_PACKAGE_DIRECTORY/Open-Sankore | grep NEEDED | awk
done; done;
done; done;
#additional dependencies
tab[$count]="gtk2-engines-pixbuf"
((count++))
for ((i=0;i<${#tab[@]};i++)); do for ((i=0;i<${#tab[@]};i++)); do
if [ $i -ne "0" ]; then if [ $i -ne "0" ]; then
echo -n ", " >> "$CONTROL_FILE" echo -n ", " >> "$CONTROL_FILE"
@ -254,10 +261,10 @@ chmod 755 "$BASE_WORKING_DIR/DEBIAN/postint"
mkdir -p "install/linux" mkdir -p "install/linux"
sudo chown -R root:root $BASE_WORKING_DIR fakeroot chown -R root:root $BASE_WORKING_DIR
dpkg -b "$BASE_WORKING_DIR" install/linux/Open-Sankore_${VERSION}_$ARCHITECTURE.deb dpkg -b "$BASE_WORKING_DIR" install/linux/Open-Sankore_${VERSION}_$ARCHITECTURE.deb
notify-send "Open-Sankore" "Package built" notify-send "Open-Sankore" "Package built"
#clean up mess #clean up mess
#sudo rm -rf $BASE_WORKING_DIR #fakeroot rm -rf $BASE_WORKING_DIR

@ -10,6 +10,14 @@
<script type="text/javascript" src="js/script.js"></script> <script type="text/javascript" src="js/script.js"></script>
<script type="text/javascript"> <script type="text/javascript">
$(document).ready(function(){ $(document).ready(function(){
var lang = ""; //locale language
if(window.sankore){
lang = sankore.locale().substr(0,2);
} else
lang = "en";
$("<script type='text/javascript' src='js/translation/" + lang + ".js'>").appendTo("head");
if((typeof sankoreLang) == "undefined")
$("<script type='text/javascript' src='js/translation/en.js'>").appendTo("head");
start(); start();
//here you can put your code //here you can put your code
if(window.sankore) if(window.sankore)

@ -1,20 +0,0 @@
var sankoreLang = {
"en":{
"short_desc": "Place the pictures in ascending order.",
"display":"Display",
"edit":"Edit",
"add":"Add new block"
},
"ru":{
"short_desc": "Расположите картинки в порядке возрастания цифр.",
"display":"Показать",
"edit":"Изменить",
"add":"Добавить новый блок"
},
"fr":{
"short_desc": "Placez les photos dans l'ordre croissant.",
"display":"D'affichage",
"edit":"Modifier",
"add":"Ajouter nouveau bloc"
}
};

@ -1,19 +1,8 @@
var lang = ""; //locale language
//main function //main function
function start(){ function start(){
if(window.sankore){ $("#display_text").text(sankoreLang.display);
try{ $("#edit_text").text(sankoreLang.edit);
lang = sankore.locale().substr(0,2);
sankoreLang[lang].edit;
} catch(e){
lang = "en";
}
} else
lang = "en";
$("#display_text").text(sankoreLang[lang].display);
$("#edit_text").text(sankoreLang[lang].edit);
if(window.sankore){ if(window.sankore){
if(sankore.preference("odr_des_imgs","")){ if(sankore.preference("odr_des_imgs","")){
@ -114,7 +103,7 @@ function start(){
// }, 1); // }, 1);
$("<div class='add_block'>" + sankoreLang[lang].add + "</div>").appendTo("body"); $("<div class='add_block'>" + sankoreLang.add + "</div>").appendTo("body");
} }
} }
}); });
@ -251,7 +240,7 @@ function showExample(){
var imgs_container = $("<div class='imgs_cont'>").appendTo(container); var imgs_container = $("<div class='imgs_cont'>").appendTo(container);
var number = $("<div class='number_cont'>1</div>").appendTo(sub_container); var number = $("<div class='number_cont'>1</div>").appendTo(sub_container);
var text = $("<div class='text_cont'>" + sankoreLang[lang].short_desc + "</div>").appendTo(sub_container); var text = $("<div class='text_cont'>" + sankoreLang.short_desc + "</div>").appendTo(sub_container);
$("<input type='hidden' value='1*2*3*4*5*'/>").appendTo(imgs_container); $("<input type='hidden' value='1*2*3*4*5*'/>").appendTo(imgs_container);

@ -0,0 +1,8 @@
var sankoreLang = {
short_desc: "Place the pictures in ascending order.",
display:"Display",
edit:"Edit",
add:"Add new block"
};

@ -0,0 +1,8 @@
var sankoreLang = {
short_desc: "Placez les photos dans l'ordre croissant.",
display:"D'affichage",
edit:"Modifier",
add:"Ajouter nouveau bloc"
};

@ -0,0 +1,8 @@
var sankoreLang = {
short_desc: "Расположите картинки в порядке возрастания цифр.",
display:"Показать",
edit:"Изменить",
add:"Добавить новый блок"
};

@ -1,5 +0,0 @@
copy.src.files=false
copy.src.target=
index.file=index.html
run.as=LOCAL
url=http://localhost/Ordonner_des_images/

@ -1,4 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project-private xmlns="http://www.netbeans.org/ns/project-private/1">
<editor-bookmarks xmlns="http://www.netbeans.org/ns/editor-bookmarks/1"/>
</project-private>

@ -1,7 +0,0 @@
include.path=${php.global.include.path}
php.version=PHP_5
source.encoding=UTF-8
src.dir=.
tags.asp=false
tags.short=true
web.root=.

@ -1,9 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://www.netbeans.org/ns/project/1">
<type>org.netbeans.modules.php.project</type>
<configuration>
<data xmlns="http://www.netbeans.org/ns/php-project/1">
<name>Ordonner_des_images.wgt</name>
</data>
</configuration>
</project>

@ -46,7 +46,10 @@ using namespace merge_lib;
UBExportFullPDF::UBExportFullPDF(QObject *parent) UBExportFullPDF::UBExportFullPDF(QObject *parent)
: UBExportAdaptor(parent) : UBExportAdaptor(parent)
{ {
// NOOP //need to calculate screen resolution
QDesktopWidget* desktop = UBApplication::desktop();
int dpiCommon = (desktop->physicalDpiX() + desktop->physicalDpiY()) / 2;
mScaleFactor = 72.0f / dpiCommon;
} }
@ -56,7 +59,7 @@ UBExportFullPDF::~UBExportFullPDF()
} }
void UBExportFullPDF::saveOverlayPdf(UBDocumentProxy* pDocumentProxy, QString filename) void UBExportFullPDF::saveOverlayPdf(UBDocumentProxy* pDocumentProxy, const QString& filename)
{ {
if (!pDocumentProxy || filename.length() == 0 || pDocumentProxy->pageCount() == 0) if (!pDocumentProxy || filename.length() == 0 || pDocumentProxy->pageCount() == 0)
return; return;
@ -70,9 +73,6 @@ void UBExportFullPDF::saveOverlayPdf(UBDocumentProxy* pDocumentProxy, QString fi
pdfPrinter.setOutputFileName(filename); pdfPrinter.setOutputFileName(filename);
pdfPrinter.setFullPage(true); pdfPrinter.setFullPage(true);
const qreal margin = UBSettings::settings()->pdfMargin->get().toDouble() * pdfPrinter.resolution() / 25.4;
mMargin = margin;
QPainter* pdfPainter = 0; QPainter* pdfPainter = 0;
for(int pageIndex = 0 ; pageIndex < pDocumentProxy->pageCount(); pageIndex++) for(int pageIndex = 0 ; pageIndex < pDocumentProxy->pageCount(); pageIndex++)
@ -87,54 +87,20 @@ void UBExportFullPDF::saveOverlayPdf(UBDocumentProxy* pDocumentProxy, QString fi
scene->setRenderingQuality(UBItem::RenderingQualityHigh); scene->setRenderingQuality(UBItem::RenderingQualityHigh);
scene->setRenderingContext(UBGraphicsScene::PdfExport); scene->setRenderingContext(UBGraphicsScene::PdfExport);
UBGraphicsPDFItem *pdfItem = qgraphicsitem_cast<UBGraphicsPDFItem*>(scene->backgroundObject()); QSize pageSize = scene->nominalSize();
if (pdfItem)
{
QSizeF sceneItemsBound = scene->itemsBoundingRect().size();
qreal ratio = (qreal)pdfPrinter.resolution() / 72.0;
QSizeF scaled = sceneItemsBound * ratio;
pdfPrinter.setPaperSize(scaled, QPrinter::DevicePixel);
if (pageIndex != 0) UBGraphicsPDFItem *pdfItem = qgraphicsitem_cast<UBGraphicsPDFItem*>(scene->backgroundObject());
pdfPrinter.newPage();
if (!pdfPainter)
pdfPainter = new QPainter(&pdfPrinter);
//render to PDF
scene->render(pdfPainter, QRectF(0, 0, sceneItemsBound.width() * ratio
, sceneItemsBound.height() * ratio), scene->itemsBoundingRect());
mHasPDFBackgrounds = true;
}
else
{
if (UBSettings::settings()->pdfPageFormat->get().toString() == "Letter")
pdfPrinter.setPageSize(QPrinter::Letter);
else
pdfPrinter.setPageSize(QPrinter::A4);
QSize docSize = pDocumentProxy->defaultDocumentSize(); if (pdfItem) mHasPDFBackgrounds = true;
if(docSize.width() > docSize.height())
{
pdfPrinter.setOrientation(QPrinter::Landscape);
}
if (pageIndex != 0) pdfPrinter.setPaperSize(QSizeF(pageSize.width()*mScaleFactor, pageSize.height()*mScaleFactor), QPrinter::Point);
pdfPrinter.newPage();
mDefaultPageRect = pdfPrinter.paperRect(); if (!pdfPainter) pdfPainter = new QPainter(&pdfPrinter);
QRectF paperRect = mDefaultPageRect.adjusted(margin, margin, -margin, -margin);
QRectF normalized = scene->normalizedSceneRect(paperRect.width() / paperRect.height());
if (!pdfPainter) if (pageIndex != 0) pdfPrinter.newPage();
pdfPainter = new QPainter(&pdfPrinter);
//render to PDF //render to PDF
scene->render(pdfPainter, paperRect, normalized); scene->render(pdfPainter);
}
//restore screen rendering quality //restore screen rendering quality
scene->setRenderingContext(UBGraphicsScene::Screen); scene->setRenderingContext(UBGraphicsScene::Screen);
@ -144,8 +110,7 @@ void UBExportFullPDF::saveOverlayPdf(UBDocumentProxy* pDocumentProxy, QString fi
scene->setBackground(isDark, isCrossed); scene->setBackground(isDark, isCrossed);
} }
if (pdfPainter) if (pdfPainter) delete pdfPainter;
delete pdfPainter;
} }
@ -171,12 +136,10 @@ void UBExportFullPDF::persist(UBDocumentProxy* pDocumentProxy)
} }
void UBExportFullPDF::persistsDocument(UBDocumentProxy* pDocumentProxy, QString filename) void UBExportFullPDF::persistsDocument(UBDocumentProxy* pDocumentProxy, const QString& filename)
{ {
QFile file(filename); QFile file(filename);
if (file.exists()) if (file.exists()) file.remove();
file.remove();
QString overlayName = filename; QString overlayName = filename;
overlayName.replace(".pdf", "_overlay.pdf"); overlayName.replace(".pdf", "_overlay.pdf");
@ -209,6 +172,8 @@ void UBExportFullPDF::persistsDocument(UBDocumentProxy* pDocumentProxy, QString
UBGraphicsScene* scene = UBPersistenceManager::persistenceManager()->loadDocumentScene(pDocumentProxy, pageIndex); UBGraphicsScene* scene = UBPersistenceManager::persistenceManager()->loadDocumentScene(pDocumentProxy, pageIndex);
UBGraphicsPDFItem *pdfItem = qgraphicsitem_cast<UBGraphicsPDFItem*>(scene->backgroundObject()); UBGraphicsPDFItem *pdfItem = qgraphicsitem_cast<UBGraphicsPDFItem*>(scene->backgroundObject());
QSize pageSize = scene->nominalSize();
if (pdfItem) if (pdfItem)
{ {
QString pdfName = UBPersistenceManager::objectDirectory + "/" + pdfItem->fileUuid().toString() + ".pdf"; QString pdfName = UBPersistenceManager::objectDirectory + "/" + pdfItem->fileUuid().toString() + ".pdf";
@ -216,24 +181,18 @@ void UBExportFullPDF::persistsDocument(UBDocumentProxy* pDocumentProxy, QString
QPointF boudingRectBottomLeft = scene->itemsBoundingRect().bottomLeft(); QPointF boudingRectBottomLeft = scene->itemsBoundingRect().bottomLeft();
QPointF pdfItemBottomLeft = pdfItem->sceneBoundingRect().bottomLeft(); QPointF pdfItemBottomLeft = pdfItem->sceneBoundingRect().bottomLeft();
QPointF offset = pdfItemBottomLeft - boudingRectBottomLeft;
qDebug() << "scene->itemsBoundingRect()" << scene->itemsBoundingRect(); qDebug() << "scene->itemsBoundingRect()" << scene->itemsBoundingRect();
qDebug() << "pdfItem->boundingRect()" << pdfItem->boundingRect(); qDebug() << "pdfItem->boundingRect()" << pdfItem->boundingRect();
qDebug() << "pdfItem->sceneBoundingRect()" << pdfItem->sceneBoundingRect(); qDebug() << "pdfItem->sceneBoundingRect()" << pdfItem->sceneBoundingRect();
qDebug() << offset;
TransformationDescription baseTrans(offset.x(), offset.y() * -1, 1, 0);
//TransformationDescription baseTrans(0, 0, 1, 0);
TransformationDescription overlayTrans(0, 0, 1, 0);
MergePageDescription pageDescription(scene->itemsBoundingRect().width(), MergePageDescription pageDescription(pageSize.width() * mScaleFactor,
scene->itemsBoundingRect().height(), pageSize.height() * mScaleFactor,
pdfItem->pageNumber(), pdfItem->pageNumber(),
QFile::encodeName(backgroundPath).constData(), QFile::encodeName(backgroundPath).constData(),
baseTrans, TransformationDescription(),
pageIndex + 1, pageIndex + 1,
overlayTrans, TransformationDescription(),
false, false); false, false);
mergeInfo.push_back(pageDescription); mergeInfo.push_back(pageDescription);
@ -242,12 +201,8 @@ void UBExportFullPDF::persistsDocument(UBDocumentProxy* pDocumentProxy, QString
} }
else else
{ {
QRectF paperRect = mDefaultPageRect.adjusted(mMargin, mMargin, -mMargin, -mMargin); MergePageDescription pageDescription(pageSize.width() * mScaleFactor,
QRectF normalized = scene->normalizedSceneRect(paperRect.width() / paperRect.height()); pageSize.height() * mScaleFactor,
MergePageDescription pageDescription(normalized.width(),
normalized.height(),
0, 0,
"", "",
TransformationDescription(), TransformationDescription(),

@ -33,14 +33,13 @@ class UBExportFullPDF : public UBExportAdaptor
virtual QString exportExtention(); virtual QString exportExtention();
virtual void persist(UBDocumentProxy* pDocument); virtual void persist(UBDocumentProxy* pDocument);
virtual void persistsDocument(UBDocumentProxy* pDocument, QString filename); virtual void persistsDocument(UBDocumentProxy* pDocument, const QString& filename);
protected: protected:
void saveOverlayPdf(UBDocumentProxy* pDocumentProxy, QString filename); void saveOverlayPdf(UBDocumentProxy* pDocumentProxy, const QString& filename);
private: private:
QRect mDefaultPageRect; float mScaleFactor;
int mMargin;
bool mHasPDFBackgrounds; bool mHasPDFBackgrounds;
}; };

@ -101,7 +101,6 @@ void UBExportPDF::persistsDocument(UBDocumentProxy* pDocumentProxy, const QStrin
//setting page size to appropriate value //setting page size to appropriate value
pdfPrinter.setPaperSize(QSizeF(pageSize.width()*scaleFactor, pageSize.height()*scaleFactor), QPrinter::Point); pdfPrinter.setPaperSize(QSizeF(pageSize.width()*scaleFactor, pageSize.height()*scaleFactor), QPrinter::Point);
pdfPrinter.setOrientation((pageSize.width() > pageSize.height())? QPrinter::Landscape : QPrinter::Portrait);
if(painterNeedsBegin) painterNeedsBegin = !pdfPainter.begin(&pdfPrinter); if(painterNeedsBegin) painterNeedsBegin = !pdfPainter.begin(&pdfPrinter);
//render to PDF //render to PDF
scene->render(&pdfPainter); scene->render(&pdfPainter);

@ -823,7 +823,6 @@ void UBBoardPaletteManager::addItem(const QPixmap& pPixmap, const QPointF& pos,
void UBBoardPaletteManager::addItemToCurrentPage() void UBBoardPaletteManager::addItemToCurrentPage()
{ {
UBApplication::applicationController->showBoard(); UBApplication::applicationController->showBoard();
UBApplication::applicationController->hideDesktop();
mAddItemPalette->hide(); mAddItemPalette->hide();
if(mPixmap.isNull()) if(mPixmap.isNull())
UBApplication::boardController->downloadURL(mItemUrl); UBApplication::boardController->downloadURL(mItemUrl);

@ -347,6 +347,7 @@ void UBApplicationController::showBoard()
if (UBApplication::boardController) if (UBApplication::boardController)
UBApplication::boardController->show(); UBApplication::boardController->show();
mIsShowingDesktop = false;
UBPlatformUtils::setDesktopMode(false); UBPlatformUtils::setDesktopMode(false);
mUninoteController->hideWindow(); mUninoteController->hideWindow();

Loading…
Cancel
Save