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

preferencesAboutTextFull
Claudio Valerio 12 years ago
commit 72958a79ca
  1. BIN
      JournalDesModifications.pdf
  2. BIN
      ReleaseNotes.pdf
  3. 2
      Sankore_3.1.pro
  4. 19
      resources/i18n/sankore_ar.ts
  5. 19
      resources/i18n/sankore_bg.ts
  6. 19
      resources/i18n/sankore_ca.ts
  7. 19
      resources/i18n/sankore_cs.ts
  8. 19
      resources/i18n/sankore_da.ts
  9. 19
      resources/i18n/sankore_de.ts
  10. 19
      resources/i18n/sankore_el.ts
  11. 19
      resources/i18n/sankore_en.ts
  12. 19
      resources/i18n/sankore_en_UK.ts
  13. 19
      resources/i18n/sankore_es.ts
  14. 430
      resources/i18n/sankore_fr.ts
  15. 430
      resources/i18n/sankore_fr_CH.ts
  16. 19
      resources/i18n/sankore_it.ts
  17. 19
      resources/i18n/sankore_iw.ts
  18. 19
      resources/i18n/sankore_ja.ts
  19. 19
      resources/i18n/sankore_ko.ts
  20. 19
      resources/i18n/sankore_mg.ts
  21. 19
      resources/i18n/sankore_nb.ts
  22. 19
      resources/i18n/sankore_nl.ts
  23. 19
      resources/i18n/sankore_pl.ts
  24. 19
      resources/i18n/sankore_pt.ts
  25. 19
      resources/i18n/sankore_rm.ts
  26. 19
      resources/i18n/sankore_ro.ts
  27. 19
      resources/i18n/sankore_ru.ts
  28. 19
      resources/i18n/sankore_sk.ts
  29. 19
      resources/i18n/sankore_sv.ts
  30. 19
      resources/i18n/sankore_tr.ts
  31. 19
      resources/i18n/sankore_zh.ts
  32. BIN
      resources/images/toolPalette/aristoTool.png
  33. BIN
      resources/images/toque.png
  34. 131
      resources/images/toque.svg
  35. 27
      resources/library/applications/OpenStreetMap.wgt/index.html
  36. 77
      resources/library/interactivities/Cat images.wgt/js/script.js
  37. 82
      resources/library/interactivities/Cat images.wgt/locales/fr/js/script.js
  38. 82
      resources/library/interactivities/Cat images.wgt/locales/ru/js/script.js
  39. 71
      resources/library/interactivities/Cat text.wgt/js/script.js
  40. 70
      resources/library/interactivities/Cat text.wgt/locales/fr/js/script.js
  41. 70
      resources/library/interactivities/Cat text.wgt/locales/ru/js/script.js
  42. 3
      resources/sankore.qrc
  43. 5
      src/adaptors/UBImportDocument.cpp
  44. 32
      src/adaptors/UBSvgSubsetAdaptor.cpp
  45. 13
      src/adaptors/UBThumbnailAdaptor.cpp
  46. 2
      src/api/UBLibraryAPI.cpp
  47. 4
      src/api/UBWidgetUniboardAPI.cpp
  48. 155
      src/board/UBBoardController.cpp
  49. 12
      src/board/UBBoardController.h
  50. 1
      src/board/UBBoardPaletteManager.cpp
  51. 18
      src/board/UBBoardView.cpp
  52. 2
      src/board/UBFeaturesController.cpp
  53. 1
      src/core/UB.h
  54. 4
      src/core/UBApplication.cpp
  55. 138
      src/core/UBDownloadManager.cpp
  56. 33
      src/core/UBDownloadManager.h
  57. 14
      src/core/UBPersistenceManager.cpp
  58. 5
      src/core/UBPersistenceManager.h
  59. 2
      src/core/main.cpp
  60. 2
      src/document/UBDocumentContainer.cpp
  61. 2
      src/document/UBDocumentContainer.h
  62. 3
      src/domain/UBGraphicsDelegateFrame.cpp
  63. 1
      src/domain/UBGraphicsItemDelegate.cpp
  64. 10
      src/domain/UBGraphicsMediaItem.cpp
  65. 45
      src/domain/UBGraphicsScene.cpp
  66. 1
      src/domain/UBGraphicsScene.h
  67. 3
      src/domain/UBGraphicsWidgetItem.cpp
  68. 2
      src/frameworks/UBFileSystemUtils.cpp
  69. 5
      src/frameworks/UBFileSystemUtils.h
  70. 1
      src/frameworks/UBPlatformUtils_linux.cpp
  71. 22
      src/gui/UBDocumentNavigator.cpp
  72. 12
      src/gui/UBFeaturesWidget.cpp
  73. 8
      src/gui/UBFeaturesWidget.h
  74. 3
      src/gui/UBTeacherGuideWidgetsTools.cpp
  75. 180
      src/gui/UBToolWidget.cpp
  76. 54
      src/gui/UBToolWidget.h
  77. 828
      src/tools/UBGraphicsAristo.cpp
  78. 156
      src/tools/UBGraphicsAristo.h
  79. 15
      src/tools/UBGraphicsCache.cpp
  80. 12
      src/tools/UBGraphicsCache.h
  81. 6
      src/tools/UBToolsManager.cpp
  82. 1
      src/tools/UBToolsManager.h
  83. 3
      src/tools/tools.pri
  84. 2
      src/web/UBTrapFlashController.cpp
  85. 2
      src/web/browser/WBWebTrapWebView.cpp

Binary file not shown.

Binary file not shown.

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

@ -1511,6 +1511,21 @@
<translation type="unfinished">سلة المهملات</translation> <translation type="unfinished">سلة المهملات</translation>
</message> </message>
</context> </context>
<context>
<name>UBFeaturesNewFolderDialog</name>
<message>
<source>Accept</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Cancel</source>
<translation type="unfinished">إلغاء </translation>
</message>
<message>
<source>Enter a new folder name</source>
<translation type="unfinished"></translation>
</message>
</context>
<context> <context>
<name>UBFeaturesProgressInfo</name> <name>UBFeaturesProgressInfo</name>
<message> <message>
@ -2096,6 +2111,10 @@ Do you want to ignore these errors for this host?</source>
<source>Cache</source> <source>Cache</source>
<translation>تخزين مؤقت</translation> <translation>تخزين مؤقت</translation>
</message> </message>
<message>
<source>Aristo</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>UBTrapFlashController</name> <name>UBTrapFlashController</name>

@ -1503,6 +1503,21 @@
<translation type="unfinished">Кошче</translation> <translation type="unfinished">Кошче</translation>
</message> </message>
</context> </context>
<context>
<name>UBFeaturesNewFolderDialog</name>
<message>
<source>Accept</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Cancel</source>
<translation type="unfinished">Отмени</translation>
</message>
<message>
<source>Enter a new folder name</source>
<translation type="unfinished"></translation>
</message>
</context>
<context> <context>
<name>UBFeaturesProgressInfo</name> <name>UBFeaturesProgressInfo</name>
<message> <message>
@ -2094,6 +2109,10 @@ Do you want to ignore these errors for this host?</source>
<source>Cache</source> <source>Cache</source>
<translation>Кеш</translation> <translation>Кеш</translation>
</message> </message>
<message>
<source>Aristo</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>UBTrapFlashController</name> <name>UBTrapFlashController</name>

@ -1504,6 +1504,21 @@
<translation type="unfinished">Paperera</translation> <translation type="unfinished">Paperera</translation>
</message> </message>
</context> </context>
<context>
<name>UBFeaturesNewFolderDialog</name>
<message>
<source>Accept</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Cancel</source>
<translation type="unfinished">Cancel·la</translation>
</message>
<message>
<source>Enter a new folder name</source>
<translation type="unfinished"></translation>
</message>
</context>
<context> <context>
<name>UBFeaturesProgressInfo</name> <name>UBFeaturesProgressInfo</name>
<message> <message>
@ -2090,6 +2105,10 @@ Voleu ignorar aquests errors per a aquest amfitrió?</translation>
<source>Cache</source> <source>Cache</source>
<translation>Memòria cau</translation> <translation>Memòria cau</translation>
</message> </message>
<message>
<source>Aristo</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>UBTrapFlashController</name> <name>UBTrapFlashController</name>

@ -1506,6 +1506,21 @@
<translation type="unfinished">Koš</translation> <translation type="unfinished">Koš</translation>
</message> </message>
</context> </context>
<context>
<name>UBFeaturesNewFolderDialog</name>
<message>
<source>Accept</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Cancel</source>
<translation type="unfinished">Zrušit</translation>
</message>
<message>
<source>Enter a new folder name</source>
<translation type="unfinished"></translation>
</message>
</context>
<context> <context>
<name>UBFeaturesProgressInfo</name> <name>UBFeaturesProgressInfo</name>
<message> <message>
@ -2097,6 +2112,10 @@ Chcete ignorovat tyto chyby na tomto serveru?</translation>
<source>Magnifier</source> <source>Magnifier</source>
<translation>Lupa</translation> <translation>Lupa</translation>
</message> </message>
<message>
<source>Aristo</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>UBTrapFlashController</name> <name>UBTrapFlashController</name>

@ -1502,6 +1502,21 @@
<translation type="unfinished">Papirkurv</translation> <translation type="unfinished">Papirkurv</translation>
</message> </message>
</context> </context>
<context>
<name>UBFeaturesNewFolderDialog</name>
<message>
<source>Accept</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Cancel</source>
<translation type="unfinished">Annuller</translation>
</message>
<message>
<source>Enter a new folder name</source>
<translation type="unfinished"></translation>
</message>
</context>
<context> <context>
<name>UBFeaturesProgressInfo</name> <name>UBFeaturesProgressInfo</name>
<message> <message>
@ -2093,6 +2108,10 @@ Do you want to ignore these errors for this host?</source>
<source>Cache</source> <source>Cache</source>
<translation>Cache</translation> <translation>Cache</translation>
</message> </message>
<message>
<source>Aristo</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>UBTrapFlashController</name> <name>UBTrapFlashController</name>

@ -1502,6 +1502,21 @@
<translation type="unfinished">Papierkorb</translation> <translation type="unfinished">Papierkorb</translation>
</message> </message>
</context> </context>
<context>
<name>UBFeaturesNewFolderDialog</name>
<message>
<source>Accept</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Cancel</source>
<translation type="unfinished">Abbrechen</translation>
</message>
<message>
<source>Enter a new folder name</source>
<translation type="unfinished"></translation>
</message>
</context>
<context> <context>
<name>UBFeaturesProgressInfo</name> <name>UBFeaturesProgressInfo</name>
<message> <message>
@ -2101,6 +2116,10 @@ Möchten Sie diese Fehler auf diesem Computer ignorieren?</translation>
<source>Cache</source> <source>Cache</source>
<translation>Zwischenspeicher</translation> <translation>Zwischenspeicher</translation>
</message> </message>
<message>
<source>Aristo</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>UBTrapFlashController</name> <name>UBTrapFlashController</name>

@ -1502,6 +1502,21 @@
<translation type="unfinished">Κάδος ανακύκλωσης</translation> <translation type="unfinished">Κάδος ανακύκλωσης</translation>
</message> </message>
</context> </context>
<context>
<name>UBFeaturesNewFolderDialog</name>
<message>
<source>Accept</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Cancel</source>
<translation type="unfinished">Άκυρο</translation>
</message>
<message>
<source>Enter a new folder name</source>
<translation type="unfinished"></translation>
</message>
</context>
<context> <context>
<name>UBFeaturesProgressInfo</name> <name>UBFeaturesProgressInfo</name>
<message> <message>
@ -2093,6 +2108,10 @@ Do you want to ignore these errors for this host?</source>
<source>Cache</source> <source>Cache</source>
<translation>Προβολέας</translation> <translation>Προβολέας</translation>
</message> </message>
<message>
<source>Aristo</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>UBTrapFlashController</name> <name>UBTrapFlashController</name>

@ -1500,6 +1500,21 @@
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
</context> </context>
<context>
<name>UBFeaturesNewFolderDialog</name>
<message>
<source>Accept</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Cancel</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Enter a new folder name</source>
<translation type="unfinished"></translation>
</message>
</context>
<context> <context>
<name>UBFeaturesProgressInfo</name> <name>UBFeaturesProgressInfo</name>
<message> <message>
@ -2085,6 +2100,10 @@ Do you want to ignore these errors for this host?</source>
<source>Cache</source> <source>Cache</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message>
<source>Aristo</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>UBTrapFlashController</name> <name>UBTrapFlashController</name>

@ -1500,6 +1500,21 @@
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
</context> </context>
<context>
<name>UBFeaturesNewFolderDialog</name>
<message>
<source>Accept</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Cancel</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Enter a new folder name</source>
<translation type="unfinished"></translation>
</message>
</context>
<context> <context>
<name>UBFeaturesProgressInfo</name> <name>UBFeaturesProgressInfo</name>
<message> <message>
@ -2085,6 +2100,10 @@ Do you want to ignore these errors for this host?</source>
<source>Cache</source> <source>Cache</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message>
<source>Aristo</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>UBTrapFlashController</name> <name>UBTrapFlashController</name>

@ -1502,6 +1502,21 @@
<translation type="unfinished">Papelera</translation> <translation type="unfinished">Papelera</translation>
</message> </message>
</context> </context>
<context>
<name>UBFeaturesNewFolderDialog</name>
<message>
<source>Accept</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Cancel</source>
<translation type="unfinished">Cancelar</translation>
</message>
<message>
<source>Enter a new folder name</source>
<translation type="unfinished"></translation>
</message>
</context>
<context> <context>
<name>UBFeaturesProgressInfo</name> <name>UBFeaturesProgressInfo</name>
<message> <message>
@ -2087,6 +2102,10 @@ Do you want to ignore these errors for this host?</source>
<source>Cache</source> <source>Cache</source>
<translation>Caché</translation> <translation>Caché</translation>
</message> </message>
<message>
<source>Aristo</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>UBTrapFlashController</name> <name>UBTrapFlashController</name>

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

@ -1504,6 +1504,21 @@ Sei sicuro di voler rimuovere %n pagina(e) dal documento &apos;%1&apos; selezion
<translation type="unfinished">Cestino</translation> <translation type="unfinished">Cestino</translation>
</message> </message>
</context> </context>
<context>
<name>UBFeaturesNewFolderDialog</name>
<message>
<source>Accept</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Cancel</source>
<translation type="unfinished">Annulla</translation>
</message>
<message>
<source>Enter a new folder name</source>
<translation type="unfinished"></translation>
</message>
</context>
<context> <context>
<name>UBFeaturesProgressInfo</name> <name>UBFeaturesProgressInfo</name>
<message> <message>
@ -2098,6 +2113,10 @@ risorsa multimediale ...</translation>
<source>Cache</source> <source>Cache</source>
<translation>Cache</translation> <translation>Cache</translation>
</message> </message>
<message>
<source>Aristo</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>UBTrapFlashController</name> <name>UBTrapFlashController</name>

@ -1499,6 +1499,21 @@
</message> </message>
<message> <message>
<source>Trash</source> <source>Trash</source>
<translation type="unfinished">סל</translation>
</message>
</context>
<context>
<name>UBFeaturesNewFolderDialog</name>
<message>
<source>Accept</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Cancel</source>
<translation type="unfinished">בטל</translation>
</message>
<message>
<source>Enter a new folder name</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
</context> </context>
@ -2088,6 +2103,10 @@ Do you want to ignore these errors for this host?</source>
<source>Cache</source> <source>Cache</source>
<translation>מטמון</translation> <translation>מטמון</translation>
</message> </message>
<message>
<source>Aristo</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>UBTrapFlashController</name> <name>UBTrapFlashController</name>

@ -1500,6 +1500,21 @@
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
</context> </context>
<context>
<name>UBFeaturesNewFolderDialog</name>
<message>
<source>Accept</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Cancel</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Enter a new folder name</source>
<translation type="unfinished"></translation>
</message>
</context>
<context> <context>
<name>UBFeaturesProgressInfo</name> <name>UBFeaturesProgressInfo</name>
<message> <message>
@ -2092,6 +2107,10 @@ Do you want to ignore these errors for this host?</source>
<source>Cache</source> <source>Cache</source>
<translation></translation> <translation></translation>
</message> </message>
<message>
<source>Aristo</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>UBTrapFlashController</name> <name>UBTrapFlashController</name>

@ -1500,6 +1500,21 @@
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
</context> </context>
<context>
<name>UBFeaturesNewFolderDialog</name>
<message>
<source>Accept</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Cancel</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Enter a new folder name</source>
<translation type="unfinished"></translation>
</message>
</context>
<context> <context>
<name>UBFeaturesProgressInfo</name> <name>UBFeaturesProgressInfo</name>
<message> <message>
@ -2091,6 +2106,10 @@ Do you want to ignore these errors for this host?</source>
<source>Cache</source> <source>Cache</source>
<translation></translation> <translation></translation>
</message> </message>
<message>
<source>Aristo</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>UBTrapFlashController</name> <name>UBTrapFlashController</name>

@ -1502,6 +1502,21 @@
<translation type="unfinished">Daba</translation> <translation type="unfinished">Daba</translation>
</message> </message>
</context> </context>
<context>
<name>UBFeaturesNewFolderDialog</name>
<message>
<source>Accept</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Cancel</source>
<translation type="unfinished">Ajanony</translation>
</message>
<message>
<source>Enter a new folder name</source>
<translation type="unfinished"></translation>
</message>
</context>
<context> <context>
<name>UBFeaturesProgressInfo</name> <name>UBFeaturesProgressInfo</name>
<message> <message>
@ -2093,6 +2108,10 @@ Tena tsy te hiraharaha an&apos;ireo tsy mety ho an&apos;ilay milina ve ianao?</t
<source>Cache</source> <source>Cache</source>
<translation>Tahiry</translation> <translation>Tahiry</translation>
</message> </message>
<message>
<source>Aristo</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>UBTrapFlashController</name> <name>UBTrapFlashController</name>

@ -1505,6 +1505,21 @@
<translation type="unfinished">Søppel</translation> <translation type="unfinished">Søppel</translation>
</message> </message>
</context> </context>
<context>
<name>UBFeaturesNewFolderDialog</name>
<message>
<source>Accept</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Cancel</source>
<translation type="unfinished">Avbryt</translation>
</message>
<message>
<source>Enter a new folder name</source>
<translation type="unfinished"></translation>
</message>
</context>
<context> <context>
<name>UBFeaturesProgressInfo</name> <name>UBFeaturesProgressInfo</name>
<message> <message>
@ -2091,6 +2106,10 @@ Do you want to ignore these errors for this host?</source>
<source>Cache</source> <source>Cache</source>
<translation>Skjul</translation> <translation>Skjul</translation>
</message> </message>
<message>
<source>Aristo</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>UBTrapFlashController</name> <name>UBTrapFlashController</name>

@ -1502,6 +1502,21 @@
<translation type="unfinished">Prullenbak</translation> <translation type="unfinished">Prullenbak</translation>
</message> </message>
</context> </context>
<context>
<name>UBFeaturesNewFolderDialog</name>
<message>
<source>Accept</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Cancel</source>
<translation type="unfinished">Annuleren</translation>
</message>
<message>
<source>Enter a new folder name</source>
<translation type="unfinished"></translation>
</message>
</context>
<context> <context>
<name>UBFeaturesProgressInfo</name> <name>UBFeaturesProgressInfo</name>
<message> <message>
@ -2087,6 +2102,10 @@ Do you want to ignore these errors for this host?</source>
<source>Cache</source> <source>Cache</source>
<translation>Cache</translation> <translation>Cache</translation>
</message> </message>
<message>
<source>Aristo</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>UBTrapFlashController</name> <name>UBTrapFlashController</name>

@ -1509,6 +1509,21 @@
<translation type="unfinished">Kosz</translation> <translation type="unfinished">Kosz</translation>
</message> </message>
</context> </context>
<context>
<name>UBFeaturesNewFolderDialog</name>
<message>
<source>Accept</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Cancel</source>
<translation type="unfinished">Anuluj</translation>
</message>
<message>
<source>Enter a new folder name</source>
<translation type="unfinished"></translation>
</message>
</context>
<context> <context>
<name>UBFeaturesProgressInfo</name> <name>UBFeaturesProgressInfo</name>
<message> <message>
@ -2100,6 +2115,10 @@ Czy chcesz ignorować te błędy dla tego hosta?</translation>
<source>Cache</source> <source>Cache</source>
<translation>Pamięć podręczna</translation> <translation>Pamięć podręczna</translation>
</message> </message>
<message>
<source>Aristo</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>UBTrapFlashController</name> <name>UBTrapFlashController</name>

@ -1505,6 +1505,21 @@
<translation type="unfinished">Lixo</translation> <translation type="unfinished">Lixo</translation>
</message> </message>
</context> </context>
<context>
<name>UBFeaturesNewFolderDialog</name>
<message>
<source>Accept</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Cancel</source>
<translation type="unfinished">Cancelar</translation>
</message>
<message>
<source>Enter a new folder name</source>
<translation type="unfinished"></translation>
</message>
</context>
<context> <context>
<name>UBFeaturesProgressInfo</name> <name>UBFeaturesProgressInfo</name>
<message> <message>
@ -2092,6 +2107,10 @@ Quer ignorar estes erros, deste servidor?</translation>
<source>Cache</source> <source>Cache</source>
<translation>Cache</translation> <translation>Cache</translation>
</message> </message>
<message>
<source>Aristo</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>UBTrapFlashController</name> <name>UBTrapFlashController</name>

@ -1500,6 +1500,21 @@
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
</context> </context>
<context>
<name>UBFeaturesNewFolderDialog</name>
<message>
<source>Accept</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Cancel</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Enter a new folder name</source>
<translation type="unfinished"></translation>
</message>
</context>
<context> <context>
<name>UBFeaturesProgressInfo</name> <name>UBFeaturesProgressInfo</name>
<message> <message>
@ -2085,6 +2100,10 @@ Do you want to ignore these errors for this host?</source>
<source>Cache</source> <source>Cache</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message>
<source>Aristo</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>UBTrapFlashController</name> <name>UBTrapFlashController</name>

@ -1502,6 +1502,21 @@
<translation type="unfinished">Coş de gunoi</translation> <translation type="unfinished">Coş de gunoi</translation>
</message> </message>
</context> </context>
<context>
<name>UBFeaturesNewFolderDialog</name>
<message>
<source>Accept</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Cancel</source>
<translation type="unfinished">Anulare</translation>
</message>
<message>
<source>Enter a new folder name</source>
<translation type="unfinished"></translation>
</message>
</context>
<context> <context>
<name>UBFeaturesProgressInfo</name> <name>UBFeaturesProgressInfo</name>
<message> <message>
@ -2093,6 +2108,10 @@ Doriţi să ignoraţi aceste erori pentru acest host?</translation>
<source>Cache</source> <source>Cache</source>
<translation>Cache</translation> <translation>Cache</translation>
</message> </message>
<message>
<source>Aristo</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>UBTrapFlashController</name> <name>UBTrapFlashController</name>

@ -1502,6 +1502,21 @@
<translation type="unfinished">Корзина</translation> <translation type="unfinished">Корзина</translation>
</message> </message>
</context> </context>
<context>
<name>UBFeaturesNewFolderDialog</name>
<message>
<source>Accept</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Cancel</source>
<translation type="unfinished">Отмена</translation>
</message>
<message>
<source>Enter a new folder name</source>
<translation type="unfinished"></translation>
</message>
</context>
<context> <context>
<name>UBFeaturesProgressInfo</name> <name>UBFeaturesProgressInfo</name>
<message> <message>
@ -2093,6 +2108,10 @@ Do you want to ignore these errors for this host?</source>
<source>Cache</source> <source>Cache</source>
<translation>Кэш</translation> <translation>Кэш</translation>
</message> </message>
<message>
<source>Aristo</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>UBTrapFlashController</name> <name>UBTrapFlashController</name>

@ -1506,6 +1506,21 @@
<translation type="unfinished">Kôš</translation> <translation type="unfinished">Kôš</translation>
</message> </message>
</context> </context>
<context>
<name>UBFeaturesNewFolderDialog</name>
<message>
<source>Accept</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Cancel</source>
<translation type="unfinished">Zrušiť</translation>
</message>
<message>
<source>Enter a new folder name</source>
<translation type="unfinished"></translation>
</message>
</context>
<context> <context>
<name>UBFeaturesProgressInfo</name> <name>UBFeaturesProgressInfo</name>
<message> <message>
@ -2097,6 +2112,10 @@ Chcete ignorovať tieto chyby na tomto serveri?</translation>
<source>Magnifier</source> <source>Magnifier</source>
<translation>Lupa</translation> <translation>Lupa</translation>
</message> </message>
<message>
<source>Aristo</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>UBTrapFlashController</name> <name>UBTrapFlashController</name>

@ -1502,6 +1502,21 @@
<translation type="unfinished">Papperskorg</translation> <translation type="unfinished">Papperskorg</translation>
</message> </message>
</context> </context>
<context>
<name>UBFeaturesNewFolderDialog</name>
<message>
<source>Accept</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Cancel</source>
<translation type="unfinished">Avsluta</translation>
</message>
<message>
<source>Enter a new folder name</source>
<translation type="unfinished"></translation>
</message>
</context>
<context> <context>
<name>UBFeaturesProgressInfo</name> <name>UBFeaturesProgressInfo</name>
<message> <message>
@ -2093,6 +2108,10 @@ Vill du ignorera felen för den här värden?</translation>
<source>Cache</source> <source>Cache</source>
<translation>Cache</translation> <translation>Cache</translation>
</message> </message>
<message>
<source>Aristo</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>UBTrapFlashController</name> <name>UBTrapFlashController</name>

@ -1501,6 +1501,21 @@
<translation type="unfinished">Çöp</translation> <translation type="unfinished">Çöp</translation>
</message> </message>
</context> </context>
<context>
<name>UBFeaturesNewFolderDialog</name>
<message>
<source>Accept</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Cancel</source>
<translation type="unfinished">İptal</translation>
</message>
<message>
<source>Enter a new folder name</source>
<translation type="unfinished"></translation>
</message>
</context>
<context> <context>
<name>UBFeaturesProgressInfo</name> <name>UBFeaturesProgressInfo</name>
<message> <message>
@ -2091,6 +2106,10 @@ Bu host için yukarıdaki hatalar yok sayılsın mı?</translation>
<source>Cache</source> <source>Cache</source>
<translation>Gizli Yer</translation> <translation>Gizli Yer</translation>
</message> </message>
<message>
<source>Aristo</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>UBTrapFlashController</name> <name>UBTrapFlashController</name>

@ -1500,6 +1500,21 @@
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
</context> </context>
<context>
<name>UBFeaturesNewFolderDialog</name>
<message>
<source>Accept</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Cancel</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Enter a new folder name</source>
<translation type="unfinished"></translation>
</message>
</context>
<context> <context>
<name>UBFeaturesProgressInfo</name> <name>UBFeaturesProgressInfo</name>
<message> <message>
@ -2091,6 +2106,10 @@ Do you want to ignore these errors for this host?</source>
<source>Cache</source> <source>Cache</source>
<translation></translation> <translation></translation>
</message> </message>
<message>
<source>Aristo</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>UBTrapFlashController</name> <name>UBTrapFlashController</name>

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.3 KiB

