1 /***************************************************************************
2 titledocument.h - description
5 copyright : (C) 2008 by Marco Gittler
6 email : g.marco@freenet.de
7 ***************************************************************************/
9 /***************************************************************************
11 * This program is free software; you can redistribute it and/or modify *
12 * it under the terms of the GNU General Public License as published by *
13 * the Free Software Foundation; either version 2 of the License, or *
14 * (at your option) any later version. *
16 ***************************************************************************/
17 #ifndef TITLEDOCUMENT_H
18 #define TITLEDOCUMENT_H
20 #include <QDomDocument>
25 class QGraphicsRectItem;
28 const int ROTATEFACTOR = 103;
29 const int ZOOMFACTOR = 104;
36 void setScene(QGraphicsScene* scene, int width, int height);
37 bool saveDocument(const KUrl& url, QGraphicsRectItem* startv, QGraphicsRectItem* endv, int duration, bool embed_images = false);
38 QDomDocument xml(QGraphicsRectItem* startv, QGraphicsRectItem* endv, bool embed_images = false);
39 int loadFromXml(QDomDocument doc, QGraphicsRectItem* startv, QGraphicsRectItem* endv, int *duration, const QString& projectpath = QString());
40 /** \brief Get the background color (incl. alpha) from the document, if possibly
41 * \returns The background color of the document, inclusive alpha. If none found, returns (0,0,0,0) */
42 QColor getBackgroundColor();
43 int frameWidth() const;
44 int frameHeight() const;
45 /** \brief Extract embeded images in project titles folder. */
46 static const QString extractBase64Image(const QString &titlePath, const QString &data);
48 enum ItemOrigin {OriginXLeft = 0, OriginYTop = 1};
49 enum AxisPosition {AxisDefault = 0, AxisInverted = 1};
52 QGraphicsScene* m_scene;
53 QString m_projectPath;
56 QString colorToString(const QColor&);
57 QString rectFToString(const QRectF&);
58 QRectF stringToRect(const QString &);
59 QColor stringToColor(const QString &);
60 QTransform stringToTransform(const QString &);
61 QList<QVariant> stringToList(const QString &);
62 int base64ToUrl(QGraphicsItem* item, QDomElement& content, bool embed);