diff --git a/src/qconsoleprintprogress.cpp b/src/qconsoleprintprogress.cpp index 4de70f1..df09a6c 100644 --- a/src/qconsoleprintprogress.cpp +++ b/src/qconsoleprintprogress.cpp @@ -10,9 +10,9 @@ std::ostream &operator<<( std::ostream &os, const QString &str ); QConsolePrintProgress::QConsolePrintProgress( QLightDrive *drive ) : m_drive( drive ) { - connect( drive, SIGNAL(prepareProgress(long,long)), this, SLOT(onPrepareProgress(long,long)) ); - connect( drive, SIGNAL(labelProgress(long,long)), this, SLOT(onLabelProgress(long,long)) ); - connect( drive, SIGNAL(timeEstimate(long)), this, SLOT(onTimeEstimate(long)) ); + connect( drive, SIGNAL(prepareProgress(int,int)), this, SLOT(onPrepareProgress(int,int)) ); + connect( drive, SIGNAL(labelProgress(int,int)), this, SLOT(onLabelProgress(int,int)) ); + connect( drive, SIGNAL(timeEstimate(int)), this, SLOT(onTimeEstimate(int)) ); connect( drive, SIGNAL(finished(int)), this, SLOT(onFinished(int)) ); } @@ -21,17 +21,17 @@ QConsolePrintProgress::~QConsolePrintProgress() { } -void QConsolePrintProgress::onPrepareProgress( long current, long final ) +void QConsolePrintProgress::onPrepareProgress( int current, int final ) { std::cout << "Preparing label: " << current << '/' << final << " \r"; } -void QConsolePrintProgress::onLabelProgress( long current, long final ) +void QConsolePrintProgress::onLabelProgress( int current, int final ) { std::cout << "Printing label: " << current << '/' << final << " \r"; } -void QConsolePrintProgress::onTimeEstimate( long time ) +void QConsolePrintProgress::onTimeEstimate( int time ) { std::cout << std::endl; } diff --git a/src/qconsoleprintprogress.h b/src/qconsoleprintprogress.h index acc578c..52f41d6 100644 --- a/src/qconsoleprintprogress.h +++ b/src/qconsoleprintprogress.h @@ -12,9 +12,9 @@ public: ~QConsolePrintProgress(); private slots: - void onPrepareProgress( long current, long final ); - void onLabelProgress( long current, long final ); - void onTimeEstimate( long time ); + void onPrepareProgress( int current, int final ); + void onLabelProgress( int current, int final ); + void onTimeEstimate( int time ); void onFinished(int status ); private: diff --git a/src/qdialogprogress.cpp b/src/qdialogprogress.cpp index d416204..b0f843e 100644 --- a/src/qdialogprogress.cpp +++ b/src/qdialogprogress.cpp @@ -73,9 +73,9 @@ bool QDialogProgress::exec( QWidget *parent, QCDScene *scene ) dialog.setWindowTitle( tr( "Printing: " ) + scene->name() ); connect( dialog.m_ui->buttonBox, SIGNAL(clicked(QAbstractButton*)), &dialog, SLOT(onButtonClicked(QAbstractButton*)) ); - connect( drive, SIGNAL(prepareProgress(long,long)), &dialog, SLOT(onPrepareProgress(long,long)) ); - connect( drive, SIGNAL(labelProgress(long,long)), &dialog, SLOT(onLabelProgress(long,long)) ); - connect( drive, SIGNAL(timeEstimate(long)), &dialog, SLOT(onTimeEstimate(long)) ); + connect( drive, SIGNAL(prepareProgress(int,int)), &dialog, SLOT(onPrepareProgress(int,int)) ); + connect( drive, SIGNAL(labelProgress(int,int)), &dialog, SLOT(onLabelProgress(int,int)) ); + connect( drive, SIGNAL(timeEstimate(int)), &dialog, SLOT(onTimeEstimate(int)) ); connect( drive, SIGNAL(finished(int)), &dialog, SLOT(onFinished(int)) ); drive->print( params, scene ); @@ -98,13 +98,13 @@ void QDialogProgress::onButtonClicked( QAbstractButton *button ) done( 0 ); } -void QDialogProgress::onPrepareProgress( long current, long final ) +void QDialogProgress::onPrepareProgress( int current, int final ) { m_ui->progressPreparation->setMaximum( final ); m_ui->progressPreparation->setValue( current ); } -void QDialogProgress::onLabelProgress( long current, long final ) +void QDialogProgress::onLabelProgress( int current, int final ) { m_ui->progressPrinting->setMaximum( final ); m_ui->progressPrinting->setValue( current ); @@ -116,7 +116,7 @@ void QDialogProgress::onLabelProgress( long current, long final ) } } -void QDialogProgress::onTimeEstimate( long time ) +void QDialogProgress::onTimeEstimate( int time ) { m_ui->timeEstimated->setTime( QTime().addSecs( time ) ); } diff --git a/src/qdialogprogress.h b/src/qdialogprogress.h index fdefcef..ccf15c5 100644 --- a/src/qdialogprogress.h +++ b/src/qdialogprogress.h @@ -41,9 +41,9 @@ public: protected slots: void onButtonClicked( QAbstractButton* button ); - void onPrepareProgress( long current, long final ); - void onLabelProgress( long current, long final ); - void onTimeEstimate( long time ); + void onPrepareProgress( int current, int final ); + void onLabelProgress( int current, int final ); + void onTimeEstimate( int time ); void onFinished(int status ); void onTimeout(); diff --git a/src/qlightscribe.cpp b/src/qlightscribe.cpp index 267ff99..0c43abb 100644 --- a/src/qlightscribe.cpp +++ b/src/qlightscribe.cpp @@ -31,6 +31,28 @@ //#include //using namespace LightScribe; +// Marshall the PrintParameters data into a D-BUS argument + QDBusArgument &operator<<( QDBusArgument &argument, const PrintParameters &p ) + { + argument.beginStructure(); + argument << p.m_labelMode << p.m_drawOptions << p.m_printQuality << p.m_mediaOptimizationLevel; + argument.endStructure(); + return argument; + } + + // Retrieve the PrintProperties data from the D-BUS argument + const QDBusArgument &operator>>( const QDBusArgument &argument, PrintParameters &p ) + { + argument.beginStructure(); + int drawOptions = 0, labelMode = 0, mediaOptimizationLevel = 0, printQuality = 0; + argument >> labelMode >> drawOptions >> printQuality >> mediaOptimizationLevel; + argument.endStructure(); + p = PrintParameters( LabelMode( labelMode ), + DrawOptions( drawOptions ), + PrintQuality( printQuality ), + MediaOptimizationLevel( mediaOptimizationLevel ) ); + return argument; + } QLightScribe *QLightScribe::instance() { @@ -41,6 +63,8 @@ QLightScribe *QLightScribe::instance() QLightScribe::QLightScribe() : m_managerPrx( new OrgLightscribePrintManagerInterface( DBusServiceName, DBusManagerPath, QDBusConnection::systemBus(), this ) ) { + qDBusRegisterMetaType(); + qDBusRegisterMetaType(); } QLightScribe::~QLightScribe() @@ -69,9 +93,9 @@ QLightDrive::QLightDrive( QObject *parent, const QString &path, const QString &n m_path( path ) { connect( m_drivePrx, SIGNAL(finished(int)), this, SIGNAL(finished(int)) ); - connect( m_drivePrx, SIGNAL(prepareProgress( long, long )), this, SIGNAL(prepareProgress( long, long )) ); - connect( m_drivePrx, SIGNAL(labelProgress( long , long )), this, SIGNAL(labelProgress( long , long )) ); - connect( m_drivePrx, SIGNAL(timeEstimate( long )), this, SIGNAL(timeEstimate( long )) ); + connect( m_drivePrx, SIGNAL(prepareProgress( int, int )), this, SIGNAL(prepareProgress( int, int )) ); + connect( m_drivePrx, SIGNAL(labelProgress( int , int )), this, SIGNAL(labelProgress( int, int )) ); + connect( m_drivePrx, SIGNAL(timeEstimate( int )), this, SIGNAL(timeEstimate( int )) ); } static diff --git a/src/qlightscribe.h b/src/qlightscribe.h index 11fff3f..c76d887 100644 --- a/src/qlightscribe.h +++ b/src/qlightscribe.h @@ -44,10 +44,10 @@ struct PrintParameters { m_printQuality( printQuality ), m_mediaOptimizationLevel( mediaOptimizationLevel ) {} }; -Q_DECLARE_METATYPE(PrintParameters); +Q_DECLARE_METATYPE( PrintParameters ); typedef QMap QObject2StringMap; -Q_DECLARE_METATYPE(QObject2StringMap); +Q_DECLARE_METATYPE( QObject2StringMap ); class OrgLightscribePrintManagerInterface; @@ -88,9 +88,9 @@ public slots: void abort(); signals: - void prepareProgress( long current, long final ); - void labelProgress( long current, long final ); - void timeEstimate( long time ); + void prepareProgress( int current, int final ); + void labelProgress( int current, int final ); + void timeEstimate( int time ); void finished( int status ); private: