- QDomElement chapters = doc.createElement("chapters");
- chapters.setAttribute("fps", m_tc.fps());
- doc.appendChild(chapters);
-
- QStringList chaptersList = m_view.vob_list->itemData(m_view.vob_list->currentIndex(), Qt::UserRole + 1).toStringList();
-
- for (int i = 0; i < chaptersList.count(); i++) {
- QDomElement chapter = doc.createElement("chapter");
- chapters.appendChild(chapter);
- chapter.setAttribute("title", i18n("Chapter %1", i));
- chapter.setAttribute("time", chaptersList.at(i));
- }
- // save chapters file
- QFile file(m_view.vob_list->currentText() + ".dvdchapter");
- if (!file.open(QIODevice::WriteOnly | QIODevice::Text)) {
- kWarning() << "////// ERROR writing DVD CHAPTER file: " << m_view.vob_list->currentText() + ".dvdchapter";
- } else {
- file.write(doc.toString().toUtf8());
- if (file.error() != QFile::NoError)
- kWarning() << "////// ERROR writing DVD CHAPTER file: " << m_view.vob_list->currentText() + ".dvdchapter";
- else {
- m_view.vob_list->setItemData(m_view.vob_list->currentIndex(), 0, Qt::UserRole + 2);
- m_view.button_save->setEnabled(false);
- }
- file.close();
+ 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);