Changeset View
Standalone View
ui/annotationwidgets.cpp
Show First 20 Lines • Show All 193 Lines • ▼ Show 20 Line(s) | 192 | { | |||
---|---|---|---|---|---|
194 | m_ann->style().setOpacity( (double)m_opacity->value() / 100.0 ); | 194 | m_ann->style().setOpacity( (double)m_opacity->value() / 100.0 ); | ||
195 | } | 195 | } | ||
196 | 196 | | |||
197 | QWidget * AnnotationWidget::createAppearanceWidget() | 197 | QWidget * AnnotationWidget::createAppearanceWidget() | ||
198 | { | 198 | { | ||
199 | QWidget * widget = new QWidget(); | 199 | QWidget * widget = new QWidget(); | ||
200 | QGridLayout * gridlayout = new QGridLayout( widget ); | 200 | QGridLayout * gridlayout = new QGridLayout( widget ); | ||
201 | 201 | | |||
202 | QLabel * tmplabel = new QLabel( i18n( "&Color:" ), widget ); | 202 | QLabel * tmplabel = new QLabel( i18n( "&Color:" ), widget ); | ||
simgunz: Is it correct to set this growth policy? I have not found any guideline on the HIG. Compared to… | |||||
For this one, FieldsStayAtSizeHint might be better, and then we just set sensible sizehints for anything that winds up too small. That's basically what we're doing for all our QML software. In general we're trying to move towards making the controls optimally sized in the first place and then static in size when the window grows or shrinks. We often manually set the width of spinboxes, comboboxes, and text fields to make sure they're all the same width. ngraham: For this one, `FieldsStayAtSizeHint` might be better, and then we just set sensible sizehints… | |||||
Let's not have static sizes, this is not a phone screen where you can't resize windows. aacid: Let's not have static sizes, this is not a phone screen where you can't resize windows. | |||||
203 | gridlayout->addWidget( tmplabel, 0, 0, Qt::AlignRight ); | 203 | gridlayout->addWidget( tmplabel, 0, 0, Qt::AlignRight ); | ||
204 | m_colorBn = new KColorButton( widget ); | 204 | m_colorBn = new KColorButton( widget ); | ||
205 | m_colorBn->setColor( m_ann->style().color() ); | 205 | m_colorBn->setColor( m_ann->style().color() ); | ||
206 | tmplabel->setBuddy( m_colorBn ); | 206 | tmplabel->setBuddy( m_colorBn ); | ||
207 | gridlayout->addWidget( m_colorBn, 0, 1 ); | 207 | gridlayout->addWidget( m_colorBn, 0, 1 ); | ||
208 | 208 | | |||
209 | tmplabel = new QLabel( i18n( "&Opacity:" ), widget ); | 209 | tmplabel = new QLabel( i18n( "&Opacity:" ), widget ); | ||
210 | gridlayout->addWidget( tmplabel, 1, 0, Qt::AlignRight ); | 210 | gridlayout->addWidget( tmplabel, 1, 0, Qt::AlignRight ); | ||
211 | m_opacity = new QSpinBox( widget ); | 211 | m_opacity = new QSpinBox( widget ); | ||
212 | m_opacity->setRange( 0, 100 ); | 212 | m_opacity->setRange( 0, 100 ); | ||
213 | m_opacity->setValue( (int)( m_ann->style().opacity() * 100 ) ); | 213 | m_opacity->setValue( (int)( m_ann->style().opacity() * 100 ) ); | ||
214 | m_opacity->setSuffix( i18nc( "Suffix for the opacity level, eg '80 %'", " %" ) ); | 214 | m_opacity->setSuffix( i18nc( "Suffix for the opacity level, eg '80 %'", " %" ) ); | ||
215 | tmplabel->setBuddy( m_opacity ); | 215 | tmplabel->setBuddy( m_opacity ); | ||
216 | gridlayout->addWidget( m_opacity, 1, 1 ); | 216 | gridlayout->addWidget( m_opacity, 1, 1 ); | ||
217 | 217 | | |||
218 | QWidget * styleWidget = createStyleWidget(); | 218 | createStyleWidget(gridlayout); | ||
219 | if ( styleWidget ) | | |||
220 | gridlayout->addWidget( styleWidget, 2, 0, 1, 2 ); | | |||
221 | 219 | | |||
222 | gridlayout->addItem( new QSpacerItem( 5, 5, QSizePolicy::Fixed, QSizePolicy::MinimumExpanding ), 3, 0 ); | 220 | gridlayout->addItem( new QSpacerItem( 5, 5, QSizePolicy::Fixed, QSizePolicy::MinimumExpanding ), | ||
221 | gridlayout->rowCount()+1, 0 ); | ||||
223 | 222 | | |||
224 | connect( m_colorBn, &KColorButton::changed, this, &AnnotationWidget::dataChanged ); | 223 | connect( m_colorBn, &KColorButton::changed, this, &AnnotationWidget::dataChanged ); | ||
225 | connect( m_opacity, SIGNAL(valueChanged(int)), this, SIGNAL(dataChanged()) ); | 224 | connect( m_opacity, SIGNAL(valueChanged(int)), this, SIGNAL(dataChanged()) ); | ||
226 | 225 | | |||
227 | return widget; | 226 | return widget; | ||
228 | } | 227 | } | ||
229 | 228 | | |||
230 | QWidget * AnnotationWidget::createStyleWidget() | 229 | void AnnotationWidget::createStyleWidget(QGridLayout * gridLayout) | ||
231 | { | 230 | { | ||
232 | return nullptr; | 231 | return; | ||
233 | } | 232 | } | ||
234 | 233 | | |||
235 | QWidget * AnnotationWidget::createExtraWidget() | 234 | QWidget * AnnotationWidget::createExtraWidget() | ||
236 | { | 235 | { | ||
237 | return nullptr; | 236 | return nullptr; | ||
238 | } | 237 | } | ||
239 | 238 | | |||
240 | 239 | | |||
241 | TextAnnotationWidget::TextAnnotationWidget( Okular::Annotation * ann ) | 240 | TextAnnotationWidget::TextAnnotationWidget( Okular::Annotation * ann ) | ||
242 | : AnnotationWidget( ann ), m_pixmapSelector( nullptr ) | 241 | : AnnotationWidget( ann ), m_pixmapSelector( nullptr ) | ||
243 | { | 242 | { | ||
244 | m_textAnn = static_cast< Okular::TextAnnotation * >( ann ); | 243 | m_textAnn = static_cast< Okular::TextAnnotation * >( ann ); | ||
245 | } | 244 | } | ||
246 | 245 | | |||
247 | QWidget * TextAnnotationWidget::createStyleWidget() | 246 | void TextAnnotationWidget::createStyleWidget(QGridLayout * gridLayout) | ||
248 | { | 247 | { | ||
249 | QWidget * widget = new QWidget(); | 248 | int row = gridLayout->rowCount(); | ||
250 | QVBoxLayout * lay = new QVBoxLayout( widget ); | 249 | QWidget * widget = (QWidget*)gridLayout->parent(); | ||
251 | lay->setMargin( 0 ); | | |||
252 | | ||||
253 | if ( m_textAnn->textType() == Okular::TextAnnotation::Linked ) | 250 | if ( m_textAnn->textType() == Okular::TextAnnotation::Linked ) | ||
254 | { | 251 | { | ||
255 | QGroupBox * gb = new QGroupBox( widget ); | 252 | QLabel * icon = new QLabel(i18n( "Icon:" ), widget); | ||
256 | lay->addWidget( gb ); | 253 | gridLayout->addWidget(icon, row, 0, Qt::AlignRight ); | ||
257 | gb->setTitle( i18n( "Icon" ) ); | 254 | m_pixmapSelector = new PixmapPreviewSelector( widget ); | ||
258 | QHBoxLayout * gblay = new QHBoxLayout( gb ); | 255 | gridLayout->addWidget( m_pixmapSelector, row, 1 ); | ||
259 | m_pixmapSelector = new PixmapPreviewSelector( gb ); | | |||
260 | gblay->addWidget( m_pixmapSelector ); | | |||
261 | 256 | | |||
262 | m_pixmapSelector->addItem( i18n( "Comment" ), QStringLiteral("Comment") ); | 257 | m_pixmapSelector->addItem( i18n( "Comment" ), QStringLiteral("Comment") ); | ||
263 | m_pixmapSelector->addItem( i18n( "Help" ), QStringLiteral("Help") ); | 258 | m_pixmapSelector->addItem( i18n( "Help" ), QStringLiteral("Help") ); | ||
264 | m_pixmapSelector->addItem( i18n( "Insert" ), QStringLiteral("Insert") ); | 259 | m_pixmapSelector->addItem( i18n( "Insert" ), QStringLiteral("Insert") ); | ||
265 | m_pixmapSelector->addItem( i18n( "Key" ), QStringLiteral("Key") ); | 260 | m_pixmapSelector->addItem( i18n( "Key" ), QStringLiteral("Key") ); | ||
266 | m_pixmapSelector->addItem( i18n( "New Paragraph" ), QStringLiteral("NewParagraph") ); | 261 | m_pixmapSelector->addItem( i18n( "New Paragraph" ), QStringLiteral("NewParagraph") ); | ||
267 | m_pixmapSelector->addItem( i18n( "Note" ), QStringLiteral("Note") ); | 262 | m_pixmapSelector->addItem( i18n( "Note" ), QStringLiteral("Note") ); | ||
268 | m_pixmapSelector->addItem( i18n( "Paragraph" ), QStringLiteral("Paragraph") ); | 263 | m_pixmapSelector->addItem( i18n( "Paragraph" ), QStringLiteral("Paragraph") ); | ||
269 | m_pixmapSelector->setIcon( m_textAnn->textIcon() ); | 264 | m_pixmapSelector->setIcon( m_textAnn->textIcon() ); | ||
270 | 265 | | |||
271 | connect( m_pixmapSelector, &PixmapPreviewSelector::iconChanged, this, &AnnotationWidget::dataChanged ); | 266 | connect( m_pixmapSelector, &PixmapPreviewSelector::iconChanged, this, &AnnotationWidget::dataChanged ); | ||
272 | } | 267 | } | ||
273 | else if ( m_textAnn->textType() == Okular::TextAnnotation::InPlace ) | 268 | else if ( m_textAnn->textType() == Okular::TextAnnotation::InPlace ) | ||
274 | { | 269 | { | ||
275 | QGridLayout * innerlay = new QGridLayout(); | | |||
276 | lay->addLayout( innerlay ); | | |||
277 | | ||||
278 | QLabel * tmplabel = new QLabel( i18n( "Font:" ), widget ); | 270 | QLabel * tmplabel = new QLabel( i18n( "Font:" ), widget ); | ||
279 | innerlay->addWidget( tmplabel, 0, 0 ); | 271 | gridLayout->addWidget( tmplabel, row, 0, Qt::AlignRight ); | ||
280 | m_fontReq = new KFontRequester( widget ); | 272 | m_fontReq = new KFontRequester( widget ); | ||
281 | innerlay->addWidget( m_fontReq, 0, 1 ); | 273 | gridLayout->addWidget( m_fontReq, row, 1 ); | ||
282 | m_fontReq->setFont( m_textAnn->textFont() ); | 274 | m_fontReq->setFont( m_textAnn->textFont() ); | ||
283 | 275 | | |||
284 | tmplabel = new QLabel( i18n( "Align:" ), widget ); | 276 | tmplabel = new QLabel( i18n( "Align:" ), widget ); | ||
285 | innerlay->addWidget( tmplabel, 1, 0 ); | 277 | gridLayout->addWidget( tmplabel, row+1, 0, Qt::AlignRight ); | ||
286 | m_textAlign = new KComboBox( widget ); | 278 | m_textAlign = new KComboBox( widget ); | ||
287 | innerlay->addWidget( m_textAlign, 1, 1 ); | 279 | gridLayout->addWidget( m_textAlign, row+1, 1 ); | ||
288 | m_textAlign->addItem( i18n("Left") ); | 280 | m_textAlign->addItem( i18n("Left") ); | ||
289 | m_textAlign->addItem( i18n("Center") ); | 281 | m_textAlign->addItem( i18n("Center") ); | ||
290 | m_textAlign->addItem( i18n("Right") ); | 282 | m_textAlign->addItem( i18n("Right") ); | ||
291 | m_textAlign->setCurrentIndex( m_textAnn->inplaceAlignment() ); | 283 | m_textAlign->setCurrentIndex( m_textAnn->inplaceAlignment() ); | ||
292 | 284 | | |||
293 | tmplabel = new QLabel( i18n( "Border Width:" ), widget ); | 285 | tmplabel = new QLabel( i18n( "Border width:" ), widget ); | ||
294 | innerlay->addWidget( tmplabel, 2, 0, Qt::AlignRight ); | 286 | gridLayout->addWidget( tmplabel, row+2, 0, Qt::AlignRight ); | ||
295 | m_spinWidth = new QDoubleSpinBox( widget ); | 287 | m_spinWidth = new QDoubleSpinBox( widget ); | ||
296 | innerlay->addWidget( m_spinWidth, 2, 1 ); | 288 | gridLayout->addWidget( m_spinWidth, row+2, 1 ); | ||
297 | tmplabel->setBuddy( m_spinWidth ); | 289 | tmplabel->setBuddy( m_spinWidth ); | ||
298 | m_spinWidth->setRange( 0, 100 ); | 290 | m_spinWidth->setRange( 0, 100 ); | ||
299 | m_spinWidth->setValue( m_textAnn->style().width() ); | 291 | m_spinWidth->setValue( m_textAnn->style().width() ); | ||
300 | m_spinWidth->setSingleStep( 0.1 ); | 292 | m_spinWidth->setSingleStep( 0.1 ); | ||
301 | 293 | | |||
302 | connect( m_fontReq, &KFontRequester::fontSelected, this, &AnnotationWidget::dataChanged ); | 294 | connect( m_fontReq, &KFontRequester::fontSelected, this, &AnnotationWidget::dataChanged ); | ||
303 | 295 | | |||
304 | connect( m_textAlign, SIGNAL(currentIndexChanged(int)), this, SIGNAL(dataChanged()) ); | 296 | connect( m_textAlign, SIGNAL(currentIndexChanged(int)), this, SIGNAL(dataChanged()) ); | ||
305 | connect( m_spinWidth, SIGNAL(valueChanged(double)), this, SIGNAL(dataChanged()) ); | 297 | connect( m_spinWidth, SIGNAL(valueChanged(double)), this, SIGNAL(dataChanged()) ); | ||
306 | } | 298 | } | ||
307 | 299 | | |||
308 | return widget; | 300 | return; | ||
309 | } | 301 | } | ||
310 | 302 | | |||
311 | void TextAnnotationWidget::applyChanges() | 303 | void TextAnnotationWidget::applyChanges() | ||
312 | { | 304 | { | ||
313 | AnnotationWidget::applyChanges(); | 305 | AnnotationWidget::applyChanges(); | ||
314 | if ( m_textAnn->textType() == Okular::TextAnnotation::Linked ) | 306 | if ( m_textAnn->textType() == Okular::TextAnnotation::Linked ) | ||
315 | { | 307 | { | ||
316 | m_textAnn->setTextIcon( m_pixmapSelector->icon() ); | 308 | m_textAnn->setTextIcon( m_pixmapSelector->icon() ); | ||
317 | } | 309 | } | ||
318 | else if ( m_textAnn->textType() == Okular::TextAnnotation::InPlace ) | 310 | else if ( m_textAnn->textType() == Okular::TextAnnotation::InPlace ) | ||
319 | { | 311 | { | ||
320 | m_textAnn->setTextFont( m_fontReq->font() ); | 312 | m_textAnn->setTextFont( m_fontReq->font() ); | ||
321 | m_textAnn->setInplaceAlignment( m_textAlign->currentIndex() ); | 313 | m_textAnn->setInplaceAlignment( m_textAlign->currentIndex() ); | ||
322 | m_textAnn->style().setWidth( m_spinWidth->value() ); | 314 | m_textAnn->style().setWidth( m_spinWidth->value() ); | ||
323 | } | 315 | } | ||
324 | } | 316 | } | ||
325 | 317 | | |||
326 | 318 | | |||
327 | StampAnnotationWidget::StampAnnotationWidget( Okular::Annotation * ann ) | 319 | StampAnnotationWidget::StampAnnotationWidget( Okular::Annotation * ann ) | ||
328 | : AnnotationWidget( ann ), m_pixmapSelector( nullptr ) | 320 | : AnnotationWidget( ann ), m_pixmapSelector( nullptr ) | ||
329 | { | 321 | { | ||
330 | m_stampAnn = static_cast< Okular::StampAnnotation * >( ann ); | 322 | m_stampAnn = static_cast< Okular::StampAnnotation * >( ann ); | ||
331 | } | 323 | } | ||
332 | 324 | | |||
333 | QWidget * StampAnnotationWidget::createStyleWidget() | 325 | void StampAnnotationWidget::createStyleWidget(QGridLayout * gridLayout) | ||
334 | { | 326 | { | ||
335 | QWidget * widget = new QWidget(); | 327 | int row = gridLayout->rowCount(); | ||
336 | QVBoxLayout * lay = new QVBoxLayout( widget ); | 328 | QWidget * widget = (QWidget*)gridLayout->parent(); | ||
337 | lay->setMargin( 0 ); | 329 | QLabel * tmplabel = new QLabel( i18n( "Stamp symbol:" ), widget ); | ||
davidhurka: Capitalize symbol? | |||||
KDE HIG prescribe sentence style capitalization for labels in a form layout: https://hig.kde.org/style/writing/capitalization.html simgunz: KDE HIG prescribe sentence style capitalization for labels in a form layout: https://hig.kde. | |||||
338 | QGroupBox * gb = new QGroupBox( widget ); | 330 | gridLayout->addWidget( tmplabel, row, 0, Qt::AlignRight); | ||
339 | lay->addWidget( gb ); | 331 | | ||
340 | gb->setTitle( i18n( "Stamp Symbol" ) ); | 332 | QHBoxLayout * gblay = new QHBoxLayout( widget ); | ||
341 | QHBoxLayout * gblay = new QHBoxLayout( gb ); | 333 | m_pixmapSelector = new PixmapPreviewSelector( widget ); | ||
342 | m_pixmapSelector = new PixmapPreviewSelector( gb ); | 334 | gridLayout->addWidget( m_pixmapSelector, row, 1 ); | ||
343 | gblay->addWidget( m_pixmapSelector ); | | |||
344 | m_pixmapSelector->setEditable( true ); | 335 | m_pixmapSelector->setEditable( true ); | ||
davidhurka: Why is this editable? Entering a path to an image does not work. | |||||
davidhurka: Read in the user documentatio that it theoretically works. | |||||
Sometimes works. :-) Try with a path to an icon. In any case I'll improve the Stamp tool soon, adding a 'select file' button. I have some code ready that I'll share soon. simgunz: Sometimes works. :-) Try with a path to an icon. In any case I'll improve the Stamp tool soon… | |||||
Once you do that, it will fix https://bugs.kde.org/show_bug.cgi?id=383652 :) ngraham: Once you do that, it will fix https://bugs.kde.org/show_bug.cgi?id=383652 :) | |||||
345 | 336 | | |||
346 | m_pixmapSelector->addItem( i18n( "Okular" ), QStringLiteral("okular") ); | 337 | m_pixmapSelector->addItem( i18n( "Okular" ), QStringLiteral("okular") ); | ||
347 | m_pixmapSelector->addItem( i18n( "Bookmark" ), QStringLiteral("bookmarks") ); | 338 | m_pixmapSelector->addItem( i18n( "Bookmark" ), QStringLiteral("bookmarks") ); | ||
348 | m_pixmapSelector->addItem( i18n( "KDE" ), QStringLiteral("kde") ); | 339 | m_pixmapSelector->addItem( i18n( "KDE" ), QStringLiteral("kde") ); | ||
349 | m_pixmapSelector->addItem( i18n( "Information" ), QStringLiteral("help-about") ); | 340 | m_pixmapSelector->addItem( i18n( "Information" ), QStringLiteral("help-about") ); | ||
350 | m_pixmapSelector->addItem( i18n( "Approved" ), QStringLiteral("Approved") ); | 341 | m_pixmapSelector->addItem( i18n( "Approved" ), QStringLiteral("Approved") ); | ||
351 | m_pixmapSelector->addItem( i18n( "As Is" ), QStringLiteral("AsIs") ); | 342 | m_pixmapSelector->addItem( i18n( "As Is" ), QStringLiteral("AsIs") ); | ||
352 | m_pixmapSelector->addItem( i18n( "Confidential" ), QStringLiteral("Confidential") ); | 343 | m_pixmapSelector->addItem( i18n( "Confidential" ), QStringLiteral("Confidential") ); | ||
353 | m_pixmapSelector->addItem( i18n( "Departmental" ), QStringLiteral("Departmental") ); | 344 | m_pixmapSelector->addItem( i18n( "Departmental" ), QStringLiteral("Departmental") ); | ||
354 | m_pixmapSelector->addItem( i18n( "Draft" ), QStringLiteral("Draft") ); | 345 | m_pixmapSelector->addItem( i18n( "Draft" ), QStringLiteral("Draft") ); | ||
355 | m_pixmapSelector->addItem( i18n( "Experimental" ), QStringLiteral("Experimental") ); | 346 | m_pixmapSelector->addItem( i18n( "Experimental" ), QStringLiteral("Experimental") ); | ||
356 | m_pixmapSelector->addItem( i18n( "Expired" ), QStringLiteral("Expired") ); | 347 | m_pixmapSelector->addItem( i18n( "Expired" ), QStringLiteral("Expired") ); | ||
357 | m_pixmapSelector->addItem( i18n( "Final" ), QStringLiteral("Final") ); | 348 | m_pixmapSelector->addItem( i18n( "Final" ), QStringLiteral("Final") ); | ||
358 | m_pixmapSelector->addItem( i18n( "For Comment" ), QStringLiteral("ForComment") ); | 349 | m_pixmapSelector->addItem( i18n( "For Comment" ), QStringLiteral("ForComment") ); | ||
359 | m_pixmapSelector->addItem( i18n( "For Public Release" ), QStringLiteral("ForPublicRelease") ); | 350 | m_pixmapSelector->addItem( i18n( "For Public Release" ), QStringLiteral("ForPublicRelease") ); | ||
360 | m_pixmapSelector->addItem( i18n( "Not Approved" ), QStringLiteral("NotApproved") ); | 351 | m_pixmapSelector->addItem( i18n( "Not Approved" ), QStringLiteral("NotApproved") ); | ||
361 | m_pixmapSelector->addItem( i18n( "Not For Public Release" ), QStringLiteral("NotForPublicRelease") ); | 352 | m_pixmapSelector->addItem( i18n( "Not For Public Release" ), QStringLiteral("NotForPublicRelease") ); | ||
362 | m_pixmapSelector->addItem( i18n( "Sold" ), QStringLiteral("Sold") ); | 353 | m_pixmapSelector->addItem( i18n( "Sold" ), QStringLiteral("Sold") ); | ||
363 | m_pixmapSelector->addItem( i18n( "Top Secret" ), QStringLiteral("TopSecret") ); | 354 | m_pixmapSelector->addItem( i18n( "Top Secret" ), QStringLiteral("TopSecret") ); | ||
364 | m_pixmapSelector->setIcon( m_stampAnn->stampIconName() ); | 355 | m_pixmapSelector->setIcon( m_stampAnn->stampIconName() ); | ||
365 | m_pixmapSelector->setPreviewSize( 64 ); | 356 | m_pixmapSelector->setPreviewSize( 64 ); | ||
366 | 357 | | |||
367 | connect( m_pixmapSelector, &PixmapPreviewSelector::iconChanged, this, &AnnotationWidget::dataChanged ); | 358 | connect( m_pixmapSelector, &PixmapPreviewSelector::iconChanged, this, &AnnotationWidget::dataChanged ); | ||
368 | 359 | | |||
369 | return widget; | 360 | return; | ||
370 | } | 361 | } | ||
371 | 362 | | |||
372 | void StampAnnotationWidget::applyChanges() | 363 | void StampAnnotationWidget::applyChanges() | ||
373 | { | 364 | { | ||
374 | AnnotationWidget::applyChanges(); | 365 | AnnotationWidget::applyChanges(); | ||
375 | m_stampAnn->setStampIconName( m_pixmapSelector->icon() ); | 366 | m_stampAnn->setStampIconName( m_pixmapSelector->icon() ); | ||
376 | } | 367 | } | ||
377 | 368 | | |||
378 | 369 | | |||
379 | 370 | | |||
380 | LineAnnotationWidget::LineAnnotationWidget( Okular::Annotation * ann ) | 371 | LineAnnotationWidget::LineAnnotationWidget( Okular::Annotation * ann ) | ||
381 | : AnnotationWidget( ann ) | 372 | : AnnotationWidget( ann ) | ||
382 | { | 373 | { | ||
383 | m_lineAnn = static_cast< Okular::LineAnnotation * >( ann ); | 374 | m_lineAnn = static_cast< Okular::LineAnnotation * >( ann ); | ||
384 | if ( m_lineAnn->linePoints().count() == 2 ) | 375 | if ( m_lineAnn->linePoints().count() == 2 ) | ||
385 | m_lineType = 0; // line | 376 | m_lineType = 0; // line | ||
386 | else if ( m_lineAnn->lineClosed() ) | 377 | else if ( m_lineAnn->lineClosed() ) | ||
387 | m_lineType = 1; // polygon | 378 | m_lineType = 1; // polygon | ||
388 | else | 379 | else | ||
389 | m_lineType = 2; // polyline | 380 | m_lineType = 2; // polyline | ||
390 | } | 381 | } | ||
391 | 382 | | |||
392 | QWidget * LineAnnotationWidget::createStyleWidget() | 383 | void LineAnnotationWidget::createStyleWidget(QGridLayout * gridLayout) | ||
393 | { | 384 | { | ||
394 | QWidget * widget = new QWidget(); | 385 | int row = gridLayout->rowCount(); | ||
395 | QVBoxLayout * lay = new QVBoxLayout( widget ); | 386 | QWidget * widget = (QWidget*)gridLayout->parent(); | ||
396 | lay->setMargin( 0 ); | 387 | | ||
388 | QLabel * tmplabel = new QLabel( i18n( "&Size:" ), widget ); | ||||
389 | gridLayout->addWidget( tmplabel, row, 0, Qt::AlignRight ); | ||||
390 | m_spinSize = new QDoubleSpinBox( widget ); | ||||
391 | gridLayout->addWidget( m_spinSize, row, 1 ); | ||||
392 | tmplabel->setBuddy( m_spinSize ); | ||||
393 | | ||||
394 | // Straight line | ||||
397 | if ( m_lineType == 0 ) | 395 | if ( m_lineType == 0 ) | ||
398 | { | 396 | { | ||
399 | QGroupBox * gb = new QGroupBox( widget ); | 397 | tmplabel = new QLabel( i18n( "Leader line length:" ), widget ); | ||
400 | lay->addWidget( gb ); | 398 | gridLayout->addWidget( tmplabel, row+1, 0, Qt::AlignRight ); | ||
401 | gb->setTitle( i18n( "Line Extensions" ) ); | 399 | m_spinLL = new QDoubleSpinBox( widget ); | ||
402 | QGridLayout * gridlay = new QGridLayout( gb ); | 400 | gridLayout->addWidget( m_spinLL, row+1, 1 ); | ||
403 | QLabel * tmplabel = new QLabel( i18n( "Leader Line Length:" ), gb ); | | |||
404 | gridlay->addWidget( tmplabel, 0, 0, Qt::AlignRight ); | | |||
405 | m_spinLL = new QDoubleSpinBox( gb ); | | |||
406 | gridlay->addWidget( m_spinLL, 0, 1 ); | | |||
407 | tmplabel->setBuddy( m_spinLL ); | 401 | tmplabel->setBuddy( m_spinLL ); | ||
408 | tmplabel = new QLabel( i18n( "Leader Line Extensions Length:" ), gb ); | 402 | tmplabel = new QLabel( i18n( "Leader line extensions length:" ), widget ); | ||
409 | gridlay->addWidget( tmplabel, 1, 0, Qt::AlignRight ); | 403 | gridLayout->addWidget( tmplabel, row+2, 0, Qt::AlignRight ); | ||
410 | m_spinLLE = new QDoubleSpinBox( gb ); | 404 | m_spinLLE = new QDoubleSpinBox( widget ); | ||
411 | gridlay->addWidget( m_spinLLE, 1, 1 ); | 405 | gridLayout->addWidget( m_spinLLE, row+2, 1 ); | ||
412 | tmplabel->setBuddy( m_spinLLE ); | 406 | tmplabel->setBuddy( m_spinLLE ); | ||
413 | } | 407 | } | ||
414 | 408 | | |||
415 | QGroupBox * gb2 = new QGroupBox( widget ); | 409 | // Polygon | ||
416 | lay->addWidget( gb2 ); | | |||
417 | gb2->setTitle( i18n( "Style" ) ); | | |||
418 | QGridLayout * gridlay2 = new QGridLayout( gb2 ); | | |||
419 | QLabel * tmplabel2 = new QLabel( i18n( "&Size:" ), gb2 ); | | |||
420 | gridlay2->addWidget( tmplabel2, 0, 0, Qt::AlignRight ); | | |||
421 | m_spinSize = new QDoubleSpinBox( gb2 ); | | |||
422 | gridlay2->addWidget( m_spinSize, 0, 1 ); | | |||
423 | tmplabel2->setBuddy( m_spinSize ); | | |||
424 | | ||||
425 | if ( m_lineType == 1 ) | 410 | if ( m_lineType == 1 ) | ||
426 | { | 411 | { | ||
427 | m_useColor = new QCheckBox( i18n( "Inner color:" ), gb2 ); | 412 | tmplabel = new QLabel( i18n( "Shape fill:" ), widget); | ||
428 | gridlay2->addWidget( m_useColor, 1, 0 ); | 413 | gridLayout->addWidget( tmplabel, row+1, 0, Qt::AlignRight ); | ||
429 | m_innerColor = new KColorButton( gb2 ); | 414 | QHBoxLayout * colorlay = new QHBoxLayout(widget); | ||
430 | gridlay2->addWidget( m_innerColor, 1, 1 ); | 415 | m_useColor = new QCheckBox( i18n( "Enabled" ), widget ); | ||
416 | colorlay->addWidget(m_useColor); | ||||
417 | m_innerColor = new KColorButton( widget ); | ||||
418 | colorlay->addWidget( m_innerColor); | ||||
419 | gridLayout->addLayout( colorlay, row+1, 1 ); | ||||
431 | } | 420 | } | ||
432 | 421 | | |||
433 | if ( m_lineType == 0 ) | 422 | if ( m_lineType == 0 ) | ||
434 | { | 423 | { | ||
435 | m_spinLL->setRange( -500, 500 ); | 424 | m_spinLL->setRange( -500, 500 ); | ||
436 | m_spinLL->setValue( m_lineAnn->lineLeadingForwardPoint() ); | 425 | m_spinLL->setValue( m_lineAnn->lineLeadingForwardPoint() ); | ||
437 | m_spinLLE->setRange( 0, 500 ); | 426 | m_spinLLE->setRange( 0, 500 ); | ||
438 | m_spinLLE->setValue( m_lineAnn->lineLeadingBackwardPoint() ); | 427 | m_spinLLE->setValue( m_lineAnn->lineLeadingBackwardPoint() ); | ||
439 | } | 428 | } | ||
440 | else if ( m_lineType == 1 ) | 429 | else if ( m_lineType == 1 ) | ||
441 | { | 430 | { | ||
442 | m_innerColor->setColor( m_lineAnn->lineInnerColor() ); | 431 | m_innerColor->setColor( m_lineAnn->lineInnerColor() ); | ||
443 | if ( m_lineAnn->lineInnerColor().isValid() ) | 432 | if ( m_lineAnn->lineInnerColor().isValid() ) | ||
444 | { | 433 | { | ||
445 | m_useColor->setChecked( true ); | 434 | m_useColor->setChecked( true ); | ||
446 | } | 435 | } | ||
447 | else | 436 | else | ||
448 | { | 437 | { | ||
449 | m_innerColor->setEnabled( false ); | 438 | m_innerColor->setEnabled( false ); | ||
450 | } | 439 | } | ||
451 | } | 440 | } | ||
452 | m_spinSize->setRange( 1, 100 ); | 441 | m_spinSize->setRange( 1, 100 ); | ||
you're going to have conflicts, AFAICS this "only for PDF documents" is gone. aacid: you're going to have conflicts, AFAICS this "only for PDF documents" is gone. | |||||
453 | m_spinSize->setValue( m_lineAnn->style().width() ); | 442 | m_spinSize->setValue( m_lineAnn->style().width() ); | ||
454 | 443 | | |||
455 | if ( m_lineType == 0 ) | 444 | if ( m_lineType == 0 ) | ||
456 | { | 445 | { | ||
457 | connect( m_spinLL, SIGNAL(valueChanged(double)), this, SIGNAL(dataChanged()) ); | 446 | connect( m_spinLL, SIGNAL(valueChanged(double)), this, SIGNAL(dataChanged()) ); | ||
458 | connect( m_spinLLE, SIGNAL(valueChanged(double)), this, SIGNAL(dataChanged()) ); | 447 | connect( m_spinLLE, SIGNAL(valueChanged(double)), this, SIGNAL(dataChanged()) ); | ||
459 | } | 448 | } | ||
460 | else if ( m_lineType == 1 ) | 449 | else if ( m_lineType == 1 ) | ||
461 | { | 450 | { | ||
462 | connect( m_innerColor, &KColorButton::changed, this, &AnnotationWidget::dataChanged ); | 451 | connect( m_innerColor, &KColorButton::changed, this, &AnnotationWidget::dataChanged ); | ||
463 | connect( m_useColor, &QAbstractButton::toggled, this, &AnnotationWidget::dataChanged ); | 452 | connect( m_useColor, &QAbstractButton::toggled, this, &AnnotationWidget::dataChanged ); | ||
464 | connect(m_useColor, &QCheckBox::toggled, m_innerColor, &KColorButton::setEnabled); | 453 | connect(m_useColor, &QCheckBox::toggled, m_innerColor, &KColorButton::setEnabled); | ||
465 | } | 454 | } | ||
466 | connect( m_spinSize, SIGNAL(valueChanged(double)), this, SIGNAL(dataChanged()) ); | 455 | connect( m_spinSize, SIGNAL(valueChanged(double)), this, SIGNAL(dataChanged()) ); | ||
467 | 456 | | |||
468 | return widget; | 457 | return; | ||
469 | } | 458 | } | ||
470 | 459 | | |||
471 | void LineAnnotationWidget::applyChanges() | 460 | void LineAnnotationWidget::applyChanges() | ||
472 | { | 461 | { | ||
473 | AnnotationWidget::applyChanges(); | 462 | AnnotationWidget::applyChanges(); | ||
474 | if ( m_lineType == 0 ) | 463 | if ( m_lineType == 0 ) | ||
475 | { | 464 | { | ||
476 | m_lineAnn->setLineLeadingForwardPoint( m_spinLL->value() ); | 465 | m_lineAnn->setLineLeadingForwardPoint( m_spinLL->value() ); | ||
Show All 16 Lines | |||||
493 | 482 | | |||
494 | 483 | | |||
495 | InkAnnotationWidget::InkAnnotationWidget( Okular::Annotation * ann ) | 484 | InkAnnotationWidget::InkAnnotationWidget( Okular::Annotation * ann ) | ||
496 | : AnnotationWidget( ann ) | 485 | : AnnotationWidget( ann ) | ||
497 | { | 486 | { | ||
498 | m_inkAnn = static_cast< Okular::InkAnnotation * >( ann ); | 487 | m_inkAnn = static_cast< Okular::InkAnnotation * >( ann ); | ||
499 | } | 488 | } | ||
500 | 489 | | |||
501 | QWidget * InkAnnotationWidget::createStyleWidget() | 490 | void InkAnnotationWidget::createStyleWidget(QGridLayout * gridLayout) | ||
502 | { | 491 | { | ||
503 | QWidget * widget = new QWidget(); | 492 | int row = gridLayout->rowCount(); | ||
504 | QVBoxLayout * lay = new QVBoxLayout( widget ); | 493 | QWidget * widget = (QWidget*)gridLayout->parent(); | ||
505 | lay->setMargin( 0 ); | 494 | QLabel * tmplabel = new QLabel( i18n( "&Size:" ), widget ); | ||
506 | 495 | | |||
507 | QGroupBox * gb2 = new QGroupBox( widget ); | 496 | gridLayout->addWidget( tmplabel, row, 0, Qt::AlignRight ); | ||
508 | lay->addWidget( gb2 ); | 497 | m_spinSize = new QDoubleSpinBox( widget ); | ||
509 | gb2->setTitle( i18n( "Style" ) ); | 498 | gridLayout->addWidget( m_spinSize, row, 1 ); | ||
510 | QGridLayout * gridlay2 = new QGridLayout( gb2 ); | 499 | tmplabel->setBuddy( m_spinSize ); | ||
511 | QLabel * tmplabel2 = new QLabel( i18n( "&Size:" ), gb2 ); | | |||
512 | gridlay2->addWidget( tmplabel2, 0, 0, Qt::AlignRight ); | | |||
513 | m_spinSize = new QDoubleSpinBox( gb2 ); | | |||
514 | gridlay2->addWidget( m_spinSize, 0, 1 ); | | |||
515 | tmplabel2->setBuddy( m_spinSize ); | | |||
516 | 500 | | |||
517 | m_spinSize->setRange( 1, 100 ); | 501 | m_spinSize->setRange( 1, 100 ); | ||
518 | m_spinSize->setValue( m_inkAnn->style().width() ); | 502 | m_spinSize->setValue( m_inkAnn->style().width() ); | ||
519 | 503 | | |||
520 | connect( m_spinSize, SIGNAL(valueChanged(double)), this, SIGNAL(dataChanged()) ); | 504 | connect( m_spinSize, SIGNAL(valueChanged(double)), this, SIGNAL(dataChanged()) ); | ||
521 | 505 | | |||
522 | return widget; | 506 | return; | ||
523 | } | 507 | } | ||
524 | 508 | | |||
525 | void InkAnnotationWidget::applyChanges() | 509 | void InkAnnotationWidget::applyChanges() | ||
526 | { | 510 | { | ||
527 | AnnotationWidget::applyChanges(); | 511 | AnnotationWidget::applyChanges(); | ||
528 | m_inkAnn->style().setWidth( m_spinSize->value() ); | 512 | m_inkAnn->style().setWidth( m_spinSize->value() ); | ||
529 | } | 513 | } | ||
530 | 514 | | |||
531 | 515 | | |||
532 | 516 | | |||
533 | HighlightAnnotationWidget::HighlightAnnotationWidget( Okular::Annotation * ann ) | 517 | HighlightAnnotationWidget::HighlightAnnotationWidget( Okular::Annotation * ann ) | ||
534 | : AnnotationWidget( ann ) | 518 | : AnnotationWidget( ann ) | ||
535 | { | 519 | { | ||
536 | m_hlAnn = static_cast< Okular::HighlightAnnotation * >( ann ); | 520 | m_hlAnn = static_cast< Okular::HighlightAnnotation * >( ann ); | ||
537 | } | 521 | } | ||
538 | 522 | | |||
539 | QWidget * HighlightAnnotationWidget::createStyleWidget() | 523 | void HighlightAnnotationWidget::createStyleWidget(QGridLayout * gridLayout) | ||
540 | { | 524 | { | ||
541 | QWidget * widget = new QWidget(); | 525 | int row = gridLayout->rowCount(); | ||
542 | QVBoxLayout * lay = new QVBoxLayout( widget ); | 526 | QWidget * widget = (QWidget*)gridLayout->parent(); | ||
543 | lay->setMargin( 0 ); | | |||
544 | QHBoxLayout * typelay = new QHBoxLayout(); | | |||
545 | lay->addLayout( typelay ); | | |||
546 | QLabel * tmplabel = new QLabel( i18n( "Type:" ), widget ); | 527 | QLabel * tmplabel = new QLabel( i18n( "Type:" ), widget ); | ||
547 | typelay->addWidget( tmplabel, 0, Qt::AlignRight ); | 528 | gridLayout->addWidget( tmplabel, row, 0, Qt::AlignRight); | ||
548 | m_typeCombo = new KComboBox( widget ); | 529 | m_typeCombo = new KComboBox( widget ); | ||
549 | tmplabel->setBuddy( m_typeCombo ); | 530 | tmplabel->setBuddy( m_typeCombo ); | ||
550 | typelay->addWidget( m_typeCombo ); | 531 | gridLayout->addWidget( m_typeCombo, row, 1 ); | ||
551 | 532 | | |||
552 | m_typeCombo->addItem( i18n( "Highlight" ) ); | 533 | m_typeCombo->addItem( i18n( "Highlight" ) ); | ||
553 | m_typeCombo->addItem( i18n( "Squiggle" ) ); | 534 | m_typeCombo->addItem( i18n( "Squiggle" ) ); | ||
554 | m_typeCombo->addItem( i18n( "Underline" ) ); | 535 | m_typeCombo->addItem( i18n( "Underline" ) ); | ||
555 | m_typeCombo->addItem( i18n( "Strike out" ) ); | 536 | m_typeCombo->addItem( i18n( "Strike out" ) ); | ||
556 | m_typeCombo->setCurrentIndex( m_hlAnn->highlightType() ); | 537 | m_typeCombo->setCurrentIndex( m_hlAnn->highlightType() ); | ||
557 | 538 | | |||
558 | connect( m_typeCombo, SIGNAL(currentIndexChanged(int)), this, SIGNAL(dataChanged()) ); | 539 | connect( m_typeCombo, SIGNAL(currentIndexChanged(int)), this, SIGNAL(dataChanged()) ); | ||
559 | 540 | | |||
560 | return widget; | 541 | return; | ||
561 | } | 542 | } | ||
562 | 543 | | |||
563 | void HighlightAnnotationWidget::applyChanges() | 544 | void HighlightAnnotationWidget::applyChanges() | ||
564 | { | 545 | { | ||
565 | AnnotationWidget::applyChanges(); | 546 | AnnotationWidget::applyChanges(); | ||
566 | m_hlAnn->setHighlightType( (Okular::HighlightAnnotation::HighlightType)m_typeCombo->currentIndex() ); | 547 | m_hlAnn->setHighlightType( (Okular::HighlightAnnotation::HighlightType)m_typeCombo->currentIndex() ); | ||
567 | } | 548 | } | ||
568 | 549 | | |||
569 | 550 | | |||
570 | 551 | | |||
571 | GeomAnnotationWidget::GeomAnnotationWidget( Okular::Annotation * ann ) | 552 | GeomAnnotationWidget::GeomAnnotationWidget( Okular::Annotation * ann ) | ||
572 | : AnnotationWidget( ann ) | 553 | : AnnotationWidget( ann ) | ||
573 | { | 554 | { | ||
574 | m_geomAnn = static_cast< Okular::GeomAnnotation * >( ann ); | 555 | m_geomAnn = static_cast< Okular::GeomAnnotation * >( ann ); | ||
575 | } | 556 | } | ||
576 | 557 | | |||
577 | QWidget * GeomAnnotationWidget::createStyleWidget() | 558 | void GeomAnnotationWidget::createStyleWidget(QGridLayout * gridLayout) | ||
578 | { | 559 | { | ||
579 | QWidget * widget = new QWidget(); | 560 | int row = gridLayout->rowCount(); | ||
580 | QGridLayout * lay = new QGridLayout( widget ); | 561 | QWidget * widget = (QWidget*)gridLayout->parent(); | ||
581 | lay->setMargin( 0 ); | | |||
582 | QLabel * tmplabel = new QLabel( i18n( "Type:" ), widget ); | 562 | QLabel * tmplabel = new QLabel( i18n( "Type:" ), widget ); | ||
583 | lay->addWidget( tmplabel, 0, 0, Qt::AlignRight ); | 563 | gridLayout->addWidget( tmplabel, row, 0, Qt::AlignRight); | ||
584 | m_typeCombo = new KComboBox( widget ); | 564 | m_typeCombo = new KComboBox( widget ); | ||
585 | tmplabel->setBuddy( m_typeCombo ); | 565 | tmplabel->setBuddy( m_typeCombo ); | ||
586 | lay->addWidget( m_typeCombo, 0, 1 ); | 566 | gridLayout->addWidget( m_typeCombo, row, 1 ); | ||
587 | m_useColor = new QCheckBox( i18n( "Inner color:" ), widget ); | 567 | tmplabel = new QLabel( i18n( "Shape fill:" ), widget); | ||
588 | lay->addWidget( m_useColor, 1, 0 ); | 568 | gridLayout->addWidget( tmplabel, row+1, 0, Qt::AlignRight ); | ||
569 | QHBoxLayout * colorlay = new QHBoxLayout(widget); | ||||
570 | m_useColor = new QCheckBox( i18n( "Enabled" ), widget ); | ||||
571 | colorlay->addWidget(m_useColor); | ||||
589 | m_innerColor = new KColorButton( widget ); | 572 | m_innerColor = new KColorButton( widget ); | ||
590 | lay->addWidget( m_innerColor, 1, 1 ); | 573 | colorlay->addWidget( m_innerColor); | ||
574 | gridLayout->addLayout( colorlay, row+1, 1 ); | ||||
591 | tmplabel = new QLabel( i18n( "&Size:" ), widget ); | 575 | tmplabel = new QLabel( i18n( "&Size:" ), widget ); | ||
592 | lay->addWidget( tmplabel, 2, 0, Qt::AlignRight ); | 576 | gridLayout->addWidget( tmplabel, row+2, 0, Qt::AlignRight ); | ||
593 | m_spinSize = new QDoubleSpinBox( widget ); | 577 | m_spinSize = new QDoubleSpinBox( widget ); | ||
594 | lay->addWidget( m_spinSize, 2, 1 ); | 578 | gridLayout->addWidget( m_spinSize, row+2, 1 ); | ||
595 | tmplabel->setBuddy( m_spinSize ); | 579 | tmplabel->setBuddy( m_spinSize ); | ||
596 | 580 | | |||
597 | m_typeCombo->addItem( i18n( "Rectangle" ) ); | 581 | m_typeCombo->addItem( i18n( "Rectangle" ) ); | ||
598 | m_typeCombo->addItem( i18n( "Ellipse" ) ); | 582 | m_typeCombo->addItem( i18n( "Ellipse" ) ); | ||
599 | m_typeCombo->setCurrentIndex( m_geomAnn->geometricalType() ); | 583 | m_typeCombo->setCurrentIndex( m_geomAnn->geometricalType() ); | ||
600 | m_innerColor->setColor( m_geomAnn->geometricalInnerColor() ); | 584 | m_innerColor->setColor( m_geomAnn->geometricalInnerColor() ); | ||
601 | if ( m_geomAnn->geometricalInnerColor().isValid() ) | 585 | if ( m_geomAnn->geometricalInnerColor().isValid() ) | ||
602 | { | 586 | { | ||
603 | m_useColor->setChecked( true ); | 587 | m_useColor->setChecked( true ); | ||
604 | } | 588 | } | ||
605 | else | 589 | else | ||
606 | { | 590 | { | ||
607 | m_innerColor->setEnabled( false ); | 591 | m_innerColor->setEnabled( false ); | ||
608 | } | 592 | } | ||
609 | m_spinSize->setRange( 0, 100 ); | 593 | m_spinSize->setRange( 0, 100 ); | ||
610 | m_spinSize->setValue( m_geomAnn->style().width() ); | 594 | m_spinSize->setValue( m_geomAnn->style().width() ); | ||
611 | 595 | | |||
612 | connect( m_typeCombo, SIGNAL(currentIndexChanged(int)), this, SIGNAL(dataChanged()) ); | 596 | connect( m_typeCombo, SIGNAL(currentIndexChanged(int)), this, SIGNAL(dataChanged()) ); | ||
613 | connect( m_innerColor, &KColorButton::changed, this, &AnnotationWidget::dataChanged ); | 597 | connect( m_innerColor, &KColorButton::changed, this, &AnnotationWidget::dataChanged ); | ||
614 | connect( m_useColor, &QAbstractButton::toggled, this, &AnnotationWidget::dataChanged ); | 598 | connect( m_useColor, &QAbstractButton::toggled, this, &AnnotationWidget::dataChanged ); | ||
615 | connect(m_useColor, &QCheckBox::toggled, m_innerColor, &KColorButton::setEnabled); | 599 | connect(m_useColor, &QCheckBox::toggled, m_innerColor, &KColorButton::setEnabled); | ||
616 | connect( m_spinSize, SIGNAL(valueChanged(double)), this, SIGNAL(dataChanged()) ); | 600 | connect( m_spinSize, SIGNAL(valueChanged(double)), this, SIGNAL(dataChanged()) ); | ||
617 | 601 | | |||
618 | return widget; | 602 | return; | ||
619 | } | 603 | } | ||
620 | 604 | | |||
621 | void GeomAnnotationWidget::applyChanges() | 605 | void GeomAnnotationWidget::applyChanges() | ||
622 | { | 606 | { | ||
623 | AnnotationWidget::applyChanges(); | 607 | AnnotationWidget::applyChanges(); | ||
624 | m_geomAnn->setGeometricalType( (Okular::GeomAnnotation::GeomType)m_typeCombo->currentIndex() ); | 608 | m_geomAnn->setGeometricalType( (Okular::GeomAnnotation::GeomType)m_typeCombo->currentIndex() ); | ||
625 | if ( !m_useColor->isChecked() ) | 609 | if ( !m_useColor->isChecked() ) | ||
626 | { | 610 | { | ||
Show All 9 Lines | |||||
636 | 620 | | |||
637 | 621 | | |||
638 | FileAttachmentAnnotationWidget::FileAttachmentAnnotationWidget( Okular::Annotation * ann ) | 622 | FileAttachmentAnnotationWidget::FileAttachmentAnnotationWidget( Okular::Annotation * ann ) | ||
639 | : AnnotationWidget( ann ), m_pixmapSelector( nullptr ) | 623 | : AnnotationWidget( ann ), m_pixmapSelector( nullptr ) | ||
640 | { | 624 | { | ||
641 | m_attachAnn = static_cast< Okular::FileAttachmentAnnotation * >( ann ); | 625 | m_attachAnn = static_cast< Okular::FileAttachmentAnnotation * >( ann ); | ||
642 | } | 626 | } | ||
643 | 627 | | |||
644 | QWidget * FileAttachmentAnnotationWidget::createStyleWidget() | 628 | void FileAttachmentAnnotationWidget::createStyleWidget(QGridLayout * gridLayout) | ||
645 | { | 629 | { | ||
646 | QWidget * widget = new QWidget(); | 630 | QWidget * widget = new QWidget(); | ||
647 | QVBoxLayout * lay = new QVBoxLayout( widget ); | 631 | QVBoxLayout * lay = new QVBoxLayout( widget ); | ||
648 | lay->setMargin( 0 ); | 632 | lay->setMargin( 0 ); | ||
649 | QGroupBox * gb = new QGroupBox( widget ); | 633 | QGroupBox * gb = new QGroupBox( widget ); | ||
650 | lay->addWidget( gb ); | 634 | lay->addWidget( gb ); | ||
651 | gb->setTitle( i18n( "File Attachment Symbol" ) ); | 635 | gb->setTitle( i18n( "File Attachment Symbol" ) ); | ||
652 | QHBoxLayout * gblay = new QHBoxLayout( gb ); | 636 | QHBoxLayout * gblay = new QHBoxLayout( gb ); | ||
653 | m_pixmapSelector = new PixmapPreviewSelector( gb ); | 637 | m_pixmapSelector = new PixmapPreviewSelector( gb ); | ||
654 | gblay->addWidget( m_pixmapSelector ); | 638 | gblay->addWidget( m_pixmapSelector ); | ||
655 | m_pixmapSelector->setEditable( true ); | 639 | m_pixmapSelector->setEditable( true ); | ||
656 | 640 | | |||
657 | m_pixmapSelector->addItem( i18nc( "Symbol for file attachment annotations", "Graph" ), QStringLiteral("graph") ); | 641 | m_pixmapSelector->addItem( i18nc( "Symbol for file attachment annotations", "Graph" ), QStringLiteral("graph") ); | ||
658 | m_pixmapSelector->addItem( i18nc( "Symbol for file attachment annotations", "Push Pin" ), QStringLiteral("pushpin") ); | 642 | m_pixmapSelector->addItem( i18nc( "Symbol for file attachment annotations", "Push Pin" ), QStringLiteral("pushpin") ); | ||
659 | m_pixmapSelector->addItem( i18nc( "Symbol for file attachment annotations", "Paperclip" ), QStringLiteral("paperclip") ); | 643 | m_pixmapSelector->addItem( i18nc( "Symbol for file attachment annotations", "Paperclip" ), QStringLiteral("paperclip") ); | ||
660 | m_pixmapSelector->addItem( i18nc( "Symbol for file attachment annotations", "Tag" ), QStringLiteral("tag") ); | 644 | m_pixmapSelector->addItem( i18nc( "Symbol for file attachment annotations", "Tag" ), QStringLiteral("tag") ); | ||
661 | m_pixmapSelector->setIcon( m_attachAnn->fileIconName() ); | 645 | m_pixmapSelector->setIcon( m_attachAnn->fileIconName() ); | ||
662 | 646 | | |||
663 | connect( m_pixmapSelector, &PixmapPreviewSelector::iconChanged, this, &AnnotationWidget::dataChanged ); | 647 | connect( m_pixmapSelector, &PixmapPreviewSelector::iconChanged, this, &AnnotationWidget::dataChanged ); | ||
664 | 648 | | |||
665 | return widget; | 649 | return; | ||
666 | } | 650 | } | ||
667 | 651 | | |||
668 | QWidget * FileAttachmentAnnotationWidget::createExtraWidget() | 652 | QWidget * FileAttachmentAnnotationWidget::createExtraWidget() | ||
669 | { | 653 | { | ||
670 | QWidget * widget = new QWidget(); | 654 | QWidget * widget = new QWidget(); | ||
671 | widget->setWindowTitle( i18nc( "'File' as normal file, that can be opened, saved, etc..", "File" ) ); | 655 | widget->setWindowTitle( i18nc( "'File' as normal file, that can be opened, saved, etc..", "File" ) ); | ||
672 | 656 | | |||
673 | Okular::EmbeddedFile *ef = m_attachAnn->embeddedFile(); | 657 | Okular::EmbeddedFile *ef = m_attachAnn->embeddedFile(); | ||
▲ Show 20 Lines • Show All 65 Lines • ▼ Show 20 Line(s) | |||||
739 | } | 723 | } | ||
740 | 724 | | |||
741 | CaretAnnotationWidget::CaretAnnotationWidget( Okular::Annotation * ann ) | 725 | CaretAnnotationWidget::CaretAnnotationWidget( Okular::Annotation * ann ) | ||
742 | : AnnotationWidget( ann ), m_pixmapSelector( nullptr ) | 726 | : AnnotationWidget( ann ), m_pixmapSelector( nullptr ) | ||
743 | { | 727 | { | ||
744 | m_caretAnn = static_cast< Okular::CaretAnnotation * >( ann ); | 728 | m_caretAnn = static_cast< Okular::CaretAnnotation * >( ann ); | ||
745 | } | 729 | } | ||
746 | 730 | | |||
747 | QWidget * CaretAnnotationWidget::createStyleWidget() | 731 | void CaretAnnotationWidget::createStyleWidget(QGridLayout * gridLayout) | ||
748 | { | 732 | { | ||
749 | QWidget * widget = new QWidget(); | 733 | QWidget * widget = new QWidget(); | ||
750 | QVBoxLayout * lay = new QVBoxLayout( widget ); | 734 | QVBoxLayout * lay = new QVBoxLayout( widget ); | ||
751 | lay->setMargin( 0 ); | 735 | lay->setMargin( 0 ); | ||
752 | QGroupBox * gb = new QGroupBox( widget ); | 736 | QGroupBox * gb = new QGroupBox( widget ); | ||
753 | lay->addWidget( gb ); | 737 | lay->addWidget( gb ); | ||
754 | gb->setTitle( i18n( "Caret Symbol" ) ); | 738 | gb->setTitle( i18n( "Caret Symbol" ) ); | ||
755 | QHBoxLayout * gblay = new QHBoxLayout( gb ); | 739 | QHBoxLayout * gblay = new QHBoxLayout( gb ); | ||
756 | m_pixmapSelector = new PixmapPreviewSelector( gb ); | 740 | m_pixmapSelector = new PixmapPreviewSelector( gb ); | ||
757 | gblay->addWidget( m_pixmapSelector ); | 741 | gblay->addWidget( m_pixmapSelector ); | ||
758 | 742 | | |||
shubham: Why not qobject_cast? | |||||
759 | m_pixmapSelector->addItem( i18nc( "Symbol for caret annotations", "None" ), QStringLiteral("caret-none") ); | 743 | m_pixmapSelector->addItem( i18nc( "Symbol for caret annotations", "None" ), QStringLiteral("caret-none") ); | ||
760 | m_pixmapSelector->addItem( i18nc( "Symbol for caret annotations", "P" ), QStringLiteral("caret-p") ); | 744 | m_pixmapSelector->addItem( i18nc( "Symbol for caret annotations", "P" ), QStringLiteral("caret-p") ); | ||
761 | m_pixmapSelector->setIcon( caretSymbolToIcon( m_caretAnn->caretSymbol() ) ); | 745 | m_pixmapSelector->setIcon( caretSymbolToIcon( m_caretAnn->caretSymbol() ) ); | ||
762 | 746 | | |||
763 | connect( m_pixmapSelector, &PixmapPreviewSelector::iconChanged, this, &AnnotationWidget::dataChanged ); | 747 | connect( m_pixmapSelector, &PixmapPreviewSelector::iconChanged, this, &AnnotationWidget::dataChanged ); | ||
764 | 748 | | |||
765 | return widget; | 749 | return; | ||
aacid: return at the end of a function screams really bad at me, please fix :) | |||||
766 | } | 750 | } | ||
767 | 751 | | |||
768 | void CaretAnnotationWidget::applyChanges() | 752 | void CaretAnnotationWidget::applyChanges() | ||
769 | { | 753 | { | ||
770 | AnnotationWidget::applyChanges(); | 754 | AnnotationWidget::applyChanges(); | ||
771 | m_caretAnn->setCaretSymbol( caretSymbolFromIcon( m_pixmapSelector->icon() ) ); | 755 | m_caretAnn->setCaretSymbol( caretSymbolFromIcon( m_pixmapSelector->icon() ) ); | ||
772 | } | 756 | } | ||
773 | 757 | | |||
774 | 758 | | |||
775 | 759 | | |||
776 | #include "moc_annotationwidgets.cpp" | 760 | #include "moc_annotationwidgets.cpp" |
Is it correct to set this growth policy? I have not found any guideline on the HIG. Compared to the grid layout where label and widget take the same amount of horizontal space, now the widgets take way more space making it a little ugly for some annotation tools. Any idea?