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_WORKSPACESETTINGSDIALOG_H 21 #define LIBREPCB_WORKSPACESETTINGSDIALOG_H 22 23 /******************************************************************************* 24 * Includes 25 ******************************************************************************/ 26 #include <librepcb/common/model/editablelistmodel.h> 27 28 #include <QtCore> 29 #include <QtWidgets> 30 31 /******************************************************************************* 32 * Namespace / Forward Declarations 33 ******************************************************************************/ 34 namespace librepcb { 35 namespace workspace { 36 37 namespace Ui { 38 class WorkspaceSettingsDialog; 39 } 40 41 class WorkspaceSettings; 42 43 /******************************************************************************* 44 * Class WorkspaceSettingsDialog 45 ******************************************************************************/ 46 47 /** 48 * @brief Dialog (GUI) to view and modify workspace settings 49 */ 50 class WorkspaceSettingsDialog final : public QDialog { 51 Q_OBJECT 52 53 using LibraryLocaleOrderModel = 54 EditableListModel<QStringList, EditableListModelType::LOCALE>; 55 using LibraryNormOrderModel = EditableListModel<QStringList>; 56 using RepositoryUrlModel = EditableListModel<QList<QUrl>>; 57 58 public: 59 // Constructors / Destructor 60 WorkspaceSettingsDialog() = delete; 61 WorkspaceSettingsDialog(const WorkspaceSettingsDialog& other) = delete; 62 explicit WorkspaceSettingsDialog(WorkspaceSettings& settings, 63 QWidget* parent = nullptr); 64 ~WorkspaceSettingsDialog(); 65 66 // Operator Overloadings 67 WorkspaceSettingsDialog& operator=(const WorkspaceSettingsDialog& rhs) = 68 delete; 69 70 private: 71 void buttonBoxClicked(QAbstractButton* button) noexcept; 72 void loadSettings() noexcept; 73 void saveSettings() noexcept; 74 75 private: 76 WorkspaceSettings& mSettings; ///< Reference to the WorkspaceSettings object 77 QScopedPointer<LibraryLocaleOrderModel> mLibLocaleOrderModel; 78 QScopedPointer<LibraryNormOrderModel> mLibNormOrderModel; 79 QScopedPointer<RepositoryUrlModel> mRepositoryUrlsModel; 80 QScopedPointer<Ui::WorkspaceSettingsDialog> mUi; 81 }; 82 83 /******************************************************************************* 84 * End of File 85 ******************************************************************************/ 86 87 } // namespace workspace 88 } // namespace librepcb 89 90 #endif // LIBREPCB_WORKSPACESETTINGSDIALOG_H 91