More internationalization and localization...

This commit is contained in:
LoRd_MuldeR 2010-12-28 21:26:16 +01:00
parent 705e4ba7e4
commit 4fb20b9dfc
14 changed files with 1007 additions and 162 deletions

View File

@ -0,0 +1,748 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE TS>
<TS version="2.0" language="de" sourcelanguage="en">
<context>
<name>DropBox</name>
<message>
<source>LameXP - DropBox</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>&lt;b&gt;LameXP DropBox&lt;/b&gt;&lt;br&gt;&lt;nobr&gt;You can add files to LameXP via Drag&amp;amp;Drop here!&lt;/nobr&gt;&lt;br&gt;&lt;nobr&gt;(Right-click to close the DropBox)&lt;/nobr&gt;</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>LogViewDialog</name>
<message>
<source>Log View</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>&lt;b&gt;Log File&lt;/b&gt;&lt;br&gt;The log file shows detailed information about the selected job.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>C:\DOS
C:\DOS\RUN
RUN\DOS\RUN
</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Discard</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Save to File...</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Copy to Clipboard</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>MainWindow</name>
<message>
<source>LameXP - Audio Encoder Front-end</source>
<translation type="unfinished">LameXP - Audio Kodierer Oberfläche</translation>
</message>
<message>
<source>Source Files</source>
<translation type="unfinished">Quell Dateien</translation>
</message>
<message>
<source>Add File(s)</source>
<translation type="unfinished">Hinzufügen</translation>
</message>
<message>
<source>Remove</source>
<translation type="unfinished">Entfernen</translation>
</message>
<message>
<source>Clear</source>
<translation type="unfinished">Löschen</translation>
</message>
<message>
<source>Show Details</source>
<translation type="unfinished">Details Anzeigen</translation>
</message>
<message>
<source>Output Directory</source>
<translation type="unfinished">Ziel Verzeichnis</translation>
</message>
<message>
<source>Goto Home Folder</source>
<translation type="unfinished">Gehe zu Profil</translation>
</message>
<message>
<source>Goto Music Folder</source>
<translation type="unfinished">Gehe zu Musik</translation>
</message>
<message>
<source>Goto Desktop Folder</source>
<translation type="unfinished">Gehe zu Desktop</translation>
</message>
<message>
<source>Make New Folder</source>
<translation type="unfinished">Neuer Ordner</translation>
</message>
<message>
<source>Save output files to the same location where the input file is located</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Prepend relative source file path to output file</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Meta Data</source>
<translation type="unfinished">Meta Daten</translation>
</message>
<message>
<source> Meta Information </source>
<translation type="unfinished">Meta Informationen</translation>
</message>
<message>
<source>Edit</source>
<translation type="unfinished">Bearbeiten</translation>
</message>
<message>
<source>Note: Meta information you enter here will &lt;u&gt;supersede&lt;/u&gt; data from the source!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Reset</source>
<translation type="unfinished">Zurücksetzen</translation>
</message>
<message>
<source> Options </source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Automatically generate playlist file (.m3u)</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Write meta information to encoded files</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Compression</source>
<translation type="unfinished">Kompression</translation>
</message>
<message>
<source> Encoder / Format </source>
<translation type="unfinished">Kodierer / Format</translation>
</message>
<message>
<source>Lame MP3</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Ogg Vorbis</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Nero AAC</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Wave (PCM)</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>FLAC</source>
<translation type="unfinished"></translation>
</message>
<message>
<source> Rate Control Method </source>
<translation type="unfinished">Bitraten Steuerungsmethode</translation>
</message>
<message>
<source>Quality-based (VBR)</source>
<translation type="unfinished">Qualitäts-basiert (VBR)</translation>
</message>
<message>
<source>Average Bitrate (ABR)</source>
<translation type="unfinished">Mittlere Bitrate (ABR)</translation>
</message>
<message>
<source>Constant Bitrate (CBR)</source>
<translation type="unfinished">Konstante Bitrate (CBR)</translation>
</message>
<message>
<source> Quality / Bitrate </source>
<translation type="unfinished">Qualität / Bitrate</translation>
</message>
<message>
<source>Minimum</source>
<translation type="unfinished">Minimum</translation>
</message>
<message>
<source>Maximum</source>
<translation type="unfinished">Maximum</translation>
</message>
<message>
<source>Advanced Options</source>
<translation type="unfinished">Erweiterte Optionen</translation>
</message>
<message>
<source>More options will be added in a later version, stay tuned!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source> Encode Now!</source>
<translation type="unfinished">Jetzt Kodieren!</translation>
</message>
<message>
<source>About...</source>
<translation type="unfinished">Über...</translation>
</message>
<message>
<source> Exit Program</source>
<translation type="unfinished">Programm Ende</translation>
</message>
<message>
<source>File</source>
<translation type="unfinished">Datei</translation>
</message>
<message>
<source>?</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>View</source>
<translation type="unfinished">Ansicht</translation>
</message>
<message>
<source>Style</source>
<translation type="unfinished">Design</translation>
</message>
<message>
<source>Tools</source>
<translation type="unfinished">Extras</translation>
</message>
<message>
<source>Configuration</source>
<translation type="unfinished">Konfiguration</translation>
</message>
<message>
<source>Quit</source>
<translation type="unfinished">Beenden</translation>
</message>
<message>
<source>Open File(s)...</source>
<translation type="unfinished">Datei(en) Öffnen...</translation>
</message>
<message>
<source>Visit Official Web-Site</source>
<translation type="unfinished">Offizielle Web-Seite</translation>
</message>
<message>
<source>Check for Updates</source>
<translation type="unfinished">Nach Updates Suchen</translation>
</message>
<message>
<source>Open Folder...</source>
<translation type="unfinished">Verzeichnis Öffnen...</translation>
</message>
<message>
<source>Clear All</source>
<translation type="unfinished">Alle Löschen</translation>
</message>
<message>
<source>Plastique</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Cleanlooks</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Windows Vista (&quot;Aero&quot;)</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Windows Classic</source>
<translation type="unfinished">Windows Klassisch</translation>
</message>
<message>
<source>Windows XP (&quot;Luna&quot;)</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Disable Update Reminder</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Disable Sound Effects</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Install WMA Decoder</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Disable Nero AAC Notifications</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Disable WMA Decoder Notifications</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Show DropBox</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Language</source>
<translation type="unfinished">Sprache</translation>
</message>
<message>
<source>DEMO VERSION</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>You can drop in audio files here!</source>
<translation type="unfinished">Sie können hier Audio-Dateien per Drag&amp;Drop einfügen!</translation>
</message>
<message>
<source>Open File in External Application</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Browse File Location</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Browse Selected Folder</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>License Declined</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>You have declined the license. Consequently the application will exit now!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Goodbye!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>LameXP - Expired</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>This demo (pre-release) version of LameXP has expired at %1.
LameXP is free software and release versions won&apos;t expire.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Exit Program</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Urgent Update</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Your version of LameXP is more than a year old. Time for an update!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Update Reminer</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Your last update check was more than 14 days ago. Check for updates now?</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Your did not check for LameXP updates yet. Check for updates now?</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Postpone</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>&lt;nobr&gt;LameXP detected that your version of the Nero AAC encoder is outdated!&lt;br&gt;</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>The current version available is %1 (or later), but you still have version %2 installed.&lt;br&gt;&lt;br&gt;</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>You can download the latest version of the Nero AAC encoder from the Nero website at:&lt;br&gt;</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>AAC Encoder Outdated</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>&lt;nobr&gt;The Nero AAC encoder could not be found. AAC encoding support will be disabled.&lt;br&gt;</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Please put &apos;neroAacEnc.exe&apos;, &apos;neroAacDec.exe&apos; and &apos;neroAacTag.exe&apos; into the LameXP directory!&lt;br&gt;&lt;br&gt;</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Your LameXP directory is located here:&lt;br&gt;</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>You can download the Nero AAC encoder for free from the official Nero website at:&lt;br&gt;</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>AAC Support Disabled</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>&lt;nobr&gt;LameXP has detected that the WMA File Decoder component is not currently installed on your system.&lt;br&gt;</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>You won&apos;t be able to process WMA files as input unless the WMA File Decoder component is installed!&lt;/nobr&gt;</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>WMA Decoder Missing</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>LameXP</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>You must add at least one file to the list before proceeding!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Low Diskspace Warning</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>&lt;nobr&gt;There are less than %1 GB of free diskspace available on your system&apos;s TEMP folder.&lt;/nobr&gt;&lt;br&gt;&lt;nobr&gt;It is highly recommend to free up more diskspace before proceeding with the encode!&lt;/nobr&gt;&lt;br&gt;&lt;br&gt;Your TEMP folder is located at:</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Abort Encoding Process</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Clean Disk Now</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Ignore</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Low Diskspace</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>You are proceeding with low diskspace. Problems might occur!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Sorry, an unsupported encoder has been chosen!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Cannot write to the selected output directory.&lt;br&gt;&lt;nobr&gt;%1&lt;/nobr&gt;&lt;br&gt;&lt;br&gt;Please choose a different directory!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Add file(s)</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Add folder</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>New Folder</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Enter the name of the new folder:</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Failed to create folder</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>The new folder could not be created:&lt;br&gt;&lt;nobr&gt;%1&lt;/nobr&gt;&lt;br&gt;&lt;br&gt;Drive is read-only or insufficient access rights!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Already running</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>LameXP is already running, please use the running instance!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Quality Level %1</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Compression %1</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Uncompressed</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Do you really want to disable the update reminder?</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Update Reminder</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>The update reminder has been disabled.&lt;br&gt;Please remember to check for updates at regular intervals!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>The update reminder has been re-enabled.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Do you really want to disable all sound effects?</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Sound Effects</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>All sound effects have been disabled.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>The sound effects have been re-enabled.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Nero AAC Notifications</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Do you really want to disable all Nero AAC Encoder notifications?</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>All Nero AAC Encoder notifications have been disabled.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>The Nero AAC Encoder notifications have been re-enabled.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>WMA Decoder Notifications</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Do you really want to disable all WMA Decoder notifications?</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>All WMA Decoder notifications have been disabled.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>The WMA Decoder notifications have been re-enabled.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Do you want to download and install the WMA File Decoder component now?</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Download &amp;&amp; Install</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Cancel</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Downloading WMA Decoder Setup, please wait...</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Download Failed</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Failed to download the WMA Decoder setup. Check your internet connection!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Try Again</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>The download seems to be corrupted. Please try again!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>WMA Decoder</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>The WMA File Decoder has been installed. Please restart LameXP now!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Quit LameXP</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Adding file(s), please wait...</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Access Denied</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>&lt;nobr&gt;%1 file(s) have been rejected, because read access was not granted!&lt;br&gt;This usually means the file is locked by another process.&lt;/nobr&gt;</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Files Rejected</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>&lt;nobr&gt;%1 file(s) have been rejected, because the file format could not be recognized!&lt;br&gt;This usually means the file is damaged or the file format is not supported.&lt;/nobr&gt;</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>MetaInfo</name>
<message>
<source>Meta Information</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>&lt;b&gt;Meta Information&lt;/b&gt;&lt;br&gt;The following meta information have been extracted from the original file.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Edit</source>
<translation type="unfinished">Bearbeiten</translation>
</message>
<message>
<source>Close</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>ProcessingDialog</name>
<message>
<source>LameXP - Processing</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>&lt;b&gt;Encoding Files&lt;/b&gt;&lt;br&gt;Your files are being encoded, please be patient...</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Initializing, please wait...</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>(VERSION_TAG)</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Abort</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Close</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>SplashScreen</name>
<message>
<source>LameXP is launching...</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>UpdateDialog</name>
<message>
<source>LameXP Update Manager</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Please wait...</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>$(HINT_TEXT)</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Latest version available:</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>(Unknown)</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Currently installed version:</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>$(INFORMATION)</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Retry</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Show Log</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Download &amp;&amp; Install</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Close</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>WorkingBanner</name>
<message>
<source>Frame</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>$(Status)</source>
<translation type="unfinished"></translation>
</message>
</context>
</TS>

View File

@ -0,0 +1,11 @@
@echo off
REM ---------------------------
set "QTVARS=E:\Qt\MSVC\4.7.1\bin\qtvars.bat"
REM ---------------------------
call "%QTVARS%"
REM ---------------------------
for %%f in (*.ts) do (
lrelease.exe %%f -qm ..\..\res\localization\%%~nf.qm
)
REM ---------------------------
pause

View File

@ -19,7 +19,7 @@ for %%f in (..\..\src\*.cpp) do (
) )
REM --------------------------- REM ---------------------------
for %%f in (*.ts) do ( for %%f in (*.ts) do (
lupdate.exe @update.lst -ts %%f lupdate.exe @update.lst -no-obsolete -ts %%f
) )
REM --------------------------- REM ---------------------------
pause pause

View File

@ -286,7 +286,7 @@
<enum>QFrame::Plain</enum> <enum>QFrame::Plain</enum>
</property> </property>
<property name="text"> <property name="text">
<string>($OUTDIR)</string> <string notr="true">($OUTDIR)</string>
</property> </property>
</widget> </widget>
</item> </item>
@ -877,7 +877,7 @@
</font> </font>
</property> </property>
<property name="text"> <property name="text">
<string>(VALUE)</string> <string notr="true">(VALUE)</string>
</property> </property>
<property name="textFormat"> <property name="textFormat">
<enum>Qt::RichText</enum> <enum>Qt::RichText</enum>
@ -1459,7 +1459,7 @@
<bool>true</bool> <bool>true</bool>
</property> </property>
<property name="text"> <property name="text">
<string>English</string> <string notr="true">English</string>
</property> </property>
</action> </action>
</widget> </widget>
@ -1571,6 +1571,12 @@
<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"/>
<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"/>
</resources> </resources>
<connections> <connections>
<connection> <connection>

View File

@ -3,9 +3,11 @@
<qresource> <qresource>
<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</file>
<file>localization/LameXP_FR.qm.txt</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>
-->
</qresource> </qresource>
</RCC> </RCC>

Binary file not shown.

View File

@ -1 +1 @@
Deutsch Deutsch

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 193 #define VER_LAMEXP_BUILD 197
#define VER_LAMEXP_SUFFIX TechPreview #define VER_LAMEXP_SUFFIX TechPreview
/* /*

View File

@ -82,16 +82,6 @@ private:
int m_index; int m_index;
}; };
//Helper class
class Tag: public QObjectUserData
{
public:
Tag(const QString &text) : m_text(text) {}
QString text(void) { return m_text; }
private:
const QString m_text;
};
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
// Constructor // Constructor
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
@ -100,7 +90,6 @@ MainWindow::MainWindow(FileListModel *fileListModel, AudioFileModel *metaInfo, S
: :
QMainWindow(parent), QMainWindow(parent),
m_fileListModel(fileListModel), m_fileListModel(fileListModel),
m_currentTranslator(new QTranslator),
m_metaData(metaInfo), m_metaData(metaInfo),
m_settings(settingsModel), m_settings(settingsModel),
m_accepted(false), m_accepted(false),
@ -113,12 +102,6 @@ MainWindow::MainWindow(FileListModel *fileListModel, AudioFileModel *metaInfo, S
//Register meta types //Register meta types
qRegisterMetaType<AudioFileModel>("AudioFileModel"); qRegisterMetaType<AudioFileModel>("AudioFileModel");
//Update window title
if(lamexp_version_demo())
{
setWindowTitle(windowTitle().append(" [DEMO VERSION]"));
}
//Enabled main buttons //Enabled main buttons
connect(buttonAbout, SIGNAL(clicked()), this, SLOT(aboutButtonClicked())); connect(buttonAbout, SIGNAL(clicked()), this, SLOT(aboutButtonClicked()));
connect(buttonStart, SIGNAL(clicked()), this, SLOT(encodeButtonClicked())); connect(buttonStart, SIGNAL(clicked()), this, SLOT(encodeButtonClicked()));
@ -135,14 +118,13 @@ MainWindow::MainWindow(FileListModel *fileListModel, AudioFileModel *metaInfo, S
sourceFileView->setContextMenuPolicy(Qt::CustomContextMenu); sourceFileView->setContextMenuPolicy(Qt::CustomContextMenu);
m_dropNoteLabel = new QLabel(sourceFileView); m_dropNoteLabel = new QLabel(sourceFileView);
m_dropNoteLabel->setAlignment(Qt::AlignHCenter | Qt::AlignVCenter); m_dropNoteLabel->setAlignment(Qt::AlignHCenter | Qt::AlignVCenter);
m_dropNoteLabel->setText("» You can drop in audio files here! «");
SET_FONT_BOLD(m_dropNoteLabel, true); SET_FONT_BOLD(m_dropNoteLabel, true);
SET_TEXT_COLOR(m_dropNoteLabel, Qt::darkGray); SET_TEXT_COLOR(m_dropNoteLabel, Qt::darkGray);
m_sourceFilesContextMenu = new QMenu(); m_sourceFilesContextMenu = new QMenu();
QAction *showDetailsContextAction = m_sourceFilesContextMenu->addAction(QIcon(":/icons/zoom.png"), "Show Details"); m_showDetailsContextAction = m_sourceFilesContextMenu->addAction(QIcon(":/icons/zoom.png"), "N/A");
QAction *previewContextAction = m_sourceFilesContextMenu->addAction(QIcon(":/icons/sound.png"), "Open File in External Application"); m_previewContextAction = m_sourceFilesContextMenu->addAction(QIcon(":/icons/sound.png"), "N/A");
QAction *findFileContextAction = m_sourceFilesContextMenu->addAction(QIcon(":/icons/folder_go.png"), "Browse File Location"); m_findFileContextAction = m_sourceFilesContextMenu->addAction(QIcon(":/icons/folder_go.png"), "N/A");
SET_FONT_BOLD(showDetailsContextAction, true); SET_FONT_BOLD(m_showDetailsContextAction, true);
connect(buttonAddFiles, SIGNAL(clicked()), this, SLOT(addFilesButtonClicked())); connect(buttonAddFiles, SIGNAL(clicked()), this, SLOT(addFilesButtonClicked()));
connect(buttonRemoveFile, SIGNAL(clicked()), this, SLOT(removeFileButtonClicked())); connect(buttonRemoveFile, SIGNAL(clicked()), this, SLOT(removeFileButtonClicked()));
connect(buttonClearFiles, SIGNAL(clicked()), this, SLOT(clearFilesButtonClicked())); connect(buttonClearFiles, SIGNAL(clicked()), this, SLOT(clearFilesButtonClicked()));
@ -153,9 +135,9 @@ MainWindow::MainWindow(FileListModel *fileListModel, AudioFileModel *metaInfo, S
connect(m_fileListModel, SIGNAL(rowsRemoved(QModelIndex,int,int)), this, SLOT(sourceModelChanged())); connect(m_fileListModel, SIGNAL(rowsRemoved(QModelIndex,int,int)), this, SLOT(sourceModelChanged()));
connect(m_fileListModel, SIGNAL(modelReset()), this, SLOT(sourceModelChanged())); connect(m_fileListModel, SIGNAL(modelReset()), this, SLOT(sourceModelChanged()));
connect(sourceFileView, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(sourceFilesContextMenu(QPoint))); connect(sourceFileView, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(sourceFilesContextMenu(QPoint)));
connect(showDetailsContextAction, SIGNAL(triggered(bool)), this, SLOT(showDetailsButtonClicked())); connect(m_showDetailsContextAction, SIGNAL(triggered(bool)), this, SLOT(showDetailsButtonClicked()));
connect(previewContextAction, SIGNAL(triggered(bool)), this, SLOT(previewContextActionTriggered())); connect(m_previewContextAction, SIGNAL(triggered(bool)), this, SLOT(previewContextActionTriggered()));
connect(findFileContextAction, SIGNAL(triggered(bool)), this, SLOT(findFileContextActionTriggered())); connect(m_findFileContextAction, SIGNAL(triggered(bool)), this, SLOT(findFileContextActionTriggered()));
//Setup "Output" tab //Setup "Output" tab
m_fileSystemModel = new QFileSystemModelEx(); m_fileSystemModel = new QFileSystemModelEx();
@ -185,9 +167,9 @@ MainWindow::MainWindow(FileListModel *fileListModel, AudioFileModel *metaInfo, S
connect(saveToSourceFolderCheckBox, SIGNAL(clicked()), this, SLOT(saveToSourceFolderChanged())); connect(saveToSourceFolderCheckBox, SIGNAL(clicked()), this, SLOT(saveToSourceFolderChanged()));
connect(prependRelativePathCheckBox, SIGNAL(clicked()), this, SLOT(prependRelativePathChanged())); connect(prependRelativePathCheckBox, SIGNAL(clicked()), this, SLOT(prependRelativePathChanged()));
m_outputFolderContextMenu = new QMenu(); m_outputFolderContextMenu = new QMenu();
QAction *showFolderContextAction = m_outputFolderContextMenu->addAction(QIcon(":/icons/zoom.png"), "Browse Selected Folder"); m_showFolderContextAction = m_outputFolderContextMenu->addAction(QIcon(":/icons/zoom.png"), "N/A");
connect(outputFolderView, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(outputFolderContextMenu(QPoint))); connect(outputFolderView, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(outputFolderContextMenu(QPoint)));
connect(showFolderContextAction, SIGNAL(triggered(bool)), this, SLOT(showFolderContextActionTriggered())); connect(m_showFolderContextAction, SIGNAL(triggered(bool)), this, SLOT(showFolderContextActionTriggered()));
outputFolderLabel->installEventFilter(this); outputFolderLabel->installEventFilter(this);
//Setup "Meta Data" tab //Setup "Meta Data" tab
@ -268,18 +250,22 @@ 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); m_languageActionGroup->addAction(actionLanguageEnglish);
QStringList translations = QDir(":/localization").entryList(QStringList() << "*.qm", QDir::Files, QDir::Name); actionLanguageEnglish->setChecked(true);
for(int i = 0; i < translations.count(); i++) connect(m_languageActionGroup, SIGNAL(triggered(QAction*)), this, SLOT(languageActionActivated(QAction*)));
QStringList translations = lamexp_query_translations();
while(translations.count() > 0)
{ {
QAction *currentLanguage = new QAction(this); QAction *currentLanguage = new QAction(this);
currentLanguage->setCheckable(true); currentLanguage->setCheckable(true);
currentLanguage->setText(QString::fromUtf8(reinterpret_cast<const char*>(QResource(QString(":/localization/%1.txt").arg(translations.at(i))).data()))); currentLanguage->setText(translations.takeFirst());
currentLanguage->setUserData(0, new Tag(translations.at(i)));
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);
}
} }
connect(m_languageActionGroup, SIGNAL(triggered(QAction*)), this, SLOT(languageActionActivated(QAction*)));
actionLanguageEnglish->setChecked(true);
//Activate tools menu actions //Activate tools menu actions
actionDisableUpdateReminder->setChecked(!m_settings->autoUpdateEnabled()); actionDisableUpdateReminder->setChecked(!m_settings->autoUpdateEnabled());
@ -324,6 +310,9 @@ MainWindow::MainWindow(FileListModel *fileListModel, AudioFileModel *metaInfo, S
//Enable Drag & Drop //Enable Drag & Drop
this->setAcceptDrops(true); this->setAcceptDrops(true);
//Finally re-translate the UI
retranslateUi(this);
} }
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
@ -347,9 +336,6 @@ MainWindow::~MainWindow(void)
sourceFileView->setModel(NULL); sourceFileView->setModel(NULL);
metaDataView->setModel(NULL); metaDataView->setModel(NULL);
//Uninstall translator
QApplication::removeTranslator(m_currentTranslator);
//Free memory //Free memory
LAMEXP_DELETE(m_tabActionGroup); LAMEXP_DELETE(m_tabActionGroup);
LAMEXP_DELETE(m_styleActionGroup); LAMEXP_DELETE(m_styleActionGroup);
@ -364,13 +350,32 @@ MainWindow::~MainWindow(void)
LAMEXP_DELETE(m_encoderButtonGroup); LAMEXP_DELETE(m_encoderButtonGroup);
LAMEXP_DELETE(m_sourceFilesContextMenu); LAMEXP_DELETE(m_sourceFilesContextMenu);
LAMEXP_DELETE(m_dropBox); LAMEXP_DELETE(m_dropBox);
LAMEXP_DELETE(m_currentTranslator);
} }
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
// PRIVATE FUNCTIONS // PRIVATE FUNCTIONS
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
/*
* Re-translate the UI
*/
void MainWindow::retranslateUi(QMainWindow *MainWindow)
{
Ui::MainWindow::retranslateUi(MainWindow);
if(lamexp_version_demo())
{
setWindowTitle(QString("%1 [%2]").arg(windowTitle(), tr("DEMO VERSION")));
}
m_dropNoteLabel->setText(QString("» %1 «").arg(tr("You can drop in audio files here!")));
m_showDetailsContextAction->setText(tr("Show Details"));
m_previewContextAction->setText(tr("Open File in External Application"));
m_findFileContextAction->setText(tr("Browse File Location"));
m_showFolderContextAction->setText(tr("Browse Selected Folder"));
}
/* /*
* Add file to source list * Add file to source list
*/ */
@ -387,15 +392,15 @@ void MainWindow::addFiles(const QStringList &files)
connect(analyzer, SIGNAL(fileSelected(QString)), m_banner, SLOT(setText(QString)), Qt::QueuedConnection); connect(analyzer, SIGNAL(fileSelected(QString)), m_banner, SLOT(setText(QString)), Qt::QueuedConnection);
connect(analyzer, SIGNAL(fileAnalyzed(AudioFileModel)), m_fileListModel, SLOT(addFile(AudioFileModel)), Qt::QueuedConnection); connect(analyzer, SIGNAL(fileAnalyzed(AudioFileModel)), m_fileListModel, SLOT(addFile(AudioFileModel)), Qt::QueuedConnection);
m_banner->show("Adding file(s), please wait...", analyzer); m_banner->show(tr("Adding file(s), please wait..."), analyzer);
if(analyzer->filesDenied()) if(analyzer->filesDenied())
{ {
QMessageBox::warning(this, "Access Denied", QString("<nobr>%1 file(s) have been rejected, because read access was not granted!<br>This usually means the file is locked by another process.</nobr>").arg(analyzer->filesDenied())); QMessageBox::warning(this, tr("Access Denied"), tr("<nobr>%1 file(s) have been rejected, because read access was not granted!<br>This usually means the file is locked by another process.</nobr>").arg(analyzer->filesDenied()));
} }
if(analyzer->filesRejected()) if(analyzer->filesRejected())
{ {
QMessageBox::warning(this, "Files Rejected", QString("<nobr>%1 file(s) have been rejected, because the file format could not be recognized!<br>This usually means the file is damaged or the file format is not supported.</nobr>").arg(analyzer->filesRejected())); QMessageBox::warning(this, tr("Files Rejected"), tr("<nobr>%1 file(s) have been rejected, because the file format could not be recognized!<br>This usually means the file is damaged or the file format is not supported.</nobr>").arg(analyzer->filesRejected()));
} }
LAMEXP_DELETE(analyzer); LAMEXP_DELETE(analyzer);
@ -526,11 +531,9 @@ bool MainWindow::eventFilter(QObject *obj, QEvent *event)
} }
break; break;
case QEvent::Enter: case QEvent::Enter:
qDebug("QEvent::HoverEnter");
outputFolderLabel->setForegroundRole(QPalette::Link); outputFolderLabel->setForegroundRole(QPalette::Link);
break; break;
case QEvent::Leave: case QEvent::Leave:
qDebug("QEvent::HoverLeave");
outputFolderLabel->setForegroundRole(QPalette::WindowText); outputFolderLabel->setForegroundRole(QPalette::WindowText);
break; break;
} }
@ -566,7 +569,7 @@ void MainWindow::windowShown(void)
m_settings->licenseAccepted(-1); m_settings->licenseAccepted(-1);
QApplication::processEvents(); QApplication::processEvents();
PlaySound(MAKEINTRESOURCE(IDR_WAVE_WHAMMY), GetModuleHandle(NULL), SND_RESOURCE | SND_SYNC); PlaySound(MAKEINTRESOURCE(IDR_WAVE_WHAMMY), GetModuleHandle(NULL), SND_RESOURCE | SND_SYNC);
QMessageBox::critical(this, "License Declined", "You have declined the license. Consequently the application will exit now!", "Goodbye!"); QMessageBox::critical(this, tr("License Declined"), tr("You have declined the license. Consequently the application will exit now!"), tr("Goodbye!"));
QProcess::startDetached(QString("%1/Uninstall.exe").arg(QApplication::applicationDirPath()), QStringList()); QProcess::startDetached(QString("%1/Uninstall.exe").arg(QApplication::applicationDirPath()), QStringList());
QApplication::quit(); QApplication::quit();
return; return;
@ -584,7 +587,7 @@ void MainWindow::windowShown(void)
{ {
qWarning("Binary has expired !!!"); qWarning("Binary has expired !!!");
PlaySound(MAKEINTRESOURCE(IDR_WAVE_WHAMMY), GetModuleHandle(NULL), SND_RESOURCE | SND_SYNC); PlaySound(MAKEINTRESOURCE(IDR_WAVE_WHAMMY), GetModuleHandle(NULL), SND_RESOURCE | SND_SYNC);
if(QMessageBox::warning(this, "LameXP - Expired", QString("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)), "Check for Updates", "Exit Program") == 0) 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)
{ {
checkUpdatesActionActivated(); checkUpdatesActionActivated();
} }
@ -597,7 +600,7 @@ void MainWindow::windowShown(void)
if(QDate::currentDate() >= lamexp_version_date().addYears(1)) if(QDate::currentDate() >= lamexp_version_date().addYears(1))
{ {
qWarning("Binary is more than a year old, time to update!"); qWarning("Binary is more than a year old, time to update!");
if(QMessageBox::warning(this, "Urgent Update", "Your version of LameXP is more than a year old. Time for an update!", "Check for Updates", "Exit Program") == 0) if(QMessageBox::warning(this, tr("Urgent Update"), tr("Your version of LameXP is more than a year old. Time for an update!"), tr("Check for Updates"), tr("Exit Program")) == 0)
{ {
checkUpdatesActionActivated(); checkUpdatesActionActivated();
} }
@ -612,7 +615,7 @@ void MainWindow::windowShown(void)
QDate lastUpdateCheck = QDate::fromString(m_settings->autoUpdateLastCheck(), Qt::ISODate); QDate lastUpdateCheck = QDate::fromString(m_settings->autoUpdateLastCheck(), Qt::ISODate);
if(!lastUpdateCheck.isValid() || QDate::currentDate() >= lastUpdateCheck.addDays(14)) if(!lastUpdateCheck.isValid() || QDate::currentDate() >= lastUpdateCheck.addDays(14))
{ {
if(QMessageBox::information(this, "Update Reminer", (lastUpdateCheck.isValid() ? "Your last update check was more than 14 days ago. Check for updates now?" : "Your did not check for LameXP updates yet. Check for updates now?"), "Check for Updates", "Postpone") == 0) 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)
{ {
checkUpdatesActionActivated(); checkUpdatesActionActivated();
} }
@ -627,24 +630,24 @@ 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 += "<nobr>LameXP detected that your version of the Nero AAC encoder is outdated!<br>"; messageText += tr("<nobr>LameXP detected that your version of the Nero AAC encoder is outdated!<br>");
messageText += "The current version available is " + lamexp_version2string("?.?.?.?", lamexp_toolver_neroaac()) + " (or later), but you still have version " + lamexp_version2string("?.?.?.?", lamexp_tool_version("neroAacEnc.exe")) + " installed.<br><br>"; 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 += "You can download the latest version of the Nero AAC encoder from the Nero website at:<br>"; messageText += tr("You can download the latest version of the Nero AAC encoder from the Nero website at:<br>");
messageText += "<b>" + LINK(AboutDialog::neroAacUrl) + "</b><br></nobr>"; messageText += "<b>" + LINK(AboutDialog::neroAacUrl) + "</b><br></nobr>";
QMessageBox::information(this, "AAC Encoder Outdated", messageText); QMessageBox::information(this, tr("AAC Encoder Outdated"), messageText);
} }
} }
else else
{ {
radioButtonEncoderAAC->setEnabled(false); radioButtonEncoderAAC->setEnabled(false);
QString messageText; QString messageText;
messageText += "<nobr>The Nero AAC encoder could not be found. AAC encoding support will be disabled.<br>"; messageText += tr("<nobr>The Nero AAC encoder could not be found. AAC encoding support will be disabled.<br>");
messageText += "Please put 'neroAacEnc.exe', 'neroAacDec.exe' and 'neroAacTag.exe' into the LameXP directory!<br><br>"; messageText += tr("Please put 'neroAacEnc.exe', 'neroAacDec.exe' and 'neroAacTag.exe' into the LameXP directory!<br><br>");
messageText += "Your LameXP directory is located here:<br>"; messageText += tr("Your LameXP directory is located here:<br>");
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 += "You can download the Nero AAC encoder for free from the official Nero website at:<br>"; messageText += tr("You can download the Nero AAC encoder for free from the official Nero website at:<br>");
messageText += "<b>" + LINK(AboutDialog::neroAacUrl) + "</b><br></nobr>"; messageText += "<b>" + LINK(AboutDialog::neroAacUrl) + "</b><br></nobr>";
QMessageBox::information(this, "AAC Support Disabled", messageText); QMessageBox::information(this, tr("AAC Support Disabled"), messageText);
} }
} }
@ -654,9 +657,9 @@ void MainWindow::windowShown(void)
if(!lamexp_check_tool("wmawav.exe")) if(!lamexp_check_tool("wmawav.exe"))
{ {
QString messageText; QString messageText;
messageText += "<nobr>LameXP has detected that the WMA File Decoder component is not currently installed on your system.<br>"; messageText += tr("<nobr>LameXP has detected that the WMA File Decoder component is not currently installed on your system.<br>");
messageText += "You won't be able to process WMA files as input unless the WMA File Decoder component is installed!</nobr>"; messageText += tr("You won't be able to process WMA files as input unless the WMA File Decoder component is installed!</nobr>");
QMessageBox::information(this, "WMA Decoder Missing", messageText); QMessageBox::information(this, tr("WMA Decoder Missing"), messageText);
installWMADecoderActionTriggered(rand() % 2); installWMADecoderActionTriggered(rand() % 2);
} }
} }
@ -710,7 +713,7 @@ void MainWindow::encodeButtonClicked(void)
if(m_fileListModel->rowCount() < 1) if(m_fileListModel->rowCount() < 1)
{ {
QMessageBox::warning(this, "LameXP", "You must add at least one file to the list before proceeding!"); QMessageBox::warning(this, tr("LameXP"), tr("You must add at least one file to the list before proceeding!"));
tabWidget->setCurrentIndex(0); tabWidget->setCurrentIndex(0);
return; return;
} }
@ -722,7 +725,7 @@ void MainWindow::encodeButtonClicked(void)
QStringList tempFolderParts = lamexp_temp_folder().split("/", QString::SkipEmptyParts, Qt::CaseInsensitive); QStringList tempFolderParts = lamexp_temp_folder().split("/", QString::SkipEmptyParts, Qt::CaseInsensitive);
tempFolderParts.takeLast(); tempFolderParts.takeLast();
if(m_settings->soundsEnabled()) PlaySound(MAKEINTRESOURCE(IDR_WAVE_WHAMMY), GetModuleHandle(NULL), SND_RESOURCE | SND_SYNC); if(m_settings->soundsEnabled()) PlaySound(MAKEINTRESOURCE(IDR_WAVE_WHAMMY), GetModuleHandle(NULL), SND_RESOURCE | SND_SYNC);
switch(QMessageBox::warning(this, "Low Diskspace Warning", QString("<nobr>There are less than %1 GB of free diskspace available on your system's TEMP folder.</nobr><br><nobr>It is highly recommend to free up more diskspace before proceeding with the encode!.</nobr><br><br>Your TEMP folder is located at:<br><nobr><i><a href=\"file:///%3\">%3</a></i></nobr><br>").arg(QString::number(minimumFreeDiskspaceMultiplier), tempFolderParts.join("\\")), "Abort Encoding Process", "Clean Disk Now", "Ignore")) switch(QMessageBox::warning(this, tr("Low Diskspace Warning"), tr("<nobr>There are less than %1 GB of free diskspace available on your system's TEMP folder.</nobr><br><nobr>It is highly recommend to free up more diskspace before proceeding with the encode!</nobr><br><br>Your TEMP folder is located at:").append("<br><nobr><i><a href=\"file:///%3\">%3</a></i></nobr><br>").arg(QString::number(minimumFreeDiskspaceMultiplier), tempFolderParts.join("\\")), tr("Abort Encoding Process"), tr("Clean Disk Now"), tr("Ignore")))
{ {
case 1: case 1:
QProcess::startDetached(QString("%1/cleanmgr.exe").arg(lamexp_known_folder(lamexp_folder_systemfolder)), QStringList() << "/D" << tempFolderParts.first()); QProcess::startDetached(QString("%1/cleanmgr.exe").arg(lamexp_known_folder(lamexp_folder_systemfolder)), QStringList() << "/D" << tempFolderParts.first());
@ -730,7 +733,7 @@ void MainWindow::encodeButtonClicked(void)
return; return;
break; break;
default: default:
QMessageBox::warning(this, "Low Diskspace", "You are proceeding with low diskspace. Problems might occur!"); QMessageBox::warning(this, tr("Low Diskspace"), tr("You are proceeding with low diskspace. Problems might occur!"));
break; break;
} }
} }
@ -744,7 +747,7 @@ void MainWindow::encodeButtonClicked(void)
case SettingsModel::PCMEncoder: case SettingsModel::PCMEncoder:
break; break;
default: default:
QMessageBox::warning(this, "LameXP", "Sorry, an unsupported encoder has been chosen!"); QMessageBox::warning(this, tr("LameXP"), tr("Sorry, an unsupported encoder has been chosen!"));
tabWidget->setCurrentIndex(3); tabWidget->setCurrentIndex(3);
return; return;
} }
@ -754,7 +757,7 @@ void MainWindow::encodeButtonClicked(void)
QFile writeTest(QString("%1/~%2.txt").arg(m_settings->outputDir(), QUuid::createUuid().toString())); QFile writeTest(QString("%1/~%2.txt").arg(m_settings->outputDir(), QUuid::createUuid().toString()));
if(!writeTest.open(QIODevice::ReadWrite)) if(!writeTest.open(QIODevice::ReadWrite))
{ {
QMessageBox::warning(this, "LameXP", QString("Cannot write to the selected output directory.<br><nobr>%1</nobr><br><br>Please choose a different directory!").arg(m_settings->outputDir())); QMessageBox::warning(this, tr("LameXP"), tr("Cannot write to the selected output directory.<br><nobr>%1</nobr><br><br>Please choose a different directory!").arg(m_settings->outputDir()));
tabWidget->setCurrentIndex(1); tabWidget->setCurrentIndex(1);
return; return;
} }
@ -785,7 +788,7 @@ void MainWindow::addFilesButtonClicked(void)
{ {
ABORT_IF_BUSY; ABORT_IF_BUSY;
QStringList fileTypeFilters = DecoderRegistry::getSupportedTypes(); QStringList fileTypeFilters = DecoderRegistry::getSupportedTypes();
QStringList selectedFiles = QFileDialog::getOpenFileNames(this, "Add file(s)", QString(), fileTypeFilters.join(";;")); QStringList selectedFiles = QFileDialog::getOpenFileNames(this, tr("Add file(s)"), QString(), fileTypeFilters.join(";;"));
addFiles(selectedFiles); addFiles(selectedFiles);
} }
@ -795,7 +798,7 @@ void MainWindow::addFilesButtonClicked(void)
void MainWindow::openFolderActionActivated(void) void MainWindow::openFolderActionActivated(void)
{ {
ABORT_IF_BUSY; ABORT_IF_BUSY;
QString selectedFolder = QFileDialog::getExistingDirectory(this, "Add folder", QDesktopServices::storageLocation(QDesktopServices::MusicLocation)); QString selectedFolder = QFileDialog::getExistingDirectory(this, tr("Add folder"), QDesktopServices::storageLocation(QDesktopServices::MusicLocation));
if(!selectedFolder.isEmpty()) if(!selectedFolder.isEmpty())
{ {
@ -959,14 +962,21 @@ void MainWindow::styleActionActivated(QAction *action)
*/ */
void MainWindow::languageActionActivated(QAction *action) void MainWindow::languageActionActivated(QAction *action)
{ {
QApplication::removeTranslator(m_currentTranslator); if(action != actionLanguageEnglish)
if(action->userData(0))
{ {
if(m_currentTranslator->load(QString(":/localization/%1").arg(dynamic_cast<Tag*>(action->userData(0))->text()))) if(lamexp_install_translator(action->text()))
{ {
QApplication::installTranslator(m_currentTranslator); m_settings->currentLanguage(action->text());
} }
} }
else
{
if(lamexp_install_translator(QString()))
{
m_settings->currentLanguage(action->text());
}
}
retranslateUi(this); retranslateUi(this);
} }
@ -1061,7 +1071,7 @@ void MainWindow::makeFolderButtonClicked(void)
ABORT_IF_BUSY; ABORT_IF_BUSY;
QDir basePath(m_fileSystemModel->fileInfo(outputFolderView->currentIndex()).absoluteFilePath()); QDir basePath(m_fileSystemModel->fileInfo(outputFolderView->currentIndex()).absoluteFilePath());
QString suggestedName = "New Folder"; QString suggestedName = tr("New Folder");
if(!m_metaData->fileArtist().isEmpty() && !m_metaData->fileAlbum().isEmpty()) if(!m_metaData->fileArtist().isEmpty() && !m_metaData->fileAlbum().isEmpty())
{ {
@ -1102,7 +1112,7 @@ void MainWindow::makeFolderButtonClicked(void)
while(true) while(true)
{ {
bool bApplied = false; bool bApplied = false;
QString folderName = QInputDialog::getText(this, "New Folder", QString("Enter the name of the new folder:").leftJustified(96, ' '), QLineEdit::Normal, suggestedName, &bApplied, Qt::WindowStaysOnTopHint).simplified(); QString folderName = QInputDialog::getText(this, tr("New Folder"), tr("Enter the name of the new folder:").leftJustified(96, ' '), QLineEdit::Normal, suggestedName, &bApplied, Qt::WindowStaysOnTopHint).simplified();
if(bApplied) if(bApplied)
{ {
@ -1142,7 +1152,7 @@ void MainWindow::makeFolderButtonClicked(void)
} }
else else
{ {
QMessageBox::warning(this, "Failed to create folder", QString("The new folder could not be created:<br><nobr>%1</nobr><br><br>Drive is read-only or insufficient access rights!").arg(basePath.absoluteFilePath(newFolder))); QMessageBox::warning(this, tr("Failed to create folder"), tr("The new folder could not be created:<br><nobr>%1</nobr><br><br>Drive is read-only or insufficient access rights!").arg(basePath.absoluteFilePath(newFolder)));
} }
} }
break; break;
@ -1202,7 +1212,7 @@ void MainWindow::notifyOtherInstance(void)
{ {
if(!m_banner->isVisible()) if(!m_banner->isVisible())
{ {
QMessageBox msgBox(QMessageBox::Warning, "Already running", "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(); msgBox.exec();
} }
} }
@ -1382,19 +1392,19 @@ void MainWindow::updateBitrate(int value)
switch(m_settings->compressionEncoder()) switch(m_settings->compressionEncoder())
{ {
case SettingsModel::MP3Encoder: case SettingsModel::MP3Encoder:
labelBitrate->setText(QString("Quality Level %1").arg(9 - value)); labelBitrate->setText(tr("Quality Level %1").arg(9 - value));
break; break;
case SettingsModel::VorbisEncoder: case SettingsModel::VorbisEncoder:
labelBitrate->setText(QString("Quality Level %1").arg(value)); labelBitrate->setText(tr("Quality Level %1").arg(value));
break; break;
case SettingsModel::AACEncoder: case SettingsModel::AACEncoder:
labelBitrate->setText(QString("Quality Level %1").arg(QString().sprintf("%.2f", static_cast<double>(value * 5) / 100.0))); labelBitrate->setText(tr("Quality Level %1").arg(QString().sprintf("%.2f", static_cast<double>(value * 5) / 100.0)));
break; break;
case SettingsModel::FLACEncoder: case SettingsModel::FLACEncoder:
labelBitrate->setText(QString("Compression %1").arg(value)); labelBitrate->setText(tr("Compression %1").arg(value));
break; break;
case SettingsModel::PCMEncoder: case SettingsModel::PCMEncoder:
labelBitrate->setText("Uncompressed"); labelBitrate->setText(tr("Uncompressed"));
break; break;
default: default:
labelBitrate->setText(QString::number(value)); labelBitrate->setText(QString::number(value));
@ -1408,10 +1418,10 @@ void MainWindow::updateBitrate(int value)
labelBitrate->setText(QString("&asymp; %1 kbps").arg(SettingsModel::mp3Bitrates[value])); labelBitrate->setText(QString("&asymp; %1 kbps").arg(SettingsModel::mp3Bitrates[value]));
break; break;
case SettingsModel::FLACEncoder: case SettingsModel::FLACEncoder:
labelBitrate->setText(QString("Compression %1").arg(value)); labelBitrate->setText(tr("Compression %1").arg(value));
break; break;
case SettingsModel::PCMEncoder: case SettingsModel::PCMEncoder:
labelBitrate->setText("Uncompressed"); labelBitrate->setText(tr("Uncompressed"));
break; break;
default: default:
labelBitrate->setText(QString("&asymp; %1 kbps").arg(min(500, value * 8))); labelBitrate->setText(QString("&asymp; %1 kbps").arg(min(500, value * 8)));
@ -1425,10 +1435,10 @@ void MainWindow::updateBitrate(int value)
labelBitrate->setText(QString("%1 kbps").arg(SettingsModel::mp3Bitrates[value])); labelBitrate->setText(QString("%1 kbps").arg(SettingsModel::mp3Bitrates[value]));
break; break;
case SettingsModel::FLACEncoder: case SettingsModel::FLACEncoder:
labelBitrate->setText(QString("Compression %1").arg(value)); labelBitrate->setText(tr("Compression %1").arg(value));
break; break;
case SettingsModel::PCMEncoder: case SettingsModel::PCMEncoder:
labelBitrate->setText("Uncompressed"); labelBitrate->setText(tr("Uncompressed"));
break; break;
default: default:
labelBitrate->setText(QString("%1 kbps").arg(min(500, value * 8))); labelBitrate->setText(QString("%1 kbps").arg(min(500, value * 8)));
@ -1595,9 +1605,9 @@ void MainWindow::disableUpdateReminderActionTriggered(bool checked)
{ {
if(checked) if(checked)
{ {
if(QMessageBox::Yes == QMessageBox::question(this, "Disable Update Reminder", "Do you really want to disable the update reminder?", QMessageBox::Yes | QMessageBox::No, QMessageBox::No)) if(QMessageBox::Yes == QMessageBox::question(this, tr("Disable Update Reminder"), tr("Do you really want to disable the update reminder?"), QMessageBox::Yes | QMessageBox::No, QMessageBox::No))
{ {
QMessageBox::information(this, "Update Reminder", "The update reminder has been disabled.<br>Please remember to check for updates at regular intervals!"); QMessageBox::information(this, tr("Update Reminder"), tr("The update reminder has been disabled.<br>Please remember to check for updates at regular intervals!"));
m_settings->autoUpdateEnabled(false); m_settings->autoUpdateEnabled(false);
} }
else else
@ -1607,7 +1617,7 @@ void MainWindow::disableUpdateReminderActionTriggered(bool checked)
} }
else else
{ {
QMessageBox::information(this, "Update Reminder", "The update reminder has been re-enabled."); QMessageBox::information(this, tr("Update Reminder"), tr("The update reminder has been re-enabled."));
m_settings->autoUpdateEnabled(true); m_settings->autoUpdateEnabled(true);
} }
@ -1621,9 +1631,9 @@ void MainWindow::disableSoundsActionTriggered(bool checked)
{ {
if(checked) if(checked)
{ {
if(QMessageBox::Yes == QMessageBox::question(this, "Disable Sound Effects", "Do you really want to disable all sound effects?", QMessageBox::Yes | QMessageBox::No, QMessageBox::No)) if(QMessageBox::Yes == QMessageBox::question(this, tr("Disable Sound Effects"), tr("Do you really want to disable all sound effects?"), QMessageBox::Yes | QMessageBox::No, QMessageBox::No))
{ {
QMessageBox::information(this, "Sound Effects", "All sound effects have been disabled."); QMessageBox::information(this, tr("Sound Effects"), tr("All sound effects have been disabled."));
m_settings->soundsEnabled(false); m_settings->soundsEnabled(false);
} }
else else
@ -1633,7 +1643,7 @@ void MainWindow::disableSoundsActionTriggered(bool checked)
} }
else else
{ {
QMessageBox::information(this, "Sound Effects", "The sound effects have been re-enabled."); QMessageBox::information(this, tr("Sound Effects"), tr("The sound effects have been re-enabled."));
m_settings->soundsEnabled(true); m_settings->soundsEnabled(true);
} }
@ -1647,9 +1657,9 @@ void MainWindow::disableNeroAacNotificationsActionTriggered(bool checked)
{ {
if(checked) if(checked)
{ {
if(QMessageBox::Yes == QMessageBox::question(this, "Nero AAC Notifications", "Do you really want to disable all Nero AAC Encoder notifications?", QMessageBox::Yes | QMessageBox::No, QMessageBox::No)) if(QMessageBox::Yes == QMessageBox::question(this, tr("Nero AAC Notifications"), tr("Do you really want to disable all Nero AAC Encoder notifications?"), QMessageBox::Yes | QMessageBox::No, QMessageBox::No))
{ {
QMessageBox::information(this, "Nero AAC Notifications", "All Nero AAC Encoder notifications have been disabled."); QMessageBox::information(this, tr("Nero AAC Notifications"), tr("All Nero AAC Encoder notifications have been disabled."));
m_settings->neroAacNotificationsEnabled(false); m_settings->neroAacNotificationsEnabled(false);
} }
else else
@ -1659,7 +1669,7 @@ void MainWindow::disableNeroAacNotificationsActionTriggered(bool checked)
} }
else else
{ {
QMessageBox::information(this, "Nero AAC Notifications", "The Nero AAC Encoder notifications have been re-enabled."); QMessageBox::information(this, tr("Nero AAC Notifications"), tr("The Nero AAC Encoder notifications have been re-enabled."));
m_settings->neroAacNotificationsEnabled(true); m_settings->neroAacNotificationsEnabled(true);
} }
@ -1673,9 +1683,9 @@ void MainWindow::disableWmaDecoderNotificationsActionTriggered(bool checked)
{ {
if(checked) if(checked)
{ {
if(QMessageBox::Yes == QMessageBox::question(this, "WMA Decoder Notifications", "Do you really want to disable all WMA Decoder notifications?", QMessageBox::Yes | QMessageBox::No, QMessageBox::No)) if(QMessageBox::Yes == QMessageBox::question(this, tr("WMA Decoder Notifications"), tr("Do you really want to disable all WMA Decoder notifications?"), QMessageBox::Yes | QMessageBox::No, QMessageBox::No))
{ {
QMessageBox::information(this, "WMA Decoder Notifications", "All WMA Decoder notifications have been disabled."); QMessageBox::information(this, tr("WMA Decoder Notifications"), tr("All WMA Decoder notifications have been disabled."));
m_settings->wmaDecoderNotificationsEnabled(false); m_settings->wmaDecoderNotificationsEnabled(false);
} }
else else
@ -1685,7 +1695,7 @@ void MainWindow::disableWmaDecoderNotificationsActionTriggered(bool checked)
} }
else else
{ {
QMessageBox::information(this, "WMA Decoder Notifications", "The WMA Decoder notifications have been re-enabled."); QMessageBox::information(this, tr("WMA Decoder Notifications"), tr("The WMA Decoder notifications have been re-enabled."));
m_settings->wmaDecoderNotificationsEnabled(true); m_settings->wmaDecoderNotificationsEnabled(true);
} }
@ -1700,7 +1710,7 @@ void MainWindow::installWMADecoderActionTriggered(bool checked)
static const char *download_url = "http://www.nch.com.au/components/wmawav.exe"; static const char *download_url = "http://www.nch.com.au/components/wmawav.exe";
static const char *download_hash = "52a3b0e6690faf3f830c336d3c0eadfb7a4e9bc6"; static const char *download_hash = "52a3b0e6690faf3f830c336d3c0eadfb7a4e9bc6";
if(QMessageBox::question(this, "Install WMA Decoder", "Do you want to download and install the WMA File Decoder component now?", "Download && Install", "Cancel") != 0) if(QMessageBox::question(this, tr("Install WMA Decoder"), tr("Do you want to download and install the WMA File Decoder component now?"), tr("Download && Install"), tr("Cancel")) != 0)
{ {
return; return;
} }
@ -1725,12 +1735,12 @@ void MainWindow::installWMADecoderActionTriggered(bool checked)
connect(&process, SIGNAL(finished(int, QProcess::ExitStatus)), &loop, SLOT(quit())); connect(&process, SIGNAL(finished(int, QProcess::ExitStatus)), &loop, SLOT(quit()));
process.start(binaryWGet, QStringList() << "-O" << QFileInfo(setupFile).fileName() << download_url); process.start(binaryWGet, QStringList() << "-O" << QFileInfo(setupFile).fileName() << download_url);
m_banner->show("Downloading WMA Decoder Setup, please wait...", &loop); m_banner->show(tr("Downloading WMA Decoder Setup, please wait..."), &loop);
if(process.exitCode() != 0 || QFileInfo(setupFile).size() < 10240) if(process.exitCode() != 0 || QFileInfo(setupFile).size() < 10240)
{ {
QFile::remove(setupFile); QFile::remove(setupFile);
if(QMessageBox::critical(this, "Download Failed", "Failed to download the WMA Decoder setup. Check your internet connection!", "Try Again", "Cancel") == 0) if(QMessageBox::critical(this, tr("Download Failed"), tr("Failed to download the WMA Decoder setup. Check your internet connection!"), tr("Try Again"), tr("Cancel")) == 0)
{ {
continue; continue;
} }
@ -1751,7 +1761,7 @@ void MainWindow::installWMADecoderActionTriggered(bool checked)
{ {
qWarning("Hash miscompare:\n Expected %s\n Detected %s\n", download_hash, setupFileHash.result().toHex().constData()); qWarning("Hash miscompare:\n Expected %s\n Detected %s\n", download_hash, setupFileHash.result().toHex().constData());
QFile::remove(setupFile); QFile::remove(setupFile);
if(QMessageBox::critical(this, "Download Failed", "The download seems to be corrupted. Please try again!", "Try Again", "Cancel") == 0) if(QMessageBox::critical(this, tr("Download Failed"), tr("The download seems to be corrupted. Please try again!"), tr("Try Again"), tr("Cancel")) == 0)
{ {
continue; continue;
} }
@ -1764,7 +1774,7 @@ void MainWindow::installWMADecoderActionTriggered(bool checked)
QFile::remove(setupFile); QFile::remove(setupFile);
QApplication::restoreOverrideCursor(); QApplication::restoreOverrideCursor();
if(QMessageBox::information(this, "WMA Decoder", "The WMA File Decoder has been installed. Please restart LameXP now!", "Quit LameXP", "Postpone") == 0) if(QMessageBox::information(this, tr("WMA Decoder"), tr("The WMA File Decoder has been installed. Please restart LameXP now!"), tr("Quit LameXP"), tr("Postpone")) == 0)
{ {
QApplication::quit(); QApplication::quit();
} }

View File

@ -35,7 +35,6 @@ class FileListModel;
class AbstractEncoder; class AbstractEncoder;
class QMenu; class QMenu;
class DropBox; class DropBox;
class QTranslator;
class MainWindow: public QMainWindow, private Ui::MainWindow class MainWindow: public QMainWindow, private Ui::MainWindow
{ {
@ -104,6 +103,7 @@ protected:
void closeEvent(QCloseEvent *event); void closeEvent(QCloseEvent *event);
void resizeEvent(QResizeEvent *event); void resizeEvent(QResizeEvent *event);
bool eventFilter(QObject *obj, QEvent *event); bool eventFilter(QObject *obj, QEvent *event);
void retranslateUi(QMainWindow *MainWindow);
private: private:
void addFiles(const QStringList &files); void addFiles(const QStringList &files);
@ -117,6 +117,10 @@ private:
QActionGroup *m_languageActionGroup; QActionGroup *m_languageActionGroup;
QButtonGroup *m_encoderButtonGroup; QButtonGroup *m_encoderButtonGroup;
QButtonGroup *m_modeButtonGroup; QButtonGroup *m_modeButtonGroup;
QAction *m_showDetailsContextAction;
QAction *m_previewContextAction;
QAction *m_findFileContextAction;
QAction *m_showFolderContextAction;
WorkingBanner *m_banner; WorkingBanner *m_banner;
MessageHandlerThread *m_messageHandler; MessageHandlerThread *m_messageHandler;
QStringList *m_delayedFileList; QStringList *m_delayedFileList;
@ -128,5 +132,4 @@ private:
QMenu *m_sourceFilesContextMenu; QMenu *m_sourceFilesContextMenu;
QMenu *m_outputFolderContextMenu; QMenu *m_outputFolderContextMenu;
DropBox *m_dropBox; DropBox *m_dropBox;
QTranslator *m_currentTranslator;
}; };

View File

@ -39,6 +39,8 @@
#include <QTextCodec> #include <QTextCodec>
#include <QLibrary> #include <QLibrary>
#include <QRegExp> #include <QRegExp>
#include <QResource>
#include <QTranslator>
//LameXP includes //LameXP includes
#include "Resource.h" #include "Resource.h"
@ -118,6 +120,10 @@ static QString g_lamexp_temp_folder;
static QMap<QString, LockedFile*> g_lamexp_tool_registry; 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
static QMap<QString, QString> g_lamexp_translations;
static QTranslator *g_lamexp_currentTranslator = NULL;
//Shared memory //Shared memory
static const char *g_lamexp_sharedmem_uuid = "{21A68A42-6923-43bb-9CF6-64BF151942EE}"; static const char *g_lamexp_sharedmem_uuid = "{21A68A42-6923-43bb-9CF6-64BF151942EE}";
static QSharedMemory *g_lamexp_sharedmem_ptr = NULL; static QSharedMemory *g_lamexp_sharedmem_ptr = NULL;
@ -514,6 +520,17 @@ bool lamexp_init_qt(int argc, char* argv[])
} }
} }
//Init available translations
QStringList qmFiles = QDir(":/localization").entryList(QStringList() << "*.qm", QDir::Files, QDir::Name);
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())
{ {
@ -523,11 +540,6 @@ bool lamexp_init_qt(int argc, char* argv[])
} }
} }
//Load translation
//QTranslator *translator = new QTranslator();
//translator->load(":/localization/LameXP_DE.qm");
//application->installTranslator(translator);
//Done //Done
qt_initialized = true; qt_initialized = true;
return true; return true;
@ -771,48 +783,6 @@ bool lamexp_clean_folder(const QString folderPath)
return !tempFolder.exists(); return !tempFolder.exists();
} }
/*
* Finalization function (final clean-up)
*/
void lamexp_finalization(void)
{
//Free all tools
if(!g_lamexp_tool_registry.isEmpty())
{
QStringList keys = g_lamexp_tool_registry.keys();
for(int i = 0; i < keys.count(); i++)
{
LAMEXP_DELETE(g_lamexp_tool_registry[keys.at(i)]);
}
g_lamexp_tool_registry.clear();
g_lamexp_tool_versions.clear();
}
//Delete temporary files
if(!g_lamexp_temp_folder.isEmpty())
{
for(int i = 0; i < 100; i++)
{
if(lamexp_clean_folder(g_lamexp_temp_folder))
{
break;
}
Sleep(125);
}
g_lamexp_temp_folder.clear();
}
//Destroy Qt application object
QApplication *application = dynamic_cast<QApplication*>(QApplication::instance());
LAMEXP_DELETE(application);
//Detach from shared memory
if(g_lamexp_sharedmem_ptr) g_lamexp_sharedmem_ptr->detach();
LAMEXP_DELETE(g_lamexp_sharedmem_ptr);
LAMEXP_DELETE(g_lamexp_semaphore_read_ptr);
LAMEXP_DELETE(g_lamexp_semaphore_write_ptr);
}
/* /*
* Register tool * Register tool
*/ */
@ -896,6 +866,49 @@ const QString lamexp_version2string(const QString &pattern, unsigned int version
return result; return result;
} }
/*
* Get list of translations
*/
QStringList lamexp_query_translations(void)
{
return g_lamexp_translations.keys();
}
/*
* Install a new translator
*/
bool lamexp_install_translator(const QString &language)
{
bool success = false;
if(!g_lamexp_currentTranslator)
{
g_lamexp_currentTranslator = new QTranslator();
}
if(language.isEmpty())
{
QApplication::removeTranslator(g_lamexp_currentTranslator);
success = true;
}
else
{
QString qmFile = g_lamexp_translations.value(language, QString());
if(!qmFile.isEmpty())
{
QApplication::removeTranslator(g_lamexp_currentTranslator);
success = g_lamexp_currentTranslator->load(QString(":/localization/%1").arg(qmFile));
QApplication::installTranslator(g_lamexp_currentTranslator);
}
else
{
qWarning("Translation '%s' not available!", language.toLatin1().constData());
}
}
return success;
}
/* /*
* Locate known folder on local system * Locate known folder on local system
*/ */
@ -1020,7 +1033,7 @@ bool lamexp_remove_file(const QString &filename)
} }
/* /*
* Get number private bytes [debug only] * Get number of free bytes on disk
*/ */
__int64 lamexp_free_diskspace(const QString &path) __int64 lamexp_free_diskspace(const QString &path)
{ {
@ -1035,6 +1048,53 @@ __int64 lamexp_free_diskspace(const QString &path)
} }
} }
/*
* Finalization function (final clean-up)
*/
void lamexp_finalization(void)
{
//Free all tools
if(!g_lamexp_tool_registry.isEmpty())
{
QStringList keys = g_lamexp_tool_registry.keys();
for(int i = 0; i < keys.count(); i++)
{
LAMEXP_DELETE(g_lamexp_tool_registry[keys.at(i)]);
}
g_lamexp_tool_registry.clear();
g_lamexp_tool_versions.clear();
}
//Delete temporary files
if(!g_lamexp_temp_folder.isEmpty())
{
for(int i = 0; i < 100; i++)
{
if(lamexp_clean_folder(g_lamexp_temp_folder))
{
break;
}
Sleep(125);
}
g_lamexp_temp_folder.clear();
}
//Clear languages
lamexp_install_translator(QString());
LAMEXP_DELETE(g_lamexp_currentTranslator);
g_lamexp_translations.clear();
//Destroy Qt application object
QApplication *application = dynamic_cast<QApplication*>(QApplication::instance());
LAMEXP_DELETE(application);
//Detach from shared memory
if(g_lamexp_sharedmem_ptr) g_lamexp_sharedmem_ptr->detach();
LAMEXP_DELETE(g_lamexp_sharedmem_ptr);
LAMEXP_DELETE(g_lamexp_semaphore_read_ptr);
LAMEXP_DELETE(g_lamexp_semaphore_write_ptr);
}
/* /*
* Get number private bytes [debug only] * Get number private bytes [debug only]
*/ */

View File

@ -33,8 +33,9 @@
//Declarations //Declarations
class QString; class QString;
class LockedFile; class QStringList;
class QDate; class QDate;
class LockedFile;
enum QtMsgType; enum QtMsgType;
//Types definitions //Types definitions
@ -90,6 +91,8 @@ 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);
QStringList lamexp_query_translations(void);
bool lamexp_install_translator(const QString &language);
//Auxiliary functions //Auxiliary functions
bool lamexp_clean_folder(const QString folderPath); bool lamexp_clean_folder(const QString folderPath);

View File

@ -47,7 +47,7 @@ static const char *g_settingsId_soundsEnabled = "Flags/EnableSounds";
static const char *g_settingsId_neroAacNotificationsEnabled = "Flags/EnableNeroAacNotifications"; static const char *g_settingsId_neroAacNotificationsEnabled = "Flags/EnableNeroAacNotifications";
static const char *g_settingsId_wmaDecoderNotificationsEnabled = "Flags/EnableWmaDecoderNotifications"; static const char *g_settingsId_wmaDecoderNotificationsEnabled = "Flags/EnableWmaDecoderNotifications";
static const char *g_settingsId_dropBoxWidgetEnabled = "Flags/EnableDropBoxWidget"; static const char *g_settingsId_dropBoxWidgetEnabled = "Flags/EnableDropBoxWidget";
static const char *g_settingsId_currentLanguage = "Localization/Language";
//Macros //Macros
#define MAKE_OPTION1(OPT,DEF) \ #define MAKE_OPTION1(OPT,DEF) \
int SettingsModel::OPT(void) { return m_settings->value(g_settingsId_##OPT, DEF).toInt(); } \ int SettingsModel::OPT(void) { return m_settings->value(g_settingsId_##OPT, DEF).toInt(); } \
@ -134,3 +134,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());

View File

@ -78,6 +78,7 @@ public:
MAKE_OPTION_DEC3(neroAacNotificationsEnabled) MAKE_OPTION_DEC3(neroAacNotificationsEnabled)
MAKE_OPTION_DEC3(wmaDecoderNotificationsEnabled) MAKE_OPTION_DEC3(wmaDecoderNotificationsEnabled)
MAKE_OPTION_DEC3(dropBoxWidgetEnabled) MAKE_OPTION_DEC3(dropBoxWidgetEnabled)
MAKE_OPTION_DEC2(currentLanguage);
//Misc //Misc
void validate(void); void validate(void);