Warning, file /plasma/latte-dock/app/layout/centrallayout.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 /*
0002 *  Copyright 2017  Smith AR <audoban@openmailbox.org>
0003 *                  Michail Vourlakos <mvourlakos@gmail.com>
0004 *
0005 *  This file is part of Latte-Dock
0006 *
0007 *  Latte-Dock is free software; you can redistribute it and/or
0008 *  modify it under the terms of the GNU General Public License as
0009 *  published by the Free Software Foundation; either version 2 of
0010 *  the License, or (at your option) any later version.
0011 *
0012 *  Latte-Dock is distributed in the hope that it will be useful,
0013 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
0014 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0015 *  GNU General Public License for more details.
0016 *
0017 *  You should have received a copy of the GNU General Public License
0018 *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
0019 */
0020 
0021 #ifndef CENTRALLAYOUT_H
0022 #define CENTRALLAYOUT_H
0023 
0024 // local
0025 #include "genericlayout.h"
0026 
0027 // Qt
0028 #include <QObject>
0029 
0030 namespace Latte {
0031 class Corona;
0032 class SharedLayout;
0033 }
0034 
0035 namespace Latte {
0036 
0037 //! CentralLayout is a very IMPORTANT layout that is responsible for specific Activities or not
0038 //! and it is used for all memory modes (SINGLE/MULTIPLE) at all times.
0039 //!
0040 //! It holds all the important settings in order to provide specific
0041 //! behavior for the Activities is assigned at.
0042 //! for example: activities for which its views should be shown,
0043 //! if the maximized windows will be borderless,
0044 //! if the layout will be shown at user layout contextmenu,
0045 //! which shared layout will be used on top of that layout.
0046 //!
0047 
0048 class CentralLayout : public Layout::GenericLayout
0049 {
0050     Q_OBJECT
0051 
0052 public:
0053     CentralLayout(QObject *parent, QString layoutFile, QString layoutName = QString());
0054     ~CentralLayout() override;
0055 
0056     void initToCorona(Latte::Corona *corona);
0057 
0058     bool disableBordersForMaximizedWindows() const;
0059     void setDisableBordersForMaximizedWindows(bool disable);
0060 
0061     bool showInMenu() const;
0062     void setShowInMenu(bool show);
0063 
0064     QString sharedLayoutName() const;
0065     void setSharedLayoutName(QString name);
0066 
0067     QStringList activities() const;
0068     void setActivities(QStringList activities);
0069 
0070     SharedLayout *sharedLayout() const;
0071     void setSharedLayout(SharedLayout *layout);
0072 
0073     //! OVERRIDE GeneralLayout implementations
0074     void addView(Plasma::Containment *containment, bool forceOnPrimary = false, int explicitScreen = -1, Layout::ViewsMap *occupied = nullptr);
0075     void syncLatteViewsToScreens(Layout::ViewsMap *occupiedMap = nullptr) override;
0076     void unloadContainments() override;
0077     bool configViewIsShown() const override;
0078     const QStringList appliedActivities() override;
0079     Types::ViewType latteViewType(int containmentId) const override;
0080     QList<Latte::View *> latteViews() override;
0081 
0082     int viewsCount(int screen) const override;
0083     int viewsCount(QScreen *screen) const override;
0084     int viewsCount() const override;
0085 
0086     Layout::Type type() const override;
0087 
0088     //! Available edges for specific view in that screen
0089     QList<Plasma::Types::Location> availableEdgesForView(QScreen *scr, Latte::View *forView) const override;
0090     //! All free edges in that screen
0091     QList<Plasma::Types::Location> freeEdges(QScreen *scr) const override;
0092     QList<Plasma::Types::Location> freeEdges(int screen) const override;
0093 
0094     QList<Latte::View *> sortedLatteViews(QList<Latte::View *> views = QList<Latte::View *>()) override;
0095     QList<Latte::View *> viewsWithPlasmaShortcuts() override;
0096 
0097 signals:
0098     void activitiesChanged();
0099     void disableBordersForMaximizedWindowsChanged();
0100     void showInMenuChanged();
0101     void sharedLayoutNameChanged();
0102 
0103 private slots:
0104     void disconnectSharedConnections();
0105 
0106     void loadConfig();
0107     void saveConfig();
0108 
0109 private:
0110     void init();
0111     void importLocalLayout(QString file);
0112 
0113     bool kwin_disabledMaximizedBorders() const;
0114     void kwin_setDisabledMaximizedBorders(bool disable);
0115 
0116 private:
0117     bool m_disableBordersForMaximizedWindows{false};
0118     bool m_showInMenu{false};
0119     QString m_sharedLayoutName;
0120     QStringList m_activities;
0121 
0122     QPointer<Latte::View> m_lastSettingsView;
0123 
0124     QPointer<SharedLayout> m_sharedLayout;
0125 
0126     QList<QMetaObject::Connection> m_sharedConnections;
0127 };
0128 
0129 }
0130 
0131 #endif //CENTRALLAYOUT_H