2 * Copyright (C) 2016 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/>.
17#include "WindowManagerPlugin.h"
19#include "MockScreens.h"
20#include "MockScreenWindow.h"
22#include "ScreenAttached.h"
24#include "TopLevelWindowModel.h"
26#include "WorkspaceManager.h"
28#include "WorkspaceModel.h"
29#include "WindowManagementPolicy.h"
30#include "WindowManagerObjects.h"
31#include "ScreensConfiguration.h"
35static const QString notInstantiatable = QStringLiteral("Not instantiatable");
37static QObject *workspace_manager(QQmlEngine *engine, QJSEngine *scriptEngine)
40 Q_UNUSED(scriptEngine)
41 return WorkspaceManager::instance();
43QObject* screensSingleton(QQmlEngine* engine, QJSEngine* scriptEngine) {
45 Q_UNUSED(scriptEngine);
46 return ConcreteScreens::self();
48QObject* objectsSingleton(QQmlEngine* engine, QJSEngine* scriptEngine) {
50 Q_UNUSED(scriptEngine);
51 return WindowManagerObjects::instance();
54void WindowManagerPlugin::registerTypes(const char *uri)
56 qmlRegisterSingletonType<WorkspaceManager>(uri, 1, 0, "WorkspaceManager", workspace_manager);
57 qmlRegisterUncreatableType<WorkspaceModel>(uri, 1, 0, "WorkspaceModel", notInstantiatable);
58 qmlRegisterSingletonType<ConcreteScreens>(uri, 1, 0, "Screens", screensSingleton);
59 qmlRegisterUncreatableType<qtmir::ScreenMode>(uri, 1, 0, "ScreenMode", notInstantiatable);
60 qmlRegisterSingletonType<WindowManagerObjects>(uri, 1, 0, "WindowManagerObjects", objectsSingleton);
62 qRegisterMetaType<ConcreteScreen*>("ConcreteScreen*");
63 qRegisterMetaType<ProxyScreens*>("ProxyScreens*");
64 qRegisterMetaType<Workspace*>("Workspace*");
65 qRegisterMetaType<TopLevelWindowModel*>("TopLevelWindowModel*");
67 qRegisterMetaType<Window*>("Window*");
68 qRegisterMetaType<QAbstractListModel*>("QAbstractListModel*");
70 qmlRegisterType<MockScreenWindow>(uri, 1, 0, "ScreenWindow");
71 qmlRegisterRevision<QWindow,1>(uri, 1, 0);
73 qmlRegisterUncreatableType<WMScreen>(uri, 1, 0, "WMScreen", notInstantiatable);
76void WindowManagerPlugin::initializeEngine(QQmlEngine *engine, const char *uri)
78 QQmlExtensionPlugin::initializeEngine(engine, uri);
80 // Make sure we've initialized the wm policy.
81 WindowManagementPolicy::instance();
83 new ConcreteScreens(MockScreens::instance(), new ScreensConfiguration());
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