VDPStatusRegViewer.h 1.7 KB

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