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 
36 #pragma once
37 
38 #include "ui_workspacedialog.h"
39 
40 #include <QDialog>
41 #include <QString>
42 
43 QT_BEGIN_NAMESPACE
44 class QLineEdit;
45 class QPushButton;
46 QT_END_NAMESPACE
47 
48 namespace ADS {
49 
50 class DockManager;
51 
52 class WorkspaceDialog : public QDialog
53 {
54     Q_OBJECT
55 
56 public:
57     explicit WorkspaceDialog(DockManager *manager, QWidget *parent = nullptr);
58 
59     void setAutoLoadWorkspace(bool);
60     bool autoLoadWorkspace() const;
61 
62     DockManager *dockManager() const;
63 
64 private:
65     void updateActions(const QStringList &workspaces);
66 
67     Ui::WorkspaceDialog m_ui;
68 
69     DockManager *m_manager = nullptr;
70 };
71 
72 class WorkspaceNameInputDialog : public QDialog
73 {
74     Q_OBJECT
75 
76 public:
77     explicit WorkspaceNameInputDialog(DockManager *manager, QWidget *parent);
78 
79     void setActionText(const QString &actionText, const QString &openActionText);
80     void setValue(const QString &value);
81     QString value() const;
82     bool isSwitchToRequested() const;
83 
84 private:
85     QLineEdit *m_newWorkspaceLineEdit = nullptr;
86     QPushButton *m_switchToButton = nullptr;
87     QPushButton *m_okButton = nullptr;
88     bool m_usedSwitchTo = false;
89 
90     DockManager *m_manager;
91 };
92 
93 } // namespace ADS
94