File indexing completed on 2024-10-27 11:22:58

0001 /*
0002     SPDX-FileCopyrightText: 2021 Michail Vourlakos <mvourlakos@gmail.com>
0003     SPDX-License-Identifier: GPL-2.0-or-later
0004 */
0005 
0006 #ifndef SCREENSHANDLER_H
0007 #define SCREENSHANDLER_H
0008 
0009 // local
0010 #include "../generic/generichandler.h"
0011 #include "../../data/screendata.h"
0012 
0013 // Qt
0014 #include <QButtonGroup>
0015 #include <QSortFilterProxyModel>
0016 
0017 namespace Ui {
0018 class ScreensDialog;
0019 }
0020 
0021 namespace Latte{
0022 namespace Settings{
0023 namespace Model {
0024 class Screens;
0025 }
0026 namespace Dialog{
0027 class ScreensDialog;
0028 }
0029 }
0030 }
0031 
0032 namespace Latte {
0033 namespace Settings {
0034 namespace Handler {
0035 
0036 class ScreensHandler : public Generic
0037 {
0038     Q_OBJECT
0039 public:
0040     ScreensHandler(Dialog::ScreensDialog *dialog);
0041     ~ScreensHandler();
0042 
0043     bool hasChangedData() const override;
0044     bool inDefaultValues() const override;
0045 
0046     Latte::Data::ScreensTable currentData() const;
0047 
0048 public slots:
0049     void deselectAll();
0050     void reset() override;
0051     void resetDefaults() override;
0052     void save() override;
0053 
0054 private:
0055     void init();
0056     void initDefaults();
0057 
0058     bool removalConfirmation(const QStringList &screens) const;
0059 
0060 private slots:
0061     void onRemoveNow();
0062     void onScreenDataChanged();
0063 
0064 private:
0065     Dialog::ScreensDialog *m_dialog{nullptr};
0066     Ui::ScreensDialog *m_ui{nullptr};
0067 
0068     //! current data
0069     Model::Screens *m_screensModel{nullptr};
0070     QSortFilterProxyModel *m_screensProxyModel{nullptr};
0071 };
0072 
0073 }
0074 }
0075 }
0076 
0077 #endif