QDomElement pgc = dvddoc.createElement("pgc");
pgc.setAttribute("entry", "root");
menus.appendChild(pgc);
+ QDomElement pre = dvddoc.createElement("pre");
+ pgc.appendChild(pre);
+ QDomText nametext = dvddoc.createTextNode("{g1 = 0;}");
+ pre.appendChild(nametext);
for (int i = 0; i < buttons.count(); i++) {
QDomElement button = dvddoc.createElement("button");
button.setAttribute("name", 'b' + QString::number(i));
- QDomText nametext = dvddoc.createTextNode("jump " + buttonsTarget.at(i) + ';');
+ nametext = dvddoc.createTextNode('{' + buttonsTarget.at(i) + ";}");
button.appendChild(nametext);
pgc.appendChild(button);
}
QStringList voburls = m_pageVob->selectedUrls();
- QDomElement pgc2 = dvddoc.createElement("pgc");
- titles.appendChild(pgc2);
- if (m_pageMenu->createMenu()) {
- QDomElement post = dvddoc.createElement("post");
- QDomText call = dvddoc.createTextNode("call menu;");
- post.appendChild(call);
- pgc2.appendChild(post);
- }
+ QDomElement pgc2;
for (int i = 0; i < voburls.count(); i++) {
if (!voburls.at(i).isEmpty()) {
// Add vob entry
+ pgc2 = dvddoc.createElement("pgc");
+ pgc2.setAttribute("pause", 0);
+ titles.appendChild(pgc2);
QDomElement vob = dvddoc.createElement("vob");
vob.setAttribute("file", voburls.at(i));
if (m_pageVob->useChapters()) {
}
}
pgc2.appendChild(vob);
+ if (m_pageMenu->createMenu()) {
+ QDomElement post = dvddoc.createElement("post");
+ QDomText call;
+ if (i == voburls.count() - 1) call = dvddoc.createTextNode("{g1 = 0; call menu;}");
+ else {
+ call = dvddoc.createTextNode("{if ( g1 eq 999 ) { call menu; } jump title " + QString::number(i + 2) + ";}");
+ }
+ post.appendChild(call);
+ pgc2.appendChild(post);
+ }
}
}
- /*
- // create one pgc for each video
- for (int i = 0; i < voburls.count(); i++) {
- if (!voburls.at(i).isEmpty()) {
- // Add vob entry
-
- QDomElement pgc2 = dvddoc.createElement("pgc");
- titles.appendChild(pgc2);
- if (m_pageMenu->createMenu()) {
- QDomElement post = dvddoc.createElement("post");
- QDomText call = dvddoc.createTextNode("call vmgm menu 1;");
- post.appendChild(call);
- pgc2.appendChild(post);
- }
-
- QDomElement vob = dvddoc.createElement("vob");
- vob.setAttribute("file", voburls.at(i));
- pgc2.appendChild(vob);
- }
- }
- */
+
QFile data2(m_authorFile.fileName());
if (data2.open(QFile::WriteOnly)) {
data2.write(dvddoc.toString().toUtf8());
m_view.add_button->setIcon(KIcon("document-new"));
m_view.delete_button->setIcon(KIcon("trash-empty"));
- // TODO: re-enable add button options
- /*m_view.add_button->setVisible(false);
- m_view.delete_button->setVisible(false);*/
+ m_view.add_button->setToolTip(i18n("Add new button"));
+ m_view.delete_button->setToolTip(i18n("Delete current button"));
m_view.menu_profile->addItems(QStringList() << i18n("PAL") << i18n("NTSC"));
connect(m_view.background_list, SIGNAL(activated(int)), this, SLOT(checkBackgroundType(int)));
connect(m_view.target_list, SIGNAL(activated(int)), this, SLOT(setButtonTarget(int)));
+ connect(m_view.back_to_menu, SIGNAL(toggled(bool)), this, SLOT(setBackToMenu(bool)));
connect(m_view.add_button, SIGNAL(pressed()), this, SLOT(addButton()));
connect(m_view.delete_button, SIGNAL(pressed()), this, SLOT(deleteButton()));
if (targets.contains(0)) return true;
// ... or that each video file has a button
for (int i = m_view.target_list->count() - 1; i > 0; i--) {
- if (!targets.contains(i)) return false;
+ // If there is a vob file entry and it has no button assigned, don't allow to go further
+ if (m_view.target_list->itemIcon(i).isNull() == false && !targets.contains(i)) return false;
}
return true;
}
emit completeChanged();
}
+void DvdWizardMenu::setBackToMenu(bool backToMenu)
+{
+ QList<QGraphicsItem *> list = m_scene->selectedItems();
+ for (int i = 0; i < list.count(); i++) {
+ if (list.at(i)->type() == QGraphicsItem::UserType + 1) {
+ DvdButton *button = static_cast < DvdButton* >(list.at(i));
+ button->setBackMenu(backToMenu);
+ break;
+ }
+ }
+ emit completeChanged();
+}
+
void DvdWizardMenu::buttonChanged()
{
QList<QGraphicsItem *> list = m_scene->selectedItems();
m_view.font_size->blockSignals(true);
m_view.font_family->blockSignals(true);
m_view.target_list->blockSignals(true);
+ m_view.back_to_menu->blockSignals(true);
foundButton = true;
m_view.tabWidget->widget(0)->setEnabled(true);
DvdButton *button = static_cast < DvdButton* >(list.at(i));
m_view.target_list->setCurrentIndex(button->target());
m_view.play_text->setText(button->toPlainText());
+ m_view.back_to_menu->setChecked(button->backMenu());
QFont font = button->font();
m_view.font_size->setValue(font.pixelSize());
m_view.font_family->setCurrentFont(font);
m_view.font_size->blockSignals(false);
m_view.font_family->blockSignals(false);
m_view.target_list->blockSignals(false);
+ m_view.back_to_menu->blockSignals(false);
break;
}
}
{
m_view.target_list->clear();
m_view.target_list->addItem(i18n("Play All"), "title 1");
+ int movieCount = 0;
for (int i = 0; i < list.count(); i++) {
- m_view.target_list->addItem(list.at(i), targetlist.at(i));
+ if (targetlist.at(i).contains("chapter"))
+ m_view.target_list->addItem(list.at(i), targetlist.at(i));
+ else {
+ m_view.target_list->addItem(KIcon("video-x-generic"), list.at(i), targetlist.at(i));
+ movieCount++;
+ }
}
+ m_view.back_to_menu->setHidden(movieCount == 1);
}
void DvdWizardMenu::checkBackgroundType(int ix)
// Make sure y1 is not odd (requested by spumux)
if (r.height() % 2 == 1) r.setHeight(r.height() + 1);
if (r.y() % 2 == 1) r.setY(r.y() - 1);
- info.insertMulti(button->command(), r);
+ QString command = button->command();
+ if (button->backMenu()) command.prepend("g1 = 999;");
+ info.insertMulti(command, r);
}
}
return info;
{
public:
- DvdButton(const QString & text): QGraphicsTextItem(text), m_target(0), m_command(QString("title 1")) {}
+ DvdButton(const QString & text): QGraphicsTextItem(text), m_target(0), m_command(QString("jump title 1")), m_backToMenu(false) {}
enum { Type = UserType + 1 };
void setTarget(int t, QString c) {
m_target = t;
QString command() const {
return m_command;
}
+ bool backMenu() const {
+ return m_backToMenu;
+ }
int type() const {
// Enable the use of qgraphicsitem_cast with this item.
return Type;
}
+ void setBackMenu(bool back) {
+ m_backToMenu = back;
+ }
private:
int m_target;
QString m_command;
+ bool m_backToMenu;
protected:
void deleteButton();
void updateColor();
void updateColor(QColor c);
+ void setBackToMenu(bool backToMenu);
};
#endif
for (int i = 0; i < allUrls.count(); i++) {
path = allUrls.at(i)->url().path();
if (!path.isEmpty()) {
- result.append("title " + QString::number(i));
+ result.append("jump title " + QString::number(i + 1));
if (useChapters() && QFile::exists(path + ".dvdchapter")) {
// insert chapters as targets
QFile file(path + ".dvdchapter");
QDomNodeList chapters = doc.elementsByTagName("chapter");
QStringList chaptersList;
for (int j = 0; j < chapters.count(); j++) {
- result.append("title " + QString::number(i + 1) + " chapter " + QString::number(j + 1));
+ result.append("jump title " + QString::number(i + 1) + " chapter " + QString::number(j + 1));
}
}