LibrePCB Developers Documentation
Loading...
Searching...
No Matches
packagechooserdialog.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_PACKAGECHOOSERDIALOG_H
21#define LIBREPCB_EDITOR_PACKAGECHOOSERDIALOG_H
22
23/*******************************************************************************
24 * Includes
25 ******************************************************************************/
28
29#include <QtCore>
30#include <QtWidgets>
31
32#include <memory>
33
34/*******************************************************************************
35 * Namespace / Forward Declarations
36 ******************************************************************************/
37namespace librepcb {
38
39class Package;
40class Workspace;
41
42namespace editor {
43
44class FootprintGraphicsItem;
45class GraphicsLayerList;
46class GraphicsScene;
47
48namespace Ui {
49class PackageChooserDialog;
50}
51
52/*******************************************************************************
53 * Class PackageChooserDialog
54 ******************************************************************************/
55
59class PackageChooserDialog final : public QDialog {
60 Q_OBJECT
61
62public:
63 // Constructors / Destructor
66 PackageChooserDialog(const Workspace& ws, const GraphicsLayerList* layers,
67 QWidget* parent = nullptr) noexcept;
68 ~PackageChooserDialog() noexcept;
69
70 // Getters
71 const std::optional<Uuid>& getSelectedPackageUuid() const noexcept {
73 }
74
75 // Operator Overloadings
77
78private: // Methods
79 void searchEditTextChanged(const QString& text) noexcept;
80 void treeCategories_currentItemChanged(const QModelIndex& current,
81 const QModelIndex& previous) noexcept;
82 void listPackages_currentItemChanged(QListWidgetItem* current,
83 QListWidgetItem* previous) noexcept;
84 void listPackages_itemDoubleClicked(QListWidgetItem* item) noexcept;
85 void searchPackages(const QString& input);
86 void setSelectedCategory(const std::optional<Uuid>& uuid) noexcept;
87 void setSelectedPackage(const std::optional<Uuid>& uuid) noexcept;
88 void updatePreview(const FilePath& fp) noexcept;
89 void accept() noexcept override;
90 const QStringList& localeOrder() const noexcept;
91
92private: // Data
95 QScopedPointer<Ui::PackageChooserDialog> mUi;
96 QScopedPointer<QAbstractItemModel> mCategoryTreeModel;
100
101 // preview
102 std::unique_ptr<Package> mPackage;
105};
106
107/*******************************************************************************
108 * End of File
109 ******************************************************************************/
110
111} // namespace editor
112} // namespace librepcb
113
114#endif
This class represents absolute, well-formatted paths to files or directories.
Definition filepath.h:127
The Package class represents a package of a component (including footprint and 3D model)
Definition package.h:59
The Uuid class is a replacement for QUuid to get UUID strings without {} braces.
Definition uuid.h:56
The Workspace class represents a workspace with all its data (library, projects, settings,...
Definition workspace.h:54
The FootprintGraphicsItem class.
Definition footprintgraphicsitem.h:66
The GraphicsLayerList class.
Definition graphicslayerlist.h:48
The GraphicsScene class.
Definition graphicsscene.h:64
The PackageChooserDialog class.
Definition packagechooserdialog.h:59
const QStringList & localeOrder() const noexcept
Definition packagechooserdialog.cpp:263
PackageChooserDialog(const PackageChooserDialog &other)=delete
PackageChooserDialog & operator=(const PackageChooserDialog &rhs)=delete
std::optional< Uuid > mSelectedPackageUuid
Definition packagechooserdialog.h:99
const GraphicsLayerList * mLayers
Definition packagechooserdialog.h:94
void setSelectedPackage(const std::optional< Uuid > &uuid) noexcept
Definition packagechooserdialog.cpp:208
void listPackages_itemDoubleClicked(QListWidgetItem *item) noexcept
Definition packagechooserdialog.cpp:139
QScopedPointer< GraphicsScene > mGraphicsScene
Definition packagechooserdialog.h:103
QScopedPointer< FootprintGraphicsItem > mGraphicsItem
Definition packagechooserdialog.h:104
std::optional< Uuid > mSelectedCategoryUuid
Definition packagechooserdialog.h:98
QScopedPointer< QAbstractItemModel > mCategoryTreeModel
Definition packagechooserdialog.h:96
void treeCategories_currentItemChanged(const QModelIndex &current, const QModelIndex &previous) noexcept
Definition packagechooserdialog.cpp:121
const Workspace & mWorkspace
Definition packagechooserdialog.h:93
const std::optional< Uuid > & getSelectedPackageUuid() const noexcept
Definition packagechooserdialog.h:71
void setSelectedCategory(const std::optional< Uuid > &uuid) noexcept
Definition packagechooserdialog.cpp:173
void updatePreview(const FilePath &fp) noexcept
Definition packagechooserdialog.cpp:231
void searchPackages(const QString &input)
Definition packagechooserdialog.cpp:148
void searchEditTextChanged(const QString &text) noexcept
Definition packagechooserdialog.cpp:107
std::unique_ptr< Package > mPackage
Definition packagechooserdialog.h:102
QScopedPointer< Ui::PackageChooserDialog > mUi
Definition packagechooserdialog.h:95
bool mCategorySelected
Definition packagechooserdialog.h:97
void listPackages_currentItemChanged(QListWidgetItem *current, QListWidgetItem *previous) noexcept
Definition packagechooserdialog.cpp:128
void accept() noexcept override
Definition packagechooserdialog.cpp:254
Definition occmodel.cpp:77
Definition uuid.h:186