+
+// Used for multiple clips editing
+ClipProperties::ClipProperties(QList <DocClipBase *>cliplist, Timecode tc, QMap <QString, QString> commonproperties, QWidget * parent) :
+ QDialog(parent),
+ m_clip(NULL),
+ m_tc(tc),
+ m_fps(0),
+ m_count(0),
+ m_clipNeedsRefresh(false),
+ m_clipNeedsReLoad(false)
+{
+ setFont(KGlobalSettings::toolBarFont());
+ m_view.setupUi(this);
+ QString title = windowTitle();
+ title.append(" " + i18np("(%1 clip)", "(%1 clips)", cliplist.count()));
+ setWindowTitle(title);
+ QMap <QString, QString> props = cliplist.at(0)->properties();
+ m_old_props = commonproperties;
+
+ if (commonproperties.contains("force_aspect_num") && !commonproperties.value("force_aspect_num").isEmpty() && commonproperties.value("force_aspect_den").toInt() > 0) {
+ m_view.clip_force_ar->setChecked(true);
+ m_view.clip_ar_num->setEnabled(true);
+ m_view.clip_ar_den->setEnabled(true);
+ m_view.clip_ar_num->setValue(commonproperties.value("force_aspect_num").toInt());
+ m_view.clip_ar_den->setValue(commonproperties.value("force_aspect_den").toInt());
+ }
+
+ if (commonproperties.contains("force_fps") && !commonproperties.value("force_fps").isEmpty() && commonproperties.value("force_fps").toDouble() > 0) {
+ m_view.clip_force_framerate->setChecked(true);
+ m_view.clip_framerate->setEnabled(true);
+ m_view.clip_framerate->setValue(commonproperties.value("force_fps").toDouble());
+ }
+
+ if (commonproperties.contains("force_progressive") && !commonproperties.value("force_progressive").isEmpty()) {
+ m_view.clip_force_progressive->setChecked(true);
+ m_view.clip_progressive->setEnabled(true);
+ m_view.clip_progressive->setValue(commonproperties.value("force_progressive").toInt());
+ }
+
+ if (commonproperties.contains("force_tff") && !commonproperties.value("force_tff").isEmpty()) {
+ m_view.clip_force_fieldorder->setChecked(true);
+ m_view.clip_fieldorder->setEnabled(true);
+ m_view.clip_fieldorder->setCurrentIndex(commonproperties.value("force_tff").toInt());
+ }
+
+ if (commonproperties.contains("threads") && !commonproperties.value("threads").isEmpty() && commonproperties.value("threads").toInt() != 1) {
+ m_view.clip_force_threads->setChecked(true);
+ m_view.clip_threads->setEnabled(true);
+ m_view.clip_threads->setValue(commonproperties.value("threads").toInt());
+ }
+
+ if (commonproperties.contains("video_index") && !commonproperties.value("video_index").isEmpty() && commonproperties.value("video_index").toInt() != 0) {
+ m_view.clip_force_vindex->setChecked(true);
+ m_view.clip_vindex->setEnabled(true);
+ m_view.clip_vindex->setValue(commonproperties.value("video_index").toInt());
+ }
+
+ if (commonproperties.contains("audio_index") && !commonproperties.value("audio_index").isEmpty() && commonproperties.value("audio_index").toInt() != 0) {
+ m_view.clip_force_aindex->setChecked(true);
+ m_view.clip_aindex->setEnabled(true);
+ m_view.clip_aindex->setValue(commonproperties.value("audio_index").toInt());
+ }
+
+ if (props.contains("audio_max")) {
+ m_view.clip_aindex->setMaximum(props.value("audio_max").toInt());
+ }
+
+ if (props.contains("video_max")) {
+ m_view.clip_vindex->setMaximum(props.value("video_max").toInt());
+ }
+
+ m_view.clip_colorspace->addItem(ProfilesDialog::getColorspaceDescription(601), 601);
+ m_view.clip_colorspace->addItem(ProfilesDialog::getColorspaceDescription(709), 709);
+ m_view.clip_colorspace->addItem(ProfilesDialog::getColorspaceDescription(240), 240);
+
+ if (commonproperties.contains("force_colorspace") && !commonproperties.value("force_colorspace").isEmpty() && commonproperties.value("force_colorspace").toInt() != 0) {
+ m_view.clip_force_colorspace->setChecked(true);
+ m_view.clip_colorspace->setEnabled(true);
+ m_view.clip_colorspace->setCurrentIndex(m_view.clip_colorspace->findData(commonproperties.value("force_colorspace").toInt()));
+ }
+
+ if (commonproperties.contains("full_luma") && !commonproperties.value("full_luma").isEmpty()) {
+ m_view.clip_full_luma->setChecked(true);
+ }
+
+ if (commonproperties.contains("transparency")) {
+ // image transparency checkbox
+ int transparency = commonproperties.value("transparency").toInt();
+ if (transparency == 0) {
+ m_view.clip_force_transparency->setChecked(true);
+ }
+ else if (transparency == 1) {
+ m_view.clip_force_transparency->setChecked(true);
+ m_view.clip_transparency->setCurrentIndex(1);
+ }
+ }
+ else {
+ m_view.clip_force_transparency->setHidden(true);
+ m_view.clip_transparency->setHidden(true);
+ }
+
+
+ connect(m_view.clip_force_transparency, SIGNAL(toggled(bool)), m_view.clip_transparency, SLOT(setEnabled(bool)));
+ connect(m_view.clip_force_ar, SIGNAL(toggled(bool)), m_view.clip_ar_num, SLOT(setEnabled(bool)));
+ connect(m_view.clip_force_ar, SIGNAL(toggled(bool)), m_view.clip_ar_den, SLOT(setEnabled(bool)));
+ connect(m_view.clip_force_progressive, SIGNAL(toggled(bool)), m_view.clip_progressive, SLOT(setEnabled(bool)));
+ connect(m_view.clip_force_threads, SIGNAL(toggled(bool)), m_view.clip_threads, SLOT(setEnabled(bool)));
+ connect(m_view.clip_force_vindex, SIGNAL(toggled(bool)), m_view.clip_vindex, SLOT(setEnabled(bool)));
+ connect(m_view.clip_force_aindex, SIGNAL(toggled(bool)), m_view.clip_aindex, SLOT(setEnabled(bool)));
+ connect(m_view.clip_force_out, SIGNAL(toggled(bool)), m_view.clip_out, SLOT(setEnabled(bool)));
+ connect(m_view.clip_force_colorspace, SIGNAL(toggled(bool)), m_view.clip_colorspace, SLOT(setEnabled(bool)));
+
+ m_view.tabWidget->removeTab(METATAB);
+ m_view.tabWidget->removeTab(MARKERTAB);
+ m_view.tabWidget->removeTab(IMAGETAB);
+ m_view.tabWidget->removeTab(SLIDETAB);
+ m_view.tabWidget->removeTab(COLORTAB);
+ m_view.tabWidget->removeTab(AUDIOTAB);
+ m_view.tabWidget->removeTab(VIDEOTAB);
+
+ m_view.clip_path->setHidden(true);
+ m_view.label_path->setHidden(true);
+ m_view.label_description->setHidden(true);
+ m_view.label_size->setHidden(true);
+ m_view.clip_filesize->setHidden(true);
+ m_view.clip_filesize->setHidden(true);
+ m_view.clip_path->setHidden(true);
+ m_view.clip_description->setHidden(true);
+ m_view.clip_thumb->setHidden(true);
+ m_view.label_duration->setHidden(true);
+ m_view.clip_duration->setHidden(true);
+
+ if (commonproperties.contains("out")) {
+ if (commonproperties.value("out").toInt() > 0) {
+ m_view.clip_force_out->setChecked(true);
+ m_view.clip_out->setText(m_tc.getTimecodeFromFrames(commonproperties.value("out").toInt()));
+ } else m_view.clip_out->setText(KdenliveSettings::image_duration());
+ } else {
+ m_view.clip_force_out->setHidden(true);
+ m_view.clip_out->setHidden(true);
+ }
+}
+
+ClipProperties::~ClipProperties()
+{
+ QAbstractItemDelegate *del1 = m_view.clip_vproperties->itemDelegate();
+ if (del1) delete del1;
+ QAbstractItemDelegate *del2 = m_view.clip_aproperties->itemDelegate();
+ if (del2) delete del2;
+}
+
+void ClipProperties::slotApplyProperties()
+{
+ if (m_clip != NULL)
+ emit applyNewClipProperties(m_clip->getId(), m_clip->properties(), properties(), needsTimelineRefresh(), needsTimelineReload());
+ m_view.buttonBox->button(QDialogButtonBox::Apply)->setEnabled(false);
+}
+
+void ClipProperties::disableClipId(const QString &id)
+{
+ if (m_clip && m_view.buttonBox->button(QDialogButtonBox::Ok)->isEnabled()) {
+ if (m_clip->getId() == id) {
+ // clip was removed from project, close this properties dialog
+ close();
+ }
+ }
+}
+
+void ClipProperties::slotModified()
+{
+ m_view.buttonBox->button(QDialogButtonBox::Apply)->setEnabled(true);
+}
+
+
+void ClipProperties::slotEnableLuma(int state)
+{
+ bool enable = false;
+ if (state == Qt::Checked) enable = true;
+ m_view.luma_duration->setEnabled(enable);
+ m_view.luma_duration_frames->setEnabled(enable);
+ m_view.slide_luma->setEnabled(enable);
+ if (enable) {
+ m_view.luma_file->setEnabled(m_view.slide_luma->isChecked());
+ } else m_view.luma_file->setEnabled(false);
+ m_view.label_softness->setEnabled(m_view.slide_luma->isChecked() && enable);
+ m_view.luma_softness->setEnabled(m_view.label_softness->isEnabled());
+}
+
+void ClipProperties::slotEnableLumaFile(int state)
+{
+ bool enable = false;
+ if (state == Qt::Checked) enable = true;
+ m_view.luma_file->setEnabled(enable);
+ m_view.luma_softness->setEnabled(enable);
+ m_view.label_softness->setEnabled(enable);
+}
+
+void ClipProperties::slotFillMarkersList()
+{