umbrello 26.03.70-1a62d36 Umbrello UML Modeller is a Unified Modelling Language (UML) diagram program based on KDE Technology

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

dontaskagain.h
Go to the documentation of this file.
1/*
2 SPDX-License-Identifier: GPL-2.0-or-later
3 SPDX-FileCopyrightText: 2018-2020 Umbrello UML Modeller Authors <umbrello-devel@kde.org>
4*/
5
6#ifndef DONTASKAGAIN_H
7#define DONTASKAGAIN_H
8
9// Qt includes
10#include <QList>
11#include <QString>
12#include <QWidget>
13
14// KDE includes
15#include <KLocalizedString>
16
17 class QVBoxLayout;
18
25 class DontAskAgainItem {
26 public:
27 DontAskAgainItem(const QString &name);
28 virtual ~DontAskAgainItem();
29 QString &name();
30 virtual QString text() const = 0;
31 bool isAll();
32 bool isEnabled();
33 void setEnabled(bool state = true);
34
35 protected:
36 QString m_name;
37};
38
39 Q_DECLARE_METATYPE(DontAskAgainItem*)
40
41#define DefineDontAskAgainItem(name,key,_text) \
42 class DontAskAgainItem##name : public DontAskAgainItem \
43{ \
44 public: \
45 DontAskAgainItem##name() : DontAskAgainItem(QStringLiteral(key)) {} \
46 virtual QString text() const { return _text; } \
47}; \
48 static DontAskAgainItem##name name;
49
63 class DontAskAgainWidget : public QWidget
64{
65 Q_OBJECT
66 public:
67 DontAskAgainWidget(QList<DontAskAgainItem *> &items, QWidget *parent = nullptr);
68 bool apply();
69 void setDefaults();
70
71 protected:
72 void addItem(DontAskAgainItem *item);
73 QVBoxLayout *m_layout;
74 QList<DontAskAgainItem *> &m_items;
75
76 protected Q_SLOTS:
77 void slotToggled(bool state);
78};
79
104 class DontAskAgainHandler
105{
106 public:
107 void addItem(DontAskAgainItem *item);
108 static DontAskAgainHandler &instance();
109 DontAskAgainWidget *createWidget();
110 protected:
111 QList<DontAskAgainItem*> m_items;
112};
113
114#endif // DONTASKAGAIN_H
DontAskAgainHandler
Definition: dontaskagain.h:105
DontAskAgainHandler::instance
static DontAskAgainHandler & instance()
Definition: dontaskagain.cpp:131
DontAskAgainHandler::addItem
void addItem(DontAskAgainItem *item)
Definition: dontaskagain.cpp:121
DontAskAgainHandler::createWidget
DontAskAgainWidget * createWidget()
Definition: dontaskagain.cpp:126
DontAskAgainHandler::m_items
QList< DontAskAgainItem * > m_items
Definition: dontaskagain.h:111
DontAskAgainItem
Definition: dontaskagain.h:25
DontAskAgainItem::text
virtual QString text() const =0
DontAskAgainItem::~DontAskAgainItem
virtual ~DontAskAgainItem()
Definition: dontaskagain.cpp:25
DontAskAgainItem::isAll
bool isAll()
Definition: dontaskagain.cpp:34
DontAskAgainItem::setEnabled
void setEnabled(bool state=true)
Definition: dontaskagain.cpp:44
DontAskAgainItem::name
QString & name()
Definition: dontaskagain.cpp:29
DontAskAgainItem::isEnabled
bool isEnabled()
Definition: dontaskagain.cpp:39
DontAskAgainItem::m_name
QString m_name
Definition: dontaskagain.h:36
DontAskAgainWidget
Definition: dontaskagain.h:64
DontAskAgainWidget::m_items
QList< DontAskAgainItem * > & m_items
Definition: dontaskagain.h:74
DontAskAgainWidget::slotToggled
void slotToggled(bool state)
Definition: dontaskagain.cpp:106
DontAskAgainWidget::addItem
void addItem(DontAskAgainItem *item)
Definition: dontaskagain.cpp:97
DontAskAgainWidget::apply
bool apply()
Definition: dontaskagain.cpp:67
DontAskAgainWidget::m_layout
QVBoxLayout * m_layout
Definition: dontaskagain.h:73
DontAskAgainWidget::setDefaults
void setDefaults()
Definition: dontaskagain.cpp:86
Q_DECLARE_METATYPE
Q_DECLARE_METATYPE(UMLObject *)