#include <QCryptographicHash>
#include <QFile>
+#include <QInputDialog>
#include <mlt++/Mlt.h>
infoXml.removeChild(markers);
}
setProfilePath(profileName);
- mlt.removeChild(infoXml);
kDebug() << "Reading file: " << url.path() << ", found clips: " << producers.count();
}
}
KMessageBox::information(kapp->activeWindow(), i18n("Project profile was not found, using default profile."), i18n("Missing Profile"));
m_profile = ProfilesDialog::getVideoProfile(KdenliveSettings::default_profile());
} else {
- KMessageBox::information(kapp->activeWindow(), i18n("Project profile was not found, it will be added to your system now."), i18n("Missing Profile"));
m_profile.description = profileInfo.attribute("description");
m_profile.frame_rate_num = profileInfo.attribute("frame_rate_num").toInt();
m_profile.frame_rate_den = profileInfo.attribute("frame_rate_den").toInt();
m_profile.sample_aspect_den = profileInfo.attribute("sample_aspect_den").toInt();
m_profile.display_aspect_num = profileInfo.attribute("display_aspect_num").toInt();
m_profile.display_aspect_den = profileInfo.attribute("display_aspect_den").toInt();
- ProfilesDialog::saveProfile(m_profile);
+ QString existing = ProfilesDialog::existingProfile(m_profile);
+ if (!existing.isEmpty()) {
+ m_profile = ProfilesDialog::getVideoProfile(existing);
+ KMessageBox::information(kapp->activeWindow(), i18n("Project profile not found, replacing with existing one: %1", m_profile.description), i18n("Missing Profile"));
+ } else {
+ QString newDesc = m_profile.description;
+ bool ok = true;
+ while (ok && (newDesc.isEmpty() || ProfilesDialog::existingProfileDescription(newDesc))) {
+ newDesc = QInputDialog::getText(kapp->activeWindow(), i18n("Existing Profile"), i18n("Your project uses an unknown profile.\nIt uses an existing profile name: %1.\nPlease choose a new name to save it", newDesc), QLineEdit::Normal, newDesc, &ok);
+ }
+ if (ok == false) {
+ // User canceled, use default profile
+ m_profile = ProfilesDialog::getVideoProfile(KdenliveSettings::default_profile());
+ } else {
+ if (newDesc != m_profile.description) {
+ // Profile description existed, was replaced by new one
+ m_profile.description = newDesc;
+ } else {
+ KMessageBox::information(kapp->activeWindow(), i18n("Project profile was not found, it will be added to your system now."), i18n("Missing Profile"));
+ }
+ ProfilesDialog::saveProfile(m_profile);
+ }
+ }
setModified(true);
}
}
return m_clipManager->getClipById(clipId);
}
-void KdenliveDoc::slotCreateTextClip(QString /*group*/, const QString &/*groupId*/)
+void KdenliveDoc::slotCreateTextClip(QString group, const QString &groupId)
{
QString titlesFolder = projectFolder().path() + "/titles/";
KStandardDirs::makeDir(titlesFolder);
QImage pix = dia_ui->renderedPixmap();
pix.save(titleInfo.at(1));
//dia_ui->saveTitle(path + ".kdenlivetitle");
- m_clipManager->slotAddTextClipFile(titleInfo.at(0), titleInfo.at(1), dia_ui->xml().toString(), QString(), QString());
+ m_clipManager->slotAddTextClipFile(titleInfo.at(0), titleInfo.at(1), dia_ui->xml().toString(), group, groupId);
setModified(true);
}
delete dia_ui;
}
+void KdenliveDoc::slotCreateTextTemplateClip(QString group, const QString &groupId)
+{
+ KUrl titlesFolder = KUrl(projectFolder().path() + "/titles/");
+ KUrl path = KFileDialog::getOpenUrl(titlesFolder, "*.kdenlivetitle", kapp->activeWindow(), i18n("Enter Template Path"));
+ if (path.isEmpty()) return;
+
+ QStringList titleInfo = TitleWidget::getFreeTitleInfo(projectFolder());
+
+ TitleWidget *dia_ui = new TitleWidget(path, titlesFolder.path(), m_render, kapp->activeWindow());
+ QImage pix = dia_ui->renderedPixmap();
+ pix.save(titleInfo.at(1));
+ delete dia_ui;
+ m_clipManager->slotAddTextTemplateClip(titleInfo.at(0), titleInfo.at(1), path, group, groupId);
+ setModified(true);
+}
+
int KdenliveDoc::tracksCount() const
{
return m_tracksList.count();