kdenlivesettingsdialog.cpp 64.6 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
/***************************************************************************
 *   Copyright (C) 2008 by Jean-Baptiste Mardelle (jb@kdenlive.org)        *
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 *   This program is distributed in the hope that it will be useful,       *
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
 *   GNU General Public License for more details.                          *
 *                                                                         *
 *   You should have received a copy of the GNU General Public License     *
 *   along with this program; if not, write to the                         *
 *   Free Software Foundation, Inc.,                                       *
 *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA          *
 ***************************************************************************/

20
21
#include "kdenlivesettingsdialog.h"
#include "profilesdialog.h"
22
#include "encodingprofilesdialog.h"
23
#include "project/dialogs/profilewidget.h"
24
#include "utils/KoIconUtils.h"
25
#include "dialogs/profilesdialog.h"
26
#include "kdenlivesettings.h"
27
#include "clipcreationdialog.h"
28
#include "renderer.h"
29

Vincent Pinon's avatar
Vincent Pinon committed
30
31
32
#ifdef USE_V4L
#include "capture/v4lcapture.h"
#endif
33

34
#include "klocalizedstring.h"
35
#include <KMessageBox>
36
#include <KLineEdit>
37
38
39
#include <KService>
#include <KRun>
#include <KOpenWithDialog>
Laurent Montel's avatar
Laurent Montel committed
40
#include "kdenlive_debug.h"
41
42
#include <QDir>
#include <QTimer>
43
#include <QThread>
44

45
46
47
48
#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
#include <fcntl.h>
49

50
#ifdef USE_JOGSHUTTLE
51
52
53
#include "jogshuttle/jogaction.h"
#include "jogshuttle/jogshuttleconfig.h"
#include <linux/input.h>
54
#include <QStandardPaths>
55
#endif
56

57
KdenliveSettingsDialog::KdenliveSettingsDialog(const QMap<QString, QString> &mappable_actions, bool gpuAllowed, QWidget *parent) :
58
    KConfigDialog(parent, QStringLiteral("settings"), KdenliveSettings::self()),
59
60
61
    m_modified(false),
    m_shuttleModified(false),
    m_mappable_actions(mappable_actions)
