[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    branches/work/soc-kopete-jingle/kopete/protocols/jabber
From:       Detlev Casanova <detlev.casanova () gmail ! com>
Date:       2008-08-09 21:14:31
Message-ID: 1218316471.879702.28540.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 844489 by casanova:

 * Added sessions removal from the Jingle GUI;
 * Fixed content dialog deletion;
 * Remove WrapJpegData method (deprecated because JPEG is not a good payload for \
VoIP).


 M  +3 -1      jabberaccount.cpp  
 M  +34 -5     jingle/jinglecallsgui.cpp  
 M  +2 -0      jingle/jinglecallsgui.h  
 M  +2 -2      jingle/jinglecallsmanager.cpp  
 M  +2 -2      jingle/jinglemediamanager.cpp  
 M  +5 -21     jingle/jinglertpsession.cpp  
 M  +0 -1      jingle/jinglertpsession.h  


--- branches/work/soc-kopete-jingle/kopete/protocols/jabber/jabberaccount.cpp \
#844488:844489 @@ -135,7 +135,9 @@
 
 	delete m_contactPool;
 	m_contactPool = 0L;
-	
+
+	delete m_jcm;
+
 #ifdef SUPPORT_JINGLE
 	//delete m_voiceCaller;
 	//m_voiceCaller = 0L;
--- branches/work/soc-kopete-jingle/kopete/protocols/jabber/jingle/jinglecallsgui.cpp \
#844488:844489 @@ -44,13 +44,14 @@
 	ui.setupUi(this);
 	setupActions();
 
-	JingleCallsModel *model = new JingleCallsModel(m_callsManager->jabberSessions());
+	model = new JingleCallsModel(m_callsManager->jabberSessions());
 	ui.treeView->setModel(model);
 }
 
 JingleCallsGui::~JingleCallsGui()
 {
-
+	kDebug() << "deleted";
+	delete model;
 }
 
 void JingleCallsGui::setupActions()
@@ -144,6 +145,8 @@
 	for (int column = 0; column < model->columnCount(index.parent()); ++column)
 	{
 		QModelIndex child = model->index(index.row() + 1, column, index.parent());
+		TreeItem *item = static_cast<TreeItem*>(child.internalPointer());
+		item->setSessionPtr(sess);
 		model->setData(child, sessData[column], Qt::EditRole);
 	}
 
@@ -173,6 +176,29 @@
 void JingleCallsGui::removeSession(JabberJingleSession* sess)
 {
 	kDebug() << "Remove session" << sess;
+	int i = 0;
+
+//Looking for the QModelIndex with the session sess.
+	//root QModelIndex
+	QAbstractItemModel *model = ui.treeView->model();
+	QModelIndex child = model->index(0, 0);
+	//QModelIndex child = rootIndex.child(0, 0);
+
+	while (child.isValid())
+	{
+		kDebug() << child.data();
+		TreeItem *childItem = static_cast<TreeItem*>(child.internalPointer());
+		if (childItem == 0)
+			kDebug() << "childItem is NULL";
+		kDebug() << "Compare" << childItem->session() << "to" << sess;
+		if (childItem->session() == sess)
+		{
+			//Children of this line will be automatically removed.
+			model->removeRow(i, child.parent());
+		}
+		child = model->index(++i, 0);
+	}
+
 	//Don't delete it, just remove it from the QTreeView.
 }
 
