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

Subtle UI/UX Adjustments #40

Merged
merged 3 commits into from
Jun 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
19 changes: 17 additions & 2 deletions src/XIVLauncher.Core/Components/MainPage/ActionButtons.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,25 +14,40 @@ public override void Draw()
var btnSize = new Vector2(80) * ImGuiHelpers.GlobalScale;

ImGui.PushFont(FontManager.IconFont);


ImGui.BeginDisabled(this.OnQueueButtonClicked == null);
if (ImGui.Button(FontAwesomeIcon.Clock.ToIconString(), btnSize))
{
this.OnQueueButtonClicked?.Invoke();
}
ImGui.PushFont(FontManager.TextFont);
ImGuiHelpers.AddTooltip("Queue");
ImGui.PopFont();
ImGui.EndDisabled();

ImGui.SameLine();


ImGui.BeginDisabled(this.OnStatusButtonClicked == null);
if (ImGui.Button(FontAwesomeIcon.Globe.ToIconString(), btnSize))
{
this.OnStatusButtonClicked?.Invoke();
}
ImGui.PushFont(FontManager.TextFont);
ImGuiHelpers.AddTooltip("Service Status");
ImGui.PopFont();
ImGui.EndDisabled();

ImGui.SameLine();

ImGui.BeginDisabled(this.OnSettingsButtonClicked == null);
if (ImGui.Button(FontAwesomeIcon.Cog.ToIconString(), btnSize))
{
this.OnSettingsButtonClicked?.Invoke();
}
ImGui.PushFont(FontManager.TextFont);
ImGuiHelpers.AddTooltip("Settings");
ImGui.PopFont();
ImGui.EndDisabled();

ImGui.PopFont();

Expand Down
3 changes: 2 additions & 1 deletion src/XIVLauncher.Core/Components/MainPage/MainPage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ public MainPage(LauncherApp app)

this.loginFrame.OnLogin += this.ProcessLogin;
this.actionButtons.OnSettingsButtonClicked += () => this.App.State = LauncherApp.LauncherState.Settings;
this.actionButtons.OnStatusButtonClicked += () => AppUtil.OpenBrowser("https://is.xivup.com/");

this.Padding = new Vector2(32f, 32f);

Expand Down Expand Up @@ -75,8 +76,8 @@ public override void Draw()

ImGui.SameLine();

this.AccountSwitcher.Draw();
this.loginFrame.Draw();
this.AccountSwitcher.Draw();

this.actionButtons.Draw();
}
Expand Down
10 changes: 5 additions & 5 deletions src/XIVLauncher.Core/Components/MainPage/NewsFrame.cs
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,6 @@ public override void Draw()
{
ImGui.PushStyleVar(ImGuiStyleVar.WindowPadding, new Vector2(32f, 32f));

//ImGui.Text("awooga");

if (this.newsLoaded)
{
var banner = this.banners[this.currentBanner];
Expand All @@ -84,7 +82,7 @@ public override void Draw()
ImGui.Dummy(new Vector2(15));

void ShowNewsEntry(News newsEntry)
{
{
ImGui.Text(newsEntry.Title);

if (ImGui.IsItemClicked(ImGuiMouseButton.Left) && !string.IsNullOrEmpty(newsEntry.Url))
Expand All @@ -93,21 +91,23 @@ void ShowNewsEntry(News newsEntry)
}
}

ImGui.TextDisabled("News");
foreach (News newsEntry in this.headlines.News)
{
ShowNewsEntry(newsEntry);
}

ImGui.Separator();
ImGui.Spacing();

ImGui.TextDisabled("Topics");
foreach (News topic in this.headlines.Topics)
{
ShowNewsEntry(topic);
}
}
else
{
ImGui.Text("News are loading...");
ImGui.Text("News is loading...");
}

ImGui.PopStyleVar();
Expand Down
32 changes: 19 additions & 13 deletions src/XIVLauncher.Core/Components/SettingsPage/SettingsPage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -70,27 +70,33 @@ public override void Draw()
if (settingsTab.IsUnixExclusive && Environment.OSVersion.Platform != PlatformID.Unix)
continue;

var eligible = settingsTab.Entries.Where(x => x.Name.ToLower().Contains(this.searchInput.ToLower())).ToArray();
var eligible = settingsTab.Entries
.Where(x => x.Name.Contains(this.searchInput.Trim(),
StringComparison.InvariantCultureIgnoreCase));

if (!eligible.Any())
continue;

any = true;

ImGui.TextColored(ImGuiColors.DalamudGrey, settingsTab.Title);
ImGui.Dummy(new Vector2(5));

foreach (SettingsEntry settingsTabEntry in settingsTab.Entries)
if (ImGui.BeginChild("SearchResults"))
{
if (!settingsTabEntry.Name.ToLower().Contains(this.searchInput.ToLower()))
continue;
ImGui.TextColored(ImGuiColors.DalamudGrey, settingsTab.Title);
ImGui.Dummy(new Vector2(5));

settingsTabEntry.Draw();
}
foreach (SettingsEntry settingsTabEntry in eligible)
{
if (!settingsTabEntry.IsVisible)
continue;

settingsTabEntry.Draw();
}

ImGui.Separator();
ImGui.Separator();

ImGui.Dummy(new Vector2(10));
ImGui.Dummy(new Vector2(10));
}
ImGui.EndChild();
}

if (!any)
Expand Down Expand Up @@ -137,8 +143,8 @@ public override void Draw()
ImGui.PopFont();

var vpSize = ImGuiHelpers.ViewportSize;
ImGui.SetCursorPos(new Vector2(vpSize.X - 250, 4));
ImGui.SetNextItemWidth(240);
ImGui.SetCursorPos(new Vector2(vpSize.X - 260, 4));
ImGui.SetNextItemWidth(250);
ImGui.InputTextWithHint("###searchInput", "Search for settings...", ref this.searchInput, 100);

base.Draw();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,7 @@ public class SettingsTabAbout : SettingsTab
{
private readonly TextureWrap logoTexture;

public override SettingsEntry[] Entries { get; } =
{
new SettingsEntry<bool>("Use UID Cache", "Tries to save your login token for the next start.", () => Program.Config.IsUidCacheEnabled ?? false, x => Program.Config.IsUidCacheEnabled = x),
};
public override SettingsEntry[] Entries => Array.Empty<SettingsEntry>();

public override string Title => "About";

Expand All @@ -25,29 +22,27 @@ public SettingsTabAbout()

public override void Draw()
{
ImGui.Text($"This is XIVLauncher Core v{AppUtil.GetAssemblyVersion()}({AppUtil.GetGitHash()})");
ImGui.Text("By goaaats");
ImGui.Image(this.logoTexture.ImGuiHandle, new Vector2(256) * ImGuiHelpers.GlobalScale);

#if FLATPAK
ImGui.TextColored(ImGuiColors.DalamudRed, "THIS IS A FLATPAK!!!");
#endif
ImGui.Text($"XIVLauncher Core v{AppUtil.GetAssemblyVersion()}({AppUtil.GetGitHash()})");
ImGui.Text("By goaaats");

if (ImGui.IsItemClicked(ImGuiMouseButton.Left))
AppUtil.OpenBrowser("https://github.com/goaaats");

ImGui.Dummy(new Vector2(20));

if (ImGui.Button("Open GitHub"))
if (ImGui.Button("Open Repository"))
{
AppUtil.OpenBrowser("https://github.com/goatcorp/FFXIVQuickLauncher");
AppUtil.OpenBrowser("https://github.com/goatcorp/XIVLauncher.Core");
}

if (ImGui.Button("Join our Discord"))
{
AppUtil.OpenBrowser("https://discord.gg/3NMcUV5");
}

if (ImGui.Button("See software licenses"))
if (ImGui.Button("See Software Licenses"))
{
PlatformHelpers.OpenBrowser(Path.Combine(AppContext.BaseDirectory, "license.txt"));
}
Expand All @@ -58,10 +53,6 @@ public override void Draw()
PlatformHelpers.OpenBrowser(Program.storage.GetFolder("logs").FullName);
}

ImGui.Dummy(new Vector2(20));

ImGui.Image(this.logoTexture.ImGuiHandle, new Vector2(256) * ImGuiHelpers.GlobalScale);

base.Draw();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public class SettingsTabDalamud : SettingsTab
},
},