62
{
63
    KdenliveSettings::setV4l_format(0);
64
65
    QWidget *p1 = new QWidget;
    m_configMisc.setupUi(p1);
66
67
    m_page1 = addPage(p1, i18n("Misc"));
    m_page1->setIcon(KoIconUtils::themedIcon(QStringLiteral("configure")));
68

69
70
    // Hide avformat-novalidate trick, causes crash (bug #2205 and #2206)
    m_configMisc.kcfg_projectloading_avformatnovalidate->setVisible(false);
71

72
    m_configMisc.kcfg_use_exiftool->setEnabled(!QStandardPaths::findExecutable(QStringLiteral("exiftool")).isEmpty());
73

74
75
    QWidget *p8 = new QWidget;
    m_configProject.setupUi(p8);
76
    m_page8 = addPage(p8, i18n("Project Defaults"));
77
78
79
80
    QVBoxLayout *vbox = new QVBoxLayout;
    m_pw = new ProfileWidget(this);
    vbox->addWidget(m_pw);
    m_configProject.profile_box->setLayout(vbox);
81
    m_configProject.profile_box->setTitle(i18n("Select the default profile (preset)"));
82
83
    // Select profile
    m_pw->loadProfile(KdenliveSettings::default_profile().isEmpty() ? KdenliveSettings::current_profile() : KdenliveSettings::default_profile());
84
    connect(m_pw, &ProfileWidget::profileChanged, this, &KdenliveSettingsDialog::slotDialogModified);
85
    m_page8->setIcon(KoIconUtils::themedIcon(QStringLiteral("project-defaults")));
Laurent Montel's avatar
Laurent Montel committed
86
    connect(m_configProject.kcfg_generateproxy, &QAbstractButton::toggled, m_configProject.kcfg_proxyminsize, &QWidget::setEnabled);
87
    m_configProject.kcfg_proxyminsize->setEnabled(KdenliveSettings::generateproxy());
88
89
    m_configProject.projecturl->setMode(KFile::Directory);
    m_configProject.projecturl->setUrl(QUrl::fromLocalFile(KdenliveSettings::defaultprojectfolder()));
Laurent Montel's avatar
Laurent Montel committed
90
    connect(m_configProject.kcfg_generateimageproxy, &QAbstractButton::toggled, m_configProject.kcfg_proxyimageminsize, &QWidget::setEnabled);
Jean-Baptiste Mardelle's avatar
Jean-Baptiste Mardelle committed
91
    m_configProject.kcfg_proxyimageminsize->setEnabled(KdenliveSettings::generateimageproxy());
92

93
    QWidget *p3 = new QWidget;
94
    m_configTimeline.setupUi(p3);
95
96
    m_page3 = addPage(p3, i18n("Timeline"));
    m_page3->setIcon(KoIconUtils::themedIcon(QStringLiteral("video-display")));
97
98
99
100

    QWidget *p2 = new QWidget;
    m_configEnv.setupUi(p2);
    m_configEnv.mltpathurl->setMode(KFile::Directory);
101
102
103
104
105
    m_configEnv.mltpathurl->lineEdit()->setObjectName(QStringLiteral("kcfg_mltpath"));
    m_configEnv.rendererpathurl->lineEdit()->setObjectName(QStringLiteral("kcfg_rendererpath"));
    m_configEnv.ffmpegurl->lineEdit()->setObjectName(QStringLiteral("kcfg_ffmpegpath"));
    m_configEnv.ffplayurl->lineEdit()->setObjectName(QStringLiteral("kcfg_ffplaypath"));
    m_configEnv.ffprobeurl->lineEdit()->setObjectName(QStringLiteral("kcfg_ffprobepath"));
106
107
    int maxThreads = QThread::idealThreadCount();
    m_configEnv.kcfg_mltthreads->setMaximum(maxThreads > 2 ? maxThreads : 8);
108
    m_configEnv.tmppathurl->setMode(KFile::Directory);
109
    m_configEnv.tmppathurl->lineEdit()->setObjectName(QStringLiteral("kcfg_currenttmpfolder"));
110
    m_configEnv.capturefolderurl->setMode(KFile::Directory);
111
    m_configEnv.capturefolderurl->lineEdit()->setObjectName(QStringLiteral("kcfg_capturefolder"));
112
    m_configEnv.capturefolderurl->setEnabled(!KdenliveSettings::capturetoprojectfolder());
Laurent Montel's avatar
Laurent Montel committed
113
    connect(m_configEnv.kcfg_capturetoprojectfolder, &QAbstractButton::clicked, this, &KdenliveSettingsDialog::slotEnableCaptureFolder);
114
115
116
117
    // Library folder
    m_configEnv.libraryfolderurl->setMode(KFile::Directory);
    m_configEnv.libraryfolderurl->lineEdit()->setObjectName(QStringLiteral("kcfg_libraryfolder"));
    m_configEnv.libraryfolderurl->setEnabled(!KdenliveSettings::librarytodefaultfolder());
118
    m_configEnv.kcfg_librarytodefaultfolder->setToolTip(QStandardPaths::writableLocation(QStandardPaths::AppDataLocation) + QStringLiteral("/library"));
Laurent Montel's avatar
Laurent Montel committed
119
    connect(m_configEnv.kcfg_librarytodefaultfolder, &QAbstractButton::clicked, this, &KdenliveSettingsDialog::slotEnableLibraryFolder);
120

121
122
123
    // Mime types
    QStringList mimes = ClipCreationDialog::getExtensions();
    qSort(mimes);
Laurent Montel's avatar
Laurent Montel committed
124
    m_configEnv.supportedmimes->setPlainText(mimes.join(QLatin1Char(' ')));
125

126
127
    m_page2 = addPage(p2, i18n("Environment"));
    m_page2->setIcon(KoIconUtils::themedIcon(QStringLiteral("application-x-executable-script")));
128
129
130

    QWidget *p4 = new QWidget;
    m_configCapture.setupUi(p4);
131
132
    m_configCapture.tabWidget->removeTab(0);
    m_configCapture.tabWidget->removeTab(2);
133
#ifdef USE_V4L
134

135
    // Video 4 Linux device detection
Laurent Montel's avatar
Laurent Montel committed
136
    for (int i = 0; i < 10; ++i) {
Laurent Montel's avatar
Laurent Montel committed
137
        QString path = QStringLiteral("/dev/video") + QString::number(i);
138
        if (QFile::exists(path)) {
139
            QStringList deviceInfo = V4lCaptureHandler::getDeviceName(path);
140
141
142
143
            if (!deviceInfo.isEmpty()) {
                m_configCapture.kcfg_detectedv4ldevices->addItem(deviceInfo.at(0), path);
                m_configCapture.kcfg_detectedv4ldevices->setItemData(m_configCapture.kcfg_detectedv4ldevices->count() - 1, deviceInfo.at(1), Qt::UserRole + 1);
            }
144
145
146
        }
    }
    connect(m_configCapture.kcfg_detectedv4ldevices, SIGNAL(currentIndexChanged(int)), this, SLOT(slotUpdatev4lDevice()));
147
    connect(m_configCapture.kcfg_v4l_format, SIGNAL(currentIndexChanged(int)), this, SLOT(slotUpdatev4lCaptureProfile()));
Laurent Montel's avatar
Laurent Montel committed
148
    connect(m_configCapture.config_v4l, &QAbstractButton::clicked, this, &KdenliveSettingsDialog::slotEditVideo4LinuxProfile);
149
150

    slotUpdatev4lDevice();
151
#endif
152

153
154
    m_page4 = addPage(p4, i18n("Capture"));
    m_page4->setIcon(KoIconUtils::themedIcon(QStringLiteral("media-record")));
155
    m_configCapture.tabWidget->setCurrentIndex(KdenliveSettings::defaultcapture());
Alberto Villa's avatar
Alberto Villa committed
156
#ifdef Q_WS_MAC
157
158
    m_configCapture.tabWidget->setEnabled(false);
    m_configCapture.kcfg_defaultcapture->setEnabled(false);
Alberto Villa's avatar
Alberto Villa committed
159
    m_configCapture.label->setText(i18n("Capture is not yet available on Mac OS X."));
160
#endif
161

162
163
    QWidget *p5 = new QWidget;
    m_configShuttle.setupUi(p5);
164
#ifdef USE_JOGSHUTTLE
165
    m_configShuttle.toolBtnReload->setIcon(KoIconUtils::themedIcon(QStringLiteral("view-refresh")));
Laurent Montel's avatar
Laurent Montel committed
166
    connect(m_configShuttle.kcfg_enableshuttle, &QCheckBox::stateChanged, this, &KdenliveSettingsDialog::slotCheckShuttle);
167
    connect(m_configShuttle.shuttledevicelist, SIGNAL(activated(int)), this, SLOT(slotUpdateShuttleDevice(int)));
Laurent Montel's avatar
Laurent Montel committed
168
    connect(m_configShuttle.toolBtnReload, &QAbstractButton::clicked, this, &KdenliveSettingsDialog::slotReloadShuttleDevices);
169

170
    slotCheckShuttle(KdenliveSettings::enableshuttle());
171
    m_configShuttle.shuttledisabled->hide();
172
173

    // Store the button pointers into an array for easier handling them in the other functions.
174
    // TODO: impl enumerator or live with cut and paste :-)))
175
176
    setupJogshuttleBtns(KdenliveSettings::shuttledevice());
#if 0
177
178
179
180
181
    m_shuttle_buttons.push_back(m_configShuttle.shuttle1);
    m_shuttle_buttons.push_back(m_configShuttle.shuttle2);
    m_shuttle_buttons.push_back(m_configShuttle.shuttle3);
    m_shuttle_buttons.push_back(m_configShuttle.shuttle4);
    m_shuttle_buttons.push_back(m_configShuttle.shuttle5);
182
183
184
185
186
    m_shuttle_buttons.push_back(m_configShuttle.shuttle6);
    m_shuttle_buttons.push_back(m_configShuttle.shuttle7);
    m_shuttle_buttons.push_back(m_configShuttle.shuttle8);
    m_shuttle_buttons.push_back(m_configShuttle.shuttle9);
    m_shuttle_buttons.push_back(m_configShuttle.shuttle10);
187
188
189
190
191
    m_shuttle_buttons.push_back(m_configShuttle.shuttle11);
    m_shuttle_buttons.push_back(m_configShuttle.shuttle12);
    m_shuttle_buttons.push_back(m_configShuttle.shuttle13);
    m_shuttle_buttons.push_back(m_configShuttle.shuttle14);
    m_shuttle_buttons.push_back(m_configShuttle.shuttle15);
192
#endif
193

194
195
196
197
#else /* ! USE_JOGSHUTTLE */
    m_configShuttle.kcfg_enableshuttle->hide();
    m_configShuttle.kcfg_enableshuttle->setDisabled(true);
#endif /* USE_JOGSHUTTLE */
198
199
    m_page5 = addPage(p5, i18n("JogShuttle"));
    m_page5->setIcon(KoIconUtils::themedIcon(QStringLiteral("jog-dial")));
200

201
202
    QWidget *p6 = new QWidget;
    m_configSdl.setupUi(p6);
203
    m_configSdl.reload_blackmagic->setIcon(KoIconUtils::themedIcon(QStringLiteral("view-refresh")));
Laurent Montel's avatar
Laurent Montel committed
204
    connect(m_configSdl.reload_blackmagic, &QAbstractButton::clicked, this, &KdenliveSettingsDialog::slotReloadBlackMagic);
205

206
207
    //m_configSdl.kcfg_openglmonitors->setHidden(true);

208
209
    m_page6 = addPage(p6, i18n("Playback"));
    m_page6->setIcon(KoIconUtils::themedIcon(QStringLiteral("media-playback-start")));
210

211
212
    QWidget *p7 = new QWidget;
    m_configTranscode.setupUi(p7);
213
214
215
    m_page7 = addPage(p7, i18n("Transcode"));
    m_page7->setIcon(KoIconUtils::themedIcon(QStringLiteral("edit-copy")));

Laurent Montel's avatar
Laurent Montel committed
216
217
218
219
    connect(m_configTranscode.button_add, &QAbstractButton::clicked, this, &KdenliveSettingsDialog::slotAddTranscode);
    connect(m_configTranscode.button_delete, &QAbstractButton::clicked, this, &KdenliveSettingsDialog::slotDeleteTranscode);
    connect(m_configTranscode.profiles_list, &QListWidget::itemChanged, this, &KdenliveSettingsDialog::slotDialogModified);
    connect(m_configTranscode.profiles_list, &QListWidget::currentRowChanged, this, &KdenliveSettingsDialog::slotSetTranscodeProfile);
220

Laurent Montel's avatar
Laurent Montel committed
221
222
223
224
225
    connect(m_configTranscode.profile_name, &QLineEdit::textChanged, this, &KdenliveSettingsDialog::slotEnableTranscodeUpdate);
    connect(m_configTranscode.profile_description, &QLineEdit::textChanged, this, &KdenliveSettingsDialog::slotEnableTranscodeUpdate);
    connect(m_configTranscode.profile_extension, &QLineEdit::textChanged, this, &KdenliveSettingsDialog::slotEnableTranscodeUpdate);
    connect(m_configTranscode.profile_parameters, &QPlainTextEdit::textChanged, this, &KdenliveSettingsDialog::slotEnableTranscodeUpdate);
    connect(m_configTranscode.profile_audioonly, &QCheckBox::stateChanged, this, &KdenliveSettingsDialog::slotEnableTranscodeUpdate);
226

Laurent Montel's avatar
Laurent Montel committed
227
    connect(m_configTranscode.button_update, &QAbstractButton::pressed, this, &KdenliveSettingsDialog::slotUpdateTranscodingProfile);
228

229
    m_configTranscode.profile_parameters->setMaximumHeight(QFontMetrics(font()).lineSpacing() * 5);
Alberto Villa's avatar
Alberto Villa committed
230

Laurent Montel's avatar
Laurent Montel committed
231
232
    connect(m_configEnv.kp_image, &QAbstractButton::clicked, this, &KdenliveSettingsDialog::slotEditImageApplication);
    connect(m_configEnv.kp_audio, &QAbstractButton::clicked, this, &KdenliveSettingsDialog::slotEditAudioApplication);
Jean-Baptiste Mardelle's avatar
Jean-Baptiste Mardelle committed
233

234
    loadEncodingProfiles();
235

236
    connect(m_configSdl.kcfg_audio_driver, SIGNAL(currentIndexChanged(int)), this, SLOT(slotCheckAlsaDriver()));
237
    connect(m_configSdl.kcfg_audio_backend, SIGNAL(currentIndexChanged(int)), this, SLOT(slotCheckAudioBackend()));
238
    initDevices();
239
    connect(m_configCapture.kcfg_grab_capture_type, SIGNAL(currentIndexChanged(int)), this, SLOT(slotUpdateGrabRegionStatus()));
240

241
    slotUpdateGrabRegionStatus();
242
    loadTranscodeProfiles();
243

244
245
    //HACK: check dvgrab version, because only dvgrab >= 3.3 supports
    //   --timestamp option without bug
246

247
    if (KdenliveSettings::dvgrab_path().isEmpty() || !QFile::exists(KdenliveSettings::dvgrab_path())) {
248
        QString dvgrabpath = QStandardPaths::findExecutable(QStringLiteral("dvgrab"));
249
        KdenliveSettings::setDvgrab_path(dvgrabpath);
250
    }
251

252
    // decklink profile
253
254
    QAction *act = new QAction(KoIconUtils::themedIcon(QStringLiteral("configure")), i18n("Configure profiles"), this);
    act->setData(4);
Laurent Montel's avatar
Laurent Montel committed
255
    connect(act, &QAction::triggered, this, &KdenliveSettingsDialog::slotManageEncodingProfile);
256
    m_configCapture.decklink_manageprofile->setDefaultAction(act);
257
    m_configCapture.decklink_showprofileinfo->setIcon(KoIconUtils::themedIcon(QStringLiteral("help-about")));
258
259
260
261
    m_configCapture.decklink_parameters->setVisible(false);
    m_configCapture.decklink_parameters->setMaximumHeight(QFontMetrics(font()).lineSpacing() * 4);
    m_configCapture.decklink_parameters->setPlainText(KdenliveSettings::decklink_parameters());
    connect(m_configCapture.kcfg_decklink_profile, SIGNAL(currentIndexChanged(int)), this, SLOT(slotUpdateDecklinkProfile()));
Laurent Montel's avatar
Laurent Montel committed
262
    connect(m_configCapture.decklink_showprofileinfo, &QAbstractButton::clicked, m_configCapture.decklink_parameters, &QWidget::setVisible);
263

264
    // ffmpeg profile
265
    m_configCapture.v4l_showprofileinfo->setIcon(KoIconUtils::themedIcon(QStringLiteral("help-about")));
266
267
268
    m_configCapture.v4l_parameters->setVisible(false);
    m_configCapture.v4l_parameters->setMaximumHeight(QFontMetrics(font()).lineSpacing() * 4);
    m_configCapture.v4l_parameters->setPlainText(KdenliveSettings::v4l_parameters());
269
270
271

    act = new QAction(KoIconUtils::themedIcon(QStringLiteral("configure")), i18n("Configure profiles"), this);
    act->setData(2);
Laurent Montel's avatar
Laurent Montel committed
272
    connect(act, &QAction::triggered, this, &KdenliveSettingsDialog::slotManageEncodingProfile);
273
    m_configCapture.v4l_manageprofile->setDefaultAction(act);
274
    connect(m_configCapture.kcfg_v4l_profile, SIGNAL(currentIndexChanged(int)), this, SLOT(slotUpdateV4lProfile()));
Laurent Montel's avatar
Laurent Montel committed
275
    connect(m_configCapture.v4l_showprofileinfo, &QAbstractButton::clicked, m_configCapture.v4l_parameters, &QWidget::setVisible);
276

277
    // screen grab profile
278
    m_configCapture.grab_showprofileinfo->setIcon(KoIconUtils::themedIcon(QStringLiteral("help-about")));
279
280
281
    m_configCapture.grab_parameters->setVisible(false);
    m_configCapture.grab_parameters->setMaximumHeight(QFontMetrics(font()).lineSpacing() * 4);
    m_configCapture.grab_parameters->setPlainText(KdenliveSettings::grab_parameters());
282
283
    act = new QAction(KoIconUtils::themedIcon(QStringLiteral("configure")), i18n("Configure profiles"), this);
    act->setData(3);
Laurent Montel's avatar
Laurent Montel committed
284
    connect(act, &QAction::triggered, this, &KdenliveSettingsDialog::slotManageEncodingProfile);
285
    m_configCapture.grab_manageprofile->setDefaultAction(act);
286
    connect(m_configCapture.kcfg_grab_profile, SIGNAL(currentIndexChanged(int)), this, SLOT(slotUpdateGrabProfile()));
Laurent Montel's avatar
Laurent Montel committed
287
    connect(m_configCapture.grab_showprofileinfo, &QAbstractButton::clicked, m_configCapture.grab_parameters, &QWidget::setVisible);
Alberto Villa's avatar
Alberto Villa committed
288

289
    // Timeline preview
290
291
    act = new QAction(KoIconUtils::themedIcon(QStringLiteral("configure")), i18n("Configure profiles"), this);
    act->setData(1);
Laurent Montel's avatar
Laurent Montel committed
292
    connect(act, &QAction::triggered, this, &KdenliveSettingsDialog::slotManageEncodingProfile);
293
294
    m_configProject.preview_manageprofile->setDefaultAction(act);
    connect(m_configProject.kcfg_preview_profile, SIGNAL(currentIndexChanged(int)), this, SLOT(slotUpdatePreviewProfile()));
Laurent Montel's avatar
Laurent Montel committed
295
    connect(m_configProject.preview_showprofileinfo, &QAbstractButton::clicked, m_configProject.previewparams, &QWidget::setVisible);
296
297
298
299
300
301
302
303
    m_configProject.previewparams->setVisible(false);
    m_configProject.previewparams->setMaximumHeight(QFontMetrics(font()).lineSpacing() * 3);
    m_configProject.previewparams->setPlainText(KdenliveSettings::previewparams());
    m_configProject.preview_showprofileinfo->setIcon(KoIconUtils::themedIcon(QStringLiteral("help-about")));
    m_configProject.preview_showprofileinfo->setToolTip(i18n("Show default timeline preview parameters"));
    m_configProject.preview_manageprofile->setIcon(KoIconUtils::themedIcon(QStringLiteral("configure")));
    m_configProject.preview_manageprofile->setToolTip(i18n("Manage timeline preview profiles"));
    m_configProject.kcfg_preview_profile->setToolTip(i18n("Select default timeline preview profile"));
304

305
    // proxy profile stuff
306
    m_configProject.proxy_showprofileinfo->setIcon(KoIconUtils::themedIcon(QStringLiteral("help-about")));
307
    m_configProject.proxy_showprofileinfo->setToolTip(i18n("Show default profile parameters"));
308
    m_configProject.proxy_manageprofile->setIcon(KoIconUtils::themedIcon(QStringLiteral("configure")));
309
310
    m_configProject.proxy_manageprofile->setToolTip(i18n("Manage proxy profiles"));
    m_configProject.kcfg_proxy_profile->setToolTip(i18n("Select default proxy profile"));
311
    m_configProject.proxyparams->setVisible(false);
312
    m_configProject.proxyparams->setMaximumHeight(QFontMetrics(font()).lineSpacing() * 3);
313
    m_configProject.proxyparams->setPlainText(KdenliveSettings::proxyparams());
314
315
316

    act = new QAction(KoIconUtils::themedIcon(QStringLiteral("configure")), i18n("Configure profiles"), this);
    act->setData(0);
Laurent Montel's avatar
Laurent Montel committed
317
    connect(act, &QAction::triggered, this, &KdenliveSettingsDialog::slotManageEncodingProfile);
318
319
    m_configProject.proxy_manageprofile->setDefaultAction(act);

Laurent Montel's avatar
Laurent Montel committed
320
    connect(m_configProject.proxy_showprofileinfo, &QAbstractButton::clicked, m_configProject.proxyparams, &QWidget::setVisible);
321
322
323
324
    connect(m_configProject.kcfg_proxy_profile, SIGNAL(currentIndexChanged(int)), this, SLOT(slotUpdateProxyProfile()));

    slotUpdateProxyProfile(-1);
    slotUpdateV4lProfile(-1);
325
    slotUpdateGrabProfile(-1);
326
    slotUpdateDecklinkProfile(-1);
327

328
329
    // enable GPU accel only if Movit is found
    m_configSdl.kcfg_gpu_accel->setEnabled(gpuAllowed);
330
    m_configSdl.kcfg_gpu_accel->setToolTip(i18n("GPU processing needs MLT compiled with Movit and Rtaudio modules"));
Alberto Villa's avatar
Alberto Villa committed
331

332
333
334
    Render::getBlackMagicDeviceList(m_configCapture.kcfg_decklink_capturedevice);
    if (!Render::getBlackMagicOutputDeviceList(m_configSdl.kcfg_blackmagic_output_device)) {
        // No blackmagic card found
335
        m_configSdl.kcfg_external_display->setEnabled(false);
336
    }
337

338
    if (!KdenliveSettings::dvgrab_path().isEmpty()) {
Vincent Pinon's avatar
Vincent Pinon committed
339
        double dvgrabVersion = 0;
340
341
        QProcess *versionCheck = new QProcess;
        versionCheck->setProcessChannelMode(QProcess::MergedChannels);
342
        versionCheck->start(QStringLiteral("dvgrab"), QStringList() << QStringLiteral("--version"));
343
344
        if (versionCheck->waitForFinished()) {
            QString version = QString(versionCheck->readAll()).simplified();
Laurent Montel's avatar
Laurent Montel committed
345
            if (version.contains(QLatin1Char(' '))) {
346
                version = version.section(QLatin1Char(' '), -1);
347
            }
348
349
            dvgrabVersion = version.toDouble();

Laurent Montel's avatar
Laurent Montel committed
350
            //qCDebug(KDENLIVE_LOG) << "// FOUND DVGRAB VERSION: " << dvgrabVersion;
351
        }
352
        delete versionCheck;
353
354
355
356
357
        if (dvgrabVersion < 3.3) {
            KdenliveSettings::setFirewiretimestamp(false);
            m_configCapture.kcfg_firewiretimestamp->setEnabled(false);
        }
        m_configCapture.dvgrab_info->setText(i18n("dvgrab version %1 at %2", dvgrabVersion, KdenliveSettings::dvgrab_path()));
358
359
360
    } else {
        m_configCapture.dvgrab_info->setText(i18n("<strong><em>dvgrab</em> utility not found, please install it for firewire capture</strong>"));
    }
361
362
}

