Changeset View
Changeset View
Standalone View
Standalone View
kded/config.cpp
Show All 11 Lines | |||||
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
13 | GNU General Public License for more details. | 13 | GNU General Public License for more details. | ||
14 | 14 | | |||
15 | You should have received a copy of the GNU General Public License | 15 | You should have received a copy of the GNU General Public License | ||
16 | along with this program. If not, see <http://www.gnu.org/licenses/>. | 16 | along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
17 | *********************************************************************/ | 17 | *********************************************************************/ | ||
18 | #include "config.h" | 18 | #include "config.h" | ||
19 | #include "output.h" | 19 | #include "output.h" | ||
20 | #include "../common/globals.h" | | |||
21 | #include "../common/control.h" | 20 | #include "../common/control.h" | ||
22 | #include "kscreen_daemon_debug.h" | 21 | #include "kscreen_daemon_debug.h" | ||
23 | #include "device.h" | 22 | #include "device.h" | ||
24 | 23 | | |||
25 | #include <QFile> | 24 | #include <QFile> | ||
26 | #include <QStandardPaths> | 25 | #include <QStandardPaths> | ||
27 | #include <QRect> | 26 | #include <QRect> | ||
28 | #include <QJsonDocument> | 27 | #include <QJsonDocument> | ||
Show All 34 Lines | |||||
63 | } | 62 | } | ||
64 | 63 | | |||
65 | void Config::activateControlWatching() | 64 | void Config::activateControlWatching() | ||
66 | { | 65 | { | ||
67 | connect(m_control, &ControlConfig::changed, this, &Config::controlChanged); | 66 | connect(m_control, &ControlConfig::changed, this, &Config::controlChanged); | ||
68 | m_control->activateWatcher(); | 67 | m_control->activateWatcher(); | ||
69 | } | 68 | } | ||
70 | 69 | | |||
70 | bool Config::autoRotationRequested() const | ||||
71 | { | ||||
72 | for (KScreen::OutputPtr &output : m_data->outputs()) { | ||||
73 | if (m_control->getAutoRotate(output)) { | ||||
74 | return true; | ||||
75 | } | ||||
76 | } | ||||
77 | return false; | ||||
78 | } | ||||
79 | | ||||
80 | void Config::setDeviceOrientation(QOrientationReading::Orientation orientation) | ||||
81 | { | ||||
82 | for (KScreen::OutputPtr &output : m_data->outputs()) { | ||||
83 | if (!m_control->getAutoRotate(output)) { | ||||
84 | continue; | ||||
85 | } | ||||
86 | if (Output::updateOrientation(output, orientation)) { | ||||
87 | // TODO: call Layouter to find fitting positions for other outputs again | ||||
88 | return; | ||||
89 | } | ||||
90 | } | ||||
91 | } | ||||
92 | | ||||
71 | bool Config::fileExists() const | 93 | bool Config::fileExists() const | ||
72 | { | 94 | { | ||
73 | return (QFile::exists(configsDirPath() % id()) || QFile::exists(configsDirPath() % s_fixedConfigFileName)); | 95 | return (QFile::exists(configsDirPath() % id()) || QFile::exists(configsDirPath() % s_fixedConfigFileName)); | ||
74 | } | 96 | } | ||
75 | 97 | | |||
76 | std::unique_ptr<Config> Config::readFile() | 98 | std::unique_ptr<Config> Config::readFile() | ||
77 | { | 99 | { | ||
78 | if (Device::self()->isLaptop() && !Device::self()->isLidClosed()) { | 100 | if (Device::self()->isLaptop() && !Device::self()->isLidClosed()) { | ||
▲ Show 20 Lines • Show All 172 Lines • Show Last 20 Lines |