workspaceview.h 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. /****************************************************************************
  2. **
  3. ** Copyright (C) 2020 The Qt Company Ltd.
  4. ** Contact: https://www.qt.io/licensing/
  5. **
  6. ** This file is part of Qt Creator.
  7. **
  8. ** Commercial License Usage
  9. ** Licensees holding valid commercial Qt licenses may use this file in
  10. ** accordance with the commercial license agreement provided with the
  11. ** Software or, alternatively, in accordance with the terms contained in
  12. ** a written agreement between you and The Qt Company. For licensing terms
  13. ** and conditions see https://www.qt.io/terms-conditions. For further
  14. ** information use the contact form at https://www.qt.io/contact-us.
  15. **
  16. ** GNU Lesser General Public License Usage
  17. ** Alternatively, this file may be used under the terms of the GNU Lesser
  18. ** General Public License version 2.1 or (at your option) any later version.
  19. ** The licenses are as published by the Free Software Foundation
  20. ** and appearing in the file LICENSE.LGPLv21 included in the packaging
  21. ** of this file. Please review the following information to ensure
  22. ** the GNU Lesser General Public License version 2.1 requirements
  23. ** will be met: https://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
  24. **
  25. ** GNU General Public License Usage
  26. ** Alternatively, this file may be used under the terms of the GNU
  27. ** General Public License version 3 or (at your option) any later version
  28. ** approved by the KDE Free Qt Foundation. The licenses are as published by
  29. ** the Free Software Foundation and appearing in the file LICENSE.GPL3
  30. ** included in the packaging of this file. Please review the following
  31. ** information to ensure the GNU General Public License requirements will
  32. ** be met: https://www.gnu.org/licenses/gpl-3.0.html.
  33. **
  34. ****************************************************************************/
  35. #pragma once
  36. #include "workspacemodel.h"
  37. #include <utils/itemviews.h>
  38. #include <QAbstractTableModel>
  39. namespace ADS {
  40. class DockManager;
  41. class WorkspaceDialog;
  42. class WorkspaceView : public Utils::TreeView
  43. {
  44. Q_OBJECT
  45. public:
  46. explicit WorkspaceView(QWidget *parent = nullptr);
  47. void createNewWorkspace();
  48. void deleteSelectedWorkspaces();
  49. void cloneCurrentWorkspace();
  50. void renameCurrentWorkspace();
  51. void switchToCurrentWorkspace();
  52. QString currentWorkspace();
  53. WorkspaceModel *workspaceModel();
  54. void selectActiveWorkspace();
  55. void selectWorkspace(const QString &workspaceName);
  56. signals:
  57. void activated(const QString &workspace);
  58. void selected(const QStringList &workspaces);
  59. void workspaceSwitched();
  60. private:
  61. void showEvent(QShowEvent *event) override;
  62. void keyPressEvent(QKeyEvent *event) override;
  63. void deleteWorkspaces(const QStringList &workspaces);
  64. QStringList selectedWorkspaces() const;
  65. static WorkspaceDialog *castToWorkspaceDialog(QWidget *widget);
  66. DockManager *m_manager;
  67. WorkspaceModel m_workspaceModel;
  68. };
  69. } // namespace ADS