on 17872af help sign in
65 lines 2.0 kB history raw
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 */
17#include "Screen.h"
18#include "WorkspaceModel.h"
19#include "WorkspaceManager.h"
20#include "Workspace.h"
22Screen::Screen()
23 : m_workspaces(new WorkspaceModel)
25 WorkspaceManager::instance()->createWorkspace()->assign(m_workspaces.data());
26 WorkspaceManager::instance()->createWorkspace()->assign(m_workspaces.data());
29QQmlListProperty<qtmir::ScreenMode> Screen::availableModes()
31 return QQmlListProperty<qtmir::ScreenMode>(this, m_sizes);
34qtmir::ScreenConfiguration *Screen::beginConfiguration() const
36 auto config = new qtmir::ScreenConfiguration;
37 config->valid = true;
38 config->id = m_id;
39 config->used = m_used;
40 config->topLeft = m_position;
41 config->currentModeIndex = m_currentModeIndex;
42 config->powerMode = m_powerMode;
43 config->scale = m_scale;
44 config->formFactor = m_formFactor;
45 return config;
48bool Screen::applyConfiguration(qtmir::ScreenConfiguration *configuration)
50 m_used = configuration->used;
51 m_position = configuration->topLeft;
52 m_currentModeIndex = configuration->currentModeIndex;
53 m_powerMode = configuration->powerMode;
54 m_scale = configuration->scale;
55 m_formFactor = configuration->formFactor;
57// m_orientation = configuration->orientation;
58 return true;
61void Screen::setActive(bool active)
63 m_active = active;
64 Q_EMIT activeChanged(active);