Improve Cue Sheet parser: Calculate duration of each track + make sure each track# isn't used multiple times + refactored error codes into an enum.

This commit is contained in:
LoRd_MuldeR 2011-05-14 15:54:04 +02:00
parent 3e7c2d59e8
commit 49dd3f0446
21 changed files with 1024 additions and 66 deletions

View File

@ -239,6 +239,95 @@
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
</context> </context>
<context>
<name>CueImportDialog</name>
<message>
<source>Import Cue Sheet</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>The following Cue Sheet will be split and imported into LameXP.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Loading Cue Sheet file, please be patient...</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>An unknown error has occured!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>The file could not be opened for reading!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>The file does not look like a valid Cue Sheet disc image file!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Could not find a supported audio track in the Cue Sheet!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Failed to load the Cue Sheet file:</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Cue Sheet Error</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>CueSheetImport</name>
<message>
<source>Import Cue Sheet</source>
<translation type="unfinished"></translation>
</message>
<message>
<source> Output Directory </source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Browse...</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Discard</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>CueSheetModel</name>
<message>
<source>No.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>File / Track</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Index</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>File %1</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Track %1</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Unknown Artist</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Unknown Title</source>
<translation type="unfinished"></translation>
</message>
</context>
<context> <context>
<name>DecoderRegistry</name> <name>DecoderRegistry</name>
<message> <message>
@ -1376,6 +1465,18 @@
<source>The LameXP shell integration has been re-enabled.</source> <source>The LameXP shell integration has been re-enabled.</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message>
<source>Import Cue Sheet</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Open Cue Sheet</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Cue Sheet File</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>MetaInfo</name> <name>MetaInfo</name>

View File

@ -239,6 +239,95 @@
<translation>Version</translation> <translation>Version</translation>
</message> </message>
</context> </context>
<context>
<name>CueImportDialog</name>
<message>
<source>Import Cue Sheet</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>The following Cue Sheet will be split and imported into LameXP.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Loading Cue Sheet file, please be patient...</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>An unknown error has occured!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>The file could not be opened for reading!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>The file does not look like a valid Cue Sheet disc image file!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Could not find a supported audio track in the Cue Sheet!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Failed to load the Cue Sheet file:</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Cue Sheet Error</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>CueSheetImport</name>
<message>
<source>Import Cue Sheet</source>
<translation type="unfinished"></translation>
</message>
<message>
<source> Output Directory </source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Browse...</source>
<translation type="unfinished">Durchsuchen...</translation>
</message>
<message>
<source>Discard</source>
<translation type="unfinished">Schließen</translation>
</message>
</context>
<context>
<name>CueSheetModel</name>
<message>
<source>No.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>File / Track</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Index</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>File %1</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Track %1</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Unknown Artist</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Unknown Title</source>
<translation type="unfinished"></translation>
</message>
</context>
<context> <context>
<name>DecoderRegistry</name> <name>DecoderRegistry</name>
<message> <message>
@ -1377,6 +1466,18 @@
<source>Don&apos;t Show Again</source> <source>Don&apos;t Show Again</source>
<translation>Nicht mehr anzeigen</translation> <translation>Nicht mehr anzeigen</translation>
</message> </message>
<message>
<source>Import Cue Sheet</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Open Cue Sheet</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Cue Sheet File</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>MetaInfo</name> <name>MetaInfo</name>

View File

@ -239,6 +239,95 @@
<translation>Versión</translation> <translation>Versión</translation>
</message> </message>
</context> </context>
<context>
<name>CueImportDialog</name>
<message>
<source>Import Cue Sheet</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>The following Cue Sheet will be split and imported into LameXP.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Loading Cue Sheet file, please be patient...</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>An unknown error has occured!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>The file could not be opened for reading!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>The file does not look like a valid Cue Sheet disc image file!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Could not find a supported audio track in the Cue Sheet!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Failed to load the Cue Sheet file:</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Cue Sheet Error</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>CueSheetImport</name>
<message>
<source>Import Cue Sheet</source>
<translation type="unfinished"></translation>
</message>
<message>
<source> Output Directory </source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Browse...</source>
<translation type="unfinished">Navegar...</translation>
</message>
<message>
<source>Discard</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>CueSheetModel</name>
<message>
<source>No.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>File / Track</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Index</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>File %1</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Track %1</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Unknown Artist</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Unknown Title</source>
<translation type="unfinished"></translation>
</message>
</context>
<context> <context>
<name>DecoderRegistry</name> <name>DecoderRegistry</name>
<message> <message>
@ -1376,6 +1465,18 @@
<source>Don&apos;t Show Again</source> <source>Don&apos;t Show Again</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message>
<source>Import Cue Sheet</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Open Cue Sheet</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Cue Sheet File</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>MetaInfo</name> <name>MetaInfo</name>

