~ubuntu-branches/ubuntu/saucy/digikam/saucy

« back to all changes in this revision

Viewing changes to imageplugins/decorate/inserttexttool.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Scott Kitterman
  • Date: 2010-12-21 23:19:11 UTC
  • mfrom: (1.2.33 upstream) (3.1.7 experimental)
  • Revision ID: james.westby@ubuntu.com-20101221231911-z9jip7s5aht1jqn9
Tags: 2:1.7.0-1ubuntu1
* Merge from Debian Experimental. Remaining Ubuntu changes:
  - Export .pot name and copy to plugins in debian/rules
  - Version build-depends on kipi-plugins-dev to ensure build is against the
    same version on all archs
* Drop debian/patches/kubuntu_01_linker.diff, incoporated upstream
* Remove patches directory and unused patches

Show diffs side-by-side

added added

removed removed

Lines of Context:
83
83
        textEdit(0),
84
84
        previewWidget(0),
85
85
        gboxSettings(0)
86
 
        {}
 
86
    {}
87
87
 
88
88
    static const QString configGroupName;
89
89
    static const QString configTextRotationEntry;
125
125
// --------------------------------------------------------
126
126
 
127
127
InsertTextTool::InsertTextTool(QObject* parent)
128
 
              : EditorTool(parent),
129
 
                d(new InsertTextToolPriv)
 
128
    : EditorTool(parent),
 
129
      d(new InsertTextToolPriv)
130
130
{
131
131
    setObjectName("inserttext");
132
132
    setToolName(i18n("Insert Text"));
134
134
 
135
135
    // -------------------------------------------------------------
136
136
 
137
 
    QFrame *frame = new QFrame(0);
 
137
    QFrame* frame = new QFrame(0);
138
138
    frame->setFrameStyle(QFrame::Panel|QFrame::Sunken);
139
139
 
140
140
    QVBoxLayout* l   = new QVBoxLayout(frame);
164
164
    // -------------------------------------------------------------
165
165
 
166
166
    KIconLoader icon;
167
 
    QWidget *alignBox   = new QWidget();
168
 
    QHBoxLayout *hlay   = new QHBoxLayout(alignBox);
 
167
    QWidget* alignBox   = new QWidget();
 
168
    QHBoxLayout* hlay   = new QHBoxLayout(alignBox);
169
169
    d->alignButtonGroup = new QButtonGroup(alignBox);
170
170
    d->alignButtonGroup->setExclusive(true);
171
171
 
172
 
    QToolButton *alignLeft = new QToolButton(alignBox);
 
172
    QToolButton* alignLeft = new QToolButton(alignBox);
173
173
    d->alignButtonGroup->addButton(alignLeft, InsertTextWidget::ALIGN_LEFT);
174
174
    alignLeft->setIcon(SmallIcon("format-justify-left"));
175
175
    alignLeft->setCheckable(true);
176
176
    alignLeft->setToolTip(i18n("Align text to the left"));
177
177
 
178
 
    QToolButton *alignRight = new QToolButton(alignBox);
 
178
    QToolButton* alignRight = new QToolButton(alignBox);
179
179
    d->alignButtonGroup->addButton(alignRight, InsertTextWidget::ALIGN_RIGHT);
180
180
    alignRight->setIcon(SmallIcon("format-justify-right"));
181
181
    alignRight->setCheckable(true);
182
182
    alignRight->setToolTip(i18n("Align text to the right"));
183
183
 
184
 
    QToolButton *alignCenter = new QToolButton(alignBox);
 
184
    QToolButton* alignCenter = new QToolButton(alignBox);
185
185
    d->alignButtonGroup->addButton(alignCenter, InsertTextWidget::ALIGN_CENTER);
186
186
    alignCenter->setIcon(SmallIcon("format-justify-center"));
187
187
    alignCenter->setCheckable(true);
188
188
    alignCenter->setToolTip(i18n("Align text to center"));
189
189
 
190
 
    QToolButton *alignBlock = new QToolButton(alignBox);
 
190
    QToolButton* alignBlock = new QToolButton(alignBox);
191
191
    d->alignButtonGroup->addButton(alignBlock, InsertTextWidget::ALIGN_BLOCK);
192
192
    alignBlock->setIcon(SmallIcon("format-justify-fill"));
193
193
    alignBlock->setCheckable(true);
202
202
 
203
203
    // -------------------------------------------------------------
204
204
 
205
 
    QLabel *label1  = new QLabel(i18n("Rotation:"));
 
205
    QLabel* label1  = new QLabel(i18n("Rotation:"));
206
206
    d->textRotation = new KComboBox();
207
207
    d->textRotation->addItem(i18nc("no rotation", "None"));
208
208
    d->textRotation->addItem(i18n("90 Degrees"));
212
212
 
213
213
    // -------------------------------------------------------------
214
214
 
215
 
    QLabel *label2     = new QLabel(i18nc("font color", "Color:"));
 
215
    QLabel* label2     = new QLabel(i18nc("font color", "Color:"));
216
216
    d->fontColorButton = new KColorButton(Qt::black);
217
217
    d->fontColorButton->setWhatsThis(i18n("Set here the font color to use."));
218
218
 
226
226
 
227
227
    // -------------------------------------------------------------
228
228
 
229
 
    QGridLayout *mainLayout = new QGridLayout();
 
229
    QGridLayout* mainLayout = new QGridLayout();
230
230
    mainLayout->addWidget(d->textEdit,             0, 0, 3,-1);
231
231
    mainLayout->addWidget(d->fontChooserWidget,    3, 0, 1,-1);
232
232
    mainLayout->addWidget(alignBox,                4, 0, 1,-1);
293
293
    int orgW = d->previewWidget->imageIface()->originalWidth();
294
294
    int orgH = d->previewWidget->imageIface()->originalHeight();
295
295
 
296
 
    if ( orgW > orgH ) d->defaultSizeFont = (int)(orgH / 8.0);
297
 
    else d->defaultSizeFont = (int)(orgW / 8.0);
 
296
    if ( orgW > orgH )
 
297
    {
 
298
        d->defaultSizeFont = (int)(orgH / 8.0);
 
299
    }
 
300
    else
 
301
    {
 
302
        d->defaultSizeFont = (int)(orgW / 8.0);
 
303
    }
298
304
 
299
305
    defaultFont.setPointSize(d->defaultSizeFont);
300
306
 
388
394
 
389
395
void InsertTextTool::slotUpdatePreview()
390
396
{
391
 
    d->previewWidget->setText(d->textEdit->document()->toPlainText(), d->textFont, d->fontColorButton->color(), 
 
397
    d->previewWidget->setText(d->textEdit->document()->toPlainText(), d->textFont, d->fontColorButton->color(),
392
398
                              d->alignTextMode,
393
399
                              d->borderText->isChecked(), d->transparentText->isChecked(),
394
400
                              d->textRotation->currentIndex());