[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: playground/network/kcall
From: George Kiagiadakis <gkiagiad () csd ! uoc ! gr>
Date: 2009-06-14 15:04:59
Message-ID: 1244991899.551176.31572.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 981959 by gkiagia:
Switch to using the channel dispatcher instead of requesting channels directly from \
the connection manager.
M +1 -0 CMakeLists.txt
A callhandler.cpp [License: LGPL (v2.1+)]
A callhandler.h [License: LGPL (v2.1+)]
M +0 -10 callwindow.cpp
M +0 -1 callwindow.h
M +0 -1 callwindowpart/CMakeLists.txt
M +0 -7 callwindowpart/callwindowpart.cpp
M +0 -3 callwindowpart/callwindowpart.h
M +0 -27 callwindowpart/callwindowpart_p.cpp
M +0 -3 callwindowpart/callwindowpart_p.h
D callwindowpart/pendingoutgoingcall.cpp
D callwindowpart/pendingoutgoingcall.h
M +12 -3 contactlistcontroller.cpp
M +8 -0 kcallapplication.cpp
--- trunk/playground/network/kcall/CMakeLists.txt #981958:981959
@@ -16,6 +16,7 @@
mainwindow.cpp
contactlistcontroller.cpp
callwindow.cpp
+ callhandler.cpp
models/treemodel.cpp
models/contactsmodel.cpp
models/pendingcontacts.cpp
--- trunk/playground/network/kcall/callwindow.cpp #981958:981959
@@ -30,16 +30,6 @@
KParts::Part *part;
};
-/*! This constructor is used to make an outgoing call to the specified \a contact */
-CallWindow::CallWindow(Tp::ContactPtr contact)
- : KParts::MainWindow(), d(new Private)
-{
- init();
- if ( d->part ) {
- QMetaObject::invokeMethod(d->part, "callContact", Q_ARG(Tp::ContactPtr, \
contact));
- }
-}
-
/*! This constructor is used to handle an incoming call, in which case
* the specified \a channel must be ready and the call must have been accepted.
*/
--- trunk/playground/network/kcall/callwindow.h #981958:981959
@@ -24,7 +24,6 @@
{
Q_OBJECT
public:
- CallWindow(Tp::ContactPtr contact);
CallWindow(Tp::StreamedMediaChannelPtr channel);
virtual ~CallWindow();
--- trunk/playground/network/kcall/callwindowpart/CMakeLists.txt #981958:981959
@@ -54,7 +54,6 @@
set(callwindowpart_SRCS
callwindowpart.cpp
callwindowpart_p.cpp
- pendingoutgoingcall.cpp
abstractmediahandler.cpp
farsight/mediadevices.cpp
farsight/mediahandler.cpp
--- trunk/playground/network/kcall/callwindowpart/callwindowpart.cpp #981958:981959
@@ -51,13 +51,6 @@
setWidget(d->videoStackedWidget);
}
-void CallWindowPart::callContact(Tp::ContactPtr contact)
-{
- emit setWindowCaption(contact->alias());
- Q_D(CallWindowPart);
- d->callContact(contact);
-}
-
void CallWindowPart::handleStreamedMediaChannel(Tp::StreamedMediaChannelPtr channel)
{
Q_D(CallWindowPart);
--- trunk/playground/network/kcall/callwindowpart/callwindowpart.h #981958:981959
@@ -31,9 +31,6 @@
CallWindowPart(QWidget *parentWidget, QObject *parent, const QVariantList \
&args);
public Q_SLOTS:
- /** Makes an outgoing call to the specified @a contact */
- void callContact(Tp::ContactPtr contact);
-
/** Handles an existing Tp::StreamedMediaChannel. This can be used
* to handle an incoming call, in which case it is assumed that the call
* has already been accepted. It can also be used for outgoing calls.
--- trunk/playground/network/kcall/callwindowpart/callwindowpart_p.cpp #981958:981959
@@ -15,7 +15,6 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "callwindowpart_p.h"
-#include "pendingoutgoingcall.h"
#include "abstractmediahandler.h"
#include <KDebug>
#include <KLocalizedString>
@@ -78,27 +77,6 @@
emit q->setStatusBarText(QString("%1 %2").arg(msg).arg(extraMsg));
}
-void CallWindowPartPrivate::callContact(Tp::ContactPtr contact)
-{
- setState(Connecting);
- connect(new PendingOutgoingCall(contact, this),
- SIGNAL(finished(Tp::PendingOperation*)),
- SLOT(pendingOutgoingCallFinished(Tp::PendingOperation*)));
- m_contact = contact;
-}
-
-void CallWindowPartPrivate::pendingOutgoingCallFinished(Tp::PendingOperation *op)
-{
- if ( op->isError() ) {
- setState(Error, op->errorMessage());
- return;
- }
-
- PendingOutgoingCall *pc = qobject_cast<PendingOutgoingCall*>(op);
- Q_ASSERT(pc);
- handleChannel(pc->channel());
-}
-
void CallWindowPartPrivate::handleChannel(Tp::StreamedMediaChannelPtr channel)
{
m_channel = channel;
@@ -155,11 +133,6 @@
// onStreamStateChanged(stream, stream->state());
}
- if ( streams.size() == 0 && !m_contact.isNull() ) {
- //HACK remove this from here
- m_channel->requestStream(m_contact, Tp::MediaStreamTypeAudio);
- }
-
if ( m_channel->awaitingRemoteAnswer() ) {
setState(Ringing);
} else {
--- trunk/playground/network/kcall/callwindowpart/callwindowpart_p.h #981958:981959
@@ -31,7 +31,6 @@
enum State { Connecting, Ringing, InCall, HangingUp, Disconnected, Error };
void setupActions();
- void callContact(Tp::ContactPtr contact);
void handleChannel(Tp::StreamedMediaChannelPtr channel);
bool requestClose();
@@ -44,7 +43,6 @@
void setStatus(const QString & msg, const QString & extraMsg);
private slots:
- void pendingOutgoingCallFinished(Tp::PendingOperation *op);
void onChannelReady(Tp::PendingOperation *op);
void onChannelInvalidated(Tp::DBusProxy *proxy, const QString &errorName,
const QString &errorMessage);
@@ -60,7 +58,6 @@
private:
CallWindowPart *const q_ptr;
- Tp::ContactPtr m_contact;
Tp::StreamedMediaChannelPtr m_channel;
State m_state;
KAction *m_hangupAction;
--- trunk/playground/network/kcall/contactlistcontroller.cpp #981958:981959
@@ -18,13 +18,13 @@
#include "models/contactsmodel.h"
#include "models/accountitem.h" //for Q_DECLARE_METATYPE
#include "models/contactitem.h" //for Q_DECLARE_METATYPE
-#include "callwindow.h"
#include <QtGui/QAbstractItemView>
#include <KDebug>
#include <KIcon>
#include <KSelectAction>
#include <KMenu>
#include <KLocalizedString>
+#include <TelepathyQt4/ReferencedHandles>
struct ContactListController::Private
{
@@ -92,8 +92,17 @@
Tp::ContactPtr contact = \
d->currentIndex.data(ContactsModel::ObjectPtrRole).value<Tp::ContactPtr>(); \
Q_ASSERT( !contact.isNull() );
- CallWindow *cw = new CallWindow(contact);
- cw->show();
+ //TODO this should be removed when Tp::Contact has support for requesting \
channels directly + Tp::AccountPtr account = \
d->currentIndex.parent().data(ContactsModel::ObjectPtrRole).value<Tp::AccountPtr>(); \
+ Q_ASSERT( !account.isNull() ); +
+ QVariantMap request;
+ request.insert(TELEPATHY_INTERFACE_CHANNEL ".ChannelType",
+ TELEPATHY_INTERFACE_CHANNEL_TYPE_STREAMED_MEDIA);
+ request.insert(TELEPATHY_INTERFACE_CHANNEL ".TargetHandleType", \
Tp::HandleTypeContact); + request.insert(TELEPATHY_INTERFACE_CHANNEL \
".TargetHandle", contact->handle()[0]); + \
request.insert(TELEPATHY_INTERFACE_CHANNEL_TYPE_STREAMED_MEDIA \
".FUTURE.InitialAudio", true); + account->ensureChannel(request, \
QDateTime::currentDateTime(), "org.freedesktop.Telepathy.Client.kcall"); }
void ContactListController::setStatus(int statusIndex)
--- trunk/playground/network/kcall/kcallapplication.cpp #981958:981959
@@ -16,16 +16,20 @@
*/
#include "kcallapplication.h"
#include "mainwindow.h"
+#include "callhandler.h"
#include "models/contactsmodel.h"
#include <KDebug>
#include <TelepathyQt4/AccountManager>
#include <TelepathyQt4/PendingReady>
+#include <TelepathyQt4/ClientRegistrar>
struct KCallApplication::Private
{
MainWindow *mainWindow;
ContactsModel *contactsModel;
Tp::AccountManagerPtr accountManager;
+ Tp::ClientRegistrarPtr registrar;
+ Tp::SharedPtr<CallHandler> callHandler;
};
KCallApplication::KCallApplication()
@@ -37,6 +41,10 @@
connect(d->accountManager->becomeReady(),
SIGNAL(finished(Tp::PendingOperation *)),
SLOT(onAccountManagerReady(Tp::PendingOperation *)));
+
+ d->registrar = Tp::ClientRegistrar::create();
+ d->callHandler = Tp::SharedPtr<CallHandler>(new CallHandler());
+ d->registrar->registerClient(Tp::AbstractClientPtr::dynamicCast(d->callHandler), \
"kcall"); }
KCallApplication::~KCallApplication()
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic