Unity 8
WorkspaceManager.h
1 /*
2  * Copyright (C) 2017 Canonical, Ltd.
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; version 3.
7  *
8  * This program is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11  * GNU General Public License for more details.
12  *
13  * You should have received a copy of the GNU General Public License
14  * along with this program. If not, see <http://www.gnu.org/licenses/>.
15  */
16 
17 #ifndef WORKSPACEMANAGER_H
18 #define WORKSPACEMANAGER_H
19 
20 #include <QQmlListProperty>
21 
22 #include "WindowManagerGlobal.h"
23 #include "WorkspaceModel.h"
24 
25 class Workspace;
26 
27 namespace unity {
28  namespace shell {
29  namespace application {
30  class MirSurfaceInterface;
31  class SurfaceManagerInterface;
32  }
33  }
34 }
35 
36 class WINDOWMANAGERQML_EXPORT WorkspaceManager : public QObject
37 {
38  Q_OBJECT
39  Q_PROPERTY(Workspace* activeWorkspace READ activeWorkspace WRITE setActiveWorkspace2 NOTIFY activeWorkspaceChanged)
40 
41 public:
42  WorkspaceManager();
43  static WorkspaceManager* instance();
44 
45  Workspace* activeWorkspace() const;
46  void setActiveWorkspace(Workspace* workspace);
47 
48  Workspace* createWorkspace();
49  void destroyWorkspace(Workspace* workspace);
50 
51  void destroyFloatingWorkspaces();
52 
53  Q_INVOKABLE void moveSurfaceToWorkspace(unity::shell::application::MirSurfaceInterface* surface,
54  Workspace* workspace);
55 
56  Q_INVOKABLE void moveWorkspaceContentToWorkspace(Workspace* to, Workspace* from);
57 
58 public Q_SLOTS:
59  void setSurfaceManager(unity::shell::application::SurfaceManagerInterface*);
60 
61 Q_SIGNALS:
62  void activeWorkspaceChanged(Workspace*);
63 
64 private:
65  void setActiveWorkspace2(Workspace* workspace);
66 
67  QSet<Workspace*> m_allWorkspaces;
68  Workspace* m_activeWorkspace;
69  unity::shell::application::SurfaceManagerInterface* m_surfaceManager;
70 };
71 
72 #endif // WORKSPACEMANAGER_H