Merge branch 'CFFBranch'

preferencesAboutTextFull
Ivan Ilin 13 years ago
commit 37afb69953
  1. 1692
      src/adaptors/UBCFFSubsetAdaptor.cpp
  2. 92
      src/adaptors/UBCFFSubsetAdaptor.h
  3. 1
      src/domain/UBGraphicsAudioItem.h
  4. 2
      src/domain/UBGraphicsItemDelegate.cpp
  5. 18
      src/domain/UBGraphicsItemDelegate.h
  6. 3
      src/domain/UBGraphicsPDFItem.h
  7. 7
      src/domain/UBGraphicsPixmapItem.h
  8. 4
      src/domain/UBGraphicsProxyWidget.h
  9. 3
      src/domain/UBGraphicsScene.cpp
  10. 3
      src/domain/UBGraphicsSvgItem.h
  11. 1
      src/domain/UBGraphicsTextItem.cpp
  12. 3
      src/domain/UBGraphicsTextItem.h
  13. 1
      src/domain/UBGraphicsVideoItem.h
  14. 10
      src/domain/UBGraphicsWidgetItem.h
  15. 2
      src/domain/UBGraphicsWidgetItemDelegate.h
  16. 25
      src/domain/UBItem.h
  17. 1
      src/domain/UBW3CWidget.cpp
  18. 1
      src/tools/UBGraphicsCurtainItem.cpp
  19. 5
      src/tools/UBGraphicsCurtainItem.h

File diff suppressed because it is too large Load Diff

