DVD Wizard cleanup, make chapters optional, should solve freeze

CCBUG: 352057
parent 44e0ed6b
......@@ -69,8 +69,9 @@ DvdWizard::DvdWizard(MonitorManager *manager, const QString &url, QWidget *paren
m_pageChapters = new DvdWizardChapters(manager, m_pageVob->dvdFormat(), this);
m_pageChapters->setTitle(i18n("DVD Chapters"));
addPage(m_pageChapters);
if (!url.isEmpty()) m_pageVob->setUrl(url);
m_pageVob->setMinimumSize(m_pageChapters->size());
m_pageMenu = new DvdWizardMenu(m_pageVob->dvdFormat(), this);
m_pageMenu->setTitle(i18n("Create DVD Menu"));
......@@ -168,7 +169,6 @@ void DvdWizard::slotPageChanged(int page)
// For some reason, when comming from page 2, we need to trick the monitor or it disappears
m_pageChapters->createMonitor(m_pageVob->dvdFormat());
}
setTitleFormat(Qt::PlainText);
m_previousPage = 1;
} else if (page == 2) {
m_pageChapters->stopMonitor();
......
......@@ -34,6 +34,8 @@ DvdWizardChapters::DvdWizardChapters(MonitorManager *manager, DVDFORMAT format,
connect(m_view.button_add, SIGNAL(clicked()), this, SLOT(slotAddChapter()));
connect(m_view.button_delete, SIGNAL(clicked()), this, SLOT(slotRemoveChapter()));
connect(m_view.chapters_list, SIGNAL(itemSelectionChanged()), this, SLOT(slotGoToChapter()));
connect(m_view.chapters_box, &QCheckBox::stateChanged, this, &DvdWizardChapters::slotEnableChapters);
setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding);
// Build monitor for chapters
QVBoxLayout *vbox = new QVBoxLayout;
......@@ -60,7 +62,6 @@ void DvdWizardChapters::stopMonitor()
void DvdWizardChapters::slotUpdateChaptersList()
{
m_manager->activateMonitor(Kdenlive::DvdMonitor, true);
m_monitor->slotOpenDvdFile(m_view.vob_list->currentText());
m_monitor->adjustRulerSize(m_view.vob_list->itemData(m_view.vob_list->currentIndex(), Qt::UserRole).toInt());
QStringList currentChaps = m_view.vob_list->itemData(m_view.vob_list->currentIndex(), Qt::UserRole + 1).toStringList();
......@@ -145,9 +146,10 @@ void DvdWizardChapters::createMonitor(DVDFORMAT format)
if (m_monitor == NULL) {
//TODO: allow monitor with different profile for DVD
m_monitor = new Monitor(Kdenlive::DvdMonitor, m_manager/*, profile*/, this);
m_monitor->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding);
m_view.video_frame->layout()->addWidget(m_monitor);
m_monitor->setSizePolicy(QSizePolicy ( QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding));
m_manager->appendMonitor(m_monitor);
m_manager->activateMonitor(Kdenlive::DvdMonitor, true);
}
}
......@@ -169,10 +171,6 @@ void DvdWizardChapters::setVobFiles(DVDFORMAT format, const QStringList &movies,
m_view.vob_list->setItemData(i, chapters.at(i).split(';'), Qt::UserRole + 1);
}
m_view.vob_list->blockSignals(false);
setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding);
adjustSize();
updateGeometry();
slotUpdateChaptersList();
}
QMap <QString, QString> DvdWizardChapters::chaptersData() const
......@@ -192,6 +190,8 @@ QStringList DvdWizardChapters::selectedTitles() const
int max = m_view.vob_list->count();
for (int i = 0; i < max; ++i) {
result.append(m_view.vob_list->itemText(i));
if (!m_view.chapters_box->isChecked())
continue;
QStringList chapters = m_view.vob_list->itemData(i, Qt::UserRole + 1).toStringList();
for (int j = 0; j < chapters.count(); ++j) {
result.append(Timecode::getStringTimecode(chapters.at(j).toInt(), m_tc.fps(), true));
......@@ -217,6 +217,8 @@ QStringList DvdWizardChapters::selectedTargets() const
for (int i = 0; i < max; ++i) {
// rightJustified: fill with 0s to make menus with more than 9 buttons work (now up to 99 buttons possible)
result.append("jump title " + QString::number(i + 1).rightJustified(2, '0'));
if (!m_view.chapters_box->isChecked())
continue;
QStringList chapters = m_view.vob_list->itemData(i, Qt::UserRole + 1).toStringList();
for (int j = 0; j < chapters.count(); ++j) {
result.append("jump title " + QString::number(i + 1).rightJustified(2, '0') + " chapter " + QString::number(j + 1).rightJustified(2, '0'));
......@@ -231,6 +233,8 @@ QDomElement DvdWizardChapters::toXml() const
QDomDocument doc;
QDomElement xml = doc.createElement(QStringLiteral("xml"));
doc.appendChild(xml);
if (!m_view.chapters_box->isChecked())
return doc.documentElement();
for (int i = 0; i < m_view.vob_list->count(); ++i) {
QDomElement vob = doc.createElement(QStringLiteral("vob"));
vob.setAttribute(QStringLiteral("file"), m_view.vob_list->itemText(i));
......@@ -240,4 +244,11 @@ QDomElement DvdWizardChapters::toXml() const
return doc.documentElement();
}
void DvdWizardChapters::slotEnableChapters(int state)
{
m_view.chapters_frame->setEnabled(state == Qt::Checked);
if (state == Qt::Checked) {
slotUpdateChaptersList();
}
}
......@@ -61,6 +61,7 @@ private slots:
void slotAddChapter();
void slotRemoveChapter();
void slotGoToChapter();
void slotEnableChapters(int state);
};
#endif
......
......@@ -133,7 +133,7 @@ bool MonitorManager::activateMonitor(Kdenlive::MonitorId name, bool forceRefresh
m_projectMonitor->displayAudioMonitor(false);
m_clipMonitor->displayAudioMonitor(true);
}
else {
else if (name == Kdenlive::ProjectMonitor) {
emit updateOverlayInfos(name, KdenliveSettings::displayProjectMonitorInfo());
m_clipMonitor->displayAudioMonitor(false);
m_projectMonitor->displayAudioMonitor(true);
......
......@@ -6,92 +6,135 @@
<rect>
<x>0</x>
<y>0</y>
<width>322</width>
<height>238</height>
<width>334</width>
<height>510</height>
</rect>
</property>
<layout class="QGridLayout" name="gridLayout">
<property name="margin">
<layout class="QGridLayout" name="gridLayout_2">
<property name="leftMargin">
<number>0</number>
</property>
<item row="2" column="0" colspan="4">
<widget class="QListWidget" name="chapters_list">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>150</height>
</size>
</property>
<property name="alternatingRowColors">
<bool>true</bool>
</property>
</widget>
</item>
<item row="3" column="0" colspan="2">
<widget class="QPushButton" name="button_add">
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item row="0" column="0">
<widget class="QCheckBox" name="chapters_box">
<property name="text">
<string>Add chapter</string>
<string>Add chapters</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>Movie file</string>
</property>
</widget>
</item>
<item row="3" column="3">
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>80</width>
<height>13</height>
</size>
</property>
</spacer>
</item>
<item row="3" column="2">
<widget class="QPushButton" name="button_delete">
<property name="text">
<string>Remove chapter</string>
</property>
</widget>
</item>
<item row="0" column="0" colspan="4">
<widget class="QFrame" name="video_frame">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>100</height>
</size>
<widget class="QFrame" name="chapters_frame">
<property name="enabled">
<bool>false</bool>
</property>
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
<enum>QFrame::NoFrame</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
<property name="lineWidth">
<number>0</number>
</property>
<layout class="QGridLayout" name="gridLayout">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item row="0" column="0" colspan="4">
<widget class="QFrame" name="video_frame">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>300</width>
<height>300</height>
</size>
</property>
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>Movie file</string>
</property>
</widget>
</item>
<item row="2" column="0" colspan="4">
<widget class="QListWidget" name="chapters_list">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>150</height>
</size>
</property>
<property name="alternatingRowColors">
<bool>true</bool>
</property>
</widget>
</item>
<item row="3" column="0" colspan="2">
<widget class="QPushButton" name="button_add">
<property name="text">
<string>Add chapter</string>
</property>
</widget>
</item>
<item row="3" column="2">
<widget class="QPushButton" name="button_delete">
<property name="text">
<string>Remove chapter</string>
</property>
</widget>
</item>
<item row="3" column="3">
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>31</width>
<height>13</height>
</size>
</property>
</spacer>
</item>
<item row="1" column="1" colspan="3">
<widget class="KComboBox" name="vob_list"/>
</item>
</layout>
</widget>
</item>
<item row="1" column="1" colspan="3">
<widget class="KComboBox" name="vob_list"/>
</item>
</layout>
</widget>
<customwidgets>
......
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