LibrePCB Developers Documentation
newelementwizardpage_copyfrom.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_NEWELEMENTWIZARDPAGE_COPYFROM_H
21#define LIBREPCB_EDITOR_NEWELEMENTWIZARDPAGE_COPYFROM_H
22
23/*******************************************************************************
24 * Includes
25 ******************************************************************************/
27
28#include <QtCore>
29#include <QtWidgets>
30
31/*******************************************************************************
32 * Namespace / Forward Declarations
33 ******************************************************************************/
34namespace librepcb {
35
36class LibraryBaseElement;
37
38namespace editor {
39
40namespace Ui {
41class NewElementWizardPage_CopyFrom;
42}
43
44/*******************************************************************************
45 * Class NewElementWizardPage_CopyFrom
46 ******************************************************************************/
47
51class NewElementWizardPage_CopyFrom final : public QWizardPage {
52 Q_OBJECT
53
54public:
55 // Constructors / Destructor
58 delete;
60 QWidget* parent = 0) noexcept;
62
63 // Getters
64 bool validatePage() noexcept override;
65 bool isComplete() const noexcept override;
66 int nextId() const noexcept override;
67
68 // Operator Overloadings
70 const NewElementWizardPage_CopyFrom& rhs) = delete;
71
72private: // Methods
73 void treeView_currentItemChanged(const QModelIndex& current,
74 const QModelIndex& previous) noexcept;
75 void treeView_doubleClicked(const QModelIndex& item) noexcept;
76 void listWidget_currentItemChanged(QListWidgetItem* current,
77 QListWidgetItem* previous) noexcept;
78 void listWidget_itemDoubleClicked(QListWidgetItem* item) noexcept;
79 void setSelectedCategory(const tl::optional<Uuid>& uuid) noexcept;
80 void setSelectedElement(const FilePath& fp) noexcept;
81 void setCategoryTreeModel(QAbstractItemModel* model) noexcept;
82 FilePath getCategoryFilePath(const tl::optional<Uuid>& category) const;
83 QSet<Uuid> getElementsByCategory(const tl::optional<Uuid>& category) const;
84 void getElementMetadata(const Uuid& uuid, FilePath& fp, QString& name) const;
85 void initializePage() noexcept override;
86 void cleanupPage() noexcept override;
87
88private: // Data
91 QScopedPointer<QAbstractItemModel> mCategoryTreeModel;
95};
96
97/*******************************************************************************
98 * End of File
99 ******************************************************************************/
100
101} // namespace editor
102} // namespace librepcb
103
104#endif
This class represents absolute, well-formatted paths to files or directories.
Definition: filepath.h:129
The Uuid class is a replacement for QUuid to get UUID strings without {} braces.
Definition: uuid.h:58
The NewElementWizardContext class.
Definition: newelementwizardcontext.h:58
The NewElementWizardPage_CopyFrom class.
Definition: newelementwizardpage_copyfrom.h:51
void setCategoryTreeModel(QAbstractItemModel *model) noexcept
Definition: newelementwizardpage_copyfrom.cpp:179
QScopedPointer< Ui::NewElementWizardPage_CopyFrom > mUi
Definition: newelementwizardpage_copyfrom.h:90
int nextId() const noexcept override
Definition: newelementwizardpage_copyfrom.cpp:92
void initializePage() noexcept override
Definition: newelementwizardpage_copyfrom.cpp:262
QSet< Uuid > getElementsByCategory(const tl::optional< Uuid > &category) const
Definition: newelementwizardpage_copyfrom.cpp:209
void cleanupPage() noexcept override
Definition: newelementwizardpage_copyfrom.cpp:317
bool mIsComplete
Definition: newelementwizardpage_copyfrom.h:94
NewElementWizardContext & mContext
Definition: newelementwizardpage_copyfrom.h:89
tl::optional< Uuid > mSelectedCategoryUuid
Definition: newelementwizardpage_copyfrom.h:93
QScopedPointer< QAbstractItemModel > mCategoryTreeModel
Definition: newelementwizardpage_copyfrom.h:91
FilePath getCategoryFilePath(const tl::optional< Uuid > &category) const
Definition: newelementwizardpage_copyfrom.cpp:189
bool isComplete() const noexcept override
Definition: newelementwizardpage_copyfrom.cpp:88
bool validatePage() noexcept override
Definition: newelementwizardpage_copyfrom.cpp:83
void setSelectedCategory(const tl::optional< Uuid > &uuid) noexcept
Definition: newelementwizardpage_copyfrom.cpp:133
void setSelectedElement(const FilePath &fp) noexcept
Definition: newelementwizardpage_copyfrom.cpp:164
bool mIsCategoryElement
Definition: newelementwizardpage_copyfrom.h:92
void treeView_currentItemChanged(const QModelIndex &current, const QModelIndex &previous) noexcept
Definition: newelementwizardpage_copyfrom.cpp:100
void treeView_doubleClicked(const QModelIndex &item) noexcept
Definition: newelementwizardpage_copyfrom.cpp:107
void listWidget_currentItemChanged(QListWidgetItem *current, QListWidgetItem *previous) noexcept
Definition: newelementwizardpage_copyfrom.cpp:113
void getElementMetadata(const Uuid &uuid, FilePath &fp, QString &name) const
Definition: newelementwizardpage_copyfrom.cpp:229
NewElementWizardPage_CopyFrom(const NewElementWizardPage_CopyFrom &other)=delete
void listWidget_itemDoubleClicked(QListWidgetItem *item) noexcept
Definition: newelementwizardpage_copyfrom.cpp:124
Definition: occmodel.cpp:77
Definition: uuid.h:183