1 /*
2     SPDX-FileCopyrightText: 2020 Michail Vourlakos <mvourlakos@gmail.com>
3     SPDX-License-Identifier: GPL-2.0-or-later
4 */
5 
6 #ifndef SETTINGSTABPREFERENCESHANDLER_H
7 #define SETTINGSTABPREFERENCESHANDLER_H
8 
9 //! local
10 #include "../generic/generichandler.h"
11 #include "../../data/preferencesdata.h"
12 
13 //! Qt
14 #include <QAction>
15 #include <QObject>
16 #include <QButtonGroup>
17 #include <QPushButton>
18 
19 namespace Ui {
20 class SettingsDialog;
21 }
22 
23 namespace Latte {
24 class Corona;
25 namespace Settings {
26 namespace Dialog {
27 class SettingsDialog;
28 }
29 }
30 }
31 
32 namespace Latte {
33 namespace Settings {
34 namespace Handler {
35 
36 //! Handlers are objects to handle the UI elements that semantically associate with specific
37 //! ui::tabs or different windows. They are responsible also to handle the user interaction
38 //! between controllers and views
39 
40 class TabPreferences : public Generic
41 {
42     Q_OBJECT
43 public:
44     TabPreferences(Latte::Settings::Dialog::SettingsDialog *parent);
45 
46     bool hasChangedData() const override;
47     bool inDefaultValues() const override;
48 
49     QStringList contextMenuAlwaysActions() const;
50     void setContextMenuAlwaysActions(const QStringList &actions);
51 
52     void reset() override;
53     void resetDefaults() override;
54     void save() override;
55 
56 signals:
57     void borderlessMaximizedChanged();
58     void contextActionsChanged();
59 
60 private slots:
61     void initUi();
62     void initSettings();
63     void updateUi();
64 
65     void onActionsBtnPressed();
66 
67 private:
68     Latte::Settings::Dialog::SettingsDialog *m_parentDialog{nullptr};
69     Ui::SettingsDialog *m_ui{nullptr};
70     Latte::Corona *m_corona{nullptr};
71 
72     QButtonGroup *m_mouseSensitivityButtons;
73 
74     //! current data
75     Data::Preferences m_preferences;
76 
77     //! original data
78     Data::Preferences o_preferences;
79 };
80 
81 }
82 }
83 }
84 
85 #endif
86