LibrePCB Developers Documentation
bomgeneratordialog.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_BOMGENERATORDIALOG_H
21 #define LIBREPCB_EDITOR_BOMGENERATORDIALOG_H
22 
23 /*******************************************************************************
24  * Includes
25  ******************************************************************************/
27 #include <optional/tl/optional.hpp>
28 
29 #include <QtCore>
30 #include <QtWidgets>
31 
32 #include <memory>
33 
34 /*******************************************************************************
35  * Namespace / Forward Declarations
36  ******************************************************************************/
37 namespace librepcb {
38 
39 class AssemblyVariant;
40 class Board;
41 class Bom;
42 class Project;
43 class Uuid;
44 class WorkspaceSettings;
45 
46 namespace editor {
47 
48 namespace Ui {
49 class BomGeneratorDialog;
50 }
51 
52 /*******************************************************************************
53  * Class BomGeneratorDialog
54  ******************************************************************************/
55 
59 class BomGeneratorDialog final : public QDialog {
60  Q_OBJECT
61 
62 public:
63  // Constructors / Destructor
64  BomGeneratorDialog() = delete;
65  BomGeneratorDialog(const BomGeneratorDialog& other) = delete;
66  BomGeneratorDialog(const WorkspaceSettings& settings, Project& project,
67  const Board* board = nullptr,
68  QWidget* parent = nullptr) noexcept;
69  ~BomGeneratorDialog() noexcept;
70 
71  // Operator Overloads
72  BomGeneratorDialog& operator=(const BomGeneratorDialog& rhs) = delete;
73 
74 signals:
75  void projectSettingsModified();
76 
77 private: // GUI Event Handlers
78  void cbxBoardCurrentIndexChanged(int index) noexcept;
79  void btnChooseOutputPathClicked() noexcept;
80  void btnOpenOutputDirectoryClicked() noexcept;
81  void btnGenerateClicked() noexcept;
82 
83 private: // Methods
84  void updateAttributes() noexcept;
85  void updateBom() noexcept;
86  void updateTable() noexcept;
87  std::shared_ptr<AssemblyVariant> getAssemblyVariant() const noexcept;
88  tl::optional<Uuid> getAssemblyVariantUuid(bool throwIfNullopt) const;
89  FilePath getOutputFilePath() const noexcept;
90 
91 private: // Data
94  std::shared_ptr<Bom> mBom;
95  QScopedPointer<Ui::BomGeneratorDialog> mUi;
96  QPointer<QPushButton> mBtnGenerate;
97 };
98 
99 /*******************************************************************************
100  * End of File
101  ******************************************************************************/
102 
103 } // namespace editor
104 } // namespace librepcb
105 
106 #endif
const WorkspaceSettings & mSettings
Definition: bomgeneratordialog.h:92
Definition: occmodel.cpp:76
Container for all workspace related settings.
Definition: workspacesettings.h:60
QScopedPointer< Ui::BomGeneratorDialog > mUi
Definition: bomgeneratordialog.h:95
Project & mProject
Definition: bomgeneratordialog.h:93
The Board class represents a PCB of a project and is always part of a circuit.
Definition: board.h:73
The BomGeneratorDialog class.
Definition: bomgeneratordialog.h:59
QPointer< QPushButton > mBtnGenerate
Definition: bomgeneratordialog.h:96
This class represents absolute, well-formatted paths to files or directories.
Definition: filepath.h:127
std::shared_ptr< Bom > mBom
Definition: bomgeneratordialog.h:94
The Project class represents a whole (opened) project with all its content.
Definition: project.h:71