umbrello: umbrello/dialogs/dontaskagain.h Source File

umbrello 2.32.0 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
DontAskAgainHandler
Definition: dontaskagain.h:108
DontAskAgainHandler::instance
static DontAskAgainHandler & instance()
Definition: dontaskagain.cpp:138
DontAskAgainHandler::addItem
void addItem(DontAskAgainItem *item)
Definition: dontaskagain.cpp:128
DontAskAgainHandler::createWidget
DontAskAgainWidget * createWidget()
Definition: dontaskagain.cpp:133
DontAskAgainHandler::m_items
QList< DontAskAgainItem * > m_items
Definition: dontaskagain.h:114
DontAskAgainItem
Definition: dontaskagain.h:30
DontAskAgainItem::text
virtual QString text() const =0
DontAskAgainItem::~DontAskAgainItem
virtual ~DontAskAgainItem()
Definition: dontaskagain.cpp:32
DontAskAgainItem::isAll
bool isAll()
Definition: dontaskagain.cpp:41
DontAskAgainItem::setEnabled
void setEnabled(bool state=true)
Definition: dontaskagain.cpp:51
DontAskAgainItem::name
QString & name()
Definition: dontaskagain.cpp:36
DontAskAgainItem::isEnabled
bool isEnabled()
Definition: dontaskagain.cpp:46
DontAskAgainItem::DontAskAgainItem
DontAskAgainItem(const QString &name)
Definition: dontaskagain.cpp:26
DontAskAgainItem::m_name
QString m_name
Definition: dontaskagain.h:41
DontAskAgainWidget
Definition: dontaskagain.h:67
DontAskAgainWidget::m_items
QList< DontAskAgainItem * > & m_items
Definition: dontaskagain.h:77
DontAskAgainWidget::slotToggled
void slotToggled(bool state)
Definition: dontaskagain.cpp:113
DontAskAgainWidget::addItem
void addItem(DontAskAgainItem *item)
Definition: dontaskagain.cpp:104
DontAskAgainWidget::apply
bool apply()
Definition: dontaskagain.cpp:74
DontAskAgainWidget::DontAskAgainWidget
DontAskAgainWidget(QList< DontAskAgainItem * > &items, QWidget *parent=0)
Definition: dontaskagain.cpp:61
DontAskAgainWidget::m_layout
QVBoxLayout * m_layout
Definition: dontaskagain.h:76
DontAskAgainWidget::setDefaults
void setDefaults()
Definition: dontaskagain.cpp:93