| 1 | /* |
| 2 | This file is part of KNewStuffQuick. |
| 3 | SPDX-FileCopyrightText: 2019 Dan Leinir Turthra Jensen <admin@leinir.dk> |
| 4 | |
| 5 | SPDX-License-Identifier: LGPL-2.1-or-later |
| 6 | */ |
| 7 | |
| 8 | #ifndef KNSQ_QUICKQUESTIONLISTENER_H |
| 9 | #define KNSQ_QUICKQUESTIONLISTENER_H |
| 10 | |
| 11 | #include "core/questionlistener.h" |
| 12 | #include <QPointer> |
| 13 | |
| 14 | namespace KNewStuffQuick |
| 15 | { |
| 16 | class QuickQuestionListener : public KNSCore::QuestionListener |
| 17 | { |
| 18 | Q_OBJECT |
| 19 | Q_DISABLE_COPY(QuickQuestionListener) |
| 20 | public: |
| 21 | static QuickQuestionListener *instance(); |
| 22 | ~QuickQuestionListener() override; |
| 23 | |
| 24 | Q_SLOT void askQuestion(KNSCore::Question *question) override; |
| 25 | |
| 26 | Q_SIGNAL void askListQuestion(QString title, QString question, QStringList list); |
| 27 | Q_SIGNAL void askContinueCancelQuestion(QString title, QString question); |
| 28 | Q_SIGNAL void askTextInputQuestion(QString title, QString question); |
| 29 | Q_SIGNAL void askPasswordQuestion(QString title, QString question); |
| 30 | Q_SIGNAL void askYesNoQuestion(QString title, QString question); |
| 31 | |
| 32 | Q_SLOT void passResponse(bool responseIsContinue, QString input); |
| 33 | |
| 34 | QuickQuestionListener() = default; // Only used by Q_GLOBAL_STATIC |
| 35 | private: |
| 36 | QPointer<KNSCore::Question> m_question; |
| 37 | }; |
| 38 | } |
| 39 | |
| 40 | #endif // KNSQ_QUICKQUESTIONLISTENER_H |
| 41 | |