From 2f34f5e5ff775e2d0184dd2ee5183fd10645fd29 Mon Sep 17 00:00:00 2001 From: Ivan Ilin Date: Mon, 31 Oct 2011 11:27:15 +0200 Subject: [PATCH] commit berore new branch created --- src/adaptors/UBCFFSubsetAdaptor.cpp | 15 ++++++- src/adaptors/UBCFFSubsetAdaptor.h | 4 +- src/domain/UBGraphicsProxyWidget.h | 2 +- src/web/UBTrapFlashController.cpp | 70 ++++++++++++++--------------- 4 files changed, 53 insertions(+), 38 deletions(-) diff --git a/src/adaptors/UBCFFSubsetAdaptor.cpp b/src/adaptors/UBCFFSubsetAdaptor.cpp index 572486d7..2661f667 100644 --- a/src/adaptors/UBCFFSubsetAdaptor.cpp +++ b/src/adaptors/UBCFFSubsetAdaptor.cpp @@ -240,6 +240,7 @@ UBCFFSubsetAdaptor::UBCFFSubsetReader::UBCFFSubsetReader(UBDocumentProxy *proxy, // QTextStream out(&tfile); // out << content; // tfile.close(); + qDebug() << "tmp path is" << pwdContent; } bool UBCFFSubsetAdaptor::UBCFFSubsetReader::parse() @@ -798,6 +799,8 @@ bool UBCFFSubsetAdaptor::UBCFFSubsetReader::parseSvgImage(const QDomElement &ele if (!QFile::exists(imagePath)) { qDebug() << "can't load file" << pwdContent + "/" + itemRefPath << "maybe file corrupted"; return false; + } else { + qDebug() << "size of file" << itemRefPath << QFileInfo(itemRefPath).size(); } pix.load(imagePath); if (pix.isNull()) { @@ -814,7 +817,8 @@ bool UBCFFSubsetAdaptor::UBCFFSubsetReader::parseSvgImage(const QDomElement &ele hastransform = true; } // repositionSvgItem(svgItem, rx * 2 + 10, ry * 2 + 10, cx - rx - 5, cy - ry -5, hastransform, transform); -repositionPixmapItem(pixItem, width, height, x, y, hastransform, transform); + repositionPixmapItem(pixItem, width, height, x, y, hastransform, transform); +// hashSceneItem(element, pixItem->); return true; } @@ -848,6 +852,14 @@ bool UBCFFSubsetAdaptor::UBCFFSubsetReader::parseIwbGroup(QDomNode *group) return true; } +//void UBCFFSubsetAdaptor::UBCFFSubsetReader::hashSceneItem(QDomNode &element, UBGraphicsItemDelegate *item) +//{ +//// adding element pointer to hash to refer if needed +// QString key = element.attribute(aId); +// if (!key.isNull()) +// persistedItems.insert(key, item); +//} + bool UBCFFSubsetAdaptor::UBCFFSubsetReader::parseSvgElement(const QDomElement &parent) { QString tagName = parent.tagName(); @@ -856,6 +868,7 @@ bool UBCFFSubsetAdaptor::UBCFFSubsetReader::parseSvgElement(const QDomElement &p return false; } + if (tagName == tRect && !parseSvgRect(parent)) return false; else if (tagName == tEllipse && !parseSvgEllipse(parent)) return false; else if (tagName == tPolygon && !parseSvgPolygon(parent)) return false; diff --git a/src/adaptors/UBCFFSubsetAdaptor.h b/src/adaptors/UBCFFSubsetAdaptor.h index 78d953ee..dcddefdd 100644 --- a/src/adaptors/UBCFFSubsetAdaptor.h +++ b/src/adaptors/UBCFFSubsetAdaptor.h @@ -27,6 +27,7 @@ class UBGraphicsScene; class QSvgGenerator; class UBGraphicsSvgItem; class UBGraphicsPixmapItem; +class UBGraphicsItemDelegate; class QTransform; class QPainter; @@ -86,6 +87,7 @@ private: QDomDocument mDOMdoc; QDomNode mCurrentDOMElement; QHash iwbExtProperties; + QHash persistedItems; bool hashElements(); void addExtentionsToHash(QDomElement *parent, QDomElement *topGroup); @@ -107,7 +109,7 @@ private: inline bool parseSvgImage(const QDomElement &element); // inline bool parseSvgTSpan(const QDomElement) bool parseIwbGroup(QDomNode *element); - + inline void hashSceneItem(QDomNode *element, UBGraphicsItemDelegate *item); // to kill void parseTextAttributes(const QDomElement &element, qreal &fontSize, QColor &fontColor, diff --git a/src/domain/UBGraphicsProxyWidget.h b/src/domain/UBGraphicsProxyWidget.h index a7dc5de7..adf0737f 100644 --- a/src/domain/UBGraphicsProxyWidget.h +++ b/src/domain/UBGraphicsProxyWidget.h @@ -41,7 +41,7 @@ class UBGraphicsProxyWidget: public QGraphicsProxyWidget, public UBItem, public virtual void remove(); - UBGraphicsItemDelegate* delegate (){ return mDelegate;}; + UBGraphicsItemDelegate* delegate (){ return mDelegate;} protected: diff --git a/src/web/UBTrapFlashController.cpp b/src/web/UBTrapFlashController.cpp index f88136af..bd2c4c06 100644 --- a/src/web/UBTrapFlashController.cpp +++ b/src/web/UBTrapFlashController.cpp @@ -73,49 +73,49 @@ void UBTrapFlashController::showTrapFlash() , viewHeight); connect(mTrapFlashUi->flashCombobox, SIGNAL(currentIndexChanged(int)), this, SLOT(selectFlash(int))); - connect(mTrapFlashUi->widgetNameLineEdit, SIGNAL(textChanged(const QString &)), this, SLOT(text_Changed(const QString &))); - connect(mTrapFlashUi->widgetNameLineEdit, SIGNAL(textEdited(const QString &)), this, SLOT(text_Edited(const QString &))); + connect(mTrapFlashUi->widgetNameLineEdit, SIGNAL(textChanged(const QString &)), this, SLOT(text_Changed(const QString &))); + connect(mTrapFlashUi->widgetNameLineEdit, SIGNAL(textEdited(const QString &)), this, SLOT(text_Edited(const QString &))); connect(mTrapFlashUi->createWidgetButton, SIGNAL(clicked(bool)), this, SLOT(createWidget())); } mTrapFlashDialog->show(); } -void UBTrapFlashController::text_Changed(const QString &newText) -{ - QString new_text = newText; - -#ifdef Q_WS_WIN // Defined on Windows. - QString illegalCharList(" < > : \" / \\ | ? * "); - QRegExp regExp("[<>:\"/\\\\|?*]"); -#endif - -#ifdef Q_WS_QWS // Defined on Qt for Embedded Linux. - QString illegalCharList(" < > : \" / \\ | ? * "); - QRegExp regExp("[<>:\"/\\\\|?*]"); -#endif - -#ifdef Q_WS_MAC // Defined on Mac OS X. - QString illegalCharList(" < > : \" / \\ | ? * "); - QRegExp regExp("[<>:\"/\\\\|?*]"); -#endif - -#ifdef Q_WS_X11 // Defined on X11. - QString illegalCharList(" < > : \" / \\ | ? * "); - QRegExp regExp("[<>:\"/\\\\|?*]"); -#endif - - if(new_text.indexOf(regExp) > -1) - { - new_text.remove(regExp); - mTrapFlashUi->widgetNameLineEdit->setText(new_text); - QToolTip::showText(mTrapFlashUi->widgetNameLineEdit->mapToGlobal(QPoint()), "Application name can`t contain any of the following characters:\r\n"+illegalCharList); - } +void UBTrapFlashController::text_Changed(const QString &newText) +{ + QString new_text = newText; + +#ifdef Q_WS_WIN // Defined on Windows. + QString illegalCharList(" < > : \" / \\ | ? * "); + QRegExp regExp("[<>:\"/\\\\|?*]"); +#endif + +#ifdef Q_WS_QWS // Defined on Qt for Embedded Linux. + QString illegalCharList(" < > : \" / \\ | ? * "); + QRegExp regExp("[<>:\"/\\\\|?*]"); +#endif + +#ifdef Q_WS_MAC // Defined on Mac OS X. + QString illegalCharList(" < > : \" / \\ | ? * "); + QRegExp regExp("[<>:\"/\\\\|?*]"); +#endif + +#ifdef Q_WS_X11 // Defined on X11. + QString illegalCharList(" < > : \" / \\ | ? * "); + QRegExp regExp("[<>:\"/\\\\|?*]"); +#endif + + if(new_text.indexOf(regExp) > -1) + { + new_text.remove(regExp); + mTrapFlashUi->widgetNameLineEdit->setText(new_text); + QToolTip::showText(mTrapFlashUi->widgetNameLineEdit->mapToGlobal(QPoint()), "Application name can`t contain any of the following characters:\r\n"+illegalCharList); + } } -void UBTrapFlashController::text_Edited(const QString &newText) -{ - +void UBTrapFlashController::text_Edited(const QString &newText) +{ + } void UBTrapFlashController::hideTrapFlash()