Commit 2b29e063 authored by Claudio Valerio's avatar Claudio Valerio

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

parents 2150f98a 0b8014ee
...@@ -328,6 +328,25 @@ macx { ...@@ -328,6 +328,25 @@ macx {
QMAKE_BUNDLE_DATA += TRANSLATION_ca QMAKE_BUNDLE_DATA += TRANSLATION_ca
} }
exists(resources/i18n/sankore_el.qm) {
TRANSLATION_el.files = resources/i18n/sankore_el.qm \
resources/i18n/Localizable.strings
TRANSLATION_el.path = "$$RESOURCES_DIR/el.lproj"
QMAKE_BUNDLE_DATA += TRANSLATION_el
}
exists(resources/i18n/sankore_tr.qm) {
TRANSLATION_tr.files = resources/i18n/sankore_tr.qm \
resources/i18n/Localizable.strings
TRANSLATION_tr.path = "$$RESOURCES_DIR/tr.lproj"
QMAKE_BUNDLE_DATA += TRANSLATION_tr
}
exists(resources/i18n/sankore_cs.qm) {
TRANSLATION_cs.files = resources/i18n/sankore_cs.qm \
resources/i18n/Localizable.strings
TRANSLATION_cs.path = "$$RESOURCES_DIR/cs.lproj"
QMAKE_BUNDLE_DATA += TRANSLATION_cs
}
QMAKE_BUNDLE_DATA += UB_ETC \ QMAKE_BUNDLE_DATA += UB_ETC \
UB_LIBRARY \ UB_LIBRARY \
UB_FONTS \ UB_FONTS \
...@@ -391,7 +410,10 @@ TRANSLATIONS = resources/i18n/sankore_en.ts \ ...@@ -391,7 +410,10 @@ TRANSLATIONS = resources/i18n/sankore_en.ts \
resources/i18n/sankore_pt.ts \ resources/i18n/sankore_pt.ts \
resources/i18n/sankore_sk.ts \ resources/i18n/sankore_sk.ts \
resources/i18n/sankore_bg.ts \ resources/i18n/sankore_bg.ts \
resources/i18n/sankore_ca.ts resources/i18n/sankore_ca.ts \
resources/i18n/sankore_el.ts \
resources/i18n/sankore_tr.ts \
resources/i18n/sankore_cs.ts
INSTALLS = UB_ETC \ INSTALLS = UB_ETC \
UB_I18N \ UB_I18N \
......
...@@ -1632,6 +1632,9 @@ ...@@ -1632,6 +1632,9 @@
</property> </property>
</action> </action>
<action name="actionGroupItems"> <action name="actionGroupItems">
<property name="checkable">
<bool>true</bool>
</property>
<property name="enabled"> <property name="enabled">
<bool>false</bool> <bool>false</bool>
</property> </property>
...@@ -1641,7 +1644,7 @@ ...@@ -1641,7 +1644,7 @@
<normalon>:/images/toolbar/ungroup.png</normalon>:/images/toolbar/group.png</iconset> <normalon>:/images/toolbar/ungroup.png</normalon>:/images/toolbar/group.png</iconset>
</property> </property>
<property name="text"> <property name="text">
<string>Group Items</string> <string>Group</string>
</property> </property>
<property name="toolTip"> <property name="toolTip">
<string>Group items</string> <string>Group items</string>
......
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
resources/images/toolbar/group.png

1.95 KB | W: | H:

resources/images/toolbar/group.png

1.19 KB | W: | H:

resources/images/toolbar/group.png
resources/images/toolbar/group.png
resources/images/toolbar/group.png
resources/images/toolbar/group.png
  • 2-up
  • Swipe
  • Onion skin
resources/images/toolbar/ungroup.png

2.21 KB | W: | H:

resources/images/toolbar/ungroup.png

1.46 KB | W: | H:

resources/images/toolbar/ungroup.png
resources/images/toolbar/ungroup.png
resources/images/toolbar/ungroup.png
resources/images/toolbar/ungroup.png
  • 2-up
  • Swipe
  • Onion skin
