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

0001 /*
0002     SPDX-FileCopyrightText: 2021 Michail Vourlakos <mvourlakos@gmail.com>
0003 
0004     SPDX-License-Identifier: GPL-2.0-or-later
0005 */
0006 
0007 #ifndef SETTINGSPARTTEMPLATESKEEPER_H
0008 #define SETTINGSPARTTEMPLATESKEEPER_H
0009 
0010 // local
0011 #include "../../data/viewdata.h"
0012 #include "../../data/viewstable.h"
0013 
0014 // Qt
0015 #include <QObject>
0016 
0017 namespace Latte {
0018 class CentralLayout;
0019 class Corona;
0020 namespace Settings {
0021 namespace Controller {
0022 class Layouts;
0023 }
0024 }
0025 }
0026 
0027 namespace Latte {
0028 namespace Settings {
0029 namespace Part {
0030 
0031 class TemplatesKeeper : public QObject
0032 {
0033     Q_OBJECT
0034 
0035 public:
0036     explicit TemplatesKeeper(Settings::Controller::Layouts *parent, Latte::Corona *corona);
0037     ~TemplatesKeeper();
0038 
0039     QString storedView(const QString &layoutCurrentId, const QString &viewId);
0040 
0041     bool hasClipboardContents() const;
0042 
0043     Latte::Data::ViewsTable clipboardContents() const;
0044     void setClipboardContents(const Latte::Data::ViewsTable &views);
0045 
0046 public slots:
0047     void clear();
0048 
0049 signals:
0050     void clipboardContentsChanged();
0051 
0052 private:
0053     QString viewKeeperId(const QString &layoutCurrentId, const QString &viewId);
0054 
0055 private:
0056     Latte::Data::ViewsTable m_storedViews;
0057     Latte::Data::ViewsTable m_clipboardViews;
0058 
0059     Latte::Corona *m_corona{nullptr};
0060     Settings::Controller::Layouts *m_layoutsController{nullptr};
0061 
0062     QList<CentralLayout *> m_garbageLayouts;
0063 };
0064 
0065 }
0066 }
0067 }
0068 
0069 #endif