@ -30,17 +30,9 @@ class UBGraphicsPixmapItem;
class UBGraphicsItemDelegate; class UBGraphicsItemDelegate;
class QTransform; class QTransform;
class QPainter; class QPainter;
class UBGraphicsItem;
class QGraphicsItem;
struct IwbExt {
IwbExt() {;}
IwbExt(QDomNode element) : element(element), extAttr(*(new QVector<QDomNode>())) {;}
QDomNode group;
QDomNode element;
QVector<QDomNode> extAttr;
QHash<QString, QString> textAttributes;
operator bool() const {return !group.isNull() || !element.isNull();}
};
class UBCFFSubsetAdaptor class UBCFFSubsetAdaptor
{ {
@ -52,22 +44,9 @@ public:
private: private:
class UBCFFSubsetReader class UBCFFSubsetReader
{ {
//xml parse states definition
enum
{
NONE,
IWB,
SVG,
PAGESET,
PAGE,
TEXTAREA,
TSPAN
};
public: public:
UBCFFSubsetReader(UBDocumentProxy *proxy, QFile *content); UBCFFSubsetReader(UBDocumentProxy *proxy, QFile *content);
QXmlStreamReader mReader;
UBDocumentProxy *mProxy; UBDocumentProxy *mProxy;
QString pwdContent; QString pwdContent;
@ -79,6 +58,8 @@ private:
QRectF mCurrentSceneRect; QRectF mCurrentSceneRect;
QString mIndent; QString mIndent;
QRectF mViewBox; QRectF mViewBox;
QRectF mViewPort;
qreal mVBTransFactor;
QPointF mViewBoxCenter; QPointF mViewBoxCenter;
QSize mSize; QSize mSize;
@ -86,8 +67,8 @@ private:
// to kill // to kill
QDomDocument mDOMdoc; QDomDocument mDOMdoc;
QDomNode mCurrentDOMElement; QDomNode mCurrentDOMElement;
QHash<QString, IwbExt> iwbExtProperties; QHash<QString, UBGraphicsItem*> persistedItems;
QHash<QString, UBGraphicsItemDelegate*> persistedItems; QDir mTmpFlashDir;
bool hashElements(); bool hashElements();
void addExtentionsToHash(QDomElement *parent, QDomElement *topGroup); void addExtentionsToHash(QDomElement *parent, QDomElement *topGroup);
@ -99,6 +80,8 @@ private:
bool parseSvgPage(const QDomElement &parent); bool parseSvgPage(const QDomElement &parent);
bool parseSvgPageset(const QDomElement &parent); bool parseSvgPageset(const QDomElement &parent);
bool parseSvgElement(const QDomElement &parent); bool parseSvgElement(const QDomElement &parent);
bool parseIwbMeta(const QDomElement &element);
bool parseSvg(const QDomElement &svgSection);
inline bool parseSvgRect(const QDomElement &element); inline bool parseSvgRect(const QDomElement &element);
inline bool parseSvgEllipse(const QDomElement &element); inline bool parseSvgEllipse(const QDomElement &element);
@ -107,61 +90,44 @@ private:
inline bool parseSvgText(const QDomElement &element); inline bool parseSvgText(const QDomElement &element);
inline bool parseSvgTextarea(const QDomElement &element); inline bool parseSvgTextarea(const QDomElement &element);
inline bool parseSvgImage(const QDomElement &element); inline bool parseSvgImage(const QDomElement &element);
// inline bool parseSvgTSpan(const QDomElement) inline bool parseSvgFlash(const QDomElement &element);
bool parseIwbGroup(QDomNode *element); inline bool parseSvgAudio(const QDomElement &element);
inline void hashSceneItem(QDomNode *element, UBGraphicsItemDelegate *item); inline bool parseSvgVideo(const QDomElement &element);
inline bool parseIwbGroup(QDomElement &parent);
inline bool parseIwbElement(QDomElement &element);
inline void parseTSpan(const QDomElement &parent, QPainter &painter
, qreal &curX, qreal &curY, qreal &width, qreal &height, qreal &linespacing, QRectF &lastDrawnTextBoundingRect
, qreal &fontSize, QColor &fontColor, QString &fontFamily, QString &fontStretch, bool &italic
, int &fontWeight, int &textAlign, QTransform &fontTransform);
inline void hashSceneItem(const QDomElement &element, UBGraphicsItem *item);
// to kill // to kill
void parseTextAttributes(const QDomElement &element, qreal &fontSize, QColor &fontColor, void parseTextAttributes(const QDomElement &element, qreal &fontSize, QColor &fontColor,
QString &fontFamily, QString &fontStretch, bool &italic, QString &fontFamily, QString &fontStretch, bool &italic,
int &fontWeight, int &textAlign, QTransform &fontTransform); int &fontWeight, int &textAlign, QTransform &fontTransform);
//methods to store current xml parse state
int PopState();
void PushState(int state);
//elements parsing methods //elements parsing methods
bool parseDoc(); bool parseDoc();
bool parseCurrentElementStart();
bool parseCurrentElementCharacters();
bool parseCurrentElementEnd();
bool parseIwb();
bool parseIwbMeta();
bool parseSvg();
bool parseRect();
bool parseEllipse();
bool parseTextArea();
bool parseText();
bool parsePolygon();
bool parsePolyline();
bool parsePage();
bool parsePageSet();
bool parseIwbElementRef();
bool createNewScene(); bool createNewScene();
bool persistCurrentScene(); bool persistCurrentScene();
// helper methods
QStack<int> stateStack; // bool getCurElementTransorm(QTransform &transform);
void repositionSvgItem(QGraphicsItem *item, qreal width, qreal height,
int currentState; qreal x, qreal y,
bool useTransform, QTransform &transform);
//helper methods void experimentalReposition(QGraphicsItem *item, qreal width, qreal height,
bool getCurElementTransorm(QTransform &transform); qreal x, qreal y,
void repositionSvgItem(UBGraphicsSvgItem *item, qreal width, qreal height, qreal x, qreal y, bool useTransform, QTransform &transform); bool useTransform, QTransform &transform);
void repositionPixmapItem(UBGraphicsPixmapItem *item, qreal width, qreal height, qreal x, qreal y
, bool useTransform, QTransform &transform);
QColor colorFromString(const QString& clrString); QColor colorFromString(const QString& clrString);
QTransform transformFromString(const QString trString); QTransform transformFromString(const QString trString);
bool getViewBoxDimenstions(const QString& viewBox); bool getViewBoxDimenstions(const QString& viewBox);
QSvgGenerator* createSvgGenerator(qreal width, qreal height); QSvgGenerator* createSvgGenerator(qreal width, qreal height);
bool getTempFileName(); bool getTempFileName();
void parseTextAttributes(qreal &fontSize, QColor &fontColor, inline bool strToBool(QString);
QString &fontFamily, QString &fontStretch, bool &italic, bool createTempFlashPath();
int &fontWeight, int &textAlign, QTransform &fontTransform);
}; };
}; };

@ -37,6 +37,7 @@ public:
} }
virtual UBItem* deepCopy () const; virtual UBItem* deepCopy () const;
virtual UBGraphicsItemDelegate *Delegate() const {return mDelegate;}
private slots: private slots:

@ -319,10 +319,12 @@ void UBGraphicsItemDelegate::lock(bool locked)
if (locked) if (locked)
{ {
mDelegated->setData(UBGraphicsItemData::ItemLocked, QVariant(true)); mDelegated->setData(UBGraphicsItemData::ItemLocked, QVariant(true));
qDebug() << "item's data is called for locked" << mDelegated->data(UBGraphicsItemData::ItemLocked);
} }
else else
{ {
mDelegated->setData(UBGraphicsItemData::ItemLocked, QVariant(false)); mDelegated->setData(UBGraphicsItemData::ItemLocked, QVariant(false));
qDebug() << "item's data is called for unlocked" << mDelegated->data(UBGraphicsItemData::ItemLocked);
} }
mDelegated->update(); mDelegated->update();

@ -30,7 +30,7 @@ class UBGraphicsWidgetItem;
class DelegateButton: public QGraphicsSvgItem class DelegateButton: public QGraphicsSvgItem
{ {
Q_OBJECT; Q_OBJECT
public: public:
DelegateButton(const QString & fileName, QGraphicsItem* pDelegated, QGraphicsItem * parent = 0) DelegateButton(const QString & fileName, QGraphicsItem* pDelegated, QGraphicsItem * parent = 0)
@ -90,7 +90,7 @@ class DelegateButton: public QGraphicsSvgItem
class UBGraphicsItemDelegate : public QObject class UBGraphicsItemDelegate : public QObject
{ {
Q_OBJECT; Q_OBJECT
public: public:
UBGraphicsItemDelegate(QGraphicsItem* pDelegated, QObject * parent = 0, bool respectRatio = true, bool canRotate = false); UBGraphicsItemDelegate(QGraphicsItem* pDelegated, QObject * parent = 0, bool respectRatio = true, bool canRotate = false);
@ -107,6 +107,8 @@ class UBGraphicsItemDelegate : public QObject
virtual QVariant itemChange(QGraphicsItem::GraphicsItemChange change, virtual QVariant itemChange(QGraphicsItem::GraphicsItemChange change,
const QVariant &value); const QVariant &value);
void printMessage(const QString &mess) {qDebug() << mess;}
QGraphicsItem* delegated() QGraphicsItem* delegated()
{ {
return mDelegated; return mDelegated;
@ -129,17 +131,19 @@ class UBGraphicsItemDelegate : public QObject
void setMimeData(QMimeData* mimeData); void setMimeData(QMimeData* mimeData);
signals: signals:
void showOnDisplayChanged(bool shown); void showOnDisplayChanged(bool shown);
void lockChanged(bool locked); void lockChanged(bool locked);
public slots: public slots:
virtual void remove(bool canUndo = true); virtual void remove(bool canUndo = true);
void showMenu(); void showMenu();
virtual void showHide(bool show);
virtual void lock(bool lock);
virtual void duplicate();
protected: protected:
virtual void buildButtons() {}; virtual void buildButtons() {;}
virtual void decorateMenu(QMenu *menu); virtual void decorateMenu(QMenu *menu);
virtual void updateMenuActionState(); virtual void updateMenuActionState();
@ -164,9 +168,7 @@ class UBGraphicsItemDelegate : public QObject
protected slots: protected slots:
virtual void gotoContentSource(bool checked); virtual void gotoContentSource(bool checked);
virtual void showHide(bool show);
virtual void lock(bool lock);
virtual void duplicate();
private: private:

@ -48,6 +48,7 @@ class UBGraphicsPDFItem: public GraphicsPDFItem, public UBItem, public UBGraphic
virtual void remove(); virtual void remove();
virtual UBGraphicsPixmapItem* toPixmapItem() const; virtual UBGraphicsPixmapItem* toPixmapItem() const;
virtual UBGraphicsItemDelegate *Delegate() const {return mDelegate;}
protected: protected:
@ -57,7 +58,7 @@ class UBGraphicsPDFItem: public GraphicsPDFItem, public UBItem, public UBGraphic
virtual QVariant itemChange(GraphicsItemChange change, const QVariant &value); virtual QVariant itemChange(GraphicsItemChange change, const QVariant &value);
UBGraphicsItemDelegate* mDelegate; // UBGraphicsItemDelegate* mDelegate;
}; };
#endif /* UBGRAPHICSPDFITEM_H_ */ #endif /* UBGRAPHICSPDFITEM_H_ */

@ -45,11 +45,13 @@ class UBGraphicsPixmapItem : public QObject, public QGraphicsPixmapItem, public
virtual void remove(); virtual void remove();
Q_PROPERTY(qreal opacity READ opacity WRITE setOpacity); Q_PROPERTY(qreal opacity READ opacity WRITE setOpacity)
void setOpacity(qreal op); void setOpacity(qreal op);
qreal opacity() const; qreal opacity() const;
virtual UBGraphicsItemDelegate* Delegate() const {return mDelegate;}
protected: protected:
virtual void mousePressEvent(QGraphicsSceneMouseEvent *event); virtual void mousePressEvent(QGraphicsSceneMouseEvent *event);
@ -60,7 +62,8 @@ protected:
virtual QVariant itemChange(GraphicsItemChange change, const QVariant &value); virtual QVariant itemChange(GraphicsItemChange change, const QVariant &value);
UBGraphicsItemDelegate* mDelegate;
// UBGraphicsItemDelegate* mDelegate;
}; };

@ -41,7 +41,7 @@ class UBGraphicsProxyWidget: public QGraphicsProxyWidget, public UBItem, public
virtual void remove(); virtual void remove();
UBGraphicsItemDelegate* delegate (){ return mDelegate;} virtual UBGraphicsItemDelegate* Delegate() const { return mDelegate;}
protected: protected:
@ -53,7 +53,7 @@ class UBGraphicsProxyWidget: public QGraphicsProxyWidget, public UBItem, public
virtual QVariant itemChange(GraphicsItemChange change, const QVariant &value); virtual QVariant itemChange(GraphicsItemChange change, const QVariant &value);
UBGraphicsItemDelegate* mDelegate; // UBGraphicsItemDelegate* mDelegate;
}; };
#endif /* UBGRAPHICSPROXYWIDGET_H_ */ #endif /* UBGRAPHICSPROXYWIDGET_H_ */