new NumericSettingsEntry("Injection Delay", "Choose how long to wait after the game has loaded before injecting.", () => Program.Config.DalamudLoadDelay, delay => Program.Config.DalamudLoadDelay = delay, 0, int.MaxValue, 1000),
new NumericSettingsEntry("Injection Delay (ms)", "Choose how long to wait after the game has loaded before injecting.", () => Program.Config.DalamudLoadDelay, delay => Program.Config.DalamudLoadDelay = delay, 0, int.MaxValue, 1000),
};

public override string Title => "Dalamud";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,26 +6,45 @@ namespace XIVLauncher.Core.Components.SettingsPage.Tabs;
public class SettingsTabDebug : SettingsTab
{
public override SettingsEntry[] Entries => Array.Empty<SettingsEntry>();
public override string Title => "Debug Info";
public override string Title => "Debug";

public override void Draw()
{
ImGui.TextUnformatted("Generic Information");
ImGui.Separator();
ImGui.TextUnformatted($"Operating System: {Environment.OSVersion}");
ImGui.TextUnformatted($"Runtime Version: {Environment.Version}");

if (Program.IsSteamDeckHardware)
ImGui.Text("Is Steam Deck hardware");
ImGui.Text("Steam Deck Hardware Detected");

if (Program.IsSteamDeckGamingMode)
ImGui.Text("Is Steam Deck");

ImGui.Separator();
ImGui.Text("Steam Deck Gaming Mode Detected");

ImGui.PushTextWrapPos(0);
#if FLATPAK
ImGui.Text("Running as a Flatpak");
#endif

foreach (DictionaryEntry entry in Environment.GetEnvironmentVariables())
{
ImGui.TextUnformatted($"{entry.Key}={entry.Value}");
}
ImGui.Spacing();

ImGui.PopTextWrapPos();
ImGui.TextUnformatted("Environment Information");
ImGui.Separator();
if(ImGui.BeginTable("EnvironmentTable", 2, ImGuiTableFlags.Borders | ImGuiTableFlags.RowBg | ImGuiTableFlags.Resizable | ImGuiTableFlags.ScrollY))
{
ImGui.TableSetupScrollFreeze(0, 1);
ImGui.TableSetupColumn("Key", ImGuiTableColumnFlags.WidthStretch, 0.35f);
ImGui.TableSetupColumn("Value");
ImGui.TableHeadersRow();
foreach (DictionaryEntry entry in Environment.GetEnvironmentVariables())
{
ImGui.TableNextRow();
ImGui.TableNextColumn();
ImGuiHelpers.TextWrapped(entry.Key?.ToString() ?? "null");
ImGui.TableNextColumn();
ImGuiHelpers.TextWrapped(entry.Value?.ToString() ?? "null");
}
ImGui.EndTable();
}

base.Draw();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ public class SettingsTabGame : SettingsTab
{
public override SettingsEntry[] Entries { get; } =
{
new SettingsEntry<DirectoryInfo>("Game Path", "Where the game is installed to.", () => Program.Config.GamePath, x => Program.Config.GamePath = x)
new SettingsEntry<DirectoryInfo>("Game Path", "Where the game is or will be installed.", () => Program.Config.GamePath, x => Program.Config.GamePath = x)
{
CheckValidity = x =>
{
Expand All @@ -20,7 +20,7 @@ public class SettingsTabGame : SettingsTab
}
},

new SettingsEntry<DirectoryInfo>("Game Config Path", "Where the user config files will be stored.", () => Program.Config.GameConfigPath, x => Program.Config.GameConfigPath = x)
new SettingsEntry<DirectoryInfo>("Game Configuration Path", "Where your user config files will be stored.", () => Program.Config.GameConfigPath, x => Program.Config.GameConfigPath = x)
{
CheckValidity = x => string.IsNullOrWhiteSpace(x?.FullName) ? "Game Config Path is not set." : null,

Expand All @@ -36,9 +36,10 @@ public class SettingsTabGame : SettingsTab
new SettingsEntry<string>("Additional Arguments", "Additional args to start the game with", () => Program.Config.AdditionalArgs, x => Program.Config.AdditionalArgs = x),
new SettingsEntry<ClientLanguage>("Game Language", "Select the game's language.", () => Program.Config.ClientLanguage ?? ClientLanguage.English, x => Program.Config.ClientLanguage = x),
new SettingsEntry<DpiAwareness>("Game DPI Awareness", "Select the game's DPI Awareness. Change this if the game's scaling looks wrong.", () => Program.Config.DpiAwareness ?? DpiAwareness.Unaware, x => Program.Config.DpiAwareness = x),
new SettingsEntry<bool>("Free trial account", "Check this if you are using a free trial account.", () => Program.Config.IsFt ?? false, x => Program.Config.IsFt = x),
new SettingsEntry<bool>("Free Trial Account", "Check this if you are using a free trial account.", () => Program.Config.IsFt ?? false, x => Program.Config.IsFt = x),
new SettingsEntry<bool>("Use XIVLauncher authenticator/OTP macros", "Check this if you want to use the XIVLauncher authenticator app or macros.", () => Program.Config.IsOtpServer ?? false, x => Program.Config.IsOtpServer = x),
new SettingsEntry<bool>("Ignore Steam", "Check this if you do not want XIVLauncher to communicate with Steam (Requires Restart).", () => Program.Config.IsIgnoringSteam ?? false, x => Program.Config.IsIgnoringSteam = x),
new SettingsEntry<bool>("Use UID Cache", "Tries to save your login token for the next start.", () => Program.Config.IsUidCacheEnabled ?? false, x => Program.Config.IsUidCacheEnabled = x),
};

public override string Title => "Game";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public SettingsTabWine()
{
Entries = new SettingsEntry[]
{
startupTypeSetting = new SettingsEntry<WineStartupType>("Installation Type", "Choose how XIVLauncher will start and manage your game installation.",
startupTypeSetting = new SettingsEntry<WineStartupType>("Wine Version", "Choose how XIVLauncher will start and manage your wine installation.",
() => Program.Config.WineStartupType ?? WineStartupType.Managed, x => Program.Config.WineStartupType = x),

new SettingsEntry<string>("Wine Binary Path",
Expand All @@ -30,7 +30,7 @@ public SettingsTabWine()
CheckValidity = b =>
{
if (b == true && (!File.Exists("/usr/lib/libgamemodeauto.so.0") && !File.Exists("/app/lib/libgamemodeauto.so.0")))
return "GameMode not detected.";
return "GameMode was not detected on your system.";

return null;
}
Expand Down
10 changes: 10 additions & 0 deletions src/XIVLauncher.Core/ImGuiHelpers.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,14 @@ public static void CenterCursorFor(int itemWidth)
var window = (int)ImGui.GetWindowWidth();
ImGui.SetCursorPosX(window / 2 - itemWidth / 2);
}

public static void AddTooltip(string text)
{
if (ImGui.IsItemHovered())
{
ImGui.BeginTooltip();
ImGui.TextUnformatted(text);
ImGui.EndTooltip();
}
}
}
2 changes: 1 addition & 1 deletion src/XIVLauncher.Core/LauncherApp.cs
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ public override void Draw()

ImGui.SetNextWindowPos(new Vector2(0, 0));
ImGui.SetNextWindowSize(ImGuiHelpers.ViewportSize);
ImGui.SetNextWindowBgAlpha(0.7f);
ImGui.SetNextWindowBgAlpha(0.75f);

if (ImGui.Begin("XIVLauncher", ImGuiWindowFlags.NoTitleBar | ImGuiWindowFlags.NoResize | ImGuiWindowFlags.NoScrollbar | ImGuiWindowFlags.NoScrollWithMouse))
{
Expand Down