| 1 | /* |
| 2 | * midisnoop - MIDI monitor and prober |
| 3 | * Copyright (C) 2012 Devin Anderson |
| 4 | * |
| 5 | * This program is free software; you can redistribute it and/or modify it |
| 6 | * under the terms of the GNU General Public License as published by the Free |
| 7 | * Software Foundation; either version 2 of the License, or (at your option) |
| 8 | * any later version. |
| 9 | * |
| 10 | * This program is distributed in the hope that it will be useful, but WITHOUT |
| 11 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
| 12 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for |
| 13 | * more details. |
| 14 | * |
| 15 | * You should have received a copy of the GNU General Public License along with |
| 16 | * this program; if not, write to the Free Software Foundation, Inc., 675 Mass |
| 17 | * Ave, Cambridge, MA 02139, USA. |
| 18 | */ |
| 19 | |
| 20 | #ifndef __MAINVIEW_H__ |
| 21 | #define __MAINVIEW_H__ |
| 22 | |
| 23 | #include <QtGui/QStandardItemModel> |
| 24 | #include <QtWidgets/QAction> |
| 25 | #include <QtWidgets/QMainWindow> |
| 26 | #include <QtWidgets/QTableView> |
| 27 | |
| 28 | #include "designerview.h" |
| 29 | #include "messagetabledelegate.h" |
| 30 | |
| 31 | class MainView: public DesignerView { |
| 32 | |
| 33 | Q_OBJECT |
| 34 | |
| 35 | public: |
| 36 | |
| 37 | explicit |
| 38 | MainView(QObject *parent=0); |
| 39 | |
| 40 | ~MainView(); |
| 41 | |
| 42 | public slots: |
| 43 | |
| 44 | void |
| 45 | addReceivedMessage(quint64 timeStamp, const QString &statusDescription, |
| 46 | const QString &dataDescription, bool valid); |
| 47 | |
| 48 | void |
| 49 | addSentMessage(quint64 timeStamp, const QString &statusDescription, |
| 50 | const QString &dataDescription, bool valid); |
| 51 | |
| 52 | void |
| 53 | clearMessages(); |
| 54 | |
| 55 | void |
| 56 | setMessageSendEnabled(bool enabled); |
| 57 | |
| 58 | signals: |
| 59 | |
| 60 | void |
| 61 | aboutRequest(); |
| 62 | |
| 63 | void |
| 64 | addMessageRequest(); |
| 65 | |
| 66 | void |
| 67 | clearMessagesRequest(); |
| 68 | |
| 69 | void |
| 70 | configureRequest(); |
| 71 | |
| 72 | private: |
| 73 | |
| 74 | enum MessageTableColumn { |
| 75 | MESSAGETABLECOLUMN_TIMESTAMP = 0, |
| 76 | MESSAGETABLECOLUMN_STATUS = 1, |
| 77 | MESSAGETABLECOLUMN_DATA = 2, |
| 78 | |
| 79 | MESSAGETABLECOLUMN_TOTAL = 3 |
| 80 | }; |
| 81 | |
| 82 | int |
| 83 | addMessage(quint64 timeStamp, const QString &statusDescription, |
| 84 | const QString &dataDescription, bool valid); |
| 85 | |
| 86 | void |
| 87 | setModelData(int row, int column, const QVariant &value, |
| 88 | int role=Qt::DisplayRole); |
| 89 | |
| 90 | QAction *aboutAction; |
| 91 | QAction *addAction; |
| 92 | QAction *clearAction; |
| 93 | QAction *configureAction; |
| 94 | MessageTableDelegate tableDelegate; |
| 95 | QAction *quitAction; |
| 96 | QStandardItemModel tableModel; |
| 97 | QTableView *tableView; |
| 98 | |
| 99 | }; |
| 100 | |
| 101 | #endif |