View File

@ -243,6 +243,95 @@
<translation>Version</translation> <translation>Version</translation>
</message> </message>
</context> </context>
<context>
<name>CueImportDialog</name>
<message>
<source>Import Cue Sheet</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>The following Cue Sheet will be split and imported into LameXP.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Loading Cue Sheet file, please be patient...</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>An unknown error has occured!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>The file could not be opened for reading!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>The file does not look like a valid Cue Sheet disc image file!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Could not find a supported audio track in the Cue Sheet!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Failed to load the Cue Sheet file:</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Cue Sheet Error</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>CueSheetImport</name>
<message>
<source>Import Cue Sheet</source>
<translation type="unfinished"></translation>
</message>
<message>
<source> Output Directory </source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Browse...</source>
<translation type="unfinished">Explorer...</translation>
</message>
<message>
<source>Discard</source>
<translation type="unfinished">Abandonner</translation>
</message>
</context>
<context>
<name>CueSheetModel</name>
<message>
<source>No.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>File / Track</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Index</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>File %1</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Track %1</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Unknown Artist</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Unknown Title</source>
<translation type="unfinished"></translation>
</message>
</context>
<context> <context>
<name>DecoderRegistry</name> <name>DecoderRegistry</name>
<message> <message>
@ -1386,6 +1475,18 @@ Ouvrir le dossier récursivement...</translation>
<source>Don&apos;t Show Again</source> <source>Don&apos;t Show Again</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message>
<source>Import Cue Sheet</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Open Cue Sheet</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Cue Sheet File</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>MetaInfo</name> <name>MetaInfo</name>

View File

@ -239,6 +239,95 @@
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
</context> </context>
<context>
<name>CueImportDialog</name>
<message>
<source>Import Cue Sheet</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>The following Cue Sheet will be split and imported into LameXP.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Loading Cue Sheet file, please be patient...</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>An unknown error has occured!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>The file could not be opened for reading!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>The file does not look like a valid Cue Sheet disc image file!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Could not find a supported audio track in the Cue Sheet!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Failed to load the Cue Sheet file:</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Cue Sheet Error</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>CueSheetImport</name>
<message>
<source>Import Cue Sheet</source>
<translation type="unfinished"></translation>
</message>
<message>
<source> Output Directory </source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Browse...</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Discard</source>
<translation type="unfinished">Annulla</translation>
</message>
</context>
<context>
<name>CueSheetModel</name>
<message>
<source>No.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>File / Track</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Index</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>File %1</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Track %1</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Unknown Artist</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Unknown Title</source>
<translation type="unfinished"></translation>
</message>
</context>
<context> <context>
<name>DecoderRegistry</name> <name>DecoderRegistry</name>
<message> <message>
@ -1377,6 +1466,18 @@
<source>Don&apos;t Show Again</source> <source>Don&apos;t Show Again</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message>
<source>Import Cue Sheet</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Open Cue Sheet</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Cue Sheet File</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>MetaInfo</name> <name>MetaInfo</name>

View File

@ -239,6 +239,95 @@
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
</context> </context>
<context>
<name>CueImportDialog</name>
<message>
<source>Import Cue Sheet</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>The following Cue Sheet will be split and imported into LameXP.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Loading Cue Sheet file, please be patient...</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>An unknown error has occured!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>The file could not be opened for reading!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>The file does not look like a valid Cue Sheet disc image file!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Could not find a supported audio track in the Cue Sheet!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Failed to load the Cue Sheet file:</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Cue Sheet Error</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>CueSheetImport</name>
<message>
<source>Import Cue Sheet</source>
<translation type="unfinished"></translation>
</message>
<message>
<source> Output Directory </source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Browse...</source>
<translation type="unfinished">...</translation>
</message>
<message>
<source>Discard</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>CueSheetModel</name>
<message>
<source>No.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>File / Track</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Index</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>File %1</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Track %1</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Unknown Artist</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Unknown Title</source>
<translation type="unfinished"></translation>
</message>
</context>
<context> <context>
<name>DecoderRegistry</name> <name>DecoderRegistry</name>
<message> <message>
@ -1376,6 +1465,18 @@
<source>Don&apos;t Show Again</source> <source>Don&apos;t Show Again</source>
<translation type="unfinished"> </translation> <translation type="unfinished"> </translation>
</message> </message>
<message>
<source>Import Cue Sheet</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Open Cue Sheet</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Cue Sheet File</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>MetaInfo</name> <name>MetaInfo</name>

