oopapidocs  2.0
metadatatable.h
00001 #ifndef MP3FILEDB_H
00002 #define MP3FILEDB_H
00003 #include "sqlmdexport.h"
00004 
00005 #include "audiometadata.h"
00006 
00007 #include <QObject>
00008 #include <QHash>
00009 #include <QStringList>
00010 #include <QSqlQuery>
00011 namespace Abstract {
00012      class MetaDataLoader;
00013 }
00014 
00021 class SQLMDEXPORT MetaDataTable : public QObject
00022 {
00023     Q_OBJECT
00024 public:
00025 
00026     static MetaDataTable* instance();
00027 
00028     ~MetaDataTable();
00029 
00035     int visit(QString directory);
00036 
00038     bool clearTable();
00039 
00041     QStringList genres() const;
00042 
00052     bool hasMetaData(QString fileName, bool fetch=false, bool refresh=false);
00053 
00055     bool dropMetaData(QString fileName);
00056 
00060     MetaDataValue findRecord(QString fileName);
00061     
00062     QSet<QString> allSongs();
00063 
00064     virtual QString tableName() const {return m_tableName;}
00065 
00066 protected:
00068     MetaDataTable(QObject* parent=0) ;
00069     bool createMetadataTable();
00070 public slots:
00071     bool insert(const MetaDataValue &mdv);
00072 signals:
00074     void inserted(MetaDataValue v);
00075 protected:
00076     // name of table for metadata
00077     QString m_tableName;
00078     QString m_driver;
00079     QString m_createTableQStr;
00080     QHash<QString, MetaDataValue> m_previous;
00081     QSqlQuery m_insertQuery;
00082 //    QSqlQuery m_deleteQuery;
00083     QString m_deleteQuery;
00084     Abstract::MetaDataLoader *m_mdl;
00085 };
00086 
00087 
00088 #endif // MP3FILEDB_H
 All Classes Namespaces Functions Enumerations