Skip to content
Snippets Groups Projects
Commit e9919eb2 authored by Andreas Traczyk's avatar Andreas Traczyk Committed by Andreas Traczyk
Browse files

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
No related branches found
No related tags found
No related merge requests found
/***************************************************************************
/**************************************************************************
* 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,11 +61,29 @@ MainPage::MainPage()
/* connect to delegates */
ContactsViewModel::instance->newContactSelected += ref new NewContactSelected([&]() {
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();
dpiChangedtoken = (displayInformation->DpiChanged += ref new TypedEventHandler<DisplayInformation^,
......@@ -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();
......
......@@ -5,10 +5,11 @@
xmlns:local="using:RingClientUWP"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d">
mc:Ignorable="d"
NavigationCacheMode="Enabled">
<Page.Resources>
<SolidColorBrush x:Key="SemiTransparentBlack" Color="#000000" Opacity="0.5"/>
<SolidColorBrush x:Key="SemiTransparentBlack" Color="#808080" Opacity="0.5"/>
<Storyboard x:Name="myStoryboard">
<DoubleAnimationUsingKeyFrames Storyboard.TargetName="_controlsBar_"
Storyboard.TargetProperty="Opacity"
......@@ -33,9 +34,8 @@
<Frame x:Name="_chatPanel_"/>
</SplitView.Pane>
<SplitView.Content>
<Grid>
<Grid Background="#000000">
<Image x:Name="_videoControl_"
Source="ms-appx:///fond-video.png"
PointerMoved="_videoControl__PointerMoved"
Stretch="UniformToFill"/>
<StackPanel x:Name="_headerBar_"
......@@ -57,8 +57,91 @@
<Setter Property="Margin" Value="10,30"/>
<Setter Property="Width" Value="40"/>
<Setter Property="Height" Value="40"/>
<Setter Property="Background" Value="Black"/>
<Setter Property="Foreground" Value="White"/>
<Setter Property="BorderBrush" Value="White"/>
<Setter Property="BorderBrush" Value="Gray"/>
<Setter Property="BorderThickness" Value="{ThemeResource ButtonBorderThemeThickness}"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Button">
<Grid x:Name="RootGrid" Background="{TemplateBinding Background}">
<VisualStateManager.VisualStateGroups>
<VisualStateGroup x:Name="CommonStates">
<VisualState x:Name="PointerOver">
<Storyboard>
<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Background"
Storyboard.TargetName="ContentPresenter">
<DiscreteObjectKeyFrame KeyTime="0"
Value="Gray"/>
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Foreground"
Storyboard.TargetName="ContentPresenter">
<DiscreteObjectKeyFrame KeyTime="0"
Value="White"/>
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="BorderBrush"
Storyboard.TargetName="ContentPresenter">
<DiscreteObjectKeyFrame KeyTime="0"
Value="White"/>
</ObjectAnimationUsingKeyFrames>
</Storyboard>
</VisualState>
<VisualState x:Name="Normal">
<Storyboard>
<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Background"
Storyboard.TargetName="ContentPresenter">
<DiscreteObjectKeyFrame KeyTime="0"
Value="Black"/>
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Foreground"
Storyboard.TargetName="ContentPresenter">
<DiscreteObjectKeyFrame KeyTime="0"
Value="White"/>
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="BorderBrush"
Storyboard.TargetName="ContentPresenter">
<DiscreteObjectKeyFrame KeyTime="0"
Value="Gray"/>
</ObjectAnimationUsingKeyFrames>
<PointerUpThemeAnimation Storyboard.TargetName="RootGrid"/>
</Storyboard>
</VisualState>
<VisualState x:Name="Pressed">
<Storyboard>
<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Background"
Storyboard.TargetName="ContentPresenter">
<DiscreteObjectKeyFrame KeyTime="0"
Value="White"/>
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Foreground"
Storyboard.TargetName="ContentPresenter">
<DiscreteObjectKeyFrame KeyTime="0"
Value="Black"/>
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="BorderBrush"
Storyboard.TargetName="ContentPresenter">
<DiscreteObjectKeyFrame KeyTime="0"
Value="Gray"/>
</ObjectAnimationUsingKeyFrames>
<PointerDownThemeAnimation Storyboard.TargetName="RootGrid"/>
</Storyboard>
</VisualState>
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
<ContentPresenter x:Name="ContentPresenter"
AutomationProperties.AccessibilityView="Raw"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
ContentTemplate="{TemplateBinding ContentTemplate}"
ContentTransitions="{TemplateBinding ContentTransitions}"
Content="{TemplateBinding Content}"
HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
Padding="{TemplateBinding Padding}"
VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"/>
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</StackPanel.Resources>
......@@ -78,7 +161,7 @@
PointerEntered="btnAny_entered"
PointerExited="btnAny_exited"
Tapped="_btnChat__Tapped">
<SymbolIcon Symbol="Message"/>
<SymbolIcon Symbol="Message" HorizontalAlignment="Left" Width="20"/>
</Button>
<Button x:Name="_btnAddFriend_"
PointerEntered="btnAny_entered"
......@@ -114,7 +197,7 @@
PointerEntered="btnAny_entered"
PointerExited="btnAny_exited"
Tapped="_btnHQ__Tapped">
<TextBlock Text="HQ"/>
<TextBlock FontSize="12" Text="HQ"/>
</Button>
</StackPanel>
</Grid>
......
/**************************************************************************
* 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();
}
......@@ -108,13 +150,3 @@ void RingClientUWP::Views::VideoPage::btnAny_exited(Platform::Object^ sender, Wi
{
barFading_ = true;
}
\ No newline at end of file
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 *
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment