~ubuntu-branches/ubuntu/trusty/digikam/trusty

« back to all changes in this revision

Viewing changes to extra/kipi-plugins/videoslideshow/dialogs/slideshowsettingswidget.cpp

  • Committer: Package Import Robot
  • Author(s): Rohan Garg
  • Date: 2012-11-26 18:24:20 UTC
  • mfrom: (1.9.1) (3.1.23 experimental)
  • Revision ID: package-import@ubuntu.com-20121126182420-qoy6z0nx4ai0wzcl
Tags: 4:3.0.0~beta3-0ubuntu1
* New upstream release
  - Add build-deps :  libhupnp-dev, libqtgstreamer-dev, libmagickcore-dev
* Merge from debian, remaining changes:
  - Make sure libqt4-opengl-dev, libgl1-mesa-dev and libglu1-mesa-dev only
    install on i386,amd64 and powerpc
  - Depend on libtiff-dev instead of libtiff4-dev
  - Drop digikam breaks/replaces kipi-plugins-common since we're past the
    LTS release now
  - digikam to recommend mplayerthumbs | ffmpegthumbs. We currently only
    have latter in the archives, even though former is also supposed to
    be part of kdemultimedia. (LP: #890059)
  - kipi-plugins to recommend www-browser rather than konqueror directly
    since 2.8 no direct usage of konqueror is present in the flickr
    plugin anymore (LP: #1011211)
  - Keep kubuntu_mysqld_executable_name.diff
  - Don't install libkipi translations
  - Keep deps on libcv-dev, libcvaux-dev
  - Keep split packaging of libraries
  - Replace icons from KDE 3 time in debian/xpm.d/*.xpm with the new
    versions (LP: #658047)
* Update debian/not-installed

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/** ===========================================================
 
2
 * @file
 
3
 *
 
4
 * This file is a part of digiKam project
 
5
 * <a href="http://www.digikam.org">http://www.digikam.org</a>
 
6
 *
 
7
 * @date   2012-07-01
 
8
 * @brief  Settings Widget
 
9
 *
 
10
 * @author Copyright (C) 2012 by A Janardhan Reddy <annapareddyjanardhanreddy at gmail dot com>
 
11
 *
 
12
 * This program is free software; you can redistribute it
 
13
 * and/or modify it under the terms of the GNU General
 
14
 * Public License as published by the Free Software Foundation;
 
15
 * either version 2, or (at your option)
 
16
 * any later version.
 
17
 *
 
18
 * This program is distributed in the hope that it will be useful,
 
19
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
20
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 
21
 * GNU General Public License for more details.
 
22
 *
 
23
 * ============================================================ */
 
24
 
 
25
#include "slideshowsettingswidget.moc"
 
26
 
 
27
// C ANSI includes
 
28
 
 
29
#include <sys/socket.h>
 
30
 
 
31
// Qt includes
 
32
 
 
33
#include <QGridLayout>
 
34
#include <QLabel>
 
35
#include <QComboBox>
 
36
#include <QSpinBox>
 
37
#include <QString>
 
38
#include <QSpacerItem>
 
39
#include <QDir>
 
40
#include <QCheckBox>
 
41
 
 
42
// KDE includes 
 
43
 
 
44
#include <kpushbutton.h>
 
45
#include <klocalizeddate.h>
 
46
#include <kfiledialog.h>
 
47
#include <kurl.h>
 
48
#include <kseparator.h>
 
49
#include <klocalizedstring.h>
 
50
#include <kmessagebox.h>
 
51
 
 
52
using namespace KIPIPlugins;
 
53
 
 
54
namespace KIPIVideoSlideShowPlugin
 
55
{
 
56
 
 
57
class SlideShowSettingsWidget::Private
 
58
{
 
59
public:
 
60
 
 
61
    Private()
 
62
    {
 
63
        PPMSettingsWidget   = 0;
 
64
        VideoSettingsWidget = 0;
 
65
        selectBtn           = 0;
 
66
        tempDirLabel        = 0;
 
67
        timeVal             = 0;
 
68
        effects             = 0;
 
69
        transitions         = 0;
 
70
        transitionSpeed     = 0;
 
71
        asptRatioCorrct     = 0;
 
72
        videoFormat         = 0;
 
73
        videoType           = 0;
 
74
        frameHeight         = 0;
 
75
        frameWidth          = 0;
 
76
        saveBtn             = 0;
 
77
        saveFileLabel       = 0;
 
78
    }
 
79
 
 
80
    QWidget*     PPMSettingsWidget;
 
81
    QWidget*     VideoSettingsWidget;
 
82
 
 
83
    KPushButton* selectBtn;
 
84
    KPushButton* audioBtn;
 
85
    KPushButton* saveBtn;
 
86
 
 
87
    QString      path;
 
88
    QString      audioPath;
 
89
    QString      savePath;
 
90
 
 
91
    bool         useDeafaultSize;
 
92
 
 
93
    QLabel*      tempDirLabel;
 
94
    QLabel*      audioFile;
 
95
    QLabel*      saveFileLabel;
 
96
    QSpinBox *   timeVal;
 
97
    QComboBox*   effects;
 
98
    QComboBox*   transitions;
 
99
    QComboBox*   transitionSpeed;
 
100
    QComboBox*   asptRatioCorrct;
 
101
    QComboBox*   aspectRatio;
 
102
    QComboBox*   videoType;
 
103
    QComboBox*   videoFormat;
 
104
    QSpinBox*    frameWidth;
 
105
    QSpinBox*    frameHeight;
 
106
    QCheckBox*   checkbox;
 
107
};
 
108
 
 
109
SlideShowSettingsWidget::SlideShowSettingsWidget(QWidget* const parent, Qt::WFlags flags)
 
110
    : KTabWidget(parent, flags), d(new Private)
 
111
{
 
112
    d->PPMSettingsWidget   = new QWidget();
 
113
    d->VideoSettingsWidget = new QWidget();
 
114
    addTab(d->PPMSettingsWidget,   QString("SlideShow Settings"));
 
115
    addTab(d->VideoSettingsWidget, QString("Video Settings"));
 
116
 
 
117
    setCloseButtonEnabled(false);
 
118
    setHoverCloseButton(false);
 
119
 
 
120
    setUpPPMSettings();
 
121
    setUpVideoSettings();
 
122
 
 
123
    connect(d->timeVal, SIGNAL(valueChanged(int)),
 
124
            this, SLOT(timeValueChanged(int)));
 
125
 
 
126
    connect(d->effects, SIGNAL(currentIndexChanged(int)),
 
127
            this, SLOT(effectIndexChanged(int)));
 
128
 
 
129
    connect(d->transitions, SIGNAL(currentIndexChanged(int)),
 
130
            this, SLOT(transIndexChanged(int)));
 
131
 
 
132
    connect(d->transitionSpeed, SIGNAL(currentIndexChanged(int)),
 
133
            this, SLOT(transSpeedIndexChanged(int)));
 
134
 
 
135
    connect(d->videoType, SIGNAL(currentIndexChanged(int)),
 
136
            this, SLOT(videoTypeChanged(int)));
 
137
 
 
138
    connect(d->videoFormat, SIGNAL(currentIndexChanged(int)),
 
139
            this, SLOT(videoFormatChanged(int)));
 
140
}
 
141
 
 
142
SlideShowSettingsWidget::~SlideShowSettingsWidget()
 
143
{
 
144
    delete d;
 
145
}
 
146
 
 
147
void SlideShowSettingsWidget::effectIndexChanged(int index)
 
148
{
 
149
    Q_EMIT effectDataChanged(d->effects->itemText(index), (EFFECT)d->effects->itemData(index).toInt());
 
150
}
 
151
 
 
152
void SlideShowSettingsWidget::transIndexChanged(int index)
 
153
{
 
154
    Q_EMIT transDataChanged(d->transitions->itemText(index), (TRANSITION_TYPE)d->transitions->itemData(index).toInt());
 
155
}
 
156
 
 
157
void SlideShowSettingsWidget::transSpeedIndexChanged(int index)
 
158
{
 
159
    Q_EMIT transSpeedDataChanged(d->transitionSpeed->itemText(index), (TRANSITION_SPEED)d->transitionSpeed->itemData(index).toInt());
 
160
}
 
161
 
 
162
void SlideShowSettingsWidget::timeValueChanged(int time)
 
163
{
 
164
    Q_EMIT timeDataChanged(time);
 
165
}
 
166
 
 
167
void SlideShowSettingsWidget::videoTypeChanged(int index)
 
168
{
 
169
    VIDEO_TYPE type     = (VIDEO_TYPE)d->videoType->itemData(index).toInt();
 
170
    VIDEO_FORMAT format = (VIDEO_FORMAT)d->videoFormat->itemData(d->videoFormat->currentIndex()).toInt();
 
171
 
 
172
    // set frame width and frame height for dvd, vcd,etc to standard tv size
 
173
    switch(type)
 
174
    {
 
175
        case VIDEO_VCD:
 
176
            if(format == VIDEO_FORMAT_NTSC)
 
177
            {
 
178
                d->frameWidth->setValue(352);
 
179
                d->frameHeight->setValue(240);
 
180
            }
 
181
            else
 
182
            {
 
183
                d->frameWidth->setValue(352);
 
184
                d->frameHeight->setValue(288);
 
185
            }
 
186
            break;
 
187
 
 
188
        case VIDEO_DVD:
 
189
        case VIDEO_XVCD:
 
190
            if(format == VIDEO_FORMAT_NTSC)
 
191
            {
 
192
                d->frameWidth->setValue(720);
 
193
                d->frameHeight->setValue(480);
 
194
            }
 
195
            else
 
196
            {
 
197
                d->frameWidth->setValue(720);
 
198
                d->frameHeight->setValue(576);
 
199
            }
 
200
            break;
 
201
 
 
202
        case VIDEO_SVCD:
 
203
            if(format == VIDEO_FORMAT_NTSC)
 
204
            {
 
205
                d->frameWidth->setValue(480);
 
206
                d->frameHeight->setValue(480);
 
207
            }
 
208
            else
 
209
            {
 
210
                d->frameWidth->setValue(576);
 
211
                d->frameHeight->setValue(480);
 
212
            }
 
213
            break;
 
214
 
 
215
        default:
 
216
            break;
 
217
    };
 
218
}
 
219
 
 
220
void SlideShowSettingsWidget::videoFormatChanged(int index)
 
221
{
 
222
    VIDEO_TYPE type = (VIDEO_TYPE)d->videoType->itemData(d->videoType->currentIndex()).toInt();
 
223
    VIDEO_FORMAT format = (VIDEO_FORMAT)d->videoFormat->itemData(index).toInt();
 
224
    // set frame width and frame height for dvd, vcd,etc to standard tv size
 
225
    if(format == VIDEO_FORMAT_NTSC)
 
226
    {
 
227
        switch(type)
 
228
        {
 
229
            case VIDEO_DVD:
 
230
            case VIDEO_XVCD:
 
231
            {
 
232
                d->frameWidth->setValue(720);
 
233
                d->frameHeight->setValue(480);
 
234
            }
 
235
            break;
 
236
 
 
237
            case VIDEO_SVCD:
 
238
            {
 
239
                d->frameWidth->setValue(480);
 
240
                d->frameHeight->setValue(480);
 
241
            }
 
242
            break;
 
243
 
 
244
            case VIDEO_VCD:
 
245
            {
 
246
                d->frameWidth->setValue(352);
 
247
                d->frameHeight->setValue(240);
 
248
            }
 
249
            break;
 
250
 
 
251
            default:
 
252
                break;
 
253
        }
 
254
    }
 
255
    else
 
256
    {
 
257
        switch(type)
 
258
        {
 
259
            case VIDEO_DVD:
 
260
            case VIDEO_XVCD:
 
261
            {
 
262
                d->frameWidth->setValue(720);
 
263
                d->frameHeight->setValue(576);
 
264
            }
 
265
            break;
 
266
 
 
267
            case VIDEO_SVCD:
 
268
            {
 
269
                d->frameWidth->setValue(576);
 
270
                d->frameHeight->setValue(480);
 
271
            }
 
272
            break;
 
273
 
 
274
            case VIDEO_VCD:
 
275
            {
 
276
                d->frameWidth->setValue(352);
 
277
                d->frameHeight->setValue(288);
 
278
            }
 
279
            break;
 
280
 
 
281
            default:
 
282
                break;
 
283
        }
 
284
    }
 
285
}
 
286
 
 
287
void SlideShowSettingsWidget::setUpPPMSettings()
 
288
{
 
289
    QGridLayout* mainLayout = new QGridLayout(d->PPMSettingsWidget);
 
290
    QLabel* timeLabel       = new QLabel("Image Display Time");
 
291
    QLabel* effectLabel     = new QLabel("Special Effect");
 
292
    QLabel* transitionLabel = new QLabel("Transition");
 
293
    QLabel* transSpeedLabel = new QLabel("Transition Speed");
 
294
 
 
295
    d->timeVal      = new QSpinBox();
 
296
    d->timeVal->setRange(1,60);
 
297
 
 
298
    d->effects      = new QComboBox();
 
299
    d->effects->setEditable(false);
 
300
    d->effects->addItem(i18n("None"),            (int)EFFECT_NONE);
 
301
    d->effects->addItem(i18n("Ken-Burn Effect"), (int)EFFECT_KENBURN);
 
302
 
 
303
    d->transitions  = new QComboBox();
 
304
    d->transitions->setEditable(false);
 
305
    d->transitions->addItem(i18n("None"),                (int)TRANSITION_TYPE_NONE);
 
306
    d->transitions->addItem(i18n("Random"),              (int)TRANSITION_TYPE_RANDOM);
 
307
    d->transitions->addItem(i18n("Fade"),                (int)TRANSITION_TYPE_FADE);
 
308
    d->transitions->addItem(i18n("Slide Left to Right"), (int)TRANSITION_TYPE_SLIDE_L2R);
 
309
    d->transitions->addItem(i18n("Slide Right to Left"), (int)TRANSITION_TYPE_SLIDE_R2L);
 
310
    d->transitions->addItem(i18n("Slide Top to Bottom"), (int)TRANSITION_TYPE_SLIDE_T2B);
 
311
    d->transitions->addItem(i18n("Slide Bottom to Top"), (int)TRANSITION_TYPE_SLIDE_B2T);
 
312
    d->transitions->addItem(i18n("Push Left to Right"),  (int)TRANSITION_TYPE_PUSH_L2R);
 
313
    d->transitions->addItem(i18n("Push Right to Left"),  (int)TRANSITION_TYPE_PUSH_R2L);
 
314
    d->transitions->addItem(i18n("Push Top to Bottom"),  (int)TRANSITION_TYPE_PUSH_T2B);
 
315
    d->transitions->addItem(i18n("Push Bottom to Top"),  (int)TRANSITION_TYPE_PUSH_B2T);
 
316
    d->transitions->addItem(i18n("Swap Left to Right"),  (int)TRANSITION_TYPE_SWAP_L2R);
 
317
    d->transitions->addItem(i18n("Swap Right to Left"),  (int)TRANSITION_TYPE_SWAP_R2L);
 
318
    d->transitions->addItem(i18n("Swap Top to Bottom"),  (int)TRANSITION_TYPE_SWAP_T2B);
 
319
    d->transitions->addItem(i18n("Swap Bottom to Top"),  (int)TRANSITION_TYPE_SWAP_B2T);
 
320
    d->transitions->addItem(i18n("Roll Left to Right"),  (int)TRANSITION_TYPE_ROLL_L2R);
 
321
    d->transitions->addItem(i18n("Roll Right to Left"),  (int)TRANSITION_TYPE_ROLL_R2L);
 
322
    d->transitions->addItem(i18n("Roll Top to Bottom"),  (int)TRANSITION_TYPE_ROLL_T2B);
 
323
    d->transitions->addItem(i18n("Roll Bottom to Top"),  (int)TRANSITION_TYPE_ROLL_B2T);
 
324
 
 
325
    d->transitionSpeed  = new QComboBox();
 
326
    d->transitionSpeed->setEditable(false);
 
327
    d->transitionSpeed->addItem(i18n("Slow"),   (int)TRANSITION_SLOW);
 
328
    d->transitionSpeed->addItem(i18n("Medium"), (int)TRANSITION_MEDIUM);
 
329
    d->transitionSpeed->addItem(i18n("Fast"),   (int)TRANSITION_FAST);
 
330
 
 
331
    mainLayout->addWidget(timeLabel,          0, 0, 1, 1);
 
332
    mainLayout->addWidget(d->timeVal,         0, 1, 1, 1);
 
333
    mainLayout->addWidget(effectLabel,        1, 0, 1, 1);
 
334
    mainLayout->addWidget(d->effects,         1, 1, 1, 1);
 
335
    mainLayout->addWidget(transitionLabel,    2, 0, 1, 1);
 
336
    mainLayout->addWidget(d->transitions,     2, 1, 1, 1); 
 
337
    mainLayout->addWidget(transSpeedLabel,    3, 0, 1, 1);
 
338
    mainLayout->addWidget(d->transitionSpeed, 3, 1, 1, 1);
 
339
 
 
340
    mainLayout->addWidget(new KSeparator(Qt::Horizontal), 4, 0, 1, 2);
 
341
 
 
342
    d->tempDirLabel           = new QLabel(i18n("Temporary Directory"));
 
343
    QLabel* asptRatioCorLabel = new QLabel("Aspect Ratio Correction");
 
344
    QLabel* heightLabel       = new QLabel("Frame Height");
 
345
    QLabel* widthLabel        = new QLabel("Frame Width");
 
346
    QLabel* aspectLabel       = new QLabel("Aspect Ratio");
 
347
    d->selectBtn              = new KPushButton("Browse");
 
348
 
 
349
    connect(d->selectBtn, SIGNAL(clicked(bool)),
 
350
            this, SLOT(slotSelectTempDirectory()));
 
351
 
 
352
    d->asptRatioCorrct = new QComboBox();
 
353
    d->asptRatioCorrct->setEditable(false);
 
354
    d->asptRatioCorrct->addItem(i18n("Auto"),    (int)ASPECTCORRECTION_TYPE_AUTO);
 
355
    d->asptRatioCorrct->addItem(i18n("None"),    (int)ASPECTCORRECTION_TYPE_NONE);
 
356
    d->asptRatioCorrct->addItem(i18n("Fill In"), (int)ASPECTCORRECTION_TYPE_FITIN);
 
357
    d->asptRatioCorrct->addItem(i18n("Fit In"),  (int)ASPECTCORRECTION_TYPE_FILLIN);
 
358
 
 
359
    d->aspectRatio     = new QComboBox();
 
360
    d->aspectRatio->addItem(i18n("default"),     (int)ASPECT_RATIO_DEFAULT);
 
361
    d->aspectRatio->addItem(i18n("4:3"),         (int)ASPECT_RATIO_4_3);
 
362
    d->aspectRatio->addItem(i18n("16:9"),        (int)ASPECT_RATIO_16_9);
 
363
 
 
364
    d->frameHeight     = new QSpinBox();
 
365
    d->frameHeight->setRange(100, 1000);
 
366
    d->frameWidth      = new QSpinBox();
 
367
    d->frameWidth->setRange(100, 1000);
 
368
 
 
369
    mainLayout->addWidget(d->tempDirLabel,    5, 0, 1, 2);
 
370
    mainLayout->addWidget(d->selectBtn,       6, 1, 1, 1);
 
371
    mainLayout->addWidget(asptRatioCorLabel,  7, 0, 1, 1);
 
372
    mainLayout->addWidget(d->asptRatioCorrct, 7, 1, 1, 1);
 
373
    mainLayout->addWidget(heightLabel,        8, 0, 1, 1);
 
374
    mainLayout->addWidget(d->frameHeight,     8, 1, 1, 1);
 
375
    mainLayout->addWidget(widthLabel,         9, 0, 1, 1);
 
376
    mainLayout->addWidget(d->frameWidth,      9, 1, 1, 1);
 
377
    mainLayout->addWidget(aspectLabel,        10, 0, 1, 1);
 
378
    mainLayout->addWidget(d->aspectRatio,     10, 1, 1, 1);
 
379
    mainLayout->addItem(new QSpacerItem(1,1), 11, 0, 1, 2);
 
380
    mainLayout->setRowStretch(11, 10);
 
381
}
 
382
 
 
383
void SlideShowSettingsWidget::resetToDefault()
 
384
{
 
385
    d->timeVal->setValue(25);
 
386
    d->effects->setCurrentIndex(d->effects->findData((int)EFFECT_NONE));
 
387
    d->transitions->setCurrentIndex(d->transitions->findData((int)TRANSITION_TYPE_RANDOM));
 
388
    d->transitionSpeed->setCurrentIndex(d->transitionSpeed->findData((int)TRANSITION_MEDIUM));
 
389
    d->asptRatioCorrct->setCurrentIndex(d->asptRatioCorrct->findData((int)ASPECTCORRECTION_TYPE_NONE));
 
390
    d->frameWidth->setValue(500);
 
391
    d->frameHeight->setValue(500);
 
392
    d->videoType->setCurrentIndex(d->videoType->findData((int)VIDEO_SVCD));
 
393
    d->videoFormat->setCurrentIndex(d->videoFormat->findData((int)VIDEO_FORMAT_PAL));
 
394
}
 
395
 
 
396
void SlideShowSettingsWidget::setUpVideoSettings()
 
397
{
 
398
    QGridLayout* mainLayout = new QGridLayout(d->VideoSettingsWidget);
 
399
    QLabel* typeLabel       = new QLabel("VideoType");
 
400
    QLabel* formatLabel     = new QLabel("Video Format");
 
401
 
 
402
    d->videoType    = new QComboBox();
 
403
    d->videoType->setEditable(false);
 
404
    d->videoType->addItem(i18n("AVI"),  (int)VIDEO_AVI);
 
405
    d->videoType->addItem(i18n("VCD"),  (int)VIDEO_VCD);
 
406
    d->videoType->addItem(i18n("SVCD"), (int)VIDEO_SVCD);
 
407
    d->videoType->addItem(i18n("XVCD"), (int)VIDEO_XVCD);
 
408
    d->videoType->addItem(i18n("DVD"),  (int)VIDEO_DVD);
 
409
    d->videoType->addItem(i18n("OGG"),  (int)VIDEO_OGG);
 
410
 
 
411
    d->videoFormat  = new QComboBox();
 
412
    d->videoFormat->setEditable(false);
 
413
    d->videoFormat->addItem(i18n("PAL"),   (int)VIDEO_FORMAT_PAL);
 
414
    d->videoFormat->addItem(i18n("NTSC"),  (int)VIDEO_FORMAT_NTSC);
 
415
    d->videoFormat->addItem(i18n("SECAM"), (int)VIDEO_FORMAT_SECAM);
 
416
 
 
417
    mainLayout->addWidget(typeLabel,                      0, 0, 1, 1);
 
418
    mainLayout->addWidget(d->videoType,                   0, 1, 1, 1);
 
419
    mainLayout->addWidget(formatLabel,                    1, 0, 1, 1);
 
420
    mainLayout->addWidget(d->videoFormat,                 1, 1, 1, 1);
 
421
    mainLayout->addWidget(new KSeparator(Qt::Horizontal), 2, 0, 1, 2);
 
422
 
 
423
    d->audioFile    = new QLabel(i18n("Audio Disabled"));
 
424
    d->audioBtn     = new KPushButton("Browse");
 
425
    d->checkbox     = new QCheckBox("Add Audio");
 
426
    d->audioBtn->setEnabled(false);
 
427
 
 
428
    d->saveFileLabel = new QLabel(i18n("Save video"));
 
429
    d->saveBtn       = new KPushButton("Browse");
 
430
 
 
431
    connect(d->saveBtn, SIGNAL(clicked(bool)),
 
432
            this, SLOT(slotSelectSaveFileName()));
 
433
 
 
434
    connect(d->audioBtn, SIGNAL(clicked(bool)),
 
435
            this, SLOT(slotSelectAudio()));
 
436
 
 
437
    connect(d->checkbox, SIGNAL(stateChanged(int)),
 
438
            this, SLOT(slotAudioChecked()));
 
439
 
 
440
    mainLayout->addWidget(d->audioFile,     3, 0, 1, 2);
 
441
    mainLayout->addWidget(d->audioBtn,      4, 1, 1, 1);
 
442
    mainLayout->addWidget(d->checkbox,      5, 0, 1, 2);
 
443
    mainLayout->addWidget(d->saveFileLabel, 6, 0, 1, 2);
 
444
    mainLayout->addWidget(d->saveBtn,       7, 1, 1, 1);
 
445
 
 
446
    mainLayout->addItem(new QSpacerItem(1,1), 10, 0, 1, 2);
 
447
    mainLayout->setRowStretch(10, 10);
 
448
}
 
449
 
 
450
void SlideShowSettingsWidget::slotSelectTempDirectory()
 
451
{
 
452
    QString path = KFileDialog::getExistingDirectory(KUrl(), this,
 
453
                                                     i18n("Select temporary directory"));
 
454
 
 
455
    if (!path.isEmpty())
 
456
    {
 
457
        setTempDirPath(path);
 
458
        d->tempDirLabel->setText(path);
 
459
    }
 
460
}
 
461
 
 
462
void SlideShowSettingsWidget::slotSelectAudio()
 
463
{
 
464
    QString path = KFileDialog::getOpenUrl().path();
 
465
    d->audioPath = path;
 
466
    d->audioFile->setText(path);
 
467
}
 
468
 
 
469
void SlideShowSettingsWidget::slotAudioChecked()
 
470
{
 
471
    if(!d->checkbox->isChecked())
 
472
    {
 
473
        d->audioPath = "";
 
474
        d->audioFile->setText("audio Disabled");
 
475
        d->audioBtn->setEnabled(false);
 
476
    }
 
477
    else
 
478
    {
 
479
       d->audioFile->setText("select Audio");
 
480
       d->audioBtn->setEnabled(true);
 
481
    }
 
482
}
 
483
 
 
484
void SlideShowSettingsWidget::slotSelectSaveFileName()
 
485
{
 
486
    QString path = KFileDialog::getSaveFileName();
 
487
    d->saveFileLabel->setText(path);
 
488
    d->savePath  = path;
 
489
}
 
490
 
 
491
 
 
492
QString SlideShowSettingsWidget::getTempDirPath() const
 
493
{
 
494
    return d->path;
 
495
}
 
496
 
 
497
void SlideShowSettingsWidget::setTempDirPath(const QString& path)
 
498
{
 
499
    if(KUrl(path).isValid())
 
500
        d->path = path;
 
501
    else
 
502
        d->path = QDir::tempPath();
 
503
}
 
504
 
 
505
void SlideShowSettingsWidget::updateData(int time, TRANSITION_TYPE transition, TRANSITION_SPEED transSpeed, EFFECT effect)
 
506
{
 
507
    d->timeVal->setValue(time);
 
508
    d->effects->setCurrentIndex(d->effects->findData((int)effect));
 
509
    d->transitions->setCurrentIndex(d->transitions->findData((int)transition));
 
510
    d->transitionSpeed->setCurrentIndex(d->transitionSpeed->findData((int)transSpeed));
 
511
}
 
512
 
 
513
ASPECTCORRECTION_TYPE SlideShowSettingsWidget::getAspectCorrection() const
 
514
{
 
515
    return (ASPECTCORRECTION_TYPE)d->asptRatioCorrct->itemData(d->asptRatioCorrct->currentIndex()).toInt();
 
516
}
 
517
 
 
518
ASPECT_RATIO SlideShowSettingsWidget::getAspectRatio() const
 
519
{
 
520
    return (ASPECT_RATIO)d->aspectRatio->itemData(d->aspectRatio->currentIndex()).toInt();
 
521
}
 
522
 
 
523
int SlideShowSettingsWidget::getFrameHeight() const
 
524
{
 
525
    return d->frameHeight->value();
 
526
}
 
527
 
 
528
int SlideShowSettingsWidget::getFrameWidth() const
 
529
{
 
530
    return d->frameWidth->value();
 
531
}
 
532
 
 
533
QString SlideShowSettingsWidget::getAudioFile() const
 
534
{
 
535
    return d->audioPath;
 
536
}
 
537
 
 
538
VIDEO_FORMAT SlideShowSettingsWidget::getVideoFormat() const
 
539
{
 
540
    return (VIDEO_FORMAT)d->videoFormat->itemData(d->videoFormat->currentIndex()).toInt();
 
541
}
 
542
 
 
543
VIDEO_TYPE SlideShowSettingsWidget::getVideoType() const
 
544
{
 
545
    return (VIDEO_TYPE)d->videoType->itemData(d->videoType->currentIndex()).toInt();
 
546
}
 
547
 
 
548
QString SlideShowSettingsWidget::getSaveFile() const
 
549
{
 
550
    return d->savePath;
 
551
}
 
552
 
 
553
} // namespace KIPIVideoSlideShowPlugin