@@ -29,8 +29,16 @@ Screens::Screens(QObject *parent) :
29 bool ok = false;
29 bool ok = false;
30 int screenCount = qEnvironmentVariableIntValue("UNITY_MOCK_SCREEN_COUNT", &ok);
30 int screenCount = qEnvironmentVariableIntValue("UNITY_MOCK_SCREEN_COUNT", &ok);
31 if (!ok) screenCount = 1;
31 if (!ok) screenCount = 1;
32+ QPoint lastPoint(0,0);
32 for (int i = 0; i < screenCount; ++i) {
33 for (int i = 0; i < screenCount; ++i) {
34+ auto screen = new Screen();
35+ screen->enabled = i == 0;
36+ screen->name = QString("Monitor %1").arg(i);
37+ screen->sizes = { QSize(640,480), QSize(1024,748), QSize(1280,1024), QSize(1440,900), QSize(1920,1080) };
38+ screen->geometry = QRect(lastPoint.x(), lastPoint.y(), 1024, 786 );
33− m_screenList.append(new Screen());
39+ m_screenList.append(screen);
41+ lastPoint.rx() += screen->geometry.width();
@@ -45,6 +53,12 @@ QHash<int, QByteArray> Screens::roleNames() const
45 QHash<int, QByteArray> roles;
53 QHash<int, QByteArray> roles;
46 roles[ScreenRole] = "screen";
54 roles[ScreenRole] = "screen";
47 roles[OutputTypeRole] = "outputType";
55 roles[OutputTypeRole] = "outputType";
56+ roles[EnabledRole] = "enabled";
57+ roles[NameRole] = "name";
58+ roles[ScaleRole] = "scale";
59+ roles[FormFactorRole] = "formFactor";
60+ roles[GeometryRole] = "geometry";
61+ roles[SizesRole] = "sizes";
48 return roles;
62 return roles;
@@ -59,6 +73,25 @@ QVariant Screens::data(const QModelIndex &index, int role) const
59 return QVariant::fromValue(m_screenList.at(index.row())->qScreen);
73 return QVariant::fromValue(m_screenList.at(index.row())->qScreen);
60 case OutputTypeRole:
74 case OutputTypeRole:
61 return m_screenList.at(index.row())->outputTypes;
75 return m_screenList.at(index.row())->outputTypes;
77+ return m_screenList.at(index.row())->enabled;
79+ return m_screenList.at(index.row())->name;
81+ return m_screenList.at(index.row())->scale;
83+ return m_screenList.at(index.row())->formFactor;
85+ return m_screenList.at(index.row())->geometry;
89+ auto availableSizes = m_screenList.at(index.row())->sizes;
90+ Q_FOREACH(auto size, availableSizes) {
91+ sizes.append(QVariant(size));
64 return QVariant();
97 return QVariant();