Laurent Montel's avatar
Laurent Montel committed
363
void KdenliveSettingsDialog::setupJogshuttleBtns(const QString &device)
364
{
365
366
    QList<KComboBox *> list;
    QList<QLabel *> list1;
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399

    list << m_configShuttle.shuttle1;
    list << m_configShuttle.shuttle2;
    list << m_configShuttle.shuttle3;
    list << m_configShuttle.shuttle4;
    list << m_configShuttle.shuttle5;
    list << m_configShuttle.shuttle6;
    list << m_configShuttle.shuttle7;
    list << m_configShuttle.shuttle8;
    list << m_configShuttle.shuttle9;
    list << m_configShuttle.shuttle10;
    list << m_configShuttle.shuttle11;
    list << m_configShuttle.shuttle12;
    list << m_configShuttle.shuttle13;
    list << m_configShuttle.shuttle14;
    list << m_configShuttle.shuttle15;

    list1 << m_configShuttle.label_2; // #1
    list1 << m_configShuttle.label_4; // #2
    list1 << m_configShuttle.label_3; // #3
    list1 << m_configShuttle.label_7; // #4
    list1 << m_configShuttle.label_5; // #5
    list1 << m_configShuttle.label_6; // #6
    list1 << m_configShuttle.label_8; // #7
    list1 << m_configShuttle.label_9; // #8
    list1 << m_configShuttle.label_10; // #9
    list1 << m_configShuttle.label_11; // #10
    list1 << m_configShuttle.label_12; // #11
    list1 << m_configShuttle.label_13; // #12
    list1 << m_configShuttle.label_14; // #13
    list1 << m_configShuttle.label_15; // #14
    list1 << m_configShuttle.label_16; // #15

400
    for (int i = 0; i < list.count(); ++i) {
401
402
403
        list[i]->hide();
        list1[i]->hide();
    }
404
#ifdef USE_JOGSHUTTLE
405
406
407
    if (!m_configShuttle.kcfg_enableshuttle->isChecked()) {
        return;
    }
408
409
    int keysCount = JogShuttle::keysCount(device);

410
    for (int i = 0; i < keysCount; ++i) {
411
412
413
414
415
416
417
418
419
        m_shuttle_buttons.push_back(list[i]);
        list[i]->show();
        list1[i]->show();
    }

    // populate the buttons with the current configuration. The items are sorted
    // according to the user-selected language, so they do not appear in random order.
    QMap<QString, QString> mappable_actions(m_mappable_actions);
    QList<QString> action_names = mappable_actions.keys();
420
    QList<QString>::Iterator iter = action_names.begin();
Laurent Montel's avatar
Laurent Montel committed
421
    //qCDebug(KDENLIVE_LOG) << "::::::::::::::::";
422
    while (iter != action_names.end()) {
Laurent Montel's avatar
Laurent Montel committed
423
        //qCDebug(KDENLIVE_LOG) << *iter;
424
425
426
        ++iter;
    }

Laurent Montel's avatar
Laurent Montel committed
427
    //qCDebug(KDENLIVE_LOG) << "::::::::::::::::";
428

429
    qSort(action_names);
430
431
    iter = action_names.begin();
    while (iter != action_names.end()) {
Laurent Montel's avatar
Laurent Montel committed
432
        //qCDebug(KDENLIVE_LOG) << *iter;
433
434
        ++iter;
    }
Laurent Montel's avatar
Laurent Montel committed
435
    //qCDebug(KDENLIVE_LOG) << "::::::::::::::::";
436
437
438
439
440

    // Here we need to compute the action_id -> index-in-action_names. We iterate over the
    // action_names, as the sorting may depend on the user-language.
    QStringList actions_map = JogShuttleConfig::actionMap(KdenliveSettings::shuttlebuttons());
    QMap<QString, int> action_pos;
441
    foreach (const QString &action_id, actions_map) {
442
443
444
445
446
447
448
449
450
451
        // This loop find out at what index is the string that would map to the action_id.
        for (int i = 0; i < action_names.size(); ++i) {
            if (mappable_actions[action_names.at(i)] == action_id) {
                action_pos[action_id] = i;
                break;
            }
        }
    }

    int i = 0;
452
    foreach (KComboBox *button, m_shuttle_buttons) {
453
454
455
        button->addItems(action_names);
        connect(button, SIGNAL(activated(int)), this, SLOT(slotShuttleModified()));
        ++i;
456
        if (i < actions_map.size()) {
457
            button->setCurrentIndex(action_pos[actions_map[i]]);
458
        }
459
    }
460
#endif
461
462
}

