Files
86Box/src/qt/qt_machinestatus.hpp

56 lines
1.4 KiB
C++
Raw Normal View History

2021-11-28 20:49:05 +01:00
#ifndef QT_MACHINESTATUS_HPP
#define QT_MACHINESTATUS_HPP
#include <QWidget>
#include <QLabel>
#include <QMouseEvent>
2021-11-28 20:49:05 +01:00
2021-12-16 22:30:48 +01:00
#include <memory>
class QStatusBar;
2021-11-28 20:49:05 +01:00
class ClickableLabel : public QLabel {
Q_OBJECT;
public:
explicit ClickableLabel(QWidget* parent = nullptr)
: QLabel(parent) {}
~ClickableLabel() {};
signals:
void clicked(QPoint);
2021-12-14 01:02:08 +06:00
void doubleClicked(QPoint);
protected:
void mousePressEvent(QMouseEvent* event) override { emit clicked(event->globalPos()); }
2021-12-14 01:02:08 +06:00
void mouseDoubleClickEvent(QMouseEvent* event) override { emit doubleClicked(event->globalPos()); }
};
class MachineStatus : public QObject
2021-11-28 20:49:05 +01:00
{
Q_OBJECT
public:
explicit MachineStatus(QObject *parent = nullptr);
2021-11-28 20:49:05 +01:00
~MachineStatus();
static bool hasCassette();
static bool hasIDE();
static bool hasSCSI();
static void iterateFDD(const std::function<void(int i)>& cb);
static void iterateCDROM(const std::function<void(int i)>& cb);
static void iterateZIP(const std::function<void(int i)>& cb);
static void iterateMO(const std::function<void(int i)>& cb);
2021-11-28 20:49:05 +01:00
public slots:
void refresh(QStatusBar* sbar);
2021-11-28 20:49:05 +01:00
void setActivity(int tag, bool active);
void setEmpty(int tag, bool active);
void message(const QString& msg);
void updateTip(int tag);
2021-11-28 20:49:05 +01:00
private:
struct States;
std::unique_ptr<States> d;
};
#endif // QT_MACHINESTATUS_HPP