Commit 5c2ddc99 authored by Ghislain MARY's avatar Ghislain MARY
Browse files

Remove useless code.

parent 122cde0e

Too many changes to show.

To preserve performance only 1000 of 1000+ files are displayed.
......@@ -192,9 +192,6 @@
<Compile Include="Views\Launcher.xaml.cs">
<DependentUpon>Launcher.xaml</DependentUpon>
</Compile>
<Compile Include="Views\MainPage.xaml.cs">
<DependentUpon>MainPage.xaml</DependentUpon>
</Compile>
<Compile Include="Model\LinphoneManager.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Views\Settings.xaml.cs">
......@@ -345,10 +342,6 @@
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="Views\MainPage.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="Views\Settings.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
......
......@@ -144,30 +144,6 @@ namespace Linphone.Views
base.OnNavigatingFrom(e);
}
private void cancel_Click_1(object sender, EventArgs e)
{
saveSettingsOnLeave = false;
if (Frame.CanGoBack)
{
Frame.GoBack();
}
}
private void save_Click_1(object sender, EventArgs e)
{
if (Frame.CanGoBack)
{
Frame.GoBack();
}
}
private void linphone_Click_1(object sender, EventArgs e)
{
mediaEncryption.SelectedItem = ResourceLoader.GetForCurrentView().GetString("MediaEncryptionSRTP");
firewallPolicy.SelectedItem = ResourceLoader.GetForCurrentView().GetString("FirewallPolicyIce");
Stun.Text = "stun.linphone.org";
}
private void LogUploadProgressIndication(int offset, int total)
{
BugReportUploadProgressBar.Maximum = total;
......
<Page
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:Linphone"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:Model="using:Linphone.Model"
x:Class="Linphone.Views.MainPage"
mc:Ignorable="d">
<Page.DataContext>
<Model:LinphoneManager/>
</Page.DataContext>
<Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
<StackPanel x:Name="stackPanel" Margin="8">
<TextBlock x:Name="RegistrationTitle" TextWrapping="Wrap" Style="{StaticResource HeaderTextBlockStyle}" VerticalAlignment="Center" Text="Register" Margin="0,8"/>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<TextBlock x:Name="UsernameTextBlock" HorizontalAlignment="Left" Margin="8,0" TextWrapping="Wrap" VerticalAlignment="Center" Text="Username:"/>
<TextBox x:Name="UsernameTextBox" Margin="8" TextWrapping="Wrap" VerticalAlignment="Center" d:LayoutOverrides="Width" Grid.Column="1"/>
<TextBlock x:Name="PasswordTextBlock" Margin="8,0" Grid.Row="1" TextWrapping="Wrap" Text="Password:" VerticalAlignment="Center" d:LayoutOverrides="Width"/>
<PasswordBox x:Name="PasswordBox" Margin="8" d:LayoutOverrides="Width, Height" Grid.Row="1" Grid.Column="1" HorizontalContentAlignment="Stretch"/>
<TextBlock x:Name="ServerTextBlock" HorizontalAlignment="Left" Margin="8,0" TextWrapping="Wrap" VerticalAlignment="Center" Grid.Row="2" Text="Server:"/>
<TextBox x:Name="ServerTextBox" Margin="8" TextWrapping="Wrap" VerticalAlignment="Center" d:LayoutOverrides="Width" Grid.Row="2" Grid.Column="1" Text="sip.linphone.org"/>
<Button x:Name="RegisterButton" Content="Register" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Margin="8,0" Grid.Row="3" d:LayoutOverrides="Height, TopPosition, BottomPosition" Click="RegisterButton_Click"/>
<TextBlock x:Name="RegistrationStateTextBlock" Margin="8" TextWrapping="Wrap" Grid.Row="3" Grid.Column="1" Text="{Binding Instance.RegistrationStateText}" HorizontalAlignment="Center" VerticalAlignment="Center"/>
</Grid>
<TextBlock x:Name="CallTitle" TextWrapping="Wrap" Style="{StaticResource HeaderTextBlockStyle}" VerticalAlignment="Center" Text="Call" Margin="0,8"/>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<TextBlock x:Name="ContactTextBlock" HorizontalAlignment="Left" Margin="8,0" TextWrapping="Wrap" VerticalAlignment="Center" Text="Contact:"/>
<TextBox x:Name="ContactTextBox" Margin="8" TextWrapping="Wrap" VerticalAlignment="Center" d:LayoutOverrides="Width" Grid.Column="1"/>
<Button x:Name="CallButton" Content="Call / Hangup" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Margin="8,0" Grid.Row="1" d:LayoutOverrides="Height, TopPosition, BottomPosition" Click="CallButton_Click"/>
<TextBlock x:Name="CallStateTextBlock" Margin="8,8,5,8" TextWrapping="Wrap" Grid.Row="1" Grid.Column="1" Text="{Binding Instance.CallStateText}" HorizontalAlignment="Center" VerticalAlignment="Center"/>
</Grid>
</StackPanel>
</Grid>
</Page>
/*
MainPage.xaml.cs
Copyright (C) 2015 Belledonne Communications, Grenoble, France
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 2
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, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
using Windows.UI.Xaml.Controls;
using BelledonneCommunications.Linphone.Native;
using Linphone.Model;
using Windows.UI.Xaml.Navigation;
// The Blank Page item template is documented at http://go.microsoft.com/fwlink/?LinkId=402352&clcid=0x409
namespace Linphone.Views
{
/// <summary>
/// An empty page that can be used on its own or navigated to within a Frame.
/// </summary>
public sealed partial class MainPage : Page
{
public MainPage()
{
this.InitializeComponent();
}
protected override void OnNavigatedTo(NavigationEventArgs e)
{
base.OnNavigatedTo(e);
Core.LogLevel = OutputTraceLevel.Message;
LinphoneManager.Instance.CoreDispatcher = Dispatcher;
LinphoneManager.Instance.Core.IsIterateEnabled = true;
}
private void CallButton_Click(object sender, Windows.UI.Xaml.RoutedEventArgs e)
{
Core core = LinphoneManager.Instance.Core;
if (core.CallsNb == 0)
{
string contact = ContactTextBox.Text;
if (contact.Length > 0)
{
Address address = core.InterpretURL(contact);
if (address != null)
{
core.InviteAddress(address);
}
}
}
else
{
foreach (Call c in core.Calls)
{
core.TerminateCall(c);
}
}
}
private void RegisterButton_Click(object sender, Windows.UI.Xaml.RoutedEventArgs e)
{
if ((UsernameTextBox.Text.Length > 0) && (ServerTextBox.Text.Length > 0))
{
Core core = LinphoneManager.Instance.Core;
ProxyConfig proxy = core.CreateProxyConfig();
AuthInfo authInfo = core.CreateAuthInfo(UsernameTextBox.Text, "", PasswordBox.Password, "", "", "");
core.AddAuthInfo(authInfo);
proxy.Identity = string.Format("sip:{0}@{1}", UsernameTextBox.Text, ServerTextBox.Text);
proxy.ServerAddr = ServerTextBox.Text;
Address addr = core.CreateAddress(proxy.ServerAddr);
addr.Transport = Transport.TCP;
proxy.ServerAddr = addr.AsString();
proxy.Route = addr.AsString();
proxy.IsRegisterEnabled = true;
core.AddProxyConfig(proxy);
core.DefaultProxyConfig = proxy;
core.VideoPolicy = new VideoPolicy(false, false);
}
}
}
}
#-------------------------------------------------
#
# Project created by QtCreator 2013-04-06T17:51:40
#
#-------------------------------------------------
QT += core gui network
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
TARGET = LinphoneTCPLogger
TEMPLATE = app
SOURCES += main.cpp\
logger.cpp \
server.cpp \
connection.cpp
HEADERS += logger.h \
server.h \
connection.h
FORMS += logger.ui
RESOURCES += \
silk.qrc
#include "connection.h"
#include <qendian.h>
Connection::Connection(QObject *parent) :
QTcpSocket(parent), mState(ReadingHeader)
{
connect(this, SIGNAL(connected()),
this, SLOT(notifyConnectionActive()));
connect(this, SIGNAL(readyRead()),
this, SLOT(processReadyRead()));
}
void Connection::notifyConnectionActive()
{
}
void Connection::processReadyRead()
{
do {
if (!hasEnoughData())
return;
processData();
} while (bytesAvailable() > 0);
}
bool Connection::hasEnoughData()
{
if (mState == ReadingHeader) {
return (bytesAvailable() >= HeaderSize);
} else if (mState == ReadingMessage) {
return (bytesAvailable() >= mMessageLength);
}
return false;
}
void Connection::processData()
{
if (mState == ReadingHeader) {
mBuffer = read(HeaderSize);
if (mBuffer.size() != HeaderSize) {
abort();
return;
}
memcpy(&mLogTime, mBuffer.constData(), 8);
#ifdef Q_LITTLE_ENDIAN
//Convert to LittleEndian
mLogTime = qbswap(mLogTime);
#endif
mLogLevel = static_cast<LogLevel>(static_cast<unsigned int>(mBuffer[8]));
mMessageLength = ((static_cast<unsigned int>(mBuffer[9]) & 0xFF) << 8)
| (static_cast<unsigned int>(mBuffer[10]) & 0xFF);
mBuffer.clear();
mState = ReadingMessage;
}
if (mState == ReadingMessage) {
if (hasEnoughData()) {
mBuffer = read(mMessageLength);
emit newMessage(mLogTime, mLogLevel, QString::fromUtf8(mBuffer));
mBuffer.clear();
mMessageLength = 0;
mState = ReadingHeader;
}
}
}
#ifndef CONNECTION_H
#define CONNECTION_H
#include <QTcpSocket>
static const int HeaderLogTimeSize = 8;
static const int HeaderLogLevelSize = 1;
static const int HeaderMessageLengthSize = 2;
static const int HeaderSize = HeaderLogTimeSize + HeaderLogLevelSize + HeaderMessageLengthSize;
class Connection : public QTcpSocket
{
Q_OBJECT
public:
enum LogLevel {
Debug,
Message,
Warning,
Error
};
enum ParseState {
ReadingHeader,
ReadingMessage
};
explicit Connection(QObject *parent = 0);
signals:
void newMessage(quint64 time, Connection::LogLevel level, const QString &message);
private slots:
void processReadyRead();
void notifyConnectionActive();
private:
bool hasEnoughData();
void processData();
QByteArray mBuffer;
ParseState mState;
quint64 mLogTime;
LogLevel mLogLevel;
unsigned int mMessageLength;
};
#endif // CONNECTION_H
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