463
464
KdenliveSettingsDialog::~KdenliveSettingsDialog() {}

465
void KdenliveSettingsDialog::slotUpdateGrabRegionStatus()
466
{
467
    m_configCapture.region_group->setHidden(m_configCapture.kcfg_grab_capture_type->currentIndex() != 1);
468
}
469

470
471
472
473
474
void KdenliveSettingsDialog::slotEnableCaptureFolder()
{
    m_configEnv.capturefolderurl->setEnabled(!m_configEnv.kcfg_capturetoprojectfolder->isChecked());
}

475
476
477
478
479
void KdenliveSettingsDialog::slotEnableLibraryFolder()
{
    m_configEnv.libraryfolderurl->setEnabled(!m_configEnv.kcfg_librarytodefaultfolder->isChecked());
}

480
481
void KdenliveSettingsDialog::initDevices()
{
482
483
    // Fill audio drivers
    m_configSdl.kcfg_audio_driver->addItem(i18n("Automatic"), QString());
484
#ifndef Q_WS_MAC
485
486
    m_configSdl.kcfg_audio_driver->addItem(i18n("OSS"), "dsp");
    m_configSdl.kcfg_audio_driver->addItem(i18n("ALSA"), "alsa");
487
    m_configSdl.kcfg_audio_driver->addItem(i18n("PulseAudio"), "pulse");
488
489
490
    m_configSdl.kcfg_audio_driver->addItem(i18n("OSS with DMA access"), "dma");
    m_configSdl.kcfg_audio_driver->addItem(i18n("Esound daemon"), "esd");
    m_configSdl.kcfg_audio_driver->addItem(i18n("ARTS daemon"), "artsc");
491
#endif
492

493
    if (!KdenliveSettings::audiodrivername().isEmpty())
494
        for (int i = 1; i < m_configSdl.kcfg_audio_driver->count(); ++i) {
495
496
497
498
499
            if (m_configSdl.kcfg_audio_driver->itemData(i).toString() == KdenliveSettings::audiodrivername()) {
                m_configSdl.kcfg_audio_driver->setCurrentIndex(i);
                KdenliveSettings::setAudio_driver((uint) i);
            }
        }
500

501
    // Fill the list of audio playback / recording devices
502
    m_configSdl.kcfg_audio_device->addItem(i18n("Default"), QString());
503
    m_configCapture.kcfg_v4l_alsadevice->addItem(i18n("Default"), "default");
504
    if (!QStandardPaths::findExecutable(QStringLiteral("aplay")).isEmpty()) {
505
        m_readProcess.setOutputChannelMode(KProcess::OnlyStdoutChannel);
506
        m_readProcess.setProgram(QStringLiteral("aplay"), QStringList() << QStringLiteral("-l"));
Laurent Montel's avatar
Laurent Montel committed
507
        connect(&m_readProcess, &KProcess::readyReadStandardOutput, this, &KdenliveSettingsDialog::slotReadAudioDevices);
508
509
510
        m_readProcess.execute(5000);
    } else {
        // If aplay is not installed on the system, parse the /proc/asound/pcm file
511
        QFile file(QStringLiteral("/proc/asound/pcm"));
512
        if (file.open(QIODevice::ReadOnly | QIODevice::Text)) {
513
            QTextStream stream(&file);
514
            QString line = stream.readLine();
515
            QString deviceId;
516
            while (!line.isNull()) {
517
                if (line.contains(QStringLiteral("playback"))) {
Laurent Montel's avatar
Laurent Montel committed
518
                    deviceId = line.section(QLatin1Char(':'), 0, 0);
519
                    m_configSdl.kcfg_audio_device->addItem(line.section(QLatin1Char(':'), 1, 1), "plughw:" + QString::number(deviceId.section(QLatin1Char('-'), 0, 0).toInt()) + QLatin1Char(',') + QString::number(deviceId.section(QLatin1Char('-'), 1, 1).toInt()));
520
                }
521
                if (line.contains(QStringLiteral("capture"))) {
Laurent Montel's avatar
Laurent Montel committed
522
                    deviceId = line.section(QLatin1Char(':'), 0, 0);
523
                    m_configCapture.kcfg_v4l_alsadevice->addItem(line.section(QLatin1Char(':'), 1, 1).simplified(), "hw:" + QString::number(deviceId.section(QLatin1Char('-'), 0, 0).toInt()) + QLatin1Char(',') + QString::number(deviceId.section(QLatin1Char('-'), 1, 1).toInt()));
524
                }
525
                line = stream.readLine();
526
            }
527
            file.close();
528
529
530
        } else {
            qCDebug(KDENLIVE_LOG) << " / / / /CANNOT READ PCM";
        }
531
    }
532

533
534
    // Add pulseaudio capture option
    m_configCapture.kcfg_v4l_alsadevice->addItem(i18n("PulseAudio"), "pulse");
535

536
537
    if (!KdenliveSettings::audiodevicename().isEmpty()) {
        // Select correct alsa device
538
539
540
        int ix = m_configSdl.kcfg_audio_device->findData(KdenliveSettings::audiodevicename());
        m_configSdl.kcfg_audio_device->setCurrentIndex(ix);
        KdenliveSettings::setAudio_device(ix);
541
    }
Alberto Villa's avatar
Alberto Villa committed
542

543
544
545
546
547
548
549
    if (!KdenliveSettings::v4l_alsadevicename().isEmpty()) {
        // Select correct alsa device
        int ix = m_configCapture.kcfg_v4l_alsadevice->findData(KdenliveSettings::v4l_alsadevicename());
        m_configCapture.kcfg_v4l_alsadevice->setCurrentIndex(ix);
        KdenliveSettings::setV4l_alsadevice(ix);
    }

550
551
552
553
554
555
556
557
    m_configSdl.kcfg_audio_backend->addItem(i18n("SDL"), "sdl_audio");
    m_configSdl.kcfg_audio_backend->addItem(i18n("RtAudio"), "rtaudio");

    if (!KdenliveSettings::audiobackend().isEmpty()) {
        int ix = m_configSdl.kcfg_audio_backend->findData(KdenliveSettings::audiobackend());
        m_configSdl.kcfg_audio_backend->setCurrentIndex(ix);
        KdenliveSettings::setAudio_backend(ix);
    }
558
    m_configSdl.group_sdl->setEnabled(KdenliveSettings::audiobackend() == QLatin1String("sdl_audio"));
559

560
    loadCurrentV4lProfileInfo();
561
562
}