@ -0,0 +1,131 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 15.1.0, SVG Export Plug-In -->
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" [
<!ENTITY ns_flows "http://ns.adobe.com/Flows/1.0/">
]>
<svg version="1.1"
xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:a="http://ns.adobe.com/AdobeSVGViewerExtensions/3.0/"
x="0px" y="0px" width="107px" height="107px" viewBox="-17.174 -24.39 107 107"
overflow="visible" enable-background="new -17.174 -24.39 107 107" xml:space="preserve">
<defs>
</defs>
<g>
<linearGradient id="SVGID_1_" gradientUnits="userSpaceOnUse" x1="12.2129" y1="39.3477" x2="59.75" y2="39.3477">
<stop offset="0" style="stop-color:#898989"/>
<stop offset="0.0798" style="stop-color:#58585A"/>
<stop offset="0.4447" style="stop-color:#474749"/>
<stop offset="0.7853" style="stop-color:#3D3D3F"/>
<stop offset="0.8232" style="stop-color:#464648"/>
<stop offset="0.8857" style="stop-color:#5F5F61"/>
<stop offset="0.9646" style="stop-color:#87888A"/>
<stop offset="1" style="stop-color:#9B9C9E"/>
</linearGradient>
<path fill="url(#SVGID_1_)" d="M59.45,37.001l-1.48-9.818l-44.251,1.82l-1.206,7.998c-0.195,0.645-0.3,1.307-0.3,1.981
c0,6.921,10.642,12.53,23.769,12.53s23.769-5.609,23.769-12.53C59.75,38.308,59.646,37.646,59.45,37.001z"/>
<linearGradient id="SVGID_2_" gradientUnits="userSpaceOnUse" x1="13.1631" y1="38.3486" x2="58.7988" y2="38.3486">
<stop offset="0" style="stop-color:#898989"/>
<stop offset="0.0859" style="stop-color:#676769"/>
<stop offset="0.268" style="stop-color:#616163"/>
<stop offset="0.4049" style="stop-color:#58585A"/>
<stop offset="0.908" style="stop-color:#676769"/>
<stop offset="0.9389" style="stop-color:#6D6D6F"/>
<stop offset="0.9815" style="stop-color:#7F7F80"/>
<stop offset="1" style="stop-color:#898989"/>
</linearGradient>
<path fill="url(#SVGID_2_)" d="M58.512,36.071l-1.422-9.523l-42.48,1.766l-1.158,7.758c-0.188,0.625-0.288,1.268-0.288,1.922
c0,6.713,10.217,12.155,22.818,12.155s22.817-5.442,22.817-12.155C58.799,37.339,58.699,36.696,58.512,36.071z"/>
</g>
<linearGradient id="SVGID_3_" gradientUnits="userSpaceOnUse" x1="13.3369" y1="31.8486" x2="58.6104" y2="31.8486">
<stop offset="0" style="stop-color:#898989"/>
<stop offset="0.0859" style="stop-color:#3D3D3F"/>
<stop offset="0.39" style="stop-color:#434345"/>
<stop offset="0.8089" style="stop-color:#555557"/>
<stop offset="0.865" style="stop-color:#58585A"/>
<stop offset="1" style="stop-color:#58585A"/>
</linearGradient>
<path fill="url(#SVGID_3_)" d="M13.337,31.536c2,0.104,6.124,4.434,12.807,6.387c6.149,1.796,12.109,2.05,17.251,0
c8.431-3.361,13.344-8.442,15.216-6.49l-1-7.102H14.455L13.337,31.536z"/>
<polygon fill="#4C4C4C" points="36.026,31.402 35.981,31.382 35.981,36.613 36.034,36.638 72.053,19.763 72.053,17.504
67.232,17.504 "/>
<polygon fill="#58585A" points="35.981,31.382 4.822,17.504 0,17.504 0,19.763 35.981,36.613 "/>
<g>
<polygon fill="#B0B2B3" points="36.034,0.628 0,17.504 36.034,34.38 72.053,17.504 "/>
<linearGradient id="SVGID_4_" gradientUnits="userSpaceOnUse" x1="0" y1="17.5039" x2="72.0527" y2="17.5039">
<stop offset="0" style="stop-color:#676769"/>
<stop offset="0.3361" style="stop-color:#6D6D6F"/>
<stop offset="0.799" style="stop-color:#7F7F80"/>
<stop offset="1" style="stop-color:#898989"/>
</linearGradient>
<polygon fill="url(#SVGID_4_)" points="36.034,0.628 0,17.504 36.034,34.38 72.053,17.504 "/>
</g>
<linearGradient id="SVGID_5_" gradientUnits="userSpaceOnUse" x1="0" y1="25.5254" x2="72.0527" y2="25.5254">
<stop offset="0" style="stop-color:#58585A"/>
<stop offset="0.2484" style="stop-color:#5B5B5D"/>
<stop offset="0.4496" style="stop-color:#656567"/>
<stop offset="0.6342" style="stop-color:#767678"/>
<stop offset="0.8089" style="stop-color:#8D8E90"/>
<stop offset="0.9752" style="stop-color:#ABADAE"/>
<stop offset="1" style="stop-color:#B0B2B3"/>
</linearGradient>
<polygon fill="url(#SVGID_5_)" points="71.615,16.671 72.053,17.504 36.034,34.38 0,17.504 0.438,16.671 "/>
<g>
<polygon fill="#B0B2B3" points="36.034,0 0.438,16.671 36.034,33.341 71.615,16.671 "/>
<linearGradient id="SVGID_6_" gradientUnits="userSpaceOnUse" x1="0.4375" y1="16.6704" x2="71.6152" y2="16.6704">
<stop offset="0" style="stop-color:#3D3D3F"/>
<stop offset="0.1996" style="stop-color:#434345"/>
<stop offset="0.4751" style="stop-color:#555556"/>
<stop offset="0.7934" style="stop-color:#727273"/>
<stop offset="1" style="stop-color:#898989"/>
</linearGradient>
<polygon fill="url(#SVGID_6_)" points="36.034,0 0.438,16.671 36.034,33.341 71.615,16.671 "/>
</g>
<polyline fill="none" stroke="#F4CC4D" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" points="
37.981,15.245 17.606,24.812 17.606,40.544 "/>
<g>
<path fill="#C2981E" d="M20.072,38.685H15.14l-2.854,15.502c0,0.743,2.381,2.803,5.32,2.803c2.938,0,5.32-2.06,5.32-2.803
L20.072,38.685z"/>
<linearGradient id="SVGID_7_" gradientUnits="userSpaceOnUse" x1="16.2759" y1="47.8516" x2="20.8228" y2="47.5343">
<stop offset="0.5031" style="stop-color:#F4CC4D"/>
<stop offset="0.6585" style="stop-color:#EEC649"/>
<stop offset="0.8725" style="stop-color:#DCB43E"/>
<stop offset="1" style="stop-color:#CEA636"/>
</linearGradient>
<path fill="url(#SVGID_7_)" d="M20.072,38.685H15.14l-2.854,15.502c0,0.743,2.381,2.803,5.32,2.803c2.938,0,5.32-2.06,5.32-2.803
L20.072,38.685z"/>
</g>
<linearGradient id="SVGID_8_" gradientUnits="userSpaceOnUse" x1="18.2104" y1="44.4365" x2="20.937" y2="51.7485">
<stop offset="0" style="stop-color:#EAC049"/>
<stop offset="0.3765" style="stop-color:#E4BA45"/>
<stop offset="0.8952" style="stop-color:#D2AA39"/>
<stop offset="0.9877" style="stop-color:#CEA636"/>
</linearGradient>
<polygon fill="url(#SVGID_8_)" points="20.535,56.606 18.673,41.413 19.269,41.341 21.131,56.533 "/>
<linearGradient id="SVGID_9_" gradientUnits="userSpaceOnUse" x1="19.7891" y1="45.0312" x2="22.4774" y2="51.315">
<stop offset="0" style="stop-color:#CEA636"/>
<stop offset="0.416" style="stop-color:#CBA230"/>
<stop offset="0.9877" style="stop-color:#C2981E"/>
</linearGradient>
<polygon fill="url(#SVGID_9_)" points="22.019,55.55 19.634,40.843 20.226,40.747 22.61,55.454 "/>
<path fill="#B79537" d="M20.384,40.379c-0.584,0.987-1.588,1.745-2.814,1.745c-1.229,0-2.188-0.593-2.771-1.58l0.172-1.494
l5.169-0.275L20.384,40.379z"/>
<radialGradient id="SVGID_10_" cx="16.71" cy="36.7051" r="5.0908" gradientUnits="userSpaceOnUse">
<stop offset="0.5031" style="stop-color:#F4CC4D"/>
<stop offset="0.6585" style="stop-color:#EEC649"/>
<stop offset="0.8725" style="stop-color:#DCB43E"/>
<stop offset="1" style="stop-color:#CEA636"/>
</radialGradient>
<circle fill="url(#SVGID_10_)" cx="17.606" cy="38.685" r="2.923"/>
<g>
<path fill="#B79537" d="M17.606,56.989c-2.939,0-5.32-2.06-5.32-2.803v0.799c0,0.742,2.381,2.803,5.32,2.803
c2.938,0,5.32-2.061,5.32-2.803v-0.799C22.927,54.93,20.545,56.989,17.606,56.989z"/>
<linearGradient id="SVGID_11_" gradientUnits="userSpaceOnUse" x1="13.0371" y1="56.083" x2="22.2794" y2="55.6343">
<stop offset="0" style="stop-color:#F4CC4D"/>
<stop offset="0.2114" style="stop-color:#EEC647"/>
<stop offset="0.5031" style="stop-color:#DDB437"/>
<stop offset="0.8282" style="stop-color:#C2981E"/>
<stop offset="0.9877" style="stop-color:#D3A522"/>
</linearGradient>
<path fill="url(#SVGID_11_)" d="M17.606,56.989c-2.939,0-5.32-2.06-5.32-2.803v0.799c0,0.742,2.381,2.803,5.32,2.803
c2.938,0,5.32-2.061,5.32-2.803v-0.799C22.927,54.93,20.545,56.989,17.606,56.989z"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 7.7 KiB

@ -68,7 +68,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
/* API identifier */ /* Geonames API identifier */
var geonamesUser = "yimgo"; var geonamesUser = "yimgo";
/* map variable will be used to manipulate the map. This will be initialized like an OpenLayers.Map object. */ /* map variable will be used to manipulate the map. This will be initialized like an OpenLayers.Map object. */
@ -149,6 +149,17 @@
}); });
} }
function importData(data)
{
map.setCenter(new OpenLayers.LonLat(data["center"]["lon"], data["center"]["lat"]), data["zoom"]);
}
function exportData()
{
if (window.sankore)
sankore.setPreference("osm", JSON.stringify({center: map.getCenter(), zoom: map.getZoom()}));
}
window.onload = function() { window.onload = function() {
map = new OpenLayers.Map({ map = new OpenLayers.Map({
div: "map" div: "map"
@ -199,6 +210,20 @@
return false; return false;
}); });
/* importing state from Sankoré preferences */
if (window.sankore) {
if (sankore.preference("osm","")) {
importData(JSON.parse(sankore.preference("osm","")));
}
}
/* exporting state when receiving a leave event */
if (window.widget) {
window.widget.onleave = function() {
exportData();
}
}
}; };
--> -->
</script> </script>

@ -112,7 +112,7 @@ function start(){
drop: function(event, ui) { drop: function(event, ui) {
if($(ui.draggable).parent().parent().html() == $(this).parent().html()){ if($(ui.draggable).parent().parent().html() == $(this).parent().html()){
var tmp_ui = $(ui.draggable).parent(); var tmp_ui = $(ui.draggable).parent();
checkOnDrop($(this), $(ui.draggable)); $(this).append($(ui.draggable));
checkCorrectness(tmp_ui); checkCorrectness(tmp_ui);
} }
} }
@ -341,7 +341,7 @@ function importData(data){
drop: function(event, ui) { drop: function(event, ui) {
if($(ui.draggable).parent().parent().html() == $(this).parent().html()){ if($(ui.draggable).parent().parent().html() == $(this).parent().html()){
var tmp_ui = $(ui.draggable).parent(); var tmp_ui = $(ui.draggable).parent();
checkOnDrop($(this), $(ui.draggable)); $(this).append($(ui.draggable));
checkCorrectness(tmp_ui); checkCorrectness(tmp_ui);
} }
} }
@ -413,12 +413,11 @@ function importData(data){
drop: function(event, ui) { drop: function(event, ui) {
if($(ui.draggable).parent().parent().html() == $(this).parent().html()){ if($(ui.draggable).parent().parent().html() == $(this).parent().html()){
var tmp_ui = $(ui.draggable).parent(); var tmp_ui = $(ui.draggable).parent();
checkOnDrop($(this), $(ui.draggable)); $(this).append($(ui.draggable));
checkCorrectness(tmp_ui); checkCorrectness(tmp_ui);
} }
} }
}); });
checkCorrectness(imgs_container);
} }
all_imgs = $("<div class='all_imgs'>").appendTo(container); all_imgs = $("<div class='all_imgs'>").appendTo(container);
@ -458,6 +457,7 @@ function importData(data){
} }
}); });
container.appendTo("#data"); container.appendTo("#data");
checkCorrectness(all_imgs);
} }
} }
} }
@ -520,7 +520,7 @@ function showExample(){
drop: function(event, ui) { drop: function(event, ui) {
if($(ui.draggable).parent().parent().html() == $(this).parent().html()){ if($(ui.draggable).parent().parent().html() == $(this).parent().html()){
var tmp_ui = $(ui.draggable).parent(); var tmp_ui = $(ui.draggable).parent();
checkOnDrop($(this), $(ui.draggable)); $(this).append($(ui.draggable));
checkCorrectness(tmp_ui); checkCorrectness(tmp_ui);
} }
} }
@ -531,7 +531,7 @@ function showExample(){
drop: function(event, ui) { drop: function(event, ui) {
if($(ui.draggable).parent().parent().html() == $(this).parent().html()){ if($(ui.draggable).parent().parent().html() == $(this).parent().html()){
var tmp_ui = $(ui.draggable).parent(); var tmp_ui = $(ui.draggable).parent();
checkOnDrop($(this), $(ui.draggable)); $(this).append($(ui.draggable));
checkCorrectness(tmp_ui); checkCorrectness(tmp_ui);
} }
} }
@ -561,9 +561,9 @@ function addCategory(obj){
$("<button class='del_category'></button>").appendTo(imgs_container); $("<button class='del_category'></button>").appendTo(imgs_container);
$("<button class='add_category'></button>").appendTo(imgs_container); $("<button class='add_category'></button>").appendTo(imgs_container);
imgs_container.attr("ondragenter", "return false;") imgs_container.attr("ondragenter", "return false;")
.attr("ondragleave", "$(this).css(\"background-color\",\"\"); return false;") .attr("ondragleave", "$(this).css(\"background-color\",\"#e6f6ff\"); return false;")
.attr("ondragover", "$(this).css(\"background-color\",\"\"); return false;") .attr("ondragover", "$(this).css(\"background-color\",\"#c3e9ff\"); return false;")
.attr("ondrop", "$(this).css(\"background-color\",\"\"); return onDropTarget(this,event);"); .attr("ondrop", "$(this).css(\"background-color\",\"#e6f6ff\"); return onDropTarget(this,event);");
} }
//add new container //add new container
@ -686,8 +686,7 @@ function returnId(){
} }
//a func for checking when smth will drop //a func for checking when smth will drop
function checkOnDrop(dest, source){ function checkOnDrop(dest){
dest.append(source);
var tmp_count = dest.find("input[name='count']").val(); var tmp_count = dest.find("input[name='count']").val();
var tmp_mask = dest.find("input[name='mask']").val(); var tmp_mask = dest.find("input[name='mask']").val();
if(dest.find(".img_block").size() == tmp_count){ if(dest.find(".img_block").size() == tmp_count){
@ -697,47 +696,35 @@ function checkOnDrop(dest, source){
tmp_right = false; tmp_right = false;
}); });
if(tmp_right) if(tmp_right)
dest.removeClass("def_cont") dest.removeClass("def_cont").removeClass("red_cont").addClass("green_cont");
.removeClass("red_cont")
.addClass("green_cont");
else else
dest.removeClass("def_cont") dest.removeClass("def_cont").removeClass("green_cont").addClass("red_cont");
.removeClass("green_cont")
.addClass("red_cont");
} else } else
dest.removeClass("def_cont") dest.removeClass("def_cont").removeClass("green_cont").addClass("red_cont");
.removeClass("green_cont")
.addClass("red_cont");
} }
//checking source on correctness //checking source on correctness
function checkCorrectness(source){ function checkCorrectness(source){
if(!source.hasClass("all_imgs")){ if(!source.hasClass("all_imgs")){
var tmp_count = source.find("input[name='count']").val(); if(source.parent().find(".all_imgs").find(".img_block").size() == 0){
var tmp_mask = source.find("input[name='mask']").val(); source.parent().find(".imgs_cont").each(function(){
if(source.find(".img_block").size() == tmp_count){ checkOnDrop($(this))
var tmp_right = true; })
source.find(".img_block").each(function(){ } else {
if($(this).find("input").val() != tmp_mask) source.parent().find(".imgs_cont").each(function(){
tmp_right = false; $(this).addClass("def_cont").removeClass("green_cont").removeClass("red_cont");
}); })
}
if(tmp_right) } else {
source.removeClass("def_cont") if(source.find(".img_block").size() > 0){
.removeClass("red_cont") source.parent().find(".imgs_cont").each(function(){
.addClass("green_cont"); $(this).addClass("def_cont").removeClass("green_cont").removeClass("red_cont");
else })
source.removeClass("def_cont") } else {
.removeClass("green_cont") source.parent().find(".imgs_cont").each(function(){
.addClass("red_cont"); checkOnDrop($(this))
} else if(source.find(".img_block").size() == 0) })
source.addClass("def_cont") }
.removeClass("green_cont")
.removeClass("red_cont");
else
source.removeClass("def_cont")
.removeClass("green_cont")
.addClass("red_cont");
} }
} }

@ -130,7 +130,7 @@ function start(){
drop: function(event, ui) { drop: function(event, ui) {
if($(ui.draggable).parent().parent().html() == $(this).parent().html()){ if($(ui.draggable).parent().parent().html() == $(this).parent().html()){
var tmp_ui = $(ui.draggable).parent(); var tmp_ui = $(ui.draggable).parent();
checkOnDrop($(this), $(ui.draggable)); $(this).append($(ui.draggable));
checkCorrectness(tmp_ui); checkCorrectness(tmp_ui);
} }
} }
@ -358,7 +358,7 @@ function importData(data){
drop: function(event, ui) { drop: function(event, ui) {
if($(ui.draggable).parent().parent().html() == $(this).parent().html()){ if($(ui.draggable).parent().parent().html() == $(this).parent().html()){
var tmp_ui = $(ui.draggable).parent(); var tmp_ui = $(ui.draggable).parent();
checkOnDrop($(this), $(ui.draggable)); $(this).append($(ui.draggable));
checkCorrectness(tmp_ui); checkCorrectness(tmp_ui);
} }
} }
@ -430,7 +430,7 @@ function importData(data){
drop: function(event, ui) { drop: function(event, ui) {
if($(ui.draggable).parent().parent().html() == $(this).parent().html()){ if($(ui.draggable).parent().parent().html() == $(this).parent().html()){
var tmp_ui = $(ui.draggable).parent(); var tmp_ui = $(ui.draggable).parent();
checkOnDrop($(this), $(ui.draggable)); $(this).append($(ui.draggable));
checkCorrectness(tmp_ui); checkCorrectness(tmp_ui);
} }
} }
@ -475,6 +475,7 @@ function importData(data){
} }
}); });
container.appendTo("#data"); container.appendTo("#data");
checkCorrectness(all_imgs);
} }
} }
} }
@ -537,7 +538,7 @@ function showExample(){
drop: function(event, ui) { drop: function(event, ui) {
if($(ui.draggable).parent().parent().html() == $(this).parent().html()){ if($(ui.draggable).parent().parent().html() == $(this).parent().html()){
var tmp_ui = $(ui.draggable).parent(); var tmp_ui = $(ui.draggable).parent();
checkOnDrop($(this), $(ui.draggable)); $(this).append($(ui.draggable));
checkCorrectness(tmp_ui); checkCorrectness(tmp_ui);
} }
} }
@ -548,7 +549,7 @@ function showExample(){
drop: function(event, ui) { drop: function(event, ui) {
if($(ui.draggable).parent().parent().html() == $(this).parent().html()){ if($(ui.draggable).parent().parent().html() == $(this).parent().html()){
var tmp_ui = $(ui.draggable).parent(); var tmp_ui = $(ui.draggable).parent();
checkOnDrop($(this), $(ui.draggable)); $(this).append($(ui.draggable));
checkCorrectness(tmp_ui); checkCorrectness(tmp_ui);
} }
} }
@ -578,9 +579,9 @@ function addCategory(obj){
$("<button class='del_category'></button>").appendTo(imgs_container); $("<button class='del_category'></button>").appendTo(imgs_container);
$("<button class='add_category'></button>").appendTo(imgs_container); $("<button class='add_category'></button>").appendTo(imgs_container);
imgs_container.attr("ondragenter", "return false;") imgs_container.attr("ondragenter", "return false;")
.attr("ondragleave", "$(this).css(\"background-color\",\"\"); return false;") .attr("ondragleave", "$(this).css(\"background-color\",\"#e6f6ff\"); return false;")
.attr("ondragover", "$(this).css(\"background-color\",\"\"); return false;") .attr("ondragover", "$(this).css(\"background-color\",\"#c3e9ff\"); return false;")
.attr("ondrop", "$(this).css(\"background-color\",\"\"); return onDropTarget(this,event);"); .attr("ondrop", "$(this).css(\"background-color\",\"#e6f6ff\"); return onDropTarget(this,event);");
} }
//add new container //add new container
@ -599,9 +600,9 @@ function addContainer(){
$("<button class='del_category'></button>").appendTo(imgs_container); $("<button class='del_category'></button>").appendTo(imgs_container);
$("<button class='add_category'></button>").appendTo(imgs_container); $("<button class='add_category'></button>").appendTo(imgs_container);
imgs_container.attr("ondragenter", "return false;") imgs_container.attr("ondragenter", "return false;")
.attr("ondragleave", "$(this).css(\"background-color\",\"\"); return false;") .attr("ondragleave", "$(this).css(\"background-color\",\"#e6f6ff\"); return false;")
.attr("ondragover", "$(this).css(\"background-color\",\"\"); return false;") .attr("ondragover", "$(this).css(\"background-color\",\"#c3e9ff\"); return false;")
.attr("ondrop", "$(this).css(\"background-color\",\"\"); return onDropTarget(this,event);"); .attr("ondrop", "$(this).css(\"background-color\",\"#e6f6ff\"); return onDropTarget(this,event);");
container.insertBefore($(".add_block")); container.insertBefore($(".add_block"));
} }
@ -704,8 +705,7 @@ function returnId(){
} }
//a func for checking when smth will drop //a func for checking when smth will drop
function checkOnDrop(dest, source){ function checkOnDrop(dest){
dest.append(source);
var tmp_count = dest.find("input[name='count']").val(); var tmp_count = dest.find("input[name='count']").val();
var tmp_mask = dest.find("input[name='mask']").val(); var tmp_mask = dest.find("input[name='mask']").val();
if(dest.find(".img_block").size() == tmp_count){ if(dest.find(".img_block").size() == tmp_count){
@ -715,47 +715,35 @@ function checkOnDrop(dest, source){
tmp_right = false; tmp_right = false;
}); });
if(tmp_right) if(tmp_right)
dest.removeClass("def_cont") dest.removeClass("def_cont").removeClass("red_cont").addClass("green_cont");
.removeClass("red_cont")
.addClass("green_cont");
else else
dest.removeClass("def_cont") dest.removeClass("def_cont").removeClass("green_cont").addClass("red_cont");
.removeClass("green_cont")
.addClass("red_cont");
} else } else
dest.removeClass("def_cont") dest.removeClass("def_cont").removeClass("green_cont").addClass("red_cont");
.removeClass("green_cont")
.addClass("red_cont");
} }
//checking source on correctness //checking source on correctness
function checkCorrectness(source){ function checkCorrectness(source){
if(!source.hasClass("all_imgs")){ if(!source.hasClass("all_imgs")){
var tmp_count = source.find("input[name='count']").val(); if(source.parent().find(".all_imgs").find(".img_block").size() == 0){
var tmp_mask = source.find("input[name='mask']").val(); source.parent().find(".imgs_cont").each(function(){
if(source.find(".img_block").size() == tmp_count){ checkOnDrop($(this))
var tmp_right = true; })
source.find(".img_block").each(function(){ } else {
if($(this).find("input").val() != tmp_mask) source.parent().find(".imgs_cont").each(function(){
tmp_right = false; $(this).addClass("def_cont").removeClass("green_cont").removeClass("red_cont");
}); })
}
if(tmp_right) } else {
source.removeClass("def_cont") if(source.find(".img_block").size() > 0){
.removeClass("red_cont") source.parent().find(".imgs_cont").each(function(){
.addClass("green_cont"); $(this).addClass("def_cont").removeClass("green_cont").removeClass("red_cont");
else })
source.removeClass("def_cont") } else {
.removeClass("green_cont") source.parent().find(".imgs_cont").each(function(){
.addClass("red_cont"); checkOnDrop($(this))
} else if(source.find(".img_block").size() == 0) })
source.addClass("def_cont") }
.removeClass("green_cont")
.removeClass("red_cont");
else
source.removeClass("def_cont")
.removeClass("green_cont")
.addClass("red_cont");
} }
} }

