Commit 340c556d authored by Julius Künzel's avatar Julius Künzel
Browse files

Add option to save as existing title as new item from withing titler

parent f1540a8b
Pipeline #62340 canceled with stage
......@@ -3756,7 +3756,8 @@ void Bin::showTitleWidget(const std::shared_ptr<ProjectClip> &clip)
doc.setContent(xmldata);
}
dia_ui.setXml(doc, clip->clipId());
if (dia_ui.exec() == QDialog::Accepted) {
int res = dia_ui.exec();
if (res == QDialog::Accepted) {
pCore->temporaryUnplug(clips, false);
QMap<QString, QString> newprops;
newprops.insert(QStringLiteral("xmldata"), dia_ui.xml().toString());
......@@ -3794,6 +3795,14 @@ void Bin::showTitleWidget(const std::shared_ptr<ProjectClip> &clip)
pCore->requestMonitorRefresh();
} else {
pCore->temporaryUnplug(clips, false);
if(res == QDialog::Accepted + 1) {
// Ready, create clip xml
std::unordered_map<QString, QString> properties;
properties[QStringLiteral("xmldata")] = dia_ui.xml().toString();
QString titleSuggestion = dia_ui.titleSuggest();
qDebug() << "new id " << ClipCreator::createTitleClip(properties, dia_ui.duration(), titleSuggestion.isEmpty() ? i18n("Title clip") : titleSuggestion, clip->parent()->clipId(),
m_itemModel);
}
}
}
......
......@@ -2340,10 +2340,14 @@ void TitleWidget::setXml(const QDomDocument &doc, const QString &id)
endViewportY->setValue(m_endViewport->data(1).toInt());
endViewportSize->setValue(m_endViewport->data(2).toInt());*/
createButton->setMenu(nullptr);
createButton->setPopupMode(QToolButton::DelayedPopup);
m_createTitleAction->setText(i18n("Update Title"));
auto *addMenu = new QMenu(this);
addMenu->addAction(i18n("Add as new Title"));
createButton->setMenu(addMenu);
connect(addMenu, &QMenu::triggered, this, [this]() {
done(QDialog::Accepted + 1);
});
QTimer::singleShot(200, this, &TitleWidget::slotAdjustZoom);
slotSelectTool();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment