Warning, file /plasma/latte-dock/app/settings/detailsdialog/detailshandler.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: 2020 Michail Vourlakos <mvourlakos@gmail.com>
0003     SPDX-License-Identifier: GPL-2.0-or-later
0004 */
0005 
0006 #ifndef DETAILSDIALOGHANDLER_H
0007 #define DETAILSDIALOGHANDLER_H
0008 
0009 // local
0010 #include "../generic/generichandler.h"
0011 #include "../../data/layoutdata.h"
0012 #include "../../layout/abstractlayout.h"
0013 
0014 // Qt
0015 #include <QButtonGroup>
0016 #include <QSortFilterProxyModel>
0017 
0018 // KDE
0019 #include <KMessageBox>
0020 
0021 namespace Ui {
0022 class DetailsDialog;
0023 }
0024 
0025 namespace Latte{
0026 namespace Settings{
0027 namespace Dialog{
0028 class DetailsDialog;
0029 }
0030 }
0031 }
0032 
0033 namespace Latte{
0034 namespace Settings{
0035 namespace Model {
0036 class Colors;
0037 class Schemes;
0038 }
0039 }
0040 }
0041 
0042 
0043 namespace Latte {
0044 namespace Settings {
0045 namespace Handler {
0046 
0047 //! Handlers are objects to handle the UI elements that semantically associate with specific
0048 //! ui::tabs or different windows. They are responsible also to handle the user interaction
0049 //! between controllers and views
0050 
0051 class DetailsHandler : public Generic
0052 {
0053     Q_OBJECT
0054 public:
0055     DetailsHandler(Dialog::DetailsDialog *dialog);
0056     ~DetailsHandler();
0057 
0058     bool hasChangedData() const override;
0059     bool inDefaultValues() const override;
0060 
0061     Latte::Data::Layout currentData() const;
0062 
0063 public slots:
0064     void reset() override;
0065     void resetDefaults() override;
0066     void save() override;
0067 
0068 signals:
0069     void currentLayoutChanged();
0070 
0071 private slots:
0072     void onCurrentLayoutIndexChanged(int row);
0073     void onCurrentColorIndexChanged(int row);
0074     void onCurrentSchemeIndexChanged(int row);
0075 
0076     void clearIcon();
0077     void clearPattern();
0078     void selectBackground();
0079     void selectIcon();
0080     void selectTextColor();
0081     void updateWindowTitle();
0082     void updateCustomSchemeCmb(const int &row);
0083 
0084 private:
0085     void init();
0086     void reload();
0087 
0088     void setIsShownInMenu(bool inMenu);
0089     void setHasDisabledBorders(bool disabled);
0090 
0091     void setBackground(const QString &background);
0092     void setCustomSchemeFile(const QString &file);
0093     void setTextColor(const QString &textColor);
0094     void setColor(const QString &color);
0095     void setIcon(const QString &icon);
0096 
0097     void setPopUpMargin(const int &margin);
0098 
0099     void setBackgroundStyle(const Latte::Layout::BackgroundStyle &style);
0100 
0101     void loadLayout(const Latte::Data::Layout &data);
0102 
0103     KMessageBox::ButtonCode saveChangesConfirmation();
0104 
0105 private:
0106     Dialog::DetailsDialog *m_dialog{nullptr};
0107     Ui::DetailsDialog *m_ui{nullptr};
0108 
0109     QSortFilterProxyModel *m_layoutsProxyModel{nullptr};
0110 
0111     int m_lastConfirmedLayoutIndex{-1};
0112 
0113     //! current data
0114     Model::Colors *m_colorsModel{nullptr};
0115     Model::Schemes *m_schemesModel{nullptr};
0116 
0117     QButtonGroup *m_backButtonsGroup;
0118 
0119     Latte::Data::Layout o_data;
0120     Latte::Data::Layout c_data;
0121 };
0122 
0123 }
0124 }
0125 }
0126 
0127 #endif