Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WinUI + More #625

Merged
merged 70 commits into from
Nov 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
70 commits
Select commit Hold shift + click to select a range
ea9ecb2
Add WinUI Proj
nlogozzo Oct 11, 2023
a22761e
Shared - Use Aura ApplicationCache Dir
nlogozzo Oct 11, 2023
d7df92b
Create winui.yml
nlogozzo Oct 11, 2023
6592426
All - Update Aura
nlogozzo Oct 11, 2023
1257ad5
WinUI - Use Python311
nlogozzo Oct 11, 2023
2d6e395
All - Cleanup
nlogozzo Oct 11, 2023
0431b9a
All - Better Documentation Links
nlogozzo Oct 11, 2023
22f0ccf
WinUI - Network Notifications
nlogozzo Oct 11, 2023
58111ff
WinUI - Don't Use Embedded Python -> Bundle With Installer
nlogozzo Oct 11, 2023
92ff9dc
Shared - Install Python Modules On Windows
nlogozzo Oct 11, 2023
d7b496d
Shared - Ensure modules stay up-to-date
nlogozzo Oct 11, 2023
a4bf0c6
WinUI - (WIP) SettingsDialog
nlogozzo Oct 11, 2023
96c97a8
All - Update ytdlp
nlogozzo Oct 11, 2023
ee20c5a
Winui - Finish SettingsDialog
nlogozzo Oct 11, 2023
554e781
All - AriaMaxConnectionsPerServer Should Be Max 16
nlogozzo Oct 12, 2023
ded6511
WinUI - Add Blank Menu Items
nlogozzo Oct 12, 2023
cbdea71
All - HistoryDialog
nlogozzo Oct 12, 2023
c94075d
All - Better Getting Of Debugging Information
nlogozzo Oct 12, 2023
43b813d
All - Update ytdlp
nlogozzo Oct 14, 2023
8f41c99
Update InnoSetupScript.iss
nlogozzo Oct 16, 2023
ff1130e
WinUI - Installer ShortName For Shortcut
nlogozzo Oct 16, 2023
5bc50cd
Update .gitattributes
nlogozzo Oct 17, 2023
dbc5671
WinUI - Better StatusPage Control
nlogozzo Oct 18, 2023
de4ec2f
GNOME - KeyringDialog Improvements
nlogozzo Oct 18, 2023
3fd632c
WinUI - (WIP) Start KeyringDialog
nlogozzo Oct 18, 2023
90be57e
WinUI - Implement KeyringDialog
nlogozzo Oct 18, 2023
24da3ac
WinUI - KeyringDialog Improvements
nlogozzo Oct 18, 2023
28dfec6
WinUI - (WIP) Start AddDownloadDialog
nlogozzo Oct 18, 2023
1f89c8d
WinUI - Better ViewStack Control
nlogozzo Oct 18, 2023
afd1620
All - Cleanup
nlogozzo Oct 18, 2023
707ecb6
WinUI - AddDownloadDialog Finish Validation
nlogozzo Oct 18, 2023
f38b2e0
WinUI - Better HomePage
nlogozzo Oct 18, 2023
ea51f0d
All - Update Packages
nlogozzo Oct 25, 2023
d655a24
GNOME - Cleanup
nlogozzo Oct 27, 2023
6caeff1
Shared - Cleanup
nlogozzo Oct 27, 2023
8ebd690
Update AddDownloadDialog.cs
nlogozzo Oct 27, 2023
b10b64b
WinUI - Finish AddDownloadDialog
nlogozzo Oct 27, 2023
ff53bd7
WinUI - Empty Handlers + Prevent Suspend + Window Closing
nlogozzo Oct 28, 2023
11575ad
WinUI - DownloadsPage
nlogozzo Oct 29, 2023
dc00d87
WinUI - DownloadRow
nlogozzo Oct 29, 2023
f46d74e
WinUI - Implement Downloads
nlogozzo Oct 29, 2023
b39ff8c
Update MainWindow.cs
nlogozzo Oct 29, 2023
02e7ded
WinUI - Cleanup
nlogozzo Oct 29, 2023
03183d1
WinUI - AddDownloadDialog Enter To Validate
nlogozzo Oct 29, 2023
c8edec2
Update DownloadRow.xaml
nlogozzo Oct 29, 2023
8e24790
WinUI - Better Closing
nlogozzo Oct 30, 2023
5db2733
WinUI Remove Run in Background + All Update Aura
nlogozzo Oct 30, 2023
3b69f50
WinUI - Home Help Label
nlogozzo Oct 30, 2023
cc51be6
WinUI - Tray Icon
nlogozzo Oct 30, 2023
bb683b1
WinUI - Single App Instance
nlogozzo Oct 30, 2023
8c7e528
Shared - Update Ver
nlogozzo Oct 30, 2023
a53d24e
All - Fix Using Double.NaN
nlogozzo Oct 30, 2023
05aba74
WinUI - Tray Icon Tweaks
nlogozzo Nov 1, 2023
5ef92d3
WinUI - Better DownloadRow Logging
nlogozzo Nov 1, 2023
e5ffdd2
WinUI - Fix Clipboard Crash
nlogozzo Nov 1, 2023
6a3d455
All - Improve Row Labels
nlogozzo Nov 1, 2023
8d62274
WinUI - New Design
nlogozzo Nov 1, 2023
577334c
WinUI - More Design Tweaks
nlogozzo Nov 1, 2023
1047277
All - Cleanup
nlogozzo Nov 1, 2023
78c0763
WinUI - Add StatusPages For Empty Sections
nlogozzo Nov 2, 2023
107e334
All - Don't Show Download Timeframe If Duration <= 0
nlogozzo Nov 2, 2023
0734fd4
Merge branch 'main' into winui
nlogozzo Nov 2, 2023
0c7abf9
All - Update Translations
nlogozzo Nov 2, 2023
5488342
Update MainWindow.xaml
nlogozzo Nov 2, 2023
b04c712
WinUI - Update Screenshots
nlogozzo Nov 2, 2023
71f61c9
Update CONTRIBUTING.md
nlogozzo Nov 2, 2023
230b61d
Update InnoSetupScript.iss
nlogozzo Nov 2, 2023
308ec52
Update DownloadRow.xaml
nlogozzo Nov 2, 2023
0509893
Merge branch 'main' into winui
nlogozzo Nov 3, 2023
5e07d41
Update ta.po
nlogozzo Nov 3, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
# Auto detect text files and perform LF normalization
* text=auto
* text eol=lf
*.csproj eol=crlf
*.sln eol=crlf
*.png binary
*.jpg binary
*.ico binary
*.pdf binary
*.exe binary
# Exclude Docs From Stats
NickvisionTubeConverter.Shared/Docs/** linguist-documentation
48 changes: 48 additions & 0 deletions .github/workflows/winui.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
types: [ "review_requested", "ready_for_review" ]
workflow_dispatch:
name: WinUI
jobs:
gnome-flatpak:
name: "WinUI on Windows"
runs-on: windows-latest
if: ${{ github.event.pull_request.user.login != 'weblate' }}
strategy:
matrix:
configuration: [Debug] #release doesn't work for some reason
platform: [x64, arm64]
env:
Project_Path: NickvisionTubeConverter.WinUI/NickvisionTubeConverter.WinUI.csproj
steps:
- uses: actions/[email protected]
with:
submodules: recursive
# Install the .NET Core workload
- name: Install .NET Core
uses: actions/[email protected]
with:
dotnet-version: 7.0.x
# Add MSBuild to the PATH: https://github.com/microsoft/setup-msbuild
- name: Setup MSBuild.exe
uses: microsoft/[email protected]
# Restore the application to populate the obj folder with RuntimeIdentifiers
- name: Restore the application
run: msbuild $env:Project_Path /t:Restore /p:Configuration=$env:Configuration
env:
Configuration: ${{ matrix.configuration }}
# Build the app
- name: Build the application
run: msbuild $env:Project_Path /p:Configuration=$env:Configuration /p:Platform=$env:Platform
env:
Configuration: ${{ matrix.configuration }}
Platform: ${{ matrix.platform }}
# Upload the app
- name: Upload app
uses: actions/[email protected]
with:
name: org.nickvision.tubeconverter-winui-${{ matrix.platform }}
path: ${{ github.workspace }}\NickvisionTubeConverter.WinUI\bin\${{ matrix.platform }}\Debug\net7.0-windows10.0.19041.0
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -354,3 +354,9 @@ _nickbuild/

# Cake tools
tools/

# WinUI App Installer
*.WinUI/Installer/*.exe
*.WinUI/Dependencies/ffmpeg.exe
*.WinUI/Dependencies/ffplay.exe
*.WinUI/Dependencies/ffprobe.exe
35 changes: 33 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ All types of contributions are encouraged and valued. See the [Table of Contents
- [Manually](#manually)
- [Your First Code Contribution](#your-first-code-contribution)
- [Developing on Linux](#developing-on-linux)
- [Developing on Windows](#developing-on-windows)
- [Styleguides](#styleguides)
- [Join The Project Team](#join-the-project-team)

Expand Down Expand Up @@ -125,10 +126,11 @@ Once all changes to your translated file are made, commit these changes and crea

#### Structure

Parabolic is built using .NET 7 and C#. With these technologies, Parabolic is built for GNOME (Linux).
The solution is setup into 2 projects:
Parabolic is built using .NET 7 and C#. With these technologies, Parabolic is built for GNOME (Linux) and Windows.
The solution is setup into 3 projects:
- NickvisionTubeConverter.Shared
- NickvisionTubeConverter.GNOME
- NickvisionTubeConverter.WinUI

The whole solution utilizes the [MVC](https://en.wikipedia.org/wiki/Model%E2%80%93view%E2%80%93controller) pattern for separating data and UI views.

Expand All @@ -150,6 +152,15 @@ Powered by the C# bindings for GTK4/Libadwaita: [gir.core](https://github.com/gi
- Helpers => Useful objects that are specific for GNOME platform version of the app
- Blueprints => UI files written in [Blueprint markup language](https://jwestman.pages.gitlab.gnome.org/blueprint-compiler/)

##### NickvisionTubeConverter.WinUI

This project contains all of the code used for the Windows platform version of the app, including installer scripts.
Powered by the [Windows App SDK](https://learn.microsoft.com/en-us/windows/apps/windows-app-sdk/)
- Views => The views (pages, windows, dialogs) of the app that connect to the shared controllers
- Controls => Generic controls for the app
- These controls should not be connected to a controller and should be able to be ported to any other application
- Installer => Inno installer scripts

#### Developing on Linux

##### GNOME
Expand Down Expand Up @@ -183,6 +194,26 @@ Use one of the commands to build the app:
| `dotnet cake --target=Publish --prefix=PREFIX --ui=gnome` | Builds the application in `_nickbuild` directory, preparing it to be installed in a provided prefix (examples of a valid prefix: `/usr`, `/app`). If `--self-contained` is added, the application will not need dotnet-runtime to run.
| `dotnet cake --target=Install --destdir=DESTDIR` | Copies files to the `DESTDIR`. `--destdir` is optional, by default files are copied to root (`/`). This command should be used after `Publish`. |

##### WinUI

Can not be developed on non-Windows platforms.

#### Developing on Windows

##### WinUI
Recommended IDE:
- Visual Studio 2022 setup for use with Windows App SDK

You may also build the app manually without Visual Studio 2022 but the Windows App SDK runtime must be installed. It can be found here: https://learn.microsoft.com/en-us/windows/apps/windows-app-sdk/downloads.

You will also need gettext for Windows to be installed for the app to properly utilize transactions. Get it here: https://mlocati.github.io/articles/gettext-iconv-windows.html

With all dependencies installed a simple `dotnet run` will build and start the app.

##### GNOME

Can not be developed on non-Linux platforms.

## Styleguides

Parabolic follows [Microsoft's C# Coding Conventions](https://learn.microsoft.com/en-us/dotnet/csharp/fundamentals/coding-style/coding-conventions).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ Adw.Window _root {
activatable-widget: _subtitleSwitch;

[suffix]
Gtk.Switch _subtitleSwitch {
Gtk.Switch _subtitleSwitch {
valign: center;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ Adw.Window _root {
margin-start: 12;
margin-end: 12;
margin-bottom: 12;
placeholder-text: _("Search...");
placeholder-text: _("Search history");
}

Gtk.Separator {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ Adw.Window _root {
child: Adw.StatusPage _disabledPage {
icon-name: "key2-symbolic";
title: _("Keyring Disabled");
description: _("Use keyring to safely store credentials for sites that require login with username and password.");
description: _("Use keyring to safely store credentials for sites that require a user name and password to login.");
child: Gtk.Button _enableKeyringButton {
label: _("Enable");
halign: center;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ Adw.PreferencesWindow _root {
numeric: true;
adjustment: Gtk.Adjustment {
lower: 1;
upper: 32;
upper: 16;
step-increment: 1;
page-increment: 2;
};
Expand Down Expand Up @@ -348,7 +348,7 @@ Adw.PreferencesWindow _root {
hexpand: true;

child: Adw.ButtonContent {
label: "Chrome";
label: _("Chrome/Edge");
icon-name: "google-chrome-symbolic";
};
}
Expand All @@ -357,7 +357,7 @@ Adw.PreferencesWindow _root {
hexpand: true;

child: Adw.ButtonContent {
label: "Firefox";
label: _("Firefox");
icon-name: "firefox-symbolic";
};
}
Expand Down
4 changes: 2 additions & 2 deletions NickvisionTubeConverter.GNOME/Controls/DownloadRow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
using NickvisionTubeConverter.Shared.Models;
using System;
using System.IO;
using static Nickvision.Aura.Localization.Gettext;
using static Nickvision.GirExt.GtkExt;
using static NickvisionTubeConverter.Shared.Helpers.Gettext;

namespace NickvisionTubeConverter.GNOME.Controls;

Expand Down Expand Up @@ -168,7 +168,7 @@ public void SetProgressState(DownloadProgressState state)
});
}
_stateViewStack.SetVisibleChildName("processing");
_progressLabel.SetText(_("Downloading"));
_progressLabel.SetText(_("Downloading..."));
break;
case DownloadProgressStatus.Processing:
if (!_runPulsingBar)
Expand Down
25 changes: 7 additions & 18 deletions NickvisionTubeConverter.GNOME/Controls/HistoryDialog.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
using System.Collections.Generic;
using System.IO;
using System.Linq;
using static Nickvision.Aura.Localization.Gettext;
using static Nickvision.GirExt.GtkExt;
using static NickvisionTubeConverter.Shared.Helpers.Gettext;

namespace NickvisionTubeConverter.GNOME.Controls;

Expand All @@ -21,9 +21,8 @@ public partial class HistoryDialog : Adw.Window
[Gtk.Connect] private readonly Gtk.Button _clearButton;
[Gtk.Connect] private readonly Gtk.SearchEntry _searchEntry;
[Gtk.Connect] private readonly Adw.ViewStack _viewStack;
[Gtk.Connect] private readonly Gtk.ScrolledWindow _scrolledWindow;
[Gtk.Connect] private readonly Adw.PreferencesGroup _urlsGroup;

/// <summary>
/// Occurs when a download is requested to be downloaded again
/// </summary>
Expand Down Expand Up @@ -51,7 +50,7 @@ private HistoryDialog(Gtk.Builder builder, Gtk.Window parent, string iconName, D
foreach (var pair in _history.History.OrderByDescending(x => x.Value.Date))
{
var row = Adw.ActionRow.New();
if(string.IsNullOrEmpty(pair.Value.Title))
if (string.IsNullOrEmpty(pair.Value.Title))
{
row.SetTitle(pair.Key);
}
Expand All @@ -62,7 +61,7 @@ private HistoryDialog(Gtk.Builder builder, Gtk.Window parent, string iconName, D
}
row.SetTitleLines(1);
row.SetSubtitleLines(1);
if(File.Exists(pair.Value.Path))
if (File.Exists(pair.Value.Path))
{
var openButton = Gtk.Button.New();
openButton.SetIconName("media-playback-start-symbolic");
Expand Down Expand Up @@ -119,7 +118,7 @@ private void ClearHistory(Gtk.Button sender, EventArgs e)
//Update UI
_searchEntry.SetVisible(false);
_viewStack.SetVisibleChildName("no-history");
foreach(var row in _historyRows)
foreach (var row in _historyRows)
{
_urlsGroup.Remove(row);
}
Expand All @@ -134,19 +133,9 @@ private void ClearHistory(Gtk.Button sender, EventArgs e)
private void SearchChanged(Gtk.SearchEntry sender, EventArgs e)
{
var search = _searchEntry.GetText().ToLower();
if(string.IsNullOrEmpty(search))
foreach (var row in _historyRows)
{
foreach (var row in _historyRows)
{
row.SetVisible(true);
}
}
else
{
foreach(var row in _historyRows)
{
row.SetVisible(row.GetTitle().ToLower().Contains(search));
}
row.SetVisible(string.IsNullOrEmpty(search) || row.GetTitle().ToLower().Contains(search));
}
}
}
46 changes: 36 additions & 10 deletions NickvisionTubeConverter.GNOME/Controls/MediaRow.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
using NickvisionTubeConverter.GNOME.Helpers;
using NickvisionTubeConverter.Shared.Models;
using System;
using static NickvisionTubeConverter.Shared.Helpers.Gettext;
using static Nickvision.Aura.Localization.Gettext;

namespace NickvisionTubeConverter.GNOME.Controls;

/// <summary>
/// A row for a media in the AddDownloadDialog
/// </summary>
public class MediaRow : Adw.EntryRow
{
private readonly MediaInfo _mediaInfo;
Expand All @@ -16,17 +19,16 @@ public class MediaRow : Adw.EntryRow
[Gtk.Connect] private readonly Gtk.Button _undoButton;

/// <summary>
/// The active status of the row's check button
/// Occurs when the check to select the download is changed
/// </summary>
public bool Active
{
get => _downloadCheck.GetActive();

set => _downloadCheck.SetActive(value);
}

public event EventHandler<EventArgs>? OnSelectionChanged;

/// <summary>
/// Constructs a MediaRow
/// </summary>
/// <param name="builder">Gtk.Builder</param>
/// <param name="mediaInfo">MediaInfo</param>
/// <param name="limitChars">Whether or not to limit characters to those only supported by Windows</param>
private MediaRow(Gtk.Builder builder, MediaInfo mediaInfo, bool limitChars) : base(builder.GetPointer("_root"), false)
{
_mediaInfo = mediaInfo;
Expand Down Expand Up @@ -59,21 +61,45 @@ private MediaRow(Gtk.Builder builder, MediaInfo mediaInfo, bool limitChars) : ba
AddController(_titleKeyController);
_undoButton.OnClicked += (sender, e) =>
{
SetText(_numberString + _mediaInfo.OriginalTitle);
SetText($"{_numberString}{_mediaInfo.OriginalTitle}");
};
}

/// <summary>
/// Constructs a MediaRow
/// </summary>
/// <param name="mediaInfo">MediaInfo</param>
/// <param name="limitChars">Whether or not to limit characters to those only supported by Windows</param>
public MediaRow(MediaInfo mediaInfo, bool limitChars) : this(Builder.FromFile("media_row.ui"), mediaInfo, limitChars)
{

}

/// <summary>
/// The active status of the row's check button
/// </summary>
public bool Active
{
get => _downloadCheck.GetActive();

set => _downloadCheck.SetActive(value);
}

/// <summary>
/// Updates the title of the row
/// </summary>
/// <param name="numbered"></param>
public void UpdateTitle(bool numbered)
{
SetText(_mediaInfo.Title);
_numberString = numbered ? $"{_mediaInfo.PlaylistPosition} - " : "";
}

/// <summary>
/// Occurs when the row's text is changed
/// </summary>
/// <param name="sender">Gtk.EventControllerKey</param>
/// <param name="e">Gtk.EventControllerKey.KeyPressedSignalArgs</param>
private bool OnKeyPressed(Gtk.EventControllerKey sender, Gtk.EventControllerKey.KeyPressedSignalArgs e)
{
var res = e.Keyval == 0x2f; // '/'
Expand Down
7 changes: 4 additions & 3 deletions NickvisionTubeConverter.GNOME/Controls/PasswordDialog.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using NickvisionTubeConverter.GNOME.Helpers;
using NickvisionTubeConverter.Shared.Helpers;
using System.Threading.Tasks;

namespace NickvisionTubeConverter.GNOME.Controls;
Expand All @@ -19,8 +20,8 @@ public partial class PasswordDialog : Adw.Window
/// <summary>
/// Whether or not the dialog was skipped
/// </summary>
public bool WasSkipped { get; private set; }
public bool WasSkipped { get; private set; }

/// <summary>
/// Constructs a PasswordDialog
/// </summary>
Expand All @@ -35,7 +36,7 @@ private PasswordDialog(Gtk.Builder builder, Gtk.Window parent, string title, Tas
builder.Connect(this);
//Dialog Settings
SetTransientFor(parent);
_migrateButton.OnClicked += (sender, e) => Gtk.Functions.ShowUri(this, Help.GetHelpURL("keyring"), 0);
_migrateButton.OnClicked += (sender, e) => Gtk.Functions.ShowUri(this, DocumentationHelpers.GetHelpURL("keyring"), 0);
_titleLabel.SetLabel(title);
_skipButton.OnClicked += (sender, e) =>
{
Expand Down
Loading