summaryrefslogtreecommitdiffstats
path: root/videogui.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'videogui.cpp')
-rw-r--r--videogui.cpp33
1 files changed, 27 insertions, 6 deletions
diff --git a/videogui.cpp b/videogui.cpp
index 02aad03..139bfb8 100644
--- a/videogui.cpp
+++ b/videogui.cpp
@@ -1,7 +1,10 @@
#include "videogui.h"
#include <QCheckBox>
#include <QHBoxLayout>
+#include <QGridLayout>
#include <QLabel>
+#include <QComboBox>
+#include <QMap>
VideoGui::VideoGui(Video *video) :
m_video(video)
@@ -19,6 +22,23 @@ VideoGui::VideoGui(Video *video) :
m_titleLoadCheck = new QCheckBox(tr("Title-Loaded"), this);
m_titleLoadCheck->setChecked(video->isJobCompleted(Video::TitleLoad));
m_titleLoadCheck->setEnabled(false);
+ m_titleSelector = new QComboBox;
+ QMapIterator<int, QString> i(video->dvdTitles());
+ while (i.hasNext()) {
+ i.next();
+ m_titleSelector->addItem(QString("Title %1: %2").arg(QString::number(i.key())).arg(i.value()), i.key());
+ }
+ int currentIndex = m_titleSelector->findData(video->dvdTitle());
+ if (currentIndex == -1)
+ currentIndex = 0;
+ m_titleSelector->setCurrentIndex(currentIndex);
+ connect(m_titleSelector, SIGNAL(currentIndexChanged(int)), this, SLOT(titleChanged(int)));
+ QGridLayout *checkGrid = new QGridLayout;
+ checkGrid->addWidget(m_imageCheck, 0, 0);
+ checkGrid->addWidget(m_encodeCheck, 0, 1);
+ checkGrid->addWidget(m_uploadCheck, 1, 0);
+ checkGrid->addWidget(m_titleLoadCheck, 1, 1);
+ checkGrid->addWidget(m_titleSelector, 0, 2);
m_subtitleCheck = new QCheckBox(tr("Found Subtitle"), this);
m_subtitleCheck->setChecked(video->isJobCompleted(Video::Subtitle));
m_posterCheck = new QCheckBox(tr("Found Poster"), this);
@@ -26,15 +46,12 @@ VideoGui::VideoGui(Video *video) :
//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;
- layout->addWidget(new QLabel(QString("<b>%1: </b>").arg(video->title())));
- layout->addWidget(m_imageCheck);
- layout->addWidget(m_encodeCheck);
- layout->addWidget(m_uploadCheck);
- layout->addWidget(m_titleLoadCheck);
+ layout->addLayout(checkGrid);
layout->addWidget(m_subtitleCheck);
layout->addWidget(m_posterCheck);
setLayout(layout);
- setFrameStyle(QFrame::StyledPanel);
+ setTitle(video->title());
+ setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed);
}
void VideoGui::jobCompleted(Video::Jobs jobType, bool success)
{
@@ -59,3 +76,7 @@ void VideoGui::jobCompleted(Video::Jobs jobType, bool success)
break;
}
}
+void VideoGui::titleChanged(int index)
+{
+ m_video->setDvdTitle(m_titleSelector->itemData(index).toInt());
+}