@ -111,7 +111,7 @@ function start(){
drop: function(event, ui) { drop: function(event, ui) {
if($(ui.draggable).parent().parent().html() == $(this).parent().html()){ if($(ui.draggable).parent().parent().html() == $(this).parent().html()){
var tmp_ui = $(ui.draggable).parent(); var tmp_ui = $(ui.draggable).parent();
checkOnDrop($(this), $(ui.draggable)); $(this).append($(ui.draggable));
checkCorrectness(tmp_ui); checkCorrectness(tmp_ui);
} }
} }
@ -342,7 +342,7 @@ function importData(data){
drop: function(event, ui) { drop: function(event, ui) {
if($(ui.draggable).parent().parent().html() == $(this).parent().html()){ if($(ui.draggable).parent().parent().html() == $(this).parent().html()){
var tmp_ui = $(ui.draggable).parent(); var tmp_ui = $(ui.draggable).parent();
checkOnDrop($(this), $(ui.draggable)); $(this).append($(ui.draggable));
checkCorrectness(tmp_ui); checkCorrectness(tmp_ui);
} }
} }
@ -414,7 +414,7 @@ function importData(data){
drop: function(event, ui) { drop: function(event, ui) {
if($(ui.draggable).parent().parent().html() == $(this).parent().html()){ if($(ui.draggable).parent().parent().html() == $(this).parent().html()){
var tmp_ui = $(ui.draggable).parent(); var tmp_ui = $(ui.draggable).parent();
checkOnDrop($(this), $(ui.draggable)); $(this).append($(ui.draggable));
checkCorrectness(tmp_ui); checkCorrectness(tmp_ui);
} }
} }
@ -459,6 +459,7 @@ function importData(data){
} }
}); });
container.appendTo("#data"); container.appendTo("#data");
checkCorrectness(all_imgs);
} }
} }
} }
@ -521,7 +522,7 @@ function showExample(){
drop: function(event, ui) { drop: function(event, ui) {
if($(ui.draggable).parent().parent().html() == $(this).parent().html()){ if($(ui.draggable).parent().parent().html() == $(this).parent().html()){
var tmp_ui = $(ui.draggable).parent(); var tmp_ui = $(ui.draggable).parent();
checkOnDrop($(this), $(ui.draggable)); $(this).append($(ui.draggable));
checkCorrectness(tmp_ui); checkCorrectness(tmp_ui);
} }
} }
@ -532,7 +533,7 @@ function showExample(){
drop: function(event, ui) { drop: function(event, ui) {
if($(ui.draggable).parent().parent().html() == $(this).parent().html()){ if($(ui.draggable).parent().parent().html() == $(this).parent().html()){
var tmp_ui = $(ui.draggable).parent(); var tmp_ui = $(ui.draggable).parent();
checkOnDrop($(this), $(ui.draggable)); $(this).append($(ui.draggable));
checkCorrectness(tmp_ui); checkCorrectness(tmp_ui);
} }
} }
@ -562,9 +563,9 @@ function addCategory(obj){
$("<button class='del_category'></button>").appendTo(imgs_container); $("<button class='del_category'></button>").appendTo(imgs_container);
$("<button class='add_category'></button>").appendTo(imgs_container); $("<button class='add_category'></button>").appendTo(imgs_container);
imgs_container.attr("ondragenter", "return false;") imgs_container.attr("ondragenter", "return false;")
.attr("ondragleave", "$(this).css(\"background-color\",\"\"); return false;") .attr("ondragleave", "$(this).css(\"background-color\",\"#e6f6ff\"); return false;")
.attr("ondragover", "$(this).css(\"background-color\",\"\"); return false;") .attr("ondragover", "$(this).css(\"background-color\",\"#c3e9ff\"); return false;")
.attr("ondrop", "$(this).css(\"background-color\",\"\"); return onDropTarget(this,event);"); .attr("ondrop", "$(this).css(\"background-color\",\"#e6f6ff\"); return onDropTarget(this,event);");
} }
//add new container //add new container
@ -583,9 +584,9 @@ function addContainer(){
$("<button class='del_category'></button>").appendTo(imgs_container); $("<button class='del_category'></button>").appendTo(imgs_container);
$("<button class='add_category'></button>").appendTo(imgs_container); $("<button class='add_category'></button>").appendTo(imgs_container);
imgs_container.attr("ondragenter", "return false;") imgs_container.attr("ondragenter", "return false;")
.attr("ondragleave", "$(this).css(\"background-color\",\"\"); return false;") .attr("ondragleave", "$(this).css(\"background-color\",\"#e6f6ff\"); return false;")
.attr("ondragover", "$(this).css(\"background-color\",\"\"); return false;") .attr("ondragover", "$(this).css(\"background-color\",\"#c3e9ff\"); return false;")
.attr("ondrop", "$(this).css(\"background-color\",\"\"); return onDropTarget(this,event);"); .attr("ondrop", "$(this).css(\"background-color\",\"#e6f6ff\"); return onDropTarget(this,event);");
container.insertBefore($(".add_block")); container.insertBefore($(".add_block"));
} }
@ -688,8 +689,7 @@ function returnId(){
} }
//a func for checking when smth will drop //a func for checking when smth will drop
function checkOnDrop(dest, source){ function checkOnDrop(dest){
dest.append(source);
var tmp_count = dest.find("input[name='count']").val(); var tmp_count = dest.find("input[name='count']").val();
var tmp_mask = dest.find("input[name='mask']").val(); var tmp_mask = dest.find("input[name='mask']").val();
if(dest.find(".img_block").size() == tmp_count){ if(dest.find(".img_block").size() == tmp_count){
@ -699,47 +699,35 @@ function checkOnDrop(dest, source){
tmp_right = false; tmp_right = false;
}); });
if(tmp_right) if(tmp_right)
dest.removeClass("def_cont") dest.removeClass("def_cont").removeClass("red_cont").addClass("green_cont");
.removeClass("red_cont")
.addClass("green_cont");
else else
dest.removeClass("def_cont") dest.removeClass("def_cont").removeClass("green_cont").addClass("red_cont");
.removeClass("green_cont")
.addClass("red_cont");
} else } else
dest.removeClass("def_cont") dest.removeClass("def_cont").removeClass("green_cont").addClass("red_cont");
.removeClass("green_cont")
.addClass("red_cont");
} }
//checking source on correctness //checking source on correctness
function checkCorrectness(source){ function checkCorrectness(source){
if(!source.hasClass("all_imgs")){ if(!source.hasClass("all_imgs")){
var tmp_count = source.find("input[name='count']").val(); if(source.parent().find(".all_imgs").find(".img_block").size() == 0){
var tmp_mask = source.find("input[name='mask']").val(); source.parent().find(".imgs_cont").each(function(){
if(source.find(".img_block").size() == tmp_count){ checkOnDrop($(this))
var tmp_right = true; })
source.find(".img_block").each(function(){ } else {
if($(this).find("input").val() != tmp_mask) source.parent().find(".imgs_cont").each(function(){
tmp_right = false; $(this).addClass("def_cont").removeClass("green_cont").removeClass("red_cont");
}); })
}
if(tmp_right) } else {
source.removeClass("def_cont") if(source.find(".img_block").size() > 0){
.removeClass("red_cont") source.parent().find(".imgs_cont").each(function(){
.addClass("green_cont"); $(this).addClass("def_cont").removeClass("green_cont").removeClass("red_cont");
else })
source.removeClass("def_cont") } else {
.removeClass("green_cont") source.parent().find(".imgs_cont").each(function(){
.addClass("red_cont"); checkOnDrop($(this))
} else if(source.find(".img_block").size() == 0) })
source.addClass("def_cont") }
.removeClass("green_cont")
.removeClass("red_cont");
else
source.removeClass("def_cont")
.removeClass("green_cont")
.addClass("red_cont");
} }
} }

@ -120,7 +120,7 @@ function start(){
drop: function(event, ui) { drop: function(event, ui) {
if($(ui.draggable).parent().parent().html() == $(this).parent().html()){ if($(ui.draggable).parent().parent().html() == $(this).parent().html()){
var tmp_ui = $(ui.draggable).parent(); var tmp_ui = $(ui.draggable).parent();
checkOnDrop($(this), $(ui.draggable)); $(this).append($(ui.draggable));
checkCorrectness(tmp_ui); checkCorrectness(tmp_ui);
} }
} }
@ -339,7 +339,7 @@ function importData(data){
drop: function(event, ui) { drop: function(event, ui) {
if($(ui.draggable).parent().parent().html() == $(this).parent().html()){ if($(ui.draggable).parent().parent().html() == $(this).parent().html()){
var tmp_ui = $(ui.draggable).parent(); var tmp_ui = $(ui.draggable).parent();
checkOnDrop($(this), $(ui.draggable)); $(this).append($(ui.draggable));
checkCorrectness(tmp_ui); checkCorrectness(tmp_ui);
} }
} }
@ -410,12 +410,11 @@ function importData(data){
drop: function(event, ui) { drop: function(event, ui) {
if($(ui.draggable).parent().parent().html() == $(this).parent().html()){ if($(ui.draggable).parent().parent().html() == $(this).parent().html()){
var tmp_ui = $(ui.draggable).parent(); var tmp_ui = $(ui.draggable).parent();
checkOnDrop($(this), $(ui.draggable)); $(this).append($(ui.draggable));
checkCorrectness(tmp_ui); checkCorrectness(tmp_ui);
} }
} }
}); });
checkCorrectness(imgs_container);
} }
all_imgs = $("<div class='all_imgs'>").appendTo(container); all_imgs = $("<div class='all_imgs'>").appendTo(container);
@ -453,6 +452,7 @@ function importData(data){
} }
} }
}); });
checkCorrectness(all_imgs);
} }
} }
} }
@ -516,7 +516,7 @@ function showExample(){
drop: function(event, ui) { drop: function(event, ui) {
if($(ui.draggable).parent().parent().html() == $(this).parent().html()){ if($(ui.draggable).parent().parent().html() == $(this).parent().html()){
var tmp_ui = $(ui.draggable).parent(); var tmp_ui = $(ui.draggable).parent();
checkOnDrop($(this), $(ui.draggable)); $(this).append($(ui.draggable));
checkCorrectness(tmp_ui); checkCorrectness(tmp_ui);
} }
} }
@ -527,7 +527,7 @@ function showExample(){
drop: function(event, ui) { drop: function(event, ui) {
if($(ui.draggable).parent().parent().html() == $(this).parent().html()){ if($(ui.draggable).parent().parent().html() == $(this).parent().html()){
var tmp_ui = $(ui.draggable).parent(); var tmp_ui = $(ui.draggable).parent();
checkOnDrop($(this), $(ui.draggable)); $(this).append($(ui.draggable));
checkCorrectness(tmp_ui); checkCorrectness(tmp_ui);
} }
} }
@ -685,8 +685,7 @@ function changeStyle(val){
} }
//a func for checking when smth will drop //a func for checking when smth will drop
function checkOnDrop(dest, source){ function checkOnDrop(dest){
dest.append(source);
var tmp_count = dest.find("input[name='count']").val(); var tmp_count = dest.find("input[name='count']").val();
var tmp_mask = dest.find("input[name='mask']").val(); var tmp_mask = dest.find("input[name='mask']").val();
if(dest.find(".img_block").size() == tmp_count){ if(dest.find(".img_block").size() == tmp_count){
@ -696,46 +695,34 @@ function checkOnDrop(dest, source){
tmp_right = false; tmp_right = false;
}); });
if(tmp_right) if(tmp_right)
dest.removeClass("def_cont") dest.removeClass("def_cont").removeClass("red_cont").addClass("green_cont");
.removeClass("red_cont")
.addClass("green_cont");
else else
dest.removeClass("def_cont") dest.removeClass("def_cont").removeClass("green_cont").addClass("red_cont");
.removeClass("green_cont")
.addClass("red_cont");
} else } else
dest.removeClass("def_cont") dest.removeClass("def_cont").removeClass("green_cont").addClass("red_cont");
.removeClass("green_cont")
.addClass("red_cont");
} }
//checking source on correctness //checking source on correctness
function checkCorrectness(source){ function checkCorrectness(source){
if(!source.hasClass("all_imgs")){ if(!source.hasClass("all_imgs")){
var tmp_count = source.find("input[name='count']").val(); if(source.parent().find(".all_imgs").find(".img_block").size() == 0){
var tmp_mask = source.find("input[name='mask']").val(); source.parent().find(".imgs_cont").each(function(){
if(source.find(".img_block").size() == tmp_count){ checkOnDrop($(this))
var tmp_right = true; })
source.find(".img_block").each(function(){ } else {
if($(this).find("input").val() != tmp_mask) source.parent().find(".imgs_cont").each(function(){
tmp_right = false; $(this).addClass("def_cont").removeClass("green_cont").removeClass("red_cont");
}); })
}
if(tmp_right) } else {
source.removeClass("def_cont") if(source.find(".img_block").size() > 0){
.removeClass("red_cont") source.parent().find(".imgs_cont").each(function(){
.addClass("green_cont"); $(this).addClass("def_cont").removeClass("green_cont").removeClass("red_cont");
else })
source.removeClass("def_cont") } else {
.removeClass("green_cont") source.parent().find(".imgs_cont").each(function(){
.addClass("red_cont"); checkOnDrop($(this))
} else if(source.find(".img_block").size() == 0) })
source.addClass("def_cont") }
.removeClass("green_cont")
.removeClass("red_cont");
else
source.removeClass("def_cont")
.removeClass("green_cont")
.addClass("red_cont");
} }
} }

@ -141,7 +141,7 @@ function start(){
drop: function(event, ui) { drop: function(event, ui) {
if($(ui.draggable).parent().parent().html() == $(this).parent().html()){ if($(ui.draggable).parent().parent().html() == $(this).parent().html()){
var tmp_ui = $(ui.draggable).parent(); var tmp_ui = $(ui.draggable).parent();
checkOnDrop($(this), $(ui.draggable)); $(this).append($(ui.draggable));
checkCorrectness(tmp_ui); checkCorrectness(tmp_ui);
} }
} }
@ -360,7 +360,7 @@ function importData(data){
drop: function(event, ui) { drop: function(event, ui) {
if($(ui.draggable).parent().parent().html() == $(this).parent().html()){ if($(ui.draggable).parent().parent().html() == $(this).parent().html()){
var tmp_ui = $(ui.draggable).parent(); var tmp_ui = $(ui.draggable).parent();
checkOnDrop($(this), $(ui.draggable)); $(this).append($(ui.draggable));
checkCorrectness(tmp_ui); checkCorrectness(tmp_ui);
} }
} }
@ -431,7 +431,7 @@ function importData(data){
drop: function(event, ui) { drop: function(event, ui) {
if($(ui.draggable).parent().parent().html() == $(this).parent().html()){ if($(ui.draggable).parent().parent().html() == $(this).parent().html()){
var tmp_ui = $(ui.draggable).parent(); var tmp_ui = $(ui.draggable).parent();
checkOnDrop($(this), $(ui.draggable)); $(this).append($(ui.draggable));
checkCorrectness(tmp_ui); checkCorrectness(tmp_ui);
} }
} }
@ -474,6 +474,7 @@ function importData(data){
} }
} }
}); });
checkCorrectness(all_imgs);
} }
} }
} }
@ -537,7 +538,7 @@ function showExample(){
drop: function(event, ui) { drop: function(event, ui) {
if($(ui.draggable).parent().parent().html() == $(this).parent().html()){ if($(ui.draggable).parent().parent().html() == $(this).parent().html()){
var tmp_ui = $(ui.draggable).parent(); var tmp_ui = $(ui.draggable).parent();
checkOnDrop($(this), $(ui.draggable)); $(this).append($(ui.draggable));
checkCorrectness(tmp_ui); checkCorrectness(tmp_ui);
} }
} }
@ -548,7 +549,7 @@ function showExample(){
drop: function(event, ui) { drop: function(event, ui) {
if($(ui.draggable).parent().parent().html() == $(this).parent().html()){ if($(ui.draggable).parent().parent().html() == $(this).parent().html()){
var tmp_ui = $(ui.draggable).parent(); var tmp_ui = $(ui.draggable).parent();
checkOnDrop($(this), $(ui.draggable)); $(this).append($(ui.draggable));
checkCorrectness(tmp_ui); checkCorrectness(tmp_ui);
} }
} }
@ -706,8 +707,7 @@ function changeStyle(val){
} }
//a func for checking when smth will drop //a func for checking when smth will drop
function checkOnDrop(dest, source){ function checkOnDrop(dest){
dest.append(source);
var tmp_count = dest.find("input[name='count']").val(); var tmp_count = dest.find("input[name='count']").val();
var tmp_mask = dest.find("input[name='mask']").val(); var tmp_mask = dest.find("input[name='mask']").val();
if(dest.find(".img_block").size() == tmp_count){ if(dest.find(".img_block").size() == tmp_count){
@ -717,46 +717,34 @@ function checkOnDrop(dest, source){
tmp_right = false; tmp_right = false;
}); });
if(tmp_right) if(tmp_right)
dest.removeClass("def_cont") dest.removeClass("def_cont").removeClass("red_cont").addClass("green_cont");
.removeClass("red_cont")
.addClass("green_cont");
else else
dest.removeClass("def_cont") dest.removeClass("def_cont").removeClass("green_cont").addClass("red_cont");
.removeClass("green_cont")
.addClass("red_cont");
} else } else
dest.removeClass("def_cont") dest.removeClass("def_cont").removeClass("green_cont").addClass("red_cont");
.removeClass("green_cont")
.addClass("red_cont");
} }
//checking source on correctness //checking source on correctness
function checkCorrectness(source){ function checkCorrectness(source){
if(!source.hasClass("all_imgs")){ if(!source.hasClass("all_imgs")){
var tmp_count = source.find("input[name='count']").val(); if(source.parent().find(".all_imgs").find(".img_block").size() == 0){
var tmp_mask = source.find("input[name='mask']").val(); source.parent().find(".imgs_cont").each(function(){
if(source.find(".img_block").size() == tmp_count){ checkOnDrop($(this))
var tmp_right = true; })
source.find(".img_block").each(function(){ } else {
if($(this).find("input").val() != tmp_mask) source.parent().find(".imgs_cont").each(function(){
tmp_right = false; $(this).addClass("def_cont").removeClass("green_cont").removeClass("red_cont");
}); })
}
if(tmp_right) } else {
source.removeClass("def_cont") if(source.find(".img_block").size() > 0){
.removeClass("red_cont") source.parent().find(".imgs_cont").each(function(){
.addClass("green_cont"); $(this).addClass("def_cont").removeClass("green_cont").removeClass("red_cont");
else })
source.removeClass("def_cont") } else {
.removeClass("green_cont") source.parent().find(".imgs_cont").each(function(){
.addClass("red_cont"); checkOnDrop($(this))
} else if(source.find(".img_block").size() == 0) })
source.addClass("def_cont") }
.removeClass("green_cont")
.removeClass("red_cont");
else
source.removeClass("def_cont")
.removeClass("green_cont")
.addClass("red_cont");
} }
} }

@ -120,7 +120,7 @@ function start(){
drop: function(event, ui) { drop: function(event, ui) {
if($(ui.draggable).parent().parent().html() == $(this).parent().html()){ if($(ui.draggable).parent().parent().html() == $(this).parent().html()){
var tmp_ui = $(ui.draggable).parent(); var tmp_ui = $(ui.draggable).parent();
checkOnDrop($(this), $(ui.draggable)); $(this).append($(ui.draggable));
checkCorrectness(tmp_ui); checkCorrectness(tmp_ui);
} }
} }
@ -339,7 +339,7 @@ function importData(data){
drop: function(event, ui) { drop: function(event, ui) {
if($(ui.draggable).parent().parent().html() == $(this).parent().html()){ if($(ui.draggable).parent().parent().html() == $(this).parent().html()){
var tmp_ui = $(ui.draggable).parent(); var tmp_ui = $(ui.draggable).parent();
checkOnDrop($(this), $(ui.draggable)); $(this).append($(ui.draggable));
checkCorrectness(tmp_ui); checkCorrectness(tmp_ui);
} }
} }
@ -410,7 +410,7 @@ function importData(data){
drop: function(event, ui) { drop: function(event, ui) {
if($(ui.draggable).parent().parent().html() == $(this).parent().html()){ if($(ui.draggable).parent().parent().html() == $(this).parent().html()){
var tmp_ui = $(ui.draggable).parent(); var tmp_ui = $(ui.draggable).parent();
checkOnDrop($(this), $(ui.draggable)); $(this).append($(ui.draggable));
checkCorrectness(tmp_ui); checkCorrectness(tmp_ui);
} }
} }
@ -453,6 +453,7 @@ function importData(data){
} }
} }
}); });
checkCorrectness(all_imgs);
} }
} }
} }
@ -516,7 +517,7 @@ function showExample(){
drop: function(event, ui) { drop: function(event, ui) {
if($(ui.draggable).parent().parent().html() == $(this).parent().html()){ if($(ui.draggable).parent().parent().html() == $(this).parent().html()){
var tmp_ui = $(ui.draggable).parent(); var tmp_ui = $(ui.draggable).parent();
checkOnDrop($(this), $(ui.draggable)); $(this).append($(ui.draggable));
checkCorrectness(tmp_ui); checkCorrectness(tmp_ui);
} }
} }
@ -527,7 +528,7 @@ function showExample(){
drop: function(event, ui) { drop: function(event, ui) {
if($(ui.draggable).parent().parent().html() == $(this).parent().html()){ if($(ui.draggable).parent().parent().html() == $(this).parent().html()){
var tmp_ui = $(ui.draggable).parent(); var tmp_ui = $(ui.draggable).parent();
checkOnDrop($(this), $(ui.draggable)); $(this).append($(ui.draggable));
checkCorrectness(tmp_ui); checkCorrectness(tmp_ui);
} }
} }
@ -685,8 +686,7 @@ function changeStyle(val){
} }
//a func for checking when smth will drop //a func for checking when smth will drop
function checkOnDrop(dest, source){ function checkOnDrop(dest){
dest.append(source);
var tmp_count = dest.find("input[name='count']").val(); var tmp_count = dest.find("input[name='count']").val();
var tmp_mask = dest.find("input[name='mask']").val(); var tmp_mask = dest.find("input[name='mask']").val();
if(dest.find(".img_block").size() == tmp_count){ if(dest.find(".img_block").size() == tmp_count){
@ -696,46 +696,34 @@ function checkOnDrop(dest, source){
tmp_right = false; tmp_right = false;
}); });
if(tmp_right) if(tmp_right)
dest.removeClass("def_cont") dest.removeClass("def_cont").removeClass("red_cont").addClass("green_cont");
.removeClass("red_cont")
.addClass("green_cont");
else else
dest.removeClass("def_cont") dest.removeClass("def_cont").removeClass("green_cont").addClass("red_cont");
.removeClass("green_cont")
.addClass("red_cont");
} else } else
dest.removeClass("def_cont") dest.removeClass("def_cont").removeClass("green_cont").addClass("red_cont");
.removeClass("green_cont")
.addClass("red_cont");
} }
//checking source on correctness //checking source on correctness
function checkCorrectness(source){ function checkCorrectness(source){
if(!source.hasClass("all_imgs")){ if(!source.hasClass("all_imgs")){
var tmp_count = source.find("input[name='count']").val(); if(source.parent().find(".all_imgs").find(".img_block").size() == 0){
var tmp_mask = source.find("input[name='mask']").val(); source.parent().find(".imgs_cont").each(function(){
if(source.find(".img_block").size() == tmp_count){ checkOnDrop($(this))
var tmp_right = true; })
source.find(".img_block").each(function(){ } else {
if($(this).find("input").val() != tmp_mask) source.parent().find(".imgs_cont").each(function(){
tmp_right = false; $(this).addClass("def_cont").removeClass("green_cont").removeClass("red_cont");
}); })
}
if(tmp_right) } else {
source.removeClass("def_cont") if(source.find(".img_block").size() > 0){
.removeClass("red_cont") source.parent().find(".imgs_cont").each(function(){
.addClass("green_cont"); $(this).addClass("def_cont").removeClass("green_cont").removeClass("red_cont");
else })
source.removeClass("def_cont") } else {
.removeClass("green_cont") source.parent().find(".imgs_cont").each(function(){
.addClass("red_cont"); checkOnDrop($(this))
} else if(source.find(".img_block").size() == 0) })
source.addClass("def_cont") }
.removeClass("green_cont")
.removeClass("red_cont");
else
source.removeClass("def_cont")
.removeClass("green_cont")
.addClass("red_cont");
} }
} }

@ -165,6 +165,7 @@
<file>images/toolPalette/triangleTool.png</file> <file>images/toolPalette/triangleTool.png</file>
<file>images/toolPalette/protractorTool.png</file> <file>images/toolPalette/protractorTool.png</file>
<file>images/toolPalette/compassTool.png</file> <file>images/toolPalette/compassTool.png</file>
<file>images/toolPalette/aristoTool.png</file>
<file>images/toolPalette/maskTool.png</file> <file>images/toolPalette/maskTool.png</file>
<file>images/toolPalette/magnifierTool.png</file> <file>images/toolPalette/magnifierTool.png</file>
<file>images/extraPalette/blackout.png</file> <file>images/extraPalette/blackout.png</file>
@ -365,6 +366,6 @@
<file>images/teacherGuide/pencil.svg</file> <file>images/teacherGuide/pencil.svg</file>
<file>images/duplicateDisabled.svg</file> <file>images/duplicateDisabled.svg</file>
<file>images/teacherGuide/flash_24x24.svg</file> <file>images/teacherGuide/flash_24x24.svg</file>
<file>images/toque.png</file> <file>images/toque.svg</file>
</qresource> </qresource>
</RCC> </RCC>

@ -171,8 +171,11 @@ UBDocumentProxy* UBImportDocument::importFile(const QFile& pFile, const QString&
return NULL; return NULL;
} }
bool addTitlePage = false;
if(UBSettings::settings()->teacherGuidePageZeroActivated->get().toBool() && !QFile(documentRootFolder+"/page000.svg").exists())
addTitlePage=true;
UBDocumentProxy* newDocument = UBPersistenceManager::persistenceManager()->createDocumentFromDir(documentRootFolder, pGroup); UBDocumentProxy* newDocument = UBPersistenceManager::persistenceManager()->createDocumentFromDir(documentRootFolder, pGroup, "", false, addTitlePage);
UBApplication::showMessage(tr("Import successful.")); UBApplication::showMessage(tr("Import successful."));
return newDocument; return newDocument;
} }