563
564
void KdenliveSettingsDialog::slotReadAudioDevices()
{
565
    QString result = QString(m_readProcess.readAllStandardOutput());
Laurent Montel's avatar
Laurent Montel committed
566
567
    //qCDebug(KDENLIVE_LOG) << "// / / / / / READING APLAY: ";
    //qCDebug(KDENLIVE_LOG) << result;
Laurent Montel's avatar
Laurent Montel committed
568
    const QStringList lines = result.split(QLatin1Char('\n'));
569
    for (const QString &devicestr : lines) {
Laurent Montel's avatar
Laurent Montel committed
570
        ////qCDebug(KDENLIVE_LOG) << "// READING LINE: " << data;
571
572
573
574
575
        if (!devicestr.startsWith(QLatin1Char(' ')) && devicestr.count(QLatin1Char(':')) > 1) {
            QString card = devicestr.section(QLatin1Char(':'), 0, 0).section(QLatin1Char(' '), -1);
            QString device = devicestr.section(QLatin1Char(':'), 1, 1).section(QLatin1Char(' '), -1);
            m_configSdl.kcfg_audio_device->addItem(devicestr.section(QLatin1Char(':'), -1).simplified(), "plughw:" + card + QLatin1Char(',') + device);
            m_configCapture.kcfg_v4l_alsadevice->addItem(devicestr.section(QLatin1Char(':'), -1).simplified(), "hw:" + card + QLatin1Char(',') + device);
576
        }
577
578
579
    }
}

