LibrePCB Developers Documentation
Loading...
Searching...
No Matches
kicadlibraryimportwizardcontext.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_KICADLIBRARYIMPORTWIZARDCONTEXT_H
21#define LIBREPCB_EDITOR_KICADLIBRARYIMPORTWIZARDCONTEXT_H
22
23/*******************************************************************************
24 * Includes
25 ******************************************************************************/
28
29#include <QtCore>
30
31#include <optional>
32
33/*******************************************************************************
34 * Namespace / Forward Declarations
35 ******************************************************************************/
36namespace librepcb {
37
38class MessageLogger;
39class Workspace;
40
41namespace kicadimport {
43}
44
45namespace editor {
46
47/*******************************************************************************
48 * Class KiCadLibraryImportWizardContext
49 ******************************************************************************/
50
54class KiCadLibraryImportWizardContext final : public QObject {
55 Q_OBJECT
56
57public:
58 static constexpr const char* NAME_PREFIX = "KICAD_";
59
60 // Constructors / Destructor
63 const KiCadLibraryImportWizardContext& other) = delete;
65 const FilePath& dstLibFp,
66 QObject* parent = nullptr) noexcept;
68
69 // Getters
70 Workspace& getWorkspace() const noexcept { return mWorkspace; }
71 const FilePath& getLibsPath() const noexcept { return mLibsPath; }
72 const FilePath& getShapes3dPath() const noexcept { return mShapes3dPath; }
73 bool getAddNamePrefix() const noexcept { return mAddNamePrefix; }
74 const std::optional<Uuid>& getComponentCategory() const noexcept {
76 }
77 const std::optional<Uuid>& getPackageCategory() const noexcept {
79 }
81 return *mImport;
82 }
83
84 // Setters
85 void setLibsPath(const QString& libsPath, const QString& shapes3dPath,
86 std::shared_ptr<MessageLogger> log) noexcept;
87 void setAddNamePrefix(bool add) noexcept;
88 void setComponentCategory(const std::optional<Uuid>& uuid) noexcept;
89 void setPackageCategory(const std::optional<Uuid>& uuid) noexcept;
90
91 // Operator Overloadings
93 const KiCadLibraryImportWizardContext& rhs) = delete;
94
95signals:
97
98private: // Data
103 std::optional<Uuid> mComponentCategoryUuid;
104 std::optional<Uuid> mPackageCategoryUuid;
105 QScopedPointer<kicadimport::KiCadLibraryImport> mImport;
106};
107
108/*******************************************************************************
109 * End of File
110 ******************************************************************************/
111
112} // namespace editor
113} // namespace librepcb
114
115#endif
This class represents absolute, well-formatted paths to files or directories.
Definition filepath.h:127
The Workspace class represents a workspace with all its data (library, projects, settings,...
Definition workspace.h:54
The KiCadLibraryImportWizardContext class.
Definition kicadlibraryimportwizardcontext.h:54
const std::optional< Uuid > & getComponentCategory() const noexcept
Definition kicadlibraryimportwizardcontext.h:74
void setLibsPath(const QString &libsPath, const QString &shapes3dPath, std::shared_ptr< MessageLogger > log) noexcept
Definition kicadlibraryimportwizardcontext.cpp:95
KiCadLibraryImportWizardContext(const KiCadLibraryImportWizardContext &other)=delete
std::optional< Uuid > mPackageCategoryUuid
Definition kicadlibraryimportwizardcontext.h:104
kicadimport::KiCadLibraryImport & getImport() const noexcept
Definition kicadlibraryimportwizardcontext.h:80
const FilePath & getShapes3dPath() const noexcept
Definition kicadlibraryimportwizardcontext.h:72
FilePath mShapes3dPath
Definition kicadlibraryimportwizardcontext.h:101
const std::optional< Uuid > & getPackageCategory() const noexcept
Definition kicadlibraryimportwizardcontext.h:77
void setComponentCategory(const std::optional< Uuid > &uuid) noexcept
Definition kicadlibraryimportwizardcontext.cpp:118
Workspace & getWorkspace() const noexcept
Definition kicadlibraryimportwizardcontext.h:70
void setAddNamePrefix(bool add) noexcept
Definition kicadlibraryimportwizardcontext.cpp:113
Workspace & mWorkspace
Definition kicadlibraryimportwizardcontext.h:99
void setPackageCategory(const std::optional< Uuid > &uuid) noexcept
Definition kicadlibraryimportwizardcontext.cpp:132
bool getAddNamePrefix() const noexcept
Definition kicadlibraryimportwizardcontext.h:73
QScopedPointer< kicadimport::KiCadLibraryImport > mImport
Definition kicadlibraryimportwizardcontext.h:105
FilePath mLibsPath
Definition kicadlibraryimportwizardcontext.h:100
bool mAddNamePrefix
Definition kicadlibraryimportwizardcontext.h:102
KiCadLibraryImportWizardContext & operator=(const KiCadLibraryImportWizardContext &rhs)=delete
std::optional< Uuid > mComponentCategoryUuid
Definition kicadlibraryimportwizardcontext.h:103
const FilePath & getLibsPath() const noexcept
Definition kicadlibraryimportwizardcontext.h:71
static constexpr const char * NAME_PREFIX
Definition kicadlibraryimportwizardcontext.h:58
KiCad library import.
Definition kicadlibraryimport.h:52
Definition occmodel.cpp:76