More internationalization and localization... (again)

This commit is contained in:
LoRd_MuldeR 2010-12-30 16:12:21 +01:00
parent 4fb20b9dfc
commit fdaf1909fc
9 changed files with 129 additions and 166 deletions

View File

@ -1208,6 +1208,10 @@
<property name="title"> <property name="title">
<string>Style</string> <string>Style</string>
</property> </property>
<property name="icon">
<iconset resource="../res/Icons.qrc">
<normaloff>:/icons/palette.png</normaloff>:/icons/palette.png</iconset>
</property>
<addaction name="actionStylePlastique"/> <addaction name="actionStylePlastique"/>
<addaction name="actionStyleCleanlooks"/> <addaction name="actionStyleCleanlooks"/>
<addaction name="actionStyleWindowsVista"/> <addaction name="actionStyleWindowsVista"/>
@ -1218,7 +1222,10 @@
<property name="title"> <property name="title">
<string>Language</string> <string>Language</string>
</property> </property>
<addaction name="actionLanguageEnglish"/> <property name="icon">
<iconset resource="../res/Icons.qrc">
<normaloff>:/icons/font.png</normaloff>:/icons/font.png</iconset>
</property>
</widget> </widget>
<addaction name="actionSourceFiles"/> <addaction name="actionSourceFiles"/>
<addaction name="actionOutputDirectory"/> <addaction name="actionOutputDirectory"/>
@ -1458,6 +1465,10 @@
<property name="checkable"> <property name="checkable">
<bool>true</bool> <bool>true</bool>
</property> </property>
<property name="icon">
<iconset resource="../res/Flags.qrc">
<normaloff>:/flags/gb.png</normaloff>:/flags/gb.png</iconset>
</property>
<property name="text"> <property name="text">
<string notr="true">English</string> <string notr="true">English</string>
</property> </property>
@ -1465,113 +1476,7 @@
</widget> </widget>
<resources> <resources>
<include location="../res/Icons.qrc"/> <include location="../res/Icons.qrc"/>
<include location="../res/Images.qrc"/> <include location="../res/Flags.qrc"/>
<include location="../res/Images.qrc"/>
<include location="../res/Images.qrc"/>
<include location="../res/Images.qrc"/>
<include location="../res/Images.qrc"/>
<include location="../res/Images.qrc"/>
<include location="../res/Images.qrc"/>
<include location="../res/Images.qrc"/>
<include location="../res/Images.qrc"/>
<include location="../res/Images.qrc"/>
<include location="../res/Images.qrc"/>
<include location="../res/Images.qrc"/>
<include location="../res/Images.qrc"/>
<include location="../res/Images.qrc"/>
<include location="../res/Images.qrc"/>
<include location="../res/Images.qrc"/>
<include location="../res/Images.qrc"/>
<include location="../res/Images.qrc"/>
<include location="../res/Images.qrc"/>
<include location="../res/Images.qrc"/>
<include location="../res/Images.qrc"/>
<include location="../res/Images.qrc"/>
<include location="../res/Images.qrc"/>
<include location="../res/Images.qrc"/>
<include location="../res/Images.qrc"/>
<include location="../res/Images.qrc"/>
<include location="../res/Images.qrc"/>
<include location="../res/Images.qrc"/>
<include location="../res/Images.qrc"/>
<include location="../res/Images.qrc"/>
<include location="../res/Icons.qrc"/>
<include location="../res/Images.qrc"/>
<include location="../res/Icons.qrc"/>
<include location="../res/Images.qrc"/>
<include location="../res/Icons.qrc"/>
<include location="../res/Images.qrc"/>
<include location="../res/Icons.qrc"/>
<include location="../res/Images.qrc"/>
<include location="../res/Icons.qrc"/>
<include location="../res/Images.qrc"/>
<include location="../res/Icons.qrc"/>
<include location="../res/Images.qrc"/>
<include location="../res/Icons.qrc"/>
<include location="../res/Images.qrc"/>
<include location="../res/Icons.qrc"/>
<include location="../res/Images.qrc"/>
<include location="../res/Icons.qrc"/>
<include location="../res/Images.qrc"/>
<include location="../res/Icons.qrc"/>
<include location="../res/Images.qrc"/>
<include location="../res/Icons.qrc"/>
<include location="../res/Images.qrc"/>
<include location="../res/Icons.qrc"/>
<include location="../res/Images.qrc"/>
<include location="../res/Icons.qrc"/>
<include location="../res/Images.qrc"/>
<include location="../res/Icons.qrc"/>
<include location="../res/Images.qrc"/>
<include location="../res/Icons.qrc"/>
<include location="../res/Images.qrc"/>
<include location="../res/Icons.qrc"/>
<include location="../res/Images.qrc"/>
<include location="../res/Icons.qrc"/>
<include location="../res/Images.qrc"/>
<include location="../res/Icons.qrc"/>
<include location="../res/Images.qrc"/>
<include location="../res/Icons.qrc"/>
<include location="../res/Images.qrc"/>
<include location="../res/Icons.qrc"/>
<include location="../res/Images.qrc"/>
<include location="../res/Icons.qrc"/>
<include location="../res/Images.qrc"/>
<include location="../res/Icons.qrc"/>
<include location="../res/Images.qrc"/>
<include location="../res/Icons.qrc"/>
<include location="../res/Images.qrc"/>
<include location="../res/Icons.qrc"/>
<include location="../res/Images.qrc"/>
<include location="../res/Icons.qrc"/>
<include location="../res/Images.qrc"/>
<include location="../res/Icons.qrc"/>
<include location="../res/Images.qrc"/>
<include location="../res/Icons.qrc"/>
<include location="../res/Images.qrc"/>
<include location="../res/Icons.qrc"/>
<include location="../res/Images.qrc"/>
<include location="../res/Icons.qrc"/>
<include location="../res/Images.qrc"/>
<include location="../res/Icons.qrc"/>
<include location="../res/Images.qrc"/>
<include location="../res/Icons.qrc"/>
<include location="../res/Images.qrc"/>
<include location="../res/Icons.qrc"/>
<include location="../res/Images.qrc"/>
<include location="../res/Icons.qrc"/>
<include location="../res/Images.qrc"/>
<include location="../res/Icons.qrc"/>
<include location="../res/Images.qrc"/>
<include location="../res/Icons.qrc"/>
<include location="../res/Images.qrc"/>
<include location="../res/Icons.qrc"/>
<include location="../res/Images.qrc"/>
<include location="../res/Icons.qrc"/>
<include location="../res/Images.qrc"/>
<include location="../res/Icons.qrc"/>
<include location="../res/Images.qrc"/>
<include location="../res/Icons.qrc"/>
<include location="../res/Images.qrc"/> <include location="../res/Images.qrc"/>
<include location="../res/Icons.qrc"/> <include location="../res/Icons.qrc"/>
<include location="../res/Images.qrc"/> <include location="../res/Images.qrc"/>

