From 2f0ace0e367489eb20a75a69c95d463fcb04830f Mon Sep 17 00:00:00 2001 From: "Jason A. Donenfeld" Date: Sat, 26 Sep 2009 22:25:02 -0400 Subject: More gui work and dvd loading. --- mainwindow.cpp | 48 ++++++++++++++---------------------------------- 1 file changed, 14 insertions(+), 34 deletions(-) (limited to 'mainwindow.cpp') diff --git a/mainwindow.cpp b/mainwindow.cpp index dd66ced..9723e70 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -4,7 +4,8 @@ #include "videoqueue.h" #include "dvddrive.h" #include "job.h" -#include +#include "newdvdgui.h" +#include #include #include #include @@ -13,23 +14,18 @@ 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("Videos in Queue")), 1); - m_currentlyInserted = new QPushButton; - connect(m_currentlyInserted, SIGNAL(clicked()), this, SLOT(newVideoFromDVD())); - heading->addWidget(m_currentlyInserted); - QVBoxLayout *layout = new QVBoxLayout; - layout->addLayout(heading); - layout->addLayout(sides); + QGridLayout *layout = new QGridLayout; + layout->addWidget(new QLabel(tr("Video Queue")), 0, 0); + layout->addWidget(new QLabel(tr("Job Queue")), 0, 1); + layout->addLayout(m_videoGuis, 1, 0); + layout->addLayout(m_jobGuis, 1, 1); + NewDVDGui *newDvdGui = new NewDVDGui; + connect(newDvdGui, SIGNAL(newDVD(QString,QMap)), this, SLOT(newVideoFromDVD(QString,QMap))); + m_jobGuis->addWidget(newDvdGui); QSettings settings; settings.beginGroup(QLatin1String("Videos")); foreach(QString title, settings.childGroups()) { @@ -39,34 +35,18 @@ MainWindow::MainWindow() else settings.remove(title); } - if (DVDDrive::instance()->dvdInserted()) - dvdAdded(); - else - dvdRemoved(); 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() +void MainWindow::newVideoFromDVD(QString name, QMap titles) { - m_currentlyInserted->setEnabled(false); - addVideo(new Video(DVDDrive::instance()->dvdName(), this)); + Video *video = new Video(name); + video->setDvdTitles(titles); + addVideo(video); } void MainWindow::runningJob(Job *job) { -- cgit v1.2.3-59-g8ed1b