kdenlivesettingsdialog.cpp 75.1 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
#include "kdenlivesettingsdialog.h"
Nicolas Carion's avatar
Nicolas Carion committed
21
#include "clipcreationdialog.h"
Nicolas Carion's avatar
linting  
Nicolas Carion committed
22
#include "core.h"
23
#include "dialogs/profilesdialog.h"
Nicolas Carion's avatar
Nicolas Carion committed
24
#include "encodingprofilesdialog.h"
25
#include "kdenlivesettings.h"
Nicolas Carion's avatar
linting  
Nicolas Carion committed
26
#include "profiles/profilemodel.hpp"
27
#include "profiles/profilerepository.hpp"
Nicolas Carion's avatar
Nicolas Carion committed
28 29
#include "profilesdialog.h"
#include "project/dialogs/profilewidget.h"
30

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

Nicolas Carion's avatar
Nicolas Carion committed
35
#include "kdenlive_debug.h"
36
#include "klocalizedstring.h"
37
#include <KIO/DesktopExecParser>
38
#include <KLineEdit>
Nicolas Carion's avatar
Nicolas Carion committed
39
#include <KMessageBox>
40
#include <KOpenWithDialog>
Nicolas Carion's avatar
Nicolas Carion committed
41
#include <KService>
Jean-Baptiste Mardelle's avatar
Jean-Baptiste Mardelle committed
42
#include <QAction>
43
#include <QDir>
Akhil K Gangadharan's avatar
Akhil K Gangadharan committed
44 45
#include <QGuiApplication>
#include <QScreen>
46 47 48
#include <QSize>
#include <QThread>
#include <QTimer>
Nicolas Carion's avatar
Nicolas Carion committed
49 50
#include <cstdio>
#include <cstdlib>
Nicolas Carion's avatar
Nicolas Carion committed
51
#include <fcntl.h>
52
#include <unistd.h>
53

54
#ifdef USE_JOGSHUTTLE
55 56
#include "jogshuttle/jogaction.h"
#include "jogshuttle/jogshuttleconfig.h"
57
#include <QStandardPaths>
Nicolas Carion's avatar
Nicolas Carion committed
58
#include <linux/input.h>
59
#endif
60

Nicolas Carion's avatar
Nicolas Carion committed
61
KdenliveSettingsDialog::KdenliveSettingsDialog(QMap<QString, QString> mappable_actions, bool gpuAllowed, QWidget *parent)
62 63 64
    : KConfigDialog(parent, QStringLiteral("settings"), KdenliveSettings::self())
    , m_modified(false)
    , m_shuttleModified(false)
Nicolas Carion's avatar
Nicolas Carion committed
65
    , m_mappable_actions(std::move(mappable_actions))
66
{
67
    KdenliveSettings::setV4l_format(0);
68
    QWidget *p1 = new QWidget;
69
    QFontInfo ftInfo(font());
70
    m_configMisc.setupUi(p1);
71
    m_page1 = addPage(p1, i18n("Misc"));
72
    m_page1->setIcon(QIcon::fromTheme(QStringLiteral("configure")));
73

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

76 77
    QWidget *p8 = new QWidget;
    m_configProject.setupUi(p8);
78
    m_page8 = addPage(p8, i18n("Project Defaults"));
Nicolas Carion's avatar
Nicolas Carion committed
79
    auto *vbox = new QVBoxLayout;
80 81 82
    m_pw = new ProfileWidget(this);
    vbox->addWidget(m_pw);
    m_configProject.profile_box->setLayout(vbox);
83
    m_configProject.profile_box->setTitle(i18n("Select the default profile (preset)"));
84
    // Select profile
85
    m_pw->loadProfile(KdenliveSettings::default_profile().isEmpty() ? pCore->getCurrentProfile()->path() : KdenliveSettings::default_profile());
86
    connect(m_pw, &ProfileWidget::profileChanged, this, &KdenliveSettingsDialog::slotDialogModified);
87
    m_page8->setIcon(QIcon::fromTheme(QStringLiteral("project-defaults")));
88 89
    m_configProject.projecturl->setMode(KFile::Directory);
    m_configProject.projecturl->setUrl(QUrl::fromLocalFile(KdenliveSettings::defaultprojectfolder()));
90 91 92 93 94 95 96 97 98 99
    connect(m_configProject.kcfg_videotracks, static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged), [this]() {
        if (m_configProject.kcfg_videotracks->value() + m_configProject.kcfg_audiotracks->value() <= 0) {
            m_configProject.kcfg_videotracks->setValue(1);
        }
    });
    connect(m_configProject.kcfg_audiotracks, static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged), [this] () {
        if (m_configProject.kcfg_videotracks->value() + m_configProject.kcfg_audiotracks->value() <= 0) {
            m_configProject.kcfg_audiotracks->setValue(1);
        }
    });
100 101 102

    QWidget *p9 = new QWidget;
    m_configProxy.setupUi(p9);
103
    KPageWidgetItem *page9 = addPage(p9, i18n("Proxy Clips"));
104 105 106 107 108 109
    page9->setIcon(QIcon::fromTheme(QStringLiteral("zoom-out")));
    connect(m_configProxy.kcfg_generateproxy, &QAbstractButton::toggled, m_configProxy.kcfg_proxyminsize, &QWidget::setEnabled);
    m_configProxy.kcfg_proxyminsize->setEnabled(KdenliveSettings::generateproxy());
    connect(m_configProxy.kcfg_generateimageproxy, &QAbstractButton::toggled, m_configProxy.kcfg_proxyimageminsize, &QWidget::setEnabled);
    m_configProxy.kcfg_proxyimageminsize->setEnabled(KdenliveSettings::generateimageproxy());
    loadExternalProxyProfiles();
110

111
    QWidget *p3 = new QWidget;
112
    m_configTimeline.setupUi(p3);
113
    m_page3 = addPage(p3, i18n("Timeline"));
114
    m_page3->setIcon(QIcon::fromTheme(QStringLiteral("video-display")));
115
    m_configTimeline.kcfg_trackheight->setMinimum(ftInfo.pixelSize() * 1.5);
116 117 118 119

    QWidget *p2 = new QWidget;
    m_configEnv.setupUi(p2);
    m_configEnv.mltpathurl->setMode(KFile::Directory);
120 121 122 123 124
    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"));
125 126
    int maxThreads = QThread::idealThreadCount();
    m_configEnv.kcfg_mltthreads->setMaximum(maxThreads > 2 ? maxThreads : 8);
127
    m_configEnv.tmppathurl->setMode(KFile::Directory);
128
    m_configEnv.tmppathurl->lineEdit()->setObjectName(QStringLiteral("kcfg_currenttmpfolder"));
129
    m_configEnv.capturefolderurl->setMode(KFile::Directory);
130
    m_configEnv.capturefolderurl->lineEdit()->setObjectName(QStringLiteral("kcfg_capturefolder"));
131
    m_configEnv.capturefolderurl->setEnabled(!KdenliveSettings::capturetoprojectfolder());
Laurent Montel's avatar
Laurent Montel committed
132
    connect(m_configEnv.kcfg_capturetoprojectfolder, &QAbstractButton::clicked, this, &KdenliveSettingsDialog::slotEnableCaptureFolder);
133 134 135 136
    // Library folder
    m_configEnv.libraryfolderurl->setMode(KFile::Directory);
    m_configEnv.libraryfolderurl->lineEdit()->setObjectName(QStringLiteral("kcfg_libraryfolder"));
    m_configEnv.libraryfolderurl->setEnabled(!KdenliveSettings::librarytodefaultfolder());
137
    m_configEnv.kcfg_librarytodefaultfolder->setToolTip(QStandardPaths::writableLocation(QStandardPaths::AppDataLocation) + QStringLiteral("/library"));
Laurent Montel's avatar
Laurent Montel committed
138
    connect(m_configEnv.kcfg_librarytodefaultfolder, &QAbstractButton::clicked, this, &KdenliveSettingsDialog::slotEnableLibraryFolder);
139

140 141
    // Mime types
    QStringList mimes = ClipCreationDialog::getExtensions();
142
    std::sort(mimes.begin(), mimes.end());
Laurent Montel's avatar
Laurent Montel committed
143
    m_configEnv.supportedmimes->setPlainText(mimes.join(QLatin1Char(' ')));
144

145
    m_page2 = addPage(p2, i18n("Environment"));
146
    m_page2->setIcon(QIcon::fromTheme(QStringLiteral("application-x-executable-script")));
147 148 149

    QWidget *p4 = new QWidget;
    m_configCapture.setupUi(p4);
150
    // Remove ffmpeg tab, unused
151
    m_configCapture.tabWidget->removeTab(0);
152 153 154
    m_configCapture.label->setVisible(false);
    m_configCapture.kcfg_defaultcapture->setVisible(false);
    //m_configCapture.tabWidget->removeTab(2);
155
#ifdef USE_V4L
156

157
    // Video 4 Linux device detection
Laurent Montel's avatar
Laurent Montel committed
158
    for (int i = 0; i < 10; ++i) {
Laurent Montel's avatar
Laurent Montel committed
159
        QString path = QStringLiteral("/dev/video") + QString::number(i);
160
        if (QFile::exists(path)) {
161
            QStringList deviceInfo = V4lCaptureHandler::getDeviceName(path);
162 163 164 165
            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);
            }
166 167
        }
    }
