X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=src%2Fkdenlivesettingsdialog.cpp;h=c213043f30fb031efae5b4e16b588cf57436214e;hb=f8cedebe2666681c596f9e35bd29445e98681158;hp=5f29130f2703e9246586f88905381ed4cdb33e22;hpb=79cb3b67ab057892daa877733ee41f8ae474985d;p=kdenlive diff --git a/src/kdenlivesettingsdialog.cpp b/src/kdenlivesettingsdialog.cpp index 5f29130f..c213043f 100644 --- a/src/kdenlivesettingsdialog.cpp +++ b/src/kdenlivesettingsdialog.cpp @@ -22,11 +22,9 @@ #ifdef USE_V4L #include "v4l/v4lcapture.h" #endif -#ifdef USE_BLACKMAGIC -#include "blackmagic/devices.h" -#endif #include "encodingprofilesdialog.h" #include "kdenlivesettings.h" +#include "renderer.h" #include #include @@ -86,6 +84,8 @@ KdenliveSettingsDialog::KdenliveSettingsDialog(const QMap& map m_configEnv.mltpathurl->setMode(KFile::Directory); m_configEnv.mltpathurl->lineEdit()->setObjectName("kcfg_mltpath"); m_configEnv.rendererpathurl->lineEdit()->setObjectName("kcfg_rendererpath"); + m_configEnv.ffmpegurl->lineEdit()->setObjectName("kcfg_ffmpegpath"); + m_configEnv.ffplayurl->lineEdit()->setObjectName("kcfg_ffplaypath"); m_configEnv.kcfg_mltthreads->setMaximum( QThread::idealThreadCount() < 4 ? QThread::idealThreadCount() : 3 ); m_configEnv.tmppathurl->setMode(KFile::Directory); m_configEnv.tmppathurl->lineEdit()->setObjectName("kcfg_currenttmpfolder"); @@ -106,7 +106,7 @@ KdenliveSettingsDialog::KdenliveSettingsDialog(const QMap& map for (int i = 0; i < 10; i++) { QString path = "/dev/video" + QString::number(i); if (QFile::exists(path)) { - QStringList deviceInfo = V4lCaptureHandler::getDeviceName(path.toUtf8().constData()); + QStringList deviceInfo = V4lCaptureHandler::getDeviceName(path); if (!deviceInfo.isEmpty()) { m_configCapture.kcfg_detectedv4ldevices->addItem(deviceInfo.at(0), path); m_configCapture.kcfg_detectedv4ldevices->setItemData(m_configCapture.kcfg_detectedv4ldevices->count() - 1, deviceInfo.at(1), Qt::UserRole + 1); @@ -137,11 +137,22 @@ KdenliveSettingsDialog::KdenliveSettingsDialog(const QMap& map m_configShuttle.shuttledisabled->hide(); // Store the button pointers into an array for easier handling them in the other functions. + // TODO: impl enumerator or live with cut and paste :-))) m_shuttle_buttons.push_back(m_configShuttle.shuttle1); m_shuttle_buttons.push_back(m_configShuttle.shuttle2); m_shuttle_buttons.push_back(m_configShuttle.shuttle3); m_shuttle_buttons.push_back(m_configShuttle.shuttle4); m_shuttle_buttons.push_back(m_configShuttle.shuttle5); + m_shuttle_buttons.push_back(m_configShuttle.shuttle6); + m_shuttle_buttons.push_back(m_configShuttle.shuttle7); + m_shuttle_buttons.push_back(m_configShuttle.shuttle8); + m_shuttle_buttons.push_back(m_configShuttle.shuttle9); + m_shuttle_buttons.push_back(m_configShuttle.shuttle10); + m_shuttle_buttons.push_back(m_configShuttle.shuttle11); + m_shuttle_buttons.push_back(m_configShuttle.shuttle12); + m_shuttle_buttons.push_back(m_configShuttle.shuttle13); + m_shuttle_buttons.push_back(m_configShuttle.shuttle14); + m_shuttle_buttons.push_back(m_configShuttle.shuttle15); // populate the buttons with the current configuration. The items are sorted // according to the user-selected language, so they do not appear in random order. @@ -178,6 +189,8 @@ KdenliveSettingsDialog::KdenliveSettingsDialog(const QMap& map QWidget *p6 = new QWidget; m_configSdl.setupUi(p6); + m_configSdl.reload_blackmagic->setIcon(KIcon("view-refresh")); + connect(m_configSdl.reload_blackmagic, SIGNAL(clicked(bool)), this, SLOT(slotReloadBlackMagic())); #ifndef USE_OPENGL m_configSdl.kcfg_openglmonitors->setHidden(true); @@ -268,18 +281,11 @@ KdenliveSettingsDialog::KdenliveSettingsDialog(const QMap& map slotUpdateV4lProfile(-1); slotUpdateDecklinkProfile(-1); -#ifdef USE_BLACKMAGIC - BMInterface::getBlackMagicDeviceList(m_configCapture.kcfg_decklink_capturedevice); - if (m_configCapture.kcfg_decklink_capturedevice->count() > 0) { - QStringList modes = m_configCapture.kcfg_decklink_capturedevice->itemData(m_configCapture.kcfg_decklink_capturedevice->currentIndex()).toStringList(); - m_configCapture.kcfg_decklink_capturedevice->setToolTip(i18n("Supported capture modes:\n") + modes.join("\n")); + Render::getBlackMagicDeviceList(m_configCapture.kcfg_decklink_capturedevice); + if (!Render::getBlackMagicOutputDeviceList(m_configSdl.kcfg_blackmagic_output_device)) { + // No blackmagic card found + m_configSdl.kcfg_external_display->setEnabled(false); } - connect(m_configCapture.kcfg_decklink_capturedevice, SIGNAL(currentIndexChanged(int)), this, SLOT(slotUpdateHDMIModes())); - - if (BMInterface::getBlackMagicOutputDeviceList(m_configSdl.kcfg_blackmagic_output_device)) { - // Found blackmagic card - } else m_configSdl.kcfg_external_display->setEnabled(false); -#endif double dvgrabVersion = 0; if (!KdenliveSettings::dvgrab_path().isEmpty()) { @@ -313,12 +319,6 @@ KdenliveSettingsDialog::KdenliveSettingsDialog(const QMap& map KdenliveSettingsDialog::~KdenliveSettingsDialog() {} -void KdenliveSettingsDialog::slotUpdateHDMIModes() -{ - QStringList modes = m_configCapture.kcfg_decklink_capturedevice->itemData(m_configCapture.kcfg_decklink_capturedevice->currentIndex()).toStringList(); - m_configCapture.kcfg_decklink_capturedevice->setToolTip(i18n("Supported capture modes:\n") + modes.join("\n")); -} - void KdenliveSettingsDialog::slotUpdateRmdRegionStatus() { m_configCapture.region_group->setHidden(m_configCapture.kcfg_rmd_capture_type->currentIndex() != 1); @@ -385,9 +385,10 @@ void KdenliveSettingsDialog::initDevices() m_configSdl.kcfg_video_driver->addItem(i18n("Ascii art library"), "aalib"); #endif - // Fill the list of audio playback devices + // Fill the list of audio playback / recording devices m_configSdl.kcfg_audio_device->addItem(i18n("Default"), QString()); m_configCapture.kcfg_rmd_alsa_device->addItem(i18n("Default"), QString()); + m_configCapture.kcfg_v4l_alsadevice->addItem(i18n("Default"), "default"); if (!KStandardDirs::findExe("aplay").isEmpty()) { m_readProcess.setOutputChannelMode(KProcess::OnlyStdoutChannel); m_readProcess.setProgram("aplay", QStringList() << "-l"); @@ -396,12 +397,11 @@ void KdenliveSettingsDialog::initDevices() } else { // If aplay is not installed on the system, parse the /proc/asound/pcm file QFile file("/proc/asound/pcm"); - if (file.open(QIODevice::ReadOnly)) { + if (file.open(QIODevice::ReadOnly | QIODevice::Text)) { QTextStream stream(&file); - QString line; + QString line = stream.readLine(); QString deviceId; - while (!stream.atEnd()) { - line = stream.readLine(); + while (!line.isNull()) { if (line.contains("playback")) { deviceId = line.section(':', 0, 0); 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())); @@ -411,9 +411,10 @@ void KdenliveSettingsDialog::initDevices() m_configCapture.kcfg_rmd_alsa_device->addItem(line.section(':', 1, 1).simplified(), "plughw:" + QString::number(deviceId.section('-', 0, 0).toInt()) + ',' + QString::number(deviceId.section('-', 1, 1).toInt())); 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())); } + line = stream.readLine(); } file.close(); - } + } else kDebug()<<" / / / /CANNOT READ PCM"; } // Add pulseaudio capture option @@ -452,7 +453,7 @@ void KdenliveSettingsDialog::slotReadAudioDevices() QStringList lines = result.split('\n'); foreach(const QString & data, lines) { //kDebug() << "// READING LINE: " << data; - if (!data.startsWith(" ") && data.count(':') > 1) { + if (!data.startsWith(' ') && data.count(':') > 1) { QString card = data.section(':', 0, 0).section(' ', -1); QString device = data.section(':', 1, 1).section(' ', -1); m_configSdl.kcfg_audio_device->addItem(data.section(':', -1).simplified(), "plughw:" + card + ',' + device); @@ -495,47 +496,58 @@ void KdenliveSettingsDialog::showPage(int page, int option) void KdenliveSettingsDialog::slotEditVideoApplication() { KService::Ptr service; - KOpenWithDialog dlg(KUrl::List(), i18n("Select default video player"), m_configEnv.kcfg_defaultplayerapp->text(), this); - if (dlg.exec() != QDialog::Accepted) + QPointer dlg = new KOpenWithDialog(KUrl::List(), i18n("Select default video player"), m_configEnv.kcfg_defaultplayerapp->text(), this); + if (dlg->exec() != QDialog::Accepted) + { + delete dlg; return; + } - service = dlg.service(); + service = dlg->service(); m_configEnv.kcfg_defaultplayerapp->setText(service->exec()); + delete dlg; } void KdenliveSettingsDialog::slotEditAudioApplication() { KService::Ptr service; - KOpenWithDialog dlg(KUrl::List(), i18n("Select default audio editor"), m_configEnv.kcfg_defaultaudioapp->text(), this); - if (dlg.exec() != QDialog::Accepted) + QPointer dlg = new KOpenWithDialog(KUrl::List(), i18n("Select default audio editor"), m_configEnv.kcfg_defaultaudioapp->text(), this); + if (dlg->exec() != QDialog::Accepted) + { + delete dlg; return; + } - service = dlg.service(); + service = dlg->service(); m_configEnv.kcfg_defaultaudioapp->setText(service->exec()); + delete dlg; } void KdenliveSettingsDialog::slotEditImageApplication() { KService::Ptr service; - KOpenWithDialog dlg(KUrl::List(), i18n("Select default image editor"), m_configEnv.kcfg_defaultimageapp->text(), this); - if (dlg.exec() != QDialog::Accepted) + QPointer dlg = new KOpenWithDialog(KUrl::List(), i18n("Select default image editor"), m_configEnv.kcfg_defaultimageapp->text(), this); + if (dlg->exec() != QDialog::Accepted) + { + delete dlg; return; - - service = dlg.service(); + } + service = dlg->service(); m_configEnv.kcfg_defaultimageapp->setText(service->exec()); + delete dlg; } -#ifdef USE_JOGSHUTTLE void KdenliveSettingsDialog::slotCheckShuttle(int state) { - m_configShuttle.config_group->setEnabled(state); +#ifdef USE_JOGSHUTTLE + m_configShuttle.config_group->setEnabled(state); if (m_configShuttle.shuttledevicelist->count() == 0) { // parse devices QString baseName = "/dev/input/event"; int fd; for (int i = 0; i < 30; i++) { QString filename = baseName + QString::number(i); - kDebug() << "/// CHECKING OFR: " << filename; + kDebug() << "/// CHECKING device: " << filename; char name[256] = "unknown"; fd = KDE_open((char *) filename.toUtf8().data(), O_RDONLY); @@ -546,16 +558,17 @@ void KdenliveSettingsDialog::slotCheckShuttle(int state) } if (KdenliveSettings::shuttledevice().isEmpty()) QTimer::singleShot(1500, this, SLOT(slotUpdateShuttleDevice())); } +#endif /* USE_JOGSHUTTLE */ } void KdenliveSettingsDialog::slotUpdateShuttleDevice(int ix) { +#ifdef USE_JOGSHUTTLE QString device = m_configShuttle.shuttledevicelist->itemData(ix).toString(); //KdenliveSettings::setShuttledevice(device); m_configShuttle.kcfg_shuttledevice->setText(device); -} - #endif /* USE_JOGSHUTTLE */ +} void KdenliveSettingsDialog::updateWidgets() { @@ -637,19 +650,19 @@ void KdenliveSettingsDialog::updateSettings() // Check encoding profiles QString data = m_configCapture.kcfg_v4l_profile->itemData(m_configCapture.kcfg_v4l_profile->currentIndex()).toString(); - if (!data.isEmpty() && (data.section(";", 0, 0) != KdenliveSettings::v4l_parameters() || data.section(";", 1, 1) != KdenliveSettings::v4l_extension())) { - KdenliveSettings::setV4l_parameters(data.section(";", 0, 0)); - KdenliveSettings::setV4l_extension(data.section(";", 1, 1)); + if (!data.isEmpty() && (data.section(';', 0, 0) != KdenliveSettings::v4l_parameters() || data.section(';', 1, 1) != KdenliveSettings::v4l_extension())) { + KdenliveSettings::setV4l_parameters(data.section(';', 0, 0)); + KdenliveSettings::setV4l_extension(data.section(';', 1, 1)); } data = m_configCapture.kcfg_decklink_profile->itemData(m_configCapture.kcfg_decklink_profile->currentIndex()).toString(); - if (!data.isEmpty() && (data.section(";", 0, 0) != KdenliveSettings::decklink_parameters() || data.section(";", 1, 1) != KdenliveSettings::decklink_extension())) { - KdenliveSettings::setDecklink_parameters(data.section(";", 0, 0)); - KdenliveSettings::setDecklink_extension(data.section(";", 1, 1)); + if (!data.isEmpty() && (data.section(';', 0, 0) != KdenliveSettings::decklink_parameters() || data.section(';', 1, 1) != KdenliveSettings::decklink_extension())) { + KdenliveSettings::setDecklink_parameters(data.section(';', 0, 0)); + KdenliveSettings::setDecklink_extension(data.section(';', 1, 1)); } data = m_configProject.kcfg_proxy_profile->itemData(m_configProject.kcfg_proxy_profile->currentIndex()).toString(); - if (!data.isEmpty() && (data.section(";", 0, 0) != KdenliveSettings::proxyparams() || data.section(";", 1, 1) != KdenliveSettings::proxyextension())) { - KdenliveSettings::setProxyparams(data.section(";", 0, 0)); - KdenliveSettings::setProxyextension(data.section(";", 1, 1)); + if (!data.isEmpty() && (data.section(';', 0, 0) != KdenliveSettings::proxyparams() || data.section(';', 1, 1) != KdenliveSettings::proxyextension())) { + KdenliveSettings::setProxyparams(data.section(';', 0, 0)); + KdenliveSettings::setProxyextension(data.section(';', 1, 1)); } @@ -760,7 +773,7 @@ void KdenliveSettingsDialog::slotCheckAlsaDriver() void KdenliveSettingsDialog::loadTranscodeProfiles() { - KSharedConfigPtr config = KSharedConfig::openConfig("kdenlivetranscodingrc"); + KSharedConfigPtr config = KSharedConfig::openConfig("kdenlivetranscodingrc", KConfig::CascadeConfig); KConfigGroup transConfig(config, "Transcoding"); // read the entries m_configTranscode.profiles_list->blockSignals(true); @@ -782,7 +795,7 @@ void KdenliveSettingsDialog::loadTranscodeProfiles() void KdenliveSettingsDialog::saveTranscodeProfiles() { - KSharedConfigPtr config = KSharedConfig::openConfig("kdenlivetranscodingrc"); + KSharedConfigPtr config = KSharedConfig::openConfig("kdenlivetranscodingrc", KConfig::CascadeConfig); //KSharedConfigPtr config = KGlobal::config(); KConfigGroup transConfig(config, "Transcoding"); // read the entries @@ -804,7 +817,7 @@ void KdenliveSettingsDialog::slotAddTranscode() QListWidgetItem *item = new QListWidgetItem(m_configTranscode.profile_name->text()); QString data = m_configTranscode.profile_parameters->toPlainText(); data.append(" %1." + m_configTranscode.profile_extension->text()); - data.append(";"); + data.append(';'); if (!m_configTranscode.profile_description->text().isEmpty()) data.append(m_configTranscode.profile_description->text()); if (m_configTranscode.profile_audioonly->isChecked()) data.append(";audio"); @@ -822,7 +835,7 @@ void KdenliveSettingsDialog::slotUpdateTranscodingProfile() item->setText(m_configTranscode.profile_name->text()); QString data = m_configTranscode.profile_parameters->toPlainText(); data.append(" %1." + m_configTranscode.profile_extension->text()); - data.append(";"); + data.append(';'); if (!m_configTranscode.profile_description->text().isEmpty()) data.append(m_configTranscode.profile_description->text()); if (m_configTranscode.profile_audioonly->isChecked()) data.append(";audio"); @@ -912,19 +925,19 @@ void KdenliveSettingsDialog::slotUpdatev4lDevice() m_configCapture.kcfg_v4l_format->addItem(i18n("Current settings")); } - QStringList pixelformats = info.split(">", QString::SkipEmptyParts); + QStringList pixelformats = info.split('>', QString::SkipEmptyParts); QString itemSize; QString pixelFormat; QStringList itemRates; for (int i = 0; i < pixelformats.count(); i++) { QString format = pixelformats.at(i).section(':', 0, 0); - QStringList sizes = pixelformats.at(i).split(":", QString::SkipEmptyParts); + QStringList sizes = pixelformats.at(i).split(':', QString::SkipEmptyParts); pixelFormat = sizes.takeFirst(); for (int j = 0; j < sizes.count(); j++) { - itemSize = sizes.at(j).section("=", 0, 0); - itemRates = sizes.at(j).section("=", 1, 1).split(",", QString::SkipEmptyParts); + itemSize = sizes.at(j).section('=', 0, 0); + itemRates = sizes.at(j).section('=', 1, 1).split(',', QString::SkipEmptyParts); for (int k = 0; k < itemRates.count(); k++) { - 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)); + 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)); } } } @@ -1003,7 +1016,7 @@ void KdenliveSettingsDialog::slotManageEncodingProfile() if (m_configCapture.tabWidget->currentIndex() == 1) type = 1; else if (m_configCapture.tabWidget->currentIndex() == 3) type = 2; } - EncodingProfilesDialog *d = new EncodingProfilesDialog(type); + QPointer d = new EncodingProfilesDialog(type); d->exec(); delete d; loadEncodingProfiles(); @@ -1064,7 +1077,7 @@ void KdenliveSettingsDialog::slotUpdateDecklinkProfile(int ix) else ix = m_configCapture.kcfg_decklink_profile->currentIndex(); QString data = m_configCapture.kcfg_decklink_profile->itemData(ix).toString(); if (data.isEmpty()) return; - m_configCapture.decklink_parameters->setPlainText(data.section(";", 0, 0)); + m_configCapture.decklink_parameters->setPlainText(data.section(';', 0, 0)); // } @@ -1074,7 +1087,7 @@ void KdenliveSettingsDialog::slotUpdateV4lProfile(int ix) else ix = m_configCapture.kcfg_v4l_profile->currentIndex(); QString data = m_configCapture.kcfg_v4l_profile->itemData(ix).toString(); if (data.isEmpty()) return; - m_configCapture.v4l_parameters->setPlainText(data.section(";", 0, 0)); + m_configCapture.v4l_parameters->setPlainText(data.section(';', 0, 0)); // } @@ -1084,14 +1097,14 @@ void KdenliveSettingsDialog::slotUpdateProxyProfile(int ix) else ix = m_configProject.kcfg_proxy_profile->currentIndex(); QString data = m_configProject.kcfg_proxy_profile->itemData(ix).toString(); if (data.isEmpty()) return; - m_configProject.proxyparams->setPlainText(data.section(";", 0, 0)); + m_configProject.proxyparams->setPlainText(data.section(';', 0, 0)); // } void KdenliveSettingsDialog::slotEditVideo4LinuxProfile() { QString vl4ProfilePath = KStandardDirs::locateLocal("appdata", "profiles/video4linux"); - ProfilesDialog *w = new ProfilesDialog(vl4ProfilePath); + QPointer w = new ProfilesDialog(vl4ProfilePath); if (w->exec() == QDialog::Accepted) { // save and update profile loadCurrentV4lProfileInfo(); @@ -1099,7 +1112,15 @@ void KdenliveSettingsDialog::slotEditVideo4LinuxProfile() delete w; } - +void KdenliveSettingsDialog::slotReloadBlackMagic() +{ + Render::getBlackMagicDeviceList(m_configCapture.kcfg_decklink_capturedevice, true); + if (!Render::getBlackMagicOutputDeviceList(m_configSdl.kcfg_blackmagic_output_device), true) { + // No blackmagic card found + m_configSdl.kcfg_external_display->setEnabled(false); + } + m_configSdl.kcfg_external_display->setEnabled(KdenliveSettings::decklink_device_found()); +} #include "kdenlivesettingsdialog.moc"