// qsamplerDeviceStatusForm.h // /**************************************************************************** Copyright (C) 2010-2020, rncbc aka Rui Nuno Capela. All rights reserved. Copyright (C) 2008,2019 Christian Schoenebeck This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. *****************************************************************************/ #ifndef __qsamplerDeviceStatusForm_h #define __qsamplerDeviceStatusForm_h #include "qsamplerDevice.h" #include #include #include #include #include #include namespace QSampler { class MidiActivityLED : public QLabel { Q_OBJECT public: MidiActivityLED(QString sText = QString(), QWidget *pParent = nullptr); ~MidiActivityLED(); void midiActivityLedOn(); protected slots: void midiActivityLedOff(); private: QTimer m_timer; // MIDI activity pixmap common resources. static int g_iMidiActivityRefCount; static QPixmap *g_pMidiActivityLedOn; static QPixmap *g_pMidiActivityLedOff; }; class DeviceStatusForm : public QWidget { Q_OBJECT public: DeviceStatusForm(int DeviceID, QWidget *pParent = nullptr, Qt::WindowFlags wflags = Qt::WindowFlags()); ~DeviceStatusForm(); QAction *visibleAction(); void midiArrived(int iPort); static DeviceStatusForm *getInstance(int iDeviceID); static const std::map& getInstances(); static void onDevicesChanged(); static void onDeviceChanged(int iDeviceID); static void deleteAllInstances(); protected: void closeEvent(QCloseEvent *pCloseEvent); void updateGUIPorts(); private: int m_DeviceID; Device *m_pDevice; QAction *m_pVisibleAction; std::vector m_midiActivityLEDs; static std::map g_instances; }; } // namespace QSampler #endif // __qsamplerDeviceStatusForm_h // end of qsamplerDeviceStatusForm.h