File indexing completed on 2024-12-15 03:45:05

0001 /*
0002     SPDX-FileCopyrightText: 2017 Volker Krause <vkrause@kde.org>
0003 
0004     SPDX-License-Identifier: MIT
0005 */
0006 
0007 #ifndef KUSERFEEDBACK_FEEDBACKCONFIGWIDGET_H
0008 #define KUSERFEEDBACK_FEEDBACKCONFIGWIDGET_H
0009 
0010 #include "kuserfeedbackwidgets_export.h"
0011 
0012 #include <KUserFeedback/Provider>
0013 
0014 #include <QWidget>
0015 
0016 #include <memory>
0017 
0018 namespace KUserFeedback {
0019 
0020 class FeedbackConfigWidgetPrivate;
0021 class Provider;
0022 
0023 /*!
0024  * Configuration widget for telemetry and survey contributions.
0025  *
0026  * Use this rather than FeedbackConfigDialog if you want to embed the
0027  * feedback configuration for example into an existing configuration
0028  * dialog.
0029  * @see FeedbackConfigDialog
0030  */
0031 class KUSERFEEDBACKWIDGETS_EXPORT FeedbackConfigWidget : public QWidget
0032 {
0033     Q_OBJECT
0034 public:
0035     /*! Create a new feedback provider configuration widget.
0036      *  @param parent The parent widget.
0037      */
0038     explicit FeedbackConfigWidget(QWidget *parent = nullptr);
0039     ~FeedbackConfigWidget() override;
0040 
0041     /*! Returns the feedback provider configured by this widget. */
0042     Provider* feedbackProvider() const;
0043 
0044     /*! Set the feedback provider that should be configured with this widget. */
0045     void setFeedbackProvider(Provider *provider);
0046 
0047     /*! Returns the telemetry level currently selected in the widget. */
0048     Provider::TelemetryMode telemetryMode() const;
0049 
0050     /*! Returns the survey interval currently selected in this widget. */
0051     int surveyInterval() const;
0052 
0053 Q_SIGNALS:
0054     /*! Emitted when any changes are made to the configuration represented
0055      *  in this widget.
0056      */
0057     void configurationChanged();
0058 
0059 protected:
0060     ///@cond internal
0061     bool eventFilter(QObject *receiver, QEvent *event) override;
0062     ///@endcond
0063 
0064 private:
0065     std::unique_ptr<FeedbackConfigWidgetPrivate> d;
0066 };
0067 
0068 }
0069 
0070 #endif // KUSERFEEDBACK_FEEDBACKCONFIGWIDGET_H