2 * Copyright (C) 2015 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/>.
20#include <QGuiApplication>
23Screens::Screens(QObject *parent) :
24 QAbstractListModel(parent)
27 int screenCount = qEnvironmentVariableIntValue("UNITY_MOCK_SCREEN_COUNT", &ok);
28 if (!ok) screenCount = 1;
29 QPoint lastPoint(0,0);
30 for (int i = 0; i < screenCount; ++i) {
31 auto screen = new Screen();
32 screen->m_active = i == 0;
33 screen->m_name = QString("Monitor %1").arg(i);
34 screen->m_position = QPoint(lastPoint.x(), lastPoint.y());
35 screen->m_sizes.append(new ScreenMode(50, QSize(640,480)));
36 screen->m_sizes.append(new ScreenMode(60, QSize(1280,1024)));
37 screen->m_sizes.append(new ScreenMode(60, QSize(1440,900)));
38 screen->m_sizes.append(new ScreenMode(60, QSize(1920,1080)));
39 screen->m_currentModeIndex = 3;
40 screen->m_physicalSize = QSize(800,568);
41 m_screenList.append(screen);
43 lastPoint.rx() += screen->m_sizes[screen->m_currentModeIndex]->size.width();
47Screens::~Screens() noexcept
49 qDeleteAll(m_screenList);
53QHash<int, QByteArray> Screens::roleNames() const
55 QHash<int, QByteArray> roles;
56 roles[ScreenRole] = "screen";
60QVariant Screens::data(const QModelIndex &index, int role) const
62 if (!index.isValid() || index.row() >= m_screenList.size()) {
68 return QVariant::fromValue(m_screenList.at(index.row()));
74int Screens::rowCount(const QModelIndex &) const
79int Screens::count() const
81 return m_screenList.size();
84void Screens::activateScreen(int)
86 qWarning("Not Implemented");
89Screen::Screen(QObject* parent)
100QQmlListProperty<ScreenMode> Screen::availableModes()
102 return QQmlListProperty<ScreenMode>(this, m_sizes);
105Screen *Screen::beginConfiguration()
107 qWarning("Not Implemented");
111void Screen::applyConfiguration()
113 qWarning("Not Implemented");
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