mirror of https://github.com/mgba-emu/mgba.git
Qt: Sync light sensor window with current state
This commit is contained in:
parent
2c5d11539a
commit
943b805306
|
@ -489,6 +489,7 @@ void GameController::setLuminanceValue(uint8_t value) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
emit luminanceValueChanged(m_luxValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GameController::setLuminanceLevel(int level) {
|
void GameController::setLuminanceLevel(int level) {
|
||||||
|
|
|
@ -79,6 +79,8 @@ signals:
|
||||||
void gameFailed();
|
void gameFailed();
|
||||||
void stateLoaded(GBAThread*);
|
void stateLoaded(GBAThread*);
|
||||||
|
|
||||||
|
void luminanceValueChanged(int);
|
||||||
|
|
||||||
void postLog(int level, const QString& log);
|
void postLog(int level, const QString& log);
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
|
@ -109,6 +111,7 @@ public slots:
|
||||||
void reloadAudioDriver();
|
void reloadAudioDriver();
|
||||||
|
|
||||||
void setLuminanceValue(uint8_t value);
|
void setLuminanceValue(uint8_t value);
|
||||||
|
uint8_t luminanceValue() const { return m_luxValue; }
|
||||||
void setLuminanceLevel(int level);
|
void setLuminanceLevel(int level);
|
||||||
void increaseLuminanceLevel() { setLuminanceLevel(m_luxLevel + 1); }
|
void increaseLuminanceLevel() { setLuminanceLevel(m_luxLevel + 1); }
|
||||||
void decreaseLuminanceLevel() { setLuminanceLevel(m_luxLevel - 1); }
|
void decreaseLuminanceLevel() { setLuminanceLevel(m_luxLevel - 1); }
|
||||||
|
|
|
@ -31,12 +31,17 @@ SensorView::SensorView(GameController* controller, QWidget* parent)
|
||||||
connect(m_ui.timeNow, &QPushButton::clicked, [controller, this] () {
|
connect(m_ui.timeNow, &QPushButton::clicked, [controller, this] () {
|
||||||
m_ui.time->setDateTime(QDateTime::currentDateTime());
|
m_ui.time->setDateTime(QDateTime::currentDateTime());
|
||||||
});
|
});
|
||||||
|
|
||||||
|
connect(m_controller, SIGNAL(luminanceValueChanged(int)), this, SLOT(luminanceValueChanged(int)));
|
||||||
}
|
}
|
||||||
|
|
||||||
void SensorView::setLuminanceValue(int value) {
|
void SensorView::setLuminanceValue(int value) {
|
||||||
bool oldState;
|
|
||||||
value = std::max(0, std::min(value, 255));
|
value = std::max(0, std::min(value, 255));
|
||||||
|
m_controller->setLuminanceValue(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
void SensorView::luminanceValueChanged(int value) {
|
||||||
|
bool oldState;
|
||||||
oldState = m_ui.lightSpin->blockSignals(true);
|
oldState = m_ui.lightSpin->blockSignals(true);
|
||||||
m_ui.lightSpin->setValue(value);
|
m_ui.lightSpin->setValue(value);
|
||||||
m_ui.lightSpin->blockSignals(oldState);
|
m_ui.lightSpin->blockSignals(oldState);
|
||||||
|
@ -44,6 +49,4 @@ void SensorView::setLuminanceValue(int value) {
|
||||||
oldState = m_ui.lightSlide->blockSignals(true);
|
oldState = m_ui.lightSlide->blockSignals(true);
|
||||||
m_ui.lightSlide->setValue(value);
|
m_ui.lightSlide->setValue(value);
|
||||||
m_ui.lightSlide->blockSignals(oldState);
|
m_ui.lightSlide->blockSignals(oldState);
|
||||||
|
|
||||||
m_controller->setLuminanceValue(value);
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,6 +23,7 @@ public:
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void setLuminanceValue(int);
|
void setLuminanceValue(int);
|
||||||
|
void luminanceValueChanged(int);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::SensorView m_ui;
|
Ui::SensorView m_ui;
|
||||||
|
|
Loading…
Reference in New Issue