Qmmp
|
00001 /*************************************************************************** 00002 * Copyright (C) 2008-2014 by Ilya Kotov * 00003 * forkotov02@hotmail.ru * 00004 * * 00005 * This program is free software; you can redistribute it and/or modify * 00006 * it under the terms of the GNU General Public License as published by * 00007 * the Free Software Foundation; either version 2 of the License, or * 00008 * (at your option) any later version. * 00009 * * 00010 * This program is distributed in the hope that it will be useful, * 00011 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 00012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 00013 * GNU General Public License for more details. * 00014 * * 00015 * You should have received a copy of the GNU General Public License * 00016 * along with this program; if not, write to the * 00017 * Free Software Foundation, Inc., * 00018 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * 00019 ***************************************************************************/ 00020 #ifndef VISUAL_H 00021 #define VISUAL_H 00022 00023 #include <QMutex> 00024 #include <QStringList> 00025 #include <QWidget> 00026 #include <QHash> 00027 #include <stddef.h> 00028 00029 class Buffer; 00030 class Decoder; 00031 class Output; 00032 class VisualFactory; 00033 00037 class Visual : public QWidget 00038 { 00039 Q_OBJECT 00040 public: 00046 Visual(QWidget *parent, Qt::WindowFlags f = 0); 00050 virtual ~Visual(); 00058 virtual void add(float *data, size_t samples, int chan) = 0; 00063 virtual void clear() = 0; 00067 QMutex *mutex(); 00071 static QList<VisualFactory*> factories(); 00076 static QString file(VisualFactory *factory); 00082 static void setEnabled(VisualFactory* factory, bool enable = true); 00087 static bool isEnabled(VisualFactory* factory); 00091 static void add(Visual*visual); 00095 static void remove(Visual*); 00102 static void initialize(QWidget *parent, QObject *receiver = 0, const char *member = 0); 00106 static QList<Visual *> *visuals(); 00112 static void showSettings(VisualFactory *factory, QWidget *parent); 00113 00114 signals: 00118 void closedByUser(); 00119 00120 protected: 00125 virtual void closeEvent (QCloseEvent *event); 00126 00127 private: 00128 Decoder *m_decoder; 00129 Output *m_output; 00130 QMutex m_mutex; 00131 00132 static QList<VisualFactory*> *m_factories; 00133 static QHash <VisualFactory*, QString> *m_files; 00134 static void checkFactories(); 00135 static QList<Visual*> m_visuals; 00136 static QHash<VisualFactory*, Visual*> m_vis_map; //internal visualization 00137 static QWidget *m_parentWidget; 00138 static QObject *m_receiver; 00139 static const char *m_member; 00140 }; 00141 00142 #endif