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

preferencesAboutTextFull
shibakaneki 13 years ago
commit 73b81093e0
  1. 1666
      src/adaptors/UBCFFSubsetAdaptor.cpp
  2. 90
      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. 7
      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 QTransform;
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
{
@ -52,22 +44,9 @@ public:
private:
class UBCFFSubsetReader
{
//xml parse states definition
enum
{
NONE,
IWB,
SVG,
PAGESET,
PAGE,
TEXTAREA,
TSPAN
};
public:
UBCFFSubsetReader(UBDocumentProxy *proxy, QFile *content);
QXmlStreamReader mReader;
UBDocumentProxy *mProxy;
QString pwdContent;
@ -79,6 +58,8 @@ private:
QRectF mCurrentSceneRect;
QString mIndent;
QRectF mViewBox;
QRectF mViewPort;
qreal mVBTransFactor;
QPointF mViewBoxCenter;
QSize mSize;
@ -86,8 +67,8 @@ private:
// to kill
QDomDocument mDOMdoc;
QDomNode mCurrentDOMElement;
QHash<QString, IwbExt> iwbExtProperties;
QHash<QString, UBGraphicsItemDelegate*> persistedItems;
QHash<QString, UBGraphicsItem*> persistedItems;
QDir mTmpFlashDir;
bool hashElements();
void addExtentionsToHash(QDomElement *parent, QDomElement *topGroup);
@ -99,6 +80,8 @@ private:
bool parseSvgPage(const QDomElement &parent);
bool parseSvgPageset(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 parseSvgEllipse(const QDomElement &element);
@ -107,61 +90,44 @@ private:
inline bool parseSvgText(const QDomElement &element);
inline bool parseSvgTextarea(const QDomElement &element);
inline bool parseSvgImage(const QDomElement &element);
// inline bool parseSvgTSpan(const QDomElement)
bool parseIwbGroup(QDomNode *element);
inline void hashSceneItem(QDomNode *element, UBGraphicsItemDelegate *item);
inline bool parseSvgFlash(const QDomElement &element);
inline bool parseSvgAudio(const QDomElement &element);
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
void parseTextAttributes(const QDomElement &element, qreal &fontSize, QColor &fontColor,
QString &fontFamily, QString &fontStretch, bool &italic,
int &fontWeight, int &textAlign, QTransform &fontTransform);
//methods to store current xml parse state
int PopState();
void PushState(int state);
//elements parsing methods
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 persistCurrentScene();
QStack<int> stateStack;
int currentState;
// helper methods
bool getCurElementTransorm(QTransform &transform);
void repositionSvgItem(UBGraphicsSvgItem *item, qreal width, qreal height, qreal x, qreal y, bool useTransform, QTransform &transform);
void repositionPixmapItem(UBGraphicsPixmapItem *item, qreal width, qreal height, qreal x, qreal y
, bool useTransform, QTransform &transform);
// bool getCurElementTransorm(QTransform &transform);
void repositionSvgItem(QGraphicsItem *item, qreal width, qreal height,
qreal x, qreal y,
bool useTransform, QTransform &transform);
void experimentalReposition(QGraphicsItem *item, qreal width, qreal height,
qreal x, qreal y,
bool useTransform, QTransform &transform);
QColor colorFromString(const QString& clrString);
QTransform transformFromString(const QString trString);
bool getViewBoxDimenstions(const QString& viewBox);
QSvgGenerator* createSvgGenerator(qreal width, qreal height);
bool getTempFileName();
void parseTextAttributes(qreal &fontSize, QColor &fontColor,
QString &fontFamily, QString &fontStretch, bool &italic,
int &fontWeight, int &textAlign, QTransform &fontTransform);
inline bool strToBool(QString);
bool createTempFlashPath();
};
};

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

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

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

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

@ -45,11 +45,13 @@ class UBGraphicsPixmapItem : public QObject, public QGraphicsPixmapItem, public
virtual void remove();
Q_PROPERTY(qreal opacity READ opacity WRITE setOpacity);
Q_PROPERTY(qreal opacity READ opacity WRITE setOpacity)
void setOpacity(qreal op);
qreal opacity() const;
virtual UBGraphicsItemDelegate* Delegate() const {return mDelegate;}
protected:
virtual void mousePressEvent(QGraphicsSceneMouseEvent *event);
@ -60,7 +62,8 @@ protected:
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();
UBGraphicsItemDelegate* delegate (){ return mDelegate;}
virtual UBGraphicsItemDelegate* Delegate() const { return mDelegate;}
protected:
@ -53,7 +53,7 @@ class UBGraphicsProxyWidget: public QGraphicsProxyWidget, public UBItem, public
virtual QVariant itemChange(GraphicsItemChange change, const QVariant &value);
UBGraphicsItemDelegate* mDelegate;
// UBGraphicsItemDelegate* mDelegate;
};
#endif /* UBGRAPHICSPROXYWIDGET_H_ */

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

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

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

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

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

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

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

@ -16,6 +16,7 @@
#define UBITEM_H
#include <QtGui>
#include "domain/UBGraphicsItemDelegate.h"
class UBGraphicsScene;
@ -86,10 +87,11 @@ class UBGraphicsItem
{
protected:
UBGraphicsItem()
UBGraphicsItem() : mDelegate(0)
{
// NOOP
}
UBGraphicsItemDelegate* mDelegate;
virtual ~UBGraphicsItem()
{
@ -97,8 +99,9 @@ class UBGraphicsItem
}
public:
virtual UBGraphicsItemDelegate *Delegate() const = 0;
virtual void remove() = 0;
};
#endif // UBITEM_H

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

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

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

Loading…
Cancel
Save