Skip to content

Commit

Permalink
Merge pull request #16 from victor-david/feature-queue-indicator
Browse files Browse the repository at this point in the history
Merge feature-queue-indicator to main
  • Loading branch information
victor-david authored Sep 27, 2024
2 parents e082073 + 203dc3d commit b3ec494
Show file tree
Hide file tree
Showing 14 changed files with 242 additions and 57 deletions.
16 changes: 16 additions & 0 deletions src/Panama.Database/Tables/TitleTable.cs
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,16 @@ public static class Calculated
/// </summary>
public const string RelatedCount = "CalcRelatedCount";

/// <summary>
/// Calculated column that holds the number of queues this title belongs to.
/// </summary>
public const string QueuedCount = "CalcQueuedCount";

/// <summary>
/// Calculated column that indicates if this title belongs to at least one queue.
/// </summary>
public const string IsQueued = "CalcIsQueued";

/// <summary>
/// The name of the submission count column. This calculated column
/// holds the number of related records from the <see cref="SubmissionTable"/>.
Expand Down Expand Up @@ -303,6 +313,12 @@ protected override void UseDataRelations()
expr = string.Format("Count(Child({0}).{1})", Defs.Relations.ToTitleRelated, TitleRelatedTable.Defs.Columns.TitleId);
CreateExpressionColumn<long>(Defs.Columns.Calculated.RelatedCount, expr);

expr = string.Format("Count(Child({0}).{1})", Defs.Relations.ToQueueTitle, QueueTitleTable.Defs.Columns.TitleId);
CreateExpressionColumn<long>(Defs.Columns.Calculated.QueuedCount, expr);

expr = string.Format("Count(Child({0}).{1}) > 0", Defs.Relations.ToQueueTitle, QueueTitleTable.Defs.Columns.TitleId);
CreateExpressionColumn<bool>(Defs.Columns.Calculated.IsQueued, expr);

expr = string.Format("Count(Child({0}).{1})", Defs.Relations.ToSubmission, SubmissionTable.Defs.Columns.Id);
CreateExpressionColumn<long>(Defs.Columns.Calculated.SubCount, expr);

Expand Down
1 change: 1 addition & 0 deletions src/Panama/Core/Config/Config.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1118,6 +1118,7 @@ protected override void OnRowValueChanged(string propertyId)
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyId));
break;
case nameof(IsTitleQueueVisible):
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyId));
MainWindowViewModel.Instance.SynchronizeTitleQueue();
break;
default:
Expand Down
6 changes: 6 additions & 0 deletions src/Panama/Core/Config/ConfigColors.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@ private static class Values
public static readonly Color DataGridAlternationDefault = (Color)ColorConverter.ConvertFromString("#FFCBE4EC");

public static readonly Color TitleReadyDefault = SystemColors.Green;
public static readonly Color TitleQueuedDefault = SystemColors.DodgerBlue;
public static readonly Color TitleFlaggedDefault = SystemColors.Blue;

public static readonly Color TitlePublishedDefault = SystemColors.Red;
public static readonly Color TitleSelfPublishedDefault = SystemColors.Coral;
public static readonly Color TitleSubmittedDefault = SystemColors.Black;
Expand All @@ -47,7 +49,9 @@ private static class Values

#region Public properties
public ConfigColor DataGridAlternation { get; }

public ConfigColor TitleReady { get; }
public ConfigColor TitleQueued { get; }
public ConfigColor TitleFlagged { get; }
public ConfigColor TitlePublished { get; }
public ConfigColor TitleSelfPublished { get; }
Expand Down Expand Up @@ -75,6 +79,7 @@ internal ConfigColors()
DataGridAlternation = new ConfigColor(nameof(DataGridAlternation), Values.DataGridAlternationDefault);

TitleReady = new ConfigColor(nameof(TitleReady), Values.TitleReadyDefault);
TitleQueued = new ConfigColor(nameof(TitleQueued), Values.TitleQueuedDefault);
TitleFlagged = new ConfigColor(nameof(TitleFlagged), Values.TitleFlaggedDefault);
TitlePublished = new ConfigColor(nameof(TitlePublished), Values.TitlePublishedDefault);
TitleSelfPublished = new ConfigColor(nameof(TitleSelfPublished), Values.TitleSelfPublishedDefault);
Expand Down Expand Up @@ -103,6 +108,7 @@ public void Reset()
DataGridAlternation.ResetToDefault();

TitleReady.ResetToDefault();
TitleQueued.ResetToDefault();
TitleFlagged.ResetToDefault();
TitlePublished.ResetToDefault();
TitleSelfPublished.ResetToDefault();
Expand Down
5 changes: 5 additions & 0 deletions src/Panama/Core/Other/FixedWidth.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,11 @@ public class FixedWidth
/// Fixed width of 76.
/// </summary>
public const int W076 = 76;

/// <summary>
/// Fixed width of 86.
/// </summary>
public const int W086 = 86;

