mirror of
https://invent.kde.org/marcoa/shift-shell.git
synced 2026-07-26 06:14:45 +00:00
quicksettings/autorotate: Properly listen to external changes
This ensures that external changes to screen rotation are listened to and updated in the quicksetting. TODO: haven't actually tested on device yet
This commit is contained in:
parent
57a35ddd0c
commit
5decdbe2b5
2 changed files with 8 additions and 3 deletions
|
|
@ -22,8 +22,13 @@ ScreenRotationUtil::ScreenRotationUtil(QObject *parent)
|
||||||
{
|
{
|
||||||
connect(m_sensor, &QOrientationSensor::activeChanged, this, &ScreenRotationUtil::availableChanged);
|
connect(m_sensor, &QOrientationSensor::activeChanged, this, &ScreenRotationUtil::availableChanged);
|
||||||
|
|
||||||
|
connect(KScreen::ConfigMonitor::instance(), &KScreen::ConfigMonitor::configurationChanged, this, [this]() {
|
||||||
|
Q_EMIT autoScreenRotationEnabledChanged();
|
||||||
|
});
|
||||||
|
|
||||||
connect(new KScreen::GetConfigOperation(), &KScreen::GetConfigOperation::finished, this, [this](auto *op) {
|
connect(new KScreen::GetConfigOperation(), &KScreen::GetConfigOperation::finished, this, [this](auto *op) {
|
||||||
m_config = qobject_cast<KScreen::GetConfigOperation *>(op)->config();
|
m_config = qobject_cast<KScreen::GetConfigOperation *>(op)->config();
|
||||||
|
KScreen::ConfigMonitor::instance()->addConfig(m_config);
|
||||||
|
|
||||||
// update all screens with event connect
|
// update all screens with event connect
|
||||||
for (KScreen::OutputPtr output : m_config->outputs()) {
|
for (KScreen::OutputPtr output : m_config->outputs()) {
|
||||||
|
|
|
||||||
|
|
@ -29,8 +29,8 @@ Q_SIGNALS:
|
||||||
private:
|
private:
|
||||||
void actuallySetAutoScreenRotationEnabled(bool value);
|
void actuallySetAutoScreenRotationEnabled(bool value);
|
||||||
|
|
||||||
KScreen::ConfigPtr m_config;
|
KScreen::ConfigPtr m_config{nullptr};
|
||||||
QOrientationSensor *m_sensor;
|
QOrientationSensor *m_sensor{nullptr};
|
||||||
|
|
||||||
bool m_available;
|
bool m_available{false};
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue