Commit 67541aa8 authored by Aleksei Kanash's avatar Aleksei Kanash

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

parents d57341fd 51aa2f96
/* @group Layout Colours */
#bar,
.photo-navigation,
.movie-title {
background-color: #51748C;
}
#pageHeader #title {
background-color: #FF7E00;
}
#pageHeader h1,
#pageHeader h2 {
text-shadow: 0px -1px 0px #994B00;
}
#footer {
background-color: #82B4D7;
}
#footer p {
text-shadow: 0px -1px 0px #4E6C81;
}
#breadcrumbcontainer li {
color: #5B7E96;
}
/* @end */
/* @group Content Colours */
body,
.blog-entry-body,
.blog-entry-date,
.blog-entry {
color: #7F7F7F;
}
#sidebarContainer .sideHeader,
#sidebarContainer #sidebar h1,
#sidebarContainer #sidebar h2,
#sidebarContainer #sidebar h3 {
color: #51748C;
}
#sidebarContainer {
color: #A6A6A6;
}
#sidebarContainer #sidebar a,
#breadcrumbcontainer,
a:link, a:visited {
color: #656565;
}
h1, h2, h3, h4, h5,
h1.blog-entry-title a,
.blog-archive-headings-wrapper,
.album-title,
.photo-title,
.movie-page-title {
color: #FF7E00;
}
/* @end */
/* @group Navbar */
#navcontainer a {
color: #7F7F7F;
}
#navcontainer a:hover,
#navcontainer #current,
#navcontainer .currentAncestor,
#sidebarContainer #sidebar a:hover,
.photo-navigation a:hover,
a:hover, a:active,
form,
h1 {
color: #FF7E00;
}
#navcontainer ul ul a:hover,
#navcontainer ul ul #current,
#navcontainer ul ul .currentAncestor {
background: #FF7E00;
color: #fff;
border-bottom-color: #FF7E00;
}
/* @end */
\ No newline at end of file
#pageHeader #overlay_curve_solid {
display: block;
}
\ No newline at end of file
#pageHeader #overlay_stripes_glow {
display: block;
}
\ No newline at end of file
#pageHeader #overlay_stripes_solid {
display: block;
}
\ No newline at end of file
#pageHeader #overlay_swirls {
display: block;
}
\ No newline at end of file
.filesharing-item {
background: url(../../images/download_icon.png) no-repeat 0 3px;
padding-left: 20px;
}
/* @group Blog */
.blog-archive-link {
background: url(../../images/blog_home.png) no-repeat 0 5px;
padding-left: 20px;
}
.blog-entry-date {
padding-left: 20px;
background: url(../../images/blog_clock.png) no-repeat 0 3px;
}
/*styles the category link in the main entry */
.blog-entry-category {
background: url(../../images/blog_file.png) no-repeat 0 0;
}
.blog-entry-body {
padding: 20px 0 40px 0;
background: url(../../images/blog_bottom_bar.png) no-repeat left bottom;
}
.blog-entry-comments {
padding-left: 20px;
background: url(../../images/blog_comments.png) no-repeat 0 3px;
}
.blog-trackback-link {
padding-left: 20px;
background: url(../../images/blog_trackback.png) no-repeat 0 0px;
}
p.blog-entry-tags {
background: url(../../images/blog_tag.png) no-repeat 0 3px;
}
/* styles the archives in the blog sidebar */
.blog-archive-link-enabled {
background: url(../../images/blog_icon.png) no-repeat 0;
}
.blog-archive-link-disabled {
background: url(../../images/blog_icon.png) no-repeat 0;
}
/* Styles the blog categories in the blog sidebar */
.blog-category-link-enabled {
background: url(../../images/blog_file.png) no-repeat 0;
}
.blog-category-link-disabled {
background: url(../../images/blog_file.png) no-repeat 0 3px;
}
.blog-rss-link {
background: url(../../images/blog_rss.png) no-repeat 0;}
.blog-comments-rss-link {
background: url(../../images/blog_rss.png) no-repeat 0;
}
/* @end */
\ No newline at end of file
.blog-entry-category {
background: url(../../images/file_black.png) no-repeat left 0;
}
p.blog-entry-tags {
background: url(../../images/tag_black.png) no-repeat left 2px;
}
.blog-category-link-disabled,
.blog-archive-link-disabled {
background: url(../../images/file_black.png) no-repeat left center;
}
.blog-category-link-enabled,
.blog-archive-link-enabled {
background: url(../../images/file_black.png) no-repeat left 1px;
}
.blog-rss-link {
background: url(../../images/feed.png) no-repeat 0;}
.blog-comments-rss-link {
background: url(../../images/feed.png) no-repeat 0;
}
\ No newline at end of file
.blog-entry-category {
background: url(../../images/file_blue.png) no-repeat left 0;
}
p.blog-entry-tags {
background: url(../../images/tag_blue.png) no-repeat left 2px;
}
.blog-category-link-disabled,
.blog-archive-link-disabled {
background: url(../../images/file_blue.png) no-repeat left center;
}
.blog-category-link-enabled,
.blog-archive-link-enabled {
background: url(../../images/file_blue.png) no-repeat left 1px;
}
.blog-rss-link {
background: url(../../images/feed.png) no-repeat 0;}
.blog-comments-rss-link {
background: url(../../images/feed.png) no-repeat 0;
}
\ No newline at end of file
.blog-entry-category {
background: url(../../images/file_brown.png) no-repeat left 0;
}
p.blog-entry-tags {
background: url(../../images/tag_brown.png) no-repeat left 2px;
}
.blog-category-link-disabled,
.blog-archive-link-disabled {
background: url(../../images/file_brown.png) no-repeat left center;
}
.blog-category-link-enabled,
.blog-archive-link-enabled {
background: url(../../images/file_brown.png) no-repeat left 1px;
}
.blog-rss-link {
background: url(../../images/feed.png) no-repeat 0;}
.blog-comments-rss-link {
background: url(../../images/feed.png) no-repeat 0;
}
\ No newline at end of file
.blog-entry-category {
background: url(../../images/file_green.png) no-repeat left 0;
}
p.blog-entry-tags {
background: url(../../images/tag_green.png) no-repeat left 2px;
}
.blog-category-link-disabled,
.blog-archive-link-disabled {
background: url(../../images/file_green.png) no-repeat left center;
}
.blog-category-link-enabled,
.blog-archive-link-enabled {
background: url(../../images/file_green.png) no-repeat left 1px;
}
.blog-rss-link {
background: url(../../images/feed.png) no-repeat 0;}
.blog-comments-rss-link {
background: url(../../images/feed.png) no-repeat 0;
}
\ No newline at end of file
.blog-entry-category {
background: url(../../images/file_pink.png) no-repeat left 0;
}
p.blog-entry-tags {
background: url(../../images/tag_pink.png) no-repeat left 2px;
}
.blog-category-link-disabled,
.blog-archive-link-disabled {
background: url(../../images/file_pink.png) no-repeat left center;
}
.blog-category-link-enabled,
.blog-archive-link-enabled {
background: url(../../images/file_pink.png) no-repeat left 2px;
}
.blog-rss-link {
background: url(../../images/feed.png) no-repeat 0;}
.blog-comments-rss-link {
background: url(../../images/feed.png) no-repeat 0;
}
\ No newline at end of file
.blog-entry-category {
background: url(../../images/file_red.png) no-repeat left 0;
}
p.blog-entry-tags {
background: url(../../images/tag_red.png) no-repeat left 2px;
}
.blog-category-link-disabled,
.blog-archive-link-disabled {
background: url(../../images/file_red.png) no-repeat left center;
}
.blog-category-link-enabled,
.blog-archive-link-enabled {
background: url(../../images/file_red.png) no-repeat left 1px;
}
.blog-rss-link {
background: url(../../images/feed.png) no-repeat 0;}
.blog-comments-rss-link {
background: url(../../images/feed.png) no-repeat 0;
}
.blog-rss-link {
background: url(../../images/feed.png) no-repeat 0;}
.blog-comments-rss-link {
background: url(../../images/feed.png) no-repeat 0;
}
\ No newline at end of file
#pageHeader #logo img {
margin: 10px auto 0;
}
\ No newline at end of file
#pageHeader #logo img {
float: left;
margin: 10px 0 0 30px;
}
\ No newline at end of file
#pageHeader #logo img {
float: right;
margin: 10px 30px 0 0;
}
\ No newline at end of file
#contentContainer {
float: right;
padding-right: 7px;
background-position: top left;
}
#sidebarContainer {
float: left;
padding-left: 7px;
}
#sidebarContainer #sidebar {
padding-left: 30px;
padding-right: 10px;
}
\ No newline at end of file
#sidebarContainer {
display: none;
}
#contentContainer {
width: auto;
background-image: none;
}
\ No newline at end of file
#contentContainer {
float: left;
padding-left: 7px;
background-position: top right;
}
#sidebarContainer {
float: right;
padding-right: 7px;
}
#sidebarContainer #sidebar {
padding-right: 30px;
padding-left: 10px;
}
\ No newline at end of file
<public:component lightWeight="true">
<public:attach event="onpropertychange" onevent="propertyChanged()" />
<public:attach event="onbeforeprint" onevent="beforePrint()" for="window"/>
<public:attach event="onafterprint" onevent="afterPrint()" for="window"/>
<script>
/*
* PNG Behavior
*
* This script was created by Erik Arvidsson (http://webfx.eae.net/contact.html#erik)
* for WebFX (http://webfx.eae.net)
* Copyright 2002-2004
*
* For usage see license at http://webfx.eae.net/license.html
*
* Version: 1.02
* Created: 2001-??-?? First working version
* Updated: 2002-03-28 Fixed issue when starting with a non png image and
* switching between non png images
* 2003-01-06 Fixed RegExp to correctly work with IE 5.0x
* 2004-05-09 When printing revert to original
*
*/
var supported = /MSIE ((5\.5)|[6789])/.test(navigator.userAgent) &&
navigator.platform == "Win32";
var realSrc;
//var blankSrc = "blank.gif";
var isPrinting = false;
if (supported) fixImage();
function propertyChanged() {
if (!supported || isPrinting) return;
var pName = event.propertyName;
if (pName != "src") return;
// if not set to blank
if (!new RegExp(blankSrc).test(src))
fixImage();
};
function fixImage() {
// get src
var src = element.src;
// check for real change
if (src == realSrc && /\.png$/i.test(src)) {
element.src = blankSrc;
return;
}
if ( ! new RegExp(blankSrc).test(src)) {
// backup old src
realSrc = src;
}
// test for png
if (/\.png$/i.test(realSrc)) {
// set blank image
element.src = blankSrc;
// set filter
element.runtimeStyle.filter = "progid:DXImageTransform.Microsoft." +
"AlphaImageLoader(src='" + src + "',sizingMethod='scale')";
}
else {
// remove filter
element.runtimeStyle.filter = "";
}
}
function beforePrint() {
isPrinting = true;
element.src = realSrc;
element.runtimeStyle.filter = "";
realSrc = null;
}
function afterPrint() {
isPrinting = false;
fixImage();
}
</script>
</public:component>
/* @group Layout Colours */
#bar,
.photo-navigation,
.movie-title {
background-color: #51748C;
}
#pageHeader #title {
background-color: #FF7E00;
}
#pageHeader h1,
#pageHeader h2 {
text-shadow: 0px -1px 0px #994B00;
}
#footer {
background-color: #82B4D7;
}
#footer p {
text-shadow: 0px -1px 0px #4E6C81;
}
#breadcrumbcontainer li {
color: #5B7E96;
}
/* @end */
/* @group Content Colours */
body,
.blog-entry-body,
.blog-entry-date,
.blog-entry {
color: #7F7F7F;
}
#sidebarContainer .sideHeader,
#sidebarContainer #sidebar h1,
#sidebarContainer #sidebar h2,
#sidebarContainer #sidebar h3 {
color: #51748C;
}
#sidebarContainer {
color: #A6A6A6;
}
#sidebarContainer #sidebar a,
#breadcrumbcontainer,
a:link, a:visited {
color: #656565;
}
h1, h2, h3, h4, h5,
h1.blog-entry-title a,
.blog-archive-headings-wrapper,
.album-title,
.photo-title,
.movie-page-title {
color: #FF7E00;
}
/* @end */
/* @group Navbar */
#navcontainer a {
color: #7F7F7F;
}
#navcontainer a:hover,
#navcontainer #current,
#navcontainer .currentAncestor,
#sidebarContainer #sidebar a:hover,
.photo-navigation a:hover,
a:hover, a:active,
form,
h1 {
color: #FF7E00;
}
#navcontainer ul ul a:hover,
#navcontainer ul ul #current,
#navcontainer ul ul .currentAncestor {
background: #FF7E00;
color: #fff;
border-bottom-color: #FF7E00;
}
/* @end */
\ No newline at end of file
#pageHeader #overlay_curve_solid {
display: block;
}
\ No newline at end of file
#pageHeader #overlay_stripes_glow {
display: block;
}
\ No newline at end of file
#pageHeader #overlay_stripes_solid {
display: block;
}
\ No newline at end of file
#pageHeader #overlay_swirls {
display: block;
}
\ No newline at end of file
.filesharing-item {
background: url(../../images/download_icon.png) no-repeat 0 3px;
padding-left: 20px;
}
/* @group Blog */
.blog-archive-link {
background: url(../../images/blog_home.png) no-repeat 0 5px;
padding-left: 20px;
}
.blog-entry-date {
padding-left: 20px;
background: url(../../images/blog_clock.png) no-repeat 0 3px;
}
/*styles the category link in the main entry */
.blog-entry-category {
background: url(../../images/blog_file.png) no-repeat 0 0;
}
.blog-entry-body {
padding: 20px 0 40px 0;
background: url(../../images/blog_bottom_bar.png) no-repeat left bottom;
}
.blog-entry-comments {
padding-left: 20px;
background: url(../../images/blog_comments.png) no-repeat 0 3px;
}
.blog-trackback-link {
padding-left: 20px;
background: url(../../images/blog_trackback.png) no-repeat 0 0px;
}
p.blog-entry-tags {
background: url(../../images/blog_tag.png) no-repeat 0 3px;
}
/* styles the archives in the blog sidebar */
.blog-archive-link-enabled {
background: url(../../images/blog_icon.png) no-repeat 0;
}
.blog-archive-link-disabled {
background: url(../../images/blog_icon.png) no-repeat 0;
}
/* Styles the blog categories in the blog sidebar */
.blog-category-link-enabled {
background: url(../../images/blog_file.png) no-repeat 0;
}
.blog-category-link-disabled {
background: url(../../images/blog_file.png) no-repeat 0 3px;
}
.blog-rss-link {
background: url(../../images/blog_rss.png) no-repeat 0;}
.blog-comments-rss-link {
background: url(../../images/blog_rss.png) no-repeat 0;
}
/* @end */
\ No newline at end of file
.blog-entry-category {
background: url(../../images/file_black.png) no-repeat left 0;
}
p.blog-entry-tags {
background: url(../../images/tag_black.png) no-repeat left 2px;
}
.blog-category-link-disabled,
.blog-archive-link-disabled {
background: url(../../images/file_black.png) no-repeat left center;
}
.blog-category-link-enabled,
.blog-archive-link-enabled {
background: url(../../images/file_black.png) no-repeat left 1px;
}
.blog-rss-link {
background: url(../../images/feed.png) no-repeat 0;}
.blog-comments-rss-link {
background: url(../../images/feed.png) no-repeat 0;
}
\ No newline at end of file
.blog-entry-category {
background: url(../../images/file_blue.png) no-repeat left 0;
}
p.blog-entry-tags {
background: url(../../images/tag_blue.png) no-repeat left 2px;
}
.blog-category-link-disabled,
.blog-archive-link-disabled {
background: url(../../images/file_blue.png) no-repeat left center;
}
.blog-category-link-enabled,
.blog-archive-link-enabled {
background: url(../../images/file_blue.png) no-repeat left 1px;
}
.blog-rss-link {
background: url(../../images/feed.png) no-repeat 0;}
.blog-comments-rss-link {
background: url(../../images/feed.png) no-repeat 0;
}
\ No newline at end of file
.blog-entry-category {
background: url(../../images/file_brown.png) no-repeat left 0;
}
p.blog-entry-tags {
background: url(../../images/tag_brown.png) no-repeat left 2px;
}
.blog-category-link-disabled,
.blog-archive-link-disabled {
background: url(../../images/file_brown.png) no-repeat left center;
}
.blog-category-link-enabled,
.blog-archive-link-enabled {
background: url(../../images/file_brown.png) no-repeat left 1px;
}
.blog-rss-link {
background: url(../../images/feed.png) no-repeat 0;}
.blog-comments-rss-link {
background: url(../../images/feed.png) no-repeat 0;
}
\ No newline at end of file
.blog-entry-category {
background: url(../../images/file_green.png) no-repeat left 0;
}
p.blog-entry-tags {
background: url(../../images/tag_green.png) no-repeat left 2px;
}
.blog-category-link-disabled,
.blog-archive-link-disabled {
background: url(../../images/file_green.png) no-repeat left center;
}
.blog-category-link-enabled,
.blog-archive-link-enabled {
background: url(../../images/file_green.png) no-repeat left 1px;
}
.blog-rss-link {
background: url(../../images/feed.png) no-repeat 0;}
.blog-comments-rss-link {
background: url(../../images/feed.png) no-repeat 0;
}
\ No newline at end of file
.blog-entry-category {
background: url(../../images/file_pink.png) no-repeat left 0;
}
p.blog-entry-tags {
background: url(../../images/tag_pink.png) no-repeat left 2px;
}
.blog-category-link-disabled,
.blog-archive-link-disabled {
background: url(../../images/file_pink.png) no-repeat left center;
}
.blog-category-link-enabled,
.blog-archive-link-enabled {
background: url(../../images/file_pink.png) no-repeat left 2px;
}
.blog-rss-link {
background: url(../../images/feed.png) no-repeat 0;}
.blog-comments-rss-link {
background: url(../../images/feed.png) no-repeat 0;
}
\ No newline at end of file
.blog-entry-category {
background: url(../../images/file_red.png) no-repeat left 0;
}
p.blog-entry-tags {
background: url(../../images/tag_red.png) no-repeat left 2px;
}
.blog-category-link-disabled,
.blog-archive-link-disabled {
background: url(../../images/file_red.png) no-repeat left center;
}
.blog-category-link-enabled,
.blog-archive-link-enabled {
background: url(../../images/file_red.png) no-repeat left 1px;
}
.blog-rss-link {
background: url(../../images/feed.png) no-repeat 0;}
.blog-comments-rss-link {
background: url(../../images/feed.png) no-repeat 0;
}
.blog-rss-link {
background: url(../../images/feed.png) no-repeat 0;}
.blog-comments-rss-link {
background: url(../../images/feed.png) no-repeat 0;
}
\ No newline at end of file
#pageHeader #logo img {
margin: 10px auto 0;
}
\ No newline at end of file
#pageHeader #logo img {
float: left;
margin: 10px 0 0 30px;
}
\ No newline at end of file
#pageHeader #logo img {
float: right;
margin: 10px 30px 0 0;
}
\ No newline at end of file
#contentContainer {
float: right;
padding-right: 7px;
background-position: top left;
}
#sidebarContainer {
float: left;
padding-left: 7px;
}
#sidebarContainer #sidebar {
padding-left: 30px;
padding-right: 10px;
}
\ No newline at end of file
#sidebarContainer {
display: none;
}
#contentContainer {
width: auto;
background-image: none;
}
\ No newline at end of file
#contentContainer {
float: left;
padding-left: 7px;
background-position: top right;
}
#sidebarContainer {
float: right;
padding-right: 7px;
}
#sidebarContainer #sidebar {
padding-right: 30px;
padding-left: 10px;
}
\ No newline at end of file
<public:component lightWeight="true">
<public:attach event="onpropertychange" onevent="propertyChanged()" />
<public:attach event="onbeforeprint" onevent="beforePrint()" for="window"/>
<public:attach event="onafterprint" onevent="afterPrint()" for="window"/>
<script>
/*
* PNG Behavior
*
* This script was created by Erik Arvidsson (http://webfx.eae.net/contact.html#erik)
* for WebFX (http://webfx.eae.net)
* Copyright 2002-2004
*
* For usage see license at http://webfx.eae.net/license.html
*
* Version: 1.02
* Created: 2001-??-?? First working version
* Updated: 2002-03-28 Fixed issue when starting with a non png image and
* switching between non png images
* 2003-01-06 Fixed RegExp to correctly work with IE 5.0x
* 2004-05-09 When printing revert to original
*
*/
var supported = /MSIE ((5\.5)|[6789])/.test(navigator.userAgent) &&
navigator.platform == "Win32";
var realSrc;
//var blankSrc = "blank.gif";
var isPrinting = false;
if (supported) fixImage();
function propertyChanged() {
if (!supported || isPrinting) return;
var pName = event.propertyName;
if (pName != "src") return;
// if not set to blank
if (!new RegExp(blankSrc).test(src))
fixImage();
};
function fixImage() {
// get src
var src = element.src;
// check for real change
if (src == realSrc && /\.png$/i.test(src)) {
element.src = blankSrc;
return;
}
if ( ! new RegExp(blankSrc).test(src)) {
// backup old src
realSrc = src;
}
// test for png
if (/\.png$/i.test(realSrc)) {
// set blank image
element.src = blankSrc;
// set filter
element.runtimeStyle.filter = "progid:DXImageTransform.Microsoft." +
"AlphaImageLoader(src='" + src + "',sizingMethod='scale')";
}
else {
// remove filter
element.runtimeStyle.filter = "";
}
}
function beforePrint() {
isPrinting = true;
element.src = realSrc;
element.runtimeStyle.filter = "";
realSrc = null;
}
function afterPrint() {
isPrinting = false;
fixImage();
}
</script>
</public:component>
...@@ -70,6 +70,12 @@ const QString UBSvgSubsetAdaptor::sPixelUnit = "px"; ...@@ -70,6 +70,12 @@ const QString UBSvgSubsetAdaptor::sPixelUnit = "px";
const QString UBSvgSubsetAdaptor::sFontWeightPrefix = "font-weight:"; const QString UBSvgSubsetAdaptor::sFontWeightPrefix = "font-weight:";
const QString UBSvgSubsetAdaptor::sFontStylePrefix = "font-style:"; const QString UBSvgSubsetAdaptor::sFontStylePrefix = "font-style:";
const QString UBSvgSubsetAdaptor::sFormerUniboardDocumentNamespaceUri = "http://www.mnemis.com/uniboard"; const QString UBSvgSubsetAdaptor::sFormerUniboardDocumentNamespaceUri = "http://www.mnemis.com/uniboard";
const QString tElement = "element";
const QString tGroup = "group";
const QString tGroups = "groups";
const QString aId = "id";
QMap<QString,IDataStorage*> UBSvgSubsetAdaptor::additionalElementToStore; QMap<QString,IDataStorage*> UBSvgSubsetAdaptor::additionalElementToStore;
QString UBSvgSubsetAdaptor::toSvgTransform(const QMatrix& matrix) QString UBSvgSubsetAdaptor::toSvgTransform(const QMatrix& matrix)
...@@ -107,6 +113,7 @@ QMatrix UBSvgSubsetAdaptor::fromSvgTransform(const QString& transform) ...@@ -107,6 +113,7 @@ QMatrix UBSvgSubsetAdaptor::fromSvgTransform(const QString& transform)
} }
static bool itemZIndexComp(const QGraphicsItem* item1, static bool itemZIndexComp(const QGraphicsItem* item1,
const QGraphicsItem* item2) const QGraphicsItem* item2)
{ {
...@@ -360,7 +367,7 @@ UBSvgSubsetAdaptor::UBSvgSubsetReader::UBSvgSubsetReader(UBDocumentProxy* pProxy ...@@ -360,7 +367,7 @@ UBSvgSubsetAdaptor::UBSvgSubsetReader::UBSvgSubsetReader(UBDocumentProxy* pProxy
UBGraphicsScene* UBSvgSubsetAdaptor::UBSvgSubsetReader::loadScene() UBGraphicsScene* UBSvgSubsetAdaptor::UBSvgSubsetReader::loadScene()
{ {
UBGraphicsScene *scene = 0; mScene = 0;
UBGraphicsWidgetItem *currentWidget = 0; UBGraphicsWidgetItem *currentWidget = 0;
mFileVersion = 40100; // default to 4.1.0 mFileVersion = 40100; // default to 4.1.0
...@@ -369,19 +376,20 @@ UBGraphicsScene* UBSvgSubsetAdaptor::UBSvgSubsetReader::loadScene() ...@@ -369,19 +376,20 @@ UBGraphicsScene* UBSvgSubsetAdaptor::UBSvgSubsetReader::loadScene()
UBGraphicsStrokesGroup* strokesGroup = 0; UBGraphicsStrokesGroup* strokesGroup = 0;
UBDrawingController* dc = UBDrawingController::drawingController(); UBDrawingController* dc = UBDrawingController::drawingController();
while (!mXmlReader.atEnd()) while (!mXmlReader.atEnd())
{ {
mXmlReader.readNext(); mXmlReader.readNext();
if (mXmlReader.isStartElement()) if (mXmlReader.isStartElement())
{ {
qreal zFromSvg = getZValueFromSvg(); qreal zFromSvg = getZValueFromSvg();
QUuid uuidFromSvg = getUuidFromSvg();
if (mXmlReader.name() == "svg") if (mXmlReader.name() == "svg")
{ {
if (!scene) if (!mScene)
{ {
scene = new UBGraphicsScene(mProxy); mScene = new UBGraphicsScene(mProxy);
} }
// introduced in UB 4.2 // introduced in UB 4.2
...@@ -418,7 +426,7 @@ UBGraphicsScene* UBSvgSubsetAdaptor::UBSvgSubsetReader::loadScene() ...@@ -418,7 +426,7 @@ UBGraphicsScene* UBSvgSubsetAdaptor::UBSvgSubsetReader::loadScene()
if (!svgSceneUuid.isNull()) if (!svgSceneUuid.isNull())
{ {
scene->setUuid(QUuid(svgSceneUuid.toString())); mScene->setUuid(QUuid(svgSceneUuid.toString()));
} }
// introduced in UB 4.0 // introduced in UB 4.0
...@@ -438,7 +446,7 @@ UBGraphicsScene* UBSvgSubsetAdaptor::UBSvgSubsetReader::loadScene() ...@@ -438,7 +446,7 @@ UBGraphicsScene* UBSvgSubsetAdaptor::UBSvgSubsetReader::loadScene()
sceneRect.setWidth(ts.at(2).toFloat()); sceneRect.setWidth(ts.at(2).toFloat());
sceneRect.setHeight(ts.at(3).toFloat()); sceneRect.setHeight(ts.at(3).toFloat());
scene->setSceneRect(sceneRect); mScene->setSceneRect(sceneRect);
} }
else else
{ {
...@@ -459,7 +467,7 @@ UBGraphicsScene* UBSvgSubsetAdaptor::UBSvgSubsetReader::loadScene() ...@@ -459,7 +467,7 @@ UBGraphicsScene* UBSvgSubsetAdaptor::UBSvgSubsetReader::loadScene()
if (!ubDarkBackground.isNull()) if (!ubDarkBackground.isNull())
crossedBackground = (ubCrossedBackground.toString() == xmlTrue); crossedBackground = (ubCrossedBackground.toString() == xmlTrue);
scene->setBackground(darkBackground, crossedBackground); mScene->setBackground(darkBackground, crossedBackground);
QStringRef pageNominalSize = mXmlReader.attributes().value(mNamespaceUri, "nominal-size"); QStringRef pageNominalSize = mXmlReader.attributes().value(mNamespaceUri, "nominal-size");
if (!pageNominalSize.isNull()) if (!pageNominalSize.isNull())
...@@ -472,7 +480,7 @@ UBGraphicsScene* UBSvgSubsetAdaptor::UBSvgSubsetReader::loadScene() ...@@ -472,7 +480,7 @@ UBGraphicsScene* UBSvgSubsetAdaptor::UBSvgSubsetReader::loadScene()
sceneSize.setWidth(ts.at(0).toInt()); sceneSize.setWidth(ts.at(0).toInt());
sceneSize.setHeight(ts.at(1).toInt()); sceneSize.setHeight(ts.at(1).toInt());
scene->setNominalSize(sceneSize); mScene->setNominalSize(sceneSize);
} }
else else
{ {
...@@ -525,11 +533,11 @@ UBGraphicsScene* UBSvgSubsetAdaptor::UBSvgSubsetReader::loadScene() ...@@ -525,11 +533,11 @@ UBGraphicsScene* UBSvgSubsetAdaptor::UBSvgSubsetReader::loadScene()
if (mXmlReader.name() == "polygon") if (mXmlReader.name() == "polygon")
{ {
polygonItem = polygonItemFromPolygonSvg(scene->isDarkBackground() ? Qt::white : Qt::black); polygonItem = polygonItemFromPolygonSvg(mScene->isDarkBackground() ? Qt::white : Qt::black);
} }
else if (mXmlReader.name() == "line") else if (mXmlReader.name() == "line")
{ {
polygonItem = polygonItemFromLineSvg(scene->isDarkBackground() ? Qt::white : Qt::black); polygonItem = polygonItemFromLineSvg(mScene->isDarkBackground() ? Qt::white : Qt::black);
} }
if (polygonItem) if (polygonItem)
...@@ -546,7 +554,7 @@ UBGraphicsScene* UBSvgSubsetAdaptor::UBSvgSubsetReader::loadScene() ...@@ -546,7 +554,7 @@ UBGraphicsScene* UBSvgSubsetAdaptor::UBSvgSubsetReader::loadScene()
polygonItem->setStrokesGroup(strokesGroup); polygonItem->setStrokesGroup(strokesGroup);
} }
}else{ }else{
scene->addItem(polygonItem); mScene->addItem(polygonItem);
} }
polygonItem->setData(UBGraphicsItemData::ItemLayerType, QVariant(UBItemLayerType::Graphic)); polygonItem->setData(UBGraphicsItemData::ItemLayerType, QVariant(UBItemLayerType::Graphic));
...@@ -557,7 +565,7 @@ UBGraphicsScene* UBSvgSubsetAdaptor::UBSvgSubsetReader::loadScene() ...@@ -557,7 +565,7 @@ UBGraphicsScene* UBSvgSubsetAdaptor::UBSvgSubsetReader::loadScene()
else if (mXmlReader.name() == "polyline") else if (mXmlReader.name() == "polyline")
{ {
QList<UBGraphicsPolygonItem*> polygonItems QList<UBGraphicsPolygonItem*> polygonItems
= polygonItemsFromPolylineSvg(scene->isDarkBackground() ? Qt::white : Qt::black); = polygonItemsFromPolylineSvg(mScene->isDarkBackground() ? Qt::white : Qt::black);
foreach(UBGraphicsPolygonItem* polygonItem, polygonItems) foreach(UBGraphicsPolygonItem* polygonItem, polygonItems)
{ {
...@@ -572,7 +580,7 @@ UBGraphicsScene* UBSvgSubsetAdaptor::UBSvgSubsetReader::loadScene() ...@@ -572,7 +580,7 @@ UBGraphicsScene* UBSvgSubsetAdaptor::UBSvgSubsetReader::loadScene()
strokesGroup->addToGroup(polygonItem); strokesGroup->addToGroup(polygonItem);
} }
}else{ }else{
scene->addItem(polygonItem); mScene->addItem(polygonItem);
} }
polygonItem->setData(UBGraphicsItemData::ItemLayerType, QVariant(UBItemLayerType::Graphic)); polygonItem->setData(UBGraphicsItemData::ItemLayerType, QVariant(UBItemLayerType::Graphic));
...@@ -594,19 +602,22 @@ UBGraphicsScene* UBSvgSubsetAdaptor::UBSvgSubsetReader::loadScene() ...@@ -594,19 +602,22 @@ UBGraphicsScene* UBSvgSubsetAdaptor::UBSvgSubsetReader::loadScene()
if (href.contains("png")) if (href.contains("png"))
{ {
QGraphicsPixmapItem* pixmapItem = pixmapItemFromSvg(); UBGraphicsPixmapItem* pixmapItem = pixmapItemFromSvg();
if (pixmapItem) if (pixmapItem)
{ {
pixmapItem->setFlag(QGraphicsItem::ItemIsMovable, true); pixmapItem->setFlag(QGraphicsItem::ItemIsMovable, true);
pixmapItem->setFlag(QGraphicsItem::ItemIsSelectable, true); pixmapItem->setFlag(QGraphicsItem::ItemIsSelectable, true);
scene->addItem(pixmapItem); mScene->addItem(pixmapItem);
if (zFromSvg != UBZLayerController::errorNum()) if (zFromSvg != UBZLayerController::errorNum())
UBGraphicsItem::assignZValue(pixmapItem, zFromSvg); UBGraphicsItem::assignZValue(pixmapItem, zFromSvg);
if (!uuidFromSvg.isNull())
pixmapItem->setUuid(uuidFromSvg);
if (isBackground) if (isBackground)
scene->setAsBackgroundObject(pixmapItem); mScene->setAsBackgroundObject(pixmapItem);
pixmapItem->show(); pixmapItem->show();
} }
...@@ -620,13 +631,13 @@ UBGraphicsScene* UBSvgSubsetAdaptor::UBSvgSubsetReader::loadScene() ...@@ -620,13 +631,13 @@ UBGraphicsScene* UBSvgSubsetAdaptor::UBSvgSubsetReader::loadScene()
svgItem->setFlag(QGraphicsItem::ItemIsMovable, true); svgItem->setFlag(QGraphicsItem::ItemIsMovable, true);
svgItem->setFlag(QGraphicsItem::ItemIsSelectable, true); svgItem->setFlag(QGraphicsItem::ItemIsSelectable, true);
scene->addItem(svgItem); mScene->addItem(svgItem);
if (zFromSvg != UBZLayerController::errorNum()) if (zFromSvg != UBZLayerController::errorNum())
UBGraphicsItem::assignZValue(svgItem, zFromSvg); UBGraphicsItem::assignZValue(svgItem, zFromSvg);
if (isBackground) if (isBackground)
scene->setAsBackgroundObject(svgItem); mScene->setAsBackgroundObject(svgItem);
svgItem->show(); svgItem->show();
} }
...@@ -646,11 +657,14 @@ UBGraphicsScene* UBSvgSubsetAdaptor::UBSvgSubsetReader::loadScene() ...@@ -646,11 +657,14 @@ UBGraphicsScene* UBSvgSubsetAdaptor::UBSvgSubsetReader::loadScene()
audioItem->setFlag(QGraphicsItem::ItemIsMovable, true); audioItem->setFlag(QGraphicsItem::ItemIsMovable, true);
audioItem->setFlag(QGraphicsItem::ItemIsSelectable, true); audioItem->setFlag(QGraphicsItem::ItemIsSelectable, true);
scene->addItem(audioItem); mScene->addItem(audioItem);
if (zFromSvg != UBZLayerController::errorNum()) if (zFromSvg != UBZLayerController::errorNum())
UBGraphicsItem::assignZValue(audioItem, zFromSvg); UBGraphicsItem::assignZValue(audioItem, zFromSvg);
if (!uuidFromSvg.isNull())
audioItem->setUuid(uuidFromSvg);
audioItem->show(); audioItem->show();
//force start to load the video and display the first frame //force start to load the video and display the first frame
...@@ -667,11 +681,14 @@ UBGraphicsScene* UBSvgSubsetAdaptor::UBSvgSubsetReader::loadScene() ...@@ -667,11 +681,14 @@ UBGraphicsScene* UBSvgSubsetAdaptor::UBSvgSubsetReader::loadScene()
videoItem->setFlag(QGraphicsItem::ItemIsMovable, true); videoItem->setFlag(QGraphicsItem::ItemIsMovable, true);
videoItem->setFlag(QGraphicsItem::ItemIsSelectable, true); videoItem->setFlag(QGraphicsItem::ItemIsSelectable, true);
scene->addItem(videoItem); mScene->addItem(videoItem);
if (zFromSvg != UBZLayerController::errorNum()) if (zFromSvg != UBZLayerController::errorNum())
UBGraphicsItem::assignZValue(videoItem, zFromSvg); UBGraphicsItem::assignZValue(videoItem, zFromSvg);
if (!uuidFromSvg.isNull())
videoItem->setUuid(uuidFromSvg);
videoItem->show(); videoItem->show();
//force start to load the video and display the first frame //force start to load the video and display the first frame
...@@ -688,11 +705,14 @@ UBGraphicsScene* UBSvgSubsetAdaptor::UBSvgSubsetReader::loadScene() ...@@ -688,11 +705,14 @@ UBGraphicsScene* UBSvgSubsetAdaptor::UBSvgSubsetReader::loadScene()
textItem->setFlag(QGraphicsItem::ItemIsMovable, true); textItem->setFlag(QGraphicsItem::ItemIsMovable, true);
textItem->setFlag(QGraphicsItem::ItemIsSelectable, true); textItem->setFlag(QGraphicsItem::ItemIsSelectable, true);
scene->addItem(textItem); mScene->addItem(textItem);
if (zFromSvg != UBZLayerController::errorNum()) if (zFromSvg != UBZLayerController::errorNum())
UBGraphicsItem::assignZValue(textItem, zFromSvg); UBGraphicsItem::assignZValue(textItem, zFromSvg);
if (!uuidFromSvg.isNull())
textItem->setUuid(uuidFromSvg);
textItem->show(); textItem->show();
} }
} }
...@@ -702,11 +722,14 @@ UBGraphicsScene* UBSvgSubsetAdaptor::UBSvgSubsetReader::loadScene() ...@@ -702,11 +722,14 @@ UBGraphicsScene* UBSvgSubsetAdaptor::UBSvgSubsetReader::loadScene()
if (mask) if (mask)
{ {
scene->addItem(mask); mScene->addItem(mask);
scene->registerTool(mask); mScene->registerTool(mask);
if (zFromSvg != UBZLayerController::errorNum()) if (zFromSvg != UBZLayerController::errorNum())
UBGraphicsItem::assignZValue(mask, zFromSvg); UBGraphicsItem::assignZValue(mask, zFromSvg);
if (!uuidFromSvg.isNull())
mask->setUuid(uuidFromSvg);
} }
} }
else if (mXmlReader.name() == "ruler") else if (mXmlReader.name() == "ruler")
...@@ -718,8 +741,8 @@ UBGraphicsScene* UBSvgSubsetAdaptor::UBSvgSubsetReader::loadScene() ...@@ -718,8 +741,8 @@ UBGraphicsScene* UBSvgSubsetAdaptor::UBSvgSubsetReader::loadScene()
ubZValue = mXmlReader.attributes().value(mNamespaceUri, "z-value").toString(); ubZValue = mXmlReader.attributes().value(mNamespaceUri, "z-value").toString();
if (ruler) if (ruler)
{ {
scene->addItem(ruler); mScene->addItem(ruler);
scene->registerTool(ruler); mScene->registerTool(ruler);
if (zFromSvg != UBZLayerController::errorNum()) if (zFromSvg != UBZLayerController::errorNum())
UBGraphicsItem::assignZValue(ruler, zFromSvg); UBGraphicsItem::assignZValue(ruler, zFromSvg);
...@@ -732,8 +755,8 @@ UBGraphicsScene* UBSvgSubsetAdaptor::UBSvgSubsetReader::loadScene() ...@@ -732,8 +755,8 @@ UBGraphicsScene* UBSvgSubsetAdaptor::UBSvgSubsetReader::loadScene()
if (compass) if (compass)
{ {
scene->addItem(compass); mScene->addItem(compass);
scene->registerTool(compass); mScene->registerTool(compass);
if (zFromSvg != UBZLayerController::errorNum()) if (zFromSvg != UBZLayerController::errorNum())
UBGraphicsItem::assignZValue(compass, zFromSvg); UBGraphicsItem::assignZValue(compass, zFromSvg);
...@@ -745,8 +768,8 @@ UBGraphicsScene* UBSvgSubsetAdaptor::UBSvgSubsetReader::loadScene() ...@@ -745,8 +768,8 @@ UBGraphicsScene* UBSvgSubsetAdaptor::UBSvgSubsetReader::loadScene()
if (protractor) if (protractor)
{ {
scene->addItem(protractor); mScene->addItem(protractor);
scene->registerTool(protractor); mScene->registerTool(protractor);
if (zFromSvg != UBZLayerController::errorNum()) if (zFromSvg != UBZLayerController::errorNum())
UBGraphicsItem::assignZValue(protractor, zFromSvg); UBGraphicsItem::assignZValue(protractor, zFromSvg);
...@@ -758,8 +781,8 @@ UBGraphicsScene* UBSvgSubsetAdaptor::UBSvgSubsetReader::loadScene() ...@@ -758,8 +781,8 @@ UBGraphicsScene* UBSvgSubsetAdaptor::UBSvgSubsetReader::loadScene()
if (triangle) if (triangle)
{ {
scene->addItem(triangle); mScene->addItem(triangle);
scene->registerTool(triangle); mScene->registerTool(triangle);
if (zFromSvg != UBZLayerController::errorNum()) if (zFromSvg != UBZLayerController::errorNum())
UBGraphicsItem::assignZValue(triangle, zFromSvg); UBGraphicsItem::assignZValue(triangle, zFromSvg);
...@@ -770,8 +793,8 @@ UBGraphicsScene* UBSvgSubsetAdaptor::UBSvgSubsetReader::loadScene() ...@@ -770,8 +793,8 @@ UBGraphicsScene* UBSvgSubsetAdaptor::UBSvgSubsetReader::loadScene()
UBGraphicsCache* cache = cacheFromSvg(); UBGraphicsCache* cache = cacheFromSvg();
if(cache) if(cache)
{ {
scene->addItem(cache); mScene->addItem(cache);
scene->registerTool(cache); mScene->registerTool(cache);
UBApplication::boardController->notifyCache(true); UBApplication::boardController->notifyCache(true);
if (zFromSvg != UBZLayerController::errorNum()) if (zFromSvg != UBZLayerController::errorNum())
...@@ -796,13 +819,13 @@ UBGraphicsScene* UBSvgSubsetAdaptor::UBSvgSubsetReader::loadScene() ...@@ -796,13 +819,13 @@ UBGraphicsScene* UBSvgSubsetAdaptor::UBSvgSubsetReader::loadScene()
pdfItem->setFlag(QGraphicsItem::ItemIsMovable, true); pdfItem->setFlag(QGraphicsItem::ItemIsMovable, true);
pdfItem->setFlag(QGraphicsItem::ItemIsSelectable, true); pdfItem->setFlag(QGraphicsItem::ItemIsSelectable, true);
scene->addItem(pdfItem); mScene->addItem(pdfItem);
if (zFromSvg != UBZLayerController::errorNum()) if (zFromSvg != UBZLayerController::errorNum())
UBGraphicsItem::assignZValue(pdfItem, zFromSvg); UBGraphicsItem::assignZValue(pdfItem, zFromSvg);
if (isBackground) if (isBackground)
scene->setAsBackgroundObject(pdfItem); mScene->setAsBackgroundObject(pdfItem);
pdfItem->show(); pdfItem->show();
...@@ -819,11 +842,14 @@ UBGraphicsScene* UBSvgSubsetAdaptor::UBSvgSubsetReader::loadScene() ...@@ -819,11 +842,14 @@ UBGraphicsScene* UBSvgSubsetAdaptor::UBSvgSubsetReader::loadScene()
appleWidgetItem->resize(foreignObjectWidth, foreignObjectHeight); appleWidgetItem->resize(foreignObjectWidth, foreignObjectHeight);
scene->addItem(appleWidgetItem); mScene->addItem(appleWidgetItem);
if (zFromSvg != UBZLayerController::errorNum()) if (zFromSvg != UBZLayerController::errorNum())
UBGraphicsItem::assignZValue(appleWidgetItem, zFromSvg); UBGraphicsItem::assignZValue(appleWidgetItem, zFromSvg);
if (!uuidFromSvg.isNull())
appleWidgetItem->setUuid(uuidFromSvg);
appleWidgetItem->show(); appleWidgetItem->show();
currentWidget = appleWidgetItem; currentWidget = appleWidgetItem;
...@@ -840,11 +866,14 @@ UBGraphicsScene* UBSvgSubsetAdaptor::UBSvgSubsetReader::loadScene() ...@@ -840,11 +866,14 @@ UBGraphicsScene* UBSvgSubsetAdaptor::UBSvgSubsetReader::loadScene()
w3cWidgetItem->resize(foreignObjectWidth, foreignObjectHeight); w3cWidgetItem->resize(foreignObjectWidth, foreignObjectHeight);
scene->addItem(w3cWidgetItem); mScene->addItem(w3cWidgetItem);
if (zFromSvg != UBZLayerController::errorNum()) if (zFromSvg != UBZLayerController::errorNum())
UBGraphicsItem::assignZValue(w3cWidgetItem, zFromSvg); UBGraphicsItem::assignZValue(w3cWidgetItem, zFromSvg);
if (!uuidFromSvg.isNull())
w3cWidgetItem->setUuid(uuidFromSvg);
w3cWidgetItem->show(); w3cWidgetItem->show();
currentWidget = w3cWidgetItem; currentWidget = w3cWidgetItem;
...@@ -859,11 +888,14 @@ UBGraphicsScene* UBSvgSubsetAdaptor::UBSvgSubsetReader::loadScene() ...@@ -859,11 +888,14 @@ UBGraphicsScene* UBSvgSubsetAdaptor::UBSvgSubsetReader::loadScene()
textItem->setFlag(QGraphicsItem::ItemIsMovable, true); textItem->setFlag(QGraphicsItem::ItemIsMovable, true);
textItem->setFlag(QGraphicsItem::ItemIsSelectable, true); textItem->setFlag(QGraphicsItem::ItemIsSelectable, true);
scene->addItem(textItem); mScene->addItem(textItem);
if (zFromSvg != UBZLayerController::errorNum()) if (zFromSvg != UBZLayerController::errorNum())
UBGraphicsItem::assignZValue(textItem, zFromSvg); UBGraphicsItem::assignZValue(textItem, zFromSvg);
if (!uuidFromSvg.isNull())
textItem->setUuid(uuidFromSvg);
textItem->show(); textItem->show();
} }
} }
...@@ -885,6 +917,10 @@ UBGraphicsScene* UBSvgSubsetAdaptor::UBSvgSubsetReader::loadScene() ...@@ -885,6 +917,10 @@ UBGraphicsScene* UBSvgSubsetAdaptor::UBSvgSubsetReader::loadScene()
QString value = mXmlReader.attributes().value("value").toString(); QString value = mXmlReader.attributes().value("value").toString();
currentWidget->setDatastoreEntry(key, value); currentWidget->setDatastoreEntry(key, value);
} else if (mXmlReader.name() == tGroups) {
//considering groups section at the end of the document
readGroupRoot();
} }
// else if (mXmlReader.name() == "teacherBar" || mXmlReader.name() == "teacherGuide"){ // else if (mXmlReader.name() == "teacherBar" || mXmlReader.name() == "teacherGuide"){
// sTeacherGuideNode.clear(); // sTeacherGuideNode.clear();
...@@ -907,8 +943,8 @@ UBGraphicsScene* UBSvgSubsetAdaptor::UBSvgSubsetReader::loadScene() ...@@ -907,8 +943,8 @@ UBGraphicsScene* UBSvgSubsetAdaptor::UBSvgSubsetReader::loadScene()
{ {
if (mXmlReader.name() == "g") if (mXmlReader.name() == "g")
{ {
if(strokesGroup && scene){ if(strokesGroup && mScene){
scene->addItem(strokesGroup); mScene->addItem(strokesGroup);
//graphicsItemFromSvg(strokesGroup); //graphicsItemFromSvg(strokesGroup);
} }
...@@ -930,6 +966,8 @@ UBGraphicsScene* UBSvgSubsetAdaptor::UBSvgSubsetReader::loadScene() ...@@ -930,6 +966,8 @@ UBGraphicsScene* UBSvgSubsetAdaptor::UBSvgSubsetReader::loadScene()
// storageClass->load(sTeacherGuideNode); // storageClass->load(sTeacherGuideNode);
// } // }
// } // }
} }
} }
...@@ -938,8 +976,8 @@ UBGraphicsScene* UBSvgSubsetAdaptor::UBSvgSubsetReader::loadScene() ...@@ -938,8 +976,8 @@ UBGraphicsScene* UBSvgSubsetAdaptor::UBSvgSubsetReader::loadScene()
qWarning() << "error parsing Sankore file " << mXmlReader.errorString(); qWarning() << "error parsing Sankore file " << mXmlReader.errorString();
} }
if (scene) { if (mScene) {
scene->setModified(false); mScene->setModified(false);
} }
if (annotationGroup) if (annotationGroup)
...@@ -948,9 +986,82 @@ UBGraphicsScene* UBSvgSubsetAdaptor::UBSvgSubsetReader::loadScene() ...@@ -948,9 +986,82 @@ UBGraphicsScene* UBSvgSubsetAdaptor::UBSvgSubsetReader::loadScene()
delete annotationGroup; delete annotationGroup;
} }
return scene; return mScene;
}
UBGraphicsGroupContainerItem* UBSvgSubsetAdaptor::UBSvgSubsetReader::readGroup()
{
UBGraphicsGroupContainerItem *result = new UBGraphicsGroupContainerItem();
QUuid groupUuid = QUuid(mXmlReader.attributes().value(aId).toString());
mXmlReader.readNext();
while (!mXmlReader.atEnd()) {
if (mXmlReader.isEndElement()) {
mXmlReader.readNext();
result->setUuid(groupUuid);
if (!result->childItems().count()) {
delete result;
result = 0;
}
break;
} else if (mXmlReader.isStartElement()) {
if (mXmlReader.name() == tGroup) {
qDebug() << "came across the group id is" << mXmlReader.attributes().value(aId);
UBGraphicsGroupContainerItem *curGroup = readGroup();
if (curGroup) {
result->addToGroup(curGroup);
}
} else if (mXmlReader.name() == tElement) {
QGraphicsItem *curItem = readElementFromGroup();
if (curItem) {
result->addToGroup(curItem);
}
}else {
mXmlReader.skipCurrentElement();
}
} else {
mXmlReader.readNext();
}
}
return result;
} }
void UBSvgSubsetAdaptor::UBSvgSubsetReader::readGroupRoot()
{
mXmlReader.readNext();
while (!mXmlReader.atEnd()) {
if (mXmlReader.isEndElement()) {
mXmlReader.readNext();
break;
} else if (mXmlReader.isStartElement()) {
if (mXmlReader.name() == tGroup) {
UBGraphicsGroupContainerItem *curGroup = readGroup();
if (curGroup) {
mScene->addGroup(curGroup);
}
}else {
mXmlReader.skipCurrentElement();
}
} else {
mXmlReader.readNext();
}
}
}
QGraphicsItem *UBSvgSubsetAdaptor::UBSvgSubsetReader::readElementFromGroup()
{
QGraphicsItem *result = 0;
result = mScene->itemByUuid(QUuid(mXmlReader.attributes().value(aId).toString()));
mXmlReader.skipCurrentElement();
mXmlReader.readNext();
return result;
}
void UBSvgSubsetAdaptor::persistScene(UBDocumentProxy* proxy, UBGraphicsScene* pScene, const int pageIndex) void UBSvgSubsetAdaptor::persistScene(UBDocumentProxy* proxy, UBGraphicsScene* pScene, const int pageIndex)
{ {
...@@ -1007,6 +1118,13 @@ bool UBSvgSubsetAdaptor::UBSvgSubsetWriter::persistScene(int pageIndex) ...@@ -1007,6 +1118,13 @@ bool UBSvgSubsetAdaptor::UBSvgSubsetWriter::persistScene(int pageIndex)
{ {
if (mScene->isModified()) if (mScene->isModified())
{ {
//Creating dom structure to store information
QDomDocument groupDomDocument;
QDomElement groupRoot = groupDomDocument.createElement(tGroups);
groupDomDocument.appendChild(groupRoot);
static int i = 0; static int i = 0;
qDebug() << "persist call no is " << ++i; qDebug() << "persist call no is " << ++i;
...@@ -1248,7 +1366,7 @@ bool UBSvgSubsetAdaptor::UBSvgSubsetWriter::persistScene(int pageIndex) ...@@ -1248,7 +1366,7 @@ bool UBSvgSubsetAdaptor::UBSvgSubsetWriter::persistScene(int pageIndex)
UBGraphicsGroupContainerItem *groupItem = qgraphicsitem_cast<UBGraphicsGroupContainerItem*>(item); UBGraphicsGroupContainerItem *groupItem = qgraphicsitem_cast<UBGraphicsGroupContainerItem*>(item);
if (groupItem && groupItem->isVisible()) if (groupItem && groupItem->isVisible())
{ {
qDebug() << "came across the group during the parsing, uuid is " << groupItem->data(UBGraphicsItemData::ItemUuid).toString(); persistGroupToDom(groupItem, &groupRoot, &groupDomDocument);
continue; continue;
} }
} }
...@@ -1280,6 +1398,30 @@ bool UBSvgSubsetAdaptor::UBSvgSubsetWriter::persistScene(int pageIndex) ...@@ -1280,6 +1398,30 @@ bool UBSvgSubsetAdaptor::UBSvgSubsetWriter::persistScene(int pageIndex)
qWarning() << "unknown type"; qWarning() << "unknown type";
} }
//writing group data
if (groupRoot.hasChildNodes()) {
mXmlWriter.writeStartElement(tGroups);
QDomElement curElement = groupRoot.firstChildElement();
while (!curElement.isNull()) {
if (curElement.hasAttribute(aId)) {
mXmlWriter.writeStartElement(tGroup);
mXmlWriter.writeAttribute(aId, curElement.attribute(aId));
QDomElement curSubElement = curElement.firstChildElement();
while (!curSubElement.isNull()) {
if (curSubElement.hasAttribute(aId)) {
mXmlWriter.writeStartElement(tElement);
mXmlWriter.writeAttribute(aId, curSubElement.attribute(aId));
mXmlWriter.writeEndElement();
curSubElement = curSubElement.nextSiblingElement();
}
}
mXmlWriter.writeEndElement();
}
curElement = curElement.nextSiblingElement();
}
mXmlWriter.writeEndElement();
}
mXmlWriter.writeEndDocument(); mXmlWriter.writeEndDocument();
QString fileName = mDocumentPath + UBFileSystemUtils::digitFileFormat("/page%1.svg", mPageIndex); QString fileName = mDocumentPath + UBFileSystemUtils::digitFileFormat("/page%1.svg", mPageIndex);
QFile file(fileName); QFile file(fileName);
...@@ -1302,6 +1444,29 @@ bool UBSvgSubsetAdaptor::UBSvgSubsetWriter::persistScene(int pageIndex) ...@@ -1302,6 +1444,29 @@ bool UBSvgSubsetAdaptor::UBSvgSubsetWriter::persistScene(int pageIndex)
return true; return true;
} }
void UBSvgSubsetAdaptor::UBSvgSubsetWriter::persistGroupToDom(QGraphicsItem *groupItem, QDomElement *curParent, QDomDocument *groupDomDocument)
{
QUuid uuid = UBGraphicsScene::getPersonalUuid(groupItem);
if (!uuid.isNull()) {
QDomElement curGroupElement = groupDomDocument->createElement(tGroup);
curGroupElement.setAttribute(aId, uuid);
curParent->appendChild(curGroupElement);
foreach (QGraphicsItem *item, groupItem->childItems()) {
QUuid tmpUuid = UBGraphicsScene::getPersonalUuid(item);
if (!tmpUuid.isNull()) {
if (item->type() == UBGraphicsGroupContainerItem::Type && item->childItems().count()) {
persistGroupToDom(item, curParent, groupDomDocument);
} else {
QDomElement curSubElement = groupDomDocument->createElement(tGroup);
curSubElement.setAttribute(aId, tmpUuid);
curGroupElement.appendChild(curSubElement);
}
}
}
}
}
void UBSvgSubsetAdaptor::UBSvgSubsetWriter::polygonItemToSvgLine(UBGraphicsPolygonItem* polygonItem, bool groupHoldsInfo) void UBSvgSubsetAdaptor::UBSvgSubsetWriter::polygonItemToSvgLine(UBGraphicsPolygonItem* polygonItem, bool groupHoldsInfo)
{ {
mXmlWriter.writeStartElement("line"); mXmlWriter.writeStartElement("line");
...@@ -2204,6 +2369,20 @@ qreal UBSvgSubsetAdaptor::UBSvgSubsetReader::getZValueFromSvg() ...@@ -2204,6 +2369,20 @@ qreal UBSvgSubsetAdaptor::UBSvgSubsetReader::getZValueFromSvg()
return result; return result;
} }
QUuid UBSvgSubsetAdaptor::UBSvgSubsetReader::getUuidFromSvg()
{
QUuid result;
QString strUuid = mXmlReader.attributes().value(mNamespaceUri, "uuid").toString();
QUuid uuid = QUuid(strUuid);
if (!uuid.isNull()) {
result = uuid;
}
return result;
}
void UBSvgSubsetAdaptor::UBSvgSubsetWriter::graphicsItemToSvg(QGraphicsItem* item) void UBSvgSubsetAdaptor::UBSvgSubsetWriter::graphicsItemToSvg(QGraphicsItem* item)
{ {
mXmlWriter.writeAttribute("x", "0"); mXmlWriter.writeAttribute("x", "0");
...@@ -2402,6 +2581,7 @@ UBGraphicsW3CWidgetItem* UBSvgSubsetAdaptor::UBSvgSubsetReader::graphicsW3CWidge ...@@ -2402,6 +2581,7 @@ UBGraphicsW3CWidgetItem* UBSvgSubsetAdaptor::UBSvgSubsetReader::graphicsW3CWidge
QStringRef uuid = mXmlReader.attributes().value(mNamespaceUri, "uuid"); QStringRef uuid = mXmlReader.attributes().value(mNamespaceUri, "uuid");
QString pixPath = mDocumentPath + "/" + UBPersistenceManager::widgetDirectory + "/" + uuid.toString() + ".png"; QString pixPath = mDocumentPath + "/" + UBPersistenceManager::widgetDirectory + "/" + uuid.toString() + ".png";
QPixmap snapshot(pixPath); QPixmap snapshot(pixPath);
if (!snapshot.isNull()) if (!snapshot.isNull())
widgetItem->w3cWidget()->setSnapshot(snapshot); widgetItem->w3cWidget()->setSnapshot(snapshot);
......
...@@ -41,6 +41,7 @@ class UBPersistenceManager; ...@@ -41,6 +41,7 @@ class UBPersistenceManager;
class UBGraphicsTriangle; class UBGraphicsTriangle;
class UBGraphicsCache; class UBGraphicsCache;
class IDataStorage; class IDataStorage;
class UBGraphicsGroupContainerItem;
class UBSvgSubsetAdaptor class UBSvgSubsetAdaptor
{ {
...@@ -94,6 +95,8 @@ class UBSvgSubsetAdaptor ...@@ -94,6 +95,8 @@ class UBSvgSubsetAdaptor
static QMap<QString,IDataStorage*> additionalElementToStore; static QMap<QString,IDataStorage*> additionalElementToStore;
class UBSvgSubsetReader class UBSvgSubsetReader
{ {
public: public:
...@@ -140,9 +143,14 @@ class UBSvgSubsetAdaptor ...@@ -140,9 +143,14 @@ class UBSvgSubsetAdaptor
UBGraphicsCache* cacheFromSvg(); UBGraphicsCache* cacheFromSvg();
void readGroupRoot();
QGraphicsItem *readElementFromGroup();
UBGraphicsGroupContainerItem* readGroup();
void graphicsItemFromSvg(QGraphicsItem* gItem); void graphicsItemFromSvg(QGraphicsItem* gItem);
qreal getZValueFromSvg(); qreal getZValueFromSvg();
QUuid getUuidFromSvg();
QXmlStreamReader mXmlReader; QXmlStreamReader mXmlReader;
int mFileVersion; int mFileVersion;
...@@ -155,6 +163,7 @@ class UBSvgSubsetAdaptor ...@@ -155,6 +163,7 @@ class UBSvgSubsetAdaptor
bool mGroupHasInfo; bool mGroupHasInfo;
QString mNamespaceUri; QString mNamespaceUri;
UBGraphicsScene *mScene;
}; };
class UBSvgSubsetWriter class UBSvgSubsetWriter
...@@ -169,6 +178,7 @@ class UBSvgSubsetAdaptor ...@@ -169,6 +178,7 @@ class UBSvgSubsetAdaptor
private: private:
void persistGroupToDom(QGraphicsItem *groupItem, QDomElement *curParent, QDomDocument *curDomDocument);
void polygonItemToSvgPolygon(UBGraphicsPolygonItem* polygonItem, bool groupHoldsInfo); void polygonItemToSvgPolygon(UBGraphicsPolygonItem* polygonItem, bool groupHoldsInfo);
void polygonItemToSvgLine(UBGraphicsPolygonItem* polygonItem, bool groupHoldsInfo); void polygonItemToSvgLine(UBGraphicsPolygonItem* polygonItem, bool groupHoldsInfo);
void strokeToSvgPolyline(UBGraphicsStroke* stroke, bool groupHoldsInfo); void strokeToSvgPolyline(UBGraphicsStroke* stroke, bool groupHoldsInfo);
......
...@@ -562,7 +562,8 @@ UBBoardView::mouseMoveEvent (QMouseEvent *event) ...@@ -562,7 +562,8 @@ UBBoardView::mouseMoveEvent (QMouseEvent *event)
|| item->type() == UBGraphicsMediaItem::Type || item->type() == UBGraphicsMediaItem::Type
|| item->type() == UBGraphicsSvgItem::Type || item->type() == UBGraphicsSvgItem::Type
|| item->type() == UBGraphicsTextItem::Type || item->type() == UBGraphicsTextItem::Type
|| item->type() == UBGraphicsStrokesGroup::Type) { || item->type() == UBGraphicsStrokesGroup::Type
|| item->type() == UBGraphicsGroupContainerItem::Type) {
if (!mJustSelectedItems.contains(item)) { if (!mJustSelectedItems.contains(item)) {
item->setSelected(true); item->setSelected(true);
......
...@@ -25,6 +25,8 @@ UBGraphicsGroupContainerItem::UBGraphicsGroupContainerItem(QGraphicsItem *parent ...@@ -25,6 +25,8 @@ UBGraphicsGroupContainerItem::UBGraphicsGroupContainerItem(QGraphicsItem *parent
UBGraphicsGroupContainerItem::setAcceptHoverEvents(true); UBGraphicsGroupContainerItem::setAcceptHoverEvents(true);
setUuid(QUuid::createUuid());
setData(UBGraphicsItemData::itemLayerType, QVariant(itemLayerType::ObjectItem)); //Necessary to set if we want z value to be assigned correctly setData(UBGraphicsItemData::itemLayerType, QVariant(itemLayerType::ObjectItem)); //Necessary to set if we want z value to be assigned correctly
} }
......
...@@ -38,6 +38,8 @@ UBGraphicsPixmapItem::UBGraphicsPixmapItem(QGraphicsItem* parent) ...@@ -38,6 +38,8 @@ UBGraphicsPixmapItem::UBGraphicsPixmapItem(QGraphicsItem* parent)
setData(UBGraphicsItemData::itemLayerType, QVariant(itemLayerType::ObjectItem)); //Necessary to set if we want z value to be assigned correctly setData(UBGraphicsItemData::itemLayerType, QVariant(itemLayerType::ObjectItem)); //Necessary to set if we want z value to be assigned correctly
setFlag(QGraphicsItem::ItemSendsGeometryChanges, true); setFlag(QGraphicsItem::ItemSendsGeometryChanges, true);
setUuid(QUuid::createUuid()); //more logical solution is in creating uuid for element in element's constructor
} }
UBGraphicsPixmapItem::~UBGraphicsPixmapItem() UBGraphicsPixmapItem::~UBGraphicsPixmapItem()
......
...@@ -189,18 +189,18 @@ void UBGraphicsPolygonItem::paint ( QPainter * painter, const QStyleOptionGraphi ...@@ -189,18 +189,18 @@ void UBGraphicsPolygonItem::paint ( QPainter * painter, const QStyleOptionGraphi
QGraphicsPolygonItem::paint(painter, option, widget); QGraphicsPolygonItem::paint(painter, option, widget);
} }
//QPainterPath UBGraphicsPolygonItem::shape() const QPainterPath UBGraphicsPolygonItem::shape() const
//{ {
// QPainterPath path; QPainterPath path;
// path.addRect(boundingRect()); path.addRect(boundingRect());
// return path; return path;
//// static QPainterPath shapePath = QGraphicsPolygonItem::shape(); // static QPainterPath shapePath = QGraphicsPolygonItem::shape();
//// return shapePath; // return shapePath;
//} }
UBGraphicsScene* UBGraphicsPolygonItem::scene() UBGraphicsScene* UBGraphicsPolygonItem::scene()
......
...@@ -118,7 +118,7 @@ class UBGraphicsPolygonItem : public QGraphicsPolygonItem, public UBItem ...@@ -118,7 +118,7 @@ class UBGraphicsPolygonItem : public QGraphicsPolygonItem, public UBItem
protected: protected:
void paint ( QPainter * painter, const QStyleOptionGraphicsItem * option, QWidget * widget); void paint ( QPainter * painter, const QStyleOptionGraphicsItem * option, QWidget * widget);
// QPainterPath shape () const; QPainterPath shape () const;
private: private:
......
...@@ -1490,7 +1490,22 @@ UBGraphicsGroupContainerItem *UBGraphicsScene::createGroup(QList<QGraphicsItem * ...@@ -1490,7 +1490,22 @@ UBGraphicsGroupContainerItem *UBGraphicsScene::createGroup(QList<QGraphicsItem *
groupItem->setVisible(true); groupItem->setVisible(true);
groupItem->setFocus(); groupItem->setFocus();
qDebug() << groupItem->uuid().toString(); if (enableUndoRedoStack) { //should be deleted after scene own undo stack implemented
UBGraphicsItemUndoCommand* uc = new UBGraphicsItemUndoCommand(this, 0, groupItem);
UBApplication::undoStack->push(uc);
}
setDocumentUpdated();
return groupItem;
}
void UBGraphicsScene::addGroup(UBGraphicsGroupContainerItem *groupItem)
{
addItem(groupItem);
groupItem->setVisible(true);
groupItem->setFocus();
if (groupItem->uuid().isNull()) { if (groupItem->uuid().isNull()) {
groupItem->setUuid(QUuid::createUuid()); groupItem->setUuid(QUuid::createUuid());
} }
...@@ -1501,8 +1516,6 @@ UBGraphicsGroupContainerItem *UBGraphicsScene::createGroup(QList<QGraphicsItem * ...@@ -1501,8 +1516,6 @@ UBGraphicsGroupContainerItem *UBGraphicsScene::createGroup(QList<QGraphicsItem *
} }
setDocumentUpdated(); setDocumentUpdated();
return groupItem;
} }
UBGraphicsSvgItem* UBGraphicsScene::addSvg(const QUrl& pSvgFileUrl, const QPointF& pPos) UBGraphicsSvgItem* UBGraphicsScene::addSvg(const QUrl& pSvgFileUrl, const QPointF& pPos)
...@@ -1785,6 +1798,20 @@ QRectF UBGraphicsScene::normalizedSceneRect(qreal ratio) ...@@ -1785,6 +1798,20 @@ QRectF UBGraphicsScene::normalizedSceneRect(qreal ratio)
return normalizedRect; return normalizedRect;
} }
QGraphicsItem *UBGraphicsScene::itemByUuid(QUuid uuid)
{
QGraphicsItem *result = 0;
//simple search before implementing container for fast access
foreach (QGraphicsItem *item, items()) {
if (UBGraphicsScene::getPersonalUuid(item) == uuid && !uuid.isNull()) {
result = item;
}
}
return result;
}
void UBGraphicsScene::setDocument(UBDocumentProxy* pDocument) void UBGraphicsScene::setDocument(UBDocumentProxy* pDocument)
{ {
if (pDocument != mDocument) if (pDocument != mDocument)
...@@ -2102,6 +2129,12 @@ void UBGraphicsScene::setOwnZlevel(QGraphicsItem *item) ...@@ -2102,6 +2129,12 @@ void UBGraphicsScene::setOwnZlevel(QGraphicsItem *item)
item->setZValue(item->data(UBGraphicsItemData::ItemOwnZValue).toReal()); item->setZValue(item->data(UBGraphicsItemData::ItemOwnZValue).toReal());
} }
QUuid UBGraphicsScene::getPersonalUuid(QGraphicsItem *item)
{
QString idCandidate = item->data(UBGraphicsItemData::ItemUuid).toString();
return idCandidate == QUuid().toString() ? QUuid() : QUuid(idCandidate);
}
qreal UBGraphicsScene::changeZLevelTo(QGraphicsItem *item, UBZLayerController::moveDestination dest) qreal UBGraphicsScene::changeZLevelTo(QGraphicsItem *item, UBZLayerController::moveDestination dest)
{ {
return mZLayerController->changeZLevelTo(item, dest); return mZLayerController->changeZLevelTo(item, dest);
......
...@@ -145,6 +145,7 @@ class UBGraphicsScene: public UBCoreGraphicsScene, public UBItem ...@@ -145,6 +145,7 @@ class UBGraphicsScene: public UBCoreGraphicsScene, public UBItem
UBGraphicsW3CWidgetItem* addOEmbed(const QUrl& pContentUrl, const QPointF& pPos = QPointF(0, 0)); UBGraphicsW3CWidgetItem* addOEmbed(const QUrl& pContentUrl, const QPointF& pPos = QPointF(0, 0));
UBGraphicsGroupContainerItem *createGroup(QList<QGraphicsItem*> items); UBGraphicsGroupContainerItem *createGroup(QList<QGraphicsItem*> items);
void addGroup(UBGraphicsGroupContainerItem *groupItem);
QGraphicsItem* setAsBackgroundObject(QGraphicsItem* item, bool pAdaptTransformation = false, bool expand = false); QGraphicsItem* setAsBackgroundObject(QGraphicsItem* item, bool pAdaptTransformation = false, bool expand = false);
...@@ -162,6 +163,8 @@ class UBGraphicsScene: public UBCoreGraphicsScene, public UBItem ...@@ -162,6 +163,8 @@ class UBGraphicsScene: public UBCoreGraphicsScene, public UBItem
QRectF normalizedSceneRect(qreal ratio = -1.0); QRectF normalizedSceneRect(qreal ratio = -1.0);
QGraphicsItem *itemByUuid(QUuid uuid);
void moveTo(const QPointF& pPoint); void moveTo(const QPointF& pPoint);
void drawLineTo(const QPointF& pEndPoint, const qreal& pWidth, bool bLineStyle); void drawLineTo(const QPointF& pEndPoint, const qreal& pWidth, bool bLineStyle);
void eraseLineTo(const QPointF& pEndPoint, const qreal& pWidth); void eraseLineTo(const QPointF& pEndPoint, const qreal& pWidth);
...@@ -294,6 +297,8 @@ class UBGraphicsScene: public UBCoreGraphicsScene, public UBItem ...@@ -294,6 +297,8 @@ class UBGraphicsScene: public UBCoreGraphicsScene, public UBItem
void setSelectedZLevel(QGraphicsItem *item); void setSelectedZLevel(QGraphicsItem *item);
void setOwnZlevel(QGraphicsItem *item); void setOwnZlevel(QGraphicsItem *item);
static QUuid getPersonalUuid(QGraphicsItem *item);
public slots: public slots:
void hideEraser(); void hideEraser();
......
...@@ -9,6 +9,7 @@ UBGraphicsStrokesGroup::UBGraphicsStrokesGroup(QGraphicsItem *parent):QGraphicsI ...@@ -9,6 +9,7 @@ UBGraphicsStrokesGroup::UBGraphicsStrokesGroup(QGraphicsItem *parent):QGraphicsI
mDelegate->setFlippable(true); mDelegate->setFlippable(true);
setData(UBGraphicsItemData::ItemLayerType, UBItemLayerType::Object); setData(UBGraphicsItemData::ItemLayerType, UBItemLayerType::Object);
setUuid(QUuid::createUuid());
setData(UBGraphicsItemData::itemLayerType, QVariant(itemLayerType::ObjectItem)); //Necessary to set if we want z value to be assigned correctly setData(UBGraphicsItemData::itemLayerType, QVariant(itemLayerType::ObjectItem)); //Necessary to set if we want z value to be assigned correctly
setFlag(QGraphicsItem::ItemSendsGeometryChanges, true); setFlag(QGraphicsItem::ItemSendsGeometryChanges, true);
setFlag(QGraphicsItem::ItemIsSelectable, true); setFlag(QGraphicsItem::ItemIsSelectable, true);
......
...@@ -63,6 +63,8 @@ void UBGraphicsSvgItem::init() ...@@ -63,6 +63,8 @@ void UBGraphicsSvgItem::init()
setMaximumCacheSize(boundingRect().size().toSize() * UB_MAX_ZOOM); setMaximumCacheSize(boundingRect().size().toSize() * UB_MAX_ZOOM);
setData(UBGraphicsItemData::itemLayerType, QVariant(itemLayerType::ObjectItem)); //Necessary to set if we want z value to be assigned correctly setData(UBGraphicsItemData::itemLayerType, QVariant(itemLayerType::ObjectItem)); //Necessary to set if we want z value to be assigned correctly
setUuid(QUuid::createUuid());
} }
...@@ -194,3 +196,9 @@ UBGraphicsPixmapItem* UBGraphicsSvgItem::toPixmapItem() const ...@@ -194,3 +196,9 @@ UBGraphicsPixmapItem* UBGraphicsSvgItem::toPixmapItem() const
return pixmapItem; return pixmapItem;
} }
void UBGraphicsSvgItem::setUuid(const QUuid &pUuid)
{
UBItem::setUuid(pUuid);
setData(UBGraphicsItemData::ItemUuid, QVariant(pUuid)); //store item uuid inside the QGraphicsItem to fast operations with Items on the scene
}
...@@ -61,6 +61,8 @@ class UBGraphicsSvgItem: public QGraphicsSvgItem, public UBItem, public UBGraphi ...@@ -61,6 +61,8 @@ class UBGraphicsSvgItem: public QGraphicsSvgItem, public UBItem, public UBGraphi
virtual UBGraphicsPixmapItem* toPixmapItem() const; virtual UBGraphicsPixmapItem* toPixmapItem() const;
virtual UBGraphicsItemDelegate *Delegate() const {return mDelegate;} virtual UBGraphicsItemDelegate *Delegate() const {return mDelegate;}
virtual void setUuid(const QUuid &pUuid);
protected: protected:
virtual void mousePressEvent(QGraphicsSceneMouseEvent *event); virtual void mousePressEvent(QGraphicsSceneMouseEvent *event);
......
...@@ -53,6 +53,8 @@ UBGraphicsTextItem::UBGraphicsTextItem(QGraphicsItem * parent) ...@@ -53,6 +53,8 @@ UBGraphicsTextItem::UBGraphicsTextItem(QGraphicsItem * parent)
setTextInteractionFlags(Qt::TextEditorInteraction); setTextInteractionFlags(Qt::TextEditorInteraction);
setUuid(QUuid::createUuid());
connect(document(), SIGNAL(contentsChanged()), mDelegate, SLOT(contentsChanged())); connect(document(), SIGNAL(contentsChanged()), mDelegate, SLOT(contentsChanged()));
connect(document(), SIGNAL(undoCommandAdded()), this, SLOT(undoCommandAdded())); connect(document(), SIGNAL(undoCommandAdded()), this, SLOT(undoCommandAdded()));
......
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
#include "core/memcheck.h" #include "core/memcheck.h"
UBItem::UBItem() UBItem::UBItem()
: mUuid(QUuid::createUuid()) : mUuid(QUuid())
, mRenderingQuality(UBItem::RenderingQualityNormal) , mRenderingQuality(UBItem::RenderingQualityNormal)
{ {
// NOOP // NOOP
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment