1 /***************************************************************************
2 * Copyright (C) 2008 by Jean-Baptiste Mardelle (jb@kdenlive.org) *
4 * This program is free software; you can redistribute it and/or modify *
5 * it under the terms of the GNU General Public License as published by *
6 * the Free Software Foundation; either version 2 of the License, or *
7 * (at your option) any later version. *
9 * This program is distributed in the hope that it will be useful, *
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
12 * GNU General Public License for more details. *
14 * You should have received a copy of the GNU General Public License *
15 * along with this program; if not, write to the *
16 * Free Software Foundation, Inc., *
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
18 ***************************************************************************/
20 #include "kdenlivesettingsdialog.h"
21 #include "profilesdialog.h"
23 #include "v4l/v4lcapture.h"
25 #include "encodingprofilesdialog.h"
26 #include "kdenlivesettings.h"
29 #include <KStandardDirs>
31 #include <kopenwithdialog.h>
32 #include <KConfigDialogManager>
34 #include <KIO/NetAccess>
35 #include <kdeversion.h>
36 #include <KMessageBox>
40 #include <QTreeWidgetItem>
49 #include "jogaction.h"
50 #include "jogshuttleconfig.h"
51 #include <linux/input.h>
55 KdenliveSettingsDialog::KdenliveSettingsDialog(const QMap<QString, QString>& mappable_actions, QWidget * parent) :
56 KConfigDialog(parent, "settings", KdenliveSettings::self()),
58 m_shuttleModified(false),
59 m_mappable_actions(mappable_actions)
61 KdenliveSettings::setV4l_format(0);
62 QWidget *p1 = new QWidget;
63 m_configMisc.setupUi(p1);
64 m_page1 = addPage(p1, i18n("Misc"), "configure");
66 // Hide multi tab option until Kdenlive really supports it
67 m_configMisc.kcfg_activatetabs->setVisible(false);
68 // Hide avformat-novalidate trick, causes crash (bug #2205 and #2206)
69 m_configMisc.kcfg_projectloading_avformatnovalidate->setVisible(false);
71 m_configMisc.kcfg_use_exiftool->setEnabled(!KStandardDirs::findExe("exiftool").isEmpty());
73 QWidget *p8 = new QWidget;
74 m_configProject.setupUi(p8);
75 m_page8 = addPage(p8, i18n("Project Defaults"), "document-new");
76 connect(m_configProject.kcfg_generateproxy, SIGNAL(toggled(bool)), m_configProject.kcfg_proxyminsize, SLOT(setEnabled(bool)));
77 m_configProject.kcfg_proxyminsize->setEnabled(KdenliveSettings::generateproxy());
78 connect(m_configProject.kcfg_generateimageproxy, SIGNAL(toggled(bool)), m_configProject.kcfg_proxyimageminsize, SLOT(setEnabled(bool)));
79 m_configProject.kcfg_proxyimageminsize->setEnabled(KdenliveSettings::generateimageproxy());
81 QWidget *p3 = new QWidget;
82 m_configTimeline.setupUi(p3);
83 m_page3 = addPage(p3, i18n("Timeline"), "video-display");
85 QWidget *p2 = new QWidget;
86 m_configEnv.setupUi(p2);
87 m_configEnv.mltpathurl->setMode(KFile::Directory);
88 m_configEnv.mltpathurl->lineEdit()->setObjectName("kcfg_mltpath");
89 m_configEnv.rendererpathurl->lineEdit()->setObjectName("kcfg_rendererpath");
90 m_configEnv.ffmpegurl->lineEdit()->setObjectName("kcfg_ffmpegpath");
91 m_configEnv.ffplayurl->lineEdit()->setObjectName("kcfg_ffplaypath");
92 m_configEnv.kcfg_mltthreads->setMaximum( QThread::idealThreadCount() < 4 ? QThread::idealThreadCount() : 3 );
93 m_configEnv.tmppathurl->setMode(KFile::Directory);
94 m_configEnv.tmppathurl->lineEdit()->setObjectName("kcfg_currenttmpfolder");
95 m_configEnv.projecturl->setMode(KFile::Directory);
96 m_configEnv.projecturl->lineEdit()->setObjectName("kcfg_defaultprojectfolder");
97 m_configEnv.capturefolderurl->setMode(KFile::Directory);
98 m_configEnv.capturefolderurl->lineEdit()->setObjectName("kcfg_capturefolder");
99 m_configEnv.capturefolderurl->setEnabled(!KdenliveSettings::capturetoprojectfolder());
100 connect(m_configEnv.kcfg_capturetoprojectfolder, SIGNAL(clicked()), this, SLOT(slotEnableCaptureFolder()));
101 m_page2 = addPage(p2, i18n("Environment"), "application-x-executable-script");
103 QWidget *p4 = new QWidget;
104 m_configCapture.setupUi(p4);
108 // Video 4 Linux device detection
109 for (int i = 0; i < 10; ++i) {
110 QString path = QLatin1String("/dev/video") + QString::number(i);
111 if (QFile::exists(path)) {
112 QStringList deviceInfo = V4lCaptureHandler::getDeviceName(path);
113 if (!deviceInfo.isEmpty()) {
114 m_configCapture.kcfg_detectedv4ldevices->addItem(deviceInfo.at(0), path);
115 m_configCapture.kcfg_detectedv4ldevices->setItemData(m_configCapture.kcfg_detectedv4ldevices->count() - 1, deviceInfo.at(1), Qt::UserRole + 1);
119 connect(m_configCapture.kcfg_detectedv4ldevices, SIGNAL(currentIndexChanged(int)), this, SLOT(slotUpdatev4lDevice()));
120 connect(m_configCapture.kcfg_v4l_format, SIGNAL(currentIndexChanged(int)), this, SLOT(slotUpdatev4lCaptureProfile()));
121 connect(m_configCapture.config_v4l, SIGNAL(clicked()), this, SLOT(slotEditVideo4LinuxProfile()));
123 slotUpdatev4lDevice();
126 m_page4 = addPage(p4, i18n("Capture"), "media-record");
127 m_configCapture.tabWidget->setCurrentIndex(KdenliveSettings::defaultcapture());
129 m_configCapture.tabWidget->setEnabled(false);
130 m_configCapture.kcfg_defaultcapture->setEnabled(false);
131 m_configCapture.label->setText(i18n("Capture is not yet available on Mac OS X."));
134 QWidget *p5 = new QWidget;
135 m_configShuttle.setupUi(p5);
136 m_configShuttle.toolBtnReload->setIcon(KIcon("view-refresh"));
137 #ifdef USE_JOGSHUTTLE
138 connect(m_configShuttle.kcfg_enableshuttle, SIGNAL(stateChanged(int)), this, SLOT(slotCheckShuttle(int)));
139 connect(m_configShuttle.shuttledevicelist, SIGNAL(activated(int)), this, SLOT(slotUpdateShuttleDevice(int)));
140 connect(m_configShuttle.toolBtnReload, SIGNAL(clicked(bool)), this, SLOT(slotReloadShuttleDevices()));
142 slotCheckShuttle(KdenliveSettings::enableshuttle());
143 m_configShuttle.shuttledisabled->hide();
145 // Store the button pointers into an array for easier handling them in the other functions.
146 // TODO: impl enumerator or live with cut and paste :-)))
147 m_shuttle_buttons.push_back(m_configShuttle.shuttle1);
148 m_shuttle_buttons.push_back(m_configShuttle.shuttle2);
149 m_shuttle_buttons.push_back(m_configShuttle.shuttle3);
150 m_shuttle_buttons.push_back(m_configShuttle.shuttle4);
151 m_shuttle_buttons.push_back(m_configShuttle.shuttle5);
152 m_shuttle_buttons.push_back(m_configShuttle.shuttle6);
153 m_shuttle_buttons.push_back(m_configShuttle.shuttle7);
154 m_shuttle_buttons.push_back(m_configShuttle.shuttle8);
155 m_shuttle_buttons.push_back(m_configShuttle.shuttle9);
156 m_shuttle_buttons.push_back(m_configShuttle.shuttle10);
157 m_shuttle_buttons.push_back(m_configShuttle.shuttle11);
158 m_shuttle_buttons.push_back(m_configShuttle.shuttle12);
159 m_shuttle_buttons.push_back(m_configShuttle.shuttle13);
160 m_shuttle_buttons.push_back(m_configShuttle.shuttle14);
161 m_shuttle_buttons.push_back(m_configShuttle.shuttle15);
163 // populate the buttons with the current configuration. The items are sorted
164 // according to the user-selected language, so they do not appear in random order.
165 QList<QString> action_names = mappable_actions.keys();
168 // Here we need to compute the action_id -> index-in-action_names. We iterate over the
169 // action_names, as the sorting may depend on the user-language.
170 QStringList actions_map = JogShuttleConfig::actionMap(KdenliveSettings::shuttlebuttons());
171 QMap<QString, int> action_pos;
172 foreach (const QString& action_id, actions_map) {
173 // This loop find out at what index is the string that would map to the action_id.
174 for (int i = 0; i < action_names.size(); ++i) {
175 if (mappable_actions[action_names.at(i)] == action_id) {
176 action_pos[action_id] = i;
183 foreach (KComboBox* button, m_shuttle_buttons) {
184 button->addItems(action_names);
185 connect(button, SIGNAL(activated(int)), this, SLOT(slotShuttleModified()));
187 if (i < actions_map.size())
188 button->setCurrentIndex(action_pos[actions_map[i]]);
190 #else /* ! USE_JOGSHUTTLE */
191 m_configShuttle.kcfg_enableshuttle->hide();
192 m_configShuttle.kcfg_enableshuttle->setDisabled(true);
193 #endif /* USE_JOGSHUTTLE */
194 m_page5 = addPage(p5, i18n("JogShuttle"), "input-mouse");
196 QWidget *p6 = new QWidget;
197 m_configSdl.setupUi(p6);
198 m_configSdl.reload_blackmagic->setIcon(KIcon("view-refresh"));
199 connect(m_configSdl.reload_blackmagic, SIGNAL(clicked(bool)), this, SLOT(slotReloadBlackMagic()));
202 m_configSdl.kcfg_openglmonitors->setHidden(true);
205 m_page6 = addPage(p6, i18n("Playback"), "media-playback-start");
207 QWidget *p7 = new QWidget;
208 m_configTranscode.setupUi(p7);
209 m_page7 = addPage(p7, i18n("Transcode"), "edit-copy");
210 connect(m_configTranscode.button_add, SIGNAL(clicked()), this, SLOT(slotAddTranscode()));
211 connect(m_configTranscode.button_delete, SIGNAL(clicked()), this, SLOT(slotDeleteTranscode()));
212 connect(m_configTranscode.profiles_list, SIGNAL(itemChanged(QListWidgetItem*)), this, SLOT(slotDialogModified()));
213 connect(m_configTranscode.profiles_list, SIGNAL(currentRowChanged(int)), this, SLOT(slotSetTranscodeProfile()));
215 connect(m_configTranscode.profile_name, SIGNAL(textChanged(QString)), this, SLOT(slotEnableTranscodeUpdate()));
216 connect(m_configTranscode.profile_description, SIGNAL(textChanged(QString)), this, SLOT(slotEnableTranscodeUpdate()));
217 connect(m_configTranscode.profile_extension, SIGNAL(textChanged(QString)), this, SLOT(slotEnableTranscodeUpdate()));
218 connect(m_configTranscode.profile_parameters, SIGNAL(textChanged()), this, SLOT(slotEnableTranscodeUpdate()));
219 connect(m_configTranscode.profile_audioonly, SIGNAL(stateChanged(int)), this, SLOT(slotEnableTranscodeUpdate()));
221 connect(m_configTranscode.button_update, SIGNAL(pressed()), this, SLOT(slotUpdateTranscodingProfile()));
223 m_configTranscode.profile_parameters->setMaximumHeight(QFontMetrics(font()).lineSpacing() * 5);
225 connect(m_configEnv.kp_image, SIGNAL(clicked()), this, SLOT(slotEditImageApplication()));
226 connect(m_configEnv.kp_audio, SIGNAL(clicked()), this, SLOT(slotEditAudioApplication()));
227 connect(m_configEnv.kp_player, SIGNAL(clicked()), this, SLOT(slotEditVideoApplication()));
229 loadEncodingProfiles();
234 connect(m_configSdl.kcfg_audio_driver, SIGNAL(currentIndexChanged(int)), this, SLOT(slotCheckAlsaDriver()));
236 connect(m_configProject.kcfg_profiles_list, SIGNAL(currentIndexChanged(int)), this, SLOT(slotUpdateDisplay()));
237 connect(m_configCapture.kcfg_grab_capture_type, SIGNAL(currentIndexChanged(int)), this, SLOT(slotUpdateGrabRegionStatus()));
239 slotUpdateGrabRegionStatus();
240 loadTranscodeProfiles();
243 //HACK: check dvgrab version, because only dvgrab >= 3.3 supports
244 // --timestamp option without bug
246 if (KdenliveSettings::dvgrab_path().isEmpty() || !QFile::exists(KdenliveSettings::dvgrab_path())) {
247 QString dvgrabpath = KStandardDirs::findExe("dvgrab");
248 KdenliveSettings::setDvgrab_path(dvgrabpath);
252 m_configCapture.decklink_showprofileinfo->setIcon(KIcon("help-about"));
253 m_configCapture.decklink_manageprofile->setIcon(KIcon("configure"));
254 m_configCapture.decklink_parameters->setVisible(false);
255 m_configCapture.decklink_parameters->setMaximumHeight(QFontMetrics(font()).lineSpacing() * 4);
256 m_configCapture.decklink_parameters->setPlainText(KdenliveSettings::decklink_parameters());
257 connect(m_configCapture.decklink_manageprofile, SIGNAL(clicked(bool)), this, SLOT(slotManageEncodingProfile()));
258 connect(m_configCapture.kcfg_decklink_profile, SIGNAL(currentIndexChanged(int)), this, SLOT(slotUpdateDecklinkProfile()));
259 connect(m_configCapture.decklink_showprofileinfo, SIGNAL(clicked(bool)), m_configCapture.decklink_parameters, SLOT(setVisible(bool)));
262 m_configCapture.v4l_showprofileinfo->setIcon(KIcon("help-about"));
263 m_configCapture.v4l_manageprofile->setIcon(KIcon("configure"));
264 m_configCapture.v4l_parameters->setVisible(false);
265 m_configCapture.v4l_parameters->setMaximumHeight(QFontMetrics(font()).lineSpacing() * 4);
266 m_configCapture.v4l_parameters->setPlainText(KdenliveSettings::v4l_parameters());
267 connect(m_configCapture.v4l_manageprofile, SIGNAL(clicked(bool)), this, SLOT(slotManageEncodingProfile()));
268 connect(m_configCapture.kcfg_v4l_profile, SIGNAL(currentIndexChanged(int)), this, SLOT(slotUpdateV4lProfile()));
269 connect(m_configCapture.v4l_showprofileinfo, SIGNAL(clicked(bool)), m_configCapture.v4l_parameters, SLOT(setVisible(bool)));
271 // screen grab profile
272 m_configCapture.grab_showprofileinfo->setIcon(KIcon("help-about"));
273 m_configCapture.grab_manageprofile->setIcon(KIcon("configure"));
274 m_configCapture.grab_parameters->setVisible(false);
275 m_configCapture.grab_parameters->setMaximumHeight(QFontMetrics(font()).lineSpacing() * 4);
276 m_configCapture.grab_parameters->setPlainText(KdenliveSettings::grab_parameters());
277 connect(m_configCapture.grab_manageprofile, SIGNAL(clicked(bool)), this, SLOT(slotManageEncodingProfile()));
278 connect(m_configCapture.kcfg_grab_profile, SIGNAL(currentIndexChanged(int)), this, SLOT(slotUpdateGrabProfile()));
279 connect(m_configCapture.grab_showprofileinfo, SIGNAL(clicked(bool)), m_configCapture.grab_parameters, SLOT(setVisible(bool)));
281 // proxy profile stuff
282 m_configProject.proxy_showprofileinfo->setIcon(KIcon("help-about"));
283 m_configProject.proxy_manageprofile->setIcon(KIcon("configure"));
284 m_configProject.proxyparams->setVisible(false);
285 m_configProject.proxyparams->setMaximumHeight(QFontMetrics(font()).lineSpacing() * 4);
286 m_configProject.proxyparams->setPlainText(KdenliveSettings::proxyparams());
287 connect(m_configProject.proxy_manageprofile, SIGNAL(clicked(bool)), this, SLOT(slotManageEncodingProfile()));
288 connect(m_configProject.proxy_showprofileinfo, SIGNAL(clicked(bool)), m_configProject.proxyparams, SLOT(setVisible(bool)));
289 connect(m_configProject.kcfg_proxy_profile, SIGNAL(currentIndexChanged(int)), this, SLOT(slotUpdateProxyProfile()));
292 slotUpdateProxyProfile(-1);
293 slotUpdateV4lProfile(-1);
294 slotUpdateGrabProfile(-1);
295 slotUpdateDecklinkProfile(-1);
297 Render::getBlackMagicDeviceList(m_configCapture.kcfg_decklink_capturedevice);
298 if (!Render::getBlackMagicOutputDeviceList(m_configSdl.kcfg_blackmagic_output_device)) {
299 // No blackmagic card found
300 m_configSdl.kcfg_external_display->setEnabled(false);
303 double dvgrabVersion = 0;
304 if (!KdenliveSettings::dvgrab_path().isEmpty()) {
305 QProcess *versionCheck = new QProcess;
306 versionCheck->setProcessChannelMode(QProcess::MergedChannels);
307 versionCheck->start("dvgrab", QStringList() << "--version");
308 if (versionCheck->waitForFinished()) {
309 QString version = QString(versionCheck->readAll()).simplified();
310 if (version.contains(' ')) version = version.section(' ', -1);
311 dvgrabVersion = version.toDouble();
313 kDebug() << "// FOUND DVGRAB VERSION: " << dvgrabVersion;
316 if (dvgrabVersion < 3.3) {
317 KdenliveSettings::setFirewiretimestamp(false);
318 m_configCapture.kcfg_firewiretimestamp->setEnabled(false);
320 m_configCapture.dvgrab_info->setText(i18n("dvgrab version %1 at %2", dvgrabVersion, KdenliveSettings::dvgrab_path()));
321 } else m_configCapture.dvgrab_info->setText(i18n("<strong><em>dvgrab</em> utility not found, please install it for firewire capture</strong>"));
324 KdenliveSettingsDialog::~KdenliveSettingsDialog() {}
326 void KdenliveSettingsDialog::slotUpdateGrabRegionStatus()
328 m_configCapture.region_group->setHidden(m_configCapture.kcfg_grab_capture_type->currentIndex() != 1);
331 void KdenliveSettingsDialog::slotEnableCaptureFolder()
333 m_configEnv.capturefolderurl->setEnabled(!m_configEnv.kcfg_capturetoprojectfolder->isChecked());
336 void KdenliveSettingsDialog::checkProfile()
338 m_configProject.kcfg_profiles_list->clear();
339 QMap <QString, QString> profilesInfo = ProfilesDialog::getProfilesInfo();
340 QMapIterator<QString, QString> i(profilesInfo);
341 while (i.hasNext()) {
343 m_configProject.kcfg_profiles_list->addItem(i.key(), i.value());
346 if (!KdenliveSettings::default_profile().isEmpty()) {
347 for (int i = 0; i < m_configProject.kcfg_profiles_list->count(); ++i) {
348 if (m_configProject.kcfg_profiles_list->itemData(i).toString() == KdenliveSettings::default_profile()) {
349 m_configProject.kcfg_profiles_list->setCurrentIndex(i);
350 KdenliveSettings::setProfiles_list(i);
357 void KdenliveSettingsDialog::initDevices()
359 // Fill audio drivers
360 m_configSdl.kcfg_audio_driver->addItem(i18n("Automatic"), QString());
362 m_configSdl.kcfg_audio_driver->addItem(i18n("OSS"), "dsp");
363 m_configSdl.kcfg_audio_driver->addItem(i18n("ALSA"), "alsa");
364 m_configSdl.kcfg_audio_driver->addItem(i18n("PulseAudio"), "pulse");
365 m_configSdl.kcfg_audio_driver->addItem(i18n("OSS with DMA access"), "dma");
366 m_configSdl.kcfg_audio_driver->addItem(i18n("Esound daemon"), "esd");
367 m_configSdl.kcfg_audio_driver->addItem(i18n("ARTS daemon"), "artsc");
370 if (!KdenliveSettings::audiodrivername().isEmpty())
371 for (int i = 1; i < m_configSdl.kcfg_audio_driver->count(); ++i) {
372 if (m_configSdl.kcfg_audio_driver->itemData(i).toString() == KdenliveSettings::audiodrivername()) {
373 m_configSdl.kcfg_audio_driver->setCurrentIndex(i);
374 KdenliveSettings::setAudio_driver((uint) i);
378 // Fill video drivers
379 m_configSdl.kcfg_video_driver->addItem(i18n("Automatic"), QString());
381 m_configSdl.kcfg_video_driver->addItem(i18n("XVideo"), "x11");
382 m_configSdl.kcfg_video_driver->addItem(i18n("X11"), "x11_noaccel");
383 m_configSdl.kcfg_video_driver->addItem(i18n("XFree86 DGA 2.0"), "dga");
384 m_configSdl.kcfg_video_driver->addItem(i18n("Nano X"), "nanox");
385 m_configSdl.kcfg_video_driver->addItem(i18n("Framebuffer console"), "fbcon");
386 m_configSdl.kcfg_video_driver->addItem(i18n("Direct FB"), "directfb");
387 m_configSdl.kcfg_video_driver->addItem(i18n("SVGAlib"), "svgalib");
388 m_configSdl.kcfg_video_driver->addItem(i18n("General graphics interface"), "ggi");
389 m_configSdl.kcfg_video_driver->addItem(i18n("Ascii art library"), "aalib");
392 // Fill the list of audio playback / recording devices
393 m_configSdl.kcfg_audio_device->addItem(i18n("Default"), QString());
394 m_configCapture.kcfg_v4l_alsadevice->addItem(i18n("Default"), "default");
395 if (!KStandardDirs::findExe("aplay").isEmpty()) {
396 m_readProcess.setOutputChannelMode(KProcess::OnlyStdoutChannel);
397 m_readProcess.setProgram("aplay", QStringList() << "-l");
398 connect(&m_readProcess, SIGNAL(readyReadStandardOutput()) , this, SLOT(slotReadAudioDevices()));
399 m_readProcess.execute(5000);
401 // If aplay is not installed on the system, parse the /proc/asound/pcm file
402 QFile file("/proc/asound/pcm");
403 if (file.open(QIODevice::ReadOnly | QIODevice::Text)) {
404 QTextStream stream(&file);
405 QString line = stream.readLine();
407 while (!line.isNull()) {
408 if (line.contains("playback")) {
409 deviceId = line.section(':', 0, 0);
410 m_configSdl.kcfg_audio_device->addItem(line.section(':', 1, 1), "plughw:" + QString::number(deviceId.section('-', 0, 0).toInt()) + ',' + QString::number(deviceId.section('-', 1, 1).toInt()));
412 if (line.contains("capture")) {
413 deviceId = line.section(':', 0, 0);
414 m_configCapture.kcfg_v4l_alsadevice->addItem(line.section(':', 1, 1).simplified(), "hw:" + QString::number(deviceId.section('-', 0, 0).toInt()) + ',' + QString::number(deviceId.section('-', 1, 1).toInt()));
416 line = stream.readLine();
419 } else kDebug()<<" / / / /CANNOT READ PCM";
422 // Add pulseaudio capture option
423 m_configCapture.kcfg_v4l_alsadevice->addItem(i18n("PulseAudio"), "pulse");
425 if (!KdenliveSettings::audiodevicename().isEmpty()) {
426 // Select correct alsa device
427 int ix = m_configSdl.kcfg_audio_device->findData(KdenliveSettings::audiodevicename());
428 m_configSdl.kcfg_audio_device->setCurrentIndex(ix);
429 KdenliveSettings::setAudio_device(ix);
432 if (!KdenliveSettings::v4l_alsadevicename().isEmpty()) {
433 // Select correct alsa device
434 int ix = m_configCapture.kcfg_v4l_alsadevice->findData(KdenliveSettings::v4l_alsadevicename());
435 m_configCapture.kcfg_v4l_alsadevice->setCurrentIndex(ix);
436 KdenliveSettings::setV4l_alsadevice(ix);
439 loadCurrentV4lProfileInfo();
443 void KdenliveSettingsDialog::slotReadAudioDevices()
445 QString result = QString(m_readProcess.readAllStandardOutput());
446 kDebug() << "// / / / / / READING APLAY: ";
448 QStringList lines = result.split('\n');
449 foreach(const QString & data, lines) {
450 //kDebug() << "// READING LINE: " << data;
451 if (!data.startsWith(' ') && data.count(':') > 1) {
452 QString card = data.section(':', 0, 0).section(' ', -1);
453 QString device = data.section(':', 1, 1).section(' ', -1);
454 m_configSdl.kcfg_audio_device->addItem(data.section(':', -1).simplified(), "plughw:" + card + ',' + device);
455 m_configCapture.kcfg_v4l_alsadevice->addItem(data.section(':', -1).simplified(), "hw:" + card + ',' + device);
460 void KdenliveSettingsDialog::showPage(int page, int option)
464 setCurrentPage(m_page1);
467 setCurrentPage(m_page2);
470 setCurrentPage(m_page3);
473 setCurrentPage(m_page4);
474 m_configCapture.tabWidget->setCurrentIndex(option);
477 setCurrentPage(m_page5);
480 setCurrentPage(m_page6);
483 setCurrentPage(m_page7);
486 setCurrentPage(m_page1);
490 void KdenliveSettingsDialog::slotEditVideoApplication()
492 KService::Ptr service;
493 QPointer<KOpenWithDialog> dlg = new KOpenWithDialog(KUrl::List(), i18n("Select default video player"), m_configEnv.kcfg_defaultplayerapp->text(), this);
494 if (dlg->exec() == QDialog::Accepted) {
495 service = dlg->service();
496 m_configEnv.kcfg_defaultplayerapp->setText(service->exec());
502 void KdenliveSettingsDialog::slotEditAudioApplication()
504 KService::Ptr service;
505 QPointer<KOpenWithDialog> dlg = new KOpenWithDialog(KUrl::List(), i18n("Select default audio editor"), m_configEnv.kcfg_defaultaudioapp->text(), this);
506 if (dlg->exec() == QDialog::Accepted) {
507 service = dlg->service();
508 m_configEnv.kcfg_defaultaudioapp->setText(service->exec());
514 void KdenliveSettingsDialog::slotEditImageApplication()
516 KService::Ptr service;
517 QPointer<KOpenWithDialog> dlg = new KOpenWithDialog(KUrl::List(), i18n("Select default image editor"), m_configEnv.kcfg_defaultimageapp->text(), this);
518 if (dlg->exec() == QDialog::Accepted) {
519 service = dlg->service();
520 m_configEnv.kcfg_defaultimageapp->setText(service->exec());
525 void KdenliveSettingsDialog::slotCheckShuttle(int state)
527 #ifdef USE_JOGSHUTTLE
528 m_configShuttle.config_group->setEnabled(state);
529 m_configShuttle.shuttledevicelist->clear();
531 QStringList devNames = KdenliveSettings::shuttledevicenames();
532 QStringList devPaths = KdenliveSettings::shuttledevicepaths();
534 if (devNames.count() != devPaths.count()) {
537 for (int i = 0; i < devNames.count(); i++) {
538 m_configShuttle.shuttledevicelist->addItem(
539 devNames.at(i), devPaths.at(i));
541 #endif /* USE_JOGSHUTTLE */
544 void KdenliveSettingsDialog::slotUpdateShuttleDevice(int ix)
546 #ifdef USE_JOGSHUTTLE
547 QString device = m_configShuttle.shuttledevicelist->itemData(ix).toString();
548 //KdenliveSettings::setShuttledevice(device);
549 m_configShuttle.kcfg_shuttledevice->setText(device);
550 #endif /* USE_JOGSHUTTLE */
553 void KdenliveSettingsDialog::updateWidgets()
555 // Revert widgets to last saved state (for example when user pressed "Cancel")
556 // kDebug() << "// // // KCONFIG Revert called";
557 #ifdef USE_JOGSHUTTLE
558 // revert jog shuttle device
559 if (m_configShuttle.shuttledevicelist->count() > 0) {
560 for (int i = 0; i < m_configShuttle.shuttledevicelist->count(); ++i) {
561 if (m_configShuttle.shuttledevicelist->itemData(i) == KdenliveSettings::shuttledevice()) {
562 m_configShuttle.shuttledevicelist->setCurrentIndex(i);
568 // Revert jog shuttle buttons
569 QList<QString> action_names = m_mappable_actions.keys();
571 QStringList actions_map = JogShuttleConfig::actionMap(KdenliveSettings::shuttlebuttons());
572 QMap<QString, int> action_pos;
573 foreach (const QString& action_id, actions_map) {
574 // This loop find out at what index is the string that would map to the action_id.
575 for (int i = 0; i < action_names.size(); ++i) {
576 if (m_mappable_actions[action_names[i]] == action_id) {
577 action_pos[action_id] = i;
583 foreach (KComboBox* button, m_shuttle_buttons) {
585 if (i < actions_map.size())
586 button->setCurrentIndex(action_pos[actions_map[i]]);
588 #endif /* USE_JOGSHUTTLE */
591 void KdenliveSettingsDialog::updateSettings()
593 // Save changes to settings (for example when user pressed "Apply" or "Ok")
594 // kDebug() << "// // // KCONFIG UPDATE called";
595 m_defaultProfile = m_configProject.kcfg_profiles_list->currentText();
596 KdenliveSettings::setDefault_profile(m_defaultPath);
598 bool resetProfile = false;
599 bool updateCapturePath = false;
601 /*if (m_configShuttle.shuttledevicelist->count() > 0) {
602 QString device = m_configShuttle.shuttledevicelist->itemData(m_configShuttle.shuttledevicelist->currentIndex()).toString();
603 if (device != KdenliveSettings::shuttledevice()) KdenliveSettings::setShuttledevice(device);
606 if (m_configEnv.kcfg_capturetoprojectfolder->isChecked() != KdenliveSettings::capturetoprojectfolder()) {
607 KdenliveSettings::setCapturetoprojectfolder(m_configEnv.kcfg_capturetoprojectfolder->isChecked());
608 updateCapturePath = true;
611 if (m_configEnv.capturefolderurl->url().path() != KdenliveSettings::capturefolder()) {
612 KdenliveSettings::setCapturefolder(m_configEnv.capturefolderurl->url().path());
613 updateCapturePath = true;
616 if (m_configCapture.kcfg_dvgrabfilename->text() != KdenliveSettings::dvgrabfilename()) {
617 KdenliveSettings::setDvgrabfilename(m_configCapture.kcfg_dvgrabfilename->text());
618 updateCapturePath = true;
621 if ((uint) m_configCapture.kcfg_firewireformat->currentIndex() != KdenliveSettings::firewireformat()) {
622 KdenliveSettings::setFirewireformat(m_configCapture.kcfg_firewireformat->currentIndex());
623 updateCapturePath = true;
626 if ((uint) m_configCapture.kcfg_v4l_format->currentIndex() != KdenliveSettings::v4l_format()) {
627 saveCurrentV4lProfile();
628 KdenliveSettings::setV4l_format(0);
631 // Check encoding profiles
633 QString data = m_configCapture.kcfg_v4l_profile->itemData(m_configCapture.kcfg_v4l_profile->currentIndex()).toString();
634 if (!data.isEmpty() && (data.section(';', 0, 0) != KdenliveSettings::v4l_parameters() || data.section(';', 1, 1) != KdenliveSettings::v4l_extension())) {
635 KdenliveSettings::setV4l_parameters(data.section(';', 0, 0));
636 KdenliveSettings::setV4l_extension(data.section(';', 1, 1));
639 data = m_configCapture.kcfg_grab_profile->itemData(m_configCapture.kcfg_grab_profile->currentIndex()).toString();
640 if (!data.isEmpty() && (data.section(';', 0, 0) != KdenliveSettings::grab_parameters() || data.section(';', 1, 1) != KdenliveSettings::grab_extension())) {
641 KdenliveSettings::setGrab_parameters(data.section(';', 0, 0));
642 KdenliveSettings::setGrab_extension(data.section(';', 1, 1));
646 data = m_configCapture.kcfg_decklink_profile->itemData(m_configCapture.kcfg_decklink_profile->currentIndex()).toString();
647 if (!data.isEmpty() && (data.section(';', 0, 0) != KdenliveSettings::decklink_parameters() || data.section(';', 1, 1) != KdenliveSettings::decklink_extension())) {
648 KdenliveSettings::setDecklink_parameters(data.section(';', 0, 0));
649 KdenliveSettings::setDecklink_extension(data.section(';', 1, 1));
652 data = m_configProject.kcfg_proxy_profile->itemData(m_configProject.kcfg_proxy_profile->currentIndex()).toString();
653 if (!data.isEmpty() && (data.section(';', 0, 0) != KdenliveSettings::proxyparams() || data.section(';', 1, 1) != KdenliveSettings::proxyextension())) {
654 KdenliveSettings::setProxyparams(data.section(';', 0, 0));
655 KdenliveSettings::setProxyextension(data.section(';', 1, 1));
659 if (updateCapturePath) emit updateCaptureFolder();
661 QString value = m_configCapture.kcfg_v4l_alsadevice->itemData(m_configCapture.kcfg_v4l_alsadevice->currentIndex()).toString();
662 if (value != KdenliveSettings::v4l_alsadevicename()) {
663 KdenliveSettings::setV4l_alsadevicename(value);
666 if (m_configSdl.kcfg_external_display->isChecked() != KdenliveSettings::external_display()) {
667 KdenliveSettings::setExternal_display(m_configSdl.kcfg_external_display->isChecked());
671 value = m_configSdl.kcfg_audio_driver->itemData(m_configSdl.kcfg_audio_driver->currentIndex()).toString();
672 if (value != KdenliveSettings::audiodrivername()) {
673 KdenliveSettings::setAudiodrivername(value);
677 if (value == "alsa") {
678 // Audio device setting is only valid for alsa driver
679 value = m_configSdl.kcfg_audio_device->itemData(m_configSdl.kcfg_audio_device->currentIndex()).toString();
680 if (value != KdenliveSettings::audiodevicename()) {
681 KdenliveSettings::setAudiodevicename(value);
684 } else if (KdenliveSettings::audiodevicename().isEmpty() == false) {
685 KdenliveSettings::setAudiodevicename(QString::null);
689 value = m_configSdl.kcfg_video_driver->itemData(m_configSdl.kcfg_video_driver->currentIndex()).toString();
690 if (value != KdenliveSettings::videodrivername()) {
691 KdenliveSettings::setVideodrivername(value);
695 if (m_configSdl.kcfg_window_background->color() != KdenliveSettings::window_background()) {
696 KdenliveSettings::setWindow_background(m_configSdl.kcfg_window_background->color());
700 if (m_configSdl.kcfg_volume->value() != KdenliveSettings::volume()) {
701 KdenliveSettings::setVolume(m_configSdl.kcfg_volume->value());
706 // The transcoding profiles were modified, save.
708 saveTranscodeProfiles();
711 #ifdef USE_JOGSHUTTLE
712 m_shuttleModified = false;
715 actions << "monitor_pause"; // the Job rest position action.
716 foreach (KComboBox* button, m_shuttle_buttons) {
717 actions << m_mappable_actions[button->currentText()];
719 QString maps = JogShuttleConfig::actionMap(actions);
720 //fprintf(stderr, "Shuttle config: %s\n", JogShuttleConfig::actionMap(actions).toAscii().constData());
721 if (KdenliveSettings::shuttlebuttons() != maps)
722 KdenliveSettings::setShuttlebuttons(maps);
725 KConfigDialog::settingsChangedSlot();
726 //KConfigDialog::updateSettings();
727 if (resetProfile) emit doResetProfile();
730 void KdenliveSettingsDialog::slotUpdateDisplay()
732 QString currentProfile = m_configProject.kcfg_profiles_list->itemData(m_configProject.kcfg_profiles_list->currentIndex()).toString();
733 QMap< QString, QString > values = ProfilesDialog::getSettingsFromFile(currentProfile);
734 m_configProject.p_size->setText(values.value("width") + 'x' + values.value("height"));
735 m_configProject.p_fps->setText(values.value("frame_rate_num") + '/' + values.value("frame_rate_den"));
736 m_configProject.p_aspect->setText(values.value("sample_aspect_num") + '/' + values.value("sample_aspect_den"));
737 m_configProject.p_display->setText(values.value("display_aspect_num") + '/' + values.value("display_aspect_den"));
738 if (values.value("progressive").toInt() == 0)
739 m_configProject.p_progressive->setText(i18n("Interlaced"));
741 m_configProject.p_progressive->setText(i18n("Progressive"));
742 m_defaultProfile = m_configProject.kcfg_profiles_list->itemText(m_configProject.kcfg_profiles_list->currentIndex());
743 m_defaultPath = currentProfile;
746 void KdenliveSettingsDialog::slotCheckAlsaDriver()
748 QString value = m_configSdl.kcfg_audio_driver->itemData(m_configSdl.kcfg_audio_driver->currentIndex()).toString();
749 m_configSdl.kcfg_audio_device->setEnabled(value == "alsa");
752 void KdenliveSettingsDialog::loadTranscodeProfiles()
754 KSharedConfigPtr config = KSharedConfig::openConfig("kdenlivetranscodingrc", KConfig::CascadeConfig);
755 KConfigGroup transConfig(config, "Transcoding");
757 m_configTranscode.profiles_list->blockSignals(true);
758 m_configTranscode.profiles_list->clear();
759 QMap< QString, QString > profiles = transConfig.entryMap();
760 QMapIterator<QString, QString> i(profiles);
761 while (i.hasNext()) {
763 QListWidgetItem *item = new QListWidgetItem(i.key());
764 QString data = i.value();
765 if (data.contains(';')) item->setToolTip(data.section(';', 1, 1));
766 item->setData(Qt::UserRole, data);
767 m_configTranscode.profiles_list->addItem(item);
768 //item->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled | Qt::ItemIsEditable);
770 m_configTranscode.profiles_list->blockSignals(false);
771 m_configTranscode.profiles_list->setCurrentRow(0);
774 void KdenliveSettingsDialog::saveTranscodeProfiles()
776 KSharedConfigPtr config = KSharedConfig::openConfig("kdenlivetranscodingrc", KConfig::CascadeConfig);
777 //KSharedConfigPtr config = KGlobal::config();
778 KConfigGroup transConfig(config, "Transcoding");
780 transConfig.deleteGroup();
781 int max = m_configTranscode.profiles_list->count();
782 for (int i = 0; i < max; ++i) {
783 QListWidgetItem *item = m_configTranscode.profiles_list->item(i);
784 transConfig.writeEntry(item->text(), item->data(Qt::UserRole).toString());
789 void KdenliveSettingsDialog::slotAddTranscode()
791 if (!m_configTranscode.profiles_list->findItems(m_configTranscode.profile_name->text(), Qt::MatchExactly).isEmpty()) {
792 KMessageBox::sorry(this, i18n("A profile with that name already exists"));
795 QListWidgetItem *item = new QListWidgetItem(m_configTranscode.profile_name->text());
796 QString data = m_configTranscode.profile_parameters->toPlainText();
797 data.append(" %1." + m_configTranscode.profile_extension->text());
799 if (!m_configTranscode.profile_description->text().isEmpty())
800 data.append(m_configTranscode.profile_description->text());
801 if (m_configTranscode.profile_audioonly->isChecked()) data.append(";audio");
802 item->setData(Qt::UserRole, data);
803 m_configTranscode.profiles_list->addItem(item);
804 m_configTranscode.profiles_list->setCurrentItem(item);
805 slotDialogModified();
808 void KdenliveSettingsDialog::slotUpdateTranscodingProfile()
810 QListWidgetItem *item = m_configTranscode.profiles_list->currentItem();
812 m_configTranscode.button_update->setEnabled(false);
813 item->setText(m_configTranscode.profile_name->text());
814 QString data = m_configTranscode.profile_parameters->toPlainText();
815 data.append(" %1." + m_configTranscode.profile_extension->text());
817 if (!m_configTranscode.profile_description->text().isEmpty())
818 data.append(m_configTranscode.profile_description->text());
819 if (m_configTranscode.profile_audioonly->isChecked()) data.append(";audio");
820 item->setData(Qt::UserRole, data);
821 slotDialogModified();
824 void KdenliveSettingsDialog::slotDeleteTranscode()
826 QListWidgetItem *item = m_configTranscode.profiles_list->currentItem();
827 if (item == NULL) return;
829 slotDialogModified();
832 void KdenliveSettingsDialog::slotEnableTranscodeUpdate()
834 if (!m_configTranscode.profile_box->isEnabled()) return;
836 if (m_configTranscode.profile_name->text().isEmpty() || m_configTranscode.profile_extension->text().isEmpty()) allow = false;
837 m_configTranscode.button_update->setEnabled(allow);
840 void KdenliveSettingsDialog::slotSetTranscodeProfile()
842 m_configTranscode.profile_box->setEnabled(false);
843 m_configTranscode.button_update->setEnabled(false);
844 m_configTranscode.profile_name->clear();
845 m_configTranscode.profile_description->clear();
846 m_configTranscode.profile_extension->clear();
847 m_configTranscode.profile_parameters->clear();
848 m_configTranscode.profile_audioonly->setChecked(false);
849 QListWidgetItem *item = m_configTranscode.profiles_list->currentItem();
853 m_configTranscode.profile_name->setText(item->text());
854 QString data = item->data(Qt::UserRole).toString();
855 if (data.contains(';')) {
856 m_configTranscode.profile_description->setText(data.section(';', 1, 1));
857 if (data.section(';', 2, 2) == "audio") m_configTranscode.profile_audioonly->setChecked(true);
858 data = data.section(';', 0, 0).simplified();
860 m_configTranscode.profile_extension->setText(data.section('.', -1));
861 m_configTranscode.profile_parameters->setPlainText(data.section(' ', 0, -2));
862 m_configTranscode.profile_box->setEnabled(true);
865 void KdenliveSettingsDialog::slotShuttleModified()
867 #ifdef USE_JOGSHUTTLE
869 actions << "monitor_pause"; // the Job rest position action.
870 foreach (KComboBox* button, m_shuttle_buttons) {
871 actions << m_mappable_actions[button->currentText()];
873 QString maps = JogShuttleConfig::actionMap(actions);
874 m_shuttleModified = KdenliveSettings::shuttlebuttons() != maps;
876 KConfigDialog::updateButtons();
879 void KdenliveSettingsDialog::slotDialogModified()
882 KConfigDialog::updateButtons();
886 bool KdenliveSettingsDialog::hasChanged()
888 if (m_modified || m_shuttleModified) return true;
889 return KConfigDialog::hasChanged();
892 void KdenliveSettingsDialog::slotUpdatev4lDevice()
894 QString device = m_configCapture.kcfg_detectedv4ldevices->itemData(m_configCapture.kcfg_detectedv4ldevices->currentIndex()).toString();
895 if (!device.isEmpty()) m_configCapture.kcfg_video4vdevice->setText(device);
896 QString info = m_configCapture.kcfg_detectedv4ldevices->itemData(m_configCapture.kcfg_detectedv4ldevices->currentIndex(), Qt::UserRole + 1).toString();
898 m_configCapture.kcfg_v4l_format->blockSignals(true);
899 m_configCapture.kcfg_v4l_format->clear();
901 QString vl4ProfilePath = KStandardDirs::locateLocal("appdata", "profiles/video4linux");
902 if (QFile::exists(vl4ProfilePath)) {
903 m_configCapture.kcfg_v4l_format->addItem(i18n("Current settings"));
906 QStringList pixelformats = info.split('>', QString::SkipEmptyParts);
909 QStringList itemRates;
910 for (int i = 0; i < pixelformats.count(); ++i) {
911 QString format = pixelformats.at(i).section(':', 0, 0);
912 QStringList sizes = pixelformats.at(i).split(':', QString::SkipEmptyParts);
913 pixelFormat = sizes.takeFirst();
914 for (int j = 0; j < sizes.count(); j++) {
915 itemSize = sizes.at(j).section('=', 0, 0);
916 itemRates = sizes.at(j).section('=', 1, 1).split(',', QString::SkipEmptyParts);
917 for (int k = 0; k < itemRates.count(); k++) {
918 m_configCapture.kcfg_v4l_format->addItem('[' + format + "] " + itemSize + " (" + itemRates.at(k) + ')', QStringList() << format << itemSize.section('x', 0, 0) << itemSize.section('x', 1, 1) << itemRates.at(k).section('/', 0, 0) << itemRates.at(k).section('/', 1, 1));
922 m_configCapture.kcfg_v4l_format->blockSignals(false);
923 slotUpdatev4lCaptureProfile();
926 void KdenliveSettingsDialog::slotUpdatev4lCaptureProfile()
928 QStringList info = m_configCapture.kcfg_v4l_format->itemData(m_configCapture.kcfg_v4l_format->currentIndex(), Qt::UserRole).toStringList();
929 if (info.isEmpty()) {
930 // No auto info, display the current ones
931 loadCurrentV4lProfileInfo();
934 m_configCapture.p_size->setText(info.at(1) + 'x' + info.at(2));
935 m_configCapture.p_fps->setText(info.at(3) + '/' + info.at(4));
936 m_configCapture.p_aspect->setText("1/1");
937 m_configCapture.p_display->setText(info.at(1) + '/' + info.at(2));
938 m_configCapture.p_colorspace->setText(ProfilesDialog::getColorspaceDescription(601));
939 m_configCapture.p_progressive->setText(i18n("Progressive"));
941 QString vl4ProfilePath = KStandardDirs::locateLocal("appdata", "profiles/video4linux");
942 if (!QFile::exists(vl4ProfilePath)) saveCurrentV4lProfile();
945 void KdenliveSettingsDialog::loadCurrentV4lProfileInfo()
947 QString vl4ProfilePath = KStandardDirs::locateLocal("appdata", "profiles/video4linux");
948 MltVideoProfile prof;
949 if (!QFile::exists(vl4ProfilePath)) {
950 // No default formats found, build one
953 prof.frame_rate_num = 15;
954 prof.frame_rate_den = 1;
955 prof.display_aspect_num = 4;
956 prof.display_aspect_den = 3;
957 prof.sample_aspect_num = 1;
958 prof.sample_aspect_den = 1;
959 prof.progressive = 1;
960 prof.colorspace = 601;
961 ProfilesDialog::saveProfile(prof, vl4ProfilePath);
963 else prof = ProfilesDialog::getVideoProfile(vl4ProfilePath);
964 m_configCapture.p_size->setText(QString::number(prof.width) + 'x' + QString::number(prof.height));
965 m_configCapture.p_fps->setText(QString::number(prof.frame_rate_num) + '/' + QString::number(prof.frame_rate_den));
966 m_configCapture.p_aspect->setText(QString::number(prof.sample_aspect_num) + '/' + QString::number(prof.sample_aspect_den));
967 m_configCapture.p_display->setText(QString::number(prof.display_aspect_num) + '/' + QString::number(prof.display_aspect_den));
968 m_configCapture.p_colorspace->setText(ProfilesDialog::getColorspaceDescription(prof.colorspace));
969 if (prof.progressive) m_configCapture.p_progressive->setText(i18n("Progressive"));
972 void KdenliveSettingsDialog::saveCurrentV4lProfile()
974 MltVideoProfile profile;
975 profile.description = "Video4Linux capture";
976 profile.colorspace = ProfilesDialog::getColorspaceFromDescription(m_configCapture.p_colorspace->text());
977 profile.width = m_configCapture.p_size->text().section('x', 0, 0).toInt();
978 profile.height = m_configCapture.p_size->text().section('x', 1, 1).toInt();
979 profile.sample_aspect_num = m_configCapture.p_aspect->text().section('/', 0, 0).toInt();
980 profile.sample_aspect_den = m_configCapture.p_aspect->text().section('/', 1, 1).toInt();
981 profile.display_aspect_num = m_configCapture.p_display->text().section('/', 0, 0).toInt();
982 profile.display_aspect_den = m_configCapture.p_display->text().section('/', 1, 1).toInt();
983 profile.frame_rate_num = m_configCapture.p_fps->text().section('/', 0, 0).toInt();
984 profile.frame_rate_den = m_configCapture.p_fps->text().section('/', 1, 1).toInt();
985 profile.progressive = m_configCapture.p_progressive->text() == i18n("Progressive");
986 QString vl4ProfilePath = KStandardDirs::locateLocal("appdata", "profiles/video4linux");
987 ProfilesDialog::saveProfile(profile, vl4ProfilePath);
990 void KdenliveSettingsDialog::slotManageEncodingProfile()
993 if (currentPage() == m_page4) {
994 type = m_configCapture.tabWidget->currentIndex();
996 QPointer<EncodingProfilesDialog> d = new EncodingProfilesDialog(type);
999 loadEncodingProfiles();
1002 void KdenliveSettingsDialog::loadEncodingProfiles()
1004 KConfig conf("encodingprofiles.rc", KConfig::CascadeConfig, "appdata");
1006 // Load v4l profiles
1007 m_configCapture.kcfg_v4l_profile->blockSignals(true);
1008 QString currentItem = m_configCapture.kcfg_v4l_profile->currentText();
1009 m_configCapture.kcfg_v4l_profile->clear();
1010 KConfigGroup group(&conf, "video4linux");
1011 QMap< QString, QString > values = group.entryMap();
1012 QMapIterator<QString, QString> i(values);
1013 while (i.hasNext()) {
1015 if (!i.key().isEmpty()) m_configCapture.kcfg_v4l_profile->addItem(i.key(), i.value());
1017 m_configCapture.kcfg_v4l_profile->blockSignals(false);
1018 if (!currentItem.isEmpty()) m_configCapture.kcfg_v4l_profile->setCurrentIndex(m_configCapture.kcfg_v4l_profile->findText(currentItem));
1020 // Load Screen Grab profiles
1021 m_configCapture.kcfg_grab_profile->blockSignals(true);
1022 currentItem = m_configCapture.kcfg_grab_profile->currentText();
1023 m_configCapture.kcfg_grab_profile->clear();
1024 KConfigGroup group2(&conf, "screengrab");
1025 values = group2.entryMap();
1026 QMapIterator<QString, QString> j(values);
1027 while (j.hasNext()) {
1029 if (!j.key().isEmpty()) m_configCapture.kcfg_grab_profile->addItem(j.key(), j.value());
1031 m_configCapture.kcfg_grab_profile->blockSignals(false);
1032 if (!currentItem.isEmpty()) m_configCapture.kcfg_grab_profile->setCurrentIndex(m_configCapture.kcfg_grab_profile->findText(currentItem));
1034 // Load Decklink profiles
1035 m_configCapture.kcfg_decklink_profile->blockSignals(true);
1036 currentItem = m_configCapture.kcfg_decklink_profile->currentText();
1037 m_configCapture.kcfg_decklink_profile->clear();
1038 KConfigGroup group3(&conf, "decklink");
1039 values = group3.entryMap();
1040 QMapIterator<QString, QString> k(values);
1041 while (k.hasNext()) {
1043 if (!k.key().isEmpty()) m_configCapture.kcfg_decklink_profile->addItem(k.key(), k.value());
1045 m_configCapture.kcfg_decklink_profile->blockSignals(false);
1046 if (!currentItem.isEmpty()) m_configCapture.kcfg_decklink_profile->setCurrentIndex(m_configCapture.kcfg_decklink_profile->findText(currentItem));
1048 // Load Proxy profiles
1049 m_configProject.kcfg_proxy_profile->blockSignals(true);
1050 currentItem = m_configProject.kcfg_proxy_profile->currentText();
1051 m_configProject.kcfg_proxy_profile->clear();
1052 KConfigGroup group4(&conf, "proxy");
1053 values = group4.entryMap();
1054 QMapIterator<QString, QString> l(values);
1055 while (l.hasNext()) {
1057 if (!l.key().isEmpty()) m_configProject.kcfg_proxy_profile->addItem(l.key(), l.value());
1059 if (!currentItem.isEmpty()) m_configProject.kcfg_proxy_profile->setCurrentIndex(m_configProject.kcfg_proxy_profile->findText(currentItem));
1060 m_configProject.kcfg_proxy_profile->blockSignals(false);
1061 slotUpdateProxyProfile();
1065 void KdenliveSettingsDialog::slotUpdateDecklinkProfile(int ix)
1067 if (ix == -1) ix = KdenliveSettings::decklink_profile();
1068 else ix = m_configCapture.kcfg_decklink_profile->currentIndex();
1069 QString data = m_configCapture.kcfg_decklink_profile->itemData(ix).toString();
1070 if (data.isEmpty()) return;
1071 m_configCapture.decklink_parameters->setPlainText(data.section(';', 0, 0));
1075 void KdenliveSettingsDialog::slotUpdateV4lProfile(int ix)
1077 if (ix == -1) ix = KdenliveSettings::v4l_profile();
1078 else ix = m_configCapture.kcfg_v4l_profile->currentIndex();
1079 QString data = m_configCapture.kcfg_v4l_profile->itemData(ix).toString();
1080 if (data.isEmpty()) return;
1081 m_configCapture.v4l_parameters->setPlainText(data.section(';', 0, 0));
1085 void KdenliveSettingsDialog::slotUpdateGrabProfile(int ix)
1087 if (ix == -1) ix = KdenliveSettings::grab_profile();
1088 else ix = m_configCapture.kcfg_grab_profile->currentIndex();
1089 QString data = m_configCapture.kcfg_grab_profile->itemData(ix).toString();
1090 if (data.isEmpty()) return;
1091 m_configCapture.grab_parameters->setPlainText(data.section(';', 0, 0));
1095 void KdenliveSettingsDialog::slotUpdateProxyProfile(int ix)
1097 if (ix == -1) ix = KdenliveSettings::v4l_profile();
1098 else ix = m_configProject.kcfg_proxy_profile->currentIndex();
1099 QString data = m_configProject.kcfg_proxy_profile->itemData(ix).toString();
1100 if (data.isEmpty()) return;
1101 m_configProject.proxyparams->setPlainText(data.section(';', 0, 0));
1105 void KdenliveSettingsDialog::slotEditVideo4LinuxProfile()
1107 QString vl4ProfilePath = KStandardDirs::locateLocal("appdata", "profiles/video4linux");
1108 QPointer<ProfilesDialog> w = new ProfilesDialog(vl4ProfilePath);
1109 if (w->exec() == QDialog::Accepted) {
1110 // save and update profile
1111 loadCurrentV4lProfileInfo();
1116 void KdenliveSettingsDialog::slotReloadBlackMagic()
1118 Render::getBlackMagicDeviceList(m_configCapture.kcfg_decklink_capturedevice, true);
1119 if (!Render::getBlackMagicOutputDeviceList(m_configSdl.kcfg_blackmagic_output_device), true) {
1120 // No blackmagic card found
1121 m_configSdl.kcfg_external_display->setEnabled(false);
1123 m_configSdl.kcfg_external_display->setEnabled(KdenliveSettings::decklink_device_found());
1126 void KdenliveSettingsDialog::slotReloadShuttleDevices()
1128 #ifdef USE_JOGSHUTTLE
1129 QString devDirStr = "/dev/input/by-id";
1130 QDir devDir(devDirStr);
1131 if (!devDir.exists()) {
1132 devDirStr = "/dev/input";
1135 DeviceMap devMap = JogShuttle::enumerateDevices(devDirStr);
1136 if (!devMap.isEmpty()) {
1137 m_configShuttle.shuttledevicelist->clear();
1140 QStringList devNamesList;
1141 QStringList devPathList;
1142 DeviceMapIter iter = devMap.begin();
1143 if (iter == devMap.end()) {
1144 KdenliveSettings::shuttledevicenames().clear();
1145 KdenliveSettings::shuttledevicepaths().clear();
1146 m_configShuttle.shuttledevicelist->clear();
1148 while (iter != devMap.end()) {
1149 kDebug() << iter.key() << ": " << iter.value();
1150 m_configShuttle.shuttledevicelist->addItem(iter.key(), iter.value());
1151 devNamesList << iter.key();
1152 devPathList << iter.value();
1156 KdenliveSettings::setShuttledevicenames(devNamesList);
1157 KdenliveSettings::setShuttledevicepaths(devPathList);
1158 QTimer::singleShot(200, this, SLOT(slotUpdateShuttleDevice()));
1160 kDebug() << "Devices reloded";
1162 #endif //USE_JOGSHUTTLE
1165 #include "kdenlivesettingsdialog.moc"