summaryrefslogtreecommitdiffstats
path: root/k9author/k9newdvd.cpp
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-05-27 23:37:00 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-05-27 23:37:00 +0000
commitb0e912c8b3d02a518fedda28c3180eb4794a7520 (patch)
tree07d344862562fab58cbe2df39d13d16f2e4d2bea /k9author/k9newdvd.cpp
parent4d695ec81fe4d4335ee82c7a9346ad9c9e144ecc (diff)
downloadk9copy-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 'k9author/k9newdvd.cpp')
-rw-r--r--k9author/k9newdvd.cpp154
1 files changed, 77 insertions, 77 deletions
diff --git a/k9author/k9newdvd.cpp b/k9author/k9newdvd.cpp
index 7cc73bd..3fa8c5b 100644
--- a/k9author/k9newdvd.cpp
+++ b/k9author/k9newdvd.cpp
@@ -12,24 +12,24 @@
#include "k9newdvd.h"
#include "k9title.h"
#include "k9tools.h"
-#include <qfile.h>
+#include <tqfile.h>
#include <stdio.h>
-#include <qtextstream.h>
+#include <tqtextstream.h>
#include <kstandarddirs.h>
-#include <qapplication.h>
+#include <tqapplication.h>
#include <ktempfile.h>
#include <kapplication.h>
#include <klocale.h>
-#include <qimage.h>
+#include <tqimage.h>
#include <kmessagebox.h>
#include "k9menu.h"
#include "k9menubutton.h"
#include "k9processlist.h"
-#include <qthread.h>
-#include <qfileinfo.h>
+#include <tqthread.h>
+#include <tqfileinfo.h>
-k9NewDVD::k9NewDVD(QObject *parent, const char *name)
- : QObject(parent, name) {
+k9NewDVD::k9NewDVD(TQObject *tqparent, const char *name)
+ : TQObject(tqparent, name) {
m_workDir=locateLocal("tmp", "k9copy/" ) ;
m_rootMenu=new k9Menu(this);
m_format=PAL;
@@ -38,7 +38,7 @@ k9NewDVD::k9NewDVD(QObject *parent, const char *name)
k9NewDVD::~k9NewDVD() {}
-int k9NewDVDItems::compareItems(QPtrCollection::Item item1,QPtrCollection::Item item2) {
+int k9NewDVDItems::compareItems(TQPtrCollection::Item item1,TQPtrCollection::Item item2) {
k9Title *_i1=(k9Title*) item1;
k9Title *_i2=(k9Title*) item2;
@@ -51,19 +51,19 @@ void k9NewDVD::execute() {
m_cancel=false;
m_error="";
m_config=new k9Config();
- // connect(m_process, SIGNAL(receivedStderr(KProcess *, char *, int)),this, SLOT(getStderr(KProcess *, char *, int) ));
+ // connect(m_process, TQT_SIGNAL(receivedStderr(KProcess *, char *, int)),this, TQT_SLOT(getStderr(KProcess *, char *, int) ));
- connect(&m_aviDecode,SIGNAL(drawFrame(QImage*)),this,SLOT(drawImage(QImage*)));
+ connect(&m_aviDecode,TQT_SIGNAL(drawFrame(TQImage*)),this,TQT_SLOT(drawImage(TQImage*)));
k9Tools::clearOutput(m_workDir+"dvd");
createXML();
- disconnect(&m_aviDecode,SIGNAL(drawFrame(QImage*)),this,SLOT(drawImage(QImage*)));
+ disconnect(&m_aviDecode,TQT_SIGNAL(drawFrame(TQImage*)),this,TQT_SLOT(drawImage(TQImage*)));
delete m_config;
}
#include "k9newdvd.moc"
-void k9NewDVD::drawImage(QImage * _image) {
+void k9NewDVD::drawImage(TQImage * _image) {
// m_progress->setImage(*_image);
}
@@ -80,16 +80,16 @@ void k9NewDVD::createXML() {
m_rootMenu->setWorkDir(m_workDir);
- QString menuFileName=m_workDir+KApplication::randomString(8)+".mpg";
+ TQString menuFileName=m_workDir+KApplication::randomString(8)+".mpg";
m_rootMenu->setMenuFileName(menuFileName);
- m_xml=new QDomDocument();
- QDomElement root = m_xml->createElement( "dvdauthor" );
+ m_xml=new TQDomDocument();
+ TQDomElement root = m_xml->createElement( "dvdauthor" );
root.setAttribute ("dest",m_workDir+"dvd");
m_xml->appendChild( root );
// Create vmgm menu
- QDomElement vmgm = m_xml->createElement("vmgm");
+ TQDomElement vmgm = m_xml->createElement("vmgm");
root.appendChild(vmgm);
m_processList->addProgress(i18n("Creating root menu"));
m_rootMenu->createMenus(&vmgm);
@@ -99,10 +99,10 @@ void k9NewDVD::createXML() {
m_totalEncodedSize=0;
m_offset=0;
m_lastvalue=0;
- for ( QStringList::Iterator it = m_tmpFiles.begin(); it != m_tmpFiles.end(); ++it ) {
- QString file= *it;
+ for ( TQStringList::Iterator it = m_tmpFiles.begin(); it != m_tmpFiles.end(); ++it ) {
+ TQString file= *it;
if (file.endsWith(".mpeg")) {
- QFileInfo f(file);
+ TQFileInfo f(file);
m_totalEncodedSize+=f.size();
}
}
@@ -110,17 +110,17 @@ void k9NewDVD::createXML() {
m_cancel=m_processList->getCancel();
bool error=false;
if (!m_cancel) {
- QString dvdAuthor(m_workDir+"/"+KApplication::randomString(8)+".xml");
- QFile file( dvdAuthor);
+ TQString dvdAuthor(m_workDir+"/"+KApplication::randomString(8)+".xml");
+ TQFile file( dvdAuthor);
file.open(IO_WriteOnly);
- QTextStream stream( &file );
+ TQTextStream stream( &file );
m_xml->save(stream,1);
file.close();
m_processList->clear();
k9Process *process=m_processList->addProcess(i18n("authoring"));
- connect(process, SIGNAL(receivedStderr(KProcess *, char *, int)),this, SLOT(getStderr(KProcess *, char *, int) ));
+ connect(process, TQT_SIGNAL(receivedStderr(KProcess *, char *, int)),this, TQT_SLOT(getStderr(KProcess *, char *, int) ));
*process << "dvdauthor" << "-x" << dvdAuthor;
m_processList->execute();
m_cancel=m_processList->getCancel();
@@ -134,9 +134,9 @@ void k9NewDVD::createXML() {
m_error=i18n("The dvd authoring was canceled");
else if (error)
m_error=i18n("An error occured while running DVDAuthor:\n")+ m_stdout;
- QFile::remove(menuFileName);
- for ( QStringList::Iterator it = m_tmpFiles.begin(); it != m_tmpFiles.end(); ++it ) {
- QFile::remove(*it);
+ TQFile::remove(menuFileName);
+ for ( TQStringList::Iterator it = m_tmpFiles.begin(); it != m_tmpFiles.end(); ++it ) {
+ TQFile::remove(*it);
}
m_tmpFiles.clear();
if (m_error !="") {
@@ -146,23 +146,23 @@ void k9NewDVD::createXML() {
}
-void k9NewDVD::addTitles (QDomElement &_root) {
+void k9NewDVD::addTitles (TQDomElement &_root) {
calcVideoBitrate();
for (k9Title *title=m_titles.first();title && !m_cancel;title=m_titles.next()) {
- QDomElement titleSet = m_xml->createElement("titleset");
+ TQDomElement titleSet = m_xml->createElement("titleset");
_root.appendChild(titleSet);
- QDomElement pgc;
+ TQDomElement pgc;
k9Menu *menu=title->getMenu();
menu->setWorkDir(m_workDir);
- QString menuFileName=m_workDir+KApplication::randomString(8)+".mpg";
+ TQString menuFileName=m_workDir+KApplication::randomString(8)+".mpg";
m_tmpFiles << menuFileName,
menu->setMenuFileName(menuFileName);
- m_processList->addProgress(i18n("Creating menu for title %1").arg(title->getNum()+1));
+ m_processList->addProgress(i18n("Creating menu for title %1").tqarg(title->getNum()+1));
menu->createMenus(&titleSet);
- QDomElement eTitle=m_xml->createElement("titles");
+ TQDomElement eTitle=m_xml->createElement("titles");
titleSet.appendChild(eTitle);
- QDomElement e=m_xml->createElement("video");
+ TQDomElement e=m_xml->createElement("video");
e.setAttribute("aspect","16:9");
e.setAttribute("format",m_format==PAL?"PAL":"NTSC");
// if (l_track->getaspectRatio()!="4:3") {
@@ -177,15 +177,15 @@ void k9NewDVD::addTitles (QDomElement &_root) {
pgc=m_xml->createElement("pgc");
eTitle.appendChild(pgc);
- QDomElement post=m_xml->createElement("post");
+ TQDomElement post=m_xml->createElement("post");
pgc.appendChild(post);
- QDomText txt=m_xml->createTextNode(title->getMenu()->getEndScript());
+ TQDomText txt=m_xml->createTextNode(title->getMenu()->getEndScript());
post.appendChild(txt);
- QPtrList <k9AviFile > *l=title->getFiles();
+ TQPtrList <k9AviFile > *l=title->getFiles();
for (k9AviFile *aviFile= l->first();aviFile && !m_cancel;aviFile=l->next()) {
if ( aviFile->getPrevious()==NULL || aviFile->getBreakPrevious()) {
- QString cmd="",chapters="";
+ TQString cmd="",chapters="";
createMencoderCmd(cmd,chapters,aviFile);
e=m_xml->createElement("vob");
e.setAttribute("file",cmd);
@@ -198,18 +198,18 @@ void k9NewDVD::addTitles (QDomElement &_root) {
}
-void k9NewDVD::setWorkDir ( const QString& _value ) {
+void k9NewDVD::setWorkDir ( const TQString& _value ) {
m_workDir = _value;
if (!m_workDir.endsWith("/"))
m_workDir +="/";
}
-void k9NewDVD::createMencoderCmd(QString &_cmd,QString &_chapters, k9AviFile *_aviFile) {
+void k9NewDVD::createMencoderCmd(TQString &_cmd,TQString &_chapters, k9AviFile *_aviFile) {
// m_aviDecode.open(_aviFile->getFileName());
m_timer.start();
m_timer2.start();
m_timer3.start();
- QTime end;
+ TQTime end;
k9AviFile *file=_aviFile;
bool bEnd;
_chapters="0";
@@ -219,20 +219,20 @@ void k9NewDVD::createMencoderCmd(QString &_cmd,QString &_chapters, k9AviFile *_a
file=file->getNext();
if (!bEnd) {
int lt=_aviFile->getStart().msecsTo(end);
- QTime t;
+ TQTime t;
t=t.addMSecs(lt);
_chapters +="," + t.toString("hh:mm:ss");
}
} while (!bEnd);
- QString fileName= m_workDir + KApplication::randomString(8)+".mpeg";
- QString t1=_aviFile->getStart().toString("hh:mm:ss.zzz");
+ TQString fileName= m_workDir + KApplication::randomString(8)+".mpeg";
+ TQString t1=_aviFile->getStart().toString("hh:mm:ss.zzz");
int length=_aviFile->getStart().msecsTo(end);
- QTime l;
+ TQTime l;
l=l.addMSecs(length);
- QString t2=l.toString("hh:mm:ss.zzz");
- QString scale;
- QString fps;
+ TQString t2=l.toString("hh:mm:ss.zzz");
+ TQString scale;
+ TQString fps;
switch (m_format) {
case PAL:
scale="720:576";
@@ -244,18 +244,18 @@ void k9NewDVD::createMencoderCmd(QString &_cmd,QString &_chapters, k9AviFile *_a
break;
}
- k9Process *process=m_processList->addProcess(i18n("Encoding %1").arg(_aviFile->getFileName()));
+ k9Process *process=m_processList->addProcess(i18n("Encoding %1").tqarg(_aviFile->getFileName()));
m_processList->setFileName(process,_aviFile->getFileName());
- QTime t(0,0);
+ TQTime t(0,0);
t.start();
m_timers[process]=t;
- connect(process, SIGNAL(receivedStdout(KProcess *, char *, int)),this, SLOT(getStdout(KProcess *, char *, int) ));
+ connect(process, TQT_SIGNAL(receivedStdout(KProcess *, char *, int)),this, TQT_SLOT(getStdout(KProcess *, char *, int) ));
//m_progress->setTitle(i18n("Encoding file"));
//m_process->clearArguments();
*process << "mencoder" << "-oac" << "lavc" << "-ovc" << "lavc" << "-of" << "mpeg" <<"-afm" <<"libmad";
*process << "-mpegopts" << "format=dvd" << "-vf" << "scale="+scale+",harddup" << "-srate" << "48000" << "-af" << "lavcresample=48000";
- *process << "-lavcopts" << QString("vcodec=mpeg2video:vrc_buf_size=1835:vrc_maxrate=9800:vbitrate=%1:keyint=15:acodec=%3:abitrate=%2:aspect=16/9").arg(m_videoBitrate).arg(m_config->getPrefAudioBitrate()).arg(m_config->getPrefAudioFormat().lower());
+ *process << "-lavcopts" << TQString("vcodec=mpeg2video:vrc_buf_size=1835:vrc_maxrate=9800:vbitrate=%1:keyint=15:acodec=%3:abitrate=%2:aspect=16/9").tqarg(m_videoBitrate).tqarg(m_config->getPrefAudioBitrate()).tqarg(m_config->getPrefAudioFormat().lower());
*process << "-ofps" << fps << "-o" << fileName << "-ss" << t1 << "-endpos" << t2 << _aviFile->getFileName();
qDebug(process->debug());
/*
@@ -273,16 +273,16 @@ void k9NewDVD::createMencoderCmd(QString &_cmd,QString &_chapters, k9AviFile *_a
}
void k9NewDVD::getStderr(KProcess *_process, char *_buffer, int _length) {
- QCString tmp(_buffer,_length);
+ TQCString tmp(_buffer,_length);
m_stdout=tmp;
int pos;
- if (tmp.contains("STAT:")) {
- pos=tmp.find("fixing VOBU");
+ if (tmp.tqcontains("STAT:")) {
+ pos=tmp.tqfind("fixing VOBU");
if (pos!=-1) {
- QString tmp2=tmp;
+ TQString tmp2=tmp;
// m_progress->setTitle(i18n("Authoring"));
// m_progress->setLabelText(i18n("Fixing VOBUS"));
- int end=tmp2.find("%");
+ int end=tmp2.tqfind("%");
if (end!=-1) {
pos =end -2;
tmp2=tmp2.mid(pos,end-pos);
@@ -290,9 +290,9 @@ void k9NewDVD::getStderr(KProcess *_process, char *_buffer, int _length) {
// m_progress->setProgress(tmp2.toInt(),100);
}
} else {
- pos=tmp.find("STAT: VOBU ");
+ pos=tmp.tqfind("STAT: VOBU ");
if (pos !=-1) {
- QCString tmp2(_buffer+pos,_length-pos);
+ TQCString tmp2(_buffer+pos,_length-pos);
int vobu,mb;
sscanf(tmp2.data(),"STAT: VOBU %d at %dMB",&vobu,&mb);
if (mb <m_lastvalue)
@@ -311,12 +311,12 @@ void k9NewDVD::getStderr(KProcess *_process, char *_buffer, int _length) {
void k9NewDVD::getStdout(KProcess *_process, char *_buffer, int _length) {
k9Process *process=(k9Process*) _process;
if (m_timers[process].elapsed() >500) {
- QCString tmp(_buffer,_length);
- int pos=tmp.find("Pos:");
+ TQCString tmp(_buffer,_length);
+ int pos=tmp.tqfind("Pos:");
if (pos!=-1) {
- QString tmp2=tmp.mid(pos);
- tmp2=tmp2.replace(":",": ").replace("(","").replace(")","").simplifyWhiteSpace();
- QStringList sl=QStringList::split(" ",tmp2);
+ TQString tmp2=tmp.mid(pos);
+ tmp2=tmp2.tqreplace(":",": ").tqreplace("(","").tqreplace(")","").simplifyWhiteSpace();
+ TQStringList sl=TQStringList::split(" ",tmp2);
float position;
sscanf(sl[1].latin1(),"%fs",&position);
int frame;
@@ -331,17 +331,17 @@ void k9NewDVD::getStdout(KProcess *_process, char *_buffer, int _length) {
// if (percent>0 &&m_timer3.elapsed() >1000 ) {
if (percent>0 ) {
int elapsed=process->getElapsed();
- QTime time2(0,0);
+ TQTime time2(0,0);
time2=time2.addMSecs(elapsed);
- QTime time3(0,0);
+ TQTime time3(0,0);
float fprc=percent/100.0;
time3=time3.addMSecs((uint32_t)(elapsed*(1.0/fprc)));
m_processList->setText(process,time2.toString("hh:mm:ss") +" / " + time3.toString("hh:mm:ss"),1);
m_timer3.restart();
}
- QString text;//=i18n("filename") + " : " + m_aviDecode.getFileName();
- text=i18n("fps")+ " : "+QString::number(fps);
+ TQString text;//=i18n("filename") + " : " + m_aviDecode.getFileName();
+ text=i18n("fps")+ " : "+TQString::number(fps);
m_processList->setText(process,text,2);
/*
m_progress->setLabelText(text);
@@ -365,9 +365,9 @@ void k9NewDVD::appendTitle(k9Title *_title) {
k9MenuButton *btn=m_rootMenu->addButton();
_title->setButton(btn);
btn->setNum(_title->getNum()+1);
- QPixmap px(m_config->getPrefButtonWidth(),m_config->getPrefButtonHeight());
- px.fill(Qt::black);
- QImage img=px.convertToImage();
+ TQPixmap px(m_config->getPrefButtonWidth(),m_config->getPrefButtonHeight());
+ px.fill(TQt::black);
+ TQImage img=px.convertToImage();
btn->setImage(img);
int nbColumn=(720-50)/(m_config->getPrefButtonWidth()+50);
int top=(int) _title->getNum()/nbColumn ;
@@ -376,15 +376,15 @@ void k9NewDVD::appendTitle(k9Title *_title) {
btn->setLeft(left*(m_config->getPrefButtonWidth()+50) +50);
btn->setWidth(m_config->getPrefButtonWidth());
btn->setHeight(m_config->getPrefButtonHeight());
- btn->setScript(QString("g1=0;jump titleset %1 menu;").arg(_title->getNum()+1));
+ btn->setScript(TQString("g1=0;jump titleset %1 menu;").tqarg(_title->getNum()+1));
btn->setTextPosition(k9MenuButton::RIGHT);
- btn->setText(i18n("title %1").arg(_title->getNum()+1));
+ btn->setText(i18n("title %1").tqarg(_title->getNum()+1));
btn->setColor(m_config->getPrefButtonTextColor());
btn->setFont(m_config->getPrefButtonFont());
- QString script="\n";
+ TQString script="\n";
for (k9Title *t = m_titles.first();t;t=m_titles.next()) {
- script +=QString("if (g6== %1) { g6=0; jump titleset %2 menu;}\n").arg(t->getNum()+1).arg(t->getNum()+1);
+ script +=TQString("if (g6== %1) { g6=0; jump titleset %2 menu;}\n").tqarg(t->getNum()+1).tqarg(t->getNum()+1);
}
m_rootMenu->setStartScript2(script);
emit sigAddTitle();
@@ -420,7 +420,7 @@ void k9NewDVD::calcVideoBitrate() {
double sec=(double)length/1000.0;
// m_videoBitrate=(int)( (size * 8388.608)/sec - 192);
m_videoBitrate=8*((size*1024 - (m_config->getPrefAudioBitrate() * sec/8))/sec);
- m_videoBitrate=QMIN(m_videoBitrate,9800);
+ m_videoBitrate=TQMIN(m_videoBitrate,9800);
}
int k9NewDVD::getTotalTime() {
@@ -434,6 +434,6 @@ int k9NewDVD::getTotalTime() {
return total;
}
-QString k9NewDVD::getError() const {
+TQString k9NewDVD::getError() const {
return m_error;
}