View File

@ -2,6 +2,8 @@
<RCC version="1.0"> <RCC version="1.0">
<qresource> <qresource>
<file>flags/de.png</file> <file>flags/de.png</file>
<file>flags/fr.png</file>
<file>flags/gb.png</file> <file>flags/gb.png</file>
<file>flags/it.png</file>
</qresource> </qresource>
</RCC> </RCC>

View File

@ -44,6 +44,7 @@
<file>icons/folder_go.png</file> <file>icons/folder_go.png</file>
<file>icons/folder_image.png</file> <file>icons/folder_image.png</file>
<file>icons/folder_page.png</file> <file>icons/folder_page.png</file>
<file>icons/font.png</file>
<file>icons/house.png</file> <file>icons/house.png</file>
<file>icons/hourglass.png</file> <file>icons/hourglass.png</file>
<file>icons/information.png</file> <file>icons/information.png</file>
@ -51,6 +52,7 @@
<file>icons/money_dollar.png</file> <file>icons/money_dollar.png</file>
<file>icons/monitor.png</file> <file>icons/monitor.png</file>
<file>icons/music.png</file> <file>icons/music.png</file>
<file>icons/palette.png</file>
<file>icons/package.png</file> <file>icons/package.png</file>
<file>icons/page_white_cplusplus.png</file> <file>icons/page_white_cplusplus.png</file>
<file>icons/page_white_add.png</file> <file>icons/page_white_add.png</file>

View File

@ -4,10 +4,10 @@
<file>localization/LameXP_DE.qm</file> <file>localization/LameXP_DE.qm</file>
<file>localization/LameXP_DE.qm.txt</file> <file>localization/LameXP_DE.qm.txt</file>
<!-- <!--
<file>localization/LameXP_FR.qm</file>
<file>localization/LameXP_FR.qm.txt</file>
<file>localization/LameXP_IT.qm</file> <file>localization/LameXP_IT.qm</file>
<file>localization/LameXP_IT.qm.txt</file> <file>localization/LameXP_IT.qm.txt</file>
<file>localization/LameXP_FR.qm</file>
<file>localization/LameXP_FR.qm.txt</file>
--> -->
</qresource> </qresource>
</RCC> </RCC>

