Skip to content

Commit

Permalink
FrmSettings>General: add Startup Boost section
Browse files Browse the repository at this point in the history
  • Loading branch information
d2phap committed May 19, 2024
1 parent 16d9794 commit 5f01637
Show file tree
Hide file tree
Showing 13 changed files with 98 additions and 21 deletions.
2 changes: 2 additions & 0 deletions Source/Components/ImageGlass.Settings/WebUI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,8 @@ public static async Task UpdateSvgIconsAsync(bool forced = false)
{ IconName.ArrowExchange, string.Empty },
{ IconName.Sun, string.Empty },
{ IconName.Moon, string.Empty },
{ IconName.Info, string.Empty },
{ IconName.Warning, string.Empty },
};


Expand Down
34 changes: 29 additions & 5 deletions Source/Components/ImageGlass.Settings/WebUI/FrmSettings.html
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@
</nav>

<div class="sidebar-bottom">
<a id="LnkHelp" href="#" lang-title="_._GetHelp" lang-text="_._GetHelp">[Get help]</a>
<a id="LnkHelp" class="cursor-help" href="#" lang-title="_._GetHelp" lang-text="_._GetHelp">[Get help]</a>
<span></span>
<a id="LnkResetSettings" href="#" lang-title="FrmSettings._ResetSettings" lang-text="FrmSettings._ResetSettings">[Reset settings]</a>
</div>
Expand Down Expand Up @@ -158,9 +158,9 @@
</div>
</section>

<!-- General > Start up -->
<!-- General > Startup -->
<section>
<header lang-text="FrmSettings._Startup">[Start up]</header>
<header lang-text="FrmSettings._Startup">[Startup]</header>
<div class="mb-2">
<label class="ig-checkbox">
<input type="checkbox" name="ShowWelcomeImage" />
Expand All @@ -173,6 +173,27 @@
<div lang-text="FrmSettings._ShouldOpenLastSeenImage">[ShouldOpenLastSeenImage]</div>
</label>
</div>

<!-- General > Startup > Startup Boost -->
<div class="mt-4 mb-2">
<div class="mb-2 d-inline-flex align-items-center">
<b lang-text="FrmSettings._StartupBoost">[Startup Boost]</b>
<i class="icon-hover cursor-help ms-2" icon="Warning" lang-title="FrmSettings._UnmanagedSettingReminder"></i>
</div>
<div class="mb-2">
<span lang-text="FrmSettings._StartupBoost._Description">
[Preload ImageGlass in the background during Windows startup to accelerate the first launch. The app will automatically exit after 3 seconds.]
</span>
</div>
<div class="mb-2">
<button id="Btn_EnableStartupBoost" class="me-2" type="button" lang-text="FrmSettings._EnableStartupBoost">
[Enable Startup Boost]
</button>
<button id="Btn_DisableStartupBoost" class="me-2" type="button" lang-text="FrmSettings._DisableStartupBoost">
[Disable Startup Boost]
</button>
</div>
</div>
</section>

<!-- General > Real-time file update -->
Expand Down Expand Up @@ -902,10 +923,13 @@

<!-- File type assosications > Default photo viewer -->
<section>
<header lang-text="FrmSettings._DefaultPhotoViewer">[Default photo viewer]</header>
<header class="d-flex align-items-center">
<span lang-text="FrmSettings._DefaultPhotoViewer">[Default photo viewer]</span>
<i class="icon-hover cursor-help ms-2" icon="Warning" lang-title="FrmSettings._UnmanagedSettingReminder"></i>
</header>
<div class="mb-2">
<div class="mb-3" style="max-width: 60rem;" lang-text="FrmSettings._DefaultPhotoViewer._Description">
[You can set ImageGlass as your default photo viewer using the buttons below. Remember to manually reset it if you uninstall ImageGlass, as the installer does not handle this task automatically.]
[You can set ImageGlass as your default photo viewer using the buttons below. If necessary, open the Default apps settings to manually choose ImageGlass as the default.]
</div>
<div class="d-flex align-items-center">
<button id="Btn_MakeDefaultViewer" class="me-2" type="button" lang-text="FrmSettings._MakeDefault">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,8 @@ export type IPageSettings = Record<string, any> & {
ArrowExchange: string,
Sun: string,
Moon: string,
Info: string,
Warning: string,
},
FILE_MACRO: string;
};
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ if (!window._pageSettings) {
ArrowExchange: '',
Moon: '',
Sun: '',
Info: '',
Warning: '',
},
startUpDir: '',
configDir: '',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,17 @@ export default class Settings {
}


// load icon element: <i icon="">
queryAll('i[icon]').forEach(el => {
const iconName = el.getAttribute('icon');
const iconSvg = _pageSettings.icons[iconName];

if (iconSvg) {
el.innerHTML = iconSvg;
}
});


// load specific settings
TabGeneral.loadSettings();
TabImage.loadSettings();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,9 @@ export class ToolbarEditorHtmlElement extends HTMLElement {
<ul class="ig-list-vertical is--no-separator toolbar-list" data-source="available">
</ul>
</div>
<div class="section-middle">[Icon]</div>
<div class="section-middle">
<i icon="ArrowExchange" style="font-size: 1.75rem;"></i>
</div>
<div class="section-current">
<div class="mb-1" lang-text="FrmSettings.Toolbar._CurrentButtons">[Current buttons:]</div>
<ul class="ig-list-vertical is--no-separator toolbar-list" data-source="current">
Expand All @@ -103,9 +105,6 @@ export class ToolbarEditorHtmlElement extends HTMLElement {
this.#editButtonFn = onEditButton.bind(this);
this.#hasChanges = false;
this.loadItems();

// load icon
query('.section-middle', this).innerHTML = _pageSettings.icons.ArrowExchange;
}

private loadItems(items?: IToolbarButton[]) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -360,4 +360,9 @@ progress {

.__web-inspector-hide-shortcut__ {
display: none !important;
}
}


.cursor-help {
cursor: help !important;
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,6 @@ toolbar-editor {
display: flex;
align-items: center;
padding: 0 1rem;

svg {
width: 2rem;
height: 2rem;
stroke: rgb(var(--AppText));
fill: rgb(var(--AppText));
}
}
.section-available {
display: grid;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,6 @@
}
}

#LnkHelp {
cursor: help;
}

section {
margin-bottom: 2rem;
padding-left: 1rem;
Expand Down Expand Up @@ -370,4 +366,25 @@
border-left: 0.1rem solid var(--ControlBorder);
}
}


i[icon] {
display: inline-flex;

&> svg {
width: 1.125em;
height: 1.125em;
stroke: rgb(var(--AppText));
fill: rgb(var(--AppText));
}

&.icon-hover {
border-radius: var(--borderRadius);
transition: background ease var(--transitionMs);

&:hover {
background: rgb(var(--Accent) / 0.25);
}
}
}
}
2 changes: 2 additions & 0 deletions Source/Components/ImageGlass.UI/Themes/IconFile.cs
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ public enum IconName
Selection,
Setting,

Info,
Warning,
Delete,
Edit,
Moon,
Expand Down
7 changes: 7 additions & 0 deletions Source/ImageGlass/Icons/Info.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 7 additions & 0 deletions Source/ImageGlass/Icons/Warning.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 6 additions & 0 deletions Source/ImageGlass/ImageGlass.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,9 @@
<None Update="Icons\Copy.svg">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="Icons\Info.svg">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="Icons\ResetSelection.svg">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
Expand All @@ -209,6 +212,9 @@
<None Update="Icons\Sun.svg">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="Icons\Warning.svg">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>


Expand Down

0 comments on commit 5f01637

Please sign in to comment.