@@ -198,8 +224,6 @@
 
 void JingleCallsModel::setModelUp(const QList<JabberJingleSession*> &sessions)
 {
-	//FIXME:Later, each TreeItem could keep a pointer on the session or content it is \
                linked to so edition is more easy.
-	//kDebug() << "Setting Model up with" << sessions.count() << "sessions";
 	for (int i = 0; i < sessions.count(); i++)
 	{
 		QVector<QVariant> sessData;
@@ -397,7 +421,10 @@
 
 TreeItem::~TreeItem()
 {
-
+	for (int i = 0; i < childItems.count(); i++)
+	{
+		delete childItems.takeAt(i);
+	}
 }
 
 void TreeItem::setContentPtr(JabberJingleContent* c)
@@ -426,7 +453,9 @@
 		return false;
 
 	for (int row = 0; row < count; ++row)
+	{
 		delete childItems.takeAt(pos);
+	}
 
 	return true;
 }
--- branches/work/soc-kopete-jingle/kopete/protocols/jabber/jingle/jinglecallsgui.h \
#844488:844489 @@ -8,6 +8,7 @@
 class JingleCallsManager;
 class JabberJingleSession;
 class JabberJingleContent;
+class JingleCallsModel;
 class JingleCallsGui : public QMainWindow
 {
 	Q_OBJECT
@@ -29,6 +30,7 @@
 	void setupActions();
 	JingleCallsManager *m_callsManager;
 	Ui::jingleCallsGui ui;
+	JingleCallsModel *model;
 };
 
 
--- branches/work/soc-kopete-jingle/kopete/protocols/jabber/jingle/jinglecallsmanager.cpp \
#844488:844489 @@ -63,7 +63,7 @@
 	delete d->mediaManager;
 	delete d->gui;
 	//delete d->sessions;
-	delete d->contentDialog;
+	//delete d->contentDialog; --> Will be deleted when necessary.
 
 	//TODO:delete the other fields in Private...
 }
@@ -297,7 +297,7 @@
 	contentDialog->session()->terminate(JingleReason(JingleReason::Decline));
 	kDebug() << "end";
 	contentDialog->close();
-	delete contentDialog;
+	contentDialog->deleteLater();
 }
 
 void JingleCallsManager::showCallsGui()
--- branches/work/soc-kopete-jingle/kopete/protocols/jabber/jingle/jinglemediamanager.cpp \
#844488:844489 @@ -36,7 +36,7 @@
 
 JingleMediaSession::~JingleMediaSession()
 {
-
+	kDebug() << "deleted";
 }
 
 void JingleMediaSession::setPayloadType(const QDomElement& payload)
@@ -211,7 +211,7 @@
 	}
 
 	connect(mediaSession, SIGNAL(incomingData()), this, SLOT(slotIncomingData()));
-	//connect(mediaSession, SIGNAL(terminated()), this, SLOT(slotSessionTerminated()));
+	connect(mediaSession, SIGNAL(terminated()), this, SLOT(slotSessionTerminated()));
 	
 	m_sessions << mediaSession;
 
--- branches/work/soc-kopete-jingle/kopete/protocols/jabber/jingle/jinglertpsession.cpp \
#844488:844489 @@ -144,33 +144,17 @@
 	//payloadTS must be set here.
 	payloadName = "PCMA";
 	payloadID = 8;
-	payloadTS = 2000; // For testing, data sent each 2000 ms TODO:Change that !!!
+	payloadTS = 168; // For testing, data sent each 168 ms for PCMA TODO:Change that \
!!!  RtpProfile *profile = rtp_profile_new(payloadName.toAscii());
-	rtp_profile_set_payload(profile, 96, &payload_type_pcma8000);
+	rtp_profile_set_payload(profile, 8, &payload_type_pcma8000);
 	rtp_session_set_profile(m_rtpSession, profile);
-	rtp_session_set_payload_type(m_rtpSession, 96);
+	rtp_session_set_payload_type(m_rtpSession, 8);
 }
 
 void JingleRtpSession::slotBytesWritten(qint64 size)
 {
-	kDebug() << size << "bytes written";
+	//kDebug() << size << "bytes written";
 	if (state != SendingData)
 		return;
 	emit dataSent();
-}
-
-void JingleRtpSession::wrapJpegData(char *data, int size)
-{
-	QImage img;
-	img.loadFromData((const uchar*)data, size, "JPEG");
-	unsigned char header[8];
-	header[0] = 0;
-	header[1] = 0;
-	header[2] = 0;
-	header[3] = 0;
-	header[4] = 0;
-	header[5] = 0;
-	header[6] = img.width() / 8;
-	header[7] = img.height() / 8;
-	
-}
+}
\ No newline at end of file
--- branches/work/soc-kopete-jingle/kopete/protocols/jabber/jingle/jinglertpsession.h \
#844488:844489 @@ -65,7 +65,6 @@
 	int payloadTS;
 	int payloadID;
 	QString payloadName;
-	void wrapJpegData(char*, int);
 	enum State {SendingData = 0} state;
 	Direction m_direction;
 };


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic