MCDO fixes 2
implement RestoreThenUpload for charadata cleanup, actually show success/failure actually sort chara data list lmao add shared character data sets display to main ui (partial) increase size of mcdo table slightly fix selecting last new entry
This commit is contained in:
@@ -38,8 +38,9 @@ internal sealed partial class CharaDataHubUi
|
||||
}
|
||||
|
||||
var indent = ImRaii.PushIndent(10f);
|
||||
if (canUpdate || (!_charaDataManager.UploadTask?.IsCompleted ?? false))
|
||||
if (canUpdate || _charaDataManager.UploadTask != null)
|
||||
{
|
||||
ImGuiHelpers.ScaledDummy(5);
|
||||
UiSharedService.DrawGrouped(() =>
|
||||
{
|
||||
if (canUpdate)
|
||||
@@ -84,6 +85,11 @@ internal sealed partial class CharaDataHubUi
|
||||
}
|
||||
});
|
||||
}
|
||||
else if (_charaDataManager.UploadTask?.IsCompleted ?? false)
|
||||
{
|
||||
var color = UiSharedService.GetBoolColor(_charaDataManager.UploadTask.Result.Success);
|
||||
UiSharedService.ColorTextWrapped(_charaDataManager.UploadTask.Result.Output, color);
|
||||
}
|
||||
});
|
||||
}
|
||||
indent.Dispose();
|
||||
@@ -359,7 +365,7 @@ internal sealed partial class CharaDataHubUi
|
||||
if (_uiSharedService.IconTextButton(FontAwesomeIcon.Trash, "Delete Character Data"))
|
||||
{
|
||||
_ = _charaDataManager.DeleteCharaData(dataDto);
|
||||
_selectedDtoId = string.Empty;
|
||||
SelectedDtoId = string.Empty;
|
||||
}
|
||||
}
|
||||
if (!UiSharedService.CtrlPressed())
|
||||
@@ -548,7 +554,7 @@ internal sealed partial class CharaDataHubUi
|
||||
}
|
||||
|
||||
using (var table = ImRaii.Table("Own Character Data", 12, ImGuiTableFlags.RowBg | ImGuiTableFlags.SizingFixedFit | ImGuiTableFlags.ScrollY,
|
||||
new Vector2(ImGui.GetWindowContentRegionMax().X - ImGui.GetWindowContentRegionMin().X, 100)))
|
||||
new Vector2(ImGui.GetWindowContentRegionMax().X - ImGui.GetWindowContentRegionMin().X, 110)))
|
||||
{
|
||||
if (table)
|
||||
{
|
||||
@@ -566,11 +572,11 @@ internal sealed partial class CharaDataHubUi
|
||||
ImGui.TableSetupColumn("Expires", ImGuiTableColumnFlags.WidthFixed, 18);
|
||||
ImGui.TableSetupScrollFreeze(0, 1);
|
||||
ImGui.TableHeadersRow();
|
||||
foreach (var entry in _charaDataManager.OwnCharaData.Values)
|
||||
foreach (var entry in _charaDataManager.OwnCharaData.Values.OrderBy(b => b.CreatedDate))
|
||||
{
|
||||
var uDto = _charaDataManager.GetUpdateDto(entry.Id);
|
||||
ImGui.TableNextColumn();
|
||||
if (string.Equals(entry.Id, _selectedDtoId, StringComparison.Ordinal))
|
||||
if (string.Equals(entry.Id, SelectedDtoId, StringComparison.Ordinal))
|
||||
_uiSharedService.IconText(FontAwesomeIcon.CaretRight);
|
||||
|
||||
ImGui.TableNextColumn();
|
||||
@@ -587,48 +593,48 @@ internal sealed partial class CharaDataHubUi
|
||||
{
|
||||
ImGui.TextUnformatted(idText);
|
||||
}
|
||||
if (ImGui.IsItemClicked()) _selectedDtoId = entry.Id;
|
||||
if (ImGui.IsItemClicked()) SelectedDtoId = entry.Id;
|
||||
|
||||
ImGui.TableNextColumn();
|
||||
ImGui.TextUnformatted(entry.Description);
|
||||
if (ImGui.IsItemClicked()) _selectedDtoId = entry.Id;
|
||||
if (ImGui.IsItemClicked()) SelectedDtoId = entry.Id;
|
||||
UiSharedService.AttachToolTip(entry.Description);
|
||||
|
||||
ImGui.TableNextColumn();
|
||||
ImGui.TextUnformatted(entry.CreatedDate.ToLocalTime().ToString());
|
||||
if (ImGui.IsItemClicked()) _selectedDtoId = entry.Id;
|
||||
if (ImGui.IsItemClicked()) SelectedDtoId = entry.Id;
|
||||
|
||||
ImGui.TableNextColumn();
|
||||
ImGui.TextUnformatted(entry.UpdatedDate.ToLocalTime().ToString());
|
||||
if (ImGui.IsItemClicked()) _selectedDtoId = entry.Id;
|
||||
if (ImGui.IsItemClicked()) SelectedDtoId = entry.Id;
|
||||
|
||||
ImGui.TableNextColumn();
|
||||
ImGui.TextUnformatted(entry.DownloadCount.ToString());
|
||||
if (ImGui.IsItemClicked()) _selectedDtoId = entry.Id;
|
||||
if (ImGui.IsItemClicked()) SelectedDtoId = entry.Id;
|
||||
|
||||
ImGui.TableNextColumn();
|
||||
bool isDownloadable = !entry.HasMissingFiles
|
||||
&& !string.IsNullOrEmpty(entry.GlamourerData);
|
||||
_uiSharedService.BooleanToColoredIcon(isDownloadable, false);
|
||||
if (ImGui.IsItemClicked()) _selectedDtoId = entry.Id;
|
||||
if (ImGui.IsItemClicked()) SelectedDtoId = entry.Id;
|
||||
UiSharedService.AttachToolTip(isDownloadable ? "Can be downloaded by others" : "Cannot be downloaded: Has missing files or data, please review this entry manually");
|
||||
|
||||
ImGui.TableNextColumn();
|
||||
var count = entry.FileGamePaths.Concat(entry.FileSwaps).Count();
|
||||
ImGui.TextUnformatted(count.ToString());
|
||||
if (ImGui.IsItemClicked()) _selectedDtoId = entry.Id;
|
||||
if (ImGui.IsItemClicked()) SelectedDtoId = entry.Id;
|
||||
UiSharedService.AttachToolTip(count == 0 ? "No File data attached" : "Has File data attached");
|
||||
|
||||
ImGui.TableNextColumn();
|
||||
bool hasGlamourerData = !string.IsNullOrEmpty(entry.GlamourerData);
|
||||
_uiSharedService.BooleanToColoredIcon(hasGlamourerData, false);
|
||||
if (ImGui.IsItemClicked()) _selectedDtoId = entry.Id;
|
||||
if (ImGui.IsItemClicked()) SelectedDtoId = entry.Id;
|
||||
UiSharedService.AttachToolTip(string.IsNullOrEmpty(entry.GlamourerData) ? "No Glamourer data attached" : "Has Glamourer data attached");
|
||||
|
||||
ImGui.TableNextColumn();
|
||||
bool hasCustomizeData = !string.IsNullOrEmpty(entry.CustomizeData);
|
||||
_uiSharedService.BooleanToColoredIcon(hasCustomizeData, false);
|
||||
if (ImGui.IsItemClicked()) _selectedDtoId = entry.Id;
|
||||
if (ImGui.IsItemClicked()) SelectedDtoId = entry.Id;
|
||||
UiSharedService.AttachToolTip(string.IsNullOrEmpty(entry.CustomizeData) ? "No Customize+ data attached" : "Has Customize+ data attached");
|
||||
|
||||
ImGui.TableNextColumn();
|
||||
@@ -636,7 +642,7 @@ internal sealed partial class CharaDataHubUi
|
||||
if (!Equals(DateTime.MaxValue, entry.ExpiryDate))
|
||||
eIcon = FontAwesomeIcon.Clock;
|
||||
_uiSharedService.IconText(eIcon, ImGuiColors.DalamudYellow);
|
||||
if (ImGui.IsItemClicked()) _selectedDtoId = entry.Id;
|
||||
if (ImGui.IsItemClicked()) SelectedDtoId = entry.Id;
|
||||
if (eIcon != FontAwesomeIcon.None)
|
||||
{
|
||||
UiSharedService.AttachToolTip($"This entry will expire on {entry.ExpiryDate.ToLocalTime()}");
|
||||
@@ -690,12 +696,12 @@ internal sealed partial class CharaDataHubUi
|
||||
var charaDataEntries = _charaDataManager.OwnCharaData.Count;
|
||||
if (charaDataEntries != _dataEntries && _selectNewEntry && _charaDataManager.OwnCharaData.Any())
|
||||
{
|
||||
_selectedDtoId = _charaDataManager.OwnCharaData.Last().Value.Id;
|
||||
SelectedDtoId = _charaDataManager.OwnCharaData.OrderBy(o => o.Value.CreatedDate).Last().Value.Id;
|
||||
_selectNewEntry = false;
|
||||
}
|
||||
_dataEntries = _charaDataManager.OwnCharaData.Count;
|
||||
|
||||
_ = _charaDataManager.OwnCharaData.TryGetValue(_selectedDtoId, out var dto);
|
||||
_ = _charaDataManager.OwnCharaData.TryGetValue(SelectedDtoId, out var dto);
|
||||
DrawEditCharaData(dto);
|
||||
}
|
||||
|
||||
|
||||
@@ -47,6 +47,19 @@ internal sealed partial class CharaDataHubUi : WindowMediatorSubscriberBase
|
||||
private bool _openMcdOnlineOnNextRun = false;
|
||||
private bool _readExport;
|
||||
private string _selectedDtoId = string.Empty;
|
||||
private string SelectedDtoId
|
||||
{
|
||||
get => _selectedDtoId;
|
||||
set
|
||||
{
|
||||
if (!string.Equals(_selectedDtoId, value, StringComparison.Ordinal))
|
||||
{
|
||||
_charaDataManager.UploadTask = null;
|
||||
_selectedDtoId = value;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
private string _selectedSpecificUserIndividual = string.Empty;
|
||||
private string _selectedSpecificGroupIndividual = string.Empty;
|
||||
private string _sharedWithYouDescriptionFilter = string.Empty;
|
||||
@@ -76,8 +89,17 @@ internal sealed partial class CharaDataHubUi : WindowMediatorSubscriberBase
|
||||
_fileDialogManager = fileDialogManager;
|
||||
_pairManager = pairManager;
|
||||
Mediator.Subscribe<GposeStartMessage>(this, (_) => IsOpen |= _configService.Current.OpenMareHubOnGposeStart);
|
||||
Mediator.Subscribe<OpenCharaDataHubWithFilterMessage>(this, (msg) =>
|
||||
{
|
||||
IsOpen = true;
|
||||
_openDataApplicationShared = true;
|
||||
_sharedWithYouOwnerFilter = msg.UserData.AliasOrUID;
|
||||
UpdateFilteredItems();
|
||||
});
|
||||
}
|
||||
|
||||
private bool _openDataApplicationShared = false;
|
||||
|
||||
public string CharaName(string name)
|
||||
{
|
||||
if (_abbreviateCharaName)
|
||||
@@ -98,7 +120,7 @@ internal sealed partial class CharaDataHubUi : WindowMediatorSubscriberBase
|
||||
}
|
||||
|
||||
_closalCts.Cancel();
|
||||
_selectedDtoId = string.Empty;
|
||||
SelectedDtoId = string.Empty;
|
||||
_filteredDict = null;
|
||||
_sharedWithYouOwnerFilter = string.Empty;
|
||||
_importCode = string.Empty;
|
||||
@@ -180,7 +202,7 @@ internal sealed partial class CharaDataHubUi : WindowMediatorSubscriberBase
|
||||
_isHandlingSelf = _charaDataManager.HandledCharaData.Any(c => c.IsSelf);
|
||||
if (_isHandlingSelf) _openMcdOnlineOnNextRun = false;
|
||||
|
||||
using (var applicationTabItem = ImRaii.TabItem("Data Application"))
|
||||
using (var applicationTabItem = ImRaii.TabItem("Data Application", _openDataApplicationShared ? ImGuiTabItemFlags.SetSelected : ImGuiTabItemFlags.None))
|
||||
{
|
||||
if (applicationTabItem)
|
||||
{
|
||||
@@ -216,7 +238,7 @@ internal sealed partial class CharaDataHubUi : WindowMediatorSubscriberBase
|
||||
}
|
||||
}
|
||||
|
||||
using (var gposeTabItem = ImRaii.TabItem("Apply Data"))
|
||||
using (var gposeTabItem = ImRaii.TabItem("Apply Data", _openDataApplicationShared ? ImGuiTabItemFlags.SetSelected : ImGuiTabItemFlags.None))
|
||||
{
|
||||
if (gposeTabItem)
|
||||
{
|
||||
@@ -677,7 +699,7 @@ internal sealed partial class CharaDataHubUi : WindowMediatorSubscriberBase
|
||||
}
|
||||
}
|
||||
|
||||
using (var sharedWithYouTabItem = ImRaii.TabItem("Shared With You"))
|
||||
using (var sharedWithYouTabItem = ImRaii.TabItem("Shared With You", _openDataApplicationShared ? ImGuiTabItemFlags.SetSelected : ImGuiTabItemFlags.None))
|
||||
{
|
||||
using var id = ImRaii.PushId("sharedWithYouTab");
|
||||
if (sharedWithYouTabItem)
|
||||
@@ -691,8 +713,12 @@ internal sealed partial class CharaDataHubUi : WindowMediatorSubscriberBase
|
||||
|
||||
DrawUpdateSharedDataButton();
|
||||
|
||||
|
||||
UiSharedService.DrawTree("Filters", () =>
|
||||
int activeFilters = 0;
|
||||
if (!string.IsNullOrEmpty(_sharedWithYouOwnerFilter)) activeFilters++;
|
||||
if (!string.IsNullOrEmpty(_sharedWithYouDescriptionFilter)) activeFilters++;
|
||||
if (_sharedWithYouDownloadableFilter) activeFilters++;
|
||||
string filtersText = activeFilters == 0 ? "Filters" : $"Filters ({activeFilters} active)";
|
||||
UiSharedService.DrawTree($"{filtersText}##filters", () =>
|
||||
{
|
||||
var filterWidth = ImGui.GetWindowContentRegionMax().X - ImGui.GetWindowContentRegionMin().X;
|
||||
ImGui.SetNextItemWidth(filterWidth);
|
||||
@@ -731,6 +757,9 @@ internal sealed partial class CharaDataHubUi : WindowMediatorSubscriberBase
|
||||
ImGuiHelpers.ScaledDummy(5);
|
||||
foreach (var entry in _filteredDict ?? [])
|
||||
{
|
||||
bool isFilteredAndHasToBeOpened = entry.Key.Contains(_sharedWithYouOwnerFilter) && _openDataApplicationShared;
|
||||
if (isFilteredAndHasToBeOpened)
|
||||
ImGui.SetNextItemOpen(isFilteredAndHasToBeOpened);
|
||||
UiSharedService.DrawTree($"{entry.Key} - [{entry.Value.Count} Character Data Sets]##{entry.Key}", () =>
|
||||
{
|
||||
foreach (var data in entry.Value)
|
||||
@@ -739,6 +768,8 @@ internal sealed partial class CharaDataHubUi : WindowMediatorSubscriberBase
|
||||
}
|
||||
ImGuiHelpers.ScaledDummy(5);
|
||||
});
|
||||
if (isFilteredAndHasToBeOpened)
|
||||
_openDataApplicationShared = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -912,7 +943,7 @@ internal sealed partial class CharaDataHubUi : WindowMediatorSubscriberBase
|
||||
{
|
||||
if (_uiSharedService.IconTextButton(FontAwesomeIcon.Edit, "Open in MCD Online Editor"))
|
||||
{
|
||||
_selectedDtoId = data.Id;
|
||||
SelectedDtoId = data.Id;
|
||||
_openMcdOnlineOnNextRun = true;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user