LibrePCB Developers Documentation
componentsymbolvarianteditdialog.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_COMPONENTSYMBOLVARIANTEDITDIALOG_H
21 #define LIBREPCB_EDITOR_COMPONENTSYMBOLVARIANTEDITDIALOG_H
22 
23 /*******************************************************************************
24  * Includes
25  ******************************************************************************/
27 
28 #include <QtCore>
29 #include <QtWidgets>
30 
31 #include <memory>
32 
33 /*******************************************************************************
34  * Namespace / Forward Declarations
35  ******************************************************************************/
36 namespace librepcb {
37 
38 class Component;
39 class Symbol;
40 class Workspace;
41 
42 namespace editor {
43 
44 class DefaultGraphicsLayerProvider;
45 class GraphicsScene;
46 class LibraryElementCache;
47 class SymbolGraphicsItem;
48 
49 namespace Ui {
50 class ComponentSymbolVariantEditDialog;
51 }
52 
53 /*******************************************************************************
54  * Class ComponentSymbolVariantEditDialog
55  ******************************************************************************/
56 
60 class ComponentSymbolVariantEditDialog final : public QDialog {
61  Q_OBJECT
62 
63 public:
64  // Constructors / Destructor
67  const ComponentSymbolVariantEditDialog& other) = delete;
69  const Workspace& ws, std::shared_ptr<const Component> cmp,
70  std::shared_ptr<ComponentSymbolVariant> symbVar,
71  QWidget* parent = nullptr) noexcept;
73 
74  // Setters
75  void setReadOnly(bool readOnly) noexcept;
76 
77  // Operator Overloadings
79  const ComponentSymbolVariantEditDialog& rhs) = delete;
80 
81 private: // Methods
82  void accept() noexcept override;
83  void schedulePreviewUpdate() noexcept;
84  void schedulePreviewTextsUpdate() noexcept;
85  void updatePreview() noexcept;
86 
87 private: // Data
89  std::shared_ptr<const Component> mComponent;
90  std::shared_ptr<ComponentSymbolVariant> mOriginalSymbVar;
92  QScopedPointer<GraphicsScene> mGraphicsScene;
93  QScopedPointer<DefaultGraphicsLayerProvider> mGraphicsLayerProvider;
94  std::shared_ptr<LibraryElementCache> mLibraryElementCache;
95  QScopedPointer<Ui::ComponentSymbolVariantEditDialog> mUi;
96 
99  QList<std::shared_ptr<Symbol>> mSymbols;
100  QList<std::shared_ptr<SymbolGraphicsItem>> mGraphicsItems;
101 };
102 
103 /*******************************************************************************
104  * End of File
105  ******************************************************************************/
106 
107 } // namespace editor
108 } // namespace librepcb
109 
110 #endif
bool mPreviewTextsUpdateScheduled
Definition: componentsymbolvarianteditdialog.h:98
QScopedPointer< DefaultGraphicsLayerProvider > mGraphicsLayerProvider
Definition: componentsymbolvarianteditdialog.h:93
Definition: occmodel.cpp:77
QScopedPointer< Ui::ComponentSymbolVariantEditDialog > mUi
Definition: componentsymbolvarianteditdialog.h:95
ComponentSymbolVariant mSymbVar
Definition: componentsymbolvarianteditdialog.h:91
QList< std::shared_ptr< SymbolGraphicsItem > > mGraphicsItems
Definition: componentsymbolvarianteditdialog.h:100
The ComponentSymbolVariantEditDialog class.
Definition: componentsymbolvarianteditdialog.h:60
std::shared_ptr< ComponentSymbolVariant > mOriginalSymbVar
Definition: componentsymbolvarianteditdialog.h:90
QList< std::shared_ptr< Symbol > > mSymbols
Definition: componentsymbolvarianteditdialog.h:99
std::shared_ptr< const Component > mComponent
Definition: componentsymbolvarianteditdialog.h:89
bool mPreviewUpdateScheduled
Definition: componentsymbolvarianteditdialog.h:97
The ComponentSymbolVariant class represents a symbol variant of a component.
Definition: componentsymbolvariant.h:53
std::shared_ptr< LibraryElementCache > mLibraryElementCache
Definition: componentsymbolvarianteditdialog.h:94
const Workspace & mWorkspace
Definition: componentsymbolvarianteditdialog.h:88
The Workspace class represents a workspace with all its data (library, projects, settings, ...)
Definition: workspace.h:54
QScopedPointer< GraphicsScene > mGraphicsScene
Definition: componentsymbolvarianteditdialog.h:92