make more strings translatable + try to load a default translation that suits the user's system language

This commit is contained in:
LoRd_MuldeR 2011-01-02 01:09:05 +01:00
parent 5a1ff67e42
commit 8c0fa11803
15 changed files with 150 additions and 48 deletions

View File

@ -1211,6 +1211,36 @@
<File
RelativePath=".\src\Registry_Decoder.h"
>
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCustomBuildTool"
Description="MOC &quot;$(SolutionDir)tmp\MOC_$(SafeInputName).cpp&quot;"
CommandLine="&quot;$(QTDIR)\bin\moc.exe&quot; -o &quot;$(SolutionDir)tmp\MOC_$(SafeInputName).cpp&quot; &quot;$(InputPath)&quot;"
Outputs="&quot;$(SolutionDir)tmp\MOC_$(SafeInputName).cpp&quot;"
/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCustomBuildTool"
Description="MOC &quot;$(SolutionDir)tmp\MOC_$(SafeInputName).cpp&quot;"
CommandLine="&quot;$(QTDIR)\bin\moc.exe&quot; -o &quot;$(SolutionDir)tmp\MOC_$(SafeInputName).cpp&quot; &quot;$(InputPath)&quot;"
Outputs="&quot;$(SolutionDir)tmp\MOC_$(SafeInputName).cpp&quot;"
/>
</FileConfiguration>
<FileConfiguration
Name="Release_Static|Win32"
>
<Tool
Name="VCCustomBuildTool"
Description="MOC &quot;$(SolutionDir)tmp\MOC_$(SafeInputName).cpp&quot;"
CommandLine="&quot;$(QTDIR)\bin\moc.exe&quot; -o &quot;$(SolutionDir)tmp\MOC_$(SafeInputName).cpp&quot; &quot;$(InputPath)&quot;"
Outputs="&quot;$(SolutionDir)tmp\MOC_$(SafeInputName).cpp&quot;"
/>
</FileConfiguration>
</File>
<File
RelativePath=".\src\Resource.h"
@ -1514,6 +1544,10 @@
RelativePath=".\tmp\MOC_Model_Progress.cpp"
>
</File>
<File
RelativePath=".\tmp\MOC_Registry_Decoder.cpp"
>
</File>
<File
RelativePath=".\tmp\MOC_Thread_FileAnalyzer.cpp"
>
@ -1676,7 +1710,7 @@
>
<Tool
Name="VCCustomBuildTool"
CommandLine="&quot;$(QTDIR)\bin\rcc.exe&quot; -o &quot;$(SolutionDir)tmp\RCC_$(SafeInputName).cpp&quot; -name &quot;$(SafeInputName)&quot; &quot;$(InputPath)&quot;"
CommandLine="&quot;$(QTDIR)\bin\rcc.exe&quot; -o &quot;$(SolutionDir)tmp\RCC_$(SafeInputName).cpp&quot; -name &quot;$(SafeInputName)&quot; &quot;$(InputPath)&quot;&#x0D;&#x0A;"
AdditionalDependencies="RCC &quot;$(SolutionDir)tmp\RCC_$(SafeInputName).cpp&quot;"
Outputs="&quot;$(SolutionDir)tmp\RCC_$(SafeInputName).cpp&quot;"
/>
@ -1686,7 +1720,7 @@
>
<Tool
Name="VCCustomBuildTool"
CommandLine="&quot;$(QTDIR)\bin\rcc.exe&quot; -o &quot;$(SolutionDir)tmp\RCC_$(SafeInputName).cpp&quot; -name &quot;$(SafeInputName)&quot; &quot;$(InputPath)&quot;"
CommandLine="&quot;$(QTDIR)\bin\rcc.exe&quot; -o &quot;$(SolutionDir)tmp\RCC_$(SafeInputName).cpp&quot; -name &quot;$(SafeInputName)&quot; &quot;$(InputPath)&quot;&#x0D;&#x0A;"
AdditionalDependencies="RCC &quot;$(SolutionDir)tmp\RCC_$(SafeInputName).cpp&quot;"
Outputs="&quot;$(SolutionDir)tmp\RCC_$(SafeInputName).cpp&quot;"
/>
@ -1696,7 +1730,7 @@
>
<Tool
Name="VCCustomBuildTool"
CommandLine="&quot;$(QTDIR)\bin\rcc.exe&quot; -o &quot;$(SolutionDir)tmp\RCC_$(SafeInputName).cpp&quot; -name &quot;$(SafeInputName)&quot; &quot;$(InputPath)&quot;"
CommandLine="&quot;$(QTDIR)\bin\rcc.exe&quot; -o &quot;$(SolutionDir)tmp\RCC_$(SafeInputName).cpp&quot; -name &quot;$(SafeInputName)&quot; &quot;$(InputPath)&quot;&#x0D;&#x0A;"
AdditionalDependencies="RCC &quot;$(SolutionDir)tmp\RCC_$(SafeInputName).cpp&quot;"
Outputs="&quot;$(SolutionDir)tmp\RCC_$(SafeInputName).cpp&quot;"
/>

