Use new icon buttons on legacy UI too
This commit is contained in:
@@ -275,13 +275,9 @@ public class CompactUi : WindowMediatorSubscriberBase
|
||||
ImGui.InputTextWithHint("##otheruid", "Other players UID/Alias", ref _pairToAdd, 20);
|
||||
ImGui.SameLine(ImGui.GetWindowContentRegionMin().X + UiSharedService.GetWindowContentRegionWidth() - buttonSize.X);
|
||||
var canAdd = !_pairManager.DirectPairs.Any(p => string.Equals(p.UserData.UID, _pairToAdd, StringComparison.Ordinal) || string.Equals(p.UserData.Alias, _pairToAdd, StringComparison.Ordinal));
|
||||
if (!canAdd)
|
||||
using (ImRaii.Disabled(!canAdd))
|
||||
{
|
||||
ImGuiComponents.DisabledButton(FontAwesomeIcon.Plus);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (ImGuiComponents.IconButton(FontAwesomeIcon.Plus))
|
||||
if (_uiSharedService.IconButton(FontAwesomeIcon.Plus))
|
||||
{
|
||||
_ = _apiController.UserAddPair(new(new(_pairToAdd)));
|
||||
_pairToAdd = string.Empty;
|
||||
@@ -334,13 +330,14 @@ public class CompactUi : WindowMediatorSubscriberBase
|
||||
break;
|
||||
}
|
||||
|
||||
var button = _buttonState ? FontAwesomeIcon.Play : FontAwesomeIcon.Pause;
|
||||
|
||||
if (!_timeout.IsRunning || _timeout.ElapsedMilliseconds > 15000)
|
||||
{
|
||||
if (_timeout.ElapsedMilliseconds > 5000)
|
||||
_timeout.Reset();
|
||||
|
||||
if (ImGuiComponents.IconButton(button) && UiSharedService.CtrlPressed())
|
||||
var button = _buttonState ? FontAwesomeIcon.Play : FontAwesomeIcon.Pause;
|
||||
|
||||
using (ImRaii.Disabled(_timeout.IsRunning))
|
||||
{
|
||||
if (_uiSharedService.IconButton(button) && UiSharedService.CtrlPressed())
|
||||
{
|
||||
foreach (var entry in users)
|
||||
{
|
||||
@@ -352,13 +349,10 @@ public class CompactUi : WindowMediatorSubscriberBase
|
||||
_timeout.Start();
|
||||
_buttonState = !_buttonState;
|
||||
}
|
||||
if (!_timeout.IsRunning)
|
||||
UiSharedService.AttachToolTip($"Hold Control to {(button == FontAwesomeIcon.Play ? "resume" : "pause")} pairing with {users.Count} out of {userCount} displayed users.");
|
||||
}
|
||||
else
|
||||
{
|
||||
var availableAt = (15000 - _timeout.ElapsedMilliseconds) / 1000;
|
||||
ImGuiComponents.DisabledButton(button);
|
||||
UiSharedService.AttachToolTip($"Next execution is available at {availableAt} seconds");
|
||||
UiSharedService.AttachToolTip($"Next execution is available at {(5000 - _timeout.ElapsedMilliseconds) / 1000} seconds");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -431,7 +425,7 @@ public class CompactUi : WindowMediatorSubscriberBase
|
||||
if (_apiController.ServerState is ServerState.Connected)
|
||||
{
|
||||
ImGui.SetCursorPosX(0 + ImGui.GetStyle().ItemSpacing.X);
|
||||
if (ImGuiComponents.IconButton(FontAwesomeIcon.UserCircle))
|
||||
if (_uiSharedService.IconButton(FontAwesomeIcon.UserCircle))
|
||||
{
|
||||
Mediator.Publish(new UiToggleMessage(typeof(EditProfileUi)));
|
||||
}
|
||||
@@ -536,7 +530,7 @@ public class CompactUi : WindowMediatorSubscriberBase
|
||||
buttonSizeX -= buttonSize.X - ImGui.GetStyle().ItemSpacing.X * 2;
|
||||
ImGui.SameLine(ImGui.GetWindowContentRegionMin().X + UiSharedService.GetWindowContentRegionWidth() - buttonSize.X);
|
||||
ImGui.SetCursorPosY(originalPos.Y + uidTextSize.Y / 2 - buttonSize.Y / 2);
|
||||
if (ImGuiComponents.IconButton(FontAwesomeIcon.Cog))
|
||||
if (_uiSharedService.IconButton(FontAwesomeIcon.Cog))
|
||||
{
|
||||
Mediator.Publish(new OpenSettingsUiMessage());
|
||||
}
|
||||
@@ -549,7 +543,7 @@ public class CompactUi : WindowMediatorSubscriberBase
|
||||
{
|
||||
buttonSizeX += _uiSharedService.GetIconButtonSize(FontAwesomeIcon.Copy).X - ImGui.GetStyle().ItemSpacing.X * 2;
|
||||
ImGui.SetCursorPosY(originalPos.Y + uidTextSize.Y / 2 - buttonSize.Y / 2);
|
||||
if (ImGuiComponents.IconButton(FontAwesomeIcon.Copy))
|
||||
if (_uiSharedService.IconButton(FontAwesomeIcon.Copy))
|
||||
{
|
||||
ImGui.SetClipboardText(_apiController.DisplayName);
|
||||
}
|
||||
|
||||
@@ -249,7 +249,7 @@ public class DrawGroupPair : DrawPairBase
|
||||
{
|
||||
ImGui.SetCursorPosY(originalY);
|
||||
|
||||
if (ImGuiComponents.IconButton(FontAwesomeIcon.Plus))
|
||||
if (_uiSharedService.IconButton(FontAwesomeIcon.Plus))
|
||||
{
|
||||
_ = _apiController.UserAddPair(new UserDto(new(_pair.UserData.UID)));
|
||||
}
|
||||
@@ -261,7 +261,7 @@ public class DrawGroupPair : DrawPairBase
|
||||
{
|
||||
ImGui.SetCursorPosY(originalY);
|
||||
|
||||
if (ImGuiComponents.IconButton(FontAwesomeIcon.Bars))
|
||||
if (_uiSharedService.IconButton(FontAwesomeIcon.Bars))
|
||||
{
|
||||
ImGui.OpenPopup("Popup");
|
||||
}
|
||||
|
||||
@@ -172,7 +172,7 @@ public class DrawUserPair : DrawPairBase
|
||||
}
|
||||
ImGui.SameLine(windowEndX - barButtonSize.X - spacingX - pauseIconSize.X);
|
||||
ImGui.SetCursorPosY(originalY);
|
||||
if (ImGuiComponents.IconButton(pauseIcon))
|
||||
if (_uiSharedService.IconButton(pauseIcon))
|
||||
{
|
||||
var perm = _pair.UserPair!.OwnPermissions;
|
||||
perm.SetPaused(!perm.IsPaused());
|
||||
@@ -191,7 +191,7 @@ public class DrawUserPair : DrawPairBase
|
||||
ImGui.SameLine(windowEndX - barButtonSize.X);
|
||||
ImGui.SetCursorPosY(originalY);
|
||||
|
||||
if (ImGuiComponents.IconButton(FontAwesomeIcon.Bars))
|
||||
if (_uiSharedService.IconButton(FontAwesomeIcon.Bars))
|
||||
{
|
||||
ImGui.OpenPopup("User Flyout Menu");
|
||||
}
|
||||
|
||||
@@ -88,7 +88,7 @@ internal sealed class GroupPanel
|
||||
|| string.Equals(p.Group.GID, _syncShellToJoin, StringComparison.Ordinal));
|
||||
|
||||
if (alreadyInGroup) ImGui.BeginDisabled();
|
||||
if (ImGuiComponents.IconButton(FontAwesomeIcon.Plus))
|
||||
if (_uiShared.IconButton(FontAwesomeIcon.Plus))
|
||||
{
|
||||
if (!string.IsNullOrEmpty(_syncShellToJoin))
|
||||
{
|
||||
@@ -170,7 +170,7 @@ internal sealed class GroupPanel
|
||||
ImGui.AlignTextToFramePadding();
|
||||
ImGui.TextUnformatted("Syncshell Password: " + _lastCreatedGroup.Password);
|
||||
ImGui.SameLine();
|
||||
if (ImGuiComponents.IconButton(FontAwesomeIcon.Copy))
|
||||
if (_uiShared.IconButton(FontAwesomeIcon.Copy))
|
||||
{
|
||||
ImGui.SetClipboardText(_lastCreatedGroup.Password);
|
||||
}
|
||||
@@ -584,7 +584,7 @@ internal sealed class GroupPanel
|
||||
ImGui.SameLine();
|
||||
}
|
||||
|
||||
if (ImGuiComponents.IconButton(pauseIcon))
|
||||
if (_uiShared.IconButton(pauseIcon))
|
||||
{
|
||||
var userPerm = groupDto.GroupUserPermissions ^ GroupUserPermissions.Paused;
|
||||
_ = ApiController.GroupChangeIndividualPermissionState(new GroupPairUserPermissionDto(groupDto.Group, new UserData(ApiController.UID), userPerm));
|
||||
@@ -592,7 +592,7 @@ internal sealed class GroupPanel
|
||||
UiSharedService.AttachToolTip((groupDto.GroupUserPermissions.IsPaused() ? "Resume" : "Pause") + " pairing with all users in this Syncshell");
|
||||
ImGui.SameLine();
|
||||
|
||||
if (ImGuiComponents.IconButton(FontAwesomeIcon.Bars))
|
||||
if (_uiShared.IconButton(FontAwesomeIcon.Bars))
|
||||
{
|
||||
ImGui.OpenPopup("ShellPopup");
|
||||
}
|
||||
|
||||
@@ -54,7 +54,7 @@ public class PairGroupsUi
|
||||
|
||||
var buttonPauseOffset = windowX + windowWidth - flyoutMenuX - spacingX - pauseButtonX;
|
||||
ImGui.SameLine(buttonPauseOffset);
|
||||
if (ImGuiComponents.IconButton(pauseButton))
|
||||
if (_uiSharedService.IconButton(pauseButton))
|
||||
{
|
||||
// If all of the currently visible pairs (after applying filters to the pairs)
|
||||
// are paused we display a resume button to resume all currently visible (after filters)
|
||||
@@ -81,7 +81,7 @@ public class PairGroupsUi
|
||||
|
||||
var buttonDeleteOffset = windowX + windowWidth - flyoutMenuX;
|
||||
ImGui.SameLine(buttonDeleteOffset);
|
||||
if (ImGuiComponents.IconButton(FontAwesomeIcon.Bars))
|
||||
if (_uiSharedService.IconButton(FontAwesomeIcon.Bars))
|
||||
{
|
||||
ImGui.OpenPopup("Group Flyout Menu");
|
||||
}
|
||||
|
||||
@@ -113,7 +113,7 @@ internal class EventViewerUI : WindowMediatorSubscriberBase
|
||||
using (ImRaii.Disabled(_filterFreeText.IsNullOrEmpty()))
|
||||
{
|
||||
ImGui.SameLine();
|
||||
if (ImGuiComponents.IconButton(FontAwesomeIcon.Ban))
|
||||
if (_uiSharedService.IconButton(FontAwesomeIcon.Ban))
|
||||
{
|
||||
_filterFreeText = string.Empty;
|
||||
_filteredEvents = RecreateFilter();
|
||||
|
||||
Reference in New Issue
Block a user