2 * Copyright (C) 2011 Lukáš Karas <lukas.karas@centrum.cz>
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the
16 * Free Software Foundation, Inc.,
17 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20 #include <QtCore/QObject>
21 #include <QtCore/QVariant>
22 #include <QtDeclarative>
23 #include <QDomElement>
25 #include "../backend/session.h"
27 #ifndef SESSIONMODELITEM_H
28 #define SESSIONMODELITEM_H
30 class SessionModelItem
: public QObject
{
32 Q_DISABLE_COPY(SessionModelItem
)
33 Q_PROPERTY(bool visible READ isVisible WRITE setVisible
);
37 SessionModelItem(MaknetoBackend::Session
*session
, QObject
*parent
= 0);
38 virtual ~SessionModelItem();
39 MaknetoBackend::Session
*getSession();
41 void setVisible(bool);
43 Q_INVOKABLE QVariant
data(int role
);
48 void textMessageReceived(const QString
&sessionId
, const QString
&text
, const QString
&contact
);
49 void whiteboardMessageReceived(const QString
&sessionId
, const QString
&text
, const QString
&contact
);
50 void messageEnqueued(const QString
&sessionId
);
52 void incomingCall(const QString
&sessionId
);
53 void callReady(const QString
&sessionId
);
54 void callEnded(const QString
&sessionId
);
55 void callError(const QString
&sessionId
, const QString
&);
56 void videoPreviewAvailable(const QString
&sessionId
, QGst::ElementPtr videoOutElemPtr
);
57 void videoAvailable(const QString
&sessionId
, QGst::ElementPtr videoOutElemPtr
);
58 void videoPreviewRemoved(const QString
&sessionId
, QGst::ElementPtr videoOutElemPtr
);
59 void videoRemoved(const QString
&sessionId
, QGst::ElementPtr videoOutElemPtr
);
60 void remoteAudioStreamAdded(const QString
&sessionId
);
62 void sessionTypeChanged(const QString
&sessionId
, int types
);
63 void messageSent(const QString
&sessionId
, const QString
&message
);
64 void sendingError(const QString
&sessionId
, const QString
&message
, const QString
&errorMessage
);
65 void chatStateChanged(const QString
&sessionId
, int chatState
, const QString
&contact
);
69 void onMessageReceived(const QString
&text
, const QString
&contact
);
70 void sendTextMessage(const QString
&text
);
71 void sendWhiteboardMessage(const QDomElement
&wb
);
72 void onSessionTypeChanged();
73 void onMessageSent(const QString
&message
); // outgoing message was successfully send
74 void onSendingError(const QString
&message
, const QString
&errorMessage
); // outgoing message sending failed
75 void onChatStateChanged(MaknetoBackend::Session::ChatState state
, const QString
&contact
);
76 void changeChatState(MaknetoBackend::Session::ChatState state
);
79 void onIncomingCall();
81 void onCallEnded(const QString
&);
82 void onCallError(const QString
&);
83 void onVideoPreviewAvailable(QGst::ElementPtr videoOutElemPtr
);
84 void onVideoAvailable(QGst::ElementPtr videoOutElemPtr
);
85 void onVideoPreviewRemoved(QGst::ElementPtr videoOutElemPtr
);
86 void onVideoRemoved(QGst::ElementPtr videoOutElemPtr
);
87 void onRemoteAudioStreamAdded();
91 friend struct QueueItem
;
94 MaknetoBackend::Session
*_session
;
95 QList
<QueueItem
*> _queue
;
99 Q_DECLARE_METATYPE(SessionModelItem
*);
101 #endif /* SESSIONMODELITEM_H */