on 747a319 help sign in
unity8/plugins/WindowManager/WindowManagerPlugin.cpp
59 lines 2.1 kB history raw
1/*
2 * Copyright (C) 2016 Canonical, Ltd.
3 *
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.
7 *
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.
12 *
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/>.
15 */
17#include "WindowManagerPlugin.h"
19#include "Screens.h"
20#include "Screen.h"
21#include "ScreenWindow.h"
22#include "TopLevelWindowModel.h"
23#include "Window.h"
24#include "WorkspaceManager.h"
25#include "Workspace.h"
26#include "WorkspaceModel.h"
28#include <QtQml>
30static QObject *workspace_manager(QQmlEngine *engine, QJSEngine *scriptEngine)
32 Q_UNUSED(engine)
33 Q_UNUSED(scriptEngine)
34 return WorkspaceManager::instance();
36QObject* screensSingleton(QQmlEngine* engine, QJSEngine* scriptEngine) {
37 Q_UNUSED(engine);
38 Q_UNUSED(scriptEngine);
39 return new Screens();
42void WindowManagerPlugin::registerTypes(const char *uri)
44 qmlRegisterType<TopLevelWindowModel>(uri, 1, 0, "TopLevelWindowModel");
45 qmlRegisterSingletonType<WorkspaceManager>(uri, 1, 0, "WorkspaceManager", workspace_manager);
46 qmlRegisterUncreatableType<WorkspaceModel>(uri, 1, 0, "WorkspaceModel", "Not a creatable type");
47 qmlRegisterSingletonType<Screens>(uri, 1, 0, "Screens", screensSingleton);
48 qmlRegisterUncreatableType<qtmir::ScreenMode>(uri, 1, 0, "ScreenMode", "ScreenMode is not creatable.");
49 qmlRegisterUncreatableType<Workspace>(uri, 1, 0, "Workspace", "Workspace is not creatable.");
51 qRegisterMetaType<Window*>("Window*");
52 qRegisterMetaType<Workspace*>("Workspace*");
54 qRegisterMetaType<QAbstractListModel*>("QAbstractListModel*");
55 qRegisterMetaType<Screen*>("Screen*");
57 qmlRegisterType<ScreenWindow>(uri, 1, 0, "ScreenWindow");
58 qmlRegisterRevision<QWindow,1>(uri, 1, 0);