| 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 __CONTROLLER_H__ |
| 21 | #define __CONTROLLER_H__ |
| 22 | |
| 23 | #include "aboutview.h" |
| 24 | #include "application.h" |
| 25 | #include "configureview.h" |
| 26 | #include "engine.h" |
| 27 | #include "errorview.h" |
| 28 | #include "mainview.h" |
| 29 | #include "messageview.h" |
| 30 | |
| 31 | class Controller: public QObject { |
| 32 | |
| 33 | Q_OBJECT |
| 34 | |
| 35 | public: |
| 36 | |
| 37 | explicit |
| 38 | Controller(Application &application, QObject *parent=0); |
| 39 | |
| 40 | ~Controller(); |
| 41 | |
| 42 | void |
| 43 | run(); |
| 44 | |
| 45 | private slots: |
| 46 | |
| 47 | void |
| 48 | handleDriverChange(); |
| 49 | |
| 50 | void |
| 51 | handleMessageSend(const QString &message); |
| 52 | |
| 53 | void |
| 54 | handleReceivedMessage(quint64 timeStamp, const QByteArray &message); |
| 55 | |
| 56 | private: |
| 57 | |
| 58 | QString |
| 59 | getGenericDataDescription(const QByteArray &message, int lastIndex=-1); |
| 60 | |
| 61 | void |
| 62 | parseMessage(const QByteArray &message); |
| 63 | |
| 64 | void |
| 65 | showError(const QString &message); |
| 66 | |
| 67 | AboutView aboutView; |
| 68 | Application &application; |
| 69 | ConfigureView configureView; |
| 70 | QString dataDescription; |
| 71 | Engine engine; |
| 72 | ErrorView errorView; |
| 73 | MainView mainView; |
| 74 | MessageView messageView; |
| 75 | QString statusDescription; |
| 76 | bool valid; |
| 77 | |
| 78 | }; |
| 79 | |
| 80 | #endif |