Skip to content

Commit

Permalink
Add a subtitle to the titlebar to show various info, such as "run as …
Browse files Browse the repository at this point in the history
…admin", "debug build", etc
  • Loading branch information
marticliment committed Feb 8, 2025
1 parent 104de8d commit 1d5007b
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 5 deletions.
1 change: 1 addition & 0 deletions src/UniGetUI.Core.Data/CoreData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ public static HttpClientHandler GenericHttpClientParameters
}

private static bool? IS_PORTABLE;
public static bool IsPortable { get => IS_PORTABLE ?? false; }

/// <summary>
/// The directory where all the user data is stored. The directory is automatically created if it does not exist.
Expand Down
3 changes: 2 additions & 1 deletion src/UniGetUI/MainWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@
<BitmapImage DecodePixelHeight="16" UriSource="ms-appx:///Assets/Images/icon.png"/>
</Image.Source>
</Image>
<widgets:TranslatedTextBlock x:Name="AppTitle" Text="WingetUI" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" FontSize="12"/>
<TextBlock x:Name="AppTitle" Text="UniGetUI" VerticalAlignment="Stretch" HorizontalAlignment="Center" FontSize="12"/>
<TextBlock x:Name="AppSubTitle" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" FontSize="12" Opacity="0.8"/>
</StackPanel>
</Border>
<StackPanel Grid.Row="1" Spacing="0" Padding="0" Margin="0,-4,0,0">
Expand Down
26 changes: 22 additions & 4 deletions src/UniGetUI/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -75,14 +75,18 @@ public MainWindow()

if (CoreTools.IsAdministrator())
{
Title = "UniGetUI " + CoreTools.Translate("[RAN AS ADMINISTRATOR]");
AppTitle.Text = Title;
AddToSubtitle(CoreTools.Translate("[RAN AS ADMINISTRATOR]"));
}

if (CoreData.IsPortable)
{
AddToSubtitle(CoreTools.Translate("Portable mode"));
}

#if DEBUG
Title = Title + " - DEBUG BUILD";
AppTitle.Text = Title;
AddToSubtitle(CoreTools.Translate("DEBUG BUILD"));
#endif

var panel = new StackPanel
{
Width = 400,
Expand Down Expand Up @@ -149,6 +153,20 @@ public MainWindow()
}
}

private void AddToSubtitle(string line)
{
if (AppSubTitle.Text.Length > 0)
AppSubTitle.Text += " - ";
AppSubTitle.Text += line;
Title = "UniGetUI - " + AppSubTitle.Text;
}

private void ClearSubtitle()
{
AppSubTitle.Text = "";
Title = "UniGetUI";
}

private static void TransferOldSettingsFormats()
{
foreach (IPackageManager Manager in PEInterface.Managers)
Expand Down

0 comments on commit 1d5007b

Please sign in to comment.