Main Page | File List

xml_dvdauthor.cpp

00001 
00002 // Hey
00004 #include "global.h"
00005 #include "xml_dvdauthor.h"
00006 
00007 #include <qmessagebox.h>
00008 #include <qfiledialog.h>
00009 #include <qfile.h>
00010 #include <qstring.h>
00011 #include <qdom.h>
00012 
00013 #ifndef DEBUG_INFO
00014 #define debug_out printf
00015 #else
00016 void debug_out(const char *, ...){};
00017 #endif
00018 
00019 CXmlDVDAuthor::CXmlDVDAuthor ()
00020 {
00021 
00022 }
00023 
00024 CXmlDVDAuthor::~CXmlDVDAuthor ()
00025 {
00026 
00027 }
00028 
00030 //
00031 // READ XML file ...
00032 //
00034 bool CXmlDVDAuthor::readXml ()
00035 {
00036         // Here we read in a xml - file and create the neccesary underlying structure.
00037         //
00038         // For now we are going to ask for the file name here and handle the QDom...
00039         // Later on this is done a level further up and only QDomNode * is sent.
00040         //
00042         QString fileName = QFileDialog::getOpenFileName ( QString("./"), QString ("XML files ( *.xml)"));
00043         // Assign the file
00044         QFile projectFile(fileName);
00045         if (!projectFile.open(IO_Raw | IO_ReadWrite))
00046                 return false;
00047 
00048         QDomDocument xmlDoc( DVD_DOCTYPE );
00049         if (!xmlDoc.setContent (&projectFile))  {
00050                 // Error handling ...
00051                 projectFile.close();
00052                 int iReturn = QMessageBox::warning ( NULL, QString ("xml project file seems to be defective."),
00053                         QString ("Do you want to try to load another project file ?"),
00054                         QMessageBox::Yes, QMessageBox::No);
00055                 if (iReturn == QMessageBox::Yes)
00056                         return readXml (); // Okay, user wants to specify another project file.
00057         }
00058         // And at last lets try to read the information of the file.
00059         QDomElement docElem = xmlDoc.documentElement();
00060         return m_dvdauthor.readXml (&docElem);
00061 }
00062 
00063 bool CXmlDVDAuthor::dvdauthor_struct::readXml(QDomElement *pDocElem)
00064 {
00065         titleset_struct *pTempTitleset = new titleset_struct;   // temp to get the node_name.
00066         titleset_struct *pTitleset = NULL;
00067         bool bReturn = true;
00068         debug_out ("CXmlDVDAuthor::dvdauthor_struct::readXml <%s><%s>\n",(const char *)pDocElem->tagName(), (const char *)node_name);
00069         if (pDocElem->tagName() != node_name)
00070                 return false;
00071         // So lets get first the attributes for this node.
00072         QDomAttr a = pDocElem->attributeNode ( DVDAUTHOR_DEST );
00073         dest = a.value();
00074         a = pDocElem->attributeNode ( DVDAUTHOR_JUMPPAD );
00075         jumppad = a.value();
00076 //printf ("CXmlDVDAuthor::dvdauthor_struct::readXml <%s><%s>\n",(const char *)a.name(), (const char *)a.value());
00077 
00078         // And now read in all remaining nodes and handle them accordingly.
00079         QDomNode xmlNode = pDocElem->firstChild();
00080         while( !xmlNode.isNull() ) {
00081                 QDomElement searchTree = xmlNode.toElement();
00082                 if (searchTree.tagName() == vmgm.node_name)
00083                         bReturn = vmgm.readXml(&searchTree);
00084                 else if (searchTree.tagName() == pTempTitleset->node_name)      {
00085                         pTitleset = addTitleset();
00086                         bReturn = pTitleset->readXml(&searchTree);
00087                 }
00088                 // If there has been a problem then return false.
00089                 if (!bReturn)
00090                         return false;
00091                 // Otherwise go to the next node ...
00092                 xmlNode = xmlNode.nextSibling();
00093         }
00094         return true;
00095 }
00096 
00097 bool CXmlDVDAuthor::vmgm_struct::readXml(QDomElement *pNodeElement)
00098 {
00099         debug_out ("CXmlDVDAuthor::vmgm_struct::readXml <%s><%s>\n",(const char *)pNodeElement->tagName(), (const char *)node_name);
00100         // vmgm has no attributes thus far I can tell.
00101         // And now read in all remaining nodes and handle them accordingly.
00102         QDomNode xmlNode = pNodeElement->firstChild();
00103         QDomElement searchTree = xmlNode.toElement();
00104         // And only one menus entry is allowed ...
00105         if (searchTree.tagName() == menus.node_name)
00106                 return menus.readXml(&searchTree);
00107         // If there has been a problem then return false.
00108         return false;
00109 }
00110 
00111 bool CXmlDVDAuthor::titleset_struct::readXml(QDomElement *pNodeElement)
00112 {
00113         debug_out ("CXmlDVDAuthor::titleset_struct::readXml <%s><%s>\n",(const char *)pNodeElement->tagName(), (const char *)node_name);
00114         bool bReturn = true;
00115         // titleset has no attributes thus far I can tell.
00116         // And now read in all remaining nodes and handle them accordingly.
00117         QDomNode xmlNode = pNodeElement->firstChild();
00118         // And only one menus entry is allowed ...
00119         while( !xmlNode.isNull() ) {
00120                 QDomElement searchTree = xmlNode.toElement();
00121                 if (searchTree.tagName() == menus.node_name)
00122                         bReturn = menus.readXml(&searchTree);
00123                 else if (searchTree.tagName() == titles.node_name)
00124                         bReturn = titles.readXml(&searchTree);
00125                 // If there has been a problem then return false.
00126                 if (!bReturn)
00127                         return false;
00128                 // Otherwise go to the next node ...
00129                 xmlNode = xmlNode.nextSibling();
00130         }
00131         return true;
00132 }
00133 
00134 bool CXmlDVDAuthor::menus_struct::readXml(QDomElement *pNodeElement)
00135 {
00136         debug_out ("CXmlDVDAuthor::menus_struct::readXml <%s><%s>\n",(const char *)pNodeElement->tagName(), (const char *)node_name);
00137         bool bReturn = true;
00138         int iAudioChannel = 0;
00139         pgc_struct *pTempPGC = new pgc_struct();
00140         pgc_struct *pNewPgc = NULL;
00141         // Lets get the attributes first ...
00142         QDomAttr a = pNodeElement->attributeNode ( MENUS_LANG );
00143         lang = a.value();
00144         // And now read in all remaining nodes and handle them accordingly.
00145         QDomNode xmlNode = pNodeElement->firstChild();
00146         // And only one menus entry is allowed ...
00147         while( !xmlNode.isNull() ) {
00148                 QDomElement searchTree = xmlNode.toElement();
00149                 if (searchTree.tagName() == video.node_name)
00150                         bReturn = video.readXml(&searchTree);
00151                 else if (searchTree.tagName() == audio[iAudioChannel].node_name)        {
00152                         bReturn = audio[iAudioChannel].readXml(&searchTree);
00153                         iAudioChannel ++;
00154                 }
00155                 else if (searchTree.tagName() == subpicture.node_name)
00156                         bReturn = subpicture.readXml(&searchTree);
00157                 else if (searchTree.tagName() == pTempPGC->node_name)   {
00158                         pNewPgc = addPgc ();
00159                         bReturn = pNewPgc->readXml(&searchTree);
00160                 }
00161                 // If there has been a problem then return false.
00162                 if (!bReturn)   {
00163                         delete pTempPGC;
00164                         return false;
00165                 }
00166                 // Otherwise go to the next node ...
00167                 xmlNode = xmlNode.nextSibling();
00168         }
00169         delete pTempPGC;
00170         return true;
00171 }
00172 
00173 bool CXmlDVDAuthor::video_struct::readXml(QDomElement *pNodeElement)
00174 {
00175         debug_out ("CXmlDVDAuthor::video_struct::readXml <%s><%s>\n",(const char *)pNodeElement->tagName(), (const char *)node_name);
00176         // The video node has only attributes and nothing else.
00177         QDomAttr a = pNodeElement->attributeNode ( VIDEO_FORMAT );
00178         format = a.value();
00179         a = pNodeElement->attributeNode ( VIDEO_ASPECT );
00180         aspect = a.value();
00181         a = pNodeElement->attributeNode ( VIDEO_RESOLUTION );
00182         resolution = a.value();
00183         a = pNodeElement->attributeNode ( VIDEO_CAPTION );
00184         caption = a.value();
00185         a = pNodeElement->attributeNode ( VIDEO_WIDESCREEN );
00186         widescreen = a.value();
00187         return true;
00188 }
00189 
00190 bool CXmlDVDAuthor::audio_struct::readXml(QDomElement *pNodeElement)
00191 {
00192         debug_out ("CXmlDVDAuthor::audio_struct::readXml <%s><%s>\n",(const char *)pNodeElement->tagName(), (const char *)node_name);
00193         // The audio node has only attributes and nothing else.
00194         QDomAttr a = pNodeElement->attributeNode ( AUDIO_FORMAT );
00195         format = a.value();
00196         a = pNodeElement->attributeNode ( AUDIO_CHANNELS );
00197         channels = a.value().toInt();
00198         a = pNodeElement->attributeNode ( AUDIO_QUANT );
00199         quant = a.value();
00200         a = pNodeElement->attributeNode ( AUDIO_DOLBY );
00201         dolby = a.value();
00202         a = pNodeElement->attributeNode ( AUDIO_LANG );
00203         lang = a.value();
00204         return true;
00205 }
00206 
00207 bool CXmlDVDAuthor::subpicture_struct::readXml(QDomElement *pNodeElement)
00208 {
00209         debug_out ("CXmlDVDAuthor::subpicture_struct::readXml <%s><%s>\n",(const char *)pNodeElement->tagName(), (const char *)node_name);
00210         // The subpicture node has only attributes and nothing else.
00211         QDomAttr a = pNodeElement->attributeNode ( SUBPICTURE_LANG );
00212         lang = a.value();
00213         return true;
00214 }
00215 bool CXmlDVDAuthor::titles_struct::readXml(QDomElement *pNodeElement)
00216 {
00217         debug_out ("CXmlDVDAuthor::titles_struct::readXml <%s><%s>\n",(const char *)pNodeElement->tagName(), (const char *)node_name);
00218         bool bReturn = true;
00219         int iAudioChannel = 0;
00220         pgc_struct tempPGC;
00221         pgc_struct *pNewPgc = NULL;
00222         // And now read in all remaining nodes and handle them accordingly.
00223         QDomNode xmlNode = pNodeElement->firstChild();
00224         // And only one menus entry is allowed ...
00225         while( !xmlNode.isNull() ) {
00226                 QDomElement searchTree = xmlNode.toElement();
00227                 if (searchTree.tagName() == video.node_name)
00228                         bReturn = video.readXml(&searchTree);
00229                 else if (searchTree.tagName() == audio[iAudioChannel].node_name)        {
00230                         bReturn = audio[iAudioChannel].readXml(&searchTree);
00231                         iAudioChannel ++;
00232                 }
00233                 else if (searchTree.tagName() == tempPGC.node_name)     {
00234                         pNewPgc = addPgc ();
00235                         bReturn = pNewPgc->readXml(&searchTree);
00236                 }
00237                 // If there has been a problem then return false.
00238                 if (!bReturn)
00239                         return false;
00240                 // Otherwise go to the next node ...
00241                 xmlNode = xmlNode.nextSibling();
00242         }
00243         return true;
00244 }
00245 
00246 bool CXmlDVDAuthor::pgc_struct::readXml(QDomElement *pNodeElement)
00247 {
00248         debug_out ("CXmlDVDAuthor::pgc_struct::readXml <%s><%s>\n",(const char *)pNodeElement->tagName(), (const char *)node_name);
00249         bool bReturn = true;
00250         button_struct tempButton;
00251         vob_struct tempVob;
00252         button_struct *pNewButton = NULL;
00253         vob_struct *pNewVob = NULL;
00254         // First read the attributes
00255         QDomAttr a = pNodeElement->attributeNode ( PGC_ENTRY );
00256         entry = a.value();
00257         a = pNodeElement->attributeNode ( PGC_PALETTE );
00258         palette = a.value();
00259         a = pNodeElement->attributeNode ( PGC_PAUSE );
00260         pause = a.value();
00261         // And now read in all remaining nodes and handle them accordingly.
00262         QDomNode xmlNode = pNodeElement->firstChild();
00263         // And only one menus entry is allowed ...
00264         while( !xmlNode.isNull() ) {
00265                 QDomElement searchTree = xmlNode.toElement();
00266                 if (searchTree.tagName() == pre.node_name)
00267                         bReturn = pre.readXml(&searchTree);
00268                 else if (searchTree.tagName() == tempVob.node_name)     {
00269                         pNewVob = addVob();
00270                         bReturn = pNewVob->readXml(&searchTree);
00271                 }
00272                 else if (searchTree.tagName() == tempButton.node_name)  {
00273                         pNewButton = addButton ();
00274                         bReturn = pNewButton->readXml(&searchTree);
00275                 }
00276                 else if (searchTree.tagName() == post.node_name)
00277                         bReturn = post.readXml(&searchTree);
00278                 // If there has been a problem then return false.
00279                 if (!bReturn)
00280                         return false;
00281                 // Otherwise go to the next node ...
00282                 xmlNode = xmlNode.nextSibling();
00283         }
00284         return true;
00285 }
00286 
00287 bool CXmlDVDAuthor::button_struct::readXml(QDomElement *pNodeElement)
00288 {
00289         debug_out ("CXmlDVDAuthor::button_struct::readXml <%s><%s>\n",(const char *)pNodeElement->tagName(), (const char *)node_name);
00290         // First read the attributes
00291         QDomAttr a = pNodeElement->attributeNode ( BUTTON_NAME );
00292         name = a.value();
00293         // The button can execute some commands, which are stored as the value of the node.
00294         value = pNodeElement->text();
00295         return true;
00296 }
00297 
00298 bool CXmlDVDAuthor::cell_struct::readXml(QDomElement *pNodeElement)
00299 {
00300         debug_out ("CXmlDVDAuthor::cell_struct::readXml <%s><%s>\n",(const char *)pNodeElement->tagName(), (const char *)node_name);
00301         // First read the attributes
00302         QDomAttr a = pNodeElement->attributeNode ( CELL_START );
00303         start = a.value();
00304         a = pNodeElement->attributeNode ( CELL_END );
00305         end = a.value();
00306         a = pNodeElement->attributeNode ( CELL_CHAPTER );
00307         chapter = a.value();
00308         a = pNodeElement->attributeNode ( CELL_PROGRAM );
00309         program = a.value();
00310         a = pNodeElement->attributeNode ( CELL_PAUSE );
00311         pause = a.value();
00312         return true;
00313 }
00314 
00315 bool CXmlDVDAuthor::vob_struct::readXml(QDomElement *pNodeElement)
00316 {
00317         debug_out ("CXmlDVDAuthor::vob_struct::readXml <%s><%s>\n",(const char *)pNodeElement->tagName(), (const char *)node_name);
00318         bool bReturn = true;
00319         // First read the attributes
00320         QDomAttr a = pNodeElement->attributeNode ( VOB_FILE );
00321         file = a.value();
00322         a = pNodeElement->attributeNode ( VOB_CHAPTERS );
00323         chapters = a.value();
00324         a = pNodeElement->attributeNode ( VOB_PAUSE );
00325         pause = a.value();
00326         // And now read in all remaining nodes and handle them accordingly.
00327         QDomNode xmlNode = pNodeElement->firstChild();
00328         // And only one menus entry is allowed ...
00329         while( !xmlNode.isNull() ) {
00330                 QDomElement searchTree = xmlNode.toElement();
00331                 if (searchTree.tagName() == cell.node_name)
00332                         bReturn = cell.readXml(&searchTree);
00333                 // Otherwise go to the next node ...
00334                 xmlNode = xmlNode.nextSibling();
00335         }
00336         return bReturn;
00337 }
00338 
00339 bool CXmlDVDAuthor::pre_struct::readXml(QDomElement *pNodeElement)
00340 {
00341         debug_out ("CXmlDVDAuthor::pre_struct::readXml <%s><%s>\n",(const char *)pNodeElement->tagName(), (const char *)node_name);
00342         // read the commands to be executed before.
00343         value = pNodeElement->text();
00344         return true;
00345 }
00346 
00347 bool CXmlDVDAuthor::post_struct::readXml(QDomElement *pNodeElement)
00348 {
00349         debug_out ("CXmlDVDAuthor::post_struct::readXml <%s><%s>\n",(const char *)pNodeElement->tagName(), (const char *)node_name);
00350         // read the commands to be executed after.
00351         value = pNodeElement->text();
00352         return true;
00353 }
00354 // HJere the readXml functions for CXmlSpumux - class
00355 bool CXmlSpumux::subpictures_struct::readXml(QDomElement *pNodeElement)
00356 {
00357         debug_out ("CXmlSpumux::subpictures_struct::readXml <%s><%s>\n",(const char *)pNodeElement->tagName(), (const char *)node_name);
00358         // vmgm has no attributes thus far I can tell.
00359         // And now read in all remaining nodes and handle them accordingly.
00360         QDomNode xmlNode = pNodeElement->firstChild();
00361         QDomElement searchTree = xmlNode.toElement();
00362         // And only one menus entry is allowed ...
00363         if (searchTree.tagName() == stream.node_name)
00364                 return stream.readXml(&searchTree);
00365         // If there has been a problem then return false.
00366         return false;
00367 }
00368 
00369 bool CXmlSpumux::stream_struct::readXml(QDomElement *pNodeElement)
00370 {
00371         debug_out ("CXmlSpumux::stream_struct::readXml <%s><%s>\n",(const char *)pNodeElement->tagName(), (const char *)node_name);
00372         bool bReturn = true;
00373         spu_struct tempSpu;
00374         spu_struct *pNewSpu = NULL;
00375         // And now read in all remaining nodes and handle them accordingly.
00376         QDomNode xmlNode = pNodeElement->firstChild();
00377         // And only one menus entry is allowed ...
00378         while( !xmlNode.isNull() ) {
00379                 QDomElement searchTree = xmlNode.toElement();
00380                 if (searchTree.tagName() == tempSpu.node_name)  {
00381                         pNewSpu = addSpu ();
00382                         bReturn = pNewSpu->readXml(&searchTree);
00383                 }
00384                 if (!bReturn)
00385                         return false;
00386                 // Otherwise go to the next node ...
00387                 xmlNode = xmlNode.nextSibling();
00388         }
00389         // If there has been a problem then return false.
00390         return true;
00391 }
00392 bool CXmlSpumux::spu_struct::readXml(QDomElement *pNodeElement)
00393 {
00394         debug_out ("CXmlSpumuxr::spu_struct::readXml <%s><%s>\n",(const char *)pNodeElement->tagName(), (const char *)node_name);
00395         bool bReturn = true;
00396         button_struct tempButton, *pNewButton=NULL;
00397         action_struct tempAction, *pNewAction=NULL;
00398 
00399         // First read the attributes
00400         QDomAttr a = pNodeElement->attributeNode ( SPU_START );
00401         start = a.value();
00402         a = pNodeElement->attributeNode ( SPU_END );
00403         end = a.value();
00404         a = pNodeElement->attributeNode ( SPU_IMAGE );
00405         image = a.value();
00406         a = pNodeElement->attributeNode ( SPU_HIGHLIGHT );
00407         highlight = a.value();
00408         a = pNodeElement->attributeNode ( SPU_SELECT );
00409         select = a.value();
00410         a = pNodeElement->attributeNode ( SPU_TRANSPARENT );
00411         transparent = a.value();
00412         a = pNodeElement->attributeNode ( SPU_FORCE );
00413         force = a.value();
00414         a = pNodeElement->attributeNode ( SPU_AUTOOUTLINE );
00415         autooutline = a.value();
00416         a = pNodeElement->attributeNode ( SPU_OUTLINEWIDTH );
00417         outlinewidth = a.value().toInt();
00418         a = pNodeElement->attributeNode ( SPU_AUTOORDER );
00419         autoorder = a.value();
00420         a = pNodeElement->attributeNode ( SPU_XOFFSET );
00421         xoffset = a.value().toInt();
00422         a = pNodeElement->attributeNode ( SPU_YOFFSET );
00423         yoffset = a.value().toInt();
00424         // And now read in all remaining nodes and handle them accordingly.
00425         QDomNode xmlNode = pNodeElement->firstChild();
00426         // And only one menus entry is allowed ...
00427         while( !xmlNode.isNull() ) {
00428                 QDomElement searchTree = xmlNode.toElement();
00429                 if (searchTree.tagName() == tempButton.node_name)       {
00430                         pNewButton = addButton();
00431                         bReturn = pNewButton->readXml(&searchTree);
00432                 }
00433                 else if (searchTree.tagName() == tempAction.node_name)  {
00434                         pNewAction = addAction();
00435                         bReturn = pNewAction->readXml(&searchTree);
00436                 }
00437                 // If there has been a problem then return false.
00438                 if (!bReturn)
00439                         return false;
00440                 // Otherwise go to the next node ...
00441                 xmlNode = xmlNode.nextSibling();
00442         }
00443         return true;
00444 }
00445 bool CXmlSpumux::button_struct::readXml(QDomElement *pNodeElement)
00446 {
00447         debug_out ("CXmlSpumux::button_struct::readXml <%s><%s>\n",(const char *)pNodeElement->tagName(), (const char *)node_name);
00448         // First read the attributes
00449         QDomAttr a = pNodeElement->attributeNode ( BUTTON_LABEL );
00450         label = a.value();
00451         a = pNodeElement->attributeNode ( BUTTON_X0 );
00452         x0 = a.value().toInt();
00453         a = pNodeElement->attributeNode ( BUTTON_Y0 );
00454         y0 = a.value().toInt();
00455         a = pNodeElement->attributeNode ( BUTTON_X1 );
00456         x1 = a.value().toInt();
00457         a = pNodeElement->attributeNode ( BUTTON_Y1 );
00458         y1 = a.value().toInt();
00459         a = pNodeElement->attributeNode ( BUTTON_LEFT );
00460         left = a.value();
00461         a = pNodeElement->attributeNode ( BUTTON_RIGHT );
00462         right = a.value();
00463         a = pNodeElement->attributeNode ( BUTTON_UP );
00464         up = a.value();
00465         a = pNodeElement->attributeNode ( BUTTON_DOWN );
00466         down = a.value();
00467         return true;
00468 }
00469 bool CXmlSpumux::action_struct::readXml(QDomElement *pNodeElement)
00470 {
00471         debug_out ("CXmlSpumux::action_struct::readXml <%s><%s>\n",(const char *)pNodeElement->tagName(), (const char *)node_name);
00472         // First read the attributes
00473         QDomAttr a = pNodeElement->attributeNode ( ACTION_LABEL );
00474         label = a.value();
00475         return true;
00476 }
00477 
00479 //
00480 // WRITE XML file ...
00481 //
00483 bool CXmlDVDAuthor::writeXml ()
00484 {
00485         // Here we read in a xml - file and create the neccesary underlying structure.
00486         //
00487         // For now we are going to ask for the file name here and handle the QDom...
00488         // Later on this is done a level further up and only QDomNode * is sent.
00489         //
00491         debug_out ("CXmlDVDAuthor::writeXml ()>\n");
00492         QString fileName = QFileDialog::getSaveFileName ( QString("./"), QString ("XML files ( *.xml)"));
00493         if (fileName.isNull())
00494                 return false;
00495         // Assign the file
00496         return writeXml(fileName);
00497 }
00498 
00499 bool CXmlDVDAuthor::writeXml (QString &fileName)
00500 {
00501         debug_out ("CXmlDVDAuthor::writeXml (%s)\n",(const char *)fileName);
00502         QFile projectFile(fileName);
00503         if (!projectFile.open(IO_WriteOnly))
00504                 return false;
00505 
00506         QDomDocument xmlDoc( DVD_DOCTYPE );     // <""> for now.
00507         if (!m_dvdauthor.writeXml (&xmlDoc))    {
00508                 projectFile.close();
00509                 return false;
00510         }
00511 
00512         QString xml = xmlDoc.toString();
00513         printf ("%s\n", (const char *)xml);
00514         projectFile.writeBlock(xml, qstrlen (xml));
00515 
00516         projectFile.close();
00517         return true;
00518 }
00519 
00520 bool CXmlDVDAuthor::dvdauthor_struct::writeXml(QDomDocument *pDocument)
00521 {
00522         debug_out ("CXmlDVDAuthor::dvdauthor_struct::writeXml <%s>\n", (const char *)node_name);
00523         bool bReturn = true;
00524         int t = 0;
00525         QDomElement rootDVDAuthor = pDocument->createElement( node_name );      // <dvdauthor>
00526         // Here we set the attributes of the <dvdauthor> tag
00527         if (!dest.isNull())
00528                 rootDVDAuthor.setAttribute( DVDAUTHOR_DEST, dest );
00529         if (!jumppad.isNull())
00530                 rootDVDAuthor.setAttribute( DVDAUTHOR_JUMPPAD, jumppad );
00531         // And now proceed to writing the rest of the file.
00532         pDocument->appendChild( rootDVDAuthor );
00533         bReturn = vmgm.writeXml (pDocument, &rootDVDAuthor);
00534         if (ppArrayTitleset)    {
00535                 while (ppArrayTitleset[t])      {
00536                         if (!bReturn)
00537                                 return false;
00538                         bReturn = ppArrayTitleset[t]->writeXml(pDocument, &rootDVDAuthor);
00539                         t++;
00540                 }
00541         }
00542         return bReturn;
00543 }
00544 
00545 bool CXmlDVDAuthor::vmgm_struct::writeXml(QDomDocument *pDocument, QDomElement *pNodeElement)
00546 {
00547         debug_out ("CXmlDVDAuthor::vmgm_struct::writeXml <%s><%s>\n",(const char *)pNodeElement->tagName(), (const char *)node_name);
00548         QDomElement vmgmNode = pDocument->createElement( node_name );   // <vmm>
00549         // And now proceed to writing the rest of the file.
00550         pNodeElement->appendChild( vmgmNode );
00551         return menus.writeXml (pDocument, &vmgmNode);
00552 }
00553 
00554 bool CXmlDVDAuthor::titleset_struct::writeXml(QDomDocument *pDocument, QDomElement *pNodeElement)
00555 {
00556         bool bReturn = true;
00557         debug_out ("CXmlDVDAuthor::titleset_struct::writeXml <%s><%s>\n",(const char *)pNodeElement->tagName(), (const char *)node_name);
00558         QDomElement titlesetNode = pDocument->createElement( node_name );       // <titleset>
00559         // And now proceed to writing the rest of the file.
00560         pNodeElement->appendChild( titlesetNode );
00561         bReturn = menus.writeXml (pDocument, &titlesetNode);
00562         if (!bReturn)
00563                 return false;
00564         return titles.writeXml (pDocument, &titlesetNode);
00565 }
00566 
00567 bool CXmlDVDAuthor::menus_struct::writeXml(QDomDocument *pDocument, QDomElement *pNodeElement)
00568 {
00569         debug_out ("CXmlDVDAuthor::menus_struct::writeXml <%s><%s>\n",(const char *)pNodeElement->tagName(), (const char *)node_name);
00570         bool bReturn = true;
00571         int t = 0;
00572         QDomElement menusNode = pDocument->createElement( node_name );  // <menus>
00573         // Here we set the attributes of the <dvdauthor> tag
00574         if (!lang.isNull())
00575                 menusNode.setAttribute( MENUS_LANG, lang );
00576 
00577         // And now proceed to writing the rest of the file.
00578         pNodeElement->appendChild( menusNode );
00579         bReturn = video.writeXml (pDocument, &menusNode);
00580         if (!bReturn)
00581                 return false;
00582         for (t=0;t<8;t++)       {
00583                 bReturn = audio[t].writeXml(pDocument, &menusNode);
00584                 if (!bReturn)
00585                         return false;
00586         }
00587         bReturn = subpicture.writeXml (pDocument, &menusNode);
00588         t = 0;
00589         if (ppArrayPgc) {
00590                 while (ppArrayPgc[t])   {
00591                         if (!bReturn)
00592                                 return false;
00593                         bReturn = ppArrayPgc[t]->writeXml(pDocument, &menusNode);
00594                         t++;
00595                 }
00596         }
00597         return bReturn;
00598 }
00599 bool CXmlDVDAuthor::video_struct::writeXml(QDomDocument *pDocument, QDomElement *pNodeElement)
00600 {
00601         // First check if this node holds any information at all ...
00602         if ( (format.isNull()) && (aspect.isNull()) && (resolution.isNull()) && (caption.isNull()) && (widescreen.isNull()) )
00603                 return true;
00604         debug_out ("CXmlDVDAuthor::video_struct::writeXml <%s><%s>\n",(const char *)pNodeElement->tagName(), (const char *)node_name);
00605 
00606         QDomElement videoNode = pDocument->createElement( node_name );  // <video>
00607         // Here we set the attributes of the <dvdauthor> tag
00608         if (!format.isNull())
00609                 videoNode.setAttribute( VIDEO_FORMAT, format );
00610         if (!aspect.isNull())
00611                 videoNode.setAttribute( VIDEO_ASPECT, aspect );
00612         if (!resolution.isNull())
00613                 videoNode.setAttribute( VIDEO_RESOLUTION, resolution );
00614         if (!caption.isNull())
00615                 videoNode.setAttribute( VIDEO_CAPTION, caption );
00616         if (!widescreen.isNull())
00617                 videoNode.setAttribute( VIDEO_WIDESCREEN, widescreen );
00618 
00619         // And now proceed to writing the rest of the file.
00620         pNodeElement->appendChild( videoNode );
00621         return true;
00622 }
00623 bool CXmlDVDAuthor::audio_struct::writeXml(QDomDocument *pDocument, QDomElement *pNodeElement)
00624 {
00625         // First check if this node holds any information at all ...
00626         if ( (format.isNull()) && (channels == 0) && (quant.isNull()) && (dolby.isNull()) && (lang.isNull()) )
00627                 return true;
00628         debug_out ("CXmlDVDAuthor::audio_struct::writeXml <%s><%s>\n",(const char *)pNodeElement->tagName(), (const char *)node_name);
00629 
00630         QDomElement audioNode = pDocument->createElement( node_name );  // <audio>
00631         // Here we set the attributes of the <dvdauthor> tag
00632         if (!format.isNull())
00633                 audioNode.setAttribute( AUDIO_FORMAT, format );
00634         if (!channels == 0)
00635                 audioNode.setAttribute( AUDIO_CHANNELS, QString ("%1").arg(channels) );
00636         if (!quant.isNull())
00637                 audioNode.setAttribute( AUDIO_QUANT, quant );
00638         if (!dolby.isNull())
00639                 audioNode.setAttribute( AUDIO_DOLBY, dolby );
00640         if (!lang.isNull())
00641                 audioNode.setAttribute( AUDIO_LANG, lang );
00642 
00643         // And now proceed to writing the rest of the file.
00644         pNodeElement->appendChild( audioNode );
00645         return true;
00646 }
00647 
00648 bool CXmlDVDAuthor::subpicture_struct::writeXml(QDomDocument *pDocument, QDomElement *pNodeElement)
00649 {
00650         // First check if this node holds any information at all ...
00651         if (lang.isNull())
00652                 return true;
00653         debug_out ("CXmlDVDAuthor::subpicture_struct::writeXml <%s><%s>\n",(const char *)pNodeElement->tagName(), (const char *)node_name);
00654         QDomElement subpictureNode = pDocument->createElement( node_name );     // <dvdauthor>
00655         // Here we set the attributes of the <dvdauthor> tag
00656         if (!lang.isNull())
00657                 subpictureNode.setAttribute( SUBPICTURE_LANG, lang );
00658 
00659         // And now proceed to writing the rest of the file.
00660         pNodeElement->appendChild( subpictureNode );
00661         return true;
00662 }
00663 
00664 bool CXmlDVDAuthor::titles_struct::writeXml(QDomDocument *pDocument, QDomElement *pNodeElement)
00665 {
00666         debug_out ("CXmlDVDAuthor::titles_struct::writeXml <%s><%s>\n",(const char *)pNodeElement->tagName(), (const char *)node_name);
00667         bool bReturn = true;
00668         int t = 0;
00669         QDomElement titlesNode = pDocument->createElement( node_name ); // <titles>
00670         // And now proceed to writing the rest of the file.
00671         pNodeElement->appendChild( titlesNode );
00672         bReturn = video.writeXml (pDocument, &titlesNode);
00673         if (!bReturn)
00674                 return false;
00675         for (t=0;t<8;t++)       {
00676                 bReturn = audio[t].writeXml(pDocument, &titlesNode);
00677                 if (!bReturn)
00678                         return false;
00679         }
00680         t = 0;
00681         if (ppArrayPgc) {
00682                 while (ppArrayPgc[t])   {
00683                         if (!bReturn)
00684                                 return false;
00685                         bReturn = ppArrayPgc[t]->writeXml(pDocument, &titlesNode);
00686                         t++;
00687                 }
00688         }
00689         return bReturn;
00690 }
00691 
00692 bool CXmlDVDAuthor::pgc_struct::writeXml(QDomDocument *pDocument, QDomElement *pNodeElement)
00693 {
00694         debug_out ("CXmlDVDAuthor::pgc_struct::writeXml <%s><%s>\n",(const char *)pNodeElement->tagName(), (const char *)node_name);
00695         bool bReturn = true;
00696         int t = 0;
00697         QDomElement pgcNode = pDocument->createElement( node_name );    // <pgc>
00698         // Here we set the attributes of the <dvdauthor> tag
00699         if (!entry.isNull())
00700                 pgcNode.setAttribute( PGC_ENTRY, entry );
00701         if (!palette.isNull())
00702                 pgcNode.setAttribute( PGC_PALETTE, palette );
00703         if (!pause.isNull())
00704                 pgcNode.setAttribute( PGC_PAUSE, pause );
00705 
00706         // And now proceed to writing the rest of the file.
00707         pNodeElement->appendChild( pgcNode );
00708         bReturn = pre.writeXml (pDocument, &pgcNode);
00709         if (ppArrayVob) {
00710                 while (ppArrayVob[t])   {
00711                         if (!bReturn)
00712                                 return false;
00713                         bReturn = ppArrayVob[t]->writeXml(pDocument, &pgcNode);
00714                         t++;
00715                 }
00716         }
00717         t = 0;
00718         if (ppArrayButton)      {
00719                 while (ppArrayButton[t])        {
00720                         if (!bReturn)
00721                                 return false;
00722                         bReturn = ppArrayButton[t]->writeXml(pDocument, &pgcNode);
00723                         t++;
00724                 }
00725         }
00726         if (!bReturn)
00727                 return false;
00728         return post.writeXml (pDocument, &pgcNode);
00729 }
00730 
00731 bool CXmlDVDAuthor::button_struct::writeXml(QDomDocument *pDocument, QDomElement *pNodeElement)
00732 {
00733         // First check if this node holds any information at all ...
00734         if ( (name.isNull()) && (value.isNull()) )
00735                 return true;
00736         debug_out ("CXmlDVDAuthor::button_struct::writeXml <%s><%s>\n",(const char *)pNodeElement->tagName(), (const char *)node_name);
00737         QDomElement buttonNode = pDocument->createElement( node_name ); // <button>
00738         // And now proceed to writing the rest of the file.
00739         pNodeElement->appendChild( buttonNode );
00740         // Here we set the attributes of the <button> tag
00741         if (!name.isNull())
00742                 buttonNode.setAttribute( BUTTON_NAME, name );
00743         QDomText domText = pDocument->createTextNode (value);
00744         buttonNode.appendChild( domText );
00745         return true;
00746 }
00747 
00748 bool CXmlDVDAuthor::cell_struct::writeXml(QDomDocument *pDocument, QDomElement *pNodeElement)
00749 {
00750         // First check if this node holds any information at all ...
00751         if ( (start.isNull()) && (end.isNull()) && (program.isNull()) )
00752                 return true;
00753         debug_out ("CXmlDVDAuthor::cell_struct::writeXml <%s><%s>\n",(const char *)pNodeElement->tagName(), (const char *)node_name);
00754         QDomElement cellNode = pDocument->createElement( node_name );   // <cell>
00755         // Here we set the attributes of the <dvdauthor> tag
00756         if (!start.isNull())
00757                 cellNode.setAttribute( CELL_START, start );
00758         if (!end.isNull())
00759                 cellNode.setAttribute( CELL_END, end );
00760         if (!chapter.isNull())
00761                 cellNode.setAttribute( CELL_CHAPTER, chapter );
00762         if (!program.isNull())
00763                 cellNode.setAttribute( CELL_PROGRAM, program );
00764         if (!pause.isNull())
00765                 cellNode.setAttribute( CELL_PAUSE, pause );
00766         // And now proceed to writing the rest of the file.
00767         pNodeElement->appendChild( cellNode );
00768         return true;
00769 }
00770 
00771 bool CXmlDVDAuthor::vob_struct::writeXml(QDomDocument *pDocument, QDomElement *pNodeElement)
00772 {
00773         debug_out ("CXmlDVDAuthor::vob_struct::writeXml <%s><%s>\n",(const char *)pNodeElement->tagName(), (const char *)node_name);
00774         QDomElement vobNode = pDocument->createElement( node_name );    // <vob>
00775         // Here we set the attributes of the <dvdauthor> tag
00776         if (!file.isNull())
00777                 vobNode.setAttribute( VOB_FILE, file );
00778         if (!chapters.isNull())
00779                 vobNode.setAttribute( VOB_CHAPTERS, chapters );
00780         if (!pause.isNull())
00781                 vobNode.setAttribute( VOB_PAUSE, pause );
00782         // And now proceed to writing the rest of the file.
00783         pNodeElement->appendChild( vobNode );
00784         return cell.writeXml (pDocument, &vobNode);
00785 }
00786 
00787 bool CXmlDVDAuthor::pre_struct::writeXml(QDomDocument *pDocument, QDomElement *pNodeElement)
00788 {
00789         // First check if this node holds any information at all ...
00790         if (value.isNull())
00791                 return true;
00792         debug_out ("CXmlDVDAuthor::pre_struct::writeXml <%s><%s>\n",(const char *)pNodeElement->tagName(), (const char *)node_name);
00793         QDomElement preNode = pDocument->createElement( node_name );    // <pre>
00794         // And now proceed to writing the rest of the file.
00795         pNodeElement->appendChild( preNode );
00796         QDomText domText = pDocument->createTextNode (value);
00797         preNode.appendChild( domText );
00798         return true;
00799 }
00800 
00801 bool CXmlDVDAuthor::post_struct::writeXml(QDomDocument *pDocument, QDomElement *pNodeElement)
00802 {
00803         // First check if this node holds any information at all ...
00804         if (value.isNull())
00805                 return true;
00806         debug_out ("CXmlDVDAuthor::post_struct::writeXml <%s><%s>\n",(const char *)pNodeElement->tagName(), (const char *)node_name);
00807         QDomElement postNode = pDocument->createElement( node_name );   // <post>
00808         // And now proceed to writing the rest of the file.
00809         QDomText domText = pDocument->createTextNode (value);
00810         postNode.appendChild( domText );
00811         pNodeElement->appendChild( postNode );
00812         return true;
00813 }
00814 
00815 // Private member functions :
00816 CXmlSpumux::CXmlSpumux ()
00817 {
00818 
00819 }
00820 
00821 CXmlSpumux::~CXmlSpumux ()
00822 {
00823 
00824 }
00825 
00826 bool CXmlSpumux::readXml ()
00827 {
00828 //      m_subpictures.readXml();
00829         return false;
00830 }
00831 
00832 bool CXmlSpumux::writeXml ()
00833 {
00834         // Here we read in a xml - file and create the neccesary underlying structure.
00835         //
00836         // For now we are going to ask for the file name here and handle the QDom...
00837         // Later on this is done a level further up and only QDomNode * is sent.
00838         //
00840         debug_out ("CXmlSpumux::writeXml\n");
00841         QString fileName = QFileDialog::getSaveFileName ( QString("./"), QString ("XML files ( *.xml)"));
00842         if (fileName.isNull())
00843                 return false;
00844         return writeXml(fileName);
00845 }
00846 
00847 bool CXmlSpumux::writeXml (QString &fileName)
00848 {
00849         debug_out ("CXmlSpumux::writeXml (%s)\n",(const char *)fileName);
00850         // Assign the file
00851         QFile projectFile(fileName);
00852         if (!projectFile.open(IO_WriteOnly))
00853                 return false;
00854 
00855         QDomDocument xmlDoc( DVD_DOCTYPE );     // <""> for now.
00856         bool bRet = m_subpictures.writeXml (&xmlDoc);
00857         if (bRet)       {
00858                 QString xml = xmlDoc.toString();
00859                 debug_out ("%s\n", (const char *)xml);
00860                 projectFile.writeBlock(xml, qstrlen (xml));
00861         }
00862 
00863         projectFile.close();
00864         return bRet;
00865 }
00866 
00867 bool CXmlSpumux::subpictures_struct::writeXml(QDomDocument *pDocument)
00868 {
00869         debug_out ("CXmlSpumux::subpictures_struct::writeXml <%s>\n",(const char *)node_name);
00870 
00871         QDomElement subpicturesNode = pDocument->createElement( node_name );    // <subpictures>
00872         // And now proceed to writing the rest of the file.
00873         pDocument->appendChild( subpicturesNode );
00874         return stream.writeXml (pDocument, &subpicturesNode);
00875 }
00876 
00877 bool CXmlSpumux::stream_struct::writeXml(QDomDocument *pDocument, QDomElement *pNodeElement)
00878 {
00879         debug_out ("CXmlSpumux::stream_struct::writeXml <%s><%s>\n",(const char *)pNodeElement->tagName(), (const char *)node_name);
00880         bool bReturn = true;
00881         int t = 0;
00882         QDomElement streamNode = pDocument->createElement( node_name ); // <stream>
00883         // And now proceed to writing the rest of the file.
00884         pNodeElement->appendChild( streamNode );
00885         if (ppArraySpu) {
00886                 while (ppArraySpu[t])   {
00887                         bReturn = ppArraySpu[t]->writeXml(pDocument, &streamNode);
00888                         if (!bReturn)
00889                                 return false;
00890                         t++;
00891                 }
00892         }
00893         return true;
00894 }
00895 bool CXmlSpumux::spu_struct::writeXml(QDomDocument *pDocument, QDomElement *pNodeElement)
00896 {
00897         debug_out ("CXmlSpumux::spu_struct::writeXml <%s><%s>\n",(const char *)pNodeElement->tagName(), (const char *)node_name);
00898         bool bReturn = true;
00899         int t = 0;
00900         QDomElement spuNode = pDocument->createElement( node_name );    // <spu>
00901         if (!start.isNull())
00902                 spuNode.setAttribute( SPU_START, start );
00903         if (!end.isNull())
00904                 spuNode.setAttribute( SPU_END, end );
00905         if (!image.isNull())
00906                 spuNode.setAttribute( SPU_IMAGE, image );
00907         if (!highlight.isNull())
00908                 spuNode.setAttribute( SPU_HIGHLIGHT, highlight );
00909         if (!select.isNull())
00910                 spuNode.setAttribute( SPU_SELECT, select );
00911         if (!transparent.isNull())
00912                 spuNode.setAttribute( SPU_TRANSPARENT, transparent );
00913         if (!force.isNull())
00914                 spuNode.setAttribute( SPU_FORCE, force );
00915         if (!autooutline.isNull())
00916                 spuNode.setAttribute( SPU_AUTOOUTLINE, autooutline );
00917         if (outlinewidth != -1)
00918                 spuNode.setAttribute( SPU_OUTLINEWIDTH, QString ("%1").arg(outlinewidth) );
00919         if (!autoorder.isNull())
00920                 spuNode.setAttribute( SPU_AUTOORDER, autoorder );
00921         if (xoffset != -1)
00922                 spuNode.setAttribute( SPU_XOFFSET, QString ("%1").arg(xoffset) );
00923         if (yoffset != -1)
00924                 spuNode.setAttribute( SPU_YOFFSET, QString ("%1").arg(yoffset) );
00925         // And now proceed to writing the rest of the file.
00926         pNodeElement->appendChild( spuNode );
00927         t=0;
00928         if (ppArrayButton)      {
00929                 while (ppArrayButton[t])        {
00930                         bReturn = ppArrayButton[t]->writeXml(pDocument, &spuNode);
00931                         if (!bReturn)
00932                                 return false;
00933                         t++;
00934                 }
00935         }
00936         t=0;
00937         if (ppArrayAction)      {
00938                 while (ppArrayAction[t])        {
00939                         bReturn = ppArrayAction[t]->writeXml(pDocument, &spuNode);
00940                         if (!bReturn)
00941                                 return false;
00942                         t++;
00943                 }
00944         }
00945         return true;
00946 }
00947 bool CXmlSpumux::button_struct::writeXml(QDomDocument *pDocument, QDomElement *pNodeElement)
00948 {
00949         // First check if this node holds any information at all ...
00950         if ( (label.isNull()) && (x0 == -1) && (y0 == -1) && (x1 == -1) && (y1 == -1) &&
00951                 (up.isNull()) && (down.isNull()) && (left.isNull()) && (right.isNull()) )
00952                 return true;
00953         debug_out ("CXmlSpumux::button_struct::writeXml <%s><%s>\n",(const char *)pNodeElement->tagName(), (const char *)node_name);
00954         QDomElement buttonNode = pDocument->createElement( node_name ); // <button>
00955         if (!label.isNull())
00956                 buttonNode.setAttribute( BUTTON_LABEL, label );
00957         if (x0 != -1)
00958                 buttonNode.setAttribute( BUTTON_X0, QString ("%1").arg(x0) );
00959         if (y0 != -1)
00960                 buttonNode.setAttribute( BUTTON_Y0, QString ("%1").arg(y0) );
00961         if (x1 != -1)
00962                 buttonNode.setAttribute( BUTTON_X1, QString ("%1").arg(x1) );
00963         if (y1 != -1)
00964                 buttonNode.setAttribute( BUTTON_Y1, QString ("%1").arg(y1) );
00965         if (!up.isNull())
00966                 buttonNode.setAttribute( BUTTON_UP, up );
00967         if (!down.isNull())
00968                 buttonNode.setAttribute( BUTTON_DOWN, down );
00969         if (!left.isNull())
00970                 buttonNode.setAttribute( BUTTON_LEFT, left );
00971         if (!right.isNull())
00972                 buttonNode.setAttribute( BUTTON_RIGHT, right );
00973         pNodeElement->appendChild( buttonNode );
00974         return true;
00975 }
00976 bool CXmlSpumux::action_struct::writeXml(QDomDocument *pDocument, QDomElement *pNodeElement)
00977 {
00978         // First check if this node holds any information at all ...
00979         if (label.isNull())
00980                 return true;
00981         debug_out ("CXmlSpumux::action_struct::writeXml <%s><%s>\n",(const char *)pNodeElement->tagName(), (const char *)node_name);
00982         QDomElement actionNode = pDocument->createElement( node_name ); // <action>
00983         if (!label.isNull())
00984                 actionNode.setAttribute( ACTION_LABEL, label );
00985         pNodeElement->appendChild( actionNode );
00986         return true;
00987 }
00988 
00990 CXmlDVDAuthor::pgc_struct::pgc_struct ()
00991 {
00992         ppArrayVob              =       NULL;
00993         ppArrayButton   =       NULL;
00994         node_name=QString("pgc");
00995 }
00996 CXmlDVDAuthor::pgc_struct::~pgc_struct ()
00997 {
00998         // Lets clean up a little bit ...
00999         int t=0;
01000         if (ppArrayVob) {
01001                 vob_struct *pVob = ppArrayVob[t];
01002                 while (pVob)    {
01003                         delete pVob;
01004                         t++;
01005                         pVob = ppArrayVob[t];
01006                 }
01007                 delete []ppArrayVob;
01008         }
01009         t=0;
01010         if (ppArrayButton)      {
01011                 button_struct *pButton = ppArrayButton[t];
01012                 while (pButton) {
01013                         delete pButton;
01014                         t++;
01015                         pButton = ppArrayButton[t];
01016                 }
01017                 delete []ppArrayButton;
01018         }
01019 }
01020 CXmlDVDAuthor::menus_struct::menus_struct ()
01021 {
01022         ppArrayPgc=NULL;
01023         node_name=QString("menus");
01024 }
01025 
01026 CXmlDVDAuthor::menus_struct::~menus_struct()
01027 {
01028         // Lets clean up a little bit ...
01029         int t=0;
01030         if (ppArrayPgc) {
01031                 pgc_struct *pPgc = ppArrayPgc[t];
01032                 while (pPgc)    {
01033                         delete pPgc;
01034                         t++;
01035                         pPgc = ppArrayPgc[t];
01036                 }
01037                 delete []ppArrayPgc;
01038         }
01039 }
01040 
01041 CXmlDVDAuthor::titles_struct::titles_struct ()
01042 {
01043         ppArrayPgc = NULL;
01044         node_name=QString("titles");
01045 }
01046 CXmlDVDAuthor::titles_struct::~titles_struct ()
01047 {
01048         int t=0;
01049         if (ppArrayPgc) {
01050                 pgc_struct *pPgc  = ppArrayPgc[t];
01051                 while (pPgc)    {
01052                         delete pPgc;
01053                         t++;
01054                         pPgc = ppArrayPgc[t];
01055                 }
01056                 delete []ppArrayPgc;
01057         }
01058 }
01059 CXmlDVDAuthor::vmgm_struct::vmgm_struct ()
01060 {
01061         node_name=QString("vmgm");
01062 }
01063 CXmlDVDAuthor::titleset_struct::titleset_struct ()
01064 {
01065         node_name=QString("titleset");
01066 }
01067 
01068 CXmlDVDAuthor::dvdauthor_struct::dvdauthor_struct ()
01069 {
01070         ppArrayTitleset=NULL;
01071         node_name=QString("dvdauthor");
01072 }
01073 
01074 CXmlDVDAuthor::dvdauthor_struct::~dvdauthor_struct ()
01075 {
01076         // Lets clean up a little bit ...
01077         int t=0;
01078         if (ppArrayTitleset)    {
01079                 titleset_struct *pTitleset = ppArrayTitleset[t];
01080                 while (pTitleset)       {
01081                         delete pTitleset;
01082                         t++;
01083                         pTitleset = ppArrayTitleset[t];
01084                 }
01085                 delete []ppArrayTitleset;
01086         }
01087 }
01088 
01089 CXmlSpumux::stream_struct::stream_struct ()
01090 {
01091         node_name = QString ("stream");
01092         ppArraySpu = NULL;
01093 }
01094 CXmlSpumux::stream_struct::~stream_struct ()
01095 {
01096         // Lets clean up a little bit ...
01097         int t=0;
01098         if (ppArraySpu) {
01099                 spu_struct *pSpu = ppArraySpu[t];
01100                 while (pSpu)    {
01101                         delete pSpu;
01102                         t++;
01103                         pSpu = ppArraySpu[t];
01104                 }
01105                 delete []ppArraySpu;
01106         }
01107 }
01108 CXmlSpumux::spu_struct::spu_struct ()
01109 {
01110         node_name = QString ("spu");
01111         outlinewidth    = -1;
01112         xoffset                 = -1;
01113         yoffset                 = -1;
01114         ppArrayButton=NULL;
01115         ppArrayAction=NULL;
01116 }
01117 CXmlSpumux::spu_struct::~spu_struct ()
01118 {
01119         int t = 0;
01120         if (ppArrayButton)      {
01121                 button_struct *pButton = ppArrayButton[t];
01122                 while (pButton) {
01123                         delete pButton;
01124                         t++;
01125                         pButton = ppArrayButton[t];
01126                 }
01127                 delete []ppArrayButton;
01128         }
01129         if (ppArrayAction)      {
01130                 action_struct *pAction = ppArrayAction[t];
01131                 while (pAction) {
01132                         delete pAction;
01133                         t++;
01134                         pAction = ppArrayAction[t];
01135                 }
01136                 delete []ppArrayAction;
01137         }
01138 }
01139 CXmlSpumux::button_struct::button_struct ()
01140 {
01141         node_name = QString ("button");
01142         x0      = -1;
01143         y0      = -1;
01144         x1      = -1;
01145         y1      = -1;
01146 }
01147 
01148 
01149 CXmlDVDAuthor::titleset_struct *CXmlDVDAuthor::dvdauthor_struct::addTitleset ()
01150 {
01151         // This function simply enlarges the array of available titlesets.
01152         // That'll keep the structure dynamic.
01153         if (!ppArrayTitleset)   {
01154                 // This is the first ...
01155                 ppArrayTitleset=new titleset_struct *[2];
01156                 ppArrayTitleset[0]=new titleset_struct;
01157                 ppArrayTitleset[1]=NULL;
01158                 return ppArrayTitleset[0];
01159         }
01160 
01161         int i,t=0;
01162         titleset_struct *pTitleset = ppArrayTitleset[t];
01163         titleset_struct **ppNewArray=NULL, **ppOldArray=NULL;
01164         while (pTitleset)       {
01165                 t ++;
01166                 pTitleset = ppArrayTitleset[t];
01167         }
01168         // Now we have the count of actual titlesets.
01169         ppNewArray=new titleset_struct *[t+2];
01170         for (i=0;i<t;i++)       {
01171                 ppNewArray[i]=ppArrayTitleset[i];
01172         }
01173         ppNewArray[i] = new titleset_struct();
01174         ppNewArray[i+1] = NULL;
01175         // Now we can delete th old array (but not the contents.
01176         ppOldArray = ppArrayTitleset;
01177         ppArrayTitleset = ppNewArray;
01178         delete []ppOldArray;
01179         // And finally return the latest addition ...
01180         return ppArrayTitleset[i];
01181 }
01182 
01183 CXmlDVDAuthor::pgc_struct *CXmlDVDAuthor::menus_struct::addPgc ()
01184 {
01185         // This function simply enlarges the array of available titlesets.
01186         // That'll keep the structure dynamic.
01187         if (!ppArrayPgc)        {
01188                 // This is the first ...
01189                 ppArrayPgc=new pgc_struct *[2];
01190                 ppArrayPgc[0]=new pgc_struct;
01191                 ppArrayPgc[1]=NULL;
01192                 return ppArrayPgc[0];
01193         }
01194 
01195         int i,t=0;
01196         pgc_struct *pPgc = ppArrayPgc[t];
01197         pgc_struct **ppNewArray=NULL, **ppOldArray=NULL;
01198         while (pPgc)    {
01199                 t ++;
01200                 pPgc = ppArrayPgc[t];
01201         }
01202         // Now we have the count of actual titlesets.
01203         ppNewArray=new pgc_struct *[t+2];
01204         for (i=0;i<t;i++)       {
01205                 ppNewArray[i]=ppArrayPgc[i];
01206         }
01207         ppNewArray[i] = new pgc_struct();
01208         ppNewArray[i+1] = NULL;
01209         // Now we can delete th old array (but not the contents.
01210         ppOldArray = ppArrayPgc;
01211         ppArrayPgc = ppNewArray;
01212         delete []ppOldArray;
01213         // And finally return the latest addition ...
01214         return ppArrayPgc[i];
01215 }
01216 
01217 CXmlDVDAuthor::button_struct *CXmlDVDAuthor::pgc_struct::addButton ()
01218 {
01219         // This function simply enlarges the array of available titlesets.
01220         // That'll keep the structure dynamic.
01221         if (!ppArrayButton)     {
01222                 // This is the first ...
01223                 ppArrayButton=new button_struct *[2];
01224                 ppArrayButton[0]=new button_struct;
01225                 ppArrayButton[1]=NULL;
01226                 return ppArrayButton[0];
01227         }
01228 
01229         int i,t=0;
01230         button_struct *pButton = ppArrayButton[t];
01231         button_struct **ppNewArray=NULL, **ppOldArray=NULL;
01232         while (pButton) {
01233                 t ++;
01234                 pButton = ppArrayButton[t];
01235         }
01236         // Now we have the count of actual titlesets.
01237         ppNewArray=new button_struct *[t+2];
01238         for (i=0;i<t;i++)       {
01239                 ppNewArray[i]=ppArrayButton[i];
01240         }
01241         ppNewArray[i] = new button_struct();
01242         ppNewArray[i+1] = NULL;
01243         // Now we can delete th old array (but not the contents.
01244         ppOldArray = ppArrayButton;
01245         ppArrayButton = ppNewArray;
01246         delete []ppOldArray;
01247         // And finally return the latest addition ...
01248         return ppArrayButton[i];
01249 }
01250 
01251 CXmlDVDAuthor::vob_struct *CXmlDVDAuthor::pgc_struct::addVob ()
01252 {
01253         // This function simply enlarges the array of available titlesets.
01254         // That'll keep the structure dynamic.
01255         if (!ppArrayVob)        {
01256                 // This is the first ...
01257                 ppArrayVob=new vob_struct *[2];
01258                 ppArrayVob[0]=new vob_struct;
01259                 ppArrayVob[1]=NULL;
01260                 return ppArrayVob[0];
01261         }
01262 
01263         int i,t=0;
01264         vob_struct *pVob = ppArrayVob[t];
01265         vob_struct **ppNewArray=NULL, **ppOldArray=NULL;
01266         while (pVob)    {
01267                 t ++;
01268                 pVob = ppArrayVob[t];
01269         }
01270         // Now we have the count of actual titlesets.
01271         ppNewArray=new vob_struct *[t+2];
01272         for (i=0;i<t;i++)       {
01273                 ppNewArray[i]=ppArrayVob[i];
01274         }
01275         ppNewArray[i] = new vob_struct();
01276         ppNewArray[i+1] = NULL;
01277         // Now we can delete th old array (but not the contents.
01278         ppOldArray = ppArrayVob;
01279         ppArrayVob = ppNewArray;
01280         delete []ppOldArray;
01281         // And finally return the latest addition ...
01282         return ppArrayVob[i];
01283 }
01284 
01285 CXmlDVDAuthor::pgc_struct *CXmlDVDAuthor::titles_struct::addPgc ()
01286 {
01287         // This function simply enlarges the array of available titlesets.
01288         // That'll keep the structure dynamic.
01289         if (!ppArrayPgc)        {
01290                 // This is the first ...
01291                 ppArrayPgc=new pgc_struct *[2];
01292                 ppArrayPgc[0]=new pgc_struct;
01293                 ppArrayPgc[1]=NULL;
01294                 return ppArrayPgc[0];
01295         }
01296 
01297         int i,t=0;
01298         pgc_struct *pPgc = ppArrayPgc[t];
01299         pgc_struct **ppNewArray=NULL, **ppOldArray=NULL;
01300         while (pPgc)    {
01301                 t ++;
01302                 pPgc = ppArrayPgc[t];
01303         }
01304         // Now we have the count of actual titlesets.
01305         ppNewArray=new pgc_struct *[t+2];
01306         for (i=0;i<t;i++)       {
01307                 ppNewArray[i]=ppArrayPgc[i];
01308         }
01309         ppNewArray[i] = new pgc_struct();
01310         ppNewArray[i+1] = NULL;
01311         // Now we can delete th old array (but not the contents.
01312         ppOldArray = ppArrayPgc;
01313         ppArrayPgc = ppNewArray;
01314         delete []ppOldArray;
01315         // And finally return the latest addition ...
01316         return ppArrayPgc[i];
01317 }
01318 
01319 CXmlSpumux::spu_struct *CXmlSpumux::stream_struct::addSpu ()
01320 {
01321         // This function simply enlarges the array of available titlesets.
01322         // That'll keep the structure dynamic.
01323         if (!ppArraySpu)        {
01324                 // This is the first ...
01325                 ppArraySpu=new spu_struct *[2];
01326                 ppArraySpu[0]=new spu_struct;
01327                 ppArraySpu[1]=NULL;
01328                 return ppArraySpu[0];
01329         }
01330 
01331         int i,t=0;
01332         spu_struct *pSpu = ppArraySpu[t];
01333         spu_struct **ppNewArray=NULL, **ppOldArray=NULL;
01334         while (pSpu)    {
01335                 t ++;
01336                 pSpu = ppArraySpu[t];
01337         }
01338         // Now we have the count of actual titlesets.
01339         ppNewArray=new spu_struct *[t+2];
01340         for (i=0;i<t;i++)       {
01341                 ppNewArray[i]=ppArraySpu[i];
01342         }
01343         ppNewArray[i] = new spu_struct();
01344         ppNewArray[i+1] = NULL;
01345         // Now we can delete th old array (but not the contents.
01346         ppOldArray = ppArraySpu;
01347         ppArraySpu = ppNewArray;
01348         delete []ppOldArray;
01349         // And finally return the latest addition ...
01350         return ppArraySpu[i];
01351 }
01352 
01353 CXmlSpumux::button_struct *CXmlSpumux::spu_struct::addButton ()
01354 {
01355         // This function simply enlarges the array of available titlesets.
01356         // That'll keep the structure dynamic.
01357         if (!ppArrayButton)     {
01358                 // This is the first ...
01359                 ppArrayButton=new button_struct *[2];
01360                 ppArrayButton[0]=new button_struct;
01361                 ppArrayButton[1]=NULL;
01362                 return ppArrayButton[0];
01363         }
01364 
01365         int i,t=0;
01366         button_struct *pButton = ppArrayButton[t];
01367         button_struct **ppNewArray=NULL, **ppOldArray=NULL;
01368         while (pButton) {
01369                 t ++;
01370                 pButton = ppArrayButton[t];
01371         }
01372         // Now we have the count of actual titlesets.
01373         ppNewArray=new button_struct *[t+2];
01374         for (i=0;i<t;i++)       {
01375                 ppNewArray[i]=ppArrayButton[i];
01376         }
01377         ppNewArray[i] = new button_struct();
01378         ppNewArray[i+1] = NULL;
01379         // Now we can delete th old array (but not the contents.
01380         ppOldArray = ppArrayButton;
01381         ppArrayButton = ppNewArray;
01382         delete []ppOldArray;
01383         // And finally return the latest addition ...
01384         return ppArrayButton[i];
01385 }
01386 
01387 CXmlSpumux::action_struct *CXmlSpumux::spu_struct::addAction ()
01388 {
01389         // This function simply enlarges the array of available titlesets.
01390         // That'll keep the structure dynamic.
01391         if (!ppArrayAction)     {
01392                 // This is the first ...
01393                 ppArrayAction=new action_struct *[2];
01394                 ppArrayAction[0]=new action_struct;
01395                 ppArrayAction[1]=NULL;
01396                 return ppArrayAction[0];
01397         }
01398 
01399         int i,t=0;
01400         action_struct *pAction = ppArrayAction[t];
01401         action_struct **ppNewArray=NULL, **ppOldArray=NULL;
01402         while (pAction) {
01403                 t ++;
01404                 pAction = ppArrayAction[t];
01405         }
01406         // Now we have the count of actual titlesets.
01407         ppNewArray=new action_struct *[t+2];
01408         for (i=0;i<t;i++)       {
01409                 ppNewArray[i]=ppArrayAction[i];
01410         }
01411         ppNewArray[i] = new action_struct();
01412         ppNewArray[i+1] = NULL;
01413         // Now we can delete th old array (but not the contents.
01414         ppOldArray = ppArrayAction;
01415         ppArrayAction = ppNewArray;
01416         delete []ppOldArray;
01417         // And finally return the latest addition ...
01418         return ppArrayAction[i];
01419 }
01420 

Generated on Tue Jan 27 01:01:14 2004 for xml_dvdauthor by doxygen 1.3.2