File indexing completed on 2024-06-02 06:03:23

0001 /*
0002     This file is part of the Kasten Framework, made within the KDE community.
0003 
0004     SPDX-FileCopyrightText: 2007-2008, 2011-2012 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_SHELLWINDOW_P_HPP
0010 #define KASTEN_SHELLWINDOW_P_HPP
0011 
0012 // lib
0013 #include "shellwindow.hpp"
0014 // Okteta core
0015 #include <kastencore.hpp>
0016 // Qt
0017 #include <QVector>
0018 
0019 namespace Kasten {
0020 class AbstractModelSynchronizer;
0021 class AbstractDocument;
0022 class AbstractTool;
0023 
0024 class ShellWindowPrivate
0025 {
0026 public:
0027     ShellWindowPrivate(ShellWindow* parent,
0028                        ViewManager* viewManager);
0029     ShellWindowPrivate(const ShellWindowPrivate&) = delete;
0030 
0031     ~ShellWindowPrivate();
0032 
0033     ShellWindowPrivate& operator=(const ShellWindowPrivate&) = delete;
0034 
0035 public:
0036     MultiViewAreas* viewArea() const;
0037     ViewManager* viewManager() const;
0038 
0039 public:
0040     void updateControllers(AbstractView* view);
0041     void addXmlGuiController(AbstractXmlGuiController* controller);
0042     void addTool(AbstractToolView* toolView);
0043     void showDocument(AbstractDocument* document);
0044 
0045 public: // If::WidgetsDockable API
0046     QVector<ToolViewDockWidget*> dockWidgets() const;
0047 
0048 private: // Q_SLOTS
0049     void onTitleChanged(const QString& newTitle);
0050     void onContentFlagsChanged(Kasten::ContentFlags contentFlags);
0051     void onLocalSyncStateChanged(Kasten::LocalSyncState newState);
0052     void onViewFocusChanged(Kasten::AbstractView* view);
0053     void onToolVisibilityChanged(bool isVisible);
0054     void onSynchronizerDeleted(QObject* synchronizer);
0055 
0056 private:
0057     Q_DECLARE_PUBLIC(ShellWindow)
0058 
0059 private:
0060     ShellWindow* const q_ptr;
0061 
0062     MultiViewAreas* mGroupedViews;
0063     // hack:
0064     // used to store a pointer to the current, so we can disconnect to its signals... well, not perfect
0065     AbstractView* mCurrentView = nullptr;
0066     AbstractDocument* mCurrentDocument = nullptr;
0067     AbstractModelSynchronizer* mCurrentSynchronizer = nullptr;
0068 
0069     ViewManager* mViewManager;
0070     QVector<AbstractXmlGuiController*> mControllers;
0071 
0072     QVector<ToolViewDockWidget*> mDockWidgets;
0073     QVector<AbstractTool*> mTools;
0074 };
0075 
0076 inline MultiViewAreas* ShellWindowPrivate::viewArea() const { return mGroupedViews; }
0077 inline ViewManager* ShellWindowPrivate::viewManager() const { return mViewManager; }
0078 inline QVector<ToolViewDockWidget*> ShellWindowPrivate::dockWidgets() const { return mDockWidgets; }
0079 
0080 inline void ShellWindowPrivate::addXmlGuiController(AbstractXmlGuiController* controller)
0081 {
0082     mControllers.append(controller);
0083 }
0084 
0085 }
0086 
0087 #endif