View File

@ -239,6 +239,95 @@
<translation>Версия</translation> <translation>Версия</translation>
</message> </message>
</context> </context>
<context>
<name>CueImportDialog</name>
<message>
<source>Import Cue Sheet</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>The following Cue Sheet will be split and imported into LameXP.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Loading Cue Sheet file, please be patient...</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>An unknown error has occured!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>The file could not be opened for reading!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>The file does not look like a valid Cue Sheet disc image file!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Could not find a supported audio track in the Cue Sheet!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Failed to load the Cue Sheet file:</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Cue Sheet Error</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>CueSheetImport</name>
<message>
<source>Import Cue Sheet</source>
<translation type="unfinished"></translation>
</message>
<message>
<source> Output Directory </source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Browse...</source>
<translation type="unfinished">Выбрать...</translation>
</message>
<message>
<source>Discard</source>
<translation type="unfinished">Отменить</translation>
</message>
</context>
<context>
<name>CueSheetModel</name>
<message>
<source>No.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>File / Track</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Index</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>File %1</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Track %1</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Unknown Artist</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Unknown Title</source>
<translation type="unfinished"></translation>
</message>
</context>
<context> <context>
<name>DecoderRegistry</name> <name>DecoderRegistry</name>
<message> <message>
@ -1378,6 +1467,18 @@
<source>Don&apos;t Show Again</source> <source>Don&apos;t Show Again</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message>
<source>Import Cue Sheet</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Open Cue Sheet</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Cue Sheet File</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>MetaInfo</name> <name>MetaInfo</name>

View File

@ -239,6 +239,95 @@
<translation type="unfinished">Версія</translation> <translation type="unfinished">Версія</translation>
</message> </message>
</context> </context>
<context>
<name>CueImportDialog</name>
<message>
<source>Import Cue Sheet</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>The following Cue Sheet will be split and imported into LameXP.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Loading Cue Sheet file, please be patient...</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>An unknown error has occured!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>The file could not be opened for reading!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>The file does not look like a valid Cue Sheet disc image file!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Could not find a supported audio track in the Cue Sheet!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Failed to load the Cue Sheet file:</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Cue Sheet Error</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>CueSheetImport</name>
<message>
<source>Import Cue Sheet</source>
<translation type="unfinished"></translation>
</message>
<message>
<source> Output Directory </source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Browse...</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Discard</source>
<translation type="unfinished">Відмінити</translation>
</message>
</context>
<context>
<name>CueSheetModel</name>
<message>
<source>No.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>File / Track</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Index</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>File %1</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Track %1</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Unknown Artist</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Unknown Title</source>
<translation type="unfinished"></translation>
</message>
</context>
<context> <context>
<name>DecoderRegistry</name> <name>DecoderRegistry</name>
<message> <message>
@ -1376,6 +1465,18 @@
<source>Don&apos;t Show Again</source> <source>Don&apos;t Show Again</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message>
<source>Import Cue Sheet</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Open Cue Sheet</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Cue Sheet File</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>MetaInfo</name> <name>MetaInfo</name>

View File

@ -219,6 +219,9 @@
<iconset resource="../res/Icons.qrc"> <iconset resource="../res/Icons.qrc">
<normaloff>:/icons/folder_explore.png</normaloff>:/icons/folder_explore.png</iconset> <normaloff>:/icons/folder_explore.png</normaloff>:/icons/folder_explore.png</iconset>
</property> </property>
<property name="autoDefault">
<bool>false</bool>
</property>
</widget> </widget>
</item> </item>
</layout> </layout>
@ -272,9 +275,6 @@
<height>16</height> <height>16</height>
</size> </size>
</property> </property>
<property name="autoDefault">
<bool>false</bool>
</property>
</widget> </widget>
</item> </item>
<item> <item>
@ -312,8 +312,10 @@
</layout> </layout>
</widget> </widget>
<tabstops> <tabstops>
<tabstop>abortButton</tabstop>
<tabstop>imprtButton</tabstop> <tabstop>imprtButton</tabstop>
<tabstop>abortButton</tabstop>
<tabstop>editOutputDir</tabstop>
<tabstop>browseButton</tabstop>
<tabstop>treeView</tabstop> <tabstop>treeView</tabstop>
</tabstops> </tabstops>
<resources> <resources>
@ -347,6 +349,8 @@
<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"/>
</resources> </resources>
<connections> <connections>
<connection> <connection>
@ -356,8 +360,8 @@
<slot>close()</slot> <slot>close()</slot>
<hints> <hints>
<hint type="sourcelabel"> <hint type="sourcelabel">
<x>609</x> <x>688</x>
<y>408</y> <y>451</y>
</hint> </hint>
<hint type="destinationlabel"> <hint type="destinationlabel">
<x>310</x> <x>310</x>

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -30,7 +30,7 @@
#define VER_LAMEXP_MINOR_LO 2 #define VER_LAMEXP_MINOR_LO 2
#define VER_LAMEXP_TYPE Alpha #define VER_LAMEXP_TYPE Alpha
#define VER_LAMEXP_PATCH 14 #define VER_LAMEXP_PATCH 14
#define VER_LAMEXP_BUILD 509 #define VER_LAMEXP_BUILD 513
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
// Tools versions // Tools versions

