Vary title based on default profile

This commit is contained in:
Ben Olden-Cooligan 2022-09-30 16:29:31 -07:00
parent 17d436c531
commit 1337d98be1
4 changed files with 480 additions and 735 deletions

View File

@ -3,6 +3,7 @@ using Eto.Drawing;
using Eto.Forms;
using Eto.Mac;
using NAPS2.ImportExport.Images;
using NAPS2.Scan;
using NAPS2.WinForms;
namespace NAPS2.EtoForms.Ui;
@ -48,6 +49,12 @@ public class MacDesktopForm : DesktopForm
ClientSize = new Size(1000, 600);
}
protected override void UpdateTitle(ScanProfile? defaultProfile)
{
Title = UiStrings.Naps2;
this.ToNative().Subtitle = defaultProfile?.DisplayName ?? UiStrings.Naps2FullName;
}
protected override void CreateToolbarsAndMenus()
{
Commands.MoveDown.ToolBarText = "";
@ -135,8 +142,6 @@ public class MacDesktopForm : DesktopForm
var window = this.ToNative();
window.Toolbar = toolbar;
window.ToolbarStyle = NSWindowToolbarStyle.Unified;
// TODO: Subtitle based on active profile?
window.Subtitle = "Not Another PDF Scanner";
// TODO: Do we want full size content?
window.StyleMask |= NSWindowStyle.FullSizeContentView;
window.StyleMask |= NSWindowStyle.UnifiedTitleAndToolbar;

View File

@ -2,6 +2,7 @@ using System.Collections.Immutable;
using System.Threading;
using Eto.Forms;
using NAPS2.ImportExport.Images;
using NAPS2.Scan;
using NAPS2.WinForms;
namespace NAPS2.EtoForms.Ui;
@ -63,7 +64,6 @@ public abstract class DesktopForm : EtoFormBase
// PostInitializeComponent();
//
Icon = Icons.favicon.ToEtoIcon();
Title = UiStrings.Naps2FullTitle;
CreateToolbarsAndMenus();
UpdateScanButton();
InitLanguageDropdown();
@ -395,6 +395,7 @@ public abstract class DesktopForm : EtoFormBase
private void UpdateScanButton()
{
var defaultProfile = _profileManager.DefaultProfile;
UpdateTitle(defaultProfile);
_scanMenuCommands.Value = _profileManager.Profiles.Select(profile =>
new ActionCommand(() => _desktopScanController.ScanWithProfile(profile))
{
@ -404,6 +405,11 @@ public abstract class DesktopForm : EtoFormBase
.ToImmutableList<Command>();
}
protected virtual void UpdateTitle(ScanProfile? defaultProfile)
{
Title = string.Format(UiStrings.Naps2TitleFormat, defaultProfile?.DisplayName ?? UiStrings.Naps2FullName);
}
#endregion
//

File diff suppressed because it is too large Load Diff

View File

@ -384,7 +384,13 @@
<data name="RunInBackground" xml:space="preserve">
<value>Run in Background</value>
</data>
<data name="Naps2FullTitle" xml:space="preserve">
<value>NAPS2 - Not Another PDF Scanner</value>
<data name="Naps2" xml:space="preserve">
<value>NAPS2</value>
</data>
<data name="Naps2TitleFormat" xml:space="preserve">
<value>NAPS2 - {0}</value>
</data>
<data name="Naps2FullName" xml:space="preserve">
<value>Not Another PDF Scanner</value>
</data>
</root>