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
29#include <optional/tl/optional.hpp>
30
31#include <QtCore>
32#include <QtWidgets>
33
34#include <memory>
35
36/*******************************************************************************
37 * Namespace / Forward Declarations
38 ******************************************************************************/
39namespace librepcb {
40
41class AssemblyVariant;
42class Board;
43class Bom;
44class Project;
45class Uuid;
46class WorkspaceSettings;
47
48namespace editor {
49
50class PartInformationToolTip;
51
52namespace Ui {
53class BomGeneratorDialog;
54}
55
56/*******************************************************************************
57 * Class BomGeneratorDialog
58 ******************************************************************************/
59
63class BomGeneratorDialog final : public QDialog {
64 Q_OBJECT
65
66public:
67 // Constructors / Destructor
69 BomGeneratorDialog(const BomGeneratorDialog& other) = delete;
70 BomGeneratorDialog(const WorkspaceSettings& settings, Project& project,
71 const Board* board = nullptr,
72 QWidget* parent = nullptr) noexcept;
73 ~BomGeneratorDialog() noexcept;
74
75 // General Methods
76 virtual bool eventFilter(QObject* obj, QEvent* e) noexcept override;
77
78 // Operator Overloads
79 BomGeneratorDialog& operator=(const BomGeneratorDialog& rhs) = delete;
80
81signals:
83
84private: // GUI Event Handlers
85 void cbxBoardCurrentIndexChanged(int index) noexcept;
86 void btnChooseOutputPathClicked() noexcept;
87 void btnOpenOutputDirectoryClicked() noexcept;
88 void btnGenerateClicked() noexcept;
89 void tableCellDoubleClicked(int row, int column) noexcept;
90
91private: // Methods
92 void updateAttributes() noexcept;
93 void updateBom() noexcept;
94 void updateTable() noexcept;
95 void updatePartsInformation() noexcept;
96 std::shared_ptr<AssemblyVariant> getAssemblyVariant() const noexcept;
97 tl::optional<Uuid> getAssemblyVariantUuid(bool throwIfNullopt) const;
98 FilePath getOutputFilePath() const noexcept;
99
100private: // Data
103 std::shared_ptr<Bom> mBom;
104 QScopedPointer<Ui::BomGeneratorDialog> mUi;
105 QPointer<QPushButton> mBtnGenerate;
109};
110
111/*******************************************************************************
112 * End of File
113 ******************************************************************************/
114
115} // namespace editor
116} // namespace librepcb
117
118#endif
The AssemblyVariant class.
Definition: assemblyvariant.h:45
The Board class represents a PCB of a project and is always part of a circuit.
Definition: board.h:73
The Bom class represents a bill of materials list.
Definition: bom.h:84
This class represents absolute, well-formatted paths to files or directories.
Definition: filepath.h:129
The Project class represents a whole (opened) project with all its content.
Definition: project.h:71
The Uuid class is a replacement for QUuid to get UUID strings without {} braces.
Definition: uuid.h:58
Container for all workspace related settings.
Definition: workspacesettings.h:60
The BomGeneratorDialog class.
Definition: bomgeneratordialog.h:63
void updateTable() noexcept
Definition: bomgeneratordialog.cpp:310
FilePath getOutputFilePath() const noexcept
Definition: bomgeneratordialog.cpp:447
QScopedPointer< Ui::BomGeneratorDialog > mUi
Definition: bomgeneratordialog.h:104
void tableCellDoubleClicked(int row, int column) noexcept
Definition: bomgeneratordialog.cpp:264
void updateBom() noexcept
Definition: bomgeneratordialog.cpp:298
QScopedPointer< PartInformationToolTip > mPartToolTip
Definition: bomgeneratordialog.h:106
uint mPartInfoProgress
Definition: bomgeneratordialog.h:107
void btnOpenOutputDirectoryClicked() noexcept
Definition: bomgeneratordialog.cpp:238
BomGeneratorDialog(const BomGeneratorDialog &other)=delete
void cbxBoardCurrentIndexChanged(int index) noexcept
void btnChooseOutputPathClicked() noexcept
Definition: bomgeneratordialog.cpp:230
Project & mProject
Definition: bomgeneratordialog.h:102
const WorkspaceSettings & mSettings
Definition: bomgeneratordialog.h:101
std::shared_ptr< AssemblyVariant > getAssemblyVariant() const noexcept
Definition: bomgeneratordialog.cpp:430
void btnGenerateClicked() noexcept
Definition: bomgeneratordialog.cpp:243
bool mUpdatePartInformationScheduled
Definition: bomgeneratordialog.h:108
std::shared_ptr< Bom > mBom
Definition: bomgeneratordialog.h:103
void updateAttributes() noexcept
Definition: bomgeneratordialog.cpp:279
tl::optional< Uuid > getAssemblyVariantUuid(bool throwIfNullopt) const
Definition: bomgeneratordialog.cpp:437
virtual bool eventFilter(QObject *obj, QEvent *e) noexcept override
Definition: bomgeneratordialog.cpp:216
QPointer< QPushButton > mBtnGenerate
Definition: bomgeneratordialog.h:105
void updatePartsInformation() noexcept
Definition: bomgeneratordialog.cpp:348
The PartInformationToolTip class.
Definition: partinformationtooltip.h:56
Definition: occmodel.cpp:77
Definition: uuid.h:183