Some more refactoring to allow better handling of multiple input files.
This commit is contained in:
parent
aacf84b88a
commit
680debf496
@ -22,7 +22,7 @@
|
|||||||
#define VER_X264_MAJOR 2
|
#define VER_X264_MAJOR 2
|
||||||
#define VER_X264_MINOR 1
|
#define VER_X264_MINOR 1
|
||||||
#define VER_X264_PATCH 0
|
#define VER_X264_PATCH 0
|
||||||
#define VER_X264_BUILD 435
|
#define VER_X264_BUILD 439
|
||||||
|
|
||||||
#define VER_X264_MINIMUM_REV 2282
|
#define VER_X264_MINIMUM_REV 2282
|
||||||
#define VER_X264_CURRENT_API 132
|
#define VER_X264_CURRENT_API 132
|
||||||
|
@ -199,7 +199,7 @@ public:
|
|||||||
// Constructor & Destructor
|
// Constructor & Destructor
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
AddJobDialog::AddJobDialog(QWidget *parent, OptionsModel *options, bool x64supported, bool use10BitEncoding, bool saveToSourceFolder)
|
AddJobDialog::AddJobDialog(QWidget *parent, OptionsModel *options, RecentlyUsed *recentlyUsed, bool x64supported, bool use10BitEncoding, bool saveToSourceFolder)
|
||||||
:
|
:
|
||||||
QDialog(parent),
|
QDialog(parent),
|
||||||
m_defaults(new OptionsModel()),
|
m_defaults(new OptionsModel()),
|
||||||
@ -207,9 +207,7 @@ AddJobDialog::AddJobDialog(QWidget *parent, OptionsModel *options, bool x64suppo
|
|||||||
m_x64supported(x64supported),
|
m_x64supported(x64supported),
|
||||||
m_use10BitEncoding(use10BitEncoding),
|
m_use10BitEncoding(use10BitEncoding),
|
||||||
m_saveToSourceFolder(saveToSourceFolder),
|
m_saveToSourceFolder(saveToSourceFolder),
|
||||||
m_initialDir_src(QDir::fromNativeSeparators(QDesktopServices::storageLocation(QDesktopServices::MoviesLocation))),
|
m_recentlyUsed(recentlyUsed)
|
||||||
m_initialDir_out(QDir::fromNativeSeparators(QDesktopServices::storageLocation(QDesktopServices::MoviesLocation))),
|
|
||||||
m_lastFilterIndex(0)
|
|
||||||
{
|
{
|
||||||
//Init the dialog, from the .ui file
|
//Init the dialog, from the .ui file
|
||||||
setupUi(this);
|
setupUi(this);
|
||||||
@ -225,12 +223,6 @@ AddJobDialog::AddJobDialog(QWidget *parent, OptionsModel *options, bool x64suppo
|
|||||||
//Hide optional controls
|
//Hide optional controls
|
||||||
checkBoxApplyToAll->setVisible(false);
|
checkBoxApplyToAll->setVisible(false);
|
||||||
|
|
||||||
//Setup file type filter
|
|
||||||
m_types.clear();
|
|
||||||
m_types << tr("Matroska Files (*.mkv)");
|
|
||||||
m_types << tr("MPEG-4 Part 14 Container (*.mp4)");
|
|
||||||
m_types << tr("H.264 Elementary Stream (*.264)");
|
|
||||||
|
|
||||||
//Monitor RC mode combobox
|
//Monitor RC mode combobox
|
||||||
connect(cbxRateControlMode, SIGNAL(currentIndexChanged(int)), this, SLOT(modeIndexChanged(int)));
|
connect(cbxRateControlMode, SIGNAL(currentIndexChanged(int)), this, SLOT(modeIndexChanged(int)));
|
||||||
|
|
||||||
@ -275,13 +267,6 @@ AddJobDialog::AddJobDialog(QWidget *parent, OptionsModel *options, bool x64suppo
|
|||||||
//Setup template selector
|
//Setup template selector
|
||||||
loadTemplateList();
|
loadTemplateList();
|
||||||
connect(cbxTemplate, SIGNAL(currentIndexChanged(int)), this, SLOT(templateSelected()));
|
connect(cbxTemplate, SIGNAL(currentIndexChanged(int)), this, SLOT(templateSelected()));
|
||||||
|
|
||||||
//Load directories
|
|
||||||
const QString appDir = x264_data_path();
|
|
||||||
QSettings settings(QString("%1/last.ini").arg(appDir), QSettings::IniFormat);
|
|
||||||
m_initialDir_src = settings.value("path/directory_openFrom", m_initialDir_src).toString();
|
|
||||||
m_initialDir_out = settings.value("path/directory_saveTo", m_initialDir_out).toString();
|
|
||||||
m_lastFilterIndex = settings.value("path/filterIndex", m_lastFilterIndex).toInt();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
AddJobDialog::~AddJobDialog(void)
|
AddJobDialog::~AddJobDialog(void)
|
||||||
@ -322,12 +307,10 @@ void AddJobDialog::showEvent(QShowEvent *event)
|
|||||||
QDialog::showEvent(event);
|
QDialog::showEvent(event);
|
||||||
templateSelected();
|
templateSelected();
|
||||||
|
|
||||||
if(!editSource->text().isEmpty()) m_initialDir_src = QFileInfo(QDir::fromNativeSeparators(editSource->text())).path();
|
|
||||||
if(!editOutput->text().isEmpty()) m_initialDir_out = QFileInfo(QDir::fromNativeSeparators(editOutput->text())).path();
|
|
||||||
|
|
||||||
if((!editSource->text().isEmpty()) && editOutput->text().isEmpty())
|
if((!editSource->text().isEmpty()) && editOutput->text().isEmpty())
|
||||||
{
|
{
|
||||||
generateOutputFileName(QDir::fromNativeSeparators(editSource->text()));
|
QString outPath = generateOutputFileName(QDir::fromNativeSeparators(editSource->text()), m_recentlyUsed->outputDirectory, m_recentlyUsed->filterIndex, m_saveToSourceFolder);
|
||||||
|
editOutput->setText(QDir::toNativeSeparators(outPath));
|
||||||
buttonAccept->setFocus();
|
buttonAccept->setFocus();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -410,7 +393,7 @@ void AddJobDialog::dropEvent(QDropEvent *event)
|
|||||||
if(!droppedFile.isEmpty())
|
if(!droppedFile.isEmpty())
|
||||||
{
|
{
|
||||||
editSource->setText(QDir::toNativeSeparators(droppedFile));
|
editSource->setText(QDir::toNativeSeparators(droppedFile));
|
||||||
generateOutputFileName(droppedFile);
|
generateOutputFileName(droppedFile, m_recentlyUsed->outputDirectory, m_recentlyUsed->filterIndex, m_saveToSourceFolder);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -426,33 +409,36 @@ void AddJobDialog::modeIndexChanged(int index)
|
|||||||
|
|
||||||
void AddJobDialog::accept(void)
|
void AddJobDialog::accept(void)
|
||||||
{
|
{
|
||||||
|
//Selection complete?
|
||||||
if(editSource->text().trimmed().isEmpty())
|
if(editSource->text().trimmed().isEmpty())
|
||||||
{
|
{
|
||||||
QMessageBox::warning(this, tr("Not Found!"), tr("Please select a valid source file first!"));
|
QMessageBox::warning(this, tr("Not Found!"), tr("Please select a valid source file first!"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(editOutput->text().trimmed().isEmpty())
|
if(editOutput->text().trimmed().isEmpty())
|
||||||
{
|
{
|
||||||
QMessageBox::warning(this, tr("Not Selected!"), tr("<nobr>Please select a valid output file first!</nobr>"));
|
QMessageBox::warning(this, tr("Not Selected!"), tr("<nobr>Please select a valid output file first!</nobr>"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
QFileInfo sourceFile = QFileInfo(editSource->text());
|
//Does source exist?
|
||||||
|
QFileInfo sourceFile = QFileInfo(this->sourceFile());
|
||||||
if(!(sourceFile.exists() && sourceFile.isFile()))
|
if(!(sourceFile.exists() && sourceFile.isFile()))
|
||||||
{
|
{
|
||||||
QMessageBox::warning(this, tr("Not Found!"), tr("<nobr>The selected source file could not be found!</nobr>"));
|
QMessageBox::warning(this, tr("Not Found!"), tr("<nobr>The selected source file could not be found!</nobr>"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
QFileInfo outputDir = QFileInfo(QFileInfo(editOutput->text()).path());
|
//Is destination dir writable?
|
||||||
|
QFileInfo outputDir = QFileInfo(QFileInfo(this->outputFile()).absolutePath());
|
||||||
if(!(outputDir.exists() && outputDir.isDir() && outputDir.isWritable()))
|
if(!(outputDir.exists() && outputDir.isDir() && outputDir.isWritable()))
|
||||||
{
|
{
|
||||||
QMessageBox::warning(this, tr("Not Writable!"), tr("<nobr>Output directory does not exist or is not writable!</nobr>"));
|
QMessageBox::warning(this, tr("Not Writable!"), tr("<nobr>Output directory does not exist or is not writable!</nobr>"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
QFileInfo outputFile = QFileInfo(editOutput->text());
|
//Does output file already exist?
|
||||||
|
QFileInfo outputFile = QFileInfo(this->outputFile());
|
||||||
if(outputFile.exists() && outputFile.isFile())
|
if(outputFile.exists() && outputFile.isFile())
|
||||||
{
|
{
|
||||||
int ret = QMessageBox::question(this, tr("Already Exists!"), tr("<nobr>Output file already exists! Overwrite?</nobr>"), QMessageBox::Yes | QMessageBox::No, QMessageBox::No);
|
int ret = QMessageBox::question(this, tr("Already Exists!"), tr("<nobr>Output file already exists! Overwrite?</nobr>"), QMessageBox::Yes | QMessageBox::No, QMessageBox::No);
|
||||||
@ -463,23 +449,21 @@ void AddJobDialog::accept(void)
|
|||||||
QMessageBox::warning(this, tr("Not a File!"), tr("<nobr>Selected output file does not appear to be a valid file!</nobr>"));
|
QMessageBox::warning(this, tr("Not a File!"), tr("<nobr>Selected output file does not appear to be a valid file!</nobr>"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//Custom parameters okay?
|
||||||
if(!editCustomX264Params->hasAcceptableInput())
|
if(!editCustomX264Params->hasAcceptableInput())
|
||||||
{
|
{
|
||||||
int ret = QMessageBox::warning(this, tr("Invalid Params"), tr("<nobr>Your custom parameters are invalid and will be discarded!</nobr>"), QMessageBox::Ignore | QMessageBox::Cancel, QMessageBox::Cancel);
|
int ret = QMessageBox::warning(this, tr("Invalid Params"), tr("<nobr>Your custom parameters are invalid and will be discarded!</nobr>"), QMessageBox::Ignore | QMessageBox::Cancel, QMessageBox::Cancel);
|
||||||
if(ret != QMessageBox::Ignore) return;
|
if(ret != QMessageBox::Ignore) return;
|
||||||
}
|
}
|
||||||
|
|
||||||
//Save directories
|
//Update recently used
|
||||||
const QString appDir = x264_data_path();
|
m_recentlyUsed->sourceDirectory = sourceFile.canonicalPath();
|
||||||
QSettings settings(QString("%1/last.ini").arg(appDir), QSettings::IniFormat);
|
m_recentlyUsed->outputDirectory = outputFile.canonicalPath();
|
||||||
if(settings.isWritable())
|
m_recentlyUsed->filterIndex = qMax(0, getFilterIdx(outputFile.suffix()));
|
||||||
{
|
saveRecentlyUsed(m_recentlyUsed);
|
||||||
settings.setValue("path/directory_saveTo", m_initialDir_out);
|
|
||||||
settings.setValue("path/directory_openFrom", m_initialDir_src);
|
|
||||||
settings.setValue("path/filterIndex", m_lastFilterIndex);
|
|
||||||
settings.sync();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
//Save options
|
||||||
saveOptions(m_options);
|
saveOptions(m_options);
|
||||||
QDialog::accept();
|
QDialog::accept();
|
||||||
}
|
}
|
||||||
@ -488,39 +472,40 @@ void AddJobDialog::browseButtonClicked(void)
|
|||||||
{
|
{
|
||||||
if(QObject::sender() == buttonBrowseSource)
|
if(QObject::sender() == buttonBrowseSource)
|
||||||
{
|
{
|
||||||
QString initDir = VALID_DIR(m_initialDir_src) ? m_initialDir_src : QDesktopServices::storageLocation(QDesktopServices::MoviesLocation);
|
QString initDir = m_recentlyUsed->sourceDirectory;
|
||||||
if(!editSource->text().isEmpty()) initDir = QString("%1/%2").arg(initDir, QFileInfo(QDir::fromNativeSeparators(editSource->text())).fileName());
|
if(!editSource->text().isEmpty())
|
||||||
|
{
|
||||||
|
QString tempDir = QFileInfo(QDir::fromNativeSeparators(editSource->text())).canonicalPath();
|
||||||
|
if(VALID_DIR(tempDir)) initDir = tempDir;
|
||||||
|
}
|
||||||
|
|
||||||
QString filePath = QFileDialog::getOpenFileName(this, tr("Open Source File"), initDir, makeFileFilter(), NULL, QFileDialog::DontUseNativeDialog);
|
QString filePath = QFileDialog::getOpenFileName(this, tr("Open Source File"), initDir, getInputFilterLst(), NULL, QFileDialog::DontUseNativeDialog);
|
||||||
if(!(filePath.isNull() || filePath.isEmpty()))
|
if(!(filePath.isNull() || filePath.isEmpty()))
|
||||||
{
|
{
|
||||||
editSource->setText(QDir::toNativeSeparators(filePath));
|
editSource->setText(QDir::toNativeSeparators(filePath));
|
||||||
generateOutputFileName(filePath);
|
QString destPath = generateOutputFileName(filePath, m_recentlyUsed->outputDirectory, m_recentlyUsed->filterIndex, m_saveToSourceFolder);
|
||||||
m_initialDir_src = QFileInfo(filePath).path();
|
editOutput->setText(QDir::toNativeSeparators(destPath));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(QObject::sender() == buttonBrowseOutput)
|
else if(QObject::sender() == buttonBrowseOutput)
|
||||||
{
|
{
|
||||||
QString initDir = VALID_DIR(m_initialDir_out) ? m_initialDir_out : QDesktopServices::storageLocation(QDesktopServices::MoviesLocation);
|
QString initDir = m_recentlyUsed->outputDirectory;
|
||||||
if(!editOutput->text().isEmpty()) initDir = QString("%1/%2").arg(initDir, QFileInfo(QDir::fromNativeSeparators(editOutput->text())).completeBaseName());
|
if(!editOutput->text().isEmpty())
|
||||||
int filterIdx = getFilterIndex(QFileInfo(QDir::fromNativeSeparators(editOutput->text())).suffix());
|
{
|
||||||
QString selectedType = m_types.at((filterIdx >= 0) ? filterIdx : m_lastFilterIndex);
|
QString tempDir = QFileInfo(QDir::fromNativeSeparators(editOutput->text())).canonicalPath();
|
||||||
|
if(VALID_DIR(tempDir)) initDir = tempDir;
|
||||||
|
}
|
||||||
|
|
||||||
QString filePath = QFileDialog::getSaveFileName(this, tr("Choose Output File"), initDir, m_types.join(";;"), &selectedType, QFileDialog::DontUseNativeDialog | QFileDialog::DontConfirmOverwrite);
|
QString selectedType = getFilterStr(m_recentlyUsed->filterIndex);
|
||||||
|
QString filePath = QFileDialog::getSaveFileName(this, tr("Choose Output File"), initDir, getFilterLst(), &selectedType, QFileDialog::DontUseNativeDialog | QFileDialog::DontConfirmOverwrite);
|
||||||
|
|
||||||
if(!(filePath.isNull() || filePath.isEmpty()))
|
if(!(filePath.isNull() || filePath.isEmpty()))
|
||||||
{
|
{
|
||||||
if(getFilterIndex(QFileInfo(filePath).suffix()) < 0)
|
if(getFilterIdx(QFileInfo(filePath).suffix()) < 0)
|
||||||
{
|
{
|
||||||
filterIdx = m_types.indexOf(selectedType);
|
filePath = QString("%1.%2").arg(filePath, getFilterExt(m_recentlyUsed->filterIndex));
|
||||||
if(filterIdx >= 0)
|
|
||||||
{
|
|
||||||
filePath = QString("%1.%2").arg(filePath, getFilterExt(filterIdx));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
editOutput->setText(QDir::toNativeSeparators(filePath));
|
editOutput->setText(QDir::toNativeSeparators(filePath));
|
||||||
m_lastFilterIndex = getFilterIndex(QFileInfo(filePath).suffix());
|
|
||||||
m_initialDir_out = QFileInfo(filePath).path();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -823,43 +808,6 @@ void AddJobDialog::saveOptions(OptionsModel *options)
|
|||||||
options->setCustomAvs2YUV(editCustomAvs2YUVParams->hasAcceptableInput() ? editCustomAvs2YUVParams->text().simplified() : QString());
|
options->setCustomAvs2YUV(editCustomAvs2YUVParams->hasAcceptableInput() ? editCustomAvs2YUVParams->text().simplified() : QString());
|
||||||
}
|
}
|
||||||
|
|
||||||
QString AddJobDialog::makeFileFilter(void)
|
|
||||||
{
|
|
||||||
static const struct
|
|
||||||
{
|
|
||||||
const char *name;
|
|
||||||
const char *fext;
|
|
||||||
}
|
|
||||||
s_filters[] =
|
|
||||||
{
|
|
||||||
{"Avisynth Scripts", "avs"},
|
|
||||||
{"Matroska Files", "mkv"},
|
|
||||||
{"MPEG-4 Part 14 Container", "mp4"},
|
|
||||||
{"Audio Video Interleaved", "avi"},
|
|
||||||
{"Flash Video", "flv"},
|
|
||||||
{"YUV4MPEG2 Stream", "y4m"},
|
|
||||||
{"Uncompresses YUV Data", "yuv"},
|
|
||||||
{NULL, NULL}
|
|
||||||
};
|
|
||||||
|
|
||||||
QString filters("All supported files (");
|
|
||||||
|
|
||||||
for(size_t index = 0; s_filters[index].name && s_filters[index].fext; index++)
|
|
||||||
{
|
|
||||||
filters += QString((index > 0) ? " *.%1" : "*.%1").arg(QString::fromLatin1(s_filters[index].fext));
|
|
||||||
}
|
|
||||||
|
|
||||||
filters += QString(");;");
|
|
||||||
|
|
||||||
for(size_t index = 0; s_filters[index].name && s_filters[index].fext; index++)
|
|
||||||
{
|
|
||||||
filters += QString("%1 (*.%2);;").arg(QString::fromLatin1(s_filters[index].name), QString::fromLatin1(s_filters[index].fext));
|
|
||||||
}
|
|
||||||
|
|
||||||
filters += QString("All files (*.*)");
|
|
||||||
return filters;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
void AddJobDialog::generateOutputFileName(const QString &filePath)
|
void AddJobDialog::generateOutputFileName(const QString &filePath)
|
||||||
{
|
{
|
||||||
@ -951,20 +899,20 @@ QString AddJobDialog::generateOutputFileName(const QString &sourceFilePath, cons
|
|||||||
|
|
||||||
if(!VALID_DIR(path))
|
if(!VALID_DIR(path))
|
||||||
{
|
{
|
||||||
RecentlyUsed defaults; initRecentlyUsed(&defaults);
|
RecentlyUsed defaults;
|
||||||
|
initRecentlyUsed(&defaults);
|
||||||
path = defaults.outputDirectory;
|
path = defaults.outputDirectory;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString outPath = QString("%1/%2.%3").arg(path, name, fext);
|
QString outPath = QString("%1/%2.%3").arg(path, name, fext);
|
||||||
|
|
||||||
if(QFileInfo(outPath).exists())
|
int n = 2;
|
||||||
|
while(QFileInfo(outPath).exists())
|
||||||
{
|
{
|
||||||
int i = 2;
|
outPath = QString("%1/%2 (%3).%4").arg(path, name, QString::number(n++), fext);
|
||||||
while(QFileInfo(outPath).exists())
|
|
||||||
{
|
|
||||||
outPath = QString("%1/%2 (%3).%4").arg(path, name, QString::number(i++), fext);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return outPath;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ------------------------------------------------------------------------- */
|
/* ------------------------------------------------------------------------- */
|
||||||
@ -976,9 +924,9 @@ static const struct
|
|||||||
}
|
}
|
||||||
FILE_TYPE_FILTERS[] =
|
FILE_TYPE_FILTERS[] =
|
||||||
{
|
{
|
||||||
{ "mkv", "Matroska Files (*.mkv)" },
|
{ "mkv", "Matroska Files" },
|
||||||
{ "mp4", "MPEG-4 Part 14 Container (*.mp4)" },
|
{ "mp4", "MPEG-4 Part 14 Container" },
|
||||||
{ "264", "H.264 Elementary Stream (*.264)"},
|
{ "264", "H.264 Elementary Stream"},
|
||||||
{ NULL, NULL }
|
{ NULL, NULL }
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -997,7 +945,7 @@ QString AddJobDialog::getFilterExt(const int filterIndex)
|
|||||||
|
|
||||||
int AddJobDialog::getFilterIdx(const QString &fileExt)
|
int AddJobDialog::getFilterIdx(const QString &fileExt)
|
||||||
{
|
{
|
||||||
for(int i = 0; FILE_TYPE_FILTERS[i].pcExt; i++)
|
for(int i = 0; (FILE_TYPE_FILTERS[i].pcExt && FILE_TYPE_FILTERS[i].pcStr); i++)
|
||||||
{
|
{
|
||||||
if(fileExt.compare(QString::fromLatin1(FILE_TYPE_FILTERS[i].pcExt), Qt::CaseInsensitive) == 0)
|
if(fileExt.compare(QString::fromLatin1(FILE_TYPE_FILTERS[i].pcExt), Qt::CaseInsensitive) == 0)
|
||||||
{
|
{
|
||||||
@ -1007,3 +955,65 @@ int AddJobDialog::getFilterIdx(const QString &fileExt)
|
|||||||
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QString AddJobDialog::getFilterStr(const int filterIndex)
|
||||||
|
{
|
||||||
|
int count = 0;
|
||||||
|
while((FILE_TYPE_FILTERS[count].pcExt) && (FILE_TYPE_FILTERS[count].pcStr)) count++;
|
||||||
|
|
||||||
|
if((filterIndex >= 0) && (filterIndex < count))
|
||||||
|
{
|
||||||
|
return QString("%1 (*.%2)").arg(QString::fromLatin1(FILE_TYPE_FILTERS[filterIndex].pcStr), QString::fromLatin1(FILE_TYPE_FILTERS[filterIndex].pcExt));
|
||||||
|
}
|
||||||
|
|
||||||
|
return QString("%1 (*.%2)").arg(QString::fromLatin1(FILE_TYPE_FILTERS[0].pcStr), QString::fromLatin1(FILE_TYPE_FILTERS[0].pcExt));
|
||||||
|
}
|
||||||
|
|
||||||
|
QString AddJobDialog::getFilterLst(void)
|
||||||
|
{
|
||||||
|
QStringList filters;
|
||||||
|
|
||||||
|
for(int i = 0; (FILE_TYPE_FILTERS[i].pcExt && FILE_TYPE_FILTERS[i].pcStr); i++)
|
||||||
|
{
|
||||||
|
filters << QString("%1 (*.%2)").arg(QString::fromLatin1(FILE_TYPE_FILTERS[i].pcStr), QString::fromLatin1(FILE_TYPE_FILTERS[i].pcExt));
|
||||||
|
}
|
||||||
|
|
||||||
|
return filters.join(";;");
|
||||||
|
}
|
||||||
|
|
||||||
|
QString AddJobDialog::getInputFilterLst(void)
|
||||||
|
{
|
||||||
|
static const struct
|
||||||
|
{
|
||||||
|
const char *name;
|
||||||
|
const char *fext;
|
||||||
|
}
|
||||||
|
s_filters[] =
|
||||||
|
{
|
||||||
|
{"Avisynth Scripts", "avs"},
|
||||||
|
{"Matroska Files", "mkv"},
|
||||||
|
{"MPEG-4 Part 14 Container", "mp4"},
|
||||||
|
{"Audio Video Interleaved", "avi"},
|
||||||
|
{"Flash Video", "flv"},
|
||||||
|
{"YUV4MPEG2 Stream", "y4m"},
|
||||||
|
{"Uncompresses YUV Data", "yuv"},
|
||||||
|
{NULL, NULL}
|
||||||
|
};
|
||||||
|
|
||||||
|
QString filters("All supported files (");
|
||||||
|
|
||||||
|
for(size_t index = 0; (s_filters[index].name && s_filters[index].fext); index++)
|
||||||
|
{
|
||||||
|
filters += QString((index > 0) ? " *.%1" : "*.%1").arg(QString::fromLatin1(s_filters[index].fext));
|
||||||
|
}
|
||||||
|
|
||||||
|
filters += QString(");;");
|
||||||
|
|
||||||
|
for(size_t index = 0; s_filters[index].name && s_filters[index].fext; index++)
|
||||||
|
{
|
||||||
|
filters += QString("%1 (*.%2);;").arg(QString::fromLatin1(s_filters[index].name), QString::fromLatin1(s_filters[index].fext));
|
||||||
|
}
|
||||||
|
|
||||||
|
filters += QString("All files (*.*)");
|
||||||
|
return filters;
|
||||||
|
}
|
||||||
|
@ -32,9 +32,6 @@ class AddJobDialog : public QDialog, private Ui::AddJobDialog
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
AddJobDialog(QWidget *parent, OptionsModel *options, bool x64supported, bool use10BitEncoding, bool saveToSourceFolder);
|
|
||||||
~AddJobDialog(void);
|
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
QString sourceDirectory;
|
QString sourceDirectory;
|
||||||
@ -43,6 +40,9 @@ public:
|
|||||||
}
|
}
|
||||||
RecentlyUsed;
|
RecentlyUsed;
|
||||||
|
|
||||||
|
AddJobDialog(QWidget *parent, OptionsModel *options, RecentlyUsed *recentlyUsed, bool x64supported, bool use10BitEncoding, bool saveToSourceFolder);
|
||||||
|
~AddJobDialog(void);
|
||||||
|
|
||||||
QString sourceFile(void);
|
QString sourceFile(void);
|
||||||
QString outputFile(void);
|
QString outputFile(void);
|
||||||
QString preset(void) { return cbxPreset->itemText(cbxPreset->currentIndex()); }
|
QString preset(void) { return cbxPreset->itemText(cbxPreset->currentIndex()); }
|
||||||
@ -64,19 +64,19 @@ public:
|
|||||||
static QString generateOutputFileName(const QString &sourceFilePath, const QString &destinationDirectory, const int filterIndex, const bool saveToSourceDir);
|
static QString generateOutputFileName(const QString &sourceFilePath, const QString &destinationDirectory, const int filterIndex, const bool saveToSourceDir);
|
||||||
static int getFilterIdx(const QString &fileExt);
|
static int getFilterIdx(const QString &fileExt);
|
||||||
static QString getFilterExt(const int filterIndex);
|
static QString getFilterExt(const int filterIndex);
|
||||||
|
static QString AddJobDialog::getFilterStr(const int filterIndex);
|
||||||
|
static QString getFilterLst(void);
|
||||||
|
static QString getInputFilterLst(void);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
OptionsModel *m_options;
|
OptionsModel *m_options;
|
||||||
OptionsModel *m_defaults;
|
OptionsModel *m_defaults;
|
||||||
|
|
||||||
RecentlyUsed *m_recentlyUsed;
|
RecentlyUsed *m_recentlyUsed;
|
||||||
|
|
||||||
const bool m_x64supported;
|
const bool m_x64supported;
|
||||||
const bool m_use10BitEncoding;
|
const bool m_use10BitEncoding;
|
||||||
const bool m_saveToSourceFolder;
|
const bool m_saveToSourceFolder;
|
||||||
|
|
||||||
QStringList m_types;
|
|
||||||
|
|
||||||
virtual void showEvent(QShowEvent *event);
|
virtual void showEvent(QShowEvent *event);
|
||||||
virtual bool eventFilter(QObject *o, QEvent *e);
|
virtual bool eventFilter(QObject *o, QEvent *e);
|
||||||
virtual void dragEnterEvent(QDragEnterEvent *event);
|
virtual void dragEnterEvent(QDragEnterEvent *event);
|
||||||
@ -100,6 +100,4 @@ private:
|
|||||||
void restoreOptions(OptionsModel *options);
|
void restoreOptions(OptionsModel *options);
|
||||||
void saveOptions(OptionsModel *options);
|
void saveOptions(OptionsModel *options);
|
||||||
void updateComboBox(QComboBox *cbox, const QString &text);
|
void updateComboBox(QComboBox *cbox, const QString &text);
|
||||||
QString makeFileFilter(void);
|
|
||||||
void generateOutputFileName(const QString &filePath);
|
|
||||||
};
|
};
|
||||||
|
@ -23,8 +23,6 @@
|
|||||||
|
|
||||||
#include "model_jobList.h"
|
#include "model_jobList.h"
|
||||||
#include "model_options.h"
|
#include "model_options.h"
|
||||||
#include "win_addJob.h"
|
|
||||||
#include "win_preferences.h"
|
|
||||||
#include "thread_avisynth.h"
|
#include "thread_avisynth.h"
|
||||||
#include "taskbar7.h"
|
#include "taskbar7.h"
|
||||||
#include "resource.h"
|
#include "resource.h"
|
||||||
@ -83,6 +81,10 @@ MainWindow::MainWindow(const x264_cpu_t *const cpuFeatures)
|
|||||||
PreferencesDialog::initPreferences(&m_preferences);
|
PreferencesDialog::initPreferences(&m_preferences);
|
||||||
PreferencesDialog::loadPreferences(&m_preferences);
|
PreferencesDialog::loadPreferences(&m_preferences);
|
||||||
|
|
||||||
|
//Load recently used
|
||||||
|
AddJobDialog::initRecentlyUsed(&m_recentlyUsed);
|
||||||
|
AddJobDialog::loadRecentlyUsed(&m_recentlyUsed);
|
||||||
|
|
||||||
//Create options object
|
//Create options object
|
||||||
m_options = new OptionsModel();
|
m_options = new OptionsModel();
|
||||||
OptionsModel::loadTemplate(m_options, QString::fromLatin1(tpl_last));
|
OptionsModel::loadTemplate(m_options, QString::fromLatin1(tpl_last));
|
||||||
@ -1010,7 +1012,7 @@ void MainWindow::dropEvent(QDropEvent *event)
|
|||||||
bool MainWindow::createJob(QString &sourceFileName, QString &outputFileName, OptionsModel *options, bool &runImmediately, const bool restart, int fileNo, int fileTotal, bool *applyToAll)
|
bool MainWindow::createJob(QString &sourceFileName, QString &outputFileName, OptionsModel *options, bool &runImmediately, const bool restart, int fileNo, int fileTotal, bool *applyToAll)
|
||||||
{
|
{
|
||||||
bool okay = false;
|
bool okay = false;
|
||||||
AddJobDialog *addDialog = new AddJobDialog(this, options, m_cpuFeatures->x64, m_preferences.use10BitEncoding, m_preferences.saveToSourcePath);
|
AddJobDialog *addDialog = new AddJobDialog(this, options, &m_recentlyUsed, m_cpuFeatures->x64, m_preferences.use10BitEncoding, m_preferences.saveToSourcePath);
|
||||||
|
|
||||||
addDialog->setRunImmediately(runImmediately);
|
addDialog->setRunImmediately(runImmediately);
|
||||||
if(!sourceFileName.isEmpty()) addDialog->setSourceFile(sourceFileName);
|
if(!sourceFileName.isEmpty()) addDialog->setSourceFile(sourceFileName);
|
||||||
|
@ -25,6 +25,7 @@
|
|||||||
#include "thread_ipc.h"
|
#include "thread_ipc.h"
|
||||||
#include "thread_encode.h"
|
#include "thread_encode.h"
|
||||||
#include "win_preferences.h"
|
#include "win_preferences.h"
|
||||||
|
#include "win_addJob.h"
|
||||||
#include "global.h"
|
#include "global.h"
|
||||||
|
|
||||||
class JobListModel;
|
class JobListModel;
|
||||||
@ -60,6 +61,7 @@ private:
|
|||||||
QList<QFile*> m_toolsList;
|
QList<QFile*> m_toolsList;
|
||||||
|
|
||||||
PreferencesDialog::Preferences m_preferences;
|
PreferencesDialog::Preferences m_preferences;
|
||||||
|
AddJobDialog::RecentlyUsed m_recentlyUsed;
|
||||||
|
|
||||||
const x264_cpu_t *const m_cpuFeatures;
|
const x264_cpu_t *const m_cpuFeatures;
|
||||||
const QString m_appDir;
|
const QString m_appDir;
|
||||||
|
Loading…
Reference in New Issue
Block a user