Commit e9919eb2 authored by atraczyk's avatar atraczyk Committed by Andreas Traczyk

videocall: transition to videopage during a call

- transtions to the videopage during a call
- displays the called peer's name at the top of the page
- allows the user to end the call with the hangup button
- allows the user to exit and re-enter the call by selecting
  different SmartListItems

Change-Id: I48e120e9ea9bcb2498ef7a45c706e7267fd77708
parent d83bc549
/***************************************************************************
/**************************************************************************
* Copyright (C) 2016 by Savoir-faire Linux *
* Author: Jger Nicolas <nicolas.jager@savoirfairelinux.com> *
* Author: Traczyk Andreas <andreas.traczyk@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 *
......@@ -44,10 +45,14 @@ CallsViewModel::CallsViewModel()
if (state == "OVER") {
delete call;
call->stateChange("", code);
callEnded();
callStatusUpdated(call); // used ?
RingD::instance->hangUpCall(call);
return;
}
else if (state == "CURRENT") {
callStarted();
}
call->stateChange(state, code);
callStatusUpdated(call); // same...
return;
......
......@@ -2,6 +2,7 @@
/**************************************************************************
* Copyright (C) 2016 by Savoir-faire Linux *
* Author: Jger Nicolas <nicolas.jager@savoirfairelinux.com> *
* Author: Traczyk Andreas <andreas.traczyk@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 *
......@@ -23,6 +24,8 @@ namespace RingClientUWP
/* delegate */
delegate void CallRecieved(Call^ call);
delegate void CallStatusUpdated(Call^ call);
delegate void CallStarted();
delegate void CallEnded();
namespace ViewModel {
public ref class CallsViewModel sealed
......@@ -56,6 +59,8 @@ internal:
/* events */
event CallRecieved^ callRecieved;
event CallStatusUpdated^ callStatusUpdated;
event CallStarted^ callStarted;
event CallEnded^ callEnded;
private:
CallsViewModel(); // singleton
......
......@@ -61,10 +61,28 @@ MainPage::MainPage()
/* connect to delegates */
ContactsViewModel::instance->newContactSelected += ref new NewContactSelected([&]() {
showFrame(_messageTextFrame_);
Contact^ selectedContact = ContactsViewModel::instance->selectedContact;
auto call = selectedContact?
SmartPanelItemsViewModel::instance->findItem(selectedContact)->_call:
nullptr;
if (call != nullptr) {
if (call->state == "CURRENT")
showFrame(_videoFrame_);
else
showFrame(_messageTextFrame_);
}
else {
showFrame(_messageTextFrame_);
}
});
ContactsViewModel::instance->noContactSelected += ref new NoContactSelected([&]() {
showFrame(_welcomeFrame_);
});
CallsViewModel::instance->callStarted += ref new CallStarted([&]() {
showFrame(_videoFrame_);
});
CallsViewModel::instance->callEnded += ref new CallEnded([&]() {
showFrame(_messageTextFrame_);
});
DisplayInformation^ displayInformation = DisplayInformation::GetForCurrentView();
......@@ -105,6 +123,7 @@ RingClientUWP::MainPage::showFrame(Windows::UI::Xaml::Controls::Frame^ frame)
_navGrid_->SetRow(_welcomeFrame_, 1);
} else if (frame == _videoFrame_) {
_navGrid_->SetRow(_videoFrame_, 1);
dynamic_cast<VideoPage^>(_videoFrame_->Content)->updatePageContent();
} else if (frame == _messageTextFrame_) {
_navGrid_->SetRow(_messageTextFrame_, 1);
dynamic_cast<MessageTextPage^>(_messageTextFrame_->Content)->updatePageContent();
......
This diff is collapsed.
/**************************************************************************
* Copyright (C) 2016 by Savoir-faire Linux *
* Author: Jger Nicolas <nicolas.jager@savoirfairelinux.com> *
* Author: Traczyk Andreas <andreas.traczyk@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 "VideoPage.xaml.h"
......@@ -17,13 +35,31 @@ using namespace Windows::UI::Xaml::Input;
using namespace Windows::UI::Xaml::Media;
using namespace Windows::UI::Xaml::Navigation;
using namespace Windows::Media::Capture;
using namespace Windows::ApplicationModel::Core;
using namespace Windows::UI::Core;
VideoPage::VideoPage()
{
InitializeComponent();
}
void
RingClientUWP::Views::VideoPage::OnNavigatedTo(Windows::UI::Xaml::Navigation::NavigationEventArgs^ e)
{
updatePageContent();
}
void RingClientUWP::Views::VideoPage::updatePageContent()
{
auto selectedContact = ViewModel::ContactsViewModel::instance->selectedContact;
Contact^ contact = selectedContact?
ViewModel::SmartPanelItemsViewModel::instance->findItem(selectedContact)->_contact:
nullptr;
if (!contact)
return;
_callee_->Text = contact->name_;
}
void RingClientUWP::Views::VideoPage::Button_Click(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e)
{
......@@ -37,6 +73,12 @@ void RingClientUWP::Views::VideoPage::_btnCancel__Click(Platform::Object^ sender
void RingClientUWP::Views::VideoPage::_btnHangUp__Tapped(Platform::Object^ sender, Windows::UI::Xaml::Input::TappedRoutedEventArgs^ e)
{
Contact^ selectedContact = ViewModel::ContactsViewModel::instance->selectedContact;
Call^ call = selectedContact?
ViewModel::SmartPanelItemsViewModel::instance->findItem(selectedContact)->_call:
nullptr;
if (call)
RingD::instance->hangUpCall(call);
pressHangUpCall();
}
......@@ -107,14 +149,4 @@ void RingClientUWP::Views::VideoPage::btnAny_entered(Platform::Object^ sender, W
void RingClientUWP::Views::VideoPage::btnAny_exited(Platform::Object^ sender, Windows::UI::Xaml::Input::PointerRoutedEventArgs^ e)
{
barFading_ = true;
}
void
RingClientUWP::Views::VideoPage::OnNavigatedTo(Windows::UI::Xaml::Navigation::NavigationEventArgs^ e)
{
updatePageContent();
}
void RingClientUWP::Views::VideoPage::updatePageContent()
{
}
\ No newline at end of file
#pragma once
/**************************************************************************
* Copyright (C) 2016 by Savoir-faire Linux *
* Author: Jger Nicolas <nicolas.jager@savoirfairelinux.com> *
* Author: Traczyk Andreas <andreas.traczyk@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 "VideoPage.g.h"
using namespace Windows::Media::Capture;
......@@ -25,6 +42,8 @@ public ref class VideoPage sealed
{
public:
VideoPage();
void updatePageContent();
property bool barFading
{
bool get()
......@@ -38,10 +57,7 @@ public:
}
protected:
// Template Support
virtual void OnNavigatedTo(Windows::UI::Xaml::Navigation::NavigationEventArgs^ e) override;
/*virtual void OnNavigatedFrom(Windows::UI::Xaml::Navigation::NavigationEventArgs^ e) override;*/
internal:
/* events */
......@@ -58,10 +74,6 @@ internal:
private:
bool barFading_;
void updatePageContent();
//void OnNavigatedToPage(Object^ sender, NavigationEventArgs^ e);
void Button_Click(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e);
void _btnCancel__Click(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e);
void _btnHangUp__Tapped(Platform::Object^ sender, Windows::UI::Xaml::Input::TappedRoutedEventArgs^ e);
......
......@@ -2,6 +2,7 @@
/**************************************************************************
* Copyright (C) 2016 by Savoir-faire Linux *
* Author: Jger Nicolas <nicolas.jager@savoirfairelinux.com> *
* Author: Traczyk Andreas <andreas.traczyk@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 *
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment