@@ -1,77 +0,0 @@
2− * Copyright (C) 2017 Canonical, Ltd.
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.
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.
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/>.
17−#include "Workspace.h"
18−#include "WorkspaceModel.h"
19−#include "WorkspaceManager.h"
20−#include "TopLevelWindowModel.h"
22−#include "windowmanagementpolicy.h"
24−Workspace::Workspace(QObject *parent)
29− connect(WorkspaceManager::instance(), &WorkspaceManager::activeWorkspaceChanged, this, [this]() {
30− bool newActive = WorkspaceManager::instance()->activeWorkspace() == this;
31− if (newActive != m_active) {
32− m_active = newActive;
33− Q_EMIT activeChanged(m_active);
38−Workspace::~Workspace()
43−void Workspace::assign(WorkspaceModel *model, const QVariant& vIndex)
45− if (m_model == model) return;
49− m_model->remove(this);
52− m_model = model ? model : WorkspaceManager::instance();
55− int index = m_model->rowCount();
56− if (vIndex.isValid() && vIndex.canConvert(QVariant::Int)) {
57− index = vIndex.toInt();
59− m_model->insert(index, this);
61− connect(m_model, &QObject::destroyed, this, [this]() {
62− m_model->remove(this);
69−void Workspace::activate()
71− WorkspaceManager::instance()->setActiveWorkspace(this);
74−void Workspace::unassign()