View File

@ -63,7 +63,7 @@ CueImportDialog::CueImportDialog(QWidget *parent)
//Enable up/down button //Enable up/down button
connect(imprtButton, SIGNAL(clicked()), this, SLOT(importButtonClicked())); connect(imprtButton, SIGNAL(clicked()), this, SLOT(importButtonClicked()));
connect(browseButton, SIGNAL(clicked()), this, SLOT(importButtonClicked())); connect(browseButton, SIGNAL(clicked()), this, SLOT(browseButtonClicked()));
//Translate //Translate
labelHeaderText->setText(QString("<b>%1</b><br>%2").arg(tr("Import Cue Sheet"), tr("The following Cue Sheet will be split and imported into LameXP."))); labelHeaderText->setText(QString("<b>%1</b><br>%2").arg(tr("Import Cue Sheet"), tr("The following Cue Sheet will be split and imported into LameXP.")));
@ -92,38 +92,66 @@ int CueImportDialog::exec(const QString &cueFile)
{ {
WorkingBanner *progress = new WorkingBanner(dynamic_cast<QWidget*>(parent())); WorkingBanner *progress = new WorkingBanner(dynamic_cast<QWidget*>(parent()));
progress->show(tr("Loading Cue Sheet file, please be patient...")); progress->show(tr("Loading Cue Sheet file, please be patient..."));
int iResult = m_model->loadCueSheet(cueFile, QApplication::instance());
progress->close();
LAMEXP_DELETE(progress);
if(iResult) QFileInfo cueFileInfo(cueFile);
m_outputDir = QFileInfo(cueFile).canonicalPath();
if(!cueFileInfo.exists() || !cueFileInfo.isFile() || m_outputDir.isEmpty())
{
QString text = QString("<nobr>%1</nobr><br><nobr>%2</nobr><br><br><nobr>%3</nobr>").arg(tr("Failed to load the Cue Sheet file:"), QDir::toNativeSeparators(cueFile), tr("The specified file could not be found!")).replace("-", "&minus;");
QMessageBox::warning(progress, tr("Cue Sheet Error"), text);
progress->close();
LAMEXP_DELETE(progress);
return CueSheetModel::ErrorIOFailure;
}
int iResult = m_model->loadCueSheet(cueFile, QApplication::instance());
if(iResult != CueSheetModel::ErrorSuccess)
{ {
QString errorMsg = tr("An unknown error has occured!"); QString errorMsg = tr("An unknown error has occured!");
switch(iResult) switch(iResult)
{ {
case 1: case CueSheetModel::ErrorIOFailure:
errorMsg = tr("The file could not be opened for reading!"); errorMsg = tr("The file could not be opened for reading. Make sure you have the required rights!");
break; break;
case 2: case CueSheetModel::ErrorBadFile:
errorMsg = tr("The file does not look like a valid Cue Sheet disc image file!"); errorMsg = tr("The provided file does not look like a valid Cue Sheet disc image file!");
break; break;
case 3: case CueSheetModel::ErrorUnsupported:
errorMsg = tr("Could not find a supported audio track in the Cue Sheet!"); errorMsg = QString("%1<br>%2").arg(tr("Could not find any supported audio track in the Cue Sheet image!"), tr("Note that LameXP can not handle \"binary\" Cue Sheet images."));
break;
case CueSheetModel::ErrorInconsistent:
errorMsg = tr("The selected Cue Sheet file contains inconsistent information. Take care!");
break; break;
} }
QString text = QString("<nobr>%1</nobr><br><nobr>%2</nobr><br><br><nobr>%3</nobr>").arg(tr("Failed to load the Cue Sheet file:"), cueFile, errorMsg).replace("-", "&minus;"); QString text = QString("<nobr>%1</nobr><br><nobr>%2</nobr><br><br><nobr>%3</nobr>").arg(tr("Failed to load the Cue Sheet file:"), QDir::toNativeSeparators(cueFile), errorMsg).replace("-", "&minus;");
QMessageBox::warning(dynamic_cast<QWidget*>(parent()), tr("Cue Sheet Error"), text); QMessageBox::warning(progress, tr("Cue Sheet Error"), text);
progress->close();
LAMEXP_DELETE(progress);
return iResult; return iResult;
} }
progress->close();
LAMEXP_DELETE(progress);
return QDialog::exec(); return QDialog::exec();
} }
void CueImportDialog::modelChanged(void) void CueImportDialog::modelChanged(void)
{ {
treeView->expandAll(); treeView->expandAll();
editOutputDir->setText(QDir::toNativeSeparators(m_outputDir));
}
void CueImportDialog::browseButtonClicked(void)
{
QString newOutDir = QFileDialog::getExistingDirectory(this, tr("Choose Output Directory"));
if(!newOutDir.isEmpty())
{
m_outputDir = newOutDir;
modelChanged();
}
} }
void CueImportDialog::importButtonClicked(void) void CueImportDialog::importButtonClicked(void)

