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_LIBRARY_EDITOR_COMPONENTSYMBOLVARIANTEDITDIALOG_H 21 #define LIBREPCB_LIBRARY_EDITOR_COMPONENTSYMBOLVARIANTEDITDIALOG_H 22 23 /******************************************************************************* 24 * Includes 25 ******************************************************************************/ 26 #include <librepcb/common/exceptions.h> 27 #include <librepcb/library/cmp/componentsymbolvariant.h> 28 29 #include <QtCore> 30 #include <QtWidgets> 31 32 /******************************************************************************* 33 * Namespace / Forward Declarations 34 ******************************************************************************/ 35 namespace librepcb { 36 37 class DefaultGraphicsLayerProvider; 38 class GraphicsScene; 39 40 namespace workspace { 41 class Workspace; 42 } 43 44 namespace library { 45 46 class Component; 47 class Symbol; 48 class SymbolGraphicsItem; 49 50 namespace editor { 51 52 class LibraryElementCache; 53 54 namespace Ui { 55 class ComponentSymbolVariantEditDialog; 56 } 57 58 /******************************************************************************* 59 * Class ComponentSymbolVariantEditDialog 60 ******************************************************************************/ 61 62 /** 63 * @brief The ComponentSymbolVariantEditDialog class 64 */ 65 class ComponentSymbolVariantEditDialog final : public QDialog { 66 Q_OBJECT 67 68 public: 69 // Constructors / Destructor 70 ComponentSymbolVariantEditDialog() = delete; 71 ComponentSymbolVariantEditDialog( 72 const ComponentSymbolVariantEditDialog& other) = delete; 73 ComponentSymbolVariantEditDialog(const workspace::Workspace& ws, 74 const Component& cmp, 75 ComponentSymbolVariant& symbVar, 76 QWidget* parent = nullptr) noexcept; 77 ~ComponentSymbolVariantEditDialog() noexcept; 78 79 // Setters 80 void setReadOnly(bool readOnly) noexcept; 81 82 // Operator Overloadings 83 ComponentSymbolVariantEditDialog& operator=( 84 const ComponentSymbolVariantEditDialog& rhs) = delete; 85 86 private: // Methods 87 void accept() noexcept override; 88 void updateGraphicsItems() noexcept; 89 90 private: // Data 91 const workspace::Workspace& mWorkspace; 92 const Component& mComponent; 93 ComponentSymbolVariant& mOriginalSymbVar; 94 ComponentSymbolVariant mSymbVar; 95 QScopedPointer<GraphicsScene> mGraphicsScene; 96 QScopedPointer<DefaultGraphicsLayerProvider> mGraphicsLayerProvider; 97 std::shared_ptr<LibraryElementCache> mLibraryElementCache; 98 QScopedPointer<Ui::ComponentSymbolVariantEditDialog> mUi; 99 100 QList<std::shared_ptr<Symbol>> mSymbols; 101 QList<std::shared_ptr<SymbolGraphicsItem>> mGraphicsItems; 102 }; 103 104 /******************************************************************************* 105 * End of File 106 ******************************************************************************/ 107 108 } // namespace editor 109 } // namespace library 110 } // namespace librepcb 111 112 #endif // LIBREPCB_LIBRARY_EDITOR_COMPONENTSYMBOLVARIANTEDITDIALOG_H 113