umbrello 2.32.3 Umbrello UML Modeller is a Unified Modelling Language (UML) diagram program based on KDE Technology

dontaskagain.h
Go to the documentation of this file.
1 /***************************************************************************
2 * This program is free software; you can redistribute it and/or modify *
3 * it under the terms of the GNU General Public License as published by *
4 * the Free Software Foundation; either version 2 of the License, or *
5 * (at your option) any later version. *
6 * *
7 * copyright (C) 2018-2020 *
8 * Umbrello UML Modeller Authors <umbrello-devel@kde.org> *
9 ***************************************************************************/
10
11 #ifndef DONTASKAGAIN_H
12 #define DONTASKAGAIN_H
13
14 // Qt includes
15 #include <QList>
16 #include <QString>
17 #include <QWidget>
18
19 // KDE includes
20 #include <KLocalizedString>
21
22 class QVBoxLayout;
23
30 class DontAskAgainItem {
31 public:
32 DontAskAgainItem(const QString &name);
33 virtual ~DontAskAgainItem();
34 QString &name();
35 virtual QString text() const = 0;
36 bool isAll();
37 bool isEnabled();
38 void setEnabled(bool state = true);
39
40 protected:
41 QString m_name;
42 };
43
44 #define DefineDontAskAgainItem(name,key,_text) \
45 class DontAskAgainItem##name : public DontAskAgainItem \
46 { \
47 public: \
48 DontAskAgainItem##name() : DontAskAgainItem(QLatin1String(key)) {} \
49 virtual QString text() const { return _text; } \
50 }; \
51 static DontAskAgainItem##name name;
52
66 class DontAskAgainWidget : public QWidget
67 {
68 Q_OBJECT
69 public:
70 DontAskAgainWidget(QList<DontAskAgainItem *> &items, QWidget *parent = 0);
71 bool apply();
72 void setDefaults();
73
74 protected:
75 void addItem(DontAskAgainItem *item);
76 QVBoxLayout *m_layout;
77 QList<DontAskAgainItem *> &m_items;
78
79 protected slots:
80 void slotToggled(bool state);
81 };
82
107 class DontAskAgainHandler
108 {
109 public:
110 void addItem(DontAskAgainItem *item);
111 static DontAskAgainHandler &instance();
112 DontAskAgainWidget *createWidget();
113 protected:
114 QList<DontAskAgainItem*> m_items;
115 };
116
117 #endif // DONTASKAGAIN_H
DontAskAgainWidget
Definition: dontaskagain.h:67
DontAskAgainHandler::m_items
QList< DontAskAgainItem * > m_items
Definition: dontaskagain.h:114
DontAskAgainItem::isAll
bool isAll()
Definition: dontaskagain.cpp:41
DontAskAgainHandler::createWidget
DontAskAgainWidget * createWidget()
Definition: dontaskagain.cpp:133
DontAskAgainWidget::DontAskAgainWidget
DontAskAgainWidget(QList< DontAskAgainItem * > &items, QWidget *parent=0)
Definition: dontaskagain.cpp:61
DontAskAgainItem::name
QString & name()
Definition: dontaskagain.cpp:36
DontAskAgainItem::~DontAskAgainItem
virtual ~DontAskAgainItem()
Definition: dontaskagain.cpp:32
DontAskAgainItem::DontAskAgainItem
DontAskAgainItem(const QString &name)
Definition: dontaskagain.cpp:26
DontAskAgainWidget::apply
bool apply()
Definition: dontaskagain.cpp:74
i18n
#define i18n
Definition: main.cpp:39
DontAskAgainItem::isEnabled
bool isEnabled()
Definition: dontaskagain.cpp:46
Q_DECLARE_METATYPE
Q_DECLARE_METATYPE(UMLStereotype *)
DontAskAgainWidget::m_items
QList< DontAskAgainItem * > & m_items
Definition: dontaskagain.h:77
MyProject\connect
connect()
Definition: namespaces-multiple.php:5
DontAskAgainWidget::addItem
void addItem(DontAskAgainItem *item)
Definition: dontaskagain.cpp:104
DontAskAgainWidget::slotToggled
void slotToggled(bool state)
Definition: dontaskagain.cpp:113
DontAskAgainItem
Definition: dontaskagain.h:30
DontAskAgainHandler::addItem
void addItem(DontAskAgainItem *item)
Definition: dontaskagain.cpp:128
dontaskagain.h
DontAskAgainItem::setEnabled
void setEnabled(bool state=true)
Definition: dontaskagain.cpp:51
DontAskAgainItem::m_name
QString m_name
Definition: dontaskagain.h:41
DontAskAgainItem::text
virtual QString text() const =0
DontAskAgainHandler::instance
static DontAskAgainHandler & instance()
Definition: dontaskagain.cpp:138
DontAskAgainHandler
Definition: dontaskagain.h:108
DontAskAgainWidget::setDefaults
void setDefaults()
Definition: dontaskagain.cpp:93
DontAskAgainWidget::m_layout
QVBoxLayout * m_layout
Definition: dontaskagain.h:76