Debian Codegraph @

src/Gui/PreferencePages/DlgSettingsWorkbenchesImp.h

raw
1 // SPDX-License-Identifier: LGPL-2.1-or-later
2
3 /****************************************************************************
4 * Copyright (c) 2020 Chris Hennes ([email protected]) *
5 * Copyright (c) 2023 FreeCAD Project Association *
6 * *
7 * This file is part of FreeCAD. *
8 * *
9 * FreeCAD is free software: you can redistribute it and/or modify it *
10 * under the terms of the GNU Lesser General Public License as *
11 * published by the Free Software Foundation, either version 2.1 of the *
12 * License, or (at your option) any later version. *
13 * *
14 * FreeCAD is distributed in the hope that it will be useful, but *
15 * WITHOUT ANY WARRANTY; without even the implied warranty of *
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
17 * Lesser General Public License for more details. *
18 * *
19 * You should have received a copy of the GNU Lesser General Public *
20 * License along with FreeCAD. If not, see *
21 * <https://www.gnu.org/licenses/>. *
22 * *
23 ***************************************************************************/
24
25
26 #ifndef GUI_DIALOG_DLGSETTINGSWORKBENCHES_IMP_H
27 #define GUI_DIALOG_DLGSETTINGSWORKBENCHES_IMP_H
28
29 #include <Gui/PropertyPage.h>
30 #include <memory>
31
32 namespace Gui
33 {
34 namespace Dialog
35 {
36 class Ui_DlgSettingsWorkbenches;
37
38 /**
39 * The DlgSettingsWorkbenchesImp class implements a pseudo-preference page explain why
40 * the remaining preference pages aren't loaded yet, and to help the user do so on demand.
41 * \author Jürgen Riegel
42 */
43 class DlgSettingsWorkbenchesImp: public PreferencePage
44 {
45 Q_OBJECT
46
47 public:
48 explicit DlgSettingsWorkbenchesImp(QWidget* parent = nullptr);
49 ~DlgSettingsWorkbenchesImp() override;
50
51 void saveSettings() override;
52 void loadSettings() override;
53 void resetSettingsToDefaults() override;
54
55 static QStringList getEnabledWorkbenches();
56 static QStringList getDisabledWorkbenches();
57
58 protected Q_SLOTS:
59 void wbToggled(const QString& wbName, bool enabled);
60 void wbItemMoved();
61 void onStartWbChanged(int index);
62 void onWbByTabToggled(bool val);
63
64 protected:
65 void buildWorkbenchList();
66 void changeEvent(QEvent* e) override;
67
68 private:
69 void addWorkbench(const QString& it, bool enabled);
70 void sortEnabledWorkbenches();
71
72 void setStartWorkbenchComboItems();
73
74 void saveWorkbenchSelector();
75 void loadWorkbenchSelector();
76 void translateWorkbenchSelector();
77
78
79 std::vector<std::string> _backgroundAutoloadedModules;
80 std::string _startupModule;
81
82 std::unique_ptr<Ui_DlgSettingsWorkbenches> ui;
83 };
84
85 } // namespace Dialog
86 } // namespace Gui
87
88 #endif // GUI_DIALOG_DLGSETTINGSWORKBENCHES_IMP_H