/// <summary>
/// Fixed width of 96
Expand Down
2 changes: 1 addition & 1 deletion src/Panama/Panama.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<RootNamespace>Restless.Panama</RootNamespace>
<TargetFramework>net7.0-windows</TargetFramework>
<UseWPF>true</UseWPF>
<Version>4.0.38</Version>
<Version>4.0.39</Version>
</PropertyGroup>

<ItemGroup>
Expand Down
18 changes: 18 additions & 0 deletions src/Panama/Resources/Strings.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions src/Panama/Resources/Strings.resx
Original file line number Diff line number Diff line change
Expand Up @@ -1194,4 +1194,10 @@ Changes will take effect after you restart the application.</value>
<data name="SettingsAutoSortOnUpdated" xml:space="preserve">
<value>Auto sort title list on updated (requires restart)</value>
</data>
<data name="ConfirmationRemoveTitleFromQueue" xml:space="preserve">
<value>This operation removes the title from the selected queue. It does not affect the title itself.</value>
</data>
<data name="MenuItemRemoveFromQueue" xml:space="preserve">
<value>Remove title from selected queue</value>
</data>
</root>
21 changes: 14 additions & 7 deletions src/Panama/View/Title/TitleEditContainer.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,17 @@

<tk:RadioButtonPanel
Margin="0,0,0,8"
tk:Property.ColumnWidths="Auto,Auto,Auto,Auto,Auto,Auto,Auto"
tk:Property.ColumnWidths="Auto,Auto,Auto,Auto,Auto,Auto,Auto,Auto"
SelectedValue="{Binding SelectedEditSection}">

<tk:RadioButton Grid.Column="0" Value="1" Content="Main"/>
<tk:RadioButton Grid.Column="1" Value="2" Content="Tags"/>
<tk:RadioButton Grid.Column="2" Value="3" Content="Version"/>
<tk:RadioButton Grid.Column="3" Value="4" Content="Related"/>
<tk:RadioButton Grid.Column="4" Value="5" Content="Submission"/>
<tk:RadioButton Grid.Column="5" Value="6" Content="Published"/>
<tk:RadioButton Grid.Column="6" Value="7" Content="Preview"/>
<tk:RadioButton Grid.Column="4" Value="5" Content="Queues" tk:Property.IsVisible="{Binding Config.IsTitleQueueVisible}"/>
<tk:RadioButton Grid.Column="5" Value="6" Content="Submission"/>
<tk:RadioButton Grid.Column="6" Value="7" Content="Published"/>
<tk:RadioButton Grid.Column="7" Value="8" Content="Preview"/>
</tk:RadioButtonPanel>

<!-- Main title data -->
Expand All @@ -50,17 +51,23 @@
tk:Property.IsLongVisible="{Binding SelectedEditSection}"
tk:Property.IsLongVisibleValue="4"/>

<!-- Queues -->
<vw:TitleEditQueue
Grid.Row="1"
tk:Property.IsLongVisible="{Binding SelectedEditSection}"
tk:Property.IsLongVisibleValue="5"/>

<!-- Submissions -->
<vw:TitleEditSubmission
Grid.Row="1"
tk:Property.IsLongVisible="{Binding SelectedEditSection}"
tk:Property.IsLongVisibleValue="5"/>
tk:Property.IsLongVisibleValue="6"/>

<!-- Published -->
<vw:TitleEditPublished
Grid.Row="1"
tk:Property.IsLongVisible="{Binding SelectedEditSection}"
tk:Property.IsLongVisibleValue="6"/>
tk:Property.IsLongVisibleValue="7"/>

<!-- Preview -->
<vw:PreviewPanel
Expand All @@ -69,6 +76,6 @@
PreviewMode="{Binding PreviewMode}"
PreviewText="{Binding PreviewText}"
tk:Property.IsLongVisible="{Binding SelectedEditSection}"
tk:Property.IsLongVisibleValue="7"/>
tk:Property.IsLongVisibleValue="8"/>

</Grid>
25 changes: 25 additions & 0 deletions src/Panama/View/Title/TitleEditQueue.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<Grid
x:Class="Restless.Panama.View.TitleEditQueue"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:tk="http://schemas.restless.toolkit.com/2021"
xmlns:vm="clr-namespace:Restless.Panama.ViewModel"
d:DataContext="{d:DesignInstance Type=vm:TitleViewModel}"
mc:Ignorable="d"
tk:Property.RowHeights="*"
d:DesignHeight="600" d:DesignWidth="360">

<tk:DataGrid
ItemsSource="{Binding Queue.ListView}"
SelectedItem="{Binding Queue.SelectedItem}"
tk:DataGridColumns.Columns="{Binding Queue.Columns}">

<DataGrid.ContextMenu>
<ContextMenu ItemsSource="{Binding Queue.MenuItems}"/>
</DataGrid.ContextMenu>

</tk:DataGrid>

</Grid>
15 changes: 15 additions & 0 deletions src/Panama/View/Title/TitleEditQueue.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
using System.Windows.Controls;

