2 * Copyright (C) 2017 Canonical, Ltd.
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.
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.
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/>.
18#include "WorkspaceManager.h"
23Screen::Screen(qtmir::Screen* screen)
25 , m_workspaces(new WorkspaceModel)
27 QQmlEngine::setObjectOwnership(m_workspaces.data(), QQmlEngine::CppOwnership);
29 connect(m_wrapped, &qtmir::Screen::usedChanged, this, &Screen::usedChanged);
30 connect(m_wrapped, &qtmir::Screen::nameChanged, this, &Screen::nameChanged);
31 connect(m_wrapped, &qtmir::Screen::outputTypeChanged, this, &Screen::outputTypeChanged);
32 connect(m_wrapped, &qtmir::Screen::scaleChanged, this, &Screen::scaleChanged);
33 connect(m_wrapped, &qtmir::Screen::formFactorChanged, this, &Screen::formFactorChanged);
34 connect(m_wrapped, &qtmir::Screen::physicalSizeChanged, this, &Screen::physicalSizeChanged);
35 connect(m_wrapped, &qtmir::Screen::positionChanged, this, &Screen::positionChanged);
36 connect(m_wrapped, &qtmir::Screen::activeChanged, this, &Screen::activeChanged);
37 connect(m_wrapped, &qtmir::Screen::currentModeIndexChanged, this, &Screen::currentModeIndexChanged);
38 connect(m_wrapped, &qtmir::Screen::availableModesChanged, this, &Screen::availableModesChanged);
40 // Connect the active workspace to activate the screen.
41 connect(m_workspaces.data(), &WorkspaceModel::workspaceAdded, this, [this](Workspace* workspace) {
42 connect(workspace, &Workspace::activeChanged, this, [this](bool active) {
43 if (active) activate();
45 if (workspace->isActive()) activate();
47 connect(m_workspaces.data(), &WorkspaceModel::workspaceRemoved, this, [this](Workspace* workspace) {
48 disconnect(workspace, &Workspace::activeChanged, this, 0);
51 WorkspaceManager::instance()->createWorkspace()->assign(m_workspaces.data());
52 WorkspaceManager::instance()->createWorkspace()->assign(m_workspaces.data());
55Screen::Screen(const Screen &other)
56 : qtmir::Screen(nullptr)
57 , m_wrapped(other.m_wrapped)
58 , m_workspaces(new WorkspaceModelProxy(other.m_workspaces.data()))
60 QQmlEngine::setObjectOwnership(m_workspaces.data(), QQmlEngine::CppOwnership);
62 connect(m_wrapped, &qtmir::Screen::usedChanged, this, &Screen::usedChanged);
63 connect(m_wrapped, &qtmir::Screen::nameChanged, this, &Screen::nameChanged);
64 connect(m_wrapped, &qtmir::Screen::outputTypeChanged, this, &Screen::outputTypeChanged);
65 connect(m_wrapped, &qtmir::Screen::scaleChanged, this, &Screen::scaleChanged);
66 connect(m_wrapped, &qtmir::Screen::formFactorChanged, this, &Screen::formFactorChanged);
67 connect(m_wrapped, &qtmir::Screen::physicalSizeChanged, this, &Screen::physicalSizeChanged);
68 connect(m_wrapped, &qtmir::Screen::positionChanged, this, &Screen::positionChanged);
69 connect(m_wrapped, &qtmir::Screen::activeChanged, this, &Screen::activeChanged);
70 connect(m_wrapped, &qtmir::Screen::currentModeIndexChanged, this, &Screen::currentModeIndexChanged);
71 connect(m_wrapped, &qtmir::Screen::availableModesChanged, this, &Screen::availableModesChanged);
74qtmir::OutputId Screen::outputId() const
76 return m_wrapped->outputId();
79bool Screen::used() const
81 return m_wrapped->used();
84QString Screen::name() const
86 return m_wrapped->name();
89float Screen::scale() const
91 return m_wrapped->scale();
94QSizeF Screen::physicalSize() const
96 return m_wrapped->physicalSize();
99qtmir::FormFactor Screen::formFactor() const
101 return m_wrapped->formFactor();
104qtmir::OutputTypes Screen::outputType() const
106 return m_wrapped->outputType();
109MirPowerMode Screen::powerMode() const
111 return m_wrapped->powerMode();
114Qt::ScreenOrientation Screen::orientation() const
116 return m_wrapped->orientation();
119QPoint Screen::position() const
121 return m_wrapped->position();
124QQmlListProperty<qtmir::ScreenMode> Screen::availableModes()
126 return m_wrapped->availableModes();
129uint Screen::currentModeIndex() const
131 return m_wrapped->currentModeIndex();
134bool Screen::isActive() const
136 return m_wrapped->isActive();
139qtmir::ScreenConfiguration *Screen::beginConfiguration() const
141 return m_wrapped->beginConfiguration();
144bool Screen::applyConfiguration(qtmir::ScreenConfiguration *configuration)
146 return m_wrapped->applyConfiguration(configuration);
149WorkspaceModel *Screen::workspaces() const
151 return m_workspaces.data();
154void Screen::sync(Screen *proxy)
158 workspaces()->sync(proxy->workspaces());
161void Screen::activate()
166void Screen::setActive(bool active)
168 m_wrapped->setActive(active);
171QScreen *Screen::qscreen() const
173 return m_wrapped->qscreen();
176ScreenProxy::ScreenProxy(ScreenProxy::Screen *const screen)
182void ScreenProxy::addWorkspace()
184 (new WorkspaceProxy(WorkspaceManager::instance()->createWorkspace()))->assign(workspaces());
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list