File indexing completed on 2024-05-12 05:13:29
0001 /* 0002 SPDX-FileCopyrightText: 2015-2024 Laurent Montel <montel@kde.org> 0003 0004 SPDX-License-Identifier: GPL-2.0-or-later 0005 */ 0006 0007 #pragma once 0008 0009 #include <QWidget> 0010 0011 namespace GrantleeThemeEditor 0012 { 0013 class ThemeEditorTabWidget; 0014 class ThemeSession; 0015 class DesktopFilePage; 0016 } 0017 class EditorPage; 0018 class KZip; 0019 0020 class ThemeEditorPage : public QWidget 0021 { 0022 Q_OBJECT 0023 public: 0024 explicit ThemeEditorPage(const QString &projectDir, const QString &themeName, QWidget *parent = nullptr); 0025 ~ThemeEditorPage() override; 0026 0027 void saveThemeAs(const QString &directory); 0028 [[nodiscard]] bool saveTheme(bool withConfirmation = true); 0029 void loadTheme(const QString &filename); 0030 0031 void addExtraPage(); 0032 0033 void uploadTheme(); 0034 void installTheme(const QString &themePath); 0035 0036 bool themeWasChanged() const; 0037 0038 void reloadConfig(); 0039 0040 void insertFile(); 0041 0042 void updatePreview(); 0043 0044 Q_SIGNALS: 0045 void changed(bool); 0046 void canInsertFile(bool); 0047 0048 private: 0049 void slotUpdateViewer(); 0050 void slotCloseTab(int); 0051 void slotChanged(); 0052 void slotCurrentWidgetChanged(int); 0053 0054 private: 0055 void setChanged(bool b); 0056 void storeTheme(const QString &directory = QString()); 0057 [[nodiscard]] QString projectDirectory() const; 0058 void createZip(const QString &themeName, KZip *zip); 0059 EditorPage *createExtraPage(const QString &filename); 0060 QList<EditorPage *> mExtraPage; 0061 GrantleeThemeEditor::ThemeEditorTabWidget *mTabWidget = nullptr; 0062 EditorPage *mEditorPage = nullptr; 0063 GrantleeThemeEditor::DesktopFilePage *mDesktopPage = nullptr; 0064 GrantleeThemeEditor::ThemeSession *const mThemeSession; 0065 bool mChanged = false; 0066 };