UBBoardView conflicts merged

preferencesAboutTextFull
Ilia Ryabokon 12 years ago
commit 0594cfe09f
  1. 4
      LICENSE.txt
  2. 4
      Open-Sankore.packproj
  3. 4
      Sankore_3.1.pro
  4. 18
      buildDebianPackage.sh
  5. 2
      plugins/cffadaptor/src/UBCFFAdaptor.cpp
  6. 2
      plugins/cffadaptor/src/UBCFFAdaptor.h
  7. 2
      plugins/cffadaptor/src/UBCFFAdaptor_global.h
  8. 2
      plugins/cffadaptor/src/UBCFFConstants.h
  9. 2
      plugins/cffadaptor/src/UBGlobals.h
  10. BIN
      resources/etc/SankoreEditor/editor_en/files/calepin.png
  11. BIN
      resources/etc/SankoreEditor/editor_en/files/logo.png
  12. BIN
      resources/etc/SankoreEditor/editor_en/files/logoplanetesankore.png
  13. BIN
      resources/etc/SankoreEditor/editor_en/files/mappe.png
  14. BIN
      resources/etc/SankoreEditor/editor_en/files/outils.png
  15. 81
      resources/etc/SankoreEditor/editor_en/index.html
  16. BIN
      resources/etc/SankoreEditor/editor_fr/files/calepin.png
  17. BIN
      resources/etc/SankoreEditor/editor_fr/files/logo.png
  18. BIN
      resources/etc/SankoreEditor/editor_fr/files/logoplanetesankore.png
  19. BIN
      resources/etc/SankoreEditor/editor_fr/files/mappe.png
  20. BIN
      resources/etc/SankoreEditor/editor_fr/files/outils.png
  21. 80
      resources/etc/SankoreEditor/editor_fr/index.html
  22. 12
      resources/forms/mainWindow.ui
  23. BIN
      resources/images/toolbar/paraschool.png
  24. 1
      resources/sankore.qrc
  25. 2
      src/adaptors/UBCFFSubsetAdaptor.cpp
  26. 2
      src/adaptors/UBCFFSubsetAdaptor.h
  27. 2
      src/adaptors/UBExportAdaptor.cpp
  28. 2
      src/adaptors/UBExportAdaptor.h
  29. 2
      src/adaptors/UBExportCFF.cpp
  30. 2
      src/adaptors/UBExportCFF.h
  31. 2
      src/adaptors/UBExportDocument.cpp
  32. 2
      src/adaptors/UBExportDocument.h
  33. 2
      src/adaptors/UBExportFullPDF.cpp
  34. 2
      src/adaptors/UBExportFullPDF.h
  35. 2
      src/adaptors/UBExportPDF.cpp
  36. 2
      src/adaptors/UBExportPDF.h
  37. 2
      src/adaptors/UBExportWeb.cpp
  38. 2
      src/adaptors/UBExportWeb.h
  39. 2
      src/adaptors/UBImportAdaptor.cpp
  40. 2
      src/adaptors/UBImportAdaptor.h
  41. 2
      src/adaptors/UBImportCFF.cpp
  42. 2
      src/adaptors/UBImportCFF.h
  43. 2
      src/adaptors/UBImportDocument.cpp
  44. 2
      src/adaptors/UBImportDocument.h
  45. 2
      src/adaptors/UBImportImage.cpp
  46. 2
      src/adaptors/UBImportImage.h
  47. 2
      src/adaptors/UBImportPDF.cpp
  48. 2
      src/adaptors/UBImportPDF.h
  49. 2
      src/adaptors/UBImportVirtualPrinter.cpp
  50. 2
      src/adaptors/UBIniFileParser.cpp
  51. 2
      src/adaptors/UBIniFileParser.h
  52. 2
      src/adaptors/UBMetadataDcSubsetAdaptor.cpp
  53. 2
      src/adaptors/UBMetadataDcSubsetAdaptor.h
  54. 245
      src/adaptors/UBSvgSubsetAdaptor.cpp
  55. 5
      src/adaptors/UBSvgSubsetAdaptor.h
  56. 2
      src/adaptors/UBThumbnailAdaptor.cpp
  57. 2
      src/adaptors/UBThumbnailAdaptor.h
  58. 2
      src/adaptors/UBWebPublisher.cpp
  59. 2
      src/adaptors/UBWebPublisher.h
  60. 2
      src/adaptors/publishing/UBDocumentPublisher.cpp
  61. 2
      src/adaptors/publishing/UBDocumentPublisher.h
  62. 2
      src/adaptors/publishing/UBSvgSubsetRasterizer.cpp
  63. 2
      src/adaptors/publishing/UBSvgSubsetRasterizer.h
  64. 2
      src/api/UBLibraryAPI.cpp
  65. 2
      src/api/UBLibraryAPI.h
  66. 2
      src/api/UBW3CWidgetAPI.cpp
  67. 2
      src/api/UBW3CWidgetAPI.h
  68. 2
      src/api/UBWidgetMessageAPI.cpp
  69. 2
      src/api/UBWidgetMessageAPI.h
  70. 2
      src/api/UBWidgetUniboardAPI.cpp
  71. 2
      src/api/UBWidgetUniboardAPI.h
  72. 14
      src/board/UBBoardController.cpp
  73. 6
      src/board/UBBoardController.h
  74. 11
      src/board/UBBoardPaletteManager.cpp
  75. 7
      src/board/UBBoardPaletteManager.h
  76. 332
      src/board/UBBoardView.cpp
  77. 23
      src/board/UBBoardView.h
  78. 14
      src/board/UBDrawingController.cpp
  79. 2
      src/board/UBDrawingController.h
  80. 3
      src/board/UBFeaturesController.cpp
  81. 2
      src/board/UBFeaturesController.h
  82. 2
      src/core/UB.h
  83. 8
      src/core/UBApplication.cpp
  84. 2
      src/core/UBApplication.h
  85. 46
      src/core/UBApplicationController.cpp
  86. 5
      src/core/UBApplicationController.h
  87. 3
      src/core/UBDisplayManager.cpp
  88. 2
      src/core/UBDisplayManager.h
  89. 2
      src/core/UBDocumentManager.cpp
  90. 2
      src/core/UBDocumentManager.h
  91. 2
      src/core/UBDownloadManager.cpp
  92. 2
      src/core/UBDownloadManager.h
  93. 2
      src/core/UBDownloadThread.cpp
  94. 2
      src/core/UBDownloadThread.h
  95. 2
      src/core/UBIdleTimer.cpp
  96. 2
      src/core/UBIdleTimer.h
  97. 2
      src/core/UBMimeData.cpp
  98. 2
      src/core/UBMimeData.h
  99. 2
      src/core/UBPersistenceManager.cpp
  100. 2
      src/core/UBPersistenceManager.h
  101. Some files were not shown because too many files have changed in this diff Show More

@ -1,6 +1,6 @@
Copyright (C) 2013 Groupement d'Intérêt Public pour l'Education Numérique en Afrique (GIP ENA) Copyright (C) 2013 Groupement d'Inter<EFBFBD>t Public pour l'Education NumŽrique en Afrique (GIP ENA)
Open-Sankoré is free software: you can redistribute it and/or modify Open-SankorŽ is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
the Free Software Foundation, version 3 of the License, the Free Software Foundation, version 3 of the License,
with a specific linking exception for the OpenSSL project's with a specific linking exception for the OpenSSL project's

@ -26,9 +26,9 @@
<key>International</key> <key>International</key>
<dict> <dict>
<key>Mode</key> <key>Mode</key>
<integer>0</integer> <integer>1</integer>
<key>Path</key> <key>Path</key>
<string></string> <string>LICENSE.txt</string>
<key>Path Type</key> <key>Path Type</key>
<integer>2</integer> <integer>2</integer>
</dict> </dict>

@ -10,8 +10,8 @@ CONFIG += debug_and_release \
VERSION_MAJ = 2 VERSION_MAJ = 2
VERSION_MIN = 00 VERSION_MIN = 00
VERSION_TYPE = r # a = alpha, b = beta, r = release, other => error VERSION_TYPE = b # a = alpha, b = beta, r = release, other => error
VERSION_PATCH = 05 VERSION_PATCH = 06
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", "")