View File

@ -42,9 +42,11 @@ protected:
void CueImportDialog::showEvent(QShowEvent *event); void CueImportDialog::showEvent(QShowEvent *event);
private slots: private slots:
void browseButtonClicked(void);
void importButtonClicked(void); void importButtonClicked(void);
void modelChanged(void); void modelChanged(void);
private: private:
CueSheetModel *m_model; CueSheetModel *m_model;
QString m_outputDir;
}; };

View File

@ -24,9 +24,9 @@
#include "Genres.h" #include "Genres.h"
#include <QApplication> #include <QApplication>
#include <QMessageBox> #include <QDir>
#include <QInputDialog>
#include <QFileInfo> #include <QFileInfo>
#include <QFont>
#include <float.h> #include <float.h>
#include <limits> #include <limits>
@ -39,6 +39,7 @@ class CueSheetItem
{ {
public: public:
virtual const char* type(void) = 0; virtual const char* type(void) = 0;
virtual bool isValid(void) { return false; }
}; };
class CueSheetTrack : public CueSheetItem class CueSheetTrack : public CueSheetItem
@ -50,20 +51,24 @@ public:
m_trackNo(trackNo) m_trackNo(trackNo)
{ {
m_startIndex = std::numeric_limits<double>::quiet_NaN(); m_startIndex = std::numeric_limits<double>::quiet_NaN();
m_duration = std::numeric_limits<double>::infinity();
} }
int trackNo(void) { return m_trackNo; } int trackNo(void) { return m_trackNo; }
double startIndex(void) { return m_startIndex; } double startIndex(void) { return m_startIndex; }
double duration(void) { return m_duration; }
QString title(void) { return m_title; } QString title(void) { return m_title; }
QString performer(void) { return m_performer; } QString performer(void) { return m_performer; }
CueSheetFile *parent(void) { return m_parent; } CueSheetFile *parent(void) { return m_parent; }
void setStartIndex(double startIndex) { m_startIndex = startIndex; } void setStartIndex(double startIndex) { m_startIndex = startIndex; }
void setTitle(const QString &title) { m_title = title; } void setDuration(double duration) { m_duration = duration; }
void setPerformer(const QString &performer) { m_performer = performer; } void setTitle(const QString &title, bool update = false) { if(!update || (m_title.isEmpty() && !title.isEmpty())) m_title = title; }
bool isValid(void) { return !(_isnan(m_startIndex) || (m_trackNo < 0)); } void setPerformer(const QString &performer, bool update = false) { if(!update || (m_performer.isEmpty() && !performer.isEmpty())) m_performer = performer; }
virtual bool isValid(void) { return !(_isnan(m_startIndex) || (m_trackNo < 0)); }
virtual const char* type(void) { return "CueSheetTrack"; } virtual const char* type(void) { return "CueSheetTrack"; }
private: private:
int m_trackNo; int m_trackNo;
double m_startIndex; double m_startIndex;
double m_duration;
QString m_title; QString m_title;
QString m_performer; QString m_performer;
CueSheetFile *m_parent; CueSheetFile *m_parent;
@ -79,6 +84,7 @@ public:
void clearTracks(void) { while(!m_tracks.isEmpty()) delete m_tracks.takeLast(); } void clearTracks(void) { while(!m_tracks.isEmpty()) delete m_tracks.takeLast(); }
CueSheetTrack *track(int index) { return m_tracks.at(index); } CueSheetTrack *track(int index) { return m_tracks.at(index); }
int trackCount(void) { return m_tracks.count(); } int trackCount(void) { return m_tracks.count(); }
virtual bool isValid(void) { return m_tracks.count() > 0; }
virtual const char* type(void) { return "CueSheetFile"; } virtual const char* type(void) { return "CueSheetFile"; }
private: private:
const QString m_fileName; const QString m_fileName;
@ -134,7 +140,7 @@ QModelIndex CueSheetModel::index(int row, int column, const QModelIndex &parent)
int CueSheetModel::columnCount(const QModelIndex &parent) const int CueSheetModel::columnCount(const QModelIndex &parent) const
{ {
return 3; return 4;
} }
int CueSheetModel::rowCount(const QModelIndex &parent) const int CueSheetModel::rowCount(const QModelIndex &parent) const
@ -182,6 +188,9 @@ QVariant CueSheetModel::headerData (int section, Qt::Orientation orientation, in
case 2: case 2:
return tr("Index"); return tr("Index");
break; break;
case 3:
return tr("Duration");
break;
default: default:
return QVariant(); return QVariant();
break; break;
@ -207,7 +216,7 @@ QVariant CueSheetModel::data(const QModelIndex &index, int role) const
return tr("File %1").arg(QString().sprintf("%02d", index.row() + 1)).append(" "); return tr("File %1").arg(QString().sprintf("%02d", index.row() + 1)).append(" ");
break; break;
case 1: case 1:
return QString("[%1]").arg(QFileInfo(filePtr->fileName()).fileName()); return QFileInfo(filePtr->fileName()).fileName();
break; break;
default: default:
return QVariant(); return QVariant();
@ -242,12 +251,48 @@ QVariant CueSheetModel::data(const QModelIndex &index, int role) const
case 2: case 2:
return indexToString(trackPtr->startIndex()); return indexToString(trackPtr->startIndex());
break; break;
case 3:
return indexToString(trackPtr->duration());
break;
default: default:
return QVariant(); return QVariant();
break; break;
} }
} }
} }
else if(role == Qt::FontRole)
{
QFont font("Monospace");
font.setStyleHint(QFont::TypeWriter);
if((index.column() == 1))
{
CueSheetItem *item = reinterpret_cast<CueSheetItem*>(index.internalPointer());
font.setBold(dynamic_cast<CueSheetFile*>(item) != NULL);
}
return font;
}
else if(role == Qt::ForegroundRole)
{
if((index.column() == 1))
{
CueSheetItem *item = reinterpret_cast<CueSheetItem*>(index.internalPointer());
if(CueSheetFile *filePtr = dynamic_cast<CueSheetFile*>(item))
{
return QFileInfo(filePtr->fileName()).exists() ? QColor("mediumblue") : QColor("darkred");
}
}
else if((index.column() == 3))
{
CueSheetItem *item = reinterpret_cast<CueSheetItem*>(index.internalPointer());
if(CueSheetTrack *trackPtr = dynamic_cast<CueSheetTrack*>(item))
{
if(trackPtr->duration() == std::numeric_limits<double>::infinity())
{
return QColor("dimgrey");
}
}
}
}
return QVariant(); return QVariant();
} }
@ -268,19 +313,19 @@ int CueSheetModel::loadCueSheet(const QString &cueFileName, QCoreApplication *ap
QFile cueFile(cueFileName); QFile cueFile(cueFileName);
if(!cueFile.open(QIODevice::ReadOnly)) if(!cueFile.open(QIODevice::ReadOnly))
{ {
return 1; return ErrorIOFailure;
} }
clearData(); clearData();
beginResetModel(); beginResetModel();
int iResult = parseCueFile(cueFile, application); int iResult = parseCueFile(cueFile, QDir(QFileInfo(cueFile).canonicalPath()), application);
endResetModel(); endResetModel();
return iResult; return iResult;
} }
int CueSheetModel::parseCueFile(QFile &cueFile, QCoreApplication *application) int CueSheetModel::parseCueFile(QFile &cueFile, const QDir &baseDir, QCoreApplication *application)
{ {
cueFile.seek(0); cueFile.seek(0);
qDebug("\n[Cue Sheet Import]"); qDebug("\n[Cue Sheet Import]");
@ -319,7 +364,7 @@ int CueSheetModel::parseCueFile(QFile &cueFile, QCoreApplication *application)
if(application) if(application)
{ {
application->processEvents(); application->processEvents();
Sleep(25); Sleep(10);
} }
QByteArray lineData = cueFile.readLine(); QByteArray lineData = cueFile.readLine();
@ -341,14 +386,8 @@ int CueSheetModel::parseCueFile(QFile &cueFile, QCoreApplication *application)
{ {
if(currentTrack->isValid()) if(currentTrack->isValid())
{ {
if(currentTrack->title().isEmpty() && !albumTitle.isEmpty()) currentTrack->setTitle(albumTitle, true);
{ currentTrack->setPerformer(albumPerformer, true);
currentTrack->setTitle(albumTitle);
}
if(currentTrack->performer().isEmpty() && !albumPerformer.isEmpty())
{
currentTrack->setPerformer(albumPerformer);
}
currentFile->addTrack(currentTrack); currentFile->addTrack(currentTrack);
currentTrack = NULL; currentTrack = NULL;
} }
@ -357,7 +396,7 @@ int CueSheetModel::parseCueFile(QFile &cueFile, QCoreApplication *application)
LAMEXP_DELETE(currentTrack); LAMEXP_DELETE(currentTrack);
} }
} }
if(currentFile->trackCount() > 0) if(currentFile->isValid())
{ {
m_files.append(currentFile); m_files.append(currentFile);
currentFile = NULL; currentFile = NULL;
@ -373,7 +412,8 @@ int CueSheetModel::parseCueFile(QFile &cueFile, QCoreApplication *application)
} }
if(!rxFile.cap(2).compare("WAVE", Qt::CaseInsensitive) || !rxFile.cap(2).compare("MP3", Qt::CaseInsensitive) || !rxFile.cap(2).compare("AIFF", Qt::CaseInsensitive)) if(!rxFile.cap(2).compare("WAVE", Qt::CaseInsensitive) || !rxFile.cap(2).compare("MP3", Qt::CaseInsensitive) || !rxFile.cap(2).compare("AIFF", Qt::CaseInsensitive))
{ {
currentFile = new CueSheetFile(rxFile.cap(1)); currentFile = new CueSheetFile(baseDir.absoluteFilePath(rxFile.cap(1)));
qDebug("File path: <%s>", currentFile->fileName().toUtf8().constData());
} }
else else
{ {
@ -396,14 +436,8 @@ int CueSheetModel::parseCueFile(QFile &cueFile, QCoreApplication *application)
{ {
if(currentTrack->isValid()) if(currentTrack->isValid())
{ {
if(currentTrack->title().isEmpty() && !albumTitle.isEmpty()) currentTrack->setTitle(albumTitle, true);
{ currentTrack->setPerformer(albumPerformer, true);
currentTrack->setTitle(albumTitle);
}
if(currentTrack->performer().isEmpty() && !albumPerformer.isEmpty())
{
currentTrack->setPerformer(albumPerformer);
}
currentFile->addTrack(currentTrack); currentFile->addTrack(currentTrack);
currentTrack = NULL; currentTrack = NULL;
} }
@ -476,21 +510,15 @@ int CueSheetModel::parseCueFile(QFile &cueFile, QCoreApplication *application)
} }
} }
//Finally append the very last track/file //Append the very last track/file that is still pending
if(currentFile) if(currentFile)
{ {
if(currentTrack) if(currentTrack)
{ {
if(currentTrack->isValid()) if(currentTrack->isValid())
{ {
if(currentTrack->title().isEmpty() && !albumTitle.isEmpty()) currentTrack->setTitle(albumTitle, true);
{ currentTrack->setPerformer(albumPerformer, true);
currentTrack->setTitle(albumTitle);
}
if(currentTrack->performer().isEmpty() && !albumPerformer.isEmpty())
{
currentTrack->setPerformer(albumPerformer);
}
currentFile->addTrack(currentTrack); currentFile->addTrack(currentTrack);
currentTrack = NULL; currentTrack = NULL;
} }
@ -499,7 +527,7 @@ int CueSheetModel::parseCueFile(QFile &cueFile, QCoreApplication *application)
LAMEXP_DELETE(currentTrack); LAMEXP_DELETE(currentTrack);
} }
} }
if(currentFile->trackCount() > 0) if(currentFile->isValid())
{ {
m_files.append(currentFile); m_files.append(currentFile);
currentFile = NULL; currentFile = NULL;
@ -510,7 +538,72 @@ int CueSheetModel::parseCueFile(QFile &cueFile, QCoreApplication *application)
} }
} }
return (m_files.count() > 0) ? 0 : (bUnsupportedTrack ? 3 : 2); //Finally calculate duration of each track
int nFiles = m_files.count();
for(int i = 0; i < nFiles; i++)
{
if(application)
{
application->processEvents();
Sleep(10);
}
CueSheetFile *currentFile = m_files.at(i);
int nTracks = currentFile->trackCount();
if(nTracks > 1)
{
for(int j = 1; j < nTracks; j++)
{
CueSheetTrack *currentTrack = currentFile->track(j);
CueSheetTrack *previousTrack = currentFile->track(j-1);
double duration = currentTrack->startIndex() - previousTrack->startIndex();
previousTrack->setDuration(max(0.0, duration));
}
}
}
//Sanity check of track numbers
if(nFiles > 0)
{
bool trackNo[100];
for(int i = 0; i < 100; i++)
{
trackNo[i] = false;
}
for(int i = 0; i < nFiles; i++)
{
if(application)
{
application->processEvents();
Sleep(10);
}
CueSheetFile *currentFile = m_files.at(i);
int nTracks = currentFile->trackCount();
if(nTracks > 1)
{
for(int j = 1; j < nTracks; j++)
{
int currentTrackNo = currentFile->track(j)->trackNo();
if(currentTrackNo > 99)
{
qWarning("Track #%02d is invalid (maximum is 99), Cue Sheet is inconsistent!", currentTrackNo);
return ErrorInconsistent;
}
if(trackNo[currentTrackNo])
{
qWarning("Track #%02d exists multiple times, Cue Sheet is inconsistent!", currentTrackNo);
return ErrorInconsistent;
}
trackNo[currentTrackNo] = true;
}
}
}
return ErrorSuccess;
}
else
{
return bUnsupportedTrack ? ErrorUnsupported : ErrorBadFile;
}
} }
double CueSheetModel::parseTimeIndex(const QString &index) double CueSheetModel::parseTimeIndex(const QString &index)
@ -538,10 +631,21 @@ double CueSheetModel::parseTimeIndex(const QString &index)
QString CueSheetModel::indexToString(const double index) const QString CueSheetModel::indexToString(const double index) const
{ {
int temp = static_cast<int>(index * 100.0); if(index == std::numeric_limits<double>::quiet_NaN())
{
return QString("<-NaN!->");
}
else if(index == std::numeric_limits<double>::infinity() || index < 0.0)
{
return QString("??:??.??");
}
else
{
int temp = static_cast<int>(index * 100.0);
int msec = temp % 100; int msec = temp % 100;
int secs = temp / 100; int secs = temp / 100;
return QString().sprintf("%02d:%02d.%02d", (secs / 60), (secs % 60), msec); return QString().sprintf("%02d:%02d.%02d", min(99, secs / 60), min(99, secs % 60), min(99, msec));
}
} }