View File

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

View File

@ -249,24 +249,20 @@ MainWindow::MainWindow(FileListModel *fileListModel, AudioFileModel *metaInfo, S
//Populate the language menu //Populate the language menu
m_languageActionGroup = new QActionGroup(this); m_languageActionGroup = new QActionGroup(this);
m_languageActionGroup->addAction(actionLanguageEnglish);
actionLanguageEnglish->setChecked(true);
connect(m_languageActionGroup, SIGNAL(triggered(QAction*)), this, SLOT(languageActionActivated(QAction*))); connect(m_languageActionGroup, SIGNAL(triggered(QAction*)), this, SLOT(languageActionActivated(QAction*)));
QStringList translations = lamexp_query_translations(); QStringList translations = lamexp_query_translations();
while(translations.count() > 0) while(!translations.isEmpty())
{ {
QString langId = translations.takeFirst();
QAction *currentLanguage = new QAction(this); QAction *currentLanguage = new QAction(this);
currentLanguage->setData(langId);
currentLanguage->setText(lamexp_translation_name(langId));
currentLanguage->setIcon(QIcon(QString(":/flags/%1.png").arg(langId)));
currentLanguage->setCheckable(true); currentLanguage->setCheckable(true);
currentLanguage->setText(translations.takeFirst());
m_languageActionGroup->addAction(currentLanguage); m_languageActionGroup->addAction(currentLanguage);
menuLanguage->addAction(currentLanguage); menuLanguage->addAction(currentLanguage);
if(currentLanguage->text().compare(m_settings->currentLanguage(), Qt::CaseInsensitive) == 0)
{
currentLanguage->setChecked(true);
languageActionActivated(currentLanguage);
}
} }
//Activate tools menu actions //Activate tools menu actions
actionDisableUpdateReminder->setChecked(!m_settings->autoUpdateEnabled()); actionDisableUpdateReminder->setChecked(!m_settings->autoUpdateEnabled());
actionDisableSounds->setChecked(!m_settings->soundsEnabled()); actionDisableSounds->setChecked(!m_settings->soundsEnabled());
@ -311,8 +307,17 @@ MainWindow::MainWindow(FileListModel *fileListModel, AudioFileModel *metaInfo, S
//Enable Drag & Drop //Enable Drag & Drop
this->setAcceptDrops(true); this->setAcceptDrops(true);
//Finally re-translate the UI //Load translation & re-translate
retranslateUi(this); QList<QAction*> languageActions = m_languageActionGroup->actions();
while(!languageActions.isEmpty())
{
QAction *currentLanguage = languageActions.takeFirst();
if(currentLanguage->data().toString().compare(m_settings->currentLanguage(), Qt::CaseInsensitive) == 0)
{
currentLanguage->setChecked(true);
languageActionActivated(currentLanguage);
}
}
} }
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
@ -630,9 +635,9 @@ void MainWindow::windowShown(void)
if(lamexp_tool_version("neroAacEnc.exe") < lamexp_toolver_neroaac()) if(lamexp_tool_version("neroAacEnc.exe") < lamexp_toolver_neroaac())
{ {
QString messageText; QString messageText;
messageText += tr("<nobr>LameXP detected that your version of the Nero AAC encoder is outdated!<br>"); messageText += QString("<nobr>%1<br>").arg(tr("LameXP detected that your version of the Nero AAC encoder is outdated!"));
messageText += tr("The current version available is %1 (or later), but you still have version %2 installed.<br><br>").arg(lamexp_version2string("?.?.?.?", lamexp_toolver_neroaac()), lamexp_version2string("?.?.?.?", lamexp_tool_version("neroAacEnc.exe"))); messageText += QString("%1<br><br>").arg(tr("The current version available is %1 (or later), but you still have version %2 installed.").arg(lamexp_version2string("?.?.?.?", lamexp_toolver_neroaac()), lamexp_version2string("?.?.?.?", lamexp_tool_version("neroAacEnc.exe"))));
messageText += tr("You can download the latest version of the Nero AAC encoder from the Nero website at:<br>"); messageText += QString("%1<br>").arg(tr("You can download the latest version of the Nero AAC encoder from the Nero website at:"));
messageText += "<b>" + LINK(AboutDialog::neroAacUrl) + "</b><br></nobr>"; messageText += "<b>" + LINK(AboutDialog::neroAacUrl) + "</b><br></nobr>";
QMessageBox::information(this, tr("AAC Encoder Outdated"), messageText); QMessageBox::information(this, tr("AAC Encoder Outdated"), messageText);
} }
@ -641,11 +646,11 @@ void MainWindow::windowShown(void)
{ {
radioButtonEncoderAAC->setEnabled(false); radioButtonEncoderAAC->setEnabled(false);
QString messageText; QString messageText;
messageText += tr("<nobr>The Nero AAC encoder could not be found. AAC encoding support will be disabled.<br>"); messageText += QString("<nobr>%1<br>").arg(tr("The Nero AAC encoder could not be found. AAC encoding support will be disabled."));
messageText += tr("Please put 'neroAacEnc.exe', 'neroAacDec.exe' and 'neroAacTag.exe' into the LameXP directory!<br><br>"); messageText += QString("%1<br><br>").arg(tr("Please put 'neroAacEnc.exe', 'neroAacDec.exe' and 'neroAacTag.exe' into the LameXP directory!"));
messageText += tr("Your LameXP directory is located here:<br>"); messageText += QString("%1<br>").arg(tr("Your LameXP directory is located here:"));
messageText += QString("<i><nobr><a href=\"file:///%1\">%1</a></nobr></i><br><br>").arg(QDir::toNativeSeparators(QCoreApplication::applicationDirPath())); messageText += QString("<i><nobr><a href=\"file:///%1\">%1</a></nobr></i><br><br>").arg(QDir::toNativeSeparators(QCoreApplication::applicationDirPath()));
messageText += tr("You can download the Nero AAC encoder for free from the official Nero website at:<br>"); messageText += QString("%1<br>").arg(tr("You can download the Nero AAC encoder for free from the official Nero website at:"));
messageText += "<b>" + LINK(AboutDialog::neroAacUrl) + "</b><br></nobr>"; messageText += "<b>" + LINK(AboutDialog::neroAacUrl) + "</b><br></nobr>";
QMessageBox::information(this, tr("AAC Support Disabled"), messageText); QMessageBox::information(this, tr("AAC Support Disabled"), messageText);
} }
@ -657,8 +662,8 @@ void MainWindow::windowShown(void)
if(!lamexp_check_tool("wmawav.exe")) if(!lamexp_check_tool("wmawav.exe"))
{ {
QString messageText; QString messageText;
messageText += tr("<nobr>LameXP has detected that the WMA File Decoder component is not currently installed on your system.<br>"); messageText += QString("<nobr>%1<br>").arg(tr("LameXP has detected that the WMA File Decoder component is not currently installed on your system."));
messageText += tr("You won't be able to process WMA files as input unless the WMA File Decoder component is installed!</nobr>"); messageText += QString("%1</nobr>").arg(tr("You won't be able to process WMA files as input unless the WMA File Decoder component is installed!"));
QMessageBox::information(this, tr("WMA Decoder Missing"), messageText); QMessageBox::information(this, tr("WMA Decoder Missing"), messageText);
installWMADecoderActionTriggered(rand() % 2); installWMADecoderActionTriggered(rand() % 2);
} }
@ -962,19 +967,11 @@ void MainWindow::styleActionActivated(QAction *action)
*/ */
void MainWindow::languageActionActivated(QAction *action) void MainWindow::languageActionActivated(QAction *action)
{ {
if(action != actionLanguageEnglish) QString langId = action->data().toString();
if(lamexp_install_translator(langId))
{ {
if(lamexp_install_translator(action->text())) m_settings->currentLanguage(langId);
{
m_settings->currentLanguage(action->text());
}
}
else
{
if(lamexp_install_translator(QString()))
{
m_settings->currentLanguage(action->text());
}
} }
retranslateUi(this); retranslateUi(this);

View File

@ -121,7 +121,8 @@ static QMap<QString, LockedFile*> g_lamexp_tool_registry;
static QMap<QString, unsigned int> g_lamexp_tool_versions; static QMap<QString, unsigned int> g_lamexp_tool_versions;
//Languages //Languages
static QMap<QString, QString> g_lamexp_translations; static QMap<QString, QString> g_lamexp_translation_files;
static QMap<QString, QString> g_lamexp_translation_names;
static QTranslator *g_lamexp_currentTranslator = NULL; static QTranslator *g_lamexp_currentTranslator = NULL;
//Shared memory //Shared memory
@ -448,6 +449,44 @@ static bool lamexp_check_elevation(void)
return !bIsProcessElevated; return !bIsProcessElevated;
} }
/*
* Initialize translation files
*/
static void lamexp_init_translations(void)
{
//Add default translations
g_lamexp_translation_files.insert(LAMEXP_DEFAULT_LANGID, "");
g_lamexp_translation_names.insert(LAMEXP_DEFAULT_LANGID, "English");
//Search for language files
QStringList qmFiles = QDir(":/localization").entryList(QStringList() << "LameXP_??.qm", QDir::Files, QDir::Name);
//Add all available translations
while(!qmFiles.isEmpty())
{
QString langId, langName;
QString qmFile = qmFiles.takeFirst();
QRegExp langIdExp("LameXP_(\\w\\w)\\.qm", Qt::CaseInsensitive);
if(langIdExp.indexIn(qmFile) >= 0)
{
langId = langIdExp.cap(1).toLower();
}
QResource langNameRes = (QString(":/localization/%1.txt").arg(qmFile));
if(langNameRes.isValid() && langNameRes.size() > 0)
{
langName = QString::fromUtf8(reinterpret_cast<const char*>(langNameRes.data()), langNameRes.size());
}
if(!langId.isEmpty() && !langName.isEmpty())
{
g_lamexp_translation_files.insert(langId, qmFile);
g_lamexp_translation_names.insert(langId, langName);
}
}
}
/* /*
* Initialize Qt framework * Initialize Qt framework
*/ */
@ -519,17 +558,9 @@ bool lamexp_init_qt(int argc, char* argv[])
return false; return false;
} }
} }
//Init available translations //Init language files
QStringList qmFiles = QDir(":/localization").entryList(QStringList() << "*.qm", QDir::Files, QDir::Name); lamexp_init_translations();
for(int i = 0; i < qmFiles.count(); i++)
{
QResource langName = (QString(":/localization/%1.txt").arg(qmFiles.at(i)));
if(langName.isValid() && langName.size() > 0)
{
g_lamexp_translations.insert(QString::fromUtf8(reinterpret_cast<const char*>(langName.data()), langName.size()), qmFiles.at(i));
}
}
//Check for process elevation //Check for process elevation
if(!lamexp_check_elevation()) if(!lamexp_check_elevation())
@ -867,17 +898,25 @@ const QString lamexp_version2string(const QString &pattern, unsigned int version
} }
/* /*
* Get list of translations * Get list of all translations
*/ */
QStringList lamexp_query_translations(void) QStringList lamexp_query_translations(void)
{ {
return g_lamexp_translations.keys(); return g_lamexp_translation_files.keys();
}
/*
* Get translation name
*/
QString lamexp_translation_name(const QString &langId)
{
return g_lamexp_translation_names.value(langId.toLower(), QString());
} }
/* /*
* Install a new translator * Install a new translator
*/ */
bool lamexp_install_translator(const QString &language) bool lamexp_install_translator(const QString &langId)
{ {
bool success = false; bool success = false;
@ -886,14 +925,14 @@ bool lamexp_install_translator(const QString &language)
g_lamexp_currentTranslator = new QTranslator(); g_lamexp_currentTranslator = new QTranslator();
} }
if(language.isEmpty()) if(langId.isEmpty() || langId.toLower().compare(LAMEXP_DEFAULT_LANGID) == 0)
{ {
QApplication::removeTranslator(g_lamexp_currentTranslator); QApplication::removeTranslator(g_lamexp_currentTranslator);
success = true; success = true;
} }
else else
{ {
QString qmFile = g_lamexp_translations.value(language, QString()); QString qmFile = g_lamexp_translation_files.value(langId.toLower(), QString());
if(!qmFile.isEmpty()) if(!qmFile.isEmpty())
{ {
QApplication::removeTranslator(g_lamexp_currentTranslator); QApplication::removeTranslator(g_lamexp_currentTranslator);
@ -902,7 +941,7 @@ bool lamexp_install_translator(const QString &language)
} }
else else
{ {
qWarning("Translation '%s' not available!", language.toLatin1().constData()); qWarning("Translation '%s' not available!", langId.toLatin1().constData());
} }
} }
@ -1080,9 +1119,13 @@ void lamexp_finalization(void)
} }
//Clear languages //Clear languages
lamexp_install_translator(QString()); if(g_lamexp_currentTranslator)
LAMEXP_DELETE(g_lamexp_currentTranslator); {
g_lamexp_translations.clear(); QApplication::removeTranslator(g_lamexp_currentTranslator);
LAMEXP_DELETE(g_lamexp_currentTranslator);
}
g_lamexp_translation_files.clear();
g_lamexp_translation_names.clear();
//Destroy Qt application object //Destroy Qt application object
QApplication *application = dynamic_cast<QApplication*>(QApplication::instance()); QApplication *application = dynamic_cast<QApplication*>(QApplication::instance());

