LibrePCB Developers Documentation
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
notification.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_NOTIFICATION_H
21#define LIBREPCB_EDITOR_NOTIFICATION_H
22
23/*******************************************************************************
24 * Includes
25 ******************************************************************************/
26#include "appwindow.h"
27
28#include <QtCore>
29
30/*******************************************************************************
31 * Namespace / Forward Declarations
32 ******************************************************************************/
33namespace librepcb {
34namespace editor {
35
36/*******************************************************************************
37 * Class Notification
38 ******************************************************************************/
39
43class Notification final : public QObject {
44 Q_OBJECT
45
46public:
47 // Constructors / Destructor
48 Notification() = delete;
49 Notification(const Notification& other) = delete;
50 explicit Notification(ui::NotificationType type, const QString& title,
51 const QString& description, const QString& buttonText,
52 const QString& dismissKey, bool autoPopUp,
53 QObject* parent = nullptr) noexcept;
54 ~Notification() noexcept;
55
56 // General Methods
57 const QString& getDismissKey() const noexcept { return mDismissKey; }
58 bool getAutoPopUp() const noexcept { return mAutoPopUp; }
59 const ui::NotificationData& getUiData() const noexcept { return mUiData; }
60 void setUiData(const ui::NotificationData& data) noexcept;
61 void resetState() noexcept;
62 void setTitle(const QString& title) noexcept;
63 void setDescription(const QString& description) noexcept;
64 void setProgress(int progress) noexcept;
65 void dismiss() noexcept;
66
67 // Operator Overloadings
68 Notification& operator=(const Notification& rhs) = delete;
69
70signals:
71 void changed(bool dismissed);
73
74private:
75 const QString mDismissKey;
76 const bool mAutoPopUp;
77 ui::NotificationData mUiData;
78};
79
80/*******************************************************************************
81 * End of File
82 ******************************************************************************/
83
84} // namespace editor
85} // namespace librepcb
86
87#endif
The Notification class.
Definition notification.h:43
const ui::NotificationData & getUiData() const noexcept
Definition notification.h:59
void setProgress(int progress) noexcept
Definition notification.cpp:99
const bool mAutoPopUp
Definition notification.h:76
const QString mDismissKey
Definition notification.h:75
Notification(const Notification &other)=delete
void setTitle(const QString &title) noexcept
Definition notification.cpp:89
void setDescription(const QString &description) noexcept
Definition notification.cpp:94
ui::NotificationData mUiData
Definition notification.h:77
void changed(bool dismissed)
void dismiss() noexcept
Definition notification.cpp:104
const QString & getDismissKey() const noexcept
Definition notification.h:57
bool getAutoPopUp() const noexcept
Definition notification.h:58
void resetState() noexcept
Definition notification.cpp:82
void setUiData(const ui::NotificationData &data) noexcept
Definition notification.cpp:67
Definition occmodel.cpp:77