blob: be00893913ddc1d97cd29732944badaf9bd5f121 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
|
/*
* Copyright (C) 2014-2015 Canonical, Ltd.
*
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU Lesser General Public License version 3, as published by
* the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranties of MERCHANTABILITY,
* SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef SESSION_INTERFACE_H
#define SESSION_INTERFACE_H
#include <functional>
#include <memory>
// Unity API
#include <unity/shell/application/ApplicationInfoInterface.h>
// local
#include "sessionmodel.h"
namespace mir {
namespace scene {
class Session;
class PromptSession;
}
}
namespace qtmir {
class MirSurfaceItemInterface;
class SessionInterface : public QObject {
Q_OBJECT
Q_PROPERTY(MirSurfaceItemInterface* surface READ surface NOTIFY surfaceChanged)
Q_PROPERTY(unity::shell::application::ApplicationInfoInterface* application READ application NOTIFY applicationChanged DESIGNABLE false)
Q_PROPERTY(SessionInterface* parentSession READ parentSession NOTIFY parentSessionChanged DESIGNABLE false)
Q_PROPERTY(SessionModel* childSessions READ childSessions DESIGNABLE false CONSTANT)
Q_PROPERTY(bool fullscreen READ fullscreen NOTIFY fullscreenChanged)
Q_PROPERTY(bool live READ live NOTIFY liveChanged)
public:
SessionInterface(QObject *parent = 0) : QObject(parent) {}
virtual ~SessionInterface() {}
enum State {
Starting,
Running,
Suspending,
Suspended,
Stopped
};
Q_INVOKABLE virtual void release() = 0;
//getters
virtual QString name() const = 0;
virtual unity::shell::application::ApplicationInfoInterface* application() const = 0;
virtual MirSurfaceItemInterface* surface() const = 0;
virtual SessionInterface* parentSession() const = 0;
virtual SessionModel* childSessions() const = 0;
virtual State state() const = 0;
virtual bool fullscreen() const = 0;
virtual bool live() const = 0;
virtual std::shared_ptr<mir::scene::Session> session() const = 0;
// For MirSurfaceItem and MirSurfaceManager use
virtual void setSurface(MirSurfaceItemInterface* surface) = 0;
// For Application use
virtual void setApplication(unity::shell::application::ApplicationInfoInterface* item) = 0;
virtual void suspend() = 0;
virtual void resume() = 0;
virtual void stop() = 0;
// For SessionManager use
virtual void addChildSession(SessionInterface* session) = 0;
virtual void insertChildSession(uint index, SessionInterface* session) = 0;
virtual void removeChildSession(SessionInterface* session) = 0;
virtual void foreachChildSession(std::function<void(SessionInterface* session)> f) const = 0;
virtual std::shared_ptr<mir::scene::PromptSession> activePromptSession() const = 0;
virtual void foreachPromptSession(std::function<void(const std::shared_ptr<mir::scene::PromptSession>&)> f) const = 0;
virtual void setFullscreen(bool fullscreen) = 0;
virtual void setLive(const bool) = 0;
virtual void appendPromptSession(const std::shared_ptr<mir::scene::PromptSession>& session) = 0;
virtual void removePromptSession(const std::shared_ptr<mir::scene::PromptSession>& session) = 0;
Q_SIGNALS:
void surfaceChanged(MirSurfaceItemInterface*);
void parentSessionChanged(SessionInterface*);
void applicationChanged(unity::shell::application::ApplicationInfoInterface* application);
void stateChanged(State state);
void fullscreenChanged(bool fullscreen);
void liveChanged(bool live);
};
} // namespace qtmir
Q_DECLARE_METATYPE(qtmir::SessionInterface*)
#endif // SESSION_INTERFACE_H
|