580
581
void KdenliveSettingsDialog::showPage(int page, int option)
{
582
583
    switch (page) {
    case 1:
584
        setCurrentPage(m_page1);
585
586
        break;
    case 2:
587
        setCurrentPage(m_page2);
588
589
        break;
    case 3:
590
        setCurrentPage(m_page3);
591
592
        break;
    case 4:
593
        setCurrentPage(m_page4);
594
595
596
        m_configCapture.tabWidget->setCurrentIndex(option);
        break;
    case 5:
597
        setCurrentPage(m_page5);
598
        break;
599
600
601
602
603
604
605
606
    case 6:
        setCurrentPage(m_page6);
        break;
    case 7:
        setCurrentPage(m_page7);
        break;
    default:
        setCurrentPage(m_page1);
607
608
    }
}
Jean-Baptiste Mardelle's avatar
Jean-Baptiste Mardelle committed
609

610
611
void KdenliveSettingsDialog::slotEditAudioApplication()
{
612
    KService::Ptr service;
613
    QPointer<KOpenWithDialog> dlg = new KOpenWithDialog(QList<QUrl>(), i18n("Select default audio editor"), m_configEnv.kcfg_defaultaudioapp->text(), this);
614
615
    if (dlg->exec() == QDialog::Accepted) {
        service = dlg->service();
616
        m_configEnv.kcfg_defaultaudioapp->setText(KRun::binaryName(service->exec(), false));
617
    }
618

619
    delete dlg;
620
621
}

