Changeset View
Changeset View
Standalone View
Standalone View
ui/annotationwidgets.cpp
Show All 13 Lines | |||||
14 | #include <qgroupbox.h> | 14 | #include <qgroupbox.h> | ||
15 | #include <qlabel.h> | 15 | #include <qlabel.h> | ||
16 | #include <qlayout.h> | 16 | #include <qlayout.h> | ||
17 | #include <qspinbox.h> | 17 | #include <qspinbox.h> | ||
18 | #include <qvariant.h> | 18 | #include <qvariant.h> | ||
19 | #include <kcolorbutton.h> | 19 | #include <kcolorbutton.h> | ||
20 | #include <kcombobox.h> | 20 | #include <kcombobox.h> | ||
21 | #include <kfontrequester.h> | 21 | #include <kfontrequester.h> | ||
22 | #include <KMessageBox> | ||||
23 | #include <KMessageWidget> | ||||
22 | #include <QIcon> | 24 | #include <QIcon> | ||
25 | #include <QFileDialog> | ||||
23 | #include <kiconloader.h> | 26 | #include <kiconloader.h> | ||
24 | #include <KLocalizedString> | 27 | #include <KLocalizedString> | ||
25 | #include <QDebug> | 28 | #include <QDebug> | ||
26 | #include <QGuiApplication> | 29 | #include <QGuiApplication> | ||
27 | #include <QList> | 30 | #include <QList> | ||
28 | #include <QMimeDatabase> | 31 | #include <QMimeDatabase> | ||
29 | #include <QPair> | 32 | #include <QPair> | ||
30 | #include <QSize> | 33 | #include <QSize> | ||
31 | #include <KFormat> | 34 | #include <KFormat> | ||
32 | #include <QFormLayout> | 35 | #include <QFormLayout> | ||
33 | 36 | | |||
34 | #include "core/document.h" | 37 | #include "core/document.h" | ||
35 | #include "guiutils.h" | 38 | #include "guiutils.h" | ||
36 | #include "pagepainter.h" | 39 | #include "pagepainter.h" | ||
37 | 40 | | |||
38 | #define FILEATTACH_ICONSIZE 48 | 41 | #define FILEATTACH_ICONSIZE 48 | ||
39 | 42 | | |||
40 | PixmapPreviewSelector::PixmapPreviewSelector( QWidget * parent ) | 43 | PixmapPreviewSelector::PixmapPreviewSelector( QWidget * parent, PreviewPosition position ) | ||
41 | : QWidget( parent ) | 44 | : QWidget( parent ), m_previewPosition( position ) | ||
42 | { | 45 | { | ||
43 | QHBoxLayout * mainlay = new QHBoxLayout( this ); | 46 | QVBoxLayout * mainlay = new QVBoxLayout( this ); | ||
44 | mainlay->setMargin( 0 ); | 47 | mainlay->setContentsMargins( 0, 0, 0, 0 ); | ||
48 | QHBoxLayout * toplay = new QHBoxLayout( this ); | ||||
49 | toplay->setContentsMargins( 0, 0, 0, 0 ); | ||||
50 | mainlay->addLayout( toplay ); | ||||
45 | m_comboItems = new KComboBox( this ); | 51 | m_comboItems = new KComboBox( this ); | ||
46 | mainlay->addWidget( m_comboItems ); | 52 | toplay->addWidget( m_comboItems ); | ||
47 | mainlay->setAlignment( m_comboItems, Qt::AlignTop ); | 53 | m_stampPushButton = new QPushButton(QIcon::fromTheme( "document-open" ), QString(), this ); | ||
54 | m_stampPushButton->setVisible( false ); | ||||
55 | m_stampPushButton->setToolTip( i18nc( "@info:tooltip", "Select a custom stamp symbol from file") ); | ||||
56 | toplay->addWidget(m_stampPushButton); | ||||
48 | m_iconLabel = new QLabel( this ); | 57 | m_iconLabel = new QLabel( this ); | ||
58 | switch ( m_previewPosition ) | ||||
59 | { | ||||
60 | case Side: | ||||
61 | toplay->addWidget( m_iconLabel ); | ||||
62 | break; | ||||
63 | case Below: | ||||
49 | mainlay->addWidget( m_iconLabel ); | 64 | mainlay->addWidget( m_iconLabel ); | ||
65 | mainlay->setAlignment( m_iconLabel, Qt::AlignHCenter ); | ||||
66 | break; | ||||
67 | } | ||||
50 | m_iconLabel->setSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed ); | 68 | m_iconLabel->setSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed ); | ||
51 | m_iconLabel->setAlignment( Qt::AlignCenter ); | 69 | m_iconLabel->setAlignment( Qt::AlignCenter ); | ||
52 | m_iconLabel->setFrameStyle( QFrame::StyledPanel ); | 70 | m_iconLabel->setFrameStyle( QFrame::StyledPanel ); | ||
53 | setPreviewSize( 32 ); | 71 | setPreviewSize( 32 ); | ||
54 | 72 | | |||
55 | setFocusPolicy( Qt::TabFocus ); | 73 | setFocusPolicy( Qt::TabFocus ); | ||
56 | setFocusProxy( m_comboItems ); | 74 | setFocusProxy( m_comboItems ); | ||
57 | 75 | | |||
58 | connect( m_comboItems, SIGNAL(currentIndexChanged(QString)), this, SLOT(iconComboChanged(QString)) ); | 76 | connect( m_comboItems, SIGNAL(currentIndexChanged(QString)), this, SLOT(iconComboChanged(QString)) ); | ||
59 | connect( m_comboItems, &QComboBox::editTextChanged, this, &PixmapPreviewSelector::iconComboChanged ); | 77 | connect( m_comboItems, &QComboBox::editTextChanged, this, &PixmapPreviewSelector::iconComboChanged ); | ||
78 | connect( m_stampPushButton, &QPushButton::clicked, this, &PixmapPreviewSelector::selectCustomStamp ); | ||||
60 | } | 79 | } | ||
61 | 80 | | |||
62 | PixmapPreviewSelector::~PixmapPreviewSelector() | 81 | PixmapPreviewSelector::~PixmapPreviewSelector() | ||
63 | { | 82 | { | ||
64 | } | 83 | } | ||
65 | 84 | | |||
66 | void PixmapPreviewSelector::setIcon( const QString& icon ) | 85 | void PixmapPreviewSelector::setIcon( const QString& icon ) | ||
67 | { | 86 | { | ||
Show All 20 Lines | |||||
88 | { | 107 | { | ||
89 | m_comboItems->addItem( item, QVariant( id ) ); | 108 | m_comboItems->addItem( item, QVariant( id ) ); | ||
90 | setIcon( m_icon ); | 109 | setIcon( m_icon ); | ||
91 | } | 110 | } | ||
92 | 111 | | |||
93 | void PixmapPreviewSelector::setPreviewSize( int size ) | 112 | void PixmapPreviewSelector::setPreviewSize( int size ) | ||
94 | { | 113 | { | ||
95 | m_previewSize = size; | 114 | m_previewSize = size; | ||
115 | switch( m_previewPosition ) | ||||
116 | { | ||||
117 | case Side: | ||||
96 | m_iconLabel->setFixedSize( m_previewSize + 8, m_previewSize + 8 ); | 118 | m_iconLabel->setFixedSize( m_previewSize + 8, m_previewSize + 8 ); | ||
119 | break; | ||||
120 | case Below: | ||||
121 | m_iconLabel->setFixedSize( 3 * m_previewSize + 8, m_previewSize + 8 ); | ||||
122 | break; | ||||
123 | } | ||||
97 | iconComboChanged( m_icon ); | 124 | iconComboChanged( m_icon ); | ||
98 | } | 125 | } | ||
99 | 126 | | |||
100 | int PixmapPreviewSelector::previewSize() const | 127 | int PixmapPreviewSelector::previewSize() const | ||
101 | { | 128 | { | ||
102 | return m_previewSize; | 129 | return m_previewSize; | ||
103 | } | 130 | } | ||
104 | 131 | | |||
105 | void PixmapPreviewSelector::setEditable( bool editable ) | 132 | void PixmapPreviewSelector::setEditable( bool editable ) | ||
106 | { | 133 | { | ||
107 | m_comboItems->setEditable( editable ); | 134 | m_comboItems->setEditable( editable ); | ||
135 | m_stampPushButton->setVisible( editable ); | ||||
108 | } | 136 | } | ||
109 | 137 | | |||
110 | void PixmapPreviewSelector::iconComboChanged( const QString& icon ) | 138 | void PixmapPreviewSelector::iconComboChanged( const QString& icon ) | ||
111 | { | 139 | { | ||
112 | int id = m_comboItems->findText( icon, Qt::MatchFixedString ); | 140 | int id = m_comboItems->findText( icon, Qt::MatchFixedString ); | ||
113 | if ( id >= 0 ) | 141 | if ( id >= 0 ) | ||
114 | { | 142 | { | ||
115 | m_icon = m_comboItems->itemData( id ).toString(); | 143 | m_icon = m_comboItems->itemData( id ).toString(); | ||
116 | } | 144 | } | ||
117 | else | 145 | else | ||
118 | { | 146 | { | ||
119 | m_icon = icon; | 147 | m_icon = icon; | ||
120 | } | 148 | } | ||
121 | 149 | | |||
122 | QPixmap pixmap = GuiUtils::loadStamp( m_icon, QSize(), m_previewSize ); | 150 | QPixmap pixmap = GuiUtils::loadStamp( m_icon, m_previewSize ); | ||
123 | const QRect cr = m_iconLabel->contentsRect(); | 151 | const QRect cr = m_iconLabel->contentsRect(); | ||
124 | if ( pixmap.width() > cr.width() || pixmap.height() > cr.height() ) | 152 | if ( pixmap.width() > cr.width() || pixmap.height() > cr.height() ) | ||
125 | pixmap = pixmap.scaled( cr.size(), Qt::KeepAspectRatio, Qt::SmoothTransformation ); | 153 | pixmap = pixmap.scaled( cr.size(), Qt::KeepAspectRatio, Qt::SmoothTransformation ); | ||
126 | m_iconLabel->setPixmap( pixmap ); | 154 | m_iconLabel->setPixmap( pixmap ); | ||
127 | 155 | | |||
128 | emit iconChanged( m_icon ); | 156 | emit iconChanged( m_icon ); | ||
129 | } | 157 | } | ||
130 | 158 | | |||
159 | void PixmapPreviewSelector::selectCustomStamp() | ||||
160 | { | ||||
161 | const QString customStampFile = QFileDialog::getOpenFileName(this, i18nc("@title:window file chooser", "Select custom stamp symbol"), | ||||
162 | QString(), i18n("*.ico *.png *.xpm *.svg *.svgz | Icon Files (*.ico *.png *.xpm *.svg *.svgz)") ); | ||||
163 | if ( !customStampFile.isEmpty() ) | ||||
164 | { | ||||
165 | QPixmap pixmap = GuiUtils::loadStamp( customStampFile, m_previewSize ); | ||||
166 | if( pixmap.isNull() ) { | ||||
167 | KMessageBox::sorry( this, | ||||
168 | xi18nc("@info", "Could not load the file <filename>%1</filename>", customStampFile ), | ||||
169 | i18nc("@title:window", "Invalid file") | ||||
170 | ); | ||||
171 | } else { | ||||
172 | m_comboItems->setEditText(customStampFile); | ||||
173 | } | ||||
174 | } | ||||
175 | } | ||||
131 | 176 | | |||
132 | AnnotationWidget * AnnotationWidgetFactory::widgetFor( Okular::Annotation * ann ) | 177 | AnnotationWidget * AnnotationWidgetFactory::widgetFor( Okular::Annotation * ann ) | ||
133 | { | 178 | { | ||
134 | switch ( ann->subType() ) | 179 | switch ( ann->subType() ) | ||
135 | { | 180 | { | ||
136 | case Okular::Annotation::AStamp: | 181 | case Okular::Annotation::AStamp: | ||
137 | return new StampAnnotationWidget( ann ); | 182 | return new StampAnnotationWidget( ann ); | ||
138 | break; | 183 | break; | ||
Show All 23 Lines | 206 | default: | |||
162 | ; | 207 | ; | ||
163 | } | 208 | } | ||
164 | // cases not covered yet: return a generic widget | 209 | // cases not covered yet: return a generic widget | ||
165 | return new AnnotationWidget( ann ); | 210 | return new AnnotationWidget( ann ); | ||
166 | } | 211 | } | ||
167 | 212 | | |||
168 | 213 | | |||
169 | AnnotationWidget::AnnotationWidget( Okular::Annotation * ann ) | 214 | AnnotationWidget::AnnotationWidget( Okular::Annotation * ann ) | ||
170 | : m_ann( ann ) | 215 | : m_typeEditable( true ), m_ann( ann ) | ||
171 | { | 216 | { | ||
172 | } | 217 | } | ||
173 | 218 | | |||
174 | AnnotationWidget::~AnnotationWidget() | 219 | AnnotationWidget::~AnnotationWidget() | ||
175 | { | 220 | { | ||
176 | } | 221 | } | ||
177 | 222 | | |||
178 | Okular::Annotation::SubType AnnotationWidget::annotationType() const | 223 | Okular::Annotation::SubType AnnotationWidget::annotationType() const | ||
▲ Show 20 Lines • Show All 52 Lines • ▼ Show 20 Line(s) | 272 | { | |||
231 | connect( m_colorBn, &KColorButton::changed, this, &AnnotationWidget::dataChanged ); | 276 | connect( m_colorBn, &KColorButton::changed, this, &AnnotationWidget::dataChanged ); | ||
232 | } | 277 | } | ||
233 | 278 | | |||
234 | void AnnotationWidget::addOpacitySpinBox( QWidget * widget, QFormLayout * formlayout ) | 279 | void AnnotationWidget::addOpacitySpinBox( QWidget * widget, QFormLayout * formlayout ) | ||
235 | { | 280 | { | ||
236 | m_opacity = new QSpinBox( widget ); | 281 | m_opacity = new QSpinBox( widget ); | ||
237 | m_opacity->setRange( 0, 100 ); | 282 | m_opacity->setRange( 0, 100 ); | ||
238 | m_opacity->setValue( (int)( m_ann->style().opacity() * 100 ) ); | 283 | m_opacity->setValue( (int)( m_ann->style().opacity() * 100 ) ); | ||
239 | m_opacity->setSuffix( i18nc( "Suffix for the opacity level, eg '80 %'", " %" ) ); | 284 | m_opacity->setSuffix( i18nc( "Suffix for the opacity level, eg '80%'", "%" ) ); | ||
240 | formlayout->addRow( i18n( "&Opacity:" ), m_opacity); | 285 | formlayout->addRow( i18n( "&Opacity:" ), m_opacity); | ||
241 | connect( m_opacity, SIGNAL(valueChanged(int)), this, SIGNAL(dataChanged()) ); | 286 | connect( m_opacity, SIGNAL(valueChanged(int)), this, SIGNAL(dataChanged()) ); | ||
242 | } | 287 | } | ||
243 | 288 | | |||
244 | void AnnotationWidget::addVerticalSpacer( QFormLayout * formlayout ) | 289 | void AnnotationWidget::addVerticalSpacer( QFormLayout * formlayout ) | ||
245 | { | 290 | { | ||
246 | formlayout->addItem( new QSpacerItem( 0, 5, QSizePolicy::Fixed, QSizePolicy::Fixed ) ); | 291 | formlayout->addItem( new QSpacerItem( 0, 5, QSizePolicy::Fixed, QSizePolicy::Fixed ) ); | ||
247 | } | 292 | } | ||
▲ Show 20 Lines • Show All 48 Lines • ▼ Show 20 Line(s) | 332 | { | |||
296 | else | 341 | else | ||
297 | { | 342 | { | ||
298 | Q_ASSERT( m_textColorBn ); | 343 | Q_ASSERT( m_textColorBn ); | ||
299 | m_textAnn->setTextColor( m_textColorBn->color() ); | 344 | m_textAnn->setTextColor( m_textColorBn->color() ); | ||
300 | } | 345 | } | ||
301 | } | 346 | } | ||
302 | } | 347 | } | ||
303 | 348 | | |||
349 | | ||||
350 | void AnnotationWidget::setAnnotTypeEditable( bool editable ) | ||||
351 | { | ||||
352 | m_typeEditable = editable; | ||||
353 | } | ||||
354 | | ||||
304 | void TextAnnotationWidget::createPopupNoteStyleUi( QWidget * widget, QFormLayout * formlayout ) { | 355 | void TextAnnotationWidget::createPopupNoteStyleUi( QWidget * widget, QFormLayout * formlayout ) { | ||
305 | addColorButton( widget, formlayout ); | 356 | addColorButton( widget, formlayout ); | ||
306 | addOpacitySpinBox( widget, formlayout ); | 357 | addOpacitySpinBox( widget, formlayout ); | ||
307 | addVerticalSpacer( formlayout ); | 358 | addVerticalSpacer( formlayout ); | ||
308 | addPixmapSelector( widget, formlayout ); | 359 | addPixmapSelector( widget, formlayout ); | ||
309 | } | 360 | } | ||
310 | 361 | | |||
311 | void TextAnnotationWidget::createInlineNoteStyleUi( QWidget * widget, QFormLayout * formlayout ) { | 362 | void TextAnnotationWidget::createInlineNoteStyleUi( QWidget * widget, QFormLayout * formlayout ) { | ||
▲ Show 20 Lines • Show All 59 Lines • ▼ Show 20 Line(s) | 421 | { | |||
371 | m_spinWidth = new QDoubleSpinBox( widget ); | 422 | m_spinWidth = new QDoubleSpinBox( widget ); | ||
372 | formlayout->addRow( i18n( "Border &width:" ), m_spinWidth ); | 423 | formlayout->addRow( i18n( "Border &width:" ), m_spinWidth ); | ||
373 | m_spinWidth->setRange( 0, 100 ); | 424 | m_spinWidth->setRange( 0, 100 ); | ||
374 | m_spinWidth->setValue( m_textAnn->style().width() ); | 425 | m_spinWidth->setValue( m_textAnn->style().width() ); | ||
375 | m_spinWidth->setSingleStep( 0.1 ); | 426 | m_spinWidth->setSingleStep( 0.1 ); | ||
376 | connect( m_spinWidth, SIGNAL(valueChanged(double)), this, SIGNAL(dataChanged()) ); | 427 | connect( m_spinWidth, SIGNAL(valueChanged(double)), this, SIGNAL(dataChanged()) ); | ||
377 | } | 428 | } | ||
378 | 429 | | |||
430 | const QList<QPair<QString, QString>> StampAnnotationWidget::defaultStamps = { | ||||
431 | { i18n( "Approved" ), QStringLiteral("Approved") }, | ||||
432 | { i18n( "As Is" ), QStringLiteral("AsIs") }, | ||||
433 | { i18n( "Confidential" ), QStringLiteral("Confidential") }, | ||||
434 | { i18n( "Departmental" ), QStringLiteral("Departmental") }, | ||||
435 | { i18n( "Draft" ), QStringLiteral("Draft") }, | ||||
436 | { i18n( "Experimental" ), QStringLiteral("Experimental") }, | ||||
437 | { i18n( "Final" ), QStringLiteral("Expired") }, | ||||
438 | { i18n( "For Comment" ), QStringLiteral("ForComment") }, | ||||
439 | { i18n( "For Public Release" ), QStringLiteral("ForPublicRelease") }, | ||||
440 | { i18n( "Not Approved" ), QStringLiteral("NotApproved") }, | ||||
441 | { i18n( "Not For Public Release" ), QStringLiteral("NotForPublicRelease") }, | ||||
442 | { i18n( "Sold" ), QStringLiteral("Sold") }, | ||||
443 | { i18n( "Top Secret" ), QStringLiteral("TopSecret") }, | ||||
444 | { i18n( "Bookmark" ), QStringLiteral("bookmark-new") }, | ||||
445 | { i18n( "Information" ), QStringLiteral("help-about") }, | ||||
446 | { i18n( "KDE" ), QStringLiteral("kde") }, | ||||
447 | { i18n( "Okular" ), QStringLiteral("okular") } | ||||
448 | }; | ||||
449 | | ||||
379 | StampAnnotationWidget::StampAnnotationWidget( Okular::Annotation * ann ) | 450 | StampAnnotationWidget::StampAnnotationWidget( Okular::Annotation * ann ) | ||
380 | : AnnotationWidget( ann ), m_pixmapSelector( nullptr ) | 451 | : AnnotationWidget( ann ), m_pixmapSelector( nullptr ) | ||
381 | { | 452 | { | ||
382 | m_stampAnn = static_cast< Okular::StampAnnotation * >( ann ); | 453 | m_stampAnn = static_cast< Okular::StampAnnotation * >( ann ); | ||
383 | } | 454 | } | ||
384 | 455 | | |||
385 | void StampAnnotationWidget::createStyleWidget( QFormLayout * formlayout ) | 456 | void StampAnnotationWidget::createStyleWidget( QFormLayout * formlayout ) | ||
386 | { | 457 | { | ||
387 | QWidget * widget = qobject_cast<QWidget *>( formlayout->parent() ); | 458 | QWidget * widget = qobject_cast<QWidget *>( formlayout->parent() ); | ||
388 | 459 | | |||
460 | KMessageWidget * brokenStampSupportWarning = new KMessageWidget( widget ); | ||||
461 | brokenStampSupportWarning->setText( xi18nc("@info", "<warning>experimental feature.<nl/>" | ||||
462 | "Stamps inserted in PDF documents are not visible in PDF readers other than Okular.</warning>") ); | ||||
463 | brokenStampSupportWarning->setMessageType( KMessageWidget::Warning ); | ||||
464 | brokenStampSupportWarning->setWordWrap( true ); | ||||
465 | brokenStampSupportWarning->setCloseButtonVisible( false ); | ||||
466 | formlayout->insertRow( 0, brokenStampSupportWarning ); | ||||
467 | | ||||
389 | addOpacitySpinBox( widget, formlayout ); | 468 | addOpacitySpinBox( widget, formlayout ); | ||
390 | addVerticalSpacer( formlayout ); | 469 | addVerticalSpacer( formlayout ); | ||
391 | 470 | | |||
392 | m_pixmapSelector = new PixmapPreviewSelector( widget ); | 471 | m_pixmapSelector = new PixmapPreviewSelector( widget, PixmapPreviewSelector::Below ); | ||
393 | formlayout->addRow( i18n( "Stamp symbol:" ), m_pixmapSelector ); | 472 | formlayout->addRow( i18n( "Stamp symbol:" ), m_pixmapSelector ); | ||
394 | m_pixmapSelector->setEditable( true ); | 473 | m_pixmapSelector->setEditable( true ); | ||
395 | 474 | | |||
396 | m_pixmapSelector->addItem( i18n( "Okular" ), QStringLiteral("okular") ); | 475 | QPair<QString, QString> pair; | ||
397 | m_pixmapSelector->addItem( i18n( "Bookmark" ), QStringLiteral("bookmarks") ); | 476 | foreach(pair, defaultStamps) | ||
398 | m_pixmapSelector->addItem( i18n( "KDE" ), QStringLiteral("kde") ); | 477 | { | ||
399 | m_pixmapSelector->addItem( i18n( "Information" ), QStringLiteral("help-about") ); | 478 | m_pixmapSelector->addItem(pair.first, pair.second); | ||
400 | m_pixmapSelector->addItem( i18n( "Approved" ), QStringLiteral("Approved") ); | 479 | } | ||
401 | m_pixmapSelector->addItem( i18n( "As Is" ), QStringLiteral("AsIs") ); | 480 | | ||
402 | m_pixmapSelector->addItem( i18n( "Confidential" ), QStringLiteral("Confidential") ); | | |||
403 | m_pixmapSelector->addItem( i18n( "Departmental" ), QStringLiteral("Departmental") ); | | |||
404 | m_pixmapSelector->addItem( i18n( "Draft" ), QStringLiteral("Draft") ); | | |||
405 | m_pixmapSelector->addItem( i18n( "Experimental" ), QStringLiteral("Experimental") ); | | |||
406 | m_pixmapSelector->addItem( i18n( "Expired" ), QStringLiteral("Expired") ); | | |||
407 | m_pixmapSelector->addItem( i18n( "Final" ), QStringLiteral("Final") ); | | |||
408 | m_pixmapSelector->addItem( i18n( "For Comment" ), QStringLiteral("ForComment") ); | | |||
409 | m_pixmapSelector->addItem( i18n( "For Public Release" ), QStringLiteral("ForPublicRelease") ); | | |||
410 | m_pixmapSelector->addItem( i18n( "Not Approved" ), QStringLiteral("NotApproved") ); | | |||
411 | m_pixmapSelector->addItem( i18n( "Not For Public Release" ), QStringLiteral("NotForPublicRelease") ); | | |||
412 | m_pixmapSelector->addItem( i18n( "Sold" ), QStringLiteral("Sold") ); | | |||
413 | m_pixmapSelector->addItem( i18n( "Top Secret" ), QStringLiteral("TopSecret") ); | | |||
414 | m_pixmapSelector->setIcon( m_stampAnn->stampIconName() ); | 481 | m_pixmapSelector->setIcon( m_stampAnn->stampIconName() ); | ||
415 | m_pixmapSelector->setPreviewSize( 64 ); | 482 | m_pixmapSelector->setPreviewSize( 64 ); | ||
416 | 483 | | |||
417 | connect( m_pixmapSelector, &PixmapPreviewSelector::iconChanged, this, &AnnotationWidget::dataChanged ); | 484 | connect( m_pixmapSelector, &PixmapPreviewSelector::iconChanged, this, &AnnotationWidget::dataChanged ); | ||
418 | } | 485 | } | ||
419 | 486 | | |||
420 | void StampAnnotationWidget::applyChanges() | 487 | void StampAnnotationWidget::applyChanges() | ||
421 | { | 488 | { | ||
▲ Show 20 Lines • Show All 193 Lines • ▼ Show 20 Line(s) | |||||
615 | { | 682 | { | ||
616 | m_hlAnn = static_cast< Okular::HighlightAnnotation * >( ann ); | 683 | m_hlAnn = static_cast< Okular::HighlightAnnotation * >( ann ); | ||
617 | } | 684 | } | ||
618 | 685 | | |||
619 | void HighlightAnnotationWidget::createStyleWidget( QFormLayout * formlayout ) | 686 | void HighlightAnnotationWidget::createStyleWidget( QFormLayout * formlayout ) | ||
620 | { | 687 | { | ||
621 | QWidget * widget = qobject_cast<QWidget *>( formlayout->parent() ); | 688 | QWidget * widget = qobject_cast<QWidget *>( formlayout->parent() ); | ||
622 | 689 | | |||
690 | | ||||
623 | m_typeCombo = new KComboBox( widget ); | 691 | m_typeCombo = new KComboBox( widget ); | ||
692 | m_typeCombo->setVisible( m_typeEditable ); | ||||
693 | if( m_typeEditable ) | ||||
694 | { | ||||
624 | formlayout->addRow( i18n( "Type:" ), m_typeCombo ); | 695 | formlayout->addRow( i18n( "Type:" ), m_typeCombo ); | ||
696 | } | ||||
625 | m_typeCombo->addItem( i18n( "Highlight" ) ); | 697 | m_typeCombo->addItem( i18n( "Highlight" ) ); | ||
626 | m_typeCombo->addItem( i18n( "Squiggle" ) ); | 698 | m_typeCombo->addItem( i18n( "Squiggle" ) ); | ||
627 | m_typeCombo->addItem( i18n( "Underline" ) ); | 699 | m_typeCombo->addItem( i18n( "Underline" ) ); | ||
628 | m_typeCombo->addItem( i18n( "Strike out" ) ); | 700 | m_typeCombo->addItem( i18n( "Strike out" ) ); | ||
629 | m_typeCombo->setCurrentIndex( m_hlAnn->highlightType() ); | 701 | m_typeCombo->setCurrentIndex( m_hlAnn->highlightType() ); | ||
630 | 702 | | |||
631 | addVerticalSpacer( formlayout ); | 703 | addVerticalSpacer( formlayout ); | ||
632 | addColorButton( widget, formlayout ); | 704 | addColorButton( widget, formlayout ); | ||
Show All 16 Lines | 720 | { | |||
649 | m_geomAnn = static_cast< Okular::GeomAnnotation * >( ann ); | 721 | m_geomAnn = static_cast< Okular::GeomAnnotation * >( ann ); | ||
650 | } | 722 | } | ||
651 | 723 | | |||
652 | void GeomAnnotationWidget::createStyleWidget( QFormLayout * formlayout ) | 724 | void GeomAnnotationWidget::createStyleWidget( QFormLayout * formlayout ) | ||
653 | { | 725 | { | ||
654 | QWidget * widget = qobject_cast<QWidget *>( formlayout->parent() ); | 726 | QWidget * widget = qobject_cast<QWidget *>( formlayout->parent() ); | ||
655 | 727 | | |||
656 | m_typeCombo = new KComboBox( widget ); | 728 | m_typeCombo = new KComboBox( widget ); | ||
729 | m_typeCombo->setVisible( m_typeEditable ); | ||||
730 | if( m_typeEditable ) | ||||
731 | { | ||||
657 | formlayout->addRow( i18n( "Type:" ), m_typeCombo ); | 732 | formlayout->addRow( i18n( "Type:" ), m_typeCombo ); | ||
733 | } | ||||
658 | addVerticalSpacer( formlayout ); | 734 | addVerticalSpacer( formlayout ); | ||
659 | addColorButton( widget, formlayout ); | 735 | addColorButton( widget, formlayout ); | ||
660 | addOpacitySpinBox( widget, formlayout ); | 736 | addOpacitySpinBox( widget, formlayout ); | ||
661 | QHBoxLayout * colorlay = new QHBoxLayout(); | 737 | QHBoxLayout * colorlay = new QHBoxLayout(); | ||
662 | m_useColor = new QCheckBox( i18n( "Enabled" ), widget ); | 738 | m_useColor = new QCheckBox( i18n( "Enabled" ), widget ); | ||
663 | colorlay->addWidget(m_useColor); | 739 | colorlay->addWidget(m_useColor); | ||
664 | m_innerColor = new KColorButton( widget ); | 740 | m_innerColor = new KColorButton( widget ); | ||
665 | colorlay->addWidget( m_innerColor); | 741 | colorlay->addWidget( m_innerColor); | ||
▲ Show 20 Lines • Show All 175 Lines • Show Last 20 Lines |