Warning, file /plasma/latte-dock/app/settings/settingsdialog/settingsdialog.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 /*
0002     SPDX-FileCopyrightText: 2017 Smith AR <audoban@openmailbox.org>
0003     SPDX-FileCopyrightText: 2017 Michail Vourlakos <mvourlakos@gmail.com>
0004 
0005     SPDX-License-Identifier: GPL-2.0-or-later
0006 */
0007 
0008 #ifndef SETTINGSDIALOG_H
0009 #define SETTINGSDIALOG_H
0010 
0011 // local
0012 #include <coretypes.h>
0013 #include "layoutscontroller.h"
0014 #include "tablayoutshandler.h"
0015 #include "tabpreferenceshandler.h"
0016 #include "../generic/genericdialog.h"
0017 
0018 // Qt
0019 #include <QObject>
0020 #include <QButtonGroup>
0021 #include <QDialog>
0022 #include <QDebug>
0023 #include <QMenuBar>
0024 #include <QStandardItemModel>
0025 #include <QTimer>
0026 
0027 // KDE
0028 #include <KHelpMenu>
0029 
0030 namespace Ui {
0031 class SettingsDialog;
0032 }
0033 
0034 namespace KActivities {
0035 class Controller;
0036 }
0037 
0038 namespace Latte {
0039 class Corona;
0040 class CentralLayout;
0041 }
0042 
0043 namespace Latte {
0044 namespace Settings {
0045 namespace Dialog {
0046 
0047 enum ConfigurationPage
0048 {
0049     LayoutPage = 0,
0050     PreferencesPage
0051 };
0052 
0053 class SettingsDialog : public GenericDialog
0054 {
0055     Q_OBJECT
0056 public:
0057     SettingsDialog(QWidget *parent, Latte::Corona *corona);
0058     ~SettingsDialog();
0059 
0060     Latte::Corona *corona() const;
0061     Ui::SettingsDialog *ui() const;
0062 
0063     QMenuBar *appMenuBar() const;
0064     QMenu *fileMenu() const;
0065     QMenu *helpMenu() const;
0066 
0067     void setStoredWindowSize(const QSize &size);
0068 
0069     QSize downloadWindowSize() const;
0070     void setDownloadWindowSize(const QSize &size);
0071 
0072     ConfigurationPage currentPage();
0073     void setCurrentPage(int page);
0074     void toggleCurrentPage();
0075 
0076 protected:
0077     void dragEnterEvent(QDragEnterEvent *event) override;
0078     void dragLeaveEvent(QDragLeaveEvent *event) override;
0079     void dragMoveEvent(QDragMoveEvent *event) override;
0080     void dropEvent(QDropEvent *event) override;
0081 
0082     void reject() override;
0083 
0084 private slots:
0085     void importFullConfiguration();
0086     void exportFullConfiguration();
0087 
0088     void showScreensDialog();
0089 
0090     void accept() override;
0091 
0092     void apply();
0093     void reset();
0094     void restoreDefaults();
0095     void showLayoutInformation();
0096     void showScreensInformation();
0097     void updateApplyButtonsState();
0098     void updateWindowActivities();    
0099 
0100     void loadConfig();
0101     void saveConfig();
0102 
0103     void onCurrentTabChanged(int index);
0104 
0105 private:
0106     void initGlobalMenu();
0107     void initLayoutMenu();
0108     void initFileMenu();
0109     void initHelpMenu();
0110 
0111     void save();
0112     void setCurrentFreeActivitiesLayout(const int &row);
0113 
0114     bool saveChanges();
0115     QSize storedWindowSize() const;
0116 
0117 private:
0118     Latte::Corona *m_corona{nullptr};
0119     Ui::SettingsDialog *m_ui;
0120 
0121     //! Handlers for UI
0122     Settings::Handler::TabLayouts *m_tabLayoutsHandler{nullptr};
0123     Settings::Handler::TabPreferences *m_tabPreferencesHandler{nullptr};
0124 
0125     //! properties
0126     QSize m_windowSize;
0127     QSize m_downloadWindowSize;
0128 
0129     //! Global menu
0130     QMenuBar *m_globalMenuBar{nullptr};
0131 
0132     //! are used for confirmation purposes, the user can choose to save or discard settings and
0133     //! change its current tab also
0134     int m_acceptedPage{-1};
0135     int m_nextPage{-1};
0136 
0137     //! File menu actions
0138     QMenu *m_fileMenu{nullptr};
0139     QAction *m_importFullAction{nullptr};
0140     QAction *m_exportFullAction{nullptr};
0141 
0142     //! Help menu actions
0143     KHelpMenu *m_helpMenu{nullptr};
0144 
0145     //! storage
0146     KConfigGroup m_deprecatedStorage;
0147     KConfigGroup m_storage;
0148 
0149     //! workaround to assign ALLACTIVITIES during startup
0150     QTimer m_activitiesTimer;
0151 };
0152 
0153 }
0154 }
0155 }
0156 
0157 #endif // SETTINGSDIALOG_H