Fixed syncshell UI messing up if there were members you didn't have an individual pair with
Some checks failed
.NET Build and Publish to Gitea / build (push) Has been cancelled
Some checks failed
.NET Build and Publish to Gitea / build (push) Has been cancelled
This commit is contained in:
@@ -20,7 +20,7 @@ public class DrawGroupPair : DrawPairBase
|
|||||||
private readonly GroupPairFullInfoDto _fullInfoDto;
|
private readonly GroupPairFullInfoDto _fullInfoDto;
|
||||||
private readonly GroupFullInfoDto _group;
|
private readonly GroupFullInfoDto _group;
|
||||||
private readonly CharaDataManager _charaDataManager;
|
private readonly CharaDataManager _charaDataManager;
|
||||||
public long _VRAMBytes;
|
public long VramUsage { get; set; }
|
||||||
|
|
||||||
public DrawGroupPair(string id, Pair entry, ApiController apiController,
|
public DrawGroupPair(string id, Pair entry, ApiController apiController,
|
||||||
MareMediator mareMediator, GroupFullInfoDto group, GroupPairFullInfoDto fullInfoDto,
|
MareMediator mareMediator, GroupFullInfoDto group, GroupPairFullInfoDto fullInfoDto,
|
||||||
@@ -87,7 +87,7 @@ public class DrawGroupPair : DrawPairBase
|
|||||||
presenceText += "Files Size: " + UiSharedService.ByteToString(_pair.LastAppliedDataBytes, true);
|
presenceText += "Files Size: " + UiSharedService.ByteToString(_pair.LastAppliedDataBytes, true);
|
||||||
if (_pair.LastAppliedApproximateVRAMBytes >= 0)
|
if (_pair.LastAppliedApproximateVRAMBytes >= 0)
|
||||||
{
|
{
|
||||||
_VRAMBytes = _pair.LastAppliedApproximateVRAMBytes;
|
VramUsage = _pair.LastAppliedApproximateVRAMBytes;
|
||||||
presenceText += Environment.NewLine + "Approx. VRAM Usage: " + UiSharedService.ByteToString(_pair.LastAppliedApproximateVRAMBytes, true);
|
presenceText += Environment.NewLine + "Approx. VRAM Usage: " + UiSharedService.ByteToString(_pair.LastAppliedApproximateVRAMBytes, true);
|
||||||
}
|
}
|
||||||
if (_pair.LastAppliedDataTris >= 0)
|
if (_pair.LastAppliedDataTris >= 0)
|
||||||
@@ -130,7 +130,7 @@ public class DrawGroupPair : DrawPairBase
|
|||||||
|
|
||||||
protected override float DrawRightSide(float textPosY, float originalY)
|
protected override float DrawRightSide(float textPosY, float originalY)
|
||||||
{
|
{
|
||||||
var pauseIcon = _pair.UserPair!.OwnPermissions.IsPaused() ? FontAwesomeIcon.Play : FontAwesomeIcon.Pause;
|
var pauseIcon = _fullInfoDto.GroupUserPermissions.IsPaused() ? FontAwesomeIcon.Play : FontAwesomeIcon.Pause;
|
||||||
var pauseIconSize = _uiSharedService.GetIconButtonSize(pauseIcon);
|
var pauseIconSize = _uiSharedService.GetIconButtonSize(pauseIcon);
|
||||||
var spacingX = ImGui.GetStyle().ItemSpacing.X;
|
var spacingX = ImGui.GetStyle().ItemSpacing.X;
|
||||||
var entryUID = _fullInfoDto.UserAliasOrUID;
|
var entryUID = _fullInfoDto.UserAliasOrUID;
|
||||||
@@ -158,6 +158,8 @@ public class DrawGroupPair : DrawPairBase
|
|||||||
var runningIconWidth = _uiSharedService.GetIconButtonSize(FontAwesomeIcon.Running).X;
|
var runningIconWidth = _uiSharedService.GetIconButtonSize(FontAwesomeIcon.Running).X;
|
||||||
var infoIconWidth = UiSharedService.GetIconSize(permIcon).X;
|
var infoIconWidth = UiSharedService.GetIconSize(permIcon).X;
|
||||||
var plusButtonWidth = _uiSharedService.GetIconButtonSize(FontAwesomeIcon.Plus).X;
|
var plusButtonWidth = _uiSharedService.GetIconButtonSize(FontAwesomeIcon.Plus).X;
|
||||||
|
var pauseButtonWidth = _uiSharedService.GetIconButtonSize(FontAwesomeIcon.Plus).X;
|
||||||
|
|
||||||
var barButtonWidth = _uiSharedService.GetIconButtonSize(FontAwesomeIcon.Bars).X;
|
var barButtonWidth = _uiSharedService.GetIconButtonSize(FontAwesomeIcon.Bars).X;
|
||||||
var barButtonSize = _uiSharedService.GetIconButtonSize(FontAwesomeIcon.Bars);
|
var barButtonSize = _uiSharedService.GetIconButtonSize(FontAwesomeIcon.Bars);
|
||||||
|
|
||||||
@@ -169,6 +171,7 @@ public class DrawGroupPair : DrawPairBase
|
|||||||
- (showShared ? (runningIconWidth + spacing) : 0)
|
- (showShared ? (runningIconWidth + spacing) : 0)
|
||||||
- (showInfo ? (infoIconWidth + spacing) : 0)
|
- (showInfo ? (infoIconWidth + spacing) : 0)
|
||||||
- (showPlus ? (plusButtonWidth + spacing) : 0)
|
- (showPlus ? (plusButtonWidth + spacing) : 0)
|
||||||
|
- (showPause ? (pauseButtonWidth + spacing) : 0)
|
||||||
- (showBars ? (barButtonWidth + spacing) : 0);
|
- (showBars ? (barButtonWidth + spacing) : 0);
|
||||||
|
|
||||||
ImGui.SameLine(pos);
|
ImGui.SameLine(pos);
|
||||||
@@ -287,6 +290,24 @@ public class DrawGroupPair : DrawPairBase
|
|||||||
UiSharedService.AttachToolTip("Pair with " + entryUID + " individually");
|
UiSharedService.AttachToolTip("Pair with " + entryUID + " individually");
|
||||||
ImGui.SameLine();
|
ImGui.SameLine();
|
||||||
}
|
}
|
||||||
|
if (showPause)
|
||||||
|
{
|
||||||
|
//rightSidePos -= pauseIconSize.X + spacingX;
|
||||||
|
ImGui.SetCursorPosY(originalY);
|
||||||
|
|
||||||
|
if (_uiSharedService.IconButton(pauseIcon))
|
||||||
|
{
|
||||||
|
var perm = _fullInfoDto.GroupUserPermissions;
|
||||||
|
var newPaused = !perm.IsPaused();
|
||||||
|
perm.SetPaused(newPaused);
|
||||||
|
}
|
||||||
|
|
||||||
|
UiSharedService.AttachToolTip(!_fullInfoDto.GroupUserPermissions.IsPaused()
|
||||||
|
? "Pause pairing with " + entryUID
|
||||||
|
: "Resume pairing with " + entryUID);
|
||||||
|
ImGui.SameLine();
|
||||||
|
|
||||||
|
}
|
||||||
if (showBars)
|
if (showBars)
|
||||||
{
|
{
|
||||||
ImGui.SetCursorPosY(originalY);
|
ImGui.SetCursorPosY(originalY);
|
||||||
@@ -295,26 +316,7 @@ public class DrawGroupPair : DrawPairBase
|
|||||||
{
|
{
|
||||||
ImGui.OpenPopup("Popup");
|
ImGui.OpenPopup("Popup");
|
||||||
}
|
}
|
||||||
ImGui.SameLine();
|
|
||||||
}
|
}
|
||||||
if (showPause)
|
|
||||||
{
|
|
||||||
rightSidePos -= pauseIconSize.X + spacingX;
|
|
||||||
ImGui.SameLine(rightSidePos);
|
|
||||||
ImGui.SetCursorPosY(originalY);
|
|
||||||
|
|
||||||
if (_uiSharedService.IconButton(pauseIcon))
|
|
||||||
{
|
|
||||||
var perm = _pair.UserPair!.OwnPermissions;
|
|
||||||
perm.SetPaused(!perm.IsPaused());
|
|
||||||
_ = _apiController.UserSetPairPermissions(new(_pair.UserData, perm));
|
|
||||||
}
|
|
||||||
|
|
||||||
UiSharedService.AttachToolTip(!_pair.UserPair!.OwnPermissions.IsPaused()
|
|
||||||
? "Pause pairing with " + entryUID
|
|
||||||
: "Resume pairing with " + entryUID);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (ImGui.BeginPopup("Popup"))
|
if (ImGui.BeginPopup("Popup"))
|
||||||
{
|
{
|
||||||
if ((userIsModerator || userIsOwner) && !(entryIsMod || entryIsOwner))
|
if ((userIsModerator || userIsOwner) && !(entryIsMod || entryIsOwner))
|
||||||
|
@@ -19,6 +19,7 @@ public class DrawUserPair : DrawPairBase
|
|||||||
protected readonly MareMediator _mediator;
|
protected readonly MareMediator _mediator;
|
||||||
private readonly SelectGroupForPairUi _selectGroupForPairUi;
|
private readonly SelectGroupForPairUi _selectGroupForPairUi;
|
||||||
private readonly CharaDataManager _charaDataManager;
|
private readonly CharaDataManager _charaDataManager;
|
||||||
|
public long VramUsage { get; set; }
|
||||||
|
|
||||||
public DrawUserPair(string id, Pair entry, UidDisplayHandler displayHandler, ApiController apiController,
|
public DrawUserPair(string id, Pair entry, UidDisplayHandler displayHandler, ApiController apiController,
|
||||||
MareMediator mareMediator, SelectGroupForPairUi selectGroupForPairUi,
|
MareMediator mareMediator, SelectGroupForPairUi selectGroupForPairUi,
|
||||||
@@ -84,6 +85,7 @@ public class DrawUserPair : DrawPairBase
|
|||||||
visibleTooltip += "Files Size: " + UiSharedService.ByteToString(_pair.LastAppliedDataBytes, true);
|
visibleTooltip += "Files Size: " + UiSharedService.ByteToString(_pair.LastAppliedDataBytes, true);
|
||||||
if (_pair.LastAppliedApproximateVRAMBytes >= 0)
|
if (_pair.LastAppliedApproximateVRAMBytes >= 0)
|
||||||
{
|
{
|
||||||
|
VramUsage = _pair.LastAppliedApproximateVRAMBytes;
|
||||||
visibleTooltip += Environment.NewLine + "Approx. VRAM Usage: " + UiSharedService.ByteToString(_pair.LastAppliedApproximateVRAMBytes, true);
|
visibleTooltip += Environment.NewLine + "Approx. VRAM Usage: " + UiSharedService.ByteToString(_pair.LastAppliedApproximateVRAMBytes, true);
|
||||||
}
|
}
|
||||||
if (_pair.LastAppliedDataTris >= 0)
|
if (_pair.LastAppliedDataTris >= 0)
|
||||||
@@ -97,6 +99,8 @@ public class DrawUserPair : DrawPairBase
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
protected override float DrawRightSide(float textPosY, float originalY)
|
protected override float DrawRightSide(float textPosY, float originalY)
|
||||||
{
|
{
|
||||||
var pauseIcon = _pair.UserPair!.OwnPermissions.IsPaused() ? FontAwesomeIcon.Play : FontAwesomeIcon.Pause;
|
var pauseIcon = _pair.UserPair!.OwnPermissions.IsPaused() ? FontAwesomeIcon.Play : FontAwesomeIcon.Pause;
|
||||||
|
@@ -454,7 +454,7 @@ internal sealed class GroupPanel
|
|||||||
ImGui.Separator();
|
ImGui.Separator();
|
||||||
if (_mareConfig.Current.SortSyncshellsByVRAM)
|
if (_mareConfig.Current.SortSyncshellsByVRAM)
|
||||||
{
|
{
|
||||||
List<DrawGroupPair> sortedVisibleUsers = visibleUsers.OrderBy(o=>o._VRAMBytes).ToList();
|
List<DrawGroupPair> sortedVisibleUsers = visibleUsers.OrderBy(o=>o.VramUsage).ToList();
|
||||||
_uidDisplayHandler.RenderPairList(sortedVisibleUsers);
|
_uidDisplayHandler.RenderPairList(sortedVisibleUsers);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@@ -1078,6 +1078,8 @@ public class SettingsUi : WindowMediatorSubscriberBase
|
|||||||
if (ImGui.Checkbox("Sort visible syncshell users by VRAM usage", ref sortSyncshellByVRAM))
|
if (ImGui.Checkbox("Sort visible syncshell users by VRAM usage", ref sortSyncshellByVRAM))
|
||||||
{
|
{
|
||||||
_configService.Current.SortSyncshellsByVRAM = sortSyncshellByVRAM;
|
_configService.Current.SortSyncshellsByVRAM = sortSyncshellByVRAM;
|
||||||
|
_logger.LogWarning("Changing value: {sortSyncshellsByVRAM}", sortSyncshellByVRAM);
|
||||||
|
|
||||||
_configService.Save();
|
_configService.Save();
|
||||||
}
|
}
|
||||||
_uiShared.DrawHelpText("This will put users using the most VRAM in a syncshell at the top of the list.");
|
_uiShared.DrawHelpText("This will put users using the most VRAM in a syncshell at the top of the list.");
|
||||||
|
Reference in New Issue
Block a user