diff --git a/Contact.cpp b/Contact.cpp index 2377b9ce8810c95081b29e17421368edc67c662d..703e293905adf0c4b89b0afd5a64d5f5dd1690fd 100644 --- a/Contact.cpp +++ b/Contact.cpp @@ -1,6 +1,7 @@ /************************************************************************** * Copyright (C) 2016 by Savoir-faire Linux * * Author: J�ger Nicolas <nicolas.jager@savoirfairelinux.com> * +* Author: Traczyk Andreas <traczyk.andreas@savoirfairelinux.com> * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * @@ -30,6 +31,7 @@ Contact::Contact(String^ name, { name_ = name; ringID_ = ringID; + conversation_ = ref new Conversation(); } void diff --git a/Contact.h b/Contact.h index a68e57ba5cf1f92a31412477d69ca527085de7c0..5c9b14b79c90b1c78fad5625ca89152bb1abc671 100644 --- a/Contact.h +++ b/Contact.h @@ -2,6 +2,7 @@ /************************************************************************** * Copyright (C) 2016 by Savoir-faire Linux * * Author: J�ger Nicolas <nicolas.jager@savoirfairelinux.com> * +* Author: Traczyk Andreas <traczyk.andreas@savoirfairelinux.com> * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * @@ -21,6 +22,7 @@ using namespace Windows::UI::Xaml::Data; namespace RingClientUWP { +ref class Conversation; public ref class Contact sealed : public INotifyPropertyChanged { public: @@ -31,10 +33,19 @@ public: property String^ name_; property String^ ringID_; + property Conversation^ _conversation + { + Conversation^ get() + { + return conversation_; + } + } protected: void NotifyPropertyChanged(String^ propertyName); +private: + Conversation^ conversation_; }; } diff --git a/Conversation.cpp b/Conversation.cpp new file mode 100644 index 0000000000000000000000000000000000000000..5e64a7ed1fba13b1ab55434c3289aed1302640f8 --- /dev/null +++ b/Conversation.cpp @@ -0,0 +1,43 @@ +/************************************************************************** +* Copyright (C) 2016 by Savoir-faire Linux * +* Author: J�ger Nicolas <nicolas.jager@savoirfairelinux.com> * +* Author: Traczyk Andreas <traczyk.andreas@savoirfairelinux.com> * +* * +* This program is free software; you can redistribute it and/or modify * +* it under the terms of the GNU General Public License as published by * +* the Free Software Foundation; either version 3 of the License, or * +* (at your option) any later version. * +* * +* This program 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 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 "pch.h" + +#include "Conversation.h" + +using namespace Windows::ApplicationModel::Core; +using namespace Platform; +using namespace Windows::UI::Core; + +using namespace RingClientUWP; + +Conversation::Conversation() +{ +} + +void +Conversation::addMessage(String^ date, bool fromContact, String^ payload) +{ + ConversationMessage^ message = ref new ConversationMessage(); + message->Date = date; + message->FromContact = fromContact; + message->Payload = payload; + std::string owner((fromContact) ? "from contact" : " from me"); + MSG_("{Conversation::addMessage}"); + MSG_("owner = " + owner); +} diff --git a/Conversation.h b/Conversation.h new file mode 100644 index 0000000000000000000000000000000000000000..7717330bb796b3367ad99dd10c84a78d7be93c3d --- /dev/null +++ b/Conversation.h @@ -0,0 +1,49 @@ +#pragma once +/************************************************************************** +* Copyright (C) 2016 by Savoir-faire Linux * +* Author: J�ger Nicolas <nicolas.jager@savoirfairelinux.com> * +* Author: Traczyk Andreas <traczyk.andreas@savoirfairelinux.com> * +* * +* This program is free software; you can redistribute it and/or modify * +* it under the terms of the GNU General Public License as published by * +* the Free Software Foundation; either version 3 of the License, or * +* (at your option) any later version. * +* * +* This program 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 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/>. * +**************************************************************************/ +using namespace Platform; +using namespace Windows::UI::Xaml::Data; + +namespace RingClientUWP +{ +public ref class ConversationMessage sealed +{ +public: + property String^ Date; + property bool FromContact; + property String^ Payload; +}; + +public ref class Conversation sealed +{ +private: + + +public: + Conversation(); + void addMessage(String^ date, bool fromContact, String^ payload); + +private: + Vector<ConversationMessage^> messages; + +}; +#define MSG_FROM_CONTACT true +#define MSG_FROM_ME false +} + diff --git a/pch.h b/pch.h index 7e025e88d81b080aa94a1a36b1cbcc0ddcc1fc0e..0ccf5895bdb43be456920b993a9a301c83aa75fa 100644 --- a/pch.h +++ b/pch.h @@ -20,6 +20,7 @@ /* standard system include files. */ #include <ppltasks.h> #include <iomanip> +#include <queue> /* required by generated headers. */ #include "App.xaml.h" @@ -28,6 +29,7 @@ #include "Call.h" #include "Contact.h" #include "ContactsViewModel.h" +#include "Conversation.h" /* ensure to be accessed from anywhere */ #include "RingD.h" diff --git a/ring-client-uwp.vcxproj b/ring-client-uwp.vcxproj index 656d2c3eeb2733f18a557776c5317ac470ba9204..edd60f8904f2e2cbe528da7e93ee922424a09f5c 100644 --- a/ring-client-uwp.vcxproj +++ b/ring-client-uwp.vcxproj @@ -164,6 +164,7 @@ <ClInclude Include="CallsViewModel.h" /> <ClInclude Include="Contact.h" /> <ClInclude Include="ContactsViewModel.h" /> + <ClInclude Include="Conversation.h" /> <ClInclude Include="LoadingPage.xaml.h"> <DependentUpon>LoadingPage.xaml</DependentUpon> </ClInclude> @@ -263,6 +264,7 @@ <ClCompile Include="CallsViewModel.cpp" /> <ClCompile Include="Contact.cpp" /> <ClCompile Include="ContactsViewModel.cpp" /> + <ClCompile Include="Conversation.cpp" /> <ClCompile Include="LoadingPage.xaml.cpp"> <DependentUpon>LoadingPage.xaml</DependentUpon> </ClCompile> diff --git a/ring-client-uwp.vcxproj.filters b/ring-client-uwp.vcxproj.filters index fb11f4132fd50940cc36db556f615a4ce635ffcf..0ad361d5d58565e86a38ea910e0fe35482f82961 100644 --- a/ring-client-uwp.vcxproj.filters +++ b/ring-client-uwp.vcxproj.filters @@ -71,6 +71,9 @@ <ClCompile Include="Call.cpp"> <Filter>Common</Filter> </ClCompile> + <ClCompile Include="Conversation.cpp"> + <Filter>Model</Filter> + </ClCompile> <ClCompile Include="CallsViewModel.cpp"> <Filter>ModelViews</Filter> </ClCompile> @@ -112,6 +115,9 @@ </ClInclude> <ClInclude Include="CallsViewModel.h"> <Filter>ModelViews</Filter> + </ClInclude> + <ClInclude Include="Conversation.h"> + <Filter>Model</Filter> </ClInclude> </ItemGroup> <ItemGroup>