View File

@ -27,6 +27,7 @@
class CueSheetFile; class CueSheetFile;
class QApplication; class QApplication;
class QDir;
class CueSheetModel : public QAbstractItemModel class CueSheetModel : public QAbstractItemModel
{ {
@ -36,6 +37,17 @@ public:
CueSheetModel(); CueSheetModel();
~CueSheetModel(void); ~CueSheetModel(void);
//Error codes
enum ErrorCode
{
ErrorSuccess = 0,
ErrorIOFailure = 1,
ErrorBadFile = 2,
ErrorUnsupported = 3,
ErrorInconsistent = 4,
ErrorUnknown = 9
};
//Model functions //Model functions
QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const; QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const;
int columnCount(const QModelIndex &parent = QModelIndex()) const; int columnCount(const QModelIndex &parent = QModelIndex()) const;
@ -49,7 +61,7 @@ public:
int loadCueSheet(const QString &cueFile, QCoreApplication *application = NULL); int loadCueSheet(const QString &cueFile, QCoreApplication *application = NULL);
private: private:
int parseCueFile(QFile &cueFile, QCoreApplication *application); int parseCueFile(QFile &cueFile, const QDir &baseDir, QCoreApplication *application);
double parseTimeIndex(const QString &index); double parseTimeIndex(const QString &index);
QString indexToString(const double index) const; QString indexToString(const double index) const;
QList<CueSheetFile*> m_files; QList<CueSheetFile*> m_files;