Permalink
Browse files

Upload work for Coquillo 1.10 (not yet completely functional)

  • Loading branch information...
1 parent a28c70e commit eecd711e699e501daf08318d5fca37f9877f6743 @sjuvonen committed Feb 1, 2012
Showing with 11,436 additions and 0 deletions.
  1. +7 −0 common.pri
  2. +25 −0 coquillo.pro
  3. +8 −0 coquillo.qrc
  4. +10 −0 extra/coquillo.desktop
  5. BIN extra/coquillo.ico
  6. BIN extra/coquillo.png
  7. +18 −0 libs.pri
  8. BIN resources/Coquillo.png
  9. +52 −0 resources/icons/scalable/Coquillo.svg
  10. +22 −0 resources/icons/scalable/select_all.svg
  11. +22 −0 resources/icons/scalable/select_inverse.svg
  12. BIN resources/icons/select_all_48x48.png
  13. BIN resources/icons/select_inverse_48x48.png
  14. +5 −0 run-coquillo.sh
  15. +72 −0 src/Coquillo.cpp
  16. +22 −0 src/Coquillo.h
  17. +83 −0 src/core/MediaScanner.cpp
  18. +43 −0 src/core/MediaScanner.h
  19. +20 −0 src/core/MetaData.cpp
  20. +54 −0 src/core/MetaData.h
  21. +34 −0 src/core/MetaDataImage.cpp
  22. +43 −0 src/core/MetaDataImage.h
  23. +409 −0 src/core/MetaDataModel.cpp
  24. +80 −0 src/core/MetaDataModel.h
  25. +375 −0 src/core/MetaDataModel2.cpp
  26. +80 −0 src/core/MetaDataModel2.h
  27. +455 −0 src/core/MetaDataReader.cpp
  28. +55 −0 src/core/MetaDataReader.h
  29. +364 −0 src/core/MetaDataWriter.cpp
  30. +54 −0 src/core/MetaDataWriter.h
  31. +211 −0 src/core/ModelDataInspector.cpp
  32. +45 −0 src/core/ModelDataInspector.h
  33. +31 −0 src/core/core.pro
  34. +32 −0 src/core/globals.cpp
  35. +94 −0 src/core/globals.h
  36. +49 −0 src/gui/AboutDialog.cpp
  37. +22 −0 src/gui/AboutDialog.h
  38. +33 −0 src/gui/DataWidget.cpp
  39. +30 −0 src/gui/DataWidget.h
  40. +158 −0 src/gui/DirectorySelectorWidget.cpp
  41. +73 −0 src/gui/DirectorySelectorWidget.h
  42. +258 −0 src/gui/EditorWidget.cpp
  43. +45 −0 src/gui/EditorWidget.h
  44. +39 −0 src/gui/FileSystemProxyModel.cpp
  45. +27 −0 src/gui/FileSystemProxyModel.h
  46. +470 −0 src/gui/MainWindow.cpp
  47. +84 −0 src/gui/MainWindow.h
  48. +369 −0 src/gui/ProcessorWidget.cpp
  49. +57 −0 src/gui/ProcessorWidget.h
  50. +51 −0 src/gui/bookmarks/BookmarkDialog.cpp
  51. +30 −0 src/gui/bookmarks/BookmarkDialog.h
  52. +145 −0 src/gui/bookmarks/BookmarkModel.cpp
  53. +37 −0 src/gui/bookmarks/BookmarkModel.h
  54. +27 −0 src/gui/cddb/Cddb.cpp
  55. +47 −0 src/gui/cddb/Cddb.h
  56. +299 −0 src/gui/cddb/CddbPrivate.cpp
  57. +89 −0 src/gui/cddb/CddbPrivate.h
  58. +414 −0 src/gui/cddb/CddbSearchDialog.cpp
  59. +69 −0 src/gui/cddb/CddbSearchDialog.h
  60. +53 −0 src/gui/gui.pro
  61. +22 −0 src/main.cpp
  62. +37 −0 src/src.pro
  63. +223 −0 src/ui/AboutApp.ui
  64. +197 −0 src/ui/BookmarkDialog.ui
  65. +744 −0 src/ui/Cddb2.ui
  66. +741 −0 src/ui/CddbSearchDialog.ui
  67. +112 −0 src/ui/DirectorySelector.ui
  68. +643 −0 src/ui/EditorWidget.ui
  69. +727 −0 src/ui/MainWindow.ui
  70. +1,124 −0 src/ui/ProcessorWidget.ui
  71. +599 −0 src/ui/SettingsDialog.ui
  72. +467 −0 src/ui/SettingsDialog2.ui
