File indexing completed on 2024-05-12 05:13:30

0001 /*
0002    SPDX-FileCopyrightText: 2013-2024 Laurent Montel <montel@kde.org>
0003 
0004    SPDX-License-Identifier: GPL-2.0-or-later
0005 */
0006 #pragma once
0007 
0008 #include "grantleethemeeditor_export.h"
0009 #include <QWidget>
0010 
0011 class KZip;
0012 
0013 namespace GrantleeThemeEditor
0014 {
0015 class EditorWidget;
0016 class PreviewWidget;
0017 class GRANTLEETHEMEEDITOR_EXPORT EditorPage : public QWidget
0018 {
0019     Q_OBJECT
0020 public:
0021     enum PageType { MainPage = 0, SecondPage, ExtraPage };
0022     explicit EditorPage(GrantleeThemeEditor::EditorPage::PageType type, QWidget *parent = nullptr);
0023     ~EditorPage() override;
0024 
0025     EditorPage::PageType pageType() const;
0026 
0027     void setPageFileName(const QString &filename);
0028     [[nodiscard]] QString pageFileName() const;
0029 
0030     GrantleeThemeEditor::EditorWidget *editor() const;
0031 
0032     void insertFile(const QString &filename);
0033     void loadTheme(const QString &path);
0034     void saveTheme(const QString &path);
0035     void saveAsFilename(const QString &filename);
0036 
0037     void createZip(const QString &themeName, KZip *zip);
0038     void installTheme(const QString &themePath);
0039 
0040 Q_SIGNALS:
0041     void needUpdateViewer();
0042     void changed();
0043 
0044 protected:
0045     const PageType mType;
0046     QString mPageFileName;
0047     GrantleeThemeEditor::PreviewWidget *mPreview = nullptr;
0048     GrantleeThemeEditor::EditorWidget *mEditor = nullptr;
0049 };
0050 }