File indexing completed on 2024-04-14 05:24:35

0001 /*
0002     SPDX-FileCopyrightText: 2020 Michail Vourlakos <mvourlakos@gmail.com>
0003     SPDX-License-Identifier: GPL-2.0-or-later
0004 */
0005 
0006 #ifndef SETTINGSTABPREFERENCESHANDLER_H
0007 #define SETTINGSTABPREFERENCESHANDLER_H
0008 
0009 //! local
0010 #include "../generic/generichandler.h"
0011 #include "../../data/preferencesdata.h"
0012 
0013 //! Qt
0014 #include <QAction>
0015 #include <QObject>
0016 #include <QButtonGroup>
0017 #include <QPushButton>
0018 
0019 namespace Ui {
0020 class SettingsDialog;
0021 }
0022 
0023 namespace Latte {
0024 class Corona;
0025 namespace Settings {
0026 namespace Dialog {
0027 class SettingsDialog;
0028 }
0029 }
0030 }
0031 
0032 namespace Latte {
0033 namespace Settings {
0034 namespace Handler {
0035 
0036 //! Handlers are objects to handle the UI elements that semantically associate with specific
0037 //! ui::tabs or different windows. They are responsible also to handle the user interaction
0038 //! between controllers and views
0039 
0040 class TabPreferences : public Generic
0041 {
0042     Q_OBJECT
0043 public:
0044     TabPreferences(Latte::Settings::Dialog::SettingsDialog *parent);
0045 
0046     bool hasChangedData() const override;
0047     bool inDefaultValues() const override;
0048 
0049     QStringList contextMenuAlwaysActions() const;
0050     void setContextMenuAlwaysActions(const QStringList &actions);
0051 
0052     void reset() override;
0053     void resetDefaults() override;
0054     void save() override;
0055 
0056 signals:
0057     void borderlessMaximizedChanged();
0058     void contextActionsChanged();
0059 
0060 private slots:
0061     void initUi();
0062     void initSettings();
0063     void updateUi();
0064 
0065     void onActionsBtnPressed();
0066 
0067 private:
0068     Latte::Settings::Dialog::SettingsDialog *m_parentDialog{nullptr};
0069     Ui::SettingsDialog *m_ui{nullptr};
0070     Latte::Corona *m_corona{nullptr};
0071 
0072     QButtonGroup *m_parabolicSpreadButtons;
0073     QButtonGroup *m_thicknessMarginInfluenceButtons;
0074 
0075     //! current data
0076     Data::Preferences m_preferences;
0077 
0078     //! original data
0079     Data::Preferences o_preferences;
0080 };
0081 
0082 }
0083 }
0084 }
0085 
0086 #endif