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"
22 #include "kdenlivesettings.h"
24 #include <KStandardDirs>
26 #include <kopenwithdialog.h>
27 #include <KConfigDialogManager>
29 #include <KIO/NetAccess>
30 #include <kdeversion.h>
34 #include <QTreeWidgetItem>
41 #include <linux/input.h>
42 #endif /* NO_JOGSHUTTLE */
45 KdenliveSettingsDialog::KdenliveSettingsDialog(QWidget * parent) :
46 KConfigDialog(parent, "settings", KdenliveSettings::self()),
50 QWidget *p1 = new QWidget;
51 m_configMisc.setupUi(p1);
52 m_page1 = addPage(p1, i18n("Misc"), "configure");
54 // Hide multi tab option until Kdenlive really supports it
55 m_configMisc.kcfg_activatetabs->setVisible(false);
57 QWidget *p8 = new QWidget;
58 m_configProject.setupUi(p8);
59 m_page8 = addPage(p8, i18n("Project Defaults"), "document-new");
61 QWidget *p3 = new QWidget;
62 m_configTimeline.setupUi(p3);
63 m_page3 = addPage(p3, i18n("Timeline"), "video-display");
65 QWidget *p2 = new QWidget;
66 m_configEnv.setupUi(p2);
67 m_configEnv.mltpathurl->setMode(KFile::Directory);
68 m_configEnv.mltpathurl->lineEdit()->setObjectName("kcfg_mltpath");
69 m_configEnv.rendererpathurl->lineEdit()->setObjectName("kcfg_rendererpath");
70 m_configEnv.tmppathurl->setMode(KFile::Directory);
71 m_configEnv.tmppathurl->lineEdit()->setObjectName("kcfg_currenttmpfolder");
72 m_configEnv.projecturl->setMode(KFile::Directory);
73 m_configEnv.projecturl->lineEdit()->setObjectName("kcfg_defaultprojectfolder");
74 m_configEnv.capturefolderurl->setMode(KFile::Directory);
75 m_configEnv.capturefolderurl->lineEdit()->setObjectName("kcfg_capturefolder");
76 m_page2 = addPage(p2, i18n("Environment"), "application-x-executable-script");
78 QWidget *p4 = new QWidget;
79 m_configCapture.setupUi(p4);
80 m_page4 = addPage(p4, i18n("Capture"), "media-record");
81 m_configCapture.tabWidget->setCurrentIndex(KdenliveSettings::defaultcapture());
83 m_configCapture.tabWidget->setEnabled(false);
84 m_configCapture.kcfg_defaultcapture->setEnabled(false);
85 m_configCapture.label->setText(i18n("Capture is not yet available on OS X."));
88 QWidget *p5 = new QWidget;
89 m_configShuttle.setupUi(p5);
91 connect(m_configShuttle.kcfg_enableshuttle, SIGNAL(stateChanged(int)), this, SLOT(slotCheckShuttle(int)));
92 connect(m_configShuttle.shuttledevicelist, SIGNAL(activated(int)), this, SLOT(slotUpdateShuttleDevice(int)));
93 slotCheckShuttle(KdenliveSettings::enableshuttle());
94 m_configShuttle.shuttledisabled->hide();
96 m_configShuttle.kcfg_enableshuttle->hide();
97 m_configShuttle.kcfg_enableshuttle->setDisabled(true);
98 #endif /* NO_JOGSHUTTLE */
99 m_page5 = addPage(p5, i18n("JogShuttle"), "input-mouse");
101 QWidget *p6 = new QWidget;
102 m_configSdl.setupUi(p6);
104 // Disable drop B frames, see Kdenlive issue #1330
105 m_configSdl.groupBox->setHidden(true);
107 m_page6 = addPage(p6, i18n("Playback"), "media-playback-start");
109 QWidget *p7 = new QWidget;
110 m_configTranscode.setupUi(p7);
111 m_page7 = addPage(p7, i18n("Transcode"), "edit-copy");
112 connect(m_configTranscode.button_add, SIGNAL(clicked()), this, SLOT(slotAddTranscode()));
113 connect(m_configTranscode.button_delete, SIGNAL(clicked()), this, SLOT(slotDeleteTranscode()));
114 connect(m_configTranscode.profiles_list, SIGNAL(itemChanged(QTreeWidgetItem *, int)), this, SLOT(slotDialogModified()));
117 actions << i18n("Do nothing");
118 actions << i18n("Play / Pause");
119 actions << i18n("Cut");
120 m_configShuttle.kcfg_shuttle1->addItems(actions);
121 m_configShuttle.kcfg_shuttle2->addItems(actions);
122 m_configShuttle.kcfg_shuttle3->addItems(actions);
123 m_configShuttle.kcfg_shuttle4->addItems(actions);
124 m_configShuttle.kcfg_shuttle5->addItems(actions);
126 connect(m_configCapture.kcfg_video4vdevice, SIGNAL(editingFinished()), this, SLOT(rebuildVideo4Commands()));
127 connect(m_configCapture.kcfg_video4adevice, SIGNAL(editingFinished()), this, SLOT(rebuildVideo4Commands()));
128 connect(m_configCapture.kcfg_video4vcodec, SIGNAL(editingFinished()), this, SLOT(rebuildVideo4Commands()));
129 connect(m_configCapture.kcfg_video4acodec, SIGNAL(editingFinished()), this, SLOT(rebuildVideo4Commands()));
130 connect(m_configCapture.kcfg_video4vformat, SIGNAL(editingFinished()), this, SLOT(rebuildVideo4Commands()));
131 connect(m_configCapture.kcfg_video4aformat, SIGNAL(editingFinished()), this, SLOT(rebuildVideo4Commands()));
132 connect(m_configCapture.kcfg_video4size, SIGNAL(editingFinished()), this, SLOT(rebuildVideo4Commands()));
133 connect(m_configCapture.kcfg_video4rate, SIGNAL(editingFinished()), this, SLOT(rebuildVideo4Commands()));
135 connect(m_configCapture.kcfg_rmd_capture_audio, SIGNAL(clicked(bool)), m_configCapture.audio_group, SLOT(setVisible(bool)));
137 m_configCapture.audio_group->setVisible(KdenliveSettings::rmd_capture_audio());
139 connect(m_configEnv.kp_image, SIGNAL(clicked()), this, SLOT(slotEditImageApplication()));
140 connect(m_configEnv.kp_audio, SIGNAL(clicked()), this, SLOT(slotEditAudioApplication()));
141 connect(m_configEnv.kp_player, SIGNAL(clicked()), this, SLOT(slotEditVideoApplication()));
147 connect(m_configSdl.kcfg_audio_driver, SIGNAL(currentIndexChanged(int)), this, SLOT(slotCheckAlsaDriver()));
149 connect(m_configProject.kcfg_profiles_list, SIGNAL(currentIndexChanged(int)), this, SLOT(slotUpdateDisplay()));
150 connect(m_configCapture.kcfg_rmd_capture_type, SIGNAL(currentIndexChanged(int)), this, SLOT(slotUpdateRmdRegionStatus()));
152 slotUpdateRmdRegionStatus();
153 loadTranscodeProfiles();
156 //HACK: check dvgrab version, because only dvgrab >= 3.3 supports
157 // --timestamp option without bug
159 if (KdenliveSettings::dvgrab_path().isEmpty() || !QFile::exists(KdenliveSettings::dvgrab_path())) {
160 QString dvgrabpath = KStandardDirs::findExe("dvgrab");
161 KdenliveSettings::setDvgrab_path(dvgrabpath);
165 double dvgrabVersion = 0;
166 if (!KdenliveSettings::dvgrab_path().isEmpty()) {
167 QProcess *versionCheck = new QProcess;
168 versionCheck->setProcessChannelMode(QProcess::MergedChannels);
169 versionCheck->start("dvgrab", QStringList() << "--version");
170 if (versionCheck->waitForFinished()) {
171 QString version = QString(versionCheck->readAll()).simplified();
172 if (version.contains(' ')) version = version.section(' ', -1);
173 dvgrabVersion = version.toDouble();
175 kDebug() << "// FOUND DVGRAB VERSION: " << dvgrabVersion;
178 if (dvgrabVersion < 3.3) {
179 KdenliveSettings::setFirewiretimestamp(false);
180 m_configCapture.kcfg_firewiretimestamp->setEnabled(false);
182 m_configCapture.dvgrab_info->setText(i18n("dvgrab version %1 at %2", dvgrabVersion, KdenliveSettings::dvgrab_path()));
183 } else m_configCapture.dvgrab_info->setText(i18n("<strong><em>dvgrab</em> utility not found, please install it for firewire capture</strong>"));
185 if (KdenliveSettings::rmd_path().isEmpty() || !QFile::exists(KdenliveSettings::rmd_path())) {
186 QString rmdpath = KStandardDirs::findExe("recordmydesktop");
187 KdenliveSettings::setRmd_path(rmdpath);
189 if (KdenliveSettings::rmd_path().isEmpty())
190 m_configCapture.rmd_info->setText(i18n("<strong><em>Recordmydesktop</em> utility not found, please install it for screen grabs</strong>"));
192 m_configCapture.rmd_info->setText(i18n("Recordmydesktop found at: %1", KdenliveSettings::rmd_path()));
195 KdenliveSettingsDialog::~KdenliveSettingsDialog() {}
197 void KdenliveSettingsDialog::slotUpdateRmdRegionStatus()
199 m_configCapture.region_group->setHidden(m_configCapture.kcfg_rmd_capture_type->currentIndex() != 1);
202 void KdenliveSettingsDialog::checkProfile()
204 m_configProject.kcfg_profiles_list->clear();
205 QMap <QString, QString> profilesInfo = ProfilesDialog::getProfilesInfo();
206 QMapIterator<QString, QString> i(profilesInfo);
207 while (i.hasNext()) {
209 m_configProject.kcfg_profiles_list->addItem(i.key(), i.value());
212 if (!KdenliveSettings::default_profile().isEmpty()) {
213 for (int i = 0; i < m_configProject.kcfg_profiles_list->count(); i++) {
214 if (m_configProject.kcfg_profiles_list->itemData(i).toString() == KdenliveSettings::default_profile()) {
215 m_configProject.kcfg_profiles_list->setCurrentIndex(i);
216 KdenliveSettings::setProfiles_list(i);
223 void KdenliveSettingsDialog::initDevices()
225 // Fill audio drivers
226 m_configSdl.kcfg_audio_driver->addItem(i18n("Automatic"), QString());
228 m_configSdl.kcfg_audio_driver->addItem(i18n("OSS"), "dsp");
229 m_configSdl.kcfg_audio_driver->addItem(i18n("ALSA"), "alsa");
230 m_configSdl.kcfg_audio_driver->addItem(i18n("PulseAudio"), "pulse");
231 m_configSdl.kcfg_audio_driver->addItem(i18n("OSS with DMA access"), "dma");
232 m_configSdl.kcfg_audio_driver->addItem(i18n("Esound daemon"), "esd");
233 m_configSdl.kcfg_audio_driver->addItem(i18n("ARTS daemon"), "artsc");
236 if (!KdenliveSettings::audiodrivername().isEmpty())
237 for (int i = 1; i < m_configSdl.kcfg_audio_driver->count(); i++) {
238 if (m_configSdl.kcfg_audio_driver->itemData(i).toString() == KdenliveSettings::audiodrivername()) {
239 m_configSdl.kcfg_audio_driver->setCurrentIndex(i);
240 KdenliveSettings::setAudio_driver((uint) i);
244 // Fill video drivers
245 m_configSdl.kcfg_video_driver->addItem(i18n("Automatic"), QString());
247 m_configSdl.kcfg_video_driver->addItem(i18n("XVideo"), "x11");
248 m_configSdl.kcfg_video_driver->addItem(i18n("X11"), "x11_noaccel");
249 m_configSdl.kcfg_video_driver->addItem(i18n("XFree86 DGA 2.0"), "dga");
250 m_configSdl.kcfg_video_driver->addItem(i18n("Nano X"), "nanox");
251 m_configSdl.kcfg_video_driver->addItem(i18n("Framebuffer console"), "fbcon");
252 m_configSdl.kcfg_video_driver->addItem(i18n("Direct FB"), "directfb");
253 m_configSdl.kcfg_video_driver->addItem(i18n("SVGAlib"), "svgalib");
254 m_configSdl.kcfg_video_driver->addItem(i18n("General graphics interface"), "ggi");
255 m_configSdl.kcfg_video_driver->addItem(i18n("Ascii art library"), "aalib");
258 // Fill the list of audio playback devices
259 m_configSdl.kcfg_audio_device->addItem(i18n("Default"), QString());
260 m_configCapture.kcfg_rmd_alsa_device->addItem(i18n("Default"), QString());
261 if (!KStandardDirs::findExe("aplay").isEmpty()) {
262 m_readProcess.setOutputChannelMode(KProcess::OnlyStdoutChannel);
263 m_readProcess.setProgram("aplay", QStringList() << "-l");
264 connect(&m_readProcess, SIGNAL(readyReadStandardOutput()) , this, SLOT(slotReadAudioDevices()));
265 m_readProcess.execute(5000);
267 // If aplay is not installed on the system, parse the /proc/asound/pcm file
268 QFile file("/proc/asound/pcm");
269 if (file.open(QIODevice::ReadOnly)) {
270 QTextStream stream(&file);
273 while (!stream.atEnd()) {
274 line = stream.readLine();
275 if (line.contains("playback")) {
276 deviceId = line.section(':', 0, 0);
277 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()));
279 if (line.contains("capture")) {
280 deviceId = line.section(':', 0, 0);
281 m_configCapture.kcfg_rmd_alsa_device->addItem(line.section(':', 1, 1), "plughw:" + QString::number(deviceId.section('-', 0, 0).toInt()) + ',' + QString::number(deviceId.section('-', 1, 1).toInt()));
287 if (!KdenliveSettings::audiodevicename().isEmpty()) {
288 // Select correct alsa device
289 int ix = m_configSdl.kcfg_audio_device->findData(KdenliveSettings::audiodevicename());
290 m_configSdl.kcfg_audio_device->setCurrentIndex(ix);
291 KdenliveSettings::setAudio_device(ix);
293 if (!KdenliveSettings::rmd_alsadevicename().isEmpty()) {
294 // Select correct alsa device
295 int ix = m_configCapture.kcfg_rmd_alsa_device->findData(KdenliveSettings::rmd_alsadevicename());
296 m_configCapture.kcfg_rmd_alsa_device->setCurrentIndex(ix);
297 KdenliveSettings::setRmd_alsa_device(ix);
302 void KdenliveSettingsDialog::slotReadAudioDevices()
304 QString result = QString(m_readProcess.readAllStandardOutput());
305 kDebug() << "// / / / / / READING APLAY: ";
307 QStringList lines = result.split('\n');
308 foreach(const QString &data, lines) {
309 kDebug() << "// READING LINE: " << data;
310 if (data.simplified().startsWith("card")) {
311 QString card = data.section(':', 0, 0).section(' ', -1);
312 QString device = data.section(':', 1, 1).section(' ', -1);
313 m_configSdl.kcfg_audio_device->addItem(data.section(':', -1), "plughw:" + card + ',' + device);
314 m_configCapture.kcfg_rmd_alsa_device->addItem(data.section(':', -1), "plughw:" + card + ',' + device);
319 void KdenliveSettingsDialog::showPage(int page, int option)
323 setCurrentPage(m_page1);
326 setCurrentPage(m_page2);
329 setCurrentPage(m_page3);
332 setCurrentPage(m_page4);
333 m_configCapture.tabWidget->setCurrentIndex(option);
336 setCurrentPage(m_page5);
339 setCurrentPage(m_page6);
342 setCurrentPage(m_page7);
345 setCurrentPage(m_page1);
349 void KdenliveSettingsDialog::slotEditVideoApplication()
351 KService::Ptr service;
352 KOpenWithDialog dlg(KUrl::List(), i18n("Select default video player"), m_configEnv.kcfg_defaultplayerapp->text(), this);
353 if (dlg.exec() != QDialog::Accepted)
356 service = dlg.service();
357 m_configEnv.kcfg_defaultplayerapp->setText(service->exec());
360 void KdenliveSettingsDialog::slotEditAudioApplication()
362 KService::Ptr service;
363 KOpenWithDialog dlg(KUrl::List(), i18n("Select default audio editor"), m_configEnv.kcfg_defaultaudioapp->text(), this);
364 if (dlg.exec() != QDialog::Accepted)
367 service = dlg.service();
368 m_configEnv.kcfg_defaultaudioapp->setText(service->exec());
371 void KdenliveSettingsDialog::slotEditImageApplication()
373 KService::Ptr service;
374 KOpenWithDialog dlg(KUrl::List(), i18n("Select default image editor"), m_configEnv.kcfg_defaultimageapp->text(), this);
375 if (dlg.exec() != QDialog::Accepted)
378 service = dlg.service();
379 m_configEnv.kcfg_defaultimageapp->setText(service->exec());
382 #ifndef NO_JOGSHUTTLE
383 void KdenliveSettingsDialog::slotCheckShuttle(int state)
385 m_configShuttle.config_group->setEnabled(state);
386 if (m_configShuttle.shuttledevicelist->count() == 0) {
388 QString baseName = "/dev/input/event";
390 for (int i = 0; i < 30; i++) {
391 QString filename = baseName + QString::number(i);
392 kDebug() << "/// CHECKING OFR: " << filename;
394 char name[256] = "unknown";
395 fd = KDE_open((char *) filename.toUtf8().data(), O_RDONLY);
396 if (fd >= 0 && ioctl(fd, EVIOCGNAME(sizeof(name)), name) >= 0) {
397 m_configShuttle.shuttledevicelist->addItem(name, filename);
401 if (KdenliveSettings::shuttledevice().isEmpty()) QTimer::singleShot(1500, this, SLOT(slotUpdateShuttleDevice()));
405 void KdenliveSettingsDialog::slotUpdateShuttleDevice(int ix)
407 QString device = m_configShuttle.shuttledevicelist->itemData(ix).toString();
408 //KdenliveSettings::setShuttledevice(device);
409 m_configShuttle.kcfg_shuttledevice->setText(device);
411 #endif /* NO_JOGSHUTTLE */
413 void KdenliveSettingsDialog::rebuildVideo4Commands()
415 QString captureCommand;
416 if (!m_configCapture.kcfg_video4adevice->text().isEmpty()) captureCommand = "-f " + m_configCapture.kcfg_video4aformat->text() + " -i " + m_configCapture.kcfg_video4adevice->text() + " -acodec " + m_configCapture.kcfg_video4acodec->text();
418 captureCommand += " -f " + m_configCapture.kcfg_video4vformat->text() + " -s " + m_configCapture.kcfg_video4size->text() + " -r " + QString::number(m_configCapture.kcfg_video4rate->value()) + " -i " + m_configCapture.kcfg_video4vdevice->text() + " -vcodec " + m_configCapture.kcfg_video4vcodec->text();
419 m_configCapture.kcfg_video4capture->setText(captureCommand);
423 void KdenliveSettingsDialog::updateSettings()
425 //kDebug() << "// // // KCONFIG UPDATE called";
427 m_defaultProfile = m_configProject.kcfg_profiles_list->currentText();
428 KdenliveSettings::setDefault_profile(m_defaultPath);
430 bool resetProfile = false;
431 bool updateCapturePath = false;
433 if (m_configEnv.capturefolderurl->url().path() != KdenliveSettings::capturefolder()) {
434 KdenliveSettings::setCapturefolder(m_configEnv.capturefolderurl->url().path());
435 updateCapturePath = true;
438 if (m_configCapture.kcfg_dvgrabfilename->text() != KdenliveSettings::dvgrabfilename()) {
439 KdenliveSettings::setDvgrabfilename(m_configCapture.kcfg_dvgrabfilename->text());
440 updateCapturePath = true;
443 if ((uint) m_configCapture.kcfg_firewireformat->currentIndex() != KdenliveSettings::firewireformat()) {
444 KdenliveSettings::setFirewireformat(m_configCapture.kcfg_firewireformat->currentIndex());
445 updateCapturePath = true;
448 if (updateCapturePath) emit updateCaptureFolder();
450 QString value = m_configCapture.kcfg_rmd_alsa_device->itemData(m_configCapture.kcfg_rmd_alsa_device->currentIndex()).toString();
451 if (value != KdenliveSettings::rmd_alsadevicename()) {
452 KdenliveSettings::setRmd_alsadevicename(value);
455 value = m_configCapture.kcfg_rmd_audio_freq->itemText(m_configCapture.kcfg_rmd_audio_freq->currentIndex());
456 kDebug() << "// AUDIO FREQ VALUE: " << value << ", CURRENT: " << KdenliveSettings::rmd_freq() << ", IX: " << m_configCapture.kcfg_rmd_audio_freq->currentIndex();
457 if (value != KdenliveSettings::rmd_freq()) {
458 kDebug() << "// SETTING AUDIO FREQ TO: " << value;
459 KdenliveSettings::setRmd_freq(value);
462 value = m_configSdl.kcfg_audio_driver->itemData(m_configSdl.kcfg_audio_driver->currentIndex()).toString();
463 if (value != KdenliveSettings::audiodrivername()) {
464 KdenliveSettings::setAudiodrivername(value);
468 if (value == "alsa") {
469 // Audio device setting is only valid for alsa driver
470 value = m_configSdl.kcfg_audio_device->itemData(m_configSdl.kcfg_audio_device->currentIndex()).toString();
471 if (value != KdenliveSettings::audiodevicename()) {
472 KdenliveSettings::setAudiodevicename(value);
475 } else if (KdenliveSettings::audiodevicename().isEmpty() == false) {
476 KdenliveSettings::setAudiodevicename(QString::null);
480 value = m_configSdl.kcfg_video_driver->itemData(m_configSdl.kcfg_video_driver->currentIndex()).toString();
481 if (value != KdenliveSettings::videodrivername()) {
482 KdenliveSettings::setVideodrivername(value);
486 if (m_configSdl.kcfg_window_background->color() != KdenliveSettings::window_background()) {
487 KdenliveSettings::setWindow_background(m_configSdl.kcfg_window_background->color());
491 if (m_configSdl.kcfg_volume->value() != KdenliveSettings::volume()) {
492 KdenliveSettings::setVolume(m_configSdl.kcfg_volume->value());
496 bool updatePreview = false;
497 if (m_configSdl.kcfg_dropbframes->isChecked() != KdenliveSettings::dropbframes()) {
498 KdenliveSettings::setDropbframes(m_configSdl.kcfg_dropbframes->isChecked());
499 updatePreview = true;
503 // The transcoding profiles were modified, save.
505 saveTranscodeProfiles();
508 #if KDE_IS_VERSION(4,3,0)
509 KConfigDialog::settingsChangedSlot();
512 //KConfigDialog::updateSettings();
513 if (resetProfile) emit doResetProfile();
514 if (updatePreview) emit updatePreviewSettings();
517 void KdenliveSettingsDialog::slotUpdateDisplay()
519 QString currentProfile = m_configProject.kcfg_profiles_list->itemData(m_configProject.kcfg_profiles_list->currentIndex()).toString();
520 QMap< QString, QString > values = ProfilesDialog::getSettingsFromFile(currentProfile);
521 m_configProject.p_size->setText(values.value("width") + 'x' + values.value("height"));
522 m_configProject.p_fps->setText(values.value("frame_rate_num") + '/' + values.value("frame_rate_den"));
523 m_configProject.p_aspect->setText(values.value("sample_aspect_num") + '/' + values.value("sample_aspect_den"));
524 m_configProject.p_display->setText(values.value("display_aspect_num") + '/' + values.value("display_aspect_den"));
525 if (values.value("progressive").toInt() == 0)
526 m_configProject.p_progressive->setText(i18n("Interlaced"));
528 m_configProject.p_progressive->setText(i18n("Progressive"));
529 m_defaultProfile = m_configProject.kcfg_profiles_list->itemText(m_configProject.kcfg_profiles_list->currentIndex());
530 m_defaultPath = currentProfile;
533 void KdenliveSettingsDialog::slotCheckAlsaDriver()
535 QString value = m_configSdl.kcfg_audio_driver->itemData(m_configSdl.kcfg_audio_driver->currentIndex()).toString();
536 m_configSdl.kcfg_audio_device->setEnabled(value == "alsa");
539 void KdenliveSettingsDialog::loadTranscodeProfiles()
541 KSharedConfigPtr config = KSharedConfig::openConfig("kdenlivetranscodingrc");
542 KConfigGroup transConfig(config, "Transcoding");
544 m_configTranscode.profiles_list->blockSignals(true);
545 QMap< QString, QString > profiles = transConfig.entryMap();
546 QMapIterator<QString, QString> i(profiles);
547 while (i.hasNext()) {
549 QTreeWidgetItem *item = new QTreeWidgetItem(m_configTranscode.profiles_list, QStringList() << i.key() << i.value());
550 item->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled | Qt::ItemIsEditable);
552 m_configTranscode.profiles_list->blockSignals(false);
555 void KdenliveSettingsDialog::saveTranscodeProfiles()
557 KSharedConfigPtr config = KSharedConfig::openConfig("kdenlivetranscodingrc");
558 //KSharedConfigPtr config = KGlobal::config();
559 KConfigGroup transConfig(config, "Transcoding");
561 transConfig.deleteGroup();
562 int max = m_configTranscode.profiles_list->topLevelItemCount();
563 for (int i = 0; i < max; i++) {
564 QTreeWidgetItem *item = m_configTranscode.profiles_list->topLevelItem(i);
565 transConfig.writeEntry(item->text(0), item->text(1));
570 void KdenliveSettingsDialog::slotAddTranscode()
572 QTreeWidgetItem *item = new QTreeWidgetItem(m_configTranscode.profiles_list, QStringList() << i18n("Name") << i18n("Parameters"));
573 item->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled | Qt::ItemIsEditable);
574 m_configTranscode.profiles_list->setCurrentItem(item);
575 m_configTranscode.profiles_list->editItem(item);
576 slotDialogModified();
579 void KdenliveSettingsDialog::slotDeleteTranscode()
581 QTreeWidgetItem *item = m_configTranscode.profiles_list->currentItem();
582 if (item == NULL) return;
584 slotDialogModified();
587 void KdenliveSettingsDialog::slotDialogModified()
590 #if KDE_IS_VERSION(4,3,0)
591 KConfigDialog::updateButtons();
596 bool KdenliveSettingsDialog::hasChanged()
598 if (m_modified) return true;
599 return KConfigDialog::hasChanged();
604 #include "kdenlivesettingsdialog.moc"