LibrePCB Developers Documentation
categorytreelabeltextbuilder.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_CATEGORYTREELABELTEXTBUILDER_H
21#define LIBREPCB_EDITOR_CATEGORYTREELABELTEXTBUILDER_H
22
23/*******************************************************************************
24 * Includes
25 ******************************************************************************/
26#include "categorytreebuilder.h"
27
30
31#include <QtCore>
32#include <QtWidgets>
33
34/*******************************************************************************
35 * Namespace / Forward Declarations
36 ******************************************************************************/
37namespace librepcb {
38
39class WorkspaceLibraryDb;
40
41namespace editor {
42
43/*******************************************************************************
44 * Class CategoryTreeLabelTextBuilder
45 ******************************************************************************/
46
50template <typename ElementType>
52 Q_DECLARE_TR_FUNCTIONS(CategoryTreeLabelTextBuilder)
53
54public:
55 // Constructors / Destructor
58 delete;
60 const QStringList& localeOrder,
61 bool nulloptIsRootCategory,
62 QLabel& label) noexcept;
64
65 // Setters
66 void setOneLine(bool oneLine) noexcept { mOneLine = oneLine; }
67 void setPleaseChooseIfEmpty(bool choose) noexcept { mChooseIfEmpty = choose; }
68 void setText(const QString& text) noexcept;
69 void setErrorText(const QString& error) noexcept;
70
71 // General Methods
72 bool updateText(const tl::optional<Uuid>& category) noexcept;
73
74 // Operator Overloadings
76 const CategoryTreeLabelTextBuilder& rhs) = delete;
77
78private: // Methods
79 void setText(const QStringList& lines) noexcept;
80
81private: // Data
83 QLabel& mLabel;
86};
87
92
93/*******************************************************************************
94 * End of File
95 ******************************************************************************/
96
97} // namespace editor
98} // namespace librepcb
99
100#endif
The WorkspaceLibraryDb class.
Definition: workspacelibrarydb.h:57
Helper class to extract a category tree from librepcb::WorkspaceLibraryDb.
Definition: categorytreebuilder.h:50
The CategoryTreeLabelTextBuilder class.
Definition: categorytreelabeltextbuilder.h:51
void setOneLine(bool oneLine) noexcept
Definition: categorytreelabeltextbuilder.h:66
bool mOneLine
Definition: categorytreelabeltextbuilder.h:84
CategoryTreeLabelTextBuilder & operator=(const CategoryTreeLabelTextBuilder &rhs)=delete
void setText(const QString &text) noexcept
Definition: categorytreelabeltextbuilder.cpp:58
void setPleaseChooseIfEmpty(bool choose) noexcept
Definition: categorytreelabeltextbuilder.h:67
void setErrorText(const QString &error) noexcept
Definition: categorytreelabeltextbuilder.cpp:65
CategoryTreeLabelTextBuilder(const CategoryTreeLabelTextBuilder &other)=delete
CategoryTreeBuilder< ElementType > mBuilder
Definition: categorytreelabeltextbuilder.h:82
QLabel & mLabel
Definition: categorytreelabeltextbuilder.h:83
~CategoryTreeLabelTextBuilder() noexcept
Definition: categorytreelabeltextbuilder.cpp:50
bool mChooseIfEmpty
Definition: categorytreelabeltextbuilder.h:85
bool updateText(const tl::optional< Uuid > &category) noexcept
Definition: categorytreelabeltextbuilder.cpp:76
CategoryTreeLabelTextBuilder< PackageCategory > PackageCategoryTreeLabelTextBuilder
Definition: categorytreelabeltextbuilder.h:91
CategoryTreeLabelTextBuilder< ComponentCategory > ComponentCategoryTreeLabelTextBuilder
Definition: categorytreelabeltextbuilder.h:89
Definition: occmodel.cpp:77