Repository: RetroAchievements/RAIntegration
Pull request #1079 (2024-04-12 14:16:06)

add Seconds as Minutes to leaderboard format list
https://discord.com/channels/310192285306454017/310195377993416714/1228338799138967554


Patch:
diff --git a/src/ui/viewmodels/AssetEditorViewModel.cpp b/src/ui/viewmodels/AssetEditorViewModel.cpp
index ed2000c5..01323daa 100644
--- a/src/ui/viewmodels/AssetEditorViewModel.cpp
+++ b/src/ui/viewmodels/AssetEditorViewModel.cpp
@@ -60,19 +60,20 @@ AssetEditorViewModel::AssetEditorViewModel() noexcept
     m_vAchievementTypes.Add(ra::etoi(ra::data::models::AchievementType::Progression), L"Progression");
     m_vAchievementTypes.Add(ra::etoi(ra::data::models::AchievementType::Win), L"Win");
 
-    m_vFormats.Add(ra::etoi(ra::data::ValueFormat::Value), L"Value");
     m_vFormats.Add(ra::etoi(ra::data::ValueFormat::Score), L"Score");
-    m_vFormats.Add(ra::etoi(ra::data::ValueFormat::Frames), L"Frames");
-    m_vFormats.Add(ra::etoi(ra::data::ValueFormat::Centiseconds), L"Centiseconds");
-    m_vFormats.Add(ra::etoi(ra::data::ValueFormat::Seconds), L"Seconds");
-    m_vFormats.Add(ra::etoi(ra::data::ValueFormat::Minutes), L"Minutes");
-    m_vFormats.Add(ra::etoi(ra::data::ValueFormat::Fixed1), L"Fixed1");
-    m_vFormats.Add(ra::etoi(ra::data::ValueFormat::Fixed2), L"Fixed2");
-    m_vFormats.Add(ra::etoi(ra::data::ValueFormat::Fixed3), L"Fixed3");
-    m_vFormats.Add(ra::etoi(ra::data::ValueFormat::Tens), L"Tens");
-    m_vFormats.Add(ra::etoi(ra::data::ValueFormat::Hundreds), L"Hundreds");
-    m_vFormats.Add(ra::etoi(ra::data::ValueFormat::Thousands), L"Thousands");
-    m_vFormats.Add(ra::etoi(ra::data::ValueFormat::UnsignedValue), L"Unsigned Value");
+    m_vFormats.Add(ra::etoi(ra::data::ValueFormat::Frames), L"Time (Frames)");
+    m_vFormats.Add(ra::etoi(ra::data::ValueFormat::Centiseconds), L"Time (Centiseconds)");
+    m_vFormats.Add(ra::etoi(ra::data::ValueFormat::Seconds), L"Time (Seconds)");
+    m_vFormats.Add(ra::etoi(ra::data::ValueFormat::Minutes), L"Time (Minutes)");
+    m_vFormats.Add(ra::etoi(ra::data::ValueFormat::SecondsAsMinutes), L"Time (Seconds as Minutes)");
+    m_vFormats.Add(ra::etoi(ra::data::ValueFormat::Value), L"Value");
+    m_vFormats.Add(ra::etoi(ra::data::ValueFormat::UnsignedValue), L"Value (Unsigned)");
+    m_vFormats.Add(ra::etoi(ra::data::ValueFormat::Tens), L"Value (Tens)");
+    m_vFormats.Add(ra::etoi(ra::data::ValueFormat::Hundreds), L"Value (Hundreds)");
+    m_vFormats.Add(ra::etoi(ra::data::ValueFormat::Thousands), L"Value (Thousands)");
+    m_vFormats.Add(ra::etoi(ra::data::ValueFormat::Fixed1), L"Value (Fixed1)");
+    m_vFormats.Add(ra::etoi(ra::data::ValueFormat::Fixed2), L"Value (Fixed2)");
+    m_vFormats.Add(ra::etoi(ra::data::ValueFormat::Fixed3), L"Value (Fixed3)");
 
     m_vLeaderboardParts.Add(ra::etoi(LeaderboardPart::Start), L"Start");
     m_vLeaderboardParts.Add(ra::etoi(LeaderboardPart::Cancel), L"Cancel");