@ -139,7 +139,6 @@ UBGraphicsScene::UBGraphicsScene(UBDocumentProxy* parent)
connect(this, SIGNAL(selectionChanged()), this, SLOT(selectionChangedProcessing())); connect(this, SIGNAL(selectionChanged()), this, SLOT(selectionChangedProcessing()));
} }
UBGraphicsScene::~UBGraphicsScene() UBGraphicsScene::~UBGraphicsScene()
{ {
// NOOP // NOOP
@ -165,8 +164,6 @@ void UBGraphicsScene::selectionChangedProcessing()
nextItem->setZValue(2); nextItem->setZValue(2);
qDebug() << QString(" >>> %1 <<< ").arg(i) << QString(" >>> %1 <<< ").arg(zValue); qDebug() << QString(" >>> %1 <<< ").arg(i) << QString(" >>> %1 <<< ").arg(zValue);
} }
} }
// MARK: - // MARK: -

@ -59,6 +59,7 @@ class UBGraphicsSvgItem: public QGraphicsSvgItem, public UBItem, public UBGraphi
virtual void remove(); virtual void remove();
virtual UBGraphicsPixmapItem* toPixmapItem() const; virtual UBGraphicsPixmapItem* toPixmapItem() const;
virtual UBGraphicsItemDelegate *Delegate() const {return mDelegate;}
protected: protected:
@ -70,7 +71,7 @@ class UBGraphicsSvgItem: public QGraphicsSvgItem, public UBItem, public UBGraphi
virtual QVariant itemChange(GraphicsItemChange change, const QVariant &value); virtual QVariant itemChange(GraphicsItemChange change, const QVariant &value);
UBGraphicsItemDelegate* mDelegate; // UBGraphicsItemDelegate* mDelegate;
QByteArray mFileData; QByteArray mFileData;
}; };