View File

@ -91,8 +91,12 @@ const QString &lamexp_temp_folder(void);
void lamexp_ipc_read(unsigned int *command, char* message, size_t buffSize); void lamexp_ipc_read(unsigned int *command, char* message, size_t buffSize);
void lamexp_ipc_send(unsigned int command, const char* message); void lamexp_ipc_send(unsigned int command, const char* message);
lamexp_cpu_t lamexp_detect_cpu_features(void); lamexp_cpu_t lamexp_detect_cpu_features(void);
//Translation support
QStringList lamexp_query_translations(void); QStringList lamexp_query_translations(void);
QString lamexp_translation_name(const QString &language);
bool lamexp_install_translator(const QString &language); bool lamexp_install_translator(const QString &language);
static const char* LAMEXP_DEFAULT_LANGID = "gb";
//Auxiliary functions //Auxiliary functions
bool lamexp_clean_folder(const QString folderPath); bool lamexp_clean_folder(const QString folderPath);

View File

@ -28,6 +28,7 @@
#include <QApplication> #include <QApplication>
#include <QString> #include <QString>
#include <QFileInfo> #include <QFileInfo>
#include <QStringList>
//Constants //Constants
static const char *g_settingsId_versionNumber = "VersionNumber"; static const char *g_settingsId_versionNumber = "VersionNumber";
@ -96,10 +97,12 @@ void SettingsModel::validate(void)
{ {
this->compressionEncoder(SettingsModel::MP3Encoder); this->compressionEncoder(SettingsModel::MP3Encoder);
} }
if(this->compressionRCMode() < SettingsModel::VBRMode || this->compressionRCMode() > SettingsModel::CBRMode) if(this->compressionRCMode() < SettingsModel::VBRMode || this->compressionRCMode() > SettingsModel::CBRMode)
{ {
this->compressionEncoder(SettingsModel::VBRMode); this->compressionEncoder(SettingsModel::VBRMode);
} }
if(!(lamexp_check_tool("neroAacEnc.exe") && lamexp_check_tool("neroAacDec.exe") && lamexp_check_tool("neroAacTag.exe"))) if(!(lamexp_check_tool("neroAacEnc.exe") && lamexp_check_tool("neroAacDec.exe") && lamexp_check_tool("neroAacTag.exe")))
{ {
if(this->compressionEncoder() == SettingsModel::AACEncoder) if(this->compressionEncoder() == SettingsModel::AACEncoder)
@ -108,10 +111,17 @@ void SettingsModel::validate(void)
this->compressionEncoder(SettingsModel::MP3Encoder); this->compressionEncoder(SettingsModel::MP3Encoder);
} }
} }
if(this->outputDir().isEmpty() || !QFileInfo(this->outputDir()).isDir()) if(this->outputDir().isEmpty() || !QFileInfo(this->outputDir()).isDir())
{ {
this->outputDir(QDesktopServices::storageLocation(QDesktopServices::MusicLocation)); this->outputDir(QDesktopServices::storageLocation(QDesktopServices::MusicLocation));
} }
if(!lamexp_query_translations().contains(this->currentLanguage(), Qt::CaseInsensitive))
{
qWarning("Current language is unknown, reverting to default language!");
this->currentLanguage(LAMEXP_DEFAULT_LANGID);
}
} }
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
@ -134,4 +144,4 @@ MAKE_OPTION3(soundsEnabled, true)
MAKE_OPTION3(neroAacNotificationsEnabled, true) MAKE_OPTION3(neroAacNotificationsEnabled, true)
MAKE_OPTION3(wmaDecoderNotificationsEnabled, true) MAKE_OPTION3(wmaDecoderNotificationsEnabled, true)
MAKE_OPTION3(dropBoxWidgetEnabled, true) MAKE_OPTION3(dropBoxWidgetEnabled, true)
MAKE_OPTION2(currentLanguage, QString()); MAKE_OPTION2(currentLanguage, LAMEXP_DEFAULT_LANGID);