Changeset View
Changeset View
Standalone View
Standalone View
ui/annotationwidgets.cpp
Show First 20 Lines • Show All 214 Lines • ▼ Show 20 Line(s) | 213 | { | |||
---|---|---|---|---|---|
215 | gridlayout->addWidget( tmplabel, 1, 0, Qt::AlignRight ); | 215 | gridlayout->addWidget( tmplabel, 1, 0, Qt::AlignRight ); | ||
216 | m_opacity = new QSpinBox( widget ); | 216 | m_opacity = new QSpinBox( widget ); | ||
217 | m_opacity->setRange( 0, 100 ); | 217 | m_opacity->setRange( 0, 100 ); | ||
218 | m_opacity->setValue( (int)( m_ann->style().opacity() * 100 ) ); | 218 | m_opacity->setValue( (int)( m_ann->style().opacity() * 100 ) ); | ||
219 | m_opacity->setSuffix( i18nc( "Suffix for the opacity level, eg '80 %'", " %" ) ); | 219 | m_opacity->setSuffix( i18nc( "Suffix for the opacity level, eg '80 %'", " %" ) ); | ||
220 | tmplabel->setBuddy( m_opacity ); | 220 | tmplabel->setBuddy( m_opacity ); | ||
221 | gridlayout->addWidget( m_opacity, 1, 1 ); | 221 | gridlayout->addWidget( m_opacity, 1, 1 ); | ||
222 | } | 222 | } | ||
223 | 223 | | |||
sander: Why this whitespace change? | |||||
224 | QWidget * styleWidget = createStyleWidget(); | 224 | QWidget * styleWidget = createStyleWidget(); | ||
225 | if ( styleWidget ) | 225 | if ( styleWidget ) | ||
226 | gridlayout->addWidget( styleWidget, 2, 0, 1, 2 ); | 226 | gridlayout->addWidget( styleWidget, 2, 0, 1, 2 ); | ||
227 | 227 | | |||
228 | gridlayout->addItem( new QSpacerItem( 5, 5, QSizePolicy::Fixed, QSizePolicy::MinimumExpanding ), 3, 0 ); | 228 | gridlayout->addItem( new QSpacerItem( 5, 5, QSizePolicy::Fixed, QSizePolicy::MinimumExpanding ), 3, 0 ); | ||
229 | 229 | | |||
230 | if ( m_colorBn ) | 230 | if ( m_colorBn ) | ||
231 | connect( m_colorBn, &KColorButton::changed, this, &AnnotationWidget::dataChanged ); | 231 | connect( m_colorBn, &KColorButton::changed, this, &AnnotationWidget::dataChanged ); | ||
▲ Show 20 Lines • Show All 49 Lines • ▼ Show 20 Line(s) | 280 | bool TextAnnotationWidget::hasOpacityBox() const { | |||
281 | return !isTypewriter(); | 281 | return !isTypewriter(); | ||
282 | } | 282 | } | ||
283 | 283 | | |||
284 | void TextAnnotationWidget::applyChanges() | 284 | void TextAnnotationWidget::applyChanges() | ||
285 | { | 285 | { | ||
286 | AnnotationWidget::applyChanges(); | 286 | AnnotationWidget::applyChanges(); | ||
287 | if ( m_textAnn->textType() == Okular::TextAnnotation::Linked ) | 287 | if ( m_textAnn->textType() == Okular::TextAnnotation::Linked ) | ||
288 | { | 288 | { | ||
289 | Q_ASSERT( m_pixmapSelector ); | ||||
289 | m_textAnn->setTextIcon( m_pixmapSelector->icon() ); | 290 | m_textAnn->setTextIcon( m_pixmapSelector->icon() ); | ||
290 | } | 291 | } | ||
291 | else if ( m_textAnn->textType() == Okular::TextAnnotation::InPlace ) | 292 | else if ( m_textAnn->textType() == Okular::TextAnnotation::InPlace ) | ||
292 | { | 293 | { | ||
294 | Q_ASSERT( m_fontReq ); | ||||
293 | m_textAnn->setTextFont( m_fontReq->font() ); | 295 | m_textAnn->setTextFont( m_fontReq->font() ); | ||
294 | if ( !isTypewriter() ) | 296 | if ( !isTypewriter() ) | ||
295 | { | 297 | { | ||
298 | Q_ASSERT( m_textAlign && m_spinWidth ); | ||||
296 | m_textAnn->setInplaceAlignment( m_textAlign->currentIndex() ); | 299 | m_textAnn->setInplaceAlignment( m_textAlign->currentIndex() ); | ||
297 | m_textAnn->style().setWidth( m_spinWidth->value() ); | 300 | m_textAnn->style().setWidth( m_spinWidth->value() ); | ||
298 | } | 301 | } | ||
302 | else | ||||
303 | { | ||||
304 | Q_ASSERT( m_textColorBn ); | ||||
305 | m_textAnn->setTextColor( m_textColorBn->color() ); | ||||
306 | } | ||||
299 | } | 307 | } | ||
300 | } | 308 | } | ||
301 | 309 | | |||
302 | void TextAnnotationWidget::createPopupNoteStyleUi( QWidget * widget, QVBoxLayout * layout ) { | 310 | void TextAnnotationWidget::createPopupNoteStyleUi( QWidget * widget, QVBoxLayout * layout ) { | ||
303 | QGroupBox * gb = new QGroupBox( widget ); | 311 | QGroupBox * gb = new QGroupBox( widget ); | ||
304 | layout->addWidget( gb ); | 312 | layout->addWidget( gb ); | ||
305 | QHBoxLayout * gblay = new QHBoxLayout( gb ); | 313 | QHBoxLayout * gblay = new QHBoxLayout( gb ); | ||
306 | gb->setTitle( i18n( "Icon" ) ); | 314 | gb->setTitle( i18n( "Icon" ) ); | ||
307 | addPixmapSelector( gb, gblay ); | 315 | addPixmapSelector( gb, gblay ); | ||
308 | } | 316 | } | ||
309 | 317 | | |||
310 | void TextAnnotationWidget::createInlineNoteStyleUi( QWidget * widget, QVBoxLayout * layout ) { | 318 | void TextAnnotationWidget::createInlineNoteStyleUi( QWidget * widget, QVBoxLayout * layout ) { | ||
311 | QGridLayout * innerlay = new QGridLayout(); | 319 | QGridLayout * innerlay = new QGridLayout(); | ||
312 | layout->addLayout( innerlay ); | 320 | layout->addLayout( innerlay ); | ||
313 | addFontRequester(widget, innerlay); | 321 | addFontRequester( widget, innerlay ); | ||
314 | addTextAlignComboBox(widget, innerlay); | 322 | addTextAlignComboBox( widget, innerlay ); | ||
315 | addWidthSpinBox(widget, innerlay); | 323 | addWidthSpinBox( widget, innerlay ); | ||
I think these whitespace changes should be in a separate patch (if they are desired at all). sander: I think these whitespace changes should be in a separate patch (if they are desired at all). | |||||
Desired, because I did them wrong in the first typewriter commit. To be honest, I'd find an extra commit saying "3 whitespace changes" more annoying. How about one single big style cleanup commit for the whole project (pro: helps to spare us periodic discussion about whitespaces for a while, con: remember to tell your tool to ignore whitespace changes when searching history for functional changes). tobiasdeiminger: Desired, because I did them wrong in the first typewriter commit. To be honest, I'd find an… | |||||
316 | } | 324 | } | ||
317 | 325 | | |||
318 | void TextAnnotationWidget::createTypewriterStyleUi( QWidget * widget, QVBoxLayout * layout ) { | 326 | void TextAnnotationWidget::createTypewriterStyleUi( QWidget * widget, QVBoxLayout * layout ) { | ||
319 | QGridLayout * innerlay = new QGridLayout(); | 327 | QGridLayout * innerlay = new QGridLayout(); | ||
320 | layout->addLayout( innerlay ); | 328 | layout->addLayout( innerlay ); | ||
321 | addFontRequester(widget, innerlay); | 329 | addFontRequester( widget, innerlay ); | ||
I think this whitespace change should be in a separate patch (if it is desired at all). sander: I think this whitespace change should be in a separate patch (if it is desired at all). | |||||
tobiasdeiminger: Same as above. | |||||
330 | addTextColorButton( widget, innerlay ); | ||||
322 | } | 331 | } | ||
323 | 332 | | |||
324 | void TextAnnotationWidget::addPixmapSelector( QWidget * widget, QLayout * layout ) | 333 | void TextAnnotationWidget::addPixmapSelector( QWidget * widget, QLayout * layout ) | ||
325 | { | 334 | { | ||
326 | m_pixmapSelector = new PixmapPreviewSelector( widget ); | 335 | m_pixmapSelector = new PixmapPreviewSelector( widget ); | ||
327 | layout->addWidget( m_pixmapSelector ); | 336 | layout->addWidget( m_pixmapSelector ); | ||
328 | m_pixmapSelector->addItem( i18n( "Comment" ), QStringLiteral("Comment") ); | 337 | m_pixmapSelector->addItem( i18n( "Comment" ), QStringLiteral("Comment") ); | ||
329 | m_pixmapSelector->addItem( i18n( "Help" ), QStringLiteral("Help") ); | 338 | m_pixmapSelector->addItem( i18n( "Help" ), QStringLiteral("Help") ); | ||
330 | m_pixmapSelector->addItem( i18n( "Insert" ), QStringLiteral("Insert") ); | 339 | m_pixmapSelector->addItem( i18n( "Insert" ), QStringLiteral("Insert") ); | ||
331 | m_pixmapSelector->addItem( i18n( "Key" ), QStringLiteral("Key") ); | 340 | m_pixmapSelector->addItem( i18n( "Key" ), QStringLiteral("Key") ); | ||
332 | m_pixmapSelector->addItem( i18n( "New Paragraph" ), QStringLiteral("NewParagraph") ); | 341 | m_pixmapSelector->addItem( i18n( "New Paragraph" ), QStringLiteral("NewParagraph") ); | ||
333 | m_pixmapSelector->addItem( i18n( "Note" ), QStringLiteral("Note") ); | 342 | m_pixmapSelector->addItem( i18n( "Note" ), QStringLiteral("Note") ); | ||
334 | m_pixmapSelector->addItem( i18n( "Paragraph" ), QStringLiteral("Paragraph") ); | 343 | m_pixmapSelector->addItem( i18n( "Paragraph" ), QStringLiteral("Paragraph") ); | ||
335 | m_pixmapSelector->setIcon( m_textAnn->textIcon() ); | 344 | m_pixmapSelector->setIcon( m_textAnn->textIcon() ); | ||
336 | connect( m_pixmapSelector, &PixmapPreviewSelector::iconChanged, this, &AnnotationWidget::dataChanged ); | 345 | connect( m_pixmapSelector, &PixmapPreviewSelector::iconChanged, this, &AnnotationWidget::dataChanged ); | ||
337 | } | 346 | } | ||
338 | 347 | | |||
339 | void TextAnnotationWidget::addFontRequester( QWidget * widget, QGridLayout * layout ) | 348 | void TextAnnotationWidget::addFontRequester( QWidget * widget, QGridLayout * layout ) | ||
340 | { | 349 | { | ||
350 | const int row = layout->rowCount(); | ||||
341 | QLabel * tmplabel = new QLabel( i18n( "Font:" ), widget ); | 351 | QLabel * tmplabel = new QLabel( i18n( "Font:" ), widget ); | ||
342 | layout->addWidget( tmplabel, 0, 0 ); | 352 | layout->addWidget( tmplabel, row, 0 ); | ||
343 | m_fontReq = new KFontRequester( widget ); | 353 | m_fontReq = new KFontRequester( widget ); | ||
344 | layout->addWidget( m_fontReq, 0, 1 ); | 354 | layout->addWidget( m_fontReq, row, 1 ); | ||
345 | m_fontReq->setFont( m_textAnn->textFont() ); | 355 | m_fontReq->setFont( m_textAnn->textFont() ); | ||
346 | connect( m_fontReq, &KFontRequester::fontSelected, this, &AnnotationWidget::dataChanged ); | 356 | connect( m_fontReq, &KFontRequester::fontSelected, this, &AnnotationWidget::dataChanged ); | ||
347 | } | 357 | } | ||
348 | 358 | | |||
359 | void TextAnnotationWidget::addTextColorButton( QWidget * widget, QGridLayout * layout ) | ||||
360 | { | ||||
361 | const int row = layout->rowCount(); | ||||
362 | QLabel * tmplabel = new QLabel( i18n( "&Text Color:" ), widget ); | ||||
363 | layout->addWidget( tmplabel, row, 0, Qt::AlignRight ); | ||||
364 | m_textColorBn = new KColorButton( widget ); | ||||
365 | m_textColorBn->setColor( m_textAnn->textColor() ); | ||||
366 | tmplabel->setBuddy( m_textColorBn ); | ||||
367 | layout->addWidget( m_textColorBn, row, 1 ); | ||||
368 | connect( m_textColorBn, &KColorButton::changed, this, &AnnotationWidget::dataChanged ); | ||||
369 | } | ||||
370 | | ||||
349 | void TextAnnotationWidget::addTextAlignComboBox( QWidget * widget, QGridLayout * layout ) | 371 | void TextAnnotationWidget::addTextAlignComboBox( QWidget * widget, QGridLayout * layout ) | ||
350 | { | 372 | { | ||
373 | const int row = layout->rowCount(); | ||||
351 | QLabel * tmplabel = new QLabel( i18n( "Align:" ), widget ); | 374 | QLabel * tmplabel = new QLabel( i18n( "Align:" ), widget ); | ||
352 | layout->addWidget( tmplabel, 1, 0 ); | 375 | layout->addWidget( tmplabel, row, 0 ); | ||
353 | m_textAlign = new KComboBox( widget ); | 376 | m_textAlign = new KComboBox( widget ); | ||
354 | layout->addWidget( m_textAlign, 1, 1 ); | 377 | layout->addWidget( m_textAlign, row, 1 ); | ||
355 | m_textAlign->addItem( i18n("Left") ); | 378 | m_textAlign->addItem( i18n("Left") ); | ||
356 | m_textAlign->addItem( i18n("Center") ); | 379 | m_textAlign->addItem( i18n("Center") ); | ||
357 | m_textAlign->addItem( i18n("Right") ); | 380 | m_textAlign->addItem( i18n("Right") ); | ||
358 | m_textAlign->setCurrentIndex( m_textAnn->inplaceAlignment() ); | 381 | m_textAlign->setCurrentIndex( m_textAnn->inplaceAlignment() ); | ||
359 | connect( m_textAlign, SIGNAL(currentIndexChanged(int)), this, SIGNAL(dataChanged()) ); | 382 | connect( m_textAlign, SIGNAL(currentIndexChanged(int)), this, SIGNAL(dataChanged()) ); | ||
360 | } | 383 | } | ||
361 | 384 | | |||
362 | void TextAnnotationWidget::addWidthSpinBox( QWidget * widget, QGridLayout * layout ) | 385 | void TextAnnotationWidget::addWidthSpinBox( QWidget * widget, QGridLayout * layout ) | ||
363 | { | 386 | { | ||
387 | const int row = layout->rowCount(); | ||||
364 | QLabel * tmplabel = new QLabel( i18n( "Border Width:" ), widget ); | 388 | QLabel * tmplabel = new QLabel( i18n( "Border Width:" ), widget ); | ||
365 | layout->addWidget( tmplabel, 2, 0, Qt::AlignRight ); | 389 | layout->addWidget( tmplabel, row, 0, Qt::AlignRight ); | ||
366 | m_spinWidth = new QDoubleSpinBox( widget ); | 390 | m_spinWidth = new QDoubleSpinBox( widget ); | ||
367 | layout->addWidget( m_spinWidth, 2, 1 ); | 391 | layout->addWidget( m_spinWidth, row, 1 ); | ||
368 | tmplabel->setBuddy( m_spinWidth ); | 392 | tmplabel->setBuddy( m_spinWidth ); | ||
369 | m_spinWidth->setRange( 0, 100 ); | 393 | m_spinWidth->setRange( 0, 100 ); | ||
370 | m_spinWidth->setValue( m_textAnn->style().width() ); | 394 | m_spinWidth->setValue( m_textAnn->style().width() ); | ||
371 | m_spinWidth->setSingleStep( 0.1 ); | 395 | m_spinWidth->setSingleStep( 0.1 ); | ||
372 | connect( m_spinWidth, SIGNAL(valueChanged(double)), this, SIGNAL(dataChanged()) ); | 396 | connect( m_spinWidth, SIGNAL(valueChanged(double)), this, SIGNAL(dataChanged()) ); | ||
373 | } | 397 | } | ||
374 | 398 | | |||
375 | StampAnnotationWidget::StampAnnotationWidget( Okular::Annotation * ann ) | 399 | StampAnnotationWidget::StampAnnotationWidget( Okular::Annotation * ann ) | ||
▲ Show 20 Lines • Show All 449 Lines • Show Last 20 Lines |
Why this whitespace change?