File indexing completed on 2024-04-21 05:30:55

0001 /*
0002     SPDX-FileCopyrightText: 2021 Michail Vourlakos <mvourlakos@gmail.com>
0003     SPDX-License-Identifier: GPL-2.0-or-later
0004 */
0005 
0006 #ifndef EXPORTTEMPLATEDIALOG_H
0007 #define EXPORTTEMPLATEDIALOG_H
0008 
0009 // local
0010 #include "../generic/genericdialog.h"
0011 #include "../viewsdialog/viewsdialog.h"
0012 #include "../settingsdialog/settingsdialog.h"
0013 #include "../../data/layoutdata.h"
0014 #include "../../data/viewdata.h"
0015 
0016 // Qt
0017 #include <QDialog>
0018 #include <QObject>
0019 #include <QPushButton>
0020 #include <QWindow>
0021 
0022 namespace Ui {
0023 class ExportTemplateDialog;
0024 }
0025 
0026 namespace Latte {
0027 class View;
0028 namespace Settings {
0029 namespace Controller {
0030 class Layouts;
0031 }
0032 namespace Handler {
0033 class ExportTemplateHandler;
0034 }
0035 }
0036 }
0037 
0038 
0039 namespace Latte {
0040 namespace Settings {
0041 namespace Dialog {
0042 
0043 class ExportTemplateDialog : public GenericDialog
0044 {
0045     Q_OBJECT
0046 
0047 public:
0048     ExportTemplateDialog(QDialog *parent);
0049     ExportTemplateDialog(SettingsDialog *parent, const Data::Layout &layout);
0050     ExportTemplateDialog(ViewsDialog *parent, const Data::View &view);
0051     ExportTemplateDialog(Latte::View *view);
0052     ~ExportTemplateDialog();
0053 
0054     Ui::ExportTemplateDialog *ui() const;
0055     Latte::Corona *corona() const;
0056 
0057     QPushButton *exportButton() const;
0058 
0059 protected:
0060     void accept() override;
0061 
0062 private slots:
0063     void onCancel();
0064     void onDataChanged();
0065     void onExportSucceeded();
0066     void onReset();
0067 
0068     void initButtons();
0069     void initExportButton(const QString &tooltip);
0070     void initSignals();
0071 
0072 private:
0073     void init();
0074 
0075 private:
0076     bool m_isExportingLayout{false};
0077     bool m_isExportingView{false};
0078 
0079     QPushButton *m_exportButton{nullptr};
0080 
0081     Latte::Corona *m_corona{nullptr};
0082 
0083     Ui::ExportTemplateDialog *m_ui;
0084     Controller::Layouts *m_layoutsController{nullptr};
0085 
0086     Handler::ExportTemplateHandler *m_handler;
0087 };
0088 
0089 }
0090 }
0091 }
0092 
0093 #endif