| 1 | #ifndef VDPSTATUSREGVIEWER_H |
| 2 | #define VDPSTATUSREGVIEWER_H |
| 3 | |
| 4 | #include "SimpleHexRequest.h" |
| 5 | #include "ui_VDPStatusRegisters.h" |
| 6 | #include <QList> |
| 7 | #include <QDialog> |
| 8 | #include <cstdint> |
| 9 | |
| 10 | /** The highlightDispatcher serves 2 purposes for the InteractiveLabel widgets |
| 11 | * a) keep a correct state: Assume widget A and B are related (both are |
| 12 | * highlighted at the same time) and they are touching each other. I don't |
| 13 | * think that there is a guaranteed order in the enterEvent,leaveEvent, so if |
| 14 | * we use the MouseOver signal to connect to the highlight slots of A and B |
| 15 | * then this sequence might arise if our mouse moves from A to B and produce |
| 16 | * a wrong result: |
| 17 | * B.mouseOver(true); A.mouseOver(false) -> highlights are false for both A and B. |
| 18 | * |
| 19 | * b) serve as a central hub (star toplogy) to dispatch events from one widget |
| 20 | * to all others. This way all InteractiveLabel widgets only need to connect |
| 21 | * to this highlightDispatcher |
| 22 | */ |
| 23 | class highlightDispatcher : public QObject |
| 24 | { |
| 25 | Q_OBJECT |
| 26 | public: |
| 27 | highlightDispatcher(); |
| 28 | |
| 29 | void receiveState(bool state); |
| 30 | |
| 31 | signals: |
| 32 | void stateDispatched(bool state); |
| 33 | |
| 34 | private: |
| 35 | int counter; |
| 36 | }; |
| 37 | |
| 38 | class VDPStatusRegViewer : public QDialog, public SimpleHexRequestUser, |
| 39 | private Ui::VDPStatusRegisters |
| 40 | { |
| 41 | Q_OBJECT |
| 42 | public: |
| 43 | VDPStatusRegViewer(QWidget* parent = nullptr); |
| 44 | |
| 45 | void refresh(); |
| 46 | |
| 47 | private: |
| 48 | void decodeVDPStatusRegs(); |
| 49 | void connectHighLights(); |
| 50 | void doConnect(InteractiveLabel* lab, highlightDispatcher* dis); |
| 51 | void makeGroup(QList<InteractiveLabel*> list, InteractiveLabel* explained); |
| 52 | |
| 53 | void DataHexRequestReceived() override; |
| 54 | |
| 55 | private: |
| 56 | uint8_t statusregs[16]; |
| 57 | }; |
| 58 | |
| 59 | #endif // VDPSTATUSREGVIEWER_H |