622
623
void KdenliveSettingsDialog::slotEditImageApplication()
{
624
    QPointer<KOpenWithDialog> dlg = new KOpenWithDialog(QList<QUrl>(), i18n("Select default image editor"), m_configEnv.kcfg_defaultimageapp->text(), this);
625
    if (dlg->exec() == QDialog::Accepted) {
Laurent Montel's avatar
Laurent Montel committed
626
        KService::Ptr service = dlg->service();
627
        m_configEnv.kcfg_defaultimageapp->setText(KRun::binaryName(service->exec(), false));
628
    }
629
    delete dlg;
630
631
}

632
633
void KdenliveSettingsDialog::slotCheckShuttle(int state)
{
634
#ifdef USE_JOGSHUTTLE
635
    m_configShuttle.config_group->setEnabled(state);
636
    m_configShuttle.shuttledevicelist->clear();
637

638
639
    QStringList devNames = KdenliveSettings::shuttledevicenames();
    QStringList devPaths = KdenliveSettings::shuttledevicepaths();
640

641
642
643
    if (devNames.count() != devPaths.count()) {
        return;
    }
644
    for (int i = 0; i < devNames.count(); ++i) {
645
        m_configShuttle.shuttledevicelist->addItem(
646
647
648
649
            devNames.at(i), devPaths.at(i));
    }
    if (state) {
        setupJogshuttleBtns(m_configShuttle.shuttledevicelist->itemData(m_configShuttle.shuttledevicelist->currentIndex()).toString());
650
    }
651
#endif /* USE_JOGSHUTTLE */
652
653
}

654
655
void KdenliveSettingsDialog::slotUpdateShuttleDevice(int ix)
{
656
#ifdef USE_JOGSHUTTLE
657
658
    QString device = m_configShuttle.shuttledevicelist->itemData(ix).toString();
    //KdenliveSettings::setShuttledevice(device);
659
    setupJogshuttleBtns(device);
660
    m_configShuttle.kcfg_shuttledevice->setText(device);
661
#endif /* USE_JOGSHUTTLE */
662
}
663

664
665
666
void KdenliveSettingsDialog::updateWidgets()
{
    // Revert widgets to last saved state (for example when user pressed "Cancel")
Laurent Montel's avatar
Laurent Montel committed
667
    // //qCDebug(KDENLIVE_LOG) << "// // // KCONFIG Revert called";
668
#ifdef USE_JOGSHUTTLE
669
670
    // revert jog shuttle device
    if (m_configShuttle.shuttledevicelist->count() > 0) {
671
672
673
674
675
676
        for (int i = 0; i < m_configShuttle.shuttledevicelist->count(); ++i) {
            if (m_configShuttle.shuttledevicelist->itemData(i) == KdenliveSettings::shuttledevice()) {
                m_configShuttle.shuttledevicelist->setCurrentIndex(i);
                break;
            }
        }
677
    }
678

679
680
681
682
683
    // Revert jog shuttle buttons
    QList<QString> action_names = m_mappable_actions.keys();
    qSort(action_names);
    QStringList actions_map = JogShuttleConfig::actionMap(KdenliveSettings::shuttlebuttons());
    QMap<QString, int> action_pos;
684
    foreach (const QString &action_id, actions_map) {
685
686
687
688
689
690
691
        // This loop find out at what index is the string that would map to the action_id.
        for (int i = 0; i < action_names.size(); ++i) {
            if (m_mappable_actions[action_names[i]] == action_id) {
                action_pos[action_id] = i;
                break;
            }
        }
692
693
    }
    int i = 0;
694
    foreach (KComboBox *button, m_shuttle_buttons) {
695
        ++i;
696
        if (i < actions_map.size()) {
697
            button->setCurrentIndex(action_pos[actions_map[i]]);
698
        }
699
    }
700
#endif /* USE_JOGSHUTTLE */
701
}
702