diff --git a/src/ui/win32/AssetEditorDialog.cpp b/src/ui/win32/AssetEditorDialog.cpp
index cb54bb49..8aee808c 100644
--- a/src/ui/win32/AssetEditorDialog.cpp
+++ b/src/ui/win32/AssetEditorDialog.cpp
@@ -986,7 +986,7 @@ BOOL AssetEditorDialog::OnInitDialog()
     }
 
     SendMessage(::GetDlgItem(GetHWND(), IDC_RA_TYPE), CB_SETDROPPEDWIDTH, 70, 0);
-    SendMessage(::GetDlgItem(GetHWND(), IDC_RA_FORMAT), CB_SETDROPPEDWIDTH, 80, 0);
+    SendMessage(::GetDlgItem(GetHWND(), IDC_RA_FORMAT), CB_SETDROPPEDWIDTH, 136, 0);
 
     return DialogBase::OnInitDialog();
 }


Test patch:
diff --git a/tests/ui/viewmodels/AssetEditorViewModel_Tests.cpp b/tests/ui/viewmodels/AssetEditorViewModel_Tests.cpp
index 3ebcd2e5..151a7d63 100644
--- a/tests/ui/viewmodels/AssetEditorViewModel_Tests.cpp
+++ b/tests/ui/viewmodels/AssetEditorViewModel_Tests.cpp
@@ -144,33 +144,35 @@ public:
         Assert::AreEqual((int)ra::data::models::AchievementType::Win, editor.AchievementTypes().GetItemAt(3)->GetId());
         Assert::AreEqual(std::wstring(L"Win"), editor.AchievementTypes().GetItemAt(3)->GetLabel());
 
