Mixxx

/home/maxime/Projets/Mixxx/1.10/mixxx/src/ladspa/ladspapresetmanager.cpp

Go to the documentation of this file.
00001 /***************************************************************************
00002 *                                                                         *
00003 *   This program is free software; you can redistribute it and/or modify  *
00004 *   it under the terms of the GNU General Public License as published by  *
00005 *   the Free Software Foundation; either version 2 of the License, or     *
00006 *   (at your option) any later version.                                   *
00007 *                                                                         *
00008 ***************************************************************************/
00009 
00010 #include <QtCore>
00011 #include <QtXml>
00012 
00013 #include "ladspapresetmanager.h"
00014 #include "ladspaloader.h"
00015 #include "widget/wwidget.h"
00016 
00017 
00018 LADSPAPresetManager::LADSPAPresetManager()
00019 {
00020     m_iPresetCount = 0;
00021 
00022     LADSPALoader * loader = new LADSPALoader();
00023 
00024     QDir dir(WWidget::getPath(QString("../../ladspa_presets"))); // TODO
00025     QFileInfoList files = dir.entryInfoList();
00026     m_Presets.resize(files.count());
00027     for (QFileInfoList::iterator fileIter = files.begin(); fileIter != files.end(); fileIter++)
00028     {
00029         qDebug() << "LADSPA: file " << (*fileIter).filePath();
00030         if ((*fileIter).isDir())
00031         {
00032             continue;
00033         }
00034 
00035         QFile file((* fileIter).filePath());
00036 
00037         QDomDocument document("Preset");
00038         file.open(QIODevice::ReadOnly);
00039         document.setContent(&file);
00040         file.close();
00041 
00042         LADSPAPreset * preset = new LADSPAPreset(document.documentElement(), loader);
00043         m_Presets [m_iPresetCount] = preset;
00044         m_iPresetCount++;
00045     }
00046 }
00047 
00048 LADSPAPresetManager::~LADSPAPresetManager()
00049 {
00050 }
00051 
00052 unsigned int LADSPAPresetManager::getPresetCount()
00053 {
00054     return m_iPresetCount;
00055 }
00056 
00057 LADSPAPreset * LADSPAPresetManager::getPreset(unsigned int i)
00058 {
00059     if (i >= m_iPresetCount)
00060     {
00061         return NULL;
00062     }
00063     return m_Presets[i];
00064 }
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines