[k3b] Using libk3b to burn an ISO

Sebastian Trüg trueg at k3b.org
Thu Aug 9 07:40:38 UTC 2012


Some comments below.

On 08/07/2012 11:35 PM, Anant Kamath wrote:
> Hi,
>
> I'm trying to use libk3b for burning an ISO file :
>
> Here is the portion of code that I'm using (after creating a
> Kapplication object) :
>
> --------------------------------------------------------------------------
>      QString imageFile = "/home/anant/test.iso";
>      K3b::Core *c = new K3b::Core;
>      qDebug()<<k3bcore;
>      c->init();
>      K3b::Device::DeviceManager* manager = new
> K3b::Device::DeviceManager( &app );

K3bCore does create the devicemanager for you.

>      manager->scanBus();

core->init() also performs the scanBus.
Just access the device manager via K3bCore::deviceManager()

>      K3b::Device::Device* dev = manager->cdWriter().at( 0 );
>      qDebug()<< dev->vendor();
>
>      K3b::SimpleJobHandler* hdl = new K3b::SimpleJobHandler ( &app );

This handler is not enough. My plan always was to make libk3b provide 
everything you need but I never finished that idea. So you need to 
implement the methods in there. You can use k3bjobprogressdialog.cpp and 
k3bemptydiscwaiter.cpp as input. I suppose you could copy most of the 
code from the waitForMedium() method (which is the one you need).

>      K3b::Iso9660ImageWritingJob* job = new K3b::Iso9660ImageWritingJob(
> hdl );
>
>       job->setBurnDevice( dev );
>       job->setSpeed( 0 ); //Auto
>       job->setSimulate( 0 );
>       job->setVerifyData( 0 );
>       job->setNoFix( 0 ); // No multisession
>       job->setDataMode( K3b::DataModeAuto );
>       job->setImagePath( imageFile );
>       job->setCopies( 1 );
>       job->setWritingApp( K3b::WritingAppAuto );
>
>      qDebug()<<job;
>      job->start();

This is all correct. But you should write a simple feedback class which 
connects to the status signals from the job. That way you get error 
messages and the like. In the K3b application the K3bJobProgressDialog 
also does this.

Hope this helps.
Please feel free to come back with more questions.

Also I think that K3b could use man-power... so if you are interested in 
improving libk3b yourself....

Cheers,
Sebastian

> ---------------------------------------------------------------------------------
>
> The problem is that, I get no errors while compiling or running this
> code, but the job just doesn't seem to start. (i.e. I'm inserting a
> blank CD but no disk is burned when this code is run. ).
>
> Are the steps that I' m following to create & run the iso burning job
> correct ?
>
> Would really appreciate any help.
>
> Regards,
> Anant Kamath
>
>


More information about the k3b mailing list