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_SCHEMAEDITOR_H
0008 #define KUSERFEEDBACK_CONSOLE_SCHEMAEDITOR_H
0009 
0010 #include <QWidget>
0011 
0012 #include <memory>
0013 
0014 class QAction;
0015 
0016 namespace KUserFeedback {
0017 namespace Console {
0018 
0019 class Product;
0020 class RESTClient;
0021 
0022 namespace Ui {
0023 class SchemaEditor;
0024 }
0025 
0026 class SchemaEditor : public QWidget
0027 {
0028     Q_OBJECT
0029 public:
0030     explicit SchemaEditor(QWidget *parent = nullptr);
0031     ~SchemaEditor() override;
0032 
0033     void setRESTClient(RESTClient *client);
0034 
0035     Product product() const;
0036     void setProduct(const Product &product);
0037 
0038     bool isDirty() const;
0039 
0040 Q_SIGNALS:
0041     void productChanged(const Product &product);
0042     void logMessage(const QString &msg);
0043 
0044 private:
0045     void save();
0046     void exportSchema();
0047     void importSchema();
0048 
0049     void setDirty(bool dirty = true);
0050     void updateState();
0051 
0052     std::unique_ptr<Ui::SchemaEditor> ui;
0053     RESTClient *m_restClient = nullptr;
0054     QAction *m_createFromTemplateAction;
0055     bool m_isDirty = false;
0056 };
0057 
0058 }
0059 }
0060 
0061 #endif // KUSERFEEDBACK_CONSOLE_SCHEMAEDITOR_H