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_configEnv.capturefolderurl->setEnabled(!KdenliveSettings::capturetoprojectfolder());
77 connect(m_configEnv.kcfg_capturetoprojectfolder, SIGNAL(clicked()), this, SLOT(slotEnableCaptureFolder()));
78 m_page2 = addPage(p2, i18n("Environment"), "application-x-executable-script");
80 QWidget *p4 = new QWidget;
81 m_configCapture.setupUi(p4);
82 m_page4 = addPage(p4, i18n("Capture"), "media-record");
83 m_configCapture.tabWidget->setCurrentIndex(KdenliveSettings::defaultcapture());
85 m_configCapture.tabWidget->setEnabled(false);
86 m_configCapture.kcfg_defaultcapture->setEnabled(false);
87 m_configCapture.label->setText(i18n("Capture is not yet available on OS X."));
90 QWidget *p5 = new QWidget;
91 m_configShuttle.setupUi(p5);
93 connect(m_configShuttle.kcfg_enableshuttle, SIGNAL(stateChanged(int)), this, SLOT(slotCheckShuttle(int)));
94 connect(m_configShuttle.shuttledevicelist, SIGNAL(activated(int)), this, SLOT(slotUpdateShuttleDevice(int)));
95 slotCheckShuttle(KdenliveSettings::enableshuttle());
96 m_configShuttle.shuttledisabled->hide();
98 m_configShuttle.kcfg_enableshuttle->hide();
99 m_configShuttle.kcfg_enableshuttle->setDisabled(true);
100 #endif /* NO_JOGSHUTTLE */
101 m_page5 = addPage(p5, i18n("JogShuttle"), "input-mouse");
103 QWidget *p6 = new QWidget;
104 m_configSdl.setupUi(p6);
106 // Disable drop B frames, see Kdenlive issue #1330
107 m_configSdl.groupBox->setHidden(true);
108 #if not defined(Q_WS_MAC) && not defined(USE_OPEN_GL)
109 m_configSdl.kcfg_openglmonitors->setHidden(true);
112 m_page6 = addPage(p6, i18n("Playback"), "media-playback-start");
114 QWidget *p7 = new QWidget;
115 m_configTranscode.setupUi(p7);
116 m_page7 = addPage(p7, i18n("Transcode"), "edit-copy");
117 connect(m_configTranscode.button_add, SIGNAL(clicked()), this, SLOT(slotAddTranscode()));
118 connect(m_configTranscode.button_delete, SIGNAL(clicked()), this, SLOT(slotDeleteTranscode()));
119 connect(m_configTranscode.profiles_list, SIGNAL(itemChanged(QTreeWidgetItem *, int)), this, SLOT(slotDialogModified()));
122 actions << i18n("Do nothing");
123 actions << i18n("Play / Pause");
124 actions << i18n("Cut");
125 m_configShuttle.kcfg_shuttle1->addItems(actions);
126 m_configShuttle.kcfg_shuttle2->addItems(actions);
127 m_configShuttle.kcfg_shuttle3->addItems(actions);
128 m_configShuttle.kcfg_shuttle4->addItems(actions);
129 m_configShuttle.kcfg_shuttle5->addItems(actions);
131 connect(m_configCapture.kcfg_video4vdevice, SIGNAL(editingFinished()), this, SLOT(rebuildVideo4Commands()));
132 connect(m_configCapture.kcfg_video4adevice, SIGNAL(editingFinished()), this, SLOT(rebuildVideo4Commands()));
133 connect(m_configCapture.kcfg_video4vcodec, SIGNAL(editingFinished()), this, SLOT(rebuildVideo4Commands()));
134 connect(m_configCapture.kcfg_video4acodec, SIGNAL(editingFinished()), this, SLOT(rebuildVideo4Commands()));
135 connect(m_configCapture.kcfg_video4vformat, SIGNAL(editingFinished()), this, SLOT(rebuildVideo4Commands()));
136 connect(m_configCapture.kcfg_video4aformat, SIGNAL(editingFinished()), this, SLOT(rebuildVideo4Commands()));
137 connect(m_configCapture.kcfg_video4size, SIGNAL(editingFinished()), this, SLOT(rebuildVideo4Commands()));
138 connect(m_configCapture.kcfg_video4rate, SIGNAL(editingFinished()), this, SLOT(rebuildVideo4Commands()));
140 connect(m_configCapture.kcfg_rmd_capture_audio, SIGNAL(clicked(bool)), m_configCapture.audio_group, SLOT(setVisible(bool)));
142 m_configCapture.audio_group->setVisible(KdenliveSettings::rmd_capture_audio());
144 connect(m_configEnv.kp_image, SIGNAL(clicked()), this, SLOT(slotEditImageApplication()));
145 connect(m_configEnv.kp_audio, SIGNAL(clicked()), this, SLOT(slotEditAudioApplication()));
146 connect(m_configEnv.kp_player, SIGNAL(clicked()), this, SLOT(slotEditVideoApplication()));
152 connect(m_configSdl.kcfg_audio_driver, SIGNAL(currentIndexChanged(int)), this, SLOT(slotCheckAlsaDriver()));
154 connect(m_configProject.kcfg_profiles_list, SIGNAL(currentIndexChanged(int)), this, SLOT(slotUpdateDisplay()));
155 connect(m_configCapture.kcfg_rmd_capture_type, SIGNAL(currentIndexChanged(int)), this, SLOT(slotUpdateRmdRegionStatus()));
157 slotUpdateRmdRegionStatus();
158 loadTranscodeProfiles();
161 //HACK: check dvgrab version, because only dvgrab >= 3.3 supports
162 // --timestamp option without bug
164 if (KdenliveSettings::dvgrab_path().isEmpty() || !QFile::exists(KdenliveSettings::dvgrab_path())) {
165 QString dvgrabpath = KStandardDirs::findExe("dvgrab");
166 KdenliveSettings::setDvgrab_path(dvgrabpath);
170 double dvgrabVersion = 0;
171 if (!KdenliveSettings::dvgrab_path().isEmpty()) {
172 QProcess *versionCheck = new QProcess;
173 versionCheck->setProcessChannelMode(QProcess::MergedChannels);
174 versionCheck->start("dvgrab", QStringList() << "--version");
175 if (versionCheck->waitForFinished()) {
176 QString version = QString(versionCheck->readAll()).simplified();
177 if (version.contains(' ')) version = version.section(' ', -1);
178 dvgrabVersion = version.toDouble();
180 kDebug() << "// FOUND DVGRAB VERSION: " << dvgrabVersion;
183 if (dvgrabVersion < 3.3) {
184 KdenliveSettings::setFirewiretimestamp(false);
185 m_configCapture.kcfg_firewiretimestamp->setEnabled(false);
187 m_configCapture.dvgrab_info->setText(i18n("dvgrab version %1 at %2", dvgrabVersion, KdenliveSettings::dvgrab_path()));
188 } else m_configCapture.dvgrab_info->setText(i18n("<strong><em>dvgrab</em> utility not found, please install it for firewire capture</strong>"));
190 if (KdenliveSettings::rmd_path().isEmpty() || !QFile::exists(KdenliveSettings::rmd_path())) {
191 QString rmdpath = KStandardDirs::findExe("recordmydesktop");
192 KdenliveSettings::setRmd_path(rmdpath);
194 if (KdenliveSettings::rmd_path().isEmpty())
195 m_configCapture.rmd_info->setText(i18n("<strong><em>Recordmydesktop</em> utility not found, please install it for screen grabs</strong>"));
197 m_configCapture.rmd_info->setText(i18n("Recordmydesktop found at: %1", KdenliveSettings::rmd_path()));
200 KdenliveSettingsDialog::~KdenliveSettingsDialog() {}
202 void KdenliveSettingsDialog::slotUpdateRmdRegionStatus()
204 m_configCapture.region_group->setHidden(m_configCapture.kcfg_rmd_capture_type->currentIndex() != 1);
207 void KdenliveSettingsDialog::slotEnableCaptureFolder()
209 m_configEnv.capturefolderurl->setEnabled(!m_configEnv.kcfg_capturetoprojectfolder->isChecked());
212 void KdenliveSettingsDialog::checkProfile()
214 m_configProject.kcfg_profiles_list->clear();
215 QMap <QString, QString> profilesInfo = ProfilesDialog::getProfilesInfo();
216 QMapIterator<QString, QString> i(profilesInfo);
217 while (i.hasNext()) {
219 m_configProject.kcfg_profiles_list->addItem(i.key(), i.value());
222 if (!KdenliveSettings::default_profile().isEmpty()) {
223 for (int i = 0; i < m_configProject.kcfg_profiles_list->count(); i++) {
224 if (m_configProject.kcfg_profiles_list->itemData(i).toString() == KdenliveSettings::default_profile()) {
225 m_configProject.kcfg_profiles_list->setCurrentIndex(i);
226 KdenliveSettings::setProfiles_list(i);
233 void KdenliveSettingsDialog::initDevices()
235 // Fill audio drivers
236 m_configSdl.kcfg_audio_driver->addItem(i18n("Automatic"), QString());
238 m_configSdl.kcfg_audio_driver->addItem(i18n("OSS"), "dsp");
239 m_configSdl.kcfg_audio_driver->addItem(i18n("ALSA"), "alsa");
240 m_configSdl.kcfg_audio_driver->addItem(i18n("PulseAudio"), "pulse");
241 m_configSdl.kcfg_audio_driver->addItem(i18n("OSS with DMA access"), "dma");
242 m_configSdl.kcfg_audio_driver->addItem(i18n("Esound daemon"), "esd");
243 m_configSdl.kcfg_audio_driver->addItem(i18n("ARTS daemon"), "artsc");
246 if (!KdenliveSettings::audiodrivername().isEmpty())
247 for (int i = 1; i < m_configSdl.kcfg_audio_driver->count(); i++) {
248 if (m_configSdl.kcfg_audio_driver->itemData(i).toString() == KdenliveSettings::audiodrivername()) {
249 m_configSdl.kcfg_audio_driver->setCurrentIndex(i);
250 KdenliveSettings::setAudio_driver((uint) i);
254 // Fill video drivers
255 m_configSdl.kcfg_video_driver->addItem(i18n("Automatic"), QString());
257 m_configSdl.kcfg_video_driver->addItem(i18n("XVideo"), "x11");
258 m_configSdl.kcfg_video_driver->addItem(i18n("X11"), "x11_noaccel");
259 m_configSdl.kcfg_video_driver->addItem(i18n("XFree86 DGA 2.0"), "dga");
260 m_configSdl.kcfg_video_driver->addItem(i18n("Nano X"), "nanox");
261 m_configSdl.kcfg_video_driver->addItem(i18n("Framebuffer console"), "fbcon");
262 m_configSdl.kcfg_video_driver->addItem(i18n("Direct FB"), "directfb");
263 m_configSdl.kcfg_video_driver->addItem(i18n("SVGAlib"), "svgalib");
264 m_configSdl.kcfg_video_driver->addItem(i18n("General graphics interface"), "ggi");
265 m_configSdl.kcfg_video_driver->addItem(i18n("Ascii art library"), "aalib");
268 // Fill the list of audio playback devices
269 m_configSdl.kcfg_audio_device->addItem(i18n("Default"), QString());
270 m_configCapture.kcfg_rmd_alsa_device->addItem(i18n("Default"), QString());
271 if (!KStandardDirs::findExe("aplay").isEmpty()) {
272 m_readProcess.setOutputChannelMode(KProcess::OnlyStdoutChannel);
273 m_readProcess.setProgram("aplay", QStringList() << "-l");
274 connect(&m_readProcess, SIGNAL(readyReadStandardOutput()) , this, SLOT(slotReadAudioDevices()));
275 m_readProcess.execute(5000);
277 // If aplay is not installed on the system, parse the /proc/asound/pcm file
278 QFile file("/proc/asound/pcm");
279 if (file.open(QIODevice::ReadOnly)) {
280 QTextStream stream(&file);
283 while (!stream.atEnd()) {
284 line = stream.readLine();
285 if (line.contains("playback")) {
286 deviceId = line.section(':', 0, 0);
287 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()));
289 if (line.contains("capture")) {
290 deviceId = line.section(':', 0, 0);
291 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()));
297 if (!KdenliveSettings::audiodevicename().isEmpty()) {
298 // Select correct alsa device
299 int ix = m_configSdl.kcfg_audio_device->findData(KdenliveSettings::audiodevicename());
300 m_configSdl.kcfg_audio_device->setCurrentIndex(ix);
301 KdenliveSettings::setAudio_device(ix);
303 if (!KdenliveSettings::rmd_alsadevicename().isEmpty()) {
304 // Select correct alsa device
305 int ix = m_configCapture.kcfg_rmd_alsa_device->findData(KdenliveSettings::rmd_alsadevicename());
306 m_configCapture.kcfg_rmd_alsa_device->setCurrentIndex(ix);
307 KdenliveSettings::setRmd_alsa_device(ix);
312 void KdenliveSettingsDialog::slotReadAudioDevices()
314 QString result = QString(m_readProcess.readAllStandardOutput());
315 kDebug() << "// / / / / / READING APLAY: ";
317 QStringList lines = result.split('\n');
318 foreach(const QString & data, lines) {
319 kDebug() << "// READING LINE: " << data;
320 if (data.simplified().startsWith("card")) {
321 QString card = data.section(':', 0, 0).section(' ', -1);
322 QString device = data.section(':', 1, 1).section(' ', -1);
323 m_configSdl.kcfg_audio_device->addItem(data.section(':', -1), "plughw:" + card + ',' + device);
324 m_configCapture.kcfg_rmd_alsa_device->addItem(data.section(':', -1), "plughw:" + card + ',' + device);
329 void KdenliveSettingsDialog::showPage(int page, int option)
333 setCurrentPage(m_page1);
336 setCurrentPage(m_page2);
339 setCurrentPage(m_page3);
342 setCurrentPage(m_page4);
343 m_configCapture.tabWidget->setCurrentIndex(option);
346 setCurrentPage(m_page5);
349 setCurrentPage(m_page6);
352 setCurrentPage(m_page7);
355 setCurrentPage(m_page1);
359 void KdenliveSettingsDialog::slotEditVideoApplication()
361 KService::Ptr service;
362 KOpenWithDialog dlg(KUrl::List(), i18n("Select default video player"), m_configEnv.kcfg_defaultplayerapp->text(), this);
363 if (dlg.exec() != QDialog::Accepted)
366 service = dlg.service();
367 m_configEnv.kcfg_defaultplayerapp->setText(service->exec());
370 void KdenliveSettingsDialog::slotEditAudioApplication()
372 KService::Ptr service;
373 KOpenWithDialog dlg(KUrl::List(), i18n("Select default audio editor"), m_configEnv.kcfg_defaultaudioapp->text(), this);
374 if (dlg.exec() != QDialog::Accepted)
377 service = dlg.service();
378 m_configEnv.kcfg_defaultaudioapp->setText(service->exec());
381 void KdenliveSettingsDialog::slotEditImageApplication()
383 KService::Ptr service;
384 KOpenWithDialog dlg(KUrl::List(), i18n("Select default image editor"), m_configEnv.kcfg_defaultimageapp->text(), this);
385 if (dlg.exec() != QDialog::Accepted)
388 service = dlg.service();
389 m_configEnv.kcfg_defaultimageapp->setText(service->exec());
392 #ifndef NO_JOGSHUTTLE
393 void KdenliveSettingsDialog::slotCheckShuttle(int state)
395 m_configShuttle.config_group->setEnabled(state);
396 if (m_configShuttle.shuttledevicelist->count() == 0) {
398 QString baseName = "/dev/input/event";
400 for (int i = 0; i < 30; i++) {
401 QString filename = baseName + QString::number(i);
402 kDebug() << "/// CHECKING OFR: " << filename;
404 char name[256] = "unknown";
405 fd = KDE_open((char *) filename.toUtf8().data(), O_RDONLY);
406 if (fd >= 0 && ioctl(fd, EVIOCGNAME(sizeof(name)), name) >= 0) {
407 m_configShuttle.shuttledevicelist->addItem(name, filename);
411 if (KdenliveSettings::shuttledevice().isEmpty()) QTimer::singleShot(1500, this, SLOT(slotUpdateShuttleDevice()));
415 void KdenliveSettingsDialog::slotUpdateShuttleDevice(int ix)
417 QString device = m_configShuttle.shuttledevicelist->itemData(ix).toString();
418 //KdenliveSettings::setShuttledevice(device);
419 m_configShuttle.kcfg_shuttledevice->setText(device);
421 #endif /* NO_JOGSHUTTLE */
423 void KdenliveSettingsDialog::rebuildVideo4Commands()
425 QString captureCommand;
426 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();
428 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();
429 m_configCapture.kcfg_video4capture->setText(captureCommand);
433 void KdenliveSettingsDialog::updateSettings()
435 //kDebug() << "// // // KCONFIG UPDATE called";
437 m_defaultProfile = m_configProject.kcfg_profiles_list->currentText();
438 KdenliveSettings::setDefault_profile(m_defaultPath);
440 bool resetProfile = false;
441 bool updateCapturePath = false;
443 if (m_configEnv.kcfg_capturetoprojectfolder->isChecked() != KdenliveSettings::capturetoprojectfolder()) {
444 KdenliveSettings::setCapturetoprojectfolder(m_configEnv.kcfg_capturetoprojectfolder->isChecked());
445 updateCapturePath = true;
448 if (m_configEnv.capturefolderurl->url().path() != KdenliveSettings::capturefolder()) {
449 KdenliveSettings::setCapturefolder(m_configEnv.capturefolderurl->url().path());
450 updateCapturePath = true;
453 if (m_configCapture.kcfg_dvgrabfilename->text() != KdenliveSettings::dvgrabfilename()) {
454 KdenliveSettings::setDvgrabfilename(m_configCapture.kcfg_dvgrabfilename->text());
455 updateCapturePath = true;
458 if ((uint) m_configCapture.kcfg_firewireformat->currentIndex() != KdenliveSettings::firewireformat()) {
459 KdenliveSettings::setFirewireformat(m_configCapture.kcfg_firewireformat->currentIndex());
460 updateCapturePath = true;
463 if (updateCapturePath) emit updateCaptureFolder();
465 QString value = m_configCapture.kcfg_rmd_alsa_device->itemData(m_configCapture.kcfg_rmd_alsa_device->currentIndex()).toString();
466 if (value != KdenliveSettings::rmd_alsadevicename()) {
467 KdenliveSettings::setRmd_alsadevicename(value);
470 value = m_configCapture.kcfg_rmd_audio_freq->itemText(m_configCapture.kcfg_rmd_audio_freq->currentIndex());
471 kDebug() << "// AUDIO FREQ VALUE: " << value << ", CURRENT: " << KdenliveSettings::rmd_freq() << ", IX: " << m_configCapture.kcfg_rmd_audio_freq->currentIndex();
472 if (value != KdenliveSettings::rmd_freq()) {
473 kDebug() << "// SETTING AUDIO FREQ TO: " << value;
474 KdenliveSettings::setRmd_freq(value);
477 value = m_configSdl.kcfg_audio_driver->itemData(m_configSdl.kcfg_audio_driver->currentIndex()).toString();
478 if (value != KdenliveSettings::audiodrivername()) {
479 KdenliveSettings::setAudiodrivername(value);
483 if (value == "alsa") {
484 // Audio device setting is only valid for alsa driver
485 value = m_configSdl.kcfg_audio_device->itemData(m_configSdl.kcfg_audio_device->currentIndex()).toString();
486 if (value != KdenliveSettings::audiodevicename()) {
487 KdenliveSettings::setAudiodevicename(value);
490 } else if (KdenliveSettings::audiodevicename().isEmpty() == false) {
491 KdenliveSettings::setAudiodevicename(QString::null);
495 value = m_configSdl.kcfg_video_driver->itemData(m_configSdl.kcfg_video_driver->currentIndex()).toString();
496 if (value != KdenliveSettings::videodrivername()) {
497 KdenliveSettings::setVideodrivername(value);
501 if (m_configSdl.kcfg_window_background->color() != KdenliveSettings::window_background()) {
502 KdenliveSettings::setWindow_background(m_configSdl.kcfg_window_background->color());
506 if (m_configSdl.kcfg_volume->value() != KdenliveSettings::volume()) {
507 KdenliveSettings::setVolume(m_configSdl.kcfg_volume->value());
511 bool updatePreview = false;
512 if (m_configSdl.kcfg_dropbframes->isChecked() != KdenliveSettings::dropbframes()) {
513 KdenliveSettings::setDropbframes(m_configSdl.kcfg_dropbframes->isChecked());
514 updatePreview = true;
518 // The transcoding profiles were modified, save.
520 saveTranscodeProfiles();
523 #if KDE_IS_VERSION(4,3,0)
524 KConfigDialog::settingsChangedSlot();
527 //KConfigDialog::updateSettings();
528 if (resetProfile) emit doResetProfile();
529 if (updatePreview) emit updatePreviewSettings();
532 void KdenliveSettingsDialog::slotUpdateDisplay()
534 QString currentProfile = m_configProject.kcfg_profiles_list->itemData(m_configProject.kcfg_profiles_list->currentIndex()).toString();
535 QMap< QString, QString > values = ProfilesDialog::getSettingsFromFile(currentProfile);
536 m_configProject.p_size->setText(values.value("width") + 'x' + values.value("height"));
537 m_configProject.p_fps->setText(values.value("frame_rate_num") + '/' + values.value("frame_rate_den"));
538 m_configProject.p_aspect->setText(values.value("sample_aspect_num") + '/' + values.value("sample_aspect_den"));
539 m_configProject.p_display->setText(values.value("display_aspect_num") + '/' + values.value("display_aspect_den"));
540 if (values.value("progressive").toInt() == 0)
541 m_configProject.p_progressive->setText(i18n("Interlaced"));
543 m_configProject.p_progressive->setText(i18n("Progressive"));
544 m_defaultProfile = m_configProject.kcfg_profiles_list->itemText(m_configProject.kcfg_profiles_list->currentIndex());
545 m_defaultPath = currentProfile;
548 void KdenliveSettingsDialog::slotCheckAlsaDriver()
550 QString value = m_configSdl.kcfg_audio_driver->itemData(m_configSdl.kcfg_audio_driver->currentIndex()).toString();
551 m_configSdl.kcfg_audio_device->setEnabled(value == "alsa");
554 void KdenliveSettingsDialog::loadTranscodeProfiles()
556 KSharedConfigPtr config = KSharedConfig::openConfig("kdenlivetranscodingrc");
557 KConfigGroup transConfig(config, "Transcoding");
559 m_configTranscode.profiles_list->blockSignals(true);
560 QMap< QString, QString > profiles = transConfig.entryMap();
561 QMapIterator<QString, QString> i(profiles);
562 while (i.hasNext()) {
564 QTreeWidgetItem *item = new QTreeWidgetItem(m_configTranscode.profiles_list, QStringList() << i.key() << i.value());
565 item->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled | Qt::ItemIsEditable);
567 m_configTranscode.profiles_list->blockSignals(false);
570 void KdenliveSettingsDialog::saveTranscodeProfiles()
572 KSharedConfigPtr config = KSharedConfig::openConfig("kdenlivetranscodingrc");
573 //KSharedConfigPtr config = KGlobal::config();
574 KConfigGroup transConfig(config, "Transcoding");
576 transConfig.deleteGroup();
577 int max = m_configTranscode.profiles_list->topLevelItemCount();
578 for (int i = 0; i < max; i++) {
579 QTreeWidgetItem *item = m_configTranscode.profiles_list->topLevelItem(i);
580 transConfig.writeEntry(item->text(0), item->text(1));
585 void KdenliveSettingsDialog::slotAddTranscode()
587 QTreeWidgetItem *item = new QTreeWidgetItem(m_configTranscode.profiles_list, QStringList() << i18n("Name") << i18n("Parameters"));
588 item->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled | Qt::ItemIsEditable);
589 m_configTranscode.profiles_list->setCurrentItem(item);
590 m_configTranscode.profiles_list->editItem(item);
591 slotDialogModified();
594 void KdenliveSettingsDialog::slotDeleteTranscode()
596 QTreeWidgetItem *item = m_configTranscode.profiles_list->currentItem();
597 if (item == NULL) return;
599 slotDialogModified();
602 void KdenliveSettingsDialog::slotDialogModified()
605 #if KDE_IS_VERSION(4,3,0)
606 KConfigDialog::updateButtons();
611 bool KdenliveSettingsDialog::hasChanged()
613 if (m_modified) return true;
614 return KConfigDialog::hasChanged();
619 #include "kdenlivesettingsdialog.moc"