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 
58 class NewElementWizardPage_CopyFrom final : public QWizardPage {
59  Q_OBJECT
60 
61 public:
62  // Constructors / Destructor
65  delete;
67  QWidget* parent = 0) noexcept;
69 
70  // Getters
71  bool validatePage() noexcept override;
72  bool isComplete() const noexcept override;
73  int nextId() const noexcept override;
74 
75  // Operator Overloadings
77  const NewElementWizardPage_CopyFrom& rhs) = delete;
78 
79 private: // Methods
80  void treeView_currentItemChanged(const QModelIndex& current,
81  const QModelIndex& previous) noexcept;
82  void treeView_doubleClicked(const QModelIndex& item) noexcept;
83  void listWidget_currentItemChanged(QListWidgetItem* current,
84  QListWidgetItem* previous) noexcept;
85  void listWidget_itemDoubleClicked(QListWidgetItem* item) noexcept;
86  void setSelectedCategory(const tl::optional<Uuid>& uuid) noexcept;
87  void setSelectedElement(const FilePath& fp) noexcept;
88  void setCategoryTreeModel(QAbstractItemModel* model) noexcept;
89  FilePath getCategoryFilePath(const tl::optional<Uuid>& category) const;
90  QSet<Uuid> getElementsByCategory(const tl::optional<Uuid>& category) const;
91  void getElementMetadata(const Uuid& uuid, FilePath& fp, QString& name) const;
92  void initializePage() noexcept override;
93  void cleanupPage() noexcept override;
94 
95 private: // Data
97  QScopedPointer<Ui::NewElementWizardPage_CopyFrom> mUi;
98  QScopedPointer<QAbstractItemModel> mCategoryTreeModel;
100  tl::optional<Uuid> mSelectedCategoryUuid;
101  QScopedPointer<LibraryBaseElement> mSelectedElement;
102 };
103 
104 /*******************************************************************************
105  * End of File
106  ******************************************************************************/
107 
108 } // namespace editor
109 } // namespace library
110 } // namespace librepcb
111 
112 #endif // LIBREPCB_LIBRARY_EDITOR_NEWELEMENTWIZARDPAGE_COPYFROM_H
void cleanupPage() noexceptoverride
Definition: newelementwizardpage_copyfrom.cpp:483
FilePath getCategoryFilePath(const tl::optional< Uuid > &category) const
Definition: newelementwizardpage_copyfrom.cpp:377
QScopedPointer< LibraryBaseElement > mSelectedElement
Definition: newelementwizardpage_copyfrom.h:101
void getElementMetadata(const Uuid &uuid, FilePath &fp, QString &name) const
Definition: newelementwizardpage_copyfrom.cpp:416
void initializePage() noexceptoverride
Definition: newelementwizardpage_copyfrom.cpp:449
The NewElementWizardContext class.
Definition: newelementwizardcontext.h:63
bool isComplete() const noexceptoverride
Definition: newelementwizardpage_copyfrom.cpp:245
bool validatePage() noexceptoverride
Definition: newelementwizardpage_copyfrom.cpp:65
QScopedPointer< QAbstractItemModel > mCategoryTreeModel
Definition: newelementwizardpage_copyfrom.h:98
int nextId() const noexceptoverride
Definition: newelementwizardpage_copyfrom.cpp:249
void setCategoryTreeModel(QAbstractItemModel *model) noexcept
Definition: newelementwizardpage_copyfrom.cpp:367
void listWidget_currentItemChanged(QListWidgetItem *current, QListWidgetItem *previous) noexcept
Definition: newelementwizardpage_copyfrom.cpp:270
QSet< Uuid > getElementsByCategory(const tl::optional< Uuid > &category) const
Definition: newelementwizardpage_copyfrom.cpp:396
The NewElementWizardPage_CopyFrom class.
Definition: newelementwizardpage_copyfrom.h:58
NewElementWizardPage_CopyFrom & operator=(const NewElementWizardPage_CopyFrom &rhs)=delete
This class represents absolute, well-formatted paths to files or directories.
Definition: filepath.h:130
void treeView_doubleClicked(const QModelIndex &item) noexcept
Definition: newelementwizardpage_copyfrom.cpp:264
~NewElementWizardPage_CopyFrom() noexcept
Definition: newelementwizardpage_copyfrom.cpp:58
bool mIsCategoryElement
Definition: newelementwizardpage_copyfrom.h:99
void treeView_currentItemChanged(const QModelIndex &current, const QModelIndex &previous) noexcept
Definition: newelementwizardpage_copyfrom.cpp:257
NewElementWizardContext & mContext
Definition: newelementwizardpage_copyfrom.h:96
void setSelectedElement(const FilePath &fp) noexcept
Definition: newelementwizardpage_copyfrom.cpp:321
tl::optional< Uuid > mSelectedCategoryUuid
Definition: newelementwizardpage_copyfrom.h:100
void setSelectedCategory(const tl::optional< Uuid > &uuid) noexcept
Definition: newelementwizardpage_copyfrom.cpp:290
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:97
void listWidget_itemDoubleClicked(QListWidgetItem *item) noexcept
Definition: newelementwizardpage_copyfrom.cpp:281