Laurent Montel's avatar
Laurent Montel committed
168
#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
169
    connect(m_configCapture.kcfg_detectedv4ldevices, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this,
Laurent Montel's avatar
Laurent Montel committed
170 171 172
#else
    connect(m_configCapture.kcfg_detectedv4ldevices, static_cast<void (QComboBox::*)(int, const QString &)>(&QComboBox::currentIndexChanged) , this,
#endif
Nicolas Carion's avatar
Nicolas Carion committed
173
            &KdenliveSettingsDialog::slotUpdatev4lDevice);
Laurent Montel's avatar
Laurent Montel committed
174
#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
175
    connect(m_configCapture.kcfg_v4l_format, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this,
Laurent Montel's avatar
Laurent Montel committed
176 177 178
#else
    connect(m_configCapture.kcfg_v4l_format, static_cast<void (QComboBox::*)(int, const QString &)>(&QComboBox::currentIndexChanged) , this,
#endif
Nicolas Carion's avatar
Nicolas Carion committed
179
            &KdenliveSettingsDialog::slotUpdatev4lCaptureProfile);
Laurent Montel's avatar
Laurent Montel committed
180
    connect(m_configCapture.config_v4l, &QAbstractButton::clicked, this, &KdenliveSettingsDialog::slotEditVideo4LinuxProfile);
181 182

    slotUpdatev4lDevice();
183
#endif
184

185
    m_page4 = addPage(p4, i18n("Capture"));
186
    m_page4->setIcon(QIcon::fromTheme(QStringLiteral("media-record")));
187
    m_configCapture.tabWidget->setCurrentIndex(KdenliveSettings::defaultcapture());
Alberto Villa's avatar
Alberto Villa committed
188
#ifdef Q_WS_MAC
189 190
    m_configCapture.tabWidget->setEnabled(false);
    m_configCapture.kcfg_defaultcapture->setEnabled(false);
Alberto Villa's avatar
Alberto Villa committed
191
    m_configCapture.label->setText(i18n("Capture is not yet available on Mac OS X."));
192
#endif
193

194 195
    QWidget *p5 = new QWidget;
    m_configShuttle.setupUi(p5);
196
#ifdef USE_JOGSHUTTLE
197
    m_configShuttle.toolBtnReload->setIcon(QIcon::fromTheme(QStringLiteral("view-refresh")));
Laurent Montel's avatar
Laurent Montel committed
198
    connect(m_configShuttle.kcfg_enableshuttle, &QCheckBox::stateChanged, this, &KdenliveSettingsDialog::slotCheckShuttle);
199
    connect(m_configShuttle.shuttledevicelist, SIGNAL(activated(int)), this, SLOT(slotUpdateShuttleDevice(int)));
Laurent Montel's avatar
Laurent Montel committed
200
    connect(m_configShuttle.toolBtnReload, &QAbstractButton::clicked, this, &KdenliveSettingsDialog::slotReloadShuttleDevices);
201

Nicolas Carion's avatar
Nicolas Carion committed
202
    slotCheckShuttle(static_cast<int>(KdenliveSettings::enableshuttle()));
203
    m_configShuttle.shuttledisabled->hide();
204 205

    // Store the button pointers into an array for easier handling them in the other functions.
206
    // TODO: impl enumerator or live with cut and paste :-)))
207 208
    setupJogshuttleBtns(KdenliveSettings::shuttledevice());
#if 0
209 210 211 212 213
    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);
214 215 216 217 218
    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);
219 220 221 222 223
    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);
224
#endif
225

Nicolas Carion's avatar
Nicolas Carion committed
226
#else  /* ! USE_JOGSHUTTLE */
227 228 229
    m_configShuttle.kcfg_enableshuttle->hide();
    m_configShuttle.kcfg_enableshuttle->setDisabled(true);
#endif /* USE_JOGSHUTTLE */
230
    m_page5 = addPage(p5, i18n("JogShuttle"));
231
    m_page5->setIcon(QIcon::fromTheme(QStringLiteral("jog-dial")));
232

233 234
    QWidget *p6 = new QWidget;
    m_configSdl.setupUi(p6);
235
    m_configSdl.reload_blackmagic->setIcon(QIcon::fromTheme(QStringLiteral("view-refresh")));
Laurent Montel's avatar
Laurent Montel committed
236
    connect(m_configSdl.reload_blackmagic, &QAbstractButton::clicked, this, &KdenliveSettingsDialog::slotReloadBlackMagic);
237

Nicolas Carion's avatar
Nicolas Carion committed
238
    // m_configSdl.kcfg_openglmonitors->setHidden(true);
239

240
    m_page6 = addPage(p6, i18n("Playback"));
241
    m_page6->setIcon(QIcon::fromTheme(QStringLiteral("media-playback-start")));
242

243 244
    QWidget *p7 = new QWidget;
    m_configTranscode.setupUi(p7);
245
    m_page7 = addPage(p7, i18n("Transcode"));
246
    m_page7->setIcon(QIcon::fromTheme(QStringLiteral("edit-copy")));
247

Laurent Montel's avatar
Laurent Montel committed
248 249 250 251
    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);
252

Laurent Montel's avatar
Laurent Montel committed
253 254 255 256 257
    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);
258

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

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

Laurent Montel's avatar
Laurent Montel committed
263 264
    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
265

266
    loadEncodingProfiles();
267

