Changeset View
Changeset View
Standalone View
Standalone View
ui/annotationwidgets.h
| Show All 11 Lines | |||||
| 12 | 12 | | |||
| 13 | #include <qwidget.h> | 13 | #include <qwidget.h> | ||
| 14 | 14 | | |||
| 15 | #include "core/annotations.h" | 15 | #include "core/annotations.h" | ||
| 16 | 16 | | |||
| 17 | class QCheckBox; | 17 | class QCheckBox; | ||
| 18 | class QComboBox; | 18 | class QComboBox; | ||
| 19 | class QDoubleSpinBox; | 19 | class QDoubleSpinBox; | ||
| 20 | class QFormLayout; | ||||
| 20 | class QLabel; | 21 | class QLabel; | ||
| 21 | class QWidget; | 22 | class QWidget; | ||
| 22 | class KColorButton; | 23 | class KColorButton; | ||
| 23 | class QSpinBox; | 24 | class QSpinBox; | ||
| 24 | class KFontRequester; | 25 | class KFontRequester; | ||
| 25 | class AnnotationWidget; | 26 | class AnnotationWidget; | ||
| 26 | 27 | | |||
| 27 | class PixmapPreviewSelector | 28 | class PixmapPreviewSelector | ||
| ▲ Show 20 Lines • Show All 55 Lines • ▼ Show 20 Line(s) | 75 | public: | |||
| 83 | virtual void applyChanges(); | 84 | virtual void applyChanges(); | ||
| 84 | 85 | | |||
| 85 | Q_SIGNALS: | 86 | Q_SIGNALS: | ||
| 86 | void dataChanged(); | 87 | void dataChanged(); | ||
| 87 | 88 | | |||
| 88 | protected: | 89 | protected: | ||
| 89 | QWidget * createAppearanceWidget(); | 90 | QWidget * createAppearanceWidget(); | ||
| 90 | 91 | | |||
| 91 | virtual QWidget * createStyleWidget(); | 92 | virtual void createStyleWidget(QFormLayout * formLayout); | ||
| 92 | virtual QWidget * createExtraWidget(); | 93 | virtual QWidget * createExtraWidget(); | ||
| 93 | 94 | | |||
| 94 | private: | 95 | void addColorButton( QWidget * widget, QFormLayout * formlayout ); | ||
| 95 | virtual bool hasColorButton() const { return true; } | 96 | void addOpacitySpinBox( QWidget * widget, QFormLayout * formlayout ); | ||
| 96 | virtual bool hasOpacityBox() const { return true; } | 97 | void addVerticalSpacer( QFormLayout * formlayout ); | ||
| 97 | 98 | | |||
| 99 | private: | ||||
| 98 | Okular::Annotation * m_ann; | 100 | Okular::Annotation * m_ann; | ||
| 99 | QWidget * m_appearanceWidget { nullptr }; | 101 | QWidget * m_appearanceWidget { nullptr }; | ||
| 100 | QWidget * m_extraWidget { nullptr }; | 102 | QWidget * m_extraWidget { nullptr }; | ||
| 101 | KColorButton *m_colorBn { nullptr }; | 103 | KColorButton *m_colorBn { nullptr }; | ||
| 102 | QSpinBox *m_opacity { nullptr }; | 104 | QSpinBox *m_opacity { nullptr }; | ||
| 103 | }; | 105 | }; | ||
| 104 | 106 | | |||
| 105 | class QVBoxLayout; | 107 | class QVBoxLayout; | ||
| 106 | class QGridLayout; | 108 | class QFormLayout; | ||
| 107 | 109 | | |||
| 108 | class TextAnnotationWidget | 110 | class TextAnnotationWidget | ||
| 109 | : public AnnotationWidget | 111 | : public AnnotationWidget | ||
| 110 | { | 112 | { | ||
| 111 | Q_OBJECT | 113 | Q_OBJECT | ||
| 112 | 114 | | |||
| 113 | public: | 115 | public: | ||
| 114 | explicit TextAnnotationWidget( Okular::Annotation * ann ); | 116 | explicit TextAnnotationWidget( Okular::Annotation * ann ); | ||
| 115 | 117 | | |||
| 116 | void applyChanges() override; | 118 | void applyChanges() override; | ||
| 117 | 119 | | |||
| 118 | protected: | 120 | protected: | ||
| 119 | QWidget * createStyleWidget() override; | 121 | void createStyleWidget(QFormLayout * formlayout) override; | ||
| 120 | 122 | | |||
| 121 | private: | 123 | private: | ||
| 122 | virtual bool hasColorButton() const override; | | |||
| 123 | virtual bool hasOpacityBox() const override; | | |||
| 124 | 124 | | |||
| 125 | void createPopupNoteStyleUi( QWidget * widget, QVBoxLayout * layout ); | 125 | void createPopupNoteStyleUi( QWidget * widget, QFormLayout * formlayout ); | ||
| 126 | void createInlineNoteStyleUi( QWidget * widget, QVBoxLayout * layout ); | 126 | void createInlineNoteStyleUi( QWidget * widget, QFormLayout * formlayout ); | ||
| 127 | void createTypewriterStyleUi( QWidget * widget, QVBoxLayout * layout ); | 127 | void createTypewriterStyleUi( QWidget * widget, QFormLayout * formlayout ); | ||
| 128 | void addPixmapSelector( QWidget * widget, QLayout * layout ); | 128 | void addPixmapSelector( QWidget * widget, QFormLayout * formlayout ); | ||
| 129 | void addFontRequester( QWidget * widget, QGridLayout * layout ); | 129 | void addFontRequester( QWidget * widget, QFormLayout * formlayout ); | ||
| 130 | void addTextColorButton( QWidget * widget, QGridLayout * layout ); | 130 | void addTextColorButton( QWidget * widget, QFormLayout * formlayout ); | ||
| 131 | void addTextAlignComboBox( QWidget * widget, QGridLayout * layout ); | 131 | void addTextAlignComboBox( QWidget * widget, QFormLayout * formlayout ); | ||
| 132 | void addWidthSpinBox( QWidget * widget, QGridLayout * layout ); | 132 | void addWidthSpinBox( QWidget * widget, QFormLayout * formlayout ); | ||
| 133 | 133 | | |||
| 134 | inline bool isTypewriter() const { return ( m_textAnn->inplaceIntent() == Okular::TextAnnotation::TypeWriter ); } | 134 | inline bool isTypewriter() const { return ( m_textAnn->inplaceIntent() == Okular::TextAnnotation::TypeWriter ); } | ||
| 135 | 135 | | |||
| 136 | Okular::TextAnnotation * m_textAnn; | 136 | Okular::TextAnnotation * m_textAnn; | ||
| 137 | PixmapPreviewSelector * m_pixmapSelector { nullptr }; | 137 | PixmapPreviewSelector * m_pixmapSelector { nullptr }; | ||
| 138 | KFontRequester * m_fontReq { nullptr }; | 138 | KFontRequester * m_fontReq { nullptr }; | ||
| 139 | KColorButton *m_textColorBn { nullptr }; | 139 | KColorButton *m_textColorBn { nullptr }; | ||
| 140 | QComboBox * m_textAlign { nullptr }; | 140 | QComboBox * m_textAlign { nullptr }; | ||
| 141 | QDoubleSpinBox * m_spinWidth { nullptr }; | 141 | QDoubleSpinBox * m_spinWidth { nullptr }; | ||
| 142 | }; | 142 | }; | ||
| 143 | 143 | | |||
| 144 | class StampAnnotationWidget | 144 | class StampAnnotationWidget | ||
| 145 | : public AnnotationWidget | 145 | : public AnnotationWidget | ||
| 146 | { | 146 | { | ||
| 147 | Q_OBJECT | 147 | Q_OBJECT | ||
| 148 | 148 | | |||
| 149 | public: | 149 | public: | ||
| 150 | explicit StampAnnotationWidget( Okular::Annotation * ann ); | 150 | explicit StampAnnotationWidget( Okular::Annotation * ann ); | ||
| 151 | 151 | | |||
| 152 | void applyChanges() override; | 152 | void applyChanges() override; | ||
| 153 | 153 | | |||
| 154 | protected: | 154 | protected: | ||
| 155 | QWidget * createStyleWidget() override; | 155 | void createStyleWidget(QFormLayout * formlayout) override; | ||
| 156 | 156 | | |||
| 157 | private: | 157 | private: | ||
| 158 | Okular::StampAnnotation * m_stampAnn; | 158 | Okular::StampAnnotation * m_stampAnn; | ||
| 159 | PixmapPreviewSelector * m_pixmapSelector; | 159 | PixmapPreviewSelector * m_pixmapSelector; | ||
| 160 | }; | 160 | }; | ||
| 161 | 161 | | |||
| 162 | class LineAnnotationWidget | 162 | class LineAnnotationWidget | ||
| 163 | : public AnnotationWidget | 163 | : public AnnotationWidget | ||
| 164 | { | 164 | { | ||
| 165 | Q_OBJECT | 165 | Q_OBJECT | ||
| 166 | 166 | | |||
| 167 | public: | 167 | public: | ||
| 168 | explicit LineAnnotationWidget( Okular::Annotation * ann ); | 168 | explicit LineAnnotationWidget( Okular::Annotation * ann ); | ||
| 169 | 169 | | |||
| 170 | void applyChanges() override; | 170 | void applyChanges() override; | ||
| 171 | 171 | | |||
| 172 | protected: | 172 | protected: | ||
| 173 | QWidget * createStyleWidget() override; | 173 | void createStyleWidget(QFormLayout * formlayout) override; | ||
| 174 | 174 | | |||
| 175 | private: | 175 | private: | ||
| 176 | Okular::LineAnnotation * m_lineAnn; | 176 | Okular::LineAnnotation * m_lineAnn; | ||
| 177 | int m_lineType; | 177 | int m_lineType; | ||
| 178 | QDoubleSpinBox * m_spinLL { nullptr }; | 178 | QDoubleSpinBox * m_spinLL { nullptr }; | ||
| 179 | QDoubleSpinBox * m_spinLLE { nullptr }; | 179 | QDoubleSpinBox * m_spinLLE { nullptr }; | ||
| 180 | QCheckBox * m_useColor { nullptr }; | 180 | QCheckBox * m_useColor { nullptr }; | ||
| 181 | KColorButton * m_innerColor { nullptr }; | 181 | KColorButton * m_innerColor { nullptr }; | ||
| 182 | QDoubleSpinBox * m_spinSize { nullptr }; | 182 | QDoubleSpinBox * m_spinSize { nullptr }; | ||
| 183 | QComboBox * m_startStyleCombo { nullptr }; | 183 | QComboBox * m_startStyleCombo { nullptr }; | ||
| 184 | QComboBox * m_endStyleCombo { nullptr }; | 184 | QComboBox * m_endStyleCombo { nullptr }; | ||
| 185 | }; | 185 | }; | ||
| 186 | 186 | | |||
| 187 | class HighlightAnnotationWidget | 187 | class HighlightAnnotationWidget | ||
| 188 | : public AnnotationWidget | 188 | : public AnnotationWidget | ||
| 189 | { | 189 | { | ||
| 190 | Q_OBJECT | 190 | Q_OBJECT | ||
| 191 | 191 | | |||
| 192 | public: | 192 | public: | ||
| 193 | explicit HighlightAnnotationWidget( Okular::Annotation * ann ); | 193 | explicit HighlightAnnotationWidget( Okular::Annotation * ann ); | ||
| 194 | 194 | | |||
| 195 | void applyChanges() override; | 195 | void applyChanges() override; | ||
| 196 | 196 | | |||
| 197 | protected: | 197 | protected: | ||
| 198 | QWidget * createStyleWidget() override; | 198 | void createStyleWidget(QFormLayout * formlayout) override; | ||
| 199 | 199 | | |||
| 200 | private: | 200 | private: | ||
| 201 | Okular::HighlightAnnotation * m_hlAnn; | 201 | Okular::HighlightAnnotation * m_hlAnn; | ||
| 202 | QComboBox * m_typeCombo; | 202 | QComboBox * m_typeCombo; | ||
| 203 | }; | 203 | }; | ||
| 204 | 204 | | |||
| 205 | class GeomAnnotationWidget | 205 | class GeomAnnotationWidget | ||
| 206 | : public AnnotationWidget | 206 | : public AnnotationWidget | ||
| 207 | { | 207 | { | ||
| 208 | Q_OBJECT | 208 | Q_OBJECT | ||
| 209 | 209 | | |||
| 210 | public: | 210 | public: | ||
| 211 | explicit GeomAnnotationWidget( Okular::Annotation * ann ); | 211 | explicit GeomAnnotationWidget( Okular::Annotation * ann ); | ||
| 212 | 212 | | |||
| 213 | void applyChanges() override; | 213 | void applyChanges() override; | ||
| 214 | 214 | | |||
| 215 | protected: | 215 | protected: | ||
| 216 | QWidget * createStyleWidget() override; | 216 | void createStyleWidget(QFormLayout * formlayout) override; | ||
| 217 | 217 | | |||
| 218 | private: | 218 | private: | ||
| 219 | Okular::GeomAnnotation * m_geomAnn; | 219 | Okular::GeomAnnotation * m_geomAnn; | ||
| 220 | QComboBox * m_typeCombo; | 220 | QComboBox * m_typeCombo; | ||
| 221 | QCheckBox * m_useColor; | 221 | QCheckBox * m_useColor; | ||
| 222 | KColorButton * m_innerColor; | 222 | KColorButton * m_innerColor; | ||
| 223 | QDoubleSpinBox * m_spinSize; | 223 | QDoubleSpinBox * m_spinSize; | ||
| 224 | }; | 224 | }; | ||
| 225 | 225 | | |||
| 226 | class FileAttachmentAnnotationWidget | 226 | class FileAttachmentAnnotationWidget | ||
| 227 | : public AnnotationWidget | 227 | : public AnnotationWidget | ||
| 228 | { | 228 | { | ||
| 229 | Q_OBJECT | 229 | Q_OBJECT | ||
| 230 | 230 | | |||
| 231 | public: | 231 | public: | ||
| 232 | explicit FileAttachmentAnnotationWidget( Okular::Annotation * ann ); | 232 | explicit FileAttachmentAnnotationWidget( Okular::Annotation * ann ); | ||
| 233 | 233 | | |||
| 234 | void applyChanges() override; | 234 | void applyChanges() override; | ||
| 235 | 235 | | |||
| 236 | protected: | 236 | protected: | ||
| 237 | QWidget * createStyleWidget() override; | 237 | void createStyleWidget(QFormLayout * formlayout) override; | ||
| 238 | QWidget * createExtraWidget() override; | 238 | QWidget * createExtraWidget() override; | ||
| 239 | 239 | | |||
| 240 | private: | 240 | private: | ||
| 241 | Okular::FileAttachmentAnnotation * m_attachAnn; | 241 | Okular::FileAttachmentAnnotation * m_attachAnn; | ||
| 242 | PixmapPreviewSelector * m_pixmapSelector; | 242 | PixmapPreviewSelector * m_pixmapSelector; | ||
| 243 | }; | 243 | }; | ||
| 244 | 244 | | |||
| 245 | class CaretAnnotationWidget | 245 | class CaretAnnotationWidget | ||
| 246 | : public AnnotationWidget | 246 | : public AnnotationWidget | ||
| 247 | { | 247 | { | ||
| 248 | Q_OBJECT | 248 | Q_OBJECT | ||
| 249 | 249 | | |||
| 250 | public: | 250 | public: | ||
| 251 | explicit CaretAnnotationWidget( Okular::Annotation * ann ); | 251 | explicit CaretAnnotationWidget( Okular::Annotation * ann ); | ||
| 252 | 252 | | |||
| 253 | void applyChanges() override; | 253 | void applyChanges() override; | ||
| 254 | 254 | | |||
| 255 | protected: | 255 | protected: | ||
| 256 | QWidget * createStyleWidget() override; | 256 | void createStyleWidget(QFormLayout * formlayout) override; | ||
| 257 | 257 | | |||
| 258 | private: | 258 | private: | ||
| 259 | Okular::CaretAnnotation * m_caretAnn; | 259 | Okular::CaretAnnotation * m_caretAnn; | ||
| 260 | PixmapPreviewSelector * m_pixmapSelector; | 260 | PixmapPreviewSelector * m_pixmapSelector; | ||
| 261 | }; | 261 | }; | ||
| 262 | 262 | | |||
| 263 | class InkAnnotationWidget | 263 | class InkAnnotationWidget | ||
| 264 | : public AnnotationWidget | 264 | : public AnnotationWidget | ||
| 265 | { | 265 | { | ||
| 266 | Q_OBJECT | 266 | Q_OBJECT | ||
| 267 | 267 | | |||
| 268 | public: | 268 | public: | ||
| 269 | explicit InkAnnotationWidget( Okular::Annotation * ann ); | 269 | explicit InkAnnotationWidget( Okular::Annotation * ann ); | ||
| 270 | 270 | | |||
| 271 | void applyChanges() override; | 271 | void applyChanges() override; | ||
| 272 | 272 | | |||
| 273 | protected: | 273 | protected: | ||
| 274 | QWidget * createStyleWidget() override; | 274 | void createStyleWidget(QFormLayout * formlayout) override; | ||
| 275 | 275 | | |||
| 276 | private: | 276 | private: | ||
| 277 | Okular::InkAnnotation * m_inkAnn; | 277 | Okular::InkAnnotation * m_inkAnn; | ||
| 278 | QDoubleSpinBox * m_spinSize; | 278 | QDoubleSpinBox * m_spinSize; | ||
| 279 | }; | 279 | }; | ||
| 280 | 280 | | |||
| 281 | #endif | 281 | #endif | ||