[1f4adec] | 1 | /* |
---|
| 2 | |
---|
| 3 | Copyright 2012-2013 Adam Reichold |
---|
| 4 | |
---|
| 5 | This file is part of qpdfview. |
---|
| 6 | |
---|
| 7 | qpdfview is free software: you can redistribute it and/or modify |
---|
| 8 | it under the terms of the GNU General Public License as published by |
---|
| 9 | the Free Software Foundation, either version 2 of the License, or |
---|
| 10 | (at your option) any later version. |
---|
| 11 | |
---|
| 12 | qpdfview is distributed in the hope that it will be useful, |
---|
| 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
| 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
| 15 | GNU General Public License for more details. |
---|
| 16 | |
---|
| 17 | You should have received a copy of the GNU General Public License |
---|
| 18 | along with qpdfview. If not, see <http://www.gnu.org/licenses/>. |
---|
| 19 | |
---|
| 20 | */ |
---|
| 21 | |
---|
| 22 | #ifndef ANNOTATIONWIDGETS_H |
---|
| 23 | #define ANNOTATIONWIDGETS_H |
---|
| 24 | |
---|
| 25 | #include <QPlainTextEdit> |
---|
| 26 | #include <QToolButton> |
---|
| 27 | |
---|
| 28 | class QMutex; |
---|
| 29 | |
---|
| 30 | namespace Poppler |
---|
| 31 | { |
---|
| 32 | class Annotation; |
---|
| 33 | class FileAttachmentAnnotation; |
---|
| 34 | } |
---|
| 35 | |
---|
| 36 | namespace qpdfview |
---|
| 37 | { |
---|
| 38 | |
---|
| 39 | class AnnotationWidget : public QPlainTextEdit |
---|
| 40 | { |
---|
| 41 | Q_OBJECT |
---|
| 42 | |
---|
| 43 | public: |
---|
| 44 | AnnotationWidget(QMutex* mutex, Poppler::Annotation* annotation, QWidget* parent = 0); |
---|
| 45 | |
---|
| 46 | signals: |
---|
| 47 | void wasModified(); |
---|
| 48 | |
---|
| 49 | protected: |
---|
| 50 | void keyPressEvent(QKeyEvent* event); |
---|
| 51 | |
---|
| 52 | protected slots: |
---|
| 53 | void on_textChanged(); |
---|
| 54 | |
---|
| 55 | private: |
---|
| 56 | Q_DISABLE_COPY(AnnotationWidget) |
---|
| 57 | |
---|
| 58 | QMutex* m_mutex; |
---|
| 59 | Poppler::Annotation* m_annotation; |
---|
| 60 | |
---|
| 61 | }; |
---|
| 62 | |
---|
| 63 | |
---|
| 64 | class FileAttachmentAnnotationWidget : public QToolButton |
---|
| 65 | { |
---|
| 66 | Q_OBJECT |
---|
| 67 | |
---|
| 68 | public: |
---|
| 69 | FileAttachmentAnnotationWidget(QMutex* mutex, Poppler::FileAttachmentAnnotation* annotation, QWidget* parent = 0); |
---|
| 70 | |
---|
| 71 | protected: |
---|
| 72 | void keyPressEvent(QKeyEvent* event); |
---|
| 73 | |
---|
| 74 | protected slots: |
---|
| 75 | void on_aboutToShow(); |
---|
| 76 | void on_aboutToHide(); |
---|
| 77 | |
---|
| 78 | void on_save_triggered(); |
---|
| 79 | void on_saveAndOpen_triggered(); |
---|
| 80 | |
---|
| 81 | private: |
---|
| 82 | Q_DISABLE_COPY(FileAttachmentAnnotationWidget) |
---|
| 83 | |
---|
| 84 | QMutex* m_mutex; |
---|
| 85 | Poppler::FileAttachmentAnnotation* m_annotation; |
---|
| 86 | |
---|
| 87 | void save(bool open = false); |
---|
| 88 | |
---|
| 89 | QMenu* m_menu; |
---|
| 90 | QAction* m_saveAction; |
---|
| 91 | QAction* m_saveAndOpenAction; |
---|
| 92 | |
---|
| 93 | }; |
---|
| 94 | |
---|
| 95 | } // qpdfview |
---|
| 96 | |
---|
| 97 | #endif // ANNOTATIONWIDGETS_H |
---|