sc/Library_sc.mk | 6 - sc/source/ui/collab/collab.cxx | 126 --------------------------------------- sc/source/ui/collab/contacts.cxx | 22 +++++- sc/source/ui/collab/contacts.hxx | 4 - sc/source/ui/collab/contacts.src | 4 - sc/source/ui/collab/sendfunc.cxx | 82 ++++++++++++++++--------- sc/source/ui/inc/collab.hxx | 76 ----------------------- 7 files changed, 71 insertions(+), 249 deletions(-)
New commits: commit d17dca0a25d893445c4e384fad66364a4b2fb66d Author: Matúš Kukan <matus.ku...@gmail.com> Date: Fri Jun 8 21:10:59 2012 +0200 tubes: remove ScCollaboration layer diff --git a/sc/Library_sc.mk b/sc/Library_sc.mk index f8ef430..6aa71ae 100644 --- a/sc/Library_sc.mk +++ b/sc/Library_sc.mk @@ -53,20 +53,14 @@ $(eval $(call gb_Library_add_linked_libs,sc,\ )) $(eval $(call gb_Library_add_cxxflags,sc,\ - $$(TELEPATHY_CFLAGS) \ -DENABLE_TELEPATHY \ )) -$(eval $(call gb_Library_add_libs,sc,\ - $$(TELEPATHY_LIBS) \ -)) - $(eval $(call gb_Library_use_externals,sc,\ telepathy \ )) $(eval $(call gb_Library_add_exception_objects,sc,\ - sc/source/ui/collab/collab \ sc/source/ui/collab/contacts \ sc/source/ui/collab/sendfunc \ )) diff --git a/sc/source/ui/collab/collab.cxx b/sc/source/ui/collab/collab.cxx deleted file mode 100644 index d14b42e..0000000 --- a/sc/source/ui/collab/collab.cxx +++ /dev/null @@ -1,126 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * Version: MPL 1.1 / GPLv3+ / LGPLv3+ - * - * The contents of this file are subject to the Mozilla Public License Version - * 1.1 (the "License"); you may not use this file except in compliance with - * the License or as specified alternatively below. You may obtain a copy of - * the License at http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License - * for the specific language governing rights and limitations under the - * License. - * - * Major Contributor(s): - * Copyright (C) 2012 Red Hat, Inc., Eike Rathke <er...@redhat.com> - * - * All Rights Reserved. - * - * For minor contributions see the git repository. - * - * Alternatively, the contents of this file may be used under the terms of - * either the GNU General Public License Version 3 or later (the "GPLv3+"), or - * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"), - * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable - * instead of those above. - */ - -#include "collab.hxx" -#include <tubes/manager.hxx> -#include <tubes/conference.hxx> -#include <tubes/contact-list.hxx> - -ScCollaboration::ScCollaboration() - : - mpAccount( NULL), - mpContact( NULL), - mpManager( NULL) -{ -} - - -ScCollaboration::~ScCollaboration() -{ - if (mpAccount) - g_object_unref( mpAccount); - if (mpContact) - g_object_unref( mpContact); - - mpManager->unref(); - mpManager = NULL; -} - - -void ScCollaboration::receivedFile( const rtl::OUString &rFileURL ) -{ - fprintf( stderr, "file recieved '%s'\n", - rtl::OUStringToOString( rFileURL, RTL_TEXTENCODING_UTF8 ).getStr() ); - sigFileReceived( rFileURL ); -} - -void ScCollaboration::packetReceivedCallback( TeleConference *pConference, TelePacket &rPacket ) -{ - rtl::OString aString( rPacket.getData(), rPacket.getSize()); - /* Relay the signal out⦠*/ - sigPacketReceived( pConference, aString); -} - -bool ScCollaboration::initManager(bool bAcceptIncoming) -{ - mpManager = TeleManager::get(bAcceptIncoming); - mpManager->sigPacketReceived.connect( - boost::bind( &ScCollaboration::packetReceivedCallback, this, _1, _2 )); - mpManager->connect(); - mpManager->prepareAccountManager(); - mpManager->sigFileReceived.connect( - boost::bind( &ScCollaboration::receivedFile, this, _1 )); - return true; -} - - -bool ScCollaboration::initAccountContact() -{ - ContactList* pContactList = mpManager->getContactList(); - AccountContactPairV aVec( pContactList->getContacts()); - - fprintf( stderr, "%u contacts\n", (int) aVec.size() ); - if (aVec.empty()) - return false; - - /* TODO: select a pair, for now just take the first */ - mpAccount = aVec[0].first; - mpContact = aVec[0].second; - fprintf( stderr, "picked %s\n", tp_contact_get_identifier( mpContact ) ); - return true; -} - - -bool ScCollaboration::startCollaboration() -{ - bool bOk = mpManager->startBuddySession( mpAccount, mpContact); - return bOk; -} - - -bool ScCollaboration::sendPacket( const rtl::OString& rString ) -{ - TelePacket aPacket( "sender", rString.getStr(), rString.getLength()); - bool bOk = mpManager->sendPacket( aPacket); - return bOk; -} - - -extern "C" { - static void file_sent_cb( bool aSuccess, void* /* pUserData */ ) - { - fprintf( stderr, "File send %s\n", aSuccess ? "success" : "failed" ); - } -} - -void ScCollaboration::sendFile( rtl::OUString &rFileURL ) -{ - mpManager->sendFile( rFileURL, file_sent_cb, NULL ); -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/source/ui/collab/sendfunc.cxx b/sc/source/ui/collab/sendfunc.cxx index aa16ce9..9c04e0d 100644 --- a/sc/source/ui/collab/sendfunc.cxx +++ b/sc/source/ui/collab/sendfunc.cxx @@ -28,15 +28,16 @@ #include "sal/config.h" +#include <boost/signals2.hpp> #include <vector> #include "cell.hxx" +#include "contacts.hxx" #include "docsh.hxx" #include "docfunc.hxx" -#include "collab.hxx" -#include "contacts.hxx" #include <tubes/manager.hxx> #include <tubes/conference.hxx> +#include <tubes/contact-list.hxx> // new file send/recv fun ... #include <com/sun/star/uno/Sequence.hxx> @@ -257,7 +258,6 @@ public: class ScDocFuncRecv { boost::shared_ptr<ScDocFuncDirect> mpChain; - boost::shared_ptr<ScCollaboration> mpCollab; protected: ScDocFuncRecv() {} @@ -270,12 +270,7 @@ public: } virtual ~ScDocFuncRecv() {} - void SetCollaboration( boost::shared_ptr<ScCollaboration>& pCollab ) - { - mpCollab = pCollab; - } - - void packetReceived( TeleConference* pConference, const rtl::OString & ); + void packetReceived( TeleConference*, TelePacket &rPacket ); virtual void fileReceived( const rtl::OUString &rStr ); virtual void RecvMessage( const rtl::OString &rString ) @@ -315,9 +310,10 @@ public: } }; -void ScDocFuncRecv::packetReceived( TeleConference*, const rtl::OString &rStr) +void ScDocFuncRecv::packetReceived( TeleConference*, TelePacket &rPacket ) { - RecvMessage( rStr); + rtl::OString aString( rPacket.getData(), rPacket.getSize() ); + RecvMessage( aString ); } void ScDocFuncRecv::fileReceived( const rtl::OUString &rStr ) @@ -418,16 +414,27 @@ class ScDocFuncDemo : public ScDocFuncRecv } }; +extern "C" +{ + static void file_sent_cb( bool aSuccess, void* /* pUserData */ ) + { + fprintf( stderr, "File send %s\n", aSuccess ? "success" : "failed" ); + } +} + class ScDocFuncSend : public ScDocFunc { boost::shared_ptr<ScDocFuncRecv> mpDirect; - boost::shared_ptr<ScCollaboration> mpCollab; + TeleManager *mpManager; void SendMessage( ScChangeOpWriter &rOp ) { fprintf( stderr, "Op: '%s'\n", rOp.toString().getStr() ); - if (mpCollab) - mpCollab->sendPacket( rOp.toString()); + if (mpManager) + { + TelePacket aPacket( "sender", rOp.toString().getStr(), rOp.toString().getLength() ); + mpManager->sendPacket( aPacket ); + } else // local demo mode mpDirect->RecvMessage( rOp.toString() ); } @@ -457,8 +464,8 @@ class ScDocFuncSend : public ScDocFunc fprintf( stderr, "Temp file is '%s'\n", rtl::OUStringToOString( aFileURL, RTL_TEXTENCODING_UTF8 ).getStr() ); - if ( mpCollab ) - mpCollab->sendFile( aFileURL ); + if (mpManager) + mpManager->sendFile( aFileURL, file_sent_cb, NULL ); else mpDirect->fileReceived( aFileURL ); @@ -470,15 +477,16 @@ public: // we don't need the rDocSh hack/pointer ScDocFuncSend( ScDocShell& rDocSh, boost::shared_ptr<ScDocFuncRecv> pDirect ) : ScDocFunc( rDocSh ), - mpDirect( pDirect ) + mpDirect( pDirect ), + mpManager( NULL ) { fprintf( stderr, "Sender created !\n" ); } virtual ~ScDocFuncSend() {} - void SetCollaboration( boost::shared_ptr<ScCollaboration>& pCollab ) + void SetCollaboration( bool bIsMaster ) { - mpCollab = pCollab; + mpManager = TeleManager::get( !bIsMaster ); } virtual void EnterListAction( sal_uInt16 nNameResId ) @@ -625,27 +633,41 @@ SC_DLLPRIVATE ScDocFunc *ScDocShell::CreateDocFunc() boost::shared_ptr<ScDocFuncDirect> pDirect( new ScDocFuncDirect( *this ) ); boost::shared_ptr<ScDocFuncRecv> pReceiver( new ScDocFuncRecv( pDirect ) ); ScDocFuncSend* pSender = new ScDocFuncSend( *this, pReceiver ); - boost::shared_ptr<ScCollaboration> pCollab( new ScCollaboration ); - pCollab->sigPacketReceived.connect( - boost::bind( &ScDocFuncRecv::packetReceived, pReceiver, _1, _2 )); - pCollab->sigFileReceived.connect( - boost::bind( &ScDocFuncRecv::fileReceived, pReceiver, _1)); + TeleManager *pManager = TeleManager::get( !bIsMaster ); bool bOk = true; - bOk = bOk && pCollab->initManager(!bIsMaster); + + pManager->sigPacketReceived.connect( + boost::bind( &ScDocFuncRecv::packetReceived, pReceiver.get(), _1, _2 )); + pManager->sigFileReceived.connect( + boost::bind( &ScDocFuncRecv::fileReceived, pReceiver.get(), _1 )); + + bOk = bOk && pManager->connect(); + pManager->prepareAccountManager(); + if (bIsMaster) { - bOk = bOk && pCollab->initAccountContact(); - bOk = bOk && pCollab->startCollaboration(); + ContactList* pContactList = pManager->getContactList(); + AccountContactPairV aVec( pContactList->getContacts()); + + fprintf( stderr, "%u contacts\n", (int) aVec.size() ); + if (aVec.empty()) + bOk = false; + else + { + /* TODO: select a pair, for now just take the first */ + TpAccount* pAccount = aVec[0].first; + TpContact* pContact = aVec[0].second; + fprintf( stderr, "picked %s\n", tp_contact_get_identifier( pContact ) ); + bOk = bOk && pManager->startBuddySession( pAccount, pContact ); + } } if (bOk) { - pReceiver->SetCollaboration( pCollab); - pSender->SetCollaboration( pCollab); + pSender->SetCollaboration( bIsMaster ); } else { fprintf( stderr, "Could not start collaboration.\n"); - // pCollab shared_ptr will be destructed } return pSender; } diff --git a/sc/source/ui/inc/collab.hxx b/sc/source/ui/inc/collab.hxx deleted file mode 100644 index 65700c9..0000000 --- a/sc/source/ui/inc/collab.hxx +++ /dev/null @@ -1,76 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * Version: MPL 1.1 / GPLv3+ / LGPLv3+ - * - * The contents of this file are subject to the Mozilla Public License Version - * 1.1 (the "License"); you may not use this file except in compliance with - * the License or as specified alternatively below. You may obtain a copy of - * the License at http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License - * for the specific language governing rights and limitations under the - * License. - * - * Major Contributor(s): - * Copyright (C) 2012 Red Hat, Inc., Eike Rathke <er...@redhat.com> - * - * All Rights Reserved. - * - * For minor contributions see the git repository. - * - * Alternatively, the contents of this file may be used under the terms of - * either the GNU General Public License Version 3 or later (the "GPLv3+"), or - * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"), - * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable - * instead of those above. - */ - -#ifndef INCLUDED_SC_COLLAB_HXX -#define INCLUDED_SC_COLLAB_HXX - -#include <sal/config.h> -#include <boost/signals2.hpp> - -typedef struct _TpContact TpContact; -typedef struct _TpAccount TpAccount; -class TeleManager; -class TeleConference; -class TelePacket; -namespace rtl { class OString; class OUString; } - -class ScCollaboration -{ -public: - - ScCollaboration(); - ~ScCollaboration(); - - bool initManager(bool bAcceptIncoming); - bool initAccountContact(); - bool startCollaboration(); - - bool sendPacket( const rtl::OString& rString ); - /** Emitted when a packet is received - */ - boost::signals2::signal<void (TeleConference*, const rtl::OString& rString )> sigPacketReceived; - - void sendFile( rtl::OUString &rFileURL ); - /** Emitted when a file is received - */ - boost::signals2::signal<void ( const rtl::OUString &pFileURL )> sigFileReceived; - - /* Internal callbacks */ - void packetReceivedCallback( TeleConference *pConference, TelePacket &rPacket ); - void receivedFile( const rtl::OUString &rFileURL ); - -private: - - TpAccount* mpAccount; - TpContact* mpContact; - TeleManager* mpManager; -}; - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ commit cea7a660a04f3e6bbe41bc8f6a7000abb41df487 Author: Matúš Kukan <matus.ku...@gmail.com> Date: Fri Jun 8 16:31:22 2012 +0200 remove a few unused includes diff --git a/sc/source/ui/collab/contacts.cxx b/sc/source/ui/collab/contacts.cxx index cfd4213..c029105 100644 --- a/sc/source/ui/collab/contacts.cxx +++ b/sc/source/ui/collab/contacts.cxx @@ -29,13 +29,10 @@ #include "sal/config.h" #include <vector> -#include "collab.hxx" #include "contacts.hrc" #include "scresid.hxx" #include <svtools/filter.hxx> #include <tubes/manager.hxx> -#include <tubes/conference.hxx> -#include <tubes/contact-list.hxx> #include <vcl/fixed.hxx> #include <vcl/dialog.hxx> #include <svx/simptabl.hxx> diff --git a/sc/source/ui/collab/contacts.hxx b/sc/source/ui/collab/contacts.hxx index eba76a3..f7ff6a9 100644 --- a/sc/source/ui/collab/contacts.hxx +++ b/sc/source/ui/collab/contacts.hxx @@ -28,10 +28,6 @@ #include "sal/config.h" -#include <vector> -#include "collab.hxx" -#include <tubes/conference.hxx> - class TeleManager; namespace tubes { void createContacts( const TeleManager &rContacts ); commit 5027968069998ba151f47c205bd0929f692e5c9a Author: Matúš Kukan <matus.ku...@gmail.com> Date: Fri Jun 8 16:18:33 2012 +0200 tubes: get Avatars loaded and displayed diff --git a/sc/source/ui/collab/contacts.cxx b/sc/source/ui/collab/contacts.cxx index bb82160..cfd4213 100644 --- a/sc/source/ui/collab/contacts.cxx +++ b/sc/source/ui/collab/contacts.cxx @@ -32,6 +32,7 @@ #include "collab.hxx" #include "contacts.hrc" #include "scresid.hxx" +#include <svtools/filter.hxx> #include <tubes/manager.hxx> #include <tubes/conference.hxx> #include <tubes/contact-list.hxx> @@ -88,6 +89,20 @@ public: AccountContactPairV::iterator it; for( it = aPairs.begin(); it != aPairs.end(); it++ ) { + Image aImage; + GFile *pAvatarFile = tp_contact_get_avatar_file( it->second ); + if( pAvatarFile ) + { + const rtl::OUString sAvatarFileUrl = fromUTF8( g_file_get_path ( pAvatarFile ) ); + Graphic aGraphic; + if( GRFILTER_OK == GraphicFilter::LoadGraphic( sAvatarFileUrl, rtl::OUString(""), aGraphic ) ) + { + BitmapEx aBitmap = aGraphic.GetBitmapEx(); + double fScale = 30.0 / aBitmap.GetSizePixel().Height(); + aBitmap.Scale( fScale, fScale ); + aImage = Image( aBitmap ); + } + } fprintf( stderr, "'%s' => '%s' '%s'\n", tp_account_get_display_name( it->first ), tp_contact_get_alias( it->second ), @@ -98,7 +113,7 @@ public: aEntry.append( sal_Unicode( '\t' ) ); aEntry.append( fromUTF8 ( tp_contact_get_identifier( it->second ) ) ); aEntry.append( sal_Unicode( '\t' ) ); - SvLBoxEntry* pEntry = maList.InsertEntry( aEntry.makeStringAndClear() ); + SvLBoxEntry* pEntry = maList.InsertEntry( aEntry.makeStringAndClear(), aImage, aImage ); // FIXME: ref the TpContact ... pEntry->SetUserData( it->second ); } commit ee364060fa490d6be89beed5ec51a08ecd10099d Author: Matúš Kukan <matus.ku...@gmail.com> Date: Fri May 11 22:26:06 2012 +0200 tubes: improve contacts list sizing diff --git a/sc/source/ui/collab/contacts.cxx b/sc/source/ui/collab/contacts.cxx index 00e0392..bb82160 100644 --- a/sc/source/ui/collab/contacts.cxx +++ b/sc/source/ui/collab/contacts.cxx @@ -58,7 +58,7 @@ public: { static long aStaticTabs[]= { - 3 /* count */, 0, 20, 80, 150, 200 + 3 /* count */, 0, 20, 100, 150, 200 }; maList.SvxSimpleTable::SetTabs( aStaticTabs ); diff --git a/sc/source/ui/collab/contacts.src b/sc/source/ui/collab/contacts.src index 6a1081f..878c1ae 100644 --- a/sc/source/ui/collab/contacts.src +++ b/sc/source/ui/collab/contacts.src @@ -15,8 +15,8 @@ ModelessDialog RID_SCDLG_CONTACTS FixedLine FL_LABEL { - Pos = MAP_APPFONT ( 6 , 3 ) ; - Size = MAP_APPFONT ( 400 , 8 ) ; + Pos = MAP_APPFONT ( 8 , 2 ) ; + Size = MAP_APPFONT ( 198 , 8 ) ; Text [ en-US ] = "Select a contact to collaborate with" ; }; Control CTL_LIST
_______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits