OSDN Git Service

Added option to choose between 8-Bit and 10-Bit encoding at runtime. We now include...
[x264-launcher/x264-launcher.git] / src / model_jobList.cpp
index 21a6247..f5b359a 100644 (file)
@@ -22,6 +22,7 @@
 #include "model_jobList.h"
 #include "global.h"
 #include "thread_encode.h"
+#include "model_options.h"
 
 #include <QIcon>
 #include <QFileInfo>
@@ -227,9 +228,27 @@ QModelIndex JobListModel::insertJob(EncodeThread *thread)
        {
                return QModelIndex();
        }
-               
+       
+       QString config = "N/A";
+
+       switch(thread->options()->rcMode())
+       {
+       case OptionsModel::RCMode_CRF:
+               config = QString("CRF@%1").arg(QString::number(thread->options()->quantizer()));
+               break;
+       case OptionsModel::RCMode_CQ:
+               config = QString("CQ@%1").arg(QString::number(qRound(thread->options()->quantizer())));
+               break;
+       case OptionsModel::RCMode_2Pass:
+               config = QString("2Pass@%1").arg(QString::number(thread->options()->bitrate()));
+               break;
+       case OptionsModel::RCMode_ABR:
+               config = QString("ABR@%1").arg(QString::number(thread->options()->bitrate()));
+               break;
+       }
+
        int n = 2;
-       QString jobName = QFileInfo(thread->sourceFileName()).completeBaseName();
+       QString jobName = QString("%1 (%2)").arg(QFileInfo(thread->sourceFileName()).completeBaseName().simplified(), config);
 
        forever
        {
@@ -244,7 +263,7 @@ QModelIndex JobListModel::insertJob(EncodeThread *thread)
                }
                if(!unique)
                {
-                       jobName = QString("%1 (%2)").arg(QFileInfo(thread->sourceFileName()).completeBaseName(), QString::number(n++));
+                       jobName = QString("%1 %2 (%3)").arg(QFileInfo(thread->sourceFileName()).completeBaseName().simplified(), QString::number(n++), config);
                        continue;
                }
                break;
@@ -381,6 +400,19 @@ LogFileModel *JobListModel::getLogFile(const QModelIndex &index)
        return NULL;
 }
 
+const QString &JobListModel::getJobSourceFile(const QModelIndex &index)
+{
+       static QString nullStr;
+       
+       if(index.isValid() && index.row() >= 0 && index.row() < m_jobs.count())
+       {
+               EncodeThread *thread = m_threads.value(m_jobs.at(index.row()));
+               return (thread != NULL) ? thread->sourceFileName() : nullStr;
+       }
+
+       return nullStr;
+}
+
 const QString &JobListModel::getJobOutputFile(const QModelIndex &index)
 {
        static QString nullStr;
@@ -414,6 +446,19 @@ unsigned int JobListModel::getJobProgress(const QModelIndex &index)
        return 0;
 }
 
+const OptionsModel *JobListModel::getJobOptions(const QModelIndex &index)
+{
+       static QString nullStr;
+       
+       if(index.isValid() && index.row() >= 0 && index.row() < m_jobs.count())
+       {
+               EncodeThread *thread = m_threads.value(m_jobs.at(index.row()));
+               return (thread != NULL) ? thread->options() : NULL;
+       }
+
+       return NULL;
+}
+
 QModelIndex JobListModel::getJobIndexById(const QUuid &id)
 {
        if(m_jobs.contains(id))