~lukas-kde/miral/shellchrome-windowinfo

« back to all changes in this revision

Viewing changes to miral-qt/tests/framework/fake_session.cpp

  • Committer: Larry Price
  • Date: 2016-09-13 16:19:29 UTC
  • mto: (330.4.1 miral)
  • mto: This revision was merged to the branch mainline in revision 352.
  • Revision ID: larry.price@canonical.com-20160913161929-vs9ka1capmljq1es
Removing miral-qt from release branch, updating copyright file, and adding GPL3 license to root dir

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
2
 
 * Copyright (C) 2015-2016 Canonical, Ltd.
3
 
 *
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.
7
 
 *
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.
12
 
 *
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/>.
15
 
 */
16
 
 
17
 
#include "fake_session.h"
18
 
 
19
 
namespace qtmir
20
 
{
21
 
 
22
 
FakeSession::FakeSession()
23
 
    : SessionInterface(0)
24
 
    , m_application(nullptr)
25
 
    , m_state(Starting)
26
 
{
27
 
}
28
 
 
29
 
FakeSession::~FakeSession()
30
 
{
31
 
    delete m_childSessions;
32
 
}
33
 
 
34
 
QString FakeSession::name() const { return QString("foo-session"); }
35
 
 
36
 
unity::shell::application::ApplicationInfoInterface *FakeSession::application() const { return m_application; }
37
 
 
38
 
MirSurfaceListModel* FakeSession::surfaceList() { return &m_surfaceList; }
39
 
 
40
 
MirSurfaceListModel* FakeSession::promptSurfaceList() { return &m_promptSurfaceList; }
41
 
 
42
 
SessionModel *FakeSession::childSessions() const { return m_childSessions; }
43
 
 
44
 
SessionInterface::State FakeSession::state() const { return m_state; }
45
 
 
46
 
bool FakeSession::fullscreen() const { return false; }
47
 
 
48
 
bool FakeSession::live() const { return true; }
49
 
 
50
 
std::shared_ptr<mir::scene::Session> FakeSession::session() const
51
 
{
52
 
    return m_session;
53
 
}
54
 
 
55
 
void FakeSession::registerSurface(MirSurfaceInterface *) {}
56
 
 
57
 
void FakeSession::setApplication(unity::shell::application::ApplicationInfoInterface *app)
58
 
{
59
 
    if (m_application != app) {
60
 
        m_application = app;
61
 
        Q_EMIT applicationChanged(m_application);
62
 
    }
63
 
}
64
 
 
65
 
void FakeSession::suspend()
66
 
{
67
 
    if (m_state == Running) {
68
 
        setState(Suspending);
69
 
    }
70
 
}
71
 
 
72
 
void FakeSession::resume()
73
 
{
74
 
    if (m_state == Suspending || m_state == Suspended) {
75
 
        setState(Running);
76
 
    }
77
 
}
78
 
 
79
 
void FakeSession::stop()
80
 
{
81
 
    setState(Stopped);
82
 
}
83
 
 
84
 
bool FakeSession::hasClosingSurfaces() const { return false; }
85
 
bool FakeSession::hadSurface() const { return false; }
86
 
 
87
 
void FakeSession::close() {}
88
 
 
89
 
void FakeSession::addChildSession(SessionInterface *) {}
90
 
 
91
 
void FakeSession::insertChildSession(uint, SessionInterface *) {}
92
 
 
93
 
void FakeSession::removeChildSession(SessionInterface *) {}
94
 
 
95
 
void FakeSession::foreachChildSession(const std::function<void (SessionInterface *)> &) const {}
96
 
 
97
 
std::shared_ptr<mir::scene::PromptSession> FakeSession::activePromptSession() const
98
 
{
99
 
    return std::shared_ptr<mir::scene::PromptSession>();
100
 
}
101
 
 
102
 
void FakeSession::foreachPromptSession(const std::function<void (const std::shared_ptr<mir::scene::PromptSession> &)> &) const {}
103
 
 
104
 
void FakeSession::setFullscreen(bool) {}
105
 
 
106
 
void FakeSession::setLive(const bool) {}
107
 
 
108
 
void FakeSession::appendPromptSession(const std::shared_ptr<mir::scene::PromptSession> &) {}
109
 
 
110
 
void FakeSession::removePromptSession(const std::shared_ptr<mir::scene::PromptSession> &) {}
111
 
 
112
 
void FakeSession::setState(SessionInterface::State state)
113
 
{
114
 
    if (m_state != state) {
115
 
        m_state = state;
116
 
        Q_EMIT stateChanged(m_state);
117
 
    }
118
 
}
119
 
 
120
 
void FakeSession::setSession(std::shared_ptr<mir::scene::Session> session)
121
 
{
122
 
    m_session = session;
123
 
}
124
 
 
125
 
} // namespace qtmir