@ -19,6 +19,15 @@
# functions # functions
#********************** #**********************
checkUser()
{
if [ `id -u` -ne 0 ]; then
echo "Please run the script as root, may be using fakeroot command as follow"
echo "fakeroot ./buildDebianPackage.sh [options]"
exit 1
fi
}
initializeVariables() initializeVariables()
{ {
MAKE_TAG=true MAKE_TAG=true
@ -120,6 +129,7 @@ buildWithStandardQt(){
#********************** #**********************
# script # script
#********************** #**********************
checkUser
initializeVariables initializeVariables
buildWithStandardQt buildWithStandardQt
@ -375,12 +385,13 @@ chmod 755 "$BASE_WORKING_DIR/DEBIAN/postint"
mkdir -p "install/linux" mkdir -p "install/linux"
DEBIAN_PACKAGE_NAME="Open-Sankore_${VERSION}_$ARCHITECTURE.deb" DEBIAN_PACKAGE_NAME="Open-Sankore_${VERSION}_$ARCHITECTURE.deb"
fakeroot chown -R root:root $BASE_WORKING_DIR chown -R root:root $BASE_WORKING_DIR
dpkg -b "$BASE_WORKING_DIR" "install/linux/$DEBIAN_PACKAGE_NAME" dpkg -b "$BASE_WORKING_DIR" "install/linux/$DEBIAN_PACKAGE_NAME"
notifyProgress "Open-Sankore" "Package built"
#clean up mess #clean up mess
fakeroot rm -rf $BASE_WORKING_DIR rm -rf $BASE_WORKING_DIR
notifyProgress "Open-Sankore" "Package built"
if [ $CREATE_DIENA_DISTRIBUTION_ZIP == true ]; then if [ $CREATE_DIENA_DISTRIBUTION_ZIP == true ]; then
@ -392,3 +403,4 @@ if [ $CREATE_DIENA_DISTRIBUTION_ZIP == true ]; then
notifyProgress "Open-Sankore" "Build Diena zip file for distribution" notifyProgress "Open-Sankore" "Build Diena zip file for distribution"
fi fi
exit 0

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2012 Webdoc SA * Copyright (C) 2010-2013 Groupement d'Intérêt Public pour l'Education Numérique en Afrique (GIP ENA)
* *
* This file is part of Open-Sankoré. * This file is part of Open-Sankoré.
* *

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2012 Webdoc SA * Copyright (C) 2010-2013 Groupement d'Intérêt Public pour l'Education Numérique en Afrique (GIP ENA)
* *
* This file is part of Open-Sankoré. * This file is part of Open-Sankoré.
* *

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2012 Webdoc SA * Copyright (C) 2010-2013 Groupement d'Intérêt Public pour l'Education Numérique en Afrique (GIP ENA)
* *
* This file is part of Open-Sankoré. * This file is part of Open-Sankoré.
* *

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2012 Webdoc SA * Copyright (C) 2010-2013 Groupement d'Intérêt Public pour l'Education Numérique en Afrique (GIP ENA)
* *
* This file is part of Open-Sankoré. * This file is part of Open-Sankoré.
* *

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2012 Webdoc SA * Copyright (C) 2010-2013 Groupement d'Intérêt Public pour l'Education Numérique en Afrique (GIP ENA)
* *
* This file is part of Open-Sankoré. * This file is part of Open-Sankoré.
* *

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

@ -1,81 +0,0 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Sankoré editor</title>
<style type="text/css">
<!--
.white { color: #FFF;
}
body {
background-color: #E5E3DB;
}
body,td,th {
font-family: Verdana, Geneva, sans-serif;
color: #666;
text-align: left;
}
.conteneur {
background-color: #5C5C5C;
text-align: center;
}
.c {
text-align: center;
}
.m {
font-size: medium;
}
a:link {
color: #666;
}
a:visited {
color: #666;
}
a:hover {
color: #000;
}
a:active {
color: #666;
}
-->
</style>
</head>
<body>
<table width="843" border="0" align="center">
<tr>
<td class="conteneur"><p><img src="files/logo.png" width="196" height="22" alt="editeur" /></p>
<p><span class="white">Instructions on how to use Sankoré editor </span></p>
<p><span class="white">THE CURRENT VERSION IS ONLY AVAILABLE IN FRENCH</span></p></td>
</tr>
<tr>
<td><div align="center"><img src="files/outils.png" width="128" height="128" alt="outils" /> <img src="files/mappe.png" width="128" height="128" alt="mappe" /> <img src="files/calepin.png" width="128" height="128" alt="calepin" /></div></td>
</tr>
<tr>
<td><p>Sankoré Editor allows you to create rich interactivity scenarios. Create interactive content easily with basic activities that can be used in various subjects (attach images, sounds, order of words, phrases, create categories ...). This content can then be added to the software Open-Sankore. </p></td>
</tr>
<tr>
<td><p>Requirement to work with the editor :</p>
<ul>
<li>a Web access</li>
<li>an account on Planète Sankoré</li>
</ul></td>
</tr>
<tr>
<td><div align="center">
<p>&nbsp;</p>
<p><a href="http://editeur.sankore.org" title="Editeur" target="_self" class="c">Click here to connect to the Sankoré Editor</a></p>
</div></td>
</tr>
<tr>
<td><p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p></td>
</tr>
<tr>
<td>Sankoré editor is hosted on <a href="http://planete.sankore.org/" target="_self">planete.sankore.org</a></td>
</tr>
</table>
<p>&nbsp;</p>
</body>
</html>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

@ -1,80 +0,0 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Editeur Sankoré</title>
<style type="text/css">
<!--
.white { color: #FFF;
}
body {
background-color: #E5E3DB;
}
body,td,th {
font-family: Verdana, Geneva, sans-serif;
color: #666;
text-align: left;
}
.conteneur {
background-color: #5C5C5C;
text-align: center;
}
.c {
text-align: center;
}
.m {
font-size: medium;
}
a:link {
color: #666;
}
a:visited {
color: #666;
}
a:hover {
color: #000;
}
a:active {
color: #666;
}
-->
</style>
</head>
<body>
<table width="843" border="0" align="center">
<tr>
<td class="conteneur"><p><img src="files/logo.png" width="196" height="22" alt="editeur" /></p>
<p><span class="white">Instructions pour l'utilisation de l'éditeur Sankoré</span></p></td>
</tr>
<tr>
<td><div align="center"><img src="files/outils.png" width="128" height="128" alt="outils" /> <img src="files/mappe.png" width="128" height="128" alt="mappe" /> <img src="files/calepin.png" width="128" height="128" alt="calepin" /></div></td>
</tr>
<tr>
<td>L'éditeur Sankoré vous permet de réaliser des scénarios d'interactivités riches. Il facilite la création de contenu interactif avec des activités de base qui peuvent être utilisées dans diverses disciplines (associer des images, des sons, ordonner des mots, des phrases, créer des catégories...). Ce contenu peut ensuite être ajouté à votre cours sur le logiciel Open-Sankoré. L'éditeur repose sur votre compte utilisateur Planète Sankoré.</td>
</tr>
<tr>
<td><p>Éléments requis pour travailler avec l'éditeur :</p>
<ul>
<li>un accès Web</li>
<li>un compte Planète Sankoré</li>
</ul></td>
</tr>
<tr>
<td><div align="center">
<p>&nbsp;</p>
<p><a href="http://editeur.sankore.org" title="Editeur" target="_self" class="c">Accès à l'éditeur Sankoré</a></p>
</div></td>
</tr>
<tr>
<td><p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p></td>
</tr>
<tr>
<td>L'éditeur Sankoré est hébergé sur <a href="http://planete.sankore.org/" target="_self">planete.sankore.org</a></td>
</tr>
</table>
<p>&nbsp;</p>
</body>
</html>

@ -1596,18 +1596,6 @@
<string>Check Update</string> <string>Check Update</string>
</property> </property>
</action> </action>
<action name="actionSankoreEditor">
<property name="icon">
<iconset resource="../sankore.qrc">
<normaloff>:/images/toolbar/paraschool.png</normaloff>:/images/toolbar/paraschool.png</iconset>
</property>
<property name="text">
<string>Open-Sankoré Editor</string>
</property>
<property name="toolTip">
<string>Show Open-Sankoré Widgets Editor</string>
</property>
</action>
<action name="actionHideApplication"> <action name="actionHideApplication">
<property name="icon"> <property name="icon">
<iconset resource="../sankore.qrc"> <iconset resource="../sankore.qrc">

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

@ -295,7 +295,6 @@
<file>images/toolbar/updates.png</file> <file>images/toolbar/updates.png</file>
<file>images/paletteLibrary.png</file> <file>images/paletteLibrary.png</file>
<file>images/paletteNavigator.png</file> <file>images/paletteNavigator.png</file>
<file>images/toolbar/paraschool.png</file>
<file>images/toolbar/display.png</file> <file>images/toolbar/display.png</file>
<file>images/toolbar/hide.png</file> <file>images/toolbar/hide.png</file>
<file>images/toolbar/record.png</file> <file>images/toolbar/record.png</file>

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2012 Webdoc SA * Copyright (C) 2010-2013 Groupement d'Intérêt Public pour l'Education Numérique en Afrique (GIP ENA)
* *
* This file is part of Open-Sankoré. * This file is part of Open-Sankoré.
* *

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2012 Webdoc SA * Copyright (C) 2010-2013 Groupement d'Intérêt Public pour l'Education Numérique en Afrique (GIP ENA)
* *
* This file is part of Open-Sankoré. * This file is part of Open-Sankoré.
* *

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2012 Webdoc SA * Copyright (C) 2010-2013 Groupement d'Intérêt Public pour l'Education Numérique en Afrique (GIP ENA)
* *
* This file is part of Open-Sankoré. * This file is part of Open-Sankoré.
* *

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2012 Webdoc SA * Copyright (C) 2010-2013 Groupement d'Intérêt Public pour l'Education Numérique en Afrique (GIP ENA)
* *
* This file is part of Open-Sankoré. * This file is part of Open-Sankoré.
* *

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2012 Webdoc SA * Copyright (C) 2010-2013 Groupement d'Intérêt Public pour l'Education Numérique en Afrique (GIP ENA)
* *
* This file is part of Open-Sankoré. * This file is part of Open-Sankoré.
* *

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2012 Webdoc SA * Copyright (C) 2010-2013 Groupement d'Intérêt Public pour l'Education Numérique en Afrique (GIP ENA)
* *
* This file is part of Open-Sankoré. * This file is part of Open-Sankoré.
* *

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2012 Webdoc SA * Copyright (C) 2010-2013 Groupement d'Intérêt Public pour l'Education Numérique en Afrique (GIP ENA)
* *
* This file is part of Open-Sankoré. * This file is part of Open-Sankoré.
* *

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2012 Webdoc SA * Copyright (C) 2010-2013 Groupement d'Intérêt Public pour l'Education Numérique en Afrique (GIP ENA)
* *
* This file is part of Open-Sankoré. * This file is part of Open-Sankoré.
* *

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2012 Webdoc SA * Copyright (C) 2010-2013 Groupement d'Intérêt Public pour l'Education Numérique en Afrique (GIP ENA)
* *
* This file is part of Open-Sankoré. * This file is part of Open-Sankoré.
* *

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2012 Webdoc SA * Copyright (C) 2010-2013 Groupement d'Intérêt Public pour l'Education Numérique en Afrique (GIP ENA)
* *
* This file is part of Open-Sankoré. * This file is part of Open-Sankoré.
* *

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2012 Webdoc SA * Copyright (C) 2010-2013 Groupement d'Intérêt Public pour l'Education Numérique en Afrique (GIP ENA)
* *
* This file is part of Open-Sankoré. * This file is part of Open-Sankoré.
* *

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2012 Webdoc SA * Copyright (C) 2010-2013 Groupement d'Intérêt Public pour l'Education Numérique en Afrique (GIP ENA)
* *
* This file is part of Open-Sankoré. * This file is part of Open-Sankoré.
* *

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2012 Webdoc SA * Copyright (C) 2010-2013 Groupement d'Intérêt Public pour l'Education Numérique en Afrique (GIP ENA)
* *
* This file is part of Open-Sankoré. * This file is part of Open-Sankoré.
* *

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2012 Webdoc SA * Copyright (C) 2010-2013 Groupement d'Intérêt Public pour l'Education Numérique en Afrique (GIP ENA)
* *
* This file is part of Open-Sankoré. * This file is part of Open-Sankoré.
* *

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2012 Webdoc SA * Copyright (C) 2010-2013 Groupement d'Intérêt Public pour l'Education Numérique en Afrique (GIP ENA)
* *
* This file is part of Open-Sankoré. * This file is part of Open-Sankoré.
* *

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2012 Webdoc SA * Copyright (C) 2010-2013 Groupement d'Intérêt Public pour l'Education Numérique en Afrique (GIP ENA)
* *
* This file is part of Open-Sankoré. * This file is part of Open-Sankoré.
* *

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2012 Webdoc SA * Copyright (C) 2010-2013 Groupement d'Intérêt Public pour l'Education Numérique en Afrique (GIP ENA)
* *
* This file is part of Open-Sankoré. * This file is part of Open-Sankoré.
* *

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2012 Webdoc SA * Copyright (C) 2010-2013 Groupement d'Intérêt Public pour l'Education Numérique en Afrique (GIP ENA)
* *
* This file is part of Open-Sankoré. * This file is part of Open-Sankoré.
* *

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2012 Webdoc SA * Copyright (C) 2010-2013 Groupement d'Intérêt Public pour l'Education Numérique en Afrique (GIP ENA)
* *
* This file is part of Open-Sankoré. * This file is part of Open-Sankoré.
* *

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2012 Webdoc SA * Copyright (C) 2010-2013 Groupement d'Intérêt Public pour l'Education Numérique en Afrique (GIP ENA)
* *
* This file is part of Open-Sankoré. * This file is part of Open-Sankoré.
* *

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2012 Webdoc SA * Copyright (C) 2010-2013 Groupement d'Intérêt Public pour l'Education Numérique en Afrique (GIP ENA)
* *
* This file is part of Open-Sankoré. * This file is part of Open-Sankoré.
* *

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2012 Webdoc SA * Copyright (C) 2010-2013 Groupement d'Intérêt Public pour l'Education Numérique en Afrique (GIP ENA)
* *
* This file is part of Open-Sankoré. * This file is part of Open-Sankoré.
* *

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2012 Webdoc SA * Copyright (C) 2010-2013 Groupement d'Intérêt Public pour l'Education Numérique en Afrique (GIP ENA)
* *
* This file is part of Open-Sankoré. * This file is part of Open-Sankoré.
* *

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2012 Webdoc SA * Copyright (C) 2010-2013 Groupement d'Intérêt Public pour l'Education Numérique en Afrique (GIP ENA)
* *
* This file is part of Open-Sankoré. * This file is part of Open-Sankoré.
* *

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2012 Webdoc SA * Copyright (C) 2010-2013 Groupement d'Intérêt Public pour l'Education Numérique en Afrique (GIP ENA)
* *
* This file is part of Open-Sankoré. * This file is part of Open-Sankoré.
* *

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2012 Webdoc SA * Copyright (C) 2010-2013 Groupement d'Intérêt Public pour l'Education Numérique en Afrique (GIP ENA)
* *
* This file is part of Open-Sankoré. * This file is part of Open-Sankoré.
* *

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2012 Webdoc SA * Copyright (C) 2010-2013 Groupement d'Intérêt Public pour l'Education Numérique en Afrique (GIP ENA)
* *
* This file is part of Open-Sankoré. * This file is part of Open-Sankoré.
* *

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2012 Webdoc SA * Copyright (C) 2010-2013 Groupement d'Intérêt Public pour l'Education Numérique en Afrique (GIP ENA)
* *
* This file is part of Open-Sankoré. * This file is part of Open-Sankoré.
* *

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2012 Webdoc SA * Copyright (C) 2010-2013 Groupement d'Intérêt Public pour l'Education Numérique en Afrique (GIP ENA)
* *
* This file is part of Open-Sankoré. * This file is part of Open-Sankoré.
* *

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2012 Webdoc SA * Copyright (C) 2010-2013 Groupement d'Intérêt Public pour l'Education Numérique en Afrique (GIP ENA)
* *
* This file is part of Open-Sankoré. * This file is part of Open-Sankoré.
* *
@ -399,10 +399,6 @@ UBGraphicsScene* UBSvgSubsetAdaptor::UBSvgSubsetReader::loadScene()
mXmlReader.readNext(); mXmlReader.readNext();
if (mXmlReader.isStartElement()) if (mXmlReader.isStartElement())
{ {
qreal zFromSvg = getZValueFromSvg();
QUuid uuidFromSvg = getUuidFromSvg();
if (mXmlReader.name() == "svg") if (mXmlReader.name() == "svg")
{ {
if (!mScene) if (!mScene)
@ -443,9 +439,7 @@ UBGraphicsScene* UBSvgSubsetAdaptor::UBSvgSubsetReader::loadScene()
QStringRef svgSceneUuid = mXmlReader.attributes().value(mNamespaceUri, "uuid"); QStringRef svgSceneUuid = mXmlReader.attributes().value(mNamespaceUri, "uuid");
if (!svgSceneUuid.isNull()) if (!svgSceneUuid.isNull())
{
mScene->setUuid(QUuid(svgSceneUuid.toString())); mScene->setUuid(QUuid(svgSceneUuid.toString()));
}
// introduced in UB 4.0 // introduced in UB 4.0
@ -475,9 +469,7 @@ UBGraphicsScene* UBSvgSubsetAdaptor::UBSvgSubsetReader::loadScene()
QStringRef pageDpi = mXmlReader.attributes().value("pageDpi"); QStringRef pageDpi = mXmlReader.attributes().value("pageDpi");
if (!pageDpi.isNull()) if (!pageDpi.isNull())
{
UBSettings::settings()->pageDpi->set(pageDpi.toString()); UBSettings::settings()->pageDpi->set(pageDpi.toString());
}
bool darkBackground = false; bool darkBackground = false;
bool crossedBackground = false; bool crossedBackground = false;
@ -560,9 +552,6 @@ UBGraphicsScene* UBSvgSubsetAdaptor::UBSvgSubsetReader::loadScene()
if (polygonItem) if (polygonItem)
{ {
polygonItem->setUuid(uuidFromSvg);
polygonItem->setData(UBGraphicsItemData::ItemLayerType, QVariant(UBItemLayerType::Graphic)); polygonItem->setData(UBGraphicsItemData::ItemLayerType, QVariant(UBItemLayerType::Graphic));
UBGraphicsStrokesGroup* group; UBGraphicsStrokesGroup* group;
@ -570,24 +559,26 @@ UBGraphicsScene* UBSvgSubsetAdaptor::UBSvgSubsetReader::loadScene()
group = new UBGraphicsStrokesGroup(); group = new UBGraphicsStrokesGroup();
mStrokesList.insert(parentId,group); mStrokesList.insert(parentId,group);
currentStroke = new UBGraphicsStroke(); currentStroke = new UBGraphicsStroke();
group->setTransform(polygonItem->transform());
UBGraphicsItem::assignZValue(group, polygonItem->zValue());
} }
else else
group = mStrokesList.value(parentId); group = mStrokesList.value(parentId);
if(polygonItem->transform().isIdentity())
polygonItem->setTransform(group->transform()); polygonItem->setTransform(group->transform());
group->addToGroup(polygonItem); group->addToGroup(polygonItem);
polygonItem->setStrokesGroup(group); polygonItem->setStrokesGroup(group);
polygonItem->setStroke(currentStroke); polygonItem->setStroke(currentStroke);
polygonItem->show(); polygonItem->show();
group->addToGroup(polygonItem); group->addToGroup(polygonItem);
} }
} }
else if (mXmlReader.name() == "polyline") else if (mXmlReader.name() == "polyline")
{ {
QList<UBGraphicsPolygonItem*> polygonItems QList<UBGraphicsPolygonItem*> polygonItems = polygonItemsFromPolylineSvg(mScene->isDarkBackground() ? Qt::white : Qt::black);
= polygonItemsFromPolylineSvg(mScene->isDarkBackground() ? Qt::white : Qt::black);
QString parentId = QUuid::createUuid().toString(); QString parentId = QUuid::createUuid().toString();
@ -600,11 +591,15 @@ UBGraphicsScene* UBSvgSubsetAdaptor::UBSvgSubsetReader::loadScene()
group = new UBGraphicsStrokesGroup(); group = new UBGraphicsStrokesGroup();
mStrokesList.insert(parentId,group); mStrokesList.insert(parentId,group);
currentStroke = new UBGraphicsStroke(); currentStroke = new UBGraphicsStroke();
group->setTransform(polygonItem->transform());
UBGraphicsItem::assignZValue(group, polygonItem->zValue());
} }
else else
group = mStrokesList.value(parentId); group = mStrokesList.value(parentId);
if(polygonItem->transform().isIdentity())
polygonItem->setTransform(group->transform()); polygonItem->setTransform(group->transform());
group->addToGroup(polygonItem); group->addToGroup(polygonItem);
polygonItem->setStrokesGroup(group); polygonItem->setStrokesGroup(group);
polygonItem->setStroke(currentStroke); polygonItem->setStroke(currentStroke);
@ -612,6 +607,7 @@ UBGraphicsScene* UBSvgSubsetAdaptor::UBSvgSubsetReader::loadScene()
polygonItem->show(); polygonItem->show();
group->addToGroup(polygonItem); group->addToGroup(polygonItem);
} }
} }
else if (mXmlReader.name() == "image") else if (mXmlReader.name() == "image")
{ {
@ -636,12 +632,6 @@ UBGraphicsScene* UBSvgSubsetAdaptor::UBSvgSubsetReader::loadScene()
mScene->addItem(pixmapItem); mScene->addItem(pixmapItem);
if (zFromSvg != UBZLayerController::errorNum())
UBGraphicsItem::assignZValue(pixmapItem, zFromSvg);
if (!uuidFromSvg.isNull())
pixmapItem->setUuid(uuidFromSvg);
if (isBackground) if (isBackground)
mScene->setAsBackgroundObject(pixmapItem); mScene->setAsBackgroundObject(pixmapItem);
@ -651,7 +641,6 @@ UBGraphicsScene* UBSvgSubsetAdaptor::UBSvgSubsetReader::loadScene()
else if (href.contains("svg")) else if (href.contains("svg"))
{ {
UBGraphicsSvgItem* svgItem = svgItemFromSvg(); UBGraphicsSvgItem* svgItem = svgItemFromSvg();
if (svgItem) if (svgItem)
{ {
svgItem->setFlag(QGraphicsItem::ItemIsMovable, true); svgItem->setFlag(QGraphicsItem::ItemIsMovable, true);
@ -659,9 +648,6 @@ UBGraphicsScene* UBSvgSubsetAdaptor::UBSvgSubsetReader::loadScene()
mScene->addItem(svgItem); mScene->addItem(svgItem);
if (zFromSvg != UBZLayerController::errorNum())
UBGraphicsItem::assignZValue(svgItem, zFromSvg);
if (isBackground) if (isBackground)
mScene->setAsBackgroundObject(svgItem); mScene->setAsBackgroundObject(svgItem);
@ -677,7 +663,6 @@ UBGraphicsScene* UBSvgSubsetAdaptor::UBSvgSubsetReader::loadScene()
else if (mXmlReader.name() == "audio") else if (mXmlReader.name() == "audio")
{ {
UBGraphicsMediaItem* audioItem = audioItemFromSvg(); UBGraphicsMediaItem* audioItem = audioItemFromSvg();
if (audioItem) if (audioItem)
{ {
audioItem->setFlag(QGraphicsItem::ItemIsMovable, true); audioItem->setFlag(QGraphicsItem::ItemIsMovable, true);
@ -685,12 +670,6 @@ UBGraphicsScene* UBSvgSubsetAdaptor::UBSvgSubsetReader::loadScene()
mScene->addItem(audioItem); mScene->addItem(audioItem);
if (zFromSvg != UBZLayerController::errorNum())
UBGraphicsItem::assignZValue(audioItem, zFromSvg);
if (!uuidFromSvg.isNull())
audioItem->setUuid(uuidFromSvg);
audioItem->show(); audioItem->show();
//force start to load the video and display the first frame //force start to load the video and display the first frame
@ -701,20 +680,14 @@ UBGraphicsScene* UBSvgSubsetAdaptor::UBSvgSubsetReader::loadScene()
else if (mXmlReader.name() == "video") else if (mXmlReader.name() == "video")
{ {
UBGraphicsMediaItem* videoItem = videoItemFromSvg(); UBGraphicsMediaItem* videoItem = videoItemFromSvg();
if (videoItem) if (videoItem)
{ {
videoItem->setFlag(QGraphicsItem::ItemIsMovable, true); videoItem->setFlag(QGraphicsItem::ItemIsMovable, true);
videoItem->setFlag(QGraphicsItem::ItemIsSelectable, true); videoItem->setFlag(QGraphicsItem::ItemIsSelectable, true);
mScene->addItem(videoItem); mScene->addItem(videoItem);
if (zFromSvg != UBZLayerController::errorNum())
UBGraphicsItem::assignZValue(videoItem, zFromSvg);
if (!uuidFromSvg.isNull())
videoItem->setUuid(uuidFromSvg);
videoItem->show(); videoItem->show();
//force start to load the video and display the first frame //force start to load the video and display the first frame
@ -725,7 +698,6 @@ UBGraphicsScene* UBSvgSubsetAdaptor::UBSvgSubsetReader::loadScene()
else if (mXmlReader.name() == "text")//This is for backward compatibility with proto text field prior to version 4.3 else if (mXmlReader.name() == "text")//This is for backward compatibility with proto text field prior to version 4.3
{ {
UBGraphicsTextItem* textItem = textItemFromSvg(); UBGraphicsTextItem* textItem = textItemFromSvg();
if (textItem) if (textItem)
{ {
textItem->setFlag(QGraphicsItem::ItemIsMovable, true); textItem->setFlag(QGraphicsItem::ItemIsMovable, true);
@ -733,85 +705,54 @@ UBGraphicsScene* UBSvgSubsetAdaptor::UBSvgSubsetReader::loadScene()
mScene->addItem(textItem); mScene->addItem(textItem);
if (zFromSvg != UBZLayerController::errorNum())
UBGraphicsItem::assignZValue(textItem, zFromSvg);
if (!uuidFromSvg.isNull())
textItem->setUuid(uuidFromSvg);
textItem->show(); textItem->show();
} }
} }
else if (mXmlReader.name() == "curtain") else if (mXmlReader.name() == "curtain")
{ {
UBGraphicsCurtainItem* mask = curtainItemFromSvg(); UBGraphicsCurtainItem* mask = curtainItemFromSvg();
if (mask) if (mask)
{ {
mScene->addItem(mask); mScene->addItem(mask);
mScene->registerTool(mask); mScene->registerTool(mask);
if (zFromSvg != UBZLayerController::errorNum())
UBGraphicsItem::assignZValue(mask, zFromSvg);
if (!uuidFromSvg.isNull())
mask->setUuid(uuidFromSvg);
} }
} }
else if (mXmlReader.name() == "ruler") else if (mXmlReader.name() == "ruler")
{ {
QString ubZValue = mXmlReader.attributes().value(mNamespaceUri, "z-value").toString();
UBGraphicsRuler *ruler = rulerFromSvg(); UBGraphicsRuler *ruler = rulerFromSvg();
ubZValue = mXmlReader.attributes().value(mNamespaceUri, "z-value").toString();
if (ruler) if (ruler)
{ {
mScene->addItem(ruler); mScene->addItem(ruler);
mScene->registerTool(ruler); mScene->registerTool(ruler);
if (zFromSvg != UBZLayerController::errorNum())
UBGraphicsItem::assignZValue(ruler, zFromSvg);
} }
} }
else if (mXmlReader.name() == "compass") else if (mXmlReader.name() == "compass")
{ {
UBGraphicsCompass *compass = compassFromSvg(); UBGraphicsCompass *compass = compassFromSvg();
if (compass) if (compass)
{ {
mScene->addItem(compass); mScene->addItem(compass);
mScene->registerTool(compass); mScene->registerTool(compass);
if (zFromSvg != UBZLayerController::errorNum())
UBGraphicsItem::assignZValue(compass, zFromSvg);
} }
} }
else if (mXmlReader.name() == "protractor") else if (mXmlReader.name() == "protractor")
{ {
UBGraphicsProtractor *protractor = protractorFromSvg(); UBGraphicsProtractor *protractor = protractorFromSvg();
if (protractor) if (protractor)
{ {
mScene->addItem(protractor); mScene->addItem(protractor);
mScene->registerTool(protractor); mScene->registerTool(protractor);
if (zFromSvg != UBZLayerController::errorNum())
UBGraphicsItem::assignZValue(protractor, zFromSvg);
} }
} }
else if (mXmlReader.name() == "triangle") else if (mXmlReader.name() == "triangle")
{ {
UBGraphicsTriangle *triangle = triangleFromSvg(); UBGraphicsTriangle *triangle = triangleFromSvg();
if (triangle) if (triangle)
{ {
mScene->addItem(triangle); mScene->addItem(triangle);
mScene->registerTool(triangle); mScene->registerTool(triangle);
if (zFromSvg != UBZLayerController::errorNum())
UBGraphicsItem::assignZValue(triangle, zFromSvg);
} }
} }
else if (mXmlReader.name() == "cache") else if (mXmlReader.name() == "cache")
@ -822,9 +763,6 @@ UBGraphicsScene* UBSvgSubsetAdaptor::UBSvgSubsetReader::loadScene()
mScene->addItem(cache); mScene->addItem(cache);
mScene->registerTool(cache); mScene->registerTool(cache);
UBApplication::boardController->notifyCache(true); UBApplication::boardController->notifyCache(true);
if (zFromSvg != UBZLayerController::errorNum())
UBGraphicsItem::assignZValue(cache, zFromSvg);
} }
} }
else if (mXmlReader.name() == "foreignObject") else if (mXmlReader.name() == "foreignObject")
@ -851,9 +789,6 @@ UBGraphicsScene* UBSvgSubsetAdaptor::UBSvgSubsetReader::loadScene()
mScene->addItem(pdfItem); mScene->addItem(pdfItem);
if (zFromSvg != UBZLayerController::errorNum())
UBGraphicsItem::assignZValue(pdfItem, zFromSvg);
if (isBackground) if (isBackground)
mScene->setAsBackgroundObject(pdfItem); mScene->setAsBackgroundObject(pdfItem);
@ -873,12 +808,6 @@ UBGraphicsScene* UBSvgSubsetAdaptor::UBSvgSubsetReader::loadScene()
mScene->addItem(appleWidgetItem); mScene->addItem(appleWidgetItem);
if (zFromSvg != UBZLayerController::errorNum())
UBGraphicsItem::assignZValue(appleWidgetItem, zFromSvg);
if (!uuidFromSvg.isNull())
appleWidgetItem->setUuid(uuidFromSvg);
appleWidgetItem->show(); appleWidgetItem->show();
currentWidget = appleWidgetItem; currentWidget = appleWidgetItem;
@ -887,7 +816,6 @@ UBGraphicsScene* UBSvgSubsetAdaptor::UBSvgSubsetReader::loadScene()
else if (src.contains(".wgt")) else if (src.contains(".wgt"))
{ {
UBGraphicsW3CWidgetItem* w3cWidgetItem = graphicsW3CWidgetFromSvg(); UBGraphicsW3CWidgetItem* w3cWidgetItem = graphicsW3CWidgetFromSvg();
if (w3cWidgetItem) if (w3cWidgetItem)
{ {
w3cWidgetItem->setFlag(QGraphicsItem::ItemIsSelectable, true); w3cWidgetItem->setFlag(QGraphicsItem::ItemIsSelectable, true);
@ -896,12 +824,6 @@ UBGraphicsScene* UBSvgSubsetAdaptor::UBSvgSubsetReader::loadScene()
mScene->addItem(w3cWidgetItem); mScene->addItem(w3cWidgetItem);
if (zFromSvg != UBZLayerController::errorNum())
UBGraphicsItem::assignZValue(w3cWidgetItem, zFromSvg);
if (!uuidFromSvg.isNull())
w3cWidgetItem->setUuid(uuidFromSvg);
w3cWidgetItem->show(); w3cWidgetItem->show();
currentWidget = w3cWidgetItem; currentWidget = w3cWidgetItem;
@ -910,7 +832,6 @@ UBGraphicsScene* UBSvgSubsetAdaptor::UBSvgSubsetReader::loadScene()
else if (type == "text") else if (type == "text")
{ {
UBGraphicsTextItem* textItem = textItemFromSvg(); UBGraphicsTextItem* textItem = textItemFromSvg();
UBGraphicsTextItemDelegate *textDelegate = 0; UBGraphicsTextItemDelegate *textDelegate = 0;
if (textItem) if (textItem)
@ -931,12 +852,6 @@ UBGraphicsScene* UBSvgSubsetAdaptor::UBSvgSubsetReader::loadScene()
mScene->addItem(textItem); mScene->addItem(textItem);
if (zFromSvg != UBZLayerController::errorNum())
UBGraphicsItem::assignZValue(textItem, zFromSvg);
if (!uuidFromSvg.isNull())
textItem->setUuid(uuidFromSvg);
textItem->show(); textItem->show();
} }
} }
@ -991,9 +906,8 @@ UBGraphicsScene* UBSvgSubsetAdaptor::UBSvgSubsetReader::loadScene()
mScene->addItem(iterator.value()); mScene->addItem(iterator.value());
} }
if (mScene) { if (mScene)
mScene->setModified(false); mScene->setModified(false);
}
mScene->enableUndoRedoStack(); mScene->enableUndoRedoStack();
qDebug() << "loadScene() : created scene and read file"; qDebug() << "loadScene() : created scene and read file";
@ -1213,24 +1127,25 @@ bool UBSvgSubsetAdaptor::UBSvgSubsetWriter::persistScene(int pageIndex)
foreach(QGraphicsItem* item, strokesGroupItem->childItems()) { foreach(QGraphicsItem* item, strokesGroupItem->childItems()) {
UBGraphicsPolygonItem* poly = qgraphicsitem_cast<UBGraphicsPolygonItem*>(item); UBGraphicsPolygonItem* poly = qgraphicsitem_cast<UBGraphicsPolygonItem*>(item);
if (!poly) { if (!poly)
continue; continue;
} else if (!resultPoly) { if (!resultPoly) {
resultPoly = poly; resultPoly = poly;
continue; continue;
} }
QPolygonF newPolygon = poly->sceneTransform().map(poly->polygon());
QPainterPath strokePainterPath;
strokePainterPath.addPolygon(resultPoly->sceneTransform().map(resultPoly->polygon()));
QPolygonF oldPolygons = strokePainterPath.simplified().toFillPolygon(resultPoly->sceneTransform().inverted());
newPolygon = oldPolygons.united(newPolygon);
resultPoly->setPolygon(newPolygon);
// QPolygonF unitedPolygon = resultPoly->polygon().united(poly->polygon());
resultPoly->setPolygon(unitedPolygon);
items.removeOne(poly); items.removeOne(poly);
} }
if (resultPoly) { if (resultPoly) {
polygonItemToSvgPolygon(resultPoly, true); resultPoly->setZValue(strokesGroupItem->zValue());
//Claudio: the painter path simplification remove all the polygons overlap
QPainterPath painterPath;
painterPath.addPolygon(resultPoly->polygon());
painterPath = painterPath.simplified();
resultPoly->setPolygon(painterPath.toFillPolygon());
polygonItemToSvgPolygon(resultPoly, false);
items.removeOne(resultPoly); items.removeOne(resultPoly);
} }
} }
@ -1239,9 +1154,7 @@ bool UBSvgSubsetAdaptor::UBSvgSubsetWriter::persistScene(int pageIndex)
UBGraphicsPolygonItem *polygonItem = qgraphicsitem_cast<UBGraphicsPolygonItem*> (item); UBGraphicsPolygonItem *polygonItem = qgraphicsitem_cast<UBGraphicsPolygonItem*> (item);
if (polygonItem && polygonItem->isVisible()) if (polygonItem && polygonItem->isVisible())
{ {
UBGraphicsStroke* currentStroke = polygonItem->stroke(); UBGraphicsStroke* currentStroke = polygonItem->stroke();
if (openStroke && (currentStroke != openStroke)) if (openStroke && (currentStroke != openStroke))
{ {
mXmlWriter.writeEndElement(); //g mXmlWriter.writeEndElement(); //g
@ -1514,7 +1427,7 @@ void UBSvgSubsetAdaptor::UBSvgSubsetWriter::persistGroupToDom(QGraphicsItem *gro
foreach (QGraphicsItem *item, groupItem->childItems()) { foreach (QGraphicsItem *item, groupItem->childItems()) {
QUuid tmpUuid = UBGraphicsScene::getPersonalUuid(item); QUuid tmpUuid = UBGraphicsScene::getPersonalUuid(item);
if (!tmpUuid.isNull()) { if (!tmpUuid.isNull()) {
if (item->type() == UBGraphicsGroupContainerItem::Type && item->childItems().count()) { if (item->type() == UBGraphicsGroupContainerItem::Type && item->childItems().count())
persistGroupToDom(item, curParent, groupDomDocument); persistGroupToDom(item, curParent, groupDomDocument);
} }
else { else {
@ -1525,7 +1438,6 @@ void UBSvgSubsetAdaptor::UBSvgSubsetWriter::persistGroupToDom(QGraphicsItem *gro
} }
} }
} }
}
} }
void UBSvgSubsetAdaptor::UBSvgSubsetWriter::polygonItemToSvgLine(UBGraphicsPolygonItem* polygonItem, bool groupHoldsInfo) void UBSvgSubsetAdaptor::UBSvgSubsetWriter::polygonItemToSvgLine(UBGraphicsPolygonItem* polygonItem, bool groupHoldsInfo)
@ -1694,26 +1606,15 @@ UBGraphicsPolygonItem* UBSvgSubsetAdaptor::UBSvgSubsetReader::polygonItemFromPol
{ {
UBGraphicsPolygonItem* polygonItem = new UBGraphicsPolygonItem(); UBGraphicsPolygonItem* polygonItem = new UBGraphicsPolygonItem();
graphicsItemFromSvg(polygonItem);
QStringRef svgPoints = mXmlReader.attributes().value("points"); QStringRef svgPoints = mXmlReader.attributes().value("points");
QPolygonF polygon; QPolygonF polygon;
if (!svgPoints.isNull()) if (!svgPoints.isNull())
{ {
// int lenght = strlen(svgPoints.toUtf8().constData()) + 1; QStringList ts = svgPoints.toString().split(QLatin1Char(' '), QString::SkipEmptyParts);
// char pippo[lenght];
// memcpy(pippo,svgPoints.toUtf8().constData(),lenght);
// char* localPosition = (char*) &pippo[0];
// do{
// float x = atof(localPosition);
// localPosition = strchr(localPosition,',') + 1;
// float y = atof(localPosition);
// localPosition = strchrnul(localPosition,' ');
// polygon << QPointF(x,y);
// }while(localPosition - pippo > lenght - 5);
QStringList ts = svgPoints.toString().split(QLatin1Char(' '),
QString::SkipEmptyParts);
foreach(const QString sPoint, ts) foreach(const QString sPoint, ts)
{ {
@ -1748,26 +1649,13 @@ UBGraphicsPolygonItem* UBSvgSubsetAdaptor::UBSvgSubsetReader::polygonItemFromPol
polygonItem->setPolygon(polygon); polygonItem->setPolygon(polygon);
QStringRef svgTransform = mXmlReader.attributes().value("transform");
QMatrix itemMatrix;
if (!svgTransform.isNull())
{
itemMatrix = fromSvgTransform(svgTransform.toString());
polygonItem->setMatrix(itemMatrix);
}
QStringRef svgFill = mXmlReader.attributes().value("fill"); QStringRef svgFill = mXmlReader.attributes().value("fill");
QColor brushColor = pDefaultColor; QColor brushColor = pDefaultColor;
if (!svgFill.isNull()) if (!svgFill.isNull())
{
brushColor.setNamedColor(svgFill.toString()); brushColor.setNamedColor(svgFill.toString());
}
QStringRef svgFillOpacity = mXmlReader.attributes().value("fill-opacity"); QStringRef svgFillOpacity = mXmlReader.attributes().value("fill-opacity");
qreal opacity = 1.0; qreal opacity = 1.0;
@ -1779,17 +1667,6 @@ UBGraphicsPolygonItem* UBSvgSubsetAdaptor::UBSvgSubsetReader::polygonItemFromPol
polygonItem->setColor(brushColor); polygonItem->setColor(brushColor);
QStringRef ubZValue = mXmlReader.attributes().value(mNamespaceUri, "z-value");
if (!ubZValue.isNull())
{
UBGraphicsItem::assignZValue(polygonItem, ubZValue.toString().toFloat());
}
else
{
UBGraphicsItem::assignZValue(polygonItem, mGroupZIndex);
}
QStringRef ubFillOnDarkBackground = mXmlReader.attributes().value(mNamespaceUri, "fill-on-dark-background"); QStringRef ubFillOnDarkBackground = mXmlReader.attributes().value(mNamespaceUri, "fill-on-dark-background");
if (!ubFillOnDarkBackground.isNull()) if (!ubFillOnDarkBackground.isNull())
@ -1864,6 +1741,7 @@ UBGraphicsPolygonItem* UBSvgSubsetAdaptor::UBSvgSubsetReader::polygonItemFromLin
} }
UBGraphicsPolygonItem* polygonItem = new UBGraphicsPolygonItem(line, lineWidth); UBGraphicsPolygonItem* polygonItem = new UBGraphicsPolygonItem(line, lineWidth);
graphicsItemFromSvg(polygonItem);
QStringRef svgStroke = mXmlReader.attributes().value("stroke"); QStringRef svgStroke = mXmlReader.attributes().value("stroke");
@ -1886,18 +1764,6 @@ UBGraphicsPolygonItem* UBSvgSubsetAdaptor::UBSvgSubsetReader::polygonItemFromLin
polygonItem->setColor(brushColor); polygonItem->setColor(brushColor);
QStringRef ubZValue = mXmlReader.attributes().value(mNamespaceUri, "z-value");
if (!ubZValue.isNull())
{
UBGraphicsItem::assignZValue(polygonItem, ubZValue.toString().toFloat());
}
else
{
UBGraphicsItem::assignZValue(polygonItem, mGroupZIndex);
}
QStringRef ubFillOnDarkBackground = mXmlReader.attributes().value(mNamespaceUri, "fill-on-dark-background"); QStringRef ubFillOnDarkBackground = mXmlReader.attributes().value(mNamespaceUri, "fill-on-dark-background");
if (!ubFillOnDarkBackground.isNull()) if (!ubFillOnDarkBackground.isNull())
@ -2288,24 +2154,21 @@ UBGraphicsMediaItem* UBSvgSubsetAdaptor::UBSvgSubsetReader::audioItemFromSvg()
//Claudio this is necessary to fix the absolute path added on Sankore 3.1 1.00.00 //Claudio this is necessary to fix the absolute path added on Sankore 3.1 1.00.00
//The absoult path doesn't work when you want to share Sankore documents. //The absoult path doesn't work when you want to share Sankore documents.
if(!href.startsWith("audios/")){ if(!audioHref.startsWith("audios/")){
int indexOfAudioDirectory = href.lastIndexOf("audios"); int indexOfAudioDirectory = href.lastIndexOf("audios");
href = mDocumentPath + "/" + href.right(href.length() - indexOfAudioDirectory); href = mDocumentPath + "/" + href.right(href.length() - indexOfAudioDirectory);
} }
UBGraphicsMediaItem* audioItem = new UBGraphicsMediaItem(QUrl::fromLocalFile(href)); UBGraphicsMediaItem* audioItem = new UBGraphicsMediaItem(QUrl::fromLocalFile(href));
if(audioItem){ if(audioItem)
audioItem->connect(UBApplication::boardController, SIGNAL(activeSceneChanged()), audioItem, SLOT(activeSceneChanged())); audioItem->connect(UBApplication::boardController, SIGNAL(activeSceneChanged()), audioItem, SLOT(activeSceneChanged()));
}
graphicsItemFromSvg(audioItem); graphicsItemFromSvg(audioItem);
QStringRef ubPos = mXmlReader.attributes().value(mNamespaceUri, "position"); QStringRef ubPos = mXmlReader.attributes().value(mNamespaceUri, "position");
qint64 p = 0; qint64 p = 0;
if (!ubPos.isNull()) if (!ubPos.isNull())
{
p = ubPos.toString().toLongLong(); p = ubPos.toString().toLongLong();
}
audioItem->setInitialPos(p); audioItem->setInitialPos(p);
return audioItem; return audioItem;
@ -2326,7 +2189,7 @@ UBGraphicsMediaItem* UBSvgSubsetAdaptor::UBSvgSubsetReader::videoItemFromSvg()
//Claudio this is necessary to fix the absolute path added on Sankore 3.1 1.00.00 //Claudio this is necessary to fix the absolute path added on Sankore 3.1 1.00.00
//The absoult path doesn't work when you want to share Sankore documents. //The absoult path doesn't work when you want to share Sankore documents.
if(!href.startsWith("videos/")){ if(!videoHref.startsWith("videos/")){
int indexOfAudioDirectory = href.lastIndexOf("videos"); int indexOfAudioDirectory = href.lastIndexOf("videos");
href = mDocumentPath + "/" + href.right(href.length() - indexOfAudioDirectory); href = mDocumentPath + "/" + href.right(href.length() - indexOfAudioDirectory);
} }
@ -2380,9 +2243,9 @@ void UBSvgSubsetAdaptor::UBSvgSubsetReader::graphicsItemFromSvg(QGraphicsItem* g
{ {
if (!svgX.isNull() && !svgY.isNull()) if (!svgX.isNull() && !svgY.isNull())
{ {
#ifdef Q_WS_WIN #ifdef Q_WS_WIN
gItem->setPos(svgX.toString().toFloat(), svgY.toString().toFloat()); gItem->setPos(svgX.toString().toFloat(), svgY.toString().toFloat());
#endif #endif
} }
} }
@ -2402,9 +2265,7 @@ void UBSvgSubsetAdaptor::UBSvgSubsetReader::graphicsItemFromSvg(QGraphicsItem* g
QStringRef ubZValue = mXmlReader.attributes().value(mNamespaceUri, "z-value"); QStringRef ubZValue = mXmlReader.attributes().value(mNamespaceUri, "z-value");
if (!ubZValue.isNull()) if (!ubZValue.isNull())
{
UBGraphicsItem::assignZValue(gItem, ubZValue.toString().toFloat()); UBGraphicsItem::assignZValue(gItem, ubZValue.toString().toFloat());
}
UBItem* ubItem = dynamic_cast<UBItem*>(gItem); UBItem* ubItem = dynamic_cast<UBItem*>(gItem);
@ -2413,17 +2274,15 @@ void UBSvgSubsetAdaptor::UBSvgSubsetReader::graphicsItemFromSvg(QGraphicsItem* g
QStringRef ubUuid = mXmlReader.attributes().value(mNamespaceUri, "uuid"); QStringRef ubUuid = mXmlReader.attributes().value(mNamespaceUri, "uuid");
if (!ubUuid.isNull()) if (!ubUuid.isNull())
{
ubItem->setUuid(QUuid(ubUuid.toString())); ubItem->setUuid(QUuid(ubUuid.toString()));
} else
ubItem->setUuid(QUuid::createUuid());
QStringRef ubSource = mXmlReader.attributes().value(mNamespaceUri, "source"); QStringRef ubSource = mXmlReader.attributes().value(mNamespaceUri, "source");
if (!ubSource.isNull()) if (!ubSource.isNull())
{
ubItem->setSourceUrl(QUrl(ubSource.toString())); ubItem->setSourceUrl(QUrl(ubSource.toString()));
} }
}
QStringRef ubLocked = mXmlReader.attributes().value(mNamespaceUri, "locked"); QStringRef ubLocked = mXmlReader.attributes().value(mNamespaceUri, "locked");
@ -2449,35 +2308,10 @@ void UBSvgSubsetAdaptor::UBSvgSubsetReader::graphicsItemFromSvg(QGraphicsItem* g
int layerAsInt = ubLayer.toString().toInt(&ok); int layerAsInt = ubLayer.toString().toInt(&ok);
if (ok) if (ok)
{
gItem->setData(UBGraphicsItemData::ItemLayerType, QVariant(layerAsInt)); gItem->setData(UBGraphicsItemData::ItemLayerType, QVariant(layerAsInt));
} }
}
}
qreal UBSvgSubsetAdaptor::UBSvgSubsetReader::getZValueFromSvg()
{
qreal result = UBZLayerController::errorNum();
QStringRef ubZValue = mXmlReader.attributes().value(mNamespaceUri, "z-value");
if (!ubZValue.isNull()) {
result = ubZValue.toString().toFloat();
}
return result;
}
QUuid UBSvgSubsetAdaptor::UBSvgSubsetReader::getUuidFromSvg()
{
QString strUuid = mXmlReader.attributes().value(mNamespaceUri, "uuid").toString();
QUuid uuid = QUuid(strUuid);
if (!uuid.isNull())
return uuid;
return QUuid::createUuid();
} }
void UBSvgSubsetAdaptor::UBSvgSubsetWriter::graphicsItemToSvg(QGraphicsItem* item) void UBSvgSubsetAdaptor::UBSvgSubsetWriter::graphicsItemToSvg(QGraphicsItem* item)
{ {
mXmlWriter.writeAttribute("x", "0"); mXmlWriter.writeAttribute("x", "0");
@ -2769,6 +2603,7 @@ UBGraphicsTextItem* UBSvgSubsetAdaptor::UBSvgSubsetReader::textItemFromSvg()
if (mXmlReader.hasError()) if (mXmlReader.hasError())
{ {
delete textItem; delete textItem;
textItem = 0;
return 0; return 0;
} }
@ -3299,9 +3134,3 @@ void UBSvgSubsetAdaptor::convertSvgImagesToImages(UBDocumentProxy* proxy)
} }
} }
} }

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2012 Webdoc SA * Copyright (C) 2010-2013 Groupement d'Intérêt Public pour l'Education Numérique en Afrique (GIP ENA)
* *
* This file is part of Open-Sankoré. * This file is part of Open-Sankoré.
* *
@ -158,9 +158,6 @@ class UBSvgSubsetAdaptor
void graphicsItemFromSvg(QGraphicsItem* gItem); void graphicsItemFromSvg(QGraphicsItem* gItem);
qreal getZValueFromSvg();
QUuid getUuidFromSvg();
QXmlStreamReader mXmlReader; QXmlStreamReader mXmlReader;
int mFileVersion; int mFileVersion;
UBDocumentProxy *mProxy; UBDocumentProxy *mProxy;

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2012 Webdoc SA * Copyright (C) 2010-2013 Groupement d'Intérêt Public pour l'Education Numérique en Afrique (GIP ENA)
* *
* This file is part of Open-Sankoré. * This file is part of Open-Sankoré.
* *

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2012 Webdoc SA * Copyright (C) 2010-2013 Groupement d'Intérêt Public pour l'Education Numérique en Afrique (GIP ENA)
* *
* This file is part of Open-Sankoré. * This file is part of Open-Sankoré.
* *

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2012 Webdoc SA * Copyright (C) 2010-2013 Groupement d'Intérêt Public pour l'Education Numérique en Afrique (GIP ENA)
* *
* This file is part of Open-Sankoré. * This file is part of Open-Sankoré.
* *

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2012 Webdoc SA * Copyright (C) 2010-2013 Groupement d'Intérêt Public pour l'Education Numérique en Afrique (GIP ENA)
* *
* This file is part of Open-Sankoré. * This file is part of Open-Sankoré.
* *

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2012 Webdoc SA * Copyright (C) 2010-2013 Groupement d'Intérêt Public pour l'Education Numérique en Afrique (GIP ENA)
* *
* This file is part of Open-Sankoré. * This file is part of Open-Sankoré.
* *

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2012 Webdoc SA * Copyright (C) 2010-2013 Groupement d'Intérêt Public pour l'Education Numérique en Afrique (GIP ENA)
* *
* This file is part of Open-Sankoré. * This file is part of Open-Sankoré.
* *

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2012 Webdoc SA * Copyright (C) 2010-2013 Groupement d'Intérêt Public pour l'Education Numérique en Afrique (GIP ENA)
* *
* This file is part of Open-Sankoré. * This file is part of Open-Sankoré.
* *

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2012 Webdoc SA * Copyright (C) 2010-2013 Groupement d'Intérêt Public pour l'Education Numérique en Afrique (GIP ENA)
* *
* This file is part of Open-Sankoré. * This file is part of Open-Sankoré.
* *

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2012 Webdoc SA * Copyright (C) 2010-2013 Groupement d'Intérêt Public pour l'Education Numérique en Afrique (GIP ENA)
* *
* This file is part of Open-Sankoré. * This file is part of Open-Sankoré.
* *

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2012 Webdoc SA * Copyright (C) 2010-2013 Groupement d'Intérêt Public pour l'Education Numérique en Afrique (GIP ENA)
* *
* This file is part of Open-Sankoré. * This file is part of Open-Sankoré.
* *

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2012 Webdoc SA * Copyright (C) 2010-2013 Groupement d'Intérêt Public pour l'Education Numérique en Afrique (GIP ENA)
* *
* This file is part of Open-Sankoré. * This file is part of Open-Sankoré.
* *

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2012 Webdoc SA * Copyright (C) 2010-2013 Groupement d'Intérêt Public pour l'Education Numérique en Afrique (GIP ENA)
* *
* This file is part of Open-Sankoré. * This file is part of Open-Sankoré.
* *

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2012 Webdoc SA * Copyright (C) 2010-2013 Groupement d'Intérêt Public pour l'Education Numérique en Afrique (GIP ENA)
* *
* This file is part of Open-Sankoré. * This file is part of Open-Sankoré.
* *

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2012 Webdoc SA * Copyright (C) 2010-2013 Groupement d'Intérêt Public pour l'Education Numérique en Afrique (GIP ENA)
* *
* This file is part of Open-Sankoré. * This file is part of Open-Sankoré.
* *

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2012 Webdoc SA * Copyright (C) 2010-2013 Groupement d'Intérêt Public pour l'Education Numérique en Afrique (GIP ENA)
* *
* This file is part of Open-Sankoré. * This file is part of Open-Sankoré.
* *

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2012 Webdoc SA * Copyright (C) 2010-2013 Groupement d'Intérêt Public pour l'Education Numérique en Afrique (GIP ENA)
* *
* This file is part of Open-Sankoré. * This file is part of Open-Sankoré.
* *

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2012 Webdoc SA * Copyright (C) 2010-2013 Groupement d'Intérêt Public pour l'Education Numérique en Afrique (GIP ENA)
* *
* This file is part of Open-Sankoré. * This file is part of Open-Sankoré.
* *
@ -358,9 +358,7 @@ void UBBoardController::setupToolbar()
void UBBoardController::setToolCursor(int tool) void UBBoardController::setToolCursor(int tool)
{ {
if (mActiveScene) if (mActiveScene)
{
mActiveScene->setToolCursor(tool); mActiveScene->setToolCursor(tool);
}
mControlView->setToolCursor(tool); mControlView->setToolCursor(tool);
} }
@ -1893,10 +1891,7 @@ void UBBoardController::updateSystemScaleFactor()
} }
if (mSystemScaleFactor != newScaleFactor) if (mSystemScaleFactor != newScaleFactor)
{
mSystemScaleFactor = newScaleFactor; mSystemScaleFactor = newScaleFactor;
emit systemScaleFactorChanged(newScaleFactor);
}
UBGraphicsScene::SceneViewState viewState = mActiveScene->viewState(); UBGraphicsScene::SceneViewState viewState = mActiveScene->viewState();
@ -1961,13 +1956,8 @@ void UBBoardController::setPageSize(QSize newSize)
void UBBoardController::notifyCache(bool visible) void UBBoardController::notifyCache(bool visible)
{ {
if(visible) if(visible)
{
emit cacheEnabled(); emit cacheEnabled();
}
else
{
emit cacheDisabled();
}
mCacheWidgetIsEnabled = visible; mCacheWidgetIsEnabled = visible;
} }

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2012 Webdoc SA * Copyright (C) 2010-2013 Groupement d'Intérêt Public pour l'Education Numérique en Afrique (GIP ENA)
* *
* This file is part of Open-Sankoré. * This file is part of Open-Sankoré.
* *
@ -149,7 +149,7 @@ class UBBoardController : public UBDocumentContainer
void setBoxing(QRect displayRect); void setBoxing(QRect displayRect);
void setToolbarTexts(); void setToolbarTexts();
static QUrl expandWidgetToTempDir(const QByteArray& pZipedData, const QString& pExtension = QString("wgt")); static QUrl expandWidgetToTempDir(const QByteArray& pZipedData, const QString& pExtension = QString("wgt"));
// static QRect freeRectInGlobalPos() const {return ;}
void setPageSize(QSize newSize); void setPageSize(QSize newSize);
UBBoardPaletteManager *paletteManager() UBBoardPaletteManager *paletteManager()
{ {
@ -239,12 +239,10 @@ class UBBoardController : public UBDocumentContainer
void newPageAdded(); void newPageAdded();
void activeSceneChanged(); void activeSceneChanged();
void zoomChanged(qreal pZoomFactor); void zoomChanged(qreal pZoomFactor);
void systemScaleFactorChanged(qreal pSystemScaleFactor);
void penColorChanged(); void penColorChanged();
void controlViewportChanged(); void controlViewportChanged();
void backgroundChanged(); void backgroundChanged();
void cacheEnabled(); void cacheEnabled();
void cacheDisabled();
void documentReorganized(int index); void documentReorganized(int index);
void displayMetadata(QMap<QString, QString> metadata); void displayMetadata(QMap<QString, QString> metadata);
void pageSelectionChanged(int index); void pageSelectionChanged(int index);

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2012 Webdoc SA * Copyright (C) 2010-2013 Groupement d'Intérêt Public pour l'Education Numérique en Afrique (GIP ENA)
* *
* This file is part of Open-Sankoré. * This file is part of Open-Sankoré.
* *
@ -175,7 +175,7 @@ void UBBoardPaletteManager::setupDockPaletteWidgets()
void UBBoardPaletteManager::slot_changeMainMode(UBApplicationController::MainMode mainMode) void UBBoardPaletteManager::slot_changeMainMode(UBApplicationController::MainMode mainMode)
{ {
// Board = 0, Internet, Document, Tutorial, ParaschoolEditor, WebDocument // Board = 0, Internet, Document, Tutorial, WebDocument
switch( mainMode ) switch( mainMode )
{ {
@ -821,8 +821,6 @@ void UBBoardPaletteManager::changeMode(eUBDockPaletteWidgetMode newMode, bool is
if( !isInit ) if( !isInit )
UBApplication::boardController->notifyPageChanged(); UBApplication::boardController->notifyPageChanged();
emit signal_changeMode(newMode);
} }
void UBBoardPaletteManager::addItem(const QPixmap& pPixmap, const QPointF& pos, qreal scaleFactor, const QUrl& sourceUrl) void UBBoardPaletteManager::addItem(const QPixmap& pPixmap, const QPointF& pos, qreal scaleFactor, const QUrl& sourceUrl)
@ -970,11 +968,6 @@ void UBBoardPaletteManager::changeStylusPaletteOrientation(QVariant var)
} }
void UBBoardPaletteManager::connectToDocumentController()
{
emit connectToDocController();
}
void UBBoardPaletteManager::refreshPalettes() void UBBoardPaletteManager::refreshPalettes()
{ {
mRightPalette->update(); mRightPalette->update();

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2012 Webdoc SA * Copyright (C) 2010-2013 Groupement d'Intérêt Public pour l'Education Numérique en Afrique (GIP ENA)
* *
* This file is part of Open-Sankoré. * This file is part of Open-Sankoré.
* *
@ -64,7 +64,6 @@ class UBBoardPaletteManager : public QObject
UBActionPalette *addItemPalette() {return mAddItemPalette;} UBActionPalette *addItemPalette() {return mAddItemPalette;}
void showVirtualKeyboard(bool show = true); void showVirtualKeyboard(bool show = true);
void initPalettesPosAtStartup(); void initPalettesPosAtStartup();
void connectToDocumentController();
void refreshPalettes(); void refreshPalettes();
UBKeyboardPalette *mKeyboardPalette; UBKeyboardPalette *mKeyboardPalette;
@ -79,10 +78,6 @@ class UBBoardPaletteManager : public QObject
void startDownloads(); void startDownloads();
void stopDownloads(); void stopDownloads();
signals:
void connectToDocController();
void signal_changeMode(eUBDockPaletteWidgetMode newMode);
public slots: public slots:
void activeSceneChanged(); void activeSceneChanged();

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2012 Webdoc SA * Copyright (C) 2010-2013 Groupement d'Intérêt Public pour l'Education Numérique en Afrique (GIP ENA)
* *
* This file is part of Open-Sankoré. * This file is part of Open-Sankoré.
* *
@ -80,18 +80,18 @@
#include "core/memcheck.h" #include "core/memcheck.h"
UBBoardView::UBBoardView (UBBoardController* pController, QWidget* pParent, bool isControl, bool isDesktop) UBBoardView::UBBoardView (UBBoardController* pController, QWidget* pParent, bool isControl, bool isDesktop)
: QGraphicsView (pParent) : QGraphicsView (pParent)
, mController (pController) , mController (pController)
, mIsCreatingTextZone (false) , mIsCreatingTextZone (false)
, mIsCreatingSceneGrabZone (false) , mIsCreatingSceneGrabZone (false)
, mOkOnWidget(false) , mOkOnWidget(false)
, suspendedMousePressEvent(NULL) , suspendedMousePressEvent(NULL)
, mLongPressInterval(1000) , mLongPressInterval(1000)
, mIsDragInProgress(false) , mIsDragInProgress(false)
, mMultipleSelectionIsEnabled(false) , mMultipleSelectionIsEnabled(false)
, bIsControl(isControl) , bIsControl(isControl)
, bIsDesktop(isDesktop) , bIsDesktop(isDesktop)
, mRubberBandInPlayMode(false) //enables rubberband with play tool , mRubberBandInPlayMode(false) //enables rubberband with play tool
{ {
init (); init ();
@ -102,14 +102,14 @@ UBBoardView::UBBoardView (UBBoardController* pController, QWidget* pParent, bool
} }
UBBoardView::UBBoardView (UBBoardController* pController, int pStartLayer, int pEndLayer, QWidget* pParent, bool isControl, bool isDesktop) UBBoardView::UBBoardView (UBBoardController* pController, int pStartLayer, int pEndLayer, QWidget* pParent, bool isControl, bool isDesktop)
: QGraphicsView (pParent) : QGraphicsView (pParent)
, mController (pController) , mController (pController)
, suspendedMousePressEvent(NULL) , suspendedMousePressEvent(NULL)
, mLongPressInterval(1000) , mLongPressInterval(1000)
, mIsDragInProgress(false) , mIsDragInProgress(false)
, mMultipleSelectionIsEnabled(false) , mMultipleSelectionIsEnabled(false)
, bIsControl(isControl) , bIsControl(isControl)
, bIsDesktop(isDesktop) , bIsDesktop(isDesktop)
{ {
init (); init ();
@ -122,10 +122,12 @@ UBBoardView::UBBoardView (UBBoardController* pController, int pStartLayer, int p
mLongPressTimer.setSingleShot(true); mLongPressTimer.setSingleShot(true);
} }
UBBoardView::~UBBoardView () { UBBoardView::~UBBoardView ()
//NOOP {
if (suspendedMousePressEvent) if (suspendedMousePressEvent){
delete suspendedMousePressEvent; delete suspendedMousePressEvent;
suspendedMousePressEvent = NULL;
}
} }
void UBBoardView::init () void UBBoardView::init ()
@ -139,6 +141,8 @@ void UBBoardView::init ()
connect (UBSettings::settings ()->boardUseHighResTabletEvent, SIGNAL (changed (QVariant)), connect (UBSettings::settings ()->boardUseHighResTabletEvent, SIGNAL (changed (QVariant)),
this, SLOT (settingChanged (QVariant))); this, SLOT (settingChanged (QVariant)));
setOptimizationFlags (QGraphicsView::IndirectPainting | QGraphicsView::DontSavePainterState); // enable UBBoardView::drawItems filter
setViewportUpdateMode(QGraphicsView::SmartViewportUpdate);
setWindowFlags (Qt::FramelessWindowHint); setWindowFlags (Qt::FramelessWindowHint);
setFrameStyle (QFrame::NoFrame); setFrameStyle (QFrame::NoFrame);
setRenderHints (QPainter::Antialiasing | QPainter::SmoothPixmapTransform | QPainter::TextAntialiasing); setRenderHints (QPainter::Antialiasing | QPainter::SmoothPixmapTransform | QPainter::TextAntialiasing);
@ -146,9 +150,6 @@ void UBBoardView::init ()
setHorizontalScrollBarPolicy (Qt::ScrollBarAlwaysOff); setHorizontalScrollBarPolicy (Qt::ScrollBarAlwaysOff);
setAcceptDrops (true); setAcceptDrops (true);
setOptimizationFlags (QGraphicsView::IndirectPainting | QGraphicsView::DontSavePainterState); // enable UBBoardView::drawItems filter
setViewportUpdateMode(QGraphicsView::SmartViewportUpdate);
mTabletStylusIsPressed = false; mTabletStylusIsPressed = false;
mMouseButtonIsPressed = false; mMouseButtonIsPressed = false;
mPendingStylusReleaseEvent = false; mPendingStylusReleaseEvent = false;
@ -170,28 +171,13 @@ void UBBoardView::init ()
mWidgetMoved = false; mWidgetMoved = false;
} }
UBGraphicsScene* UBGraphicsScene* UBBoardView::scene ()
UBBoardView::scene ()
{ {
return qobject_cast<UBGraphicsScene*> (QGraphicsView::scene ()); return qobject_cast<UBGraphicsScene*> (QGraphicsView::scene ());
} }
void
UBBoardView::hideEvent (QHideEvent * event)
{
Q_UNUSED (event);
emit hidden ();
}
void void UBBoardView::keyPressEvent (QKeyEvent *event)
UBBoardView::showEvent (QShowEvent * event)
{
Q_UNUSED (event);
emit shown ();
}
void
UBBoardView::keyPressEvent (QKeyEvent *event)
{ {
// send to the scene anyway // send to the scene anyway
QApplication::sendEvent (scene (), event); QApplication::sendEvent (scene (), event);
@ -304,20 +290,14 @@ UBBoardView::keyPressEvent (QKeyEvent *event)
void UBBoardView::keyReleaseEvent(QKeyEvent *event) void UBBoardView::keyReleaseEvent(QKeyEvent *event)
{ {
// if (!event->isAccepted ())
{ if (Qt::Key_Shift == event->key() ||Qt::Key_Control == event->key())
if (Qt::Key_Shift == event->key()
||Qt::Key_Control == event->key())
{
setMultiselection(false); setMultiselection(false);
}
}
QGraphicsView::keyReleaseEvent(event); QGraphicsView::keyReleaseEvent(event);
} }
bool bool UBBoardView::event (QEvent * e)
UBBoardView::event (QEvent * e)
{ {
if (e->type () == QEvent::Gesture) if (e->type () == QEvent::Gesture)
{ {
@ -462,14 +442,13 @@ bool UBBoardView::itemHaveParentWithType(QGraphicsItem *item, int type)
return itemHaveParentWithType(item->parentItem(), type); return itemHaveParentWithType(item->parentItem(), type);
} }
bool UBBoardView::isUBItem(QGraphicsItem *item) bool UBBoardView::isUBItem(QGraphicsItem *item)
{ {
if ((UBGraphicsItemType::UserTypesCount > item->type()) && (item->type() > QGraphicsItem::UserType)) if ((UBGraphicsItemType::UserTypesCount > item->type()) && (item->type() > QGraphicsItem::UserType))
return true; return true;
else
{
return false; return false;
}
} }
bool UBBoardView::isCppTool(QGraphicsItem *item) bool UBBoardView::isCppTool(QGraphicsItem *item)
@ -483,12 +462,12 @@ bool UBBoardView::isCppTool(QGraphicsItem *item)
void UBBoardView::handleItemsSelection(QGraphicsItem *item) void UBBoardView::handleItemsSelection(QGraphicsItem *item)
{ {
// we need to select new pressed itemOnBoard and deselect all other items. // we need to select new pressed itemOnBoard and deselect all other items.
// the trouble is in: // the trouble is in:
// some items can has parents (groupped items or strokes, or strokes in groups). // some items can has parents (groupped items or strokes, or strokes in groups).
// some items is already selected and we don't need to reselect them // some items is already selected and we don't need to reselect them
// //
// item selection managed by QGraphicsView::mousePressEvent(). It should be called later. // item selection managed by QGraphicsView::mousePressEvent(). It should be called later.
if (item) if (item)
{ {
@ -531,7 +510,7 @@ void UBBoardView::handleItemsSelection(QGraphicsItem *item)
bool UBBoardView::itemShouldReceiveMousePressEvent(QGraphicsItem *item) bool UBBoardView::itemShouldReceiveMousePressEvent(QGraphicsItem *item)
{ {
/* /*
Some items should receive mouse press events averytime, Some items should receive mouse press events averytime,
some items should receive that events when they are selected, some items should receive that events when they are selected,
some items shouldn't receive mouse press events at mouse press, but should receive them at mouse release (suspended mouse press event) some items shouldn't receive mouse press events at mouse press, but should receive them at mouse release (suspended mouse press event)
@ -571,6 +550,8 @@ Here we determines cases when items should to get mouse press event at pressing
case UBGraphicsSvgItem::Type: case UBGraphicsSvgItem::Type:
case UBGraphicsPixmapItem::Type: case UBGraphicsPixmapItem::Type:
case UBGraphicsTextItem::Type: case UBGraphicsTextItem::Type:
if (currentTool == UBStylusTool::Play)
return true;
if ((currentTool == UBStylusTool::Selector) && item->isSelected()) if ((currentTool == UBStylusTool::Selector) && item->isSelected())
return true; return true;
if ((currentTool == UBStylusTool::Selector) && item->parentItem() && item->parentItem()->isSelected()) if ((currentTool == UBStylusTool::Selector) && item->parentItem() && item->parentItem()->isSelected())
@ -578,19 +559,19 @@ Here we determines cases when items should to get mouse press event at pressing
if (currentTool != UBStylusTool::Selector) if (currentTool != UBStylusTool::Selector)
return false; return false;
break; break;
case UBGraphicsItemType::StrokeItemType:
// Groups shouldn't reacts on any presses and moves for Play tool. if (currentTool == UBStylusTool::Play)
return true;
break;
case UBGraphicsGroupContainerItem::Type: case UBGraphicsGroupContainerItem::Type:
// Groups shouldn't reacts on any presses and moves for Play tool.
if(currentTool == UBStylusTool::Play) if(currentTool == UBStylusTool::Play)
{ {
movingItem = NULL; movingItem = NULL;
return true;
} }
return false; return false;
break; break;
//case UBToolWidget::Type:
// return true;
case QGraphicsWebView::Type: case QGraphicsWebView::Type:
return true; return true;
@ -761,11 +742,8 @@ void UBBoardView::handleItemMousePress(QMouseEvent *event)
return; return;
if (itemShouldReceiveMousePressEvent(movingItem)) if (itemShouldReceiveMousePressEvent(movingItem))
{
QGraphicsView::mousePressEvent (event); QGraphicsView::mousePressEvent (event);
} else {
else
{
if (movingItem) if (movingItem)
{ {
UBGraphicsItem *graphicsItem = dynamic_cast<UBGraphicsItem*>(movingItem); UBGraphicsItem *graphicsItem = dynamic_cast<UBGraphicsItem*>(movingItem);
@ -933,6 +911,7 @@ QWidget *UBBoardView::widgetForTabletEvent(QWidget *w, const QPoint &pos)
return childAtPos; return childAtPos;
} }
#endif #endif
void UBBoardView::longPressEvent() void UBBoardView::longPressEvent()
{ {
UBDrawingController *drawingController = UBDrawingController::drawingController(); UBDrawingController *drawingController = UBDrawingController::drawingController();
@ -966,8 +945,7 @@ void UBBoardView::mousePressEvent (QMouseEvent *event)
mIsDragInProgress = false; mIsDragInProgress = false;
if (isAbsurdPoint (event->pos ())) if (isAbsurdPoint (event->pos ())) {
{
event->accept (); event->accept ();
return; return;
} }
@ -1016,13 +994,13 @@ void UBBoardView::mousePressEvent (QMouseEvent *event)
mLongPressTimer.start(); mLongPressTimer.start();
if (!movingItem) { if (!movingItem) {
// Rubberband selection implementation // Rubberband selection implementation
// if (!mUBRubberBand) { // if (!mUBRubberBand) {
// mUBRubberBand = new UBRubberBand(QRubberBand::Rectangle, this); // mUBRubberBand = new UBRubberBand(QRubberBand::Rectangle, this);
// } // }
// mUBRubberBand->setGeometry (QRect (mMouseDownPos, QSize ())); // mUBRubberBand->setGeometry (QRect (mMouseDownPos, QSize ()));
// mUBRubberBand->show(); // mUBRubberBand->show();
// scene()->updateMultipleSelectionFrame(); // scene()->updateMultipleSelectionFrame();
} }
if(mUBRubberBand) { if(mUBRubberBand) {
@ -1081,7 +1059,6 @@ void UBBoardView::mousePressEvent (QMouseEvent *event)
default: default:
if(UBDrawingController::drawingController()->mActiveRuler==NULL) { if(UBDrawingController::drawingController()->mActiveRuler==NULL) {
viewport()->setCursor (QCursor (Qt::BlankCursor)); viewport()->setCursor (QCursor (Qt::BlankCursor));
}
if (scene () && !mTabletStylusIsPressed) { if (scene () && !mTabletStylusIsPressed) {
if (currentTool == UBStylusTool::Eraser) { if (currentTool == UBStylusTool::Eraser) {
@ -1093,17 +1070,17 @@ void UBBoardView::mousePressEvent (QMouseEvent *event)
event->accept (); event->accept ();
} }
} }
}
} }
void void UBBoardView::mouseMoveEvent (QMouseEvent *event)
UBBoardView::mouseMoveEvent (QMouseEvent *event)
{ {
// static QTime lastCallTime; // static QTime lastCallTime;
// if (!lastCallTime.isNull()) { // if (!lastCallTime.isNull()) {
// qDebug() << "time interval is " << lastCallTime.msecsTo(QTime::currentTime()); // qDebug() << "time interval is " << lastCallTime.msecsTo(QTime::currentTime());
// } // }
// QTime mouseMoveTime = QTime::currentTime(); // QTime mouseMoveTime = QTime::currentTime();
if(!mIsDragInProgress if(!mIsDragInProgress
&& ((mapToScene(event->pos()) - mLastPressedMousePos).manhattanLength() < QApplication::startDragDistance())) { && ((mapToScene(event->pos()) - mLastPressedMousePos).manhattanLength() < QApplication::startDragDistance())) {
qDebug() << "mouse move event canceled"; qDebug() << "mouse move event canceled";
@ -1158,24 +1135,24 @@ UBBoardView::mouseMoveEvent (QMouseEvent *event)
if (!mUBRubberBand) { if (!mUBRubberBand) {
mUBRubberBand = new UBRubberBand(QRubberBand::Rectangle, this); mUBRubberBand = new UBRubberBand(QRubberBand::Rectangle, this);
} }
// mUBRubberBand->setGeometry (QRect (mMouseDownPos, QSize ())); // mUBRubberBand->setGeometry (QRect (mMouseDownPos, QSize ()));
mUBRubberBand->setGeometry(bandRect); mUBRubberBand->setGeometry(bandRect);
mUBRubberBand->show(); mUBRubberBand->show();
// QTime startTime = QTime::currentTime(); // QTime startTime = QTime::currentTime();
// QTime testTime = QTime::currentTime(); // QTime testTime = QTime::currentTime();
QList<QGraphicsItem *> rubberItems = items(bandRect); QList<QGraphicsItem *> rubberItems = items(bandRect);
// qDebug() << "=================="; // qDebug() << "==================";
// qDebug() << "| ====rubber items" << testTime.msecsTo(QTime::currentTime()); // qDebug() << "| ====rubber items" << testTime.msecsTo(QTime::currentTime());
// testTime = QTime::currentTime(); // testTime = QTime::currentTime();
foreach (QGraphicsItem *item, mJustSelectedItems) { foreach (QGraphicsItem *item, mJustSelectedItems) {
if (!rubberItems.contains(item)) { if (!rubberItems.contains(item)) {
item->setSelected(false); item->setSelected(false);
mJustSelectedItems.remove(item); mJustSelectedItems.remove(item);
} }
} }
// qDebug() << "| ===foreach length" << testTime.msecsTo(QTime::currentTime()); // qDebug() << "| ===foreach length" << testTime.msecsTo(QTime::currentTime());
// testTime = QTime::currentTime(); // testTime = QTime::currentTime();
int counter = 0; int counter = 0;
if (currentTool == UBStylusTool::Selector) { if (currentTool == UBStylusTool::Selector) {
@ -1199,11 +1176,11 @@ UBBoardView::mouseMoveEvent (QMouseEvent *event)
} }
} }
// qDebug() << "| ==selected items count" << counter << endl // qDebug() << "| ==selected items count" << counter << endl
// << "| ==selection time" << testTime.msecsTo(QTime::currentTime()) << endl // << "| ==selection time" << testTime.msecsTo(QTime::currentTime()) << endl
// << "| =elapsed time " << startTime.msecsTo(QTime::currentTime()) << endl // << "| =elapsed time " << startTime.msecsTo(QTime::currentTime()) << endl
// << "=================="; // << "==================";
// QCoreApplication::removePostedEvents(scene(), 0); // QCoreApplication::removePostedEvents(scene(), 0);
} }
handleItemMouseMove(event); handleItemMouseMove(event);
} break; } break;
@ -1227,12 +1204,12 @@ UBBoardView::mouseMoveEvent (QMouseEvent *event)
event->accept (); event->accept ();
} }
// qDebug() << "mouse move time" << mouseMoveTime.msecsTo(QTime::currentTime()); // qDebug() << "mouse move time" << mouseMoveTime.msecsTo(QTime::currentTime());
// lastCallTime = QTime::currentTime(); // lastCallTime = QTime::currentTime();
} }
void void UBBoardView::mouseReleaseEvent (QMouseEvent *event)
UBBoardView::mouseReleaseEvent (QMouseEvent *event)
{ {
UBStylusTool::Enum currentTool = (UBStylusTool::Enum)UBDrawingController::drawingController ()->stylusTool (); UBStylusTool::Enum currentTool = (UBStylusTool::Enum)UBDrawingController::drawingController ()->stylusTool ();
@ -1342,10 +1319,96 @@ UBBoardView::mouseReleaseEvent (QMouseEvent *event)
if (mRubberBand) { if (mRubberBand) {
mRubberBand->hide (); mRubberBand->hide ();
} }
UBGraphicsItem *graphicsItem = dynamic_cast<UBGraphicsItem*>(movingItem);
if (graphicsItem)
graphicsItem->Delegate()->commitUndoStep();
bool bReleaseIsNeed = true;
if (movingItem != determineItemToPress(scene()->itemAt(this->mapToScene(event->posF().toPoint()))))
{
movingItem = NULL;
bReleaseIsNeed = false;
}
if (mWidgetMoved)
{
mWidgetMoved = false;
movingItem = NULL;
}
else
if (movingItem && (!isCppTool(movingItem) || UBGraphicsCurtainItem::Type == movingItem->type()))
{
if (suspendedMousePressEvent)
{
QGraphicsView::mousePressEvent(suspendedMousePressEvent); // suspendedMousePressEvent is deleted by old Qt event loop
movingItem = NULL;
delete suspendedMousePressEvent;
suspendedMousePressEvent = NULL;
bReleaseIsNeed = true;
}
else
{
if (isUBItem(movingItem) &&
DelegateButton::Type != movingItem->type() &&
QGraphicsSvgItem::Type != movingItem->type() &&
UBGraphicsDelegateFrame::Type != movingItem->type() &&
UBGraphicsCache::Type != movingItem->type() &&
QGraphicsWebView::Type != movingItem->type() && // for W3C widgets as Tools.
!(!isMultipleSelectionEnabled() && movingItem->parentItem() && UBGraphicsWidgetItem::Type == movingItem->type() && UBGraphicsGroupContainerItem::Type == movingItem->parentItem()->type()))
{
bReleaseIsNeed = false;
if (movingItem->isSelected() && isMultipleSelectionEnabled())
movingItem->setSelected(false);
else
if (movingItem->parentItem() && movingItem->parentItem()->isSelected() && isMultipleSelectionEnabled())
movingItem->parentItem()->setSelected(false);
else
{
if (movingItem->isSelected())
bReleaseIsNeed = true;
movingItem->setSelected(true);
}
}
}
}
else
bReleaseIsNeed = true;
if (scene () && mRubberBand && mIsCreatingTextZone) if (mUBRubberBand && mUBRubberBand->isVisible()) {
mUBRubberBand->hide();
}
if (bReleaseIsNeed)
{ {
QGraphicsView::mouseReleaseEvent (event);
}
}
else if (currentTool == UBStylusTool::Play) {
if (bIsDesktop) {
event->ignore();
return;
}
if (mWidgetMoved) {
movingItem = NULL;
mWidgetMoved = false;
}
else {
if (suspendedMousePressEvent) {
QGraphicsView::mousePressEvent(suspendedMousePressEvent); // suspendedMousePressEvent is deleted by old Qt event loop
movingItem = NULL;
delete suspendedMousePressEvent;
suspendedMousePressEvent = NULL;
}
}
QGraphicsView::mouseReleaseEvent (event);
}
else if (currentTool == UBStylusTool::Text) {
if (mRubberBand)
mRubberBand->hide ();
if (scene () && mRubberBand && mIsCreatingTextZone) {
QRect rubberRect = mRubberBand->geometry (); QRect rubberRect = mRubberBand->geometry ();
UBGraphicsTextItem* textItem = scene()->addTextHtml ("", mapToScene (rubberRect.topLeft ())); UBGraphicsTextItem* textItem = scene()->addTextHtml ("", mapToScene (rubberRect.topLeft ()));
@ -1357,9 +1420,7 @@ UBBoardView::mouseReleaseEvent (QMouseEvent *event)
textItem->setFocus(); textItem->setFocus();
} }
else else
{
QGraphicsView::mouseReleaseEvent (event); QGraphicsView::mouseReleaseEvent (event);
}
mIsCreatingTextZone = false; mIsCreatingTextZone = false;
} }
@ -1368,7 +1429,6 @@ UBBoardView::mouseReleaseEvent (QMouseEvent *event)
if (mRubberBand) { if (mRubberBand) {
mRubberBand->hide (); mRubberBand->hide ();
} }
if (scene () && mRubberBand && mIsCreatingSceneGrabZone && mRubberBand->geometry ().width () > 16) if (scene () && mRubberBand && mIsCreatingSceneGrabZone && mRubberBand->geometry ().width () > 16)
{ {
QRect rect = mRubberBand->geometry (); QRect rect = mRubberBand->geometry ();
@ -1401,14 +1461,11 @@ UBBoardView::mouseReleaseEvent (QMouseEvent *event)
movingItem = NULL; movingItem = NULL;
mLongPressTimer.stop(); mLongPressTimer.stop();
emit mouseReleased(); emit mouseReleased();
} }
void void UBBoardView::forcedTabletRelease ()
UBBoardView::forcedTabletRelease ()
{ {
if (mMouseButtonIsPressed || mTabletStylusIsPressed || mPendingStylusReleaseEvent) if (mMouseButtonIsPressed || mTabletStylusIsPressed || mPendingStylusReleaseEvent)
{ {
qWarning () << "dirty mouse/tablet state:"; qWarning () << "dirty mouse/tablet state:";
@ -1425,26 +1482,14 @@ UBBoardView::forcedTabletRelease ()
} }
} }
void void UBBoardView::mouseDoubleClickEvent (QMouseEvent *event)
UBBoardView::mouseDoubleClickEvent (QMouseEvent *event)
{ {
// We don't want a double click, we want two clicks // We don't want a double click, we want two clicks
mousePressEvent (event); mousePressEvent (event);
} }
void void UBBoardView::wheelEvent (QWheelEvent *wheelEvent)
UBBoardView::wheelEvent (QWheelEvent *wheelEvent)
{ {
if (isInteractive () && wheelEvent->orientation () == Qt::Vertical)
{
// Too many wheelEvent are sent, how should we handle them to "smoothly" zoom ?
// something like zoom( pow(zoomFactor, event->delta() / 120) )
// use DateTime man, store last event time, and if if less than 300ms than this is one big scroll
// and move scroll with one const speed.
// so, you no will related with scroll event count
}
QList<QGraphicsItem *> selItemsList = scene()->selectedItems(); QList<QGraphicsItem *> selItemsList = scene()->selectedItems();
// if NO have selected items, than no need process mouse wheel. just exist // if NO have selected items, than no need process mouse wheel. just exist
if( selItemsList.count() > 0 ) if( selItemsList.count() > 0 )
@ -1456,8 +1501,8 @@ UBBoardView::wheelEvent (QWheelEvent *wheelEvent)
QPointF scenePos = mapToScene(wheelEvent->pos()); QPointF scenePos = mapToScene(wheelEvent->pos());
QList<QGraphicsItem *> itemsList = scene()->items(scenePos); QList<QGraphicsItem *> itemsList = scene()->items(scenePos);
QBool isSlectedAndMouseHower = itemsList.contains(selItem); QBool isSelectedAndMouseHower = itemsList.contains(selItem);
if(isSlectedAndMouseHower) if(isSelectedAndMouseHower)
{ {
QGraphicsView::wheelEvent(wheelEvent); QGraphicsView::wheelEvent(wheelEvent);
wheelEvent->accept(); wheelEvent->accept();
@ -1467,8 +1512,7 @@ UBBoardView::wheelEvent (QWheelEvent *wheelEvent)
} }
void void UBBoardView::leaveEvent (QEvent * event)
UBBoardView::leaveEvent (QEvent * event)
{ {
if (scene ()) if (scene ())
scene ()->leaveEvent (event); scene ()->leaveEvent (event);
@ -1476,15 +1520,10 @@ UBBoardView::leaveEvent (QEvent * event)
QGraphicsView::leaveEvent (event); QGraphicsView::leaveEvent (event);
} }
void void UBBoardView::drawItems (QPainter *painter, int numItems, QGraphicsItem* items[], const QStyleOptionGraphicsItem options[])
UBBoardView::drawItems (QPainter *painter, int numItems,
QGraphicsItem* items[],
const QStyleOptionGraphicsItem options[])
{ {
if (!mFilterZIndex) if (!mFilterZIndex)
{
QGraphicsView::drawItems (painter, numItems, items, options); QGraphicsView::drawItems (painter, numItems, items, options);
}
else else
{ {
int count = 0; int count = 0;
@ -1539,8 +1578,7 @@ void UBBoardView::dropEvent (QDropEvent *event)
} }
} }
void void UBBoardView::resizeEvent (QResizeEvent * event)
UBBoardView::resizeEvent (QResizeEvent * event)
{ {
const qreal maxWidth = width () * 10; const qreal maxWidth = width () * 10;
const qreal maxHeight = height () * 10; const qreal maxHeight = height () * 10;
@ -1551,8 +1589,7 @@ UBBoardView::resizeEvent (QResizeEvent * event)
emit resized (event); emit resized (event);
} }
void void UBBoardView::drawBackground (QPainter *painter, const QRectF &rect)
UBBoardView::drawBackground (QPainter *painter, const QRectF &rect)
{ {
if (testAttribute (Qt::WA_TranslucentBackground)) if (testAttribute (Qt::WA_TranslucentBackground))
{ {
@ -1634,8 +1671,7 @@ UBBoardView::drawBackground (QPainter *painter, const QRectF &rect)
} }
} }
void void UBBoardView::settingChanged (QVariant newValue)
UBBoardView::settingChanged (QVariant newValue)
{ {
Q_UNUSED (newValue); Q_UNUSED (newValue);
@ -1668,14 +1704,12 @@ bool UBBoardView::isAbsurdPoint(QPoint point)
return !isValidPoint; return !isValidPoint;
} }
void void UBBoardView::focusOutEvent (QFocusEvent * event)
UBBoardView::focusOutEvent (QFocusEvent * event)
{ {
Q_UNUSED (event); Q_UNUSED (event);
} }
void void UBBoardView::setToolCursor (int tool)
UBBoardView::setToolCursor (int tool)
{ {
QWidget *controlViewport = viewport (); QWidget *controlViewport = viewport ();
switch (tool) switch (tool)

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2012 Webdoc SA * Copyright (C) 2010-2013 Groupement d'Intérêt Public pour l'Education Numérique en Afrique (GIP ENA)
* *
* This file is part of Open-Sankoré. * This file is part of Open-Sankoré.
* *
@ -38,7 +38,7 @@ class UBBoardView : public QGraphicsView
{ {
Q_OBJECT Q_OBJECT
public: public:
UBBoardView(UBBoardController* pController, QWidget* pParent = 0, bool isControl = false, bool isDesktop = false); UBBoardView(UBBoardController* pController, QWidget* pParent = 0, bool isControl = false, bool isDesktop = false);
UBBoardView(UBBoardController* pController, int pStartLayer, int pEndLayer, QWidget* pParent = 0, bool isControl = false, bool isDesktop = false); UBBoardView(UBBoardController* pController, int pStartLayer, int pEndLayer, QWidget* pParent = 0, bool isControl = false, bool isDesktop = false);
@ -55,20 +55,19 @@ class UBBoardView : public QGraphicsView
void setMultiselection(bool enable); void setMultiselection(bool enable);
bool isMultipleSelectionEnabled() { return mMultipleSelectionIsEnabled; } bool isMultipleSelectionEnabled() { return mMultipleSelectionIsEnabled; }
// work around for handling tablet events on MAC OS with Qt 4.8.0 and above // work around for handling tablet events on MAC OS with Qt 4.8.0 and above
#if defined(Q_WS_MACX) #if defined(Q_WS_MACX)
bool directTabletEvent(QEvent *event); bool directTabletEvent(QEvent *event);
QWidget *widgetForTabletEvent(QWidget *w, const QPoint &pos); QWidget *widgetForTabletEvent(QWidget *w, const QPoint &pos);
#endif #endif
signals: signals:
void resized(QResizeEvent* event); void resized(QResizeEvent* event);
void hidden();
void shown(); void shown();
void clickOnBoard(); void clickOnBoard();
void mouseReleased(); void mouseReleased();
protected:
protected:
bool itemIsLocked(QGraphicsItem *item); bool itemIsLocked(QGraphicsItem *item);
bool isUBItem(QGraphicsItem *item); // we should to determine items who is not UB and use general scene behavior for them. bool isUBItem(QGraphicsItem *item); // we should to determine items who is not UB and use general scene behavior for them.
@ -101,7 +100,6 @@ class UBBoardView : public QGraphicsView
QGraphicsItem *items[], QGraphicsItem *items[],
const QStyleOptionGraphicsItem options[]); const QStyleOptionGraphicsItem options[]);
// virtual void dragEnterEvent(QDragEnterEvent * event);
virtual void dropEvent(QDropEvent *event); virtual void dropEvent(QDropEvent *event);
virtual void dragMoveEvent(QDragMoveEvent *event); virtual void dragMoveEvent(QDragMoveEvent *event);
@ -109,10 +107,7 @@ class UBBoardView : public QGraphicsView
virtual void drawBackground(QPainter *painter, const QRectF &rect); virtual void drawBackground(QPainter *painter, const QRectF &rect);
virtual void showEvent(QShowEvent * event); private:
virtual void hideEvent(QHideEvent * event);
private:
void init(); void init();
@ -174,11 +169,11 @@ class UBBoardView : public QGraphicsView
static bool hasSelectedParents(QGraphicsItem * item); static bool hasSelectedParents(QGraphicsItem * item);
private slots: private slots:
void settingChanged(QVariant newValue); void settingChanged(QVariant newValue);
public slots: public slots:
void virtualKeyboardActivated(bool b); void virtualKeyboardActivated(bool b);
void longPressEvent(); void longPressEvent();

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2012 Webdoc SA * Copyright (C) 2010-2013 Groupement d'Intérêt Public pour l'Education Numérique en Afrique (GIP ENA)
* *
* This file is part of Open-Sankoré. * This file is part of Open-Sankoré.
* *
@ -159,35 +159,23 @@ bool UBDrawingController::isDrawingTool()
int UBDrawingController::currentToolWidthIndex() int UBDrawingController::currentToolWidthIndex()
{ {
if (stylusTool() == UBStylusTool::Pen || stylusTool() == UBStylusTool::Line) if (stylusTool() == UBStylusTool::Pen || stylusTool() == UBStylusTool::Line)
{
return UBSettings::settings()->penWidthIndex(); return UBSettings::settings()->penWidthIndex();
}
else if (stylusTool() == UBStylusTool::Marker) else if (stylusTool() == UBStylusTool::Marker)
{
return UBSettings::settings()->markerWidthIndex(); return UBSettings::settings()->markerWidthIndex();
}
else else
{
return -1; return -1;
}
} }
qreal UBDrawingController::currentToolWidth() qreal UBDrawingController::currentToolWidth()
{ {
if (stylusTool() == UBStylusTool::Pen || stylusTool() == UBStylusTool::Line) if (stylusTool() == UBStylusTool::Pen || stylusTool() == UBStylusTool::Line)
{
return UBSettings::settings()->currentPenWidth(); return UBSettings::settings()->currentPenWidth();
}
else if (stylusTool() == UBStylusTool::Marker) else if (stylusTool() == UBStylusTool::Marker)
{
return UBSettings::settings()->currentMarkerWidth(); return UBSettings::settings()->currentMarkerWidth();
}
else else
{
//failsafe //failsafe
return UBSettings::settings()->currentPenWidth(); return UBSettings::settings()->currentPenWidth();
}
} }

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2012 Webdoc SA * Copyright (C) 2010-2013 Groupement d'Intérêt Public pour l'Education Numérique en Afrique (GIP ENA)
* *
* This file is part of Open-Sankoré. * This file is part of Open-Sankoré.
* *

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2012 Webdoc SA * Copyright (C) 2010-2013 Groupement d'Intérêt Public pour l'Education Numérique en Afrique (GIP ENA)
* *
* This file is part of Open-Sankoré. * This file is part of Open-Sankoré.
* *
@ -37,7 +37,6 @@
#include "domain/UBGraphicsScene.h" #include "domain/UBGraphicsScene.h"
#include "domain/UBGraphicsSvgItem.h" #include "domain/UBGraphicsSvgItem.h"
#include "domain/UBGraphicsPixmapItem.h" #include "domain/UBGraphicsPixmapItem.h"
#include "domain/UBGraphicsVideoItem.h"
#include "domain/UBGraphicsWidgetItem.h" #include "domain/UBGraphicsWidgetItem.h"
#include "gui/UBFeaturesWidget.h" #include "gui/UBFeaturesWidget.h"

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2012 Webdoc SA * Copyright (C) 2010-2013 Groupement d'Intérêt Public pour l'Education Numérique en Afrique (GIP ENA)
* *
* This file is part of Open-Sankoré. * This file is part of Open-Sankoré.
* *

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2012 Webdoc SA * Copyright (C) 2010-2013 Groupement d'Intérêt Public pour l'Education Numérique en Afrique (GIP ENA)
* *
* This file is part of Open-Sankoré. * This file is part of Open-Sankoré.
* *

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2012 Webdoc SA * Copyright (C) 2010-2013 Groupement d'Intérêt Public pour l'Education Numérique en Afrique (GIP ENA)
* *
* This file is part of Open-Sankoré. * This file is part of Open-Sankoré.
* *
@ -317,8 +317,6 @@ int UBApplication::exec(const QString& pFileToImport)
webController = new UBWebController(mainWindow); webController = new UBWebController(mainWindow);
documentController = new UBDocumentController(mainWindow); documentController = new UBDocumentController(mainWindow);
boardController->paletteManager()->connectToDocumentController();
UBDrawingController::drawingController()->setStylusTool((int)UBStylusTool::Pen); UBDrawingController::drawingController()->setStylusTool((int)UBStylusTool::Pen);
applicationController = new UBApplicationController(boardController->controlView(), applicationController = new UBApplicationController(boardController->controlView(),
@ -349,7 +347,6 @@ int UBApplication::exec(const QString& pFileToImport)
connect(mainWindow->actionPreferences, SIGNAL(triggered()), mPreferencesController, SLOT(show())); connect(mainWindow->actionPreferences, SIGNAL(triggered()), mPreferencesController, SLOT(show()));
connect(mainWindow->actionTutorial, SIGNAL(triggered()), applicationController, SLOT(showTutorial())); connect(mainWindow->actionTutorial, SIGNAL(triggered()), applicationController, SLOT(showTutorial()));
connect(mainWindow->actionTutorial, SIGNAL(triggered()), this, SLOT(stopScript())); connect(mainWindow->actionTutorial, SIGNAL(triggered()), this, SLOT(stopScript()));
connect(mainWindow->actionSankoreEditor, SIGNAL(triggered()), applicationController, SLOT(showSankoreEditor()));
connect(mainWindow->actionCheckUpdate, SIGNAL(triggered()), applicationController, SLOT(checkUpdateRequest())); connect(mainWindow->actionCheckUpdate, SIGNAL(triggered()), applicationController, SLOT(checkUpdateRequest()));
@ -543,7 +540,6 @@ void UBApplication::decorateActionMenu(QAction* action)
menu->addSeparator(); menu->addSeparator();
menu->addAction(mainWindow->actionTutorial); menu->addAction(mainWindow->actionTutorial);
menu->addAction(mainWindow->actionSankoreEditor);
#ifndef Q_WS_X11 // No Podcast on Linux yet #ifndef Q_WS_X11 // No Podcast on Linux yet
menu->addAction(mainWindow->actionPodcast); menu->addAction(mainWindow->actionPodcast);
@ -651,12 +647,10 @@ void UBApplication::cleanup()
if (webController) delete webController; if (webController) delete webController;
if (documentController) delete documentController; if (documentController) delete documentController;
applicationController = NULL; applicationController = NULL;
boardController = NULL; boardController = NULL;
webController = NULL; webController = NULL;
documentController = NULL; documentController = NULL;
} }
void UBStyle::drawItemText(QPainter *painter, const QRect &rect, int alignment, const QPalette &pal, void UBStyle::drawItemText(QPainter *painter, const QRect &rect, int alignment, const QPalette &pal,

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2012 Webdoc SA * Copyright (C) 2010-2013 Groupement d'Intérêt Public pour l'Education Numérique en Afrique (GIP ENA)
* *
* This file is part of Open-Sankoré. * This file is part of Open-Sankoré.
* *

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2012 Webdoc SA * Copyright (C) 2010-2013 Groupement d'Intérêt Public pour l'Education Numérique en Afrique (GIP ENA)
* *
* This file is part of Open-Sankoré. * This file is part of Open-Sankoré.
* *
@ -513,42 +513,14 @@ void UBApplicationController::showTutorial()
} }
void UBApplicationController::showSankoreEditor()
{
if (UBApplication::boardController)
{
UBApplication::boardController->persistCurrentScene();
UBApplication::boardController->hide();
}
// it's needed not to duplicate webbrowser search in web mode. If I've breaked smbd's code let Ivan know
UBApplication::webController->show(UBWebController::Paraschool);
mMainWindow->webToolBar->hide();
mMainWindow->boardToolBar->hide();
mMainWindow->documentToolBar->hide();
mMainWindow->tutorialToolBar->show();
mMainMode = ParaschoolEditor;
adaptToolBar();
mUninoteController->hideWindow();
mirroringEnabled(false);
emit mainModeChanged(mMainMode);
}
void UBApplicationController::checkUpdate() void UBApplicationController::checkUpdate()
{ {
if(mHttp) // if(mHttp)
delete mHttp; // delete mHttp;
QUrl url("http://ftp.open-sankore.org/update.json"); // QUrl url("http://ftp.open-sankore.org/update.json");
mHttp = new QHttp(url.host()); // mHttp = new QHttp(url.host());
connect(mHttp, SIGNAL(requestFinished(int,bool)), this, SLOT(updateRequestFinished(int,bool))); // connect(mHttp, SIGNAL(requestFinished(int,bool)), this, SLOT(updateRequestFinished(int,bool)));
mHttp->get(url.path()); // mHttp->get(url.path());
} }
void UBApplicationController::updateRequestFinished(int id, bool error) void UBApplicationController::updateRequestFinished(int id, bool error)
@ -622,10 +594,6 @@ void UBApplicationController::hideDesktop()
{ {
showTutorial(); showTutorial();
} }
else if (mMainMode == ParaschoolEditor)
{
showSankoreEditor();
}
mIsShowingDesktop = false; mIsShowingDesktop = false;

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2012 Webdoc SA * Copyright (C) 2010-2013 Groupement d'Intérêt Public pour l'Education Numérique en Afrique (GIP ENA)
* *
* This file is part of Open-Sankoré. * This file is part of Open-Sankoré.
* *
@ -92,7 +92,7 @@ class UBApplicationController : public QObject
enum MainMode enum MainMode
{ {
Board = 0, Internet, Document, Tutorial, ParaschoolEditor, WebDocument Board = 0, Internet, Document, Tutorial, WebDocument
}; };
MainMode displayMode() MainMode displayMode()
@ -137,7 +137,6 @@ class UBApplicationController : public QObject
void actionPaste(); void actionPaste();
void showTutorial(); void showTutorial();
void showSankoreEditor();
void checkUpdateRequest(); void checkUpdateRequest();
void checkUpdateAtLaunch(); void checkUpdateAtLaunch();

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2012 Webdoc SA * Copyright (C) 2010-2013 Groupement d'Intérêt Public pour l'Education Numérique en Afrique (GIP ENA)
* *
* This file is part of Open-Sankoré. * This file is part of Open-Sankoré.
* *
@ -19,6 +19,7 @@
* along with Open-Sankoré. If not, see <http://www.gnu.org/licenses/>. * along with Open-Sankoré. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include "UBDisplayManager.h" #include "UBDisplayManager.h"
#include "frameworks/UBPlatformUtils.h" #include "frameworks/UBPlatformUtils.h"

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2012 Webdoc SA * Copyright (C) 2010-2013 Groupement d'Intérêt Public pour l'Education Numérique en Afrique (GIP ENA)
* *
* This file is part of Open-Sankoré. * This file is part of Open-Sankoré.
* *

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2012 Webdoc SA * Copyright (C) 2010-2013 Groupement d'Intérêt Public pour l'Education Numérique en Afrique (GIP ENA)
* *
* This file is part of Open-Sankoré. * This file is part of Open-Sankoré.
* *

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2012 Webdoc SA * Copyright (C) 2010-2013 Groupement d'Intérêt Public pour l'Education Numérique en Afrique (GIP ENA)
* *
* This file is part of Open-Sankoré. * This file is part of Open-Sankoré.
* *

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2012 Webdoc SA * Copyright (C) 2010-2013 Groupement d'Intérêt Public pour l'Education Numérique en Afrique (GIP ENA)
* *
* This file is part of Open-Sankoré. * This file is part of Open-Sankoré.
* *

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2012 Webdoc SA * Copyright (C) 2010-2013 Groupement d'Intérêt Public pour l'Education Numérique en Afrique (GIP ENA)
* *
* This file is part of Open-Sankoré. * This file is part of Open-Sankoré.
* *

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2012 Webdoc SA * Copyright (C) 2010-2013 Groupement d'Intérêt Public pour l'Education Numérique en Afrique (GIP ENA)
* *
* This file is part of Open-Sankoré. * This file is part of Open-Sankoré.
* *

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2012 Webdoc SA * Copyright (C) 2010-2013 Groupement d'Intérêt Public pour l'Education Numérique en Afrique (GIP ENA)
* *
* This file is part of Open-Sankoré. * This file is part of Open-Sankoré.
* *

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2012 Webdoc SA * Copyright (C) 2010-2013 Groupement d'Intérêt Public pour l'Education Numérique en Afrique (GIP ENA)
* *
* This file is part of Open-Sankoré. * This file is part of Open-Sankoré.
* *

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2012 Webdoc SA * Copyright (C) 2010-2013 Groupement d'Intérêt Public pour l'Education Numérique en Afrique (GIP ENA)
* *
* This file is part of Open-Sankoré. * This file is part of Open-Sankoré.
* *

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2012 Webdoc SA * Copyright (C) 2010-2013 Groupement d'Intérêt Public pour l'Education Numérique en Afrique (GIP ENA)
* *
* This file is part of Open-Sankoré. * This file is part of Open-Sankoré.
* *

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2012 Webdoc SA * Copyright (C) 2010-2013 Groupement d'Intérêt Public pour l'Education Numérique en Afrique (GIP ENA)
* *
* This file is part of Open-Sankoré. * This file is part of Open-Sankoré.
* *

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2012 Webdoc SA * Copyright (C) 2010-2013 Groupement d'Intérêt Public pour l'Education Numérique en Afrique (GIP ENA)
* *
* This file is part of Open-Sankoré. * This file is part of Open-Sankoré.
* *

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2012 Webdoc SA * Copyright (C) 2010-2013 Groupement d'Intérêt Public pour l'Education Numérique en Afrique (GIP ENA)
* *
* This file is part of Open-Sankoré. * This file is part of Open-Sankoré.
* *

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save