diff options
author | 2009-09-26 02:56:22 -0400 | |
---|---|---|
committer | 2009-09-26 02:56:22 -0400 | |
commit | 2a36c859bb5052f47b0122a2e78378a46b9031c5 (patch) | |
tree | 62d09c38f3592947ba747bb58248fa16e8f55b11 | |
parent | Layout magic (diff) | |
download | AnyRip-2a36c859bb5052f47b0122a2e78378a46b9031c5.tar.xz AnyRip-2a36c859bb5052f47b0122a2e78378a46b9031c5.zip |
Gui beginnings.
-rw-r--r-- | AnyRip.pro | 6 | ||||
-rw-r--r-- | dvddrive.cpp | 7 | ||||
-rw-r--r-- | dvddrive.h | 2 | ||||
-rw-r--r-- | dvdimagejob.cpp | 6 | ||||
-rw-r--r-- | dvdimagejob.h | 4 | ||||
-rw-r--r-- | dvdimagejobgui.cpp | 22 | ||||
-rw-r--r-- | dvdimagejobgui.h | 8 | ||||
-rw-r--r-- | encodemp4job.cpp | 4 | ||||
-rw-r--r-- | encodemp4job.h | 2 | ||||
-rw-r--r-- | job.cpp | 9 | ||||
-rw-r--r-- | job.h | 5 | ||||
-rw-r--r-- | jobqueue.cpp | 1 | ||||
-rw-r--r-- | jobqueue.h | 2 | ||||
-rw-r--r-- | main.cpp | 9 | ||||
-rw-r--r-- | mainwindow.cpp | 78 | ||||
-rw-r--r-- | mainwindow.h | 31 | ||||
-rw-r--r-- | titleloadjob.cpp | 4 | ||||
-rw-r--r-- | titleloadjob.h | 2 | ||||
-rw-r--r-- | uploadjob.cpp | 4 | ||||
-rw-r--r-- | uploadjob.h | 2 | ||||
-rw-r--r-- | video.cpp | 29 | ||||
-rw-r--r-- | video.h | 5 | ||||
-rw-r--r-- | videogui.cpp | 17 | ||||
-rw-r--r-- | videoqueue.cpp | 2 | ||||
-rw-r--r-- | videoqueue.h | 3 |
25 files changed, 222 insertions, 42 deletions
@@ -9,7 +9,8 @@ SOURCES += main.cpp \ encodemp4job.cpp \ uploadjob.cpp \ titleloadjob.cpp \ - videogui.cpp + videogui.cpp \ + mainwindow.cpp HEADERS += dvdimagejob.h \ dvdimagejobgui.h \ job.h \ @@ -20,7 +21,8 @@ HEADERS += dvdimagejob.h \ encodemp4job.h \ uploadjob.h \ titleloadjob.h \ - videogui.h + videogui.h \ + mainwindow.h LIBS += -ldvdcss \ -ldvdread QT += dbus diff --git a/dvddrive.cpp b/dvddrive.cpp index b81fca2..31042c4 100644 --- a/dvddrive.cpp +++ b/dvddrive.cpp @@ -70,3 +70,10 @@ void DVDDrive::eject() m_halDisc = 0; } } +DVDDrive* DVDDrive::s_instance = 0; +DVDDrive* DVDDrive::instance() +{ + if (!s_instance) + s_instance = new DVDDrive; + return s_instance; +} @@ -13,9 +13,11 @@ public: QString dvdDevice() const; bool dvdInserted() const; void eject(); + static DVDDrive* instance(); private: QDBusInterface *m_halManager; QDBusInterface *m_halDisc; + static DVDDrive *s_instance; private slots: bool deviceAdded(const QString &device); void deviceRemoved(const QString &device); diff --git a/dvdimagejob.cpp b/dvdimagejob.cpp index 54e82ca..e676ce6 100644 --- a/dvdimagejob.cpp +++ b/dvdimagejob.cpp @@ -13,7 +13,6 @@ DVDImageJob::DVDImageJob(Video *video, QString defaultPath) : Job(video), - m_dvdDrive(new DVDDrive(this)), //TODO: get from static singleton instance m_defaultPath(defaultPath) { } @@ -53,7 +52,7 @@ bool DVDImageJob::saveImageToPath(const QString &path) // http://www.google.com/codesearch/p?hl=en&sa=N&cd=10&ct=rc#PY4_fj37fsw/uia/netsteria/dvd/read.cc&q=DVDCSS_SEEK_KEY bool DVDImageJob::saveImageToDevice(QIODevice &out) { - QString dvdDevice = m_dvdDrive->dvdDevice(); + QString dvdDevice = DVDDrive::instance()->dvdDevice(); dvd_reader_t *dvdr = DVDOpen(dvdDevice.toStdString().c_str()); if (!dvdr) { qDebug() << "can't open DVD (dvdread)"; @@ -123,7 +122,8 @@ bool DVDImageJob::saveImageToDevice(QIODevice &out) qDebug() << "can't open DVD (dvdcss)"; return false; } - + sleep(5); + return true; int blkno = 0; int curvob = 0; while (1) { diff --git a/dvdimagejob.h b/dvdimagejob.h index d70d414..d53d7e6 100644 --- a/dvdimagejob.h +++ b/dvdimagejob.h @@ -2,7 +2,6 @@ #define DVDIMAGEJOB_H #include "job.h" -class DVDDrive; class QIODevice; class DVDImageJob : public Job @@ -13,18 +12,17 @@ public: bool saveImageToDevice(QIODevice &out); bool saveImageToPath(const QString &path); Video::Jobs jobType() const; - QWidget* gui(); private: static int cmpvob(const void *p1, const void *p2); typedef struct vobfile { int32_t start, end; } vobfile; - DVDDrive *m_dvdDrive; QString m_defaultPath; protected: bool executeJob(); + QWidget* gui(); signals: void extractProgress(int current, int total); diff --git a/dvdimagejobgui.cpp b/dvdimagejobgui.cpp index 7db1dd6..7041ebc 100644 --- a/dvdimagejobgui.cpp +++ b/dvdimagejobgui.cpp @@ -4,12 +4,20 @@ #include <dvdcss/dvdcss.h> #include <QPushButton> #include <QProgressBar> +#include <QLabel> #include <QVBoxLayout> #include <QFile> DVDImageJobGui::DVDImageJobGui(DVDImageJob *job) : m_first(true) { + m_progressBar = new QProgressBar; + m_progressLabel = new QLabel; + QVBoxLayout *layout = new QVBoxLayout; + layout->addWidget(new QLabel(tr("<b>Copying DVD ISO</b>"))); + layout->addWidget(m_progressBar); + layout->addWidget(m_progressLabel); + setLayout(layout); connect(job, SIGNAL(extractProgress(int,int)), this, SLOT(extractProgress(int,int))); } void DVDImageJobGui::extractProgress(int current, int maximum) @@ -22,12 +30,12 @@ void DVDImageJobGui::extractProgress(int current, int maximum) long long maximumBytes = (long long)maximum * DVDCSS_BLOCK_SIZE; double bytesPerMillisecond = (double)currentBytes / (double)m_startTime.elapsed(); long long millisecondsRemaining = (long long)((maximumBytes - currentBytes) / bytesPerMillisecond); - setWindowTitle(QString("%1 of %2 megabytes (%3 mb/s, %4 remaining)") - .arg(QString::number((double)currentBytes / 1024.0 / 1024.0, 'f', 2)) - .arg(QString::number((double)maximumBytes / 1024.0 / 1024.0, 'f', 2)) - .arg(QString::number(bytesPerMillisecond * (1000.0 / 1024.0 / 1024.0), 'f', 2)) - .arg(QTime().addMSecs(millisecondsRemaining).toString())); + m_progressLabel->setText(QString("%1 of %2 megabytes (%3 mb/s, %4 remaining)") + .arg(QString::number((double)currentBytes / 1024.0 / 1024.0, 'f', 2)) + .arg(QString::number((double)maximumBytes / 1024.0 / 1024.0, 'f', 2)) + .arg(QString::number(bytesPerMillisecond * (1000.0 / 1024.0 / 1024.0), 'f', 2)) + .arg(QTime().addMSecs(millisecondsRemaining).toString())); } - setMaximum(maximum); - setValue(current); + m_progressBar->setMaximum(maximum); + m_progressBar->setValue(current); } diff --git a/dvdimagejobgui.h b/dvdimagejobgui.h index 27aafe5..122cdd4 100644 --- a/dvdimagejobgui.h +++ b/dvdimagejobgui.h @@ -1,11 +1,13 @@ #ifndef DVDIMAGEJOBGUI_H #define DVDIMAGEJOBGUI_H -#include <QProgressBar> +#include <QWidget> #include <QTime> +class QLabel; +class QProgressBar; class DVDImageJob; -class DVDImageJobGui : public QProgressBar +class DVDImageJobGui : public QWidget { Q_OBJECT @@ -13,6 +15,8 @@ public: DVDImageJobGui(DVDImageJob *job); private: + QProgressBar* m_progressBar; + QLabel* m_progressLabel; QTime m_startTime; bool m_first; DVDImageJob *m_job; diff --git a/encodemp4job.cpp b/encodemp4job.cpp index 84408d3..34b82f9 100644 --- a/encodemp4job.cpp +++ b/encodemp4job.cpp @@ -1,5 +1,6 @@ #include "encodemp4job.h" #include <QWidget> +#include <QLabel> EncodeMP4Job::EncodeMP4Job(Video *video, QString encodePath, QString imagePath) : Job(video), @@ -14,10 +15,11 @@ Video::Jobs EncodeMP4Job::jobType() const bool EncodeMP4Job::executeJob() { //TODO: encode the actual mp4! + sleep(5); return true; } QWidget* EncodeMP4Job::gui() { //TODO: make a gui - return new QWidget; + return new QLabel("Encode mp4 place holder, foo!"); } diff --git a/encodemp4job.h b/encodemp4job.h index 58ecd51..41eef3b 100644 --- a/encodemp4job.h +++ b/encodemp4job.h @@ -10,9 +10,9 @@ class EncodeMP4Job : public Job public: EncodeMP4Job(Video *video, QString encodePath, QString imagePath); Video::Jobs jobType() const; - QWidget* gui(); protected: bool executeJob(); + QWidget* gui(); private: QString m_encodePath; QString m_imagePath; @@ -3,7 +3,8 @@ #include <QtConcurrentRun> Job::Job(QObject *parent) - : QObject(parent) + : QObject(parent), + m_gui(0) { m_watcher = new QFutureWatcher<bool>; m_watcher->setParent(this); @@ -17,3 +18,9 @@ void Job::jobFinished() { emit completed(m_watcher->future().result()); } +QWidget* Job::widget() +{ + if (!m_gui) + m_gui = gui(); + return m_gui; +} @@ -4,6 +4,7 @@ #include "video.h" #include <QObject> #include <QFutureWatcher> +class QWidget; class Job : public QObject { @@ -11,12 +12,14 @@ class Job : public QObject public: void runJob(); virtual Video::Jobs jobType() const = 0; - virtual QWidget* gui() = 0; + QWidget* widget(); protected: Job(QObject *parent = 0); virtual bool executeJob() = 0; + virtual QWidget* gui() = 0; private: QFutureWatcher<bool> *m_watcher; + QWidget *m_gui; private slots: void jobFinished(); signals: diff --git a/jobqueue.cpp b/jobqueue.cpp index c18ffee..be747d2 100644 --- a/jobqueue.cpp +++ b/jobqueue.cpp @@ -22,6 +22,7 @@ void JobQueue::runNextJob() Job *job = m_queue.dequeue(); qDebug() << "running job" << job->jobType() << "for video" << qobject_cast<Video*>(job->parent())->title(); connect(job, SIGNAL(completed(bool)), this, SLOT(jobCompleted())); + emit runningJob(job); job->runJob(); } void JobQueue::jobCompleted() @@ -18,6 +18,8 @@ private: void runNextJob(); private slots: void jobCompleted(); +signals: + void runningJob(Job *job); }; #endif // JOBQUEUE_H @@ -1,6 +1,4 @@ -#include "dvddrive.h" -#include "videogui.h" -#include "video.h" +#include "mainwindow.h" #include <QApplication> int main(int argc, char *argv[]) @@ -9,8 +7,7 @@ int main(int argc, char *argv[]) a.setApplicationName(QLatin1String("AnyRip")); a.setOrganizationName(QLatin1String("AnyClip")); a.setOrganizationDomain(QLatin1String("anyclip.com")); - DVDDrive drive; - Video v(drive.dvdName()); - v.gui()->show(); + MainWindow mw; + mw.show(); return a.exec(); } diff --git a/mainwindow.cpp b/mainwindow.cpp new file mode 100644 index 0000000..147514a --- /dev/null +++ b/mainwindow.cpp @@ -0,0 +1,78 @@ +#include "mainwindow.h" +#include "video.h" +#include "videogui.h" +#include "videoqueue.h" +#include "dvddrive.h" +#include "job.h" +#include <QVBoxLayout> +#include <QHBoxLayout> +#include <QSettings> +#include <QLabel> +#include <QPushButton> +#include <QDebug> + +MainWindow::MainWindow() +{ + connect(DVDDrive::instance(), SIGNAL(dvdAdded()), this, SLOT(dvdAdded())); + connect(DVDDrive::instance(), SIGNAL(dvdRemoved()), this, SLOT(dvdRemoved())); + m_queue = new VideoQueue; + connect(m_queue, SIGNAL(runningJob(Job*)), this, SLOT(runningJob(Job*))); + m_videoGuis = new QVBoxLayout; + m_jobGuis = new QVBoxLayout; + QHBoxLayout *sides = new QHBoxLayout; + sides->addLayout(m_videoGuis); + sides->addLayout(m_jobGuis); + QHBoxLayout *heading = new QHBoxLayout; + heading->addWidget(new QLabel(tr("<b>Videos in Queue</b>")), 1); + m_currentlyInserted = new QPushButton; + connect(m_currentlyInserted, SIGNAL(clicked()), this, SLOT(newVideoFromDVD())); + if (DVDDrive::instance()->dvdInserted()) + dvdAdded(); + else + dvdRemoved(); + heading->addWidget(m_currentlyInserted); + QVBoxLayout *layout = new QVBoxLayout; + layout->addLayout(heading); + layout->addLayout(sides); + QSettings settings; + settings.beginGroup(QLatin1String("Videos")); + foreach(QString title, settings.childGroups()) { + Video *video = new Video(title, this); + if (video->isJobCompleted(Video::DVDImage)) + addVideo(video); + } + setLayout(layout); +} +void MainWindow::dvdAdded() +{ + QSettings settings; + settings.beginGroup(QLatin1String("Videos")); + QString dvdName = DVDDrive::instance()->dvdName(); + m_currentlyInserted->setEnabled(!settings.childGroups().contains(dvdName)); + m_currentlyInserted->setText(tr("Rip %1").arg(dvdName)); +} +void MainWindow::dvdRemoved() +{ + m_currentlyInserted->setEnabled(false); + m_currentlyInserted->setText(tr("Insert DVD...")); +} +void MainWindow::addVideo(Video *video) +{ + m_videoGuis->addWidget(video->widget()); + m_queue->newVideo(video); +} +void MainWindow::newVideoFromDVD() +{ + m_currentlyInserted->setEnabled(false); + addVideo(new Video(DVDDrive::instance()->dvdName(), this)); +} +void MainWindow::runningJob(Job *job) +{ + connect(job, SIGNAL(completed(bool)), this, SLOT(completedJob(bool))); + m_jobGuis->addWidget(job->widget()); +} +void MainWindow::completedJob(bool success) +{ + //TODO: do something with success + delete qobject_cast<Job*>(sender())->widget(); +} diff --git a/mainwindow.h b/mainwindow.h new file mode 100644 index 0000000..cc78ddd --- /dev/null +++ b/mainwindow.h @@ -0,0 +1,31 @@ +#ifndef MAINWINDOW_H +#define MAINWINDOW_H + +#include <QWidget> +#include "dvddrive.h" +class QVBoxLayout; +class QPushButton; +class Video; +class VideoQueue; +class Job; + +class MainWindow : public QWidget +{ + Q_OBJECT +public: + MainWindow(); +private: + QVBoxLayout *m_videoGuis; + QVBoxLayout *m_jobGuis; + QPushButton *m_currentlyInserted; + VideoQueue *m_queue; + void addVideo(Video *video); +private slots: + void dvdAdded(); + void dvdRemoved(); + void newVideoFromDVD(); + void runningJob(Job *job); + void completedJob(bool success); +}; + +#endif // MAINWINDOW_H diff --git a/titleloadjob.cpp b/titleloadjob.cpp index f54c9b2..d0c613c 100644 --- a/titleloadjob.cpp +++ b/titleloadjob.cpp @@ -1,5 +1,6 @@ #include "titleloadjob.h" #include <QWidget> +#include <QLabel> TitleLoadJob::TitleLoadJob(Video *video, QString subtitlePath, QString posterPath) : Job(video), @@ -14,10 +15,11 @@ Video::Jobs TitleLoadJob::jobType() const bool TitleLoadJob::executeJob() { //TODO: title load the whole thing + sleep(5); return true; } QWidget* TitleLoadJob::gui() { //TODO: make a gui - return new QWidget; + return new QLabel("Bet your ass this is title loading."); } diff --git a/titleloadjob.h b/titleloadjob.h index d4ff9ab..4a1729e 100644 --- a/titleloadjob.h +++ b/titleloadjob.h @@ -10,9 +10,9 @@ class TitleLoadJob : public Job public: TitleLoadJob(Video *video, QString subtitlePath, QString posterPath); Video::Jobs jobType() const; - QWidget* gui(); protected: bool executeJob(); + QWidget* gui(); private: QString m_subtitlePath; QString m_posterPath; diff --git a/uploadjob.cpp b/uploadjob.cpp index 776db6b..a4691c4 100644 --- a/uploadjob.cpp +++ b/uploadjob.cpp @@ -1,5 +1,6 @@ #include "uploadjob.h" #include <QWidget> +#include <QLabel> UploadJob::UploadJob(Video *video, QString encodePath) : Job(video), @@ -13,10 +14,11 @@ Video::Jobs UploadJob::jobType() const bool UploadJob::executeJob() { //TODO: upload the mp4! + sleep(5); return true; } QWidget* UploadJob::gui() { //TODO: make a gui - return new QWidget; + return new QLabel("Endoplasmic sludge in your upload house"); } diff --git a/uploadjob.h b/uploadjob.h index ff77e6b..e8453f2 100644 --- a/uploadjob.h +++ b/uploadjob.h @@ -10,9 +10,9 @@ class UploadJob : public Job public: UploadJob(Video *video, QString encodePath); Video::Jobs jobType() const; - QWidget* gui(); protected: bool executeJob(); + QWidget* gui(); private: QString m_encodePath; }; @@ -5,33 +5,48 @@ #include "uploadjob.h" #include "titleloadjob.h" #include "videogui.h" - +#include "dvddrive.h" #include <QDir> +#include <QSettings> Video::Video(QString title, QObject *parent) : QObject(parent), m_jobsCompleted(QBitArray(6)), m_jobsInProgress(QBitArray(6)) { + m_settingsKey = QString("Videos/%1/Jobs Completed").arg(title.replace(QChar('/'), QChar('-'))); + QSettings settings; + if (settings.contains(m_settingsKey)) { + m_jobsCompleted = settings.value(m_settingsKey).toBitArray(); + if (m_jobsCompleted.size() != 6) + m_jobsCompleted.resize(6); + } m_title = title; m_rootPath = QString("%1/AnyRip/%2").arg(QDir::homePath()).arg(m_title); + QDir().mkpath(m_rootPath); m_imagePath = QString("%1/%2 - Image.iso").arg(m_rootPath).arg(m_title); m_encodePath = QString("%1/%2 - Encode.mp4").arg(m_rootPath).arg(m_title); m_subtitlePath = QString("%1/%2 - Subtitles.srt").arg(m_rootPath).arg(m_title); m_posterPath = QString("%1/%2 - Poster.jpg").arg(m_rootPath).arg(m_title); } +void Video::saveState() +{ + QSettings settings; + settings.setValue(m_settingsKey, m_jobsCompleted); +} void Video::completedJob(bool success) { Job *job = qobject_cast<Job*>(sender()); qDebug() << "Job code" << job->jobType() << "completed" << success; m_jobsCompleted.setBit(job->jobType(), success); + saveState(); m_jobsInProgress.setBit(job->jobType(), false); emit jobCompleted(job->jobType(), success); - delete job; + job->deleteLater(); } DVDImageJob* Video::dvdImageJob() { - if (!m_jobsInProgress.at(Video::DVDImage) && !m_jobsCompleted.at(Video::DVDImage)) { + if (!m_jobsInProgress.at(Video::DVDImage) && !m_jobsCompleted.at(Video::DVDImage) && DVDDrive::instance()->dvdInserted()) { DVDImageJob *job = new DVDImageJob(this, m_imagePath); connect(job, SIGNAL(completed(bool)), this, SLOT(completedJob(bool))); m_jobsInProgress.setBit(Video::DVDImage, true); @@ -88,6 +103,7 @@ void Video::setSubtitle(const QIODevice &input) m_jobsInProgress.setBit(Video::Subtitle, true); //TODO: save input to subtitle file m_jobsCompleted.setBit(Video::Subtitle, true); + saveState(); m_jobsInProgress.setBit(Video::Subtitle, false); emit jobCompleted(Video::Subtitle, true); } @@ -96,6 +112,7 @@ void Video::setPoster(const QIODevice &input) m_jobsInProgress.setBit(Video::Poster, true); //TODO: save input to subtitle file m_jobsCompleted.setBit(Video::Poster, true); + saveState(); m_jobsInProgress.setBit(Video::Poster, false); emit jobCompleted(Video::Poster, true); } @@ -103,7 +120,11 @@ QString Video::title() const { return m_title; } -VideoGui* Video::gui() +VideoGui* Video::widget() { return new VideoGui(this); } +bool Video::isJobCompleted(Video::Jobs job) const +{ + return m_jobsCompleted.at(job); +} @@ -27,7 +27,8 @@ public: TitleLoadJob* titleLoadJob(); QList<Job*> availableJobs(); QString title() const; - VideoGui* gui(); + VideoGui* widget(); + bool isJobCompleted(Video::Jobs job) const; private: QBitArray m_jobsCompleted; QBitArray m_jobsInProgress; @@ -37,6 +38,8 @@ private: QString m_encodePath; QString m_subtitlePath; QString m_posterPath; + QString m_settingsKey; + void saveState(); private slots: void completedJob(bool success); signals: diff --git a/videogui.cpp b/videogui.cpp index 6b952d3..d0b2e95 100644 --- a/videogui.cpp +++ b/videogui.cpp @@ -6,18 +6,23 @@ VideoGui::VideoGui(Video *video) : m_video(video) { + //TODO: disable first 4 without them going grey m_imageCheck = new QCheckBox(tr("Copied DVD ISO"), this); - m_imageCheck->setCheckable(false); + m_imageCheck->setChecked(video->isJobCompleted(Video::DVDImage)); + m_imageCheck->setEnabled(false); m_encodeCheck = new QCheckBox(tr("Encoded MP4"), this); - m_encodeCheck->setCheckable(false); + m_encodeCheck->setChecked(video->isJobCompleted(Video::EncodeMP4)); + m_encodeCheck->setEnabled(false); m_uploadCheck = new QCheckBox(tr("Uploaded MP4"), this); - m_uploadCheck->setCheckable(false); + m_uploadCheck->setChecked(video->isJobCompleted(Video::Upload)); + m_uploadCheck->setEnabled(false); m_titleLoadCheck = new QCheckBox(tr("Title-Loaded"), this); - m_titleLoadCheck->setCheckable(false); + m_titleLoadCheck->setChecked(video->isJobCompleted(Video::TitleLoad)); + m_titleLoadCheck->setEnabled(false); m_subtitleCheck = new QCheckBox(tr("Found Subtitle"), this); - m_subtitleCheck->setCheckable(false); + m_subtitleCheck->setChecked(video->isJobCompleted(Video::Subtitle)); m_posterCheck = new QCheckBox(tr("Found Poster"), this); - m_posterCheck->setCheckable(false); + m_posterCheck->setChecked(video->isJobCompleted(Video::Poster)); //TODO: actions for checking subtitle and poster check to actually do it connect(video, SIGNAL(jobCompleted(Video::Jobs,bool)), this, SLOT(jobCompleted(Video::Jobs,bool))); QHBoxLayout *layout = new QHBoxLayout; diff --git a/videoqueue.cpp b/videoqueue.cpp index f7a5991..f4eb639 100644 --- a/videoqueue.cpp +++ b/videoqueue.cpp @@ -13,6 +13,8 @@ VideoQueue::VideoQueue(QObject *parent) : m_jobQueues.insert(Video::EncodeMP4, new JobQueue(this)); m_jobQueues.insert(Video::Upload, new JobQueue(this)); m_jobQueues.insert(Video::TitleLoad, new JobQueue(this)); + foreach(JobQueue *queue, m_jobQueues) + connect(queue, SIGNAL(runningJob(Job*)), this, SIGNAL(runningJob(Job*))); } void VideoQueue::newVideo(Video *video) { diff --git a/videoqueue.h b/videoqueue.h index a587c23..49cc852 100644 --- a/videoqueue.h +++ b/videoqueue.h @@ -5,6 +5,7 @@ #include <QVector> class JobQueue; class Video; +class Job; class VideoQueue : public QObject { @@ -17,6 +18,8 @@ private: void enqueueVideo(Video *video); private slots: void videoChanged(); +signals: + void runningJob(Job *job); }; #endif // VIDEOQUEUE_H |