").appendTo(img_tmp)
diff --git a/resources/library/search/ImgSearch.wgs/config.xml b/resources/library/search/Google images.wgs/config.xml
similarity index 100%
rename from resources/library/search/ImgSearch.wgs/config.xml
rename to resources/library/search/Google images.wgs/config.xml
diff --git a/resources/library/search/ImgSearch.wgs/css/basic.css b/resources/library/search/Google images.wgs/css/basic.css
similarity index 100%
rename from resources/library/search/ImgSearch.wgs/css/basic.css
rename to resources/library/search/Google images.wgs/css/basic.css
diff --git a/resources/library/search/ImgSearch.wgs/icon.png b/resources/library/search/Google images.wgs/icon.png
similarity index 100%
rename from resources/library/search/ImgSearch.wgs/icon.png
rename to resources/library/search/Google images.wgs/icon.png
diff --git a/resources/library/search/ImgSearch.wgs/icon.thumbnail.png b/resources/library/search/Google images.wgs/icon.thumbnail.png
similarity index 100%
rename from resources/library/search/ImgSearch.wgs/icon.thumbnail.png
rename to resources/library/search/Google images.wgs/icon.thumbnail.png
diff --git a/resources/library/search/ImgSearch.wgs/images/down.png b/resources/library/search/Google images.wgs/images/down.png
similarity index 100%
rename from resources/library/search/ImgSearch.wgs/images/down.png
rename to resources/library/search/Google images.wgs/images/down.png
diff --git a/resources/library/search/ImgSearch.wgs/images/greySquare.png b/resources/library/search/Google images.wgs/images/greySquare.png
similarity index 100%
rename from resources/library/search/ImgSearch.wgs/images/greySquare.png
rename to resources/library/search/Google images.wgs/images/greySquare.png
diff --git a/resources/library/search/ImgSearch.wgs/images/icon-close.png b/resources/library/search/Google images.wgs/images/icon-close.png
similarity index 100%
rename from resources/library/search/ImgSearch.wgs/images/icon-close.png
rename to resources/library/search/Google images.wgs/images/icon-close.png
diff --git a/resources/library/search/ImgSearch.wgs/images/popupBack.png b/resources/library/search/Google images.wgs/images/popupBack.png
similarity index 100%
rename from resources/library/search/ImgSearch.wgs/images/popupBack.png
rename to resources/library/search/Google images.wgs/images/popupBack.png
diff --git a/resources/library/search/ImgSearch.wgs/images/search.png b/resources/library/search/Google images.wgs/images/search.png
similarity index 100%
rename from resources/library/search/ImgSearch.wgs/images/search.png
rename to resources/library/search/Google images.wgs/images/search.png
diff --git a/resources/library/search/ImgSearch.wgs/images/trgDown.png b/resources/library/search/Google images.wgs/images/trgDown.png
similarity index 100%
rename from resources/library/search/ImgSearch.wgs/images/trgDown.png
rename to resources/library/search/Google images.wgs/images/trgDown.png
diff --git a/resources/library/search/ImgSearch.wgs/images/trgUp.png b/resources/library/search/Google images.wgs/images/trgUp.png
similarity index 100%
rename from resources/library/search/ImgSearch.wgs/images/trgUp.png
rename to resources/library/search/Google images.wgs/images/trgUp.png
diff --git a/resources/library/search/ImgSearch.wgs/images/up.png b/resources/library/search/Google images.wgs/images/up.png
similarity index 100%
rename from resources/library/search/ImgSearch.wgs/images/up.png
rename to resources/library/search/Google images.wgs/images/up.png
diff --git a/resources/library/search/ImgSearch.wgs/index.html b/resources/library/search/Google images.wgs/index.html
similarity index 100%
rename from resources/library/search/ImgSearch.wgs/index.html
rename to resources/library/search/Google images.wgs/index.html
diff --git a/resources/library/search/ImgSearch.wgs/scripts/jquery-1.6.2.min.js b/resources/library/search/Google images.wgs/scripts/jquery-1.6.2.min.js
similarity index 100%
rename from resources/library/search/ImgSearch.wgs/scripts/jquery-1.6.2.min.js
rename to resources/library/search/Google images.wgs/scripts/jquery-1.6.2.min.js
diff --git a/resources/library/shape/white_bubble_speak_left.svg b/resources/library/shape/bulle blanche gauche.svg
similarity index 100%
rename from resources/library/shape/white_bubble_speak_left.svg
rename to resources/library/shape/bulle blanche gauche.svg
diff --git a/resources/library/shape/white_bubble_think.svg b/resources/library/shape/bulle blanche idée.svg
similarity index 100%
rename from resources/library/shape/white_bubble_think.svg
rename to resources/library/shape/bulle blanche idée.svg
diff --git a/resources/library/shape/white_bubble_speak.svg b/resources/library/shape/bulle blanche.svg
similarity index 100%
rename from resources/library/shape/white_bubble_speak.svg
rename to resources/library/shape/bulle blanche.svg
diff --git a/resources/library/shape/blue_bubble_speak_left.svg b/resources/library/shape/bulle bleue gauche.svg
similarity index 100%
rename from resources/library/shape/blue_bubble_speak_left.svg
rename to resources/library/shape/bulle bleue gauche.svg
diff --git a/resources/library/shape/blue_bubble_think.svg b/resources/library/shape/bulle bleue idée.svg
similarity index 100%
rename from resources/library/shape/blue_bubble_think.svg
rename to resources/library/shape/bulle bleue idée.svg
diff --git a/resources/library/shape/blue_bubble_speak.svg b/resources/library/shape/bulle bleue.svg
similarity index 100%
rename from resources/library/shape/blue_bubble_speak.svg
rename to resources/library/shape/bulle bleue.svg
diff --git a/resources/library/shape/grey_bubble_speak_left.svg b/resources/library/shape/bulle grise gauche.svg
similarity index 100%
rename from resources/library/shape/grey_bubble_speak_left.svg
rename to resources/library/shape/bulle grise gauche.svg
diff --git a/resources/library/shape/grey_bubble_think.svg b/resources/library/shape/bulle grise idée.svg
similarity index 100%
rename from resources/library/shape/grey_bubble_think.svg
rename to resources/library/shape/bulle grise idée.svg
diff --git a/resources/library/shape/grey_bubble_speak.svg b/resources/library/shape/bulle grise.svg
similarity index 100%
rename from resources/library/shape/grey_bubble_speak.svg
rename to resources/library/shape/bulle grise.svg
diff --git a/resources/library/shape/red_bubble_speak_left.svg b/resources/library/shape/bulle rouge gauche.svg
similarity index 100%
rename from resources/library/shape/red_bubble_speak_left.svg
rename to resources/library/shape/bulle rouge gauche.svg
diff --git a/resources/library/shape/red_bubble_think.svg b/resources/library/shape/bulle rouge idée.svg
similarity index 100%
rename from resources/library/shape/red_bubble_think.svg
rename to resources/library/shape/bulle rouge idée.svg
diff --git a/resources/library/shape/red_bubble_speak.svg b/resources/library/shape/bulle rouge.svg
similarity index 100%
rename from resources/library/shape/red_bubble_speak.svg
rename to resources/library/shape/bulle rouge.svg
diff --git a/resources/library/shape/nofill_bubble_speak_left.svg b/resources/library/shape/bulle vide gauche.svg
similarity index 100%
rename from resources/library/shape/nofill_bubble_speak_left.svg
rename to resources/library/shape/bulle vide gauche.svg
diff --git a/resources/library/shape/nofill_bubble_think.svg b/resources/library/shape/bulle vide idée.svg
similarity index 100%
rename from resources/library/shape/nofill_bubble_think.svg
rename to resources/library/shape/bulle vide idée.svg
diff --git a/resources/library/shape/nofill_bubble_speak.svg b/resources/library/shape/bulle vide.svg
similarity index 100%
rename from resources/library/shape/nofill_bubble_speak.svg
rename to resources/library/shape/bulle vide.svg
diff --git a/resources/library/shape/white_square_rnd.svg b/resources/library/shape/carré blanc arr.svg
similarity index 100%
rename from resources/library/shape/white_square_rnd.svg
rename to resources/library/shape/carré blanc arr.svg
diff --git a/resources/library/shape/white_square.svg b/resources/library/shape/carré blanc.svg
similarity index 100%
rename from resources/library/shape/white_square.svg
rename to resources/library/shape/carré blanc.svg
diff --git a/resources/library/shape/blue_square_rnd.svg b/resources/library/shape/carré bleu arr.svg
similarity index 100%
rename from resources/library/shape/blue_square_rnd.svg
rename to resources/library/shape/carré bleu arr.svg
diff --git a/resources/library/shape/blue_square.svg b/resources/library/shape/carré bleu.svg
similarity index 100%
rename from resources/library/shape/blue_square.svg
rename to resources/library/shape/carré bleu.svg
diff --git a/resources/library/shape/grey_square_rnd.svg b/resources/library/shape/carré gris arr.svg
similarity index 100%
rename from resources/library/shape/grey_square_rnd.svg
rename to resources/library/shape/carré gris arr.svg
diff --git a/resources/library/shape/grey_square.svg b/resources/library/shape/carré gris.svg
similarity index 100%
rename from resources/library/shape/grey_square.svg
rename to resources/library/shape/carré gris.svg
diff --git a/resources/library/shape/red_square_rnd.svg b/resources/library/shape/carré rouge arr.svg
similarity index 100%
rename from resources/library/shape/red_square_rnd.svg
rename to resources/library/shape/carré rouge arr.svg
diff --git a/resources/library/shape/red_square.svg b/resources/library/shape/carré rouge.svg
similarity index 100%
rename from resources/library/shape/red_square.svg
rename to resources/library/shape/carré rouge.svg
diff --git a/resources/library/shape/nofill_square_rnd.svg b/resources/library/shape/carré vide arr.svg
similarity index 100%
rename from resources/library/shape/nofill_square_rnd.svg
rename to resources/library/shape/carré vide arr.svg
diff --git a/resources/library/shape/nofill_square.svg b/resources/library/shape/carré vide.svg
similarity index 100%
rename from resources/library/shape/nofill_square.svg
rename to resources/library/shape/carré vide.svg
diff --git a/resources/library/shape/carré blanc arr.svg b/resources/library/shape/carré blanc arr.svg
new file mode 100644
index 00000000..a1721d4f
--- /dev/null
+++ b/resources/library/shape/carré blanc arr.svg
@@ -0,0 +1,106 @@
+
+
+
\ No newline at end of file
diff --git a/resources/library/shape/carré blanc.svg b/resources/library/shape/carré blanc.svg
new file mode 100644
index 00000000..9bbb6959
--- /dev/null
+++ b/resources/library/shape/carré blanc.svg
@@ -0,0 +1,113 @@
+
+
+
\ No newline at end of file
diff --git a/resources/library/shape/white_cylinder.svg b/resources/library/shape/cylindre blanc.svg
similarity index 100%
rename from resources/library/shape/white_cylinder.svg
rename to resources/library/shape/cylindre blanc.svg
diff --git a/resources/library/shape/blue_cylinder.svg b/resources/library/shape/cylindre bleu.svg
similarity index 100%
rename from resources/library/shape/blue_cylinder.svg
rename to resources/library/shape/cylindre bleu.svg
diff --git a/resources/library/shape/grey_cylinder.svg b/resources/library/shape/cylindre gris.svg
similarity index 100%
rename from resources/library/shape/grey_cylinder.svg
rename to resources/library/shape/cylindre gris.svg
diff --git a/resources/library/shape/red_cylinder.svg b/resources/library/shape/cylindre rouge.svg
similarity index 100%
rename from resources/library/shape/red_cylinder.svg
rename to resources/library/shape/cylindre rouge.svg
diff --git a/resources/library/shape/nofill_cylinder.svg b/resources/library/shape/cylindre vide.svg
similarity index 100%
rename from resources/library/shape/nofill_cylinder.svg
rename to resources/library/shape/cylindre vide.svg
diff --git a/resources/library/shape/white_disk.svg b/resources/library/shape/disque blanc.svg
similarity index 100%
rename from resources/library/shape/white_disk.svg
rename to resources/library/shape/disque blanc.svg
diff --git a/resources/library/shape/blue_disk.svg b/resources/library/shape/disque bleu.svg
similarity index 100%
rename from resources/library/shape/blue_disk.svg
rename to resources/library/shape/disque bleu.svg
diff --git a/resources/library/shape/grey_disk.svg b/resources/library/shape/disque gris.svg
similarity index 100%
rename from resources/library/shape/grey_disk.svg
rename to resources/library/shape/disque gris.svg
diff --git a/resources/library/shape/red_disk.svg b/resources/library/shape/disque rouge.svg
similarity index 100%
rename from resources/library/shape/red_disk.svg
rename to resources/library/shape/disque rouge.svg
diff --git a/resources/library/shape/nofill_disk.svg b/resources/library/shape/disque vide.svg
similarity index 100%
rename from resources/library/shape/nofill_disk.svg
rename to resources/library/shape/disque vide.svg
diff --git a/resources/library/shape/white_star_rnd.svg b/resources/library/shape/étoile blanche arr.svg
similarity index 100%
rename from resources/library/shape/white_star_rnd.svg
rename to resources/library/shape/étoile blanche arr.svg
diff --git a/resources/library/shape/white_star.svg b/resources/library/shape/étoile blanche.svg
similarity index 100%
rename from resources/library/shape/white_star.svg
rename to resources/library/shape/étoile blanche.svg
diff --git a/resources/library/shape/blue_star_rnd.svg b/resources/library/shape/étoile bleue arr.svg
similarity index 100%
rename from resources/library/shape/blue_star_rnd.svg
rename to resources/library/shape/étoile bleue arr.svg
diff --git a/resources/library/shape/blue_star.svg b/resources/library/shape/étoile bleue.svg
similarity index 100%
rename from resources/library/shape/blue_star.svg
rename to resources/library/shape/étoile bleue.svg
diff --git a/resources/library/shape/grey_star_rnd.svg b/resources/library/shape/étoile grise arr.svg
similarity index 100%
rename from resources/library/shape/grey_star_rnd.svg
rename to resources/library/shape/étoile grise arr.svg
diff --git a/resources/library/shape/grey_star.svg b/resources/library/shape/étoile grise.svg
similarity index 100%
rename from resources/library/shape/grey_star.svg
rename to resources/library/shape/étoile grise.svg
diff --git a/resources/library/shape/red_star_rnd.svg b/resources/library/shape/étoile rouge arr.svg
similarity index 100%
rename from resources/library/shape/red_star_rnd.svg
rename to resources/library/shape/étoile rouge arr.svg
diff --git a/resources/library/shape/red_star.svg b/resources/library/shape/étoile rouge.svg
similarity index 100%
rename from resources/library/shape/red_star.svg
rename to resources/library/shape/étoile rouge.svg
diff --git a/resources/library/shape/nofill_star_rnd.svg b/resources/library/shape/étoile vide arr.svg
similarity index 100%
rename from resources/library/shape/nofill_star_rnd.svg
rename to resources/library/shape/étoile vide arr.svg
diff --git a/resources/library/shape/nofill_star.svg b/resources/library/shape/étoile vide.svg
similarity index 100%
rename from resources/library/shape/nofill_star.svg
rename to resources/library/shape/étoile vide.svg
diff --git a/resources/library/shape/white_arrow_down.svg b/resources/library/shape/flèche blanche bas.svg
similarity index 100%
rename from resources/library/shape/white_arrow_down.svg
rename to resources/library/shape/flèche blanche bas.svg
diff --git a/resources/library/shape/white_arrow_right.svg b/resources/library/shape/flèche blanche droite.svg
similarity index 100%
rename from resources/library/shape/white_arrow_right.svg
rename to resources/library/shape/flèche blanche droite.svg
diff --git a/resources/library/shape/white_arrow_left.svg b/resources/library/shape/flèche blanche gauche.svg
similarity index 100%
rename from resources/library/shape/white_arrow_left.svg
rename to resources/library/shape/flèche blanche gauche.svg
diff --git a/resources/library/shape/white_arrow_up.svg b/resources/library/shape/flèche blanche haut.svg
similarity index 100%
rename from resources/library/shape/white_arrow_up.svg
rename to resources/library/shape/flèche blanche haut.svg
diff --git a/resources/library/shape/blue_arrow_down.svg b/resources/library/shape/flèche bleue bas.svg
similarity index 100%
rename from resources/library/shape/blue_arrow_down.svg
rename to resources/library/shape/flèche bleue bas.svg
diff --git a/resources/library/shape/blue_arrow_right.svg b/resources/library/shape/flèche bleue droite.svg
similarity index 100%
rename from resources/library/shape/blue_arrow_right.svg
rename to resources/library/shape/flèche bleue droite.svg
diff --git a/resources/library/shape/blue_arrow_left.svg b/resources/library/shape/flèche bleue gauche.svg
similarity index 100%
rename from resources/library/shape/blue_arrow_left.svg
rename to resources/library/shape/flèche bleue gauche.svg
diff --git a/resources/library/shape/blue_arrow_up.svg b/resources/library/shape/flèche bleue haut.svg
similarity index 100%
rename from resources/library/shape/blue_arrow_up.svg
rename to resources/library/shape/flèche bleue haut.svg
diff --git a/resources/library/shape/grey_arrow_down.svg b/resources/library/shape/flèche grise bas.svg
similarity index 100%
rename from resources/library/shape/grey_arrow_down.svg
rename to resources/library/shape/flèche grise bas.svg
diff --git a/resources/library/shape/grey_arrow_right.svg b/resources/library/shape/flèche grise droite.svg
similarity index 100%
rename from resources/library/shape/grey_arrow_right.svg
rename to resources/library/shape/flèche grise droite.svg
diff --git a/resources/library/shape/grey_arrow_left.svg b/resources/library/shape/flèche grise gauche.svg
similarity index 100%
rename from resources/library/shape/grey_arrow_left.svg
rename to resources/library/shape/flèche grise gauche.svg
diff --git a/resources/library/shape/grey_arrow_up.svg b/resources/library/shape/flèche grise haut.svg
similarity index 100%
rename from resources/library/shape/grey_arrow_up.svg
rename to resources/library/shape/flèche grise haut.svg
diff --git a/resources/library/shape/red_arrow_down.svg b/resources/library/shape/flèche rouge bas.svg
similarity index 100%
rename from resources/library/shape/red_arrow_down.svg
rename to resources/library/shape/flèche rouge bas.svg
diff --git a/resources/library/shape/red_arrow_right.svg b/resources/library/shape/flèche rouge droite.svg
similarity index 100%
rename from resources/library/shape/red_arrow_right.svg
rename to resources/library/shape/flèche rouge droite.svg
diff --git a/resources/library/shape/red_arrow_left.svg b/resources/library/shape/flèche rouge gauche.svg
similarity index 100%
rename from resources/library/shape/red_arrow_left.svg
rename to resources/library/shape/flèche rouge gauche.svg
diff --git a/resources/library/shape/red_arrow_up.svg b/resources/library/shape/flèche rouge haut.svg
similarity index 100%
rename from resources/library/shape/red_arrow_up.svg
rename to resources/library/shape/flèche rouge haut.svg
diff --git a/resources/library/shape/nofill_arrow_down.svg b/resources/library/shape/flèche vide bas.svg
similarity index 100%
rename from resources/library/shape/nofill_arrow_down.svg
rename to resources/library/shape/flèche vide bas.svg
diff --git a/resources/library/shape/nofill_arrow_right.svg b/resources/library/shape/flèche vide droite.svg
similarity index 100%
rename from resources/library/shape/nofill_arrow_right.svg
rename to resources/library/shape/flèche vide droite.svg
diff --git a/resources/library/shape/nofill_arrow_left.svg b/resources/library/shape/flèche vide gauche.svg
similarity index 100%
rename from resources/library/shape/nofill_arrow_left.svg
rename to resources/library/shape/flèche vide gauche.svg
diff --git a/resources/library/shape/nofill_arrow_up.svg b/resources/library/shape/flèche vide haut.svg
similarity index 100%
rename from resources/library/shape/nofill_arrow_up.svg
rename to resources/library/shape/flèche vide haut.svg
diff --git a/resources/library/shape/flèche blanche bas.svg b/resources/library/shape/flèche blanche bas.svg
new file mode 100644
index 00000000..e4270523
--- /dev/null
+++ b/resources/library/shape/flèche blanche bas.svg
@@ -0,0 +1,102 @@
+
+
+
\ No newline at end of file
diff --git a/resources/library/shape/flèche blanche droite.svg b/resources/library/shape/flèche blanche droite.svg
new file mode 100644
index 00000000..593b5c67
--- /dev/null
+++ b/resources/library/shape/flèche blanche droite.svg
@@ -0,0 +1,103 @@
+
+
+
\ No newline at end of file
diff --git a/resources/library/shape/flèche blanche gauche.svg b/resources/library/shape/flèche blanche gauche.svg
new file mode 100644
index 00000000..90e42e31
--- /dev/null
+++ b/resources/library/shape/flèche blanche gauche.svg
@@ -0,0 +1,102 @@
+
+
+
\ No newline at end of file
diff --git a/resources/library/shape/flèche blanche haut.svg b/resources/library/shape/flèche blanche haut.svg
new file mode 100644
index 00000000..b13c8774
--- /dev/null
+++ b/resources/library/shape/flèche blanche haut.svg
@@ -0,0 +1,103 @@
+
+
+
\ No newline at end of file
diff --git a/resources/library/shape/flèche bleue bas.svg b/resources/library/shape/flèche bleue bas.svg
new file mode 100644
index 00000000..7613a3f2
--- /dev/null
+++ b/resources/library/shape/flèche bleue bas.svg
@@ -0,0 +1,33 @@
+
+
+
+
diff --git a/resources/library/shape/flèche bleue droite.svg b/resources/library/shape/flèche bleue droite.svg
new file mode 100644
index 00000000..cd147f73
--- /dev/null
+++ b/resources/library/shape/flèche bleue droite.svg
@@ -0,0 +1,33 @@
+
+
+
+
diff --git a/resources/library/shape/flèche bleue gauche.svg b/resources/library/shape/flèche bleue gauche.svg
new file mode 100644
index 00000000..64cf0f8a
--- /dev/null
+++ b/resources/library/shape/flèche bleue gauche.svg
@@ -0,0 +1,33 @@
+
+
+
+
diff --git a/resources/library/shape/flèche bleue haut.svg b/resources/library/shape/flèche bleue haut.svg
new file mode 100644
index 00000000..331c491c
--- /dev/null
+++ b/resources/library/shape/flèche bleue haut.svg
@@ -0,0 +1,34 @@
+
+
+
+
diff --git a/resources/library/shape/flèche grise bas.svg b/resources/library/shape/flèche grise bas.svg
new file mode 100644
index 00000000..d68b5218
--- /dev/null
+++ b/resources/library/shape/flèche grise bas.svg
@@ -0,0 +1,34 @@
+
+
+
+
diff --git a/resources/library/shape/flèche grise droite.svg b/resources/library/shape/flèche grise droite.svg
new file mode 100644
index 00000000..32f50aa2
--- /dev/null
+++ b/resources/library/shape/flèche grise droite.svg
@@ -0,0 +1,34 @@
+
+
+
+
diff --git a/resources/library/shape/flèche grise gauche.svg b/resources/library/shape/flèche grise gauche.svg
new file mode 100644
index 00000000..a895bb88
--- /dev/null
+++ b/resources/library/shape/flèche grise gauche.svg
@@ -0,0 +1,34 @@
+
+
+
+
diff --git a/resources/library/shape/flèche grise haut.svg b/resources/library/shape/flèche grise haut.svg
new file mode 100644
index 00000000..d4db8052
--- /dev/null
+++ b/resources/library/shape/flèche grise haut.svg
@@ -0,0 +1,34 @@
+
+
+
+
diff --git a/resources/library/shape/flèche rouge bas.svg b/resources/library/shape/flèche rouge bas.svg
new file mode 100644
index 00000000..96d38b83
--- /dev/null
+++ b/resources/library/shape/flèche rouge bas.svg
@@ -0,0 +1,34 @@
+
+
+
+
diff --git a/resources/library/shape/flèche rouge droite.svg b/resources/library/shape/flèche rouge droite.svg
new file mode 100644
index 00000000..d2fbc359
--- /dev/null
+++ b/resources/library/shape/flèche rouge droite.svg
@@ -0,0 +1,34 @@
+
+
+
+
diff --git a/resources/library/shape/flèche rouge gauche.svg b/resources/library/shape/flèche rouge gauche.svg
new file mode 100644
index 00000000..336a1e11
--- /dev/null
+++ b/resources/library/shape/flèche rouge gauche.svg
@@ -0,0 +1,34 @@
+
+
+
+
diff --git a/resources/library/shape/flèche rouge haut.svg b/resources/library/shape/flèche rouge haut.svg
new file mode 100644
index 00000000..6dd21956
--- /dev/null
+++ b/resources/library/shape/flèche rouge haut.svg
@@ -0,0 +1,34 @@
+
+
+
+
diff --git a/resources/library/shape/flèche vide bas.svg b/resources/library/shape/flèche vide bas.svg
new file mode 100644
index 00000000..07ce46d0
--- /dev/null
+++ b/resources/library/shape/flèche vide bas.svg
@@ -0,0 +1,16 @@
+
+
+
+
diff --git a/resources/library/shape/flèche vide droite.svg b/resources/library/shape/flèche vide droite.svg
new file mode 100644
index 00000000..ee87f755
--- /dev/null
+++ b/resources/library/shape/flèche vide droite.svg
@@ -0,0 +1,16 @@
+
+
+
+
diff --git a/resources/library/shape/flèche vide gauche.svg b/resources/library/shape/flèche vide gauche.svg
new file mode 100644
index 00000000..198f69da
--- /dev/null
+++ b/resources/library/shape/flèche vide gauche.svg
@@ -0,0 +1,16 @@
+
+
+
+
diff --git a/resources/library/shape/flèche vide haut.svg b/resources/library/shape/flèche vide haut.svg
new file mode 100644
index 00000000..54433be6
--- /dev/null
+++ b/resources/library/shape/flèche vide haut.svg
@@ -0,0 +1,16 @@
+
+
+
+
diff --git a/resources/library/shape/white_exagon.svg b/resources/library/shape/hexagone blanc.svg
similarity index 100%
rename from resources/library/shape/white_exagon.svg
rename to resources/library/shape/hexagone blanc.svg
diff --git a/resources/library/shape/blue_exagon.svg b/resources/library/shape/hexagone bleu.svg
similarity index 100%
rename from resources/library/shape/blue_exagon.svg
rename to resources/library/shape/hexagone bleu.svg
diff --git a/resources/library/shape/grey_exagon.svg b/resources/library/shape/hexagone gris.svg
similarity index 100%
rename from resources/library/shape/grey_exagon.svg
rename to resources/library/shape/hexagone gris.svg
diff --git a/resources/library/shape/red_exagon.svg b/resources/library/shape/hexagone rouge.svg
similarity index 100%
rename from resources/library/shape/red_exagon.svg
rename to resources/library/shape/hexagone rouge.svg
diff --git a/resources/library/shape/nofill_exagon.svg b/resources/library/shape/hexagone vide.svg
similarity index 100%
rename from resources/library/shape/nofill_exagon.svg
rename to resources/library/shape/hexagone vide.svg
diff --git a/resources/library/shape/white_pentagon.svg b/resources/library/shape/pentagone blanc.svg
similarity index 100%
rename from resources/library/shape/white_pentagon.svg
rename to resources/library/shape/pentagone blanc.svg
diff --git a/resources/library/shape/blue_pentagon.svg b/resources/library/shape/pentagone bleu.svg
similarity index 100%
rename from resources/library/shape/blue_pentagon.svg
rename to resources/library/shape/pentagone bleu.svg
diff --git a/resources/library/shape/grey_pentagon.svg b/resources/library/shape/pentagone gris.svg
similarity index 100%
rename from resources/library/shape/grey_pentagon.svg
rename to resources/library/shape/pentagone gris.svg
diff --git a/resources/library/shape/red_pentagon.svg b/resources/library/shape/pentagone rouge.svg
similarity index 100%
rename from resources/library/shape/red_pentagon.svg
rename to resources/library/shape/pentagone rouge.svg
diff --git a/resources/library/shape/nofill_pentagon.svg b/resources/library/shape/pentagone vide.svg
similarity index 100%
rename from resources/library/shape/nofill_pentagon.svg
rename to resources/library/shape/pentagone vide.svg
diff --git a/resources/library/shape/white_rectangle_rnd.svg b/resources/library/shape/rectangle blanc arr.svg
similarity index 100%
rename from resources/library/shape/white_rectangle_rnd.svg
rename to resources/library/shape/rectangle blanc arr.svg
diff --git a/resources/library/shape/white_rectangle.svg b/resources/library/shape/rectangle blanc.svg
similarity index 100%
rename from resources/library/shape/white_rectangle.svg
rename to resources/library/shape/rectangle blanc.svg
diff --git a/resources/library/shape/blue_rectangle_rnd.svg b/resources/library/shape/rectangle bleu arr.svg
similarity index 100%
rename from resources/library/shape/blue_rectangle_rnd.svg
rename to resources/library/shape/rectangle bleu arr.svg
diff --git a/resources/library/shape/blue_rectangle.svg b/resources/library/shape/rectangle bleu.svg
similarity index 100%
rename from resources/library/shape/blue_rectangle.svg
rename to resources/library/shape/rectangle bleu.svg
diff --git a/resources/library/shape/grey_rectangle_rnd.svg b/resources/library/shape/rectangle gris arr.svg
similarity index 100%
rename from resources/library/shape/grey_rectangle_rnd.svg
rename to resources/library/shape/rectangle gris arr.svg
diff --git a/resources/library/shape/grey_rectangle.svg b/resources/library/shape/rectangle gris.svg
similarity index 100%
rename from resources/library/shape/grey_rectangle.svg
rename to resources/library/shape/rectangle gris.svg
diff --git a/resources/library/shape/red_rectangle_rnd.svg b/resources/library/shape/rectangle rouge arr.svg
similarity index 100%
rename from resources/library/shape/red_rectangle_rnd.svg
rename to resources/library/shape/rectangle rouge arr.svg
diff --git a/resources/library/shape/red_rectangle.svg b/resources/library/shape/rectangle rouge.svg
similarity index 100%
rename from resources/library/shape/red_rectangle.svg
rename to resources/library/shape/rectangle rouge.svg
diff --git a/resources/library/shape/nofill_rectangle_rnd.svg b/resources/library/shape/rectangle vide arr.svg
similarity index 100%
rename from resources/library/shape/nofill_rectangle_rnd.svg
rename to resources/library/shape/rectangle vide arr.svg
diff --git a/resources/library/shape/nofill_rectangle.svg b/resources/library/shape/rectangle vide.svg
similarity index 100%
rename from resources/library/shape/nofill_rectangle.svg
rename to resources/library/shape/rectangle vide.svg
diff --git a/resources/library/shape/white_triangle_rnd.svg b/resources/library/shape/triangle blanc arr.svg
similarity index 100%
rename from resources/library/shape/white_triangle_rnd.svg
rename to resources/library/shape/triangle blanc arr.svg
diff --git a/resources/library/shape/white_triangle.svg b/resources/library/shape/triangle blanc.svg
similarity index 100%
rename from resources/library/shape/white_triangle.svg
rename to resources/library/shape/triangle blanc.svg
diff --git a/resources/library/shape/blue_triangle_rnd.svg b/resources/library/shape/triangle bleu arr.svg
similarity index 100%
rename from resources/library/shape/blue_triangle_rnd.svg
rename to resources/library/shape/triangle bleu arr.svg
diff --git a/resources/library/shape/blue_triangle.svg b/resources/library/shape/triangle bleu.svg
similarity index 100%
rename from resources/library/shape/blue_triangle.svg
rename to resources/library/shape/triangle bleu.svg
diff --git a/resources/library/shape/grey_triangle_rnd.svg b/resources/library/shape/triangle gris arr.svg
similarity index 100%
rename from resources/library/shape/grey_triangle_rnd.svg
rename to resources/library/shape/triangle gris arr.svg
diff --git a/resources/library/shape/grey_triangle.svg b/resources/library/shape/triangle gris.svg
similarity index 100%
rename from resources/library/shape/grey_triangle.svg
rename to resources/library/shape/triangle gris.svg
diff --git a/resources/library/shape/red_triangle_rnd.svg b/resources/library/shape/triangle rouge arr.svg
similarity index 100%
rename from resources/library/shape/red_triangle_rnd.svg
rename to resources/library/shape/triangle rouge arr.svg
diff --git a/resources/library/shape/red_triangle.svg b/resources/library/shape/triangle rouge.svg
similarity index 100%
rename from resources/library/shape/red_triangle.svg
rename to resources/library/shape/triangle rouge.svg
diff --git a/resources/library/shape/nofill_triangle_rnd.svg b/resources/library/shape/triangle vide arr.svg
similarity index 100%
rename from resources/library/shape/nofill_triangle_rnd.svg
rename to resources/library/shape/triangle vide arr.svg
diff --git a/resources/library/shape/nofill_triangle.svg b/resources/library/shape/triangle vide.svg
similarity index 100%
rename from resources/library/shape/nofill_triangle.svg
rename to resources/library/shape/triangle vide.svg
diff --git a/resources/library/shape/étoile blanche arr.svg b/resources/library/shape/étoile blanche arr.svg
new file mode 100644
index 00000000..ccc1232e
--- /dev/null
+++ b/resources/library/shape/étoile blanche arr.svg
@@ -0,0 +1,140 @@
+
+
+
\ No newline at end of file
diff --git a/resources/library/shape/étoile blanche.svg b/resources/library/shape/étoile blanche.svg
new file mode 100644
index 00000000..728fe939
--- /dev/null
+++ b/resources/library/shape/étoile blanche.svg
@@ -0,0 +1,124 @@
+
+
+
\ No newline at end of file
diff --git a/resources/library/shape/étoile bleue arr.svg b/resources/library/shape/étoile bleue arr.svg
new file mode 100644
index 00000000..da45d59b
--- /dev/null
+++ b/resources/library/shape/étoile bleue arr.svg
@@ -0,0 +1,38 @@
+
+
+
+
diff --git a/resources/library/shape/étoile bleue.svg b/resources/library/shape/étoile bleue.svg
new file mode 100644
index 00000000..516b7180
--- /dev/null
+++ b/resources/library/shape/étoile bleue.svg
@@ -0,0 +1,29 @@
+
+
+
+
diff --git a/resources/library/shape/étoile vide arr.svg b/resources/library/shape/étoile vide arr.svg
new file mode 100644
index 00000000..5980afe0
--- /dev/null
+++ b/resources/library/shape/étoile vide arr.svg
@@ -0,0 +1,18 @@
+
+
+
+
diff --git a/resources/library/shape/étoile vide.svg b/resources/library/shape/étoile vide.svg
new file mode 100644
index 00000000..fcc08260
--- /dev/null
+++ b/resources/library/shape/étoile vide.svg
@@ -0,0 +1,14 @@
+
+
+
+
diff --git a/src/adaptors/UBCFFSubsetAdaptor.cpp b/src/adaptors/UBCFFSubsetAdaptor.cpp
index 1dff442d..016af489 100644
--- a/src/adaptors/UBCFFSubsetAdaptor.cpp
+++ b/src/adaptors/UBCFFSubsetAdaptor.cpp
@@ -54,6 +54,8 @@ static QString tIwb = "iwb";
static QString tMeta = "meta";
static QString tPage = "page";
static QString tPageset = "pageset";
+static QString tG = "g";
+static QString tSwitch = "switch";
static QString tPolygon = "polygon";
static QString tPolyline = "polyline";
static QString tRect = "rect";
@@ -64,7 +66,7 @@ static QString tTspan = "tspan";
static QString tBreak = "tbreak";
static QString tImage = "image";
static QString tFlash = "flash";
-static QString tAudio = "audio";
+static QString tAudio = "a";
static QString tVideo = "video";
//attribute names definition
@@ -163,6 +165,31 @@ bool UBCFFSubsetAdaptor::UBCFFSubsetReader::parse()
return result;
}
+
+bool UBCFFSubsetAdaptor::UBCFFSubsetReader::parseGSection(const QDomElement &element)
+{
+ QDomElement currentSvgElement = element.firstChildElement();
+ while (!currentSvgElement.isNull()) {
+ if (!parseSvgElement(currentSvgElement))
+ return false;
+
+ currentSvgElement = currentSvgElement.nextSiblingElement();
+ }
+
+ return true;
+}
+bool UBCFFSubsetAdaptor::UBCFFSubsetReader::parseSvgSwitchSection(const QDomElement &element)
+{
+
+ QDomElement currentSvgElement = element.firstChildElement();
+ while (!currentSvgElement.isNull()) {
+ if (parseSvgElement(currentSvgElement))
+ return true;
+ }
+
+ return false;
+}
+
bool UBCFFSubsetAdaptor::UBCFFSubsetReader::parseSvgRect(const QDomElement &element)
{
qreal x1 = element.attribute(aX).toDouble();
@@ -177,7 +204,12 @@ bool UBCFFSubsetAdaptor::UBCFFSubsetReader::parseSvgRect(const QDomElement &elem
QColor fillColor = !textFillColor.isNull() ? colorFromString(textFillColor) : QColor();
QColor strokeColor = !textStrokeColor.isNull() ? colorFromString(textStrokeColor) : QColor();
- int strokeWidth = !textStrokeWidth.isNull() ? textStrokeWidth.toInt() : 0;
+ int strokeWidth = textStrokeWidth.toInt();
+
+ x1 -= strokeWidth/2;
+ y1 -= strokeWidth/2;
+ width += strokeWidth;
+ height += strokeWidth;
//init svg generator with temp file
QSvgGenerator *generator = createSvgGenerator(width, height);
@@ -206,13 +238,13 @@ bool UBCFFSubsetAdaptor::UBCFFSubsetReader::parseSvgRect(const QDomElement &elem
UBGraphicsSvgItem *svgItem = mCurrentScene->addSvg(QUrl::fromLocalFile(generator->fileName()));
QTransform transform;
QString textTransform = element.attribute(aTransform);
- bool hastransform = false;
+
+ svgItem->resetTransform();
if (!textTransform.isNull()) {
- transform = transformFromString(textTransform);
- hastransform = true;
+ transform = transformFromString(textTransform, svgItem);
}
- repositionSvgItem(svgItem, width, height, x1, y1, hastransform, transform);
+ repositionSvgItem(svgItem, width, height, x1, y1, transform);
hashSceneItem(element, svgItem);
delete generator;
@@ -251,13 +283,14 @@ bool UBCFFSubsetAdaptor::UBCFFSubsetReader::parseSvgEllipse(const QDomElement &e
UBGraphicsSvgItem *svgItem = mCurrentScene->addSvg(QUrl::fromLocalFile(generator->fileName()));
QTransform transform;
QString textTransform = element.attribute(aTransform);
- bool hastransform = false;
+
+ svgItem->resetTransform();
if (!textTransform.isNull()) {
- transform = transformFromString(textTransform);
- hastransform = true;
+ transform = transformFromString(textTransform, svgItem);
}
- repositionSvgItem(svgItem, rx * 2, ry * 2, cx - rx , cy - ry, hastransform, transform);
+
+ repositionSvgItem(svgItem, rx * 2, ry * 2, cx - 2*rx, cy+ry, transform);
hashSceneItem(element, svgItem);
delete generator;
@@ -308,7 +341,7 @@ bool UBCFFSubsetAdaptor::UBCFFSubsetReader::parseSvgPolygon(const QDomElement &e
QColor strokeColor = !strokeColorText.isEmpty() ? colorFromString(strokeColorText) : QColor();
QColor fillColor = !fillColorText.isEmpty() ? colorFromString(fillColorText) : QColor();
- int strokeWidth = strokeWidthText.toInt() > 0 ? strokeWidthText.toInt() : 0;
+ int strokeWidth = strokeWidthText.toDouble();
QPen pen;
pen.setColor(strokeColor);
@@ -334,12 +367,12 @@ bool UBCFFSubsetAdaptor::UBCFFSubsetReader::parseSvgPolygon(const QDomElement &e
UBGraphicsSvgItem *svgItem = mCurrentScene->addSvg(QUrl::fromLocalFile(generator->fileName()));
QTransform transform;
QString textTransform = element.attribute(aTransform);
- bool hastransform = false;
+
+ svgItem->resetTransform();
if (!textTransform.isNull()) {
- transform = transformFromString(textTransform);
- hastransform = true;
+ transform = transformFromString(textTransform, svgItem);
}
- repositionSvgItem(svgItem, width + 10, height + 10, x1 - 5, y1 - 5, hastransform, transform);
+ repositionSvgItem(svgItem, width +strokeWidth, height + strokeWidth, x1 - strokeWidth/2 + transform.m31(), y1 + strokeWidth/2 + transform.m32(), transform);
hashSceneItem(element, svgItem);
delete generator;
@@ -389,7 +422,10 @@ bool UBCFFSubsetAdaptor::UBCFFSubsetReader::parseSvgPolyline(const QDomElement &
QString strokeWidthText = element.attribute(aStrokewidth);
QColor strokeColor = !strokeColorText.isEmpty() ? colorFromString(strokeColorText) : QColor();
- int strokeWidth = strokeWidthText.toInt() > 0 ? strokeWidthText.toInt() : 0;
+ int strokeWidth = strokeWidthText.toDouble();
+
+ width += strokeWidth;
+ height += strokeWidth;
QPen pen;
pen.setColor(strokeColor);
@@ -400,7 +436,7 @@ bool UBCFFSubsetAdaptor::UBCFFSubsetReader::parseSvgPolyline(const QDomElement &
painter.begin(generator); //drawing to svg tmp file
- painter.translate(pen.widthF() / 2 - x1, pen.widthF() / 2 - y1);
+ painter.translate(pen.widthF()/2 - x1, pen.widthF()/2- y1);
painter.setPen(pen);
painter.drawPolyline(polygon);
@@ -410,12 +446,12 @@ bool UBCFFSubsetAdaptor::UBCFFSubsetReader::parseSvgPolyline(const QDomElement &
UBGraphicsSvgItem *svgItem = mCurrentScene->addSvg(QUrl::fromLocalFile(generator->fileName()));
QTransform transform;
QString textTransform = element.attribute(aTransform);
- bool hastransform = false;
+
+ svgItem->resetTransform();
if (!textTransform.isNull()) {
- transform = transformFromString(textTransform);
- hastransform = true;
+ transform = transformFromString(textTransform, svgItem);
}
- repositionSvgItem(svgItem, width + 10, height + 10, x1 - 5, y1 - 5, hastransform, transform);
+ repositionSvgItem(svgItem, width +strokeWidth, height + strokeWidth, x1 + transform.m31() - strokeWidth/2, y1 + transform.m32() + strokeWidth/2, transform);
hashSceneItem(element, svgItem);
delete generator;
@@ -539,7 +575,6 @@ bool UBCFFSubsetAdaptor::UBCFFSubsetReader::parseSvgText(const QDomElement &elem
// remember if text area has transform
// QString transformString;
QTransform transform = fontTransform;
- bool hasTransform = !fontTransform.isIdentity();
QRectF lastDrawnTextBoundingRect;
//parse text area tags
@@ -554,7 +589,8 @@ bool UBCFFSubsetAdaptor::UBCFFSubsetReader::parseSvgText(const QDomElement &elem
//add resulting svg file to scene
UBGraphicsSvgItem *svgItem = mCurrentScene->addSvg(QUrl::fromLocalFile(generator->fileName()));
- repositionSvgItem(svgItem, width, height, x, y, hasTransform, transform);
+ svgItem->resetTransform();
+ repositionSvgItem(svgItem, width, height, x + transform.m31(), y + transform.m32(), transform);
hashSceneItem(element, svgItem);
delete generator;
@@ -661,10 +697,10 @@ bool UBCFFSubsetAdaptor::UBCFFSubsetReader::parseSvgTextarea(const QDomElement &
QTransform transform;
QString textTransform = element.attribute(aTransform);
- bool hastransform = false;
+
+ svgItem->resetTransform();
if (!textTransform.isNull()) {
- transform = transformFromString(textTransform);
- hastransform = true;
+ transform = transformFromString(textTransform, svgItem);
}
//by default all the textAreas are not editable
@@ -673,7 +709,7 @@ bool UBCFFSubsetAdaptor::UBCFFSubsetReader::parseSvgTextarea(const QDomElement &
curDelegate->setEditable(false);
}
- repositionSvgItem(svgItem, width, height, x, y, hastransform, transform);
+ repositionSvgItem(svgItem, width, height, x + transform.m31(), y + transform.m32(), transform);
hashSceneItem(element, svgItem);
return true;
@@ -705,12 +741,12 @@ bool UBCFFSubsetAdaptor::UBCFFSubsetReader::parseSvgImage(const QDomElement &ele
UBGraphicsPixmapItem *pixItem = mCurrentScene->addPixmap(pix);
QTransform transform;
QString textTransform = element.attribute(aTransform);
- bool hastransform = false;
+
+ pixItem->resetTransform();
if (!textTransform.isNull()) {
- transform = transformFromString(textTransform);
- hastransform = true;
+ transform = transformFromString(textTransform, pixItem);
}
- repositionSvgItem(pixItem, width, height, x, y, hastransform, transform);
+ repositionSvgItem(pixItem, width, height, x + transform.m31(), y + transform.m32(), transform);
hashSceneItem(element, pixItem);
return true;
@@ -747,10 +783,12 @@ bool UBCFFSubsetAdaptor::UBCFFSubsetReader::parseSvgFlash(const QDomElement &ele
QTransform transform;
QString textTransform = element.attribute(aTransform);
+
+ flashItem->resetTransform();
if (!textTransform.isNull()) {
- transform = transformFromString(textTransform);
+ transform = transformFromString(textTransform, flashItem);
}
- repositionSvgItem(flashItem, width, height, x, y, true, transform);
+ repositionSvgItem(flashItem, width, height, x + transform.m31(), y + transform.m32(), transform);
hashSceneItem(element, flashItem);
return true;
@@ -758,32 +796,42 @@ bool UBCFFSubsetAdaptor::UBCFFSubsetReader::parseSvgFlash(const QDomElement &ele
bool UBCFFSubsetAdaptor::UBCFFSubsetReader::parseSvgAudio(const QDomElement &element)
{
- qreal x = element.attribute(aX).toDouble();
- qreal y = element.attribute(aY).toDouble();
- qreal width = element.attribute(aWidth).toDouble();
- qreal height = element.attribute(aHeight).toDouble();
+ QDomElement parentOfAudio = element.firstChild().toElement();
+
+ qreal x = parentOfAudio.attribute(aX).toDouble();
+ qreal y = parentOfAudio.attribute(aY).toDouble();
QString itemRefPath = element.attribute(aHref);
- QUrl urlPath;
+ QUrl concreteUrl;
if (!itemRefPath.isNull()) {
- QString videoPath = pwdContent + "/" + itemRefPath;
- if (!QFile::exists(videoPath)) {
+ QString audioPath = pwdContent + "/" + itemRefPath;
+ if (!QFile::exists(audioPath)) {
qDebug() << "can't load file" << pwdContent + "/" + itemRefPath << "maybe file corrupted";
return false;
}
- urlPath = QUrl::fromLocalFile(videoPath);
+ concreteUrl = QUrl::fromLocalFile(audioPath);
}
- UBGraphicsAudioItem *audioItem = mCurrentScene->addAudio(urlPath, false);
+ QUuid uuid = QUuid::createUuid();
+
+#ifdef Q_WS_X11
+ concreteUrl = QUrl::fromLocalFile(mCurrentScene->document()->persistencePath() + "/" + UBPersistenceManager::persistenceManager()
+ ->addAudioFileToDocument(mCurrentScene->document(), concreteUrl.toLocalFile(), uuid));
+#else
+ concreteUrl = QUrl::fromLocalFile(UBPersistenceManager::persistenceManager()
+ ->addAudioFileToDocument(mCurrentScene->document(), concreteUrl.toLocalFile(), uuid));
+#endif
+
+ UBGraphicsAudioItem *audioItem = mCurrentScene->addAudio(concreteUrl, false);
QTransform transform;
- QString textTransform = element.attribute(aTransform);
- bool hastransform = false;
+ QString textTransform = parentOfAudio.attribute(aTransform);
+
+ audioItem->resetTransform();
if (!textTransform.isNull()) {
- transform = transformFromString(textTransform);
- hastransform = true;
+ transform = transformFromString(textTransform, audioItem);
}
- repositionSvgItem(audioItem, width, height, x, y, hastransform, transform);
+ repositionSvgItem(audioItem, audioItem->boundingRect().width(), audioItem->boundingRect().height(), x + transform.m31(), y + transform.m32(), transform);
hashSceneItem(element, audioItem);
return true;
@@ -795,31 +843,38 @@ bool UBCFFSubsetAdaptor::UBCFFSubsetReader::parseSvgVideo(const QDomElement &ele
if (parseSvgFlash(element)) return true;
else return false;
}
-
qreal x = element.attribute(aX).toDouble();
qreal y = element.attribute(aY).toDouble();
- qreal width = element.attribute(aWidth).toDouble();
- qreal height = element.attribute(aHeight).toDouble();
- QUrl urlPath;
+ QUrl concreteUrl;
if (!itemRefPath.isNull()) {
QString videoPath = pwdContent + "/" + itemRefPath;
if (!QFile::exists(videoPath)) {
qDebug() << "can't load file" << pwdContent + "/" + itemRefPath << "maybe file corrupted";
return false;
}
- urlPath = QUrl::fromLocalFile(videoPath);
+ concreteUrl = QUrl::fromLocalFile(videoPath);
}
- UBGraphicsVideoItem *videoItem = mCurrentScene->addVideo(urlPath, false);
+ QUuid uuid = QUuid::createUuid();
+
+#ifdef Q_WS_X11
+ concreteUrl = QUrl::fromLocalFile(mCurrentScene->document()->persistencePath() + "/" + UBPersistenceManager::persistenceManager()
+ ->addVideoFileToDocument(mCurrentScene->document(), concreteUrl.toLocalFile(), uuid));
+#else
+ concreteUrl = QUrl::fromLocalFile(UBPersistenceManager::persistenceManager()
+ ->addVideoFileToDocument(mCurrentScene->document(), concreteUrl.toLocalFile(), uuid));
+#endif
+
+ UBGraphicsVideoItem *videoItem = mCurrentScene->addVideo(concreteUrl, false);
QTransform transform;
QString textTransform = element.attribute(aTransform);
- bool hastransform = false;
+
+ videoItem->resetTransform();
if (!textTransform.isNull()) {
- transform = transformFromString(textTransform);
- hastransform = true;
+ transform = transformFromString(textTransform, videoItem);
}
- repositionSvgItem(videoItem, width, height, x - 5, y - 5, hastransform, transform);
+ repositionSvgItem(videoItem, videoItem->boundingRect().width(), videoItem->boundingRect().height(), x + transform.m31(), y + transform.m32(), transform);
hashSceneItem(element, videoItem);
return true;
@@ -849,16 +904,18 @@ bool UBCFFSubsetAdaptor::UBCFFSubsetReader::parseSvgElement(const QDomElement &p
return false;
}
- if (tagName == tRect && !parseSvgRect(parent)) return false;
- else if (tagName == tEllipse && !parseSvgEllipse(parent)) return false;
- else if (tagName == tPolygon && !parseSvgPolygon(parent)) return false;
- else if (tagName == tPolyline && !parseSvgPolyline(parent)) return false;
- else if (tagName == tText && !parseSvgText(parent)) return false;
- else if (tagName == tTextarea && !parseSvgTextarea(parent)) return false;
- else if (tagName == tImage && !parseSvgImage(parent)) return false;
- else if (tagName == tFlash && !parseSvgFlash(parent)) return false;
- else if (tagName == tAudio && !parseSvgAudio(parent)) return false;
- else if (tagName == tVideo && !parseSvgVideo(parent)) return false;
+ if (tagName == tG && !parseGSection(parent)) return false;
+ else if (tagName == tSwitch && !parseSvgSwitchSection(parent)) return false;
+ else if (tagName == tRect && !parseSvgRect(parent)) return false;
+ else if (tagName == tEllipse && !parseSvgEllipse(parent)) return false;
+ else if (tagName == tPolygon && !parseSvgPolygon(parent)) return false;
+ else if (tagName == tPolyline && !parseSvgPolyline(parent)) return false;
+ else if (tagName == tText && !parseSvgText(parent)) return false;
+ else if (tagName == tTextarea && !parseSvgTextarea(parent)) return false;
+ else if (tagName == tImage && !parseSvgImage(parent)) return false;
+ else if (tagName == tFlash && !parseSvgFlash(parent)) return false;
+ else if (tagName == tAudio && !parseSvgAudio(parent)) return false;
+ else if (tagName == tVideo && !parseSvgVideo(parent)) return false;
return true;
}
@@ -986,7 +1043,7 @@ bool UBCFFSubsetAdaptor::UBCFFSubsetReader::parseDoc()
void UBCFFSubsetAdaptor::UBCFFSubsetReader::repositionSvgItem(QGraphicsItem *item, qreal width, qreal height,
qreal x, qreal y,
- bool useTransform, QTransform &transform)
+ QTransform &transform)
{
//First using viebox coordinates, then translate them to scene coordinates
@@ -998,29 +1055,32 @@ void UBCFFSubsetAdaptor::UBCFFSubsetReader::repositionSvgItem(QGraphicsItem *ite
qreal fullScaleX = mVBTransFactor * xScale;
qreal fullScaleY = mVBTransFactor * yScale;
- if (useTransform) { //if rotation or translation specified
- QPointF oldVector((x - transform.dx()), (y - transform.dy()));
- QTransform rTransform(transform.m11(), transform.m12(), transform.m21(), transform.m22(), 0, 0);
- QPointF newVector = rTransform.map(oldVector);
-
- item->setTransform(rTransform.scale(fullScaleX, fullScaleY));
- item->setPos((x - mViewBoxCenter.x() + (newVector - oldVector).x()) * mVBTransFactor,
- (y - mViewBoxCenter.y() + (newVector - oldVector).y()) * mVBTransFactor);
- } else { //item is't rotated or translated
- item->setTransform(QTransform(fullScaleX, 0, 0, fullScaleY, 0, 0));
- itemBounds = item->boundingRect();
- item->setPos((int)((x - mViewBoxCenter.x()) * mVBTransFactor),
- (int)((y - mViewBoxCenter.y()) * mVBTransFactor));
- }
+ QPointF oldVector((x - transform.dx()), (y - transform.dy()));
+ QTransform rTransform;
+ QPointF newVector = rTransform.map(oldVector);
+
+ QRectF sr = mCurrentScene->sceneRect();
+ QRectF sr1 = mCurrentSceneRect;
+ QRectF sr2 = mCurrentScene->normalizedSceneRect();
+
+ QTransform tr = item->sceneTransform();
+ item->setTransform(rTransform.scale(fullScaleX, fullScaleY), true);
+ tr = item->sceneTransform();
+ QPoint pos ((int)((x + mShiftVector.x() + (newVector - oldVector).x()) * mVBTransFactor), (int)((y +mShiftVector.y() + (newVector - oldVector).y()) * mVBTransFactor));
+ item->setPos(pos);
}
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());
+ mCurrentScene->setSceneRect(mViewBox);
+ if ((mCurrentScene->sceneRect().topLeft().x() >= 0) || (mCurrentScene->sceneRect().topLeft().y() >= 0)) {
+ mShiftVector = -mViewBox.center();
+ }
+ mCurrentSceneRect = mViewBox;
+ mVBTransFactor = qMin(mCurrentScene->normalizedSceneRect().width() / mViewPort.width(),
+ mCurrentScene->normalizedSceneRect().height() / mViewPort.height());
return true;
}
@@ -1048,11 +1108,12 @@ bool UBCFFSubsetAdaptor::UBCFFSubsetReader::persistScenes()
qDebug() << "can't allocate scene, loading failed";
return false;
}
- UBSvgSubsetAdaptor::persistScene(mProxy, mCurrentScene, i);
- UBGraphicsScene *tmpScene = UBSvgSubsetAdaptor::loadScene(mProxy, i);
- tmpScene->setModified(true);
- UBThumbnailAdaptor::persistScene(mProxy->persistencePath(), tmpScene, i);
- delete tmpScene;
+
+ UBSvgSubsetAdaptor::persistScene(mProxy, mCurrentScene, i);
+ UBGraphicsScene *tmpScene = UBSvgSubsetAdaptor::loadScene(mProxy, i);
+ tmpScene->setModified(true);
+ UBThumbnailAdaptor::persistScene(mProxy->persistencePath(), tmpScene, i);
+ delete tmpScene;
mCurrentScene->setModified(false);
}
@@ -1087,45 +1148,63 @@ QColor UBCFFSubsetAdaptor::UBCFFSubsetReader::colorFromString(const QString& clr
return QColor(clrString);
}
-QTransform UBCFFSubsetAdaptor::UBCFFSubsetReader::transformFromString(const QString trString)
+QTransform UBCFFSubsetAdaptor::UBCFFSubsetReader::transformFromString(const QString trString, QGraphicsItem *item)
{
+ qreal dxr = 0.0;
+ qreal dyr = 0.0;
qreal dx = 0.0;
qreal dy = 0.0;
qreal angle = 0.0;
+ QTransform tr;
- //check pattern for strings like 'rotate(10)'
- QRegExp regexp("rotate\\( *([-+]{0,1}[0-9]*\\.{0,1}[0-9]*) *\\)");
- if (regexp.exactMatch(trString)) {
- angle = regexp.capturedTexts().at(1).toDouble();
- } else {
+ foreach(QString trStr, trString.split(" ", QString::SkipEmptyParts))
+ {
+ //check pattern for strings like 'rotate(10)'
+ QRegExp regexp("rotate\\( *([-+]{0,1}[0-9]*\\.{0,1}[0-9]*) *\\)");
+ if (regexp.exactMatch(trStr)) {
+ angle = regexp.capturedTexts().at(1).toDouble();
+ if (item)
+ {
+ item->setTransformOriginPoint(QPointF(0, 0));
+ item->rotate(angle);
+ }
+ continue;
+ };
+
//check pattern for strings like 'rotate(10,20,20)' or 'rotate(10.1,10.2,34.2)'
regexp.setPattern("rotate\\( *([-+]{0,1}[0-9]*\\.{0,1}[0-9]*) *, *([-+]{0,1}[0-9]*\\.{0,1}[0-9]*) *, *([-+]{0,1}[0-9]*\\.{0,1}[0-9]*) *\\)");
- if (regexp.exactMatch(trString)) {
+ if (regexp.exactMatch(trStr)) {
angle = regexp.capturedTexts().at(1).toDouble();
- dx = regexp.capturedTexts().at(2).toDouble();
- dy = regexp.capturedTexts().at(3).toDouble();
+ dxr = regexp.capturedTexts().at(2).toDouble();
+ dyr = regexp.capturedTexts().at(3).toDouble();
+ if (item)
+ {
+ item->setTransformOriginPoint(QPointF(dxr, dyr)-item->pos());
+ item->rotate(angle);
+ }
+ continue;
}
- }
- //check pattern for strings like 'translate(11.0, 12.34)'
- regexp.setPattern("translate\\( *([-+]{0,1}[0-9]*\\.{0,1}[0-9]*) *,*([-+]{0,1}[0-9]*\\.{0,1}[0-9]*)*\\)");
- if (regexp.exactMatch(trString)) {
- dx = regexp.capturedTexts().at(1).toDouble();
- dy = regexp.capturedTexts().at(2).toDouble();
- }
- return QTransform().translate(dx, dy).rotate(angle);
+ //check pattern for strings like 'translate(11.0, 12.34)'
+ regexp.setPattern("translate\\( *([-+]{0,1}[0-9]*\\.{0,1}[0-9]*) *,*([-+]{0,1}[0-9]*\\.{0,1}[0-9]*)*\\)");
+ if (regexp.exactMatch(trStr)) {
+ dx = regexp.capturedTexts().at(1).toDouble();
+ dy = regexp.capturedTexts().at(2).toDouble();
+ tr.translate(dx,dy);
+ continue;
+ }
+ }
+ return tr;
}
bool UBCFFSubsetAdaptor::UBCFFSubsetReader::getViewBoxDimenstions(const QString& viewBox)
{
- //check pattern for strings like 'rotate(10)'
- QRegExp regexp("([0-9]+) ([0-9]+) ([0-9]+) ([0-9]+)");
- if (regexp.exactMatch(viewBox))
+ QStringList capturedTexts = viewBox.split(" ", QString::SkipEmptyParts);
+ if (capturedTexts.count())
{
- int capturesCount = regexp.capturedTexts().count();
- if (capturesCount == 5 && regexp.capturedTexts().at(0).length() == viewBox.length())
+ if (4 == capturedTexts.count())
{
- mViewBox = QRectF(0, 0, regexp.capturedTexts().at(3).toDouble(), regexp.capturedTexts().at(4).toDouble());
+ mViewBox = QRectF(capturedTexts.at(0).toDouble(), capturedTexts.at(1).toDouble(), capturedTexts.at(2).toDouble(), capturedTexts.at(3).toDouble());
mViewPort = mViewBox;
mViewPort.translate(- mViewPort.center());
mViewBoxCenter.setX(mViewBox.width() / 2);
diff --git a/src/adaptors/UBCFFSubsetAdaptor.h b/src/adaptors/UBCFFSubsetAdaptor.h
index d4def19b..791c057d 100644
--- a/src/adaptors/UBCFFSubsetAdaptor.h
+++ b/src/adaptors/UBCFFSubsetAdaptor.h
@@ -65,6 +65,7 @@ private:
qreal mVBTransFactor;
QPointF mViewBoxCenter;
QSize mSize;
+ QPointF mShiftVector;
private:
QDomDocument mDOMdoc;
@@ -85,6 +86,8 @@ private:
bool parseIwbMeta(const QDomElement &element);
bool parseSvg(const QDomElement &svgSection);
+ inline bool parseGSection(const QDomElement &element);
+ inline bool parseSvgSwitchSection(const QDomElement &element);
inline bool parseSvgRect(const QDomElement &element);
inline bool parseSvgEllipse(const QDomElement &element);
inline bool parseSvgPolygon(const QDomElement &element);
@@ -123,9 +126,9 @@ private:
// helper methods
void repositionSvgItem(QGraphicsItem *item, qreal width, qreal height,
qreal x, qreal y,
- bool useTransform, QTransform &transform);
+ QTransform &transform);
QColor colorFromString(const QString& clrString);
- QTransform transformFromString(const QString trString);
+ QTransform transformFromString(const QString trString, QGraphicsItem *item = 0);
bool getViewBoxDimenstions(const QString& viewBox);
QSvgGenerator* createSvgGenerator(qreal width, qreal height);
bool getTempFileName();
diff --git a/src/adaptors/UBExportFullPDF.cpp b/src/adaptors/UBExportFullPDF.cpp
index 8f6b80f6..b7499f97 100644
--- a/src/adaptors/UBExportFullPDF.cpp
+++ b/src/adaptors/UBExportFullPDF.cpp
@@ -100,6 +100,7 @@ void UBExportFullPDF::saveOverlayPdf(UBDocumentProxy* pDocumentProxy, const QStr
if (pageIndex != 0) pdfPrinter.newPage();
//render to PDF
+ scene->setDrawingMode(true);
scene->render(pdfPainter, QRectF(), scene->normalizedSceneRect());
//restore screen rendering quality
@@ -107,6 +108,7 @@ void UBExportFullPDF::saveOverlayPdf(UBDocumentProxy* pDocumentProxy, const QStr
scene->setRenderingQuality(UBItem::RenderingQualityNormal);
//restore background state
+ scene->setDrawingMode(false);
scene->setBackground(isDark, isCrossed);
}
diff --git a/src/adaptors/UBSvgSubsetAdaptor.cpp b/src/adaptors/UBSvgSubsetAdaptor.cpp
index 49bb4b6b..e028d143 100644
--- a/src/adaptors/UBSvgSubsetAdaptor.cpp
+++ b/src/adaptors/UBSvgSubsetAdaptor.cpp
@@ -389,7 +389,8 @@ UBGraphicsScene* UBSvgSubsetAdaptor::UBSvgSubsetReader::loadScene()
// introduced in UB 4.0
- QStringRef svgViewBox = mXmlReader.attributes().value(nsSvg, "viewBox");
+ QStringRef svgViewBox = mXmlReader.attributes().value("viewBox");
+
if (!svgViewBox.isNull())
{
diff --git a/src/api/UBWidgetUniboardAPI.cpp b/src/api/UBWidgetUniboardAPI.cpp
index 4b4d3686..260734ad 100644
--- a/src/api/UBWidgetUniboardAPI.cpp
+++ b/src/api/UBWidgetUniboardAPI.cpp
@@ -534,7 +534,7 @@ void UBWidgetUniboardAPI::ProcessDropEvent(QDropEvent *event)
}
}
}
-
+ qDebug() << destFileName;
QString mimeText = createMimeText(downloaded, contentType, destFileName);
dropMimeData.setData(tMimeText, mimeText.toAscii());
@@ -623,7 +623,7 @@ QString UBWidgetUniboardAPI::createMimeText(bool downloaded, const QString &mime
}
QString relatedFileName = fileName;
- relatedFileName = relatedFileName.remove(mGraphicsWidget->getOwnFolder().toLocalFile());
+ relatedFileName = relatedFileName.remove(mGraphicsWidget->getOwnFolder().toLocalFile() + "/");
writer.writeTextElement(tPath, relatedFileName); //writing path to created object
}
diff --git a/src/board/UBBoardPaletteManager.cpp b/src/board/UBBoardPaletteManager.cpp
index 5212008a..52e6019d 100644
--- a/src/board/UBBoardPaletteManager.cpp
+++ b/src/board/UBBoardPaletteManager.cpp
@@ -733,11 +733,11 @@ void UBBoardPaletteManager::changeMode(eUBDockPaletteWidgetMode newMode, bool is
if(mKeyboardPalette->m_isVisible)
{
mKeyboardPalette->hide();
- mKeyboardPalette->setParent(brWnd);
+ mKeyboardPalette->setParent(UBApplication::mainWindow);
mKeyboardPalette->show();
}
else
- mKeyboardPalette->setParent(brWnd);
+ mKeyboardPalette->setParent(UBApplication::mainWindow);
}
}
diff --git a/src/board/UBBoardPaletteManager.h b/src/board/UBBoardPaletteManager.h
index 45b982de..8e9cef3e 100644
--- a/src/board/UBBoardPaletteManager.h
+++ b/src/board/UBBoardPaletteManager.h
@@ -1,192 +1,192 @@
-/*
- * 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 UBBOARDPALETTEMANAGER_H_
-#define UBBOARDPALETTEMANAGER_H_
-
-#include
-#include
-
-#include "web/UBRoutedMouseEventWebView.h"
-#include "gui/UBLeftPalette.h"
-#include "gui/UBRightPalette.h"
-#include "gui/UBPageNavigationWidget.h"
-#include "gui/UBLibWidget.h"
-#include "gui/UBCachePropertiesWidget.h"
-#include "gui/UBDockDownloadWidget.h"
-#include "core/UBApplicationController.h"
-#include "gui/UBFeaturesWidget.h"
-
-
-class UBStylusPalette;
-class UBClockPalette;
-class UBPageNumberPalette;
-class UBZoomPalette;
-class UBActionPalette;
-class UBBoardController;
-class UBFloatingPalette;
-class UBServerXMLHttpRequest;
-class UBKeyboardPalette;
-class UBMainWindow;
-class UBApplicationController;
-class UBDockTeacherGuideWidget;
-
+/*
+ * 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 UBBOARDPALETTEMANAGER_H_
+#define UBBOARDPALETTEMANAGER_H_
+
+#include
+#include
+
+#include "web/UBRoutedMouseEventWebView.h"
+#include "gui/UBLeftPalette.h"
+#include "gui/UBRightPalette.h"
+#include "gui/UBPageNavigationWidget.h"
+#include "gui/UBLibWidget.h"
+#include "gui/UBCachePropertiesWidget.h"
+#include "gui/UBDockDownloadWidget.h"
+#include "core/UBApplicationController.h"
+#include "gui/UBFeaturesWidget.h"
+
+
+class UBStylusPalette;
+class UBClockPalette;
+class UBPageNumberPalette;
+class UBZoomPalette;
+class UBActionPalette;
+class UBBoardController;
+class UBFloatingPalette;
+class UBServerXMLHttpRequest;
+class UBKeyboardPalette;
+class UBMainWindow;
+class UBApplicationController;
+class UBDockTeacherGuideWidget;
+
// Uncomment this to use old-styles lib paletter
// #define USE_WEB_WIDGET
-
-
-class UBBoardPaletteManager : public QObject
-{
- Q_OBJECT
-
- public:
- UBBoardPaletteManager(QWidget* container, UBBoardController* controller);
- virtual ~UBBoardPaletteManager();
-
- void setupLayout();
- UBLeftPalette* leftPalette(){return mLeftPalette;}
- UBRightPalette* rightPalette(){return mRightPalette;}
- UBStylusPalette* stylusPalette(){return mStylusPalette;}
- void showVirtualKeyboard(bool show = true);
- void initPalettesPosAtStartup();
- void connectToDocumentController();
- void refreshPalettes();
-
- UBKeyboardPalette *mKeyboardPalette;
-
- void processPalettersWidget(UBDockPalette *paletter, eUBDockPaletteWidgetMode mode);
- void changeMode(eUBDockPaletteWidgetMode newMode, bool isInit = false);
- void startDownloads();
- void stopDownloads();
-
- signals:
- void connectToDocController();
- void signal_changeMode(eUBDockPaletteWidgetMode newMode);
-
- public slots:
-
- void activeSceneChanged();
- void containerResized();
- void addItem(const QUrl& pUrl);
- void addItem(const QPixmap& pPixmap, const QPointF& p = QPointF(0.0, 0.0), qreal scale = 1.0, const QUrl& sourceUrl = QUrl());
-
- void slot_changeMainMode(UBApplicationController::MainMode);
- void slot_changeDesktopMode(bool);
-
- private:
-
- void setupPalettes();
- void connectPalettes();
- void positionFreeDisplayPalette();
- void setupDockPaletteWidgets();
-
- QWidget* mContainer;
- UBBoardController *mBoardControler;
-
- UBStylusPalette *mStylusPalette;
-
- UBZoomPalette *mZoomPalette;
-
- /** The left dock palette */
- UBLeftPalette* mLeftPalette;
- /** The right dock palette */
- UBRightPalette* mRightPalette;
-
- UBActionPalette *mBackgroundsPalette;
- UBActionPalette *mToolsPalette;
- UBActionPalette* mAddItemPalette;
- UBActionPalette* mErasePalette;
- UBActionPalette* mPagePalette;
-
- QUrl mItemUrl;
- QPixmap mPixmap;
- QPointF mPos;
- qreal mScaleFactor;
-
- QTime mPageButtonPressedTime;
- bool mPendingPageButtonPressed;
-
- QTime mZoomButtonPressedTime;
- bool mPendingZoomButtonPressed;
-
- QTime mPanButtonPressedTime;
- bool mPendingPanButtonPressed;
-
- QTime mEraseButtonPressedTime;
- bool mPendingEraseButtonPressed;
-
- /** The page navigator widget */
- UBPageNavigationWidget* mpPageNavigWidget;
-
-#ifdef USE_WEB_WIDGET
- /** The library widget */
- UBLibWidget* mpLibWidget;
-#endif
-
- /** The cache properties widget */
- UBCachePropertiesWidget* mpCachePropWidget;
-
- UBFeaturesWidget *mpFeaturesWidget;
-
- /** The download widget */
- UBDockDownloadWidget* mpDownloadWidget;
- // HACK: here we duplicate the lib widget for the desktop mode
- // we MUST refactor the architecture in order to use only one
- // lib widget!
- UBLibWidget* mpDesktopLibWidget;
-
- UBDockTeacherGuideWidget* mpTeacherGuideWidget;
-
- bool mDownloadInProgress;
-
- private slots:
-
- void changeBackground();
-
- void toggleBackgroundPalette(bool checked);
- void backgroundPaletteClosed();
-
- void toggleStylusPalette(bool checked);
- void tooglePodcastPalette(bool checked);
-
- void erasePaletteButtonPressed();
- void erasePaletteButtonReleased();
-
- void toggleErasePalette(bool ckecked);
- void erasePaletteClosed();
-
- void togglePagePalette(bool ckecked);
- void pagePaletteClosed();
-
- void pagePaletteButtonPressed();
- void pagePaletteButtonReleased();
-
- void addItemToCurrentPage();
- void addItemToNewPage();
- void addItemToLibrary();
-
- void purchaseLinkActivated(const QString&);
-
- void linkClicked(const QUrl& url);
-
- void zoomButtonPressed();
- void zoomButtonReleased();
- void panButtonPressed();
- void panButtonReleased();
-
- void changeStylusPaletteOrientation(QVariant var);
-};
-
-#endif /* UBBOARDPALETTEMANAGER_H_ */
+
+
+class UBBoardPaletteManager : public QObject
+{
+ Q_OBJECT
+
+ public:
+ UBBoardPaletteManager(QWidget* container, UBBoardController* controller);
+ virtual ~UBBoardPaletteManager();
+
+ void setupLayout();
+ UBLeftPalette* leftPalette(){return mLeftPalette;}
+ UBRightPalette* rightPalette(){return mRightPalette;}
+ UBStylusPalette* stylusPalette(){return mStylusPalette;}
+ void showVirtualKeyboard(bool show = true);
+ void initPalettesPosAtStartup();
+ void connectToDocumentController();
+ void refreshPalettes();
+
+ UBKeyboardPalette *mKeyboardPalette;
+
+ void processPalettersWidget(UBDockPalette *paletter, eUBDockPaletteWidgetMode mode);
+ void changeMode(eUBDockPaletteWidgetMode newMode, bool isInit = false);
+ void startDownloads();
+ void stopDownloads();
+
+ signals:
+ void connectToDocController();
+ void signal_changeMode(eUBDockPaletteWidgetMode newMode);
+
+ public slots:
+
+ void activeSceneChanged();
+ void containerResized();
+ void addItem(const QUrl& pUrl);
+ void addItem(const QPixmap& pPixmap, const QPointF& p = QPointF(0.0, 0.0), qreal scale = 1.0, const QUrl& sourceUrl = QUrl());
+
+ void slot_changeMainMode(UBApplicationController::MainMode);
+ void slot_changeDesktopMode(bool);
+
+ private:
+
+ void setupPalettes();
+ void connectPalettes();
+ void positionFreeDisplayPalette();
+ void setupDockPaletteWidgets();
+
+ QWidget* mContainer;
+ UBBoardController *mBoardControler;
+
+ UBStylusPalette *mStylusPalette;
+
+ UBZoomPalette *mZoomPalette;
+
+ /** The left dock palette */
+ UBLeftPalette* mLeftPalette;
+ /** The right dock palette */
+ UBRightPalette* mRightPalette;
+
+ UBActionPalette *mBackgroundsPalette;
+ UBActionPalette *mToolsPalette;
+ UBActionPalette* mAddItemPalette;
+ UBActionPalette* mErasePalette;
+ UBActionPalette* mPagePalette;
+
+ QUrl mItemUrl;
+ QPixmap mPixmap;
+ QPointF mPos;
+ qreal mScaleFactor;
+
+ QTime mPageButtonPressedTime;
+ bool mPendingPageButtonPressed;
+
+ QTime mZoomButtonPressedTime;
+ bool mPendingZoomButtonPressed;
+
+ QTime mPanButtonPressedTime;
+ bool mPendingPanButtonPressed;
+
+ QTime mEraseButtonPressedTime;
+ bool mPendingEraseButtonPressed;
+
+ /** The page navigator widget */
+ UBPageNavigationWidget* mpPageNavigWidget;
+
+#ifdef USE_WEB_WIDGET
+ /** The library widget */
+ UBLibWidget* mpLibWidget;
+#endif
+
+ /** The cache properties widget */
+ UBCachePropertiesWidget* mpCachePropWidget;
+
+ UBFeaturesWidget *mpFeaturesWidget;
+
+ /** The download widget */
+ UBDockDownloadWidget* mpDownloadWidget;
+ // HACK: here we duplicate the lib widget for the desktop mode
+ // we MUST refactor the architecture in order to use only one
+ // lib widget!
+ UBLibWidget* mpDesktopLibWidget;
+
+ UBDockTeacherGuideWidget* mpTeacherGuideWidget;
+
+ bool mDownloadInProgress;
+
+ private slots:
+
+ void changeBackground();
+
+ void toggleBackgroundPalette(bool checked);
+ void backgroundPaletteClosed();
+
+ void toggleStylusPalette(bool checked);
+ void tooglePodcastPalette(bool checked);
+
+ void erasePaletteButtonPressed();
+ void erasePaletteButtonReleased();
+
+ void toggleErasePalette(bool ckecked);
+ void erasePaletteClosed();
+
+ void togglePagePalette(bool ckecked);
+ void pagePaletteClosed();
+
+ void pagePaletteButtonPressed();
+ void pagePaletteButtonReleased();
+
+ void addItemToCurrentPage();
+ void addItemToNewPage();
+ void addItemToLibrary();
+
+ void purchaseLinkActivated(const QString&);
+
+ void linkClicked(const QUrl& url);
+
+ void zoomButtonPressed();
+ void zoomButtonReleased();
+ void panButtonPressed();
+ void panButtonReleased();
+
+ void changeStylusPaletteOrientation(QVariant var);
+};
+
+#endif /* UBBOARDPALETTEMANAGER_H_ */
diff --git a/src/board/UBBoardView.cpp b/src/board/UBBoardView.cpp
index c8e746ef..2b4cdd8f 100644
--- a/src/board/UBBoardView.cpp
+++ b/src/board/UBBoardView.cpp
@@ -436,7 +436,6 @@ void UBBoardView::mousePressEvent (QMouseEvent *event)
|| movingItem->type() == UBGraphicsTriangle::Type
|| movingItem == this->scene()->backgroundObject()
|| movingItem->group())
-
{
movingItem = NULL;
QGraphicsView::mousePressEvent (event);
diff --git a/src/board/UBFeaturesController.cpp b/src/board/UBFeaturesController.cpp
index e25893d8..5bd9f5b7 100644
--- a/src/board/UBFeaturesController.cpp
+++ b/src/board/UBFeaturesController.cpp
@@ -18,15 +18,24 @@
#include "domain/UBGraphicsVideoItem.h"
#include "domain/UBGraphicsWidgetItem.h"
-UBFeature::UBFeature(const QString &url, const QPixmap &icon, const QString &name, const QString &realPath, UBFeatureElementType type)
+UBFeature::UBFeature(const QString &url, const QPixmap &icon, const QString &name, const QUrl &realPath, UBFeatureElementType type)
: virtualPath(url), mThumbnail(icon), mName(name), mPath(realPath), elementType(type)
{
}
+QString UBFeature::getUrl() const
+{
+ if ( elementType == FEATURE_INTERNAL )
+ return getFullPath().toString();
+ /*if ( UBApplication::isFromWeb( getFullPath() ) )
+ return QUrl( getFullPath() );*/
+ return getFullPath().toLocalFile();
+}
+
bool UBFeature::operator ==( const UBFeature &f )const
{
- return virtualPath == f.getUrl() && mName == f.getName() && mPath == f.getFullPath() && elementType == f.getType();
+ return virtualPath == f.getVirtualPath() && mName == f.getName() && mPath == f.getFullPath() && elementType == f.getType();
}
bool UBFeature::operator !=( const UBFeature &f )const
@@ -55,24 +64,24 @@ UBFeaturesController::UBFeaturesController(QWidget *pParentWidget) :
void UBFeaturesController::initDirectoryTree()
{
- mUserAudioDirectoryPath = UBSettings::settings()->userAudioDirectory();
- mUserVideoDirectoryPath = UBSettings::settings()->userVideoDirectory();
- mUserPicturesDirectoryPath = UBSettings::settings()->userImageDirectory();
- mUserInteractiveDirectoryPath = UBSettings::settings()->userInteractiveDirectory();
- mUserAnimationDirectoryPath = UBSettings::settings()->userAnimationDirectory();
-
- mLibPicturesDirectoryPath = UBSettings::settings()->applicationImageLibraryDirectory();
- mLibInteractiveDirectoryPath = UBSettings::settings()->applicationInteractivesDirectory();
- mLibApplicationsDirectoryPath = UBSettings::settings()->applicationApplicationsLibraryDirectory();
- mLibShapesDirectoryPath = UBSettings::settings()->applicationShapeLibraryDirectory() ;
- mLibSearchDirectoryPath = UBSettings::settings()->userSearchDirectory();
- trashDirectoryPath = UBSettings::userTrashDirPath();
+ mUserAudioDirectoryPath = QUrl::fromLocalFile( UBSettings::settings()->userAudioDirectory() );
+ mUserVideoDirectoryPath = QUrl::fromLocalFile( UBSettings::settings()->userVideoDirectory() );
+ mUserPicturesDirectoryPath = QUrl::fromLocalFile( UBSettings::settings()->userImageDirectory() );
+ mUserInteractiveDirectoryPath = QUrl::fromLocalFile( UBSettings::settings()->userInteractiveDirectory() );
+ mUserAnimationDirectoryPath = QUrl::fromLocalFile( UBSettings::settings()->userAnimationDirectory() );
+
+ mLibPicturesDirectoryPath = QUrl::fromLocalFile( UBSettings::settings()->applicationImageLibraryDirectory() );
+ mLibInteractiveDirectoryPath = QUrl::fromLocalFile( UBSettings::settings()->applicationInteractivesDirectory() );
+ mLibApplicationsDirectoryPath = QUrl::fromLocalFile( UBSettings::settings()->applicationApplicationsLibraryDirectory() );
+ mLibShapesDirectoryPath = QUrl::fromLocalFile( UBSettings::settings()->applicationShapeLibraryDirectory() );
+ mLibSearchDirectoryPath =QUrl::fromLocalFile( UBSettings::settings()->userSearchDirectory() );
+ trashDirectoryPath = QUrl::fromLocalFile( UBSettings::userTrashDirPath() );
featuresList = new QList ();
QList tools = UBToolsManager::manager()->allTools();
- featuresList->append( UBFeature( QString(), QPixmap( ":images/libpalette/home.png" ), "root", QString() ) );
+ featuresList->append( UBFeature( QString(), QPixmap( ":images/libpalette/home.png" ), "root", QUrl() ) );
currentElement = featuresList->at(0);
appPath = rootPath + "/Applications";
@@ -99,18 +108,18 @@ void UBFeaturesController::initDirectoryTree()
featuresList->append( UBFeature( rootPath, QPixmap(":images/libpalette/ShapesCategory.svg"), "Shapes" , mLibShapesDirectoryPath ) );
trashElement = UBFeature( rootPath, QPixmap(":images/libpalette/TrashCategory.svg"), "Trash", trashDirectoryPath, FEATURE_TRASH );
featuresList->append( trashElement );
- favoriteElement = UBFeature( rootPath, QPixmap(":images/libpalette/FavoritesCategory.svg"), "Favorites", "favorites", FEATURE_FAVORITE );
+ favoriteElement = UBFeature( rootPath, QPixmap(":images/libpalette/FavoritesCategory.svg"), "Favorites", QUrl("favorites"), FEATURE_FAVORITE );
featuresList->append( favoriteElement );
- searchElement = UBFeature( rootPath, QPixmap(":images/libpalette/WebSearchCategory.svg"), "Web search", mLibSearchDirectoryPath );
- featuresList->append( searchElement );
+ webSearchElement = UBFeature( rootPath, QPixmap(":images/libpalette/WebSearchCategory.svg"), "Web search", mLibSearchDirectoryPath );
+ featuresList->append( webSearchElement );
loadFavoriteList();
foreach (UBToolsManager::UBToolDescriptor tool, tools)
{
- featuresList->append( UBFeature( appPath, tool.icon, tool.label, tool.id, FEATURE_INTERNAL ) );
- if ( favoriteSet->find( tool.id ) != favoriteSet->end() )
+ featuresList->append( UBFeature( appPath, tool.icon, tool.label, QUrl( tool.id ), FEATURE_INTERNAL ) );
+ if ( favoriteSet->find( QUrl( tool.id ) ) != favoriteSet->end() )
{
- featuresList->append( UBFeature( favoritePath, tool.icon, tool.label, tool.id, FEATURE_INTERNAL ) );
+ featuresList->append( UBFeature( favoritePath, tool.icon, tool.label, QUrl( tool.id ), FEATURE_INTERNAL ) );
}
}
fileSystemScan( mUserInteractiveDirectoryPath, appPath );
@@ -129,9 +138,9 @@ void UBFeaturesController::initDirectoryTree()
}
-void UBFeaturesController::fileSystemScan(const QString & currentPath, const QString & currVirtualPath)
+void UBFeaturesController::fileSystemScan(const QUrl & currentPath, const QString & currVirtualPath)
{
- QFileInfoList fileInfoList = UBFileSystemUtils::allElementsInDirectory(currentPath);
+ QFileInfoList fileInfoList = UBFileSystemUtils::allElementsInDirectory(currentPath.toLocalFile());
QFileInfoList::iterator fileInfo;
for ( fileInfo = fileInfoList.begin(); fileInfo != fileInfoList.end(); fileInfo += 1)
@@ -151,6 +160,7 @@ void UBFeaturesController::fileSystemScan(const QString & currentPath, const QSt
QString itemName = (fileType != FEATURE_ITEM) ? fileName : fileInfo->completeBaseName();
QPixmap icon = QPixmap(":images/libpalette/soundIcon.svg");
QString fullFileName = fileInfo->filePath();
+
if ( fileType == FEATURE_FOLDER )
{
@@ -171,15 +181,15 @@ void UBFeaturesController::fileSystemScan(const QString & currentPath, const QSt
icon = QPixmap( thumbnailPath );
else icon = createThumbnail( fullFileName );*/
}
- featuresList->append( UBFeature( currVirtualPath, icon, fileName, fullFileName, fileType ) );
- if ( favoriteSet->find( fullFileName ) != favoriteSet->end() )
+ featuresList->append( UBFeature( currVirtualPath, icon, fileName, QUrl::fromLocalFile( fullFileName ), fileType ) );
+ if ( favoriteSet->find( QUrl::fromLocalFile( fullFileName ) ) != favoriteSet->end() )
{
- featuresList->append( UBFeature( favoritePath, icon, fileName, fullFileName, fileType ) );
+ featuresList->append( UBFeature( favoritePath, icon, fileName, QUrl::fromLocalFile( fullFileName ), fileType ) );
}
if ( fileType == FEATURE_FOLDER )
{
- fileSystemScan( fullFileName, currVirtualPath + "/" + fileName );
+ fileSystemScan( QUrl::fromLocalFile( fullFileName ), currVirtualPath + "/" + fileName );
}
}
@@ -187,7 +197,7 @@ void UBFeaturesController::fileSystemScan(const QString & currentPath, const QSt
void UBFeaturesController::loadFavoriteList()
{
- favoriteSet = new QSet();
+ favoriteSet = new QSet();
QFile file( UBSettings::userDataDirectory() + "/favorites.dat" );
if ( file.exists() )
{
@@ -197,7 +207,7 @@ void UBFeaturesController::loadFavoriteList()
in >> elementsNumber;
for ( int i = 0; i < elementsNumber; ++i)
{
- QString path;
+ QUrl path;
in >> path;
/*QFileInfo fileInfo( path );
QString fileName = fileInfo.fileName();
@@ -216,7 +226,7 @@ void UBFeaturesController::saveFavoriteList()
file.open(QIODevice::WriteOnly);
QDataStream out(&file);
out << favoriteSet->size();
- for ( QSet::iterator it = favoriteSet->begin(); it != favoriteSet->end(); ++it )
+ for ( QSet::iterator it = favoriteSet->begin(); it != favoriteSet->end(); ++it )
{
out << (*it);
}
@@ -226,12 +236,12 @@ void UBFeaturesController::saveFavoriteList()
UBFeature UBFeaturesController::addToFavorite( const QUrl &path )
{
QString filePath = fileNameFromUrl( path );
- if ( favoriteSet->find( filePath ) == favoriteSet->end() )
+ if ( favoriteSet->find( path ) == favoriteSet->end() )
{
QFileInfo fileInfo( filePath );
QString fileName = fileInfo.fileName();
- UBFeature elem( favoritePath, thumbnailForFile( filePath ), fileName, filePath, fileTypeFromUrl(filePath) );
- favoriteSet->insert( filePath );
+ UBFeature elem( favoritePath, thumbnailForFile( filePath ), fileName, path, fileTypeFromUrl(filePath) );
+ favoriteSet->insert( path );
saveFavoriteList();
return elem;
}
@@ -241,9 +251,9 @@ UBFeature UBFeaturesController::addToFavorite( const QUrl &path )
void UBFeaturesController::removeFromFavorite( const QUrl &path )
{
QString filePath = fileNameFromUrl( path );
- if ( favoriteSet->find( filePath ) != favoriteSet->end() )
+ if ( favoriteSet->find( path ) != favoriteSet->end() )
{
- favoriteSet->erase( favoriteSet->find( filePath ) );
+ favoriteSet->erase( favoriteSet->find( path ) );
saveFavoriteList();
}
}
@@ -256,6 +266,7 @@ QString UBFeaturesController::fileNameFromUrl( const QUrl &url )
return url.toLocalFile();
}
+
UBFeatureElementType UBFeaturesController::fileTypeFromUrl( const QString &path )
{
QFileInfo fileInfo( path );
@@ -334,31 +345,52 @@ QPixmap UBFeaturesController::createThumbnail(const QString &path)
return QPixmap(thumbnailPath);
}
+UBFeature UBFeaturesController::importImage( const QImage &image, const UBFeature &destination )
+{
+ QDateTime now = QDateTime::currentDateTime();
+ QString fileName = tr("ImportedImage") + "-" + now.toString("dd-MM-yyyy hh-mm-ss") + ".png";
+
+ UBFeature dest = destination;
+
+ if ( !destination.getFullVirtualPath().startsWith( picturesElement.getFullVirtualPath(), Qt::CaseInsensitive ) )
+ {
+ dest = picturesElement;
+ }
+
+ QString filePath = dest.getFullPath().toLocalFile() + "/" + fileName;
+ image.save(filePath);
+
+ QPixmap thumb = createThumbnail( filePath );
+ return UBFeature( dest.getFullVirtualPath(), thumb, fileName,
+ QUrl::fromLocalFile( filePath ), FEATURE_ITEM );
+
+}
+
UBFeature UBFeaturesController::newFolder( const QString &name )
{
- QString path = currentElement.getFullPath() + "/" + name;
+ QString path = currentElement.getFullPath().toLocalFile() + "/" + name;
if(!QFileInfo(path).exists())
{
QDir().mkpath(path);
}
- return UBFeature( currentElement.getUrl() + "/" + currentElement.getName(), QPixmap(":images/libpalette/folder.svg"), name, path, FEATURE_FOLDER );
+ return UBFeature( currentElement.getFullVirtualPath(), QPixmap(":images/libpalette/folder.svg"),
+ name, QUrl::fromLocalFile( path ), FEATURE_FOLDER );
}
void UBFeaturesController::addItemToPage(const UBFeature &item)
{
- if ( item.getType() == FEATURE_INTERNAL )
- {
- UBApplication::boardController->downloadURL( QUrl( item.getFullPath() ) );
- }
- else
- {
- UBApplication::boardController->downloadURL( QUrl::fromLocalFile( item.getFullPath() ) );
- }
+ UBApplication::boardController->downloadURL( item.getFullPath() );
}
+void UBFeaturesController::addItemAsBackground(const UBFeature &item)
+{
+ UBApplication::boardController->downloadURL( item.getFullPath(), QPointF(), QSize(), true );
+}
+
+
UBFeature UBFeaturesController::getDestinationForItem( const QUrl &url )
{
- QString mimetype = UBFileSystemUtils::mimeTypeFromFileName( fileNameFromUrl(url) );
+ QString mimetype = UBFileSystemUtils::mimeTypeFromFileName( url.toString() );
if ( mimetype.contains("audio") )
return audiosElement;
@@ -376,10 +408,60 @@ UBFeature UBFeaturesController::getDestinationForItem( const QUrl &url )
return UBFeature();
}
+UBFeature UBFeaturesController::addDownloadedFile( const QUrl &sourceUrl, const QByteArray &pData )
+{
+ UBFeature dest = getDestinationForItem( sourceUrl );
+ if ( dest == UBFeature() )
+ return UBFeature();
+ QString fileName = QFileInfo( sourceUrl.toString() ).fileName();
+ QString filePath = dest.getFullPath().toLocalFile() + "/" + fileName;
+
+ QFile file( filePath );
+ if( file.open(QIODevice::WriteOnly ))
+ {
+ file.write(pData);
+ file.close();
+ return UBFeature( dest.getFullVirtualPath(), thumbnailForFile( filePath ),
+ fileName, QUrl::fromLocalFile(filePath), FEATURE_ITEM );
+ }
+ return UBFeature();
+}
+
UBFeature UBFeaturesController::moveItemToFolder( const QUrl &url, const UBFeature &destination )
{
- UBFeature newElement = copyItemToFolder( url, destination );
+ /*UBFeature newElement = copyItemToFolder( url, destination );
deleteItem( url );
+ return newElement;*/
+ QString sourcePath = url.toLocalFile();
+
+ Q_ASSERT( QFileInfo( sourcePath ).exists() );
+
+ UBFeature possibleDest = getDestinationForItem( url );
+
+ UBFeature dest = destination;
+
+ if ( destination != trashElement &&
+ !destination.getFullVirtualPath().startsWith( possibleDest.getFullVirtualPath(), Qt::CaseInsensitive ) )
+ {
+ dest = possibleDest;
+ }
+
+ QString name = QFileInfo( sourcePath ).fileName();
+ QString destPath = dest.getFullPath().toLocalFile();
+ QString destVirtualPath = dest.getFullVirtualPath();
+ QString newFullPath = destPath + "/" + name;
+ if ( sourcePath.compare( newFullPath, Qt::CaseInsensitive ) )
+ {
+ QFile( sourcePath ).copy( newFullPath );
+ deleteItem( url );
+ }
+
+ QPixmap thumb = thumbnailForFile( newFullPath );
+
+ UBFeatureElementType type = FEATURE_ITEM;
+ if ( UBFileSystemUtils::mimeTypeFromFileName( newFullPath ).contains("application") )
+ type = FEATURE_INTERACTIVE;
+ UBFeature newElement( destVirtualPath, thumb, name, QUrl::fromLocalFile( newFullPath ), type );
return newElement;
}
@@ -394,23 +476,24 @@ UBFeature UBFeaturesController::copyItemToFolder( const QUrl &url, const UBFeatu
UBFeature dest = destination;
if ( destination != trashElement &&
- !destination.getVirtualPath().startsWith( possibleDest.getVirtualPath(), Qt::CaseInsensitive ) )
+ !destination.getFullVirtualPath().startsWith( possibleDest.getFullVirtualPath(), Qt::CaseInsensitive ) )
{
dest = possibleDest;
}
QString name = QFileInfo( sourcePath ).fileName();
- QString destPath = dest.getFullPath();
- QString destVirtualPath = dest.getVirtualPath();
+ QString destPath = dest.getFullPath().toLocalFile();
+ QString destVirtualPath = dest.getFullVirtualPath();
QString newFullPath = destPath + "/" + name;
- QFile( sourcePath ).copy( newFullPath );
+ if ( !sourcePath.compare( newFullPath, Qt::CaseInsensitive ) )
+ QFile( sourcePath ).copy( newFullPath );
QPixmap thumb = thumbnailForFile( newFullPath );
UBFeatureElementType type = FEATURE_ITEM;
if ( UBFileSystemUtils::mimeTypeFromFileName( newFullPath ).contains("application") )
type = FEATURE_INTERACTIVE;
- UBFeature newElement( destVirtualPath, thumb, name, newFullPath, type );
+ UBFeature newElement( destVirtualPath, thumb, name, QUrl::fromLocalFile( newFullPath ), type );
return newElement;
}
@@ -420,7 +503,7 @@ void UBFeaturesController::deleteItem( const QUrl &url )
Q_ASSERT( QFileInfo( path ).exists() );
QString thumbnailPath = UBFileSystemUtils::thumbnailPath( path );
- if (thumbnailPath.length() && QFileInfo( thumbnailPath ).exists())
+ if ( thumbnailPath.length() && QFileInfo( thumbnailPath ).exists() )
{
QFile::remove(thumbnailPath);
}
@@ -429,7 +512,7 @@ void UBFeaturesController::deleteItem( const QUrl &url )
bool UBFeaturesController::isTrash( const QUrl &url )
{
- return url.toLocalFile().startsWith( trashDirectoryPath );
+ return url.toLocalFile().startsWith( trashDirectoryPath.toLocalFile() );
}
UBFeaturesController::~UBFeaturesController()
diff --git a/src/board/UBFeaturesController.h b/src/board/UBFeaturesController.h
index 7569bba6..1348d289 100644
--- a/src/board/UBFeaturesController.h
+++ b/src/board/UBFeaturesController.h
@@ -8,129 +8,132 @@
#include
#include
#include
+#include
+#include
+#include
enum UBFeatureElementType
{
- FEATURE_CATEGORY,
- FEATURE_VIRTUALFOLDER,
- FEATURE_FOLDER,
- FEATURE_INTERACTIVE,
- FEATURE_INTERNAL,
- FEATURE_ITEM,
- FEATURE_TRASH,
- FEATURE_FAVORITE,
- FEATURE_SEARCH
+ FEATURE_CATEGORY,
+ FEATURE_VIRTUALFOLDER,
+ FEATURE_FOLDER,
+ FEATURE_INTERACTIVE,
+ FEATURE_INTERNAL,
+ FEATURE_ITEM,
+ FEATURE_TRASH,
+ FEATURE_FAVORITE,
+ FEATURE_SEARCH
};
class UBFeature
{
- public:
- UBFeature() {;}
- //UBFeature(const UBFeature &f);
- UBFeature(const QString &url, const QPixmap &icon, const QString &name, const QString &realPath, UBFeatureElementType type = FEATURE_CATEGORY);
- virtual ~UBFeature() {;}
- QString getName() const { return mName; }
- QPixmap getThumbnail() const {return mThumbnail;}
- QString getUrl() const { return virtualPath; }
- //QString getPath() const { return mPath; };
- QString getFullPath() const { return mPath; }
- QString getVirtualPath() const { return virtualPath + "/" + mName; }
- UBFeatureElementType getType() const { return elementType; }
- bool isFolder() const;
- bool isDeletable() const;
- bool operator ==( const UBFeature &f )const;
- bool operator !=( const UBFeature &f )const;
- private:
- QString virtualPath;
- QPixmap mThumbnail;
- QString mName;
- QString mPath;
- UBFeatureElementType elementType;
+ public:
+ UBFeature() {;}
+ //UBFeature(const UBFeature &f);
+ UBFeature(const QString &url, const QPixmap &icon, const QString &name, const QString &realPath, UBFeatureElementType type = FEATURE_CATEGORY);
+ virtual ~UBFeature() {;}
+ QString getName() const { return mName; }
+ QPixmap getThumbnail() const {return mThumbnail;}
+ QString getUrl() const { return virtualPath; }
+ //QString getPath() const { return mPath; };
+ QString getFullPath() const { return mPath; }
+ QString getVirtualPath() const { return virtualPath + "/" + mName; }
+ UBFeatureElementType getType() const { return elementType; }
+ bool isFolder() const;
+ bool isDeletable() const;
+ bool operator ==( const UBFeature &f )const;
+ bool operator !=( const UBFeature &f )const;
+ private:
+ QString virtualPath;
+ QPixmap mThumbnail;
+ QString mName;
+ QString mPath;
+ UBFeatureElementType elementType;
};
Q_DECLARE_METATYPE( UBFeature )
- class UBFeaturesController : public QObject
+class UBFeaturesController : public QObject
{
- Q_OBJECT
- public:
- UBFeaturesController(QWidget *parentWidget);
- virtual ~UBFeaturesController();
-
- QList * getFeatures()const { return featuresList; }
-
- const QString& getRootPath()const { return rootPath; }
-
- void addItemToPage(const UBFeature &item);
- const UBFeature& getCurrentElement()const { return currentElement; }
- void setCurrentElement( const UBFeature &elem ) { currentElement = elem; }
- const UBFeature & getTrashElement () const { return trashElement; }
- UBFeature moveItemToFolder( const QUrl &url, const UBFeature &destination );
- UBFeature copyItemToFolder( const QUrl &url, const UBFeature &destination );
- void deleteItem( const QUrl &url );
- bool isTrash( const QUrl &url );
- UBFeature newFolder( const QString &name );
- UBFeature addToFavorite( const QUrl &path );
- void removeFromFavorite( const QUrl &path );
-
- static QString fileNameFromUrl( const QUrl &url );
- static QPixmap thumbnailForFile( const QString &path );
- static bool isDeletable( const QUrl &url );
- private:
- void initDirectoryTree();
- void fileSystemScan(const QString &currPath, const QString & currVirtualPath);
- static QPixmap createThumbnail(const QString &path);
- //void addImageToCurrentPage( const QString &path );
- void loadFavoriteList();
- void saveFavoriteList();
- UBFeature getDestinationForItem( const QUrl &url );
-
- static UBFeatureElementType fileTypeFromUrl( const QString &path );
-
- QList *featuresList;
- UBFeature *rootElement;
-
- QString mUserAudioDirectoryPath;
- QString mUserVideoDirectoryPath;
- QString mUserPicturesDirectoryPath;
- QString mUserInteractiveDirectoryPath;
- QString mUserAnimationDirectoryPath;
-
- QString libraryPath;
- QString mLibAudioDirectoryPath;
- QString mLibVideoDirectoryPath;
- QString mLibPicturesDirectoryPath;
- QString mLibInteractiveDirectoryPath;
- QString mLibAnimationDirectoryPath;
- QString mLibApplicationsDirectoryPath;
- QString mLibShapesDirectoryPath;
- QString trashDirectoryPath;
- QString mLibSearchDirectoryPath;
-
- QString rootPath;
- QString audiosPath;
- QString moviesPath;
- QString picturesPath;
- QString appPath;
- QString flashPath;
- QString shapesPath;
- QString interactPath;
- QString trashPath;
- QString favoritePath;
-
- int mLastItemOffsetIndex;
- UBFeature currentElement;
- UBFeature trashElement;
- UBFeature favoriteElement;
- UBFeature audiosElement;
- UBFeature moviesElement;
- UBFeature picturesElement;
- UBFeature interactElement;
- UBFeature flashElement;
- UBFeature shapesElement;
- UBFeature searchElement;
-
- QSet *favoriteSet;
+ Q_OBJECT
+ public:
+ UBFeaturesController(QWidget *parentWidget);
+ virtual ~UBFeaturesController();
+
+ QList * getFeatures()const { return featuresList; }
+
+ const QString& getRootPath()const { return rootPath; }
+
+ void addItemToPage(const UBFeature &item);
+ const UBFeature& getCurrentElement()const { return currentElement; }
+ void setCurrentElement( const UBFeature &elem ) { currentElement = elem; }
+ const UBFeature & getTrashElement () const { return trashElement; }
+ UBFeature moveItemToFolder( const QUrl &url, const UBFeature &destination );
+ UBFeature copyItemToFolder( const QUrl &url, const UBFeature &destination );
+ void deleteItem( const QUrl &url );
+ bool isTrash( const QUrl &url );
+ UBFeature newFolder( const QString &name );
+ UBFeature addToFavorite( const QUrl &path );
+ void removeFromFavorite( const QUrl &path );
+
+ static QString fileNameFromUrl( const QUrl &url );
+ static QPixmap thumbnailForFile( const QString &path );
+ static bool isDeletable( const QUrl &url );
+ private:
+ void initDirectoryTree();
+ void fileSystemScan(const QString &currPath, const QString & currVirtualPath);
+ static QPixmap createThumbnail(const QString &path);
+ //void addImageToCurrentPage( const QString &path );
+ void loadFavoriteList();
+ void saveFavoriteList();
+ UBFeature getDestinationForItem( const QUrl &url );
+
+ static UBFeatureElementType fileTypeFromUrl( const QString &path );
+
+ QList *featuresList;
+ UBFeature *rootElement;
+
+ QString mUserAudioDirectoryPath;
+ QString mUserVideoDirectoryPath;
+ QString mUserPicturesDirectoryPath;
+ QString mUserInteractiveDirectoryPath;
+ QString mUserAnimationDirectoryPath;
+
+ QString libraryPath;
+ QString mLibAudioDirectoryPath;
+ QString mLibVideoDirectoryPath;
+ QString mLibPicturesDirectoryPath;
+ QString mLibInteractiveDirectoryPath;
+ QString mLibAnimationDirectoryPath;
+ QString mLibApplicationsDirectoryPath;
+ QString mLibShapesDirectoryPath;
+ QString trashDirectoryPath;
+ QString mLibSearchDirectoryPath;
+
+ QString rootPath;
+ QString audiosPath;
+ QString moviesPath;
+ QString picturesPath;
+ QString appPath;
+ QString flashPath;
+ QString shapesPath;
+ QString interactPath;
+ QString trashPath;
+ QString favoritePath;
+
+ int mLastItemOffsetIndex;
+ UBFeature currentElement;
+ UBFeature trashElement;
+ UBFeature favoriteElement;
+ UBFeature audiosElement;
+ UBFeature moviesElement;
+ UBFeature picturesElement;
+ UBFeature interactElement;
+ UBFeature flashElement;
+ UBFeature shapesElement;
+ UBFeature searchElement;
+
+ QSet *favoriteSet;
};
diff --git a/src/document/UBDocumentController.cpp b/src/document/UBDocumentController.cpp
index 669e140f..22f11c69 100644
--- a/src/document/UBDocumentController.cpp
+++ b/src/document/UBDocumentController.cpp
@@ -72,9 +72,15 @@ UBDocumentController::UBDocumentController(UBMainWindow* mainWindow)
{
setupViews();
setupToolbar();
+ this->selectDocument(UBApplication::boardController->activeDocument());
connect(this, SIGNAL(exportDone()), mMainWindow, SLOT(onExportDone()));
+ connect(mMainWindow->actionNewPage, SIGNAL(triggered()), this, SLOT(reloadThumbs()));
}
+void UBDocumentController::reloadThumbs()
+{
+ mDocumentThumbs = UBThumbnailAdaptor::load(selectedDocumentProxy());
+}
UBDocumentController::~UBDocumentController()
{
diff --git a/src/document/UBDocumentController.h b/src/document/UBDocumentController.h
index de6f118f..f3e387ba 100644
--- a/src/document/UBDocumentController.h
+++ b/src/document/UBDocumentController.h
@@ -75,6 +75,7 @@ class UBDocumentController : public QObject
void copy();
void paste();
void focusChanged(QWidget *old, QWidget *current);
+ void reloadThumbs();
protected:
virtual void setupViews();
diff --git a/src/domain/UBGraphicsItemDelegate.cpp b/src/domain/UBGraphicsItemDelegate.cpp
index c081d40e..8a7494ec 100644
--- a/src/domain/UBGraphicsItemDelegate.cpp
+++ b/src/domain/UBGraphicsItemDelegate.cpp
@@ -236,27 +236,27 @@ void UBGraphicsItemDelegate::setMimeData(QMimeData *mimeData)
bool UBGraphicsItemDelegate::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
{
- if(NULL != mMimeData)
- {
- QDrag* mDrag = new QDrag(event->widget());
- mDrag->setMimeData(mMimeData);
- if (!mDragPixmap.isNull()) {
- mDrag->setPixmap(mDragPixmap);
- mDrag->setHotSpot(mDragPixmap.rect().center());
- }
- mDrag->exec();
- mDragPixmap = QPixmap();
+ if((NULL != mMimeData) && ((event->pos() - mDragStartPosition).manhattanLength() < QApplication::startDragDistance()))
+ {
+ QDrag* mDrag = new QDrag(event->widget());
+ mDrag->setMimeData(mMimeData);
+ if (!mDragPixmap.isNull()) {
+ mDrag->setPixmap(mDragPixmap);
+ mDrag->setHotSpot(mDragPixmap.rect().center());
+ }
+ mDrag->exec();
+ mDragPixmap = QPixmap();
- return true;
- }
+ return true;
+ }
if(isLocked())
{
event->accept();
return true;
}
- else
- return false;
+
+ return true;
}
bool UBGraphicsItemDelegate::weelEvent(QGraphicsSceneWheelEvent *event)
@@ -699,4 +699,4 @@ void UBGraphicsToolBarItem::paint(QPainter *painter, const QStyleOptionGraphicsI
path.addRoundedRect(rect(), 10, 10);
painter->fillPath(path, brush());
-}
\ No newline at end of file
+}
diff --git a/src/domain/UBGraphicsVideoItem.cpp b/src/domain/UBGraphicsVideoItem.cpp
index 9fa9d345..7ef73f8d 100644
--- a/src/domain/UBGraphicsVideoItem.cpp
+++ b/src/domain/UBGraphicsVideoItem.cpp
@@ -109,11 +109,6 @@ void UBGraphicsVideoItem::showOnDisplayChanged(bool shown)
void UBGraphicsVideoItem::mousePressEvent(QGraphicsSceneMouseEvent *event)
{
-// QDrag* mDrag = new QDrag(event->widget());
-// QMimeData* pMime = new QMimeData();
-// mDrag->setMimeData(pMime);
-// mDrag->start();
-
mShouldMove = (event->buttons() & Qt::LeftButton);
mMousePressPos = event->scenePos();
mMouseMovePos = mMousePressPos;
diff --git a/src/gui/UBFeaturesActionBar.cpp b/src/gui/UBFeaturesActionBar.cpp
index ac009c48..8311bfc9 100644
--- a/src/gui/UBFeaturesActionBar.cpp
+++ b/src/gui/UBFeaturesActionBar.cpp
@@ -66,8 +66,8 @@ UBFeaturesActionBar::UBFeaturesActionBar( UBFeaturesController *controller, QWid
mButtonGroup->addButton(mpRemoveFavoriteBtn);
mButtonGroup->addButton(mpNewFolderBtn);
// Connect signals & slots
- /*connect(mpFavoriteAction,SIGNAL(triggered()), this, SLOT(onActionFavorite()));
- connect(mpSocialAction,SIGNAL(triggered()), this, SLOT(onActionSocial()));
+ connect(mpFavoriteAction,SIGNAL(triggered()), this, SLOT(onActionFavorite()));
+ /*connect(mpSocialAction,SIGNAL(triggered()), this, SLOT(onActionSocial()));
connect(mpSearchAction,SIGNAL(triggered()), this, SLOT(onActionSearch()));
connect(mpDeleteAction,SIGNAL(triggered()), this, SLOT(onActionTrash()));
connect(mpCloseAction, SIGNAL(triggered()), this, SLOT(onActionClose()));
@@ -170,6 +170,11 @@ void UBFeaturesActionBar::onActionNewFolder()
emit newFolderToCreate();
}
+void UBFeaturesActionBar::onActionFavorite()
+{
+ emit addElementsToFavorite();
+}
+
/*
void UBFeaturesActionBar::dragMoveEvent(QDragMoveEvent *event)
{
diff --git a/src/gui/UBFeaturesActionBar.h b/src/gui/UBFeaturesActionBar.h
index a45371d8..7aec99a9 100644
--- a/src/gui/UBFeaturesActionBar.h
+++ b/src/gui/UBFeaturesActionBar.h
@@ -30,9 +30,11 @@ signals:
void deleteElements( const QMimeData &data );
void addToFavorite( const QMimeData &data );
void removeFromFavorite( const QMimeData &data );
+ void addElementsToFavorite();
private slots:
void onSearchTextChanged(QString txt);
void onActionNewFolder();
+ void onActionFavorite();
protected:
//void dragMoveEvent(QDragMoveEvent *event);
void dragEnterEvent( QDragEnterEvent *event );
diff --git a/src/gui/UBFeaturesWidget.cpp b/src/gui/UBFeaturesWidget.cpp
index f40f9e16..7a71b555 100644
--- a/src/gui/UBFeaturesWidget.cpp
+++ b/src/gui/UBFeaturesWidget.cpp
@@ -116,14 +116,19 @@ UBFeaturesWidget::UBFeaturesWidget(QWidget *parent, const char *name):UBDockPale
this, SLOT(currentSelected(const QModelIndex &)));*/
connect( featuresListView, SIGNAL(clicked ( const QModelIndex & ) ),
this, SLOT( currentSelected(const QModelIndex &) ) );
- connect( mActionBar, SIGNAL( searchElement(const QString &) ), this, SLOT( const searchStarted(QString &) ) );
+ connect( mActionBar, SIGNAL( searchElement(const QString &) ), this, SLOT( searchStarted(const QString &) ) );
connect( mActionBar, SIGNAL( newFolderToCreate() ), this, SLOT( createNewFolder() ) );
connect( mActionBar, SIGNAL( deleteElements(const QMimeData &) ), this, SLOT( deleteElements(const QMimeData &) ) );
connect( mActionBar, SIGNAL( addToFavorite(const QMimeData &) ), this, SLOT( addToFavorite(const QMimeData &) ) );
connect( mActionBar, SIGNAL( removeFromFavorite(const QMimeData &) ), this, SLOT( removeFromFavorite(const QMimeData &) ) );
+ connect ( mActionBar, SIGNAL( addElementsToFavorite() ), this, SLOT ( addElementsToFavorite() ) );
connect( pathListView, SIGNAL(clicked( const QModelIndex & ) ),
this, SLOT( currentPathChanged( const QModelIndex & ) ) );
connect( thumbSlider, SIGNAL( sliderMoved(int) ), this, SLOT(thumbnailSizeChanged( int ) ) );
+ connect( UBApplication::boardController, SIGNAL( displayMetadata( QMap ) ),
+ this, SLOT( onDisplayMetadata( QMap ) ) );
+ connect( UBDownloadManager::downloadManager(), SIGNAL( addDownloadedFileToLibrary( bool, QUrl, QString, QByteArray ) ),
+ this, SLOT( onAddDownloadedFileToLibrary( bool, QUrl, QString,QByteArray ) ) );
}
bool UBFeaturesWidget::eventFilter( QObject *target, QEvent *event )
@@ -165,7 +170,7 @@ void UBFeaturesWidget::currentSelected(const QModelIndex ¤t)
if ( feature.isFolder() )
{
- QString newPath = feature.getUrl() + "/" + feature.getName();
+ QString newPath = feature.getFullVirtualPath();
//pathViewer->addPathElement( feature.getThumbnail(), newPath );
controller->setCurrentElement( feature );
@@ -208,7 +213,7 @@ void UBFeaturesWidget::currentPathChanged(const QModelIndex &index)
if ( index.isValid() )
{
UBFeature feature = featuresPathModel->data(index, Qt::UserRole + 1).value();
- QString newPath = feature.getUrl() + "/" + feature.getName();
+ QString newPath = feature.getFullVirtualPath();
featuresPathModel->setPath( newPath );
featuresPathModel->invalidate();
@@ -281,7 +286,7 @@ void UBFeaturesWidget::addToFavorite( const QMimeData & mimeData )
foreach ( QUrl url, urls )
{
UBFeature elem = controller->addToFavorite( url );
- if ( !elem.getUrl().isEmpty() && !elem.getUrl().isNull() )
+ if ( !elem.getVirtualPath().isEmpty() && !elem.getVirtualPath().isNull() )
featuresModel->addItem( elem );
}
QSortFilterProxyModel *model = dynamic_cast( featuresListView->model() );
@@ -305,6 +310,44 @@ void UBFeaturesWidget::thumbnailSizeChanged( int value )
featuresListView->setGridSize( QSize( value * 1.75, value * 1.75 ) );
}
+void UBFeaturesWidget::onDisplayMetadata( QMap metadata )
+{
+ UBFeature feature( QString(), QPixmap(":images/libpalette/notFound.png"), QString(), metadata["Url"], FEATURE_ITEM );
+ feature.setMetadata( metadata );
+
+ featureProperties->showElement( feature );
+ switchToProperties();
+ mActionBar->setCurrentState( IN_PROPERTIES );
+}
+
+void UBFeaturesWidget::onAddDownloadedFileToLibrary(bool pSuccess, QUrl sourceUrl, QString pContentHeader, QByteArray pData)
+{
+ if ( pSuccess )
+ {
+ UBFeature newFeature = controller->addDownloadedFile( sourceUrl, pData );
+ if ( newFeature != UBFeature() )
+ {
+ featuresModel->addItem( newFeature );
+ QSortFilterProxyModel *model = dynamic_cast( featuresListView->model() );
+ model->invalidate();
+ }
+ }
+}
+
+void UBFeaturesWidget::addElementsToFavorite()
+{
+ QModelIndexList selected = featuresListView->selectionModel()->selectedIndexes();
+ for ( int i = 0; i < selected.size(); ++i )
+ {
+ UBFeature feature = selected.at(i).data( Qt::UserRole + 1 ).value();
+ UBFeature elem = controller->addToFavorite( feature.getFullPath() );
+ if ( !elem.getVirtualPath().isEmpty() && !elem.getVirtualPath().isNull() )
+ featuresModel->addItem( elem );
+ }
+ QSortFilterProxyModel *model = dynamic_cast( featuresListView->model() );
+ model->invalidate();
+}
+
void UBFeaturesWidget::switchToListView()
{
stackedWidget->setCurrentIndex(ID_LISTVIEW);
@@ -376,13 +419,19 @@ void UBFeaturesListView::mouseReleaseEvent( QMouseEvent *event )
*/
void UBFeaturesListView::dragEnterEvent( QDragEnterEvent *event )
{
- if ( event->mimeData()->hasUrls() )
+ if ( event->mimeData()->hasUrls() || event->mimeData()->hasImage() )
event->acceptProposedAction();
}
+void UBFeaturesListView::dragMoveEvent( QDragMoveEvent *event )
+{
+ if ( event->mimeData()->hasUrls() || event->mimeData()->hasImage() )
+ event->acceptProposedAction();
+}
+
void UBFeaturesListView::dropEvent( QDropEvent *event )
{
- if( event->source() || dynamic_cast( event->source() ) )
+ if( event->source() && dynamic_cast( event->source() ) )
{
event->setDropAction( Qt::MoveAction );
}
@@ -441,7 +490,7 @@ UBFeaturesWebView::~UBFeaturesWebView()
void UBFeaturesWebView::showElement(const UBFeature &elem)
{
QString qsWidgetName;
- QString path = elem.getFullPath();
+ QString path = elem.getFullPath().toLocalFile();
QString qsConfigPath = QString("%0/config.xml").arg(path);
@@ -490,6 +539,7 @@ UBFeatureProperties::UBFeatureProperties( QWidget *parent, const char *name ) :
, mpThumbnail(NULL)
, mpOrigPixmap(NULL)
, mpElement(NULL)
+ , mpObjInfos(NULL)
{
setObjectName(name);
@@ -529,12 +579,49 @@ UBFeatureProperties::UBFeatureProperties( QWidget *parent, const char *name ) :
mpButtonLayout->addStretch(1);
- mpObjInfoLabel = new QLabel(tr("Object informations"));
+ mpObjInfoLabel = new QLabel(tr("Object informations"));
mpObjInfoLabel->setStyleSheet(QString("color: #888888; font-size : 18px; font-weight:bold;"));
mpLayout->addWidget(mpObjInfoLabel, 0);
- connect(mpAddPageButton, SIGNAL(clicked()), this, SLOT(onAddToPage()));
+ mpObjInfos = new QTreeWidget(this);
+ mpObjInfos->setColumnCount(2);
+ mpObjInfos->header()->hide();
+ mpObjInfos->setAlternatingRowColors(true);
+ mpObjInfos->setRootIsDecorated(false);
+ mpObjInfos->setObjectName("DockPaletteWidgetBox");
+ mpObjInfos->setStyleSheet("background:white;");
+ mpLayout->addWidget(mpObjInfos, 1);
+ connect( mpAddPageButton, SIGNAL(clicked()), this, SLOT(onAddToPage()) );
+ connect( mpSetAsBackgroundButton, SIGNAL( clicked() ), this, SLOT( onSetAsBackground() ) );
+ connect( mpAddToLibButton, SIGNAL( clicked() ), this, SLOT(onAddToLib() ) );
+}
+
+void UBFeatureProperties::resizeEvent( QResizeEvent *event )
+{
+ Q_UNUSED(event);
+ adaptSize();
+}
+
+void UBFeatureProperties::showEvent (QShowEvent *event )
+{
+ Q_UNUSED(event);
+ adaptSize();
+}
+
+void UBFeatureProperties::adaptSize()
+{
+ if( NULL != mpOrigPixmap )
+ {
+ if( width() < THUMBNAIL_WIDTH + 40 )
+ {
+ mpThumbnail->setPixmap( mpOrigPixmap->scaledToWidth( width() - 40 ) );
+ }
+ else
+ {
+ mpThumbnail->setPixmap( mpOrigPixmap->scaledToWidth( THUMBNAIL_WIDTH ) );
+ }
+ }
}
void UBFeatureProperties::showElement( const UBFeature &elem )
@@ -552,55 +639,81 @@ void UBFeatureProperties::showElement( const UBFeature &elem )
mpElement = new UBFeature( elem );
mpOrigPixmap = new QPixmap( elem.getThumbnail() );
mpThumbnail->setPixmap(elem.getThumbnail().scaledToWidth(THUMBNAIL_WIDTH));
- //populateMetadata();
+ populateMetadata();
- if ( UBApplication::isFromWeb( elem.getUrl() ) )
+ if ( UBApplication::isFromWeb( elem.getFullPath().toString() ) )
{
mpAddToLibButton->show();
- /*if(elem->metadatas()["Type"].toLower().contains("image"))
+ if( elem.getMetadata()["Type"].toLower().contains("image") )
{
mpSetAsBackgroundButton->show();
}
else
{
mpSetAsBackgroundButton->hide();
- }*/
+ }
}
else
{
mpAddToLibButton->hide();
- if (UBFileSystemUtils::mimeTypeFromFileName( elem.getUrl() ).contains("image"))
+ if (UBFileSystemUtils::mimeTypeFromFileName( elem.getFullPath().toLocalFile() ).contains("image"))
{
mpSetAsBackgroundButton->show();
}
- else
+ else
{
mpSetAsBackgroundButton->hide();
}
}
}
+void UBFeatureProperties::populateMetadata()
+{
+ if(NULL != mpObjInfos){
+ mpObjInfos->clear();
+ QMap metas = mpElement->getMetadata();
+ QList lKeys = metas.keys();
+ QList lValues = metas.values();
+
+ for(int i=0; i< metas.size(); i++){
+ QStringList values;
+ values << lKeys.at(i);
+ values << lValues.at(i);
+ mpItem = new QTreeWidgetItem(values);
+ mpObjInfos->addTopLevelItem(mpItem);
+ }
+ mpObjInfos->resizeColumnToContents(0);
+ }
+}
+
void UBFeatureProperties::onAddToPage()
{
QWidget *w = parentWidget()->parentWidget();
UBFeaturesWidget* featuresWidget = dynamic_cast( w );
featuresWidget->getFeaturesController()->addItemToPage( *mpElement );
- /*if ( UBApplication::isFromWeb( mpElement->getUrl() ) )
- {
+}
+
+void UBFeatureProperties::onAddToLib()
+{
+ if ( UBApplication::isFromWeb( mpElement->getFullPath().toString() ) )
+ {
sDownloadFileDesc desc;
desc.isBackground = false;
- desc.modal = true;
- desc.name = QFileInfo( mpElement->getName() ).fileName();
- desc.url = mpElement->getUrl();
+ desc.modal = false;
+ desc.name = QFileInfo( mpElement->getFullPath().toString()).fileName();
+ qDebug() << desc.name;
+ desc.url = mpElement->getFullPath().toString();
+ qDebug() << desc.url;
UBDownloadManager::downloadManager()->addFileToDownload(desc);
-
}
- else
- {
- QWidget *w = parentWidget()->parentWidget();
- UBFeaturesWidget* featuresWidget = dynamic_cast( w );
- featuresWidget->getFeaturesController()->addItemToPage( *mpElement );
- }*/
+}
+
+
+void UBFeatureProperties::onSetAsBackground()
+{
+ QWidget *w = parentWidget()->parentWidget();
+ UBFeaturesWidget* featuresWidget = dynamic_cast( w );
+ featuresWidget->getFeaturesController()->addItemAsBackground( *mpElement );
}
UBFeatureProperties::~UBFeatureProperties()
@@ -641,7 +754,7 @@ QVariant UBFeaturesModel::data(const QModelIndex &index, int role) const
}
else if (role == Qt::UserRole)
{
- return featuresList->at(index.row()).getUrl();
+ return featuresList->at(index.row()).getVirtualPath();
}
else if (role == Qt::UserRole + 1)
{
@@ -663,14 +776,15 @@ QMimeData* UBFeaturesModel::mimeData(const QModelIndexList &indexes) const
if ( index.isValid() )
{
UBFeature element = data( index, Qt::UserRole + 1 ).value();
- if ( element.getType() == FEATURE_INTERNAL )
+ urlList.push_back( element.getFullPath() );
+ /*if ( element.getType() == FEATURE_INTERNAL )
{
urlList.push_back( QUrl( element.getFullPath() ) );
}
else if ( element.getType() == FEATURE_INTERACTIVE || element.getType() == FEATURE_ITEM )
{
- urlList.push_back( QUrl::fromLocalFile(element.getFullPath()) );
- }
+ urlList.push_back( element.getFullPath() );
+ }*/
}
}
mimeData->setUrls( urlList );
@@ -682,7 +796,7 @@ bool UBFeaturesModel::dropMimeData(const QMimeData *mimeData, Qt::DropAction act
{
Q_UNUSED(row)
- if ( !mimeData->hasUrls() )
+ if ( !mimeData->hasUrls() && !mimeData->hasImage() )
return false;
if ( action == Qt::IgnoreAction )
return true;
@@ -701,29 +815,38 @@ bool UBFeaturesModel::dropMimeData(const QMimeData *mimeData, Qt::DropAction act
parentFeature = parent.data( Qt::UserRole + 1).value();
}
- QList urls = mimeData->urls();
-
- foreach ( QUrl url, urls )
- {
- UBFeature element;
-
- if ( action == Qt::MoveAction )
- {
- element = dynamic_cast(QObject::parent())->getFeaturesController()->moveItemToFolder( url, parentFeature );
- }
- else
- {
- element = dynamic_cast(QObject::parent())->getFeaturesController()->copyItemToFolder( url, parentFeature );
- }
- addItem( element );
- }
+ if ( mimeData->hasUrls() )
+ {
+ QList urls = mimeData->urls();
+
+ foreach ( QUrl url, urls )
+ {
+ UBFeature element;
+
+ if ( action == Qt::MoveAction )
+ {
+ element = dynamic_cast(QObject::parent())->getFeaturesController()->moveItemToFolder( url, parentFeature );
+ }
+ else
+ {
+ element = dynamic_cast(QObject::parent())->getFeaturesController()->copyItemToFolder( url, parentFeature );
+ }
+ addItem( element );
+ }
+ }
+ else if ( mimeData->hasImage() )
+ {
+ QImage image = qvariant_cast( mimeData->imageData() );
+ UBFeature element = dynamic_cast(QObject::parent())->getFeaturesController()->importImage( image, parentFeature );
+ addItem( element );
+ }
return true;
}
void UBFeaturesModel::addItem( const UBFeature &item )
{
beginInsertRows( QModelIndex(), featuresList->size(), featuresList->size() );
- featuresList->push_back( item );
+ featuresList->append( item );
endInsertRows();
}
@@ -731,8 +854,8 @@ void UBFeaturesModel::deleteFavoriteItem( const QString &path )
{
for ( int i = 0; i < featuresList->size(); ++i )
{
- if ( !QString::compare( featuresList->at(i).getFullPath(), path, Qt::CaseInsensitive ) &&
- !QString::compare( featuresList->at(i).getUrl(), "/root/favorites", Qt::CaseInsensitive ) )
+ if ( !QString::compare( featuresList->at(i).getUrl(), path, Qt::CaseInsensitive ) &&
+ !QString::compare( featuresList->at(i).getVirtualPath(), "/root/favorites", Qt::CaseInsensitive ) )
{
removeRow( i, QModelIndex() );
return;
@@ -776,7 +899,7 @@ Qt::ItemFlags UBFeaturesModel::flags( const QModelIndex &index ) const
item.getType() == FEATURE_ITEM ||
item.getType() == FEATURE_INTERNAL )
return Qt::ItemIsDragEnabled | defaultFlags;
- if ( item.isFolder() && !item.getFullPath().isNull() )
+ if ( item.isFolder() && !item.getVirtualPath().isNull() )
return defaultFlags | Qt::ItemIsDropEnabled;
else return defaultFlags | Qt::ItemIsDropEnabled;
}
@@ -804,7 +927,7 @@ Qt::ItemFlags UBFeaturesModel::flags( const QModelIndex &index ) const
QStringList UBFeaturesModel::mimeTypes() const
{
QStringList types;
- types << "text/uri-list";
+ types << "text/uri-list" << "image/png" << "image/tiff" << "image/gif" << "image/jpeg";
return types;
}
@@ -846,9 +969,8 @@ bool UBFeaturesPathProxyModel::filterAcceptsRow( int sourceRow, const QModelInde
eUBLibElementType type = (eUBLibElementType)sourceModel()->data(index, Qt::UserRole + 1).toInt();*/
UBFeature feature = sourceModel()->data(index, Qt::UserRole + 1).value();
- QString virtualFullPath = feature.getUrl() + "/" + feature.getName();
- return feature.isFolder() && path.startsWith( virtualFullPath );
+ return feature.isFolder() && path.startsWith( feature.getFullVirtualPath() );
}
QString UBFeaturesItemDelegate::displayText ( const QVariant & value, const QLocale & locale ) const
diff --git a/src/gui/UBFeaturesWidget.h b/src/gui/UBFeaturesWidget.h
index faaea0c4..85aaebbd 100644
--- a/src/gui/UBFeaturesWidget.h
+++ b/src/gui/UBFeaturesWidget.h
@@ -99,6 +99,9 @@ private slots:
void addToFavorite( const QMimeData & );
void removeFromFavorite( const QMimeData & );
void thumbnailSizeChanged( int );
+ void onDisplayMetadata( QMap );
+ void onAddDownloadedFileToLibrary(bool, QUrl, QString, QByteArray);
+ void addElementsToFavorite();
protected:
bool eventFilter(QObject *target, QEvent *event);
};
@@ -112,6 +115,7 @@ public:
protected:
virtual void dragEnterEvent( QDragEnterEvent *event );
virtual void dropEvent( QDropEvent *event );
+ virtual void dragMoveEvent( QDragMoveEvent *event );
/*virtual void mousePressEvent( QMouseEvent *event );
virtual void mouseMoveEvent( QMouseEvent *event );
virtual void mouseReleaseEvent( QMouseEvent *event );*/
@@ -150,28 +154,31 @@ public:
protected:
- //void resizeEvent(QResizeEvent *event);
- //void showEvent(QShowEvent *event);
+ void resizeEvent(QResizeEvent *event);
+ void showEvent(QShowEvent *event);
private slots:
void onAddToPage();
- //void onAddToLib();
- //void onSetAsBackground();
+ void onAddToLib();
+ void onSetAsBackground();
//void onBack();
private:
+ void populateMetadata();
+ void adaptSize();
+
QVBoxLayout* mpLayout;
QHBoxLayout* mpButtonLayout;
UBFeatureItemButton* mpAddPageButton;
UBFeatureItemButton* mpAddToLibButton;
UBFeatureItemButton* mpSetAsBackgroundButton;
QLabel* mpObjInfoLabel;
- //QTreeWidget* mpObjInfos;
+ QTreeWidget* mpObjInfos;
QLabel* mpThumbnail;
QPixmap* mpOrigPixmap;
int maxThumbHeight;
UBFeature *mpElement;
- //QTreeWidgetItem* mpItem;
+ QTreeWidgetItem* mpItem;
};
diff --git a/src/web/UBWebController.cpp b/src/web/UBWebController.cpp
index ca46e500..2e975868 100644
--- a/src/web/UBWebController.cpp
+++ b/src/web/UBWebController.cpp
@@ -423,7 +423,7 @@ void UBWebController::setupPalettes()
{
if(!(*mToolsCurrentPalette))
{
- (*mToolsCurrentPalette) = new UBWebToolsPalette((*mCurrentWebBrowser),false);
+ (*mToolsCurrentPalette) = new UBWebToolsPalette(UBApplication::mainWindow, false);
#ifndef Q_WS_WIN
if (UBPlatformUtils::hasVirtualKeyboard() && UBApplication::boardController->paletteManager()->mKeyboardPalette)