UBDocumentProxy.h 2.87 KB
Newer Older
Claudio Valerio's avatar
Claudio Valerio committed
1
/*
Claudio Valerio's avatar
Claudio Valerio committed
2 3 4 5
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
Claudio Valerio's avatar
Claudio Valerio committed
6
 *
Claudio Valerio's avatar
Claudio Valerio committed
7 8 9 10 11 12 13
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
Claudio Valerio's avatar
Claudio Valerio committed
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47
 */

#ifndef UBDOCUMENTPROXY_H_
#define UBDOCUMENTPROXY_H_

#include <QtGui>

#include "frameworks/UBStringUtils.h"

#include "core/UBSettings.h"

class UBGraphicsScene;

class UBDocumentProxy : public QObject
{
    Q_OBJECT;

    public:

        UBDocumentProxy();
        UBDocumentProxy(const QString& pPersistencePath);

        virtual ~UBDocumentProxy();

        QString persistencePath() const;

        void setPersistencePath(const QString& pPersistencePath);

        void setMetaData(const QString& pKey , const QVariant& pValue);
        QVariant metaData(const QString& pKey) const;
        QHash<QString, QVariant> metaDatas() const;

        QString name() const;
        QString groupName() const;
48 49 50 51 52 53
        QString sessionTitle() const;
        void setSessionTitle(const QString& sessionTitle);
        QString sessionTarget() const;
        void setSessionTarget(const QString& sessionTarget);
        QString sessionLicence() const;
        void setSessionLicence(const QString& sessionLicence);
shibakaneki's avatar
shibakaneki committed
54 55 56 57 58 59 60 61
        void setSessionKeywords(const QString& kw);
        QString sessionKeywords();
        void setSessionLevel(const QString& level);
        QString sessionLevel();
        void setSessionTopic(const QString& topic);
        QString sessionTopic();
        void setSessionAuthor(const QString& authors);
        QString sessionAuthors();
62
        QString documentDate();
shibakaneki's avatar
shibakaneki committed
63

Claudio Valerio's avatar
Claudio Valerio committed
64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107

        QSize defaultDocumentSize() const;
        void setDefaultDocumentSize(QSize pSize);
        void setDefaultDocumentSize(int pWidth, int pHeight);

        QUuid uuid() const;
        void setUuid(const QUuid& uuid);

        bool isModified() const;

        int pageCount();
        void setPageCount(int pPageCount);
        int incPageCount();
        int decPageCount();

    signals:
        void defaultDocumentSizeChanged();

    private:

        void init();

        QString mPersistencePath;

        QHash<QString, QVariant> mMetaDatas;

        bool mIsModified;

        int mPageCount;

};

inline bool operator==(const UBDocumentProxy &proxy1, const UBDocumentProxy &proxy2)
{
    return proxy1.persistencePath() == proxy2.persistencePath();
}

inline uint qHash(const UBDocumentProxy &key)
{
    return qHash(key.persistencePath());
}


#endif /* UBDOCUMENTPROXY_H_ */