diff --git a/Sankore_3.1.pro b/Sankore_3.1.pro index a295e6fc..3005b8b1 100644 --- a/Sankore_3.1.pro +++ b/Sankore_3.1.pro @@ -4,12 +4,16 @@ TEMPLATE = app THIRD_PARTY_PATH=../Sankore-ThirdParty CONFIG += debug_and_release \ - no_include_pwd + no_include_pwd + +linux-g++-64 { + CONFIG += link_prl +} VERSION_MAJ = 1 VERSION_MIN = 40 VERSION_TYPE = b # a = alpha, b = beta, r = release, other => error -VERSION_PATCH = 00 +VERSION_PATCH = 01 VERSION = "$${VERSION_MAJ}.$${VERSION_MIN}.$${VERSION_TYPE}.$${VERSION_PATCH}" VERSION = $$replace(VERSION, "\\.r", "") diff --git a/resources/i18n/sankore_ar.ts b/resources/i18n/sankore_ar.ts index 2cb1f7b1..74fe4073 100644 --- a/resources/i18n/sankore_ar.ts +++ b/resources/i18n/sankore_ar.ts @@ -1848,11 +1848,11 @@ Do you want to ignore these errors for this host? - Enseignant + Teacher - Élève + Student diff --git a/resources/i18n/sankore_da.ts b/resources/i18n/sankore_da.ts index 0cddc24e..4d380b25 100644 --- a/resources/i18n/sankore_da.ts +++ b/resources/i18n/sankore_da.ts @@ -1854,11 +1854,11 @@ Do you want to ignore these errors for this host? - Enseignant + Teacher - Élève + Student diff --git a/resources/i18n/sankore_de.ts b/resources/i18n/sankore_de.ts index cebd0c7e..96e093e7 100644 --- a/resources/i18n/sankore_de.ts +++ b/resources/i18n/sankore_de.ts @@ -1854,11 +1854,11 @@ Möchten Sie diese Fehler auf diesem Computer ignorieren? - Enseignant + Teacher - Élève + Student diff --git a/resources/i18n/sankore_en.ts b/resources/i18n/sankore_en.ts index 2b349206..19d36ecd 100644 --- a/resources/i18n/sankore_en.ts +++ b/resources/i18n/sankore_en.ts @@ -1848,11 +1848,11 @@ Do you want to ignore these errors for this host? - Enseignant + Teacher - Élève + Student diff --git a/resources/i18n/sankore_en_UK.ts b/resources/i18n/sankore_en_UK.ts index d9739ce0..c4eb8cbb 100644 --- a/resources/i18n/sankore_en_UK.ts +++ b/resources/i18n/sankore_en_UK.ts @@ -1848,11 +1848,11 @@ Do you want to ignore these errors for this host? - Enseignant + Teacher - Élève + Student diff --git a/resources/i18n/sankore_es.ts b/resources/i18n/sankore_es.ts index 0804a481..3ddd9826 100644 --- a/resources/i18n/sankore_es.ts +++ b/resources/i18n/sankore_es.ts @@ -1854,11 +1854,11 @@ Do you want to ignore these errors for this host? - Enseignant + Teacher - Élève + Student diff --git a/resources/i18n/sankore_fr.ts b/resources/i18n/sankore_fr.ts index 816e81b8..4d57becf 100644 --- a/resources/i18n/sankore_fr.ts +++ b/resources/i18n/sankore_fr.ts @@ -1856,11 +1856,11 @@ Voulez-vous ignorer les erreurs pour ce serveur? Action %0 - Enseignant + Teacher - Élève + Student @@ -1967,7 +1967,7 @@ Veuillez redémarrer l'application pour accéder aux documents mis à jour. Remind me later - + diff --git a/resources/i18n/sankore_fr_CH.ts b/resources/i18n/sankore_fr_CH.ts index 816e81b8..4d57becf 100644 --- a/resources/i18n/sankore_fr_CH.ts +++ b/resources/i18n/sankore_fr_CH.ts @@ -1856,11 +1856,11 @@ Voulez-vous ignorer les erreurs pour ce serveur? Action %0 - Enseignant + Teacher - Élève + Student @@ -1967,7 +1967,7 @@ Veuillez redémarrer l'application pour accéder aux documents mis à jour. Remind me later - + diff --git a/resources/i18n/sankore_it.ts b/resources/i18n/sankore_it.ts index 825bcc24..73e9cee4 100644 --- a/resources/i18n/sankore_it.ts +++ b/resources/i18n/sankore_it.ts @@ -1854,11 +1854,11 @@ Vuoi ignorare gli errori per questo host? - Enseignant + Teacher - Élève + Student diff --git a/resources/i18n/sankore_iw.ts b/resources/i18n/sankore_iw.ts index 9ce57b52..823f7fb8 100644 --- a/resources/i18n/sankore_iw.ts +++ b/resources/i18n/sankore_iw.ts @@ -1848,11 +1848,11 @@ Do you want to ignore these errors for this host? - Enseignant + Teacher - Élève + Student diff --git a/resources/i18n/sankore_ja.ts b/resources/i18n/sankore_ja.ts index 1a5038bc..ec77e051 100644 --- a/resources/i18n/sankore_ja.ts +++ b/resources/i18n/sankore_ja.ts @@ -1855,11 +1855,11 @@ Do you want to ignore these errors for this host? - Enseignant + Teacher - Élève + Student diff --git a/resources/i18n/sankore_ko.ts b/resources/i18n/sankore_ko.ts index a264e9d9..cce0a0de 100644 --- a/resources/i18n/sankore_ko.ts +++ b/resources/i18n/sankore_ko.ts @@ -1854,11 +1854,11 @@ Do you want to ignore these errors for this host? - Enseignant + Teacher - Élève + Student diff --git a/resources/i18n/sankore_nb.ts b/resources/i18n/sankore_nb.ts index 031ffb1b..ad7040d3 100644 --- a/resources/i18n/sankore_nb.ts +++ b/resources/i18n/sankore_nb.ts @@ -1849,11 +1849,11 @@ Do you want to ignore these errors for this host? - Enseignant + Teacher - Élève + Student diff --git a/resources/i18n/sankore_nl.ts b/resources/i18n/sankore_nl.ts index 6949a52c..af0cf6ce 100644 --- a/resources/i18n/sankore_nl.ts +++ b/resources/i18n/sankore_nl.ts @@ -1848,11 +1848,11 @@ Do you want to ignore these errors for this host? - Enseignant + Teacher - Élève + Student diff --git a/resources/i18n/sankore_pl.ts b/resources/i18n/sankore_pl.ts index 70663776..9f20715c 100644 --- a/resources/i18n/sankore_pl.ts +++ b/resources/i18n/sankore_pl.ts @@ -1855,11 +1855,11 @@ Czy chcesz ignorować te błędy dla tego hosta? - Enseignant + Teacher - Élève + Student diff --git a/resources/i18n/sankore_pt.ts b/resources/i18n/sankore_pt.ts index 6ea05ac5..cc80aa9e 100644 --- a/resources/i18n/sankore_pt.ts +++ b/resources/i18n/sankore_pt.ts @@ -1848,11 +1848,11 @@ Do you want to ignore these errors for this host? - Enseignant + Teacher - Élève + Student diff --git a/resources/i18n/sankore_rm.ts b/resources/i18n/sankore_rm.ts index b705e05a..b0345c77 100644 --- a/resources/i18n/sankore_rm.ts +++ b/resources/i18n/sankore_rm.ts @@ -1848,11 +1848,11 @@ Do you want to ignore these errors for this host? - Enseignant + Teacher - Élève + Student diff --git a/resources/i18n/sankore_ro.ts b/resources/i18n/sankore_ro.ts index a2aa70e0..013ffe24 100644 --- a/resources/i18n/sankore_ro.ts +++ b/resources/i18n/sankore_ro.ts @@ -1854,11 +1854,11 @@ Doriţi să ignoraţi aceste erori pentru acest host? - Enseignant + Teacher - Élève + Student diff --git a/resources/i18n/sankore_ru.ts b/resources/i18n/sankore_ru.ts index e42f1e8c..f1855b28 100644 --- a/resources/i18n/sankore_ru.ts +++ b/resources/i18n/sankore_ru.ts @@ -1,6 +1,6 @@ - + BlackoutWidget @@ -81,11 +81,11 @@ Tutorial - Учебное руководство + Учебник Stylus - Инструменты для ввода + Инструменты Ctrl+T @@ -109,7 +109,7 @@ Redo - Восстановить + Вернуть Ctrl+Y @@ -281,7 +281,7 @@ Show Desktop - Показать рабочий стол + Рабочий стол Show Computer Desktop @@ -757,7 +757,7 @@ Open the tutorial - Открыть учебное руководство + Открыть учебник Check Update @@ -976,7 +976,7 @@ Show the stylus palette - Показать панель элементов для ввода + Показать инструменты Show Board on Secondary Screen @@ -984,7 +984,7 @@ Show Desktop on Secondary Screen - Показать рабочий стол на втором экране + Показать раб. стол на втором экране @@ -1111,7 +1111,8 @@ Are you sure you want to remove %n page(s) from the selected document '%1'? - + + Вы уверены, что хотите удалить %n страниц из выбранного документа '%1'? @@ -1193,7 +1194,7 @@ UBDocumentTreeWidget %1 (copy) - %1 (копия) + %1 (копирование) Copying page %1/%2 @@ -1203,6 +1204,7 @@ %1 pages copied + @@ -1665,7 +1667,7 @@ Do you want to ignore these errors for this host? on your desktop ... - на вашем рабочем столе... + на вашем раб. столе... in folder %1 @@ -1780,23 +1782,23 @@ Do you want to ignore these errors for this host? UBTeacherBarWidget Title - Название + Название Phasis - + Тип урока Duration - + Длительность Equipment - + Оборудование Activity - + Участники @@ -1804,62 +1806,70 @@ Do you want to ignore these errors for this host? I discover - + Открытие I experiment - + Эксперименты I train myself - + Самостоятельно I play - + Игра I memorize - + Заметка Short - + Не долго Middle - + Средне Long - + Долго Alone - + Один By Group - + Группы All together - + Все вместе UBTeacherStudentAction Action %0 - + Действие %0 Enseignant - + Teacher Élève - + Student + + + Teacher + Учитель + + + Student + Студент @@ -1965,7 +1975,7 @@ Please reboot the application to access the updated documents. Remind me later - + Напомнить позже @@ -2506,7 +2516,7 @@ p, li { white-space: pre-wrap; } Stylus Palette - Панель инструментов для ввода + Инструменты Horizontal diff --git a/resources/i18n/sankore_sv.ts b/resources/i18n/sankore_sv.ts index adfa1a82..71b2bcbf 100644 --- a/resources/i18n/sankore_sv.ts +++ b/resources/i18n/sankore_sv.ts @@ -1854,11 +1854,11 @@ Vill du ignorera felen för den här värden? - Enseignant + Teacher - Élève + Student diff --git a/resources/i18n/sankore_zh.ts b/resources/i18n/sankore_zh.ts index 83979695..0d513289 100644 --- a/resources/i18n/sankore_zh.ts +++ b/resources/i18n/sankore_zh.ts @@ -1854,11 +1854,11 @@ Do you want to ignore these errors for this host? - Enseignant + Teacher - Élève + Student diff --git a/resources/images/tab_mask.png b/resources/images/tab_mask.png new file mode 100644 index 00000000..035608fa Binary files /dev/null and b/resources/images/tab_mask.png differ diff --git a/resources/library/interactive/BlackYellow.wgt/config.xml b/resources/library/sankoreInteractivities/BlackYellow.wgt/config.xml similarity index 100% rename from resources/library/interactive/BlackYellow.wgt/config.xml rename to resources/library/sankoreInteractivities/BlackYellow.wgt/config.xml diff --git a/resources/library/interactive/BlackYellow.wgt/css/basic.css b/resources/library/sankoreInteractivities/BlackYellow.wgt/css/basic.css similarity index 100% rename from resources/library/interactive/BlackYellow.wgt/css/basic.css rename to resources/library/sankoreInteractivities/BlackYellow.wgt/css/basic.css diff --git a/resources/library/interactive/BlackYellow.wgt/icon.png b/resources/library/sankoreInteractivities/BlackYellow.wgt/icon.png similarity index 100% rename from resources/library/interactive/BlackYellow.wgt/icon.png rename to resources/library/sankoreInteractivities/BlackYellow.wgt/icon.png diff --git a/resources/library/interactive/BlackYellow.wgt/images/greySquare.png b/resources/library/sankoreInteractivities/BlackYellow.wgt/images/greySquare.png similarity index 100% rename from resources/library/interactive/BlackYellow.wgt/images/greySquare.png rename to resources/library/sankoreInteractivities/BlackYellow.wgt/images/greySquare.png diff --git a/resources/library/interactive/BlackYellow.wgt/images/greySquare2.png b/resources/library/sankoreInteractivities/BlackYellow.wgt/images/greySquare2.png similarity index 100% rename from resources/library/interactive/BlackYellow.wgt/images/greySquare2.png rename to resources/library/sankoreInteractivities/BlackYellow.wgt/images/greySquare2.png diff --git a/resources/library/interactive/BlackYellow.wgt/images/icon-close.png b/resources/library/sankoreInteractivities/BlackYellow.wgt/images/icon-close.png similarity index 100% rename from resources/library/interactive/BlackYellow.wgt/images/icon-close.png rename to resources/library/sankoreInteractivities/BlackYellow.wgt/images/icon-close.png diff --git a/resources/library/interactive/BlackYellow.wgt/images/popupBack.png b/resources/library/sankoreInteractivities/BlackYellow.wgt/images/popupBack.png similarity index 100% rename from resources/library/interactive/BlackYellow.wgt/images/popupBack.png rename to resources/library/sankoreInteractivities/BlackYellow.wgt/images/popupBack.png diff --git a/resources/library/interactive/BlackYellow.wgt/index.html b/resources/library/sankoreInteractivities/BlackYellow.wgt/index.html similarity index 100% rename from resources/library/interactive/BlackYellow.wgt/index.html rename to resources/library/sankoreInteractivities/BlackYellow.wgt/index.html diff --git a/resources/library/interactive/BlackYellow.wgt/scripts/blackYellow.js b/resources/library/sankoreInteractivities/BlackYellow.wgt/scripts/blackYellow.js similarity index 100% rename from resources/library/interactive/BlackYellow.wgt/scripts/blackYellow.js rename to resources/library/sankoreInteractivities/BlackYellow.wgt/scripts/blackYellow.js diff --git a/resources/library/interactive/BlackYellow.wgt/scripts/jquery-1.6.2.min.js b/resources/library/sankoreInteractivities/BlackYellow.wgt/scripts/jquery-1.6.2.min.js similarity index 100% rename from resources/library/interactive/BlackYellow.wgt/scripts/jquery-1.6.2.min.js rename to resources/library/sankoreInteractivities/BlackYellow.wgt/scripts/jquery-1.6.2.min.js diff --git a/resources/library/interactive/BlackYellow.wgt/scripts/jquery.disable.text.select.js b/resources/library/sankoreInteractivities/BlackYellow.wgt/scripts/jquery.disable.text.select.js similarity index 100% rename from resources/library/interactive/BlackYellow.wgt/scripts/jquery.disable.text.select.js rename to resources/library/sankoreInteractivities/BlackYellow.wgt/scripts/jquery.disable.text.select.js diff --git a/resources/library/interactive/BlackYellow.wgt/scripts/languages.js b/resources/library/sankoreInteractivities/BlackYellow.wgt/scripts/languages.js similarity index 100% rename from resources/library/interactive/BlackYellow.wgt/scripts/languages.js rename to resources/library/sankoreInteractivities/BlackYellow.wgt/scripts/languages.js diff --git a/resources/library/interactive/Choisir.wgt/config.xml b/resources/library/sankoreInteractivities/Choisir.wgt/config.xml similarity index 100% rename from resources/library/interactive/Choisir.wgt/config.xml rename to resources/library/sankoreInteractivities/Choisir.wgt/config.xml diff --git a/resources/library/interactive/Choisir.wgt/css/basic.css b/resources/library/sankoreInteractivities/Choisir.wgt/css/basic.css similarity index 100% rename from resources/library/interactive/Choisir.wgt/css/basic.css rename to resources/library/sankoreInteractivities/Choisir.wgt/css/basic.css diff --git a/resources/library/interactive/Choisir.wgt/icon.png b/resources/library/sankoreInteractivities/Choisir.wgt/icon.png similarity index 100% rename from resources/library/interactive/Choisir.wgt/icon.png rename to resources/library/sankoreInteractivities/Choisir.wgt/icon.png diff --git a/resources/library/interactive/Choisir.wgt/images/1thOption.png b/resources/library/sankoreInteractivities/Choisir.wgt/images/1thOption.png similarity index 100% rename from resources/library/interactive/Choisir.wgt/images/1thOption.png rename to resources/library/sankoreInteractivities/Choisir.wgt/images/1thOption.png diff --git a/resources/library/interactive/Choisir.wgt/images/2thOption.png b/resources/library/sankoreInteractivities/Choisir.wgt/images/2thOption.png similarity index 100% rename from resources/library/interactive/Choisir.wgt/images/2thOption.png rename to resources/library/sankoreInteractivities/Choisir.wgt/images/2thOption.png diff --git a/resources/library/interactive/Choisir.wgt/images/3thOption.png b/resources/library/sankoreInteractivities/Choisir.wgt/images/3thOption.png similarity index 100% rename from resources/library/interactive/Choisir.wgt/images/3thOption.png rename to resources/library/sankoreInteractivities/Choisir.wgt/images/3thOption.png diff --git a/resources/library/interactive/Choisir.wgt/images/addSomething.png b/resources/library/sankoreInteractivities/Choisir.wgt/images/addSomething.png similarity index 100% rename from resources/library/interactive/Choisir.wgt/images/addSomething.png rename to resources/library/sankoreInteractivities/Choisir.wgt/images/addSomething.png diff --git a/resources/library/interactive/Choisir.wgt/images/bigBlackClose.png b/resources/library/sankoreInteractivities/Choisir.wgt/images/bigBlackClose.png similarity index 100% rename from resources/library/interactive/Choisir.wgt/images/bigBlackClose.png rename to resources/library/sankoreInteractivities/Choisir.wgt/images/bigBlackClose.png diff --git a/resources/library/interactive/Choisir.wgt/images/blueClose.png b/resources/library/sankoreInteractivities/Choisir.wgt/images/blueClose.png similarity index 100% rename from resources/library/interactive/Choisir.wgt/images/blueClose.png rename to resources/library/sankoreInteractivities/Choisir.wgt/images/blueClose.png diff --git a/resources/library/interactive/Choisir.wgt/images/boldBlackClose.png b/resources/library/sankoreInteractivities/Choisir.wgt/images/boldBlackClose.png similarity index 100% rename from resources/library/interactive/Choisir.wgt/images/boldBlackClose.png rename to resources/library/sankoreInteractivities/Choisir.wgt/images/boldBlackClose.png diff --git a/resources/library/interactive/Choisir.wgt/images/boldClose.png b/resources/library/sankoreInteractivities/Choisir.wgt/images/boldClose.png similarity index 100% rename from resources/library/interactive/Choisir.wgt/images/boldClose.png rename to resources/library/sankoreInteractivities/Choisir.wgt/images/boldClose.png diff --git a/resources/library/interactive/Choisir.wgt/images/boldGreyClose.png b/resources/library/sankoreInteractivities/Choisir.wgt/images/boldGreyClose.png similarity index 100% rename from resources/library/interactive/Choisir.wgt/images/boldGreyClose.png rename to resources/library/sankoreInteractivities/Choisir.wgt/images/boldGreyClose.png diff --git a/resources/library/interactive/Choisir.wgt/images/bottomLeftThing.png b/resources/library/sankoreInteractivities/Choisir.wgt/images/bottomLeftThing.png similarity index 100% rename from resources/library/interactive/Choisir.wgt/images/bottomLeftThing.png rename to resources/library/sankoreInteractivities/Choisir.wgt/images/bottomLeftThing.png diff --git a/resources/library/interactive/Choisir.wgt/images/complete.png b/resources/library/sankoreInteractivities/Choisir.wgt/images/complete.png similarity index 100% rename from resources/library/interactive/Choisir.wgt/images/complete.png rename to resources/library/sankoreInteractivities/Choisir.wgt/images/complete.png diff --git a/resources/library/interactive/Choisir.wgt/images/grayClose.png b/resources/library/sankoreInteractivities/Choisir.wgt/images/grayClose.png similarity index 100% rename from resources/library/interactive/Choisir.wgt/images/grayClose.png rename to resources/library/sankoreInteractivities/Choisir.wgt/images/grayClose.png diff --git a/resources/library/interactive/Choisir.wgt/images/greySquare.png b/resources/library/sankoreInteractivities/Choisir.wgt/images/greySquare.png similarity index 100% rename from resources/library/interactive/Choisir.wgt/images/greySquare.png rename to resources/library/sankoreInteractivities/Choisir.wgt/images/greySquare.png diff --git a/resources/library/interactive/Choisir.wgt/images/greySquareArrow.png b/resources/library/sankoreInteractivities/Choisir.wgt/images/greySquareArrow.png similarity index 100% rename from resources/library/interactive/Choisir.wgt/images/greySquareArrow.png rename to resources/library/sankoreInteractivities/Choisir.wgt/images/greySquareArrow.png diff --git a/resources/library/interactive/Choisir.wgt/images/horSep.png b/resources/library/sankoreInteractivities/Choisir.wgt/images/horSep.png similarity index 100% rename from resources/library/interactive/Choisir.wgt/images/horSep.png rename to resources/library/sankoreInteractivities/Choisir.wgt/images/horSep.png diff --git a/resources/library/interactive/Choisir.wgt/images/leftThing.png b/resources/library/sankoreInteractivities/Choisir.wgt/images/leftThing.png similarity index 100% rename from resources/library/interactive/Choisir.wgt/images/leftThing.png rename to resources/library/sankoreInteractivities/Choisir.wgt/images/leftThing.png diff --git a/resources/library/interactive/Choisir.wgt/images/lessBottomBorder.png b/resources/library/sankoreInteractivities/Choisir.wgt/images/lessBottomBorder.png similarity index 100% rename from resources/library/interactive/Choisir.wgt/images/lessBottomBorder.png rename to resources/library/sankoreInteractivities/Choisir.wgt/images/lessBottomBorder.png diff --git a/resources/library/interactive/Choisir.wgt/images/lessTopBorder.png b/resources/library/sankoreInteractivities/Choisir.wgt/images/lessTopBorder.png similarity index 100% rename from resources/library/interactive/Choisir.wgt/images/lessTopBorder.png rename to resources/library/sankoreInteractivities/Choisir.wgt/images/lessTopBorder.png diff --git a/resources/library/interactive/Choisir.wgt/images/lowerBack.png b/resources/library/sankoreInteractivities/Choisir.wgt/images/lowerBack.png similarity index 100% rename from resources/library/interactive/Choisir.wgt/images/lowerBack.png rename to resources/library/sankoreInteractivities/Choisir.wgt/images/lowerBack.png diff --git a/resources/library/interactive/Choisir.wgt/images/lowerBorder.png b/resources/library/sankoreInteractivities/Choisir.wgt/images/lowerBorder.png similarity index 100% rename from resources/library/interactive/Choisir.wgt/images/lowerBorder.png rename to resources/library/sankoreInteractivities/Choisir.wgt/images/lowerBorder.png diff --git a/resources/library/interactive/Choisir.wgt/images/lowerBorder2.png b/resources/library/sankoreInteractivities/Choisir.wgt/images/lowerBorder2.png similarity index 100% rename from resources/library/interactive/Choisir.wgt/images/lowerBorder2.png rename to resources/library/sankoreInteractivities/Choisir.wgt/images/lowerBorder2.png diff --git a/resources/library/interactive/Choisir.wgt/images/niceBack.png b/resources/library/sankoreInteractivities/Choisir.wgt/images/niceBack.png similarity index 100% rename from resources/library/interactive/Choisir.wgt/images/niceBack.png rename to resources/library/sankoreInteractivities/Choisir.wgt/images/niceBack.png diff --git a/resources/library/interactive/Choisir.wgt/images/niceBack2.png b/resources/library/sankoreInteractivities/Choisir.wgt/images/niceBack2.png similarity index 100% rename from resources/library/interactive/Choisir.wgt/images/niceBack2.png rename to resources/library/sankoreInteractivities/Choisir.wgt/images/niceBack2.png diff --git a/resources/library/interactive/Choisir.wgt/images/niceBack3.png b/resources/library/sankoreInteractivities/Choisir.wgt/images/niceBack3.png similarity index 100% rename from resources/library/interactive/Choisir.wgt/images/niceBack3.png rename to resources/library/sankoreInteractivities/Choisir.wgt/images/niceBack3.png diff --git a/resources/library/interactive/Choisir.wgt/images/pencil.png b/resources/library/sankoreInteractivities/Choisir.wgt/images/pencil.png similarity index 100% rename from resources/library/interactive/Choisir.wgt/images/pencil.png rename to resources/library/sankoreInteractivities/Choisir.wgt/images/pencil.png diff --git a/resources/library/interactive/Choisir.wgt/images/point.png b/resources/library/sankoreInteractivities/Choisir.wgt/images/point.png similarity index 100% rename from resources/library/interactive/Choisir.wgt/images/point.png rename to resources/library/sankoreInteractivities/Choisir.wgt/images/point.png diff --git a/resources/library/interactive/Choisir.wgt/images/redBoldClose.png b/resources/library/sankoreInteractivities/Choisir.wgt/images/redBoldClose.png similarity index 100% rename from resources/library/interactive/Choisir.wgt/images/redBoldClose.png rename to resources/library/sankoreInteractivities/Choisir.wgt/images/redBoldClose.png diff --git a/resources/library/interactive/Choisir.wgt/images/reload.jpg b/resources/library/sankoreInteractivities/Choisir.wgt/images/reload.jpg similarity index 100% rename from resources/library/interactive/Choisir.wgt/images/reload.jpg rename to resources/library/sankoreInteractivities/Choisir.wgt/images/reload.jpg diff --git a/resources/library/interactive/Choisir.wgt/images/reload2.png b/resources/library/sankoreInteractivities/Choisir.wgt/images/reload2.png similarity index 100% rename from resources/library/interactive/Choisir.wgt/images/reload2.png rename to resources/library/sankoreInteractivities/Choisir.wgt/images/reload2.png diff --git a/resources/library/interactive/Choisir.wgt/images/rightThing.png b/resources/library/sankoreInteractivities/Choisir.wgt/images/rightThing.png similarity index 100% rename from resources/library/interactive/Choisir.wgt/images/rightThing.png rename to resources/library/sankoreInteractivities/Choisir.wgt/images/rightThing.png diff --git a/resources/library/interactive/Choisir.wgt/images/separator.png b/resources/library/sankoreInteractivities/Choisir.wgt/images/separator.png similarity index 100% rename from resources/library/interactive/Choisir.wgt/images/separator.png rename to resources/library/sankoreInteractivities/Choisir.wgt/images/separator.png diff --git a/resources/library/interactive/Choisir.wgt/images/separator2.png b/resources/library/sankoreInteractivities/Choisir.wgt/images/separator2.png similarity index 100% rename from resources/library/interactive/Choisir.wgt/images/separator2.png rename to resources/library/sankoreInteractivities/Choisir.wgt/images/separator2.png diff --git a/resources/library/interactive/Choisir.wgt/images/settings.png b/resources/library/sankoreInteractivities/Choisir.wgt/images/settings.png similarity index 100% rename from resources/library/interactive/Choisir.wgt/images/settings.png rename to resources/library/sankoreInteractivities/Choisir.wgt/images/settings.png diff --git a/resources/library/interactive/Choisir.wgt/images/sidePoints.png b/resources/library/sankoreInteractivities/Choisir.wgt/images/sidePoints.png similarity index 100% rename from resources/library/interactive/Choisir.wgt/images/sidePoints.png rename to resources/library/sankoreInteractivities/Choisir.wgt/images/sidePoints.png diff --git a/resources/library/interactive/Choisir.wgt/images/spanner.png b/resources/library/sankoreInteractivities/Choisir.wgt/images/spanner.png similarity index 100% rename from resources/library/interactive/Choisir.wgt/images/spanner.png rename to resources/library/sankoreInteractivities/Choisir.wgt/images/spanner.png diff --git a/resources/library/interactive/Choisir.wgt/images/star.png b/resources/library/sankoreInteractivities/Choisir.wgt/images/star.png similarity index 100% rename from resources/library/interactive/Choisir.wgt/images/star.png rename to resources/library/sankoreInteractivities/Choisir.wgt/images/star.png diff --git a/resources/library/interactive/Choisir.wgt/images/stop.jpg b/resources/library/sankoreInteractivities/Choisir.wgt/images/stop.jpg similarity index 100% rename from resources/library/interactive/Choisir.wgt/images/stop.jpg rename to resources/library/sankoreInteractivities/Choisir.wgt/images/stop.jpg diff --git a/resources/library/interactive/Choisir.wgt/images/tool.png b/resources/library/sankoreInteractivities/Choisir.wgt/images/tool.png similarity index 100% rename from resources/library/interactive/Choisir.wgt/images/tool.png rename to resources/library/sankoreInteractivities/Choisir.wgt/images/tool.png diff --git a/resources/library/interactive/Choisir.wgt/images/topLeftThing.png b/resources/library/sankoreInteractivities/Choisir.wgt/images/topLeftThing.png similarity index 100% rename from resources/library/interactive/Choisir.wgt/images/topLeftThing.png rename to resources/library/sankoreInteractivities/Choisir.wgt/images/topLeftThing.png diff --git a/resources/library/interactive/Choisir.wgt/images/transparentBack.png b/resources/library/sankoreInteractivities/Choisir.wgt/images/transparentBack.png similarity index 100% rename from resources/library/interactive/Choisir.wgt/images/transparentBack.png rename to resources/library/sankoreInteractivities/Choisir.wgt/images/transparentBack.png diff --git a/resources/library/interactive/Choisir.wgt/images/upperBorder.png b/resources/library/sankoreInteractivities/Choisir.wgt/images/upperBorder.png similarity index 100% rename from resources/library/interactive/Choisir.wgt/images/upperBorder.png rename to resources/library/sankoreInteractivities/Choisir.wgt/images/upperBorder.png diff --git a/resources/library/interactive/Choisir.wgt/images/upperBorder2.png b/resources/library/sankoreInteractivities/Choisir.wgt/images/upperBorder2.png similarity index 100% rename from resources/library/interactive/Choisir.wgt/images/upperBorder2.png rename to resources/library/sankoreInteractivities/Choisir.wgt/images/upperBorder2.png diff --git a/resources/library/interactive/Choisir.wgt/index.html b/resources/library/sankoreInteractivities/Choisir.wgt/index.html similarity index 100% rename from resources/library/interactive/Choisir.wgt/index.html rename to resources/library/sankoreInteractivities/Choisir.wgt/index.html diff --git a/resources/library/interactive/Choisir.wgt/scripts/jquery-1.6.2.min.js b/resources/library/sankoreInteractivities/Choisir.wgt/scripts/jquery-1.6.2.min.js similarity index 100% rename from resources/library/interactive/Choisir.wgt/scripts/jquery-1.6.2.min.js rename to resources/library/sankoreInteractivities/Choisir.wgt/scripts/jquery-1.6.2.min.js diff --git a/resources/library/interactive/Choisir.wgt/scripts/languages.js b/resources/library/sankoreInteractivities/Choisir.wgt/scripts/languages.js similarity index 100% rename from resources/library/interactive/Choisir.wgt/scripts/languages.js rename to resources/library/sankoreInteractivities/Choisir.wgt/scripts/languages.js diff --git a/resources/library/interactive/Choisir.wgt/scripts/selQuestionApp.js b/resources/library/sankoreInteractivities/Choisir.wgt/scripts/selQuestionApp.js similarity index 100% rename from resources/library/interactive/Choisir.wgt/scripts/selQuestionApp.js rename to resources/library/sankoreInteractivities/Choisir.wgt/scripts/selQuestionApp.js diff --git a/resources/library/sankoreInteractivities/ord-phrases.wgt/template/scripts/template2.js b/resources/library/sankoreInteractivities/ord-phrases.wgt/template/scripts/template2.js index 7e6e14a9..bacfa21d 100644 --- a/resources/library/sankoreInteractivities/ord-phrases.wgt/template/scripts/template2.js +++ b/resources/library/sankoreInteractivities/ord-phrases.wgt/template/scripts/template2.js @@ -208,7 +208,7 @@ function modeEdit() // if no sankore api, insert ok button if( !isSankore ) { - $( "#mp_setup" ).empty().append( '' ); + $( "#mp_setup" ).empty().append( '' ); $( "#mp_setup input:button" ).click( function(){ modeView(); }); diff --git a/resources/library/sankoreInteractivities/ord-words.wgt/template/scripts/template2.js b/resources/library/sankoreInteractivities/ord-words.wgt/template/scripts/template2.js index bb06994c..5c40bb64 100644 --- a/resources/library/sankoreInteractivities/ord-words.wgt/template/scripts/template2.js +++ b/resources/library/sankoreInteractivities/ord-words.wgt/template/scripts/template2.js @@ -236,7 +236,7 @@ function modeEdit() // if no sankore api, insert ok button if( !isSankore ) { - $( "#mp_setup" ).empty().append( '' ); + $( "#mp_setup" ).empty().append( '' ); $( "#mp_setup input:button" ).click( function(){ modeView(); }); @@ -249,9 +249,11 @@ $(window).mouseout(function(){ if(window.sankore){ var str = ""; $( "#mp_word .letter" ).each( function(){ - str += $(this).text(); + str += $(this).text() + "*"; }); - + + str = str.substr(0, str.length - 1); + sankore.setPreference("currentOrdWords", str); sankore.setPreference("rightOrdWords", word); } diff --git a/resources/sankore.qrc b/resources/sankore.qrc index d71aadae..c0ff2a69 100644 --- a/resources/sankore.qrc +++ b/resources/sankore.qrc @@ -337,5 +337,6 @@ images/libpalette/WebSearchCategory.svg images/download_close.png images/download_open.png + images/tab_mask.png diff --git a/src/adaptors/UBCFFSubsetAdaptor.cpp b/src/adaptors/UBCFFSubsetAdaptor.cpp index 223d9b2f..981d4ff2 100644 --- a/src/adaptors/UBCFFSubsetAdaptor.cpp +++ b/src/adaptors/UBCFFSubsetAdaptor.cpp @@ -729,10 +729,8 @@ bool UBCFFSubsetAdaptor::UBCFFSubsetReader::parseSvgFlash(const QDomElement &ele QTransform transform; QString textTransform = element.attribute(aTransform); - bool hastransform = false; if (!textTransform.isNull()) { transform = transformFromString(textTransform); - hastransform = true; } repositionSvgItem(flashItem, width, height, x, y, true, transform); hashSceneItem(element, flashItem); @@ -923,13 +921,12 @@ bool UBCFFSubsetAdaptor::UBCFFSubsetReader::parseIwbElement(QDomElement &element } bool locked = false; - bool isBackground = false; bool isEditableItem = false; bool isEditable = false; //Text items to convert to UBGraphicsTextItem only QString IDRef = element.attribute(aRef); if (!IDRef.isNull()) { - isBackground = element.hasAttribute(aBackground) ? strToBool(element.attribute(aBackground)) : false; + element.hasAttribute(aBackground) ? strToBool(element.attribute(aBackground)) : false; locked = element.hasAttribute(aBackground) ? strToBool(element.attribute(aBackground)) : false; isEditableItem = element.hasAttribute(aEditable); if (isEditableItem) @@ -1002,6 +999,7 @@ void UBCFFSubsetAdaptor::UBCFFSubsetReader::repositionSvgItem(QGraphicsItem *ite bool UBCFFSubsetAdaptor::UBCFFSubsetReader::createNewScene() { mCurrentScene = UBPersistenceManager::persistenceManager()->createDocumentSceneAt(mProxy, mProxy->pageCount()); + mCurrentScene->setURStackEnable(false); mCurrentSceneRect = mCurrentScene->normalizedSceneRect(); mVBTransFactor = qMin(mCurrentSceneRect.width() / mViewPort.width(), mCurrentSceneRect.height() / mViewPort.height()); @@ -1038,7 +1036,6 @@ bool UBCFFSubsetAdaptor::UBCFFSubsetReader::persistScenes() UBThumbnailAdaptor::persistScene(mProxy->persistencePath(), tmpScene, i); delete tmpScene; - mCurrentScene->setModified(false); } diff --git a/src/adaptors/UBExportAdaptor.cpp b/src/adaptors/UBExportAdaptor.cpp index 737a27b5..e2b8b3f6 100644 --- a/src/adaptors/UBExportAdaptor.cpp +++ b/src/adaptors/UBExportAdaptor.cpp @@ -17,7 +17,6 @@ #include "document/UBDocumentProxy.h" -#include "frameworks/UBDesktopServices.h" #include "frameworks/UBFileSystemUtils.h" #include "core/UBSettings.h" diff --git a/src/adaptors/UBMetadataDcSubsetAdaptor.cpp b/src/adaptors/UBMetadataDcSubsetAdaptor.cpp index fb38f59a..a5dded62 100644 --- a/src/adaptors/UBMetadataDcSubsetAdaptor.cpp +++ b/src/adaptors/UBMetadataDcSubsetAdaptor.cpp @@ -90,8 +90,6 @@ void UBMetadataDcSubsetAdaptor::persist(UBDocumentProxy* proxy) xmlWriter.writeStartElement("Description"); xmlWriter.writeAttribute("about", proxy->metaData(UBSettings::documentIdentifer).toString()); - QDate today = QDate::currentDate(); - xmlWriter.writeTextElement(nsDc, "title", proxy->metaData(UBSettings::documentName).toString()); xmlWriter.writeTextElement(nsDc, "type", proxy->metaData(UBSettings::documentGroupName).toString()); xmlWriter.writeTextElement(nsDc, "date", QDate::currentDate().toString("yyyy-MM-dd")); diff --git a/src/adaptors/UBSvgSubsetAdaptor.cpp b/src/adaptors/UBSvgSubsetAdaptor.cpp index cdaea1e2..6533e06a 100644 --- a/src/adaptors/UBSvgSubsetAdaptor.cpp +++ b/src/adaptors/UBSvgSubsetAdaptor.cpp @@ -29,6 +29,7 @@ #include "domain/UBGraphicsTextItem.h" #include "domain/UBAbstractWidget.h" #include "domain/UBGraphicsStroke.h" +#include "domain/UBItem.h" #include "tools/UBGraphicsRuler.h" #include "tools/UBGraphicsCompass.h" @@ -106,7 +107,8 @@ QMatrix UBSvgSubsetAdaptor::fromSvgTransform(const QString& transform) static bool itemZIndexComp(const QGraphicsItem* item1, const QGraphicsItem* item2) { - return item1->zValue() < item2->zValue(); +// return item1->zValue() < item2->zValue(); + return item1->data(UBGraphicsItemData::ItemOwnZValue).toReal() < item2->data(UBGraphicsItemData::ItemOwnZValue).toReal(); } @@ -1337,11 +1339,13 @@ UBGraphicsPolygonItem* UBSvgSubsetAdaptor::UBSvgSubsetReader::polygonItemFromPol if (!ubZValue.isNull()) { - polygonItem->setZValue(ubZValue.toString().toFloat()); +// polygonItem->setZValue (ubZValue.toString().toFloat()); + UBGraphicsItem::assignZValue(polygonItem, ubZValue.toString().toFloat()); } else { - polygonItem->setZValue(mGroupZIndex); +// polygonItem->setZValue(mGroupZIndex); + UBGraphicsItem::assignZValue(polygonItem, mGroupZIndex); } QStringRef ubFillOnDarkBackground = mXmlReader.attributes().value(mNamespaceUri, "fill-on-dark-background"); @@ -1444,11 +1448,13 @@ UBGraphicsPolygonItem* UBSvgSubsetAdaptor::UBSvgSubsetReader::polygonItemFromLin if (!ubZValue.isNull()) { - polygonItem->setZValue(ubZValue.toString().toFloat()); +// polygonItem->setZValue(ubZValue.toString().toFloat()); + UBGraphicsItem::assignZValue(polygonItem, ubZValue.toString().toFloat()); } else { - polygonItem->setZValue(mGroupZIndex); +// polygonItem->setZValue(mGroupZIndex); + UBGraphicsItem::assignZValue(polygonItem, mGroupZIndex); } @@ -1587,7 +1593,8 @@ QList UBSvgSubsetAdaptor::UBSvgSubsetReader::polygonItem { UBGraphicsPolygonItem* polygonItem = new UBGraphicsPolygonItem(QLineF(points.at(i), points.at(i + 1)), lineWidth); polygonItem->setColor(brushColor); - polygonItem->setZValue(zValue); +// polygonItem->setZValue(zValue); + UBGraphicsItem::assignZValue(polygonItem, zValue); polygonItem->setColorOnDarkBackground(colorOnDarkBackground); polygonItem->setColorOnLightBackground(colorOnLightBackground); @@ -1931,7 +1938,8 @@ void UBSvgSubsetAdaptor::UBSvgSubsetReader::graphicsItemFromSvg(QGraphicsItem* g if (!ubZValue.isNull()) { - gItem->setZValue(ubZValue.toString().toFloat()); +// gItem->setZValue(ubZValue.toString().toFloat()); + UBGraphicsItem::assignZValue(gItem, ubZValue.toString().toFloat()); } UBItem* ubItem = dynamic_cast(gItem); @@ -2484,7 +2492,8 @@ UBGraphicsRuler* UBSvgSubsetAdaptor::UBSvgSubsetReader::rulerFromSvg() graphicsItemFromSvg(ruler); - ruler->setZValue(UBGraphicsScene::toolLayerStart + UBGraphicsScene::toolOffsetRuler); +// ruler->setZValue(UBGraphicsScene::toolLayerStart + UBGraphicsScene::toolOffsetRuler); + UBGraphicsItem::assignZValue(ruler, UBGraphicsScene::toolLayerStart + UBGraphicsScene::toolOffsetRuler); ruler->setData(UBGraphicsItemData::ItemLayerType, QVariant(UBItemLayerType::Tool)); QStringRef svgWidth = mXmlReader.attributes().value("width"); @@ -2542,7 +2551,8 @@ UBGraphicsCompass* UBSvgSubsetAdaptor::UBSvgSubsetReader::compassFromSvg() graphicsItemFromSvg(compass); - compass->setZValue(UBGraphicsScene::toolLayerStart + UBGraphicsScene::toolOffsetCompass); + //compass->setZValue(UBGraphicsScene::toolLayerStart + UBGraphicsScene::toolOffsetCompass); + UBGraphicsItem::assignZValue(compass, UBGraphicsScene::toolLayerStart + UBGraphicsScene::toolOffsetCompass); compass->setData(UBGraphicsItemData::ItemLayerType, QVariant(UBItemLayerType::Tool)); QStringRef svgX = mXmlReader.attributes().value("x"); @@ -2606,7 +2616,8 @@ UBGraphicsProtractor* UBSvgSubsetAdaptor::UBSvgSubsetReader::protractorFromSvg() { UBGraphicsProtractor* protractor = new UBGraphicsProtractor(); - protractor->setZValue(UBGraphicsScene::toolLayerStart + UBGraphicsScene::toolOffsetProtractor); +// protractor->setZValue(UBGraphicsScene::toolLayerStart + UBGraphicsScene::toolOffsetProtractor); + UBGraphicsItem::assignZValue(protractor, UBGraphicsScene::toolLayerStart + UBGraphicsScene::toolOffsetProtractor); protractor->setData(UBGraphicsItemData::ItemLayerType, QVariant(UBItemLayerType::Tool)); graphicsItemFromSvg(protractor); @@ -2676,7 +2687,8 @@ UBGraphicsTriangle* UBSvgSubsetAdaptor::UBSvgSubsetReader::triangleFromSvg() { UBGraphicsTriangle* triangle = new UBGraphicsTriangle(); - triangle->setZValue(UBGraphicsScene::toolLayerStart + UBGraphicsScene::toolOffsetTriangle); +// triangle->setZValue(UBGraphicsScene::toolLayerStart + UBGraphicsScene::toolOffsetTriangle); + UBGraphicsItem::assignZValue(triangle, UBGraphicsScene::toolLayerStart + UBGraphicsScene::toolOffsetTriangle); triangle->setData(UBGraphicsItemData::ItemLayerType, QVariant(UBItemLayerType::Tool)); graphicsItemFromSvg(triangle); @@ -2695,7 +2707,6 @@ UBGraphicsTriangle* UBSvgSubsetAdaptor::UBSvgSubsetReader::triangleFromSvg() triangle->setRect(svgX.toString().toFloat(), svgY.toString().toFloat(), svgWidth.toString().toFloat(), svgHeight.toString().toFloat(), orientation); } - triangle->setVisible(true); return triangle; } @@ -2703,7 +2714,8 @@ UBGraphicsTriangle* UBSvgSubsetAdaptor::UBSvgSubsetReader::triangleFromSvg() UBGraphicsCache* UBSvgSubsetAdaptor::UBSvgSubsetReader::cacheFromSvg() { UBGraphicsCache* pCache = new UBGraphicsCache(); - //pCache->setZValue(UBGraphicsScene::toolLayerStart + UBGraphicsScene::toolOffsetCache); + pCache->setZValue(UBGraphicsScene::toolLayerStart + UBGraphicsScene::toolOffsetCache); +// UBGraphicsItem::assignZValue(pCache, UBGraphicsScene::toolLayerStart + UBGraphicsScene::toolOffsetCache); pCache->setData(UBGraphicsItemData::ItemLayerType, QVariant(UBItemLayerType::Tool)); graphicsItemFromSvg(pCache); diff --git a/src/adaptors/publishing/UBDocumentPublisher.cpp b/src/adaptors/publishing/UBDocumentPublisher.cpp index 02f8d900..d3ec39dd 100644 --- a/src/adaptors/publishing/UBDocumentPublisher.cpp +++ b/src/adaptors/publishing/UBDocumentPublisher.cpp @@ -240,8 +240,6 @@ void UBDocumentPublisher::upgradeDocumentForPublishing() { UBGraphicsScene *scene = UBSvgSubsetAdaptor::loadScene(mPublishingDocument, pageIndex); - bool sceneHasWidget = false; - QList widgets; foreach(QGraphicsItem* item, scene->items()){ @@ -249,7 +247,6 @@ void UBDocumentPublisher::upgradeDocumentForPublishing() if(widgetItem){ generateWidgetPropertyScript(widgetItem, pageIndex + 1); - sceneHasWidget = true; widgets << widgetItem; } } diff --git a/src/board/UBBoardController.cpp b/src/board/UBBoardController.cpp index 829c07ef..7eac5b9e 100644 --- a/src/board/UBBoardController.cpp +++ b/src/board/UBBoardController.cpp @@ -66,6 +66,7 @@ #include "UBBoardPaletteManager.h" #include "core/memcheck.h" +//#include UBBoardController::UBBoardController(UBMainWindow* mainWindow) : QObject(mainWindow->centralWidget()) @@ -776,6 +777,12 @@ void UBBoardController::downloadFinished(bool pSuccess, QUrl sourceUrl, QString { QString mimeType = pContentTypeHeader; + // In some cases "image/jpeg;charset=" is retourned by the drag-n-drop. That is + // why we will check if an ; exists and take the first part (the standard allows this kind of mimetype) + int position=mimeType.indexOf(";"); + if(position != -1) + mimeType=mimeType.left(position); + if (!pSuccess) { UBApplication::showMessage(tr("Downloading content %1 failed").arg(sourceUrl.toString())); @@ -1132,7 +1139,7 @@ void UBBoardController::setActiveDocumentScene(UBDocumentProxy* pDocumentProxy, if(sceneChange) emit activeSceneWillChange(); - UBApplication::undoStack->clear(); + ClearUndoStack(); mActiveScene = targetScene; mActiveDocument = pDocumentProxy; @@ -1173,6 +1180,55 @@ void UBBoardController::setActiveDocumentScene(UBDocumentProxy* pDocumentProxy, } } +void UBBoardController::ClearUndoStack() +{ + QSet uniqueItems; + // go through all stack command + for(int i = 0; i < UBApplication::undoStack->count(); i++) + { + + UBAbstractUndoCommand *abstractCmd = (UBAbstractUndoCommand*)UBApplication::undoStack->command(i); + if(abstractCmd->getType() != UBAbstractUndoCommand::undotype_GRAPHICITEM) + continue; + + UBGraphicsItemUndoCommand *cmd = (UBGraphicsItemUndoCommand*)UBApplication::undoStack->command(i); + + // go through all added and removed objects, for create list of unique objects + QSetIterator itAdded(cmd->GetAddedList()); + while (itAdded.hasNext()) + { + QGraphicsItem* item = itAdded.next(); + if( !uniqueItems.contains(item) ) + uniqueItems.insert(item); + } + + QSetIterator itRemoved(cmd->GetRemovedList()); + while (itRemoved.hasNext()) + { + QGraphicsItem* item = itRemoved.next(); + if( !uniqueItems.contains(item) ) + uniqueItems.insert(item); + } + } + + // clear stack, and command list + UBApplication::undoStack->clear(); + + // go through all unique items, and check, ot on scene, or not. + // if not on scene, than item can be deleted + + QSetIterator itUniq(uniqueItems); + while (itUniq.hasNext()) + { + QGraphicsItem* item = itUniq.next(); + UBGraphicsScene *scene = (UBGraphicsScene*)item->scene(); + if(!scene) + { + mActiveScene->deleteItem(item); + } + } + +} void UBBoardController::adjustDisplayViews() { @@ -1842,7 +1898,8 @@ void UBBoardController::processMimeData(const QMimeData* pMimeData, const QPoint if (gi) { - gi->setZValue(mActiveScene->getNextObjectZIndex()); +// gi->setZValue(mActiveScene->getNextObjectZIndex()); + UBGraphicsItem::assignZValue(gi, mActiveScene->getNextObjectZIndex()); mActiveScene->addItem(gi); gi->setPos(gi->pos() + QPointF(50, 50)); } diff --git a/src/board/UBBoardController.h b/src/board/UBBoardController.h index 218130ab..7d722152 100644 --- a/src/board/UBBoardController.h +++ b/src/board/UBBoardController.h @@ -140,6 +140,7 @@ class UBBoardController : public QObject void setBoxing(QRect displayRect); void setToolbarTexts(); static QUrl expandWidgetToTempDir(const QByteArray& pZipedData, const QString& pExtension = QString("wgt")); +// static QRect freeRectInGlobalPos() const {return ;} void setPageSize(QSize newSize); UBBoardPaletteManager *paletteManager() { @@ -150,6 +151,9 @@ class UBBoardController : public QObject void notifyPageChanged(); void displayMetaData(QMap metadatas); + void ClearUndoStack(); + + public slots: void setActiveDocumentScene(UBDocumentProxy* pDocumentProxy, int pSceneIndex = 0); void showDocumentsDialog(); diff --git a/src/board/UBBoardPaletteManager.cpp b/src/board/UBBoardPaletteManager.cpp index 986a8356..483fbbac 100644 --- a/src/board/UBBoardPaletteManager.cpp +++ b/src/board/UBBoardPaletteManager.cpp @@ -81,8 +81,8 @@ UBBoardPaletteManager::UBBoardPaletteManager(QWidget* container, UBBoardControll , mpLibWidget(NULL) , mpCachePropWidget(NULL) , mpTeacherBarWidget(NULL) - , mpDesktopLibWidget(NULL) , mpDownloadWidget(NULL) + , mpDesktopLibWidget(NULL) , mDownloadInProgress(false) { setupPalettes(); @@ -727,7 +727,7 @@ void UBBoardPaletteManager::changeMode(eUBDockPaletteWidgetMode newMode, bool is case eUBDockPaletteWidget_BOARD: { mLeftPalette->setParent(UBApplication::boardController->controlContainer()); - mRightPalette->setParent(UBApplication::boardController->controlContainer()); + mRightPalette->assignParent(UBApplication::boardController->controlContainer()); if (UBPlatformUtils::hasVirtualKeyboard() && mKeyboardPalette != NULL) { @@ -743,6 +743,9 @@ void UBBoardPaletteManager::changeMode(eUBDockPaletteWidgetMode newMode, bool is mLeftPalette->setVisible(true); mRightPalette->setVisible(true); +#ifdef Q_WS_WIN + mRightPalette->setAdditionalVOffset(0); +#endif if( !isInit ) containerResized(); @@ -752,7 +755,7 @@ void UBBoardPaletteManager::changeMode(eUBDockPaletteWidgetMode newMode, bool is case eUBDockPaletteWidget_DESKTOP: { mLeftPalette->setParent((QWidget*)UBApplication::applicationController->uninotesController()->drawingView()); - mRightPalette->setParent((QWidget*)UBApplication::applicationController->uninotesController()->drawingView()); + mRightPalette->assignParent((QWidget*)UBApplication::applicationController->uninotesController()->drawingView()); if (UBPlatformUtils::hasVirtualKeyboard() && mKeyboardPalette != NULL) { @@ -772,6 +775,9 @@ void UBBoardPaletteManager::changeMode(eUBDockPaletteWidgetMode newMode, bool is mLeftPalette->setVisible(false); mRightPalette->setVisible(true); +#ifdef Q_WS_WIN + mRightPalette->setAdditionalVOffset(30); +#endif if( !isInit ) UBApplication::applicationController->uninotesController()->TransparentWidgetResized(); @@ -802,7 +808,7 @@ void UBBoardPaletteManager::changeMode(eUBDockPaletteWidgetMode newMode, bool is mLeftPalette->setVisible(false); mRightPalette->setVisible(false); mLeftPalette->setParent(0); - mRightPalette->setParent(0); + mRightPalette->assignParent(0); if (UBPlatformUtils::hasVirtualKeyboard() && mKeyboardPalette != NULL) { @@ -1027,3 +1033,27 @@ void UBBoardPaletteManager::stopDownloads() mRightPalette->removeTab(mpDownloadWidget->name()); } } + +QRect UBBoardPaletteManager::GetFreeRectGlobalCoords() const +{ + QPoint topLeft, bottomRight; + if (mLeftPalette) { + int x = mLeftPalette->getTabPaletteRect().topRight().x(); + int y = 0; + if (x || y) { + topLeft.setX(x); + topLeft.setY(y); + topLeft = mContainer->mapToGlobal(topLeft); + } + } + if (mRightPalette) { + int x = mRightPalette->getTabPaletteRect().topLeft().x(); + int y = mRightPalette->height(); + if (x || y) { + bottomRight.setX(x); + bottomRight.setY(y); + bottomRight = mContainer->mapToGlobal(bottomRight); + } + } + return QRect(topLeft, bottomRight); +} diff --git a/src/board/UBBoardPaletteManager.h b/src/board/UBBoardPaletteManager.h index 4cba1d4a..0dc4c2f9 100644 --- a/src/board/UBBoardPaletteManager.h +++ b/src/board/UBBoardPaletteManager.h @@ -65,6 +65,7 @@ class UBBoardPaletteManager : public QObject void changeMode(eUBDockPaletteWidgetMode newMode, bool isInit = false); void startDownloads(); void stopDownloads(); + QRect GetFreeRectGlobalCoords() const; signals: void connectToDocController(); diff --git a/src/board/UBBoardView.cpp b/src/board/UBBoardView.cpp index dd8e47c1..d5ff09e6 100644 --- a/src/board/UBBoardView.cpp +++ b/src/board/UBBoardView.cpp @@ -12,8 +12,6 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - - #include "UBBoardView.h" #include diff --git a/src/board/UBLibraryController.cpp b/src/board/UBLibraryController.cpp index 1326b458..bd4b48b9 100644 --- a/src/board/UBLibraryController.cpp +++ b/src/board/UBLibraryController.cpp @@ -16,7 +16,6 @@ #include "frameworks/UBFileSystemUtils.h" #include "frameworks/UBPlatformUtils.h" -#include "frameworks/UBDesktopServices.h" #include "core/UBApplication.h" #include "core/UBPersistenceManager.h" @@ -54,13 +53,13 @@ UBLibraryController::UBLibraryController(QWidget *pParentWidget) : { readFavoriteList(); - mAudioStandardDirectoryPath = QUrl::fromLocalFile(UBDesktopServices::storageLocation(QDesktopServices::MusicLocation)); + mAudioStandardDirectoryPath = QUrl::fromLocalFile(QDesktopServices::storageLocation(QDesktopServices::MusicLocation)); userPath(mAudioStandardDirectoryPath); - mVideoStandardDirectoryPath = QUrl::fromLocalFile(UBDesktopServices::storageLocation(QDesktopServices::MoviesLocation)); + mVideoStandardDirectoryPath = QUrl::fromLocalFile(QDesktopServices::storageLocation(QDesktopServices::MoviesLocation)); userPath(mVideoStandardDirectoryPath); - mPicturesStandardDirectoryPath = QUrl::fromLocalFile(UBDesktopServices::storageLocation(QDesktopServices::PicturesLocation)); + mPicturesStandardDirectoryPath = QUrl::fromLocalFile(QDesktopServices::storageLocation(QDesktopServices::PicturesLocation)); userPath(mPicturesStandardDirectoryPath); mInteractiveUserDirectoryPath = QUrl::fromLocalFile(UBSettings::settings()->uniboardInteractiveUserDirectory()); @@ -696,16 +695,20 @@ void UBLibraryController::addVideosToCurrentPage(const QList& videos) void UBLibraryController::addAudiosToCurrentPage(const QList& sounds) { - QPointF topLeftPos = visibleSceneRect().topLeft(); + QPointF centerPos = visibleSceneRect().center(); - QPointF pos = topLeftPos; + QPointF pos = centerPos; + + //move it a little higher for convenience + centerPos.setX(pos.x() - 200); + centerPos.setY(pos.y() - 100); foreach(const QUrl url, sounds) { mLastItemOffsetIndex++; mLastItemOffsetIndex = qMin(mLastItemOffsetIndex, 5); - pos = QPointF(topLeftPos.x() + 50 * mLastItemOffsetIndex, - topLeftPos.y() + 50 * mLastItemOffsetIndex); + pos = QPointF(centerPos.x() + 50 * mLastItemOffsetIndex, + centerPos.y() + 50 * mLastItemOffsetIndex); UBApplication::boardController->addAudio(url, false, pos); } } diff --git a/src/core/UB.h b/src/core/UB.h index fbe7dd77..83a4b456 100644 --- a/src/core/UB.h +++ b/src/core/UB.h @@ -78,6 +78,7 @@ struct UBGraphicsItemData ItemLayerType , ItemLocked , ItemEditable//for text only + , ItemOwnZValue }; }; diff --git a/src/core/UBApplication.cpp b/src/core/UBApplication.cpp index 992204ee..b0f063f4 100644 --- a/src/core/UBApplication.cpp +++ b/src/core/UBApplication.cpp @@ -109,7 +109,7 @@ UBApplication::UBApplication(const QString &id, int &argc, char **argv) : QtSing setOrganizationName("Sankore"); setOrganizationDomain("sankore.org"); - setApplicationName("Sankore 3.1"); + setApplicationName("Open-Sankore"); setApplicationVersion(UBVERSION); @@ -222,7 +222,6 @@ int UBApplication::exec(const QString& pFileToImport) QWebSettings *gs = QWebSettings::globalSettings(); gs->setAttribute(QWebSettings::JavaEnabled, true); gs->setAttribute(QWebSettings::PluginsEnabled, true); - gs->setAttribute(QWebSettings::JavaEnabled, true); gs->setAttribute(QWebSettings::LocalStorageDatabaseEnabled, true); gs->setAttribute(QWebSettings::OfflineWebApplicationCacheEnabled, true); gs->setAttribute(QWebSettings::OfflineStorageDatabaseEnabled, true); diff --git a/src/core/UBApplicationController.cpp b/src/core/UBApplicationController.cpp index efece366..68c9b81b 100644 --- a/src/core/UBApplicationController.cpp +++ b/src/core/UBApplicationController.cpp @@ -368,7 +368,7 @@ void UBApplicationController::showInternet() if (UBSettings::settings()->webUseExternalBrowser->get().toBool()) { showDesktop(true); - UBApplication::webController->show(UBWebController::WebBrowser); + UBApplication::webController->show(UBWebController::WebBrowser); // really no have emit mainModeChanged here ? potential problem with virtual keyboard ? } else @@ -460,6 +460,7 @@ void UBApplicationController::showTutorial() UBApplication::boardController->hide(); } + // it's needed not to duplicate webbrowser search in web mode. If I've breaked smbd's code let Ivan know UBApplication::webController->show(UBWebController::Tutorial); mMainWindow->webToolBar->hide(); @@ -488,7 +489,8 @@ void UBApplicationController::showSankoreEditor() UBApplication::boardController->hide(); } - UBApplication::webController->show(UBWebController::Paraschool); +// it's needed not to duplicate webbrowser search in web mode. If I've breaked smbd's code let Ivan know + UBApplication::webController->show(UBWebController::Paraschool); mMainWindow->webToolBar->hide(); mMainWindow->boardToolBar->hide(); @@ -695,7 +697,7 @@ void UBApplicationController::importFile(const QString& pFilePath) bool success = false; - document = UBDocumentManager::documentManager()->importFile(fileToOpen, UBSettings::defaultDocumentGroupName); + document = UBDocumentManager::documentManager()->importFile(fileToOpen, ""); success = (document != 0); diff --git a/src/core/UBPersistenceManager.cpp b/src/core/UBPersistenceManager.cpp index 8e92e360..9ac5d13a 100644 --- a/src/core/UBPersistenceManager.cpp +++ b/src/core/UBPersistenceManager.cpp @@ -20,7 +20,6 @@ #include "frameworks/UBPlatformUtils.h" #include "frameworks/UBFileSystemUtils.h" -#include "frameworks/UBDesktopServices.h" #include "core/UBApplication.h" #include "core/UBSettings.h" @@ -171,7 +170,7 @@ QStringList UBPersistenceManager::allGips() QStringList UBPersistenceManager::allSounds() { - QString soundLibraryPath = UBDesktopServices::storageLocation(QDesktopServices::MusicLocation); + QString soundLibraryPath = QDesktopServices::storageLocation(QDesktopServices::MusicLocation); QDir dir(soundLibraryPath); diff --git a/src/core/UBSettings.cpp b/src/core/UBSettings.cpp index 0d39c960..0db96ae9 100644 --- a/src/core/UBSettings.cpp +++ b/src/core/UBSettings.cpp @@ -13,7 +13,6 @@ #include "frameworks/UBPlatformUtils.h" #include "frameworks/UBFileSystemUtils.h" -#include "frameworks/UBDesktopServices.h" #include "frameworks/UBCryptoUtils.h" #include "UB.h" @@ -194,8 +193,8 @@ void UBSettings::init() appEnableAutomaticSoftwareUpdates = new UBSetting(this, "App", "EnableAutomaticSoftwareUpdates", true); appEnableSoftwareUpdates = new UBSetting(this, "App", "EnableSoftwareUpdates", true); appToolBarOrientationVertical = new UBSetting(this, "App", "ToolBarOrientationVertical", false); - navigPaletteWidth = new UBSetting(this, "Board", "NavigPaletteWidth", 300); - libPaletteWidth = new UBSetting(this, "Board", "LibPaletteWidth", 300); + navigPaletteWidth = new UBSetting(this, "Board", "NavigPaletteWidth", 270); + libPaletteWidth = new UBSetting(this, "Board", "LibPaletteWidth", 270); appIsInSoftwareUpdateProcess = new UBSetting(this, "App", "IsInSoftwareUpdateProcess", false); appLastSessionDocumentUUID = new UBSetting(this, "App", "LastSessionDocumentUUID", ""); @@ -294,15 +293,15 @@ void UBSettings::init() mirroringRefreshRateInFps = new UBSetting(this, "Mirroring", "RefreshRateInFramePerSecond", QVariant(defaultRefreshRateInFramePerSecond)); - lastImportFilePath = new UBSetting(this, "Import", "LastImportFilePath", QVariant(UBDesktopServices::storageLocation(QDesktopServices::DocumentsLocation))); - lastImportFolderPath = new UBSetting(this, "Import", "LastImportFolderPath", QVariant(UBDesktopServices::storageLocation(QDesktopServices::DocumentsLocation))); - lastExportFilePath = new UBSetting(this, "Export", "LastExportFilePath", QVariant(UBDesktopServices::storageLocation(QDesktopServices::DocumentsLocation))); - lastExportDirPath = new UBSetting(this, "Export", "LastExportDirPath", QVariant(UBDesktopServices::storageLocation(QDesktopServices::DocumentsLocation))); - lastImportToLibraryPath = new UBSetting(this, "Library", "LastImportToLibraryPath", QVariant(UBDesktopServices::storageLocation(QDesktopServices::DocumentsLocation))); + lastImportFilePath = new UBSetting(this, "Import", "LastImportFilePath", QVariant(QDesktopServices::storageLocation(QDesktopServices::DocumentsLocation))); + lastImportFolderPath = new UBSetting(this, "Import", "LastImportFolderPath", QVariant(QDesktopServices::storageLocation(QDesktopServices::DocumentsLocation))); + lastExportFilePath = new UBSetting(this, "Export", "LastExportFilePath", QVariant(QDesktopServices::storageLocation(QDesktopServices::DocumentsLocation))); + lastExportDirPath = new UBSetting(this, "Export", "LastExportDirPath", QVariant(QDesktopServices::storageLocation(QDesktopServices::DocumentsLocation))); + lastImportToLibraryPath = new UBSetting(this, "Library", "LastImportToLibraryPath", QVariant(QDesktopServices::storageLocation(QDesktopServices::DocumentsLocation))); - lastPicturePath = new UBSetting(this, "Library", "LastPicturePath", QVariant(UBDesktopServices::storageLocation(QDesktopServices::PicturesLocation))); - lastWidgetPath = new UBSetting(this, "Library", "LastWidgetPath", QVariant(UBDesktopServices::storageLocation(QDesktopServices::DocumentsLocation))); - lastVideoPath = new UBSetting(this, "Library", "LastVideoPath", QVariant(UBDesktopServices::storageLocation(QDesktopServices::MoviesLocation))); + lastPicturePath = new UBSetting(this, "Library", "LastPicturePath", QVariant(QDesktopServices::storageLocation(QDesktopServices::PicturesLocation))); + lastWidgetPath = new UBSetting(this, "Library", "LastWidgetPath", QVariant(QDesktopServices::storageLocation(QDesktopServices::DocumentsLocation))); + lastVideoPath = new UBSetting(this, "Library", "LastVideoPath", QVariant(QDesktopServices::storageLocation(QDesktopServices::MoviesLocation))); defaultDocumentGroupName = tr("Untitled Documents"); documentTrashGroupName = tr("Trash"); @@ -761,8 +760,8 @@ QString UBSettings::uniboardDataDirectory() // ", defaulting to " + UBDesktopServices::storageLocation(QDesktopServices::DataLocation); } } - QString qtDataPath = UBFileSystemUtils::normalizeFilePath(UBDesktopServices::storageLocation(QDesktopServices::DataLocation)); - qtDataPath.replace("/Sankore", ""); + QString qtDataPath = UBFileSystemUtils::normalizeFilePath(QDesktopServices::storageLocation(QDesktopServices::DataLocation)); + qtDataPath.replace("/Open-Sankore", ""); return qtDataPath; } @@ -770,7 +769,7 @@ QString UBSettings::uniboardDataDirectory() QString UBSettings::uniboardUserImageDirectory() { QString valideUserImageDirectory = - UBDesktopServices::storageLocation(QDesktopServices::PicturesLocation) + QDesktopServices::storageLocation(QDesktopServices::PicturesLocation) + "/" + QCoreApplication::applicationName(); bool hasCreatedDir = false; @@ -852,9 +851,7 @@ QString UBSettings::defaultUserImagesDirectory() QString UBSettings::uniboardUserVideoDirectory() { QString valideUserVideoDirectory = - UBDesktopServices::storageLocation(QDesktopServices::MoviesLocation); - - bool hasCreatedDir = false; + QDesktopServices::storageLocation(QDesktopServices::MoviesLocation); // first look into the application settings if (sAppSettings && getAppSettings()->contains("App/UserVideoDirectory")) @@ -889,7 +886,6 @@ QString UBSettings::uniboardUserVideoDirectory() if (!dir.exists()) { dir.mkpath(userVideoDirectory); - hasCreatedDir = true; } if (dir.exists()) @@ -898,7 +894,6 @@ QString UBSettings::uniboardUserVideoDirectory() } else { - hasCreatedDir = false; qWarning() << "Failed to interpret App/UserVideoDirectory config : " + getAppSettings()->value("App/UserVideoDirectory").toString() + ", defaulting to " + valideUserVideoDirectory; @@ -927,9 +922,7 @@ QString UBSettings::uniboardUserVideoDirectory() QString UBSettings::podcastRecordingDirectory() { QString validePodcastRecordingDirectory = - UBDesktopServices::storageLocation(QDesktopServices::DesktopLocation); - - bool hasCreatedDir = false; + QDesktopServices::storageLocation(QDesktopServices::DesktopLocation); // first look into the application settings if (sAppSettings && getAppSettings()->contains("Podcast/RecordingDirectory")) @@ -964,7 +957,6 @@ QString UBSettings::podcastRecordingDirectory() if (!dir.exists()) { dir.mkpath(userPodcastRecordingDirectory); - hasCreatedDir = true; } if (dir.exists()) @@ -973,7 +965,6 @@ QString UBSettings::podcastRecordingDirectory() } else { - hasCreatedDir = false; qWarning() << "Failed to interpret Podcast/RecordingDirectory config : " + getAppSettings()->value("Podcast/RecordingDirectory").toString() + ", defaulting to user Desktop"; @@ -1099,8 +1090,6 @@ QString UBSettings::uniboardInteractiveUserDirectory() { QString valideUserInteractiveDirectory = uniboardDataDirectory() + "/interactive content"; - bool hasCreatedDir = false; - // first look into the application settings if (sAppSettings && getAppSettings()->contains("App/UserInteractiveContentDirectory")) { @@ -1129,7 +1118,6 @@ QString UBSettings::uniboardInteractiveUserDirectory() if (!dir.exists()) { dir.mkpath(userWidgetDirectory); - hasCreatedDir = true; } if (dir.exists()) @@ -1138,7 +1126,6 @@ QString UBSettings::uniboardInteractiveUserDirectory() } else { - hasCreatedDir = false; qWarning() << "Failed to interpret App/UserInteractiveContentDirectory config : " + getAppSettings()->value("App/UserInteractiveContentDirectory").toString() + ", defaulting to " + valideUserInteractiveDirectory; @@ -1194,8 +1181,6 @@ QString UBSettings::uniboardInteractiveFavoritesDirectory() { QString valideUserInteractiveDirectory = uniboardDataDirectory() + "/interactive favorites"; - bool hasCreatedDir = false; - // first look into the application settings if (sAppSettings && getAppSettings()->contains("App/UserInteractiveFavoritesDirectory")) { @@ -1224,7 +1209,6 @@ QString UBSettings::uniboardInteractiveFavoritesDirectory() if (!dir.exists()) { dir.mkpath(userWidgetDirectory); - hasCreatedDir = true; } if (dir.exists()) @@ -1233,7 +1217,6 @@ QString UBSettings::uniboardInteractiveFavoritesDirectory() } else { - hasCreatedDir = false; qWarning() << "Failed to interpret App/UserInteractiveFavoritesDirectory config : " + getAppSettings()->value("App/UserInteractiveFavoritesDirectory").toString() + ", defaulting to " + valideUserInteractiveDirectory; diff --git a/src/desktop/UBDesktopAnnotationController.cpp b/src/desktop/UBDesktopAnnotationController.cpp index aa4b0504..09cd7ed8 100644 --- a/src/desktop/UBDesktopAnnotationController.cpp +++ b/src/desktop/UBDesktopAnnotationController.cpp @@ -372,6 +372,7 @@ void UBDesktopAnnotationController::close() void UBDesktopAnnotationController::stylusToolChanged(int tool) { + Q_UNUSED(tool); // UBStylusTool::Enum eTool = (UBStylusTool::Enum)tool; // if(eTool != UBStylusTool::Selector && eTool != UBStylusTool::Text) // { @@ -900,7 +901,7 @@ void UBDesktopAnnotationController::updateMask(bool bTransparent) { if(bTransparent) { - // Here we have to generate a new mask. This method is certainly resource + // Here we have to generate a new mask This method is certainly resource // consuming but for the moment this is the only solution that I found. mMask = QPixmap(mTransparentDrawingView->width(), mTransparentDrawingView->height()); @@ -922,13 +923,17 @@ void UBDesktopAnnotationController::updateMask(bool bTransparent) UBApplication::boardController->paletteManager()->mKeyboardPalette->width(), UBApplication::boardController->paletteManager()->mKeyboardPalette->height()); } -// UBApplication::boardController->paletteManager()->mDesktopRightPalette if(UBApplication::boardController->paletteManager()->rightPalette()->isVisible()) { - p.drawRect(UBApplication::boardController->paletteManager()->rightPalette()->geometry().x(), - UBApplication::boardController->paletteManager()->rightPalette()->geometry().y(), - UBApplication::boardController->paletteManager()->rightPalette()->width(), - UBApplication::boardController->paletteManager()->rightPalette()->height()); + QRect rightPalette(UBApplication::boardController->paletteManager()->rightPalette()->geometry().x(), + UBApplication::boardController->paletteManager()->rightPalette()->geometry().y(), + UBApplication::boardController->paletteManager()->rightPalette()->width(), + UBApplication::boardController->paletteManager()->rightPalette()->height()); + + QRect tabsPalette(UBApplication::boardController->paletteManager()->rightPalette()->getTabPaletteRect()); + + p.drawRect(rightPalette); + p.drawRect(tabsPalette); } p.end(); diff --git a/src/desktop/UBDesktopPalette.cpp b/src/desktop/UBDesktopPalette.cpp index d3641157..2ac196f9 100644 --- a/src/desktop/UBDesktopPalette.cpp +++ b/src/desktop/UBDesktopPalette.cpp @@ -111,7 +111,6 @@ void UBDesktopPalette::updateShowHideState(bool pShowEnabled) mShowHideAction->setToolTip(tr("Show Board on Secondary Screen")); else mShowHideAction->setToolTip(tr("Show Desktop on Secondary Screen")); - } diff --git a/src/desktop/desktop.pri b/src/desktop/desktop.pri index 37600cd2..642e014c 100644 --- a/src/desktop/desktop.pri +++ b/src/desktop/desktop.pri @@ -23,3 +23,4 @@ macx:SOURCES += src/desktop/UBWindowCapture_mac.mm linux-g++:SOURCES += src/desktop/UBWindowCapture_linux.cpp linux-g++-32:SOURCES += src/desktop/UBWindowCapture_linux.cpp +linux-g++-64:SOURCES += src/desktop/UBWindowCapture_linux.cpp diff --git a/src/document/UBDocumentController.cpp b/src/document/UBDocumentController.cpp index 27539123..7ee43999 100644 --- a/src/document/UBDocumentController.cpp +++ b/src/document/UBDocumentController.cpp @@ -19,7 +19,6 @@ #include "frameworks/UBFileSystemUtils.h" #include "frameworks/UBStringUtils.h" -#include "frameworks/UBDesktopServices.h" #include "frameworks/UBPlatformUtils.h" #include "core/UBApplication.h" @@ -1455,7 +1454,7 @@ bool UBDocumentController::isOKToOpenDocument(UBDocumentProxy* proxy) QString docVersion = proxy->metaData(UBSettings::documentVersion).toString(); if (docVersion.isEmpty() || docVersion.startsWith("4.1") || docVersion.startsWith("4.2") - || docVersion.startsWith("4.3") || docVersion.startsWith("4.4")) // TODO UB 4.7 update if necessary + || docVersion.startsWith("4.3") || docVersion.startsWith("4.4") || docVersion.startsWith("4.5")) // TODO UB 4.7 update if necessary { return true; } diff --git a/src/frameworks/UBDesktopServices_linux.cpp b/src/domain/UBAbstractUndoCommand.cpp similarity index 66% rename from src/frameworks/UBDesktopServices_linux.cpp rename to src/domain/UBAbstractUndoCommand.cpp index 2c03b51b..fe623acc 100644 --- a/src/frameworks/UBDesktopServices_linux.cpp +++ b/src/domain/UBAbstractUndoCommand.cpp @@ -13,9 +13,28 @@ * along with this program. If not, see . */ -#include "UBDesktopServices.h" +#include "UBAbstractUndoCommand.h" -QString UBDesktopServices::storageLocation(StandardLocation type) +UBAbstractUndoCommand::UBAbstractUndoCommand() { - return QDesktopServices::storageLocation(type); + // NOOP } + +UBAbstractUndoCommand::~UBAbstractUndoCommand() +{ + // NOOP +} + + +void UBAbstractUndoCommand::undo() +{ + // NOOP +} + +void UBAbstractUndoCommand::redo() +{ + // NOOP +} + +//void UBAbstractUndoCommand::UndoType getType(UndoType type); + diff --git a/src/domain/UBAbstractUndoCommand.h b/src/domain/UBAbstractUndoCommand.h new file mode 100644 index 00000000..3276284a --- /dev/null +++ b/src/domain/UBAbstractUndoCommand.h @@ -0,0 +1,46 @@ +/* + * 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 . + */ + +#ifndef UBABSTRACTUNDOCOMMAND_H_ +#define UBABSTRACTUNDOCOMMAND_H_ + +#include + +class UBAbstractUndoCommand : public QUndoCommand +{ + public: + + UBAbstractUndoCommand(); + ~UBAbstractUndoCommand(); + + enum UndoType + { + undotype_UNKNOWN = 0, + undotype_DOCUMENT = 1, + undotype_GRAPHICITEMTRANSFORM = 2, + undotype_GRAPHICITEM = 3, + undotype_GRAPHICTEXTITEM = 4, + undotype_PAGESIZE = 5 + }; + + virtual UndoType getType() { return undotype_UNKNOWN; } + + protected: + virtual void undo(); + virtual void redo(); + +}; + +#endif /* UBABSTRACTUNDOCOMMAND_H_ */ diff --git a/src/domain/UBDocumentUndoCommand.h b/src/domain/UBDocumentUndoCommand.h index a5f61d9a..b6b1785a 100644 --- a/src/domain/UBDocumentUndoCommand.h +++ b/src/domain/UBDocumentUndoCommand.h @@ -17,18 +17,20 @@ #define UBDOCUMENTUNDOCOMMAND_H_ #include +#include "UBAbstractUndoCommand.h" class UBDocumentProxy; class UBGraphicsScene; - -class UBDocumentUndoCommand: public QUndoCommand +class UBDocumentUndoCommand: public UBAbstractUndoCommand { public: UBDocumentUndoCommand(UBDocumentProxy* pDocument, const QList& pOldScenes, const QList& pNewScenes, const int& pActiveSceneIndex); virtual ~UBDocumentUndoCommand(); + virtual UndoType getType() { return undotype_DOCUMENT; }; + protected: virtual void undo(); diff --git a/src/domain/UBGraphicsAudioItem.cpp b/src/domain/UBGraphicsAudioItem.cpp index 12a2eae6..d38e27b7 100644 --- a/src/domain/UBGraphicsAudioItem.cpp +++ b/src/domain/UBGraphicsAudioItem.cpp @@ -95,7 +95,8 @@ UBItem* UBGraphicsAudioItem::deepCopy() const UBGraphicsAudioItem *copy = new UBGraphicsAudioItem(audioUrl, parentItem()); copy->setPos(this->pos()); - copy->setZValue(this->zValue()); +// copy->setZValue(this->zValue()); + UBGraphicsItem::assignZValue(copy, this->zValue()); copy->setTransform(this->transform()); copy->setFlag(QGraphicsItem::ItemIsMovable, true); copy->setFlag(QGraphicsItem::ItemIsSelectable, true); diff --git a/src/domain/UBGraphicsDelegateFrame.cpp b/src/domain/UBGraphicsDelegateFrame.cpp index a6f17114..393353d1 100644 --- a/src/domain/UBGraphicsDelegateFrame.cpp +++ b/src/domain/UBGraphicsDelegateFrame.cpp @@ -531,6 +531,9 @@ void UBGraphicsDelegateFrame::positionHandles() { setBrush(QBrush(UBSettings::paletteColor)); } + + //make frame interact like delegated item when selected. Maybe should be deleted if selection logic will change + setZValue(delegated()->zValue()); } diff --git a/src/domain/UBGraphicsItemDelegate.cpp b/src/domain/UBGraphicsItemDelegate.cpp index 7cc8fa96..86b93b68 100644 --- a/src/domain/UBGraphicsItemDelegate.cpp +++ b/src/domain/UBGraphicsItemDelegate.cpp @@ -72,7 +72,8 @@ void UBGraphicsItemDelegate::init() { mFrame = new UBGraphicsDelegateFrame(this, QRectF(0, 0, 0, 0), mFrameWidth, mRespectRatio); mFrame->hide(); - mFrame->setZValue(UBGraphicsScene::toolLayerStart + 1); +// mFrame->setZValue(UBGraphicsScene::toolLayerStart + 1); + UBGraphicsItem::assignZValue(mFrame, UBGraphicsScene::toolLayerStart + 1); mFrame->setFlag(QGraphicsItem::ItemIsSelectable, true); mDeleteButton = new DelegateButton(":/images/close.svg", mDelegated, mFrame); @@ -92,7 +93,8 @@ void UBGraphicsItemDelegate::init() foreach(DelegateButton* button, mButtons) { button->hide(); - button->setZValue(UBGraphicsScene::toolLayerStart + 2); +// button->setZValue(UBGraphicsScene::toolLayerStart + 2); + UBGraphicsItem::assignZValue(button, UBGraphicsScene::toolLayerStart + 2); button->setFlag(QGraphicsItem::ItemIsSelectable, true); } } @@ -282,8 +284,8 @@ void UBGraphicsItemDelegate::positionHandles() void UBGraphicsItemDelegate::remove(bool canUndo) { - QGraphicsScene* scene = mDelegated->scene(); - +// QGraphicsScene* scene = mDelegated->scene(); + UBGraphicsScene* scene = (UBGraphicsScene*)(mDelegated->scene()); if (scene) { foreach(DelegateButton* button, mButtons) @@ -321,12 +323,10 @@ void UBGraphicsItemDelegate::lock(bool locked) if (locked) { mDelegated->setData(UBGraphicsItemData::ItemLocked, QVariant(true)); - qDebug() << "item's data is called for locked" << mDelegated->data(UBGraphicsItemData::ItemLocked); } else { mDelegated->setData(UBGraphicsItemData::ItemLocked, QVariant(false)); - qDebug() << "item's data is called for unlocked" << mDelegated->data(UBGraphicsItemData::ItemLocked); } mDelegated->update(); diff --git a/src/domain/UBGraphicsItemTransformUndoCommand.cpp b/src/domain/UBGraphicsItemTransformUndoCommand.cpp index 0d799f0a..f21355bd 100644 --- a/src/domain/UBGraphicsItemTransformUndoCommand.cpp +++ b/src/domain/UBGraphicsItemTransformUndoCommand.cpp @@ -15,6 +15,7 @@ #include "UBGraphicsItemTransformUndoCommand.h" #include "UBResizableGraphicsItem.h" +#include "domain/UBItem.h" #include "core/memcheck.h" @@ -49,6 +50,7 @@ void UBGraphicsItemTransformUndoCommand::undo() mItem->setPos(mPreviousPosition); mItem->setTransform(mPreviousTransform); mItem->setZValue(mPreviousZValue); +// UBGraphicsItem::assignZValue(mItem, mPreviousZValue); UBResizableGraphicsItem* resizableItem = dynamic_cast(mItem); @@ -62,6 +64,8 @@ void UBGraphicsItemTransformUndoCommand::redo() mItem->setTransform(mCurrentTransform); mItem->setZValue(mCurrentZValue); +// UBGraphicsItem::assignZValue(mItem, /*mCurrentZValue*/mItem->data(UBGraphicsItemData::ItemOwnZValue).toReal()); + UBResizableGraphicsItem* resizableItem = dynamic_cast(mItem); if (resizableItem) diff --git a/src/domain/UBGraphicsItemTransformUndoCommand.h b/src/domain/UBGraphicsItemTransformUndoCommand.h index 67b57dd1..2f4538d7 100644 --- a/src/domain/UBGraphicsItemTransformUndoCommand.h +++ b/src/domain/UBGraphicsItemTransformUndoCommand.h @@ -19,9 +19,10 @@ #include #include "UBResizableGraphicsItem.h" +#include "UBAbstractUndoCommand.h" -class UBGraphicsItemTransformUndoCommand : public QUndoCommand +class UBGraphicsItemTransformUndoCommand : public UBAbstractUndoCommand { public: UBGraphicsItemTransformUndoCommand(QGraphicsItem* pItem, @@ -31,6 +32,8 @@ class UBGraphicsItemTransformUndoCommand : public QUndoCommand const QSizeF& prevSize = QSizeF()); virtual ~UBGraphicsItemTransformUndoCommand(); + virtual UndoType getType() { return undotype_GRAPHICITEMTRANSFORM; }; + protected: virtual void undo(); virtual void redo(); diff --git a/src/domain/UBGraphicsItemUndoCommand.h b/src/domain/UBGraphicsItemUndoCommand.h index 4d513915..d3230893 100644 --- a/src/domain/UBGraphicsItemUndoCommand.h +++ b/src/domain/UBGraphicsItemUndoCommand.h @@ -17,11 +17,13 @@ #define UBGRAPHICSITEMUNDOCOMMAND_H_ #include +#include "UBAbstractUndoCommand.h" + class UBGraphicsScene; -class UBGraphicsItemUndoCommand : public QUndoCommand +class UBGraphicsItemUndoCommand : public UBAbstractUndoCommand { public: UBGraphicsItemUndoCommand(UBGraphicsScene* pScene, const QSet& pRemovedItems, @@ -32,6 +34,11 @@ class UBGraphicsItemUndoCommand : public QUndoCommand virtual ~UBGraphicsItemUndoCommand(); + QSet GetAddedList() { return mAddedItems; }; + QSet GetRemovedList() { return mRemovedItems; }; + + virtual UndoType getType() { return undotype_GRAPHICITEM; }; + protected: virtual void undo(); virtual void redo(); diff --git a/src/domain/UBGraphicsPDFItem.cpp b/src/domain/UBGraphicsPDFItem.cpp index 7838358f..704ba676 100644 --- a/src/domain/UBGraphicsPDFItem.cpp +++ b/src/domain/UBGraphicsPDFItem.cpp @@ -84,7 +84,8 @@ UBItem* UBGraphicsPDFItem::deepCopy() const UBGraphicsPDFItem *copy = new UBGraphicsPDFItem(mRenderer, mPageNumber, parentItem()); copy->setPos(this->pos()); - copy->setZValue(this->zValue()); +// copy->setZValue(this->zValue()); + UBGraphicsItem::assignZValue(copy, this->zValue()); copy->setTransform(this->transform()); copy->setFlag(QGraphicsItem::ItemIsMovable, true); copy->setFlag(QGraphicsItem::ItemIsSelectable, true); @@ -134,7 +135,8 @@ UBGraphicsPixmapItem* UBGraphicsPDFItem::toPixmapItem() const pixmapItem->setPixmap(pixmap); pixmapItem->setPos(this->pos()); - pixmapItem->setZValue(this->zValue()); +// pixmapItem->setZValue(this->zValue()); + UBGraphicsItem::assignZValue(pixmapItem, this->zValue()); pixmapItem->setTransform(this->transform()); pixmapItem->setFlag(QGraphicsItem::ItemIsMovable, true); pixmapItem->setFlag(QGraphicsItem::ItemIsSelectable, true); diff --git a/src/domain/UBGraphicsPixmapItem.cpp b/src/domain/UBGraphicsPixmapItem.cpp index edffb90d..ceb4fd28 100644 --- a/src/domain/UBGraphicsPixmapItem.cpp +++ b/src/domain/UBGraphicsPixmapItem.cpp @@ -98,7 +98,8 @@ UBItem* UBGraphicsPixmapItem::deepCopy() const copy->setPixmap(this->pixmap()); copy->setPos(this->pos()); - copy->setZValue(this->zValue()); +// copy->setZValue(this->zValue()); + UBGraphicsItem::assignZValue(copy, this->zValue()); copy->setTransform(this->transform()); copy->setFlag(QGraphicsItem::ItemIsMovable, true); copy->setFlag(QGraphicsItem::ItemIsSelectable, true); diff --git a/src/domain/UBGraphicsPolygonItem.cpp b/src/domain/UBGraphicsPolygonItem.cpp index c8153ca4..d2e96e25 100644 --- a/src/domain/UBGraphicsPolygonItem.cpp +++ b/src/domain/UBGraphicsPolygonItem.cpp @@ -153,7 +153,9 @@ UBGraphicsPolygonItem* UBGraphicsPolygonItem::deepCopy(const QPolygonF& pol) con copy->setPen(this->pen()); copy->mHasAlpha = this->mHasAlpha; - copy->setZValue(this->zValue()); +// copy->setZValue(this->zValue()); + UBGraphicsItem::assignZValue(copy, this->zValue()); + copy->setColorOnDarkBackground(this->colorOnDarkBackground()); copy->setColorOnLightBackground(this->colorOnLightBackground()); diff --git a/src/domain/UBGraphicsScene.cpp b/src/domain/UBGraphicsScene.cpp index 476dd289..cbbbe593 100644 --- a/src/domain/UBGraphicsScene.cpp +++ b/src/domain/UBGraphicsScene.cpp @@ -75,6 +75,8 @@ qreal UBGraphicsScene::toolOffsetEraser = 200; qreal UBGraphicsScene::toolOffsetCurtain = 1000; qreal UBGraphicsScene::toolOffsetPointer = 1100; +qreal UBGraphicsScene::toolOffsetCache = 1000;//Didier please define offset you want + UBGraphicsScene::UBGraphicsScene(UBDocumentProxy* parent) : UBCoreGraphicsScene(parent) , mEraser(0) @@ -91,8 +93,10 @@ UBGraphicsScene::UBGraphicsScene(UBDocumentProxy* parent) , mCurrentStroke(0) , mShouldUseOMP(true) , mItemCount(0) + , enableUndoRedoStack(true) , magniferControlViewWidget(0) , magniferDisplayViewWidget(0) + { #ifdef __ppc__ @@ -137,6 +141,8 @@ UBGraphicsScene::UBGraphicsScene(UBDocumentProxy* parent) } connect(this, SIGNAL(selectionChanged()), this, SLOT(selectionChangedProcessing())); + + } UBGraphicsScene::~UBGraphicsScene() @@ -150,32 +156,28 @@ UBGraphicsScene::~UBGraphicsScene() void UBGraphicsScene::selectionChangedProcessing() { - -// if (selectedItems().count()) -// UBApplication::showMessage("ZValue is " + QString::number(selectedItems().first()->zValue(), 'f')); + if (selectedItems().count()) + UBApplication::showMessage("ZValue is " + QString::number(selectedItems().first()->zValue(), 'f')); QList allItemsList = items(); - for( int i = 0; i < allItemsList.size(); i++ ) - { + qreal maxZ = 0.; + for( int i = 0; i < allItemsList.size(); i++ ) { QGraphicsItem *nextItem = allItemsList.at(i); //Temporary stub. Due to ugly z-order implementation I need to do this (sankore 360) //z-order behavior should be reimplemented and this stub should be deleted if (nextItem == mBackgroundObject) continue; //Temporary stub end (sankore 360) -// qreal zValue = nextItem->zValue(); - nextItem->setZValue(qreal(1)); -// qDebug() << QString(" %1 ").arg(i) << QString(" %1 ").arg(zValue); + if (nextItem->zValue() > maxZ) + maxZ = nextItem->zValue(); + nextItem->setZValue(nextItem->data(UBGraphicsItemData::ItemOwnZValue).toReal()); +// nextItem->setZValue(qreal(1)); } - QList selItemsList = selectedItems(); - for( int i = 0; i < selItemsList.size(); i++ ) - { + for( int i = 0; i < selItemsList.size(); i++ ) { QGraphicsItem *nextItem = selItemsList.at(i); -// qreal zValue = nextItem->zValue(); - nextItem->setZValue(2); -// qDebug() << QString(" >>> %1 <<< ").arg(i) << QString(" >>> %1 <<< ").arg(zValue); + nextItem->setZValue(maxZ + 0.0001); } } @@ -373,10 +375,13 @@ bool UBGraphicsScene::inputDeviceRelease() if (mRemovedItems.size() > 0 || mAddedItems.size() > 0) { - UBGraphicsItemUndoCommand* udcmd = new UBGraphicsItemUndoCommand(this, mRemovedItems, mAddedItems); //deleted by the undoStack - if(UBApplication::undoStack) - UBApplication::undoStack->push(udcmd); + if (enableUndoRedoStack) { //should be deleted after scene own undo stack implemented + UBGraphicsItemUndoCommand* udcmd = new UBGraphicsItemUndoCommand(this, mRemovedItems, mAddedItems); //deleted by the undoStack + + if(UBApplication::undoStack) + UBApplication::undoStack->push(udcmd); + } mRemovedItems.clear(); mAddedItems.clear(); @@ -407,23 +412,23 @@ void UBGraphicsScene::drawEraser(const QPointF &pPoint, bool isFirstDraw) if(isFirstDraw) { + qreal maxZ = 0.; QList allItemsList = items(); for( int i = 0; i < allItemsList.size(); i++ ) { QGraphicsItem *nextItem = allItemsList.at(i); qreal zValue = nextItem->zValue(); - nextItem->setZValue(qreal(1)); - qDebug() << QString(" %1 ").arg(i) << QString(" %1 ").arg(zValue); + if (zValue > maxZ) + maxZ = zValue; + nextItem->setZValue(nextItem->data(UBGraphicsItemData::ItemOwnZValue).toReal()); } - mEraser->setZValue(2); + mEraser->setZValue(maxZ + 0.0001); mEraser->show(); } - } } - void UBGraphicsScene::drawPointer(const QPointF &pPoint, bool isFirstDraw) { qreal pointerDiameter = UBSettings::pointerDiameter / UBApplication::boardController->currentZoom(); @@ -439,19 +444,20 @@ void UBGraphicsScene::drawPointer(const QPointF &pPoint, bool isFirstDraw) if(isFirstDraw) { + qreal maxZ = 0.; QList allItemsList = items(); for( int i = 0; i < allItemsList.size(); i++ ) { QGraphicsItem *nextItem = allItemsList.at(i); qreal zValue = nextItem->zValue(); - nextItem->setZValue(qreal(1)); - qDebug() << QString(" %1 ").arg(i) << QString(" %1 ").arg(zValue); + if (zValue > maxZ) + maxZ = zValue; + nextItem->setZValue(nextItem->data(UBGraphicsItemData::ItemOwnZValue).toReal()); } - mPointer->setZValue(2); + mPointer->setZValue(maxZ + 0.0001); mPointer->show(); } - } } @@ -824,8 +830,8 @@ void UBGraphicsScene::initPolygonItem(UBGraphicsPolygonItem* polygonItem) polygonItem->setData(UBGraphicsItemData::ItemLayerType, QVariant(UBItemLayerType::Graphic)); - polygonItem->setZValue(getNextDrawingZIndex()); - +// polygonItem->setZValue(getNextDrawingZIndex()); + UBGraphicsItem::assignZValue(polygonItem, getNextDrawingZIndex()); } @@ -962,8 +968,11 @@ void UBGraphicsScene::clearItemsAndAnnotations() // force refresh, QT is a bit lazy and take a lot of time (nb item ^2 ?) to trigger repaint update(sceneRect()); - UBGraphicsItemUndoCommand* uc = new UBGraphicsItemUndoCommand(this, removedItems, emptyList); - UBApplication::undoStack->push(uc); + if (enableUndoRedoStack) { //should be deleted after scene own undo stack implemented + UBGraphicsItemUndoCommand* uc = new UBGraphicsItemUndoCommand(this, removedItems, emptyList); + UBApplication::undoStack->push(uc); + } + setDocumentUpdated(); } @@ -996,8 +1005,12 @@ void UBGraphicsScene::clearItems() // force refresh, QT is a bit lazy and take a lot of time (nb item ^2 ?) to trigger repaint update(sceneRect()); - UBGraphicsItemUndoCommand* uc = new UBGraphicsItemUndoCommand(this, removedItems, emptyList); - UBApplication::undoStack->push(uc); + + if (enableUndoRedoStack) { //should be deleted after scene own undo stack implemented + UBGraphicsItemUndoCommand* uc = new UBGraphicsItemUndoCommand(this, removedItems, emptyList); + UBApplication::undoStack->push(uc); + } + setDocumentUpdated(); } @@ -1023,8 +1036,12 @@ void UBGraphicsScene::clearAnnotations() // force refresh, QT is a bit lazy and take a lot of time (nb item ^2 ?) to trigger repaint update(sceneRect()); - UBGraphicsItemUndoCommand* uc = new UBGraphicsItemUndoCommand(this, removedItems, emptyList); - UBApplication::undoStack->push(uc); + + if (enableUndoRedoStack) { //should be deleted after scene own undo stack implemented + UBGraphicsItemUndoCommand* uc = new UBGraphicsItemUndoCommand(this, removedItems, emptyList); + UBApplication::undoStack->push(uc); + } + setDocumentUpdated(); } @@ -1035,7 +1052,8 @@ UBGraphicsPixmapItem* UBGraphicsScene::addPixmap(const QPixmap& pPixmap, const Q pixmapItem->setFlag(QGraphicsItem::ItemIsMovable, true); pixmapItem->setFlag(QGraphicsItem::ItemIsSelectable, true); - pixmapItem->setZValue(getNextObjectZIndex()); +// pixmapItem->setZValue(getNextObjectZIndex()); + UBGraphicsItem::assignZValue(pixmapItem, getNextObjectZIndex()); pixmapItem->setPixmap(pPixmap); @@ -1044,8 +1062,10 @@ UBGraphicsPixmapItem* UBGraphicsScene::addPixmap(const QPixmap& pPixmap, const Q addItem(pixmapItem); - UBGraphicsItemUndoCommand* uc = new UBGraphicsItemUndoCommand(this, 0, pixmapItem); - UBApplication::undoStack->push(uc); + if (enableUndoRedoStack) { //should be deleted after scene own undo stack implemented + UBGraphicsItemUndoCommand* uc = new UBGraphicsItemUndoCommand(this, 0, pixmapItem); + UBApplication::undoStack->push(uc); + } pixmapItem->scale(pScaleFactor, pScaleFactor); @@ -1070,8 +1090,10 @@ UBGraphicsPixmapItem* UBGraphicsScene::addPixmap(const QPixmap& pPixmap, const Q void UBGraphicsScene::textUndoCommandAdded(UBGraphicsTextItem *textItem) { - UBGraphicsTextItemUndoCommand* uc = new UBGraphicsTextItemUndoCommand(textItem); - UBApplication::undoStack->push(uc); + if (enableUndoRedoStack) { //should be deleted after scene own undo stack implemented + UBGraphicsTextItemUndoCommand* uc = new UBGraphicsTextItemUndoCommand(textItem); + UBApplication::undoStack->push(uc); + } } @@ -1083,14 +1105,17 @@ UBGraphicsVideoItem* UBGraphicsScene::addVideo(const QUrl& pVideoFileUrl, bool s videoItem->setFlag(QGraphicsItem::ItemIsMovable, true); videoItem->setFlag(QGraphicsItem::ItemIsSelectable, true); - videoItem->setZValue(getNextObjectZIndex()); +// videoItem->setZValue(getNextObjectZIndex()); + UBGraphicsItem::assignZValue(videoItem, getNextObjectZIndex()); addItem(videoItem); videoItem->show(); - UBGraphicsItemUndoCommand* uc = new UBGraphicsItemUndoCommand(this, 0, videoItem); - UBApplication::undoStack->push(uc); + if (enableUndoRedoStack) { //should be deleted after scene own undo stack implemented + UBGraphicsItemUndoCommand* uc = new UBGraphicsItemUndoCommand(this, 0, videoItem); + UBApplication::undoStack->push(uc); + } videoItem->mediaObject()->play(); @@ -1113,14 +1138,17 @@ UBGraphicsAudioItem* UBGraphicsScene::addAudio(const QUrl& pAudioFileUrl, bool s audioItem->setFlag(QGraphicsItem::ItemIsMovable, true); audioItem->setFlag(QGraphicsItem::ItemIsSelectable, true); - audioItem->setZValue(getNextObjectZIndex()); +// audioItem->setZValue(getNextObjectZIndex()); + UBGraphicsItem::assignZValue(audioItem, getNextObjectZIndex()); addItem(audioItem); audioItem->show(); - UBGraphicsItemUndoCommand* uc = new UBGraphicsItemUndoCommand(this, 0, audioItem); - UBApplication::undoStack->push(uc); + if (enableUndoRedoStack) { //should be deleted after scene own undo stack implemented + UBGraphicsItemUndoCommand* uc = new UBGraphicsItemUndoCommand(this, 0, audioItem); + UBApplication::undoStack->push(uc); + } audioItem->mediaObject()->play(); @@ -1178,7 +1206,8 @@ UBGraphicsW3CWidgetItem* UBGraphicsScene::addW3CWidget(const QUrl& pWidgetUrl, c void UBGraphicsScene::addGraphicsWidget(UBGraphicsWidgetItem* graphicsWidget, const QPointF& pPos) { graphicsWidget->setFlag(QGraphicsItem::ItemIsSelectable, true); - graphicsWidget->setZValue(getNextObjectZIndex()); +// graphicsWidget->setZValue(getNextObjectZIndex()); + UBGraphicsItem::assignZValue(graphicsWidget, getNextObjectZIndex()); addItem(graphicsWidget); @@ -1194,8 +1223,10 @@ void UBGraphicsScene::addGraphicsWidget(UBGraphicsWidgetItem* graphicsWidget, co // graphicsWidget->widgetWebView()->loadMainHtml(); graphicsWidget->setSelected(true); - UBGraphicsItemUndoCommand* uc = new UBGraphicsItemUndoCommand(this, 0, graphicsWidget); - UBApplication::undoStack->push(uc); + if (enableUndoRedoStack) { //should be deleted after scene own undo stack implemented + UBGraphicsItemUndoCommand* uc = new UBGraphicsItemUndoCommand(this, 0, graphicsWidget); + UBApplication::undoStack->push(uc); + } setDocumentUpdated(); } @@ -1238,7 +1269,8 @@ UBGraphicsSvgItem* UBGraphicsScene::addSvg(const QUrl& pSvgFileUrl, const QPoint svgItem->setFlag(QGraphicsItem::ItemIsMovable, true); svgItem->setFlag(QGraphicsItem::ItemIsSelectable, true); - svgItem->setZValue(getNextObjectZIndex()); +// svgItem->setZValue(getNextObjectZIndex()); + UBGraphicsItem::assignZValue(svgItem, getNextObjectZIndex()); qreal sscale = 1 / UBApplication::boardController->systemScaleFactor(); svgItem->scale(sscale, sscale); @@ -1249,8 +1281,10 @@ UBGraphicsSvgItem* UBGraphicsScene::addSvg(const QUrl& pSvgFileUrl, const QPoint addItem(svgItem); - UBGraphicsItemUndoCommand* uc = new UBGraphicsItemUndoCommand(this, 0, svgItem); - UBApplication::undoStack->push(uc); + if (enableUndoRedoStack) { //should be deleted after scene own undo stack implemented + UBGraphicsItemUndoCommand* uc = new UBGraphicsItemUndoCommand(this, 0, svgItem); + UBApplication::undoStack->push(uc); + } setDocumentUpdated(); @@ -1271,7 +1305,8 @@ UBGraphicsTextItem* UBGraphicsScene::addTextWithFont(const QString& pString, con { UBGraphicsTextItem *textItem = new UBGraphicsTextItem(); textItem->setPlainText(pString); - textItem->setZValue(getNextObjectZIndex()); +// textItem->setZValue(getNextObjectZIndex()); + UBGraphicsItem::assignZValue(textItem, getNextObjectZIndex()); QFont font = textItem->font(); @@ -1309,8 +1344,10 @@ UBGraphicsTextItem* UBGraphicsScene::addTextWithFont(const QString& pString, con textItem->show(); - UBGraphicsItemUndoCommand* uc = new UBGraphicsItemUndoCommand(this, 0, textItem); - UBApplication::undoStack->push(uc); + if (enableUndoRedoStack) { //should be deleted after scene own undo stack implemented + UBGraphicsItemUndoCommand* uc = new UBGraphicsItemUndoCommand(this, 0, textItem); + UBApplication::undoStack->push(uc); + } connect(textItem, SIGNAL(textUndoCommandAdded(UBGraphicsTextItem *)), this, SLOT(textUndoCommandAdded(UBGraphicsTextItem *))); @@ -1326,18 +1363,20 @@ UBGraphicsTextItem *UBGraphicsScene::addTextHtml(const QString &pString, const Q UBGraphicsTextItem *textItem = new UBGraphicsTextItem(); textItem->setPlainText(""); textItem->setHtml(pString); - textItem->setZValue(getNextObjectZIndex()); +// textItem->setZValue(getNextObjectZIndex()); + UBGraphicsItem::assignZValue(textItem, getNextObjectZIndex()); addItem(textItem); textItem->show(); - UBGraphicsItemUndoCommand* uc = new UBGraphicsItemUndoCommand(this, 0, textItem); - UBApplication::undoStack->push(uc); + if (enableUndoRedoStack) { //should be deleted after scene own undo stack implemented + UBGraphicsItemUndoCommand* uc = new UBGraphicsItemUndoCommand(this, 0, textItem); + UBApplication::undoStack->push(uc); + } connect(textItem, SIGNAL(textUndoCommandAdded(UBGraphicsTextItem *)), this, SLOT(textUndoCommandAdded(UBGraphicsTextItem *))); -// textItem->setSelected(true); textItem->setFocus(); setDocumentUpdated(); @@ -1425,7 +1464,8 @@ QGraphicsItem* UBGraphicsScene::setAsBackgroundObject(QGraphicsItem* item, bool item->setAcceptedMouseButtons(Qt::NoButton); item->setData(UBGraphicsItemData::ItemLayerType, UBItemLayerType::FixedBackground); - item->setZValue(backgroundLayerStart); +// item->setZValue(backgroundLayerStart); + UBGraphicsItem::assignZValue(item, backgroundLayerStart); if (pAdaptTransformation) { @@ -1529,7 +1569,9 @@ void UBGraphicsScene::addRuler(QPointF center) QRectF rect = ruler->rect(); ruler->setRect(center.x() - rect.width()/2, center.y() - rect.height()/2, rect.width(), rect.height()); - ruler->setZValue(toolLayerStart + toolOffsetRuler); +// ruler->setZValue(toolLayerStart + toolOffsetRuler); + UBGraphicsItem::assignZValue(ruler, toolLayerStart + toolOffsetRuler); + ruler->setData(UBGraphicsItemData::ItemLayerType, QVariant(UBItemLayerType::Tool)); addItem(ruler); @@ -1546,7 +1588,9 @@ void UBGraphicsScene::addProtractor(QPointF center) UBGraphicsProtractor* protractor = new UBGraphicsProtractor(); // mem : owned and destroyed by the scene mTools << protractor; - protractor->setZValue(toolLayerStart + toolOffsetProtractor); +// protractor->setZValue(toolLayerStart + toolOffsetProtractor); + UBGraphicsItem::assignZValue(protractor, toolLayerStart + toolOffsetProtractor); + protractor->setData(UBGraphicsItemData::ItemLayerType, QVariant(UBItemLayerType::Tool)); addItem(protractor); @@ -1565,7 +1609,9 @@ void UBGraphicsScene::addTriangle(QPointF center) UBGraphicsTriangle* triangle = new UBGraphicsTriangle(); // mem : owned and destroyed by the scene mTools << triangle; - triangle->setZValue(toolLayerStart + toolOffsetProtractor); +// triangle->setZValue(toolLayerStart + toolOffsetProtractor); + UBGraphicsItem::assignZValue(triangle, toolLayerStart + toolOffsetTriangle); + triangle->setData(UBGraphicsItemData::ItemLayerType, QVariant(UBItemLayerType::Tool)); addItem(triangle); @@ -1586,8 +1632,6 @@ void UBGraphicsScene::addMagnifier(UBMagnifierParams params) QGraphicsView *cView = (QGraphicsView*)UBApplication::boardController->controlView(); QGraphicsView *dView = (QGraphicsView*)UBApplication::boardController->displayView(); - QPoint ccZeroPoint = cContainer->mapToGlobal(QPoint(0,0)); - QPoint cvZeroPoint = cView->mapToGlobal(QPoint(0,0)); QPoint dvZeroPoint = dView->mapToGlobal(QPoint(0,0)); int cvW = cView->width(); @@ -1635,8 +1679,6 @@ void UBGraphicsScene::moveMagnifier(QPoint newPos) QGraphicsView *cView = (QGraphicsView*)UBApplication::boardController->controlView(); QGraphicsView *dView = (QGraphicsView*)UBApplication::boardController->displayView(); - QPoint ccZeroPoint = cContainer->mapToGlobal(QPoint(0,0)); - QPoint cvZeroPoint = cView->mapToGlobal(QPoint(0,0)); QPoint dvZeroPoint = dView->mapToGlobal(QPoint(0,0)); int cvW = cView->width(); @@ -1700,7 +1742,9 @@ void UBGraphicsScene::addCompass(QPointF center) QRectF rect = compass->rect(); compass->setRect(center.x() - rect.width() / 2, center.y() - rect.height() / 2, rect.width(), rect.height()); - compass->setZValue(toolLayerStart + toolOffsetCompass); +// compass->setZValue(toolLayerStart + toolOffsetCompass); + UBGraphicsItem::assignZValue(compass, toolLayerStart + toolOffsetCompass); + compass->setData(UBGraphicsItemData::ItemLayerType, QVariant(UBItemLayerType::Tool)); compass->setVisible(true); @@ -1711,16 +1755,7 @@ void UBGraphicsScene::addCache() { UBGraphicsCache* cache = new UBGraphicsCache(); mTools << cache; - QGraphicsView* view; - if(UBApplication::applicationController->displayManager()->hasDisplay()) - { - view = (QGraphicsView*)(UBApplication::boardController->displayView()); - } - else - { - view = (QGraphicsView*)(UBApplication::boardController->controlView()); - } addItem(cache); cache->setVisible(true); cache->setSelected(true); @@ -1740,7 +1775,10 @@ void UBGraphicsScene::addMask() view = (QGraphicsView*)UBApplication::boardController->controlView(); QPolygonF polygon = view->mapToScene(view->rect()); - curtain->setZValue(toolLayerStart + toolOffsetCurtain); + +// curtain->setZValue(toolLayerStart + toolOffsetCurtain); + UBGraphicsItem::assignZValue(curtain, toolLayerStart + toolOffsetCurtain); + QRectF rect = polygon.boundingRect(); qreal xScale = view->matrix().m11(); qreal yScale = view->matrix().m22(); diff --git a/src/domain/UBGraphicsScene.h b/src/domain/UBGraphicsScene.h index f4364e34..416c2344 100644 --- a/src/domain/UBGraphicsScene.h +++ b/src/domain/UBGraphicsScene.h @@ -55,6 +55,8 @@ class UBGraphicsScene: public UBCoreGraphicsScene, public UBItem Q_OBJECT public: + // tmp stub for divide addings scene objects from undo mechanism implementation + void setURStackEnable(bool set = true) {enableUndoRedoStack = set;} UBGraphicsScene(UBDocumentProxy *parent); virtual ~UBGraphicsScene(); @@ -363,8 +365,13 @@ class UBGraphicsScene: public UBCoreGraphicsScene, public UBItem //int mMesure1Ms, mMesure2Ms; bool mHasCache; + // tmp stub for divide addings scene objects from undo mechanism implementation + bool enableUndoRedoStack; + UBMagnifier *magniferControlViewWidget; UBMagnifier *magniferDisplayViewWidget; + + }; #endif /* UBGRAPHICSSCENE_H_ */ diff --git a/src/domain/UBGraphicsSvgItem.cpp b/src/domain/UBGraphicsSvgItem.cpp index cfd3509a..9d8798ec 100644 --- a/src/domain/UBGraphicsSvgItem.cpp +++ b/src/domain/UBGraphicsSvgItem.cpp @@ -132,7 +132,8 @@ UBItem* UBGraphicsSvgItem::deepCopy() const UBGraphicsSvgItem* copy = new UBGraphicsSvgItem(this->fileData()); copy->setPos(this->pos()); - copy->setZValue(this->zValue()); +// copy->setZValue(this->zValue()); + UBGraphicsItem::assignZValue(copy, this->zValue()); copy->setTransform(this->transform()); copy->setFlag(QGraphicsItem::ItemIsMovable, true); copy->setFlag(QGraphicsItem::ItemIsSelectable, true); @@ -186,7 +187,8 @@ UBGraphicsPixmapItem* UBGraphicsSvgItem::toPixmapItem() const pixmapItem->setPixmap(QPixmap::fromImage(image)); pixmapItem->setPos(this->pos()); - pixmapItem->setZValue(this->zValue()); +// pixmapItem->setZValue(this->zValue()); + UBGraphicsItem::assignZValue(pixmapItem, this->zValue()); pixmapItem->setTransform(this->transform()); pixmapItem->setFlag(QGraphicsItem::ItemIsMovable, true); pixmapItem->setFlag(QGraphicsItem::ItemIsSelectable, true); diff --git a/src/domain/UBGraphicsTextItem.cpp b/src/domain/UBGraphicsTextItem.cpp index 8770a435..0d01527a 100644 --- a/src/domain/UBGraphicsTextItem.cpp +++ b/src/domain/UBGraphicsTextItem.cpp @@ -205,7 +205,8 @@ UBItem* UBGraphicsTextItem::deepCopy() const copy->setHtml(toHtml()); copy->setPos(this->pos()); - copy->setZValue(this->zValue()); +// copy->setZValue(this->zValue()); + UBGraphicsItem::assignZValue(copy, this->zValue()); copy->setTransform(this->transform()); copy->setFlag(QGraphicsItem::ItemIsMovable, true); copy->setFlag(QGraphicsItem::ItemIsSelectable, true); diff --git a/src/domain/UBGraphicsTextItemUndoCommand.h b/src/domain/UBGraphicsTextItemUndoCommand.h index 0198d8b5..9f9a610a 100644 --- a/src/domain/UBGraphicsTextItemUndoCommand.h +++ b/src/domain/UBGraphicsTextItemUndoCommand.h @@ -17,16 +17,19 @@ #define UBGRAPHICSTEXTITEMUNDOCOMMAND_H_ #include +#include "UBAbstractUndoCommand.h" #include "UBGraphicsTextItem.h" -class UBGraphicsTextItemUndoCommand: public QUndoCommand +class UBGraphicsTextItemUndoCommand : public UBAbstractUndoCommand { public: UBGraphicsTextItemUndoCommand(UBGraphicsTextItem *textItem); virtual ~UBGraphicsTextItemUndoCommand(); + virtual UndoType getType() { return undotype_GRAPHICTEXTITEM; }; + protected: virtual void undo(); virtual void redo(); diff --git a/src/domain/UBGraphicsVideoItem.cpp b/src/domain/UBGraphicsVideoItem.cpp index 841667cf..c1e57e4d 100644 --- a/src/domain/UBGraphicsVideoItem.cpp +++ b/src/domain/UBGraphicsVideoItem.cpp @@ -68,7 +68,8 @@ UBItem* UBGraphicsVideoItem::deepCopy() const UBGraphicsVideoItem *copy = new UBGraphicsVideoItem(videoUrl, parentItem()); copy->setPos(this->pos()); - copy->setZValue(this->zValue()); +// copy->setZValue(this->zValue()); + UBGraphicsItem::assignZValue(copy, this->zValue()); copy->setTransform(this->transform()); copy->setFlag(QGraphicsItem::ItemIsMovable, true); copy->setFlag(QGraphicsItem::ItemIsSelectable, true); diff --git a/src/domain/UBGraphicsVideoItemDelegate.cpp b/src/domain/UBGraphicsVideoItemDelegate.cpp index 429194b0..99ba687b 100644 --- a/src/domain/UBGraphicsVideoItemDelegate.cpp +++ b/src/domain/UBGraphicsVideoItemDelegate.cpp @@ -52,7 +52,8 @@ void UBGraphicsVideoItemDelegate::buildButtons() mMuteButton->hide(); mVideoControl = new DelegateVideoControl(delegated(), mFrame); - mVideoControl->setZValue(UBGraphicsScene::toolLayerStart + 2); +// mVideoControl->setZValue(UBGraphicsScene::toolLayerStart + 2); + UBGraphicsItem::assignZValue(mVideoControl, UBGraphicsScene::toolLayerStart + 2); mVideoControl->setFlag(QGraphicsItem::ItemIsSelectable, true); connect(mPlayPauseButton, SIGNAL(clicked(bool)), this, SLOT(togglePlayPause())); diff --git a/src/domain/UBGraphicsWidgetItem.cpp b/src/domain/UBGraphicsWidgetItem.cpp index b1246f2a..a786e55a 100644 --- a/src/domain/UBGraphicsWidgetItem.cpp +++ b/src/domain/UBGraphicsWidgetItem.cpp @@ -366,7 +366,8 @@ UBItem* UBGraphicsW3CWidgetItem::deepCopy() const UBGraphicsW3CWidgetItem *copy = new UBGraphicsW3CWidgetItem(mWebKitWidget->widgetUrl(), parentItem()); copy->setPos(this->pos()); - copy->setZValue(this->zValue()); +// copy->setZValue(this->zValue()); + UBGraphicsItem::assignZValue(copy, this->zValue()); copy->setTransform(this->transform()); copy->setFlag(QGraphicsItem::ItemIsMovable, true); copy->setFlag(QGraphicsItem::ItemIsSelectable, true); diff --git a/src/domain/UBItem.cpp b/src/domain/UBItem.cpp index 4a3e1643..3e6f68cf 100644 --- a/src/domain/UBItem.cpp +++ b/src/domain/UBItem.cpp @@ -28,3 +28,9 @@ UBItem::~UBItem() { // NOOP } + +void UBGraphicsItem::assignZValue(QGraphicsItem *item, int value) +{ + item->setZValue(value); + item->setData(UBGraphicsItemData::ItemOwnZValue, value); +} diff --git a/src/domain/UBItem.h b/src/domain/UBItem.h index 328a3c37..7ae29988 100644 --- a/src/domain/UBItem.h +++ b/src/domain/UBItem.h @@ -100,6 +100,7 @@ protected: public: + static void assignZValue(QGraphicsItem*, int value); virtual UBGraphicsItemDelegate *Delegate() const = 0; virtual void remove() = 0; diff --git a/src/domain/UBPageSizeUndoCommand.h b/src/domain/UBPageSizeUndoCommand.h index 78cf98b8..ad295d49 100644 --- a/src/domain/UBPageSizeUndoCommand.h +++ b/src/domain/UBPageSizeUndoCommand.h @@ -17,16 +17,19 @@ #define UBPageSizeUndoCommand_H_ #include +#include "UBAbstractUndoCommand.h" class UBGraphicsScene; -class UBPageSizeUndoCommand : public QUndoCommand +class UBPageSizeUndoCommand : public UBAbstractUndoCommand { public: UBPageSizeUndoCommand(UBGraphicsScene* pScene, const QSize& previousSize, const QSize& newSize); virtual ~UBPageSizeUndoCommand(); + virtual UndoType getType() { return undotype_PAGESIZE; }; + protected: virtual void undo(); virtual void redo(); diff --git a/src/domain/domain.pri b/src/domain/domain.pri index fbff6174..e3653576 100644 --- a/src/domain/domain.pri +++ b/src/domain/domain.pri @@ -21,7 +21,8 @@ HEADERS += src/domain/UBGraphicsScene.h \ src/domain/UBGraphicsStroke.h \ src/domain/UBGraphicsMediaItem.h \ src/domain/UBGraphicsAudioItem.h \ - src/domain/UBGraphicsAudioItemDelegate.h + src/domain/UBGraphicsAudioItemDelegate.h \ + src/domain/UBAbstractUndoCommand.h HEADERS += src/domain/UBGraphicsItemDelegate.h \ src/domain/UBGraphicsVideoItemDelegate.h \ @@ -52,7 +53,8 @@ SOURCES += src/domain/UBGraphicsScene.cpp \ src/domain/UBGraphicsStroke.cpp \ src/domain/UBGraphicsMediaItem.cpp \ src/domain/UBGraphicsAudioItem.cpp \ - src/domain/UBGraphicsAudioItemDelegate.cpp + src/domain/UBGraphicsAudioItemDelegate.cpp \ + src/domain/UBAbstractUndoCommand.cpp SOURCES += src/domain/UBGraphicsItemDelegate.cpp \ src/domain/UBGraphicsVideoItemDelegate.cpp \ diff --git a/src/frameworks/UBCoreGraphicsScene.cpp b/src/frameworks/UBCoreGraphicsScene.cpp index 4412f9b1..bcac6202 100644 --- a/src/frameworks/UBCoreGraphicsScene.cpp +++ b/src/frameworks/UBCoreGraphicsScene.cpp @@ -53,3 +53,16 @@ void UBCoreGraphicsScene::removeItem(QGraphicsItem* item, bool forceDelete) delete item; } } + +bool UBCoreGraphicsScene::deleteItem(QGraphicsItem* item) +{ + if(mItemsToDelete.contains(item)) + { + mItemsToDelete.remove(item); + delete item; + return true; + } + else + return false; +} + diff --git a/src/frameworks/UBCoreGraphicsScene.h b/src/frameworks/UBCoreGraphicsScene.h index fdeaae49..656f2a00 100644 --- a/src/frameworks/UBCoreGraphicsScene.h +++ b/src/frameworks/UBCoreGraphicsScene.h @@ -28,6 +28,9 @@ class UBCoreGraphicsScene : public QGraphicsScene virtual void removeItem(QGraphicsItem* item, bool forceDelete = false); + virtual bool deleteItem(QGraphicsItem* item); + + private: QSet mItemsToDelete; }; diff --git a/src/frameworks/UBDesktopServices.h b/src/frameworks/UBDesktopServices.h deleted file mode 100644 index 0e7c3dc9..00000000 --- a/src/frameworks/UBDesktopServices.h +++ /dev/null @@ -1,34 +0,0 @@ -/* - * 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 . - */ - -#ifndef UBDESKTOPSERVICES_H_ -#define UBDESKTOPSERVICES_H_ - -#include -#include - -#include "core/memcheck.h" - -// TODO Qt 4.6 #error Delete this UBDesktopServices class, -// it was used to work around a bug in Qt 4.4 that was fixed in Qt 4.5 and another that should be fixed -// in 4.5.1 - -class UBDesktopServices : public QDesktopServices -{ - public: - static QString storageLocation(StandardLocation type); -}; - -#endif /* UBDESKTOPSERVICES_H_ */ diff --git a/src/frameworks/UBDesktopServices_mac.cpp b/src/frameworks/UBDesktopServices_mac.cpp deleted file mode 100644 index a2b9a019..00000000 --- a/src/frameworks/UBDesktopServices_mac.cpp +++ /dev/null @@ -1,103 +0,0 @@ -/* - * 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 . - */ - -#include "UBDesktopServices.h" - -#include - -#import - -/* - Translates a QDesktopServices::StandardLocation into the mac equivalent. -*/ -OSType translateLocation(QDesktopServices::StandardLocation type) -{ - switch (type) { - case QDesktopServices::DesktopLocation: - return kDesktopFolderType; break; - - case QDesktopServices::DocumentsLocation: - return kDocumentsFolderType; break; - - case QDesktopServices::FontsLocation: - // There are at least two different font directories on the mac: /Library/Fonts and ~/Library/Fonts. - // To select a specific one we have to specify a different first parameter when calling FSFindFolder. - return kFontsFolderType; break; - - case QDesktopServices::ApplicationsLocation: - return kApplicationsFolderType; break; - - case QDesktopServices::MusicLocation: - return kMusicDocumentsFolderType; break; - - case QDesktopServices::MoviesLocation: - return kMovieDocumentsFolderType; break; - - case QDesktopServices::PicturesLocation: - return kPictureDocumentsFolderType; break; - - case QDesktopServices::TempLocation: - return kTemporaryFolderType; break; - - case QDesktopServices::DataLocation: - return kApplicationSupportFolderType; break; - - case QDesktopServices::CacheLocation: - return kCachedDataFolderType; break; - - default: - return kDesktopFolderType; break; - } -} - -/* - Constructs a full unicode path from a FSRef. -*/ -static QString getFullPath(const FSRef &ref) -{ - QByteArray ba(2048, 0); - if (FSRefMakePath(&ref, reinterpret_cast(ba.data()), ba.size()) == noErr) - return QString::fromUtf8(ba).normalized(QString::NormalizationForm_C); - return QString(); -} - -// Mac OS X implementation of QDesktopServices is bugged in Qt 4.4, -// we use the implementation inspired from Qt 4.5 snapshot -QString UBDesktopServices::storageLocation(StandardLocation type) -{ - if (QDesktopServices::HomeLocation == type) - return QDir::homePath(); - else if (QDesktopServices::TempLocation == type) - return QDir::tempPath(); - - short domain = kOnAppropriateDisk; - - if (QDesktopServices::DataLocation == type || QDesktopServices::CacheLocation == type) - domain = kUserDomain; - - // http://developer.apple.com/documentation/Carbon/Reference/Folder_Manager/Reference/reference.html - FSRef ref; - OSErr err = FSFindFolder(domain, translateLocation(type), false, &ref); - if (err) - return QString(); - - QString path = getFullPath(ref); - - if (QDesktopServices::DataLocation == type || QDesktopServices::CacheLocation == type) - path += "/Sankore/Sankore"; - - return path; -} - diff --git a/src/frameworks/UBDesktopServices_win.cpp b/src/frameworks/UBDesktopServices_win.cpp deleted file mode 100644 index d92fa1e7..00000000 --- a/src/frameworks/UBDesktopServices_win.cpp +++ /dev/null @@ -1,23 +0,0 @@ -/* - * 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 . - */ - -#include "UBDesktopServices.h" -#include "core/memcheck.h" - -QString UBDesktopServices::storageLocation(StandardLocation type) -{ - // Windows implementation of QDesktopServices is fine - return QDesktopServices::storageLocation(type); -} diff --git a/src/frameworks/UBFileSystemUtils.cpp b/src/frameworks/UBFileSystemUtils.cpp index 1c315dfe..1cd8e27e 100644 --- a/src/frameworks/UBFileSystemUtils.cpp +++ b/src/frameworks/UBFileSystemUtils.cpp @@ -14,7 +14,6 @@ */ #include "UBFileSystemUtils.h" -#include "UBDesktopServices.h" #include @@ -57,12 +56,12 @@ bool UBFileSystemUtils::isAZipFile(QString &filePath) QString UBFileSystemUtils::defaultTempDirPath() { - return UBDesktopServices::storageLocation(QDesktopServices::TempLocation) + "/" + defaultTempDirName(); + return QDesktopServices::storageLocation(QDesktopServices::TempLocation) + "/" + defaultTempDirName(); } QString UBFileSystemUtils::createTempDir(const QString& templateString, bool autoDeleteOnExit) { - QString appTempDir = UBDesktopServices::storageLocation(QDesktopServices::TempLocation) + QString appTempDir = QDesktopServices::storageLocation(QDesktopServices::TempLocation) + "/" + templateString; int index = 0; @@ -127,7 +126,7 @@ void UBFileSystemUtils::deleteAllTempDirCreatedDuringSession() void UBFileSystemUtils::cleanupGhostTempFolders(const QString& templateString) { - QDir dir(UBDesktopServices::storageLocation(QDesktopServices::TempLocation)); + QDir dir(QDesktopServices::storageLocation(QDesktopServices::TempLocation)); foreach (QFileInfo dirContent, dir.entryInfoList(QDir::Dirs | QDir::NoDotAndDotDot | QDir::Hidden , QDir::Name)) { diff --git a/src/frameworks/frameworks.pri b/src/frameworks/frameworks.pri index e38a9aa1..4a53c6aa 100644 --- a/src/frameworks/frameworks.pri +++ b/src/frameworks/frameworks.pri @@ -1,46 +1,45 @@ - -HEADERS += src/frameworks/UBGeometryUtils.h \ - src/frameworks/UBDesktopServices.h \ - src/frameworks/UBPlatformUtils.h \ - src/frameworks/UBFileSystemUtils.h \ - src/frameworks/UBStringUtils.h \ - src/frameworks/UBVersion.h \ - src/frameworks/UBCoreGraphicsScene.h \ - src/frameworks/UBCryptoUtils.h \ - src/frameworks/UBBase32.h - -SOURCES += src/frameworks/UBGeometryUtils.cpp \ - src/frameworks/UBPlatformUtils.cpp \ - src/frameworks/UBFileSystemUtils.cpp \ - src/frameworks/UBStringUtils.cpp \ - src/frameworks/UBVersion.cpp \ - src/frameworks/UBCoreGraphicsScene.cpp \ - src/frameworks/UBCryptoUtils.cpp \ - src/frameworks/UBBase32.cpp - - -win32 { - - SOURCES += src/frameworks/UBPlatformUtils_win.cpp \ - src/frameworks/UBDesktopServices_win.cpp -} - - -macx { - - SOURCES += src/frameworks/UBPlatformUtils_mac.mm \ - src/frameworks/UBDesktopServices_mac.cpp - -} - - -linux-g++ { - - SOURCES += src/frameworks/UBPlatformUtils_linux.cpp \ - src/frameworks/UBDesktopServices_linux.cpp -} -linux-g++-32 { - - SOURCES += src/frameworks/UBPlatformUtils_linux.cpp \ - src/frameworks/UBDesktopServices_linux.cpp -} + +HEADERS += src/frameworks/UBGeometryUtils.h \ + src/frameworks/UBPlatformUtils.h \ + src/frameworks/UBFileSystemUtils.h \ + src/frameworks/UBStringUtils.h \ + src/frameworks/UBVersion.h \ + src/frameworks/UBCoreGraphicsScene.h \ + src/frameworks/UBCryptoUtils.h \ + src/frameworks/UBBase32.h + +SOURCES += src/frameworks/UBGeometryUtils.cpp \ + src/frameworks/UBPlatformUtils.cpp \ + src/frameworks/UBFileSystemUtils.cpp \ + src/frameworks/UBStringUtils.cpp \ + src/frameworks/UBVersion.cpp \ + src/frameworks/UBCoreGraphicsScene.cpp \ + src/frameworks/UBCryptoUtils.cpp \ + src/frameworks/UBBase32.cpp + + +win32 { + + SOURCES += src/frameworks/UBPlatformUtils_win.cpp +} + + +macx { + + SOURCES += src/frameworks/UBPlatformUtils_mac.mm + +} + + +linux-g++ { + + SOURCES += src/frameworks/UBPlatformUtils_linux.cpp +} +linux-g++-32 { + + SOURCES += src/frameworks/UBPlatformUtils_linux.cpp +} +linux-g++-64 { + + SOURCES += src/frameworks/UBPlatformUtils_linux.cpp +} diff --git a/src/gui/UBActionPalette.cpp b/src/gui/UBActionPalette.cpp index c5cd1ea6..9647590e 100644 --- a/src/gui/UBActionPalette.cpp +++ b/src/gui/UBActionPalette.cpp @@ -306,9 +306,5 @@ UBActionPaletteButton* UBActionPalette::getButtonFromAction(QAction *action) bool UBActionPaletteButton::hitButton(const QPoint &pos) const { Q_UNUSED(pos); -// if(isChecked()) -// { -// return false; -// } return true; } diff --git a/src/gui/UBDockPalette.cpp b/src/gui/UBDockPalette.cpp index 8707d6ca..ef6b0344 100644 --- a/src/gui/UBDockPalette.cpp +++ b/src/gui/UBDockPalette.cpp @@ -41,6 +41,7 @@ UBDockPalette::UBDockPalette(QWidget *parent, const char *name) , mpStackWidget(NULL) , mpLayout(NULL) , mCurrentTab(0) + , mTabPalette(new UBTabDockPalete(this, parent)) { setObjectName(name); @@ -54,7 +55,7 @@ UBDockPalette::UBDockPalette(QWidget *parent, const char *name) mTabWidgets.clear(); // We let 2 pixels in order to keep a small border for the resizing - setMinimumWidth(2*border() + 2); + setMinimumWidth(/*2*border() + 2*/0); if (parent) { @@ -93,6 +94,10 @@ UBDockPalette::~UBDockPalette() delete mpLayout; mpLayout = NULL; } + if (NULL != mTabPalette) { + delete mTabPalette; + mTabPalette = NULL; + } } /** @@ -123,139 +128,139 @@ void UBDockPalette::setOrientation(eUBDockOrientation orientation) setMaximumWidth(parentWidget()->width()); setMinimumWidth(maximumWidth()); } - } /** * \brief Handle the mouse move event * @param as the mouse event */ -void UBDockPalette::mouseMoveEvent(QMouseEvent *event) -{ - QPoint p = event->pos(); - - if(mCanResize && ((mMousePressPos - p).manhattanLength() > QApplication::startDragDistance())) - { - switch(mOrientation) - { - case eUBDockOrientation_Left: - if(p.x() < collapseWidth() && p.x() >= minimumWidth()) - { - resize(border(), height()); - mLastWidth = collapseWidth() + 1; - mResized = true; - } - else if(p.x() <= maximumWidth() && p.x() >= minimumWidth()) - { - resize(p.x(), height()); - mResized = true; - } - break; - case eUBDockOrientation_Right: - if((this->x() + p.x() > parentWidget()->width() - collapseWidth()) && (this->x() + p.x() < parentWidget()->width())) - { - resize(border(), height()); - mLastWidth = collapseWidth() + 1; - mResized = true; - } - else if((this->x() + p.x() >= parentWidget()->width() - maximumWidth()) && (this->x() + p.x() <= parentWidget()->width() - this->minimumWidth())) - { - resize(parentWidget()->width() - (this->x() + p.x()), height()); - mResized = true; - } - - break; - case eUBDockOrientation_Top: - case eUBDockOrientation_Bottom: - if(p.y() <= maximumHeight()) - { - resize(width(), p.y()); - mResized = true; - } - break; - - default: - break; - } - } -} +//void UBDockPalette::mouseMoveEvent(QMouseEvent *event) +//{ + +// QPoint p = event->pos(); + +// if(mCanResize && ((mMousePressPos - p).manhattanLength() > QApplication::startDragDistance())) +// { +// switch(mOrientation) +// { +// case eUBDockOrientation_Left: +// if(p.x() < collapseWidth() && p.x() >= minimumWidth()) +// { +// resize(border(), height()); +// mLastWidth = collapseWidth() + 1; +// mResized = true; +// } +// else if(p.x() <= maximumWidth() && p.x() >= minimumWidth()) +// { +// resize(p.x(), height()); +// mResized = true; +// } +// break; +// case eUBDockOrientation_Right: +// if((this->x() + p.x() > parentWidget()->width() - collapseWidth()) && (this->x() + p.x() < parentWidget()->width())) +// { +// resize(border(), height()); +// mLastWidth = collapseWidth() + 1; +// mResized = true; +// } +// else if((this->x() + p.x() >= parentWidget()->width() - maximumWidth()) && (this->x() + p.x() <= parentWidget()->width() - this->minimumWidth())) +// { +// resize(parentWidget()->width() - (this->x() + p.x()), height()); +// mResized = true; +// } + +// break; +// case eUBDockOrientation_Top: +// case eUBDockOrientation_Bottom: +// if(p.y() <= maximumHeight()) +// { +// resize(width(), p.y()); +// mResized = true; +// } +// break; + +// default: +// break; +// } +// } +//} /** * \brief Handle the mouse press event * @param as the mouse event */ -void UBDockPalette::mousePressEvent(QMouseEvent *event) -{ - mClickTime = QTime::currentTime(); - // The goal here is to verify if the user can resize the widget. - // It is only possible to resize it if the border is selected - QPoint p = event->pos(); - mMousePressPos = p; - mResized = false; - - switch(mOrientation) - { - case eUBDockOrientation_Left: - if((p.x() >= width() - 2 * border()) && (p.x() <= width())) - { - mCanResize = true; - } - break; - case eUBDockOrientation_Right: - if((p.x() >= 0) && (p.x() <= 2 * border())) - { - mCanResize = true; - } - break; - case eUBDockOrientation_Top: - // Not supported yet - break; - case eUBDockOrientation_Bottom: - // Not supported yet - break; - default: - break; - } -} +//void UBDockPalette::mousePressEvent(QMouseEvent *event) +//{ +// mClickTime = QTime::currentTime(); +// // The goal here is to verify if the user can resize the widget. +// // It is only possible to resize it if the border is selected +// QPoint p = event->pos(); +// mMousePressPos = p; +// mResized = false; + +// switch(mOrientation) +// { +// case eUBDockOrientation_Left: +// if((p.x() >= width() - 2 * border()) && (p.x() <= width())) +// { +// mCanResize = true; +// } +// break; +// case eUBDockOrientation_Right: +// if((p.x() >= 0) && (p.x() <= 2 * border())) +// { +// mCanResize = true; +// } +// break; +// case eUBDockOrientation_Top: +// // Not supported yet +// break; +// case eUBDockOrientation_Bottom: +// // Not supported yet +// break; +// default: +// break; +// } +//} /** * \brief Handle the mouse release event * @param event as the mouse event */ -void UBDockPalette::mouseReleaseEvent(QMouseEvent *event) -{ - Q_UNUSED(event); - if(!mResized && mClickTime.elapsed() < CLICKTIME) - { - int nbTabs = mTabWidgets.size(); - int clickedTab = 0; - // If the clicked position is in the tab, perform the related action - if(eUBDockOrientation_Left == mOrientation) - { - if(mMousePressPos.x() >= width() - 2*border() && - mMousePressPos.y() >= mHTab && - mMousePressPos.x() <= width() && - mMousePressPos.y() <= mHTab + nbTabs*TABSIZE + (nbTabs -1)*tabSpacing()) - { - clickedTab = (mMousePressPos.y() - mHTab)/(TABSIZE+tabSpacing()); - tabClicked(clickedTab); - } - } - else if(eUBDockOrientation_Right == mOrientation) - { - if(mMousePressPos.x() >= 0 && - mMousePressPos.x() <= 2*border() && - mMousePressPos.y() >= mHTab && - mMousePressPos.y() <= mHTab + nbTabs*TABSIZE + (nbTabs -1)*tabSpacing()) - { - clickedTab = (mMousePressPos.y() - mHTab)/(TABSIZE+tabSpacing()); - tabClicked(clickedTab); - } - } - } - - mCanResize = false; -} +//void UBDockPalette::mouseReleaseEvent(QMouseEvent *event) +//{ +// Q_UNUSED(event); +// if(!mResized && mClickTime.elapsed() < CLICKTIME) +// { +// int nbTabs = mTabWidgets.size(); +// int clickedTab = 0; +// // If the clicked position is in the tab, perform the related action +// if(eUBDockOrientation_Left == mOrientation) +// { +// if(mMousePressPos.x() >= width() - 2*border() && +// mMousePressPos.y() >= mHTab && +// mMousePressPos.x() <= width() && +// mMousePressPos.y() <= mHTab + nbTabs*TABSIZE + (nbTabs -1)*tabSpacing()) +// { +// clickedTab = (mMousePressPos.y() - mHTab)/(TABSIZE+tabSpacing()); +// tabClicked(clickedTab); +// } +// } +// else if(eUBDockOrientation_Right == mOrientation) +// { +// if(mMousePressPos.x() >= 0 && +// mMousePressPos.x() <= 2*border() && +// mMousePressPos.y() >= mHTab && +// mMousePressPos.y() <= mHTab + nbTabs*TABSIZE + (nbTabs -1)*tabSpacing()) +// { +// clickedTab = (mMousePressPos.y() - mHTab)/(TABSIZE+tabSpacing()); +// tabClicked(clickedTab); +// } +// } +// } + +// mCanResize = false; +//} /** * \brief Handle the resize event @@ -288,6 +293,7 @@ void UBDockPalette::resizeEvent(QResizeEvent *event) break; } move(origin.x(), origin.y()); + moveTabs(); } /** @@ -332,11 +338,11 @@ void UBDockPalette::paintEvent(QPaintEvent *event) // First draw the BIG RECTANGLE (I write it big because the rectangle is big...) if(mOrientation == eUBDockOrientation_Left) { - path.addRect(0.0, 0.0, width()-2*border(), height()); + path.addRect(0.0, 0.0, width(), height()); } else if(mOrientation == eUBDockOrientation_Right) { - path.addRect(2*border(), 0.0, width()-2*border(), height()); + path.addRect(0.0, 0.0, width(), height()); } // THEN DRAW THE small tabs (yes, the tabs are small...) @@ -348,52 +354,53 @@ void UBDockPalette::paintEvent(QPaintEvent *event) { mHTab = height() - border() - nbTabs*TABSIZE - (nbTabs-1)*tabSpacing(); } - - for(int i = 0; i < mTabWidgets.size(); i++) - { - UBDockPaletteWidget* pCrntWidget = mTabWidgets.at(i); - if(NULL != pCrntWidget) - { - if(mOrientation == eUBDockOrientation_Left) - { - path.addRoundedRect(width()-4*border(), mHTab + i*TABSIZE + i*tabSpacing(), 4*border(), TABSIZE, radius(), radius()); - painter.drawPath(path); - QPixmap iconPixmap; - if(mCollapseWidth >= width()) - { - // Get the collapsed icon - iconPixmap = pCrntWidget->iconToRight(); - } - else - { - // Get the expanded icon - iconPixmap = pCrntWidget->iconToLeft(); - } - painter.drawPixmap(width() - 2*border() + 1, mHTab + i*TABSIZE + i*tabSpacing() + 1 , 2*border() - 4, TABSIZE - 2, iconPixmap); - } - else if(mOrientation == eUBDockOrientation_Right) - { - path.addRoundedRect(0.0, mHTab + i*TABSIZE + i*tabSpacing(), 4*border(), TABSIZE, radius(), radius()); - painter.drawPath(path); - QPixmap iconPixmap; - if(mCollapseWidth >= width()) - { - // Get the collapsed icon - iconPixmap = pCrntWidget->iconToLeft(); - } - else - { - // Get the expanded icon - iconPixmap = pCrntWidget->iconToRight(); - } - painter.drawPixmap(2, mHTab + i*TABSIZE + i*tabSpacing() + 1, 2*border() - 4, TABSIZE - 2, iconPixmap); - } - else - { - painter.drawRoundedRect(border(), border(), width() - 2 * border(), height() - 2 * border(), radius(), radius()); - } - } - } + painter.drawPath(path); + +// for(int i = 0; i < mTabWidgets.size(); i++) +// { +// UBDockPaletteWidget* pCrntWidget = mTabWidgets.at(i); +// if(NULL != pCrntWidget) +// { +// if(mOrientation == eUBDockOrientation_Left) +// { +// path.addRoundedRect(width()-4*border(), mHTab + i*TABSIZE + i*tabSpacing(), 4*border(), TABSIZE, radius(), radius()); +// painter.drawPath(path); +// QPixmap iconPixmap; +// if(mCollapseWidth >= width()) +// { +// // Get the collapsed icon +// iconPixmap = pCrntWidget->iconToRight(); +// } +// else +// { +// // Get the expanded icon +// iconPixmap = pCrntWidget->iconToLeft(); +// } +// painter.drawPixmap(width() - 2*border() + 1, mHTab + i*TABSIZE + i*tabSpacing() + 1 , 2*border() - 4, TABSIZE - 2, iconPixmap); +// } +// else if(mOrientation == eUBDockOrientation_Right) +// { +// path.addRoundedRect(0.0, mHTab + i*TABSIZE + i*tabSpacing(), 4*border(), TABSIZE, radius(), radius()); +// painter.drawPath(path); +// QPixmap iconPixmap; +// if(mCollapseWidth >= width()) +// { +// // Get the collapsed icon +// iconPixmap = pCrntWidget->iconToLeft(); +// } +// else +// { +// // Get the expanded icon +// iconPixmap = pCrntWidget->iconToRight(); +// } +// painter.drawPixmap(2, mHTab + i*TABSIZE + i*tabSpacing() + 1, 2*border() - 4, TABSIZE - 2, iconPixmap); +// } +// else +// { +// painter.drawRoundedRect(border(), border(), width() - 2 * border(), height() - 2 * border(), radius(), radius()); +// } +// } +// } } } @@ -460,6 +467,7 @@ void UBDockPalette::tabClicked(int tabIndex) { toggleCollapseExpand(); } + mTabPalette->update(); } /** @@ -493,7 +501,7 @@ void UBDockPalette::toggleCollapseExpand() { // The palette must be collapsed mLastWidth = width(); - resize(2*border(), height()); + resize(0, height()); } else { @@ -550,6 +558,7 @@ void UBDockPalette::addTab(UBDockPaletteWidget *widget) mTabWidgets.append(widget); mpStackWidget->addWidget(widget); mpStackWidget->setCurrentWidget(widget); + resizeTabs(); update(); } } @@ -571,6 +580,8 @@ void UBDockPalette::removeTab(const QString &widgetName) break; } } + resizeTabs(); + mCurrentTab = qMax(mCurrentTab - 1, 0); } /** @@ -666,3 +677,253 @@ void UBDockPalette::onAllDownloadsFinished() } } } + +void UBDockPalette::moveTabs() +{ + if (!mHTab) { + if(eUBDockTabOrientation_Up == mTabsOrientation) { + mHTab = border(); + } else { + mHTab = height() - border() - mTabWidgets.size() * TABSIZE - (mTabWidgets.size() - 1) * tabSpacing(); + } + } + + QPoint origin(width(), mHTab + mTabPalette->mVerticalOffset); + + switch (mOrientation) { + case eUBDockOrientation_Left: + origin.setX(width()); + break; + case eUBDockOrientation_Right: + if (parentWidget()) { + origin.setX(parentWidget()->width() - width() - mTabPalette->width()); + } + break; + case eUBDockOrientation_Top: ; + case eUBDockOrientation_Bottom: ; + } + + mTabPalette->move(origin.x(), origin.y()); +} +void UBDockPalette::resizeTabs() +{ + int numTabs = mTabWidgets.size(); + mTabPalette->resize(2 * border(), (numTabs * TABSIZE) + qMax(numTabs - 1, 0) * tabSpacing()); +} +QRect UBDockPalette::getTabPaletteRect() +{ + QRect tabsRect = mTabPalette->rect(); + QPoint topLeft = mTabPalette->mapToParent(tabsRect.topLeft()); + QPoint bottomRight = mTabPalette->mapToParent(tabsRect.bottomRight()); + + return QRect(topLeft, bottomRight); +} +void UBDockPalette::assignParent(QWidget *widget) +{ + setParent(widget); + mTabPalette->setParent(widget); +} +void UBDockPalette::setVisible(bool visible) +{ + QWidget::setVisible(visible); + mTabPalette->setVisible(visible); +} + +UBTabDockPalete::UBTabDockPalete(UBDockPalette *dockPalette, QWidget *parent) : + QWidget(parent) + , dock(dockPalette) + , mVerticalOffset(0) + , mFlotable(false) +{ + int numTabs = dock->mTabWidgets.size(); + resize(2 * dock->border(), (numTabs * TABSIZE) + qMax(numTabs - 1, 0) * dock->tabSpacing()); +// move(dock->width(), 20); + + setAttribute(Qt::WA_TranslucentBackground); +} + +void UBTabDockPalete::paintEvent(QPaintEvent */*event*/) +{ + int nTabs = dock->mTabWidgets.size(); + if (nTabs <= 0) { + qDebug() << "not enough tabs"; + return; + } + + QPainter painter(this); + painter.setRenderHint(QPainter::Antialiasing); + painter.setPen(Qt::NoPen); + painter.setBrush(dock->mBackgroundBrush); + + int yFrom = 0; + for (int i = 0; i < nTabs; i++) { + UBDockPaletteWidget* pCrntWidget = dock->mTabWidgets.at(i); + QPainterPath path; + path.setFillRule(Qt::WindingFill); + QPixmap iconPixmap; + + switch (dock->mOrientation) { + case eUBDockOrientation_Left: + path.addRect(0, yFrom, width() / 2, TABSIZE); + path.addRoundedRect(0, yFrom, width(), TABSIZE, dock->radius(), dock->radius()); + if (pCrntWidget) { + if(dock->mCollapseWidth >= dock->width()) { + // Get the collapsed icon + iconPixmap = pCrntWidget->iconToRight(); + } else { + // Get the expanded icon + iconPixmap = pCrntWidget->iconToLeft(); + } + + } + break; + + case eUBDockOrientation_Right: + path.addRect(width() /2, yFrom, width() / 2, TABSIZE); + path.addRoundedRect(0, yFrom, width(), TABSIZE, dock->radius(), dock->radius()); + if (pCrntWidget) { + if(dock->mCollapseWidth >= dock->width()) { + // Get the collapsed icon + iconPixmap = pCrntWidget->iconToLeft(); + } else { + // Get the expanded icon + iconPixmap = pCrntWidget->iconToRight(); + } + } + break; + + case eUBDockOrientation_Top: ; + case eUBDockOrientation_Bottom: ; + default: + break; + } + + painter.save(); + QPixmap transparencyPix(":/images/tab_mask.png"); + if (dock->mCurrentTab != i) { + iconPixmap.setAlphaChannel(transparencyPix); + QColor color(0x7F, 0x7F, 0x7F, 0x3F); + painter.setBrush(QBrush(color)); + } + + painter.drawPath(path); + painter.drawPixmap(2, yFrom + 2, width() - 4, TABSIZE - 4, iconPixmap); + yFrom += (TABSIZE + dock->tabSpacing()); + painter.restore(); + } +} +UBTabDockPalete::~UBTabDockPalete() +{ +} + +void UBTabDockPalete::mousePressEvent(QMouseEvent *event) +{ + dock->mClickTime = QTime::currentTime(); + // The goal here is to verify if the user can resize the widget. + // It is only possible to resize it if the border is selected + QPoint p = event->pos(); + dock->mMousePressPos = p; + dock->mResized = false; + + switch(dock->mOrientation) { + case eUBDockOrientation_Left: + dock->mCanResize = true; + break; + case eUBDockOrientation_Right: + dock->mCanResize = true; + break; + case eUBDockOrientation_Top: + // Not supported yet + break; + case eUBDockOrientation_Bottom: + // Not supported yet + break; + default: + break; + } +} +void UBTabDockPalete::mouseMoveEvent(QMouseEvent *event) +{ + QPoint p = event->pos(); + + if(dock->mCanResize && ((dock->mMousePressPos - p).manhattanLength() > QApplication::startDragDistance())) + { + if (qAbs(dock->mMousePressPos.y() - p.y()) > 10 && mFlotable) { + qDebug() << "y differences" << dock->mMousePressPos.y() << p.y(); + mVerticalOffset += p.y() - dock->mMousePressPos.y(); + move(this->pos().x(), p.y()); + } + + switch(dock->mOrientation) { + + case eUBDockOrientation_Left: + p.setX(p.x() + dock->width()); + if(p.x() < dock->collapseWidth() && p.x() >= dock->minimumWidth()) { + dock->resize(0, dock->height()); + dock->mLastWidth = dock->collapseWidth() + 1; + dock->mResized = true; + } else if (p.x() <= dock->maximumWidth() && p.x() >= dock->minimumWidth()) { + dock->resize(p.x(), dock->height()); + dock->mResized = true; + } + break; + + case eUBDockOrientation_Right: + p.setX(p.x() - 2 * dock->border()); + if((dock->x() + p.x() > dock->parentWidget()->width() - dock->collapseWidth()) && (dock->x() + p.x() < dock->parentWidget()->width())) { + dock->resize(0, dock->height()); + dock->mLastWidth = dock->collapseWidth() + 1; + dock->mResized = true; + } else if((dock->x() + p.x() >= dock->parentWidget()->width() - dock->maximumWidth()) && (dock->x() + p.x() <= dock->parentWidget()->width() - dock->minimumWidth())) { + dock->resize(dock->parentWidget()->width() - (dock->x() + p.x()), dock->height()); + dock->mResized = true; + } + break; + + case eUBDockOrientation_Top: + case eUBDockOrientation_Bottom: + if(p.y() <= dock->maximumHeight()) { + dock->resize(width(), p.y()); + dock->mResized = true; + } + break; + + default: + break; + } + } +} +void UBTabDockPalete::mouseReleaseEvent(QMouseEvent *event) +{ + Q_UNUSED(event); + if(!dock->mResized && dock->mClickTime.elapsed() < CLICKTIME) { + int nbTabs = dock->mTabWidgets.size(); + int clickedTab = 0; + // If the clicked position is in the tab, perform the related action + + if(eUBDockOrientation_Left == dock->mOrientation) { + if(dock->mMousePressPos.y() >= dock->mHTab && + dock->mMousePressPos.x() <= width() && + dock->mMousePressPos.y() <= dock->mHTab + nbTabs * TABSIZE + (nbTabs -1)*dock->tabSpacing()) { + + clickedTab = (dock->mMousePressPos.y() - dock->mHTab) / (TABSIZE + dock->tabSpacing()); + dock->tabClicked(clickedTab); + } + + } else if (eUBDockOrientation_Right == dock->mOrientation) { + if(dock->mMousePressPos.x() >= 0 && + dock->mMousePressPos.x() <= width() && + dock->mMousePressPos.y() >= 0 && + dock->mMousePressPos.y() <= nbTabs * TABSIZE + (nbTabs -1) * dock->tabSpacing()) { + + clickedTab = (dock->mMousePressPos.y())/(TABSIZE+dock->tabSpacing()); + dock->tabClicked(clickedTab); + } + } + } + + dock->mCanResize = false; +} + + + diff --git a/src/gui/UBDockPalette.h b/src/gui/UBDockPalette.h index a1b3c758..c89747fa 100644 --- a/src/gui/UBDockPalette.h +++ b/src/gui/UBDockPalette.h @@ -31,8 +31,8 @@ #include "UBDockPaletteWidget.h" -#define TABSIZE 50 -#define CLICKTIME 1000000 +#define TABSIZE 50 //Height of the tab of the palette +#define CLICKTIME 1000000 //Clicktime to expand or collapse paltte /** * \brief The dock positions @@ -51,9 +51,35 @@ typedef enum eUBDockTabOrientation_Down /** Down tabs */ }eUBDockTabOrientation; +class UBDockPalette; + +class UBTabDockPalete : public QWidget +{ + Q_OBJECT + friend class UBDockPalette; + +public: + + UBTabDockPalete(UBDockPalette *dockPalette, QWidget *parent = 0); + ~UBTabDockPalete(); + +protected: + virtual void mousePressEvent(QMouseEvent *event); + virtual void mouseMoveEvent(QMouseEvent *event); + virtual void mouseReleaseEvent(QMouseEvent *event); + virtual void paintEvent(QPaintEvent *event); + +private: + UBDockPalette *dock; + int mVerticalOffset; + bool mFlotable; +}; + class UBDockPalette : public QWidget { Q_OBJECT + friend class UBTabDockPalete; + public: UBDockPalette(QWidget* parent=0, const char* name="UBDockPalette"); ~UBDockPalette(); @@ -62,10 +88,14 @@ public: void setOrientation(eUBDockOrientation orientation); void setTabsOrientation(eUBDockTabOrientation orientation); void showTabWidget(int tabIndex); + QRect getTabPaletteRect(); - virtual void mouseMoveEvent(QMouseEvent *event); - virtual void mousePressEvent(QMouseEvent *event); - virtual void mouseReleaseEvent(QMouseEvent *event); + virtual void assignParent(QWidget *widget); + virtual void setVisible(bool visible); + +// virtual void mouseMoveEvent(QMouseEvent *event); +// virtual void mousePressEvent(QMouseEvent *event); +// virtual void mouseReleaseEvent(QMouseEvent *event); virtual void paintEvent(QPaintEvent *event); virtual void enterEvent(QEvent *); virtual void leaveEvent(QEvent *); @@ -77,7 +107,13 @@ public: void connectSignals(); - QVector GetWidgetsList() { return mRegisteredWidgets; }; + QVector GetWidgetsList() { return mRegisteredWidgets; } + +public: + bool isTabFlotable() {return mTabPalette->mFlotable;} + void setTabFlotable(bool newFlotable) {mTabPalette->mFlotable = newFlotable;} + int getAdditionalVOffset() const {return mTabPalette->mVerticalOffset;} + void setAdditionalVOffset(int newOffset) {mTabPalette->mVerticalOffset = newOffset;} public slots: void onShowTabWidget(const QString& widgetName); @@ -137,6 +173,11 @@ private: void tabClicked(int tabIndex); int tabSpacing(); void toggleCollapseExpand(); + void moveTabs(); + void resizeTabs(); + +private: + UBTabDockPalete *mTabPalette; }; diff --git a/src/gui/UBDocumentNavigator.cpp b/src/gui/UBDocumentNavigator.cpp index fea695f4..4efea020 100644 --- a/src/gui/UBDocumentNavigator.cpp +++ b/src/gui/UBDocumentNavigator.cpp @@ -105,7 +105,6 @@ void UBDocumentNavigator::generateThumbnails() // Get the thumbnails QList thumbs = UBThumbnailAdaptor::load(mCrntDoc); - QGraphicsPixmapItem* selection = NULL; for(int i = 0; i < thumbs.count(); i++) { @@ -115,7 +114,6 @@ void UBDocumentNavigator::generateThumbnails() // Get the selected item if(UBApplication::boardController->activeSceneIndex() == i) { - selection = pixmapItem; mCrntItem = dynamic_cast(pixmapItem); mCrntItem->setSelected(true); } @@ -161,6 +159,7 @@ void UBDocumentNavigator::updateSpecificThumbnail(int iPage) mScene->removeItem(pItem); mScene->addItem(pixmapItem); mThumbnails.replace(iPage, pixmapItem); + delete pItem; } } } @@ -289,11 +288,6 @@ void UBDocumentNavigator::refreshScene() mLabels.at(i)->setPos(pos); } } - - QScrollBar *vertScrollBar = verticalScrollBar(); - int scrollBarThickness = 0; - if (vertScrollBar && vertScrollBar->isVisible()) - scrollBarThickness = vertScrollBar->width(); } /** diff --git a/src/gui/UBDocumentTreeWidget.cpp b/src/gui/UBDocumentTreeWidget.cpp index 7f06d5d2..b344855c 100644 --- a/src/gui/UBDocumentTreeWidget.cpp +++ b/src/gui/UBDocumentTreeWidget.cpp @@ -25,6 +25,10 @@ #include "core/UBDocumentManager.h" #include "document/UBDocumentController.h" +#include "adaptors/UBThumbnailAdaptor.h" +#include "adaptors/UBSvgSubsetAdaptor.h" +#include "frameworks/UBFileSystemUtils.h" + #include "core/memcheck.h" UBDocumentTreeWidget::UBDocumentTreeWidget(QWidget * parent) @@ -290,7 +294,14 @@ void UBDocumentTreeWidget::dropEvent(QDropEvent *event) } UBPersistenceManager::persistenceManager()->insertDocumentSceneAt(targetDocProxy, sceneClone, targetDocProxy->pageCount()); - } + + //due to incorrect generation of thumbnails of invisible scene I've used direct copying of thumbnail files + //it's not universal and good way but it's faster + QString from = sourceItem.documentProxy()->persistencePath() + UBFileSystemUtils::digitFileFormat("/page%1.thumbnail.jpg", sourceItem.sceneIndex() + 1); + QString to = targetDocProxy->persistencePath() + UBFileSystemUtils::digitFileFormat("/page%1.thumbnail.jpg", targetDocProxy->pageCount()); + QFile::remove(to); + QFile::copy(from, to); + } } QApplication::restoreOverrideCursor(); diff --git a/src/gui/UBDocumentTreeWidget.h b/src/gui/UBDocumentTreeWidget.h index ab2e9866..f76d1696 100644 --- a/src/gui/UBDocumentTreeWidget.h +++ b/src/gui/UBDocumentTreeWidget.h @@ -23,7 +23,7 @@ class UBDocumentProxyTreeItem; class UBDocumentTreeWidget : public QTreeWidget { - Q_OBJECT; + Q_OBJECT public: UBDocumentTreeWidget(QWidget *parent = 0); diff --git a/src/gui/UBLeftPalette.cpp b/src/gui/UBLeftPalette.cpp index 391b0efe..9cb518e7 100644 --- a/src/gui/UBLeftPalette.cpp +++ b/src/gui/UBLeftPalette.cpp @@ -24,11 +24,11 @@ UBLeftPalette::UBLeftPalette(QWidget *parent, const char *name):UBDockPalette(pa { setObjectName(name); setOrientation(eUBDockOrientation_Left); - mLastWidth = 300; - mCollapseWidth = 180; + mLastWidth = 270; + mCollapseWidth = 150; resize(UBSettings::settings()->navigPaletteWidth->get().toInt(), parentWidget()->height()); - mpLayout->setContentsMargins(customMargin(), customMargin(), 2*border() + customMargin(), customMargin()); +// mpLayout->setContentsMargins(customMargin(), customMargin(), 2*border() + customMargin(), customMargin()); } @@ -45,7 +45,7 @@ UBLeftPalette::~UBLeftPalette() */ void UBLeftPalette::updateMaxWidth() { - setMaximumWidth(300); + setMaximumWidth(270); } /** @@ -55,5 +55,5 @@ void UBLeftPalette::updateMaxWidth() void UBLeftPalette::resizeEvent(QResizeEvent *event) { UBDockPalette::resizeEvent(event); - UBSettings::settings()->navigPaletteWidth->set(width()); +// UBSettings::settings()->navigPaletteWidth->set(width()); } diff --git a/src/gui/UBLibraryWidget.cpp b/src/gui/UBLibraryWidget.cpp index 53a0b2a1..31371a83 100644 --- a/src/gui/UBLibraryWidget.cpp +++ b/src/gui/UBLibraryWidget.cpp @@ -39,9 +39,9 @@ */ UBLibraryWidget::UBLibraryWidget(QWidget *parent, const char *name):UBThumbnailWidget(parent) , chainedElements(NULL) + , mLibraryController(NULL) , mpCrntDir(NULL) , mpCrntElem(NULL) - , mLibraryController(NULL) , mpTmpElem(NULL) { setObjectName(name); diff --git a/src/gui/UBMagnifer.cpp b/src/gui/UBMagnifer.cpp index c1a779a7..b98edf18 100644 --- a/src/gui/UBMagnifer.cpp +++ b/src/gui/UBMagnifer.cpp @@ -204,7 +204,6 @@ void UBMagnifier::mouseMoveEvent ( QMouseEvent * event ) { if(mShouldMoveWidget && (event->buttons() & Qt::LeftButton)) { - QPoint offset = event->pos() - mMousePressPos; move(pos() - mMousePressPos + event->pos()); event->accept(); diff --git a/src/gui/UBRightPalette.cpp b/src/gui/UBRightPalette.cpp index 3c36658d..b6d21b00 100644 --- a/src/gui/UBRightPalette.cpp +++ b/src/gui/UBRightPalette.cpp @@ -26,10 +26,10 @@ UBRightPalette::UBRightPalette(QWidget *parent, const char *name):UBDockPalette( { setObjectName(name); setOrientation(eUBDockOrientation_Right); - mCollapseWidth = 180; - mLastWidth = 300; + mCollapseWidth = 150; + mLastWidth = 270; resize(UBSettings::settings()->libPaletteWidth->get().toInt(), parentWidget()->height()); - mpLayout->setContentsMargins(2*border() + customMargin(), customMargin(), customMargin(), customMargin()); +// mpLayout->setContentsMargins(2*border() + customMargin(), customMargin(), customMargin(), customMargin()); } /** @@ -37,7 +37,6 @@ UBRightPalette::UBRightPalette(QWidget *parent, const char *name):UBDockPalette( */ UBRightPalette::~UBRightPalette() { - } /** diff --git a/src/gui/UBTeacherBarWidget.cpp b/src/gui/UBTeacherBarWidget.cpp index ea8348b1..52c21bb2 100644 --- a/src/gui/UBTeacherBarWidget.cpp +++ b/src/gui/UBTeacherBarWidget.cpp @@ -62,6 +62,7 @@ UBTeacherBarWidget::UBTeacherBarWidget(QWidget *parent, const char *name):UBDock mpTitleLabel->setAlignment(Qt::AlignRight); mpTitle = new QLineEdit(mpContainer); mpTitle->setObjectName("DockPaletteWidgetLineEdit"); + connect(mpTitle, SIGNAL(textChanged(const QString&)), this, SLOT(onTitleTextChanged(const QString&))); mpTitleLayout = new QHBoxLayout(); mpTitleLayout->addWidget(mpTitleLabel, 0); mpTitleLayout->addWidget(mpTitle, 1); @@ -95,6 +96,7 @@ UBTeacherBarWidget::UBTeacherBarWidget(QWidget *parent, const char *name):UBDock mpEquipmentLabel->setAlignment(Qt::AlignRight); mpEquipment = new QLineEdit(mpContainer); mpEquipment->setObjectName("DockPaletteWidgetLineEdit"); + connect(mpEquipment, SIGNAL(textChanged(const QString&)), this, SLOT(onEquipmentTextChanged(const QString&))); mpEquipmentLayout = new QHBoxLayout(); mpEquipmentLayout->addWidget(mpEquipmentLabel, 0); mpEquipmentLayout->addWidget(mpEquipment, 1); @@ -319,6 +321,16 @@ void UBTeacherBarWidget::loadContent() mpAction3->setStudentText(nextInfos.action3Student); } +void UBTeacherBarWidget::onTitleTextChanged(const QString& text) +{ + mpTitle->setToolTip(text); +} + +void UBTeacherBarWidget::onEquipmentTextChanged(const QString& text) +{ + mpEquipment->setToolTip(text); +} + UBTeacherStudentAction::UBTeacherStudentAction(int actionNumber, QWidget *parent, const char *name):QWidget(parent) , mpActionLabel(NULL) , mpTeacherLabel(NULL) @@ -345,8 +357,8 @@ UBTeacherStudentAction::UBTeacherStudentAction(int actionNumber, QWidget *parent mpTeacherLayout = new QHBoxLayout(); //TODO: I'm not able to translate this string using the normal way *qm file why? - //mpTeacherLabel = new QLabel(tr("Teacher"), this); - mpTeacherLabel = new QLabel(tr("Enseignant"), this); + mpTeacherLabel = new QLabel(tr("Teacher"), this); +// mpTeacherLabel = new QLabel(tr("Enseignant"), this); mpTeacherLabel->setAlignment(Qt::AlignTop); mpTeacher = new QTextEdit(this); mpTeacher->setObjectName("TeacherStudentBox"); @@ -356,8 +368,8 @@ UBTeacherStudentAction::UBTeacherStudentAction(int actionNumber, QWidget *parent mpLayout->addLayout(mpTeacherLayout, 1); mpStudentLayout = new QHBoxLayout(); -// mpStudentLabel = new QLabel(tr("Student"), this); - mpStudentLabel = new QLabel(tr("Élève"), this); + mpStudentLabel = new QLabel(tr("Student"), this); +// mpStudentLabel = new QLabel(tr("Élève"), this); mpStudentLabel->setAlignment(Qt::AlignTop); mpStudent = new QTextEdit(this); mpStudent->setObjectName("TeacherStudentBox"); diff --git a/src/gui/UBTeacherBarWidget.h b/src/gui/UBTeacherBarWidget.h index 555b6ef6..a021027f 100644 --- a/src/gui/UBTeacherBarWidget.h +++ b/src/gui/UBTeacherBarWidget.h @@ -15,6 +15,8 @@ class UBTeacherStudentAction : public QWidget { + Q_OBJECT + public: UBTeacherStudentAction(int actionNumber, QWidget* parent=0, const char* name="UBTeacherStudentAction"); ~UBTeacherStudentAction(); @@ -48,6 +50,8 @@ private slots: void saveContent(); void loadContent(); void onValueChanged(); + void onTitleTextChanged(const QString& text); + void onEquipmentTextChanged(const QString& text); private: void populateCombos(); diff --git a/src/gui/UBThumbnailView.h b/src/gui/UBThumbnailView.h index ecd13a19..32390f1a 100644 --- a/src/gui/UBThumbnailView.h +++ b/src/gui/UBThumbnailView.h @@ -22,7 +22,7 @@ class UBGraphicsScene; class UBThumbnailView : public QGraphicsView { - Q_OBJECT; + Q_OBJECT public: UBThumbnailView(); diff --git a/src/gui/UBThumbnailWidget.h b/src/gui/UBThumbnailWidget.h index c4fa103f..f3f25d6a 100644 --- a/src/gui/UBThumbnailWidget.h +++ b/src/gui/UBThumbnailWidget.h @@ -23,6 +23,7 @@ #include "frameworks/UBCoreGraphicsScene.h" #include "core/UBSettings.h" +#include "domain/UBItem.h" #define STARTDRAGTIME 1000000 #define BUTTONSIZE 48 @@ -148,6 +149,7 @@ class UBThumbnail { item->scene()->addItem(mSelectionItem); mSelectionItem->setZValue(item->zValue() - 1); +// UBGraphicsItem::assignZValue(mSelectionItem, item->zValue() - 1); mAddedToScene = true; } diff --git a/src/gui/UBToolWidget.cpp b/src/gui/UBToolWidget.cpp index ea1bdee1..5bea3f1a 100644 --- a/src/gui/UBToolWidget.cpp +++ b/src/gui/UBToolWidget.cpp @@ -183,7 +183,6 @@ void UBToolWidget::mouseMoveEvent ( QMouseEvent * event ) { if(mShouldMoveWidget && (event->buttons() & Qt::LeftButton)) { - QPoint offset = event->pos() - mMousePressPos; move(pos() - mMousePressPos + event->pos()); event->accept(); } diff --git a/src/gui/gui.pri b/src/gui/gui.pri index 1e65ca8f..20075dfb 100644 --- a/src/gui/gui.pri +++ b/src/gui/gui.pri @@ -119,3 +119,7 @@ linux-g++-32 { SOURCES += src/gui/UBKeyboardPalette_linux.cpp } +linux-g++-64 { + + SOURCES += src/gui/UBKeyboardPalette_linux.cpp +} diff --git a/src/network/UBNetworkAccessManager.cpp b/src/network/UBNetworkAccessManager.cpp index 4f32444a..4a7f1ed1 100644 --- a/src/network/UBNetworkAccessManager.cpp +++ b/src/network/UBNetworkAccessManager.cpp @@ -17,8 +17,6 @@ #include #include -#include "frameworks/UBDesktopServices.h" - #include "core/UBApplication.h" #include "core/UBApplicationController.h" #include "core/UBSettings.h" diff --git a/src/pdf-merger/Object.h b/src/pdf-merger/Object.h index d2bc75ba..982d3734 100644 --- a/src/pdf-merger/Object.h +++ b/src/pdf-merger/Object.h @@ -48,7 +48,7 @@ namespace merge_lib std::string fileName = "", std::pair streamBounds = std::make_pair ((unsigned int)0,(unsigned int)0), bool hasStream = false ): _number(objectNumber), _generationNumber(generationNumber), _oldNumber(objectNumber), _content(objectContent),_parents(),_children(),_isPassed(false), - _fileName(fileName), _streamBounds(streamBounds), _hasStream(hasStream), _hasStreamInContent(false) + _streamBounds(streamBounds), _fileName(fileName), _hasStream(hasStream), _hasStreamInContent(false) { } virtual ~Object(); diff --git a/src/pdf-merger/pdfMerger.pri b/src/pdf-merger/pdfMerger.pri index c976b39d..edc8d1fd 100644 --- a/src/pdf-merger/pdfMerger.pri +++ b/src/pdf-merger/pdfMerger.pri @@ -78,3 +78,8 @@ linux-g++-32 { LIBS += -lz } +linux-g++-64 { + + LIBS += -lz + +} diff --git a/src/podcast/UBPodcastController.cpp b/src/podcast/UBPodcastController.cpp index 9b6e03d5..e377249a 100644 --- a/src/podcast/UBPodcastController.cpp +++ b/src/podcast/UBPodcastController.cpp @@ -15,7 +15,6 @@ #include "UBPodcastController.h" -#include "frameworks/UBDesktopServices.h" #include "frameworks/UBFileSystemUtils.h" #include "frameworks/UBStringUtils.h" #include "frameworks/UBPlatformUtils.h" diff --git a/src/podcast/quicktime/UBQuickTimeVideoEncoder.cpp b/src/podcast/quicktime/UBQuickTimeVideoEncoder.cpp index f188ab80..2ae6b90e 100644 --- a/src/podcast/quicktime/UBQuickTimeVideoEncoder.cpp +++ b/src/podcast/quicktime/UBQuickTimeVideoEncoder.cpp @@ -19,7 +19,6 @@ #include -#include "frameworks/UBDesktopServices.h" #include "frameworks/UBFileSystemUtils.h" #include "core/UBApplication.h" diff --git a/src/podcast/windowsmedia/UBWindowsMediaVideoEncoder.cpp b/src/podcast/windowsmedia/UBWindowsMediaVideoEncoder.cpp index bc2ee2fe..1d2d773e 100644 --- a/src/podcast/windowsmedia/UBWindowsMediaVideoEncoder.cpp +++ b/src/podcast/windowsmedia/UBWindowsMediaVideoEncoder.cpp @@ -17,7 +17,6 @@ #include -#include "frameworks/UBDesktopServices.h" #include "frameworks/UBFileSystemUtils.h" #include "core/UBApplication.h" diff --git a/src/softwareupdate/UBSoftwareUpdateController.cpp b/src/softwareupdate/UBSoftwareUpdateController.cpp index 50fad512..6f651db1 100644 --- a/src/softwareupdate/UBSoftwareUpdateController.cpp +++ b/src/softwareupdate/UBSoftwareUpdateController.cpp @@ -14,7 +14,6 @@ */ //#include "frameworks/UBVersion.h" -//#include "frameworks/UBDesktopServices.h" //#include "frameworks/UBFileSystemUtils.h" //#include "frameworks/UBPlatformUtils.h" diff --git a/src/tools/UBAbstractDrawRuler.cpp b/src/tools/UBAbstractDrawRuler.cpp index 3c8b8169..e69aa815 100644 --- a/src/tools/UBAbstractDrawRuler.cpp +++ b/src/tools/UBAbstractDrawRuler.cpp @@ -35,7 +35,6 @@ const QColor UBAbstractDrawRuler::sDarkBackgroundDrawColor = QColor(0xff, 0xff, const int UBAbstractDrawRuler::sLeftEdgeMargin = 10; const int UBAbstractDrawRuler::sDegreeToQtAngleUnit = 16; const int UBAbstractDrawRuler::sRotationRadius = 15; -const int UBAbstractDrawRuler::sPixelsPerMillimeter = 5; const int UBAbstractDrawRuler::sFillTransparency = 127; const int UBAbstractDrawRuler::sDrawTransparency = 192; const int UBAbstractDrawRuler::sRoundingRadius = sLeftEdgeMargin / 2; @@ -44,7 +43,12 @@ const int UBAbstractDrawRuler::sRoundingRadius = sLeftEdgeMargin / 2; UBAbstractDrawRuler::UBAbstractDrawRuler() : mShowButtons(false) , mAntiScaleRatio(1.0) -{} +{ + //we actually need to evaluate pixels per millimeter + QDesktopWidget* desktop = UBApplication::desktop(); + int dpiCommon = (desktop->physicalDpiX() + desktop->physicalDpiY()) / 2; + sPixelsPerMillimeter = qRound(dpiCommon / 25.4f);//because 1inch = 25.4 mm +} void UBAbstractDrawRuler::create(QGraphicsItem& item) { diff --git a/src/tools/UBAbstractDrawRuler.h b/src/tools/UBAbstractDrawRuler.h index cf98e2f5..0e632eff 100644 --- a/src/tools/UBAbstractDrawRuler.h +++ b/src/tools/UBAbstractDrawRuler.h @@ -70,14 +70,13 @@ protected: static const QColor sDarkBackgroundMiddleFillColor; static const QColor sDarkBackgroundDrawColor; - static const int sLeftEdgeMargin; - static const int sDegreeToQtAngleUnit; - static const int sRotationRadius; - static const int sPixelsPerMillimeter; - static const int sFillTransparency; - static const int sDrawTransparency; - static const int sRoundingRadius; - + static const int sLeftEdgeMargin; + static const int sDegreeToQtAngleUnit; + static const int sRotationRadius; + static const int sFillTransparency; + static const int sDrawTransparency; + static const int sRoundingRadius; + int sPixelsPerMillimeter; }; #endif diff --git a/src/tools/UBGraphicsCache.cpp b/src/tools/UBGraphicsCache.cpp index 231399c3..cff7c43c 100644 --- a/src/tools/UBGraphicsCache.cpp +++ b/src/tools/UBGraphicsCache.cpp @@ -33,7 +33,8 @@ UBGraphicsCache::UBGraphicsCache():QGraphicsRectItem() // Get the board size and pass it to the shape QRect boardRect = UBApplication::boardController->displayView()->rect(); setRect(-15*boardRect.width(), -15*boardRect.height(), 30*boardRect.width(), 30*boardRect.height()); - setZValue(CACHE_ZVALUE); +// setZValue(CACHE_ZVALUE); + UBGraphicsItem::assignZValue(this, CACHE_ZVALUE); setData(Qt::UserRole, QVariant("Cache")); } @@ -48,7 +49,8 @@ UBItem* UBGraphicsCache::deepCopy() const copy->setPos(this->pos()); copy->setRect(this->rect()); - copy->setZValue(this->zValue()); +// copy->setZValue(this->zValue()); + UBGraphicsItem::assignZValue(copy, this->zValue()); copy->setTransform(this->transform()); // TODO UB 4.7 ... complete all members ? @@ -87,10 +89,10 @@ void UBGraphicsCache::init() void UBGraphicsCache::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) { - //Q_UNUSED(option); + Q_UNUSED(option); Q_UNUSED(widget); - setZValue(CACHE_ZVALUE); + UBGraphicsItem::assignZValue(this, CACHE_ZVALUE); painter->setBrush(mMaskColor); painter->setPen(mMaskColor); diff --git a/src/tools/UBGraphicsCompass.cpp b/src/tools/UBGraphicsCompass.cpp index d0374c11..6e13b125 100644 --- a/src/tools/UBGraphicsCompass.cpp +++ b/src/tools/UBGraphicsCompass.cpp @@ -85,7 +85,8 @@ UBItem* UBGraphicsCompass::deepCopy() const copy->setPos(this->pos()); copy->setRect(this->rect()); - copy->setZValue(this->zValue()); +// copy->setZValue(this->zValue()); + UBGraphicsItem::assignZValue(copy, this->zValue()); copy->setTransform(this->transform()); // TODO UB 4.7 ... complete all members ? diff --git a/src/tools/UBGraphicsCurtainItem.cpp b/src/tools/UBGraphicsCurtainItem.cpp index 118b92f2..3dfb21b6 100644 --- a/src/tools/UBGraphicsCurtainItem.cpp +++ b/src/tools/UBGraphicsCurtainItem.cpp @@ -57,8 +57,8 @@ UBGraphicsCurtainItem::~UBGraphicsCurtainItem() QVariant UBGraphicsCurtainItem::itemChange(GraphicsItemChange change, const QVariant &value) { - if (change == QGraphicsItem::ItemSelectedHasChanged && QGraphicsRectItem::scene() && isSelected()) - setZValue(UBGraphicsScene::toolLayerStart + UBGraphicsScene::toolOffsetCurtain); +// if (change == QGraphicsItem::ItemSelectedHasChanged && QGraphicsRectItem::scene() && isSelected()) +// setZValue(UBGraphicsScene::toolLayerStart + UBGraphicsScene::toolOffsetCurtain); QVariant newValue = value; @@ -130,7 +130,8 @@ UBItem* UBGraphicsCurtainItem::deepCopy() const copy->setPos(this->pos()); copy->setBrush(this->brush()); copy->setPen(this->pen()); - copy->setZValue(this->zValue()); +// copy->setZValue(this->zValue()); + UBGraphicsItem::assignZValue(copy, this->zValue()); copy->setTransform(this->transform()); copy->setFlag(QGraphicsItem::ItemIsMovable, true); copy->setFlag(QGraphicsItem::ItemIsSelectable, true); diff --git a/src/tools/UBGraphicsCurtainItemDelegate.cpp b/src/tools/UBGraphicsCurtainItemDelegate.cpp index 31eb0da7..a16685b6 100644 --- a/src/tools/UBGraphicsCurtainItemDelegate.cpp +++ b/src/tools/UBGraphicsCurtainItemDelegate.cpp @@ -52,7 +52,7 @@ bool UBGraphicsCurtainItemDelegate::mousePressEvent(QGraphicsSceneMouseEvent *ev if (!mDelegated->isSelected()) { mDelegated->setSelected(true); - mDelegated->setZValue(UBGraphicsScene::toolLayerStart + UBGraphicsScene::toolOffsetCurtain); +// mDelegated->setZValue(UBGraphicsScene::toolLayerStart + UBGraphicsScene::toolOffsetCurtain); positionHandles(); return true; @@ -69,13 +69,13 @@ QVariant UBGraphicsCurtainItemDelegate::itemChange(QGraphicsItem::GraphicsItemCh { if (change == QGraphicsItem::ItemZValueHasChanged) { - mFrame->setZValue(mDelegated->zValue() + 1); +// mFrame->setZValue(mDelegated->zValue() + 1); - foreach(DelegateButton* button, mButtons) - { - button->setZValue(mDelegated->zValue() + 2); - button->setZValue(mDelegated->zValue() + 2); - } +// foreach(DelegateButton* button, mButtons) +// { +// button->setZValue(mDelegated->zValue() + 2); +// button->setZValue(mDelegated->zValue() + 2); +// } } if (change == QGraphicsItem::ItemVisibleHasChanged) diff --git a/src/tools/UBGraphicsProtractor.cpp b/src/tools/UBGraphicsProtractor.cpp index 43a84af1..bafb5689 100644 --- a/src/tools/UBGraphicsProtractor.cpp +++ b/src/tools/UBGraphicsProtractor.cpp @@ -580,7 +580,8 @@ UBItem* UBGraphicsProtractor::deepCopy() const copy->setPos(this->pos()); copy->setRect(this->rect()); - copy->setZValue(this->zValue()); +// copy->setZValue(this->zValue()); + UBGraphicsItem::assignZValue(copy, this->zValue()); copy->setTransform(this->transform()); copy->mCurrentAngle = this->mCurrentAngle; diff --git a/src/tools/UBGraphicsRuler.cpp b/src/tools/UBGraphicsRuler.cpp index cd15de78..2bf27719 100644 --- a/src/tools/UBGraphicsRuler.cpp +++ b/src/tools/UBGraphicsRuler.cpp @@ -74,7 +74,8 @@ UBItem* UBGraphicsRuler::deepCopy() const copy->setPos(this->pos()); copy->setRect(this->rect()); - copy->setZValue(this->zValue()); +// copy->setZValue(this->zValue()); + UBGraphicsItem::assignZValue(copy, this->zValue()); copy->setTransform(this->transform()); // TODO UB 4.7 ... complete all members ? diff --git a/src/tools/UBGraphicsTriangle.cpp b/src/tools/UBGraphicsTriangle.cpp index f6459f97..e5c7fdeb 100644 --- a/src/tools/UBGraphicsTriangle.cpp +++ b/src/tools/UBGraphicsTriangle.cpp @@ -93,7 +93,8 @@ UBItem* UBGraphicsTriangle::deepCopy(void) const copy->setPos(this->pos()); copy->setPolygon(this->polygon()); - copy->setZValue(this->zValue()); +// copy->setZValue(this->zValue()); + UBGraphicsItem::assignZValue(copy, this->zValue()); copy->setTransform(this->transform()); // TODO UB 4.7 ... complete all members ? diff --git a/src/transition/UniboardSankoreTransition.cpp b/src/transition/UniboardSankoreTransition.cpp index 6ed3acae..32c320af 100644 --- a/src/transition/UniboardSankoreTransition.cpp +++ b/src/transition/UniboardSankoreTransition.cpp @@ -15,7 +15,6 @@ #include "UniboardSankoreTransition.h" #include "core/UBSettings.h" -#include "frameworks/UBDesktopServices.h" #include "frameworks/UBFileSystemUtils.h" #include "core/UBApplication.h" #include "core/UBPersistenceManager.h" @@ -28,9 +27,9 @@ UniboardSankoreTransition::UniboardSankoreTransition(QObject *parent) : , mTransitionDlg(NULL) , mThread(NULL) { - mOldSankoreDirectory = UBFileSystemUtils::normalizeFilePath(UBDesktopServices::storageLocation(QDesktopServices::DataLocation)); + mOldSankoreDirectory = UBFileSystemUtils::normalizeFilePath(QDesktopServices::storageLocation(QDesktopServices::DataLocation)); - mUniboardSourceDirectory = UBFileSystemUtils::normalizeFilePath(UBDesktopServices::storageLocation(QDesktopServices::DataLocation)); + mUniboardSourceDirectory = UBFileSystemUtils::normalizeFilePath(QDesktopServices::storageLocation(QDesktopServices::DataLocation)); #if defined(Q_WS_MACX) mOldSankoreDirectory.replace("Sankore/Sankore 3.1", "Sankore"); mUniboardSourceDirectory.replace("Sankore/Sankore 3.1", "Uniboard"); @@ -86,7 +85,7 @@ void UniboardSankoreTransition::documentTransition() QFileInfoList fileInfoList = UBFileSystemUtils::allElementsInDirectory(uniboardDocumentDirectory); fileInfoList << UBFileSystemUtils::allElementsInDirectory(mOldSankoreDirectory + "/document"); - QString backupDirectoryPath = UBFileSystemUtils::normalizeFilePath(UBDesktopServices::storageLocation(QDesktopServices::DesktopLocation)); + QString backupDirectoryPath = UBFileSystemUtils::normalizeFilePath(QDesktopServices::storageLocation(QDesktopServices::DesktopLocation)); if (fileInfoList.count() != 0){ mTransitionDlg = new UBUpdateDlg(NULL, fileInfoList.count(), backupDirectoryPath); diff --git a/src/web/UBTrapFlashController.cpp b/src/web/UBTrapFlashController.cpp index d93c0a17..a701353d 100644 --- a/src/web/UBTrapFlashController.cpp +++ b/src/web/UBTrapFlashController.cpp @@ -116,7 +116,7 @@ void UBTrapFlashController::text_Changed(const QString &newText) void UBTrapFlashController::text_Edited(const QString &newText) { - + Q_UNUSED(newText); } void UBTrapFlashController::hideTrapFlash() diff --git a/src/web/UBWebController.cpp b/src/web/UBWebController.cpp index 1cacd63b..f556872f 100644 --- a/src/web/UBWebController.cpp +++ b/src/web/UBWebController.cpp @@ -150,6 +150,8 @@ void UBWebController::webBrowserInstance() (*mCurrentWebBrowser)->tabWidget()->tabBar()->show(); (*mCurrentWebBrowser)->tabWidget()->lineEdits()->show(); +// (*mCurrentWebBrowser)->tabWidget()->tabBar()->hide(); +// (*mCurrentWebBrowser)->tabWidget()->lineEdits()->hide(); } UBApplication::applicationController->setMirrorSourceWidget((*mCurrentWebBrowser)->paintWidget()); @@ -194,7 +196,7 @@ void UBWebController::tutorialWebInstance() else { mCurrentWebBrowser = &mWebBrowserList[Tutorial]; - mToolsCurrentPalette = &mToolsPaletteList[Tutorial]; +// mToolsCurrentPalette = &mToolsPaletteList[Tutorial]; // mKeyboardCurrentPalette = &mKeyboardPaletteList[Tutorial]; mToolsPalettePositionned = &mToolsPalettePositionnedList[Tutorial]; if (!(*mCurrentWebBrowser)) diff --git a/src/web/browser/WBBrowserWindow.cpp b/src/web/browser/WBBrowserWindow.cpp index f87178e9..e8151811 100644 --- a/src/web/browser/WBBrowserWindow.cpp +++ b/src/web/browser/WBBrowserWindow.cpp @@ -97,11 +97,11 @@ WBBrowserWindow::WBBrowserWindow(QWidget *parent, Ui::MainWindow* uniboardMainWi defaultSettings->setAttribute(QWebSettings::PluginsEnabled, true); setupMenu(); -// if(!isViewerWebInstance) + if(!isViewerWebInstance) setupToolBar(); -// else{ -// setupToolBarForTutorial(); -// } + else{ + setupToolBarForTutorial(); + } QVBoxLayout *layout = new QVBoxLayout; layout->setSpacing(0); @@ -206,7 +206,6 @@ void WBBrowserWindow::setupToolBar() mChaseWidget = new WBChaseWidget(this); mWebToolBar->insertWidget(mUniboardMainWindow->actionWebBigger, mChaseWidget); - mWebToolBar->insertSeparator(mUniboardMainWindow->actionWebBigger); connect(mUniboardMainWindow->actionHome, SIGNAL(triggered()), this , SLOT(slotHome())); diff --git a/src/web/browser/WBDownloadManager.cpp b/src/web/browser/WBDownloadManager.cpp index f45976d8..1b3206f6 100644 --- a/src/web/browser/WBDownloadManager.cpp +++ b/src/web/browser/WBDownloadManager.cpp @@ -58,8 +58,6 @@ #include #include -#include "frameworks/UBDesktopServices.h" - #include "network/UBAutoSaver.h" #include "network/UBNetworkAccessManager.h" #include "frameworks/UBFileSystemUtils.h" @@ -134,7 +132,7 @@ void WBDownloadItem::getFileName() { QSettings settings; settings.beginGroup(QLatin1String("downloadmanager")); - QString defaultLocation = !mCustomDownloadPath.isEmpty() ? mCustomDownloadPath : UBDesktopServices::storageLocation(QDesktopServices::DesktopLocation); + QString defaultLocation = !mCustomDownloadPath.isEmpty() ? mCustomDownloadPath : QDesktopServices::storageLocation(QDesktopServices::DesktopLocation); QString downloadDirectory = settings.value(QLatin1String("downloadDirectory"), defaultLocation).toString(); if (!downloadDirectory.isEmpty()) downloadDirectory += QLatin1Char('/'); diff --git a/src/web/browser/WBTabWidget.cpp b/src/web/browser/WBTabWidget.cpp index 70b3b1d2..2d610a1f 100644 --- a/src/web/browser/WBTabWidget.cpp +++ b/src/web/browser/WBTabWidget.cpp @@ -251,7 +251,6 @@ WBTabWidget::WBTabWidget(QWidget *parent) mLineEdits->setMinimumWidth(200); QSizePolicy spolicy = mLineEdits->sizePolicy(); mLineEdits->setSizePolicy(QSizePolicy::Maximum, spolicy.verticalPolicy()); - } void WBTabWidget::clear() diff --git a/src/web/browser/WBTabWidget.h b/src/web/browser/WBTabWidget.h index ccc90517..4e7874b2 100644 --- a/src/web/browser/WBTabWidget.h +++ b/src/web/browser/WBTabWidget.h @@ -138,7 +138,7 @@ class WBWebActionMapper : public QObject */ class WBTabWidget : public QTabWidget { - Q_OBJECT; + Q_OBJECT signals: // tab widget signals @@ -171,8 +171,10 @@ class WBTabWidget : public QTabWidget QByteArray saveState() const; bool restoreState(const QByteArray &state); - WBTabBar* tabBar() { return mTabBar; }; - QStackedWidget* lineEdits() { return mLineEdits; }; + WBTabBar* tabBar() { return mTabBar; } + QStackedWidget* lineEdits() { return mLineEdits; } + + void setLineEditStackVisible(bool visible) {mLineEdits->setVisible(visible);mLineEdits->hide();} protected: void mouseDoubleClickEvent(QMouseEvent *event); void contextMenuEvent(QContextMenuEvent *event);