2
* Copyright (C) 2015-2016 Canonical, Ltd.
4
* This program is free software: you can redistribute it and/or modify it under
5
* the terms of the GNU Lesser General Public License version 3, as published by
6
* the Free Software Foundation.
8
* This program is distributed in the hope that it will be useful, but WITHOUT
9
* ANY WARRANTY; without even the implied warranties of MERCHANTABILITY,
10
* SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11
* Lesser General Public License for more details.
13
* You should have received a copy of the GNU Lesser General Public License
14
* along with this program. If not, see <http://www.gnu.org/licenses/>.
17
#include <Unity/Application/session_interface.h>
18
#include <Unity/Application/sessionmodel.h>
19
#include <Unity/Application/mirsurfacelistmodel.h>
22
#ifndef QTMIR_FAKE_SESSION_H
23
#define QTMIR_FAKE_SESSION_H
27
class FakeSession : public SessionInterface
33
virtual ~FakeSession();
35
QString name() const override;
36
unity::shell::application::ApplicationInfoInterface* application() const override;
37
MirSurfaceListModel* surfaceList() override;
38
MirSurfaceListModel* promptSurfaceList() override;
39
SessionModel* childSessions() const override;
40
State state() const override;
41
bool fullscreen() const override;
42
bool live() const override;
44
std::shared_ptr<mir::scene::Session> session() const override;
46
// For MirSurfaceItem and MirSurfaceManager use
48
void registerSurface(MirSurfaceInterface*) override;
50
// For Application use
52
void setApplication(unity::shell::application::ApplicationInfoInterface* app) override;
53
void suspend() override;
54
void resume() override;
56
bool hadSurface() const override;
57
bool hasClosingSurfaces() const override;
59
void close() override;
61
bool activeFocus() const override { return false; }
63
pid_t pid() const override { return 0; }
65
// For SessionManager use
67
void addChildSession(SessionInterface*) override;
68
void insertChildSession(uint, SessionInterface*) override;
69
void removeChildSession(SessionInterface*) override;
70
void foreachChildSession(const std::function<void(SessionInterface* session)> &) const override;
72
std::shared_ptr<mir::scene::PromptSession> activePromptSession() const override;
73
void foreachPromptSession(const std::function<void(const std::shared_ptr<mir::scene::PromptSession>&)> &) const override;
75
void setFullscreen(bool) override;
76
void setLive(const bool) override;
77
void appendPromptSession(const std::shared_ptr<mir::scene::PromptSession>&) override;
78
void removePromptSession(const std::shared_ptr<mir::scene::PromptSession>&) override;
82
void setState(State state);
83
void setSession(std::shared_ptr<mir::scene::Session> session);
86
unity::shell::application::ApplicationInfoInterface* m_application;
88
std::shared_ptr<mir::scene::Session> m_session;
89
MirSurfaceListModel m_surfaceList;
90
MirSurfaceListModel m_promptSurfaceList;
91
SessionModel *m_childSessions{new SessionModel};
96
#endif // QTMIR_FAKE_SESSION_H