diff options
author | Jason A. Donenfeld <Jason@zx2c4.com> | 2009-09-26 22:25:02 -0400 |
---|---|---|
committer | Jason A. Donenfeld <Jason@zx2c4.com> | 2009-09-26 22:25:02 -0400 |
commit | 2f0ace0e367489eb20a75a69c95d463fcb04830f (patch) | |
tree | 0d84316b9ecb04bc0becc8670e55bb7d946f33ab /mainwindow.cpp | |
parent | More HandBrake progress (diff) | |
download | AnyRip-2f0ace0e367489eb20a75a69c95d463fcb04830f.tar.xz AnyRip-2f0ace0e367489eb20a75a69c95d463fcb04830f.zip |
More gui work and dvd loading.
Diffstat (limited to 'mainwindow.cpp')
-rw-r--r-- | mainwindow.cpp | 48 |
1 files changed, 14 insertions, 34 deletions
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 <QVBoxLayout> +#include "newdvdgui.h" +#include <QGridLayout> #include <QHBoxLayout> #include <QSettings> #include <QLabel> @@ -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("<b>Videos in Queue</b>")), 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("<b>Video Queue</b>")), 0, 0); + layout->addWidget(new QLabel(tr("<b>Job Queue</b>")), 0, 1); + layout->addLayout(m_videoGuis, 1, 0); + layout->addLayout(m_jobGuis, 1, 1); + NewDVDGui *newDvdGui = new NewDVDGui; + connect(newDvdGui, SIGNAL(newDVD(QString,QMap<int,QString>)), this, SLOT(newVideoFromDVD(QString,QMap<int,QString>))); + 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<int, QString> 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) { |