LibrePCB Developers Documentation
workspacesettingsdialog.h
Go to the documentation of this file.
1 /*
2  * LibrePCB - Professional EDA for everyone!
3  * Copyright (C) 2013 LibrePCB Developers, see AUTHORS.md for contributors.
4  * https://librepcb.org/
5  *
6  * This program is free software: you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation, either version 3 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program. If not, see <http://www.gnu.org/licenses/>.
18  */
19 
20 #ifndef LIBREPCB_EDITOR_WORKSPACESETTINGSDIALOG_H
21 #define LIBREPCB_EDITOR_WORKSPACESETTINGSDIALOG_H
22 
23 /*******************************************************************************
24  * Includes
25  ******************************************************************************/
26 #include "../modelview/editablelistmodel.h"
27 
29 
30 #include <QtCore>
31 #include <QtWidgets>
32 
33 /*******************************************************************************
34  * Namespace / Forward Declarations
35  ******************************************************************************/
36 namespace librepcb {
37 
38 class Theme;
39 class ThemeColor;
40 class Workspace;
41 class WorkspaceSettings;
42 
43 namespace editor {
44 
45 class KeyboardShortcutsModel;
46 
47 namespace Ui {
48 class WorkspaceSettingsDialog;
49 }
50 
51 /*******************************************************************************
52  * Class WorkspaceSettingsDialog
53  ******************************************************************************/
54 
58 class WorkspaceSettingsDialog final : public QDialog {
59  Q_OBJECT
60 
65 
67  QPointer<WorkspaceSettingsItem_GenericValueList<QStringList>> setting;
69  QString defaultArgument;
70  QVector<std::pair<QString, QString>> placeholders;
71  QStringList currentValue;
72  };
73 
74 public:
75  // Constructors / Destructor
76  WorkspaceSettingsDialog() = delete;
77  WorkspaceSettingsDialog(const WorkspaceSettingsDialog& other) = delete;
78  explicit WorkspaceSettingsDialog(Workspace& workspace,
79  QWidget* parent = nullptr);
81 
82  // Operator Overloadings
83  WorkspaceSettingsDialog& operator=(const WorkspaceSettingsDialog& rhs) =
84  delete;
85 
86 signals:
87  void desktopIntegrationStatusChanged();
88 
89 private:
90  void buttonBoxClicked(QAbstractButton* button) noexcept;
91  void keyPressEvent(QKeyEvent* event) noexcept override;
92  void externalApplicationListIndexChanged(int index) noexcept;
93  void updateThemesList(const Uuid& selectedTheme) noexcept;
94  void themeIndexChanged(int index) noexcept;
95  void initColorTreeWidgetItem(QTreeWidgetItem& item,
96  const ThemeColor& color) noexcept;
97  Theme* getCurrentTheme() noexcept;
98  void updateDismissedMessagesCount() noexcept;
99  void updateDesktopIntegrationStatus() noexcept;
100  void loadSettings() noexcept;
101  void saveSettings() noexcept;
102 
103 private:
104  Workspace& mWorkspace;
105  WorkspaceSettings& mSettings;
106  QScopedPointer<LibraryLocaleOrderModel> mLibLocaleOrderModel;
107  QScopedPointer<LibraryNormOrderModel> mLibNormOrderModel;
108  QScopedPointer<ApiEndpointModel> mApiEndpointModel;
109  QScopedPointer<KeyboardShortcutsModel> mKeyboardShortcutsModel;
110  QScopedPointer<QSortFilterProxyModel> mKeyboardShortcutsFilterModel;
111  QScopedPointer<Ui::WorkspaceSettingsDialog> mUi;
112 
113  // Cached settings
114  QVector<ExternalApplication> mExternalApplications;
115  QMap<Uuid, Theme> mThemes;
116 };
117 
118 /*******************************************************************************
119  * End of File
120  ******************************************************************************/
121 
122 } // namespace editor
123 } // namespace librepcb
124 
125 #endif
Dialog (GUI) to view and modify workspace settings.
Definition: workspacesettingsdialog.h:58
A generic QAbstractTableModel subclass to view and edit list of various data types.
Definition: editablelistmodel.h:73
Definition: occmodel.cpp:77
QPointer< WorkspaceSettingsItem_GenericValueList< QStringList > > setting
Definition: workspacesettingsdialog.h:67
QVector< std::pair< QString, QString > > placeholders
Definition: workspacesettingsdialog.h:70
Container for all workspace related settings.
Definition: workspacesettings.h:60
QString defaultArgument
Definition: workspacesettingsdialog.h:69
Color settings as used by librepcb::Theme.
Definition: themecolor.h:43
QStringList currentValue
Definition: workspacesettingsdialog.h:71
QString exampleExecutable
Definition: workspacesettingsdialog.h:68
A QAbstractItemModel to represent keyboard shortcut workspace settings.
Definition: keyboardshortcutsmodel.h:44
The Uuid class is a replacement for QUuid to get UUID strings without {} braces.
Definition: uuid.h:58
Theme class as used by librepcb::WorkspaceSettingsItem_Themes.
Definition: theme.h:44
The Workspace class represents a workspace with all its data (library, projects, settings, ...)
Definition: workspace.h:54