LibrePCB Developers Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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_LIBRARY_EDITOR_NEWELEMENTWIZARDPAGE_COPYFROM_H
21 #define LIBREPCB_LIBRARY_EDITOR_NEWELEMENTWIZARDPAGE_COPYFROM_H
22 
23 /*******************************************************************************
24  * Includes
25  ******************************************************************************/
27 
28 #include <QtCore>
29 #include <QtWidgets>
30 
31 /*******************************************************************************
32  * Namespace / Forward Declarations
33  ******************************************************************************/
34 namespace librepcb {
35 namespace library {
36 
37 class LibraryBaseElement;
38 
39 namespace editor {
40 
41 namespace Ui {
42 class NewElementWizardPage_CopyFrom;
43 }
44 
45 /*******************************************************************************
46  * Class NewElementWizardPage_CopyFrom
47  ******************************************************************************/
48 
52 class NewElementWizardPage_CopyFrom final : public QWizardPage {
53  Q_OBJECT
54 
55 public:
56  // Constructors / Destructor
59  delete;
61  QWidget* parent = 0) noexcept;
63 
64  // Getters
65  bool validatePage() noexcept override;
66  bool isComplete() const noexcept override;
67  int nextId() const noexcept override;
68 
69  // Operator Overloadings
71  const NewElementWizardPage_CopyFrom& rhs) = delete;
72 
73 private: // Methods
74  void treeView_currentItemChanged(const QModelIndex& current,
75  const QModelIndex& previous) noexcept;
76  void treeView_doubleClicked(const QModelIndex& item) noexcept;
77  void listWidget_currentItemChanged(QListWidgetItem* current,
78  QListWidgetItem* previous) noexcept;
79  void listWidget_itemDoubleClicked(QListWidgetItem* item) noexcept;
80  void setSelectedCategory(const tl::optional<Uuid>& uuid) noexcept;
81  void setSelectedElement(const FilePath& fp) noexcept;
82  void setCategoryTreeModel(QAbstractItemModel* model) noexcept;
83  FilePath getCategoryFilePath(const tl::optional<Uuid>& category) const;
84  QSet<Uuid> getElementsByCategory(const tl::optional<Uuid>& category) const;
85  void getElementMetadata(const Uuid& uuid, FilePath& fp, QString& name) const;
86  void initializePage() noexcept override;
87  void cleanupPage() noexcept override;
88 
89 private: // Data
91  QScopedPointer<Ui::NewElementWizardPage_CopyFrom> mUi;
92  QScopedPointer<QAbstractItemModel> mCategoryTreeModel;
94  tl::optional<Uuid> mSelectedCategoryUuid;
96 };
97 
98 /*******************************************************************************
99  * End of File
100  ******************************************************************************/
101 
102 } // namespace editor
103 } // namespace library
104 } // namespace librepcb
105 
106 #endif // LIBREPCB_LIBRARY_EDITOR_NEWELEMENTWIZARDPAGE_COPYFROM_H
void cleanupPage() noexceptoverride
Definition: newelementwizardpage_copyfrom.cpp:299
FilePath getCategoryFilePath(const tl::optional< Uuid > &category) const
Definition: newelementwizardpage_copyfrom.cpp:173
void getElementMetadata(const Uuid &uuid, FilePath &fp, QString &name) const
Definition: newelementwizardpage_copyfrom.cpp:212
void initializePage() noexceptoverride
Definition: newelementwizardpage_copyfrom.cpp:245
The NewElementWizardContext class.
Definition: newelementwizardcontext.h:60
bool isComplete() const noexceptoverride
Definition: newelementwizardpage_copyfrom.cpp:72
bool validatePage() noexceptoverride
Definition: newelementwizardpage_copyfrom.cpp:67
QScopedPointer< QAbstractItemModel > mCategoryTreeModel
Definition: newelementwizardpage_copyfrom.h:92
int nextId() const noexceptoverride
Definition: newelementwizardpage_copyfrom.cpp:76
void setCategoryTreeModel(QAbstractItemModel *model) noexcept
Definition: newelementwizardpage_copyfrom.cpp:163
void listWidget_currentItemChanged(QListWidgetItem *current, QListWidgetItem *previous) noexcept
Definition: newelementwizardpage_copyfrom.cpp:97
QSet< Uuid > getElementsByCategory(const tl::optional< Uuid > &category) const
Definition: newelementwizardpage_copyfrom.cpp:192
The NewElementWizardPage_CopyFrom class.
Definition: newelementwizardpage_copyfrom.h:52
NewElementWizardPage_CopyFrom & operator=(const NewElementWizardPage_CopyFrom &rhs)=delete
This class represents absolute, well-formatted paths to files or directories.
Definition: filepath.h:127
void treeView_doubleClicked(const QModelIndex &item) noexcept
Definition: newelementwizardpage_copyfrom.cpp:91
~NewElementWizardPage_CopyFrom() noexcept
Definition: newelementwizardpage_copyfrom.cpp:60
bool mIsCategoryElement
Definition: newelementwizardpage_copyfrom.h:93
void treeView_currentItemChanged(const QModelIndex &current, const QModelIndex &previous) noexcept
Definition: newelementwizardpage_copyfrom.cpp:84
NewElementWizardContext & mContext
Definition: newelementwizardpage_copyfrom.h:90
void setSelectedElement(const FilePath &fp) noexcept
Definition: newelementwizardpage_copyfrom.cpp:148
tl::optional< Uuid > mSelectedCategoryUuid
Definition: newelementwizardpage_copyfrom.h:94
bool mIsComplete
Definition: newelementwizardpage_copyfrom.h:95
void setSelectedCategory(const tl::optional< Uuid > &uuid) noexcept
Definition: newelementwizardpage_copyfrom.cpp:117
The Uuid class is a replacement for QUuid to get UUID strings without {} braces.
Definition: uuid.h:58
QScopedPointer< Ui::NewElementWizardPage_CopyFrom > mUi
Definition: newelementwizardpage_copyfrom.h:91
void listWidget_itemDoubleClicked(QListWidgetItem *item) noexcept
Definition: newelementwizardpage_copyfrom.cpp:108