summaryrefslogtreecommitdiffstats
path: root/src/Authoring/Studio/Palettes
diff options
context:
space:
mode:
authorMahmoud Badri <mahmoud.badri@qt.io>2018-08-16 12:15:02 +0300
committerMahmoud Badri <mahmoud.badri@qt.io>2018-08-17 07:50:29 +0000
commit54811c97d8de7ecc90f7f96823b607322c3e98f4 (patch)
treea155784ae3583c5639f1bd13c7b9871d6885d98a /src/Authoring/Studio/Palettes
parent2bc0f9c2ee2e1702ca85344dca764167680e2899 (diff)
Set qml streams from timeline context menu
Allow setting qml streams to textures, materials and layers from the timeline context menu. Change-Id: Ic697eb14890a27f69fa7ccfdd331937038ad1060 Reviewed-by: Miikka Heikkinen <miikka.heikkinen@qt.io>
Diffstat (limited to 'src/Authoring/Studio/Palettes')
-rw-r--r--src/Authoring/Studio/Palettes/Project/EditPresentationIdDlg.cpp37
-rw-r--r--src/Authoring/Studio/Palettes/Project/EditPresentationIdDlg.h2
2 files changed, 19 insertions, 20 deletions
diff --git a/src/Authoring/Studio/Palettes/Project/EditPresentationIdDlg.cpp b/src/Authoring/Studio/Palettes/Project/EditPresentationIdDlg.cpp
index 18233edf..fc79d5ee 100644
--- a/src/Authoring/Studio/Palettes/Project/EditPresentationIdDlg.cpp
+++ b/src/Authoring/Studio/Palettes/Project/EditPresentationIdDlg.cpp
@@ -38,32 +38,33 @@ EditPresentationIdDlg::EditPresentationIdDlg(const QString &src, QWidget *parent
{
m_ui->setupUi(this);
- auto *sp = std::find_if(g_StudioApp.m_subpresentations.begin(),
- g_StudioApp.m_subpresentations.end(),
- [&src](const SubPresentationRecord &spr) -> bool {
- return spr.m_argsOrSrc == src;
- });
+ if (src == g_StudioApp.GetCore()->GetDoc()->getRelativePath()) {
+ m_presentationId = g_StudioApp.GetCore()->GetDoc()->getPresentationId();
+ } else {
+ auto *sp = std::find_if(g_StudioApp.m_subpresentations.begin(),
+ g_StudioApp.m_subpresentations.end(),
+ [&src](const SubPresentationRecord &spr) -> bool {
+ return spr.m_argsOrSrc == src;
+ });
- if (sp != g_StudioApp.m_subpresentations.end()) {
- m_presentationId = sp->m_id;
- m_ui->lineEditPresentationId->setText(m_presentationId);
+ if (sp != g_StudioApp.m_subpresentations.end())
+ m_presentationId = sp->m_id;
}
- connect(m_ui->lineEditPresentationId, &QLineEdit::textEdited, this,
- &EditPresentationIdDlg::onChangePresentationId);
-}
-
-void EditPresentationIdDlg::onChangePresentationId()
-{
- m_presentationId = m_ui->lineEditPresentationId->text();
+ m_ui->lineEditPresentationId->setText(m_presentationId);
}
void EditPresentationIdDlg::accept()
{
- if (!g_StudioApp.GetCore()->getProjectFile().isUniquePresentationId(m_presentationId, m_src)) {
- g_StudioApp.showPresentationIdUniqueWarning();
+ QString newId = m_ui->lineEditPresentationId->text();
+ if (!newId.isEmpty() && newId != m_presentationId) {
+ if (!g_StudioApp.GetCore()->getProjectFile().isUniquePresentationId(newId, m_src)) {
+ g_StudioApp.showPresentationIdUniqueWarning();
+ } else {
+ g_StudioApp.GetCore()->getProjectFile().writePresentationId(newId, m_src);
+ QDialog::accept();
+ }
} else {
- g_StudioApp.GetCore()->getProjectFile().writePresentationId(m_presentationId, m_src);
QDialog::accept();
}
}
diff --git a/src/Authoring/Studio/Palettes/Project/EditPresentationIdDlg.h b/src/Authoring/Studio/Palettes/Project/EditPresentationIdDlg.h
index 30001cf3..baa73c7a 100644
--- a/src/Authoring/Studio/Palettes/Project/EditPresentationIdDlg.h
+++ b/src/Authoring/Studio/Palettes/Project/EditPresentationIdDlg.h
@@ -56,8 +56,6 @@ private:
Ui::EditPresentationIdDlg *m_ui;
QString m_src; // src attribute value for the current presentation in the project file
QString m_presentationId;
-
- void onChangePresentationId();
};
#endif // EDITPRESENTATIONIDDLG_H