Append the proper extension to the output file name, according to selected file type.

This commit is contained in:
LoRd_MuldeR 2012-02-04 22:44:19 +01:00
parent d7d5f27756
commit ccfe3910ba
3 changed files with 18 additions and 12 deletions

View File

@ -248,7 +248,7 @@ QModelIndex JobListModel::insertJob(EncodeThread *thread)
}
int n = 2;
QString jobName = QString("%1 [%2]").arg(QFileInfo(thread->sourceFileName()).completeBaseName(), config);
QString jobName = QString("%1 (%2)").arg(QFileInfo(thread->sourceFileName()).completeBaseName().simplified(), config);
forever
{
@ -263,7 +263,7 @@ QModelIndex JobListModel::insertJob(EncodeThread *thread)
}
if(!unique)
{
jobName = QString("%1 (%2) [%3]").arg(QFileInfo(thread->sourceFileName()).completeBaseName(), QString::number(n++), config);
jobName = QString("%1 %2 (%3)").arg(QFileInfo(thread->sourceFileName()).completeBaseName().simplified(), QString::number(n++), config);
continue;
}
break;

View File

@ -315,20 +315,25 @@ void AddJobDialog::browseButtonClicked(void)
}
else if(QObject::sender() == buttonBrowseOutput)
{
QString filters;
filters += tr("Matroska Files (*.mkv)").append(";;");
filters += tr("MPEG-4 Part 14 Container (*.mp4)").append(";;");
filters += tr("H.264 Elementary Stream (*.264)");
QString types, selectedType;
types += tr("Matroska Files (*.mkv)").append(";;");
types += tr("MPEG-4 Part 14 Container (*.mp4)").append(";;");
types += tr("H.264 Elementary Stream (*.264)");
QString filePath = QFileDialog::getSaveFileName(this, tr("Choose Output File"), VALID_DIR(initialDir_out) ? initialDir_out : QDesktopServices::storageLocation(QDesktopServices::MoviesLocation), filters, NULL, QFileDialog::DontUseNativeDialog | QFileDialog::DontConfirmOverwrite);
QString filePath = QFileDialog::getSaveFileName(this, tr("Choose Output File"), VALID_DIR(initialDir_out) ? initialDir_out : QDesktopServices::storageLocation(QDesktopServices::MoviesLocation), types, &selectedType, QFileDialog::DontUseNativeDialog | QFileDialog::DontConfirmOverwrite);
if(!(filePath.isNull() || filePath.isEmpty()))
{
QString suffix = QFileInfo(filePath).suffix();
if(suffix.compare("mkv", Qt::CaseInsensitive) && suffix.compare("mp4", Qt::CaseInsensitive) && suffix.compare("264", Qt::CaseInsensitive))
QRegExp ext("\\(\\*\\.(.+)\\)");
if(ext.lastIndexIn(selectedType) >= 0)
{
filePath = QString("%1.mkv").arg(filePath);
QString suffix = QFileInfo(filePath).suffix();
if(suffix.compare(ext.cap(1), Qt::CaseInsensitive))
{
filePath = QString("%1.%2").arg(filePath, ext.cap(1));
}
}
editOutput->setText(QDir::toNativeSeparators(filePath));
initialDir_out = QFileInfo(filePath).path();
}

View File

@ -2,10 +2,11 @@
REM ///////////////////////////////////////////////////////////////////////////
set "MSVC_PATH=D:\Microsoft Visual Studio 10.0\VC"
set "NSIS_PATH=E:\NSIS\_Unicode"
set "QTVC_PATH=E:\QtSDK\4.8.0\MSVC2010"
set "QTVC_PATH=E:\QtSDK\Desktop\Qt\4.8.0\msvc2010"
set "UPX3_PATH=E:\UPX"
REM ///////////////////////////////////////////////////////////////////////////
call "%QTVC_PATH%\bin\qtvars.bat"
if exist "%QTVC_PATH%\bin\qtvars.bat" ( call "%QTVC_PATH%\bin\qtvars.bat" )
if exist "%QTVC_PATH%\bin\qtenv2.bat" ( call "%QTVC_PATH%\bin\qtenv2.bat" )
call "%MSVC_PATH%\vcvarsall.bat" x86
echo ---------------------------------------------------------------------
echo BEGIN BUILD