View File

@ -37,6 +37,12 @@ del /Q "%OBJ_PATH%\*.idb"
del /Q "%MOC_PATH%\*.cpp"
del /Q "%MOC_PATH%\*.h"
REM ------------------------------------------
REM :: BUILD LANGUAGE FILES ::
REM ------------------------------------------
for %%f in (..\Translation\*.ts) do (
lrelease.exe %%f -qm ..\..\res\localization\%%~nf.qm
)
REM ------------------------------------------
REM :: BUILD BINARIES ::
REM ------------------------------------------
call _build.bat "..\..\LameXP.sln" "%LAMEXP_CONFIG%"

BIN
res/flags/en.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 599 B

View File

@ -25,7 +25,7 @@
#define VER_LAMEXP_MAJOR 4
#define VER_LAMEXP_MINOR_HI 0
#define VER_LAMEXP_MINOR_LO 0
#define VER_LAMEXP_BUILD 204
#define VER_LAMEXP_BUILD 209
#define VER_LAMEXP_SUFFIX TechPreview
/*

View File

@ -190,14 +190,14 @@ void AboutDialog::showAboutQt(void)
void AboutDialog::showAboutContributors(void)
{
QString contributorsAboutText;
contributorsAboutText += QString("<h3>%1</h3>").arg(tr("The following people have contributed to LameXP:"));
contributorsAboutText += QString("<h3><nobr>%1</nobr></h3>").arg(tr("The following people have contributed to LameXP:"));
contributorsAboutText += QString("<b>%1</b>").arg(tr("Translators:"));
contributorsAboutText += "<table style=\"margin-top:5px\">";
contributorsAboutText += CONTRIBUTOR("Englisch", "LoRd_MuldeR &lt;MuldeR2@GMX.de&gt;", ":/flags/gb.png");
contributorsAboutText += CONTRIBUTOR("Englisch", "LoRd_MuldeR &lt;MuldeR2@GMX.de&gt;", ":/flags/en.png");
contributorsAboutText += CONTRIBUTOR("Deutsch", "LoRd_MuldeR &lt;MuldeR2@GMX.de&gt;", ":/flags/de.png");
contributorsAboutText += "</table>";
contributorsAboutText += "<br><br>";
contributorsAboutText += QString("<i>%1</i><br>").arg(tr("If you are willing to contribute a LameXP translation, feel free to contact us!"));
contributorsAboutText += QString("<nobr><i>%1</i></nobr><br>").arg(tr("If you are willing to contribute a LameXP translation, feel free to contact us!"));
QMessageBox *contributorsAboutBox = new QMessageBox(this);
contributorsAboutBox->setText(contributorsAboutText);

View File

@ -599,7 +599,7 @@ void MainWindow::windowShown(void)
{
qWarning("Binary has expired !!!");
PlaySound(MAKEINTRESOURCE(IDR_WAVE_WHAMMY), GetModuleHandle(NULL), SND_RESOURCE | SND_SYNC);
if(QMessageBox::warning(this, tr("LameXP - Expired"), tr("This demo (pre-release) version of LameXP has expired at %1.\nLameXP is free software and release versions won't expire.").arg(expireDate.toString(Qt::ISODate)), tr("Check for Updates"), tr("Exit Program")) == 0)
if(QMessageBox::warning(this, tr("LameXP - Expired"), QString("<nobr>%1<br>%2</nobr>").arg(tr("This demo (pre-release) version of LameXP has expired at %1.").arg(expireDate.toString(Qt::ISODate)), tr("LameXP is free software and release versions won't expire.")), tr("Check for Updates"), tr("Exit Program")) == 0)
{
checkUpdatesActionActivated();
}
@ -627,7 +627,7 @@ void MainWindow::windowShown(void)
QDate lastUpdateCheck = QDate::fromString(m_settings->autoUpdateLastCheck(), Qt::ISODate);
if(!lastUpdateCheck.isValid() || QDate::currentDate() >= lastUpdateCheck.addDays(14))
{
if(QMessageBox::information(this, tr("Update Reminer"), (lastUpdateCheck.isValid() ? tr("Your last update check was more than 14 days ago. Check for updates now?") : tr("Your did not check for LameXP updates yet. Check for updates now?")), tr("Check for Updates"), tr("Postpone")) == 0)
if(QMessageBox::information(this, tr("Update Reminder"), (lastUpdateCheck.isValid() ? tr("Your last update check was more than 14 days ago. Check for updates now?") : tr("Your did not check for LameXP updates yet. Check for updates now?")), tr("Check for Updates"), tr("Postpone")) == 0)
{
checkUpdatesActionActivated();
}
@ -1214,7 +1214,7 @@ void MainWindow::notifyOtherInstance(void)
{
if(!m_banner->isVisible())
{
QMessageBox msgBox(QMessageBox::Warning, tr("Already running"), tr("LameXP is already running, please use the running instance!"), QMessageBox::NoButton, this, Qt::Dialog | Qt::MSWindowsFixedSizeDialogHint | Qt::WindowStaysOnTopHint);
QMessageBox msgBox(QMessageBox::Warning, tr("Already Running"), tr("LameXP is already running, please use the running instance!"), QMessageBox::NoButton, this, Qt::Dialog | Qt::MSWindowsFixedSizeDialogHint | Qt::WindowStaysOnTopHint);
msgBox.exec();
}
}

View File

@ -114,7 +114,7 @@ ProcessingDialog::ProcessingDialog(FileListModel *fileListModel, AudioFileModel
//Create context menu
m_contextMenu = new QMenu();
QAction *contextMenuAction = m_contextMenu->addAction(QIcon(":/icons/zoom.png"), "Show details for selected job");
QAction *contextMenuAction = m_contextMenu->addAction(QIcon(":/icons/zoom.png"), tr("Show details for selected job"));
view_log->setContextMenuPolicy(Qt::CustomContextMenu);
connect(view_log, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(contextMenuTriggered(QPoint)));
connect(contextMenuAction, SIGNAL(triggered(bool)), this, SLOT(contextMenuActionTriggered()));
@ -243,7 +243,7 @@ void ProcessingDialog::initEncoding(void)
m_playList.clear();
CHANGE_BACKGROUND_COLOR(frame_header, QColor(Qt::white));
SET_PROGRESS_TEXT("Encoding files, please wait...");
SET_PROGRESS_TEXT(tr("Encoding files, please wait..."));
m_progressIndicator->start();
button_closeDialog->setEnabled(false);
@ -268,7 +268,7 @@ void ProcessingDialog::abortEncoding(void)
m_userAborted = true;
button_AbortProcess->setEnabled(false);
SET_PROGRESS_TEXT("Aborted! Waiting for running jobs to terminate...");
SET_PROGRESS_TEXT(tr("Aborted! Waiting for running jobs to terminate..."));
for(int i = 0; i < m_threadList.count(); i++)
{
@ -283,7 +283,7 @@ void ProcessingDialog::doneEncoding(void)
if(!m_userAborted)
{
SET_PROGRESS_TEXT(QString("Encoding: %1 files of %2 completed so far, please wait...").arg(QString::number(progressBar->value()), QString::number(progressBar->maximum())));
SET_PROGRESS_TEXT(tr("Encoding: %1 files of %2 completed so far, please wait...").arg(QString::number(progressBar->value()), QString::number(progressBar->maximum())));
WinSevenTaskbar::setTaskbarProgress(this, progressBar->value(), progressBar->maximum());
}
@ -311,7 +311,7 @@ void ProcessingDialog::doneEncoding(void)
if(!m_userAborted && m_settings->createPlaylist() && !m_settings->outputToSourceDir())
{
SET_PROGRESS_TEXT("Creatig the playlist file, please wait...");
SET_PROGRESS_TEXT(tr("Creatig the playlist file, please wait..."));
QApplication::processEvents();
writePlayList();
}
@ -321,8 +321,8 @@ void ProcessingDialog::doneEncoding(void)
CHANGE_BACKGROUND_COLOR(frame_header, QColor("#FFF3BA"));
WinSevenTaskbar::setTaskbarState(this, WinSevenTaskbar::WinSevenTaskbarErrorState);
WinSevenTaskbar::setOverlayIcon(this, &QIcon(":/icons/error.png"));
SET_PROGRESS_TEXT((m_succeededJobs.count() > 0) ? QString("Process was aborted by the user after %1 file(s)!").arg(QString::number(m_succeededJobs.count())) : "Process was aborted prematurely by the user!");
m_systemTray->showMessage("LameXP - Aborted", "Process was aborted by the user.", QSystemTrayIcon::Warning);
SET_PROGRESS_TEXT((m_succeededJobs.count() > 0) ? tr("Process was aborted by the user after %1 file(s)!").arg(QString::number(m_succeededJobs.count())) : "Process was aborted prematurely by the user!");
m_systemTray->showMessage(tr("LameXP - Aborted"), tr("Process was aborted by the user."), QSystemTrayIcon::Warning);
m_systemTray->setIcon(QIcon(":/icons/cd_delete.png"));
QApplication::processEvents();
if(m_settings->soundsEnabled()) PlaySound(MAKEINTRESOURCE(IDR_WAVE_ABORTED), GetModuleHandle(NULL), SND_RESOURCE | SND_SYNC);
@ -334,8 +334,8 @@ void ProcessingDialog::doneEncoding(void)
CHANGE_BACKGROUND_COLOR(frame_header, QColor("#FFBABA"));
WinSevenTaskbar::setTaskbarState(this, WinSevenTaskbar::WinSevenTaskbarErrorState);
WinSevenTaskbar::setOverlayIcon(this, &QIcon(":/icons/exclamation.png"));
SET_PROGRESS_TEXT(QString("Error: %1 of %2 files failed. Double-click failed items for detailed information!").arg(QString::number(m_failedJobs.count()), QString::number(m_failedJobs.count() + m_succeededJobs.count())));
m_systemTray->showMessage("LameXP - Error", "At least one file has failed!", QSystemTrayIcon::Critical);
SET_PROGRESS_TEXT(tr("Error: %1 of %2 files failed. Double-click failed items for detailed information!").arg(QString::number(m_failedJobs.count()), QString::number(m_failedJobs.count() + m_succeededJobs.count())));
m_systemTray->showMessage(tr("LameXP - Error"), tr("At least one file has failed!"), QSystemTrayIcon::Critical);
m_systemTray->setIcon(QIcon(":/icons/cd_delete.png"));
QApplication::processEvents();
if(m_settings->soundsEnabled()) PlaySound(MAKEINTRESOURCE(IDR_WAVE_ERROR), GetModuleHandle(NULL), SND_RESOURCE | SND_SYNC);
@ -345,8 +345,8 @@ void ProcessingDialog::doneEncoding(void)
CHANGE_BACKGROUND_COLOR(frame_header, QColor("#E0FFE2"));
WinSevenTaskbar::setTaskbarState(this, WinSevenTaskbar::WinSevenTaskbarNormalState);
WinSevenTaskbar::setOverlayIcon(this, &QIcon(":/icons/accept.png"));
SET_PROGRESS_TEXT("Alle files completed successfully.");
m_systemTray->showMessage("LameXP - Done", "All files completed successfully.", QSystemTrayIcon::Information);
SET_PROGRESS_TEXT(tr("Alle files completed successfully."));
m_systemTray->showMessage(tr("LameXP - Done"), tr("All files completed successfully."), QSystemTrayIcon::Information);
m_systemTray->setIcon(QIcon(":/icons/cd_add.png"));
QApplication::processEvents();
if(m_settings->soundsEnabled()) PlaySound(MAKEINTRESOURCE(IDR_WAVE_SUCCESS), GetModuleHandle(NULL), SND_RESOURCE | SND_SYNC);
@ -535,7 +535,7 @@ void ProcessingDialog::writePlayList(void)
}
else
{
QMessageBox::warning(this, "Playlist creation failed", QString("The playlist file could not be created:<br><nobr>%1</nobr>").arg(playListFile));
QMessageBox::warning(this, tr("Playlist creation failed"), QString("%1<br><nobr>%2</nobr>").arg(tr("The playlist file could not be created:"), playListFile));
}
}

View File

@ -123,6 +123,7 @@ static QMap<QString, unsigned int> g_lamexp_tool_versions;
//Languages
static QMap<QString, QString> g_lamexp_translation_files;
static QMap<QString, QString> g_lamexp_translation_names;
static QMap<QString, WORD> g_lamexp_translation_sysid;
static QTranslator *g_lamexp_currentTranslator = NULL;
//Shared memory
@ -465,6 +466,7 @@ static void lamexp_init_translations(void)
while(!qmFiles.isEmpty())
{
QString langId, langName;
WORD systemId = 0;
QString qmFile = qmFiles.takeFirst();
QRegExp langIdExp("LameXP_(\\w\\w)\\.qm", Qt::CaseInsensitive);
@ -473,16 +475,22 @@ static void lamexp_init_translations(void)
langId = langIdExp.cap(1).toLower();
}
QResource langNameRes = (QString(":/localization/%1.txt").arg(qmFile));
if(langNameRes.isValid() && langNameRes.size() > 0)
QResource langRes = (QString(":/localization/%1.txt").arg(qmFile));
if(langRes.isValid() && langRes.size() > 0)
{
langName = QString::fromUtf8(reinterpret_cast<const char*>(langNameRes.data()), langNameRes.size());
QStringList langInfo = QString::fromUtf8(reinterpret_cast<const char*>(langRes.data()), langRes.size()).simplified().split(",", QString::SkipEmptyParts);
if(langInfo.count() == 2)
{
systemId = langInfo.at(0).toUInt();
langName = langInfo.at(1);
}
}
if(!langId.isEmpty() && !langName.isEmpty())
if(!langId.isEmpty() && systemId > 0 && !langName.isEmpty())
{
g_lamexp_translation_files.insert(langId, qmFile);
g_lamexp_translation_names.insert(langId, langName);
g_lamexp_translation_sysid.insert(langId, systemId);
}
}
}
@ -907,6 +915,14 @@ QString lamexp_translation_name(const QString &langId)
return g_lamexp_translation_names.value(langId.toLower(), QString());
}
/*
* Get translation system id
*/
WORD lamexp_translation_sysid(const QString &langId)
{
return g_lamexp_translation_sysid.value(langId.toLower(), 0);
}
/*
* Install a new translator
*/

