Skip to content

Commit

Permalink
Merge pull request #31 from NickvisionApps/rc
Browse files Browse the repository at this point in the history
2023.7.0-rc1
  • Loading branch information
fsobolev authored Jul 13, 2023
2 parents fb571e8 + 1a5e5cd commit 748eb29
Show file tree
Hide file tree
Showing 23 changed files with 1,019 additions and 39 deletions.
3 changes: 3 additions & 0 deletions NickvisionCavalier.GNOME/.fleet/run.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
"name": "Cavalier GNOME",
"projectPath": "NickvisionCavalier.GNOME.csproj",
"args": [],
"environment": {
"LANG": "en_US.UTF-8"
},
},

]
Expand Down
10 changes: 10 additions & 0 deletions NickvisionCavalier.GNOME/Blueprints/preferences_dialog.blp
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,16 @@ Adw.PreferencesWindow _root {
Adw.ComboRow _mirrorRow {
title: _("Mirror");
}

Adw.ActionRow _reverseMirrorRow {
title: _("Reverse mirror");
activatable-widget: _reverseMirrorSwitch;

[suffix]
Gtk.Switch _reverseMirrorSwitch {
valign: center;
}
}
}

Adw.PreferencesGroup {
Expand Down
5 changes: 5 additions & 0 deletions NickvisionCavalier.GNOME/Blueprints/shortcuts_dialog.blp
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@ Gtk.ShortcutsWindow _shortcuts {
accelerator: "M <Shift>M";
}

Gtk.ShortcutsShortcut {
title: _("Toggle Reverse Mirror");
accelerator: "V";
}

Gtk.ShortcutsShortcut {
title: _("Change Drawing Area Margin");
accelerator: "N <Shift>N";
Expand Down
4 changes: 2 additions & 2 deletions NickvisionCavalier.GNOME/NickvisionCavalier.GNOME.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<Exec Command="echo Compiling extra resources..." />
<Exec Command="blueprint-compiler batch-compile ./Blueprints ./Blueprints ./Blueprints/*.blp" />
<Exec Command="glib-compile-resources --sourcedir ./Resources ./Resources/org.nickvision.cavalier.gresource.xml --target=$(OutDir)/org.nickvision.cavalier.gresource" />
<Exec Command="while read lang_code; do \&#xA; mkdir -p $(OutDir)/${lang_code};\&#xA; msgfmt ../NickvisionCavalier.Shared/Resources/po/${lang_code}.po -o $(OutDir)/${lang_code}/cavalier.mo;\&#xA;done %3C ../NickvisionCavalier.Shared/Resources/po/LINGUAS" />
<Exec Command="while read lang_code; do \&#xA; mkdir -p $(OutDir)${lang_code};\&#xA; msgfmt ../NickvisionCavalier.Shared/Resources/po/${lang_code}.po -o $(OutDir)${lang_code}/cavalier.mo;\&#xA;done %3C ../NickvisionCavalier.Shared/Resources/po/LINGUAS" />
</Target>

<Target Name="PostBuild" AfterTargets="PostBuildEvent">
Expand All @@ -29,7 +29,7 @@

<Target Name="PostPublish" AfterTargets="Publish">
<Exec Command="cp $(OutDir)/org.nickvision.cavalier.gresource $(PublishDir)/org.nickvision.cavalier.gresource" />
<Exec Command="while read lang_code; do \&#xA; cp -r $(OutDir)/${lang_code} $(PublishDir)/; \&#xA;done %3C ../NickvisionCavalier.Shared/Resources/po/LINGUAS" />
<Exec Command="while read lang_code; do \&#xA; cp -r $(OutDir)/${lang_code} $(PublishDir)/; \&#xA;done %3C ../NickvisionCavalier.Shared/Resources/po/LINGUAS" />
</Target>

<Target Name="EmbedUIFiles" BeforeTargets="BeforeResGen">
Expand Down
4 changes: 2 additions & 2 deletions NickvisionCavalier.GNOME/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ public Program()
_mainWindowController.AppInfo.Name = "Nickvision Cavalier";
_mainWindowController.AppInfo.ShortName = _("Cavalier");
_mainWindowController.AppInfo.Description = $"{_("Visualize audio with CAVA")}.";
_mainWindowController.AppInfo.Version = "2023.7.0-beta1";
_mainWindowController.AppInfo.Changelog = "<ul><li>Cavalier is reborn as part of Nickvision apps family! Completely rewritten in C#, gaining better performance and solid base to grow in future!</li><li>New notable features comparing to previous stable release of Cavalier: Spine drawing mode, drawing direction selection and mirror.</li><li>Translations were moved to Weblate.</li></ul>";
_mainWindowController.AppInfo.Version = "2023.7.0-rc1";
_mainWindowController.AppInfo.Changelog = "<ul><li>Cavalier is reborn as part of Nickvision apps family! Completely rewritten in C#, gaining better performance and solid base to grow in future!</li><li>New notable features comparing to previous stable release of Cavalier: Spine drawing mode, drawing direction selection and mirror.</li><li>Translations were moved to Weblate.</li><li>Compared to 2023.7.0-beta1: fixed an issue where CAVA was still running after Cavalier quits, added Reverse mirror option, fixed other minor issues.</li></ul>";
_mainWindowController.AppInfo.GitHubRepo = new Uri("https://github.com/NickvisionApps/Cavalier");
_mainWindowController.AppInfo.IssueTracker = new Uri("https://github.com/NickvisionApps/Cavalier/issues/new");
_mainWindowController.AppInfo.SupportUrl = new Uri("https://github.com/NickvisionApps/Cavalier/discussions");
Expand Down
Binary file modified NickvisionCavalier.GNOME/Screenshots/Bars.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified NickvisionCavalier.GNOME/Screenshots/Default.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified NickvisionCavalier.GNOME/Screenshots/Levels.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed NickvisionCavalier.GNOME/Screenshots/Particles.png
Binary file not shown.
Binary file added NickvisionCavalier.GNOME/Screenshots/Spine.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
28 changes: 15 additions & 13 deletions NickvisionCavalier.GNOME/Views/MainWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,7 @@ private MainWindow(Gtk.Builder builder, MainWindowController controller, Adw.App
_preferencesController.OnWindowSettingsChanged += UpdateWindowSettings;
_preferencesController.OnCavaSettingsChanged += _drawingView.UpdateCavaSettings;
var preferencesDialog = new PreferencesDialog(_preferencesController, application);
OnCloseRequest += (sender, e) =>
{
_preferencesController.Save(); // Save configuration in case preferences dialog is opened
_drawingView.Dispose();
return false;
};
OnCloseRequest += OnClose;
UpdateWindowSettings(null, EventArgs.Empty);
OnNotify += (sender, e) =>
{
Expand All @@ -57,11 +52,6 @@ private MainWindow(Gtk.Builder builder, MainWindowController controller, Adw.App
_headerRevealer.SetRevealChild(GetIsActive());
}
};
OnCloseRequest += (sender, e) =>
{
_controller.SaveWindowSize((uint)DefaultWidth, (uint)DefaultHeight);
return false;
};
_resizeTimer = new Timer(400);
_resizeTimer.AutoReset = false;
_resizeTimer.Elapsed += (sender, e) => _resizeBin.SetVisible(false);
Expand Down Expand Up @@ -189,15 +179,27 @@ private void KeyboardShortcuts(Gio.SimpleAction sender, EventArgs e)
shortcutsWindow.Present();
}

/// <summary>
/// Occurs when closing the window
/// </summary>
/// <param name="sender">Gtk.Window</param>
/// <param name="e">EventArgs</param>
private bool OnClose(Gtk.Window sender, EventArgs e)
{
_controller.SaveWindowSize((uint)DefaultWidth, (uint)DefaultHeight);
_preferencesController.Save(); // Save configuration in case preferences dialog is opened
_drawingView.Dispose();
return false;
}

/// <summary>
/// Occurs when quit action is triggered
/// </summary>
/// <param name="sender">Gio.SimpleAction</param>
/// <param name="e">EventArgs</param>
private void Quit(Gio.SimpleAction sender, EventArgs e)
{
_preferencesController.Save(); // Save configuration in case preferences dialog is opened
_drawingView.Dispose();
OnClose(this, EventArgs.Empty);
_application.Quit();
}

Expand Down
17 changes: 17 additions & 0 deletions NickvisionCavalier.GNOME/Views/PreferencesDialog.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ public partial class PreferencesDialog : Adw.PreferencesWindow
[Gtk.Connect] private readonly Gtk.CheckButton _barsCheckButton;
[Gtk.Connect] private readonly Gtk.CheckButton _spineCheckButton;
[Gtk.Connect] private readonly Adw.ComboRow _mirrorRow;
[Gtk.Connect] private readonly Adw.ActionRow _reverseMirrorRow;
[Gtk.Connect] private readonly Gtk.Switch _reverseMirrorSwitch;
[Gtk.Connect] private readonly Gtk.Scale _marginScale;
[Gtk.Connect] private readonly Adw.ComboRow _directionRow;
[Gtk.Connect] private readonly Adw.ActionRow _offsetRow;
Expand Down Expand Up @@ -142,6 +144,11 @@ private PreferencesDialog(Gtk.Builder builder, PreferencesViewController control
};
application.AddAction(actPrevMirror);
application.SetAccelsForAction("app.prev-mirror", new string[] { "<Shift>m" });
//Toggle Reverse Mirror Action
var actReverseMirror = Gio.SimpleAction.New("toggle-reverse-mirror", null);
actReverseMirror.OnActivate += (sender, e) => _reverseMirrorSwitch.SetActive(!_reverseMirrorSwitch.GetActive());
application.AddAction(actReverseMirror);
application.SetAccelsForAction("app.toggle-reverse-mirror", new string[] { "v" });
//Increase Area Margin Action
var actIncMargin = Gio.SimpleAction.New("inc-margin", null);
actIncMargin.OnActivate += (sender, e) =>
Expand Down Expand Up @@ -400,6 +407,7 @@ private PreferencesDialog(Gtk.Builder builder, PreferencesViewController control
if (_controller.Stereo)
{
_mirrorRow.SetModel(Gtk.StringList.New(new string[] { _("Off"), _("Full"), _("Split Channels") }));
_reverseMirrorRow.SetVisible(_controller.Mirror == Mirror.SplitChannels);
_mirrorRow.SetSelected((uint)_controller.Mirror);
}
else
Expand All @@ -419,6 +427,15 @@ private PreferencesDialog(Gtk.Builder builder, PreferencesViewController control
if (e.Pspec.GetName() == "selected")
{
_controller.Mirror = (Mirror)_mirrorRow.GetSelected();
_reverseMirrorRow.SetVisible(_controller.Mirror == Mirror.SplitChannels);
}
};
_reverseMirrorSwitch.SetActive(_controller.ReverseMirror);
_reverseMirrorSwitch.OnNotify += (sender, e) =>
{
if (e.Pspec.GetName() == "active")
{
_controller.ReverseMirror = _reverseMirrorSwitch.GetActive();
}
};
_marginScale.SetValue((int)_controller.AreaMargin);
Expand Down
10 changes: 10 additions & 0 deletions NickvisionCavalier.Shared/Controllers/PreferencesViewController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,16 @@ public Mirror Mirror
set => Configuration.Current.Mirror = value;
}

/// <summary>
/// Whether to reverse mirrored bars
/// </summary>
public bool ReverseMirror
{
get => Configuration.Current.ReverseMirror;

set => Configuration.Current.ReverseMirror = value;
}

/// <summary>
/// List of color profiles
/// </summary>
Expand Down
7 changes: 6 additions & 1 deletion NickvisionCavalier.Shared/Models/Configuration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,10 @@ public class Configuration
/// </summary>
public Mirror Mirror { get; set; }
/// <summary>
/// Whether to reverse mirrored bars
/// </summary>
public bool ReverseMirror { get; set; }
/// <summary>
/// List of color profiles
/// </summary>
public List<ColorProfile> ColorProfiles { get; set; }
Expand Down Expand Up @@ -144,9 +148,10 @@ public Configuration()
ItemsOffset = 0.1f;
ItemsRoundness = 0.5f;
Filling = true;
LinesThickness = 15;
LinesThickness = 5;
Mode = DrawingMode.WaveBox;
Mirror = Mirror.Off;
ReverseMirror = false;
ColorProfiles = new List<ColorProfile> { new ColorProfile() };
ActiveProfile = 0;
}
Expand Down
4 changes: 2 additions & 2 deletions NickvisionCavalier.Shared/Models/Renderer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -67,12 +67,12 @@ public void Draw(float[] sample, float width, float height)
if (Configuration.Current.Mirror == Mirror.Full)
{
_drawFunc(sample, Configuration.Current.Direction, Configuration.Current.AreaMargin, Configuration.Current.AreaMargin, GetMirrorWidth(width), GetMirrorHeight(height), fgPaint);
_drawFunc(sample, GetMirrorDirection(), GetMirrorX(width), GetMirrorY(height), GetMirrorWidth(width), GetMirrorHeight(height), fgPaint);
_drawFunc(Configuration.Current.ReverseMirror ? sample.Reverse().ToArray() : sample, GetMirrorDirection(), GetMirrorX(width), GetMirrorY(height), GetMirrorWidth(width), GetMirrorHeight(height), fgPaint);
}
else if (Configuration.Current.Mirror == Mirror.SplitChannels)
{
_drawFunc(sample.Take(sample.Length / 2).ToArray(), Configuration.Current.Direction, Configuration.Current.AreaMargin, Configuration.Current.AreaMargin, GetMirrorWidth(width), GetMirrorHeight(height), fgPaint);
_drawFunc(sample.Skip(sample.Length / 2).Reverse().ToArray(), GetMirrorDirection(), GetMirrorX(width), GetMirrorY(height), GetMirrorWidth(width), GetMirrorHeight(height), fgPaint);
_drawFunc(Configuration.Current.ReverseMirror ? sample.Skip(sample.Length / 2).ToArray() : sample.Skip(sample.Length / 2).Reverse().ToArray(), GetMirrorDirection(), GetMirrorX(width), GetMirrorY(height), GetMirrorWidth(width), GetMirrorHeight(height), fgPaint);
}
else
{
Expand Down
Binary file added NickvisionCavalier.Shared/Resources/banner.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 748eb29

Please sign in to comment.