File indexing completed on 2024-09-15 04:58:18
0001 /*************************************************************************** 0002 * Copyright (C) 2015 by Renaud Guezennec * 0003 * http://www.renaudguezennec.eu/accueil,3.html * 0004 * * 0005 * rolisteam is free software; you can redistribute it and/or modify * 0006 * it under the terms of the GNU General Public License as published by * 0007 * the Free Software Foundation; either version 2 of the License, or * 0008 * (at your option) any later version. * 0009 * * 0010 * This program is distributed in the hope that it will be useful, * 0011 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 0012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 0013 * GNU General Public License for more details. * 0014 * * 0015 * You should have received a copy of the GNU General Public License * 0016 * along with this program; if not, write to the * 0017 * Free Software Foundation, Inc., * 0018 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * 0019 ***************************************************************************/ 0020 #ifndef MEDIACONTAINER_H 0021 #define MEDIACONTAINER_H 0022 0023 #include <QAction> 0024 #include <QMdiSubWindow> 0025 #include <QString> 0026 0027 #include "controller/view_controller/mediacontrollerbase.h" 0028 #include "preferences/preferencesmanager.h" 0029 #include "rwidgets/rwidgets_global.h" 0030 #include "rwidgets/toolbars/vtoolbar.h" 0031 0032 /** 0033 * @brief The MediaContainer class 0034 */ 0035 class RWIDGET_EXPORT MediaContainer : public QMdiSubWindow 0036 { 0037 Q_OBJECT 0038 Q_PROPERTY(QString ownerId READ ownerId WRITE setOwnerId NOTIFY ownerIdChanged) 0039 0040 public: 0041 enum class ContainerType : int 0042 { 0043 ImageContainer, 0044 VMapContainer, 0045 NoteContainer, 0046 SharedNoteContainer, 0047 ChatContainer, 0048 CharacterSheetContainer, 0049 PDFContainer, 0050 WebViewContainer, 0051 MindMapContainer 0052 }; 0053 Q_ENUM(ContainerType) 0054 /** 0055 * @brief MediaContainer 0056 */ 0057 MediaContainer(MediaControllerBase* ctrl, ContainerType containerType, QWidget* parent= nullptr); 0058 0059 MediaControllerBase* ctrl() const; 0060 /** 0061 * @brief ~MediaContainer 0062 */ 0063 virtual ~MediaContainer() override; 0064 /** 0065 * @brief error 0066 * @param err - error message to display 0067 */ 0068 void error(QString err, QWidget* parent); 0069 void addActionToMenu(QMenu& menu); 0070 0071 QString ownerId() const; 0072 void setOwnerId(const QString& ownerId); 0073 0074 void setContainerType(const ContainerType& containerType); 0075 MediaContainer::ContainerType getContainerType() const; 0076 0077 QString mediaId() const; 0078 0079 protected: 0080 void closeEvent(QCloseEvent* event) override; 0081 void showEvent(QShowEvent* showEvent) override; 0082 void hideEvent(QHideEvent* hideEvent) override; 0083 0084 signals: 0085 void visibleChanged(bool); 0086 void ownerIdChanged(); 0087 void uriNameChanged(); 0088 0089 public slots: 0090 void setVisible(bool b) override; 0091 void detachView(bool b); 0092 0093 protected: 0094 QPointer<MediaControllerBase> m_lifeCycleCtrl; 0095 QString m_filter; 0096 PreferencesManager* m_preferences; 0097 QCursor* m_currentCursor= nullptr; 0098 QAction* m_detachedDialog; 0099 ContainerType m_containerType; 0100 }; 0101 0102 #endif // MEDIACONTAINER_H