Skip to content

Commit 67047c0

Browse files
committed
Add about page
1 parent 6951bf8 commit 67047c0

18 files changed

Lines changed: 1290 additions & 27 deletions

LICENSE.txt

Lines changed: 674 additions & 0 deletions
Large diffs are not rendered by default.

YtFlowApp/AboutPage.cpp

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
#include "pch.h"
2+
#include "AboutPage.h"
3+
#if __has_include("AboutPage.g.cpp")
4+
#include "AboutPage.g.cpp"
5+
#endif
6+
7+
#include "CoreFfi.h"
8+
#include "winrt/Windows.System.h"
9+
10+
using namespace winrt;
11+
using namespace Windows::Foundation;
12+
using namespace Windows::UI::Xaml;
13+
14+
namespace winrt::YtFlowApp::implementation
15+
{
16+
void AboutPage::Page_Loaded(IInspectable const &, RoutedEventArgs const &)
17+
{
18+
CoreVersionText().Text(to_hstring(GetYtFlowCoreVersion()));
19+
auto const pkgVer = Windows::ApplicationModel::Package::Current().Id().Version();
20+
auto pkgVerStr = to_hstring(pkgVer.Major) + L"." + to_hstring(pkgVer.Minor) + L"." + to_hstring(pkgVer.Build) +
21+
L"." + to_hstring(pkgVer.Revision);
22+
PackageVersionText().Text(std::move(pkgVerStr));
23+
}
24+
25+
fire_and_forget AboutPage::LicenseButton_Click(IInspectable const &, RoutedEventArgs const &)
26+
{
27+
auto const lifetime = get_strong();
28+
// .txt files do not work.
29+
auto const file =
30+
co_await Windows::Storage::StorageFile::GetFileFromApplicationUriAsync(Uri{L"ms-appx:///third_party.md"});
31+
co_await resume_foreground(lifetime->Dispatcher());
32+
Windows::System::LauncherOptions const options;
33+
options.DisplayApplicationPicker(true);
34+
co_await Windows::System::Launcher::LaunchFileAsync(file, options);
35+
}
36+
37+
}

YtFlowApp/AboutPage.h

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#pragma once
2+
3+
#include "AboutPage.g.h"
4+
5+
namespace winrt::YtFlowApp::implementation
6+
{
7+
struct AboutPage : AboutPageT<AboutPage>
8+
{
9+
AboutPage()
10+
{
11+
// Xaml objects should not call InitializeComponent during construction.
12+
// See https://github.com/microsoft/cppwinrt/tree/master/nuget#initializecomponent
13+
}
14+
15+
void Page_Loaded(winrt::Windows::Foundation::IInspectable const &sender,
16+
winrt::Windows::UI::Xaml::RoutedEventArgs const &e);
17+
fire_and_forget LicenseButton_Click(winrt::Windows::Foundation::IInspectable const &sender,
18+
winrt::Windows::UI::Xaml::RoutedEventArgs const &e);
19+
};
20+
}
21+
22+
namespace winrt::YtFlowApp::factory_implementation
23+
{
24+
struct AboutPage : AboutPageT<AboutPage, implementation::AboutPage>
25+
{
26+
};
27+
}

YtFlowApp/AboutPage.xaml

