From ccfe3910ba08d5433d912cdeebf3851e500ae4d7 Mon Sep 17 00:00:00 2001 From: lordmulder Date: Sat, 4 Feb 2012 22:44:19 +0100 Subject: [PATCH] Append the proper extension to the output file name, according to selected file type. --- src/model_jobList.cpp | 4 ++-- src/win_addJob.cpp | 21 +++++++++++++-------- z_build.bat | 5 +++-- 3 files changed, 18 insertions(+), 12 deletions(-) diff --git a/src/model_jobList.cpp b/src/model_jobList.cpp index 6d019d1..74e2d6c 100644 --- a/src/model_jobList.cpp +++ b/src/model_jobList.cpp @@ -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; diff --git a/src/win_addJob.cpp b/src/win_addJob.cpp index f41eeaa..d56f0fd 100644 --- a/src/win_addJob.cpp +++ b/src/win_addJob.cpp @@ -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(); } diff --git a/z_build.bat b/z_build.bat index 8f671a9..c3bbf18 100644 --- a/z_build.bat +++ b/z_build.bat @@ -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