@@ -0,0 +1,124 @@
1+/*
2+ * Copyright (C) 2017 Canonical, Ltd.
3+ *
4+ * This program is free software: you can redistribute it and/or modify it under
5+ * the terms of the GNU Lesser General Public License version 3, as published by
6+ * the Free Software Foundation.
7+ *
8+ * This program is distributed in the hope that it will be useful, but WITHOUT
9+ * ANY WARRANTY; without even the implied warranties of MERCHANTABILITY,
10+ * SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11+ * Lesser General Public License for more details.
12+ *
13+ * You should have received a copy of the GNU Lesser General Public License
14+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
15+ */
16+
17+#include "Screen.h"
18+#include "WorkspaceModel.h"
19+#include "WorkspaceManager.h"
20+#include "Workspace.h"
21+
22+Screen::Screen(qtmir::Screen* screen)
23+ : m_wrapped(screen)
24+ , m_workspaces(new WorkspaceModel)
25+{
26+ connect(m_wrapped, &qtmir::Screen::usedChanged, this, &Screen::usedChanged);
27+ connect(m_wrapped, &qtmir::Screen::nameChanged, this, &Screen::nameChanged);
28+ connect(m_wrapped, &qtmir::Screen::outputTypeChanged, this, &Screen::outputTypeChanged);
29+ connect(m_wrapped, &qtmir::Screen::scaleChanged, this, &Screen::scaleChanged);
30+ connect(m_wrapped, &qtmir::Screen::formFactorChanged, this, &Screen::formFactorChanged);
31+ connect(m_wrapped, &qtmir::Screen::physicalSizeChanged, this, &Screen::physicalSizeChanged);
32+ connect(m_wrapped, &qtmir::Screen::positionChanged, this, &Screen::positionChanged);
33+ connect(m_wrapped, &qtmir::Screen::activeChanged, this, &Screen::activeChanged);
34+ connect(m_wrapped, &qtmir::Screen::currentModeIndexChanged, this, &Screen::currentModeIndexChanged);
35+ connect(m_wrapped, &qtmir::Screen::availableModesChanged, this, &Screen::availableModesChanged);
36+
37+ WorkspaceManager::instance()->createWorkspace()->assign(m_workspaces.data());
38+ WorkspaceManager::instance()->createWorkspace()->assign(m_workspaces.data());
39+}
40+
41+qtmir::OutputId Screen::outputId() const
42+{
43+ return m_wrapped->outputId();
44+}
45+
46+bool Screen::used() const
47+{
48+ return m_wrapped->used();
49+}
50+
51+QString Screen::name() const
52+{
53+ return m_wrapped->name();
54+}
55+
56+float Screen::scale() const
57+{
58+ return m_wrapped->scale();
59+}
60+
61+QSizeF Screen::physicalSize() const
62+{
63+ return m_wrapped->physicalSize();
64+}
65+
66+qtmir::FormFactor Screen::formFactor() const
67+{
68+ return m_wrapped->formFactor();
69+}
70+
71+qtmir::OutputTypes Screen::outputType() const
72+{
73+ return m_wrapped->outputType();
74+}
75+
76+MirPowerMode Screen::powerMode() const
77+{
78+ return m_wrapped->powerMode();
79+}
80+
81+Qt::ScreenOrientation Screen::orientation() const
82+{
83+ return m_wrapped->orientation();
84+}
85+
86+QPoint Screen::position() const
87+{
88+ return m_wrapped->position();
89+}
90+
91+QQmlListProperty<qtmir::ScreenMode> Screen::availableModes()
92+{
93+ return m_wrapped->availableModes();
94+}
95+
96+uint Screen::currentModeIndex() const
97+{
98+ return m_wrapped->currentModeIndex();
99+}
100+
101+bool Screen::isActive() const
102+{
103+ return m_wrapped->isActive();
104+}
105+
106+qtmir::ScreenConfiguration *Screen::beginConfiguration() const
107+{
108+ return m_wrapped->beginConfiguration();
109+}
110+
111+bool Screen::applyConfiguration(qtmir::ScreenConfiguration *configuration)
112+{
113+ return m_wrapped->applyConfiguration(configuration);
114+}
115+
116+void Screen::setActive(bool active)
117+{
118+ m_wrapped->setActive(active);
119+}
120+
121+QScreen *Screen::qscreen() const
122+{
123+ return m_wrapped->qscreen();
124+}