Lines changed: 128 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,128 @@
1+
<Page
2+
x:Class="YtFlowApp.AboutPage"
3+
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
4+
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
5+
xmlns:local="using:YtFlowApp"
6+
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
7+
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
8+
mc:Ignorable="d"
9+
NavigationCacheMode="Enabled"
10+
Loaded="Page_Loaded">
11+
<Page.Resources>
12+
<Style TargetType="Grid" x:Key="AboutItemContainerStyle">
13+
<Setter Property="Padding" Value="18" />
14+
<Setter Property="Background" Value="{ThemeResource LayerFillColorDefaultBrush}" />
15+
<Setter Property="CornerRadius" Value="{StaticResource AppControlCornerRadius}" />
16+
<Setter Property="BorderThickness" Value="1" />
17+
<Setter Property="BorderBrush" Value="{ThemeResource CardStrokeColorDefaultBrush}" />
18+
<Setter Property="Margin" Value="0, 0, 0, 4" />
19+
</Style>
20+
<Style TargetType="TextBlock" x:Key="AboutItemValueStyle">
21+
<Setter Property="Foreground" Value="{ThemeResource SystemControlPageTextBaseMediumBrush}" />
22+
</Style>
23+
</Page.Resources>
24+
25+
<ScrollViewer x:Name="MainScrollViewer" Margin="16, 0, 16, 0">
26+
<Grid>
27+
<Grid.RowDefinitions>
28+
<RowDefinition Height="Auto" />
29+
<RowDefinition Height="Auto" />
30+
<RowDefinition Height="Auto" />
31+
</Grid.RowDefinitions>
32+
<Grid.ColumnDefinitions>
33+
<ColumnDefinition />
34+
<ColumnDefinition x:Name="SideColumn" Width="0" />
35+
</Grid.ColumnDefinitions>
36+
<ContentControl
37+
x:Name="HeaderControl"
38+
Grid.Row="0"
39+
Grid.ColumnSpan="2"
40+
Margin="0, 0, 0, 16"
41+
Style="{ThemeResource NavigationViewTitleHeaderContentControlTextStyle}"
42+
Height="48"
43+
>
44+
About
45+
</ContentControl>
46+
47+
<StackPanel x:Name="SidePanel" Grid.Row="2">
48+
<Image
49+
Source="ms-appx:///Assets/Square150x150Logo.png"
50+
HorizontalAlignment="Center"
51+
Width="150"
52+
/>
53+
<TextBlock
54+
Text="© YtFlow contributors"
55+
Foreground="{ThemeResource SystemControlPageTextBaseMediumBrush}"
56+
HorizontalAlignment="Center"
57+
/>
58+
<TextBlock
59+
Text="Logo by annoymous-hentai"
60+
Foreground="{ThemeResource SystemControlPageTextBaseMediumBrush}"
61+
HorizontalAlignment="Center"
62+
/>
63+
</StackPanel>
64+
<StackPanel x:Name="MainPanel" Grid.Row="1">
65+
<Grid Style="{StaticResource AboutItemContainerStyle}">
66+
<Grid.RowDefinitions>
67+
<RowDefinition />
68+
<RowDefinition />
69+
</Grid.RowDefinitions>
70+
<Grid.ColumnDefinitions>
71+
<ColumnDefinition Width="*" />
72+
<ColumnDefinition Width="Auto" />
73+
</Grid.ColumnDefinitions>
74+
<TextBlock Grid.Column="0" Grid.Row="0" Text="YtFlow" />
75+
<TextBlock x:Name="PackageVersionText" Grid.Column="0" Grid.Row="1" Style="{StaticResource AboutItemValueStyle}" />
76+
<HyperlinkButton
77+
Grid.Column="1"
78+
Grid.RowSpan="2"
79+
NavigateUri="https://github.com/YtFlow/YtFlowApp/tree/next"
80+
Content="View on GitHub"
81+
/>
82+
</Grid>
83+
<Grid Style="{StaticResource AboutItemContainerStyle}">
84+
<Grid.RowDefinitions>
85+
<RowDefinition />
86+
<RowDefinition />
87+
</Grid.RowDefinitions>
88+
<Grid.ColumnDefinitions>
89+
<ColumnDefinition Width="*" />
90+
<ColumnDefinition Width="Auto" />
91+
</Grid.ColumnDefinitions>
92+
<TextBlock Grid.Column="0" Grid.Row="0" Text="YtFlowCore" />
93+
<TextBlock x:Name="CoreVersionText" Grid.Column="0" Grid.Row="1" Style="{StaticResource AboutItemValueStyle}" />
94+
<HyperlinkButton
95+
Grid.Column="1"
96+
Grid.RowSpan="2"
97+
NavigateUri="https://github.com/YtFlow/YtFlowCore"
98+
Content="View on GitHub"
99+
/>
100+
</Grid>
101+
<Button Content="Third-Party Licenses..." Margin="0, 16, 0, 0" Click="LicenseButton_Click" />
102+
</StackPanel>
103+
</Grid>
104+
<VisualStateManager.VisualStateGroups>
105+
<VisualStateGroup>
106+
<VisualState>
107+
<VisualState.StateTriggers>
108+
<AdaptiveTrigger MinWindowWidth="{StaticResource MediumAdaptiveWidth}" />
109+
</VisualState.StateTriggers>
110+
<VisualState.Setters>
111+
<Setter Target="HeaderControl.Margin" Value="12, 44, 0, 0" />
112+
<Setter Target="HeaderControl.Height" Value="80" />
113+
<Setter Target="SideColumn.Width" Value="200" />
114+
<Setter Target="SidePanel.(Grid.Column)" Value="1" />
115+
<Setter Target="SidePanel.(Grid.ColumnSpan)" Value="1" />
116+
<Setter Target="SidePanel.(Grid.Row)" Value="1" />
117+
<Setter Target="MainPanel.(Grid.Column)" Value="0" />
118+
<Setter Target="MainPanel.(Grid.ColumnSpan)" Value="1" />
119+
<Setter Target="MainPanel.(Grid.Row)" Value="1" />
120+
<Setter Target="MainPanel.Margin" Value="0, 0, 16, 0" />
121+
<Setter Target="MainScrollViewer.Margin" Value="40, 0, 40, 0" />
122+
</VisualState.Setters>
123+
</VisualState>
124+
</VisualStateGroup>
125+
</VisualStateManager.VisualStateGroups>
126+
</ScrollViewer>
127+
</Page>
128+

