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"
21Screen::Screen(qtmir::Screen* screen)
23 , m_workspaces(new WorkspaceModel)
25 connect(m_wrapped, &qtmir::Screen::usedChanged, this, &Screen::usedChanged);
26 connect(m_wrapped, &qtmir::Screen::nameChanged, this, &Screen::nameChanged);
27 connect(m_wrapped, &qtmir::Screen::outputTypeChanged, this, &Screen::outputTypeChanged);
28 connect(m_wrapped, &qtmir::Screen::scaleChanged, this, &Screen::scaleChanged);
29 connect(m_wrapped, &qtmir::Screen::formFactorChanged, this, &Screen::formFactorChanged);
30 connect(m_wrapped, &qtmir::Screen::physicalSizeChanged, this, &Screen::physicalSizeChanged);
31 connect(m_wrapped, &qtmir::Screen::positionChanged, this, &Screen::positionChanged);
32 connect(m_wrapped, &qtmir::Screen::activeChanged, this, &Screen::activeChanged);
33 connect(m_wrapped, &qtmir::Screen::currentModeIndexChanged, this, &Screen::currentModeIndexChanged);
34 connect(m_wrapped, &qtmir::Screen::availableModesChanged, this, &Screen::availableModesChanged);
36 // Connect the active workspace to activate the screen.
37 connect(m_workspaces.data(), &WorkspaceModel::workspaceAdded, this, [this](Workspace* workspace) {
38 connect(workspace, &Workspace::activeChanged, this, [this](bool active) {
39 if (active) activate();
41 if (workspace->isActive()) activate();
43 connect(m_workspaces.data(), &WorkspaceModel::workspaceRemoved, this, [this](Workspace* workspace) {
44 disconnect(workspace, &Workspace::activeChanged, this, 0);
47 WorkspaceManager::instance()->createWorkspace()->assign(m_workspaces.data());
48 WorkspaceManager::instance()->createWorkspace()->assign(m_workspaces.data());
51Screen::Screen(const Screen &other)
52 : qtmir::Screen(nullptr)
53 , m_wrapped(other.m_wrapped)
54 , m_workspaces(new WorkspaceModelProxy(other.m_workspaces.data()))
56 connect(m_wrapped, &qtmir::Screen::usedChanged, this, &Screen::usedChanged);
57 connect(m_wrapped, &qtmir::Screen::nameChanged, this, &Screen::nameChanged);
58 connect(m_wrapped, &qtmir::Screen::outputTypeChanged, this, &Screen::outputTypeChanged);
59 connect(m_wrapped, &qtmir::Screen::scaleChanged, this, &Screen::scaleChanged);
60 connect(m_wrapped, &qtmir::Screen::formFactorChanged, this, &Screen::formFactorChanged);
61 connect(m_wrapped, &qtmir::Screen::physicalSizeChanged, this, &Screen::physicalSizeChanged);
62 connect(m_wrapped, &qtmir::Screen::positionChanged, this, &Screen::positionChanged);
63 connect(m_wrapped, &qtmir::Screen::activeChanged, this, &Screen::activeChanged);
64 connect(m_wrapped, &qtmir::Screen::currentModeIndexChanged, this, &Screen::currentModeIndexChanged);
65 connect(m_wrapped, &qtmir::Screen::availableModesChanged, this, &Screen::availableModesChanged);
68qtmir::OutputId Screen::outputId() const
70 return m_wrapped->outputId();
73bool Screen::used() const
75 return m_wrapped->used();
78QString Screen::name() const
80 return m_wrapped->name();
83float Screen::scale() const
85 return m_wrapped->scale();
88QSizeF Screen::physicalSize() const
90 return m_wrapped->physicalSize();
93qtmir::FormFactor Screen::formFactor() const
95 return m_wrapped->formFactor();
98qtmir::OutputTypes Screen::outputType() const
100 return m_wrapped->outputType();
103MirPowerMode Screen::powerMode() const
105 return m_wrapped->powerMode();
108Qt::ScreenOrientation Screen::orientation() const
110 return m_wrapped->orientation();
113QPoint Screen::position() const
115 return m_wrapped->position();
118QQmlListProperty<qtmir::ScreenMode> Screen::availableModes()
120 return m_wrapped->availableModes();
123uint Screen::currentModeIndex() const
125 return m_wrapped->currentModeIndex();
128bool Screen::isActive() const
130 return m_wrapped->isActive();
133qtmir::ScreenConfiguration *Screen::beginConfiguration() const
135 return m_wrapped->beginConfiguration();
138bool Screen::applyConfiguration(qtmir::ScreenConfiguration *configuration)
140 return m_wrapped->applyConfiguration(configuration);
143WorkspaceModel *Screen::workspaces() const
145 return m_workspaces.data();
148void Screen::sync(Screen *proxy)
152 workspaces()->sync(proxy->workspaces());
155void Screen::activate()
160void Screen::setActive(bool active)
162 m_wrapped->setActive(active);
165QScreen *Screen::qscreen() const
167 return m_wrapped->qscreen();
170ScreenProxy::ScreenProxy(ScreenProxy::Screen *const screen)
176void ScreenProxy::addWorkspace()
178 (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