/* * Copyright (C) 2016 Canonical, Ltd. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; version 3. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ #include "WindowManagerPlugin.h" #include "Screen.h" #include "ScreenAttached.h" #include "Screens.h" #include "ScreenWindow.h" #include "TopLevelWindowModel.h" #include "Window.h" #include "WorkspaceManager.h" #include "Workspace.h" #include "WorkspaceModel.h" #include #include static const QString notInstantiatable = QStringLiteral("Not instantiatable"); static QObject *workspace_manager(QQmlEngine *engine, QJSEngine *scriptEngine) { Q_UNUSED(engine) Q_UNUSED(scriptEngine) return WorkspaceManager::instance(); } QObject* screensSingleton(QQmlEngine* engine, QJSEngine* scriptEngine) { Q_UNUSED(engine); Q_UNUSED(scriptEngine); return new Screens(qtmir::get_screen_model()); } void WindowManagerPlugin::registerTypes(const char *uri) { qmlRegisterType(uri, 1, 0, "TopLevelWindowModel"); qmlRegisterSingletonType(uri, 1, 0, "WorkspaceManager", workspace_manager); qmlRegisterUncreatableType(uri, 1, 0, "WorkspaceModel", notInstantiatable); qmlRegisterSingletonType(uri, 1, 0, "Screens", screensSingleton); qmlRegisterUncreatableType(uri, 1, 0, "ScreenMode", notInstantiatable); qmlRegisterUncreatableType(uri, 1, 0, "Workspace", notInstantiatable); qRegisterMetaType("Screen*"); qRegisterMetaType("ScreensProxy*"); qRegisterMetaType("Workspace*"); qRegisterMetaType("Window*"); qRegisterMetaType("QAbstractListModel*"); qmlRegisterType(uri, 1, 0, "ScreenWindow"); qmlRegisterRevision(uri, 1, 0); qmlRegisterUncreatableType(uri, 1, 0, "WMScreen", notInstantiatable); }