mirror of
https://github.com/TomHarte/CLK.git
synced 2025-02-16 18:30:32 +00:00
Introduces a presentation flag for LEDs.
All existing receivers ignore it.
This commit is contained in:
parent
2731ca8c92
commit
52ea3b741c
@ -23,8 +23,12 @@ namespace Activity {
|
||||
*/
|
||||
class Observer {
|
||||
public:
|
||||
enum LEDPresentation: uint8_t {
|
||||
Persistent = (1 << 0),
|
||||
};
|
||||
|
||||
/// Announces to the receiver that there is an LED of name @c name.
|
||||
virtual void register_led([[maybe_unused]] const std::string &name) {}
|
||||
virtual void register_led([[maybe_unused]] const std::string &name, [[maybe_unused]] uint8_t presentation = 0) {}
|
||||
|
||||
/// Announces to the receiver that there is a drive of name @c name.
|
||||
///
|
||||
|
@ -607,7 +607,7 @@ template <bool has_scsi_bus> class ConcreteMachine:
|
||||
void set_activity_observer(Activity::Observer *observer) final {
|
||||
activity_observer_ = observer;
|
||||
if(activity_observer_) {
|
||||
activity_observer_->register_led(caps_led);
|
||||
activity_observer_->register_led(caps_led, Activity::Observer::LEDPresentation::Persistent);
|
||||
activity_observer_->set_led_status(caps_led, caps_led_state_);
|
||||
}
|
||||
|
||||
|
@ -61,7 +61,7 @@ struct SpeakerDelegate: public Outputs::Speaker::Speaker::Delegate, public LockP
|
||||
};
|
||||
|
||||
struct ActivityObserver: public Activity::Observer {
|
||||
void register_led(const std::string &name) final {
|
||||
void register_led(const std::string &name, uint8_t) final {
|
||||
[machine addLED:[NSString stringWithUTF8String:name.c_str()]];
|
||||
}
|
||||
|
||||
|
@ -1323,7 +1323,7 @@ void MainWindow::addActivityObserver() {
|
||||
activitySource->set_activity_observer(this);
|
||||
}
|
||||
|
||||
void MainWindow::register_led(const std::string &name) {
|
||||
void MainWindow::register_led(const std::string &name, uint8_t) {
|
||||
std::lock_guard guard(ledStatusesLock);
|
||||
ledStatuses[name] = false;
|
||||
QMetaObject::invokeMethod(this, "updateStatusBarText");
|
||||
|
@ -152,7 +152,7 @@ class MainWindow : public QMainWindow, public Outputs::Speaker::Speaker::Delegat
|
||||
|
||||
KeyboardMapper keyMapper;
|
||||
|
||||
void register_led(const std::string &) override;
|
||||
void register_led(const std::string &, uint8_t) override;
|
||||
void set_led_status(const std::string &, bool) override;
|
||||
|
||||
std::recursive_mutex ledStatusesLock;
|
||||
|
@ -271,7 +271,7 @@ class ActivityObserver: public Activity::Observer {
|
||||
|
||||
private:
|
||||
std::vector<std::string> leds_;
|
||||
void register_led(const std::string &name) final {
|
||||
void register_led(const std::string &name, uint8_t) final {
|
||||
std::lock_guard lock_guard(mutex);
|
||||
leds_.push_back(name);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user