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

0001 /*
0002     SPDX-FileCopyrightText: 2016 Volker Krause <vkrause@kde.org>
0003 
0004     SPDX-License-Identifier: MIT
0005 */
0006 
0007 #ifndef KUSERFEEDBACK_CONSOLE_MAINWINDOW_H
0008 #define KUSERFEEDBACK_CONSOLE_MAINWINDOW_H
0009 
0010 #include <QMainWindow>
0011 #include <QVector>
0012 
0013 #include <memory>
0014 
0015 class QAbstractItemModel;
0016 class QNetworkAccessManager;
0017 
0018 namespace KUserFeedback {
0019 
0020 class Provider;
0021 
0022 namespace Console {
0023 
0024 namespace Ui
0025 {
0026 class MainWindow;
0027 }
0028 
0029 class Product;
0030 class ProductModel;
0031 class ServerInfo;
0032 class RESTClient;
0033 
0034 class MainWindow : public QMainWindow
0035 {
0036     Q_OBJECT
0037 public:
0038     MainWindow();
0039     ~MainWindow() override;
0040 
0041 protected:
0042     void closeEvent(QCloseEvent *event) override;
0043 
0044 private:
0045     void connectToServer(const ServerInfo &info);
0046 
0047     void createProduct();
0048     void deleteProduct();
0049     void productSelected();
0050     void importProduct();
0051     void exportProduct();
0052 
0053     void logMessage(const QString &msg);
0054     void logError(const QString &msg);
0055 
0056     Product selectedProduct() const;
0057 
0058     void updateActions();
0059 
0060     template <typename T> void addView(T *view, QMenu *menu);
0061 
0062     std::unique_ptr<Ui::MainWindow> ui;
0063     RESTClient *m_restClient;
0064     ProductModel *m_productModel;
0065 
0066     Provider *m_feedbackProvider;
0067 };
0068 }
0069 }
0070 
0071 #endif // KUSERFEEDBACK_CONSOLE_MAINWINDOW_H