-        Assert::AreEqual({ 13U }, editor.Formats().Count());
-        Assert::AreEqual((int)ra::data::ValueFormat::Value, editor.Formats().GetItemAt(0)->GetId());
-        Assert::AreEqual(std::wstring(L"Value"), editor.Formats().GetItemAt(0)->GetLabel());
-        Assert::AreEqual((int)ra::data::ValueFormat::Score, editor.Formats().GetItemAt(1)->GetId());
-        Assert::AreEqual(std::wstring(L"Score"), editor.Formats().GetItemAt(1)->GetLabel());
-        Assert::AreEqual((int)ra::data::ValueFormat::Frames, editor.Formats().GetItemAt(2)->GetId());
-        Assert::AreEqual(std::wstring(L"Frames"), editor.Formats().GetItemAt(2)->GetLabel());
-        Assert::AreEqual((int)ra::data::ValueFormat::Centiseconds, editor.Formats().GetItemAt(3)->GetId());
-        Assert::AreEqual(std::wstring(L"Centiseconds"), editor.Formats().GetItemAt(3)->GetLabel());
-        Assert::AreEqual((int)ra::data::ValueFormat::Seconds, editor.Formats().GetItemAt(4)->GetId());
-        Assert::AreEqual(std::wstring(L"Seconds"), editor.Formats().GetItemAt(4)->GetLabel());
-        Assert::AreEqual((int)ra::data::ValueFormat::Minutes, editor.Formats().GetItemAt(5)->GetId());
-        Assert::AreEqual(std::wstring(L"Minutes"), editor.Formats().GetItemAt(5)->GetLabel());
-        Assert::AreEqual((int)ra::data::ValueFormat::Fixed1, editor.Formats().GetItemAt(6)->GetId());
-        Assert::AreEqual(std::wstring(L"Fixed1"), editor.Formats().GetItemAt(6)->GetLabel());
-        Assert::AreEqual((int)ra::data::ValueFormat::Fixed2, editor.Formats().GetItemAt(7)->GetId());
-        Assert::AreEqual(std::wstring(L"Fixed2"), editor.Formats().GetItemAt(7)->GetLabel());
-        Assert::AreEqual((int)ra::data::ValueFormat::Fixed3, editor.Formats().GetItemAt(8)->GetId());
-        Assert::AreEqual(std::wstring(L"Fixed3"), editor.Formats().GetItemAt(8)->GetLabel());
-        Assert::AreEqual((int)ra::data::ValueFormat::Tens, editor.Formats().GetItemAt(9)->GetId());
-        Assert::AreEqual(std::wstring(L"Tens"), editor.Formats().GetItemAt(9)->GetLabel());
-        Assert::AreEqual((int)ra::data::ValueFormat::Hundreds, editor.Formats().GetItemAt(10)->GetId());
-        Assert::AreEqual(std::wstring(L"Hundreds"), editor.Formats().GetItemAt(10)->GetLabel());
-        Assert::AreEqual((int)ra::data::ValueFormat::Thousands, editor.Formats().GetItemAt(11)->GetId());
-        Assert::AreEqual(std::wstring(L"Thousands"), editor.Formats().GetItemAt(11)->GetLabel());
-        Assert::AreEqual((int)ra::data::ValueFormat::UnsignedValue, editor.Formats().GetItemAt(12)->GetId());
-        Assert::AreEqual(std::wstring(L"Unsigned Value"), editor.Formats().GetItemAt(12)->GetLabel());
+        Assert::AreEqual({ 14U }, editor.Formats().Count());
+        Assert::AreEqual((int)ra::data::ValueFormat::Score, editor.Formats().GetItemAt(0)->GetId());
+        Assert::AreEqual(std::wstring(L"Score"), editor.Formats().GetItemAt(0)->GetLabel());
+        Assert::AreEqual((int)ra::data::ValueFormat::Frames, editor.Formats().GetItemAt(1)->GetId());
+        Assert::AreEqual(std::wstring(L"Time (Frames)"), editor.Formats().GetItemAt(1)->GetLabel());
+        Assert::AreEqual((int)ra::data::ValueFormat::Centiseconds, editor.Formats().GetItemAt(2)->GetId());
+        Assert::AreEqual(std::wstring(L"Time (Centiseconds)"), editor.Formats().GetItemAt(2)->GetLabel());
+        Assert::AreEqual((int)ra::data::ValueFormat::Seconds, editor.Formats().GetItemAt(3)->GetId());
+        Assert::AreEqual(std::wstring(L"Time (Seconds)"), editor.Formats().GetItemAt(3)->GetLabel());
+        Assert::AreEqual((int)ra::data::ValueFormat::Minutes, editor.Formats().GetItemAt(4)->GetId());
+        Assert::AreEqual(std::wstring(L"Time (Minutes)"), editor.Formats().GetItemAt(4)->GetLabel());
+        Assert::AreEqual((int)ra::data::ValueFormat::SecondsAsMinutes, editor.Formats().GetItemAt(5)->GetId());
+        Assert::AreEqual(std::wstring(L"Time (Seconds as Minutes)"), editor.Formats().GetItemAt(5)->GetLabel());
+        Assert::AreEqual((int)ra::data::ValueFormat::Value, editor.Formats().GetItemAt(6)->GetId());
+        Assert::AreEqual(std::wstring(L"Value"), editor.Formats().GetItemAt(6)->GetLabel());
+        Assert::AreEqual((int)ra::data::ValueFormat::UnsignedValue, editor.Formats().GetItemAt(7)->GetId());
+        Assert::AreEqual(std::wstring(L"Value (Unsigned)"), editor.Formats().GetItemAt(7)->GetLabel());
+        Assert::AreEqual((int)ra::data::ValueFormat::Tens, editor.Formats().GetItemAt(8)->GetId());
+        Assert::AreEqual(std::wstring(L"Value (Tens)"), editor.Formats().GetItemAt(8)->GetLabel());
+        Assert::AreEqual((int)ra::data::ValueFormat::Hundreds, editor.Formats().GetItemAt(9)->GetId());
+        Assert::AreEqual(std::wstring(L"Value (Hundreds)"), editor.Formats().GetItemAt(9)->GetLabel());
+        Assert::AreEqual((int)ra::data::ValueFormat::Thousands, editor.Formats().GetItemAt(10)->GetId());
+        Assert::AreEqual(std::wstring(L"Value (Thousands)"), editor.Formats().GetItemAt(10)->GetLabel());
+        Assert::AreEqual((int)ra::data::ValueFormat::Fixed1, editor.Formats().GetItemAt(11)->GetId());
+        Assert::AreEqual(std::wstring(L"Value (Fixed1)"), editor.Formats().GetItemAt(11)->GetLabel());
+        Assert::AreEqual((int)ra::data::ValueFormat::Fixed2, editor.Formats().GetItemAt(12)->GetId());
+        Assert::AreEqual(std::wstring(L"Value (Fixed2)"), editor.Formats().GetItemAt(12)->GetLabel());
+        Assert::AreEqual((int)ra::data::ValueFormat::Fixed3, editor.Formats().GetItemAt(13)->GetId());
+        Assert::AreEqual(std::wstring(L"Value (Fixed3)"), editor.Formats().GetItemAt(13)->GetLabel());
 
         Assert::AreEqual({ 4U }, editor.LeaderboardParts().Count());
         Assert::AreEqual((int)AssetEditorViewModel::LeaderboardPart::Start, editor.LeaderboardParts().GetItemAt(0)->GetId());