Added support for importing Meta tags from a CSV files.

This commit is contained in:
LoRd_MuldeR 2012-01-04 21:10:33 +01:00
parent 8e65917d9c
commit f857054dda
28 changed files with 1602 additions and 391 deletions

View File

@ -20,6 +20,7 @@ a:visited { color: #0000EE; }
<li>Added support for the QAAC Encoder, requires QuickTime v7.7.1 or newer (see <a href="FAQ.html#71a113b0" target="_blank">FAQ doc</a> for details)
<li>Added Chinese and Taiwanese translations, thanks to 456Vv &lt;123@456vv.com&gt;
<li>Added experimental support for dcaenc, created by Alexander E. Patrakov &lt;patrakov@gmail.com&gt;
<li>Added CSV export/import for Meta tags (see context-menu on the "Source Files" tab)
<li>Updated Qt runtime libraries to v4.8.0 (2011-12-15), compiled with MSVC 10.0
<li>Updated LAME encoder to v3.99.2 Final (2011-11-18), compiled with ICL 12.1.7 and MSVC 10.0 (<a href="http://lame.cvs.sourceforge.net/viewvc/lame/lame/doc/html/history.html?revision=1.134" target="_blank">details</a>)
<li>Updated MediaInfo to v0.7.52 (2011-12-19), compiled with ICL 12.1.6 and MSVC 10.0

File diff suppressed because it is too large Load Diff

View File

@ -536,6 +536,22 @@
<source>Full Path</source>
<translation>Dateipfad</translation>
</message>
<message>
<source>(System Default)</source>
<translation>(Systemstandard)</translation>
</message>
<message>
<source>Select ANSI Codepage for CSV file:</source>
<translation>ANSI Codepage für CSV Datei auswählen:</translation>
</message>
<message>
<source>OK</source>
<translation>OK</translation>
</message>
<message>
<source>Cancel</source>
<translation>Abbrechen</translation>
</message>
</context>
<context>
<name>LogViewDialog</name>
@ -1734,6 +1750,70 @@
<source>DCA Enc</source>
<translation></translation>
</message>
<message>
<source>Export Meta Tags to CSV File</source>
<translation>Metatags als CSV-Datei exportieren</translation>
</message>
<message>
<source>Import Meta Tags from CSV File</source>
<translation>Metatags aus CSV-Datei importieren</translation>
</message>
<message>
<source>Save CSV file</source>
<translation>CSV-Datei speichern</translation>
</message>
<message>
<source>CSV File</source>
<translation>CSV Datei</translation>
</message>
<message>
<source>CSV Export</source>
<translation>CSV Export</translation>
</message>
<message>
<source>Sorry, there are no meta tags that can be exported!</source>
<translation>Keine Metatags gefunden, die exportiert werden können!</translation>
</message>
<message>
<source>Sorry, failed to open CSV file for writing!</source>
<translation>Die CSV-Datei konnte nicht zum Schreiben geöffnet werden!</translation>
</message>
<message>
<source>Sorry, failed to write to the CSV file!</source>
<translation>Beim Schreiben der CSV-Datei ist ein Fehler aufgetreten!</translation>
</message>
<message>
<source>The CSV files was created successfully!</source>
<translation>Die CSV-Datei wurde erfolgreich erzeugt!</translation>
</message>
<message>
<source>Open CSV file</source>
<translation>CSV-Datei öffnen</translation>
</message>
<message>
<source>Sorry, failed to open CSV file for reading!</source>
<translation>Die CSV-Datei konnte nicht zum Lesen geöffnet werden!</translation>
</message>
<message>
<source>Sorry, failed to read from the CSV file!</source>
<translation>Beim Lesen der CSV-Datei ist ein Fehler aufgetreten!</translation>
</message>
<message>
<source>Sorry, the CSV file does not contain any known fields!</source>
<translation>Die CSV-Datei enthält keine unterstützten Datenfelder!</translation>
</message>
<message>
<source>CSV file is incomplete. Not all files were updated!</source>
<translation>Die CSV-Datei ist unvollständig. Nicht alle Dateien wurden aktualisiert!</translation>
</message>
<message>
<source>The CSV files was imported successfully!</source>
<translation>Die CSV-Datei wurde erfolgreich importiert!</translation>
</message>
<message>
<source>CSV Import</source>
<translation>CSV Import</translation>
</message>
</context>
<context>
<name>MetaInfo</name>

View File

@ -535,6 +535,22 @@
<source>Full Path</source>
<translation>Ruta completa</translation>
</message>
<message>
<source>(System Default)</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Select ANSI Codepage for CSV file:</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>OK</source>
<translation type="unfinished">Aceptar</translation>
</message>
<message>
<source>Cancel</source>
<translation type="unfinished">Cancelar</translation>
</message>
</context>
<context>
<name>LogViewDialog</name>
@ -1733,6 +1749,70 @@
<source>DCA Enc</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Export Meta Tags to CSV File</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Import Meta Tags from CSV File</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Save CSV file</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>CSV File</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>CSV Export</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Sorry, there are no meta tags that can be exported!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Sorry, failed to open CSV file for writing!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Sorry, failed to write to the CSV file!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>The CSV files was created successfully!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Open CSV file</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Sorry, failed to open CSV file for reading!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Sorry, failed to read from the CSV file!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Sorry, the CSV file does not contain any known fields!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>CSV file is incomplete. Not all files were updated!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>The CSV files was imported successfully!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>CSV Import</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>MetaInfo</name>

View File

@ -539,6 +539,22 @@
<source>Full Path</source>
<translation>Chemin complet</translation>
</message>
<message>
<source>(System Default)</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Select ANSI Codepage for CSV file:</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>OK</source>
<translation type="unfinished">OK</translation>
</message>
<message>
<source>Cancel</source>
<translation type="unfinished">Annuler</translation>
</message>
</context>
<context>
<name>LogViewDialog</name>
@ -1743,6 +1759,70 @@ Ouvrir le dossier récursivement...</translation>
<source>DCA Enc</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Export Meta Tags to CSV File</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Import Meta Tags from CSV File</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Save CSV file</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>CSV File</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>CSV Export</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Sorry, there are no meta tags that can be exported!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Sorry, failed to open CSV file for writing!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Sorry, failed to write to the CSV file!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>The CSV files was created successfully!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Open CSV file</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Sorry, failed to open CSV file for reading!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Sorry, failed to read from the CSV file!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Sorry, the CSV file does not contain any known fields!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>CSV file is incomplete. Not all files were updated!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>The CSV files was imported successfully!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>CSV Import</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>MetaInfo</name>

View File

@ -536,6 +536,22 @@
<source>Full Path</source>
<translation>Percorso</translation>
</message>
<message>
<source>(System Default)</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Select ANSI Codepage for CSV file:</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>OK</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Cancel</source>
<translation type="unfinished">Cancella</translation>
</message>
</context>
<context>
<name>LogViewDialog</name>
@ -1734,6 +1750,70 @@
<source>DCA Enc</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Export Meta Tags to CSV File</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Import Meta Tags from CSV File</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Save CSV file</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>CSV File</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>CSV Export</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Sorry, there are no meta tags that can be exported!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Sorry, failed to open CSV file for writing!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Sorry, failed to write to the CSV file!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>The CSV files was created successfully!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Open CSV file</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Sorry, failed to open CSV file for reading!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Sorry, failed to read from the CSV file!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Sorry, the CSV file does not contain any known fields!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>CSV file is incomplete. Not all files were updated!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>The CSV files was imported successfully!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>CSV Import</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>MetaInfo</name>

View File

@ -535,6 +535,22 @@
<source>Full Path</source>
<translation type="unfinished"> </translation>
</message>
<message>
<source>(System Default)</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Select ANSI Codepage for CSV file:</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>OK</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Cancel</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>LogViewDialog</name>
@ -1733,6 +1749,70 @@
<source>DCA Enc</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Export Meta Tags to CSV File</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Import Meta Tags from CSV File</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Save CSV file</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>CSV File</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>CSV Export</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Sorry, there are no meta tags that can be exported!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Sorry, failed to open CSV file for writing!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Sorry, failed to write to the CSV file!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>The CSV files was created successfully!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Open CSV file</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Sorry, failed to open CSV file for reading!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Sorry, failed to read from the CSV file!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Sorry, the CSV file does not contain any known fields!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>CSV file is incomplete. Not all files were updated!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>The CSV files was imported successfully!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>CSV Import</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>MetaInfo</name>

File diff suppressed because it is too large Load Diff

View File

@ -538,6 +538,22 @@
<source>Full Path</source>
<translation>Полный путь</translation>
</message>
<message>
<source>(System Default)</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Select ANSI Codepage for CSV file:</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>OK</source>
<translation type="unfinished">ОК</translation>
</message>
<message>
<source>Cancel</source>
<translation type="unfinished">Отмена</translation>
</message>
</context>
<context>
<name>LogViewDialog</name>
@ -1739,6 +1755,70 @@
<source>DCA Enc</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Export Meta Tags to CSV File</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Import Meta Tags from CSV File</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Save CSV file</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>CSV File</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>CSV Export</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Sorry, there are no meta tags that can be exported!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Sorry, failed to open CSV file for writing!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Sorry, failed to write to the CSV file!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>The CSV files was created successfully!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Open CSV file</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Sorry, failed to open CSV file for reading!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Sorry, failed to read from the CSV file!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Sorry, the CSV file does not contain any known fields!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>CSV file is incomplete. Not all files were updated!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>The CSV files was imported successfully!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>CSV Import</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>MetaInfo</name>

View File

@ -535,6 +535,22 @@
<source>Full Path</source>
<translation></translation>
</message>
<message>
<source>(System Default)</source>
<translation type="unfinished">()</translation>
</message>
<message>
<source>Select ANSI Codepage for CSV file:</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>OK</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Cancel</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>LogViewDialog</name>
@ -1733,6 +1749,70 @@
<source>DCA Enc</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Export Meta Tags to CSV File</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Import Meta Tags from CSV File</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Save CSV file</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>CSV File</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>CSV Export</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Sorry, there are no meta tags that can be exported!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Sorry, failed to open CSV file for writing!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Sorry, failed to write to the CSV file!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>The CSV files was created successfully!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Open CSV file</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Sorry, failed to open CSV file for reading!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Sorry, failed to read from the CSV file!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Sorry, the CSV file does not contain any known fields!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>CSV file is incomplete. Not all files were updated!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>The CSV files was imported successfully!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>CSV Import</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>MetaInfo</name>

View File

@ -536,6 +536,22 @@
<source>Full Path</source>
<translation>Повний шлях</translation>
</message>
<message>
<source>(System Default)</source>
<translation type="unfinished">(Типово для ОС)</translation>
</message>
<message>
<source>Select ANSI Codepage for CSV file:</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>OK</source>
<translation type="unfinished">Ок</translation>
</message>
<message>
<source>Cancel</source>
<translation type="unfinished">Відмінити</translation>
</message>
</context>
<context>
<name>LogViewDialog</name>
@ -1734,6 +1750,70 @@
<source>DCA Enc</source>
<translation>DCA Enc</translation>
</message>
<message>
<source>Export Meta Tags to CSV File</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Import Meta Tags from CSV File</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Save CSV file</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>CSV File</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>CSV Export</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Sorry, there are no meta tags that can be exported!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Sorry, failed to open CSV file for writing!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Sorry, failed to write to the CSV file!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>The CSV files was created successfully!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Open CSV file</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Sorry, failed to open CSV file for reading!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Sorry, failed to read from the CSV file!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Sorry, the CSV file does not contain any known fields!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>CSV file is incomplete. Not all files were updated!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>The CSV files was imported successfully!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>CSV Import</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>MetaInfo</name>

View File

@ -535,6 +535,22 @@
<source>Full Path</source>
<translation></translation>
</message>
<message>
<source>(System Default)</source>
<translation type="unfinished">()</translation>
</message>
<message>
<source>Select ANSI Codepage for CSV file:</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>OK</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Cancel</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>LogViewDialog</name>
@ -1733,6 +1749,70 @@
<source>DCA Enc</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Export Meta Tags to CSV File</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Import Meta Tags from CSV File</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Save CSV file</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>CSV File</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>CSV Export</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Sorry, there are no meta tags that can be exported!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Sorry, failed to open CSV file for writing!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Sorry, failed to write to the CSV file!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>The CSV files was created successfully!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Open CSV file</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Sorry, failed to open CSV file for reading!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Sorry, failed to read from the CSV file!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Sorry, the CSV file does not contain any known fields!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>CSV file is incomplete. Not all files were updated!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>The CSV files was imported successfully!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>CSV Import</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>MetaInfo</name>

View File

@ -59,6 +59,7 @@
<file>icons/folder_image.png</file>
<file>icons/folder_explore.png</file>
<file>icons/folder_page.png</file>
<file>icons/folder_table.png</file>
<file>icons/font.png</file>
<file>icons/group.png</file>
<file>icons/house.png</file>

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.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -30,7 +30,7 @@
#define VER_LAMEXP_MINOR_LO 4
#define VER_LAMEXP_TYPE Alpha
#define VER_LAMEXP_PATCH 13
#define VER_LAMEXP_BUILD 867
#define VER_LAMEXP_BUILD 870
///////////////////////////////////////////////////////////////////////////////
// Tool versions (minimum expected versions!)

View File

@ -127,6 +127,7 @@ MainWindow::MainWindow(FileListModel *fileListModel, AudioFileModel *metaInfo, S
m_findFileContextAction = m_sourceFilesContextMenu->addAction(QIcon(":/icons/folder_go.png"), "N/A");
m_sourceFilesContextMenu->addSeparator();
m_exportCsvContextAction = m_sourceFilesContextMenu->addAction(QIcon(":/icons/table_save.png"), "N/A");
m_importCsvContextAction = m_sourceFilesContextMenu->addAction(QIcon(":/icons/folder_table.png"), "N/A");
SET_FONT_BOLD(m_showDetailsContextAction, true);
connect(buttonAddFiles, SIGNAL(clicked()), this, SLOT(addFilesButtonClicked()));
connect(buttonRemoveFile, SIGNAL(clicked()), this, SLOT(removeFileButtonClicked()));
@ -144,6 +145,8 @@ MainWindow::MainWindow(FileListModel *fileListModel, AudioFileModel *metaInfo, S
connect(m_previewContextAction, SIGNAL(triggered(bool)), this, SLOT(previewContextActionTriggered()));
connect(m_findFileContextAction, SIGNAL(triggered(bool)), this, SLOT(findFileContextActionTriggered()));
connect(m_exportCsvContextAction, SIGNAL(triggered(bool)), this, SLOT(exportCsvContextActionTriggered()));
connect(m_importCsvContextAction, SIGNAL(triggered(bool)), this, SLOT(importCsvContextActionTriggered()));
//Setup "Output" tab
m_fileSystemModel = new QFileSystemModelEx();
@ -707,6 +710,7 @@ void MainWindow::changeEvent(QEvent *e)
m_showFolderContextAction->setText(tr("Browse Selected Folder"));
m_addFavoriteFolderAction->setText(tr("Bookmark Current Output Folder"));
m_exportCsvContextAction->setText(tr("Export Meta Tags to CSV File"));
m_importCsvContextAction->setText(tr("Import Meta Tags from CSV File"));
//Force GUI update
m_metaInfoModel->clearData();
@ -2131,6 +2135,9 @@ void MainWindow::handleDelayedFiles(void)
addFiles(selectedFiles);
}
/*
* Export Meta tags to CSV file
*/
void MainWindow::exportCsvContextActionTriggered(void)
{
TEMP_HIDE_DROPBOX
@ -2159,18 +2166,76 @@ void MainWindow::exportCsvContextActionTriggered(void)
m_settings->mostRecentInputPath(QFileInfo(selectedCsvFile).canonicalPath());
switch(m_fileListModel->exportToCsv(selectedCsvFile))
{
case 1:
QMessageBox::critical(this, tr("CSV Export"), NOBR(tr("There are no meta tags that could be exported!")));
case FileListModel::CsvError_NoTags:
QMessageBox::critical(this, tr("CSV Export"), NOBR(tr("Sorry, there are no meta tags that can be exported!")));
break;
case 2:
case FileListModel::CsvError_FileOpen:
QMessageBox::critical(this, tr("CSV Export"), NOBR(tr("Sorry, failed to open CSV file for writing!")));
break;
case 3:
case FileListModel::CsvError_FileWrite:
QMessageBox::critical(this, tr("CSV Export"), NOBR(tr("Sorry, failed to write to the CSV file!")));
break;
default:
case FileListModel::CsvError_OK:
QMessageBox::information(this, tr("CSV Export"), NOBR(tr("The CSV files was created successfully!")));
break;
default:
qWarning("exportToCsv: Unknown return code!");
}
}
)
}
/*
* Import Meta tags from CSV file
*/
void MainWindow::importCsvContextActionTriggered(void)
{
TEMP_HIDE_DROPBOX
(
QString selectedCsvFile;
if(USE_NATIVE_FILE_DIALOG)
{
selectedCsvFile = QFileDialog::getOpenFileName(this, tr("Open CSV file"), m_settings->mostRecentInputPath(), QString("%1 (*.csv)").arg(tr("CSV File")));
}
else
{
QFileDialog dialog(this, tr("Open CSV file"));
dialog.setFileMode(QFileDialog::ExistingFile);
dialog.setNameFilter(QString("%1 (*.csv)").arg(tr("CSV File")));
dialog.setDirectory(m_settings->mostRecentInputPath());
if(dialog.exec())
{
selectedCsvFile = dialog.selectedFiles().first();
}
}
if(!selectedCsvFile.isEmpty())
{
m_settings->mostRecentInputPath(QFileInfo(selectedCsvFile).canonicalPath());
switch(m_fileListModel->importFromCsv(this, selectedCsvFile))
{
case FileListModel::CsvError_FileOpen:
QMessageBox::critical(this, tr("CSV Import"), NOBR(tr("Sorry, failed to open CSV file for reading!")));
break;
case FileListModel::CsvError_FileRead:
QMessageBox::critical(this, tr("CSV Import"), NOBR(tr("Sorry, failed to read from the CSV file!")));
break;
case FileListModel::CsvError_NoTags:
QMessageBox::critical(this, tr("CSV Import"), NOBR(tr("Sorry, the CSV file does not contain any known fields!")));
break;
case FileListModel::CsvError_Incomplete:
QMessageBox::warning(this, tr("CSV Import"), NOBR(tr("CSV file is incomplete. Not all files were updated!")));
break;
case FileListModel::CsvError_OK:
QMessageBox::information(this, tr("CSV Import"), NOBR(tr("The CSV files was imported successfully!")));
break;
case FileListModel::CsvError_Aborted:
/* User aborted, ignore! */
break;
default:
qWarning("exportToCsv: Unknown return code!");
}
}
)

View File

@ -90,6 +90,7 @@ private slots:
void handleDelayedFiles(void);
void hibernateComputerActionTriggered(bool checked);
void importCueSheetActionTriggered(bool checked);
void importCsvContextActionTriggered(void);
void initOutputFolderModel(void);
void languageActionActivated(QAction *action);
void languageFromFileActionActivated(bool checked);
@ -185,6 +186,7 @@ private:
QAction *m_showFolderContextAction;
QAction *m_addFavoriteFolderAction;
QAction *m_exportCsvContextAction;
QAction *m_importCsvContextAction;
QActionGroup *m_languageActionGroup;
QActionGroup *m_styleActionGroup;
QActionGroup *m_tabActionGroup;

View File

@ -21,9 +21,17 @@
#include "Model_FileList.h"
#include "Global.h"
#include <QFileInfo>
#include <QDir>
#include <QFile>
#include <QTextCodec>
#include <QTextStream>
#include <QInputDialog>
#define EXPAND(STR) QString(STR).leftJustified(96, ' ')
#define CHECK_HDR(STR,NAM) (!(STR).compare((NAM), Qt::CaseInsensitive))
////////////////////////////////////////////////////////////
// Constructor & Destructor
@ -245,12 +253,16 @@ int FileListModel::exportToCsv(const QString &outFile)
if(!(haveTitle || haveArtist || haveAlbum || haveGenre || haveYear || haveComment))
{
return 1;
return CsvError_NoTags;
}
QFile file(outFile);
if(file.open(QIODevice::WriteOnly))
if(!file.open(QIODevice::WriteOnly))
{
return CsvError_FileOpen;
}
else
{
QStringList line;
@ -265,13 +277,9 @@ int FileListModel::exportToCsv(const QString &outFile)
if(file.write(line.join(";").append("\r\n").toUtf8().prepend("\xef\xbb\xbf")) < 1)
{
file.close();
return 3;
return CsvError_FileWrite;
}
}
else
{
return 2;
}
for(int i = 0; i < nFiles; i++)
{
@ -288,10 +296,186 @@ int FileListModel::exportToCsv(const QString &outFile)
if(file.write(line.replaceInStrings(";", ",").join(";").append("\r\n").toUtf8()) < 1)
{
file.close();
return 3;
return CsvError_FileWrite;
}
}
file.close();
return 0;
return CsvError_OK;
}
int FileListModel::importFromCsv(QWidget *parent, const QString &inFile)
{
QFile file(inFile);
if(!file.open(QIODevice::ReadOnly))
{
return CsvError_FileOpen;
}
QTextCodec *codec = NULL;
QByteArray bomCheck = file.peek(16);
if((!bomCheck.isEmpty()) && bomCheck.startsWith("\xef\xbb\xbf"))
{
codec = QTextCodec::codecForName("UTF-8");
}
else if((!bomCheck.isEmpty()) && bomCheck.startsWith("\xff\xfe"))
{
codec = QTextCodec::codecForName("UTF-16LE");
}
else if((!bomCheck.isEmpty()) && bomCheck.startsWith("\xfe\xff"))
{
codec = QTextCodec::codecForName("UTF-16BE");
}
else
{
const QString systemDefault = tr("(System Default)");
QStringList codecList;
codecList.append(systemDefault);
codecList.append(lamexp_available_codepages());
QInputDialog *input = new QInputDialog(parent);
input->setLabelText(EXPAND(tr("Select ANSI Codepage for CSV file:")));
input->setOkButtonText(tr("OK"));
input->setCancelButtonText(tr("Cancel"));
input->setTextEchoMode(QLineEdit::Normal);
input->setComboBoxItems(codecList);
if(input->exec() < 1)
{
LAMEXP_DELETE(input);
return CsvError_Aborted;
}
if(input->textValue().compare(systemDefault, Qt::CaseInsensitive))
{
qDebug("User-selected codec is: %s", input->textValue().toLatin1().constData());
codec = QTextCodec::codecForName(input->textValue().toLatin1().constData());
}
else
{
qDebug("Going to use the system's default codec!");
codec = QTextCodec::codecForName("System");
}
LAMEXP_DELETE(input);
}
bomCheck.clear();
//----------------------//
QTextStream stream(&file);
stream.setAutoDetectUnicode(false);
stream.setCodec(codec);
QStringList header = stream.readLine().simplified().split(";", QString::KeepEmptyParts);
const int nCols = header.count();
const int nFiles = m_fileList.count();
if(nCols < 1)
{
return CsvError_FileRead;
}
for(int i = 0; i < nCols; i++)
{
header[i] = header[i].trimmed();
}
bool *ignore = new bool[nCols];
memset(ignore, 0, sizeof(bool) * nCols);
//----------------------//
for(int i = 0; i < nFiles; i++)
{
if(stream.atEnd())
{
LAMEXP_DELETE_ARRAY(ignore);
return CsvError_Incomplete;
}
QStringList line = stream.readLine().split(";", QString::KeepEmptyParts);
if(line.count() < header.count())
{
qWarning("Skipping an incomplete line in CSV file!");
continue;
}
for(int j = 0; j < nCols; j++)
{
if(ignore[j])
{
continue;
}
else if(CHECK_HDR(header.at(j), "POSITION"))
{
bool ok = false;
unsigned int temp = line.at(j).trimmed().toUInt(&ok);
if(ok) m_fileList[i].setFilePosition(temp);
}
else if(CHECK_HDR(header.at(j), "TITLE"))
{
QString temp = line.at(j).trimmed();
if(!temp.isEmpty()) m_fileList[i].setFileName(temp);
}
else if(CHECK_HDR(header.at(j), "ARTIST"))
{
QString temp = line.at(j).trimmed();
if(!temp.isEmpty()) m_fileList[i].setFileArtist(temp);
}
else if(CHECK_HDR(header.at(j), "ALBUM"))
{
QString temp = line.at(j).trimmed();
if(!temp.isEmpty()) m_fileList[i].setFileAlbum(temp);
}
else if(CHECK_HDR(header.at(j), "GENRE"))
{
QString temp = line.at(j).trimmed();
if(!temp.isEmpty()) m_fileList[i].setFileGenre(temp);
}
else if(CHECK_HDR(header.at(j), "YEAR"))
{
bool ok = false;
unsigned int temp = line.at(j).trimmed().toUInt(&ok);
if(ok) m_fileList[i].setFileYear(temp);
}
else if(CHECK_HDR(header.at(j), "COMMENT"))
{
QString temp = line.at(j).trimmed();
if(!temp.isEmpty()) m_fileList[i].setFileComment(temp);
}
else
{
qWarning("Unkonw field '%s' will be ignored!", header.at(j).toUtf8().constData());
ignore[j] = true;
}
}
bool noFieldsLeft = true;
for(int j = 0; j < nCols; j++)
{
if(!ignore[j])
{
noFieldsLeft = false;
break;
}
}
if(noFieldsLeft)
{
LAMEXP_DELETE_ARRAY(ignore);
return CsvError_NoTags;
}
}
//----------------------//
LAMEXP_DELETE_ARRAY(ignore);
return CsvError_OK;
}

View File

@ -50,6 +50,20 @@ public:
//CSV export/import
int exportToCsv(const QString &outFile);
int importFromCsv(QWidget *parent, const QString &inFile);
//Public types
enum
{
CsvError_OK = 0,
CsvError_NoTags = 1,
CsvError_FileOpen = 2,
CsvError_FileRead = 3,
CsvError_FileWrite = 4,
CsvError_Incomplete = 5,
CsvError_Aborted = 6
}
CsvError;
public slots:
void addFile(const QString &filePath);