- QString tmpfile;
- QDomDocument doc;
- if (!m_scene)
- return -1;
-
- if (KIO::NetAccess::download(url, tmpfile, 0)) {
- QFile file(tmpfile);
- if (file.open(QIODevice::ReadOnly)) {
- doc.setContent(&file, false);
- file.close();
- } else
- return -1;
- KIO::NetAccess::removeTempFile(tmpfile);
- return loadFromXml(doc, startv, endv);
+ m_projectPath = projectpath;
+ QDomNodeList titles = doc.elementsByTagName("kdenlivetitle");
+ //TODO: Check if the opened title size is equal to project size, otherwise warn user and rescale
+ if (doc.documentElement().hasAttribute("width") && doc.documentElement().hasAttribute("height")) {
+ int doc_width = doc.documentElement().attribute("width").toInt();
+ int doc_height = doc.documentElement().attribute("height").toInt();
+ if (doc_width != m_width || doc_height != m_height) {
+ KMessageBox::information(kapp->activeWindow(), i18n("This title clip was created with a different frame size."), i18n("Title Profile"));
+ //TODO: convert using QTransform
+ m_width = doc_width;
+ m_height = doc_height;
+ }
+ } else {
+ // Document has no size info, it is likely an old version title, so ignore viewport data
+ QDomNodeList viewportlist = doc.documentElement().elementsByTagName("startviewport");
+ if (!viewportlist.isEmpty()) {
+ doc.documentElement().removeChild(viewportlist.at(0));
+ }
+ viewportlist = doc.documentElement().elementsByTagName("endviewport");
+ if (!viewportlist.isEmpty()) {
+ doc.documentElement().removeChild(viewportlist.at(0));
+ }