source: terepaima/terepaima-0.4.16/sources/psmodel.h

desarrollostretch
Last change on this file was 1f4adec, checked in by aosorio <aosorio@…>, 8 years ago

Agregado proyecto base, esto luego del dh_make -f

  • Property mode set to 100644
File size: 3.1 KB
Line 
1/*
2
3Copyright 2013 Alexander Volkov
4Copyright 2013 Adam Reichold
5
6This file is part of qpdfview.
7
8qpdfview is free software: you can redistribute it and/or modify
9it under the terms of the GNU General Public License as published by
10the Free Software Foundation, either version 2 of the License, or
11(at your option) any later version.
12
13qpdfview is distributed in the hope that it will be useful,
14but WITHOUT ANY WARRANTY; without even the implied warranty of
15MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16GNU General Public License for more details.
17
18You should have received a copy of the GNU General Public License
19along with qpdfview.  If not, see <http://www.gnu.org/licenses/>.
20
21*/
22
23#ifndef PSMODEL_H
24#define PSMODEL_H
25
26#include <QCoreApplication>
27#include <QMutex>
28
29class QFormLayout;
30class QSettings;
31class QSpinBox;
32
33struct SpectrePage;
34struct SpectreDocument;
35struct SpectreRenderContext;
36
37#include "model.h"
38
39namespace qpdfview
40{
41
42class PsPlugin;
43
44namespace Model
45{
46    class PsPage : public Page
47    {
48        friend class PsDocument;
49
50    public:
51        ~PsPage();
52
53        QSizeF size() const;
54
55        QImage render(qreal horizontalResolution, qreal verticalResolution, Rotation rotation, const QRect& boundingRect) const;
56
57    private:
58        Q_DISABLE_COPY(PsPage)
59
60        PsPage(QMutex* mutex, SpectrePage* page, SpectreRenderContext* renderContext);
61
62        mutable QMutex* m_mutex;
63        SpectrePage* m_page;
64        SpectreRenderContext* m_renderContext;
65
66    };
67
68    class PsDocument : public Document
69    {
70        Q_DECLARE_TR_FUNCTIONS(Model::PsDocument)
71
72        friend class qpdfview::PsPlugin;
73
74    public:
75        ~PsDocument();
76
77        int numberOfPages() const;
78
79        Page* page(int index) const;
80
81        QStringList saveFilter() const;
82
83        bool canSave() const;
84        bool save(const QString& filePath, bool withChanges) const;
85
86        bool canBePrintedUsingCUPS() const;
87
88        void loadProperties(QStandardItemModel* propertiesModel) const;
89
90    private:
91        Q_DISABLE_COPY(PsDocument)
92
93        PsDocument(SpectreDocument* document, SpectreRenderContext* renderContext);
94
95        mutable QMutex m_mutex;
96        SpectreDocument* m_document;
97        SpectreRenderContext* m_renderContext;
98
99    };
100}
101
102class PsSettingsWidget : public SettingsWidget
103{
104    Q_OBJECT
105
106public:
107    PsSettingsWidget(QSettings* settings, QWidget* parent = 0);
108
109    void accept();
110    void reset();
111
112private:
113    Q_DISABLE_COPY(PsSettingsWidget)
114
115    QSettings* m_settings;
116
117    QFormLayout* m_layout;
118
119    QSpinBox* m_graphicsAntialiasBitsSpinBox;
120    QSpinBox* m_textAntialiasBitsSpinBox;
121
122};
123
124class PsPlugin : public QObject, Plugin
125{
126    Q_OBJECT
127    Q_INTERFACES(qpdfview::Plugin)
128
129#if QT_VERSION >= QT_VERSION_CHECK(5,0,0)
130
131    Q_PLUGIN_METADATA(IID "local.qpdfview.Plugin")
132
133#endif // QT_VERSION
134
135public:
136    PsPlugin(QObject* parent = 0);
137
138    Model::Document* loadDocument(const QString& filePath) const;
139
140    SettingsWidget* createSettingsWidget(QWidget* parent) const;
141
142private:
143    Q_DISABLE_COPY(PsPlugin)
144
145    QSettings* m_settings;
146
147};
148
149} // qpdfview
150
151#endif // PSMODEL_H
Note: See TracBrowser for help on using the repository browser.