Skip to content

Commit

Permalink
Studio Views: Added UI elements and updated filters
Browse files Browse the repository at this point in the history
  • Loading branch information
Impertatore committed Jan 8, 2021
1 parent df9d1bd commit f64bb6b
Show file tree
Hide file tree
Showing 28 changed files with 2,251 additions and 58 deletions.
9 changes: 9 additions & 0 deletions StudioViews/StudioViews/Model/AnalysisBand.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
namespace StudioViews.Model
{
public class AnalysisBand
{
public int MinimumMatchValue { get; set; }

public int MaximumMatchValue { get; set; }
}
}
9 changes: 9 additions & 0 deletions StudioViews/StudioViews/Model/ConfirmationStatus.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
namespace StudioViews.Model
{
public class ConfirmationStatus
{
public string Id { get; set; }

public string Name { get; set; }
}
}
167 changes: 167 additions & 0 deletions StudioViews/StudioViews/Model/FilterItem.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,167 @@
using System;
using System.Drawing;
using System.Windows.Media.Imaging;
using System.Xml.Serialization;
using Sdl.MultiSelectComboBox.API;
using StudioViews.ViewModel;

namespace StudioViews.Model
{
public class FilterItem : BaseModel, IItemEnabledAware, IItemGroupAware
{
private string _id;
private string _name;
private bool _isEnabled;
private int _selectedOrder;
private IItemGroup _group;
private BitmapImage _image;
private Size _imageSize;

public FilterItem()
{
_isEnabled = true;
_selectedOrder = -1;
_imageSize = new Size(2, 24);
}

/// <summary>
/// Unique id in the collection
/// </summary>
public string Id
{
get => _id;
set
{
if (_id != null && string.Compare(_id, value, StringComparison.InvariantCulture) == 0)
{
return;
}

_id = value;
OnPropertyChanged(nameof(Id));
}
}

/// <summary>
/// The item name.
///
/// The filter criteria is applied on this property when using the default filter service.
/// </summary>
public string Name
{
get => _name;
set
{
if (_name != null && string.Compare(_name, value, StringComparison.InvariantCulture) == 0)
{
return;
}

_name = value;
OnPropertyChanged(nameof(Name));
}
}

/// <summary>
/// Identifies whether the item is enabled or not.
///
/// When the item is not enabled, then it will not be selectable from the dropdown list and removed
/// from the selected items automatically.
/// </summary>
public bool IsEnabled
{
get => _isEnabled;
set
{
if (_isEnabled.Equals(value))
{
return;
}

_isEnabled = value;
OnPropertyChanged(nameof(IsEnabled));
}
}

/// <summary>
/// The order in which the items are added to the selected collection.
///
/// This order is independent to the group and sort order of the items in the collection. This selected
/// order is visible in each of the selected items from the dropdown list and visually represented by
/// the order of the items in the Selected Items Panel.
/// </summary>
public int SelectedOrder
{
get => _selectedOrder;
set
{
if (_selectedOrder.Equals(value))
{
return;
}

_selectedOrder = value;
OnPropertyChanged(nameof(SelectedOrder));
}
}

/// <summary>
/// Identifies the name and order of the group header
/// </summary>
public IItemGroup Group
{
get => _group;
set
{
if (_group != null && _group.Equals(value))
{
return;
}

_group = value;
OnPropertyChanged(nameof(Group));
}
}

/// <summary>
/// The item Image.
///
/// Use the ImageSize to identify the space required to display the image in the view.
/// </summary>
[XmlIgnore]
public BitmapImage Image
{
get => _image;
set
{
_image = value;
OnPropertyChanged(nameof(Image));
}
}

/// <summary>
/// The image size.
///
/// Measures the width and height that is required to display the image.
/// </summary>
public Size ImageSize
{
get => _imageSize;
set
{
if (_imageSize.Equals(value))
{
return;
}

_imageSize = value;
OnPropertyChanged(nameof(ImageSize));
}
}

public override string ToString()
{
return Name;
}
}
}
38 changes: 38 additions & 0 deletions StudioViews/StudioViews/Model/FilterItemGroup.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
using Sdl.MultiSelectComboBox.API;
using StudioViews.ViewModel;

namespace StudioViews.Model
{
public class FilterItemGroup : BaseModel, IItemGroup
{
private int _order;

public FilterItemGroup(int index, string name)
{
Order = index;
Name = name;
}

public int Order
{
get => _order;
set
{
if (_order.Equals(value))
{
return;
}

_order = value;
OnPropertyChanged(nameof(Order));
}
}

public string Name { get; }

public override string ToString()
{
return Name;
}
}
}
6 changes: 1 addition & 5 deletions StudioViews/StudioViews/Model/ProjectFileInfo.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Collections.Generic;

namespace StudioViews.Model
{
Expand Down
25 changes: 24 additions & 1 deletion StudioViews/StudioViews/Services/ContentReader.cs
Original file line number Diff line number Diff line change
@@ -1,23 +1,46 @@
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using Sdl.FileTypeSupport.Framework.BilingualApi;

namespace StudioViews.Services
{
public class ContentReader : AbstractBilingualContentProcessor
{
private IFileProperties _fileProperties;
private IDocumentProperties _documentProperties;

public ContentReader()
{
ParagraphUnits = new List<IParagraphUnit>();
}

public List<IParagraphUnit> ParagraphUnits { get; }

public CultureInfo SourceLanguage { get; private set; }

public CultureInfo TargetLanguage { get; private set; }

public override void Initialize(IDocumentProperties documentInfo)
{
_documentProperties = documentInfo;

SourceLanguage = documentInfo.SourceLanguage.CultureInfo;
TargetLanguage = documentInfo.TargetLanguage?.CultureInfo ?? SourceLanguage;

base.Initialize(documentInfo);
}

public override void SetFileProperties(IFileProperties fileInfo)
{
_fileProperties = fileInfo;
base.SetFileProperties(fileInfo);
}

public override void ProcessParagraphUnit(IParagraphUnit paragraphUnit)
{
if (paragraphUnit.IsStructure || !paragraphUnit.SegmentPairs.Any())
{
base.ProcessParagraphUnit(paragraphUnit);
return;
}

Expand Down
2 changes: 0 additions & 2 deletions StudioViews/StudioViews/Services/FileInfoService.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Xml;
using System.Xml.Linq;
using StudioViews.Model;
Expand Down
Loading

0 comments on commit f64bb6b

Please sign in to comment.