...@@ -6,6 +6,63 @@ html, body { ...@@ -6,6 +6,63 @@ html, body {
color: #666666; color: #666666;
} }
::-webkit-scrollbar {
width: 14px;
}
::-webkit-scrollbar-thumb {
/*border-radius: 10px; */
background-color:lightgray;
border: 2px solid gray;
}
::-webkit-scrollbar-button:vertical:start{
border-top-right-radius: 10px;
border-top-left-radius: 10px;
background-color:lightgray;
background-image: url(images/trgUp.png);
background-size: 8px auto;
background-position: center;
background-repeat: no-repeat;
border: 2px solid gray;
}
::-webkit-scrollbar-button:vertical:end{
border-bottom-right-radius: 10px;
border-bottom-left-radius: 10px;
background-color:lightgray;
background-image: url(images/trgDown.png);
background-size: 8px auto;
background-position: center;
background-repeat: no-repeat;
border: 2px solid gray;
}
::-webkit-scrollbar-button:horizontal:start{
width: 14px;
border-bottom-left-radius: 10px;
border-top-left-radius: 10px;
background-color:lightgray;
background-image: url(images/trgLeft.png);
background-size: 8px auto;
background-position: center;
background-repeat: no-repeat;
border: 2px solid gray;
}
::-webkit-scrollbar-button:horizontal:end{
width: 14px;
border-bottom-right-radius: 10px;
border-top-right-radius: 10px;
background-color:lightgray;
background-image: url(images/trgRight.png);
background-size: 8px auto;
background-position: center;
background-repeat: no-repeat;
border: 2px solid gray;
}
#ubwidget { #ubwidget {
position: absolute; position: absolute;
top: 0; top: 0;
......
...@@ -77,6 +77,8 @@ function initAfterI18nMessagesLoaded(reload, templates, callbacks) { ...@@ -77,6 +77,8 @@ function initAfterI18nMessagesLoaded(reload, templates, callbacks) {
log("Toobar Initialisation"); log("Toobar Initialisation");
$("button[role=edit]").click(function(){ $("button[role=edit]").click(function(){
app.onEdit = true; app.onEdit = true;
if(window.sankore)
window.sankore.enableDropOnWidget(app.onEdit);
$(document.body).addClass("onEdit"); $(document.body).addClass("onEdit");
if(callbacks.onEdit && typeof callbacks.onEdit === 'function') { if(callbacks.onEdit && typeof callbacks.onEdit === 'function') {
callbacks.onEdit(app); callbacks.onEdit(app);
...@@ -84,6 +86,8 @@ function initAfterI18nMessagesLoaded(reload, templates, callbacks) { ...@@ -84,6 +86,8 @@ function initAfterI18nMessagesLoaded(reload, templates, callbacks) {
}); });
$("button[role=view]").click(function(){ $("button[role=view]").click(function(){
app.onEdit = false; app.onEdit = false;
if(window.sankore)
window.sankore.enableDropOnWidget(app.onEdit);
$(document.body).removeClass("onEdit"); $(document.body).removeClass("onEdit");
if(callbacks.onView && typeof callbacks.onView === 'function') { if(callbacks.onView && typeof callbacks.onView === 'function') {
callbacks.onView(app); callbacks.onView(app);
...@@ -133,7 +137,10 @@ var Parameters = (function(){ ...@@ -133,7 +137,10 @@ var Parameters = (function(){
else { else {
log("Set parameter value ["+value+"] for key : ["+key+"]"); log("Set parameter value ["+value+"] for key : ["+key+"]");
this.delegate.setPreference(key, value); this.delegate.setPreference(key, value);
this.container.trigger("preferenceChange", {key: key, value: value}); this.container.trigger("preferenceChange", {
key: key,
value: value
});
} }
} }
} }
...@@ -234,9 +241,39 @@ var App = (function() { ...@@ -234,9 +241,39 @@ var App = (function() {
return doc; return doc;
} }
var file = stringToXML(e.dataTransfer.getData("text/plain")); var file = stringToXML(e.dataTransfer.getData("text/plain"));
var tmp_img = $("<img/>").attr("src", $(file).find("path:eq(0)").text());
var w = 0;
var h = 0;
$(this).append(tmp_img);
setTimeout(function(){
if(tmp_img.height() >= tmp_img.width()){
if(tmp_img.height() > 180){
h = 180;
tmp_img.attr("height",h);
w = tmp_img.width();
} else {
h = tmp_img.height();
w = tmp_img.width();
}
}
else{
if(tmp_img.width() > 180){
w = 180;
tmp_img.attr("width",w);
h = tmp_img.height();
} else {
h = tmp_img.height();
w = tmp_img.width();
}
}
callback({ callback({
src: $(file).find("path:eq(0)").text() src: $(file).find("path:eq(0)").text(),
width: w,
height: h
}); });
tmp_img.remove();
}, 6)
return false; return false;
} }
......
...@@ -195,5 +195,8 @@ $(document).ready(function(){ ...@@ -195,5 +195,8 @@ $(document).ready(function(){
onEdit: reloadApp, onEdit: reloadApp,
onView: reloadApp onView: reloadApp
}; };
init(reloadCallback, {toolbar: toolbarTemplate, parameters: parametersTemplate}, callbacks); init(reloadCallback, {
toolbar: toolbarTemplate,
parameters: parametersTemplate
}, callbacks);
}); });
\ No newline at end of file
...@@ -32,6 +32,7 @@ ...@@ -32,6 +32,7 @@
#include "domain/UBGraphicsTextItem.h" #include "domain/UBGraphicsTextItem.h"
#include "domain/UBGraphicsTextItemDelegate.h" #include "domain/UBGraphicsTextItemDelegate.h"
#include "domain/UBGraphicsWidgetItem.h" #include "domain/UBGraphicsWidgetItem.h"
#include "domain/UBGraphicsGroupContainerItem.h"
#include "frameworks/UBFileSystemUtils.h" #include "frameworks/UBFileSystemUtils.h"
...@@ -128,8 +129,9 @@ bool UBCFFSubsetAdaptor::ConvertCFFFileToUbz(QString &cffSourceFile, UBDocumentP ...@@ -128,8 +129,9 @@ bool UBCFFSubsetAdaptor::ConvertCFFFileToUbz(QString &cffSourceFile, UBDocumentP
return result; return result;
} }
UBCFFSubsetAdaptor::UBCFFSubsetReader::UBCFFSubsetReader(UBDocumentProxy *proxy, QFile *content): UBCFFSubsetAdaptor::UBCFFSubsetReader::UBCFFSubsetReader(UBDocumentProxy *proxy, QFile *content)
mProxy(proxy) : mProxy(proxy)
, mGSectionContainer(NULL)
{ {
int errorLine, errorColumn; int errorLine, errorColumn;
QString errorStr; QString errorStr;
...@@ -168,6 +170,8 @@ bool UBCFFSubsetAdaptor::UBCFFSubsetReader::parse() ...@@ -168,6 +170,8 @@ bool UBCFFSubsetAdaptor::UBCFFSubsetReader::parse()
bool UBCFFSubsetAdaptor::UBCFFSubsetReader::parseGSection(const QDomElement &element) bool UBCFFSubsetAdaptor::UBCFFSubsetReader::parseGSection(const QDomElement &element)
{ {
mGSectionContainer = new UBGraphicsGroupContainerItem();
QDomElement currentSvgElement = element.firstChildElement(); QDomElement currentSvgElement = element.firstChildElement();
while (!currentSvgElement.isNull()) { while (!currentSvgElement.isNull()) {
if (!parseSvgElement(currentSvgElement)) if (!parseSvgElement(currentSvgElement))
...@@ -176,6 +180,16 @@ bool UBCFFSubsetAdaptor::UBCFFSubsetReader::parseGSection(const QDomElement &ele ...@@ -176,6 +180,16 @@ bool UBCFFSubsetAdaptor::UBCFFSubsetReader::parseGSection(const QDomElement &ele
currentSvgElement = currentSvgElement.nextSiblingElement(); currentSvgElement = currentSvgElement.nextSiblingElement();
} }
if (mGSectionContainer->childItems().count())
{
mCurrentScene->addGroup(mGSectionContainer);
}
else
{
delete mGSectionContainer;
mGSectionContainer = NULL;
}
return true; return true;
} }
bool UBCFFSubsetAdaptor::UBCFFSubsetReader::parseSvgSwitchSection(const QDomElement &element) bool UBCFFSubsetAdaptor::UBCFFSubsetReader::parseSvgSwitchSection(const QDomElement &element)
...@@ -247,6 +261,11 @@ bool UBCFFSubsetAdaptor::UBCFFSubsetReader::parseSvgRect(const QDomElement &elem ...@@ -247,6 +261,11 @@ bool UBCFFSubsetAdaptor::UBCFFSubsetReader::parseSvgRect(const QDomElement &elem
repositionSvgItem(svgItem, width, height, x1, y1, transform); repositionSvgItem(svgItem, width, height, x1, y1, transform);
hashSceneItem(element, svgItem); hashSceneItem(element, svgItem);
if (mGSectionContainer)
{
addItemToGSection(svgItem);
}
delete generator; delete generator;
return true; return true;
...@@ -293,6 +312,11 @@ bool UBCFFSubsetAdaptor::UBCFFSubsetReader::parseSvgEllipse(const QDomElement &e ...@@ -293,6 +312,11 @@ bool UBCFFSubsetAdaptor::UBCFFSubsetReader::parseSvgEllipse(const QDomElement &e
repositionSvgItem(svgItem, rx * 2, ry * 2, cx - 2*rx, cy+ry, transform); repositionSvgItem(svgItem, rx * 2, ry * 2, cx - 2*rx, cy+ry, transform);
hashSceneItem(element, svgItem); hashSceneItem(element, svgItem);
if (mGSectionContainer)
{
addItemToGSection(svgItem);
}
delete generator; delete generator;
return true; return true;
...@@ -375,6 +399,11 @@ bool UBCFFSubsetAdaptor::UBCFFSubsetReader::parseSvgPolygon(const QDomElement &e ...@@ -375,6 +399,11 @@ bool UBCFFSubsetAdaptor::UBCFFSubsetReader::parseSvgPolygon(const QDomElement &e
repositionSvgItem(svgItem, width +strokeWidth, height + strokeWidth, x1 - strokeWidth/2 + transform.m31(), y1 + strokeWidth/2 + transform.m32(), transform); repositionSvgItem(svgItem, width +strokeWidth, height + strokeWidth, x1 - strokeWidth/2 + transform.m31(), y1 + strokeWidth/2 + transform.m32(), transform);
hashSceneItem(element, svgItem); hashSceneItem(element, svgItem);
if (mGSectionContainer)
{
addItemToGSection(svgItem);
}
delete generator; delete generator;
return true; return true;
...@@ -454,6 +483,11 @@ bool UBCFFSubsetAdaptor::UBCFFSubsetReader::parseSvgPolyline(const QDomElement & ...@@ -454,6 +483,11 @@ bool UBCFFSubsetAdaptor::UBCFFSubsetReader::parseSvgPolyline(const QDomElement &
repositionSvgItem(svgItem, width +strokeWidth, height + strokeWidth, x1 + transform.m31() - strokeWidth/2, y1 + transform.m32() + strokeWidth/2, transform); repositionSvgItem(svgItem, width +strokeWidth, height + strokeWidth, x1 + transform.m31() - strokeWidth/2, y1 + transform.m32() + strokeWidth/2, transform);
hashSceneItem(element, svgItem); hashSceneItem(element, svgItem);
if (mGSectionContainer)
{
addItemToGSection(svgItem);
}
delete generator; delete generator;
return true; return true;
...@@ -593,6 +627,11 @@ bool UBCFFSubsetAdaptor::UBCFFSubsetReader::parseSvgText(const QDomElement &elem ...@@ -593,6 +627,11 @@ bool UBCFFSubsetAdaptor::UBCFFSubsetReader::parseSvgText(const QDomElement &elem
repositionSvgItem(svgItem, width, height, x + transform.m31(), y + transform.m32(), transform); repositionSvgItem(svgItem, width, height, x + transform.m31(), y + transform.m32(), transform);
hashSceneItem(element, svgItem); hashSceneItem(element, svgItem);
if (mGSectionContainer)
{
addItemToGSection(svgItem);
}
delete generator; delete generator;
return true; return true;
} }
...@@ -712,6 +751,11 @@ bool UBCFFSubsetAdaptor::UBCFFSubsetReader::parseSvgTextarea(const QDomElement & ...@@ -712,6 +751,11 @@ bool UBCFFSubsetAdaptor::UBCFFSubsetReader::parseSvgTextarea(const QDomElement &
repositionSvgItem(svgItem, width, height, x + transform.m31(), y + transform.m32(), transform); repositionSvgItem(svgItem, width, height, x + transform.m31(), y + transform.m32(), transform);
hashSceneItem(element, svgItem); hashSceneItem(element, svgItem);
if (mGSectionContainer)
{
addItemToGSection(svgItem);
}
return true; return true;
} }
bool UBCFFSubsetAdaptor::UBCFFSubsetReader::parseSvgImage(const QDomElement &element) bool UBCFFSubsetAdaptor::UBCFFSubsetReader::parseSvgImage(const QDomElement &element)
...@@ -749,6 +793,11 @@ bool UBCFFSubsetAdaptor::UBCFFSubsetReader::parseSvgImage(const QDomElement &ele ...@@ -749,6 +793,11 @@ bool UBCFFSubsetAdaptor::UBCFFSubsetReader::parseSvgImage(const QDomElement &ele
repositionSvgItem(pixItem, width, height, x + transform.m31(), y + transform.m32(), transform); repositionSvgItem(pixItem, width, height, x + transform.m31(), y + transform.m32(), transform);
hashSceneItem(element, pixItem); hashSceneItem(element, pixItem);
if (mGSectionContainer)
{
addItemToGSection(pixItem);
}
return true; return true;
} }
bool UBCFFSubsetAdaptor::UBCFFSubsetReader::parseSvgFlash(const QDomElement &element) bool UBCFFSubsetAdaptor::UBCFFSubsetReader::parseSvgFlash(const QDomElement &element)
...@@ -791,6 +840,11 @@ bool UBCFFSubsetAdaptor::UBCFFSubsetReader::parseSvgFlash(const QDomElement &ele ...@@ -791,6 +840,11 @@ bool UBCFFSubsetAdaptor::UBCFFSubsetReader::parseSvgFlash(const QDomElement &ele
repositionSvgItem(flashItem, width, height, x + transform.m31(), y + transform.m32(), transform); repositionSvgItem(flashItem, width, height, x + transform.m31(), y + transform.m32(), transform);
hashSceneItem(element, flashItem); hashSceneItem(element, flashItem);
if (mGSectionContainer)
{
addItemToGSection(flashItem);
}
return true; return true;
} }
...@@ -829,6 +883,11 @@ bool UBCFFSubsetAdaptor::UBCFFSubsetReader::parseSvgAudio(const QDomElement &ele ...@@ -829,6 +883,11 @@ bool UBCFFSubsetAdaptor::UBCFFSubsetReader::parseSvgAudio(const QDomElement &ele
repositionSvgItem(audioItem, audioItem->boundingRect().width(), audioItem->boundingRect().height(), x + transform.m31(), y + transform.m32(), transform); repositionSvgItem(audioItem, audioItem->boundingRect().width(), audioItem->boundingRect().height(), x + transform.m31(), y + transform.m32(), transform);
hashSceneItem(element, audioItem); hashSceneItem(element, audioItem);
if (mGSectionContainer)
{
addItemToGSection(audioItem);
}
return true; return true;
} }
bool UBCFFSubsetAdaptor::UBCFFSubsetReader::parseSvgVideo(const QDomElement &element) bool UBCFFSubsetAdaptor::UBCFFSubsetReader::parseSvgVideo(const QDomElement &element)
...@@ -867,6 +926,11 @@ bool UBCFFSubsetAdaptor::UBCFFSubsetReader::parseSvgVideo(const QDomElement &ele ...@@ -867,6 +926,11 @@ bool UBCFFSubsetAdaptor::UBCFFSubsetReader::parseSvgVideo(const QDomElement &ele
repositionSvgItem(videoItem, videoItem->boundingRect().width(), videoItem->boundingRect().height(), x + transform.m31(), y + transform.m32(), transform); repositionSvgItem(videoItem, videoItem->boundingRect().width(), videoItem->boundingRect().height(), x + transform.m31(), y + transform.m32(), transform);
hashSceneItem(element, videoItem); hashSceneItem(element, videoItem);
if (mGSectionContainer)
{
addItemToGSection(videoItem);
}
return true; return true;
} }
...@@ -877,6 +941,11 @@ void UBCFFSubsetAdaptor::UBCFFSubsetReader::parseSvgSectionAttr(const QDomElemen ...@@ -877,6 +941,11 @@ void UBCFFSubsetAdaptor::UBCFFSubsetReader::parseSvgSectionAttr(const QDomElemen
svgSection.attribute(aHeight).toInt()); svgSection.attribute(aHeight).toInt());
} }
void UBCFFSubsetAdaptor::UBCFFSubsetReader::addItemToGSection(QGraphicsItem *item)
{
mGSectionContainer->addToGroup(item);
}
void UBCFFSubsetAdaptor::UBCFFSubsetReader::hashSceneItem(const QDomElement &element, UBGraphicsItem *item) void UBCFFSubsetAdaptor::UBCFFSubsetReader::hashSceneItem(const QDomElement &element, UBGraphicsItem *item)
{ {
// adding element pointer to hash to refer if needed // adding element pointer to hash to refer if needed
......
...@@ -35,6 +35,7 @@ class QGraphicsItem; ...@@ -35,6 +35,7 @@ class QGraphicsItem;
class QTextBlockFormat; class QTextBlockFormat;
class QTextCharFormat; class QTextCharFormat;
class QTextCursor; class QTextCursor;
class UBGraphicsStrokesGroup;
class UBCFFSubsetAdaptor class UBCFFSubsetAdaptor
...@@ -66,6 +67,8 @@ private: ...@@ -66,6 +67,8 @@ private:
QPointF mViewBoxCenter; QPointF mViewBoxCenter;
QSize mSize; QSize mSize;
QPointF mShiftVector; QPointF mShiftVector;
bool mSvgGSectionIsOpened;
UBGraphicsGroupContainerItem *mGSectionContainer;
private: private:
QDomDocument mDOMdoc; QDomDocument mDOMdoc;
...@@ -73,6 +76,7 @@ private: ...@@ -73,6 +76,7 @@ private:
QHash<QString, UBGraphicsItem*> persistedItems; QHash<QString, UBGraphicsItem*> persistedItems;
QDir mTmpFlashDir; QDir mTmpFlashDir;
void addItemToGSection(QGraphicsItem *item);
bool hashElements(); bool hashElements();
void addExtentionsToHash(QDomElement *parent, QDomElement *topGroup); void addExtentionsToHash(QDomElement *parent, QDomElement *topGroup);
......
...@@ -396,6 +396,7 @@ UBGraphicsScene* UBSvgSubsetAdaptor::UBSvgSubsetReader::loadScene() ...@@ -396,6 +396,7 @@ UBGraphicsScene* UBSvgSubsetAdaptor::UBSvgSubsetReader::loadScene()
if (!mScene) if (!mScene)
{ {
mScene = new UBGraphicsScene(mProxy); mScene = new UBGraphicsScene(mProxy);
mScene->setURStackEnable(false);
} }
// introduced in UB 4.2 // introduced in UB 4.2
...@@ -1013,6 +1014,7 @@ UBGraphicsScene* UBSvgSubsetAdaptor::UBSvgSubsetReader::loadScene() ...@@ -1013,6 +1014,7 @@ UBGraphicsScene* UBSvgSubsetAdaptor::UBSvgSubsetReader::loadScene()
delete annotationGroup; delete annotationGroup;
} }
mScene->setURStackEnable(true);
return mScene; return mScene;
} }
......
...@@ -1102,7 +1102,7 @@ UBItem *UBBoardController::downloadFinished(bool pSuccess, QUrl sourceUrl, QStri ...@@ -1102,7 +1102,7 @@ UBItem *UBBoardController::downloadFinished(bool pSuccess, QUrl sourceUrl, QStri
QUuid uuid = QUuid::createUuid(); QUuid uuid = QUuid::createUuid();
QUrl url = QUrl::fromLocalFile(UBPersistenceManager::persistenceManager() QUrl url = QUrl::fromLocalFile(UBPersistenceManager::persistenceManager()
->addVideoFileToDocument(selectedDocument(), sourceUrl, pData, uuid)); ->addAudioFileToDocument(selectedDocument(), sourceUrl, pData, uuid));
audioMediaItem = mActiveScene->addMedia(url, false, pPos); audioMediaItem = mActiveScene->addMedia(url, false, pPos);
......
...@@ -106,8 +106,7 @@ UBBoardView::~UBBoardView () { ...@@ -106,8 +106,7 @@ UBBoardView::~UBBoardView () {
delete suspendedMousePressEvent; delete suspendedMousePressEvent;
} }
void void UBBoardView::init ()
UBBoardView::init ()
{ {
connect (UBSettings::settings ()->boardPenPressureSensitive, SIGNAL (changed (QVariant)), connect (UBSettings::settings ()->boardPenPressureSensitive, SIGNAL (changed (QVariant)),
this, SLOT (settingChanged (QVariant))); this, SLOT (settingChanged (QVariant)));
...@@ -1439,4 +1438,3 @@ UBBoardView::setToolCursor (int tool) ...@@ -1439,4 +1438,3 @@ UBBoardView::setToolCursor (int tool)
controlViewport->setCursor (UBResources::resources ()->penCursor); controlViewport->setCursor (UBResources::resources ()->penCursor);
} }
} }
...@@ -18,8 +18,10 @@ ...@@ -18,8 +18,10 @@
#include "core/UBSettings.h" #include "core/UBSettings.h"
#include "core/UBApplication.h" #include "core/UBApplication.h"
#include "gui/UBMainWindow.h" #include "domain/UBGraphicsScene.h"
#include "board/UBBoardController.h"
#include "gui/UBMainWindow.h"
#include "core/memcheck.h" #include "core/memcheck.h"
UBDrawingController* UBDrawingController::sDrawingController = 0; UBDrawingController* UBDrawingController::sDrawingController = 0;
...@@ -87,6 +89,7 @@ void UBDrawingController::setStylusTool(int tool) ...@@ -87,6 +89,7 @@ void UBDrawingController::setStylusTool(int tool)
{ {
if (tool != mStylusTool) if (tool != mStylusTool)
{ {
UBApplication::boardController->activeScene()->deselectAllItems();
if (mStylusTool == UBStylusTool::Pen || mStylusTool == UBStylusTool::Marker if (mStylusTool == UBStylusTool::Pen || mStylusTool == UBStylusTool::Marker
|| mStylusTool == UBStylusTool::Line) || mStylusTool == UBStylusTool::Line)
{ {
......
...@@ -117,6 +117,9 @@ struct UBGraphicsItemData ...@@ -117,6 +117,9 @@ struct UBGraphicsItemData
, ItemOwnZValue , ItemOwnZValue
, itemLayerType //use instead of deprecated ItemLayerType , itemLayerType //use instead of deprecated ItemLayerType
, ItemUuid //storing uuid in QGraphicsItem for fast finding operations , ItemUuid //storing uuid in QGraphicsItem for fast finding operations
//Duplicating delegate's functions to make possible working with pure QGraphicsItem
, ItemFlippable // (bool)
, ItemRotatable // (bool)
}; };
}; };
......
...@@ -399,8 +399,8 @@ void UBSettings::init() ...@@ -399,8 +399,8 @@ void UBSettings::init()
libIconSize = new UBSetting(this, "Library", "LibIconSize", defaultLibraryIconSize); libIconSize = new UBSetting(this, "Library", "LibIconSize", defaultLibraryIconSize);
actionGroupText = "Group items"; actionGroupText = tr("Group");
actionUngroupText = "Ungroup items"; actionUngroupText = tr("Ungroup");
} }
......
...@@ -29,6 +29,7 @@ UBGraphicsGroupContainerItem::UBGraphicsGroupContainerItem(QGraphicsItem *parent ...@@ -29,6 +29,7 @@ UBGraphicsGroupContainerItem::UBGraphicsGroupContainerItem(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
} }
void UBGraphicsGroupContainerItem::addToGroup(QGraphicsItem *item) void UBGraphicsGroupContainerItem::addToGroup(QGraphicsItem *item)
...@@ -42,6 +43,19 @@ void UBGraphicsGroupContainerItem::addToGroup(QGraphicsItem *item) ...@@ -42,6 +43,19 @@ void UBGraphicsGroupContainerItem::addToGroup(QGraphicsItem *item)
return; return;
} }
//Check if group is allready rotatable or flippable
if (childItems().count()) {
if (UBGraphicsItem::isFlippable(this) && !UBGraphicsItem::isFlippable(item)) {
mDelegate->setFlippable(false);
}
if (UBGraphicsItem::isRotatable(this) && !UBGraphicsItem::isRotatable(item)) {
mDelegate->setRotatable(false);
}
} else {
mDelegate->setFlippable(UBGraphicsItem::isFlippable(item));
mDelegate->setRotatable(UBGraphicsItem::isRotatable(item));
}
// COMBINE // COMBINE
bool ok; bool ok;
QTransform itemTransform = item->itemTransform(this, &ok); QTransform itemTransform = item->itemTransform(this, &ok);
...@@ -80,7 +94,7 @@ void UBGraphicsGroupContainerItem::addToGroup(QGraphicsItem *item) ...@@ -80,7 +94,7 @@ void UBGraphicsGroupContainerItem::addToGroup(QGraphicsItem *item)
// ### Expensive, we could maybe use dirtySceneTransform bit for optimization // ### Expensive, we could maybe use dirtySceneTransform bit for optimization
item->setTransform(newItemTransform); item->setTransform(newItemTransform);
// item->d_func()->setIsMemberOfGroup(true); // item->d_func()->setIsMemberOfGroup(true);
prepareGeometryChange(); prepareGeometryChange();
itemsBoundingRect |= itemTransform.mapRect(item->boundingRect() | item->childrenBoundingRect()); itemsBoundingRect |= itemTransform.mapRect(item->boundingRect() | item->childrenBoundingRect());
update(); update();
...@@ -270,6 +284,27 @@ void UBGraphicsGroupContainerItem::pRemoveFromGroup(QGraphicsItem *item) ...@@ -270,6 +284,27 @@ void UBGraphicsGroupContainerItem::pRemoveFromGroup(QGraphicsItem *item)
QGraphicsItem *newParent = parentItem(); QGraphicsItem *newParent = parentItem();
if (childItems().count()) {
if (!UBGraphicsItem::isFlippable(item) || !UBGraphicsItem::isRotatable(item)) {
bool flippableNow = true;
bool rotatableNow = true;
foreach (QGraphicsItem *item, childItems()) {
if (!UBGraphicsItem::isFlippable(item)) {
flippableNow = false;
}
if (!UBGraphicsItem::isRotatable(item)) {
rotatableNow = false;
}
if (!rotatableNow && !flippableNow) {
break;
}
}
mDelegate->setFlippable(flippableNow);
mDelegate->setRotatable(rotatableNow);
}
}
// COMBINE // COMBINE
bool ok; bool ok;
QTransform itemTransform; QTransform itemTransform;
......
...@@ -16,7 +16,9 @@ UBGraphicsGroupContainerItemDelegate::UBGraphicsGroupContainerItemDelegate(QGrap ...@@ -16,7 +16,9 @@ UBGraphicsGroupContainerItemDelegate::UBGraphicsGroupContainerItemDelegate(QGrap
UBGraphicsItemDelegate(pDelegated, parent, true, false, false), mDestroyGroupButton(0) UBGraphicsItemDelegate(pDelegated, parent, true, false, false), mDestroyGroupButton(0)
{ {
//Wrapper function. Use it to set correct data() to QGraphicsItem as well
setFlippable(false);
setRotatable(false);
} }
UBGraphicsGroupContainerItem *UBGraphicsGroupContainerItemDelegate::delegated() UBGraphicsGroupContainerItem *UBGraphicsGroupContainerItemDelegate::delegated()
......
...@@ -158,6 +158,10 @@ void UBGraphicsItemDelegate::init() ...@@ -158,6 +158,10 @@ void UBGraphicsItemDelegate::init()
button->setFlag(QGraphicsItem::ItemIsSelectable, true); button->setFlag(QGraphicsItem::ItemIsSelectable, true);
} }
} }
//Wrapper function. Use it to set correct data() to QGraphicsItem as well
setFlippable(false);
setRotatable(false);
} }
...@@ -410,7 +414,7 @@ void UBGraphicsItemDelegate::remove(bool canUndo) ...@@ -410,7 +414,7 @@ void UBGraphicsItemDelegate::remove(bool canUndo)
} }
bool UBGraphicsItemDelegate::isLocked() bool UBGraphicsItemDelegate::isLocked() const
{ {
return mDelegated->data(UBGraphicsItemData::ItemLocked).toBool(); return mDelegated->data(UBGraphicsItemData::ItemLocked).toBool();
} }
...@@ -598,6 +602,22 @@ void UBGraphicsItemDelegate::showMenu() ...@@ -598,6 +602,22 @@ void UBGraphicsItemDelegate::showMenu()
void UBGraphicsItemDelegate::setFlippable(bool flippable) void UBGraphicsItemDelegate::setFlippable(bool flippable)
{ {
mFlippable = flippable; mFlippable = flippable;
Q_ASSERT (mDelegated);
if (mDelegated) {
mDelegated->setData(UBGraphicsItemData::ItemFlippable, QVariant(flippable));
}
}
void UBGraphicsItemDelegate::setRotatable(bool pCanRotate)
{
mCanRotate = pCanRotate;
Q_ASSERT(mDelegated);
if (mDelegated) {
mDelegated->setData(UBGraphicsItemData::ItemRotatable, QVariant(pCanRotate));
}
} }
bool UBGraphicsItemDelegate::isFlippable() bool UBGraphicsItemDelegate::isFlippable()
......
...@@ -224,8 +224,8 @@ class UBGraphicsItemDelegate : public QObject ...@@ -224,8 +224,8 @@ class UBGraphicsItemDelegate : public QObject
UBGraphicsDelegateFrame* frame() { return mFrame; } UBGraphicsDelegateFrame* frame() { return mFrame; }
bool canRotate() { return mCanRotate; } bool canRotate() const { return mCanRotate; }
bool isLocked(); bool isLocked() const;
bool canDuplicate() { return mCanDuplicate; } bool canDuplicate() { return mCanDuplicate; }
QMimeData* mimeData(){ return mMimeData; } QMimeData* mimeData(){ return mMimeData; }
...@@ -233,6 +233,7 @@ class UBGraphicsItemDelegate : public QObject ...@@ -233,6 +233,7 @@ class UBGraphicsItemDelegate : public QObject
void setDragPixmap(const QPixmap &pix) {mDragPixmap = pix;} void setDragPixmap(const QPixmap &pix) {mDragPixmap = pix;}
void setFlippable(bool flippable); void setFlippable(bool flippable);
void setRotatable(bool pCanRotate);
bool isFlippable(); bool isFlippable();
void setButtonsVisible(bool visible); void setButtonsVisible(bool visible);
......
...@@ -42,7 +42,7 @@ void UBAudioPresentationWidget::paintEvent(QPaintEvent *event) ...@@ -42,7 +42,7 @@ void UBAudioPresentationWidget::paintEvent(QPaintEvent *event)
mask_img.fill(0xff); mask_img.fill(0xff);
QPainter mask_painter(&mask_img); QPainter mask_painter(&mask_img);
mask_painter.setBrush(QBrush( QColor(0, 0, 0))); mask_painter.setBrush(QBrush( QColor(0, 0, 0)));
mask_painter.drawRoundedRect(1,1, width()-3, height()-3, height()/5, height()/5); mask_painter.drawRoundedRect(1,1, width()-2, height()-2, height()/5, height()/5);
setMask(QBitmap::fromImage(mask_img)); setMask(QBitmap::fromImage(mask_img));
...@@ -131,7 +131,6 @@ UBGraphicsMediaItem::UBGraphicsMediaItem(const QUrl& pMediaFileUrl, QGraphicsIte ...@@ -131,7 +131,6 @@ UBGraphicsMediaItem::UBGraphicsMediaItem(const QUrl& pMediaFileUrl, QGraphicsIte
connect(mDelegate, SIGNAL(showOnDisplayChanged(bool)), this, SLOT(showOnDisplayChanged(bool))); connect(mDelegate, SIGNAL(showOnDisplayChanged(bool)), this, SLOT(showOnDisplayChanged(bool)));
connect(mMediaObject, SIGNAL(hasVideoChanged(bool)), this, SLOT(hasMediaChanged(bool))); connect(mMediaObject, SIGNAL(hasVideoChanged(bool)), this, SLOT(hasMediaChanged(bool)));
} }
...@@ -179,6 +178,18 @@ QVariant UBGraphicsMediaItem::itemChange(GraphicsItemChange change, const QVaria ...@@ -179,6 +178,18 @@ QVariant UBGraphicsMediaItem::itemChange(GraphicsItemChange change, const QVaria
return UBGraphicsProxyWidget::itemChange(change, value); return UBGraphicsProxyWidget::itemChange(change, value);
} }
void UBGraphicsMediaItem::setSourceUrl(const QUrl &pSourceUrl)
{
UBAudioPresentationWidget* pAudioWidget = dynamic_cast<UBAudioPresentationWidget*>(mAudioWidget);
if (pAudioWidget)
{
pAudioWidget->setTitle(UBFileSystemUtils::lastPathComponent(pSourceUrl.toString()));
}
UBItem::setSourceUrl(pSourceUrl);
}
void UBGraphicsMediaItem::clearSource() void UBGraphicsMediaItem::clearSource()
{ {
QString path = mediaFileUrl().toLocalFile(); QString path = mediaFileUrl().toLocalFile();
......
...@@ -97,16 +97,7 @@ public: ...@@ -97,16 +97,7 @@ public:
virtual void copyItemParameters(UBItem *copy) const; virtual void copyItemParameters(UBItem *copy) const;
virtual void setSourceUrl(const QUrl &pSourceUrl) virtual void setSourceUrl(const QUrl &pSourceUrl);
{
UBAudioPresentationWidget* pAudioWidget = dynamic_cast<UBAudioPresentationWidget*>(mAudioWidget);
if (pAudioWidget)
{
pAudioWidget->setTitle(UBFileSystemUtils::lastPathComponent(pSourceUrl.toLocalFile()));
}
UBItem::setSourceUrl(pSourceUrl);
}
public slots: public slots:
......
...@@ -56,6 +56,10 @@ UBGraphicsMediaItemDelegate::UBGraphicsMediaItemDelegate(UBGraphicsMediaItem* pD ...@@ -56,6 +56,10 @@ UBGraphicsMediaItemDelegate::UBGraphicsMediaItemDelegate(UBGraphicsMediaItem* pD
{ {
delegated()->setMute(true); delegated()->setMute(true);
} }
//Wrapper function. Use it to set correct data() to QGraphicsItem as well
setFlippable(false);
setRotatable(false);
} }
bool UBGraphicsMediaItemDelegate::mousePressEvent(QGraphicsSceneMouseEvent *event) bool UBGraphicsMediaItemDelegate::mousePressEvent(QGraphicsSceneMouseEvent *event)
......
...@@ -28,10 +28,10 @@ ...@@ -28,10 +28,10 @@
UBGraphicsPixmapItem::UBGraphicsPixmapItem(QGraphicsItem* parent) UBGraphicsPixmapItem::UBGraphicsPixmapItem(QGraphicsItem* parent)
: QGraphicsPixmapItem(parent) : QGraphicsPixmapItem(parent)
{ {
mDelegate = new UBGraphicsItemDelegate(this, 0, true, true, false); mDelegate = new UBGraphicsItemDelegate(this, 0, true);
mDelegate->init(); mDelegate->init();
mDelegate->setFlippable(true); mDelegate->setFlippable(true);
mDelegate->setRotatable(true);
setData(UBGraphicsItemData::ItemLayerType, UBItemLayerType::Object); setData(UBGraphicsItemData::ItemLayerType, UBItemLayerType::Object);
setTransformationMode(Qt::SmoothTransformation); setTransformationMode(Qt::SmoothTransformation);
......
...@@ -308,9 +308,10 @@ UBGraphicsScene::~UBGraphicsScene() ...@@ -308,9 +308,10 @@ UBGraphicsScene::~UBGraphicsScene()
void UBGraphicsScene::selectionChangedProcessing() void UBGraphicsScene::selectionChangedProcessing()
{ {
if (selectedItems().count()){ if (selectedItems().count()){
qDebug() << "Selected item bounding rect: " << selectedItems().first()->boundingRect(); // UBApplication::showMessage("ZValue is " + QString::number(selectedItems().first()->zValue(), 'f') + "own z value is "
UBApplication::showMessage("ZValue is " + QString::number(selectedItems().first()->zValue(), 'f') + "own z value is " // + QString::number(selectedItems().first()->data(UBGraphicsItemData::ItemOwnZValue).toReal(), 'f'));
+ QString::number(selectedItems().first()->data(UBGraphicsItemData::ItemOwnZValue).toReal(), 'f')); qDebug() << "flippable" << selectedItems().first()->data(UBGraphicsItemData::ItemFlippable).toBool() << endl
<< "rotatable" << selectedItems().first()->data(UBGraphicsItemData::ItemRotatable).toBool();
} }
} }
...@@ -1269,7 +1270,7 @@ void UBGraphicsScene::clearAnnotations() ...@@ -1269,7 +1270,7 @@ void UBGraphicsScene::clearAnnotations()
while (itItems.hasNext()) while (itItems.hasNext())
{ {
QGraphicsItem* item = itItems.next(); QGraphicsItem* item = itItems.next();
UBGraphicsPolygonItem* pi = qgraphicsitem_cast<UBGraphicsPolygonItem*>(item); UBGraphicsStrokesGroup* pi = qgraphicsitem_cast<UBGraphicsStrokesGroup*>(item);
if (pi) if (pi)
{ {
removeItem(item); removeItem(item);
...@@ -1998,8 +1999,6 @@ void UBGraphicsScene::moveMagnifier(QPoint newPos, bool forceGrab) ...@@ -1998,8 +1999,6 @@ void UBGraphicsScene::moveMagnifier(QPoint newPos, bool forceGrab)
QPoint dvZeroPoint = dView->mapToGlobal(QPoint(0,0)); QPoint dvZeroPoint = dView->mapToGlobal(QPoint(0,0));
QRect qcr = cView->geometry();
QRect qdr = dView->geometry();
int cvW = cView->width(); int cvW = cView->width();
int dvW = dView->width(); int dvW = dView->width();
qreal wCoeff = (qreal)dvW / (qreal)cvW; qreal wCoeff = (qreal)dvW / (qreal)cvW;
...@@ -2352,6 +2351,7 @@ void UBGraphicsScene::keyReleaseEvent(QKeyEvent * keyEvent) ...@@ -2352,6 +2351,7 @@ void UBGraphicsScene::keyReleaseEvent(QKeyEvent * keyEvent)
default: default:
{ {
item->setSelected(false);
UBGraphicsItem *ubgi = dynamic_cast<UBGraphicsItem*>(item); UBGraphicsItem *ubgi = dynamic_cast<UBGraphicsItem*>(item);
if (0 != ubgi) if (0 != ubgi)
ubgi->remove(); ubgi->remove();
......
...@@ -9,6 +9,8 @@ UBGraphicsStrokesGroup::UBGraphicsStrokesGroup(QGraphicsItem *parent):QGraphicsI ...@@ -9,6 +9,8 @@ UBGraphicsStrokesGroup::UBGraphicsStrokesGroup(QGraphicsItem *parent):QGraphicsI
mDelegate = new UBGraphicsItemDelegate(this, 0, true, true, false); mDelegate = new UBGraphicsItemDelegate(this, 0, true, true, false);
mDelegate->init(); mDelegate->init();
mDelegate->setFlippable(true); mDelegate->setFlippable(true);
mDelegate->setRotatable(true);
setData(UBGraphicsItemData::ItemLayerType, UBItemLayerType::Object); setData(UBGraphicsItemData::ItemLayerType, UBItemLayerType::Object);
setUuid(QUuid::createUuid()); setUuid(QUuid::createUuid());
......
...@@ -56,6 +56,7 @@ void UBGraphicsSvgItem::init() ...@@ -56,6 +56,7 @@ void UBGraphicsSvgItem::init()
mDelegate = new UBGraphicsItemDelegate(this, 0, true, true, false); mDelegate = new UBGraphicsItemDelegate(this, 0, true, true, false);
mDelegate->init(); mDelegate->init();
mDelegate->setFlippable(true); mDelegate->setFlippable(true);
mDelegate->setRotatable(true);
setFlag(QGraphicsItem::ItemSendsGeometryChanges, true); setFlag(QGraphicsItem::ItemSendsGeometryChanges, true);
......
...@@ -38,6 +38,8 @@ UBGraphicsTextItem::UBGraphicsTextItem(QGraphicsItem * parent) ...@@ -38,6 +38,8 @@ UBGraphicsTextItem::UBGraphicsTextItem(QGraphicsItem * parent)
mDelegate->init(); mDelegate->init();
mDelegate->frame()->setOperationMode(UBGraphicsDelegateFrame::Resizing); mDelegate->frame()->setOperationMode(UBGraphicsDelegateFrame::Resizing);
mDelegate->setFlippable(false);
mDelegate->setRotatable(true);
mTypeTextHereLabel = tr("<Type Text Here>"); mTypeTextHereLabel = tr("<Type Text Here>");
......
...@@ -28,7 +28,7 @@ UBGraphicsWebView::UBGraphicsWebView(QGraphicsItem* parent) ...@@ -28,7 +28,7 @@ UBGraphicsWebView::UBGraphicsWebView(QGraphicsItem* parent)
{ {
setData(UBGraphicsItemData::ItemLayerType, UBItemLayerType::Object); setData(UBGraphicsItemData::ItemLayerType, UBItemLayerType::Object);
mDelegate = new UBGraphicsItemDelegate(this, 0, true, false, false); mDelegate = new UBGraphicsItemDelegate(this, 0, true);
mDelegate->init(); mDelegate->init();
setFlag(QGraphicsItem::ItemSendsGeometryChanges, true); setFlag(QGraphicsItem::ItemSendsGeometryChanges, true);
......
...@@ -34,3 +34,13 @@ void UBGraphicsItem::assignZValue(QGraphicsItem *item, qreal value) ...@@ -34,3 +34,13 @@ void UBGraphicsItem::assignZValue(QGraphicsItem *item, qreal value)
item->setZValue(value); item->setZValue(value);
item->setData(UBGraphicsItemData::ItemOwnZValue, value); item->setData(UBGraphicsItemData::ItemOwnZValue, value);
} }
bool UBGraphicsItem::isFlippable(QGraphicsItem *item)
{
return item->data(UBGraphicsItemData::ItemFlippable).toBool();
}
bool UBGraphicsItem::isRotatable(QGraphicsItem *item)
{
return item->data(UBGraphicsItemData::ItemRotatable).toBool();
}
...@@ -105,6 +105,9 @@ protected: ...@@ -105,6 +105,9 @@ protected:
public: public:
static void assignZValue(QGraphicsItem*, qreal value); static void assignZValue(QGraphicsItem*, qreal value);
static bool isRotatable(QGraphicsItem *item);
static bool isFlippable(QGraphicsItem *item);
virtual UBGraphicsItemDelegate *Delegate() const = 0; virtual UBGraphicsItemDelegate *Delegate() const = 0;
virtual void remove() = 0; virtual void remove() = 0;
......
...@@ -107,7 +107,7 @@ void UBFeaturesWidget::currentSelected(const QModelIndex &current) ...@@ -107,7 +107,7 @@ void UBFeaturesWidget::currentSelected(const QModelIndex &current)
QString objName = sender()->objectName(); QString objName = sender()->objectName();
if (objName.isEmpty()) { if (objName.isEmpty()) {
qWarning() << "incorrrect sender"; qWarning() << "incorrect sender";
} else if (objName == objNamePathList) { } else if (objName == objNamePathList) {
//Calling to reset the model for listView. Maybe separate function needed //Calling to reset the model for listView. Maybe separate function needed
controller->searchStarted("", centralWidget->listView()); controller->searchStarted("", centralWidget->listView());
...@@ -732,7 +732,7 @@ UBFeaturesWebView::UBFeaturesWebView(QWidget* parent, const char* name):QWidget( ...@@ -732,7 +732,7 @@ UBFeaturesWebView::UBFeaturesWebView(QWidget* parent, const char* name):QWidget(
mpView->setObjectName("SearchEngineView"); mpView->setObjectName("SearchEngineView");
mpSankoreAPI = new UBWidgetUniboardAPI(UBApplication::boardController->activeScene()); mpSankoreAPI = new UBWidgetUniboardAPI(UBApplication::boardController->activeScene());
mpView->page()->mainFrame()->addToJavaScriptWindowObject("sankore", mpSankoreAPI); mpView->page()->mainFrame()->addToJavaScriptWindowObject("sankore", mpSankoreAPI);
connect(mpView->page()->mainFrame(), SIGNAL(javaScriptWindowObjectCleared()), this, SLOT(javaScriptWindowObjectCleared()));
mpWebSettings = QWebSettings::globalSettings(); mpWebSettings = QWebSettings::globalSettings();
mpWebSettings->setAttribute(QWebSettings::JavaEnabled, true); mpWebSettings->setAttribute(QWebSettings::JavaEnabled, true);
mpWebSettings->setAttribute(QWebSettings::PluginsEnabled, true); mpWebSettings->setAttribute(QWebSettings::PluginsEnabled, true);
...@@ -767,6 +767,11 @@ UBFeaturesWebView::~UBFeaturesWebView() ...@@ -767,6 +767,11 @@ UBFeaturesWebView::~UBFeaturesWebView()
} }
} }
void UBFeaturesWebView::javaScriptWindowObjectCleared()
{
mpView->page()->mainFrame()->addToJavaScriptWindowObject("sankore", mpSankoreAPI);
}
void UBFeaturesWebView::showElement(const UBFeature &elem) void UBFeaturesWebView::showElement(const UBFeature &elem)
{ {
QString qsWidgetName; QString qsWidgetName;
......
...@@ -248,7 +248,6 @@ private slots: ...@@ -248,7 +248,6 @@ private slots:
void setFileNameList(const QStringList &pLst); void setFileNameList(const QStringList &pLst);
void reactOnTextChanged(const QString &pStr); void reactOnTextChanged(const QString &pStr);
private: private:
QLineEdit *mLineEdit; QLineEdit *mLineEdit;
QRegExpValidator *mValidator; QRegExpValidator *mValidator;
...@@ -289,6 +288,7 @@ public: ...@@ -289,6 +288,7 @@ public:
private slots: private slots:
void onLoadFinished(bool ok); void onLoadFinished(bool ok);
void javaScriptWindowObjectCleared();
private: private:
QWebView* mpView; QWebView* mpView;
......
...@@ -39,6 +39,7 @@ UBGraphicsCurtainItem::UBGraphicsCurtainItem(QGraphicsItem* parent) ...@@ -39,6 +39,7 @@ UBGraphicsCurtainItem::UBGraphicsCurtainItem(QGraphicsItem* parent)
{ {
mDelegate = new UBGraphicsCurtainItemDelegate(this, 0); mDelegate = new UBGraphicsCurtainItemDelegate(this, 0);
mDelegate->init(); mDelegate->init();
setFlag(QGraphicsItem::ItemIsMovable, true); setFlag(QGraphicsItem::ItemIsMovable, true);
setFlag(QGraphicsItem::ItemIsSelectable, true); setFlag(QGraphicsItem::ItemIsSelectable, true);
......
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