X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=src%2Fkdenlivesettingsdialog.cpp;h=5744bcdd44aec11e8a171f9bfa16ea66227ee5cc;hb=9185a624b1d46d1b4c3a5ac5fe57564e22c3cb1c;hp=7cd86aad91142f1d989cffcdfbb15a1d55addb88;hpb=3f928c7073780439f63f1fb5378ae144c84e735b;p=kdenlive diff --git a/src/kdenlivesettingsdialog.cpp b/src/kdenlivesettingsdialog.cpp index 7cd86aad..5744bcdd 100644 --- a/src/kdenlivesettingsdialog.cpp +++ b/src/kdenlivesettingsdialog.cpp @@ -27,6 +27,7 @@ #include #include #include +#include #include #include @@ -42,7 +43,8 @@ KdenliveSettingsDialog::KdenliveSettingsDialog(QWidget * parent) : - KConfigDialog(parent, "settings", KdenliveSettings::self()) + KConfigDialog(parent, "settings", KdenliveSettings::self()), + m_modified(false) { QWidget *p1 = new QWidget; @@ -73,6 +75,11 @@ KdenliveSettingsDialog::KdenliveSettingsDialog(QWidget * parent) : m_configCapture.setupUi(p4); m_page4 = addPage(p4, i18n("Capture"), "media-record"); m_configCapture.tabWidget->setCurrentIndex(KdenliveSettings::defaultcapture()); +#ifdef Q_WS_MAC + m_configCapture.tabWidget->setEnabled(false); + m_configCapture.kcfg_defaultcapture->setEnabled(false); + m_configCapture.label->setText(i18n("Capture is not yet available on OS X.")); +#endif QWidget *p5 = new QWidget; m_configShuttle.setupUi(p5); @@ -96,6 +103,7 @@ KdenliveSettingsDialog::KdenliveSettingsDialog(QWidget * parent) : m_page7 = addPage(p7, i18n("Transcode"), "edit-copy"); connect(m_configTranscode.button_add, SIGNAL(clicked()), this, SLOT(slotAddTranscode())); connect(m_configTranscode.button_delete, SIGNAL(clicked()), this, SLOT(slotDeleteTranscode())); + connect(m_configTranscode.profiles_list, SIGNAL(itemChanged(QTreeWidgetItem *, int)), this, SLOT(slotDialogModified())); QStringList actions; actions << i18n("Do nothing"); @@ -204,15 +212,17 @@ void KdenliveSettingsDialog::initDevices() { // Fill audio drivers m_configSdl.kcfg_audio_driver->addItem(i18n("Automatic"), QString()); +#ifndef Q_WS_MAC m_configSdl.kcfg_audio_driver->addItem(i18n("OSS"), "dsp"); m_configSdl.kcfg_audio_driver->addItem(i18n("ALSA"), "alsa"); m_configSdl.kcfg_audio_driver->addItem(i18n("PulseAudio"), "pulse"); m_configSdl.kcfg_audio_driver->addItem(i18n("OSS with DMA access"), "dma"); m_configSdl.kcfg_audio_driver->addItem(i18n("Esound daemon"), "esd"); m_configSdl.kcfg_audio_driver->addItem(i18n("ARTS daemon"), "artsc"); +#endif if (!KdenliveSettings::audiodrivername().isEmpty()) - for (int i = 1;i < m_configSdl.kcfg_audio_driver->count(); i++) { + for (int i = 1; i < m_configSdl.kcfg_audio_driver->count(); i++) { if (m_configSdl.kcfg_audio_driver->itemData(i).toString() == KdenliveSettings::audiodrivername()) { m_configSdl.kcfg_audio_driver->setCurrentIndex(i); KdenliveSettings::setAudio_driver((uint) i); @@ -221,6 +231,7 @@ void KdenliveSettingsDialog::initDevices() // Fill video drivers m_configSdl.kcfg_video_driver->addItem(i18n("Automatic"), QString()); +#ifndef Q_WS_MAC m_configSdl.kcfg_video_driver->addItem(i18n("XVideo"), "x11"); m_configSdl.kcfg_video_driver->addItem(i18n("X11"), "x11_noaccel"); m_configSdl.kcfg_video_driver->addItem(i18n("XFree86 DGA 2.0"), "dga"); @@ -230,6 +241,7 @@ void KdenliveSettingsDialog::initDevices() m_configSdl.kcfg_video_driver->addItem(i18n("SVGAlib"), "svgalib"); m_configSdl.kcfg_video_driver->addItem(i18n("General graphics interface"), "ggi"); m_configSdl.kcfg_video_driver->addItem(i18n("Ascii art library"), "aalib"); +#endif // Fill the list of audio playback devices m_configSdl.kcfg_audio_device->addItem(i18n("Default"), QString()); @@ -311,7 +323,14 @@ void KdenliveSettingsDialog::showPage(int page, int option) case 5: setCurrentPage(m_page5); break; - + case 6: + setCurrentPage(m_page6); + break; + case 7: + setCurrentPage(m_page7); + break; + default: + setCurrentPage(m_page1); } } @@ -391,18 +410,31 @@ void KdenliveSettingsDialog::rebuildVideo4Commands() void KdenliveSettingsDialog::updateSettings() { - kDebug() << "// // // KCONFIG UPDATE called"; + //kDebug() << "// // // KCONFIG UPDATE called"; + m_defaultProfile = m_configMisc.kcfg_profiles_list->currentText(); KdenliveSettings::setDefault_profile(m_defaultPath); bool resetProfile = false; + bool updateCapturePath = false; if (m_configEnv.capturefolderurl->url().path() != KdenliveSettings::capturefolder()) { - kDebug() << "/// CAPT FOLDER UPDATED"; KdenliveSettings::setCapturefolder(m_configEnv.capturefolderurl->url().path()); - emit updateCaptureFolder(); + updateCapturePath = true; } + if (m_configCapture.kcfg_dvgrabfilename->text() != KdenliveSettings::dvgrabfilename()) { + KdenliveSettings::setDvgrabfilename(m_configCapture.kcfg_dvgrabfilename->text()); + updateCapturePath = true; + } + + if ((uint) m_configCapture.kcfg_firewireformat->currentIndex() != KdenliveSettings::firewireformat()) { + KdenliveSettings::setFirewireformat(m_configCapture.kcfg_firewireformat->currentIndex()); + updateCapturePath = true; + } + + if (updateCapturePath) emit updateCaptureFolder(); + QString value = m_configCapture.kcfg_rmd_alsa_device->itemData(m_configCapture.kcfg_rmd_alsa_device->currentIndex()).toString(); if (value != KdenliveSettings::rmd_alsadevicename()) { KdenliveSettings::setRmd_alsadevicename(value); @@ -445,10 +477,17 @@ void KdenliveSettingsDialog::updateSettings() updatePreview = true; } - // TODO: only save profiles if modified - saveTranscodeProfiles(); + if (m_modified) { + // The transcoding profiles were modified, save. + m_modified = false; + saveTranscodeProfiles(); + } + +#if KDE_IS_VERSION(4,3,0) + KConfigDialog::settingsChangedSlot(); +#endif - KConfigDialog::updateSettings(); + //KConfigDialog::updateSettings(); if (resetProfile) emit doResetProfile(); if (updatePreview) emit updatePreviewSettings(); } @@ -475,26 +514,24 @@ void KdenliveSettingsDialog::slotCheckAlsaDriver() void KdenliveSettingsDialog::loadTranscodeProfiles() { - KSharedConfigPtr config = KGlobal::config(); + KSharedConfigPtr config = KSharedConfig::openConfig("kdenlivetranscodingrc"); KConfigGroup transConfig(config, "Transcoding"); // read the entries - + m_configTranscode.profiles_list->blockSignals(true); QMap< QString, QString > profiles = transConfig.entryMap(); - if (profiles.isEmpty()) { - // TODO: find a better way to store defaule transcode profiles - profiles.insert("DNxHD 1920x1080", "-s 1920x1080 -r pal -b 220000k -threads 2 -vcodec dnxhd -acodec copy %1.mov"); - } QMapIterator i(profiles); while (i.hasNext()) { i.next(); QTreeWidgetItem *item = new QTreeWidgetItem(m_configTranscode.profiles_list, QStringList() << i.key() << i.value()); item->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled | Qt::ItemIsEditable); } + m_configTranscode.profiles_list->blockSignals(false); } void KdenliveSettingsDialog::saveTranscodeProfiles() { - KSharedConfigPtr config = KGlobal::config(); + KSharedConfigPtr config = KSharedConfig::openConfig("kdenlivetranscodingrc"); + //KSharedConfigPtr config = KGlobal::config(); KConfigGroup transConfig(config, "Transcoding"); // read the entries transConfig.deleteGroup(); @@ -510,7 +547,9 @@ void KdenliveSettingsDialog::slotAddTranscode() { QTreeWidgetItem *item = new QTreeWidgetItem(m_configTranscode.profiles_list, QStringList() << i18n("Name") << i18n("Parameters")); item->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled | Qt::ItemIsEditable); + m_configTranscode.profiles_list->setCurrentItem(item); m_configTranscode.profiles_list->editItem(item); + slotDialogModified(); } void KdenliveSettingsDialog::slotDeleteTranscode() @@ -518,8 +557,26 @@ void KdenliveSettingsDialog::slotDeleteTranscode() QTreeWidgetItem *item = m_configTranscode.profiles_list->currentItem(); if (item == NULL) return; delete item; + slotDialogModified(); +} + +void KdenliveSettingsDialog::slotDialogModified() +{ + m_modified = true; +#if KDE_IS_VERSION(4,3,0) + KConfigDialog::updateButtons(); +#endif } +//virtual +bool KdenliveSettingsDialog::hasChanged() +{ + if (m_modified) return true; + return KConfigDialog::hasChanged(); +} + + + #include "kdenlivesettingsdialog.moc"