Laurent Montel's avatar
Laurent Montel committed
268
#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
269
    connect(m_configSdl.kcfg_audio_driver, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this,
Laurent Montel's avatar
Laurent Montel committed
270 271 272
#else
    connect(m_configSdl.kcfg_audio_driver, static_cast<void (QComboBox::*)(int, const QString &)>(&QComboBox::currentIndexChanged) , this,
#endif
Nicolas Carion's avatar
Nicolas Carion committed
273
            &KdenliveSettingsDialog::slotCheckAlsaDriver);
Laurent Montel's avatar
Laurent Montel committed
274
#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
275
    connect(m_configSdl.kcfg_audio_backend, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this,
Laurent Montel's avatar
Laurent Montel committed
276 277 278
#else
    connect(m_configSdl.kcfg_audio_backend, static_cast<void (QComboBox::*)(int, const QString &)>(&QComboBox::currentIndexChanged) , this,
#endif
Nicolas Carion's avatar
Nicolas Carion committed
279
            &KdenliveSettingsDialog::slotCheckAudioBackend);
280
    initDevices();
Laurent Montel's avatar
Laurent Montel committed
281
#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
282
    connect(m_configCapture.kcfg_grab_capture_type, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this,
Laurent Montel's avatar
Laurent Montel committed
283 284 285
#else
    connect(m_configCapture.kcfg_grab_capture_type, static_cast<void (QComboBox::*)(int, const QString &)>(&QComboBox::currentIndexChanged) , this,
#endif
Nicolas Carion's avatar
Nicolas Carion committed
286
            &KdenliveSettingsDialog::slotUpdateGrabRegionStatus);
287

288
    slotUpdateGrabRegionStatus();
289
    loadTranscodeProfiles();
290

291
    // decklink profile
292
    QAction *act = new QAction(QIcon::fromTheme(QStringLiteral("configure")), i18n("Configure profiles"), this);
293
    act->setData(4);
Laurent Montel's avatar
Laurent Montel committed
294
    connect(act, &QAction::triggered, this, &KdenliveSettingsDialog::slotManageEncodingProfile);
295
    m_configCapture.decklink_manageprofile->setDefaultAction(act);
296
    m_configCapture.decklink_showprofileinfo->setIcon(QIcon::fromTheme(QStringLiteral("help-about")));
297 298 299
    m_configCapture.decklink_parameters->setVisible(false);
    m_configCapture.decklink_parameters->setMaximumHeight(QFontMetrics(font()).lineSpacing() * 4);
    m_configCapture.decklink_parameters->setPlainText(KdenliveSettings::decklink_parameters());
Laurent Montel's avatar
Laurent Montel committed
300
#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
301
    connect(m_configCapture.kcfg_decklink_profile, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this,
Laurent Montel's avatar
Laurent Montel committed
302 303 304
#else
    connect(m_configCapture.kcfg_decklink_profile, static_cast<void (QComboBox::*)(int, const QString &)>(&QComboBox::currentIndexChanged) , this,
#endif
Nicolas Carion's avatar
Nicolas Carion committed
305
            &KdenliveSettingsDialog::slotUpdateDecklinkProfile);
Laurent Montel's avatar
Laurent Montel committed
306
    connect(m_configCapture.decklink_showprofileinfo, &QAbstractButton::clicked, m_configCapture.decklink_parameters, &QWidget::setVisible);
307

308
    // ffmpeg profile
309
    m_configCapture.v4l_showprofileinfo->setIcon(QIcon::fromTheme(QStringLiteral("help-about")));
310 311 312
    m_configCapture.v4l_parameters->setVisible(false);
    m_configCapture.v4l_parameters->setMaximumHeight(QFontMetrics(font()).lineSpacing() * 4);
    m_configCapture.v4l_parameters->setPlainText(KdenliveSettings::v4l_parameters());
313

314
    act = new QAction(QIcon::fromTheme(QStringLiteral("configure")), i18n("Configure profiles"), this);
315
    act->setData(2);
Laurent Montel's avatar
Laurent Montel committed
316
    connect(act, &QAction::triggered, this, &KdenliveSettingsDialog::slotManageEncodingProfile);
317
    m_configCapture.v4l_manageprofile->setDefaultAction(act);
Laurent Montel's avatar
Laurent Montel committed
318
#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
319
    connect(m_configCapture.kcfg_v4l_profile, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this,
Laurent Montel's avatar
Laurent Montel committed
320 321 322
#else
    connect(m_configCapture.kcfg_v4l_profile, static_cast<void (QComboBox::*)(int, const QString &)>(&QComboBox::currentIndexChanged) , this,
#endif
Nicolas Carion's avatar
Nicolas Carion committed
323
            &KdenliveSettingsDialog::slotUpdateV4lProfile);
Laurent Montel's avatar
Laurent Montel committed
324
    connect(m_configCapture.v4l_showprofileinfo, &QAbstractButton::clicked, m_configCapture.v4l_parameters, &QWidget::setVisible);
325

326
    // screen grab profile
327
    m_configCapture.grab_showprofileinfo->setIcon(QIcon::fromTheme(QStringLiteral("help-about")));
328 329 330
    m_configCapture.grab_parameters->setVisible(false);
    m_configCapture.grab_parameters->setMaximumHeight(QFontMetrics(font()).lineSpacing() * 4);
    m_configCapture.grab_parameters->setPlainText(KdenliveSettings::grab_parameters());
331
    act = new QAction(QIcon::fromTheme(QStringLiteral("configure")), i18n("Configure profiles"), this);
332
    act->setData(3);
Laurent Montel's avatar
Laurent Montel committed
333
    connect(act, &QAction::triggered, this, &KdenliveSettingsDialog::slotManageEncodingProfile);
334
    m_configCapture.grab_manageprofile->setDefaultAction(act);
Laurent Montel's avatar
Laurent Montel committed
335
#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
336
    connect(m_configCapture.kcfg_grab_profile, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this,
Laurent Montel's avatar
Laurent Montel committed
337 338 339
#else
    connect(m_configCapture.kcfg_grab_profile, static_cast<void (QComboBox::*)(int, const QString &)>(&QComboBox::currentIndexChanged) , this,
#endif
Nicolas Carion's avatar
Nicolas Carion committed
340
            &KdenliveSettingsDialog::slotUpdateGrabProfile);
Laurent Montel's avatar
Laurent Montel committed
341
    connect(m_configCapture.grab_showprofileinfo, &QAbstractButton::clicked, m_configCapture.grab_parameters, &QWidget::setVisible);
Alberto Villa's avatar
Alberto Villa committed
342

343 344 345 346 347 348 349
    // audio capture channels
    m_configCapture.audiocapturechannels->clear();
    m_configCapture.audiocapturechannels->addItem(i18n("Mono (1 channel)"), 1);
    m_configCapture.audiocapturechannels->addItem(i18n("Stereo (2 channels)"), 2);

    int channelsIndex = m_configCapture.audiocapturechannels->findData(KdenliveSettings::audiocapturechannels());
    m_configCapture.audiocapturechannels->setCurrentIndex(qMax(channelsIndex, 0));
Laurent Montel's avatar
Laurent Montel committed
350
#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
351
    connect(m_configCapture.audiocapturechannels, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this,
Laurent Montel's avatar
Laurent Montel committed
352 353 354
#else
    connect(m_configCapture.audiocapturechannels, static_cast<void (QComboBox::*)(int, const QString &)>(&QComboBox::currentIndexChanged) , this,
#endif
355 356 357 358 359 360 361 362 363
            &KdenliveSettingsDialog::slotUpdateAudioCaptureChannels);

    // audio capture sample rate
    m_configCapture.audiocapturesamplerate->clear();
    m_configCapture.audiocapturesamplerate->addItem(i18n("44100 Hz"), 44100);
    m_configCapture.audiocapturesamplerate->addItem(i18n("48000 Hz"), 48000);

    int sampleRateIndex = m_configCapture.audiocapturesamplerate->findData(KdenliveSettings::audiocapturesamplerate());
    m_configCapture.audiocapturesamplerate->setCurrentIndex(qMax(sampleRateIndex, 0));
Laurent Montel's avatar
Laurent Montel committed
364
#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
365
    connect(m_configCapture.audiocapturesamplerate, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this,
Laurent Montel's avatar
Laurent Montel committed
366 367 368
#else
    connect(m_configCapture.audiocapturesamplerate, static_cast<void (QComboBox::*)(int, const QString &)>(&QComboBox::currentIndexChanged) , this,
#endif
369 370 371 372
            &KdenliveSettingsDialog::slotUpdateAudioCaptureSampleRate);

    m_configCapture.labelNoAudioDevices->setVisible(false);

373
    // Timeline preview
374
    act = new QAction(QIcon::fromTheme(QStringLiteral("configure")), i18n("Configure profiles"), this);
375
    act->setData(1);
Laurent Montel's avatar
Laurent Montel committed
376
    connect(act, &QAction::triggered, this, &KdenliveSettingsDialog::slotManageEncodingProfile);
377
    m_configProject.preview_manageprofile->setDefaultAction(act);
Laurent Montel's avatar
Laurent Montel committed
378
#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
379
    connect(m_configProject.kcfg_preview_profile, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this,
Laurent Montel's avatar
Laurent Montel committed
380 381 382
#else
    connect(m_configProject.kcfg_preview_profile, static_cast<void (QComboBox::*)(int, const QString &)>(&QComboBox::currentIndexChanged) , this,
#endif
Nicolas Carion's avatar
Nicolas Carion committed
383
            &KdenliveSettingsDialog::slotUpdatePreviewProfile);
Laurent Montel's avatar
Laurent Montel committed
384
    connect(m_configProject.preview_showprofileinfo, &QAbstractButton::clicked, m_configProject.previewparams, &QWidget::setVisible);
385 386 387
    m_configProject.previewparams->setVisible(false);
    m_configProject.previewparams->setMaximumHeight(QFontMetrics(font()).lineSpacing() * 3);
    m_configProject.previewparams->setPlainText(KdenliveSettings::previewparams());
388
    m_configProject.preview_showprofileinfo->setIcon(QIcon::fromTheme(QStringLiteral("help-about")));
389
    m_configProject.preview_showprofileinfo->setToolTip(i18n("Show default timeline preview parameters"));
390
    m_configProject.preview_manageprofile->setIcon(QIcon::fromTheme(QStringLiteral("configure")));
391 392
    m_configProject.preview_manageprofile->setToolTip(i18n("Manage timeline preview profiles"));
    m_configProject.kcfg_preview_profile->setToolTip(i18n("Select default timeline preview profile"));
393

394
    // proxy profile stuff
395 396 397 398 399 400 401 402
    m_configProxy.proxy_showprofileinfo->setIcon(QIcon::fromTheme(QStringLiteral("help-about")));
    m_configProxy.proxy_showprofileinfo->setToolTip(i18n("Show default profile parameters"));
    m_configProxy.proxy_manageprofile->setIcon(QIcon::fromTheme(QStringLiteral("configure")));
    m_configProxy.proxy_manageprofile->setToolTip(i18n("Manage proxy profiles"));
    m_configProxy.kcfg_proxy_profile->setToolTip(i18n("Select default proxy profile"));
    m_configProxy.proxyparams->setVisible(false);
    m_configProxy.proxyparams->setMaximumHeight(QFontMetrics(font()).lineSpacing() * 3);
    m_configProxy.proxyparams->setPlainText(KdenliveSettings::proxyparams());
403

404
    act = new QAction(QIcon::fromTheme(QStringLiteral("configure")), i18n("Configure profiles"), this);
405
    act->setData(0);
Laurent Montel's avatar
Laurent Montel committed
406
    connect(act, &QAction::triggered, this, &KdenliveSettingsDialog::slotManageEncodingProfile);
407
    m_configProxy.proxy_manageprofile->setDefaultAction(act);
408

409
    connect(m_configProxy.proxy_showprofileinfo, &QAbstractButton::clicked, m_configProxy.proxyparams, &QWidget::setVisible);
Laurent Montel's avatar
Laurent Montel committed
410
#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
411
    connect(m_configProxy.kcfg_proxy_profile, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this,
Laurent Montel's avatar
Laurent Montel committed
412 413 414
#else
    connect(m_configProxy.kcfg_proxy_profile, static_cast<void (QComboBox::*)(int, const QString &)>(&QComboBox::currentIndexChanged) , this,
#endif
Nicolas Carion's avatar
Nicolas Carion committed
415
            &KdenliveSettingsDialog::slotUpdateProxyProfile);
416 417 418

    slotUpdateProxyProfile(-1);
    slotUpdateV4lProfile(-1);
419
    slotUpdateGrabProfile(-1);
420
    slotUpdateDecklinkProfile(-1);
421

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

426 427
    getBlackMagicDeviceList(m_configCapture.kcfg_decklink_capturedevice);
    if (!getBlackMagicOutputDeviceList(m_configSdl.kcfg_blackmagic_output_device)) {
428
        // No blackmagic card found
429
        m_configSdl.kcfg_external_display->setEnabled(false);
430
    }
431 432
    
    initAudioRecDevice();
Akhil K Gangadharan's avatar
Akhil K Gangadharan committed
433

434
    // Config dialog size
Akhil K Gangadharan's avatar
Akhil K Gangadharan committed
435 436 437 438
    KSharedConfigPtr config = KSharedConfig::openConfig();
    KConfigGroup settingsGroup(config, "settings");
    QSize optimalSize;

439 440
    if (!settingsGroup.exists() || !settingsGroup.hasKey("dialogSize")) {
        const QSize screenSize = (QGuiApplication::primaryScreen()->availableSize() * 0.9);
Akhil K Gangadharan's avatar
Akhil K Gangadharan committed
441 442
        const QSize targetSize = QSize(1024, 700);
        optimalSize = targetSize.boundedTo(screenSize);
443 444
    } else {
        optimalSize = settingsGroup.readEntry("dialogSize", QVariant(size())).toSize();
Akhil K Gangadharan's avatar
Akhil K Gangadharan committed
445 446
    }
    resize(optimalSize);
447 448
}

449
// static
450
bool KdenliveSettingsDialog::getBlackMagicDeviceList(QComboBox *devicelist, bool force)
451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476
{
    if (!force && !KdenliveSettings::decklink_device_found()) {
        return false;
    }
    Mlt::Profile profile;
    Mlt::Producer bm(profile, "decklink");
    int found_devices = 0;
    if (bm.is_valid()) {
        bm.set("list_devices", 1);
        found_devices = bm.get_int("devices");
    } else {
        KdenliveSettings::setDecklink_device_found(false);
    }
    if (found_devices <= 0) {
        devicelist->setEnabled(false);
        return false;
    }
    KdenliveSettings::setDecklink_device_found(true);
    for (int i = 0; i < found_devices; ++i) {
        char *tmp = qstrdup(QStringLiteral("device.%1").arg(i).toUtf8().constData());
        devicelist->addItem(bm.get(tmp));
        delete[] tmp;
    }
    return true;
}

477 478 479 480
// static
bool KdenliveSettingsDialog::initAudioRecDevice()
{
    QStringList audioDevices = pCore->getAudioCaptureDevices();
481 482 483 484

    //show a hint to the user to know what to check for in case the device list are empty (common issue)
    m_configCapture.labelNoAudioDevices->setVisible(audioDevices.empty());

485
    m_configCapture.kcfg_defaultaudiocapture->addItems(audioDevices);
Laurent Montel's avatar
Laurent Montel committed
486
#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
487
    connect(m_configCapture.kcfg_defaultaudiocapture, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), [&]() {
Laurent Montel's avatar
Laurent Montel committed
488 489 490
#else
    connect(m_configCapture.kcfg_defaultaudiocapture, static_cast<void (QComboBox::*)(int, const QString &)>(&QComboBox::currentIndexChanged) , [&]() {
#endif
491 492 493 494 495 496 497 498 499 500 501 502
        QString currentDevice = m_configCapture.kcfg_defaultaudiocapture->currentText();
        KdenliveSettings::setDefaultaudiocapture(currentDevice);
    });
    QString selectedDevice = KdenliveSettings::defaultaudiocapture();
    int selectedIndex = m_configCapture.kcfg_defaultaudiocapture->findText(selectedDevice);
    if (!selectedDevice.isEmpty() && selectedIndex > -1) {
        m_configCapture.kcfg_defaultaudiocapture->setCurrentIndex(selectedIndex);
    }
    return true;
}

bool KdenliveSettingsDialog::getBlackMagicOutputDeviceList(QComboBox *devicelist, bool force)
503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529
{
    if (!force && !KdenliveSettings::decklink_device_found()) {
        return false;
    }
    Mlt::Profile profile;
    Mlt::Consumer bm(profile, "decklink");
    int found_devices = 0;
    if (bm.is_valid()) {
        bm.set("list_devices", 1);
        found_devices = bm.get_int("devices");
    } else {
        KdenliveSettings::setDecklink_device_found(false);
    }
    if (found_devices <= 0) {
        devicelist->setEnabled(false);
        return false;
    }
    KdenliveSettings::setDecklink_device_found(true);
    for (int i = 0; i < found_devices; ++i) {
        char *tmp = qstrdup(QStringLiteral("device.%1").arg(i).toUtf8().constData());
        devicelist->addItem(bm.get(tmp));
        delete[] tmp;
    }
    devicelist->addItem(QStringLiteral("test"));
    return true;
}

Laurent Montel's avatar
Laurent Montel committed
530
void KdenliveSettingsDialog::setupJogshuttleBtns(const QString &device)
531
{
532
    QList<QComboBox *> list;
533
    QList<QLabel *> list1;
534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550

    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;

Nicolas Carion's avatar
Nicolas Carion committed
551 552 553 554 555 556 557 558
    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
559 560 561 562 563 564 565 566
    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

567
    for (int i = 0; i < list.count(); ++i) {
568 569 570
        list[i]->hide();
        list1[i]->hide();
    }
571
#ifdef USE_JOGSHUTTLE
572 573 574
    if (!m_configShuttle.kcfg_enableshuttle->isChecked()) {
        return;
    }
575 576
    int keysCount = JogShuttle::keysCount(device);

577
    for (int i = 0; i < keysCount; ++i) {
578 579 580 581 582 583 584 585 586
        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();
587
    QList<QString>::Iterator iter = action_names.begin();
Nicolas Carion's avatar
Nicolas Carion committed
588
    // qCDebug(KDENLIVE_LOG) << "::::::::::::::::";
589
    while (iter != action_names.end()) {
Nicolas Carion's avatar
Nicolas Carion committed
590
        // qCDebug(KDENLIVE_LOG) << *iter;
591 592 593
        ++iter;
    }

Nicolas Carion's avatar
Nicolas Carion committed
594
    // qCDebug(KDENLIVE_LOG) << "::::::::::::::::";
595

596
    std::sort(action_names.begin(), action_names.end());
597 598
    iter = action_names.begin();
    while (iter != action_names.end()) {
Nicolas Carion's avatar
Nicolas Carion committed
599
        // qCDebug(KDENLIVE_LOG) << *iter;
600 601
        ++iter;
    }
Nicolas Carion's avatar
Nicolas Carion committed
602
    // qCDebug(KDENLIVE_LOG) << "::::::::::::::::";
603 604 605 606 607

    // 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;
Nicolas Carion's avatar
Nicolas Carion committed
608
    for (const QString &action_id : actions_map) {
609 610 611 612 613 614 615 616 617 618
        // 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;
619
    for (QComboBox *button : m_shuttle_buttons) {
620 621 622
        button->addItems(action_names);
        connect(button, SIGNAL(activated(int)), this, SLOT(slotShuttleModified()));
        ++i;
623
        if (i < actions_map.size()) {
624
            button->setCurrentIndex(action_pos[actions_map[i]]);
625
        }
626
    }
Vincent Pinon's avatar
Vincent Pinon committed
627 628
#else
    Q_UNUSED(device)
629
#endif
630 631
}

Nicolas Carion's avatar
Nicolas Carion committed
632
KdenliveSettingsDialog::~KdenliveSettingsDialog() = default;
633

634
void KdenliveSettingsDialog::slotUpdateGrabRegionStatus()
635
{
636
    m_configCapture.region_group->setHidden(m_configCapture.kcfg_grab_capture_type->currentIndex() != 1);
637
}
638

639 640 641 642 643
void KdenliveSettingsDialog::slotEnableCaptureFolder()
{
    m_configEnv.capturefolderurl->setEnabled(!m_configEnv.kcfg_capturetoprojectfolder->isChecked());
}

644 645 646 647 648
void KdenliveSettingsDialog::slotEnableLibraryFolder()
{
    m_configEnv.libraryfolderurl->setEnabled(!m_configEnv.kcfg_librarytodefaultfolder->isChecked());
}

649 650
void KdenliveSettingsDialog::initDevices()
{
651 652
    // Fill audio drivers
    m_configSdl.kcfg_audio_driver->addItem(i18n("Automatic"), QString());
653 654 655 656 657 658
#if defined(Q_OS_WIN)
    //TODO: i18n
    m_configSdl.kcfg_audio_driver->addItem("DirectSound", "directsound");
    m_configSdl.kcfg_audio_driver->addItem("WinMM", "winmm");
    m_configSdl.kcfg_audio_driver->addItem("Wasapi", "wasapi");
#elif !defined(Q_WS_MAC)
659
    m_configSdl.kcfg_audio_driver->addItem(i18n("ALSA"), "alsa");
660 661 662
    m_configSdl.kcfg_audio_driver->addItem(i18n("PulseAudio"), "pulseaudio");
    m_configSdl.kcfg_audio_driver->addItem(i18n("OSS"), "dsp");
    //m_configSdl.kcfg_audio_driver->addItem(i18n("OSS with DMA access"), "dma");
663 664
    m_configSdl.kcfg_audio_driver->addItem(i18n("Esound daemon"), "esd");
    m_configSdl.kcfg_audio_driver->addItem(i18n("ARTS daemon"), "artsc");
665
#endif
666

667
    if (!KdenliveSettings::audiodrivername().isEmpty())
668
        for (int i = 1; i < m_configSdl.kcfg_audio_driver->count(); ++i) {
669 670
            if (m_configSdl.kcfg_audio_driver->itemData(i).toString() == KdenliveSettings::audiodrivername()) {
                m_configSdl.kcfg_audio_driver->setCurrentIndex(i);
Nicolas Carion's avatar
Nicolas Carion committed
671
                KdenliveSettings::setAudio_driver((uint)i);
672 673
            }
        }
674

675
    // Fill the list of audio playback / recording devices
676
    m_configSdl.kcfg_audio_device->addItem(i18n("Default"), QString());
677
    m_configCapture.kcfg_v4l_alsadevice->addItem(i18n("Default"), "default");
678
    if (!QStandardPaths::findExecutable(QStringLiteral("aplay")).isEmpty()) {
679
        m_readProcess.setOutputChannelMode(KProcess::OnlyStdoutChannel);
680
        m_readProcess.setProgram(QStringLiteral("aplay"), QStringList() << QStringLiteral("-l"));
Laurent Montel's avatar
Laurent Montel committed
681
        connect(&m_readProcess, &KProcess::readyReadStandardOutput, this, &KdenliveSettingsDialog::slotReadAudioDevices);
682 683 684
        m_readProcess.execute(5000);
    } else {
        // If aplay is not installed on the system, parse the /proc/asound/pcm file
685
        QFile file(QStringLiteral("/proc/asound/pcm"));
686
        if (file.open(QIODevice::ReadOnly | QIODevice::Text)) {
687
            QTextStream stream(&file);
688
            QString line = stream.readLine();
689
            QString deviceId;
690
            while (!line.isNull()) {
691
                if (line.contains(QStringLiteral("playback"))) {
Laurent Montel's avatar
Laurent Montel committed
692
                    deviceId = line.section(QLatin1Char(':'), 0, 0);
Nicolas Carion's avatar
Nicolas Carion committed
693 694 695
                    m_configSdl.kcfg_audio_device->addItem(line.section(QLatin1Char(':'), 1, 1), QStringLiteral("plughw:%1,%2")
                                                                                                     .arg(deviceId.section(QLatin1Char('-'), 0, 0).toInt())
                                                                                                     .arg(deviceId.section(QLatin1Char('-'), 1, 1).toInt()));
696
                }
697
                if (line.contains(QStringLiteral("capture"))) {
Laurent Montel's avatar
Laurent Montel committed
698
                    deviceId = line.section(QLatin1Char(':'), 0, 0);
Nicolas Carion's avatar
Nicolas Carion committed
699 700 701
                    m_configCapture.kcfg_v4l_alsadevice->addItem(
                        line.section(QLatin1Char(':'), 1, 1).simplified(),
                        QStringLiteral("hw:%1,%2").arg(deviceId.section(QLatin1Char('-'), 0, 0).toInt()).arg(deviceId.section(QLatin1Char('-'), 1, 1).toInt()));
702
                }
703
                line = stream.readLine();
704
            }
705
            file.close();
706 707 708
        } else {
            qCDebug(KDENLIVE_LOG) << " / / / /CANNOT READ PCM";
        }
709
    }
710

711 712
    // Add pulseaudio capture option
    m_configCapture.kcfg_v4l_alsadevice->addItem(i18n("PulseAudio"), "pulse");
713