Added program arguments to print labels in console mode

git-svn-id: https://svn.code.sf.net/p/qlscribe/svn/trunk@65 cac9541e-1b8d-4bfa-827e-589bba606050
This commit is contained in:
ruglory
2009-02-16 00:56:11 +00:00
parent 86d1abdfbd
commit 9b15a68c99
16 changed files with 277 additions and 32 deletions
+50
View File
@@ -0,0 +1,50 @@
#include "qconsoleprintprogress.h"
#include "qlightscribe.h"
#include <QApplication>
#include <iostream>
QConsolePrintProgress::QConsolePrintProgress()
{
QLightScribe *scribe = QLightScribe::instance();
connect( scribe, SIGNAL(prepareProgress(long,long)), this, SLOT(onPrepareProgress(long,long)) );
connect( scribe, SIGNAL(labelProgress(long,long)), this, SLOT(onLabelProgress(long,long)) );
connect( scribe, SIGNAL(timeEstimate(long)), this, SLOT(onTimeEstimate(long)) );
connect( scribe, SIGNAL(finished(int)), this, SLOT(onFinished(int)) );
}
QConsolePrintProgress::~QConsolePrintProgress()
{
}
void QConsolePrintProgress::onPrepareProgress( long current, long final )
{
std::cout << "Preparing label: " << current << '/' << final << " \r";
}
void QConsolePrintProgress::onLabelProgress( long current, long final )
{
std::cout << "Printing label: " << current << '/' << final << " \r";
}
void QConsolePrintProgress::onTimeEstimate( long time )
{
std::cout << std::endl;
}
void QConsolePrintProgress::onFinished( int status )
{
std::cout << "\n";
if( !status )
std::cout << "Print successfull" << std::endl;
else
std::cout << "Prin failed: 0x" << QString::number( status, 16 ) << std::endl;
QLightScribe *scribe = QLightScribe::instance();
scribe->stopThread();
scribe->wait( 1000 );
qApp->exit( status );
}