diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-05-27 23:37:00 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-05-27 23:37:00 +0000 |
commit | b0e912c8b3d02a518fedda28c3180eb4794a7520 (patch) | |
tree | 07d344862562fab58cbe2df39d13d16f2e4d2bea /libk9copy/k9dvdauthor.cpp | |
parent | 4d695ec81fe4d4335ee82c7a9346ad9c9e144ecc (diff) | |
download | k9copy-b0e912c8b3d02a518fedda28c3180eb4794a7520.tar.gz k9copy-b0e912c8b3d02a518fedda28c3180eb4794a7520.zip |
TQt4 convert k9copy
This enables compilation under both Qt3 and Qt4
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/k9copy@1233843 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'libk9copy/k9dvdauthor.cpp')
-rwxr-xr-x | libk9copy/k9dvdauthor.cpp | 182 |
1 files changed, 91 insertions, 91 deletions
diff --git a/libk9copy/k9dvdauthor.cpp b/libk9copy/k9dvdauthor.cpp index 8ee4959..51aa324 100755 --- a/libk9copy/k9dvdauthor.cpp +++ b/libk9copy/k9dvdauthor.cpp @@ -25,36 +25,36 @@ #include <sys/types.h> #include <sys/stat.h> -#include <qdom.h> -#include <qfile.h> -#include <qnamespace.h> -#include <qprocess.h> -#include <qdir.h> -#include <qdatetime.h> -#include <qdatastream.h> -#include <qfile.h> -#include <qlabel.h> -#include <qprogressdialog.h> +#include <tqdom.h> +#include <tqfile.h> +#include <tqnamespace.h> +#include <tqprocess.h> +#include <tqdir.h> +#include <tqdatetime.h> +#include <tqdatastream.h> +#include <tqfile.h> +#include <tqlabel.h> +#include <tqprogressdialog.h> #include <signal.h> #include <klocale.h> -#include <qvaluelist.h> +#include <tqvaluelist.h> #include <kstandarddirs.h> -#include <qapplication.h> +#include <tqapplication.h> class k9Progress; -k9DVDAuthor::k9DVDAuthor(QObject *DVDStruct,const char* name,const QStringList& args) { +k9DVDAuthor::k9DVDAuthor(TQObject *DVDStruct,const char* name,const TQStringList& args) { DVD=(k9DVD*)DVDStruct; xml=NULL; cancelled=false; error=false; - progress = new k9Progress(qApp->mainWidget(),"progress",NULL); + progress = new k9Progress(tqApp->mainWidget(),"progress",NULL); files.setAutoDelete(true); } k9DVDAuthor::~k9DVDAuthor() { - QPtrListIterator <KTempFile> it (files); + TQPtrListIterator <KTempFile> it (files); KTempFile *file; while ( (file = it.current()) != 0 ) { ++it; @@ -69,14 +69,14 @@ void k9DVDAuthor::createXML() { int i; if (xml!=NULL) delete xml; - xml=new QDomDocument(); + xml=new TQDomDocument(); - QDomElement root = xml->createElement( "dvdauthor" ); + TQDomElement root = xml->createElement( "dvdauthor" ); root.setAttribute ("dest",workDir+"dvd"); xml->appendChild( root ); // Create vmgm menu - QDomElement vmgm = xml->createElement("vmgm"); + TQDomElement vmgm = xml->createElement("vmgm"); root.appendChild(vmgm); addMenus(vmgm); @@ -118,24 +118,24 @@ void k9DVDAuthor::createXML() { addTitle(root,tmp); } - QString x = xml->toString(); + TQString x = xml->toString(); - //QFile file( locateLocal("tmp", "k9copy/k9author.xml" )); + //TQFile file( locateLocal("tmp", "k9copy/k9author.xml" )); // if ( file.open( IO_WriteOnly ) ) { - QTextStream stream( m_xml->file() ); + TQTextStream stream( m_xml->file() ); xml->save(stream,1); m_xml->file()->close(); // } } -void k9DVDAuthor::addMenus(QDomElement &titleSet) { +void k9DVDAuthor::addMenus(TQDomElement &titleSet) { int i; - QDomElement menu,video,pgc,pre,vob,button; - QDomText precmd; - QDomText buttonText; - QTime max(0,0); - QString c,start; + TQDomElement menu,video,pgc,pre,vob,button; + TQDomText precmd; + TQDomText buttonText; + TQTime max(0,0); + TQString c,start; k9DVDTitle * l_track= DVD->getstart(); if (l_track==NULL) { @@ -143,9 +143,9 @@ void k9DVDAuthor::addMenus(QDomElement &titleSet) { } else { if( DVD->getnewTitleNum(l_track)==-1) { error=true; - QString sMsg; - //sMsg.QString::sprintf(tr2i18n("'%s' not selected"),l_track->getname().latin1()); - sMsg=i18n("'%1' not selected").arg(l_track->getname()); + TQString sMsg; + //sMsg.TQString::sprintf(tr2i18n("'%s' not selected"),l_track->getname().latin1()); + sMsg=i18n("'%1' not selected").tqarg(l_track->getname()); KMessageBox::error( 0,sMsg, tr2i18n("authoring")); } start.sprintf("jump titleset %d menu;",DVD->getnewTitleNum(l_track)); @@ -159,7 +159,7 @@ void k9DVDAuthor::addMenus(QDomElement &titleSet) { pre=xml->createElement("pre"); pgc.appendChild(pre); precmd=xml->createTextNode(""); - QString cmd="if (g0==0) \n { \n subtitle=0; \n g0=1;\n "+start+"\n}\n"; + TQString cmd="if (g0==0) \n { \n subtitle=0; \n g0=1;\n "+start+"\n}\n"; pre.appendChild(precmd); int numt=0; @@ -174,14 +174,14 @@ void k9DVDAuthor::addMenus(QDomElement &titleSet) { } /** No descriptions */ -void k9DVDAuthor::addTitle(QDomElement &root, k9DVDTitle *title) { +void k9DVDAuthor::addTitle(TQDomElement &root, k9DVDTitle *title) { int i,j; k9DVDSubtitle *l_sub; k9DVDAudioStream *l_auds; k9DVDTitle *l_track= title; - QDomElement e,t,pgc; - QString caud="",csub="",c,palette; + TQDomElement e,t,pgc; + TQString caud="",csub="",c,palette; if (l_track->isSelected() && l_track->getIndexed()) { double titleFactor; @@ -189,15 +189,15 @@ void k9DVDAuthor::addTitle(QDomElement &root, k9DVDTitle *title) { titleFactor=l_track->getfactor(); else titleFactor=factor; - QDomElement titleSet = xml->createElement("titleset"); + TQDomElement titleSet = xml->createElement("titleset"); root.appendChild(titleSet); - QDomElement titleMenu = xml->createElement("menus"); + TQDomElement titleMenu = xml->createElement("menus"); titleSet.appendChild(titleMenu); - QDomElement pgc = xml->createElement("pgc"); + TQDomElement pgc = xml->createElement("pgc"); titleMenu.appendChild(pgc); - QDomElement pre = xml->createElement("pre"); + TQDomElement pre = xml->createElement("pre"); pgc.appendChild(pre); - QDomText precmd=xml->createTextNode(""); + TQDomText precmd=xml->createTextNode(""); int subtitle=0,audio=-1; if (l_track->getDefSubtitle() != NULL) { @@ -219,13 +219,13 @@ void k9DVDAuthor::addTitle(QDomElement &root, k9DVDTitle *title) { } } - QString txtcmd; + TQString txtcmd; if (audio !=-1) { txtcmd="subtitle=%1;\n audio=%2;\n g1=0;jump title 1;"; - txtcmd=txtcmd.arg(subtitle+63).arg(audio); + txtcmd=txtcmd.tqarg(subtitle+63).tqarg(audio); } else { txtcmd="subtitle=%1;\n g1=0;jump title 1;"; - txtcmd=txtcmd.arg(subtitle+63); + txtcmd=txtcmd.tqarg(subtitle+63); } precmd.setNodeValue(txtcmd); @@ -239,7 +239,7 @@ void k9DVDAuthor::addTitle(QDomElement &root, k9DVDTitle *title) { //palette.sprintf("palette%d.yuv",l_track->getnumTitle()); //palette= locateLocal("tmp", "k9copy/k9" +palette); - QTextStream stream( paletteFile->file() ); + TQTextStream stream( paletteFile->file() ); for (j=0;j<16;j++) { l_track->getpalette(j,c); stream << c+"\n"; @@ -334,28 +334,28 @@ void k9DVDAuthor::addTitle(QDomElement &root, k9DVDTitle *title) { bool first=true; uint32_t chapterSize= (l_chap->getendSector()-l_chap->getstartSector())*DVD_VIDEO_LB_LEN; - QString sChapter,sCell; + TQString sChapter,sCell; for (k9ChapterCell *cell =l_chap->cells.first();cell ;cell =l_chap->cells.next() ) { icell++; - sCell = QString("--cell %1").arg(icell); - sChapter=QString("--chapter %1").arg(numPart); + sCell = TQString("--cell %1").tqarg(icell); + sChapter=TQString("--chapter %1").tqarg(numPart); //test uint32_t itotSize = (cell->getlastSector()-cell->getstartSector())* DVD_VIDEO_LB_LEN; - QString file; + TQString file; e=xml->createElement("vob"); - file=QString("k9copy --play --input %1 --dvdtitle %2 %3 %4 %5 %6 --vampsfactor %7 --inputsize %8 --chaptersize %9 ") - .arg(DVD->getDevice()) - .arg(title->getnumTitle()) - .arg(sChapter) - .arg(sCell) - .arg(caud) - .arg(csub) - .arg(titleFactor,0,'f',2) - .arg(itotSize,0,'f',0) - .arg(chapterSize,0,'f',0); + file=TQString("k9copy --play --input %1 --dvdtitle %2 %3 %4 %5 %6 --vampsfactor %7 --inputsize %8 --chaptersize %9 ") + .tqarg(DVD->getDevice()) + .tqarg(title->getnumTitle()) + .tqarg(sChapter) + .tqarg(sCell) + .tqarg(caud) + .tqarg(csub) + .tqarg(titleFactor,0,'f',2) + .tqarg(itotSize,0,'f',0) + .tqarg(chapterSize,0,'f',0); if (m_firsttitle) { file +=" --initstatus "; m_firsttitle=false; @@ -363,10 +363,10 @@ void k9DVDAuthor::addTitle(QDomElement &root, k9DVDTitle *title) { if (l_track->getforceFactor()) { file +=" --ffactor "; } - file +=QString(" --inject %1 --totalsize %2 --dvdsize %3 |") - .arg(inject) - .arg(m_totalSize -m_forced ,0,'f',0) - .arg(((uint64_t)k9DVDSize::getMaxSize() *1024 *1024) - m_forcedsh,0,'f',0); + file +=TQString(" --inject %1 --totalsize %2 --dvdsize %3 |") + .tqarg(inject) + .tqarg(m_totalSize -m_forced ,0,'f',0) + .tqarg(((uint64_t)k9DVDSize::getMaxSize() *1024 *1024) - m_forcedsh,0,'f',0); e.setAttribute("file",file); if (first) @@ -378,16 +378,16 @@ void k9DVDAuthor::addTitle(QDomElement &root, k9DVDTitle *title) { } } - QDomElement post = xml->createElement("post"); + TQDomElement post = xml->createElement("post"); pgc.appendChild(post); - QDomText postcmd=xml->createTextNode(""); + TQDomText postcmd=xml->createTextNode(""); k9DVDTitle * l_next=l_track->getnextTitle(); if (l_next!=NULL) { c.sprintf("g1=%d;\ncall vmgm menu;",DVD->getnewTitleNum(l_next)); if( DVD->getnewTitleNum(l_next)==-1) { error=true; - c=i18n("'%1' not selected").arg(l_next->getname()); + c=i18n("'%1' not selected").tqarg(l_next->getname()); KMessageBox::error( 0, c, tr2i18n("authoring")); } @@ -399,10 +399,10 @@ void k9DVDAuthor::addTitle(QDomElement &root, k9DVDTitle *title) { } -const QString& k9DVDAuthor::getworkDir() { +const TQString& k9DVDAuthor::getworkDir() { return workDir; } -void k9DVDAuthor::setworkDir( const QString& _newVal) { +void k9DVDAuthor::setworkDir( const TQString& _newVal) { workDir = _newVal; if (workDir.right(1)!='/') workDir +='/'; @@ -411,7 +411,7 @@ void k9DVDAuthor::setworkDir( const QString& _newVal) { void k9DVDAuthor::author() { if ( ! k9Tools::checkProgram("dvdauthor")) { - KMessageBox::error (qApp->mainWidget(),i18n("Unable to run %1").arg("dvdauthor") , i18n("authoring")); + KMessageBox::error (tqApp->mainWidget(),i18n("Unable to run %1").tqarg("dvdauthor") , i18n("authoring")); error = TRUE; return; } @@ -421,7 +421,7 @@ void k9DVDAuthor::author() { //nettoyage du répertoire de sortie k9Tools::clearOutput(workDir+"dvd"); - time = new QTime(0,0); + time = new TQTime(0,0); time->start(); progress->setTitle(i18n("Authoring")); @@ -441,14 +441,14 @@ void k9DVDAuthor::author() { //run dvdauthor if (!cancelled && !error) { - QString c("dvdauthor"); - proc=progress->getProcess();// new QProcess(c,0); + TQString c("dvdauthor"); + proc=progress->getProcess();// new TQProcess(c,0); *proc << c << "-x" << m_xml->name(); //locateLocal("tmp", "k9copy/k9author.xml"); - connect( proc, SIGNAL(receivedStderr(KProcess *, char *, int)), - this, SLOT(DVDAuthorStderr(KProcess *, char *, int )) ); - connect( proc, SIGNAL(receivedStdout(KProcess *, char *, int )), - this, SLOT(DVDAuthorStdout(KProcess *, char *, int)) ); - // connect(progress, SIGNAL(cancelled()), this, SLOT(stopProcess())); + connect( proc, TQT_SIGNAL(receivedStderr(KProcess *, char *, int)), + this, TQT_SLOT(DVDAuthorStderr(KProcess *, char *, int )) ); + connect( proc, TQT_SIGNAL(receivedStdout(KProcess *, char *, int )), + this, TQT_SLOT(DVDAuthorStdout(KProcess *, char *, int)) ); + // connect(progress, TQT_SIGNAL(cancelled()), this, TQT_SLOT(stopProcess())); m_copied=0; m_lastPos=0; @@ -465,7 +465,7 @@ void k9DVDAuthor::author() { burnOk=true; } else { if (cancelled) { - //QMessageBox::critical( 0, tr2i18n("authoring"), tr2i18n("Authoring canceled")); + //TQMessageBox::critical( 0, tr2i18n("authoring"), tr2i18n("Authoring canceled")); KMessageBox::error( 0, tr2i18n("Authoring cancelled"),tr2i18n("authoring")); } else @@ -490,29 +490,29 @@ void k9DVDAuthor::author() { /** No descriptions */ void k9DVDAuthor::DVDAuthorStderr(KProcess *proc, char *buffer, int buflen ) { - //QString m_stderr(proc->readStderr()); - QString m_stderr=QString::fromLatin1(buffer, buflen); + //TQString m_stderr(proc->readStderr()); + TQString m_stderr=TQString::tqfromLatin1(buffer, buflen); float m_percent; - QString m_remain; + TQString m_remain; - int pos=m_stderr.find("INFOPOS:"); + int pos=m_stderr.tqfind("INFOPOS:"); if (pos!=-1) { progress->setTitle(i18n("Authoring")); - QString tmp=m_stderr.mid(pos); + TQString tmp=m_stderr.mid(pos); uint32_t totalBytes,totalSize; sscanf(tmp.latin1(),"INFOPOS: %d %d",&totalBytes,&totalSize); //if (totalBytes>m_lastPos) // m_copied+=totalBytes - m_lastPos; m_copied=totalBytes; m_lastPos=totalBytes; - //qDebug(QString("copied : %1 totalSize : %2").arg(m_copied).arg(m_totalSize*512)); + //qDebug(TQString("copied : %1 totalSize : %2").tqarg(m_copied).tqarg(m_totalSize*512)); m_percent=(float)m_copied / (float)(m_totalSize/DVD_VIDEO_LB_LEN ); - QTime time2(0,0); + TQTime time2(0,0); time2=time2.addMSecs(time->elapsed()); if (m_percent>0) { - QTime time3(0,0); + TQTime time3(0,0); time3=time3.addMSecs((uint32_t)(time->elapsed()*(1/m_percent))); m_remain=time3.toString("hh:mm:ss"); } @@ -532,12 +532,12 @@ void k9DVDAuthor::DVDAuthorStderr(KProcess *proc, char *buffer, int buflen ) { int end; lastMsg=m_stderr; - if (m_stderr.contains("STAT:")) { - pos=m_stderr.find("fixing VOBU"); + if (m_stderr.tqcontains("STAT:")) { + pos=m_stderr.tqfind("fixing VOBU"); if (pos!=-1) { progress->setTitle(i18n("Authoring")); progress->setLabelText(i18n("Fixing VOBUS")); - end=m_stderr.find("%"); + end=m_stderr.tqfind("%"); if (end!=-1) { pos =end -2; m_stderr=m_stderr.mid(pos,end-pos); @@ -548,7 +548,7 @@ void k9DVDAuthor::DVDAuthorStderr(KProcess *proc, char *buffer, int buflen ) { } } - pos=m_stderr.find("INFOIMAGE:"); + pos=m_stderr.tqfind("INFOIMAGE:"); if (pos!=-1) { progress->setImage(m_stderr.mid(pos+10)); } @@ -558,14 +558,14 @@ void k9DVDAuthor::DVDAuthorStderr(KProcess *proc, char *buffer, int buflen ) { } void k9DVDAuthor::DVDAuthorStdout(KProcess *proc, char *buffer, int buflen) { - QString c=QString::fromLatin1( buffer,buflen); + TQString c=TQString::tqfromLatin1( buffer,buflen); //(proc->readStdout()); int pos; - pos=c.find("STAT"); + pos=c.tqfind("STAT"); if (pos!=-1) { c=c.mid(pos); progress->setLabelText(c); - qApp->processEvents(); + tqApp->processEvents(); } } |