From e8dda4e6cd9cda1720b663f8fcecb607cfe8129e Mon Sep 17 00:00:00 2001 From: Nicolas Jager <nicolas.jager@savoirfairelinux.com> Date: Mon, 21 Aug 2017 15:29:38 -0400 Subject: [PATCH] Add stubs and class diagram add stubs for : - Database class. - ConversationModel class and Conversation namespace. - NewCallModel class and NewCall namespace. - ContactModel class and Contact namespace. - Message namespace. - NewAccountModel. - CallbacksHandler, will be used to bind the callbacks from the daemon and will emit signals for lrc and client. - Lrc class, this class is the root class of all models. Instating this class will build interfaces between the daemon, client and the database. - all these class are nested in the lrc namespace. - all publicly exposed API have been put into lrc::api namespace - add diagrams in doc folder Change-Id: Ia06f874dd1baebb086edd570e52d8d61d73b905b Reviewed-by: Guillaume Roguez <guillaume.roguez@savoirfairelinux.com> Signed-off-by: Guillaume Roguez <guillaume.roguez@savoirfairelinux.com> --- CMakeLists.txt | 34 +++++- doc/Diagram1.dia | Bin 0 -> 6958 bytes doc/Diagram2.dia | Bin 0 -> 4597 bytes src/api/account.h | 56 ++++++++++ src/api/call.h | 60 ++++++++++ src/api/contact.h | 52 +++++++++ src/api/contactmodel.h | 74 +++++++++++++ src/api/conversation.h | 51 +++++++++ src/api/conversationmodel.h | 88 +++++++++++++++ src/api/lrc.h | 51 +++++++++ src/api/message.h | 60 ++++++++++ src/api/newaccountmodel.h | 59 ++++++++++ src/api/newcallmodel.h | 73 +++++++++++++ src/callbackshandler.cpp | 52 +++++++++ src/callbackshandler.h | 42 +++++++ src/contactmodel.cpp | 157 +++++++++++++++++++++++++++ src/conversationmodel.cpp | 211 ++++++++++++++++++++++++++++++++++++ src/database.cpp | 88 +++++++++++++++ src/database.h | 78 +++++++++++++ src/lrc.cpp | 63 +++++++++++ src/newaccountmodel.cpp | 80 ++++++++++++++ src/newcallmodel.cpp | 127 ++++++++++++++++++++++ 22 files changed, 1554 insertions(+), 2 deletions(-) create mode 100644 doc/Diagram1.dia create mode 100644 doc/Diagram2.dia create mode 100644 src/api/account.h create mode 100644 src/api/call.h create mode 100644 src/api/contact.h create mode 100644 src/api/contactmodel.h create mode 100644 src/api/conversation.h create mode 100644 src/api/conversationmodel.h create mode 100644 src/api/lrc.h create mode 100644 src/api/message.h create mode 100644 src/api/newaccountmodel.h create mode 100644 src/api/newcallmodel.h create mode 100644 src/callbackshandler.cpp create mode 100644 src/callbackshandler.h create mode 100644 src/contactmodel.cpp create mode 100644 src/conversationmodel.cpp create mode 100644 src/database.cpp create mode 100644 src/database.h create mode 100644 src/lrc.cpp create mode 100644 src/newaccountmodel.cpp create mode 100644 src/newcallmodel.cpp diff --git a/CMakeLists.txt b/CMakeLists.txt index 7c6efcf6..81d89a18 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -52,6 +52,7 @@ SET(QT5_MODULE_PATH ${QT5_PATH}/lib/cmake) FIND_PACKAGE(Ring REQUIRED) FIND_PACKAGE(Qt5Core REQUIRED) FIND_PACKAGE(Qt5LinguistTools) # translations +FIND_PACKAGE(Qt5Sql REQUIRED) IF(${CMAKE_SYSTEM_NAME} MATCHES "Linux" AND NOT ENABLE_LIBWRAP) FIND_PACKAGE(Qt5DBus) @@ -205,13 +206,13 @@ INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}) INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/src) INCLUDE_DIRECTORIES ( ${CMAKE_CURRENT_BINARY_DIR}) -# Build dbus interfaces +# Build dbus api IF(DEFINED RING_XML_INTERFACES_DIR) SET (dbus_xml_introspecs_path ${RING_XML_INTERFACES_DIR}) ELSEIF(EXISTS "${RING_BUILD_DIR}/../bin/dbus") SET (dbus_xml_introspecs_path ${RING_BUILD_DIR}/../bin/dbus) ELSE() - SET (dbus_xml_introspecs_path ${CMAKE_INSTALL_PREFIX}/share/dbus-1/interfaces) + SET (dbus_xml_introspecs_path ${CMAKE_INSTALL_PREFIX}/share/dbus-1/api) ENDIF() #File to compile @@ -293,6 +294,13 @@ SET( libringclient_LIB_SRCS src/audio/settings.cpp src/media/recordingmodel.cpp src/bannedcontactmodel.cpp + src/contactmodel.cpp + src/newcallmodel.cpp + src/conversationmodel.cpp + src/database.cpp + src/lrc.cpp + src/newaccountmodel.cpp + src/callbackshandler.cpp #Data collections src/transitionalpersonbackend.cpp @@ -446,6 +454,20 @@ SET( libringclient_LIB_HDRS src/bannedcontactmodel.h ) +SET(libringclient_api_LIB_HDRS + src/api/message.h + src/api/conversation.h + src/api/contact.h + src/api/call.h + src/api/account.h + src/api/lrc.h + src/api/newaccountmodel.h + src/api/newcallmodel.h + src/api/contactmodel.h + src/api/conversationmodel.h +) + + SET(libringclient_video_LIB_HDRS src/video/device.h src/video/devicemodel.h @@ -637,6 +659,7 @@ IF(NOT ${ENABLE_STATIC} MATCHES false) -lpthread ${QT_QTDBUS_LIBRARY} ${QT_QTCORE_LIBRARY} + Qt5::Sql ) SET_TARGET_PROPERTIES( ringclient_static PROPERTIES VERSION ${GENERIC_LIB_VERSION} @@ -661,6 +684,7 @@ ENDIF() TARGET_LINK_LIBRARIES( ringclient -lpthread ${QT_QTCORE_LIBRARY} + Qt5::Sql ) IF(${ENABLE_LIBWRAP} MATCHES true) @@ -736,6 +760,12 @@ INSTALL( FILES ${libringclient_interface_LIB_HDRS} COMPONENT Devel ) +INSTALL( FILES ${libringclient_api_LIB_HDRS} + DESTINATION ${INCLUDE_INSTALL_DIR}/libringclient/api + COMPONENT Devel +) + + #This hack force Debian based system to return a non multi-arch path #this is required to prevent the .deb libringclient.so from having an #higher priority than the prefixed one. diff --git a/doc/Diagram1.dia b/doc/Diagram1.dia new file mode 100644 index 0000000000000000000000000000000000000000..7cf3e1844f468be4caaa64d3b2309b2b7b5b87d1 GIT binary patch literal 6958 zcmb2|=3oE;Cg!)X+4+x;P5L`8UeV&fomhvw&wn?(OL<r^r?YXR?Z+E8V`E}CayROJ z=5y6jNj<*%#-DGwUYpiz|M6m3%1@4&6-yRIz6qOabv5>CX#M|w`)bF>6OVSvx61Q} zERr#axY222|EA7n$KI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2cM@w;>&#IS&`-7+5uGd zH*tK|(D{0tt!(njb#W#;xFxO#*F~k;>-O%t+t6ui%<0bCCnaNQkyUWzK+Em&D^=M$ zefMpO^O(rbTf2VWt#B(3i5k-%Ss$)GSbZ>@S$JQx+Mcwz8rART^4QojsWu5Yb}n!U zP}2Bl8<ga8_(@#COtT9L83HC8QY^epY}@yD&v&~JlA-l0bnhX*y!~2Ri}q`E@0hmM zoOjXdZR<|I2|ud3(%Ey?Vb!fVQ(u_XzZbZxscV_OUrVt0%;oi7Ple9RT=hoicc|o} z+rhP+)-SxaR>!V9wO#4f-DM$6DhstmcLjL{8k8)}S^#2#`CuY<yY|(Ker7)+wgx$I zuq(>66qFgYY*xOy;D6K01~Amfv)ZLI_ua|O>%*1=yjF}5i<q`|n~t^YQxSnfS5~zd z<TmeUOEoEN-7ziMn<ufzv(I|k600)rP?JY5vVzS!7fqWwN54fgWkRLXj9F*fQ^M|F zyBEe$+-D<j&c#Cbp-+pkAQpzso-C&trrjMkT#vlmGE-=|$<lI@#AutZpELh(SbS<W zzV)bTUo-E)wghLF*R3wE&maE1cWt$aQlgdAi;sn7AuMkaV;*F6mu)>RaC>Ex0Pm06 n7D@Y!PpU8e&RCoF(cix3-Us{Gz9aMNe$-!ErfVI!f|&sTxEN#m literal 0 HcmV?d00001 diff --git a/doc/Diagram2.dia b/doc/Diagram2.dia new file mode 100644 index 0000000000000000000000000000000000000000..dba8decb55f0c3d4da6b2129dcf1588921389394 GIT binary patch literal 4597 zcmb2|=3oE;Cg!)X(Z#n<Os)IAJ|S~ekf-SKtKYjNte+NY?OylEV&z=VxJUucz#EK= zdJIuva-VL0H}UY?<H*8jqLMXB?=&0hxAwemJHJ@ofBElo{J!{kR&z1XC(-cewm zM9WE)xo#)l{5@)4|MzzPuSfdw_x@H&v4(#rpT_!`u}10S+pE93Z!e07iH*B=_wK?U zcKlr?&V^fCDl2}@SLkc@-tqF&qr<xoCTwoZ3}E@T_v>!Qz?6$$H*v6g8t~tbk71vD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Uq#ou1B<w*yt|{f4zO4_@`z4Oz}59 zz1UpRR~7N??&E)As+YAccpWVhSz~m$tm<UCedk{*Mz{G-zKdOqcA4K*eKO?E#!Wf* z_MMn;yZH5~R~GFzEt+Q7e(yIp;#OuKy}MRuqSyR<!?NFvt3$VHOkC#kHF&EBN6?44 z0?tz|xfLy}Rote3<lP>D-zUGn+A6pEYowRR!=OjJlWr9(KXqw^seo}!%61;p7QU4m z+I0%1d#&x(yB3tq#Chqu=CX#Xo?qVYy!qFAqHdy6nA=^O$b*wbcd2P_SuXJ9x~hNJ zhZI%};>F}O1vcA1RTTfe<7M)8CdY<}if{Dp7b<AJP~*LreroY@9l!ZAMZ+ySCU2fB z>op;Fv$^E2t==0JCnaChNj^UBrr}qkC#ff<^7uAcyffQc?=xXq_xgu-m!C`AtNJPE zOHmMuoHkGV{iZJ`S=WfG=zHjEdYCCkx-E})m?e`~J@J#$)oC?bCvMqUQ!K4^g3p4z zWu>BEhtc&p%sZKsZhe^8=p7`)xT4I@GUM*yD)xxX#b)JR3eUIxuU=X1Whob;chmOt zfz3QNxQKfSryqR2USIp?)6ezk5uQJH_sukvH?BTu@a2EazhCijDSJ*-OkAmJw7=$G q`*aC?Lp#IIRl>%rUt8?p-^~9$OdLGU!vFrC{OA6?e<s;5G5`RW57Slv literal 0 HcmV?d00001 diff --git a/src/api/account.h b/src/api/account.h new file mode 100644 index 00000000..6742433f --- /dev/null +++ b/src/api/account.h @@ -0,0 +1,56 @@ +/**************************************************************************** + * Copyright (C) 2017 Savoir-faire Linux * + * Author : Nicolas Jäger <nicolas.jager@savoirfairelinux.com> * + * Author : Sébastien Blin <sebastien.blin@savoirfairelinux.com> * + * * + * This library is free software; you can redistribute it and/or * + * modify it under the terms of the GNU Lesser General Public * + * License as published by the Free Software Foundation; either * + * version 2.1 of the License, or (at your option) any later version. * + * * + * This library is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * + * Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program. If not, see <http://www.gnu.org/licenses/>. * + ***************************************************************************/ +#pragma once + +#include <string> +#include <memory> + +namespace lrc +{ + +namespace api +{ + +class NewCallModel; +class ContactModel; +class ConversationModel; +class NewAccountModel; + +namespace account +{ + +enum class Type { + INVALID, + RING, + SIP +}; + +struct Info +{ + std::string id; + Type type = account::Type::INVALID; + std::unique_ptr<lrc::api::NewCallModel> callModel; + std::unique_ptr<lrc::api::ContactModel> contactModel; + std::unique_ptr<lrc::api::ConversationModel> conversationModel; + std::unique_ptr<lrc::api::NewAccountModel> accountModel; +}; + +} // namespace account +} // namespace api +} // namespace lrc diff --git a/src/api/call.h b/src/api/call.h new file mode 100644 index 00000000..35dd998d --- /dev/null +++ b/src/api/call.h @@ -0,0 +1,60 @@ +/**************************************************************************** + * Copyright (C) 2017 Savoir-faire Linux * + * Author : Nicolas Jäger <nicolas.jager@savoirfairelinux.com> * + * Author : Sébastien Blin <sebastien.blin@savoirfairelinux.com> * + * * + * This library is free software; you can redistribute it and/or * + * modify it under the terms of the GNU Lesser General Public * + * License as published by the Free Software Foundation; either * + * version 2.1 of the License, or (at your option) any later version. * + * * + * This library is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * + * Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program. If not, see <http://www.gnu.org/licenses/>. * + ***************************************************************************/ +#pragma once + +// std +#include <string> +#include <ctime> + +namespace lrc +{ + +namespace api +{ + +namespace call +{ + +enum class Status { + INVALID, + OUTGOING_REQUESTED, + INCOMING_RINGING, + OUTGOING_RINGING, + CONNECTING, + SEARCHING, + IN_PROGRESS, + PAUSED, + PEER_PAUSED, + INACTIVE, + ENDED, + TERMINATING, + CONNECTED, + AUTO_ANSWERING +}; + +struct Info +{ + std::string id; + std::time_t startTime = 0; + Status status = Status::INVALID; +}; + +} // namespace call +} // namespace api +} // namespace lrc diff --git a/src/api/contact.h b/src/api/contact.h new file mode 100644 index 00000000..7cb65363 --- /dev/null +++ b/src/api/contact.h @@ -0,0 +1,52 @@ +/**************************************************************************** + * Copyright (C) 2017 Savoir-faire Linux * + * Author : Nicolas Jäger <nicolas.jager@savoirfairelinux.com> * + * Author : Sébastien Blin <sebastien.blin@savoirfairelinux.com> * + * * + * This library is free software; you can redistribute it and/or * + * modify it under the terms of the GNU Lesser General Public * + * License as published by the Free Software Foundation; either * + * version 2.1 of the License, or (at your option) any later version. * + * * + * This library is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * + * Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program. If not, see <http://www.gnu.org/licenses/>. * + ***************************************************************************/ +#pragma once + +// Std +#include <string> + +namespace lrc +{ + +namespace api +{ + +namespace contact +{ + +enum class Type { + INVALID, + RING, + SIP +}; + +struct Info +{ + std::string uri; + std::string avatar; + std::string registeredName; + std::string alias; + bool isTrusted = false; + bool isPresent = false; + Type type = Type::INVALID; +}; + +} // namespace contact +} // namespace api +} // namespace lrc diff --git a/src/api/contactmodel.h b/src/api/contactmodel.h new file mode 100644 index 00000000..d11d46df --- /dev/null +++ b/src/api/contactmodel.h @@ -0,0 +1,74 @@ +/**************************************************************************** + * Copyright (C) 2017 Savoir-faire Linux * + * Author : Nicolas Jäger <nicolas.jager@savoirfairelinux.com> * + * Author : Sébastien Blin <sebastien.blin@savoirfairelinux.com> * + * * + * This library is free software; you can redistribute it and/or * + * modify it under the terms of the GNU Lesser General Public * + * License as published by the Free Software Foundation; either * + * version 2.1 of the License, or (at your option) any later version. * + * * + * This library is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * + * Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program. If not, see <http://www.gnu.org/licenses/>. * + ***************************************************************************/ +#pragma once + +// Std +#include <string> +#include <memory> +#include <map> + +// Qt +#include <qobject.h> + +// LRC +#include "typedefs.h" + +namespace lrc +{ + +class Database; +class ContactModelPimpl; + +namespace api +{ + +namespace contact { struct Info; } +namespace account { struct Info; } +class NewAccountModel; +class ConversationModel; + +class LIB_EXPORT ContactModel : public QObject { + Q_OBJECT +public: + using ContactInfoMap = std::map<std::string, std::shared_ptr<contact::Info>>; + + const account::Info& owner; + + ContactModel(NewAccountModel& parent, + const Database& database, + const account::Info& info); + ~ContactModel(); + + const contact::Info& getContact(const std::string& uri) const; + const ContactInfoMap& getAllContacts() const; + void addContact(const std::string& uri); + void removeContact(const std::string& uri); + void nameLookup(const std::string& uri) const; + void addressLookup(const std::string& name) const; + +Q_SIGNALS: + void contactsChanged(); + +private: + std::unique_ptr<ContactModelPimpl> pimpl_; + +}; + +} // namespace api +} // namespace lrc diff --git a/src/api/conversation.h b/src/api/conversation.h new file mode 100644 index 00000000..90b195ee --- /dev/null +++ b/src/api/conversation.h @@ -0,0 +1,51 @@ +/**************************************************************************** + * Copyright (C) 2017 Savoir-faire Linux * + * Author : Nicolas Jäger <nicolas.jager@savoirfairelinux.com> * + * Author : Sébastien Blin <sebastien.blin@savoirfairelinux.com> * + * * + * This library is free software; you can redistribute it and/or * + * modify it under the terms of the GNU Lesser General Public * + * License as published by the Free Software Foundation; either * + * version 2.1 of the License, or (at your option) any later version. * + * * + * This library is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * + * Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program. If not, see <http://www.gnu.org/licenses/>. * + ***************************************************************************/ +#pragma once + +// Std +#include <vector> +#include <map> + +// Data +#include "message.h" + +namespace lrc +{ + +namespace api +{ + +namespace conversation +{ + +struct Info +{ + std::string uid; + std::string accountId; + std::vector<std::string> participants; + std::string callId; + std::map<int, message::Info> messages; + unsigned int lastMessageUid = 0; + bool isUsed = false; + unsigned int unreadMessages = 0; +}; + +} // namespace conversation +} // namespace api +} // namespace lrc diff --git a/src/api/conversationmodel.h b/src/api/conversationmodel.h new file mode 100644 index 00000000..8f58d347 --- /dev/null +++ b/src/api/conversationmodel.h @@ -0,0 +1,88 @@ +/**************************************************************************** + * Copyright (C) 2017 Savoir-faire Linux * + * Author : Nicolas Jäger <nicolas.jager@savoirfairelinux.com> * + * Author : Sébastien Blin <sebastien.blin@savoirfairelinux.com> * + * * + * This library is free software; you can redistribute it and/or * + * modify it under the terms of the GNU Lesser General Public * + * License as published by the Free Software Foundation; either * + * version 2.1 of the License, or (at your option) any later version. * + * * + * This library is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * + * Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program. If not, see <http://www.gnu.org/licenses/>. * + ***************************************************************************/ +#pragma once + +// Std +#include <memory> +#include <map> +#include <string> +#include <deque> + +// Qt +#include <qobject.h> + +// Lrc +#include "typedefs.h" + +// Data +#include "api/conversation.h" + +namespace lrc +{ + +class Database; +class ConversationModelPimpl; + +namespace api +{ + +namespace account { struct Info; } +namespace message { struct Info; } +class NewAccountModel; + +class LIB_EXPORT ConversationModel : public QObject { + Q_OBJECT +public: + using ConversationQueue = std::deque<conversation::Info>; + + const account::Info& owner; + + ConversationModel(const NewAccountModel& parent, + const Database& database, + const account::Info& info); + ~ConversationModel(); + + const ConversationQueue& getFilteredConversations() const; + conversation::Info getConversation(unsigned int row) const; + void addConversation(const std::string& uri) const; + void removeConversation(const std::string& uid); + void selectConversation(const std::string& uid); + void placeCall(const std::string& uid) const; + void sendMessage(const std::string& uid, const std::string& body) const; + void setFilter(const std::string& filter); + void addParticipant(const std::string& uid, const::std::string& uri); + void clearHistory(const std::string& uid); + +Q_SIGNALS: + void newMessageAdded(const std::string& uid, const message::Info& msg); + void conversationUpdated(unsigned int row); + void modelUpdated() const; + void newContactAdded(const std::string& uri); + void incomingCallFromItem(const unsigned int row); + + void showChatView(const conversation::Info& conversationInfo); + void showCallView(const conversation::Info& conversationInfo); + void showIncomingCallView(const conversation::Info& conversationInfo); + +private: + std::unique_ptr<ConversationModelPimpl> pimpl_; +}; + +} // namespace api +} // namespace lrc diff --git a/src/api/lrc.h b/src/api/lrc.h new file mode 100644 index 00000000..67b7a50b --- /dev/null +++ b/src/api/lrc.h @@ -0,0 +1,51 @@ +/**************************************************************************** + * Copyright (C) 2017 Savoir-faire Linux * + * Author : Nicolas Jäger <nicolas.jager@savoirfairelinux.com> * + * Author : Sébastien Blin <sebastien.blin@savoirfairelinux.com> * + * * + * This library is free software; you can redistribute it and/or * + * modify it under the terms of the GNU Lesser General Public * + * License as published by the Free Software Foundation; either * + * version 2.1 of the License, or (at your option) any later version. * + * * + * This library is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * + * Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program. If not, see <http://www.gnu.org/licenses/>. * + ***************************************************************************/ +#pragma once + +// Std +#include <memory> + +// Lrc +#include "typedefs.h" + +namespace lrc +{ + +class Database; +class CallbacksHandler; +class LrcPimpl; + +namespace api +{ + +class NewAccountModel; + +class LIB_EXPORT Lrc { +public: + Lrc(); + ~Lrc(); + + NewAccountModel& getAccountModel(); + +private: + std::unique_ptr<LrcPimpl> lrcPipmpl_; +}; + +} // namespace api +} // namespace lrc diff --git a/src/api/message.h b/src/api/message.h new file mode 100644 index 00000000..be99b91d --- /dev/null +++ b/src/api/message.h @@ -0,0 +1,60 @@ +/**************************************************************************** + * Copyright (C) 2017 Savoir-faire Linux * + * Author : Nicolas Jäger <nicolas.jager@savoirfairelinux.com> * + * Author : Sébastien Blin <sebastien.blin@savoirfairelinux.com> * + * * + * This library is free software; you can redistribute it and/or * + * modify it under the terms of the GNU Lesser General Public * + * License as published by the Free Software Foundation; either * + * version 2.1 of the License, or (at your option) any later version. * + * * + * This library is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * + * Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program. If not, see <http://www.gnu.org/licenses/>. * + ***************************************************************************/ +#pragma once + +// std +#include <ctime> +#include <string> + +namespace lrc +{ + +namespace api +{ + +namespace message +{ + +enum class Type { + INVALID, + TEXT, + CALL, + CONTACT +}; + +enum class Status { + INVALID, + SENDING, + FAILED, + SUCCEED, + READ +}; + +struct Info +{ + std::string contact; + std::string body; + std::time_t timestamp = 0; + Type type = Type::INVALID; + Status status = Status::INVALID; +}; + +} // namespace message +} // namespace api +} // namespace lrc diff --git a/src/api/newaccountmodel.h b/src/api/newaccountmodel.h new file mode 100644 index 00000000..6b67d5e1 --- /dev/null +++ b/src/api/newaccountmodel.h @@ -0,0 +1,59 @@ +/**************************************************************************** + * Copyright (C) 2017 Savoir-faire Linux * + * Author : Nicolas Jäger <nicolas.jager@savoirfairelinux.com> * + * Author : Sébastien Blin <sebastien.blin@savoirfairelinux.com> * + * * + * This library is free software; you can redistribute it and/or * + * modify it under the terms of the GNU Lesser General Public * + * License as published by the Free Software Foundation; either * + * version 2.1 of the License, or (at your option) any later version. * + * * + * This library is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * + * Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program. If not, see <http://www.gnu.org/licenses/>. * + ***************************************************************************/ +#pragma once + +// std +#include <vector> +#include <map> +#include <memory> +#include <string> + +// Qt +#include <qobject.h> + +// Lrc +#include "typedefs.h" + +namespace lrc +{ + +class Database; +class NewAccountModelPimpl; + +namespace api +{ + +namespace account { struct Info; } + +class LIB_EXPORT NewAccountModel : public QObject { +public: + using AccountInfoMap = std::map<std::string, account::Info>; + + NewAccountModel(const Database& database); + ~NewAccountModel(); + + const std::vector<std::string> getAccountList() const; + const account::Info& getAccountInfo(const std::string& accountId); + +private: + std::unique_ptr<NewAccountModelPimpl> pimpl_; +}; + +} // namespace api +} // namespace lrc diff --git a/src/api/newcallmodel.h b/src/api/newcallmodel.h new file mode 100644 index 00000000..a2223c6f --- /dev/null +++ b/src/api/newcallmodel.h @@ -0,0 +1,73 @@ +/**************************************************************************** + * Copyright (C) 2017 Savoir-faire Linux * + * Author : Nicolas Jäger <nicolas.jager@savoirfairelinux.com> * + * Author : Sébastien Blin <sebastien.blin@savoirfairelinux.com> * + * * + * This library is free software; you can redistribute it and/or * + * modify it under the terms of the GNU Lesser General Public * + * License as published by the Free Software Foundation; either * + * version 2.1 of the License, or (at your option) any later version. * + * * + * This library is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * + * Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program. If not, see <http://www.gnu.org/licenses/>. * + ***************************************************************************/ +#pragma once + +// Std +#include <memory> +#include <string> +#include <map> + +// Qt +#include <qobject.h> + +namespace lrc +{ + +class NewCallModelPimpl; + +namespace api +{ + +namespace account { struct Info; } +namespace call { struct Info; } +class NewAccountModel; + +class NewCallModel : public QObject { + Q_OBJECT +public: + using CallInfoMap = std::map<std::string, std::shared_ptr<call::Info>>; + + const account::Info& owner; + + enum class Media { + NONE, + AUDIO, + VIDEO + }; + + NewCallModel(NewAccountModel& parent, const account::Info& info); + ~NewCallModel(); + + const call::Info& createCall(const std::string& contactUri); + + void hangUp(const std::string& callId) const; + void togglePause(const std::string& callId) const; + void toggleMedia(const std::string& callId, const Media media) const; + void toggleRecoringdAudio(const std::string& callId) const; + void setQuality(const std::string& callId, const double quality) const; + void transfer(const std::string& callId, const std::string& to) const; + void addParticipant(const std::string& callId, const std::string& participant); + void removeParticipant(const std::string& callId, const std::string& participant); + +private: + std::unique_ptr<NewCallModelPimpl> pimpl_; +}; + +} // namespace api +} // namespace lrc diff --git a/src/callbackshandler.cpp b/src/callbackshandler.cpp new file mode 100644 index 00000000..7f3dbba5 --- /dev/null +++ b/src/callbackshandler.cpp @@ -0,0 +1,52 @@ +/**************************************************************************** + * Copyright (C) 2017 Savoir-faire Linux * + * Author : Nicolas Jäger <nicolas.jager@savoirfairelinux.com> * + * Author : Sébastien Blin <sebastien.blin@savoirfairelinux.com> * + * * + * This library is free software; you can redistribute it and/or * + * modify it under the terms of the GNU Lesser General Public * + * License as published by the Free Software Foundation; either * + * version 2.1 of the License, or (at your option) any later version. * + * * + * This library is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * + * Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program. If not, see <http://www.gnu.org/licenses/>. * + ***************************************************************************/ +#include "callbackshandler.h" + +namespace lrc +{ + +CallbacksHandler::CallbacksHandler() +: QObject() +{ + +} + +CallbacksHandler::~CallbacksHandler() +{ + +} + +void +CallbacksHandler::slotNewAccountMessage(const QString& accountId, + const QString& from, + const MapStringString& payloads) +{ + +} + +void +CallbacksHandler::slotNewBuddySubscription(const QString& accountId, + const QString& uri, + bool status, + const QString& message) +{ + +} + +} // namespace lrc diff --git a/src/callbackshandler.h b/src/callbackshandler.h new file mode 100644 index 00000000..36315038 --- /dev/null +++ b/src/callbackshandler.h @@ -0,0 +1,42 @@ +/**************************************************************************** + * Copyright (C) 2017 Savoir-faire Linux * + * Author : Nicolas Jäger <nicolas.jager@savoirfairelinux.com> * + * Author : Sébastien Blin <sebastien.blin@savoirfairelinux.com> * + * * + * This library is free software; you can redistribute it and/or * + * modify it under the terms of the GNU Lesser General Public * + * License as published by the Free Software Foundation; either * + * version 2.1 of the License, or (at your option) any later version. * + * * + * This library is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * + * Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program. If not, see <http://www.gnu.org/licenses/>. * + ***************************************************************************/ +#pragma once + +// Qt +#include <qobject.h> + +// Lrc +#include "typedefs.h" + +namespace lrc +{ + +class CallbacksHandler : public QObject { + Q_OBJECT + +public: + CallbacksHandler(); + ~CallbacksHandler(); + +public Q_SLOTS: + void slotNewAccountMessage(const QString& accountId, const QString& from, const MapStringString& payloads); + void slotNewBuddySubscription(const QString& accountId, const QString& uri, bool status, const QString& message); +}; + +} // namespace lrc diff --git a/src/contactmodel.cpp b/src/contactmodel.cpp new file mode 100644 index 00000000..b6c90115 --- /dev/null +++ b/src/contactmodel.cpp @@ -0,0 +1,157 @@ +/**************************************************************************** + * Copyright (C) 2017 Savoir-faire Linux * + * Author : Nicolas Jäger <nicolas.jager@savoirfairelinux.com> * + * Author : Sébastien Blin <sebastien.blin@savoirfairelinux.com> * + * * + * This library is free software; you can redistribute it and/or * + * modify it under the terms of the GNU Lesser General Public * + * License as published by the Free Software Foundation; either * + * version 2.1 of the License, or (at your option) any later version. * + * * + * This library is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * + * Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program. If not, see <http://www.gnu.org/licenses/>. * + ***************************************************************************/ +#include "api/contactmodel.h" + +// LRC +#include "api/newaccountmodel.h" +#include "api/contact.h" + +#include "database.h" + +namespace lrc +{ + +using namespace api; + +class ContactModelPimpl : public QObject +{ + Q_OBJECT +public: + ContactModelPimpl(NewAccountModel& p, const Database& d); + ~ContactModelPimpl(); + ContactModelPimpl(const ContactModelPimpl& contactModelPimpl); + + bool fillsWithContacts(); + void sendMessage(const std::string& uri, const std::string& body) const; + void setContactPresent(const std::string& uri, bool status); + + const Database& db; + ContactModel::ContactInfoMap contacts; + NewAccountModel& parent; + +public Q_SLOTS: + // TODO remove this from here when LRC signals are added + void slotContactsAdded(const QString &accountID, const QString &uri, bool confirmed); + void slotContactsRemoved(const QString &accountID, const QString &uri, bool status); +}; + + +ContactModel::ContactModel(NewAccountModel& parent, const Database& database, const account::Info& info) +: QObject() +, pimpl_(std::make_unique<ContactModelPimpl>(parent, database)) +, owner(info) +{ + +} + +ContactModel::~ContactModel() +{ + +} + +const contact::Info& +ContactModel::getContact(const std::string& uri) const +{ + throw std::invalid_argument("no contact found for given uri"); +} + +const ContactModel::ContactInfoMap& +ContactModel::getAllContacts() const +{ + return pimpl_->contacts; +} + +void +ContactModel::addContact(const std::string& uri) +{ + +} + +void +ContactModel::removeContact(const std::string& uri) +{ + +} + +void +ContactModel::nameLookup(const std::string& uri) const +{ + +} + +void +ContactModel::addressLookup(const std::string& name) const +{ + +} + +ContactModelPimpl::ContactModelPimpl(NewAccountModel& p, const Database& d) +: db(d) +, parent(p) +{ + +} + +ContactModelPimpl::~ContactModelPimpl() +{ + +} + +ContactModelPimpl::ContactModelPimpl(const ContactModelPimpl& contactModelPimpl) +: db(contactModelPimpl.db) +, contacts(contactModelPimpl.contacts) +, parent(contactModelPimpl.parent) +{ + +} + +void +ContactModelPimpl::sendMessage(const std::string& uri, const std::string& body) const +{ + +} + +bool +ContactModelPimpl::fillsWithContacts() +{ + return false; +} + +void +ContactModelPimpl::setContactPresent(const std::string& uri, bool status) +{ + +} + +void +ContactModelPimpl::slotContactsAdded(const QString &accountID, const QString &uri, bool confirmed) +{ + +} + +void +ContactModelPimpl::slotContactsRemoved(const QString &accountID, const QString &uri, bool status) +{ + +} + +} // namespace lrc + +#include "api/moc_contactmodel.cpp" +#include "contactmodel.moc" diff --git a/src/conversationmodel.cpp b/src/conversationmodel.cpp new file mode 100644 index 00000000..462655d2 --- /dev/null +++ b/src/conversationmodel.cpp @@ -0,0 +1,211 @@ +/**************************************************************************** + * Copyright (C) 2017 Savoir-faire Linux * + * Author : Nicolas Jäger <nicolas.jager@savoirfairelinux.com> * + * Author : Sébastien Blin <sebastien.blin@savoirfairelinux.com> * + * * + * This library is free software; you can redistribute it and/or * + * modify it under the terms of the GNU Lesser General Public * + * License as published by the Free Software Foundation; either * + * version 2.1 of the License, or (at your option) any later version. * + * * + * This library is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * + * Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program. If not, see <http://www.gnu.org/licenses/>. * + ***************************************************************************/ +#include "api/conversationmodel.h" + +// std +#include <regex> + +// LRC +#include "api/newcallmodel.h" +#include "api/newaccountmodel.h" +#include "api/account.h" + +#include "database.h" +#include "namedirectory.h" + +namespace lrc +{ + +using namespace api; + +class ConversationModelPimpl : public QObject +{ + Q_OBJECT +public: + ConversationModelPimpl(const NewAccountModel& p, const Database& d, const account::Info& o); + ~ConversationModelPimpl(); + + // shortcuts in owner + NewCallModel& callModel; + + /** + * Search a conversation in conversations_ + * @param uid the contact to search + * @return the index in conversations_ + */ + int find(const std::string& uid) const; + /** + * Initialize conversations_ and filteredConversations_ + */ + void initConversations(); + /** + * Sort conversation by last action + */ + void sortConversations(); + void search(); + + const NewAccountModel& parent; + const Database& database; + + ConversationModel::ConversationQueue conversations; + mutable ConversationModel::ConversationQueue filteredConversations; + std::string filter; + +public Q_SLOTS: + void slotContactsChanged(); + void slotMessageAdded(int uid, const std::string& accountId, const message::Info& msg); + void slotRegisteredNameFound(const Account* account, NameDirectory::LookupStatus status, + const QString& address, const QString& name); + +}; + +ConversationModel::ConversationModel(const NewAccountModel& parent, + const Database& database, + const account::Info& info) +: QObject() +,pimpl_(std::make_unique<ConversationModelPimpl>(parent, database, owner)) +, owner(info) +{ + +} + +ConversationModel::~ConversationModel() +{ + +} + +const ConversationModel::ConversationQueue& +ConversationModel::getFilteredConversations() const +{ + return pimpl_->conversations; +} + +conversation::Info +ConversationModel::getConversation(const unsigned int row) const +{ + return {}; +} + +void +ConversationModel::addConversation(const std::string& uri) const +{ + +} + +void +ConversationModel::selectConversation(const std::string& uid) +{ + +} + +void +ConversationModel::removeConversation(const std::string& uid) +{ + +} + +void +ConversationModel::placeCall(const std::string& uid) const +{ +} + +void +ConversationModel::sendMessage(const std::string& uid, const std::string& body) const +{ + +} + +void +ConversationModel::setFilter(const std::string& filter) +{ + +} + +void +ConversationModel::addParticipant(const std::string& uid, const::std::string& uri) +{ + +} + +void +ConversationModel::clearHistory(const std::string& uid) +{ + +} + +ConversationModelPimpl::ConversationModelPimpl(const NewAccountModel& p, const Database& d, const account::Info& o) +: parent(p) +, database(d) +, callModel(*o.callModel) +{ + +} + +ConversationModelPimpl::~ConversationModelPimpl() +{ + +} + +int +ConversationModelPimpl::find(const std::string& uid) const +{ + return -1; +} + +void +ConversationModelPimpl::search() +{ + +} + +void +ConversationModelPimpl::initConversations() +{ + +} + +void +ConversationModelPimpl::sortConversations() +{ + +} + +void +ConversationModelPimpl::slotContactsChanged() +{ + +} + +void +ConversationModelPimpl::slotMessageAdded(int uid, const std::string& account, const message::Info& msg) +{ + +} + +void +ConversationModelPimpl::slotRegisteredNameFound(const Account* account, NameDirectory::LookupStatus status, + const QString& address, const QString& name) +{ + +} + +} // namespace lrc + +#include "api/moc_conversationmodel.cpp" +#include "conversationmodel.moc" diff --git a/src/database.cpp b/src/database.cpp new file mode 100644 index 00000000..1613ef77 --- /dev/null +++ b/src/database.cpp @@ -0,0 +1,88 @@ +/**************************************************************************** + * Copyright (C) 2017 Savoir-faire Linux * + * Author : Nicolas Jäger <nicolas.jager@savoirfairelinux.com> * + * Author : Sébastien Blin <sebastien.blin@savoirfairelinux.com> * + * * + * This library is free software; you can redistribute it and/or * + * modify it under the terms of the GNU Lesser General Public * + * License as published by the Free Software Foundation; either * + * version 2.1 of the License, or (at your option) any later version. * + * * + * This library is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * + * Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program. If not, see <http://www.gnu.org/licenses/>. * + ***************************************************************************/ +#include "database.h" + +// Data +#include "api/message.h" + +namespace lrc +{ + +using namespace api; + +Database::Database() +: QObject() +{ + +} + +Database::~Database() +{ + +} + +void +Database::addMessage(const std::string& accountId, const message::Info& message) const +{ + +} + +void +Database::clearHistory(const std::string& accountId, const std::string& uid, bool removeContact) const +{ + +} + +Database::MessagesMap +Database::getHistory(const std::string& accountId, const std::string& uid) const +{ + return {}; +} + +std::size_t +Database::numberOfUnreads(const std::string& accountId, const std::string& uid) const +{ + return 0; +} + +void +Database::setMessageRead(int uid) const +{ + +} + +void +Database::addContact(const std::string& contact, const QByteArray& payload) const +{ + +} + +std::string +Database::getContactAttribute(const std::string& uid, const std::string& attribute) const +{ + return {}; +} + +void +Database::slotRegisteredNameFound(Account const*, NameDirectory::LookupStatus, QString const&, QString const&) const +{ + +} + +} // namespace lrc diff --git a/src/database.h b/src/database.h new file mode 100644 index 00000000..b61bbd1f --- /dev/null +++ b/src/database.h @@ -0,0 +1,78 @@ +/**************************************************************************** + * Copyright (C) 2017 Savoir-faire Linux * + * Author : Nicolas Jäger <nicolas.jager@savoirfairelinux.com> * + * Author : Sébastien Blin <sebastien.blin@savoirfairelinux.com> * + * * + * This library is free software; you can redistribute it and/or * + * modify it under the terms of the GNU Lesser General Public * + * License as published by the Free Software Foundation; either * + * version 2.1 of the License, or (at your option) any later version. * + * * + * This library is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * + * Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program. If not, see <http://www.gnu.org/licenses/>. * + ***************************************************************************/ +#pragma once + +// Std +#include <memory> +#include <string> + +// Qt +#include <qobject.h> +#include <QtSql/QSqlQuery> + +// Lrc +#include "namedirectory.h" + +class Account; // TODO: move this class into lrc ns + +namespace lrc +{ + +namespace api { namespace message { struct Info; }} + +class Database : public QObject { + Q_OBJECT + +public: + using MessagesMap = std::map<int, api::message::Info>; + + static constexpr auto ringDB = "ring.db"; // TODO: set path correctly for tests and release. + + Database(); + ~Database(); + + // Messages related + void addMessage(const std::string& accountId, const api::message::Info& message) const; + void clearHistory(const std::string& accountId, + const std::string& uid, + bool removeContact = false) const; + MessagesMap getHistory(const std::string& accountId, const std::string& uid) const; + std::size_t numberOfUnreads(const std::string& accountId, const std::string& uid) const; + void setMessageRead(int uid) const; + + // Contacts related + void addContact(const std::string& contact, const QByteArray& payload) const; + std::string getContactAttribute(const std::string& uid, const std::string& attribute) const; + +Q_SIGNALS: + void messageAdded(int uid, const std::string& accountId, const api::message::Info& msg) const; + void contactAdded(const std::string& uid) const; + +private Q_SLOTS: + void slotRegisteredNameFound(const Account* account, + NameDirectory::LookupStatus status, + const QString& address, + const QString& name) const; + +private: + std::unique_ptr<QSqlQuery> query_; + QSqlDatabase db_; +}; + +} // namespace lrc diff --git a/src/lrc.cpp b/src/lrc.cpp new file mode 100644 index 00000000..e73838d2 --- /dev/null +++ b/src/lrc.cpp @@ -0,0 +1,63 @@ +/**************************************************************************** + * Copyright (C) 2017 Savoir-faire Linux * + * Author : Nicolas Jäger <nicolas.jager@savoirfairelinux.com> * + * Author : Sébastien Blin <sebastien.blin@savoirfairelinux.com> * + * * + * This library is free software; you can redistribute it and/or * + * modify it under the terms of the GNU Lesser General Public * + * License as published by the Free Software Foundation; either * + * version 2.1 of the License, or (at your option) any later version. * + * * + * This library is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * + * Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program. If not, see <http://www.gnu.org/licenses/>. * + ***************************************************************************/ +#include "api/lrc.h" + +// Models and database +#include "api/newaccountmodel.h" +#include "database.h" +#include "callbackshandler.h" + +namespace lrc +{ + +using namespace api; + +class LrcPimpl +{ + +public: + LrcPimpl(); + + std::unique_ptr<Lrc> parent; + std::unique_ptr<Database> database; + std::unique_ptr<NewAccountModel> accountModel; + std::unique_ptr<CallbacksHandler> callbackHandler; +}; + +Lrc::Lrc() +: lrcPipmpl_(std::make_unique<LrcPimpl>()) +{ +} + +Lrc::~Lrc() +{ +} + +NewAccountModel& +Lrc::getAccountModel() +{ + return *lrcPipmpl_->accountModel; +} + +LrcPimpl::LrcPimpl() +{ + database = std::make_unique<Database>(); +} + +} // namespace lrc diff --git a/src/newaccountmodel.cpp b/src/newaccountmodel.cpp new file mode 100644 index 00000000..8128c92b --- /dev/null +++ b/src/newaccountmodel.cpp @@ -0,0 +1,80 @@ +/**************************************************************************** + * Copyright (C) 2017 Savoir-faire Linux * + * Author : Nicolas Jäger <nicolas.jager@savoirfairelinux.com> * + * Author : Sébastien Blin <sebastien.blin@savoirfairelinux.com> * + * * + * This library is free software; you can redistribute it and/or * + * modify it under the terms of the GNU Lesser General Public * + * License as published by the Free Software Foundation; either * + * version 2.1 of the License, or (at your option) any later version. * + * * + * This library is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * + * Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program. If not, see <http://www.gnu.org/licenses/>. * + ***************************************************************************/ +#include "api/newaccountmodel.h" + + +// LRC +#include "api/newcallmodel.h" +#include "api/contactmodel.h" +#include "api/conversationmodel.h" +#include "api/account.h" + +#include "database.h" + +namespace lrc +{ + +using namespace api; + +class NewAccountModelPimpl +{ +public: + NewAccountModelPimpl(const Database& database); + ~NewAccountModelPimpl(); + + const Database& database; + NewAccountModel::AccountInfoMap accounts; +}; + +NewAccountModel::NewAccountModel(const Database& database) +: QObject() +, pimpl_(std::make_unique<NewAccountModelPimpl>(database)) +{ +} + +NewAccountModel::~NewAccountModel() +{ +} + +const std::vector<std::string> +NewAccountModel::getAccountList() const +{ + return {}; +} + +const account::Info& +NewAccountModel::getAccountInfo(const std::string& accountId) +{ + return pimpl_->accounts[accountId]; +} + +NewAccountModelPimpl::NewAccountModelPimpl(const Database& database) +: database(database) +{ + +} + +NewAccountModelPimpl::~NewAccountModelPimpl() +{ + +} + +} // namespace lrc + +#include "api/moc_newaccountmodel.cpp" diff --git a/src/newcallmodel.cpp b/src/newcallmodel.cpp new file mode 100644 index 00000000..f834430b --- /dev/null +++ b/src/newcallmodel.cpp @@ -0,0 +1,127 @@ +/**************************************************************************** + * Copyright (C) 2017 Savoir-faire Linux * + * Author : Nicolas Jäger <nicolas.jager@savoirfairelinux.com> * + * Author : Sébastien Blin <sebastien.blin@savoirfairelinux.com> * + * * + * This library is free software; you can redistribute it and/or * + * modify it under the terms of the GNU Lesser General Public * + * License as published by the Free Software Foundation; either * + * version 2.1 of the License, or (at your option) any later version. * + * * + * This library is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * + * Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program. If not, see <http://www.gnu.org/licenses/>. * + ***************************************************************************/ +#include "api/newcallmodel.h" + +// LRC +#include "api/newaccountmodel.h" + +namespace lrc +{ + +using namespace api; + +class NewCallModelPimpl +{ +public: + NewCallModelPimpl(NewAccountModel& parent); + ~NewCallModelPimpl(); + + void sendMessage(const std::string& callId, const std::string& body) const; + + NewCallModel::CallInfoMap calls; + NewAccountModel& parent; +}; + +NewCallModel::NewCallModel(NewAccountModel& parent, const account::Info& info) +: QObject() +, owner(info) +, pimpl_(std::make_unique<NewCallModelPimpl>(parent)) +{ + +} + +NewCallModel::~NewCallModel() +{ + +} + +const call::Info& +NewCallModel::createCall(const std::string& contactUri) +{ + +} + +void +NewCallModel::hangUp(const std::string& callId) const +{ + +} + +void +NewCallModel::togglePause(const std::string& callId) const +{ + +} + +void +NewCallModel::toggleMedia(const std::string& callId, const Media media) const +{ + +} + +void +NewCallModel::toggleRecoringdAudio(const std::string& callId) const +{ + +} + +void +NewCallModel::setQuality(const std::string& callId, const double quality) const +{ + +} + +void +NewCallModel::transfer(const std::string& callId, const std::string& to) const +{ + +} + +void +NewCallModel::addParticipant(const std::string& callId, const std::string& participant) +{ + +} + +void +NewCallModel::removeParticipant(const std::string& callId, const std::string& participant) +{ + +} + +NewCallModelPimpl::NewCallModelPimpl(NewAccountModel& p) +: parent(p) +{ + +} + +NewCallModelPimpl::~NewCallModelPimpl() +{ + +} + +void +NewCallModelPimpl::sendMessage(const std::string& callId, const std::string& body) const +{ + +} + +} // namespace lrc + +#include "api/moc_newcallmodel.cpp" -- GitLab