@ -941,18 +941,6 @@ UBGraphicsScene* UBSvgSubsetAdaptor::UBSvgSubsetReader::loadScene()
readGroupRoot(); readGroupRoot();
} }
// else if (mXmlReader.name() == "teacherBar" || mXmlReader.name() == "teacherGuide"){
// sTeacherGuideNode.clear();
// sTeacherGuideNode += "<teacherGuide version=\"" + mXmlReader.attributes().value("version").toString() + "\">";
// sTeacherGuideNode += "\n";
// }
// else if (mXmlReader.name() == "media" || mXmlReader.name() == "link" || mXmlReader.name() == "title" || mXmlReader.name() == "comment" || mXmlReader.name() == "action")
// {
// sTeacherGuideNode += "<" + mXmlReader.name().toString() + " ";
// foreach(QXmlStreamAttribute attribute, mXmlReader.attributes())
// sTeacherGuideNode += attribute.name().toString() + "=\"" + attribute.value().toString() + "\" ";
// sTeacherGuideNode += " />\n";
// }
else else
{ {
// NOOP // NOOP
@ -976,17 +964,6 @@ UBGraphicsScene* UBSvgSubsetAdaptor::UBSvgSubsetReader::loadScene()
mGroupDarkBackgroundColor = QColor(); mGroupDarkBackgroundColor = QColor();
mGroupLightBackgroundColor = QColor(); mGroupLightBackgroundColor = QColor();
} }
// else if (mXmlReader.name() == "teacherBar" || mXmlReader.name() == "teacherGuide"){
// sTeacherGuideNode += "</teacherGuide>";
// qDebug() << sTeacherGuideNode;
// QMap<QString,IDataStorage*> elements = getAdditionalElementToStore();
// IDataStorage* storageClass = elements.value("teacherGuide");
// if(storageClass){
// storageClass->load(sTeacherGuideNode);
// }
// }
} }
} }
@ -1147,17 +1124,10 @@ bool UBSvgSubsetAdaptor::UBSvgSubsetWriter::persistScene(int pageIndex)
QDomElement groupRoot = groupDomDocument.createElement(tGroups); QDomElement groupRoot = groupDomDocument.createElement(tGroups);
groupDomDocument.appendChild(groupRoot); groupDomDocument.appendChild(groupRoot);
static int i = 0;
qDebug() << "persist call no is " << ++i;
QBuffer buffer; QBuffer buffer;
buffer.open(QBuffer::WriteOnly); buffer.open(QBuffer::WriteOnly);
mXmlWriter.setDevice(&buffer); mXmlWriter.setDevice(&buffer);
//Unused variable
//QTime timer = QTime::currentTime();
mXmlWriter.setAutoFormatting(true); mXmlWriter.setAutoFormatting(true);
mXmlWriter.writeStartDocument(); mXmlWriter.writeStartDocument();
@ -3120,7 +3090,7 @@ UBGraphicsTriangle* UBSvgSubsetAdaptor::UBSvgSubsetReader::triangleFromSvg()
UBGraphicsCache* UBSvgSubsetAdaptor::UBSvgSubsetReader::cacheFromSvg() UBGraphicsCache* UBSvgSubsetAdaptor::UBSvgSubsetReader::cacheFromSvg()
{ {
UBGraphicsCache* pCache = new UBGraphicsCache(); UBGraphicsCache* pCache = UBGraphicsCache::instance(mScene);
pCache->setData(UBGraphicsItemData::ItemLayerType, QVariant(UBItemLayerType::Tool)); pCache->setData(UBGraphicsItemData::ItemLayerType, QVariant(UBItemLayerType::Tool));
graphicsItemFromSvg(pCache); graphicsItemFromSvg(pCache);

@ -23,7 +23,12 @@
#include "core/UBApplication.h" #include "core/UBApplication.h"
#include "core/UBSettings.h" #include "core/UBSettings.h"
#include "gui/UBDockTeacherGuideWidget.h"
#include "gui/UBTeacherGuideWidget.h"
#include "board/UBBoardController.h" #include "board/UBBoardController.h"
#include "board/UBBoardPaletteManager.h"
#include "document/UBDocumentProxy.h" #include "document/UBDocumentProxy.h"
@ -120,7 +125,7 @@ void UBThumbnailAdaptor::persistScene(UBDocumentProxy* proxy, UBGraphicsScene* p
QFile thumbFile(fileName); QFile thumbFile(fileName);
if (pScene->isModified() || overrideModified || !thumbFile.exists()) if (pScene->isModified() || overrideModified || !thumbFile.exists() || UBApplication::boardController->paletteManager()->teacherGuideDockWidget()->teacherGuideWidget()->isModified())
{ {
qreal nominalWidth = pScene->nominalSize().width(); qreal nominalWidth = pScene->nominalSize().width();
qreal nominalHeight = pScene->nominalSize().height(); qreal nominalHeight = pScene->nominalSize().height();
@ -152,6 +157,12 @@ void UBThumbnailAdaptor::persistScene(UBDocumentProxy* proxy, UBGraphicsScene* p
pScene->render(&painter, imageRect, sceneRect, Qt::KeepAspectRatio); pScene->render(&painter, imageRect, sceneRect, Qt::KeepAspectRatio);
if(UBApplication::boardController->paletteManager()->teacherGuideDockWidget()->teacherGuideWidget()->isModified()){
QPixmap toque(":images/toque.svg");
painter.setOpacity(0.6);
painter.drawPixmap(QPoint(width - toque.width(),0),toque);
}
pScene->setRenderingContext(UBGraphicsScene::Screen); pScene->setRenderingContext(UBGraphicsScene::Screen);
pScene->setRenderingQuality(UBItem::RenderingQualityNormal); pScene->setRenderingQuality(UBItem::RenderingQualityNormal);

@ -40,7 +40,7 @@ UBLibraryAPI::~UBLibraryAPI()
void UBLibraryAPI::addObject(QString pUrl, int width, int height, int x, int y, bool background) void UBLibraryAPI::addObject(QString pUrl, int width, int height, int x, int y, bool background)
{ {
if (UBApplication::boardController) if (UBApplication::boardController)
UBApplication::boardController->downloadURL(QUrl(pUrl), QPointF(x, y), QSize(width, height), background); UBApplication::boardController->downloadURL(QUrl(pUrl), QString(), QPointF(x, y), QSize(width, height), background);
} }

@ -201,7 +201,7 @@ void UBWidgetUniboardAPI::addObject(QString pUrl, int width, int height, int x,
if (UBApplication::boardController->activeScene() != mScene) if (UBApplication::boardController->activeScene() != mScene)
return; return;
UBApplication::boardController->downloadURL(QUrl(pUrl), QPointF(x, y), QSize(width, height), background); UBApplication::boardController->downloadURL(QUrl(pUrl), QString(), QPointF(x, y), QSize(width, height), background);
} }
@ -506,7 +506,7 @@ void UBWidgetUniboardAPI::ProcessDropEvent(QGraphicsSceneDragDropEvent *event)
sDownloadFileDesc desc; sDownloadFileDesc desc;
desc.dest = sDownloadFileDesc::graphicsWidget; desc.dest = sDownloadFileDesc::graphicsWidget;
desc.modal = true; desc.modal = true;
desc.url = url; desc.srcUrl = url;
desc.currentSize = 0; desc.currentSize = 0;
desc.name = QFileInfo(url).fileName(); desc.name = QFileInfo(url).fileName();
desc.totalSize = 0; // The total size will be retrieved during the download desc.totalSize = 0; // The total size will be retrieved during the download

@ -95,6 +95,7 @@ UBBoardController::UBBoardController(UBMainWindow* mainWindow)
, mCleanupDone(false) , mCleanupDone(false)
, mCacheWidgetIsEnabled(false) , mCacheWidgetIsEnabled(false)
, mDeletingSceneIndex(-1) , mDeletingSceneIndex(-1)
, mMovingSceneIndex(-1)
, mActionGroupText(tr("Group")) , mActionGroupText(tr("Group"))
, mActionUngroupText(tr("Ungroup")) , mActionUngroupText(tr("Ungroup"))
{ {
@ -131,7 +132,7 @@ void UBBoardController::init()
, this, SLOT(lastWindowClosed())); , this, SLOT(lastWindowClosed()));
connect(UBDownloadManager::downloadManager(), SIGNAL(downloadModalFinished()), this, SLOT(onDownloadModalFinished())); connect(UBDownloadManager::downloadManager(), SIGNAL(downloadModalFinished()), this, SLOT(onDownloadModalFinished()));
connect(UBDownloadManager::downloadManager(), SIGNAL(addDownloadedFileToBoard(bool,QUrl,QString,QByteArray,QPointF,QSize,bool)), this, SLOT(downloadFinished(bool,QUrl,QString,QByteArray,QPointF,QSize,bool))); connect(UBDownloadManager::downloadManager(), SIGNAL(addDownloadedFileToBoard(bool,QUrl,QUrl,QString,QByteArray,QPointF,QSize,bool)), this, SLOT(downloadFinished(bool,QUrl,QUrl,QString,QByteArray,QPointF,QSize,bool)));
UBDocumentProxy* doc = UBPersistenceManager::persistenceManager()->createDocument(); UBDocumentProxy* doc = UBPersistenceManager::persistenceManager()->createDocument();
@ -562,7 +563,12 @@ UBGraphicsItem *UBBoardController::duplicateItem(UBItem *item)
} }
UBMimeType::Enum itemMimeType; UBMimeType::Enum itemMimeType;
QString contentTypeHeader = UBFileSystemUtils::mimeTypeFromFileName(item->sourceUrl().toLocalFile());
QString srcFile = item->sourceUrl().toLocalFile();
if (srcFile.isEmpty())
srcFile = item->sourceUrl().toString();
QString contentTypeHeader = UBFileSystemUtils::mimeTypeFromFileName(srcFile);
if(NULL != qgraphicsitem_cast<UBGraphicsGroupContainerItem*>(commonItem)) if(NULL != qgraphicsitem_cast<UBGraphicsGroupContainerItem*>(commonItem))
itemMimeType = UBMimeType::Group; itemMimeType = UBMimeType::Group;
else else
@ -587,8 +593,9 @@ UBGraphicsItem *UBBoardController::duplicateItem(UBItem *item)
if (mitem) if (mitem)
{ {
sourceUrl = mitem->mediaFileUrl(); sourceUrl = mitem->mediaFileUrl();
downloadURL(sourceUrl, srcFile, itemPos, QSize(itemSize.width(), itemSize.height()), false, false);
} }
}break; }return NULL; // async operation
case UBMimeType::VectorImage: case UBMimeType::VectorImage:
{ {
@ -661,7 +668,7 @@ UBGraphicsItem *UBBoardController::duplicateItem(UBItem *item)
if (retItem) if (retItem)
return retItem; return retItem;
UBItem *createdItem = downloadFinished(true, sourceUrl, contentTypeHeader, pData, itemPos, QSize(itemSize.width(), itemSize.height()), false); UBItem *createdItem = downloadFinished(true, sourceUrl, sourceUrl, contentTypeHeader, pData, itemPos, QSize(itemSize.width(), itemSize.height()), false);
if (createdItem) if (createdItem)
{ {
createdItem->setSourceUrl(item->sourceUrl()); createdItem->setSourceUrl(item->sourceUrl());
@ -675,6 +682,7 @@ UBGraphicsItem *UBBoardController::duplicateItem(UBItem *item)
retItem = dynamic_cast<UBGraphicsItem *>(createdItem); retItem = dynamic_cast<UBGraphicsItem *>(createdItem);
} }
return retItem; return retItem;
} }
@ -960,7 +968,7 @@ void UBBoardController::groupButtonClicked()
} }
} }
void UBBoardController::downloadURL(const QUrl& url, const QPointF& pPos, const QSize& pSize, bool isBackground, bool internalData) void UBBoardController::downloadURL(const QUrl& url, QString contentSourceUrl, const QPointF& pPos, const QSize& pSize, bool isBackground, bool internalData)
{ {
qDebug() << "something has been dropped on the board! Url is: " << url.toString(); qDebug() << "something has been dropped on the board! Url is: " << url.toString();
QString sUrl = url.toString(); QString sUrl = url.toString();
@ -971,7 +979,7 @@ void UBBoardController::downloadURL(const QUrl& url, const QPointF& pPos, const
if(sUrl.startsWith("uniboardTool://")) if(sUrl.startsWith("uniboardTool://"))
{ {
downloadFinished(true, url, "application/vnd.mnemis-uniboard-tool", QByteArray(), pPos, pSize, isBackground); downloadFinished(true, url, QUrl(), "application/vnd.mnemis-uniboard-tool", QByteArray(), pPos, pSize, isBackground);
} }
else if (sUrl.startsWith("file://") || sUrl.startsWith("/")) else if (sUrl.startsWith("file://") || sUrl.startsWith("/"))
{ {
@ -984,22 +992,37 @@ void UBBoardController::downloadURL(const QUrl& url, const QPointF& pPos, const
|| contentType.startsWith("application/widget") || contentType.startsWith("application/widget")
|| contentType.startsWith("application/vnd.apple-widget"); || contentType.startsWith("application/vnd.apple-widget");
QFile file(fileName);
if (shouldLoadFileData) if (shouldLoadFileData)
{
QFile file(fileName);
file.open(QIODevice::ReadOnly); file.open(QIODevice::ReadOnly);
downloadFinished(true, formedUrl, QUrl(), contentType, file.readAll(), pPos, pSize, isBackground, internalData);
file.close();
}
else
{
// media items should be copyed in separate thread
downloadFinished(true, formedUrl, contentType, file.readAll(), pPos, pSize, isBackground, internalData); sDownloadFileDesc desc;
desc.modal = false;
desc.srcUrl = sUrl;
desc.originalSrcUrl = contentSourceUrl;
desc.currentSize = 0;
desc.name = QFileInfo(url.toString()).fileName();
desc.totalSize = 0; // The total size will be retrieved during the download
desc.pos = pPos;
desc.size = pSize;
desc.isBackground = isBackground;
if (shouldLoadFileData) UBDownloadManager::downloadManager()->addFileToDownload(desc);
file.close(); }
} }
else else
{ {
// When we fall there, it means that we are dropping something from the web to the board // When we fall there, it means that we are dropping something from the web to the board
sDownloadFileDesc desc; sDownloadFileDesc desc;
desc.modal = true; desc.modal = true;
desc.url = url.toString(); desc.srcUrl = url.toString();
desc.currentSize = 0; desc.currentSize = 0;
desc.name = QFileInfo(url.toString()).fileName(); desc.name = QFileInfo(url.toString()).fileName();
desc.totalSize = 0; // The total size will be retrieved during the download desc.totalSize = 0; // The total size will be retrieved during the download
@ -1022,7 +1045,7 @@ void UBBoardController::downloadURL(const QUrl& url, const QPointF& pPos, const
} }
UBItem *UBBoardController::downloadFinished(bool pSuccess, QUrl sourceUrl, QString pContentTypeHeader, UBItem *UBBoardController::downloadFinished(bool pSuccess, QUrl sourceUrl, QUrl contentUrl, QString pContentTypeHeader,
QByteArray pData, QPointF pPos, QSize pSize, QByteArray pData, QPointF pPos, QSize pSize,
bool isBackground, bool internalData) bool isBackground, bool internalData)
{ {
@ -1157,11 +1180,9 @@ UBItem *UBBoardController::downloadFinished(bool pSuccess, QUrl sourceUrl, QStri
qDebug() << "accepting mime type" << mimeType << "as video"; qDebug() << "accepting mime type" << mimeType << "as video";
UBGraphicsMediaItem *mediaVideoItem = 0; UBGraphicsMediaItem *mediaVideoItem = 0;
QUuid uuid = QUuid::createUuid();
if (pData.length() > 0) if (pData.length() > 0)
{ {
QUuid uuid = QUuid::createUuid();
QString destFile; QString destFile;
bool b = UBPersistenceManager::persistenceManager()->addFileToDocument(selectedDocument(), bool b = UBPersistenceManager::persistenceManager()->addFileToDocument(selectedDocument(),
sourceUrl.toString(), sourceUrl.toString(),
@ -1178,16 +1199,19 @@ UBItem *UBBoardController::downloadFinished(bool pSuccess, QUrl sourceUrl, QStri
QUrl url = QUrl::fromLocalFile(destFile); QUrl url = QUrl::fromLocalFile(destFile);
mediaVideoItem = mActiveScene->addMedia(url, false, pPos); mediaVideoItem = mActiveScene->addMedia(url, false, pPos);
mediaVideoItem->setSourceUrl(sourceUrl);
mediaVideoItem->setUuid(uuid);
} }
else else
{ {
mediaVideoItem = addVideo(sourceUrl, false, pPos); qDebug() << sourceUrl.toString();
mediaVideoItem = addVideo(sourceUrl, false, pPos, true);
} }
if(mediaVideoItem){ if(mediaVideoItem){
if (contentUrl.isEmpty())
mediaVideoItem->setSourceUrl(sourceUrl);
else
mediaVideoItem->setSourceUrl(contentUrl);
mediaVideoItem->setUuid(uuid);
connect(this, SIGNAL(activeSceneChanged()), mediaVideoItem, SLOT(activeSceneChanged())); connect(this, SIGNAL(activeSceneChanged()), mediaVideoItem, SLOT(activeSceneChanged()));
} }
@ -1201,10 +1225,9 @@ UBItem *UBBoardController::downloadFinished(bool pSuccess, QUrl sourceUrl, QStri
UBGraphicsMediaItem *audioMediaItem = 0; UBGraphicsMediaItem *audioMediaItem = 0;
QUuid uuid = QUuid::createUuid();
if (pData.length() > 0) if (pData.length() > 0)
{ {
QUuid uuid = QUuid::createUuid();
QString destFile; QString destFile;
bool b = UBPersistenceManager::persistenceManager()->addFileToDocument(selectedDocument(), bool b = UBPersistenceManager::persistenceManager()->addFileToDocument(selectedDocument(),
sourceUrl.toString(), sourceUrl.toString(),
@ -1221,16 +1244,18 @@ UBItem *UBBoardController::downloadFinished(bool pSuccess, QUrl sourceUrl, QStri
QUrl url = QUrl::fromLocalFile(destFile); QUrl url = QUrl::fromLocalFile(destFile);
audioMediaItem = mActiveScene->addMedia(url, false, pPos); audioMediaItem = mActiveScene->addMedia(url, false, pPos);
audioMediaItem->setSourceUrl(sourceUrl);
audioMediaItem->setUuid(uuid);
} }
else else
{ {
audioMediaItem = addAudio(sourceUrl, false, pPos); audioMediaItem = addAudio(sourceUrl, false, pPos, true);
} }
if(audioMediaItem){ if(audioMediaItem){
if (contentUrl.isEmpty())
audioMediaItem->setSourceUrl(sourceUrl);
else
audioMediaItem->setSourceUrl(contentUrl);
audioMediaItem->setUuid(uuid);
connect(this, SIGNAL(activeSceneChanged()), audioMediaItem, SLOT(activeSceneChanged())); connect(this, SIGNAL(activeSceneChanged()), audioMediaItem, SLOT(activeSceneChanged()));
} }
@ -1362,6 +1387,11 @@ UBItem *UBBoardController::downloadFinished(bool pSuccess, QUrl sourceUrl, QStri
mActiveScene->addMask(pPos); mActiveScene->addMask(pPos);
UBDrawingController::drawingController()->setStylusTool(UBStylusTool::Selector); UBDrawingController::drawingController()->setStylusTool(UBStylusTool::Selector);
} }
else if (sourceUrl.toString() == UBToolsManager::manager()->aristo.id)
{
mActiveScene->addAristo(pPos);
UBDrawingController::drawingController()->setStylusTool(UBStylusTool::Selector);
}
else else
{ {
showMessage(tr("Unknown tool type %1").arg(sourceUrl.toString())); showMessage(tr("Unknown tool type %1").arg(sourceUrl.toString()));
@ -1450,9 +1480,6 @@ void UBBoardController::setActiveDocumentScene(UBDocumentProxy* pDocumentProxy,
{ {
freezeW3CWidgets(true); freezeW3CWidgets(true);
if(sceneChange)
emit activeSceneWillChange();
persistCurrentScene(); persistCurrentScene();
ClearUndoStack(); ClearUndoStack();
@ -1500,14 +1527,17 @@ void UBBoardController::moveSceneToIndex(int source, int target)
{ {
if (selectedDocument()) if (selectedDocument())
{ {
persistCurrentScene(); persistCurrentScene();
UBDocumentContainer::movePageToIndex(source, target); UBDocumentContainer::movePageToIndex(source, target);
selectedDocument()->setMetaData(UBSettings::documentUpdatedAt, UBStringUtils::toUtcIsoDateTime(QDateTime::currentDateTime())); selectedDocument()->setMetaData(UBSettings::documentUpdatedAt, UBStringUtils::toUtcIsoDateTime(QDateTime::currentDateTime()));
UBMetadataDcSubsetAdaptor::persist(selectedDocument()); UBMetadataDcSubsetAdaptor::persist(selectedDocument());
mMovingSceneIndex = source;
setActiveDocumentScene(target); setActiveDocumentScene(target);
mMovingSceneIndex = -1;
} }
} }
@ -1786,6 +1816,13 @@ qreal UBBoardController::currentZoom()
return 1.0; return 1.0;
} }
void UBBoardController::removeTool(UBToolWidget* toolWidget)
{
toolWidget->hide();
delete toolWidget;
}
void UBBoardController::hide() void UBBoardController::hide()
{ {
UBApplication::mainWindow->actionLibrary->setChecked(false); UBApplication::mainWindow->actionLibrary->setChecked(false);
@ -1800,11 +1837,9 @@ void UBBoardController::persistCurrentScene()
{ {
if(UBPersistenceManager::persistenceManager() if(UBPersistenceManager::persistenceManager()
&& selectedDocument() && mActiveScene && mActiveSceneIndex != mDeletingSceneIndex && selectedDocument() && mActiveScene && mActiveSceneIndex != mDeletingSceneIndex
&& (mActiveSceneIndex >= 0) && (mActiveSceneIndex >= 0) && mActiveSceneIndex != mMovingSceneIndex
&& (mActiveScene->isModified() || (UBApplication::boardController->paletteManager()->teacherGuideDockWidget() && UBApplication::boardController->paletteManager()->teacherGuideDockWidget()->teacherGuideWidget()->isModified()))) && (mActiveScene->isModified() || (UBApplication::boardController->paletteManager()->teacherGuideDockWidget() && UBApplication::boardController->paletteManager()->teacherGuideDockWidget()->teacherGuideWidget()->isModified())))
{ {
emit activeSceneWillBePersisted();
UBPersistenceManager::persistenceManager()->persistDocumentScene(selectedDocument(), mActiveScene, mActiveSceneIndex); UBPersistenceManager::persistenceManager()->persistDocumentScene(selectedDocument(), mActiveScene, mActiveSceneIndex);
updatePage(mActiveSceneIndex); updatePage(mActiveSceneIndex);
} }
@ -2016,11 +2051,14 @@ void UBBoardController::grabScene(const QRectF& pSceneRect)
} }
} }
UBGraphicsMediaItem* UBBoardController::addVideo(const QUrl& pSourceUrl, bool startPlay, const QPointF& pos) UBGraphicsMediaItem* UBBoardController::addVideo(const QUrl& pSourceUrl, bool startPlay, const QPointF& pos, bool bUseSource)
{ {
QUuid uuid = QUuid::createUuid(); QUuid uuid = QUuid::createUuid();
QUrl concreteUrl = pSourceUrl; QUrl concreteUrl = pSourceUrl;
// media file is not in document folder yet
if (!bUseSource)
{
QString destFile; QString destFile;
bool b = UBPersistenceManager::persistenceManager()->addFileToDocument(selectedDocument(), bool b = UBPersistenceManager::persistenceManager()->addFileToDocument(selectedDocument(),
pSourceUrl.toLocalFile(), pSourceUrl.toLocalFile(),
@ -2033,6 +2071,8 @@ UBGraphicsMediaItem* UBBoardController::addVideo(const QUrl& pSourceUrl, bool st
return NULL; return NULL;
} }
concreteUrl = QUrl::fromLocalFile(destFile); concreteUrl = QUrl::fromLocalFile(destFile);
}// else we just use source Url.
UBGraphicsMediaItem* vi = mActiveScene->addMedia(concreteUrl, startPlay, pos); UBGraphicsMediaItem* vi = mActiveScene->addMedia(concreteUrl, startPlay, pos);
selectedDocument()->setMetaData(UBSettings::documentUpdatedAt, UBStringUtils::toUtcIsoDateTime(QDateTime::currentDateTime())); selectedDocument()->setMetaData(UBSettings::documentUpdatedAt, UBStringUtils::toUtcIsoDateTime(QDateTime::currentDateTime()));
@ -2046,11 +2086,14 @@ UBGraphicsMediaItem* UBBoardController::addVideo(const QUrl& pSourceUrl, bool st
} }
UBGraphicsMediaItem* UBBoardController::addAudio(const QUrl& pSourceUrl, bool startPlay, const QPointF& pos) UBGraphicsMediaItem* UBBoardController::addAudio(const QUrl& pSourceUrl, bool startPlay, const QPointF& pos, bool bUseSource)
{ {
QUuid uuid = QUuid::createUuid(); QUuid uuid = QUuid::createUuid();
QUrl concreteUrl = pSourceUrl; QUrl concreteUrl = pSourceUrl;
// media file is not in document folder yet
if (!bUseSource)
{
QString destFile; QString destFile;
bool b = UBPersistenceManager::persistenceManager()->addFileToDocument(selectedDocument(), bool b = UBPersistenceManager::persistenceManager()->addFileToDocument(selectedDocument(),
pSourceUrl.toLocalFile(), pSourceUrl.toLocalFile(),
@ -2063,6 +2106,7 @@ UBGraphicsMediaItem* UBBoardController::addAudio(const QUrl& pSourceUrl, bool st
return NULL; return NULL;
} }
concreteUrl = QUrl::fromLocalFile(destFile); concreteUrl = QUrl::fromLocalFile(destFile);
}// else we just use source Url.
UBGraphicsMediaItem* ai = mActiveScene->addMedia(concreteUrl, startPlay, pos); UBGraphicsMediaItem* ai = mActiveScene->addMedia(concreteUrl, startPlay, pos);
selectedDocument()->setMetaData(UBSettings::documentUpdatedAt, UBStringUtils::toUtcIsoDateTime(QDateTime::currentDateTime())); selectedDocument()->setMetaData(UBSettings::documentUpdatedAt, UBStringUtils::toUtcIsoDateTime(QDateTime::currentDateTime()));
@ -2236,7 +2280,7 @@ void UBBoardController::processMimeData(const QMimeData* pMimeData, const QPoint
if("" != url) if("" != url)
{ {
downloadURL(url, pPos); downloadURL(url, QString(), pPos);
return; return;
} }
} }
@ -2256,7 +2300,7 @@ void UBBoardController::processMimeData(const QMimeData* pMimeData, const QPoint
foreach(const QUrl url, urls){ foreach(const QUrl url, urls){
QPointF pos(pPos + QPointF(index * 15, index * 15)); QPointF pos(pPos + QPointF(index * 15, index * 15));
downloadURL(url, pos, QSize(), false, internalData); downloadURL(url, QString(), pos, QSize(), false, internalData);
index++; index++;
} }
@ -2282,7 +2326,7 @@ void UBBoardController::processMimeData(const QMimeData* pMimeData, const QPoint
// Sometimes, it is possible to have an URL as text. we check here if it is the case // Sometimes, it is possible to have an URL as text. we check here if it is the case
QString qsTmp = pMimeData->text().remove(QRegExp("[\\0]")); QString qsTmp = pMimeData->text().remove(QRegExp("[\\0]"));
if(qsTmp.startsWith("http")){ if(qsTmp.startsWith("http")){
downloadURL(QUrl(qsTmp), pPos); downloadURL(QUrl(qsTmp), QString(), pPos);
} }
else{ else{
mActiveScene->addTextHtml(pMimeData->html(), pPos); mActiveScene->addTextHtml(pMimeData->html(), pPos);
@ -2296,7 +2340,7 @@ void UBBoardController::processMimeData(const QMimeData* pMimeData, const QPoint
QString qsUrl = UBPlatformUtils::urlFromClipboard(); QString qsUrl = UBPlatformUtils::urlFromClipboard();
if("" != qsUrl){ if("" != qsUrl){
// We finally got the url of the dropped ressource! Let's import it! // We finally got the url of the dropped ressource! Let's import it!
downloadURL(qsUrl, pPos); downloadURL(qsUrl, qsUrl, pPos);
return; return;
} }
#endif #endif
@ -2313,31 +2357,32 @@ void UBBoardController::togglePodcast(bool checked)
void UBBoardController::moveGraphicsWidgetToControlView(UBGraphicsWidgetItem* graphicsWidget) void UBBoardController::moveGraphicsWidgetToControlView(UBGraphicsWidgetItem* graphicsWidget)
{ {
graphicsWidget->remove();
mActiveScene->setURStackEnable(false); mActiveScene->setURStackEnable(false);
UBGraphicsItem *toolW3C = duplicateItem(dynamic_cast<UBItem *>(graphicsWidget)); graphicsWidget->remove(false);
UBGraphicsWidgetItem *copyedGraphicsWidget = NULL; mActiveScene->addItemToDeletion(graphicsWidget);
if (UBGraphicsWidgetItem::Type == toolW3C->type())
copyedGraphicsWidget = static_cast<UBGraphicsWidgetItem *>(toolW3C);
UBToolWidget *toolWidget = new UBToolWidget(copyedGraphicsWidget); UBToolWidget *toolWidget = new UBToolWidget(graphicsWidget, mControlView);
mActiveScene->addItem(toolWidget);
qreal ssf = 1 / UBApplication::boardController->systemScaleFactor();
toolWidget->setScale(ssf);
toolWidget->setPos(graphicsWidget->scenePos());
mActiveScene->setURStackEnable(true); mActiveScene->setURStackEnable(true);
QPoint controlViewPos = mControlView->mapFromScene(graphicsWidget->sceneBoundingRect().center());
toolWidget->centerOn(mControlView->mapTo(mControlContainer, controlViewPos));
toolWidget->show();
} }
void UBBoardController::moveToolWidgetToScene(UBToolWidget* toolWidget) void UBBoardController::moveToolWidgetToScene(UBToolWidget* toolWidget)
{ {
UBGraphicsWidgetItem *graphicsWidgetItem = addW3cWidget(toolWidget->graphicsWidgetItem()->widgetUrl(), QPointF(0, 0)); UBGraphicsWidgetItem *widgetToScene = toolWidget->toolWidget();
graphicsWidgetItem->setPos(toolWidget->pos());
widgetToScene->resetTransform();
QPoint mainWindowCenter = toolWidget->mapTo(mMainWindow, QPoint(toolWidget->width(), toolWidget->height()) / 2);
QPoint controlViewCenter = mControlView->mapFrom(mMainWindow, mainWindowCenter);
QPointF scenePos = mControlView->mapToScene(controlViewCenter);
mActiveScene->addGraphicsWidget(widgetToScene, scenePos);
toolWidget->remove(); toolWidget->remove();
graphicsWidgetItem->setSelected(true);
} }

@ -193,8 +193,8 @@ class UBBoardController : public UBDocumentContainer
void firstScene(); void firstScene();
void lastScene(); void lastScene();
void groupButtonClicked(); void groupButtonClicked();
void downloadURL(const QUrl& url, const QPointF& pPos = QPointF(0.0, 0.0), const QSize& pSize = QSize(), bool isBackground = false, bool internalData = false); void downloadURL(const QUrl& url, QString contentSourceUrl = QString(), const QPointF& pPos = QPointF(0.0, 0.0), const QSize& pSize = QSize(), bool isBackground = false, bool internalData = false);
UBItem *downloadFinished(bool pSuccess, QUrl sourceUrl, QString pHeader, UBItem *downloadFinished(bool pSuccess, QUrl sourceUrl, QUrl contentUrl, QString pHeader,
QByteArray pData, QPointF pPos, QSize pSize, QByteArray pData, QPointF pPos, QSize pSize,
bool isBackground = false, bool internalData = false); bool isBackground = false, bool internalData = false);
void changeBackground(bool isDark, bool isCrossed); void changeBackground(bool isDark, bool isCrossed);
@ -203,14 +203,15 @@ class UBBoardController : public UBDocumentContainer
void hideMessage(); void hideMessage();
void setDisabled(bool disable); void setDisabled(bool disable);
void setColorIndex(int pColorIndex); void setColorIndex(int pColorIndex);
void removeTool(UBToolWidget* toolWidget);
void hide(); void hide();
void show(); void show();
void setWidePageSize(bool checked); void setWidePageSize(bool checked);
void setRegularPageSize(bool checked); void setRegularPageSize(bool checked);
void stylusToolChanged(int tool); void stylusToolChanged(int tool);
void grabScene(const QRectF& pSceneRect); void grabScene(const QRectF& pSceneRect);
UBGraphicsMediaItem* addVideo(const QUrl& pUrl, bool startPlay, const QPointF& pos); UBGraphicsMediaItem* addVideo(const QUrl& pUrl, bool startPlay, const QPointF& pos, bool bUseSource = false);
UBGraphicsMediaItem* addAudio(const QUrl& pUrl, bool startPlay, const QPointF& pos); UBGraphicsMediaItem* addAudio(const QUrl& pUrl, bool startPlay, const QPointF& pos, bool bUseSource = false);
UBGraphicsWidgetItem *addW3cWidget(const QUrl& pUrl, const QPointF& pos); UBGraphicsWidgetItem *addW3cWidget(const QUrl& pUrl, const QPointF& pos);
void cut(); void cut();
@ -228,8 +229,6 @@ class UBBoardController : public UBDocumentContainer
signals: signals:
void newPageAdded(); void newPageAdded();
void activeSceneWillBePersisted();
void activeSceneWillChange();
void activeSceneChanged(); void activeSceneChanged();
void zoomChanged(qreal pZoomFactor); void zoomChanged(qreal pZoomFactor);
void systemScaleFactorChanged(qreal pSystemScaleFactor); void systemScaleFactorChanged(qreal pSystemScaleFactor);
@ -285,6 +284,7 @@ class UBBoardController : public UBDocumentContainer
bool mCacheWidgetIsEnabled; bool mCacheWidgetIsEnabled;
QGraphicsItem* mLastCreatedItem; QGraphicsItem* mLastCreatedItem;
int mDeletingSceneIndex; int mDeletingSceneIndex;
int mMovingSceneIndex;
QString mActionGroupText; QString mActionGroupText;
QString mActionUngroupText; QString mActionUngroupText;

@ -995,6 +995,7 @@ void UBBoardPaletteManager::startDownloads()
mDownloadInProgress = true; mDownloadInProgress = true;
mpDownloadWidget->setVisibleState(true); mpDownloadWidget->setVisibleState(true);
mRightPalette->addTab(mpDownloadWidget); mRightPalette->addTab(mpDownloadWidget);
mpDownloadWidget;
} }
} }

@ -61,6 +61,7 @@
#include "tools/UBGraphicsCache.h" #include "tools/UBGraphicsCache.h"
#include "tools/UBGraphicsTriangle.h" #include "tools/UBGraphicsTriangle.h"
#include "tools/UBGraphicsProtractor.h" #include "tools/UBGraphicsProtractor.h"
#include "tools/UBGraphicsAristo.h"
#include "core/memcheck.h" #include "core/memcheck.h"
@ -307,7 +308,6 @@ UBBoardView::event (QEvent * e)
if (gestureEvent) if (gestureEvent)
{ {
QSwipeGesture* swipe = dynamic_cast<QSwipeGesture*> (gestureEvent->gesture (Qt::SwipeGesture)); QSwipeGesture* swipe = dynamic_cast<QSwipeGesture*> (gestureEvent->gesture (Qt::SwipeGesture));
if (swipe) if (swipe)
{ {
if (swipe->horizontalDirection () == QSwipeGesture::Left) if (swipe->horizontalDirection () == QSwipeGesture::Left)
@ -362,9 +362,7 @@ void UBBoardView::tabletEvent (QTabletEvent * event)
QPointF scenePos = viewportTransform ().inverted ().map (tabletPos); QPointF scenePos = viewportTransform ().inverted ().map (tabletPos);
qreal pressure = 1.0; qreal pressure = 1.0;
if (((currentTool == UBStylusTool::Pen || currentTool == UBStylusTool::Line) if (((currentTool == UBStylusTool::Pen || currentTool == UBStylusTool::Line) && mPenPressureSensitive) || (currentTool == UBStylusTool::Marker && mMarkerPressureSensitive))
&& mPenPressureSensitive)
|| (currentTool == UBStylusTool::Marker && mMarkerPressureSensitive))
pressure = event->pressure (); pressure = event->pressure ();
@ -521,6 +519,7 @@ Here we determines cases when items should to get mouse press event at pressing
case UBGraphicsTriangle::Type: case UBGraphicsTriangle::Type:
case UBGraphicsCompass::Type: case UBGraphicsCompass::Type:
case UBGraphicsCache::Type: case UBGraphicsCache::Type:
case UBGraphicsAristo::Type:
return true; return true;
case UBGraphicsDelegateFrame::Type: case UBGraphicsDelegateFrame::Type:
@ -553,8 +552,8 @@ Here we determines cases when items should to get mouse press event at pressing
return false; return false;
break; break;
case UBToolWidget::Type: //case UBToolWidget::Type:
return true; // return true;
case QGraphicsWebView::Type: case QGraphicsWebView::Type:
return true; return true;
@ -1123,7 +1122,7 @@ UBBoardView::mouseReleaseEvent (QMouseEvent *event)
DelegateButton::Type != movingItem->type() && DelegateButton::Type != movingItem->type() &&
QGraphicsSvgItem::Type != movingItem->type() && QGraphicsSvgItem::Type != movingItem->type() &&
UBGraphicsDelegateFrame::Type != movingItem->type() && UBGraphicsDelegateFrame::Type != movingItem->type() &&
UBToolWidget::Type != movingItem->type() && // UBToolWidget::Type != movingItem->type() &&
UBGraphicsCache::Type != movingItem->type() && UBGraphicsCache::Type != movingItem->type() &&
QGraphicsWebView::Type != movingItem->type() && // for W3C widgets as Tools. QGraphicsWebView::Type != movingItem->type() && // for W3C widgets as Tools.
!(!isMultipleSelectionEnabled() && movingItem->parentItem() && UBGraphicsWidgetItem::Type == movingItem->type() && UBGraphicsGroupContainerItem::Type == movingItem->parentItem()->type())) !(!isMultipleSelectionEnabled() && movingItem->parentItem() && UBGraphicsWidgetItem::Type == movingItem->type() && UBGraphicsGroupContainerItem::Type == movingItem->parentItem()->type()))
@ -1364,6 +1363,11 @@ void UBBoardView::dropEvent (QDropEvent *event)
event->acceptProposedAction(); event->acceptProposedAction();
} }
} }
//prevent features in UBFeaturesWidget deletion from the model when event is processing inside
//Qt base classes
if (event->dropAction() == Qt::MoveAction) {
event->setDropAction(Qt::CopyAction);
}
} }
void void

@ -711,7 +711,7 @@ void UBFeaturesController::addItemToPage(const UBFeature &item)
void UBFeaturesController::addItemAsBackground(const UBFeature &item) void UBFeaturesController::addItemAsBackground(const UBFeature &item)
{ {
UBApplication::boardController->downloadURL( item.getFullPath(), QPointF(), QSize(), true ); UBApplication::boardController->downloadURL( item.getFullPath(), QString(), QPointF(), QSize(), true );
} }
UBFeature UBFeaturesController::getDestinationFeatureForUrl( const QUrl &url ) UBFeature UBFeaturesController::getDestinationFeatureForUrl( const QUrl &url )

@ -145,6 +145,7 @@ struct UBGraphicsItemType
TriangleItemType, TriangleItemType,
MagnifierItemType, MagnifierItemType,
cacheItemType, cacheItemType,
AristoItemType,
groupContainerType, groupContainerType,
ToolWidgetItemType, ToolWidgetItemType,
GraphicsWidgetItemType, GraphicsWidgetItemType,

@ -130,6 +130,8 @@ UBApplication::UBApplication(const QString &id, int &argc, char **argv) : QtSing
|| args.contains("log"); || args.contains("log");
setupTranslators(args);
UBResources::resources(); UBResources::resources();
if (!undoStack) if (!undoStack)
@ -139,8 +141,6 @@ UBApplication::UBApplication(const QString &id, int &argc, char **argv) : QtSing
UBSettings *settings = UBSettings::settings(); UBSettings *settings = UBSettings::settings();
setupTranslators(args);
connect(settings->appToolBarPositionedAtTop, SIGNAL(changed(QVariant)), this, SLOT(toolBarPositionChanged(QVariant))); connect(settings->appToolBarPositionedAtTop, SIGNAL(changed(QVariant)), this, SLOT(toolBarPositionChanged(QVariant)));
connect(settings->appToolBarDisplayText, SIGNAL(changed(QVariant)), this, SLOT(toolBarDisplayTextChanged(QVariant))); connect(settings->appToolBarDisplayText, SIGNAL(changed(QVariant)), this, SLOT(toolBarDisplayTextChanged(QVariant)));
updateProtoActionsState(); updateProtoActionsState();

@ -14,12 +14,79 @@
*/ */
#include "UBDownloadManager.h" #include "UBDownloadManager.h"
#include "core/UBApplication.h" #include "core/UBApplication.h"
#include "core/UBPersistenceManager.h"
#include "gui/UBMainWindow.h" #include "gui/UBMainWindow.h"
#include "board/UBBoardController.h" #include "board/UBBoardController.h"
#include "board/UBBoardPaletteManager.h" #include "board/UBBoardPaletteManager.h"
#include "frameworks/UBFileSystemUtils.h"
#include "core/memcheck.h" #include "core/memcheck.h"
UBAsyncLocalFileDownloader::UBAsyncLocalFileDownloader(sDownloadFileDesc desc, QObject *parent)
: QThread(parent)
, mDesc(desc)
, m_bAborting(false)
{
}
UBAsyncLocalFileDownloader *UBAsyncLocalFileDownloader::download()
{
if (!QFile::exists(QUrl(mDesc.srcUrl).toLocalFile())) {
qDebug() << "file" << mDesc.srcUrl << "does not present in fs";
return this;
}
start();
return this;
}
void UBAsyncLocalFileDownloader::run()
{
QString mimeType = UBFileSystemUtils::mimeTypeFromFileName(mDesc.srcUrl);
int position=mimeType.indexOf(";");
if(position != -1)
mimeType=mimeType.left(position);
UBMimeType::Enum itemMimeType = UBFileSystemUtils::mimeTypeFromString(mimeType);
QString destDirectory;
if (UBMimeType::Video == itemMimeType)
destDirectory = UBPersistenceManager::videoDirectory;
else
if (UBMimeType::Audio == itemMimeType)
destDirectory = UBPersistenceManager::audioDirectory;
if (mDesc.originalSrcUrl.isEmpty())
mDesc.originalSrcUrl = mDesc.srcUrl;
QString uuid = QUuid::createUuid();
UBPersistenceManager::persistenceManager()->addFileToDocument(UBApplication::boardController->selectedDocument(),
QUrl(mDesc.srcUrl).toLocalFile(),
destDirectory,
uuid,
mTo,
NULL);
if (m_bAborting)
{
if (QFile::exists(mTo))
QFile::remove(mTo);
}
else
emit signal_asyncCopyFinished(mDesc.id, !mTo.isEmpty(), QUrl::fromLocalFile(mTo), QUrl::fromLocalFile(mDesc.originalSrcUrl), "", NULL, mDesc.pos, mDesc.size, mDesc.isBackground);
}
void UBAsyncLocalFileDownloader::abort()
{
m_bAborting = true;
}
/** The unique instance of the download manager */ /** The unique instance of the download manager */
static UBDownloadManager* pInstance = NULL; static UBDownloadManager* pInstance = NULL;
@ -100,7 +167,7 @@ void UBDownloadManager::init()
{ {
mCrntDL.clear(); mCrntDL.clear();
mPendingDL.clear(); mPendingDL.clear();
mReplies.clear(); mDownloads.clear();
mLastID = 1; mLastID = 1;
mDLAvailability.clear(); mDLAvailability.clear();
for(int i=0; i<SIMULTANEOUS_DOWNLOAD; i++) for(int i=0; i<SIMULTANEOUS_DOWNLOAD; i++)
@ -193,7 +260,8 @@ void UBDownloadManager::onDownloadProgress(int id, qint64 received, qint64 total
* \brief Called when the download of the given file is finished * \brief Called when the download of the given file is finished
* @param desc as the current downloaded file description * @param desc as the current downloaded file description
*/ */
void UBDownloadManager::onDownloadFinished(int id, bool pSuccess, QUrl sourceUrl, QString pContentTypeHeader, QByteArray pData, QPointF pPos, QSize pSize, bool isBackground)
void UBDownloadManager::onDownloadFinished(int id, bool pSuccess, QUrl sourceUrl, QUrl contentUrl, QString pContentTypeHeader, QByteArray pData, QPointF pPos, QSize pSize, bool isBackground)
{ {
// Temporary data for dnd do not delete it please // Temporary data for dnd do not delete it please
Q_UNUSED(pPos) Q_UNUSED(pPos)
@ -209,9 +277,9 @@ void UBDownloadManager::onDownloadFinished(int id, bool pSuccess, QUrl sourceUrl
desc.contentTypeHeader = pContentTypeHeader; desc.contentTypeHeader = pContentTypeHeader;
emit downloadFinished(pSuccess, desc, pData); emit downloadFinished(pSuccess, desc, pData);
} else if(desc.modal) { } else if(desc.dest == sDownloadFileDesc::board) {
// The downloaded file is modal so we must put it on the board // The downloaded file is modal so we must put it on the board
emit addDownloadedFileToBoard(pSuccess, sourceUrl, pContentTypeHeader, pData, pPos, pSize, isBackground); emit addDownloadedFileToBoard(pSuccess, sourceUrl, contentUrl, pContentTypeHeader, pData, pPos, pSize, isBackground);
} }
else else
{ {
@ -259,7 +327,7 @@ void UBDownloadManager::updateFileCurrentSize(int id, qint64 received, qint64 to
mCrntDL.remove(i); mCrntDL.remove(i);
// Here we don't forget to remove the reply related to the finished download // Here we don't forget to remove the reply related to the finished download
mReplies.remove(id); mDownloads.remove(id);
// Free the download slot used by the finished file // Free the download slot used by the finished file
for(int j=0; j<mDLAvailability.size();j++) for(int j=0; j<mDLAvailability.size();j++)
@ -301,16 +369,29 @@ void UBDownloadManager::updateFileCurrentSize(int id, qint64 received, qint64 to
* @param desc as the given file description * @param desc as the given file description
*/ */
void UBDownloadManager::startFileDownload(sDownloadFileDesc desc) void UBDownloadManager::startFileDownload(sDownloadFileDesc desc)
{
if (desc.srcUrl.startsWith("file://") || desc.srcUrl.startsWith("/"))
{
UBAsyncLocalFileDownloader * cpHelper = new UBAsyncLocalFileDownloader(desc, this);
connect(cpHelper, SIGNAL(signal_asyncCopyFinished(int, bool, QUrl, QUrl, QString, QByteArray, QPointF, QSize, bool)), this, SLOT(onDownloadFinished(int, bool, QUrl, QUrl,QString, QByteArray, QPointF, QSize, bool)));
QObject *res = dynamic_cast<QObject *>(cpHelper->download());
if (!res)
delete res;
else
mDownloads[desc.id] = res;
}
else
{ {
UBDownloadHttpFile* http = new UBDownloadHttpFile(desc.id, this); UBDownloadHttpFile* http = new UBDownloadHttpFile(desc.id, this);
connect(http, SIGNAL(downloadProgress(int, qint64,qint64)), this, SLOT(onDownloadProgress(int,qint64,qint64))); connect(http, SIGNAL(downloadProgress(int, qint64,qint64)), this, SLOT(onDownloadProgress(int,qint64,qint64)));
connect(http, SIGNAL(downloadFinished(int, bool, QUrl, QString, QByteArray, QPointF, QSize, bool)), this, SLOT(onDownloadFinished(int, bool, QUrl, QString, QByteArray, QPointF, QSize, bool))); connect(http, SIGNAL(downloadFinished(int, bool, QUrl, QUrl, QString, QByteArray, QPointF, QSize, bool)), this, SLOT(onDownloadFinished(int, bool, QUrl, QUrl, QString, QByteArray, QPointF, QSize, bool)));
//the desc.url is encoded. So we have to decode it before. //the desc.srcUrl is encoded. So we have to decode it before.
QUrl url; QUrl url;
url.setEncodedUrl(desc.url.toUtf8()); url.setEncodedUrl(desc.srcUrl.toUtf8());
// We send here the request and store its reply in order to be able to cancel it if needed // We send here the request and store its reply in order to be able to cancel it if needed
mReplies[desc.id] = http->get(url, desc.pos, desc.size, desc.isBackground); mDownloads[desc.id] = dynamic_cast<QObject *>(http->get(url, desc.pos, desc.size, desc.isBackground));
}
} }
/** /**
@ -356,10 +437,18 @@ void UBDownloadManager::checkIfModalRemains()
void UBDownloadManager::cancelDownloads() void UBDownloadManager::cancelDownloads()
{ {
// Stop the current downloads // Stop the current downloads
QMap<int, QNetworkReply*>::iterator it = mReplies.begin(); QMap<int, QObject*>::iterator it = mDownloads.begin();
for(; it!=mReplies.end();it++) for(; it!=mDownloads.end();it++)
{ {
dynamic_cast<QNetworkReply*>(it.value())->abort(); QNetworkReply *netReply = dynamic_cast<QNetworkReply*>(it.value());
if (netReply)
netReply->abort();
else
{
UBAsyncLocalFileDownloader *localDownload = dynamic_cast<UBAsyncLocalFileDownloader *>(it.value());
if (localDownload)
localDownload->abort();
}
} }
// Clear all the lists // Clear all the lists
@ -372,7 +461,8 @@ void UBDownloadManager::cancelDownloads()
void UBDownloadManager::onDownloadError(int id) void UBDownloadManager::onDownloadError(int id)
{ {
QNetworkReply* pReply = mReplies.value(id); QNetworkReply *pReply = dynamic_cast<QNetworkReply *>(mDownloads.value(id));
if(NULL != pReply) if(NULL != pReply)
{ {
// Check which error occured: // Check which error occured:
@ -402,9 +492,25 @@ void UBDownloadManager::finishDownloads(bool cancel)
void UBDownloadManager::cancelDownload(int id) void UBDownloadManager::cancelDownload(int id)
{ {
if (!mDownloads.size())
return;
// Stop the download // Stop the download
mReplies[id]->abort();
mReplies.remove(id); QNetworkReply *pNetworkDownload = dynamic_cast<QNetworkReply *>(mDownloads[id]);
if (pNetworkDownload)
pNetworkDownload->abort();
else
{
UBAsyncLocalFileDownloader *pLocalDownload = dynamic_cast<UBAsyncLocalFileDownloader *>(mDownloads[id]);
if (pLocalDownload)
{
if (pLocalDownload->isRunning())
pLocalDownload->abort();
}
}
mDownloads.remove(id);
// Remove the canceled download from the download lists // Remove the canceled download from the download lists
bool bFound = false; bool bFound = false;
@ -494,7 +600,7 @@ void UBDownloadHttpFile::onDownloadFinished(bool pSuccess, QUrl sourceUrl, QStri
if(pSuccess) if(pSuccess)
{ {
// Notify the end of the download // Notify the end of the download
emit downloadFinished(mId, pSuccess, sourceUrl, pContentTypeHeader, pData, pPos, pSize, isBackground); emit downloadFinished(mId, pSuccess, sourceUrl, sourceUrl, pContentTypeHeader, pData, pPos, pSize, isBackground);
} }
else else
{ {

@ -52,7 +52,8 @@ struct sDownloadFileDesc
int id; int id;
int totalSize; int totalSize;
int currentSize; int currentSize;
QString url; QString srcUrl;
QString originalSrcUrl;
QString contentTypeHeader; QString contentTypeHeader;
bool modal; bool modal;
QPointF pos; // For board drop only QPointF pos; // For board drop only
@ -75,7 +76,7 @@ public:
signals: signals:
void downloadProgress(int id, qint64 current,qint64 total); void downloadProgress(int id, qint64 current,qint64 total);
void downloadFinished(int id, bool pSuccess, QUrl sourceUrl, QString pContentTypeHeader, QByteArray pData, QPointF pPos, QSize pSize, bool isBackground); void downloadFinished(int id, bool pSuccess, QUrl sourceUrl, QUrl contentUrl, QString pContentTypeHeader, QByteArray pData, QPointF pPos, QSize pSize, bool isBackground);
void downloadError(int id); void downloadError(int id);
private slots: private slots:
@ -86,6 +87,28 @@ private:
int mId; int mId;
}; };
class UBAsyncLocalFileDownloader : public QThread
{
Q_OBJECT
public:
UBAsyncLocalFileDownloader(sDownloadFileDesc desc, QObject *parent = 0);
UBAsyncLocalFileDownloader *download();
void run();
void abort();
signals:
void finished(QString srcUrl, QString resUrl);
void signal_asyncCopyFinished(int id, bool pSuccess, QUrl sourceUrl, QUrl contentUrl, QString pContentTypeHeader, QByteArray pData, QPointF pPos, QSize pSize, bool isBackground);
private:
sDownloadFileDesc mDesc;
bool m_bAborting;
QString mFrom;
QString mTo;
};
class UBDownloadManager : public QObject class UBDownloadManager : public QObject
{ {
Q_OBJECT Q_OBJECT
@ -108,7 +131,7 @@ signals:
void downloadFinished(bool pSuccess, int id, QUrl sourceUrl, QString pContentTypeHeader, QByteArray pData); void downloadFinished(bool pSuccess, int id, QUrl sourceUrl, QString pContentTypeHeader, QByteArray pData);
void downloadFinished(bool pSuccess, sDownloadFileDesc desc, QByteArray pData); void downloadFinished(bool pSuccess, sDownloadFileDesc desc, QByteArray pData);
void downloadModalFinished(); void downloadModalFinished();
void addDownloadedFileToBoard(bool pSuccess, QUrl sourceUrl, QString pContentTypeHeader, QByteArray pData, QPointF pPos, QSize pSize, bool isBackground); void addDownloadedFileToBoard(bool pSuccess, QUrl sourceUrl, QUrl contentUrl, QString pContentTypeHeader, QByteArray pData, QPointF pPos, QSize pSize, bool isBackground);
void addDownloadedFileToLibrary(bool pSuccess, QUrl sourceUrl, QString pContentTypeHeader, QByteArray pData); void addDownloadedFileToLibrary(bool pSuccess, QUrl sourceUrl, QString pContentTypeHeader, QByteArray pData);
void cancelAllDownloads(); void cancelAllDownloads();
void allDownloadsFinished(); void allDownloadsFinished();
@ -116,7 +139,7 @@ signals:
private slots: private slots:
void onUpdateDownloadLists(); void onUpdateDownloadLists();
void onDownloadProgress(int id, qint64 received, qint64 total); void onDownloadProgress(int id, qint64 received, qint64 total);
void onDownloadFinished(int id, bool pSuccess, QUrl sourceUrl, QString pContentTypeHeader, QByteArray pData, QPointF pPos, QSize pSize, bool isBackground); void onDownloadFinished(int id, bool pSuccess, QUrl sourceUrl, QUrl contentUrl, QString pContentTypeHeader, QByteArray pData, QPointF pPos, QSize pSize, bool isBackground);
void onDownloadError(int id); void onDownloadError(int id);
private: private:
@ -138,7 +161,7 @@ private:
/** The current download availability (-1 = free, otherwise the file ID is recorded)*/ /** The current download availability (-1 = free, otherwise the file ID is recorded)*/
QVector<int> mDLAvailability; QVector<int> mDLAvailability;
/** A map containing the replies of the GET operations */ /** A map containing the replies of the GET operations */
QMap<int, QNetworkReply*> mReplies; QMap<int, QObject*> mDownloads;
}; };
#endif // UBDOWNLOADMANAGER_H #endif // UBDOWNLOADMANAGER_H

@ -265,7 +265,7 @@ UBDocumentProxy* UBPersistenceManager::createDocument(const QString& pGroupName,
return doc; return doc;
} }
UBDocumentProxy* UBPersistenceManager::createDocumentFromDir(const QString& pDocumentDirectory, const QString& pGroupName, const QString& pName, bool withEmptyPage) UBDocumentProxy* UBPersistenceManager::createDocumentFromDir(const QString& pDocumentDirectory, const QString& pGroupName, const QString& pName, bool withEmptyPage, bool addTitlePage)
{ {
checkIfDocumentRepositoryExists(); checkIfDocumentRepositoryExists();
@ -281,6 +281,7 @@ UBDocumentProxy* UBPersistenceManager::createDocumentFromDir(const QString& pDoc
doc->setMetaData(UBSettings::documentName, pName); doc->setMetaData(UBSettings::documentName, pName);
} }
if(withEmptyPage) createDocumentSceneAt(doc, 0); if(withEmptyPage) createDocumentSceneAt(doc, 0);
if(addTitlePage) persistDocumentScene(doc, mSceneCache.createScene(doc, 0, false), 0);
QMap<QString, QVariant> metadatas = UBMetadataDcSubsetAdaptor::load(pDocumentDirectory); QMap<QString, QVariant> metadatas = UBMetadataDcSubsetAdaptor::load(pDocumentDirectory);
@ -463,11 +464,6 @@ void UBPersistenceManager::deleteDocumentScenes(UBDocumentProxy* proxy, const QL
} }
} }
foreach(int index, compactedIndexes)
{
emit documentSceneDeleted(proxy, index);
}
} }
@ -576,8 +572,6 @@ void UBPersistenceManager::moveSceneToIndex(UBDocumentProxy* proxy, int source,
thumb.rename(proxy->persistencePath() + UBFileSystemUtils::digitFileFormat("/page%1.thumbnail.jpg", target)); thumb.rename(proxy->persistencePath() + UBFileSystemUtils::digitFileFormat("/page%1.thumbnail.jpg", target));
mSceneCache.moveScene(proxy, source, target); mSceneCache.moveScene(proxy, source, target);
emit documentSceneMoved(proxy, target);
} }
@ -612,7 +606,7 @@ void UBPersistenceManager::persistDocumentScene(UBDocumentProxy* pDocumentProxy,
UBBoardPaletteManager* paletteManager = UBApplication::boardController->paletteManager(); UBBoardPaletteManager* paletteManager = UBApplication::boardController->paletteManager();
bool teacherGuideModified = false; bool teacherGuideModified = false;
if(paletteManager->teacherGuideDockWidget()) if(UBApplication::app()->boardController->currentPage() == pSceneIndex && paletteManager->teacherGuideDockWidget())
teacherGuideModified = paletteManager->teacherGuideDockWidget()->teacherGuideWidget()->isModified(); teacherGuideModified = paletteManager->teacherGuideDockWidget()->teacherGuideWidget()->isModified();
if (pDocumentProxy->isModified() || teacherGuideModified) if (pDocumentProxy->isModified() || teacherGuideModified)
@ -628,8 +622,6 @@ void UBPersistenceManager::persistDocumentScene(UBDocumentProxy* pDocumentProxy,
} }
mSceneCache.insert(pDocumentProxy, pSceneIndex, pScene); mSceneCache.insert(pDocumentProxy, pSceneIndex, pScene);
emit documentCommitted(pDocumentProxy);
} }

@ -47,7 +47,7 @@ class UBPersistenceManager : public QObject
static void destroy(); static void destroy();
virtual UBDocumentProxy* createDocument(const QString& pGroupName = "", const QString& pName = "", bool withEmptyPage = true); virtual UBDocumentProxy* createDocument(const QString& pGroupName = "", const QString& pName = "", bool withEmptyPage = true);
virtual UBDocumentProxy* createDocumentFromDir(const QString& pDocumentDirectory, const QString& pGroupName = "", const QString& pName = "", bool withEmptyPage = false); virtual UBDocumentProxy* createDocumentFromDir(const QString& pDocumentDirectory, const QString& pGroupName = "", const QString& pName = "", bool withEmptyPage = false, bool addTitlePage = false);
virtual UBDocumentProxy* persistDocumentMetadata(UBDocumentProxy* pDocumentProxy); virtual UBDocumentProxy* persistDocumentMetadata(UBDocumentProxy* pDocumentProxy);
@ -117,13 +117,10 @@ class UBPersistenceManager : public QObject
void documentCreated(UBDocumentProxy* pDocumentProxy); void documentCreated(UBDocumentProxy* pDocumentProxy);
void documentMetadataChanged(UBDocumentProxy* pDocumentProxy); void documentMetadataChanged(UBDocumentProxy* pDocumentProxy);
void documentCommitted(UBDocumentProxy* pDocumentProxy);
void documentWillBeDeleted(UBDocumentProxy* pDocumentProxy); void documentWillBeDeleted(UBDocumentProxy* pDocumentProxy);
void documentSceneCreated(UBDocumentProxy* pDocumentProxy, int pIndex); void documentSceneCreated(UBDocumentProxy* pDocumentProxy, int pIndex);
void documentSceneMoved(UBDocumentProxy* pDocumentProxy, int pIndex);
void documentSceneWillBeDeleted(UBDocumentProxy* pDocumentProxy, int pIndex); void documentSceneWillBeDeleted(UBDocumentProxy* pDocumentProxy, int pIndex);
void documentSceneDeleted(UBDocumentProxy* pDocumentProxy, int pDeletedIndex);
private: private:

@ -129,7 +129,7 @@ int main(int argc, char *argv[])
QObject::connect(&app, SIGNAL(messageReceived(const QString&)), &app, SLOT(handleOpenMessage(const QString&))); QObject::connect(&app, SIGNAL(messageReceived(const QString&)), &app, SLOT(handleOpenMessage(const QString&)));
qDebug() << fileToOpen; qDebug() << "file name argument" << fileToOpen;
int result = app.exec(fileToOpen); int result = app.exec(fileToOpen);
app.cleanup(); app.cleanup();

@ -94,7 +94,6 @@ void UBDocumentContainer::updatePage(int index)
void UBDocumentContainer::deleteThumbPage(int index) void UBDocumentContainer::deleteThumbPage(int index)
{ {
mDocumentThumbs.removeAt(index); mDocumentThumbs.removeAt(index);
emit documentPageDeleted(index);
} }
void UBDocumentContainer::updateThumbPage(int index) void UBDocumentContainer::updateThumbPage(int index)
@ -106,7 +105,6 @@ void UBDocumentContainer::updateThumbPage(int index)
void UBDocumentContainer::insertThumbPage(int index) void UBDocumentContainer::insertThumbPage(int index)
{ {
mDocumentThumbs.insert(index, UBThumbnailAdaptor::get(mCurrentDocument, index)); mDocumentThumbs.insert(index, UBThumbnailAdaptor::get(mCurrentDocument, index));
emit documentPageAdded(index);
} }
void UBDocumentContainer::reloadThumbnails() void UBDocumentContainer::reloadThumbnails()

@ -58,8 +58,6 @@ class UBDocumentContainer : public QObject
signals: signals:
void documentSet(UBDocumentProxy* document); void documentSet(UBDocumentProxy* document);
void documentPageAdded(int index);
void documentPageDeleted(int index);
void documentPageUpdated(int index); void documentPageUpdated(int index);
void documentThumbnailsUpdated(UBDocumentContainer* source); void documentThumbnailsUpdated(UBDocumentContainer* source);
}; };

@ -563,8 +563,7 @@ void UBGraphicsDelegateFrame::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
mTranslateX += fixedPoint.x() - bottomRight.x(); mTranslateX += fixedPoint.x() - bottomRight.x();
mTranslateY += fixedPoint.y() - bottomRight.y(); mTranslateY += fixedPoint.y() - bottomRight.y();
} }
else if (moving() || rotating()) delegated()->setTransform(buildTransform());
delegated()->setTransform(tr);
} }
else // resizing/resizing horizontally else // resizing/resizing horizontally
{ {

@ -58,6 +58,7 @@ DelegateButton::DelegateButton(const QString & fileName, QGraphicsItem* pDelegat
{ {
setAcceptedMouseButtons(Qt::LeftButton); setAcceptedMouseButtons(Qt::LeftButton);
setData(UBGraphicsItemData::ItemLayerType, QVariant(UBItemLayerType::Control)); setData(UBGraphicsItemData::ItemLayerType, QVariant(UBItemLayerType::Control));
setCacheMode(QGraphicsItem::NoCache); /* because of SANKORE-1017: this allows pixmap to be refreshed when grabbing window, thus teacher screen is synchronized with main screen. */
} }
DelegateButton::~DelegateButton() DelegateButton::~DelegateButton()

@ -73,7 +73,11 @@ UBGraphicsMediaItem::UBGraphicsMediaItem(const QUrl& pMediaFileUrl, QGraphicsIte
mMediaObject = new Phonon::MediaObject(this); mMediaObject = new Phonon::MediaObject(this);
if (pMediaFileUrl.toLocalFile().contains("videos")) QString mediaPath = pMediaFileUrl.toString();
if ("" == mediaPath)
mediaPath = pMediaFileUrl.toLocalFile();
if (mediaPath.toLower().contains("videos"))
{ {
mMediaType = mediaType_Video; mMediaType = mediaType_Video;
@ -91,7 +95,7 @@ UBGraphicsMediaItem::UBGraphicsMediaItem(const QUrl& pMediaFileUrl, QGraphicsIte
haveLinkedImage = true; haveLinkedImage = true;
} }
else else
if (pMediaFileUrl.toLocalFile().contains("audios")) if (mediaPath.toLower().contains("audios"))
{ {
mMediaType = mediaType_Audio; mMediaType = mediaType_Audio;
mAudioOutput = new Phonon::AudioOutput(Phonon::MusicCategory, this); mAudioOutput = new Phonon::AudioOutput(Phonon::MusicCategory, this);
@ -191,7 +195,7 @@ void UBGraphicsMediaItem::setSourceUrl(const QUrl &pSourceUrl)
UBAudioPresentationWidget* pAudioWidget = dynamic_cast<UBAudioPresentationWidget*>(mAudioWidget); UBAudioPresentationWidget* pAudioWidget = dynamic_cast<UBAudioPresentationWidget*>(mAudioWidget);
if (pAudioWidget) if (pAudioWidget)
{ {
pAudioWidget->setTitle(UBFileSystemUtils::lastPathComponent(pSourceUrl.toString())); pAudioWidget->setTitle(UBFileSystemUtils::lastPathComponent(pSourceUrl.toLocalFile()));
} }
UBItem::setSourceUrl(pSourceUrl); UBItem::setSourceUrl(pSourceUrl);

@ -39,6 +39,7 @@
#include "tools/UBGraphicsTriangle.h" #include "tools/UBGraphicsTriangle.h"
#include "tools/UBGraphicsCurtainItem.h" #include "tools/UBGraphicsCurtainItem.h"
#include "tools/UBGraphicsCache.h" #include "tools/UBGraphicsCache.h"
#include "tools/UBGraphicsAristo.h"
#include "document/UBDocumentProxy.h" #include "document/UBDocumentProxy.h"
@ -581,8 +582,8 @@ bool UBGraphicsScene::inputDeviceRelease()
addItem(pStrokes); addItem(pStrokes);
mDrawWithCompass = false; mDrawWithCompass = false;
}else if (mCurrentStroke) }
{ else if (mCurrentStroke){
UBGraphicsStrokesGroup* pStrokes = new UBGraphicsStrokesGroup(); UBGraphicsStrokesGroup* pStrokes = new UBGraphicsStrokesGroup();
// Remove the strokes that were just drawn here and replace them by a stroke item // Remove the strokes that were just drawn here and replace them by a stroke item
@ -628,8 +629,8 @@ bool UBGraphicsScene::inputDeviceRelease()
if (mCurrentStroke && mCurrentStroke->polygons().empty()){ if (mCurrentStroke && mCurrentStroke->polygons().empty()){
delete mCurrentStroke; delete mCurrentStroke;
}
mCurrentStroke = NULL; mCurrentStroke = NULL;
}
return accepted; return accepted;
} }
@ -1216,6 +1217,11 @@ void UBGraphicsScene::textUndoCommandAdded(UBGraphicsTextItem *textItem)
} }
UBGraphicsMediaItem* UBGraphicsScene::addMedia(const QUrl& pMediaFileUrl, bool shouldPlayAsap, const QPointF& pPos) UBGraphicsMediaItem* UBGraphicsScene::addMedia(const QUrl& pMediaFileUrl, bool shouldPlayAsap, const QPointF& pPos)
{ {
qDebug() << pMediaFileUrl.toLocalFile();
if (!QFile::exists(pMediaFileUrl.toLocalFile()))
if (!QFile::exists(pMediaFileUrl.toString()))
return NULL;
UBGraphicsMediaItem* mediaItem = new UBGraphicsMediaItem(pMediaFileUrl); UBGraphicsMediaItem* mediaItem = new UBGraphicsMediaItem(pMediaFileUrl);
if(mediaItem){ if(mediaItem){
connect(UBApplication::boardController, SIGNAL(activeSceneChanged()), mediaItem, SLOT(activeSceneChanged())); connect(UBApplication::boardController, SIGNAL(activeSceneChanged()), mediaItem, SLOT(activeSceneChanged()));
@ -1310,7 +1316,7 @@ void UBGraphicsScene::addGraphicsWidget(UBGraphicsWidgetItem* graphicsWidget, co
if (graphicsWidget->canBeContent()) if (graphicsWidget->canBeContent())
{ {
// graphicsWidget->widgetWebView()->loadMainHtml(); graphicsWidget->loadMainHtml();
graphicsWidget->setSelected(true); graphicsWidget->setSelected(true);
if (mUndoRedoStackEnabled) { //should be deleted after scene own undo stack implemented if (mUndoRedoStackEnabled) { //should be deleted after scene own undo stack implemented
@ -1602,6 +1608,9 @@ void UBGraphicsScene::removeItem(QGraphicsItem* item)
--mItemCount; --mItemCount;
mFastAccessItems.removeAll(item); mFastAccessItems.removeAll(item);
/* delete the item if it is cache to allow its reinstanciation, because Cache implements design pattern Singleton. */
if (dynamic_cast<UBGraphicsCache*>(item))
UBCoreGraphicsScene::deleteItem(item);
} }
void UBGraphicsScene::removeItems(const QSet<QGraphicsItem*>& items) void UBGraphicsScene::removeItems(const QSet<QGraphicsItem*>& items)
@ -1937,11 +1946,26 @@ void UBGraphicsScene::addCompass(QPointF center)
compass->setVisible(true); compass->setVisible(true);
} }
void UBGraphicsScene::addCache() void UBGraphicsScene::addAristo(QPointF center)
{ {
UBGraphicsCache* cache = new UBGraphicsCache(); UBGraphicsAristo* aristo = new UBGraphicsAristo();
mTools << cache; mTools << aristo;
aristo->setData(UBGraphicsItemData::ItemLayerType, QVariant(UBItemLayerType::Tool));
addItem(aristo);
QPointF itemSceneCenter = aristo->sceneBoundingRect().center();
aristo->moveBy(center.x() - itemSceneCenter.x(), center.y() - itemSceneCenter.y());
aristo->setVisible(true);
setModified(true);
}
void UBGraphicsScene::addCache()
{
UBGraphicsCache* cache = UBGraphicsCache::instance(this);
if (!items().contains(cache)) {
addItem(cache); addItem(cache);
cache->setData(UBGraphicsItemData::ItemLayerType, QVariant(UBItemLayerType::Tool)); cache->setData(UBGraphicsItemData::ItemLayerType, QVariant(UBItemLayerType::Tool));
@ -1951,6 +1975,7 @@ void UBGraphicsScene::addCache()
UBApplication::boardController->notifyCache(true); UBApplication::boardController->notifyCache(true);
UBApplication::boardController->notifyPageChanged(); UBApplication::boardController->notifyPageChanged();
} }
}
void UBGraphicsScene::addMask(const QPointF &center) void UBGraphicsScene::addMask(const QPointF &center)
{ {
@ -2277,10 +2302,12 @@ void UBGraphicsScene::setToolCursor(int tool)
if (mCurrentStroke && mCurrentStroke->polygons().empty()){ if (mCurrentStroke && mCurrentStroke->polygons().empty()){
delete mCurrentStroke; delete mCurrentStroke;
}
mCurrentStroke = NULL; mCurrentStroke = NULL;
} }
void UBGraphicsScene::initStroke(){ }
void UBGraphicsScene::initStroke()
{
mCurrentStroke = new UBGraphicsStroke(); mCurrentStroke = new UBGraphicsStroke();
} }

@ -216,6 +216,7 @@ class UBGraphicsScene: public UBCoreGraphicsScene, public UBItem
void addCompass(QPointF center); void addCompass(QPointF center);
void addTriangle(QPointF center); void addTriangle(QPointF center);
void addMagnifier(UBMagnifierParams params); void addMagnifier(UBMagnifierParams params);
void addAristo(QPointF center);
void addMask(const QPointF &center = QPointF()); void addMask(const QPointF &center = QPointF());
void addCache(); void addCache();

@ -563,7 +563,8 @@ void UBGraphicsWidgetItem::injectInlineJavaScript()
void UBGraphicsWidgetItem::paint( QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) void UBGraphicsWidgetItem::paint( QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
{ {
if (scene()->renderingContext() != UBGraphicsScene::Screen)
if (scene() && scene()->renderingContext() != UBGraphicsScene::Screen)
{ {
painter->drawPixmap(0, 0, snapshot()); painter->drawPixmap(0, 0, snapshot());
} }

@ -19,7 +19,6 @@
#include "core/UBApplication.h" #include "core/UBApplication.h"
#include "board/UBBoardController.h"
#include "document/UBDocumentContainer.h" #include "document/UBDocumentContainer.h"
#include "globals/UBGlobals.h" #include "globals/UBGlobals.h"
@ -855,4 +854,3 @@ QString UBFileSystemUtils::readTextFile(QString path)
return ""; return "";
} }

@ -17,14 +17,17 @@
#define UBFILESYSTEMUTILS_H_ #define UBFILESYSTEMUTILS_H_
#include <QtCore> #include <QtCore>
#include <QThread>
#include "core/UB.h" #include "core/UB.h"
class QuaZipFile; class QuaZipFile;
class UBProcessingProgressListener; class UBProcessingProgressListener;
class UBFileSystemUtils class UBFileSystemUtils : public QObject
{ {
Q_OBJECT
public: public:
UBFileSystemUtils(); UBFileSystemUtils();

@ -17,6 +17,7 @@
#include <QtGui> #include <QtGui>
#include <unistd.h>
#include <X11/Xlib.h> #include <X11/Xlib.h>
#include <X11/keysym.h> #include <X11/keysym.h>

@ -89,27 +89,9 @@ void UBDocumentNavigator::generateThumbnails(UBDocumentContainer* source)
{ {
const QPixmap* pix = source->pageAt(i); const QPixmap* pix = source->pageAt(i);
QPixmap result(pix->width(),pix->height());
int pageIndex = UBDocumentContainer::pageFromSceneIndex(i); int pageIndex = UBDocumentContainer::pageFromSceneIndex(i);
QPainter composePainter; UBSceneThumbnailNavigPixmap* pixmapItem = new UBSceneThumbnailNavigPixmap(*pix, source->selectedDocument(), i);
composePainter.begin(&result);
composePainter.drawPixmap(QPoint(0,0),*pix);
if(pageIndex == UBApplication::boardController->currentPage() &&
((pageIndex == 0 && UBSettings::settings()->teacherGuidePageZeroActivated->get().toBool()) ||
(pageIndex && UBSettings::settings()->teacherGuideLessonPagesActivated->get().toBool()))
) {
if(UBApplication::boardController->paletteManager()->teacherGuideDockWidget()->teacherGuideWidget()->isModified()){
QPixmap toque(":images/toque.png");
composePainter.setOpacity(0.6);
composePainter.drawPixmap(QPoint(pix->width() - toque.width(),0),toque);
}
}
composePainter.end();
UBSceneThumbnailNavigPixmap* pixmapItem = new UBSceneThumbnailNavigPixmap(result, source->selectedDocument(), i);
QString label = pageIndex == 0 ? tr("Title page") : tr("Page %0").arg(pageIndex); QString label = pageIndex == 0 ? tr("Title page") : tr("Page %0").arg(pageIndex);
UBThumbnailTextItem *labelItem = new UBThumbnailTextItem(label); UBThumbnailTextItem *labelItem = new UBThumbnailTextItem(label);
@ -128,7 +110,6 @@ void UBDocumentNavigator::generateThumbnails(UBDocumentContainer* source)
void UBDocumentNavigator::onScrollToSelectedPage(int index) void UBDocumentNavigator::onScrollToSelectedPage(int index)
{ {
qDebug() << "Selection in widget: " << index;
int c = 0; int c = 0;
foreach(UBImgTextThumbnailElement el, mThumbsWithLabels) foreach(UBImgTextThumbnailElement el, mThumbsWithLabels)
{ {
@ -286,7 +267,6 @@ void UBDocumentNavigator::mousePressEvent(QMouseEvent *event)
break; break;
} }
} }
qDebug() << "Selected Scene: " << index;
UBApplication::boardController->setActiveDocumentScene(index); UBApplication::boardController->setActiveDocumentScene(index);
} }
QGraphicsView::mousePressEvent(event); QGraphicsView::mousePressEvent(event);

@ -12,10 +12,6 @@
const char *UBFeaturesWidget::objNamePathList = "PathList"; const char *UBFeaturesWidget::objNamePathList = "PathList";
const char *UBFeaturesWidget::objNameFeatureList = "FeatureList"; const char *UBFeaturesWidget::objNameFeatureList = "FeatureList";
const QString UBFeaturesNewFolderDialog::acceptText = tr("Accept");
const QString UBFeaturesNewFolderDialog::cancelText = tr("Cancel");
const QString UBFeaturesNewFolderDialog::labelText = tr("Enter a new folder name");
const QMargins FeatureListMargins(0, 0, 0, 30); const QMargins FeatureListMargins(0, 0, 0, 30);
const int FeatureListBorderOffset = 10; const int FeatureListBorderOffset = 10;
const char featureTypeSplitter = ':'; const char featureTypeSplitter = ':';
@ -198,7 +194,6 @@ void UBFeaturesWidget::lockIt(bool pLock)
mActionBar->setEnabled(!pLock); mActionBar->setEnabled(!pLock);
pathListView->setEnabled(!pLock); pathListView->setEnabled(!pLock);
centralWidget->setLockedExcludingAdditional(pLock); centralWidget->setLockedExcludingAdditional(pLock);
// pathListView->setLocked(true);
} }
void UBFeaturesWidget::addToFavorite( const UBFeaturesMimeData * mimeData ) void UBFeaturesWidget::addToFavorite( const UBFeaturesMimeData * mimeData )
@ -578,6 +573,9 @@ void UBFeaturesCentralWidget::scanFinished()
} }
UBFeaturesNewFolderDialog::UBFeaturesNewFolderDialog(QWidget *parent) : QWidget(parent) UBFeaturesNewFolderDialog::UBFeaturesNewFolderDialog(QWidget *parent) : QWidget(parent)
, acceptText(tr("Accept"))
, cancelText(tr("Cancel"))
, labelText(tr("Enter a new folder name"))
{ {
this->setStyleSheet("background:white;"); this->setStyleSheet("background:white;");
@ -1048,8 +1046,8 @@ void UBFeatureProperties::onAddToLib()
desc.modal = false; desc.modal = false;
desc.name = QFileInfo( mpElement->getFullPath().toString()).fileName(); desc.name = QFileInfo( mpElement->getFullPath().toString()).fileName();
qDebug() << desc.name; qDebug() << desc.name;
desc.url = mpElement->getFullPath().toString(); desc.srcUrl = mpElement->getFullPath().toString();
qDebug() << desc.url; qDebug() << desc.srcUrl;
UBDownloadManager::downloadManager()->addFileToDownload(desc); UBDownloadManager::downloadManager()->addFileToDownload(desc);
} }
} }

@ -226,10 +226,6 @@ class UBFeaturesNewFolderDialog : public QWidget
Q_OBJECT Q_OBJECT
public: public:
static const QString acceptText;
static const QString cancelText;
static const QString labelText;
UBFeaturesNewFolderDialog(QWidget *parent = 0); UBFeaturesNewFolderDialog(QWidget *parent = 0);
void setRegexp(const QRegExp pRegExp); void setRegexp(const QRegExp pRegExp);
bool validString(const QString &pStr); bool validString(const QString &pStr);
@ -249,7 +245,9 @@ private:
QRegExpValidator *mValidator; QRegExpValidator *mValidator;
QStringList mFileNameList; QStringList mFileNameList;
QPushButton *acceptButton; QPushButton *acceptButton;
const QString acceptText;
const QString cancelText;
const QString labelText;
}; };
class UBFeaturesProgressInfo: public QWidget { class UBFeaturesProgressInfo: public QWidget {

@ -230,10 +230,8 @@ void UBTGAdaptableText::bottomMargin(int newValue)
void UBTGAdaptableText::focusInEvent(QFocusEvent* e) void UBTGAdaptableText::focusInEvent(QFocusEvent* e)
{ {
qDebug() << "pippa";
if(isReadOnly()){ if(isReadOnly()){
e->ignore(); e->ignore();
qDebug() << "ignored";
} }
managePlaceholder(true); managePlaceholder(true);
QTextEdit::focusInEvent(e); QTextEdit::focusInEvent(e);
@ -247,7 +245,6 @@ void UBTGAdaptableText::focusOutEvent(QFocusEvent* e){
void UBTGAdaptableText::managePlaceholder(bool focus){ void UBTGAdaptableText::managePlaceholder(bool focus){
if(focus){ if(focus){
if(toPlainText() == mPlaceHolderText){ if(toPlainText() == mPlaceHolderText){
qDebug() << "Place holder found";
setTextColor(QColor(Qt::black)); setTextColor(QColor(Qt::black));
setPlainText(""); setPlainText("");
} }

@ -32,32 +32,32 @@ QPixmap* UBToolWidget::sClosePixmap = 0;
QPixmap* UBToolWidget::sUnpinPixmap = 0; QPixmap* UBToolWidget::sUnpinPixmap = 0;
UBToolWidget::UBToolWidget(const QUrl& pUrl, QGraphicsItem *pParent) UBToolWidget::UBToolWidget(const QUrl& pUrl, QWidget *pParent)
: QGraphicsWidget(pParent, Qt::FramelessWindowHint | Qt::WindowStaysOnTopHint) : QWidget(pParent, Qt::FramelessWindowHint | Qt::WindowStaysOnTopHint)
, mShouldMoveWidget(false) , mShouldMoveWidget(false)
, mContentMargin(0) , mContentMargin(0)
, mFrameWidth(0) , mFrameWidth(0)
, mGraphicsWebView(0) , mWebView(0)
, mGraphicsWidgetItem(0) , mToolWidget(0)
{ {
int widgetType = UBGraphicsWidgetItem::widgetType(pUrl); int widgetType = UBGraphicsWidgetItem::widgetType(pUrl);
if (widgetType == UBWidgetType::Apple) if (widgetType == UBWidgetType::Apple)
mGraphicsWidgetItem = new UBGraphicsAppleWidgetItem(pUrl, this); mToolWidget = new UBGraphicsAppleWidgetItem(pUrl);
else if (widgetType == UBWidgetType::W3C) else if (widgetType == UBWidgetType::W3C)
mGraphicsWidgetItem = new UBGraphicsW3CWidgetItem(pUrl, this); mToolWidget = new UBGraphicsW3CWidgetItem(pUrl);
else else
qDebug() << "UBToolWidget::UBToolWidget: Unknown widget Type"; qDebug() << "UBToolWidget::UBToolWidget: Unknown widget Type";
initialize(); initialize();
} }
UBToolWidget::UBToolWidget(UBGraphicsWidgetItem *pWidget, QGraphicsItem *pParent) UBToolWidget::UBToolWidget(UBGraphicsWidgetItem *pWidget, QWidget *pParent)
: QGraphicsWidget(pParent, Qt::FramelessWindowHint | Qt::WindowStaysOnTopHint) : QWidget(pParent, Qt::FramelessWindowHint | Qt::WindowStaysOnTopHint)
, mShouldMoveWidget(false) , mShouldMoveWidget(false)
, mContentMargin(0) , mContentMargin(0)
, mFrameWidth(0) , mFrameWidth(0)
, mGraphicsWebView(0) , mWebView(0)
, mGraphicsWidgetItem(pWidget) , mToolWidget(pWidget)
{ {
initialize(); initialize();
javaScriptWindowObjectCleared(); javaScriptWindowObjectCleared();
@ -76,50 +76,66 @@ void UBToolWidget::initialize()
if(!sUnpinPixmap) if(!sUnpinPixmap)
sUnpinPixmap = new QPixmap(":/images/unpin.svg"); sUnpinPixmap = new QPixmap(":/images/unpin.svg");
UBGraphicsScene *wscene = dynamic_cast<UBGraphicsScene *>(mGraphicsWidgetItem->scene()); UBGraphicsScene *wscene = dynamic_cast<UBGraphicsScene *>(mToolWidget->scene());
if (wscene) if (wscene)
{ {
wscene->removeItemFromDeletion(mGraphicsWidgetItem); wscene->removeItemFromDeletion(mToolWidget);
wscene->removeItem(mGraphicsWidgetItem); wscene->removeItem(mToolWidget);
} }
mGraphicsWidgetItem->setParent(this);
QGraphicsLinearLayout *graphicsLayout = new QGraphicsLinearLayout(Qt::Vertical, this); mWebView = new QWebView(this);
QPalette palette = mWebView->page()->palette();
palette.setBrush(QPalette::Base, QBrush(Qt::transparent));
mWebView->page()->setPalette(palette);
mWebView->installEventFilter(this);
mFrameWidth = UBSettings::settings()->objectFrameWidth; mFrameWidth = UBSettings::settings()->objectFrameWidth;
mContentMargin = sClosePixmap->width() / 2 + mFrameWidth; mContentMargin = sClosePixmap->width() / 2 + mFrameWidth;
graphicsLayout->setContentsMargins(mContentMargin, mContentMargin, mContentMargin, mContentMargin); setLayout(new QVBoxLayout());
setPreferredSize(mGraphicsWidgetItem->preferredWidth() + mContentMargin * 2, mGraphicsWidgetItem->preferredHeight() + mContentMargin * 2); layout()->setContentsMargins(mContentMargin, mContentMargin, mContentMargin, mContentMargin);
layout()->addWidget(mWebView);
mGraphicsWebView = new QGraphicsWebView(this); setFixedSize(mToolWidget->boundingRect().width() + mContentMargin * 2, mToolWidget->boundingRect().height() + mContentMargin * 2);
connect(mGraphicsWebView->page()->mainFrame(), SIGNAL(javaScriptWindowObjectCleared()), this, SLOT(javaScriptWindowObjectCleared()));
mGraphicsWebView->load(mGraphicsWidgetItem->mainHtml());
graphicsLayout->addItem(mGraphicsWebView);
mGraphicsWebView->setAcceptDrops(false); connect(mWebView->page()->mainFrame(), SIGNAL(javaScriptWindowObjectCleared()), this, SLOT(javaScriptWindowObjectCleared()));
mGraphicsWebView->settings()->setAttribute(QWebSettings::PluginsEnabled, true); mWebView->load(mToolWidget->mainHtml());
mGraphicsWebView->setAttribute(Qt::WA_OpaquePaintEvent, false);
QPalette palette = mGraphicsWebView->page()->palette();
palette.setBrush(QPalette::Base, QBrush(Qt::transparent));
mGraphicsWebView->page()->setPalette(palette);
setLayout(graphicsLayout); mWebView->setAcceptDrops(false);
mWebView->settings()->setAttribute(QWebSettings::PluginsEnabled, true);
mWebView->setAttribute(Qt::WA_OpaquePaintEvent, false);
connect(UBApplication::boardController, SIGNAL(activeSceneChanged()), this, SLOT(javaScriptWindowObjectCleared())); connect(UBApplication::boardController, SIGNAL(activeSceneChanged()), this, SLOT(javaScriptWindowObjectCleared()));
} }
bool UBToolWidget::event(QEvent *event)
bool UBToolWidget::eventFilter(QObject *obj, QEvent *event)
{
if (mShouldMoveWidget && obj == mWebView && event->type() == QEvent::MouseMove)
{
QMouseEvent *mouseMoveEvent = static_cast<QMouseEvent*>(event);
if (mouseMoveEvent->buttons() & Qt::LeftButton)
{ {
if (event->type() == QEvent::ShortcutOverride) move(pos() - mMousePressPos + mWebView->mapTo(this, mouseMoveEvent->pos()));
event->accept(); event->accept();
return QGraphicsWidget::event(event); return true;
}
} }
void UBToolWidget::mousePressEvent(QGraphicsSceneMouseEvent *event) // standard event processing
return QObject::eventFilter(obj, event);
}
void UBToolWidget::mousePressEvent(QMouseEvent *event)
{ {
QGraphicsWidget::mousePressEvent(event); QWidget::mousePressEvent(event);
/* did webkit consume the mouse press ? */ /* did webkit consume the mouse press ? */
mShouldMoveWidget = !event->isAccepted() && (event->buttons() & Qt::LeftButton); mShouldMoveWidget = !event->isAccepted() && (event->buttons() & Qt::LeftButton);
@ -128,108 +144,92 @@ void UBToolWidget::mousePressEvent(QGraphicsSceneMouseEvent *event)
update(); update();
} }
void UBToolWidget::mouseMoveEvent(QGraphicsSceneMouseEvent *event) void UBToolWidget::mouseMoveEvent(QMouseEvent *event)
{ {
if(mShouldMoveWidget && (event->buttons() & Qt::LeftButton)) { if(mShouldMoveWidget && (event->buttons() & Qt::LeftButton)) {
setPos(pos() - mMousePressPos + event->pos()); move(pos() - mMousePressPos + event->pos());
event->accept(); event->accept();
} }
QGraphicsWidget::mouseMoveEvent(event); QWidget::mouseMoveEvent(event);
} }
void UBToolWidget::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) void UBToolWidget::mouseReleaseEvent(QMouseEvent *event)
{ {
mShouldMoveWidget = false; mShouldMoveWidget = false;
if (event->pos().x() >= 0 && event->pos().x() < sClosePixmap->width() && event->pos().y() >= 0 && event->pos().y() < sClosePixmap->height()) { if (event->pos().x() >= 0 && event->pos().x() < sClosePixmap->width() && event->pos().y() >= 0 && event->pos().y() < sClosePixmap->height()) {
remove(); UBApplication::boardController->removeTool(this);
event->accept(); event->accept();
} }
else if (mGraphicsWidgetItem->canBeContent() && event->pos().x() >= mContentMargin && event->pos().x() < mContentMargin + sUnpinPixmap->width() && event->pos().y() >= 0 && event->pos().y() < sUnpinPixmap->height()) { else if (mToolWidget->canBeContent() && event->pos().x() >= mContentMargin && event->pos().x() < mContentMargin + sUnpinPixmap->width() && event->pos().y() >= 0 && event->pos().y() < sUnpinPixmap->height()) {
UBApplication::boardController->moveToolWidgetToScene(this); UBApplication::boardController->moveToolWidgetToScene(this);
event->accept(); event->accept();
} }
else else
QGraphicsWidget::mouseReleaseEvent(event); /* don't propgate to parent, the widget is deleted in UBApplication */ QWidget::mouseReleaseEvent(event); /* don't propgate to parent, the widget is deleted in UBApplication */
} }
void UBToolWidget::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) void UBToolWidget::paintEvent(QPaintEvent *event)
{
QWidget::paintEvent(event);
//if (isActiveWindow())
{ {
QGraphicsWidget::paint(painter, option, widget); QPainter painter(this);
painter.setRenderHint(QPainter::Antialiasing);
painter.setPen(Qt::NoPen);
painter.setBrush(QColor(127, 127, 127, 127));
/* painting lightweight toolbar */ painter.drawRoundedRect(QRectF(sClosePixmap->width() / 2
if (isActiveWindow()) { , sClosePixmap->height() / 2
painter->setRenderHint(QPainter::Antialiasing); , width() - sClosePixmap->width()
painter->setPen(Qt::NoPen); , mFrameWidth)
painter->setBrush(QColor(127, 127, 127, 127)); , mFrameWidth / 2
, mFrameWidth / 2);
painter->drawRoundedRect(QRectF(sClosePixmap->width() / 2, sClosePixmap->height() / 2, preferredWidth() - sClosePixmap->width(), mFrameWidth), mFrameWidth / 2, mFrameWidth / 2); painter.drawPixmap(0, 0, *sClosePixmap);
painter->drawPixmap(0, 0, *sClosePixmap);
if (mGraphicsWidgetItem->canBeContent()) if (mToolWidget->canBeContent())
painter->drawPixmap(mContentMargin, 0, *sUnpinPixmap); painter.drawPixmap(mContentMargin, 0, *sUnpinPixmap);
} }
} }
void UBToolWidget::javaScriptWindowObjectCleared() void UBToolWidget::javaScriptWindowObjectCleared()
{ {
UBWidgetUniboardAPI *uniboardAPI = new UBWidgetUniboardAPI(UBApplication::boardController->activeScene(), mGraphicsWidgetItem); UBWidgetUniboardAPI *uniboardAPI = new UBWidgetUniboardAPI(UBApplication::boardController->activeScene(), mToolWidget);
mGraphicsWebView->page()->mainFrame()->addToJavaScriptWindowObject("sankore", uniboardAPI); mWebView->page()->mainFrame()->addToJavaScriptWindowObject("sankore", uniboardAPI);
UBGraphicsW3CWidgetItem *graphicsW3cWidgetItem = dynamic_cast<UBGraphicsW3CWidgetItem*>(mGraphicsWidgetItem); UBGraphicsW3CWidgetItem *graphicsW3cWidgetItem = dynamic_cast<UBGraphicsW3CWidgetItem*>(mToolWidget);
if (graphicsW3cWidgetItem) if (graphicsW3cWidgetItem)
{ {
UBW3CWidgetAPI* widgetAPI = new UBW3CWidgetAPI(graphicsW3cWidgetItem); UBW3CWidgetAPI* widgetAPI = new UBW3CWidgetAPI(graphicsW3cWidgetItem);
mGraphicsWebView->page()->mainFrame()->addToJavaScriptWindowObject("widget", widgetAPI); mWebView->page()->mainFrame()->addToJavaScriptWindowObject("widget", widgetAPI);
} }
} }
UBGraphicsWidgetItem* UBToolWidget::graphicsWidgetItem() const UBGraphicsWidgetItem* UBToolWidget::toolWidget() const
{ {
return mGraphicsWidgetItem; return mToolWidget;
} }
QPointF UBToolWidget::naturalCenter() const QPoint UBToolWidget::naturalCenter() const
{ {
if (mGraphicsWebView) if (mWebView)
return mGraphicsWebView->geometry().center(); return mWebView->geometry().center();
else else
return QPointF(0, 0); return QPoint(0, 0);
}
void UBToolWidget::centerOn(const QPointF& pos)
{
QGraphicsWidget::setPos(pos - QPointF(preferredWidth() / 2, preferredHeight() / 2));
} }
void UBToolWidget::remove() void UBToolWidget::remove()
{ {
mGraphicsWebView->setHtml(QString()); mToolWidget = NULL;
scene()->removeItem(this); hide();
} deleteLater();
UBGraphicsScene* UBToolWidget::scene()
{
return qobject_cast<UBGraphicsScene*>(QGraphicsItem::scene());
}
QPointF UBToolWidget::pos() const
{
return QPointF(QGraphicsItem::pos().x() + mContentMargin * scale(), QGraphicsItem::pos().y() + mContentMargin * scale());
}
void UBToolWidget::setPos(const QPointF &point)
{
UBToolWidget::setPos(point.x(), point.y());
}
void UBToolWidget::setPos(qreal x, qreal y)
{
QGraphicsItem::setPos(x - mContentMargin * scale(), y - mContentMargin * scale());
} }
int UBToolWidget::type() const void UBToolWidget::centerOn(const QPoint& pos)
{ {
return Type; QWidget::move(pos - QPoint(width() / 2, height() / 2));
} }

@ -17,60 +17,52 @@
#define UBTOOLWIDGET_H_ #define UBTOOLWIDGET_H_
#include <QtGui> #include <QtGui>
#include <QtWebKit>
#include "core/UB.h"
class UBGraphicsScene;
class UBGraphicsWidgetItem; class UBGraphicsWidgetItem;
class QWidget;
class UBGraphicsScene;
class QWebView;
class UBToolWidget : public QGraphicsWidget class UBToolWidget : public QWidget
{ {
Q_OBJECT Q_OBJECT;
public: public:
UBToolWidget(const QUrl& pUrl, QGraphicsItem *pParent = 0); UBToolWidget(const QUrl& pUrl, QWidget* pParent = 0);
UBToolWidget(UBGraphicsWidgetItem* pGraphicsWidgetItem, QGraphicsItem *pParent = 0); UBToolWidget(UBGraphicsWidgetItem* pWidget, QWidget* pParent = 0);
virtual ~UBToolWidget(); virtual ~UBToolWidget();
UBGraphicsWidgetItem* graphicsWidgetItem() const;
QPointF naturalCenter() const;
void centerOn(const QPointF& pos);
void remove(); void remove();
void centerOn(const QPoint& pos);
virtual UBGraphicsScene* scene(); QPoint naturalCenter() const;
virtual QPointF pos() const;
virtual void setPos(const QPointF &point);
virtual void setPos(qreal x, qreal y);
virtual int type() const;
enum UBGraphicsWidgetItem *toolWidget() const;
{
Type = UBGraphicsItemType::ToolWidgetItemType
};
protected: protected:
void initialize(); void initialize();
virtual void paintEvent(QPaintEvent *event);
virtual void mousePressEvent(QMouseEvent *event);
virtual void mouseMoveEvent(QMouseEvent *event);
virtual void mouseReleaseEvent(QMouseEvent *event);
virtual bool event(QEvent *event); virtual bool eventFilter(QObject *obj, QEvent *event);
virtual void mousePressEvent(QGraphicsSceneMouseEvent *event);
virtual void mouseMoveEvent(QGraphicsSceneMouseEvent *event);
virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent *event);
virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
private slots: private slots:
void javaScriptWindowObjectCleared(); void javaScriptWindowObjectCleared();
protected: protected:
bool mShouldMoveWidget; QWebView *mWebView;
int mContentMargin; UBGraphicsWidgetItem *mToolWidget;
int mFrameWidth;
QGraphicsWebView *mGraphicsWebView;
UBGraphicsWidgetItem *mGraphicsWidgetItem;
QPointF mMousePressPos;
static QPixmap *sClosePixmap; static QPixmap *sClosePixmap;
static QPixmap *sUnpinPixmap; static QPixmap *sUnpinPixmap;
QPoint mMousePressPos;
bool mShouldMoveWidget;
int mContentMargin;
int mFrameWidth;
}; };
#endif /* UBTOOLWIDGET_H_ */ #endif /* UBTOOLWIDGET_H_ */

@ -0,0 +1,828 @@
/*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "UBGraphicsAristo.h"
#include "board/UBBoardController.h"
#include "board/UBDrawingController.h"
#include "core/UBApplication.h"
#include "domain/UBGraphicsScene.h"
#include <QColor>
#include <QFont>
#include <QFontMetricsF>
#include <QGraphicsItem>
#include <QLineF>
#include <QPolygonF>
#include <QRadialGradient>
#include <QString>
#include "core/memcheck.h"
const QRectF UBGraphicsAristo::sDefaultRect = QRectF(0, 0, 800, 500);
const UBGraphicsAristo::Orientation UBGraphicsAristo::sDefaultOrientation = UBGraphicsAristo::Bottom;
UBGraphicsAristo::UBGraphicsAristo()
: UBAbstractDrawRuler()
, QGraphicsPathItem()
, mMarking(false)
, mResizing(false)
, mRotating(false)
, mOrientation(Undefined)
, mRotatedAngle(0)
, mMarkerAngle(0)
, mStartAngle(0)
, mSpan(180)
, mHFlipSvgItem(0)
, mMarkerSvgItem(0)
, mResizeSvgItem(0)
, mRotateSvgItem(0)
{
mHFlipSvgItem = new QGraphicsSvgItem(":/images/vflipTool.svg", this);
mHFlipSvgItem->setVisible(false);
mHFlipSvgItem->setData(UBGraphicsItemData::ItemLayerType, QVariant(UBItemLayerType::Control));
mResizeSvgItem = new QGraphicsSvgItem(":/images/resizeTool.svg", this);
mResizeSvgItem->setVisible(false);
mResizeSvgItem->setData(UBGraphicsItemData::ItemLayerType, QVariant(UBItemLayerType::Control));
mRotateSvgItem = new QGraphicsSvgItem(":/images/rotateTool.svg", this);
mRotateSvgItem->setVisible(false);
mRotateSvgItem->setData(UBGraphicsItemData::ItemLayerType, QVariant(UBItemLayerType::Control));
mMarkerSvgItem = new QGraphicsSvgItem(":/images/angleMarker.svg", this);
mMarkerSvgItem->setVisible(false);
mMarkerSvgItem->setData(UBGraphicsItemData::ItemLayerType, QVariant(UBItemLayerType::Tool));
mMarkerSvgItem->setVisible(true);
create(*this);
setBoundingRect(sDefaultRect);
setOrientation(sDefaultOrientation);
}
UBGraphicsAristo::~UBGraphicsAristo()
{
/* NOOP */
}
/*
* setOrientation() modify the tool orientation.
* makeGeometryChange() is called so points are recomputed, control items are positionnated and shape is determined according to this modification.
*/
void UBGraphicsAristo::setOrientation(Orientation orientation)
{
mOrientation = orientation;
makeGeometryChange();
}
/* calculatePoints() is used to calculate polygon's apexes coordinates.
* This function handles orientation changes too.
*/
void UBGraphicsAristo::calculatePoints()
{
switch (mOrientation) {
case Bottom:
C.setX(boundingRect().center().x());
C.setY(boundingRect().bottom());
A.setX(boundingRect().left());
A.setY(boundingRect().bottom() - boundingRect().width() / 2);
B.setX(boundingRect().right());
B.setY(boundingRect().bottom() - boundingRect().width() / 2);
break;
case Top:
C.setX(boundingRect().center().x());
C.setY(boundingRect().top());
A.setX(boundingRect().left());
A.setY(boundingRect().top() + boundingRect().width() / 2);
B.setX(boundingRect().right());
B.setY(boundingRect().top() + boundingRect().width() / 2);
break;
default:
break;
}
}
/*
* setItemsPos() places control items according to A, B and C positions.
* Call this function after A, B or C position modification, mostly after calling calculatePoints().
* These positions has to be set when calling setPath() to allow hover events on items which are not into the main polygon.
*/
void UBGraphicsAristo::setItemsPos()
{
mCloseSvgItem->setPos(closeButtonRect().topLeft() + rotationCenter());
mHFlipSvgItem->setPos(hFlipRect().topLeft() + rotationCenter());
mRotateSvgItem->setPos(rotateRect().topLeft() + rotationCenter());
mResizeSvgItem->setPos(resizeButtonRect().topLeft() + rotationCenter());
mMarkerSvgItem->setPos(markerButtonRect().topLeft() + rotationCenter());
}
/*
* determinePath() modify the shape according to apexes coordinates and control item positions.
* This is useful when orientation is modified.
* Returns the painter path corresponding to object parameters.
*/
QPainterPath UBGraphicsAristo::determinePath()
{
QPainterPath path;
QPolygonF polygon;
polygon << A << B << C;
path.addPolygon(polygon);
path.addPath(mResizeSvgItem->shape().translated(mResizeSvgItem->pos()));
path.addPath(mMarkerSvgItem->shape().translated(mMarkerSvgItem->pos()));
return path;
}
/*
* setBoundingRect() is a helper to set the given rectangle as the new shape to limit apexes coordinates.
* This is useful when instanciating or resizing the object.
* makeGeometryChange() is called so points are recomputed, control items are positionnated and shape is determined according to this modification.
* Setting bounds' width less than 300 is not allowed.
*/
void UBGraphicsAristo::setBoundingRect(QRectF boundingRect)
{
if (boundingRect.width() < 300)
return;
QPainterPath path;
path.addRect(boundingRect);
setPath(path);
if (mOrientation != Undefined)
makeGeometryChange();
}
void UBGraphicsAristo::makeGeometryChange()
{
calculatePoints();
setItemsPos();
setPath(determinePath());
}
UBItem* UBGraphicsAristo::deepCopy(void) const
{
UBGraphicsAristo* copy = new UBGraphicsAristo();
copyItemParameters(copy);
return copy;
}
void UBGraphicsAristo::copyItemParameters(UBItem *copy) const
{
UBGraphicsAristo* cp = dynamic_cast<UBGraphicsAristo*>(copy);
if (cp)
{
/* TODO: copy all members */
cp->setPos(this->pos());
cp->setTransform(this->transform());
cp->setBoundingRect(boundingRect());
cp->setOrientation(mOrientation);
cp->mRotatedAngle = mRotatedAngle;
cp->mMarkerAngle = mMarkerAngle;
}
}
void UBGraphicsAristo::paint(QPainter *painter, const QStyleOptionGraphicsItem *, QWidget *)
{
QPolygonF polygon;
painter->setBrush(fillBrush());
painter->setPen(drawColor());
polygon << A << B << C;
painter->drawPolygon(polygon);
polygon.clear();
paintGraduations(painter);
paintMarker(painter);
}
QBrush UBGraphicsAristo::fillBrush() const
{
QColor fillColor = edgeFillColor();// scene()->isDarkBackground() ? sDarkBackgroundFillColor : sFillColor;
QColor fillColorCenter = middleFillColor();//scene()->isDarkBackground() ? sDarkBackgroundFillColorCenter : sFillColorCenter;
QColor transparentWhite = Qt::white;
transparentWhite.setAlpha(scene()->isDarkBackground() ? sDrawTransparency : sFillTransparency);
QRadialGradient radialGradient(boundingRect().center(), radius(), boundingRect().center());
radialGradient.setColorAt(0, fillColorCenter);
radialGradient.setColorAt(1, fillColor);
return radialGradient;
}
/* paintGraduations() paints graduations on the ruler side (length graduations) and the two other sides (angle graduation) */
void UBGraphicsAristo::paintGraduations(QPainter *painter)
{
paintRulerGraduations(painter);
paintProtractorGraduations(painter);
}
void UBGraphicsAristo::paintRulerGraduations(QPainter *painter)
{
/* defining useful constants */
const int centimeterGraduationHeight = 15;
const int halfCentimeterGraduationHeight = 10;
const int millimeterGraduationHeight = 5;
const int millimetersPerCentimeter = 10;
const int millimetersPerHalfCentimeter = 5;
painter->save();
painter->setFont(font());
QFontMetricsF fontMetrics(painter->font());
/* Browsing milliters in half width of ruler side */
for (int millimeters = 0; millimeters < (boundingRect().width() / 2 - sLeftEdgeMargin - sRoundingRadius) / sPixelsPerMillimeter; millimeters++)
{
/* defining graduationHeight ; values are different to draw bigger lines if millimiter considered is a centimeter or a half centimeter */
int graduationHeight = (0 == millimeters % millimetersPerCentimeter) ?
centimeterGraduationHeight :
((0 == millimeters % millimetersPerHalfCentimeter) ?
halfCentimeterGraduationHeight : millimeterGraduationHeight);
/* correcting graduationHeight: draw the line in the other direction in case ruler is top-oriented, to stay inside the tool and inside the rect */
graduationHeight = mOrientation == Bottom ? graduationHeight : - graduationHeight;
/* drawing graduation to the left and to the right of origin, which is the center of graduated side */
painter->drawLine(QLine(rotationCenter().x() + sPixelsPerMillimeter * millimeters, rotationCenter().y(), rotationCenter().x() + sPixelsPerMillimeter * millimeters, rotationCenter().y() + graduationHeight));
if (millimeters != 0)
painter->drawLine(QLine(rotationCenter().x() - sPixelsPerMillimeter * millimeters, rotationCenter().y(), rotationCenter().x() - sPixelsPerMillimeter * millimeters, rotationCenter().y() + graduationHeight));
/* drawing associated value if considered graduation is a centimeter */
if (0 == millimeters % millimetersPerCentimeter)
{
/* defining graduation value */
QString text = QString("%1").arg((int)(millimeters / millimetersPerCentimeter));
/* staying inside polygon */
if (rotationCenter().x() + sPixelsPerMillimeter * millimeters + fontMetrics.width(text) / 2 < boundingRect().right())
{
qreal textWidth = fontMetrics.width(text);
qreal textHeight = fontMetrics.tightBoundingRect(text).height() + 5;
/* text y-coordinate is different according to tool's orientation */
qreal textY = mOrientation == Bottom ? A.y() + 5 + centimeterGraduationHeight : A.y() - 5 - centimeterGraduationHeight + graduationHeight;
/* if text's rect is not out of polygon's bounds, drawing value below or above graduation */
QPointF intersectionPoint;
bool paint = false;
if (mOrientation == Bottom && QLineF(QPointF(rotationCenter().x() - sPixelsPerMillimeter * millimeters - textWidth / 2, rotationCenter().y()), QPointF(rotationCenter().x() - sPixelsPerMillimeter * millimeters - textWidth / 2, textY + textHeight)).intersect(QLineF(A, C), &intersectionPoint) != QLineF::BoundedIntersection && QLineF(QPointF(rotationCenter().x() - sPixelsPerMillimeter * millimeters + textWidth / 2, rotationCenter().y()), QPointF(rotationCenter().x() - sPixelsPerMillimeter * millimeters + textWidth / 2, textY + textHeight)).intersect(QLineF(A, C), &intersectionPoint) != QLineF::BoundedIntersection) {
paint = true;
}
else if (mOrientation == Top && QLineF(QPointF(rotationCenter().x() - sPixelsPerMillimeter * millimeters - textWidth / 2, rotationCenter().y()), QPointF(rotationCenter().x() - sPixelsPerMillimeter * millimeters - textWidth / 2, textY - textHeight)).intersect(QLineF(A, C), &intersectionPoint) != QLineF::BoundedIntersection && QLineF(QPointF(rotationCenter().x() - sPixelsPerMillimeter * millimeters + textWidth / 2, rotationCenter().y()), QPointF(rotationCenter().x() - sPixelsPerMillimeter * millimeters + textWidth / 2, textY - textHeight)).intersect(QLineF(A, C), &intersectionPoint) != QLineF::BoundedIntersection) {
paint = true;
}
if (paint) {
painter->drawText(
QRectF(rotationCenter().x() + sPixelsPerMillimeter * millimeters - textWidth / 2, textY, textWidth, textHeight),
Qt::AlignVCenter, text);
if (millimeters != 0)
painter->drawText(
QRectF(rotationCenter().x() - sPixelsPerMillimeter * millimeters - textWidth / 2, textY, textWidth, textHeight),
Qt::AlignVCenter, text);
}
}
}
}
painter->restore();
}
void UBGraphicsAristo::paintProtractorGraduations(QPainter* painter)
{
/* defining useful constants */
const int tenDegreeGraduationLength = 15;
const int fiveDegreeGraduationLength = 10;
const int oneDegreeGraduationLength = 5;
painter->save();
QFont font1 = painter->font();
#ifdef Q_WS_MAC
font1.setPointSizeF(font1.pointSizeF() - 3);
#endif
QFontMetricsF fm1(font1);
//Font for internal arc
QFont font2 = painter->font();
font2.setPointSizeF(font1.pointSizeF()/1.5);
QFontMetricsF fm2(font2);
/* defining virtual arc diameter */
qreal rad = radius();
QPointF center = rotationCenter();
/* browsing angles */
for (int angle = 1; angle < mSpan; angle++)
{
int graduationLength = (0 == angle % 10) ? tenDegreeGraduationLength : ((0 == angle % 5) ? fiveDegreeGraduationLength : oneDegreeGraduationLength);
qreal co = cos(((qreal)angle + mStartAngle) * PI/180);
qreal si = sin(((qreal)angle + mStartAngle) * PI/180);
/* inverse sinus according to the orientation, to draw graduations on the polygon */
si = mOrientation == Bottom ? -si : si;
/* drawing the graduation around the virtual arc */
if (angle >= sArcAngleMargin && angle <= mSpan - sArcAngleMargin)
painter->drawLine(QLineF(QPointF(center.x()+ rad/2*co, center.y() - rad/2*si),
QPointF(center.x()+ (rad/2 + graduationLength)*co,
center.y() - (rad/2 + graduationLength)*si)));
QPointF intersectionPoint;
QLineF referenceLine;
if (angle < 90)
referenceLine.setP1(B);
else
referenceLine.setP1(A);
referenceLine.setP2(C);
/* if angle is 10-multiple, drawing it's value, rotated to be easily red */
if (0 == angle % 10) {
QString grad = QString("%1").arg((int)(angle));
QString grad2 = QString("%1").arg((int)mSpan - angle);
painter->setFont(font2);
painter->save();
painter->translate(center.x() + (rad/2 + graduationLength*1.5)*co, center.y() - (rad/2 + graduationLength*1.5)*si);
int degrees = mOrientation == Bottom ? angle : -angle;
painter->rotate(-90 + degrees);
painter->drawText(- fm2.width(grad)/2, - fm2.height()/2, fm2.width(grad), fm2.height(), Qt::AlignCenter, grad);
painter->restore();
painter->setFont(font1);
/* drawing the graduation near tool's side */
if (QLineF(QPointF(center.x()+ rad/2*co, center.y() - rad/2*si),
QPointF(center.x()+ (rad/2 + graduationLength)*co,
center.y() - (rad/2 + graduationLength)*si)).intersect(referenceLine, &intersectionPoint) == QLineF::UnboundedIntersection)
painter->drawLine(QLineF(QPointF(center.x() + (rad/2 + graduationLength*1.5 + fm2.width(grad)/2)*co,
center.y() - (rad/2 + graduationLength*1.5 + fm2.height()/2)*si),
intersectionPoint));
}
/* drawing the graduation near tool's side */
else
if (QLineF(QPointF(center.x()+ rad/2*co, center.y() - rad/2*si),
QPointF(center.x()+ (rad/2 + graduationLength)*co,
center.y() - (rad/2 + graduationLength)*si)).intersect(referenceLine, &intersectionPoint) == QLineF::UnboundedIntersection)
painter->drawLine(QLineF(QPointF(intersectionPoint.x() - (graduationLength*1.5)*co,
intersectionPoint.y() + (graduationLength*1.5)*si),
intersectionPoint));
}
painter->restore();
}
/* paintMarker() adjust marker button according to the current angle, draw the line allowing user to set precisely the angle, and draw the current angle's value. */
void UBGraphicsAristo::paintMarker(QPainter *painter)
{
/* adjusting marker button */
mMarkerSvgItem->resetTransform();
mMarkerSvgItem->translate(-markerButtonRect().left(), -markerButtonRect().top());
mMarkerSvgItem->rotate(mMarkerAngle);
mMarkerSvgItem->translate(markerButtonRect().left(), markerButtonRect().top());
qreal co = cos((mMarkerAngle) * PI/180);
qreal si = sin((mMarkerAngle) * PI/180);
/* Setting point composing the line (from point C) which intersects the line we want to draw. */
QPointF referencePoint;
if (mOrientation == Bottom) {
if ((int)mMarkerAngle % 360 < 90)
referencePoint = B;
else
referencePoint = A;
}
else if (mOrientation == Top) {
if ((int)mMarkerAngle % 360 < 270 && (int)mMarkerAngle % 360 > 0)
referencePoint = A;
else
referencePoint = B;
}
/* getting intersection point to draw the wanted line */
QLineF intersectedLine(rotationCenter(), QPointF(rotationCenter().x()+co, rotationCenter().y()+si));
QPointF intersectionPoint;
if (intersectedLine.intersect(QLineF(referencePoint, C), &intersectionPoint))
painter->drawLine(QLineF(intersectionPoint, rotationCenter()));
/* drawing angle value */
qreal rightAngle = mOrientation == Bottom ? mMarkerAngle : 360 - mMarkerAngle;
QString angleText = QString("%1°").arg(rightAngle, 0, 'f', 1);
QFont font1 = painter->font();
#ifdef Q_WS_MAC
font1.setPointSizeF(font1.pointSizeF() - 3);
#endif
QFontMetricsF fm1(font1);
if (mOrientation == Bottom)
painter->drawText(rotationCenter().x() - fm1.width(angleText)/2 - radius()/8, rotationCenter().y() + radius()/8 - fm1.height()/2, fm1.width(angleText), fm1.height(), Qt::AlignCenter, angleText);
else
painter->drawText(rotationCenter().x() - fm1.width(angleText)/2 - radius()/8, rotationCenter().y() - radius()/8 - fm1.height()/2, fm1.width(angleText), fm1.height(), Qt::AlignCenter, angleText);
}
void UBGraphicsAristo::rotateAroundCenter(qreal angle)
{
qreal oldAngle = mRotatedAngle;
mRotatedAngle = angle;
QTransform transform;
rotateAroundCenter(transform, rotationCenter());
setTransform(transform, true);
mRotatedAngle = oldAngle + angle; // We have to store absolute value for FLIP case
}
void UBGraphicsAristo::rotateAroundCenter(QTransform& transform, QPointF center)
{
transform.translate(center.x(), center.y());
transform.rotate(mRotatedAngle);
transform.translate(- center.x(), - center.y());
}
void UBGraphicsAristo::resize(qreal factor)
{
prepareGeometryChange();
translate(rotationCenter().x(), rotationCenter().y());
scale(factor, factor);
translate(-rotationCenter().x(), -rotationCenter().y());
}
QPointF UBGraphicsAristo::rotationCenter() const
{
return QPointF((A.x() + B.x()) / 2, (A.y() + B.y()) / 2);
}
QRectF UBGraphicsAristo::closeButtonRect() const
{
qreal y = radius() / 4 + hFlipRect().height() + 3 + rotateRect().height() + 3;
if (mOrientation == Top)
y = -y;
return QRectF(- mCloseSvgItem->boundingRect().width() / 2, y, mCloseSvgItem->boundingRect().width(), mCloseSvgItem->boundingRect().height());
}
QRectF UBGraphicsAristo::hFlipRect() const
{
qreal y = radius() / 4;
if (mOrientation == Top)
y = -y;
return QRectF(- mHFlipSvgItem->boundingRect().width() / 2, y, mHFlipSvgItem->boundingRect().width(), mHFlipSvgItem->boundingRect().height());
}
QRectF UBGraphicsAristo::markerButtonRect() const
{
return QRectF (radius()/2 - mMarkerSvgItem->boundingRect().width(), - mMarkerSvgItem->boundingRect().height()/2, mMarkerSvgItem->boundingRect().width(), mMarkerSvgItem->boundingRect().height());
}
QRectF UBGraphicsAristo::resizeButtonRect() const
{
return QRectF((B - rotationCenter()).x() - 100 - mResizeSvgItem->boundingRect().width()/2, - mResizeSvgItem->boundingRect().height()/2, mResizeSvgItem->boundingRect().width(), mResizeSvgItem->boundingRect().height());
}
QRectF UBGraphicsAristo::rotateRect() const
{
qreal y = radius() / 4 + hFlipRect().height() + 3;
if (mOrientation == Top)
y = -y;
return QRectF(- mRotateSvgItem->boundingRect().width() / 2, y, mRotateSvgItem->boundingRect().width(), mRotateSvgItem->boundingRect().height());
}
QCursor UBGraphicsAristo::flipCursor() const
{
return Qt::ArrowCursor;
}
QCursor UBGraphicsAristo::markerCursor() const
{
return Qt::ArrowCursor;
}
QCursor UBGraphicsAristo::resizeCursor() const
{
return Qt::ArrowCursor;
}
void UBGraphicsAristo::mousePressEvent(QGraphicsSceneMouseEvent *event)
{
switch (toolFromPos(event->pos())) {
case Rotate:
mRotating = true;
event->accept();
break;
case Resize:
mResizing = true;
event->accept();
break;
case MoveMarker:
mMarking = true;
event->accept();
break;
default:
QGraphicsItem::mousePressEvent(event);
break;
}
mShowButtons = false;
mHFlipSvgItem->setVisible(false);
mCloseSvgItem->setVisible(false);
mRotateSvgItem->setVisible(mRotating);
mResizeSvgItem->setVisible(mResizing);
update();
}
void UBGraphicsAristo::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
{
if (!mResizing && !mRotating && !mMarking)
{
QGraphicsItem::mouseMoveEvent(event);
}
else
{
QLineF currentLine(rotationCenter(), event->pos());
QLineF lastLine(rotationCenter(), event->lastPos());
if (mRotating) {
rotateAroundCenter(currentLine.angleTo(lastLine));
}
else if (mResizing) {
QPointF delta = event->pos() - event->lastPos();
setBoundingRect(QRectF(boundingRect().topLeft(), QSizeF(boundingRect().width() + delta.x(), boundingRect().height() + delta.x())));
}
else if(mMarking) {
qreal angle = currentLine.angleTo(lastLine);
mMarkerAngle += angle;
mMarkerAngle -= (int)(mMarkerAngle/360)*360;
if (mOrientation == Bottom) {
if (mMarkerAngle >= 270)
mMarkerAngle = 0;
else if (mMarkerAngle > 180)
mMarkerAngle = 180;
}
else if (mOrientation == Top) {
if (mMarkerAngle < 90)
mMarkerAngle = 360;
else if (mMarkerAngle < 180)
mMarkerAngle = 180;
}
update();
}
event->accept();
}
}
void UBGraphicsAristo::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
{
if (mResizing || mRotating || mMarking)
{
mResizing = false;
mRotating = false;
mMarking = false;
event->accept();
}
else
{
switch (toolFromPos(event->pos())) {
case Close :
hide();
emit hidden();
break;
case HorizontalFlip:
/* substracting difference to zero [2pi] twice, to obtain the desired angle */
mMarkerAngle -= 2 * (mMarkerAngle - (int)(mMarkerAngle/360)*360) - 360;
/* setting new orientation */
switch(mOrientation) {
case Bottom:
setOrientation(Top);
break;
case Top:
setOrientation(Bottom);
break;
default:
break;
}
default:
QGraphicsItem::mouseReleaseEvent(event);
break;
}
}
mShowButtons = true;
update();
if (scene())
scene()->setModified(true);
}
void UBGraphicsAristo::hoverEnterEvent(QGraphicsSceneHoverEvent *event)
{
UBStylusTool::Enum currentTool = (UBStylusTool::Enum)UBDrawingController::drawingController ()->stylusTool ();
if (currentTool == UBStylusTool::Selector) {
mShowButtons = true;
mHFlipSvgItem->setVisible(true);
mRotateSvgItem->setVisible(true);
mResizeSvgItem->setVisible(true);
mCloseSvgItem->setVisible(true);
switch (toolFromPos(event->pos())) {
case HorizontalFlip:
setCursor(flipCursor());
break;
case Rotate:
setCursor(rotateCursor());
break;
case Resize:
setCursor(resizeCursor());
break;
case MoveMarker:
setCursor(markerCursor());
break;
case Close:
setCursor(closeCursor());
break;
default:
setCursor(moveCursor());
break;
}
event->accept();
update();
} else if (UBDrawingController::drawingController()->isDrawingTool()) {
setCursor(drawRulerLineCursor());
UBDrawingController::drawingController()->mActiveRuler = this;
event->accept();
}
}
void UBGraphicsAristo::hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
{
mShowButtons = false;
setCursor(Qt::ArrowCursor);
mHFlipSvgItem->setVisible(false);
mRotateSvgItem->setVisible(false);
mResizeSvgItem->setVisible(false);
mCloseSvgItem->setVisible(false);
UBDrawingController::drawingController()->mActiveRuler = NULL;
event->accept();
update();
}
void UBGraphicsAristo::hoverMoveEvent(QGraphicsSceneHoverEvent *event)
{
UBStylusTool::Enum currentTool = (UBStylusTool::Enum)UBDrawingController::drawingController ()->stylusTool ();
if (currentTool == UBStylusTool::Selector)
{
mShowButtons = true;
mHFlipSvgItem->setVisible(true);
mRotateSvgItem->setVisible(true);
mResizeSvgItem->setVisible(true);
mCloseSvgItem->setVisible(true);
switch (toolFromPos(event->pos())) {
case HorizontalFlip:
setCursor(flipCursor());
break;
case Rotate:
setCursor(rotateCursor());
break;
case Resize:
setCursor(resizeCursor());
break;
case MoveMarker:
setCursor(markerCursor());
break;
case Close:
setCursor(closeCursor());
break;
default:
setCursor(moveCursor());
break;
}
event->accept();
}
else if (UBDrawingController::drawingController()->isDrawingTool())
event->accept();
}
/*
* toolfromPos() returns the item type corresponding to the given position.
* This method is used to reduce the amount of code in each event function and improve class' maintainability.
* pos: event's position ; a rotation is done to counter elements rotation, like the marker button.
*/
UBGraphicsAristo::Tool UBGraphicsAristo::toolFromPos(QPointF pos)
{
pos = pos - rotationCenter();
qreal rotationAngle = mOrientation == Bottom ? - mMarkerAngle : Top ? 360 * (int)(mMarkerAngle / 360 + 1) - mMarkerAngle : 0;
QTransform t;
t.rotate(rotationAngle);
QPointF p2 = t.map(pos);
if (resizeButtonRect().contains(pos))
return Resize;
else if (closeButtonRect().contains(pos))
return Close;
else if (rotateRect().contains(pos))
return Rotate;
else if (markerButtonRect().contains(p2))
return MoveMarker;
else if (hFlipRect().contains(pos))
return HorizontalFlip;
else if (shape().contains(pos))
return Move;
else
return None;
}
void UBGraphicsAristo::StartLine(const QPointF &scenePos, qreal width)
{
QPointF itemPos = mapFromScene(scenePos);
qreal y;
y = rotationCenter().y();
if (itemPos.x() < boundingRect().x() + sLeftEdgeMargin)
itemPos.setX(boundingRect().x() + sLeftEdgeMargin);
if (itemPos.x() > boundingRect().x() + boundingRect().width() - sLeftEdgeMargin)
itemPos.setX(boundingRect().x() + boundingRect().width() - sLeftEdgeMargin);
itemPos.setY(y);
itemPos = mapToScene(itemPos);
scene()->moveTo(itemPos);
scene()->drawLineTo(itemPos, width, true);
}
void UBGraphicsAristo::DrawLine(const QPointF &scenePos, qreal width)
{
QPointF itemPos = mapFromScene(scenePos);
qreal y;
y = rotationCenter().y();
if (itemPos.x() < boundingRect().x() + sLeftEdgeMargin)
itemPos.setX(boundingRect().x() + sLeftEdgeMargin);
if (itemPos.x() > boundingRect().x() + boundingRect().width() - sLeftEdgeMargin)
itemPos.setX(boundingRect().x() + boundingRect().width() - sLeftEdgeMargin);
itemPos.setY(y);
itemPos = mapToScene(itemPos);
// We have to use "pointed" line for marker tool
scene()->drawLineTo(itemPos, width,
UBDrawingController::drawingController()->stylusTool() != UBStylusTool::Marker);
}
void UBGraphicsAristo::EndLine()
{
/* NOOP */
}
UBGraphicsScene* UBGraphicsAristo::scene() const
{
return static_cast<UBGraphicsScene*>(QGraphicsPathItem::scene());
}

@ -0,0 +1,156 @@
/*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef UBGRAPHICSARISTO_H_
#define UBGRAPHICSARISTO_H_
#include "core/UB.h"
#include "domain/UBItem.h"
#include "domain/UBGraphicsScene.h"
#include "tools/UBAbstractDrawRuler.h"
#include <QtGlobal>
#include <QBrush>
#include <QCursor>
#include <QGraphicsPathItem>
#include <QGraphicsSceneHoverEvent>
#include <QGraphicsSceneMouseEvent>
#include <QGraphicsSvgItem>
#include <QObject>
#include <QPainter>
#include <QPainterPath>
#include <QPointF>
#include <QRectF>
#include <QStyleOptionGraphicsItem>
#include <QTransform>
#include <QWidget>
class UBGraphicsAristo : public UBAbstractDrawRuler, public QGraphicsPathItem, public UBItem
{
Q_OBJECT
public:
UBGraphicsAristo();
virtual ~UBGraphicsAristo();
enum {
Type = UBGraphicsItemType::AristoItemType
};
enum Tool {
None,
Move,
Resize,
Rotate,
Close,
MoveMarker,
HorizontalFlip
};
enum Orientation
{
Bottom = 0,
Top,
Undefined
};
void setOrientation(Orientation orientation);
void setBoundingRect(QRectF boundingRect);
virtual UBItem* deepCopy() const;
virtual void copyItemParameters(UBItem *copy) const;
virtual void StartLine(const QPointF& scenePos, qreal width);
virtual void DrawLine(const QPointF& position, qreal width);
virtual void EndLine();
virtual int type() const
{
return Type;
}
UBGraphicsScene* scene() const;
protected:
virtual void paint (QPainter *painter, const QStyleOptionGraphicsItem *styleOption, QWidget *widget);
virtual void rotateAroundCenter(qreal angle);
virtual void resize(qreal factor);
virtual QPointF rotationCenter() const;
virtual QRectF closeButtonRect() const;
QRectF hFlipRect() const;
QRectF markerButtonRect() const;
QRectF resizeButtonRect () const;
QRectF rotateRect() const;
QCursor flipCursor() const;
QCursor markerCursor() const;
QCursor resizeCursor() const;
virtual void mousePressEvent(QGraphicsSceneMouseEvent *event);
virtual void mouseMoveEvent(QGraphicsSceneMouseEvent *event);
virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent *event);
virtual void hoverEnterEvent(QGraphicsSceneHoverEvent *event);
virtual void hoverLeaveEvent(QGraphicsSceneHoverEvent *event);
virtual void hoverMoveEvent(QGraphicsSceneHoverEvent *event);
private:
Tool toolFromPos(QPointF pos);
QTransform calculateRotationTransform();
void rotateAroundCenter(QTransform& transform, QPointF center);
void calculatePoints();
QPainterPath determinePath();
void setItemsPos();
void makeGeometryChange();
QBrush fillBrush() const;
void paintGraduations(QPainter *painter);
void paintMarker(QPainter *painter);
void paintProtractorGraduations(QPainter* painter);
void paintRulerGraduations(QPainter *painter);
inline qreal radius () const
{
return sqrt(((B.x() - A.x())*(B.x() - A.x()))+((B.y() - A.y())*(B.y() - A.y()))) * 9 / 16 - 20;
}
bool mMarking;
bool mResizing;
bool mRotating;
Orientation mOrientation;
qreal mRotatedAngle;
qreal mMarkerAngle;
qreal mStartAngle;
qreal mSpan;
QGraphicsSvgItem* mHFlipSvgItem;
QGraphicsSvgItem* mMarkerSvgItem;
QGraphicsSvgItem* mResizeSvgItem;
QGraphicsSvgItem* mRotateSvgItem;
QPointF A, B, C;
static const int sArcAngleMargin = 5;
static const Orientation sDefaultOrientation;
static const QRectF sDefaultRect;
};
#endif /* UBGRAPHICSARISTO_H_ */

@ -24,11 +24,21 @@
#include "core/memcheck.h" #include "core/memcheck.h"
UBGraphicsCache::UBGraphicsCache():QGraphicsRectItem() QMap<UBGraphicsScene*, UBGraphicsCache*> UBGraphicsCache::sInstances;
UBGraphicsCache* UBGraphicsCache::instance(UBGraphicsScene *scene)
{
if (!sInstances.contains(scene))
sInstances.insert(scene, new UBGraphicsCache(scene));
return sInstances[scene];
}
UBGraphicsCache::UBGraphicsCache(UBGraphicsScene *scene) : QGraphicsRectItem()
, mMaskColor(Qt::black) , mMaskColor(Qt::black)
, mMaskShape(eMaskShape_Circle) , mMaskShape(eMaskShape_Circle)
, mShapeWidth(100) , mShapeWidth(100)
, mDrawMask(false) , mDrawMask(false)
, mScene(scene)
{ {
// Get the board size and pass it to the shape // Get the board size and pass it to the shape
QRect boardRect = UBApplication::boardController->displayView()->rect(); QRect boardRect = UBApplication::boardController->displayView()->rect();
@ -39,11 +49,12 @@ UBGraphicsCache::UBGraphicsCache():QGraphicsRectItem()
UBGraphicsCache::~UBGraphicsCache() UBGraphicsCache::~UBGraphicsCache()
{ {
sInstances.remove(mScene);
} }
UBItem* UBGraphicsCache::deepCopy() const UBItem* UBGraphicsCache::deepCopy() const
{ {
UBGraphicsCache* copy = new UBGraphicsCache(); UBGraphicsCache* copy = new UBGraphicsCache(mScene);
copyItemParameters(copy); copyItemParameters(copy);

@ -30,7 +30,7 @@ typedef enum
class UBGraphicsCache : public QGraphicsRectItem, public UBItem class UBGraphicsCache : public QGraphicsRectItem, public UBItem
{ {
public: public:
UBGraphicsCache(); static UBGraphicsCache* instance(UBGraphicsScene *scene);
~UBGraphicsCache(); ~UBGraphicsCache();
enum { Type = UBGraphicsItemType::cacheItemType }; enum { Type = UBGraphicsItemType::cacheItemType };
@ -55,8 +55,7 @@ protected:
void mouseReleaseEvent(QGraphicsSceneMouseEvent *event); void mouseReleaseEvent(QGraphicsSceneMouseEvent *event);
private: private:
void init(); static QMap<UBGraphicsScene*, UBGraphicsCache*> sInstances;
QRectF updateRect(QPointF currentPoint);
QColor mMaskColor; QColor mMaskColor;
eMaskShape mMaskShape; eMaskShape mMaskShape;
@ -65,6 +64,13 @@ private:
QPointF mShapePos; QPointF mShapePos;
int mOldShapeWidth; int mOldShapeWidth;
QPointF mOldShapePos; QPointF mOldShapePos;
UBGraphicsScene* mScene;
UBGraphicsCache(UBGraphicsScene *scene);
void init();
QRectF updateRect(QPointF currentPoint);
}; };
#endif // UBGRAPHICSCACHE_H #endif // UBGRAPHICSCACHE_H

@ -91,6 +91,12 @@ UBToolsManager::UBToolsManager(QObject *parent)
mDescriptors << cache; mDescriptors << cache;
// -------------------------------------------------------------------------------- // --------------------------------------------------------------------------------
aristo.id = "uniboardTool://uniboard.mnemis.com/aristo";
aristo.icon = QPixmap(":/images/toolPalette/aristoTool.png");
aristo.label = tr("Aristo");
aristo.version = "1.0";
mToolsIcon.insert(aristo.id, ":/images/toolPalette/aristoTool.png");
mDescriptors << aristo;
} }
UBToolsManager::~UBToolsManager() UBToolsManager::~UBToolsManager()

@ -76,6 +76,7 @@ class UBToolsManager : public QObject
UBToolDescriptor triangle; UBToolDescriptor triangle;
UBToolDescriptor magnifier; UBToolDescriptor magnifier;
UBToolDescriptor cache; UBToolDescriptor cache;
UBToolDescriptor aristo;
QString iconFromToolId(QString id) { return mToolsIcon.value(id);} QString iconFromToolId(QString id) { return mToolsIcon.value(id);}

@ -1,8 +1,8 @@
HEADERS += src/tools/UBGraphicsRuler.h \ HEADERS += src/tools/UBGraphicsRuler.h \
src/tools/UBGraphicsTriangle.h \ src/tools/UBGraphicsTriangle.h \
src/tools/UBGraphicsProtractor.h \ src/tools/UBGraphicsProtractor.h \
src/tools/UBGraphicsCompass.h \ src/tools/UBGraphicsCompass.h \
src/tools/UBGraphicsAristo.h \
src/tools/UBToolsManager.h \ src/tools/UBToolsManager.h \
src/tools/UBGraphicsCurtainItem.h \ src/tools/UBGraphicsCurtainItem.h \
src/tools/UBGraphicsCurtainItemDelegate.h \ src/tools/UBGraphicsCurtainItemDelegate.h \
@ -13,6 +13,7 @@ SOURCES += src/tools/UBGraphicsRuler.cpp \
src/tools/UBGraphicsTriangle.cpp \ src/tools/UBGraphicsTriangle.cpp \
src/tools/UBGraphicsProtractor.cpp \ src/tools/UBGraphicsProtractor.cpp \
src/tools/UBGraphicsCompass.cpp \ src/tools/UBGraphicsCompass.cpp \
src/tools/UBGraphicsAristo.cpp \
src/tools/UBToolsManager.cpp \ src/tools/UBToolsManager.cpp \
src/tools/UBGraphicsCurtainItem.cpp \ src/tools/UBGraphicsCurtainItem.cpp \
src/tools/UBGraphicsCurtainItemDelegate.cpp \ src/tools/UBGraphicsCurtainItemDelegate.cpp \

@ -200,7 +200,7 @@ void UBTrapFlashController::createWidget()
// flash widget // flash widget
UBWebKitUtils::HtmlObject selectedObject = mAvailableFlashes.at(selectedIndex - 1); UBWebKitUtils::HtmlObject selectedObject = mAvailableFlashes.at(selectedIndex - 1);
UBApplication::applicationController->showBoard(); UBApplication::applicationController->showBoard();
UBApplication::boardController->downloadURL(QUrl(selectedObject.source), QPoint(0, 0), QSize(selectedObject.width, selectedObject.height)); UBApplication::boardController->downloadURL(QUrl(selectedObject.source), QString(), QPoint(0, 0), QSize(selectedObject.width, selectedObject.height));
} }
QString freezedWidgetPath = UBPlatformUtils::applicationResourcesDirectory() + "/etc/freezedWidgetWrapper.html"; QString freezedWidgetPath = UBPlatformUtils::applicationResourcesDirectory() + "/etc/freezedWidgetWrapper.html";

@ -281,7 +281,7 @@ void WBWebTrapWebView::trapElementAtPos(const QPoint& pos)
emit objectCaptured(QUrl(page()->currentFrame()->url().toString() + "/" + source), type, emit objectCaptured(QUrl(page()->currentFrame()->url().toString() + "/" + source), type,
htr.boundingRect().width(), htr.boundingRect().height()); htr.boundingRect().width(), htr.boundingRect().height());
UBApplication::boardController->downloadURL(QUrl(source), QPointF(0.0, 0.0)); UBApplication::boardController->downloadURL(QUrl(source));
UBApplication::applicationController->showBoard(); UBApplication::applicationController->showBoard();
} }
} }

Loading…
Cancel
Save