提交 b61f841a authored 作者: Mitch Capper's avatar Mitch Capper

Redid options.xaml so layout grows better. Added record call option. Fixed…

Redid options.xaml so layout grows better. Added record call option. Fixed slight bug in plugin manager base.
上级 b3157509
using System;
using System.Collections.Generic;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading;
using System.Windows;
......@@ -69,9 +70,9 @@ namespace FSClient {
Environment.Exit(-1);
}
}
Account.LoadSettings();
Account.LoadSettings();
recordings_folder = Properties.Settings.Default.RecordingPath;
IncomingBalloons = Properties.Settings.Default.IncomingBalloons;
IncomingTopMost = Properties.Settings.Default.FrontOnIncoming;
ClearDTMFS = Properties.Settings.Default.ClearDTMFS;
......@@ -352,8 +353,8 @@ namespace FSClient {
Properties.Settings.Default.IncomingBalloons = IncomingBalloons;
Properties.Settings.Default.FrontOnIncoming = IncomingTopMost;
Properties.Settings.Default.ClearDTMFS = ClearDTMFS;
Properties.Settings.Default.UseNumberOnlyInput = UseNumberOnlyInput;
Properties.Settings.Default.UseNumberOnlyInput = UseNumberOnlyInput;
Properties.Settings.Default.RecordingPath = recordings_folder;
Properties.Settings.Default.Sofia = new SettingsSofia(sofia);
Properties.Settings.Default.ContactPlugins = contact_plugin_manager.GetSettings();
Properties.Settings.Default.HeadsetPlugins = headset_plugin_manager.GetSettings();
......@@ -587,7 +588,25 @@ namespace FSClient {
}
}
private string _cur_dial_str;
public Utils.ObjectEventHandler<string> cur_dial_strChanged;
public Utils.ObjectEventHandler<string> cur_dial_strChanged;
public string recordings_folder {
get { return _recordings_folder; }
set {
if (value == _recordings_folder)
return;
if (! Directory.Exists(value)){
Directory.CreateDirectory(value);
if (! Directory.Exists(value)) //maybe we should prompt here if there is an issue but then again if they don't want to use recordings lets not force it
value = null;
}
_recordings_folder = value;
if (recordings_folderChanged != null)
recordings_folderChanged(this, value);
}
}
private string _recordings_folder;
public Utils.ObjectEventHandler<string> recordings_folderChanged;
#endregion
......
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.IO;
using System.Linq;
using System.Text.RegularExpressions;
using System.Windows;
......@@ -229,6 +230,10 @@ namespace FSClient {
menu.Items.Add(CreateMenuItem("Call on Account " + account.name, create_outgoing_call));
}
else {
if (am_recording_file != null)
menu.Items.Add(CreateMenuItem("Stop Recording Call", StopRecordCall));
else if (broker.recordings_folder != null)
menu.Items.Add(CreateMenuItem("Record Call", RecordCall));
menu.Items.Add(CreateMenuItem("Transfer", TransferPrompt));
item = new MenuItem() { Header = "Their Volume" };
for (int x = -4; x <= 4; x++) {
......@@ -251,6 +256,29 @@ namespace FSClient {
CallRightClickMenuShowing(this, new CallRightClickEventArgs { call = this, menu = menu });
}
}
private void StopRecordCall(){
Utils.bgapi_exec("uuid_record", leg_b_uuid + " stop \"" + am_recording_file + "\"");
am_recording_file = null;
}
private string am_recording_file;
private void RecordCall(){
String full_path = broker.recordings_folder.Replace('/', '\\');
if (! full_path.Contains(":\\"))
full_path = Path.Combine(Directory.GetCurrentDirectory(),full_path); //freeswitch is not happy with relative paths when using quotes
full_path = Path.Combine(full_path,"rec_" + other_party_number + "_" + DateTime.Now.ToString("yyyy-MM-dd_HH-mm-ss"));
int num =1;
String orig_full_path = full_path;
while (File.Exists(full_path + ".wav"))
full_path = orig_full_path + "." + num++;
full_path = full_path.Replace('\\', '/'); //seems freeswitch will selectively escape what it cant otherwise
am_recording_file = full_path + ".wav";
Utils.bgapi_exec("uuid_setvar", leg_b_uuid + " record_stereo true");
Utils.bgapi_exec("uuid_record", leg_b_uuid + " start \"" + am_recording_file +"\"");
}
private void Call_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e) {
CallPropertyEventArgs args = new CallPropertyEventArgs(this, e.PropertyName);
if (e.PropertyName == "state" && CallStateChanged != null)
......@@ -407,6 +435,8 @@ namespace FSClient {
start_time = DateTime.Now;
if (duration_timer == null)
duration_timer = new System.Threading.Timer(DurationTimerFired, null, 1000, 1000);
if (broker == null)
broker = Broker.get_instance();
}
private static void DurationTimerFired(object obj) {
if (Application.Current != null)
......@@ -463,8 +493,8 @@ namespace FSClient {
return menu;
}
private static Broker broker;
public void SetOurAudioLevel(int level){
if (level > 4 || level < -4)
return;
......
<Window x:Class="FSClient.Options"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="Options" Height="360" Width="550" Loaded="Window_Loaded" Closing="Window_Closing" WindowStyle="ThreeDBorderWindow" ResizeMode="NoResize" Icon="phone.ico">
Title="Options" Height="390" Width="550" Loaded="Window_Loaded" Closing="Window_Closing" WindowStyle="ThreeDBorderWindow" ResizeMode="NoResize" Icon="phone.ico">
<Window.Resources>
<Style x:Key="OptionHeaderStyle" TargetType="{x:Type TextBlock}">
<Setter Property="FontWeight" Value="Bold"/>
......@@ -10,53 +10,68 @@
<Setter Property="HorizontalAlignment" Value="Right"/>
</Style>
</Window.Resources>
<Grid>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="170"/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition />
<RowDefinition />
<RowDefinition />
<RowDefinition />
<RowDefinition />
<RowDefinition />
<RowDefinition />
<RowDefinition />
<RowDefinition />
<RowDefinition />
<RowDefinition Height="80" />
<RowDefinition Height="30" />
</Grid.RowDefinitions>
<TextBlock Grid.Row="1" Text="Headset Device:" Style="{DynamicResource OptionHeaderStyle}" />
<ComboBox Height="23" Grid.Row="1" Grid.Column="1" Name="comboHeadsetDevice" Width="340" />
<TextBlock Grid.Row="2" Text="Main Input:" Style="{DynamicResource OptionHeaderStyle}" />
<ComboBox Height="23" Grid.Row="2" Grid.Column="1" Name="comboHeadsetInput" Width="340" />
<TextBlock Grid.Row="3" Text="Main Output:" Style="{DynamicResource OptionHeaderStyle}" />
<ComboBox Height="23" Grid.Row="3" Grid.Column="1" Name="comboHeadsetOutput" Width="340" />
<Grid Grid.ColumnSpan="2">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="170"/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition />
<RowDefinition />
<RowDefinition />
<RowDefinition />
<RowDefinition />
<RowDefinition />
<RowDefinition />
</Grid.RowDefinitions>
<StackPanel Orientation="Horizontal" Grid.Column="0" Grid.ColumnSpan="2" HorizontalAlignment="Center" >
<Button Content="Reload Devices" Height="23" Name="btnReloadDevices" Width="100" Click="btnReloadDevices_Click" />
<Button Content="Sofia Settings" Height="23" Name="btnSofiaSettings" Width="100" Margin="10,0,0,0" Click="btnSofiaSettings_Click" />
<Button Content="Event Socket Settings" Height="23" Name="btnEventSocketSettings" Width="125" Margin="10,0,0,0" Click="btnEventSocketSettings_Click" />
<Button Content="Plugin Settings" Height="23" Name="btnPluginSettings" Width="100" Margin="10,0,0,0" Click="btnPluginSettings_Click" />
</StackPanel>
<TextBlock Grid.Row="1" Text="Headset Device:" Style="{DynamicResource OptionHeaderStyle}" />
<ComboBox Height="23" Grid.Row="1" Grid.Column="1" Name="comboHeadsetDevice" Width="340" />
<TextBlock Grid.Row="4" Text="Speakerphone Input:" Style="{DynamicResource OptionHeaderStyle}" />
<ComboBox Height="23" Grid.Row="4" Grid.Column="1" Name="comboSpeakerInput" Width="340" />
<TextBlock Grid.Row="5" Text="Speakerphone Output:" Style="{DynamicResource OptionHeaderStyle}" />
<ComboBox Height="23" Grid.Row="5" Grid.Column="1" Name="comboSpeakerOutput" Width="340" />
<TextBlock Grid.Row="6" Text="Ring Device:" Style="{DynamicResource OptionHeaderStyle}" />
<ComboBox Height="23" Grid.Row="6" Grid.Column="1" Name="comboRingDevice" Width="340" />
<StackPanel Grid.Row="7" Grid.Column="1" Grid.RowSpan="3">
<CheckBox x:Name="chkIncomingFront" Content="Bring To Front On Incoming Calls" VerticalAlignment="Center" FontWeight="Bold" FontSize="13.333" />
<CheckBox x:Name="chkIncomingBalloons" Content="Show Incoming Call Notification Balloons" VerticalAlignment="Center" FontWeight="Bold" FontSize="13.333" />
<CheckBox x:Name="chkClearDTMFS" Content="Clear Key Presses In Call Stats On Disconnect" VerticalAlignment="Center" FontWeight="Bold" FontSize="13.333" />
<CheckBox x:Name="chkUseNumbers" Content="Only Allow Numerical Input While Dialing" VerticalAlignment="Center" FontWeight="Bold" FontSize="13.333" />
</StackPanel>
<Button Content="Save" Grid.Row="10" Height="23" HorizontalAlignment="Left" Margin="101,0,0,0" Name="btnSave" VerticalAlignment="Center" Width="75" Grid.ColumnSpan="2" Click="btnSave_Click" />
<Button Content="Cancel" Grid.Column="1" Grid.Row="10" Height="23" HorizontalAlignment="Left" Margin="172,0,0,0" Name="btnCancel" VerticalAlignment="Center" Width="75" Click="btnCancel_Click" />
<StackPanel Orientation="Horizontal" Grid.Column="0" Grid.ColumnSpan="2" HorizontalAlignment="Center" >
<Button Content="Reload Devices" Height="23" Name="btnReloadDevices" Width="100" Click="btnReloadDevices_Click" />
<Button Content="Sofia Settings" Height="23" Name="btnSofiaSettings" Width="100" Margin="10,0,0,0" Click="btnSofiaSettings_Click" />
<Button Content="Event Socket Settings" Height="23" Name="btnEventSocketSettings" Width="125" Margin="10,0,0,0" Click="btnEventSocketSettings_Click" />
<Button Content="Plugin Settings" Height="23" Name="btnPluginSettings" Width="100" Margin="10,0,0,0" Click="btnPluginSettings_Click" />
<TextBlock Grid.Row="2" Text="Main Input:" Style="{DynamicResource OptionHeaderStyle}" />
<ComboBox Height="23" Grid.Row="2" Grid.Column="1" Name="comboHeadsetInput" Width="340" />
<TextBlock Grid.Row="3" Text="Main Output:" Style="{DynamicResource OptionHeaderStyle}" />
<ComboBox Height="23" Grid.Row="3" Grid.Column="1" Name="comboHeadsetOutput" Width="340" />
<TextBlock Grid.Row="4" Text="Speakerphone Input:" Style="{DynamicResource OptionHeaderStyle}" />
<ComboBox Height="23" Grid.Row="4" Grid.Column="1" Name="comboSpeakerInput" Width="340" />
<TextBlock Grid.Row="5" Text="Speakerphone Output:" Style="{DynamicResource OptionHeaderStyle}" />
<ComboBox Height="23" Grid.Row="5" Grid.Column="1" Name="comboSpeakerOutput" Width="340" />
<TextBlock Grid.Row="6" Text="Ring Device:" Style="{DynamicResource OptionHeaderStyle}" />
<ComboBox Height="23" Grid.Row="6" Grid.Column="1" Name="comboRingDevice" Width="340" />
<TextBlock Grid.Row="7" Text="Recording Path:" Style="{DynamicResource OptionHeaderStyle}" />
<StackPanel Orientation="Horizontal" Grid.Row="7" Grid.Column="1">
<TextBox Height="23" Name="txtRecordingPath" Width="286" Margin="10,0" />
<Button Name="btnPathBrowse" Content="Browse" Height="25" Click="btnPathBrowse_Click" />
</StackPanel>
</Grid>
<StackPanel Grid.Row="1" Grid.Column="1" Grid.RowSpan="3">
<CheckBox x:Name="chkIncomingFront" Content="Bring To Front On Incoming Calls" VerticalAlignment="Center" FontWeight="Bold" FontSize="13.333" />
<CheckBox x:Name="chkIncomingBalloons" Content="Show Incoming Call Notification Balloons" VerticalAlignment="Center" FontWeight="Bold" FontSize="13.333" />
<CheckBox x:Name="chkClearDTMFS" Content="Clear Key Presses In Call Stats On Disconnect" VerticalAlignment="Center" FontWeight="Bold" FontSize="13.333" />
<CheckBox x:Name="chkUseNumbers" Content="Only Allow Numerical Input While Dialing" VerticalAlignment="Center" FontWeight="Bold" FontSize="13.333" />
</StackPanel>
<Button Content="Save" Grid.Row="2" Height="23" HorizontalAlignment="Left" Margin="101,0,0,0" Name="btnSave" VerticalAlignment="Center" Width="75" Grid.ColumnSpan="2" Click="btnSave_Click" />
<Button Content="Cancel" Grid.Column="1" Grid.Row="2" Height="23" HorizontalAlignment="Left" Margin="172,0,0,0" Name="btnCancel" VerticalAlignment="Center" Width="75" Click="btnCancel_Click" />
</Grid>
</Window>
using System.Linq;
using System.Windows;
using System.Windows;
using System.Windows.Forms;
using WF=System.Windows.Forms;
namespace FSClient {
/// <summary>
/// Interaction logic for Options.xaml
......@@ -34,7 +36,8 @@ namespace FSClient {
chkIncomingBalloons.IsChecked = broker.IncomingBalloons;
chkIncomingFront.IsChecked = broker.IncomingTopMost;
chkClearDTMFS.IsChecked = broker.ClearDTMFS;
chkUseNumbers.IsChecked = broker.UseNumberOnlyInput;
chkUseNumbers.IsChecked = broker.UseNumberOnlyInput;
txtRecordingPath.Text = broker.recordings_folder;
comboHeadsetDevice.SelectedItem = broker.ActiveHeadset();
if (comboHeadsetDevice.SelectedIndex == -1)
......@@ -54,7 +57,8 @@ namespace FSClient {
broker.IncomingBalloons = chkIncomingBalloons.IsChecked == true;
broker.IncomingTopMost = chkIncomingFront.IsChecked == true;
broker.ClearDTMFS = chkClearDTMFS.IsChecked == true;
broker.UseNumberOnlyInput = chkUseNumbers.IsChecked == true;
broker.UseNumberOnlyInput = chkUseNumbers.IsChecked == true;
broker.recordings_folder = txtRecordingPath.Text;
broker.SetActiveHeadset(comboHeadsetDevice.SelectedItem as string);
broker.SaveSettings();
......@@ -89,6 +93,15 @@ namespace FSClient {
private void btnPluginSettings_Click(object sender, RoutedEventArgs e){
broker.edit_plugins();
}
private void btnPathBrowse_Click(object sender, RoutedEventArgs e) {
WF.FolderBrowserDialog dlg = new WF.FolderBrowserDialog();
dlg.SelectedPath = txtRecordingPath.Text;
DialogResult res = dlg.ShowDialog();
if (res != System.Windows.Forms.DialogResult.OK)
return;
txtRecordingPath.Text = dlg.SelectedPath;
}
}
}
......@@ -140,7 +140,7 @@ namespace FSClient {
protected abstract void SetPlugins(IEnumerable<PluginData> plugins);
public virtual void SetPluginEnabled(bool enabled, PluginData plugin){
plugin.enabled = false;
plugin.enabled = enabled;
}
public abstract void Dispose();
}
......
......@@ -187,6 +187,7 @@ namespace FSClient.Properties {
this["EventSocket"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
public global::FSClient.SettingsPluginDataCollection HeadsetPlugins {
......@@ -197,6 +198,7 @@ namespace FSClient.Properties {
this["HeadsetPlugins"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
public global::FSClient.SettingsPluginDataCollection ContactPlugins {
......@@ -207,5 +209,17 @@ namespace FSClient.Properties {
this["ContactPlugins"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("recordings")]
public string RecordingPath {
get {
return ((string)(this["RecordingPath"]));
}
set {
this["RecordingPath"] = value;
}
}
}
}
\ No newline at end of file
}
......@@ -50,5 +50,8 @@
<Setting Name="ContactPlugins" Type="FSClient.SettingsPluginDataCollection" Scope="User">
<Value Profile="(Default)" />
</Setting>
<Setting Name="RecordingPath" Type="System.String" Scope="User">
<Value Profile="(Default)">recordings</Value>
</Setting>
</Settings>
</SettingsFile>
\ No newline at end of file
......@@ -40,6 +40,9 @@
<setting name="SettingsUpgrade" serializeAs="String">
<value>True</value>
</setting>
<setting name="RecordingPath" serializeAs="String">
<value>recordings</value>
</setting>
</FSClient.Properties.Settings>
</userSettings>
</configuration>
Markdown 格式
0% 或
您添加了 0 人 到此讨论。请谨慎行事。
请先完成此评论的编辑!
请 注册 或者 后发表评论