From 733d7e29c3baa21ccb05232b47ac92e6ff7c69d8 Mon Sep 17 00:00:00 2001 From: ruglory Date: Sun, 22 Feb 2009 06:36:38 +0000 Subject: [PATCH] QConsolePrintProgress fixed to connect to drive git-svn-id: https://svn.code.sf.net/p/qlscribe/svn/trunk@82 cac9541e-1b8d-4bfa-827e-589bba606050 --- src/main.cpp | 6 ++++-- src/qconsoleprintprogress.cpp | 13 ++++++------- src/qconsoleprintprogress.h | 7 ++++++- 3 files changed, 16 insertions(+), 10 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index c539681..e624c10 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -126,9 +126,11 @@ int main( int argc, char **argv ) std::cerr << "Error: drive " << driveIndex << " specified, but there are only " << drives.size() << " drives" << std::endl; return 6; } - QConsolePrintProgress progress; std::cout << "Printing label " << files.front() << std::endl; - drives[driveIndex]->print( params, &scene ); + + QLightDrive *drive = drives[driveIndex]; + QConsolePrintProgress progress( drive ); + drive->print( params, &scene ); rez = app.exec(); } else { MainWindow mwindow( true ); diff --git a/src/qconsoleprintprogress.cpp b/src/qconsoleprintprogress.cpp index 46e0fa2..530521b 100644 --- a/src/qconsoleprintprogress.cpp +++ b/src/qconsoleprintprogress.cpp @@ -5,14 +5,13 @@ #include -QConsolePrintProgress::QConsolePrintProgress() +QConsolePrintProgress::QConsolePrintProgress( QLightDrive *drive ) + : m_drive( drive ) { - 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)) ); + 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(finished(int)), this, SLOT(onFinished(int)) ); } diff --git a/src/qconsoleprintprogress.h b/src/qconsoleprintprogress.h index 02643d3..acc578c 100644 --- a/src/qconsoleprintprogress.h +++ b/src/qconsoleprintprogress.h @@ -3,10 +3,12 @@ #include +class QLightDrive; + class QConsolePrintProgress : public QObject { Q_OBJECT public: - QConsolePrintProgress(); + QConsolePrintProgress( QLightDrive *drive ); ~QConsolePrintProgress(); private slots: @@ -14,6 +16,9 @@ private slots: void onLabelProgress( long current, long final ); void onTimeEstimate( long time ); void onFinished(int status ); + +private: + QLightDrive *m_drive; }; #endif // QCONSOLEPRINTPROGRESS_H