View
@@ -0,0 +1,7 @@
+
+unix {
+ isEmpty(PREFIX) {
+ PREFIX = /usr
+ }
+}
+
View
@@ -0,0 +1,25 @@
+include(common.pri)
+
+TEMPLATE = subdirs
+CONFIG += ordered
+
+SUBDIRS += src/core src/gui
+SUBDIRS += src/
+
+unix {
+ DATADIR = $$PREFIX/share
+ ICON = extra/coquillo.png
+
+ icons.path = $$DATADIR/pixmaps
+ icons.files = extra/coquillo.png
+
+ launcher.path = $$DATADIR/applications
+ launches.files = extra/coquillo.desktop
+
+ INSTALLS += icons launcher
+}
+
+win32 {
+ CONFIG += windows
+ RC_FILE = coquillo.rc
+}
View
@@ -0,0 +1,8 @@
+<!DOCTYPE RCC>
+<RCC version="1.0">
+ <qresource>
+ <file>resources/Coquillo.png</file>
+ <file>resources/icons/select_all_48x48.png</file>
+ <file>resources/icons/select_inverse_48x48.png</file>
+ </qresource>
+</RCC>
View
@@ -0,0 +1,10 @@
+[Desktop Entry]
+Name=Coquillo
+GenericName=Audio Metadata Editor
+Icon=coquillo
+Exec=coquillo
+Type=Application
+Categories=AudioVideo;Music;
+Comment=Edit metadata of audio files
+Comment[fi_FI.UTF-8]=Äänitiedostojen metatietojen editori
+
View
Binary file not shown.
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
@@ -0,0 +1,18 @@
+
+include(common.pri)
+
+ROOT = ../../
+
+MOC_DIR = $$ROOT/build
+OBJECTS_DIR = $$ROOT/build
+UI_DIR = $$ROOT/build
+
+VERSION = 1.0
+
+target.path = $$PREFIX/lib/coquillo
+
+win32 {
+
+ CONFIG += windows dll
+}
+
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@@ -0,0 +1,52 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+
+<svg xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:cc="http://creativecommons.org/ns#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:svg="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" width="1100" height="1100" id="svg2" version="1.1" inkscape:version="0.48.1 r9760" sodipodi:docname="Coquillo-Mod.svg">
+ <defs id="defs4">
+ <linearGradient inkscape:collect="always" id="linearGradient3087">
+ <stop style="stop-color:#2b0000;stop-opacity:1" offset="0" id="stop3089" />
+ <stop style="stop-color:#800000;stop-opacity:1" offset="1" id="stop3091" />
+ </linearGradient>
+ <linearGradient inkscape:collect="always" id="linearGradient3077">
+ <stop style="stop-color:#00ff00;stop-opacity:1;" offset="0" id="stop3079" />
+ <stop style="stop-color:#008000;stop-opacity:1" offset="1" id="stop3081" />
+ </linearGradient>
+ <linearGradient inkscape:collect="always" id="linearGradient3069">
+ <stop style="stop-color:#00ff00;stop-opacity:1;" offset="0" id="stop3071" />
+ <stop style="stop-color:#008000;stop-opacity:1" offset="1" id="stop3073" />
+ </linearGradient>
+ <linearGradient inkscape:collect="always" id="linearGradient3061">
+ <stop style="stop-color:#00ff00;stop-opacity:1;" offset="0" id="stop3063" />
+ <stop style="stop-color:#008000;stop-opacity:1" offset="1" id="stop3065" />
+ </linearGradient>
+ <linearGradient inkscape:collect="always" id="linearGradient3039">
+ <stop style="stop-color:#00ff00;stop-opacity:1;" offset="0" id="stop3041" />
+ <stop style="stop-color:#008000;stop-opacity:1" offset="1" id="stop3043" />
+ </linearGradient>
+ <linearGradient inkscape:collect="always" xlink:href="#linearGradient3039" id="linearGradient3045" x1="-30" y1="285.21933" x2="364.28571" y2="156.6479" gradientUnits="userSpaceOnUse" gradientTransform="translate(223.42857,-12.285714)" />
+ <linearGradient inkscape:collect="always" xlink:href="#linearGradient3061" id="linearGradient3067" x1="115.71429" y1="459.50504" x2="352.85715" y2="192.36218" gradientUnits="userSpaceOnUse" gradientTransform="matrix(1.1206614,0,0,0.92797292,130.42826,2.816172)" />
+ <linearGradient inkscape:collect="always" xlink:href="#linearGradient3069" id="linearGradient3075" x1="681.42859" y1="243.79076" x2="381.42856" y2="129.50504" gradientUnits="userSpaceOnUse" gradientTransform="matrix(1.163776,0,0,1.4927145,149.70936,-57.099633)" />
+ <linearGradient inkscape:collect="always" xlink:href="#linearGradient3077" id="linearGradient3083" x1="647.14288" y1="433.79074" x2="414.28571" y2="192.36218" gradientUnits="userSpaceOnUse" gradientTransform="translate(169.14286,-8)" />
+ <linearGradient inkscape:collect="always" xlink:href="#linearGradient3087" id="linearGradient3093" x1="334" y1="968.07648" x2="350" y2="249.50504" gradientUnits="userSpaceOnUse" gradientTransform="matrix(1.7159596,0,0,0.87148109,-71.41123,7.067998)" />
+ </defs>
+ <sodipodi:namedview id="base" pagecolor="#ffffff" bordercolor="#666666" borderopacity="1.0" inkscape:pageopacity="0.0" inkscape:pageshadow="2" inkscape:zoom="0.5" inkscape:cx="336.057" inkscape:cy="604.55916" inkscape:document-units="px" inkscape:current-layer="layer1" showgrid="false" inkscape:window-width="1918" inkscape:window-height="1022" inkscape:window-x="0" inkscape:window-y="26" inkscape:window-maximized="1" />
+ <metadata id="metadata7">
+ <rdf:RDF>
+ <cc:Work rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ <dc:title></dc:title>
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <g inkscape:label="Layer 1" inkscape:groupmode="layer" id="layer1" transform="translate(0,47.637817)">
+ <path sodipodi:type="arc" style="opacity:0.38000022;fill:#000000;fill-opacity:1;stroke:#f44800;stroke-width:1;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" id="path3097" sodipodi:cx="307.85715" sodipodi:cy="938.79077" sodipodi:rx="165" sodipodi:ry="97.85714" d="m 212.08936,1018.4782 a 165,97.85714 0 1 1 1.26345,0.5288" sodipodi:start="2.1900294" sodipodi:end="8.4638427" sodipodi:open="true" transform="matrix(1.4779672,0,0,1,64.854377,-83.714285)" />
+ <path style="fill:none;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" d="m 1500.5795,445.97753 c -195.7742,89.12619 -286.821,189.83379 -355.7664,292.98552 0,0 125.598,-13.04003 263.8963,-115.19092 35.185,-25.98859 61.4184,-45.36532 80.9777,-59.81236 57.3206,-42.33854 57.3206,-42.33854 57.3206,-42.33854" id="path2985-9" inkscape:connector-curvature="0" sodipodi:nodetypes="ccssc" />
+ <path style="fill:none;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" d="m 1122.8571,98.076468 c 71.5739,103.972062 201.6297,189.468042 330.0001,232.857152 0,0 -60,-141.42858 -182.8572,-222.85715 C 1147.1429,26.647897 1138.5714,58.076468 1138.5714,58.076468" id="path3012" inkscape:connector-curvature="0" sodipodi:nodetypes="ccsc" />
+ <path style="fill:url(#linearGradient3093);fill-opacity:1;stroke:#000000;stroke-width:1.22287631px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" d="m 485.04992,208.32228 c 0,0 -34.31919,606.30184 -93.15208,654.85583 C 333.06493,911.73195 664,870.64792 664,870.64792 647.71328,918.81648 556.94285,676.02262 619.29927,221.38261 627.01949,165.0946 485.04992,208.32228 485.04992,208.32228 z" id="path3085" inkscape:connector-curvature="0" sodipodi:nodetypes="cscsc" />
+ <path style="fill:url(#linearGradient3083);fill-opacity:1;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" d="m 537.85715,208.63024 c 55.57382,163.97206 163.62961,193.46804 312.00001,240.85715 0,0 -28,-149.42858 -150.8572,-230.85715 -122.8571,-81.42857 -131.42852,-50 -131.42852,-50" id="path3012-6" inkscape:connector-curvature="0" sodipodi:nodetypes="ccsc" />
+ <path style="fill:url(#linearGradient3067);fill-opacity:1;stroke:#000000;stroke-width:1.01977611px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" d="M 501.0668,141.95445 C 307.55846,245.01101 273.6385,320.0895 214.11196,480.9519 c 0,0 149.24731,-31.71253 260.99729,-161.68695 111.74999,-129.97442 91.74999,-145.97442 91.74999,-145.97442" id="path2985" inkscape:connector-curvature="0" sodipodi:nodetypes="ccsc" inkscape:transform-center-x="-27.216061" inkscape:transform-center-y="-123.28783" />
+ <path style="fill:url(#linearGradient3045);fill-opacity:1;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" d="m 570.47941,78.7539 c -211.21064,18.75629 -248.46862,59.88964 -381.67096,310.00791 0,0 184.16351,-69.78184 264.97291,-142.98507 101.51742,-91.96211 96.96012,-109.74696 96.96012,-109.74696" id="path2985-2" inkscape:connector-curvature="0" sodipodi:nodetypes="ccsc" />
+ <path style="fill:url(#linearGradient3075);fill-opacity:1;stroke:#000000;stroke-width:1.3180232px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" d="m 528.56254,147.40211 c 100.93629,126.58633 172.83748,140.01154 426.51776,187.03563 0,0 -90.80501,-183.05743 -257.22856,-236.35018 -166.42343,-53.292809 -163.6052,-4.80001 -163.6052,-4.80001" id="path3012-3" inkscape:connector-curvature="0" sodipodi:nodetypes="ccsc" />
+ </g>
+</svg>
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+
+<svg xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:cc="http://creativecommons.org/ns#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:svg="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg" xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" width="800" height="800" id="svg2" version="1.1" inkscape:version="0.48.1 r9760" sodipodi:docname="select_all.svg">
+ <defs id="defs4" />
+ <sodipodi:namedview id="base" pagecolor="#ffffff" bordercolor="#666666" borderopacity="1.0" inkscape:pageopacity="0.0" inkscape:pageshadow="2" inkscape:zoom="0.7" inkscape:cx="428.92733" inkscape:cy="407.81086" inkscape:document-units="px" inkscape:current-layer="layer1" showgrid="false" inkscape:window-width="1320" inkscape:window-height="808" inkscape:window-x="369" inkscape:window-y="202" inkscape:window-maximized="0" inkscape:snap-grids="true" inkscape:snap-to-guides="true" />
+ <metadata id="metadata7">
+ <rdf:RDF>
+ <cc:Work rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ <dc:title />
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <g inkscape:label="Layer 1" inkscape:groupmode="layer" id="layer1" transform="translate(0,-252.36218)">
+ <rect style="fill:#00009b;fill-opacity:0.90196078;stroke:#000000;stroke-width:4.5356431;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" id="rect2985" width="560" height="119.9057" x="124.28571" y="319.50504" />
+ <rect style="fill:#00009b;fill-opacity:0.90196078;stroke:#230000;stroke-width:4.50152016;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" id="rect2985-5" width="560" height="118.10831" x="124.28571" y="498.07645" />
+ <rect style="fill:#00009b;fill-opacity:0.90196078;stroke:#230000;stroke-width:4.47152758;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" id="rect2985-2" width="560" height="116.53971" x="122.85715" y="682.36218" />
+ <rect style="fill:#00009b;fill-opacity:0.90196078;stroke:#230000;stroke-width:4.46961164;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" id="rect2985-54" width="560" height="116.43987" x="122.85715" y="869.50507" />
+ </g>
+</svg>
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+
+<svg xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:cc="http://creativecommons.org/ns#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:svg="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg" xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" width="800" height="800" id="svg2" version="1.1" inkscape:version="0.48.1 r9760" sodipodi:docname="select_all.svg">
+ <defs id="defs4" />
+ <sodipodi:namedview id="base" pagecolor="#ffffff" bordercolor="#666666" borderopacity="1.0" inkscape:pageopacity="0.0" inkscape:pageshadow="2" inkscape:zoom="0.7" inkscape:cx="428.92733" inkscape:cy="407.81086" inkscape:document-units="px" inkscape:current-layer="layer1" showgrid="false" inkscape:window-width="1320" inkscape:window-height="808" inkscape:window-x="369" inkscape:window-y="202" inkscape:window-maximized="0" inkscape:snap-grids="true" inkscape:snap-to-guides="true" />
+ <metadata id="metadata7">
+ <rdf:RDF>
+ <cc:Work rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ <dc:title></dc:title>
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <g inkscape:label="Layer 1" inkscape:groupmode="layer" id="layer1" transform="translate(0,-252.36218)">
+ <rect style="fill:#aaccee;fill-opacity:0.90196078000000002;stroke:#230000;stroke-width:4.53564309999999971;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:0.70588237;stroke-dasharray:none" id="rect2985" width="560" height="119.9057" x="124.28571" y="319.50504" />
+ <rect style="fill:#00009b;fill-opacity:0.90196078;stroke:#230000;stroke-width:4.50152016;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" id="rect2985-5" width="560" height="118.10831" x="124.28571" y="498.07645" />
+ <rect style="fill:#aaccee;fill-opacity:0.90196078000000002;stroke:#230000;stroke-width:4.47152758000000006;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:0.70588237;stroke-dasharray:none" id="rect2985-2" width="560" height="116.53971" x="122.85715" y="682.36218" />
+ <rect style="fill:#aaccee;fill-opacity:0.90196078000000002;stroke:#230000;stroke-width:4.46961164000000011;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:0.70588237;stroke-dasharray:none" id="rect2985-54" width="560" height="116.43987" x="122.85715" y="869.50507" />
+ </g>
+</svg>
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
@@ -0,0 +1,5 @@
+#!/bin/sh
+
+export LD_LIBRARY_PATH=lib
+./coquillo
+
View
@@ -0,0 +1,72 @@
+
+#include <QApplication>
+#include <QDesktopServices>
+#include <QSettings>
+
+#include "Coquillo.h"
+
+#include <core/MetaDataModel2.h>
+#include <core/ModelDataInspector.h>
+#include <gui/MainWindow.h>
+
+Coquillo::Coquillo(QObject * parent)
+: QObject(parent) {
+
+ migrateSettings();
+ writeDefaults();
+
+ MetaDataModel2 * m = new MetaDataModel2(this);
+
+ _window = new MainWindow(m);
+
+// ModelDataInspector * inspector = new ModelDataInspector(this);
+// inspector->setModel(_model);
+
+ _window->show();
+
+ QApplication * app = qobject_cast<QApplication *>(QApplication::instance());
+
+ connect(app, SIGNAL(lastWindowClosed()),
+ _window, SLOT(saveSettings()));
+}
+
+Coquillo::~Coquillo() {
+ delete _window;
+}
+
+void Coquillo::migrateSettings() {
+}
+
+void Coquillo::writeDefaults() {
+
+ QHash<QString, QVariant> defaults;
+
+ // Location to use when starting up the application
+ defaults.insert(
+ "DefaultLocation",
+ QDesktopServices::storageLocation(QDesktopServices::MusicLocation)
+ );
+
+ // If this option is enabled, legacy covers will be converted to the new format.
+ // If turned off, legacy covers will not be read at all!
+ defaults.insert("Compat/ConvertLegacyXiphPictures", true);
+
+ // Pad numbers in filenames to this length when using pad-enabled formatting
+ // characters in ProcessorWidget
+ defaults.insert("Rules/NumberPadWidth", 2);
+
+ // Don't write useless ID3v1 tags by default
+ defaults.insert("Media/MPEG_ID3v1_Enabled", false);
+
+ // Default encoding for ID3v2 tags
+ defaults.insert("Media/ID3v2_Encoding", "UTF-8");
+
+ QSettings settings;
+
+ foreach (QString key, defaults.keys()) {
+ if (!settings.contains(key))
+ settings.setValue(key, defaults.value(key));
+ }
+
+ settings.sync();
+}
View
@@ -0,0 +1,22 @@
+#ifndef COQUILLO_H
+#define COQUILLO_H
+
+#include <QObject>
+
+class MainWindow;
+
+class Coquillo : public QObject {
+ Q_OBJECT
+
+ public:
+ Coquillo(QObject * parent=0);
+ ~Coquillo();
+
+ private:
+ void migrateSettings();
+ void writeDefaults();
+
+ MainWindow * _window;
+};
+
+#endif
View
@@ -0,0 +1,83 @@
+
+#include <taglib/fileref.h>
+
+#include <QDir>
+#include <QFileInfoList>
+#include <QStringList>
+
+#include "MediaScanner.h"
+#include "MetaDataReader.h"
+
+#include <QDebug>
+
+extern volatile bool abortAction;
+
+MediaScanner::MediaScanner(QObject * parent) : QObject(parent), _recursive(false) {
+
+}
+
+void MediaScanner::scan() {
+ if (_path.isEmpty())
+ return;
+
+ emit started();
+
+ const QStringList paths = fetchMedia(_path, validFileTypes(), _recursive);
+
+ emit maximumChanged(paths.count());
+
+ processMedia(paths);
+
+ emit finished();
+}
+
+void MediaScanner::scanPath(const QString & path) {
+ _path = path;
+ scan();
+}
+
+QStringList MediaScanner::validFileTypes() const {
+ TagLib::StringList exts = TagLib::FileRef::defaultFileExtensions();
+ QStringList types = QString::fromUtf8( exts.toString("%%*.").toCString(true) ).split("%%");
+
+ // Prepends the first items with '*.' also
+ types << QString("*.%1").arg( types.takeFirst() );
+
+ return types;
+}
+
+QStringList MediaScanner::fetchMedia(const QString & path, const QStringList & fileTypes, bool recursive) const {
+ QStringList files;
+
+ if (abortAction)
+ return QStringList();
+
+ QDir dir(path);
+ QFileInfoList infoList = dir.entryInfoList(fileTypes, QDir::Files, QDir::Name);
+
+ foreach (const QFileInfo info, infoList)
+ files << info.absoluteFilePath();
+
+ if (recursive) {
+ infoList = dir.entryInfoList(QDir::Dirs | QDir::NoDotAndDotDot);
+
+ foreach (const QFileInfo info, infoList)
+ files << fetchMedia(info.absoluteFilePath(), fileTypes, true);
+ }
+
+ return files;
+}
+
+void MediaScanner::processMedia(const QStringList & paths) {
+ for (int i = 0; i < paths.count(); i++) {
+ if (abortAction)
+ return;
+
+ const MetaData metaData = MetaDataReader::getTags(paths[i]);
+
+ if (metaData.valid())
+ emit itemFound(metaData);
+
+ emit progress(i);
+ }
+}
Oops, something went wrong.

0 comments on commit eecd711

Please sign in to comment.