@ -30,7 +30,6 @@ QColor UBGraphicsTextItem::lastUsedTextColor;
UBGraphicsTextItem::UBGraphicsTextItem(QGraphicsItem * parent) UBGraphicsTextItem::UBGraphicsTextItem(QGraphicsItem * parent)
: QGraphicsTextItem(parent) : QGraphicsTextItem(parent)
, mDelegate(0)
, mMultiClickState(0) , mMultiClickState(0)
, mLastMousePressTime(QTime::currentTime()) , mLastMousePressTime(QTime::currentTime())
{ {

@ -78,6 +78,7 @@ class UBGraphicsTextItem : public QGraphicsTextItem, public UBItem, public UBRes
{ {
mColorOnLightBackground = pColorOnLightBackground; mColorOnLightBackground = pColorOnLightBackground;
} }
virtual UBGraphicsItemDelegate *Delegate() const {return mDelegate;}
signals: signals:
void textUndoCommandAdded(UBGraphicsTextItem *textItem); void textUndoCommandAdded(UBGraphicsTextItem *textItem);
@ -96,7 +97,7 @@ class UBGraphicsTextItem : public QGraphicsTextItem, public UBItem, public UBRes
virtual QVariant itemChange(GraphicsItemChange change, const QVariant &value); virtual QVariant itemChange(GraphicsItemChange change, const QVariant &value);
private: private:
UBGraphicsItemDelegate *mDelegate; // UBGraphicsItemDelegate *mDelegate;
qreal mTextHeight; qreal mTextHeight;
int mMultiClickState; int mMultiClickState;

@ -40,6 +40,7 @@ public:
{ {
return mVideoWidget; return mVideoWidget;
} }
virtual UBGraphicsItemDelegate *Delegate() const {return mDelegate;}
public slots: public slots:

@ -29,10 +29,12 @@ class UBGraphicsScene;
class UBAbstractWidget; class UBAbstractWidget;
class UBW3CWidgetAPI; class UBW3CWidgetAPI;
class UBW3CWidgetWebStorageAPI; class UBW3CWidgetWebStorageAPI;
class UBGraphiscItem;
class UBGraphiscItemDelegate;
class UBGraphicsWidgetItem : public UBGraphicsProxyWidget class UBGraphicsWidgetItem : public UBGraphicsProxyWidget
{ {
Q_OBJECT; Q_OBJECT
public: public:
UBGraphicsWidgetItem(QGraphicsItem *parent = 0, int widgetType = 0); UBGraphicsWidgetItem(QGraphicsItem *parent = 0, int widgetType = 0);
@ -60,11 +62,13 @@ class UBGraphicsWidgetItem : public UBGraphicsProxyWidget
QMap<QString, QString> datastoreEntries() const; QMap<QString, QString> datastoreEntries() const;
void removeDatastoreEntry(const QString& key); void removeDatastoreEntry(const QString& key);
void removeAllDatastoreEntries(); void removeAllDatastoreEntries();
virtual UBGraphicsItemDelegate* Delegate() const {return mDelegate;}
virtual void remove(); virtual void remove();
void removeScript(); void removeScript();
protected: protected:
virtual void mousePressEvent(QGraphicsSceneMouseEvent *event); virtual void mousePressEvent(QGraphicsSceneMouseEvent *event);
@ -89,7 +93,7 @@ class UBGraphicsWidgetItem : public UBGraphicsProxyWidget
class UBGraphicsAppleWidgetItem : public UBGraphicsWidgetItem class UBGraphicsAppleWidgetItem : public UBGraphicsWidgetItem
{ {
Q_OBJECT; Q_OBJECT
public: public:
UBGraphicsAppleWidgetItem(const QUrl& pWidgetUrl, QGraphicsItem *parent = 0); UBGraphicsAppleWidgetItem(const QUrl& pWidgetUrl, QGraphicsItem *parent = 0);
@ -109,7 +113,7 @@ class UBGraphicsAppleWidgetItem : public UBGraphicsWidgetItem
class UBGraphicsW3CWidgetItem : public UBGraphicsWidgetItem class UBGraphicsW3CWidgetItem : public UBGraphicsWidgetItem
{ {
Q_OBJECT; Q_OBJECT
public: public:
UBGraphicsW3CWidgetItem(const QUrl& pWidgetUrl, QGraphicsItem *parent = 0, int widgetType = UBGraphicsItemType::W3CWidgetItemType); UBGraphicsW3CWidgetItem(const QUrl& pWidgetUrl, QGraphicsItem *parent = 0, int widgetType = UBGraphicsItemType::W3CWidgetItemType);

@ -24,7 +24,7 @@
class UBGraphicsWidgetItemDelegate : public UBGraphicsItemDelegate class UBGraphicsWidgetItemDelegate : public UBGraphicsItemDelegate
{ {
Q_OBJECT; Q_OBJECT
public: public:
UBGraphicsWidgetItemDelegate(UBGraphicsWidgetItem* pDelegated, int widgetType = 0); UBGraphicsWidgetItemDelegate(UBGraphicsWidgetItem* pDelegated, int widgetType = 0);

@ -16,6 +16,7 @@
#define UBITEM_H #define UBITEM_H
#include <QtGui> #include <QtGui>
#include "domain/UBGraphicsItemDelegate.h"
class UBGraphicsScene; class UBGraphicsScene;
@ -84,21 +85,23 @@ class UBItem
class UBGraphicsItem class UBGraphicsItem
{ {
protected: protected:
UBGraphicsItem() UBGraphicsItem() : mDelegate(0)
{ {
// NOOP // NOOP
} }
UBGraphicsItemDelegate* mDelegate;
virtual ~UBGraphicsItem() virtual ~UBGraphicsItem()
{ {
// NOOP // NOOP
} }
public: public:
virtual UBGraphicsItemDelegate *Delegate() const = 0;
virtual void remove() = 0;
virtual void remove() = 0;
}; };
#endif // UBITEM_H #endif // UBITEM_H

@ -228,7 +228,6 @@ void UBW3CWidget::javaScriptWindowObjectCleared()
void UBW3CWidget::votingSystemError(const QString& error) void UBW3CWidget::votingSystemError(const QString& error)
{ {
page()->mainFrame()->evaluateJavaScript("if(voting.onerror) { voting.onerror('" + error +"');}"); page()->mainFrame()->evaluateJavaScript("if(voting.onerror) { voting.onerror('" + error +"');}");
} }

@ -36,7 +36,6 @@ const QColor UBGraphicsCurtainItem::sDarkBackgroundOpaqueControlColor = QColor(6
UBGraphicsCurtainItem::UBGraphicsCurtainItem(QGraphicsItem* parent) UBGraphicsCurtainItem::UBGraphicsCurtainItem(QGraphicsItem* parent)
: QGraphicsRectItem(parent) : QGraphicsRectItem(parent)
, mDelegate(0)
{ {
mDelegate = new UBGraphicsCurtainItemDelegate(this, 0); mDelegate = new UBGraphicsCurtainItemDelegate(this, 0);
mDelegate->init(); mDelegate->init();

@ -28,7 +28,7 @@ class UBGraphicsItemDelegate;
class UBGraphicsCurtainItem : public QObject, public QGraphicsRectItem, public UBItem, public UBGraphicsItem class UBGraphicsCurtainItem : public QObject, public QGraphicsRectItem, public UBItem, public UBGraphicsItem
{ {
Q_OBJECT; Q_OBJECT
public: public:
UBGraphicsCurtainItem(QGraphicsItem* parent = 0); UBGraphicsCurtainItem(QGraphicsItem* parent = 0);
@ -47,6 +47,7 @@ class UBGraphicsCurtainItem : public QObject, public QGraphicsRectItem, public U
//TODO UB 4.x not nice ... //TODO UB 4.x not nice ...
void triggerRemovedSignal(); void triggerRemovedSignal();
virtual UBGraphicsItemDelegate* Delegate() const {return mDelegate;}
signals: signals:
@ -65,7 +66,7 @@ class UBGraphicsCurtainItem : public QObject, public QGraphicsRectItem, public U
QColor drawColor() const; QColor drawColor() const;
QColor opaqueControlColor() const; QColor opaqueControlColor() const;
UBGraphicsItemDelegate* mDelegate; // UBGraphicsItemDelegate* mDelegate;
static const QColor sDrawColor; static const QColor sDrawColor;
static const QColor sDarkBackgroundDrawColor; static const QColor sDarkBackgroundDrawColor;

Loading…
Cancel
Save