namespace Restless.Panama.View
{
/// <summary>
/// Interaction logic for TitleEditQueue.xaml
/// </summary>
public partial class TitleEditQueue : Grid
{
public TitleEditQueue()
{
InitializeComponent();
}
}
}
21 changes: 13 additions & 8 deletions src/Panama/View/Title/TitleFlagsToolTip.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
d:DataContext="{d:DesignInstance Type=vm:TitleViewModel}"
mc:Ignorable="d"
tk:Property.ColumnWidths="Auto,*"
tk:Property.RowHeights="Auto,Auto,Auto,Auto,Auto,Auto"
tk:Property.RowHeights="Auto,Auto,Auto,Auto,Auto,Auto,Auto"
d:DesignHeight="135" d:DesignWidth="180">

<Grid.Resources>
Expand All @@ -23,18 +23,22 @@

<Border
Grid.Row="2"
Background="{Binding Config.Colors.TitleQueued.ColorBrush}"/>

<Border
Grid.Row="3"
Background="{Binding Config.Colors.TitleFlagged.ColorBrush}"/>

<Border
Grid.Row="3"
Grid.Row="4"
Background="{Binding Config.Colors.TitlePublished.ColorBrush}"/>

<Border
Grid.Row="4"
Grid.Row="5"
Background="{Binding Config.Colors.TitleSelfPublished.ColorBrush}"/>

<Border
Grid.Row="5"
Grid.Row="6"
Background="{Binding Config.Colors.TitleSubmitted.ColorBrush}"/>

<TextBlock
Expand All @@ -43,8 +47,9 @@
Text="Title flags"/>

<TextBlock Grid.Row="1" Grid.Column="1" Text="Ready"/>
<TextBlock Grid.Row="2" Grid.Column="1" Text="Flagged"/>
<TextBlock Grid.Row="3" Grid.Column="1" Text="Published"/>
<TextBlock Grid.Row="4" Grid.Column="1" Text="Self published"/>
<TextBlock Grid.Row="5" Grid.Column="1" Text="Submitted"/>
<TextBlock Grid.Row="2" Grid.Column="1" Text="Queued"/>
<TextBlock Grid.Row="3" Grid.Column="1" Text="Flagged"/>
<TextBlock Grid.Row="4" Grid.Column="1" Text="Published"/>
<TextBlock Grid.Row="5" Grid.Column="1" Text="Self published"/>
<TextBlock Grid.Row="6" Grid.Column="1" Text="Submitted"/>
</Grid>
25 changes: 15 additions & 10 deletions src/Panama/View/Tool/SettingsWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
ResizeMode="NoResize"
Title="{x:Static r:Strings.MenuItemSettings}"
Style="{StaticResource DefaultAppWindowStyle}"
Height="702" Width="602">
Height="702" Width="622">

<Grid
tk:Property.ColumnWidths="126,*"
Expand Down Expand Up @@ -112,29 +112,34 @@
Header="Title"
IsExpanded="{Binding Config.IsSettingTitleColorExpanded}">

<Grid tk:Property.ColumnWidths="*,*,*,*,*">
<Grid tk:Property.ColumnWidths="*,*,*,*,*,*">

<con:SimpleColorPickerWrapper
Header="Ready"
Color="{Binding Config.Colors.TitleReady.Color}"/>

<con:SimpleColorPickerWrapper
Grid.Column="1"
Header="Queued"
Color="{Binding Config.Colors.TitleQueued.Color}"/>

<con:SimpleColorPickerWrapper
Grid.Column="2"
Header="Flagged"
Color="{Binding Config.Colors.TitleFlagged.Color}"/>

<con:SimpleColorPickerWrapper
Grid.Column="2"
Grid.Column="3"
Header="Published"
Color="{Binding Config.Colors.TitlePublished.Color}"/>

<con:SimpleColorPickerWrapper
Grid.Column="3"
Header="Self Published"
Grid.Column="4"
Header="Self"
Color="{Binding Config.Colors.TitleSelfPublished.Color}"/>

<con:SimpleColorPickerWrapper
Grid.Column="4"
Grid.Column="5"
Header="Submitted"
Color="{Binding Config.Colors.TitleSubmitted.Color}"/>
</Grid>
Expand All @@ -146,7 +151,7 @@
Header="Publisher"
IsExpanded="{Binding Config.IsSettingPublisherColorExpanded}">

<Grid tk:Property.ColumnWidths="*,*,*,*,*">
<Grid tk:Property.ColumnWidths="*,*,*,*,*,*">

<con:SimpleColorPickerWrapper
Header="Exclusive"
Expand Down Expand Up @@ -181,7 +186,7 @@
Header="Submission"
IsExpanded="{Binding Config.IsSettingSubmissionColorExpanded}">

<Grid tk:Property.ColumnWidths="*,*,*,*,*">
<Grid tk:Property.ColumnWidths="*,*,*,*,*,*">

<con:SimpleColorPickerWrapper
Header="Online"
Expand All @@ -205,7 +210,7 @@
Header="Other"
IsExpanded="{Binding Config.IsSettingOtherColorExpanded}">

<Grid tk:Property.ColumnWidths="*,*,*,*,*">
<Grid tk:Property.ColumnWidths="*,*,*,*,*,*">

<con:SimpleColorPickerWrapper
Header="Alternation"
Expand Down
Loading

0 comments on commit b3ec494

Please sign in to comment.