~smartboyhw/ubuntu/raring/calligra/2.6.0-0ubuntu1

« back to all changes in this revision

Viewing changes to libs/main/config/KoConfigGridPage.cpp

  • Committer: Package Import Robot
  • Author(s): Philip Muškovac
  • Date: 2012-10-23 21:09:16 UTC
  • mfrom: (1.1.13)
  • Revision ID: package-import@ubuntu.com-20121023210916-m82w6zxnxhaxz7va
Tags: 1:2.5.90-0ubuntu1
* New upstream alpha release (LP: #1070436)
  - Add libkactivities-dev and libopenimageio-dev to build-depends
  - Add kubuntu_build_calligraactive.diff to build calligraactive by default
  - Add package for calligraauthor and move files that are shared between
    calligrawords and calligraauthor to calligrawords-common
* Document the patches
* Remove numbers from patches so they follow the same naming scheme as
  the rest of our patches.
* calligra-data breaks replaces krita-data (<< 1:2.5.3) (LP: #1071686)

Show diffs side-by-side

added added

removed removed

Lines of Context:
24
24
#include <KoGridData.h>
25
25
#include <KoUnitDoubleSpinBox.h>
26
26
#include <KoAspectButton.h>
 
27
#include <KoPart.h>
27
28
 
28
29
#include <kcolorbutton.h>
29
30
#include <kdialog.h>
30
31
 
31
32
#include <QCheckBox>
32
33
#include <QGroupBox>
33
 
#include <QGridLayout>
 
34
#include <QFormLayout>
34
35
#include <QHBoxLayout>
35
36
#include <QLabel>
36
37
 
57
58
{
58
59
    setObjectName(name);
59
60
 
60
 
    d->config = d->doc->componentData().config();
 
61
    d->config = d->doc->documentPart()->componentData().config();
61
62
 
62
63
    KoUnit unit = d->doc->unit();
63
64
    KoGridData &gd = d->doc->gridData();
64
65
 
65
66
    QGroupBox* generalGrp = new QGroupBox(i18n("Grid"), this);
66
 
    QGridLayout *layoutGeneral = new QGridLayout(generalGrp);
67
 
    QLabel * showGridLabel = new QLabel(i18n("Show grid:"), generalGrp);
68
 
    d->gridChBox = new QCheckBox("", generalGrp);
 
67
    QFormLayout *layoutGeneral = new QFormLayout(generalGrp);
 
68
    d->gridChBox = new QCheckBox(generalGrp);
69
69
    d->gridChBox->setChecked(gd.showGrid());
70
 
    QLabel * snapGridLabel = new QLabel(i18n("Snap to grid:"), generalGrp);
71
 
    d->snapChBox = new QCheckBox("", generalGrp);
 
70
    d->snapChBox = new QCheckBox(generalGrp);
72
71
    d->snapChBox->setChecked(gd.snapToGrid());
73
 
    QLabel* gridColorLbl = new QLabel(i18n("Grid color:"), generalGrp);
74
72
    d->gridColorBtn = new KColorButton(gd.gridColor(), generalGrp);
75
73
#if KDE_IS_VERSION(4,5,0)
76
74
    d->gridColorBtn->setAlphaChannelEnabled(true);
77
75
#endif
78
 
    gridColorLbl->setBuddy(d->gridColorBtn);
79
 
    layoutGeneral->addWidget(showGridLabel, 0, 0);
80
 
    layoutGeneral->addWidget(d->gridChBox, 0, 1);
81
 
    layoutGeneral->addWidget(snapGridLabel, 1, 0);
82
 
    layoutGeneral->addWidget(d->snapChBox, 1, 1);
83
 
    layoutGeneral->addWidget(gridColorLbl, 2, 0);
84
 
    layoutGeneral->addWidget(d->gridColorBtn, 2, 1);
 
76
    layoutGeneral->addRow(i18n("Show grid:"), d->gridChBox);
 
77
    layoutGeneral->addRow(i18n("Snap to grid:"), d->snapChBox);
 
78
    layoutGeneral->addRow(i18n("Grid color:"), d->gridColorBtn);
85
79
 
86
80
    QGroupBox* spacingGrp = new QGroupBox(i18n("Spacing"), this);
87
81
    QHBoxLayout *hboxLayout = new QHBoxLayout(spacingGrp);
88
 
    QGridLayout* layoutSpacingGrp = new QGridLayout();
89
 
    QLabel* spaceHorizLbl = new QLabel(i18nc("Horizontal grid spacing", "&Horizontal:"));
 
82
    QFormLayout *layoutSpacingGrp = new QFormLayout();
90
83
    d->spaceHorizUSpin = new KoUnitDoubleSpinBox(spacingGrp);
91
84
    d->spaceHorizUSpin->setMinMaxStep(0.0, 1000, 0.1);
92
85
    d->spaceHorizUSpin->setUnit(unit);
93
86
    d->spaceHorizUSpin->changeValue(gd.gridX());
94
 
    spaceHorizLbl->setBuddy(d->spaceHorizUSpin);
95
 
    QLabel* spaceVertLbl = new QLabel(i18nc("Vertical grid spacing", "&Vertical:"));
96
87
    d->spaceVertUSpin = new KoUnitDoubleSpinBox(spacingGrp);
97
88
    d->spaceVertUSpin->setMinMaxStep(0.0, 1000, 0.1);
98
89
    d->spaceVertUSpin->setUnit(unit);
99
90
    d->spaceVertUSpin->changeValue(gd.gridY());
100
 
    spaceVertLbl->setBuddy(d->spaceVertUSpin);
101
 
    layoutSpacingGrp->addWidget(spaceHorizLbl, 0, 0);
102
 
    layoutSpacingGrp->addWidget(d->spaceHorizUSpin, 0, 1);
103
 
    layoutSpacingGrp->addWidget(spaceVertLbl, 1, 0);
104
 
    layoutSpacingGrp->addWidget(d->spaceVertUSpin, 1, 1);
 
91
    layoutSpacingGrp->addRow(i18nc("Horizontal grid spacing", "&Horizontal:"), d->spaceHorizUSpin);
 
92
    layoutSpacingGrp->addRow(i18nc("Vertical grid spacing", "&Vertical:"), d->spaceVertUSpin);
105
93
    hboxLayout->addLayout(layoutSpacingGrp);
106
94
    d->bnLinkSpacing = new KoAspectButton(spacingGrp);
107
95
    d->bnLinkSpacing->setKeepAspectRatio(gd.gridX() == gd.gridY());
108
96
    hboxLayout->addWidget(d->bnLinkSpacing);
 
97
    hboxLayout->addStretch();
109
98
 
110
99
    QVBoxLayout *mainLayout = new QVBoxLayout(this);
111
 
 
112
 
    QGridLayout* gl = new QGridLayout();
113
 
    gl->setSpacing(KDialog::spacingHint());
114
 
    gl->setMargin(KDialog::marginHint());
115
 
    gl->addWidget(generalGrp, 0, 0, 1, 2);
116
 
    gl->addItem(new QSpacerItem(0, 0), 1, 1);
117
 
    gl->addWidget(spacingGrp, 2, 0, 1, 2);
118
 
    gl->addItem(new QSpacerItem(0, 0), 4, 0, 1, 2);
119
 
    mainLayout->addLayout(gl);
 
100
    mainLayout->setMargin(0);
 
101
    mainLayout->addWidget(generalGrp);
 
102
    mainLayout->addWidget(spacingGrp);
120
103
    mainLayout->addStretch();
121
104
 
122
105
    setValuesFromGrid(d->doc->gridData());