~gerboland/qtmir/ual-catch-exception

« back to all changes in this revision

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

  • Committer: CI Train Bot
  • Author(s): Daniel d'Andrada
  • Date: 2016-04-13 18:38:49 UTC
  • mfrom: (466.2.16 surfaceListModel)
  • Revision ID: ci-train-bot@canonical.com-20160413183849-qdqd0akyoa4rdl9i
Surface-based window management

- Session is no longer exported to QML. It's now an internal qtmir concept.
Approved by: Gerry Boland

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*
2
 
 * Copyright (C) 2013-2015 Canonical, Ltd.
 
2
 * Copyright (C) 2013-2016 Canonical, Ltd.
3
3
 *
4
4
 * This program is free software: you can redistribute it and/or modify it under
5
5
 * the terms of the GNU Lesser General Public License version 3, as published by
40
40
    }
41
41
}
42
42
 
 
43
namespace unity {
 
44
    namespace shell {
 
45
        namespace application {
 
46
            class MirSurfaceInterface;
 
47
        }
 
48
    }
 
49
}
 
50
 
43
51
class MirServer;
44
52
 
45
53
namespace qtmir {
53
61
class ApplicationManager : public unity::shell::application::ApplicationManagerInterface
54
62
{
55
63
    Q_OBJECT
56
 
    Q_ENUMS(MoreRoles)
57
64
 
58
65
    // TODO: Move to unity::shell::application::ApplicationManagerInterface
59
66
    Q_PROPERTY(bool empty READ isEmpty NOTIFY emptyChanged)
65
72
        ApplicationManager* create();
66
73
    };
67
74
 
68
 
    // FIXME: these roles should be added to unity-api and removed from here
69
 
    enum MoreRoles {
70
 
        RoleSession = RoleExemptFromLifecycle+1,
71
 
        RoleFullscreen,
72
 
    };
73
 
 
74
75
    static ApplicationManager* singleton();
75
76
 
76
77
    explicit ApplicationManager(
88
89
    Q_INVOKABLE qtmir::Application* get(int index) const override;
89
90
    Q_INVOKABLE qtmir::Application* findApplication(const QString &appId) const override;
90
91
    Q_INVOKABLE bool requestFocusApplication(const QString &appId) override;
91
 
    Q_INVOKABLE bool focusApplication(const QString &appId) override;
92
 
    Q_INVOKABLE void unfocusCurrentApplication() override;
93
92
    Q_INVOKABLE qtmir::Application* startApplication(const QString &appId, const QStringList &arguments = QStringList()) override;
94
93
    Q_INVOKABLE bool stopApplication(const QString &appId) override;
95
94
 
111
110
    void onSessionStopping(std::shared_ptr<mir::scene::Session> const& session);
112
111
 
113
112
    void onSessionCreatedSurface(mir::scene::Session const*, std::shared_ptr<mir::scene::Surface> const&);
114
 
    void onSessionDestroyingSurface(mir::scene::Session const* session,
115
 
                                    std::shared_ptr<mir::scene::Surface> const& surface);
116
113
 
117
114
    void onProcessStarting(const QString& appId);
118
115
    void onProcessStopped(const QString& appId);
122
119
    void onResumeRequested(const QString& appId);
123
120
 
124
121
Q_SIGNALS:
125
 
    void focusRequested(const QString &appId);
126
122
    void emptyChanged();
127
123
 
128
124
private Q_SLOTS:
129
125
    void onAppDataChanged(const int role);
130
126
    void onSessionAboutToCreateSurface(const std::shared_ptr<mir::scene::Session> &session,
131
127
                                       int type, QSize &size);
 
128
    void onApplicationClosing(Application *application);
 
129
    void updateFocusedApplication();
132
130
 
133
131
private:
134
132
    void setFocused(Application *application);
142
140
 
143
141
    Application* findApplicationWithPromptSession(const mir::scene::PromptSession* promptSession);
144
142
    Application *findClosingApplication(const QString &inputAppId) const;
 
143
    Application *findApplication(MirSurfaceInterface* surface);
145
144
 
146
145
    QSharedPointer<MirServer> m_mirServer;
147
146
 
148
147
    QList<Application*> m_applications;
149
 
    Application* m_focusedApplication;
150
148
    DBusWindowStack* m_dbusWindowStack;
151
149
    QSharedPointer<TaskController> m_taskController;
152
150
    QSharedPointer<DesktopFileReader::Factory> m_desktopFileReaderFactory;
155
153
    QSharedPointer<SettingsInterface> m_settings;
156
154
    QList<Application*> m_closingApplications;
157
155
    QList<QString> m_queuedStartApplications;
 
156
    bool m_modelUnderChange{false};
158
157
    static ApplicationManager* the_application_manager;
159
158
 
160
159
    friend class Application;