703
704
705
706
707
708
709
710
711
void KdenliveSettingsDialog::accept()
{
    if (m_pw->selectedProfile().isEmpty()) {
        KMessageBox::error(this, i18n("Please select a video profile"));
        return;
    }
    KConfigDialog::accept();
}

712
713
void KdenliveSettingsDialog::updateSettings()
{
714
    // Save changes to settings (for example when user pressed "Apply" or "Ok")
Laurent Montel's avatar
Laurent Montel committed
715
    // //qCDebug(KDENLIVE_LOG) << "// // // KCONFIG UPDATE called";
716
717
718
719
    if (m_pw->selectedProfile().isEmpty()) {
        KMessageBox::error(this, i18n("Please select a video profile"));
        return;
    }
720
    KdenliveSettings::setDefault_profile(m_pw->selectedProfile());
721
722

    bool resetProfile = false;
723
    bool updateCapturePath = false;
724
    bool updateLibrary = false;
Alberto Villa's avatar
Alberto Villa committed
725

726
    /*if (m_configShuttle.shuttledevicelist->count() > 0) {
727
728
    QString device = m_configShuttle.shuttledevicelist->itemData(m_configShuttle.shuttledevicelist->currentIndex()).toString();
    if (device != KdenliveSettings::shuttledevice()) KdenliveSettings::setShuttledevice(device);
729
    }*/
730

731
    // Capture default folder
732
733
734
735
736
    if (m_configEnv.kcfg_capturetoprojectfolder->isChecked() != KdenliveSettings::capturetoprojectfolder()) {
        KdenliveSettings::setCapturetoprojectfolder(m_configEnv.kcfg_capturetoprojectfolder->isChecked());
        updateCapturePath = true;
    }

737
738
    if (m_configProject.projecturl->url().toLocalFile() != KdenliveSettings::defaultprojectfolder()) {
        KdenliveSettings::setDefaultprojectfolder(m_configProject.projecturl->url().toLocalFile());
739
740
    }

741
742
    if (m_configEnv.capturefolderurl->url().toLocalFile() != KdenliveSettings::capturefolder()) {
        KdenliveSettings::setCapturefolder(m_configEnv.capturefolderurl->url().toLocalFile());
743
        updateCapturePath = true;
744
745
    }

746
747
748
749
750
751
    // Library default folder
    if (m_configEnv.kcfg_librarytodefaultfolder->isChecked() != KdenliveSettings::librarytodefaultfolder()) {
        KdenliveSettings::setLibrarytodefaultfolder(m_configEnv.kcfg_librarytodefaultfolder->isChecked());
        updateLibrary = true;
    }

752
753
    if (m_configEnv.libraryfolderurl->url().toLocalFile() != KdenliveSettings::libraryfolder()) {
        KdenliveSettings::setLibraryfolder(m_configEnv.libraryfolderurl->url().toLocalFile());
754
755
756
757
758
        if (!KdenliveSettings::librarytodefaultfolder()) {
            updateLibrary = true;
        }
    }

759
760
761
762
763
    if (m_configCapture.kcfg_dvgrabfilename->text() != KdenliveSettings::dvgrabfilename()) {
        KdenliveSettings::setDvgrabfilename(m_configCapture.kcfg_dvgrabfilename->text());
        updateCapturePath = true;
    }

764
    if (m_configCapture.kcfg_firewireformat->currentIndex() != KdenliveSettings::firewireformat()) {
765
766
767
768
        KdenliveSettings::setFirewireformat(m_configCapture.kcfg_firewireformat->currentIndex());
        updateCapturePath = true;
    }

769
    if (m_configCapture.kcfg_v4l_format->currentIndex() != KdenliveSettings::v4l_format()) {
770
771
772
        saveCurrentV4lProfile();
        KdenliveSettings::setV4l_format(0);
    }
773

774
    // Check if screengrab is fullscreen
775
    if (m_configCapture.kcfg_grab_capture_type->currentIndex() != KdenliveSettings::grab_capture_type()) {
776
777
778
        KdenliveSettings::setGrab_capture_type(m_configCapture.kcfg_grab_capture_type->currentIndex());
        emit updateFullScreenGrab();
    }
Alberto Villa's avatar
Alberto Villa committed
779

780
    // Check encoding profiles
781
    // FFmpeg
782
783
784
785
    QString profilestr = m_configCapture.kcfg_v4l_profile->itemData(m_configCapture.kcfg_v4l_profile->currentIndex()).toString();
    if (!profilestr.isEmpty() && (profilestr.section(QLatin1Char(';'), 0, 0) != KdenliveSettings::v4l_parameters() || profilestr.section(QLatin1Char(';'), 1, 1) != KdenliveSettings::v4l_extension())) {
        KdenliveSettings::setV4l_parameters(profilestr.section(QLatin1Char(';'), 0, 0));
        KdenliveSettings::setV4l_extension(profilestr.section(QLatin1Char(';'), 1, 1));
786
    }
787
    // screengrab
788
789
790
791
    profilestr = m_configCapture.kcfg_grab_profile->itemData(m_configCapture.kcfg_grab_profile->currentIndex()).toString();
    if (!profilestr.isEmpty() && (profilestr.section(QLatin1Char(';'), 0, 0) != KdenliveSettings::grab_parameters() || profilestr.section(QLatin1Char(';'), 1, 1) != KdenliveSettings::grab_extension())) {
        KdenliveSettings::setGrab_parameters(profilestr.section(QLatin1Char(';'), 0, 0));
        KdenliveSettings::setGrab_extension(profilestr.section(QLatin1Char(';'), 1, 1));
792
    }
793

794
    // decklink
795
796
797
798
    profilestr = m_configCapture.kcfg_decklink_profile->itemData(m_configCapture.kcfg_decklink_profile->currentIndex()).toString();
    if (!profilestr.isEmpty() && (profilestr.section(QLatin1Char(';'), 0, 0) != KdenliveSettings::decklink_parameters() || profilestr.section(QLatin1Char(';'), 1, 1) != KdenliveSettings::decklink_extension())) {
        KdenliveSettings::setDecklink_parameters(profilestr.section(QLatin1Char(';'), 0, 0