2 * Copyright (C) 2015 Canonical, Ltd.
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; version 3.
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
22#include <QtQuick/private/qquickitem_p.h>
23#include <QtQuick/private/qquickrectangle_p.h>
24#include <QtQuick/private/qquicktext_p.h>
29ShellView::ShellView(QQmlEngine *engine, QObject *qmlArgs)
30 : QQuickView(engine, nullptr)
32 setResizeMode(QQuickView::SizeRootObjectToView);
34 setTitle(QStringLiteral("Unity8"));
36 rootContext()->setContextProperty(QStringLiteral("applicationArguments"), qmlArgs);
38 connect(this, &QQuickView::statusChanged, this, [this] {
39 if (status() == QQuickView::Error) {
40 QQuickRectangle *rect = new QQuickRectangle(contentItem());
41 rect->setColor(Qt::white);
42 QQuickItemPrivate::get(rect)->anchors()->setFill(contentItem());
45 for(const QQmlError &e: errors()) {
46 errorsString += e.toString() + "\n";
48 QQuickText *text = new QQuickText(rect);
49 text->setColor(Qt::black);
50 text->setWrapMode(QQuickText::Wrap);
51 text->setText(QString("There was an error loading Unity8:\n%1").arg(errorsString));
52 QQuickItemPrivate::get(text)->anchors()->setFill(rect);
57 QUrl source(::qmlDirectory() + "/OrientedShell.qml");
60 connect(this, &QWindow::widthChanged, this, &ShellView::onWidthChanged);
61 connect(this, &QWindow::heightChanged, this, &ShellView::onHeightChanged);
64void ShellView::onWidthChanged(int w)
66 // For good measure in case SizeRootObjectToView doesn't fulfill its promise.
68 // There's at least one situation that's know to leave the root object with an outdated size.
69 // (really looks like Qt bug)
70 // Happens when starting unity8 with an external monitor already connected.
71 // The QResizeEvent we get still has the size of the first screen and since the resize move is triggered
72 // from the resize event handler, the root item doesn't get resized.
73 // TODO: Confirm the Qt bug and submit a patch upstream
75 rootObject()->setWidth(w);
79void ShellView::onHeightChanged(int h)
81 // See comment in ShellView::onWidthChanged()
83 rootObject()->setHeight(h);
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