diff options
Diffstat (limited to 'qmidiplayer-desktop/qmpchannelswindow.hpp')
-rw-r--r-- | qmidiplayer-desktop/qmpchannelswindow.hpp | 50 |
1 files changed, 39 insertions, 11 deletions
diff --git a/qmidiplayer-desktop/qmpchannelswindow.hpp b/qmidiplayer-desktop/qmpchannelswindow.hpp index 207ee8d..ab3227f 100644 --- a/qmidiplayer-desktop/qmpchannelswindow.hpp +++ b/qmidiplayer-desktop/qmpchannelswindow.hpp @@ -8,6 +8,8 @@ #include <QShowEvent> #include <QCloseEvent> #include <QMoveEvent> +#include <QAbstractTableModel> +#include <QStyledItemDelegate> #include "qmppresetselect.hpp" #include "qmpchanneleditor.hpp" #include "../core/qmpmidiplay.hpp" @@ -60,6 +62,42 @@ class qmpChannelFunc:public qmpFuncBaseIntf void close(); }; +class qmpChannelsModel:public QAbstractTableModel +{ + Q_OBJECT + public: + explicit qmpChannelsModel(QObject*parent=nullptr); + int columnCount(const QModelIndex&parent=QModelIndex())const override; + int rowCount(const QModelIndex&parent=QModelIndex())const override; + QModelIndex parent(const QModelIndex&child)const override; + QVariant data(const QModelIndex&index,int role=Qt::ItemDataRole::DisplayRole)const override; + QVariant headerData(int section,Qt::Orientation orientation,int role=Qt::ItemDataRole::DisplayRole)const override; + Qt::ItemFlags flags(const QModelIndex&idx)const override; + public slots: + void updateChannelActivity(); + void channelMSClicked(const QModelIndex&idx); + void channelMSClearAll(int type); + private: + int evh; + bool updatequeued; + bool mute[16],solo[16]; +}; + +class qmpDeviceItemDelegate:public QStyledItemDelegate +{ + Q_OBJECT + public: + explicit qmpDeviceItemDelegate(QWidget*parent=nullptr); + void paint(QPainter*painter,const QStyleOptionViewItem&option,const QModelIndex&index)const override; + QSize sizeHint(const QStyleOptionViewItem&option,const QModelIndex&index)const override; + QWidget* createEditor(QWidget*parent,const QStyleOptionViewItem&option,const QModelIndex&index)const override; + void setEditorData(QWidget*editor,const QModelIndex&index)const override; + void setModelData(QWidget*editor,QAbstractItemModel*model,const QModelIndex&index)const override; + void updateEditorGeometry(QWidget*editor,const QStyleOptionViewItem&option,const QModelIndex&index)const override; + private: + QWidget *par; +}; + class qmpChannelsWindow:public QWidget { Q_OBJECT @@ -69,32 +107,22 @@ class qmpChannelsWindow:public QWidget ~qmpChannelsWindow(); void showEvent(QShowEvent *event); void closeEvent(QCloseEvent *event); - void resetAcitivity(); public slots: - void channelWindowsUpdate(); - void updateChannelActivity(); - void channelMSChanged(); - void showPresetWindow(int chid,int col); void showChannelEditorWindow(int chid); - void changeMidiMapping(int chid,int idx); void on_pbUnmute_clicked(); void on_pbUnsolo_clicked(); signals: void noteOn(); - protected: - bool eventFilter(QObject *o,QEvent *e); - private: Ui::qmpChannelsWindow *ui; qmpPresetSelector *pselectw; qmpChannelEditor *ceditw; + qmpChannelsModel *chmodel; QIcon *cha,*chi; qmpChannelFunc *chnlf; int eh; - //callback fuse... (avoid black midi blocking the main thread) - int callbacksc,cbcnt,fused; }; #endif // QMPCHANNELSWINDOW_H |