File indexing completed on 2024-05-12 13:44:22

0001 /***************************************************************************
0002  *  Copyright (C) 2020 by Renaud Guezennec                               *
0003  *   http://www.rolisteam.org/contact                                      *
0004  *                                                                         *
0005  *   This software 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 INSTANTMESSAGINGVIEW_H
0021 #define INSTANTMESSAGINGVIEW_H
0022 
0023 #include "rwidgets_global.h"
0024 #include <QDockWidget>
0025 #include <QPointer>
0026 
0027 #include "controller/instantmessagingcontroller.h"
0028 
0029 namespace Ui
0030 {
0031 class InstantMessagingView;
0032 }
0033 
0034 class InstantMessagingController;
0035 class QQuickWidget;
0036 class RWIDGET_EXPORT InstantMessagerManager : public QObject
0037 {
0038     Q_OBJECT
0039     Q_PROPERTY(InstantMessagingController* ctrl READ ctrl NOTIFY ctrlChanged)
0040 public:
0041     InstantMessagerManager(QObject* object= nullptr);
0042 
0043     InstantMessagingController* ctrl() const;
0044 
0045     void setCtrl(InstantMessagingController* ctrl);
0046 
0047 signals:
0048     void ctrlChanged();
0049 
0050 private:
0051     QPointer<InstantMessagingController> m_ctrl;
0052 };
0053 
0054 class RWIDGET_EXPORT InstantMessagingView : public QWidget
0055 {
0056     Q_OBJECT
0057 
0058 public:
0059     explicit InstantMessagingView(InstantMessagingController* ctrl, QWidget* parent= nullptr);
0060     ~InstantMessagingView();
0061 
0062 protected:
0063     void closeEvent(QCloseEvent* event) override;
0064 
0065 private:
0066     Ui::InstantMessagingView* m_ui;
0067     std::unique_ptr<QQuickWidget> m_qmlViewer;
0068     QPointer<InstantMessagingController> m_ctrl;
0069 };
0070 
0071 #endif // INSTANTMESSAGINGVIEW_H