LibrePCB Developers Documentation
editorcommandcategory.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_EDITORCOMMANDCATEGORY_H
21#define LIBREPCB_EDITOR_EDITORCOMMANDCATEGORY_H
22
23/*******************************************************************************
24 * Includes
25 ******************************************************************************/
26#include <QtCore>
27#include <QtWidgets>
28
29/*******************************************************************************
30 * Namespace / Forward Declarations
31 ******************************************************************************/
32namespace librepcb {
33namespace editor {
34
35/*******************************************************************************
36 * Class EditorCommandCategory
37 ******************************************************************************/
38
42class EditorCommandCategory final : public QObject {
43 Q_OBJECT
44
45public:
46 // Constructors / Destructor
49 EditorCommandCategory(const QString& objectName, const char* text,
50 bool configurable, QObject* parent = nullptr) noexcept
51 : QObject(parent),
52 mTextNoTr(text),
53 mText(text),
54 mConfigurable(configurable) {
55 setObjectName(objectName);
57 }
59
60 // Getters
61 const char* getTextNoTr() const noexcept { return mTextNoTr; }
62 const QString& getText() const noexcept { return mText; }
63 bool isConfigurable() const noexcept { return mConfigurable; }
64
65 // General Methods
66 void updateTranslations() noexcept {
67 // Note: Translations are done within the EditorCommandSet context.
68 mText = QCoreApplication::translate("EditorCommandSet", mTextNoTr);
69 }
70
71 // Operator Overloadings
73
74private: // Data
75 const char* mTextNoTr;
76 QString mText;
78};
79
80/*******************************************************************************
81 * End of File
82 ******************************************************************************/
83
84} // namespace editor
85} // namespace librepcb
86
87#endif
Category for librepcb::editor::EditorCommand.
Definition: editorcommandcategory.h:42
bool isConfigurable() const noexcept
Definition: editorcommandcategory.h:63
void updateTranslations() noexcept
Definition: editorcommandcategory.h:66
EditorCommandCategory(const EditorCommandCategory &other)=delete
QString mText
Definition: editorcommandcategory.h:76
const QString & getText() const noexcept
Definition: editorcommandcategory.h:62
const char * getTextNoTr() const noexcept
Definition: editorcommandcategory.h:61
const char * mTextNoTr
Definition: editorcommandcategory.h:75
~EditorCommandCategory() noexcept
Definition: editorcommandcategory.h:58
EditorCommandCategory & operator=(const EditorCommandCategory &rhs)=delete
EditorCommandCategory(const QString &objectName, const char *text, bool configurable, QObject *parent=nullptr) noexcept
Definition: editorcommandcategory.h:49
bool mConfigurable
Definition: editorcommandcategory.h:77
Definition: occmodel.cpp:77