File indexing completed on 2024-06-02 06:03:25
0001 /* 0002 This file is part of the Kasten Framework, made within the KDE community. 0003 0004 SPDX-FileCopyrightText: 2006, 2008-2009, 2019 Friedrich W. H. Kossebau <kossebau@kde.org> 0005 0006 SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL 0007 */ 0008 0009 #ifndef KASTEN_VIEWMANAGER_HPP 0010 #define KASTEN_VIEWMANAGER_HPP 0011 0012 // lib 0013 #include "abstractview.hpp" 0014 // Qt 0015 #include <QVector> 0016 #include <QObject> 0017 // Std 0018 #include <memory> 0019 0020 namespace Kasten { 0021 0022 class ModelCodecViewManager; 0023 class AbstractViewFactory; 0024 0025 class ViewManagerPrivate; 0026 0027 class KASTENGUI_EXPORT ViewManager : public QObject 0028 { 0029 Q_OBJECT 0030 0031 public: 0032 ViewManager(); 0033 0034 ~ViewManager() override; 0035 0036 public: 0037 void setViewFactory(AbstractViewFactory* factory); 0038 0039 void createCopyOfView(AbstractView* view, Qt::Alignment alignment = {}); 0040 void removeViews(const QVector<AbstractView*>& views); 0041 0042 public: 0043 QVector<AbstractView*> views() const; 0044 AbstractView* viewByWidget(QWidget* widget) const; 0045 0046 public: 0047 ModelCodecViewManager* codecViewManager() const; 0048 0049 public Q_SLOTS: 0050 void createViewsFor(const QVector<Kasten::AbstractDocument*>& documents); 0051 void removeViewsFor(const QVector<Kasten::AbstractDocument*>& documents); 0052 0053 Q_SIGNALS: 0054 // view was created and already added to the list 0055 void opened(const QVector<Kasten::AbstractView*>& views); 0056 // view will be closed, already removed from list 0057 void closing(const QVector<Kasten::AbstractView*>& views); 0058 0059 private: 0060 const std::unique_ptr<class ViewManagerPrivate> d_ptr; 0061 Q_DECLARE_PRIVATE(ViewManager) 0062 }; 0063 0064 } 0065 0066 #endif