~lukas-kde/qtmir/betterSessionManagement

« back to all changes in this revision

Viewing changes to src/modules/Unity/Application/sessionmanager.h

  • Committer: Lukáš Tinkl
  • Date: 2017-03-24 11:51:00 UTC
  • mfrom: (590.1.35 qtmir)
  • Revision ID: lukas.tinkl@canonical.com-20170324115100-n0itqdupc26qe6g6
merge trunk, resolve conflicts

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
2
 
 * Copyright (C) 2014-2015 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
 
#ifndef SESSIONMANAGER_H
18
 
#define SESSIONMANAGER_H
19
 
 
20
 
// std
21
 
#include <memory>
22
 
 
23
 
// Qt
24
 
#include <QHash>
25
 
#include <QSharedPointer>
26
 
 
27
 
// Mir
28
 
#include <mir_toolkit/common.h>
29
 
 
30
 
// miral
31
 
#include <miral/application_info.h>
32
 
 
33
 
// local
34
 
#include "session.h"
35
 
#include "sessionmodel.h"
36
 
 
37
 
namespace mir {
38
 
    namespace scene {
39
 
        class Session;
40
 
        class PromptSession;
41
 
    }
42
 
}
43
 
 
44
 
namespace qtmir {
45
 
 
46
 
class Application;
47
 
class ApplicationManager;
48
 
 
49
 
class SessionManager : public SessionModel
50
 
{
51
 
    Q_OBJECT
52
 
 
53
 
public:
54
 
    explicit SessionManager(
55
 
        const std::shared_ptr<PromptSessionManager>& promptSessionManager,
56
 
        ApplicationManager* applicationManager,
57
 
        QObject *parent = 0
58
 
    );
59
 
    ~SessionManager();
60
 
 
61
 
    static SessionManager* singleton();
62
 
 
63
 
    SessionInterface *findSession(const mir::scene::Session* session) const;
64
 
 
65
 
Q_SIGNALS:
66
 
    void sessionStarting(SessionInterface* session);
67
 
    void sessionStopping(SessionInterface* session);
68
 
 
69
 
public Q_SLOTS:
70
 
    void onSessionStarting(const miral::ApplicationInfo &appInfo);
71
 
    void onSessionStopping(const miral::ApplicationInfo &appInfo);
72
 
 
73
 
    void onPromptSessionStarting(const PromptSession& promptSession);
74
 
    void onPromptSessionStopping(const PromptSession& promptSession);
75
 
    void onPromptProviderAdded(const qtmir::PromptSession &promptSession, const std::shared_ptr<mir::scene::Session> &);
76
 
    void onPromptProviderRemoved(const qtmir::PromptSession &promptSession, const std::shared_ptr<mir::scene::Session> &);
77
 
 
78
 
protected:
79
 
 
80
 
private:
81
 
    const std::shared_ptr<PromptSessionManager> m_promptSessionManager;
82
 
    ApplicationManager* m_applicationManager;
83
 
    static SessionManager *the_session_manager;
84
 
 
85
 
    QHash<const mir::scene::PromptSession *, SessionInterface *> m_mirPromptToSessionHash;
86
 
};
87
 
 
88
 
} // namespace qtmir
89
 
 
90
 
#endif // SESSIONMANAGER_H