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

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 CENTRALLAYOUT_H
0009 #define CENTRALLAYOUT_H
0010 
0011 // local
0012 #include "genericlayout.h"
0013 #include "../data/layoutdata.h"
0014 #include "../wm/schemecolors.h"
0015 
0016 // Qt
0017 #include <QObject>
0018 
0019 namespace Latte {
0020 class Corona;
0021 }
0022 
0023 namespace Latte {
0024 
0025 //! CentralLayout is a layout that is assigned to ALL Activities, FREE Activities or SPRECIFIC Activities.
0026 //! It is a real running layout instance.
0027 //!
0028 //! It holds all the important settings in order to provide specific
0029 //! behavior for the Activities is assigned at.
0030 //! for example: activities for which its views should be shown,
0031 //! if the maximized windows will be borderless,
0032 //! if the layout will be shown at user layout contextmenu.
0033 //!
0034 
0035 class CentralLayout : public Layout::GenericLayout
0036 {
0037     Q_OBJECT
0038     Q_PROPERTY(Latte::WindowSystem::SchemeColors *scheme READ scheme NOTIFY schemeChanged)
0039 
0040 public:
0041     CentralLayout(QObject *parent, QString layoutFile, QString layoutName = QString());
0042     ~CentralLayout() override;
0043 
0044     bool initCorona() override;
0045 
0046     bool disableBordersForMaximizedWindows() const;
0047     void setDisableBordersForMaximizedWindows(bool disable);
0048 
0049     bool showInMenu() const;
0050     void setShowInMenu(bool show);
0051 
0052     bool isForFreeActivities() const;
0053     bool isOnAllActivities() const;
0054 
0055     QStringList activities() const;
0056     void setActivities(QStringList activities);
0057 
0058     const QStringList appliedActivities() override;
0059     Types::ViewType latteViewType(uint containmentId) const override;
0060 
0061     Layout::Type type() const override;
0062     Data::Layout data() const;
0063 
0064     Latte::WindowSystem::SchemeColors *scheme() const;
0065 
0066 public:
0067     Q_INVOKABLE bool isCurrent() override;
0068 
0069 signals:
0070     void disableBordersForMaximizedWindowsChanged();
0071     void schemeChanged();
0072     void showInMenuChanged();
0073 
0074 private slots:
0075     void loadConfig();
0076     void saveConfig();
0077 
0078     void onSchemeFileChanged();
0079 
0080 private:
0081     void init();
0082     void importLocalLayout(QString file);
0083 
0084     void setScheme(Latte::WindowSystem::SchemeColors *_scheme);
0085 
0086 private:
0087     bool m_disableBordersForMaximizedWindows{false};
0088     bool m_showInMenu{false};
0089     QStringList m_activities;
0090 
0091     Latte::WindowSystem::SchemeColors *m_scheme{nullptr};
0092 };
0093 
0094 }
0095 
0096 #endif //CENTRALLAYOUT_H