Qmmp
|
00001 /*************************************************************************** 00002 * Copyright (C) 2008-2013 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 00028 class Buffer; 00029 class Decoder; 00030 class Output; 00031 class VisualFactory; 00032 00036 class Visual : public QWidget 00037 { 00038 Q_OBJECT 00039 public: 00044 Visual(QWidget *parent); 00048 virtual ~Visual(); 00056 virtual void add(unsigned char *data, qint64 size, int chan) = 0; 00061 virtual void clear() = 0; 00065 QMutex *mutex(); 00069 static QList<VisualFactory*> factories(); 00074 static QString file(VisualFactory *factory); 00080 static void setEnabled(VisualFactory* factory, bool enable = true); 00085 static bool isEnabled(VisualFactory* factory); 00089 static void add(Visual*visual); 00093 static void remove(Visual*); 00100 static void initialize(QWidget *parent, QObject *receiver = 0, const char *member = 0); 00104 static QList<Visual *> *visuals(); 00110 static void showSettings(VisualFactory *factory, QWidget *parent); 00111 00112 signals: 00116 void closedByUser(); 00117 00118 protected: 00123 virtual void closeEvent (QCloseEvent *event); 00124 00125 private: 00126 Decoder *m_decoder; 00127 Output *m_output; 00128 QMutex m_mutex; 00129 00130 static QList<VisualFactory*> *m_factories; 00131 static QHash <VisualFactory*, QString> *m_files; 00132 static void checkFactories(); 00133 static QList<Visual*> m_visuals; 00134 static QHash<VisualFactory*, Visual*> m_vis_map; //internal visualization 00135 static QWidget *m_parentWidget; 00136 static QObject *m_receiver; 00137 static const char *m_member; 00138 }; 00139 00140 #endif