2 * Copyright (C) 2014 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 "ApplicationInfo.h"
18#include "ApplicationTestInterface.h"
19#include "ApplicationManager.h"
20#include "SurfaceManager.h"
21#include "MirSurfaceItem.h"
22#include "MirSurfaceItemModel.h"
26ApplicationTestInterface::ApplicationTestInterface(QObject* parent)
27 : QDBusAbstractAdaptor(parent)
29 QDBusConnection connection = QDBusConnection::sessionBus();
30 connection.registerService("com.canonical.Unity8");
31 connection.registerObject("/com/canonical/Unity8/Mocks", parent);
34quint32 ApplicationTestInterface::addPromptSurface(const QString &appId, const QString &surfaceImage)
36 qDebug() << "ApplicationTestInterface::addPromptSurface to " << appId;
38 ApplicationInfo* application = ApplicationManager::singleton()->findApplication(appId);
40 qDebug() << "ApplicationTestInterface::addPromptSurface - No application found for " << appId;
43 quint32 surfaceId = ++nextId;
44 MirSurfaceItem* surface = SurfaceManager::singleton()->createSurface(
45 QString("%1-Prompt%2").arg(appId)
47 MirSurfaceItem::Normal,
48 MirSurfaceItem::Maximized,
50 m_childItems[surfaceId] = surface;
51 application->addPromptSurface(surface);
56quint32 ApplicationTestInterface::addChildSurface(const QString& appId, const quint32 existingSurfaceId, const QString& surfaceImage)
58 qDebug() << "ApplicationTestInterface::addChildSurface to " << appId;
60 ApplicationInfo* application = ApplicationManager::singleton()->findApplication(appId);
62 qDebug() << "ApplicationTestInterface::addChildSurface - No application found for " << appId;
66 MirSurfaceItem* parentSurface = nullptr;
67 if (m_childItems.contains(existingSurfaceId)) {
68 parentSurface = m_childItems[existingSurfaceId];
69 } else if (application->surface()) {
70 parentSurface = application->surface();
72 qDebug() << "ApplicationTestInterface::addChildSurface - No surface for " << appId << ":" << existingSurfaceId;
76 quint32 surfaceId = ++nextId;
77 MirSurfaceItem* surface = SurfaceManager::singleton()->createSurface(
78 QString("%1-Child%2").arg(parentSurface->name())
80 MirSurfaceItem::Normal,
81 MirSurfaceItem::Maximized,
83 parentSurface->addChildSurface(surface);
84 m_childItems[surfaceId] = surface;
89void ApplicationTestInterface::removeSurface(int surfaceId)
91 qDebug() << "ApplicationTestInterface::removeSurface - " << surfaceId;
93 if (!m_childItems.contains(surfaceId)) {
94 qDebug() << "ApplicationTestInterface::removeSurface - No added surface for " << surfaceId;
97 MirSurfaceItem* surface = m_childItems.take(surfaceId);
98 Q_EMIT surface->removed();
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