View File

@ -95,8 +95,9 @@ lamexp_cpu_t lamexp_detect_cpu_features(void);
//Translation support
QStringList lamexp_query_translations(void);
QString lamexp_translation_name(const QString &language);
WORD lamexp_translation_sysid(const QString &langId);
bool lamexp_install_translator(const QString &language);
static const char* LAMEXP_DEFAULT_LANGID = "gb";
static const char* LAMEXP_DEFAULT_LANGID = "en";
//Auxiliary functions
bool lamexp_clean_folder(const QString folderPath);

View File

@ -100,10 +100,10 @@ QVariant ProgressModel::headerData(int section, Qt::Orientation orientation, int
switch(section)
{
case 0:
return "Job";
return tr("Job");
break;
case 1:
return "Status";
return tr("Status");
break;
default:
return QVariant();

View File

@ -70,6 +70,8 @@ const int SettingsModel::mp3Bitrates[15] = {32, 40, 48, 56, 64, 80, 96, 112, 128
////////////////////////////////////////////////////////////
SettingsModel::SettingsModel(void)
:
m_defaultLanguage(NULL)
{
QString appPath = QDesktopServices::storageLocation(QDesktopServices::DataLocation);
m_settings = new QSettings(appPath.append("/config.ini"), QSettings::IniFormat);
@ -85,6 +87,7 @@ SettingsModel::SettingsModel(void)
SettingsModel::~SettingsModel(void)
{
LAMEXP_DELETE(m_settings);
LAMEXP_DELETE(m_defaultLanguage);
}
////////////////////////////////////////////////////////////
@ -120,10 +123,46 @@ void SettingsModel::validate(void)
if(!lamexp_query_translations().contains(this->currentLanguage(), Qt::CaseInsensitive))
{
qWarning("Current language is unknown, reverting to default language!");
this->currentLanguage(LAMEXP_DEFAULT_LANGID);
this->currentLanguage(defaultLanguage());
}
}
////////////////////////////////////////////////////////////
// Private Functions
////////////////////////////////////////////////////////////
QString SettingsModel::defaultLanguage(void)
{
if(m_defaultLanguage)
{
return *m_defaultLanguage;
}
//Check if we can use the default translation
WORD systemLangId = PRIMARYLANGID(GetUserDefaultLangID());
if(systemLangId == LANG_ENGLISH)
{
m_defaultLanguage = new QString(LAMEXP_DEFAULT_LANGID);
return LAMEXP_DEFAULT_LANGID;
}
//Try to find a suitable translation for the user's system language
QStringList languages = lamexp_query_translations();
while(!languages.isEmpty())
{
QString currentLangId = languages.takeFirst();
if(lamexp_translation_sysid(currentLangId) == systemLangId)
{
m_defaultLanguage = new QString(currentLangId);
return currentLangId;
}
}
//Fall back to the default translation
m_defaultLanguage = new QString(LAMEXP_DEFAULT_LANGID);
return LAMEXP_DEFAULT_LANGID;
}
////////////////////////////////////////////////////////////
// Getter and Setter
////////////////////////////////////////////////////////////
@ -144,4 +183,4 @@ MAKE_OPTION3(soundsEnabled, true)
MAKE_OPTION3(neroAacNotificationsEnabled, true)
MAKE_OPTION3(wmaDecoderNotificationsEnabled, true)
MAKE_OPTION3(dropBoxWidgetEnabled, true)
MAKE_OPTION2(currentLanguage, LAMEXP_DEFAULT_LANGID);
MAKE_OPTION2(currentLanguage, defaultLanguage());

View File

@ -85,6 +85,8 @@ public:
private:
QSettings *m_settings;
QString *m_defaultLanguage;
QString defaultLanguage(void);
};
#undef MAKE_OPTION_DEC1

View File

@ -75,9 +75,9 @@ QStringList DecoderRegistry::getSupportedTypes(void)
{
extensions.removeDuplicates();
extensions.sort();
types.prepend(QString("All supported types (%1)").arg(extensions.join(" ")));
types.prepend(QString("%1 (%2)").arg(tr("All supported types"), extensions.join(" ")));
}
types << "All files (*.*)";
types << QString("%1 (*.*)").arg(tr("All files"));
return types;
}

View File

@ -21,12 +21,16 @@
#pragma once
#include <QObject>
class QString;
class QStringList;
class AbstractDecoder;
class DecoderRegistry
class DecoderRegistry : public QObject
{
Q_OBJECT
public:
static AbstractDecoder *lookup(const QString &containerType, const QString &containerProfile, const QString &formatType, const QString &formatProfile, const QString &formatVersion);
static QStringList DecoderRegistry::getSupportedTypes(void);

View File

@ -98,13 +98,13 @@ void ProcessThread::processFile()
bool bSuccess = true;
qDebug("Process thread %s has started.", m_jobId.toString().toLatin1().constData());
emit processStateInitialized(m_jobId, QFileInfo(m_audioFile.filePath()).fileName(), "Starting...", ProgressModel::JobRunning);
emit processStateInitialized(m_jobId, QFileInfo(m_audioFile.filePath()).fileName(), tr("Starting..."), ProgressModel::JobRunning);
//Generate output file name
QString outFileName = generateOutFileName();
if(outFileName.isEmpty())
{
emit processStateChanged(m_jobId, "Not found!", ProgressModel::JobFailed);
emit processStateChanged(m_jobId, tr("Not found!"), ProgressModel::JobFailed);
emit processStateFinished(m_jobId, outFileName, false);
return;
}
@ -142,8 +142,8 @@ void ProcessThread::processFile()
}
else
{
handleMessage(QString("The format of this file is NOT supported:\n%1\n\nContainer Format:\t%2\nAudio Format:\t%3").arg(m_audioFile.filePath(), m_audioFile.formatContainerInfo(), m_audioFile.formatAudioCompressInfo()));
emit processStateChanged(m_jobId, "Unsupported!", ProgressModel::JobFailed);
handleMessage(QString("%1\n%2\n\n%3\t%4\n%5\t%6").arg(tr("The format of this file is NOT supported:"), m_audioFile.filePath(), tr("Container Format:"), m_audioFile.formatContainerInfo(), tr("Audio Format:"), m_audioFile.formatAudioCompressInfo()));
emit processStateChanged(m_jobId, tr("Unsupported!"), ProgressModel::JobFailed);
emit processStateFinished(m_jobId, outFileName, false);
return;
}
@ -188,7 +188,7 @@ void ProcessThread::processFile()
}
//Report result
emit processStateChanged(m_jobId, (bSuccess ? "Done." : (m_aborted ? "Aborted!" : "Failed!")), (bSuccess ? ProgressModel::JobComplete : ProgressModel::JobFailed));
emit processStateChanged(m_jobId, (bSuccess ? tr("Done.") : (m_aborted ? tr("Aborted!") : tr("Failed!"))), (bSuccess ? ProgressModel::JobComplete : ProgressModel::JobFailed));
emit processStateFinished(m_jobId, outFileName, bSuccess);
qDebug("Process thread is done.");
@ -203,13 +203,13 @@ void ProcessThread::handleUpdate(int progress)
switch(m_currentStep)
{
case EncodingStep:
emit processStateChanged(m_jobId, QString("Encoding (%1%)").arg(QString::number(progress)), ProgressModel::JobRunning);
emit processStateChanged(m_jobId, QString("%1 (%2%)").arg(tr("Encoding"), QString::number(progress)), ProgressModel::JobRunning);
break;
case FilteringStep:
emit processStateChanged(m_jobId, QString("Filtering (%1%)").arg(QString::number(progress)), ProgressModel::JobRunning);
emit processStateChanged(m_jobId, QString("%1 (%2%)").arg(tr("Filtering"), QString::number(progress)), ProgressModel::JobRunning);
break;
case DecodingStep:
emit processStateChanged(m_jobId, QString("Decoding (%1%)").arg(QString::number(progress)), ProgressModel::JobRunning);
emit processStateChanged(m_jobId, QString("%1 (%2%)").arg(tr("Decoding"), QString::number(progress)), ProgressModel::JobRunning);
break;
}
}
@ -232,14 +232,14 @@ QString ProcessThread::generateOutFileName(void)
QFileInfo sourceFile(m_audioFile.filePath());
if(!sourceFile.exists() || !sourceFile.isFile())
{
handleMessage(QString("The source audio file could not be found:\n%1").arg(sourceFile.absoluteFilePath()));
handleMessage(QString("%1\n%2").arg(tr("The source audio file could not be found:"), sourceFile.absoluteFilePath()));
return QString();
}
QFile readTest(sourceFile.canonicalFilePath());
if(!readTest.open(QIODevice::ReadOnly))
{
handleMessage(QString("The source audio file could not be opened for reading:\n%1").arg(readTest.fileName()));
handleMessage(QString("%1\n%2").arg(tr("The source audio file could not be opened for reading:"), readTest.fileName()));
return QString();
}
else
@ -265,7 +265,7 @@ QString ProcessThread::generateOutFileName(void)
targetDir.mkpath(".");
if(!targetDir.exists())
{
handleMessage(QString("The target output directory doesn't exist and could NOT be created:\n%1").arg(targetDir.absolutePath()));
handleMessage(QString("%1\n%2").arg(tr("The target output directory doesn't exist and could NOT be created:"), targetDir.absolutePath()));
return QString();
}
}
@ -273,7 +273,7 @@ QString ProcessThread::generateOutFileName(void)
QFile writeTest(QString("%1/.%2").arg(targetDir.canonicalPath(), lamexp_rand_str()));
if(!writeTest.open(QIODevice::ReadWrite))
{
handleMessage(QString("The target output directory is NOT writable:\n%1").arg(targetDir.absolutePath()));
handleMessage(QString("%1\n%2").arg(tr("The target output directory is NOT writable:"), targetDir.absolutePath()));
return QString();
}
else