LibrePCB Developers Documentation
messagewidget.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_MESSAGEWIDGET_H
21#define LIBREPCB_EDITOR_MESSAGEWIDGET_H
22
23/*******************************************************************************
24 * Includes
25 ******************************************************************************/
26#include <QtCore>
27#include <QtWidgets>
28
29/*******************************************************************************
30 * Namespace / Forward Declarations
31 ******************************************************************************/
32namespace librepcb {
33
34class Workspace;
35
36namespace editor {
37
38/*******************************************************************************
39 * Class MessageWidget
40 ******************************************************************************/
41
55class MessageWidget final : public QWidget {
56 Q_OBJECT
57
58public:
59 // Constructors / Destructor
60 explicit MessageWidget(QWidget* parent = nullptr) noexcept;
61 MessageWidget(const MessageWidget& other) = delete;
62 ~MessageWidget() noexcept;
63
72 void init(const QString& message, bool active) noexcept;
73
85 void init(Workspace& workspace, const QString& dismissKey,
86 const QString& message, bool active) noexcept;
87
96 void setActive(bool active) noexcept;
97
98 // Operator Overloadings
99 MessageWidget& operator=(const MessageWidget& rhs) = delete;
100
101signals:
107 void linkActivated(const QString& link);
108
109private: // Methods
110 void setWorkspace(Workspace* workspace) noexcept;
112 void updateVisibility() noexcept;
113
114private: // Data
115 QPointer<QHBoxLayout> mLayout;
116 QScopedPointer<QLabel> mMessageLabel;
117 QScopedPointer<QLabel> mDismissLabel;
118 QScopedPointer<QLabel> mHideLabel;
119
121 QString mDismissKey;
124};
125
126/*******************************************************************************
127 * End of File
128 ******************************************************************************/
129
130} // namespace editor
131} // namespace librepcb
132
133#endif
The Workspace class represents a workspace with all its data (library, projects, settings,...
Definition: workspace.h:54
A widget containing a hidable, optionally dismissable message label.
Definition: messagewidget.h:55
QPointer< Workspace > mWorkspace
Definition: messagewidget.h:120
MessageWidget(QWidget *parent=nullptr) noexcept
Definition: messagewidget.cpp:41
void setActive(bool active) noexcept
Set whether the message should be shown (if not dismissed) or not.
Definition: messagewidget.cpp:124
MessageWidget(const MessageWidget &other)=delete
QScopedPointer< QLabel > mMessageLabel
Definition: messagewidget.h:116
void linkActivated(const QString &link)
A link in the message label has been clicked.
QScopedPointer< QLabel > mDismissLabel
Definition: messagewidget.h:117
QString mDismissKey
Definition: messagewidget.h:121
QPointer< QHBoxLayout > mLayout
Definition: messagewidget.h:115
void init(const QString &message, bool active) noexcept
Initialize widget without the "don't show again" feature.
Definition: messagewidget.cpp:107
~MessageWidget() noexcept
Definition: messagewidget.cpp:100
QScopedPointer< QLabel > mHideLabel
Definition: messagewidget.h:118
bool mActive
Definition: messagewidget.h:122
bool mTemporarilyHidden
Definition: messagewidget.h:123
void updateVisibility() noexcept
Definition: messagewidget.cpp:150
void dismissedMessagesModified() noexcept
void setWorkspace(Workspace *workspace) noexcept
Definition: messagewidget.cpp:136
Definition: occmodel.cpp:77