File indexing completed on 2024-05-05 17:45:46
0001 /* 0002 * SPDX-FileCopyrightText: 2009 Ben Cooksley <bcooksley@kde.org> 0003 * 0004 * SPDX-License-Identifier: GPL-2.0-or-later 0005 */ 0006 0007 #ifndef SETTINGS_BASE_H 0008 #define SETTINGS_BASE_H 0009 0010 #include "BaseMode.h" 0011 #include "MenuItem.h" 0012 #include "tooltipmanager.h" 0013 #include <QButtonGroup> 0014 #include <QMap> 0015 #include <QStackedWidget> 0016 0017 #include <KAboutApplicationDialog> 0018 #include <KActionMenu> 0019 #include <KConfigDialog> 0020 #include <KLineEdit> 0021 #include <KXmlGuiWindow> 0022 0023 class QScreen; 0024 0025 class SettingsBase : public KXmlGuiWindow 0026 { 0027 Q_OBJECT 0028 0029 public: 0030 explicit SettingsBase(BaseMode::ApplicationMode mode, QWidget *parent = nullptr); 0031 ~SettingsBase() override; 0032 bool queryClose() override; 0033 0034 void setStartupModule(const QString &startupModule); 0035 void setStartupModuleArgs(const QStringList &startupModuleArgs); 0036 void reloadStartupModule(); 0037 0038 protected: 0039 QSize sizeHint() const override; 0040 0041 private Q_SLOTS: 0042 void initApplication(); 0043 void initToolBar(); 0044 void initHelpMenu(); 0045 void initMenuList(MenuItem *parent); 0046 void about(); 0047 void changePlugin(); 0048 void viewChange(bool state); 0049 void updateViewActions(); 0050 void changeToolBar(BaseMode::ToolBarItems toolbar); 0051 void changeAboutMenu(const KAboutData *menuAbout, QAction *menuItem, const QString &fallback); 0052 0053 private Q_SLOTS: 0054 /** 0055 * Updates the window size limit 0056 */ 0057 void slotGeometryChanged(); 0058 0059 private: 0060 /** 0061 * @return the plugin controller if the current view is found in the plugin list and successfully loaded, 0062 * @c nullptr otherwise 0063 */ 0064 BaseMode *loadCurrentView(); 0065 0066 // Follow screen resolution 0067 QScreen *m_screen = nullptr; 0068 0069 // The plugins 0070 QVector<KPluginMetaData> m_plugins; 0071 QMap<QString, BaseMode *> m_loadedViews; 0072 QList<ToolTipManager *> tooltipManagers; 0073 BaseMode *activeView = nullptr; 0074 // The search bar 0075 KLineEdit *searchText = nullptr; 0076 QWidget *spacerWidget = nullptr; 0077 // The toolbar 0078 QWidgetAction *searchAction = nullptr; 0079 QWidgetAction *spacerAction = nullptr; 0080 QAction *switchToIconAction = nullptr; 0081 QAction *switchToSidebarAction = nullptr; 0082 QAction *highlightChangesAction = nullptr; 0083 QAction *reportPageSpecificBugAction = nullptr; 0084 QAction *quitAction = nullptr; 0085 // The help menu 0086 QAction *aboutViewAction = nullptr; 0087 KActionMenu *helpActionMenu = nullptr; 0088 // The control module 0089 QStackedWidget *stackedWidget = nullptr; 0090 // The module list 0091 MenuItem *rootModule = nullptr; 0092 MenuItem *homeModule = nullptr; 0093 MenuItem *lostFound = nullptr; 0094 QStringList categories; 0095 QList<KPluginMetaData> pluginModules; 0096 // The about dialog 0097 KAboutApplicationDialog *aboutDialog = nullptr; 0098 BaseMode::ApplicationMode m_mode = BaseMode::SystemSettings; 0099 QString m_startupModule; 0100 QStringList m_startupModuleArgs; 0101 }; 0102 #endif