// Build monitor for chapters
if (m_isPal) m_tc.setFormat(25);
- else m_tc.setFormat(30, true);
+ else m_tc.setFormat(30000.0/1001, true);
m_manager = new MonitorManager(this);
m_manager->resetProfiles(m_tc);
}
m_view.chapters_list->clear();
m_view.chapters_list->addItems(chaptersString);
+
+ //bool modified = m_view.vob_list->itemData(m_view.vob_list->currentIndex(), Qt::UserRole + 2).toInt();
}
void DvdWizardChapters::slotAddChapter()
chaptersString.append(Timecode::getStringTimecode(chapterTimes.at(i), m_tc.fps()));
currentChaps.append(QString::number(chapterTimes.at(i)));
}
+ // Save item chapters
m_view.vob_list->setItemData(m_view.vob_list->currentIndex(), currentChaps, Qt::UserRole + 1);
+ // Mark item as modified
+ m_view.vob_list->setItemData(m_view.vob_list->currentIndex(), 1, Qt::UserRole + 2);
m_view.chapters_list->clear();
m_view.chapters_list->addItems(chaptersString);
}
int ix = m_view.chapters_list->currentRow();
QStringList currentChaps = m_view.vob_list->itemData(m_view.vob_list->currentIndex(), Qt::UserRole + 1).toStringList();
currentChaps.removeAt(ix);
+
+ // Save item chapters
m_view.vob_list->setItemData(m_view.vob_list->currentIndex(), currentChaps, Qt::UserRole + 1);
+ // Mark item as modified
+ m_view.vob_list->setItemData(m_view.vob_list->currentIndex(), 1, Qt::UserRole + 2);
// rebuild chapters
QStringList chaptersString;
m_monitor->setTimePos(m_view.chapters_list->currentItem()->text() + ":00");
}
-void DvdWizardChapters::slotGetChaptersList(int ix)
-{
- QString url = m_view.vob_list->itemText(ix);
- if (QFile::exists(url + ".dvdchapter")) {
- // insert chapters as children
- QFile file(url + ".dvdchapter");
- if (file.open(QIODevice::ReadOnly)) {
- QDomDocument doc;
- doc.setContent(&file);
- file.close();
- QDomNodeList chapters = doc.elementsByTagName("chapter");
- QStringList chaptersList;
- for (int j = 0; j < chapters.count(); j++) {
- chaptersList.append(QString::number(chapters.at(j).toElement().attribute("time").toInt()));
- }
- m_view.vob_list->setItemData(ix, chaptersList, Qt::UserRole + 1);
- }
- }
-}
-
-void DvdWizardChapters::setVobFiles(bool isPal, const QStringList movies, const QStringList durations)
+void DvdWizardChapters::setVobFiles(bool isPal, const QStringList movies, const QStringList durations, const QStringList chapters)
{
m_isPal = isPal;
if (m_isPal) m_tc.setFormat(25);
- else m_tc.setFormat(30, true);
+ else m_tc.setFormat(30000.0/1001, true);
m_manager->resetProfiles(m_tc);
m_monitor->resetProfile();
- if (m_view.vob_list->count() == movies.count()) {
- bool equal = true;
- for (int i = 0; i < movies.count(); i++) {
- if (movies.at(i) != m_view.vob_list->itemText(i)) {
- equal = false;
- break;
- }
- }
- if (equal) return;
- }
m_view.vob_list->clear();
for (int i = 0; i < movies.count(); i++) {
m_view.vob_list->addItem(movies.at(i), durations.at(i));
- slotGetChaptersList(i);
+ m_view.vob_list->setItemData(i, chapters.at(i).split(';'), Qt::UserRole + 1);
}
slotUpdateChaptersList();
}
+QMap <QString, QString> DvdWizardChapters::chaptersData() const
+{
+ QMap <QString, QString> result;
+ int max = m_view.vob_list->count();
+ for (int i = 0; i < max; i++) {
+ QString chapters = m_view.vob_list->itemData(i, Qt::UserRole + 1).toStringList().join(";");
+ result.insert(m_view.vob_list->itemText(i), chapters);
+ }
+ return result;
+}
+
QStringList DvdWizardChapters::selectedTitles() const
{
QStringList result;
}
return result;
}
+
+
+QDomElement DvdWizardChapters::toXml() const
+{
+ QDomDocument doc;
+ QDomElement xml = doc.createElement("xml");
+ doc.appendChild(xml);
+ for (int i = 0; i < m_view.vob_list->count(); i++) {
+ QDomElement vob = doc.createElement("vob");
+ vob.setAttribute("file", m_view.vob_list->itemText(i));
+ vob.setAttribute("chapters", m_view.vob_list->itemData(i, Qt::UserRole + 1).toStringList().join(";"));
+ xml.appendChild(vob);
+ }
+ return doc.documentElement();
+}