From: Jean-Baptiste Mardelle Date: Fri, 23 Dec 2011 12:39:22 +0000 (+0100) Subject: Update GUI for editing transcoding profiles X-Git-Url: https://git.sesse.net/?a=commitdiff_plain;h=e74e612a801f662d5e4d2bf62aa886fda53277ee;p=kdenlive Update GUI for editing transcoding profiles --- diff --git a/src/kdenlivesettingsdialog.cpp b/src/kdenlivesettingsdialog.cpp index e2eaca7c..7af5147c 100644 --- a/src/kdenlivesettingsdialog.cpp +++ b/src/kdenlivesettingsdialog.cpp @@ -33,6 +33,7 @@ #include #include #include +#include #include #include @@ -187,7 +188,18 @@ KdenliveSettingsDialog::KdenliveSettingsDialog(const QMap& map 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())); + connect(m_configTranscode.profiles_list, SIGNAL(itemChanged(QListWidgetItem *)), this, SLOT(slotDialogModified())); + connect(m_configTranscode.profiles_list, SIGNAL(currentRowChanged(int)), this, SLOT(slotSetTranscodeProfile())); + + connect(m_configTranscode.profile_name, SIGNAL(textChanged(const QString &)), this, SLOT(slotEnableTranscodeUpdate())); + connect(m_configTranscode.profile_description, SIGNAL(textChanged(const QString &)), this, SLOT(slotEnableTranscodeUpdate())); + connect(m_configTranscode.profile_extension, SIGNAL(textChanged(const QString &)), this, SLOT(slotEnableTranscodeUpdate())); + connect(m_configTranscode.profile_parameters, SIGNAL(textChanged()), this, SLOT(slotEnableTranscodeUpdate())); + connect(m_configTranscode.profile_audioonly, SIGNAL(stateChanged(int)), this, SLOT(slotEnableTranscodeUpdate())); + + connect(m_configTranscode.button_update, SIGNAL(pressed()), this, SLOT(slotUpdateTranscodingProfile())); + + m_configTranscode.profile_parameters->setMaximumHeight(QFontMetrics(font()).lineSpacing() * 5); connect(m_configCapture.kcfg_rmd_capture_audio, SIGNAL(clicked(bool)), m_configCapture.audio_group, SLOT(setVisible(bool))); @@ -748,14 +760,20 @@ void KdenliveSettingsDialog::loadTranscodeProfiles() KConfigGroup transConfig(config, "Transcoding"); // read the entries m_configTranscode.profiles_list->blockSignals(true); + m_configTranscode.profiles_list->clear(); QMap< QString, QString > profiles = transConfig.entryMap(); 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); + QListWidgetItem *item = new QListWidgetItem(i.key()); + QString data = i.value(); + if (data.contains(';')) item->setToolTip(data.section(';', 1, 1)); + item->setData(Qt::UserRole, data); + m_configTranscode.profiles_list->addItem(item); + //item->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled | Qt::ItemIsEditable); } m_configTranscode.profiles_list->blockSignals(false); + m_configTranscode.profiles_list->setCurrentRow(0); } void KdenliveSettingsDialog::saveTranscodeProfiles() @@ -765,31 +783,90 @@ void KdenliveSettingsDialog::saveTranscodeProfiles() KConfigGroup transConfig(config, "Transcoding"); // read the entries transConfig.deleteGroup(); - int max = m_configTranscode.profiles_list->topLevelItemCount(); + int max = m_configTranscode.profiles_list->count(); for (int i = 0; i < max; i++) { - QTreeWidgetItem *item = m_configTranscode.profiles_list->topLevelItem(i); - transConfig.writeEntry(item->text(0), item->text(1)); + QListWidgetItem *item = m_configTranscode.profiles_list->item(i); + transConfig.writeEntry(item->text(), item->data(Qt::UserRole).toString()); } config->sync(); } void KdenliveSettingsDialog::slotAddTranscode() { - QTreeWidgetItem *item = new QTreeWidgetItem(m_configTranscode.profiles_list, QStringList() << i18n("Name") << i18n("Parameters")); - item->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled | Qt::ItemIsEditable); + if (!m_configTranscode.profiles_list->findItems(m_configTranscode.profile_name->text(), Qt::MatchExactly).isEmpty()) { + KMessageBox::sorry(this, i18n("A profile with that name already exists")); + return; + } + 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(";"); + if (!m_configTranscode.profile_description->text().isEmpty()) + data.append(m_configTranscode.profile_description->text()); + if (m_configTranscode.profile_audioonly->isChecked()) data.append(";audio"); + item->setData(Qt::UserRole, data); + m_configTranscode.profiles_list->addItem(item); m_configTranscode.profiles_list->setCurrentItem(item); - m_configTranscode.profiles_list->editItem(item); + slotDialogModified(); +} + +void KdenliveSettingsDialog::slotUpdateTranscodingProfile() +{ + QListWidgetItem *item = m_configTranscode.profiles_list->currentItem(); + if (!item) return; + m_configTranscode.button_update->setEnabled(false); + item->setText(m_configTranscode.profile_name->text()); + QString data = m_configTranscode.profile_parameters->toPlainText(); + data.append(" %1." + m_configTranscode.profile_extension->text()); + 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"); + item->setData(Qt::UserRole, data); slotDialogModified(); } void KdenliveSettingsDialog::slotDeleteTranscode() { - QTreeWidgetItem *item = m_configTranscode.profiles_list->currentItem(); + QListWidgetItem *item = m_configTranscode.profiles_list->currentItem(); if (item == NULL) return; delete item; slotDialogModified(); } +void KdenliveSettingsDialog::slotEnableTranscodeUpdate() +{ + if (!m_configTranscode.profile_box->isEnabled()) return; + bool allow = true; + if (m_configTranscode.profile_name->text().isEmpty() || m_configTranscode.profile_extension->text().isEmpty()) allow = false; + m_configTranscode.button_update->setEnabled(allow); +} + +void KdenliveSettingsDialog::slotSetTranscodeProfile() +{ + m_configTranscode.profile_box->setEnabled(false); + m_configTranscode.button_update->setEnabled(false); + m_configTranscode.profile_name->clear(); + m_configTranscode.profile_description->clear(); + m_configTranscode.profile_extension->clear(); + m_configTranscode.profile_parameters->clear(); + m_configTranscode.profile_audioonly->setChecked(false); + QListWidgetItem *item = m_configTranscode.profiles_list->currentItem(); + if (!item) { + return; + } + m_configTranscode.profile_name->setText(item->text()); + QString data = item->data(Qt::UserRole).toString(); + if (data.contains(';')) { + m_configTranscode.profile_description->setText(data.section(';', 1, 1)); + if (data.section(';', 2, 2) == "audio") m_configTranscode.profile_audioonly->setChecked(true); + data = data.section(';', 0, 0).simplified(); + } + m_configTranscode.profile_extension->setText(data.section('.', -1)); + m_configTranscode.profile_parameters->setPlainText(data.section(' ', 0, -2)); + m_configTranscode.profile_box->setEnabled(true); +} + void KdenliveSettingsDialog::slotShuttleModified() { #ifdef USE_JOGSHUTTLE @@ -1018,6 +1095,7 @@ void KdenliveSettingsDialog::slotEditVideo4LinuxProfile() delete w; } + #include "kdenlivesettingsdialog.moc" diff --git a/src/kdenlivesettingsdialog.h b/src/kdenlivesettingsdialog.h index 8c01c3fb..d1e99ca7 100644 --- a/src/kdenlivesettingsdialog.h +++ b/src/kdenlivesettingsdialog.h @@ -65,6 +65,12 @@ private slots: void slotCheckAlsaDriver(); void slotAddTranscode(); void slotDeleteTranscode(); + /** @brief Update current transcoding profile. */ + void slotUpdateTranscodingProfile(); + /** @brief Enable / disable the update profile button. */ + void slotEnableTranscodeUpdate(); + /** @brief Update display of current transcoding profile parameters. */ + void slotSetTranscodeProfile(); void slotShuttleModified(); void slotDialogModified(); void slotEnableCaptureFolder(); diff --git a/src/kdenlivetranscodingrc b/src/kdenlivetranscodingrc index 06e2cb90..018db4c6 100644 --- a/src/kdenlivetranscodingrc +++ b/src/kdenlivetranscodingrc @@ -13,9 +13,9 @@ DNxHD 720p 50 fps 175 Mb/s=-s 1280x720 -r 50 -vb 175000k -threads 2 -vcodec dnxh DNxHD 720p 50 fps 115 Mb/s=-s 1280x720 -r 50 -vb 175000k -threads 2 -vcodec dnxhd -acodec copy %1.mov;High quality encoding DNxHD 720p 59.94 fps 220 Mb/s=-s 1280x720 -r 60000/1001 -vb 220000k -threads 2 -vcodec dnxhd -acodec copy %1.mov;High quality encoding DNxHD 720p 59.94 fps 145 Mb/s=-s 1280x720 -r 60000/1001 -vb 145000k -threads 2 -vcodec dnxhd -acodec copy %1.mov;High quality encoding -Fix MPEG-1=-sameq -acodec copy -vcodec mpeg1video %1.mpg;Fix unplayable MPEG-1 files;vcodec=mpeg1video -Fix Ogg Theora=-sameq -vcodec libtheora -acodec copy %1.ogv;Fix unplayable OGG Theora files;vcodec=theora -Remux MPEG-2 PS/VOB=-vcodec copy -acodec copy %1.mpg;Fix audio sync in MPEG-2 vob files;vcodec=mpeg2video +Fix MPEG-1=-sameq -acodec copy -vcodec mpeg1video %1.mpg;Fix unplayable MPEG-1 files +Fix Ogg Theora=-sameq -vcodec libtheora -acodec copy %1.ogv;Fix unplayable OGG Theora files +Remux MPEG-2 PS/VOB=-vcodec copy -acodec copy %1.mpg;Fix audio sync in MPEG-2 vob files Lossless Matroska=-sn -vcodec huffyuv -acodec flac %1.mkv;High quality lossless encoding -Wav 48000Hz=-vn -ar 48000 %1.wav;Extract audio as WAV file +Wav 48000Hz=-vn -ar 48000 %1.wav;Extract audio as WAV file;audio Remux with MKV=-vcodec copy -acodec copy -sn %1.mkv diff --git a/src/widgets/configcapture_ui.ui b/src/widgets/configcapture_ui.ui index 4867d3ca..08652d62 100644 --- a/src/widgets/configcapture_ui.ui +++ b/src/widgets/configcapture_ui.ui @@ -7,7 +7,7 @@ 0 0 405 - 595 + 479 @@ -358,12 +358,6 @@ - - - 0 - 0 - - true diff --git a/src/widgets/configtranscode_ui.ui b/src/widgets/configtranscode_ui.ui index 7b900cac..35a06ac8 100644 --- a/src/widgets/configtranscode_ui.ui +++ b/src/widgets/configtranscode_ui.ui @@ -6,55 +6,40 @@ 0 0 - 366 - 183 + 319 + 306 - - 0 - - - 0 - - - + + true - - false - - - true - - - - Name - - - - - FFmpeg parameters - - - + Add Profile - + + + + Update Profile + + + + Delete Profile - + Qt::Horizontal @@ -67,6 +52,68 @@ + + + + + 0 + 0 + + + + + + + + + + Name + + + + + + + + + + Description + + + + + + + + + + Extension + + + + + + + + + + Audio only + + + + + + + Parameters + + + + + + + + +