File indexing completed on 2024-05-12 05:13:32
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 <QWidget> 0009 0010 namespace GrantleeThemeEditor 0011 { 0012 class ThemeEditorTabWidget; 0013 class ThemeSession; 0014 class DesktopFilePage; 0015 } 0016 class EditorPage; 0017 class KZip; 0018 0019 class ThemeEditorPage : public QWidget 0020 { 0021 Q_OBJECT 0022 public: 0023 explicit ThemeEditorPage(const QString &projectDir, const QString &themeName, QWidget *parent = nullptr); 0024 ~ThemeEditorPage() override; 0025 0026 void saveThemeAs(const QString &directory); 0027 bool saveTheme(bool withConfirmation = true); 0028 void loadTheme(const QString &filename); 0029 0030 void addExtraPage(); 0031 0032 void uploadTheme(); 0033 void installTheme(const QString &themePath); 0034 0035 [[nodiscard]] bool themeWasChanged() const; 0036 0037 void reloadConfig(); 0038 0039 void insertFile(); 0040 0041 void setPrinting(bool print); 0042 0043 void updatePreview(); 0044 0045 Q_SIGNALS: 0046 void changed(bool); 0047 void canInsertFile(bool); 0048 0049 private: 0050 void slotUpdateViewer(); 0051 void slotCloseTab(int); 0052 void slotChanged(); 0053 void slotExtraHeaderDisplayChanged(const QStringList &extraHeaders); 0054 void slotCurrentWidgetChanged(int); 0055 0056 private: 0057 void setChanged(bool b); 0058 void storeTheme(const QString &directory = QString()); 0059 QString projectDirectory() const; 0060 void createZip(const QString &themeName, KZip *zip); 0061 EditorPage *createExtraPage(const QString &filename); 0062 QList<EditorPage *> mExtraPage; 0063 GrantleeThemeEditor::ThemeEditorTabWidget *mTabWidget = nullptr; 0064 EditorPage *mEditorPage = nullptr; 0065 GrantleeThemeEditor::DesktopFilePage *mDesktopPage = nullptr; 0066 GrantleeThemeEditor::ThemeSession *const mThemeSession; 0067 bool mChanged = false; 0068 };