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

0001 /*
0002     SPDX-FileCopyrightText: 2016 Volker Krause <vkrause@kde.org>
0003 
0004     SPDX-License-Identifier: MIT
0005 */
0006 
0007 #ifndef KUSERFEEDBACK_CONSOLE_AGGREGATIONEDITWIDGET_H
0008 #define KUSERFEEDBACK_CONSOLE_AGGREGATIONEDITWIDGET_H
0009 
0010 #include <QWidget>
0011 
0012 #include <memory>
0013 
0014 namespace KUserFeedback {
0015 namespace Console {
0016 
0017 class Aggregation;
0018 class AggregationEditorModel;
0019 class AggregationElementEditModel;
0020 class Product;
0021 class SchemaEntryItemEditorFactory;
0022 
0023 namespace Ui
0024 {
0025 class AggregationEditWidget;
0026 }
0027 
0028 class AggregationEditWidget : public QWidget
0029 {
0030     Q_OBJECT
0031 public:
0032     explicit AggregationEditWidget(QWidget *parent = nullptr);
0033     ~AggregationEditWidget() override;
0034 
0035     Product product() const;
0036     void setProduct(const Product &product);
0037 
0038 Q_SIGNALS:
0039     void productChanged();
0040 
0041 private:
0042     Aggregation currentAggregation() const;
0043     void addAggregation();
0044     void deleteAggregation();
0045     void addElement();
0046     void deleteElement();
0047 
0048     void updateState();
0049     void contextMenu(QPoint pos);
0050     void selectionChanged();
0051 
0052     std::unique_ptr<Ui::AggregationEditWidget> ui;
0053     AggregationEditorModel *m_model;
0054     std::unique_ptr<SchemaEntryItemEditorFactory> m_editorFactory;
0055     AggregationElementEditModel *m_elementModel;
0056 };
0057 }
0058 }
0059 
0060 #endif // KUSERFEEDBACK_CONSOLE_AGGREGATIONEDITWIDGET_H