YtFlowApp/App.idl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,10 @@ namespace YtFlowApp
7676
get;
7777
};
7878
}
79+
[default_interface] runtimeclass AboutPage : Windows.UI.Xaml.Controls.Page
80+
{
81+
AboutPage();
82+
}
7983

8084
[default_interface] runtimeclass HomeProfileControl : Windows.UI.Xaml.Controls.UserControl
8185
{

YtFlowApp/App.xaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010
<XamlControlsResources xmlns="using:Microsoft.UI.Xaml.Controls" />
1111
<ResourceDictionary>
1212
<x:Double x:Key="MediumAdaptiveWidth">600</x:Double>
13+
<CornerRadius x:Key="AppControlCornerRadius">4</CornerRadius>
14+
<CornerRadius x:Key="AppOverlayCornerRadius">8</CornerRadius>
1315
<Thickness x:Key="PluginWidgetMargin">0, 0, 0, 8</Thickness>
1416
<Thickness x:Key="PluginWidgetIconMargin">10, 25, 20, 25</Thickness>
1517
<Style x:Key="PluginWidgetPluginNameStyle" TargetType="TextBlock">

YtFlowApp/CoreFfi.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -215,4 +215,8 @@ namespace winrt::YtFlowApp::implementation
215215
unwrap_ffi_result<FfiNoop>(ytflow_core::ytflow_db_conn_free(conn_ptr));
216216
}
217217
}
218+
std::string GetYtFlowCoreVersion()
219+
{
220+
return std::string(ytflow_core::ytflow_get_version());
221+
}
218222
}

YtFlowApp/CoreFfi.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,4 +157,5 @@ namespace winrt::YtFlowApp::implementation
157157
ytflow_core::Database *db_ptr{nullptr};
158158
};
159159
inline FfiDb FfiDbInstance;
160+
std::string GetYtFlowCoreVersion();
160161
}

YtFlowApp/ForwardHomeWidget.xaml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -34,18 +34,18 @@
3434
Padding="18"
3535
Margin="{StaticResource PluginWidgetMargin}"
3636
Background="{ThemeResource LayerFillColorDefaultBrush}"
37-
CornerRadius="8"
37+
CornerRadius="{StaticResource AppControlCornerRadius}"
3838
BorderThickness="1"
3939
BorderBrush="{ThemeResource CardStrokeColorDefaultBrush}"
4040
>
4141
<Grid.RowDefinitions>
42-
<RowDefinition />
43-
<RowDefinition />
44-
<RowDefinition />
45-
<RowDefinition />
46-
<RowDefinition />
47-
<RowDefinition />
48-
<RowDefinition />
42+
<RowDefinition Height="Auto" />
43+
<RowDefinition Height="Auto" />
44+
<RowDefinition Height="Auto" />
45+
<RowDefinition Height="Auto" />
46+
<RowDefinition Height="Auto" />
47+
<RowDefinition Height="Auto" />
48+
<RowDefinition Height="Auto" />
4949
</Grid.RowDefinitions>
5050
<Grid.ColumnDefinitions>
5151
<ColumnDefinition Width="3*" />

YtFlowApp/HomePage.xaml

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@
5353
Grid.ColumnSpan="2"
5454
Padding="18"
5555
Background="{ThemeResource LayerFillColorDefaultBrush}"
56-
CornerRadius="8"
56+
CornerRadius="{StaticResource AppControlCornerRadius}"
5757
BorderThickness="1"
5858
BorderBrush="{ThemeResource CardStrokeColorDefaultBrush}"
5959
>
@@ -112,7 +112,7 @@
112112
<local:HomeProfileControl
113113
VerticalAlignment="Stretch"
114114
HorizontalAlignment="Stretch"
115-
Margin="0, 0, 0, 16"
115+
Margin="0, 0, 0, 4"
116116
Profile="{x:Bind}"
117117
ConnectRequested="OnConnectRequested"
118118
EditRequested="OnEditRequested"
@@ -131,9 +131,15 @@
131131
x:Name="SidePanel"
132132
Grid.Row="1"
133133
Grid.Column="0"
134-
Margin="14, 0, 16, 0"
134+
Margin="14, 8, 16, 0"
135135
>
136-
<TextBlock Style="{ThemeResource SubtitleTextBlockStyle}" Margin="4, 0, 0, 16">Add a Profile</TextBlock>
136+
<TextBlock
137+
x:Name="AddProfileLabel"
138+
Style="{ThemeResource SubtitleTextBlockStyle}"
139+
Margin="4, 0, 0, 16"
140+
>
141+
Add a Profile
142+
</TextBlock>
137143
<Button HorizontalAlignment="Stretch" Click="CreateProfileButton_Click" Height="48">
138144
<StackPanel Orientation="Horizontal">
139145
<FontIcon FontFamily="Segoe MDL2 Assets" Glyph="&#xE7B8;" />

0 commit comments

Comments
 (0)