Save secondary list sorting.

Allow sorting by platform ascending.

Fixes issue 5774.
This commit is contained in:
rog 2012-12-17 06:08:45 -05:00
parent 351979795c
commit 4c7b63cf0e
4 changed files with 27 additions and 10 deletions

View File

@ -212,6 +212,7 @@ void SConfig::SaveSettings()
ini.Set("GameList", "ListTaiwan", m_ListTaiwan);
ini.Set("GameList", "ListUnknown", m_ListUnknown);
ini.Set("GameList", "ListSort", m_ListSort);
ini.Set("GameList", "ListSortSecondary", m_ListSort2);
// Core
ini.Set("Core", "HLE_BS2", m_LocalCoreStartupParameter.bHLE_BS2);
@ -350,7 +351,8 @@ void SConfig::LoadSettings()
ini.Get("GameList", "ListKorea", &m_ListKorea, true);
ini.Get("GameList", "ListTaiwan", &m_ListTaiwan, true);
ini.Get("GameList", "ListUnknown", &m_ListUnknown, true);
ini.Get("GameList", "ListSort", &m_ListSort, 2);
ini.Get("GameList", "ListSort", &m_ListSort, 3);
ini.Get("GameList", "ListSortSecondary",&m_ListSort2, 0);
// Core
ini.Get("Core", "HLE_BS2", &m_LocalCoreStartupParameter.bHLE_BS2, false);

View File

@ -62,7 +62,6 @@ struct SConfig : NonCopyable
bool m_InterfaceLogWindow;
bool m_InterfaceLogConfigWindow;
bool m_InterfaceConsole;
int m_ListSort;
bool m_ListDrives;
bool m_ListWad;
@ -76,6 +75,9 @@ struct SConfig : NonCopyable
bool m_ListKorea;
bool m_ListTaiwan;
bool m_ListUnknown;
int m_ListSort;
int m_ListSort2;
std::string m_WirelessMac;
bool m_PauseMovie;
bool m_ShowLag;

View File

@ -51,6 +51,7 @@
size_t CGameListCtrl::m_currentItem = 0;
size_t CGameListCtrl::m_numberItem = 0;
std::string CGameListCtrl::m_currentFilename;
bool sorted = false;
static int CompareGameListItems(const GameListItem* iso1, const GameListItem* iso2,
long sortData = CGameListCtrl::COLUMN_TITLE)
@ -284,6 +285,7 @@ void CGameListCtrl::Update()
InitBitmaps();
// add columns
InsertColumn(COLUMN_DUMMY,_T(""));
InsertColumn(COLUMN_PLATFORM, _T(""));
InsertColumn(COLUMN_BANNER, _("Banner"));
InsertColumn(COLUMN_TITLE, _("Title"));
@ -303,6 +305,7 @@ void CGameListCtrl::Update()
#endif
// set initial sizes for columns
SetColumnWidth(COLUMN_DUMMY,0);
SetColumnWidth(COLUMN_PLATFORM, 35 + platform_padding);
SetColumnWidth(COLUMN_BANNER, 96 + platform_padding);
SetColumnWidth(COLUMN_TITLE, 200 + platform_padding);
@ -320,9 +323,14 @@ void CGameListCtrl::Update()
// Sort items by Title
wxListEvent event;
event.m_col = SConfig::GetInstance().m_ListSort; last_column = 0;
event.m_col = SConfig::GetInstance().m_ListSort2;
last_column = 1;
OnColumnClick(event);
event.m_col = SConfig::GetInstance().m_ListSort;
OnColumnClick(event);
sorted = true;
SetColumnWidth(COLUMN_SIZE, wxLIST_AUTOSIZE);
}
else
@ -414,9 +422,11 @@ void CGameListCtrl::InsertItemInReportView(long _Index)
GameListItem& rISOFile = *m_ISOFiles[_Index];
m_gamePath.append(rISOFile.GetFileName() + '\n');
// Insert a first row with the platform image, that will be used as the Index
long ItemIndex = InsertItem(_Index, wxEmptyString,
m_PlatformImageIndex[rISOFile.GetPlatform()]);
// Insert a first row with nothing in it, that will be used as the Index
long ItemIndex = InsertItem(_Index, wxEmptyString);
// Insert the platform's image in the first (visible) column
SetItemColumnImage(_Index, COLUMN_PLATFORM, m_PlatformImageIndex[rISOFile.GetPlatform()]);
if (rISOFile.GetImage().IsOk())
ImageIndex = m_imageListSmall->Add(rISOFile.GetImage());
@ -708,10 +718,12 @@ void CGameListCtrl::OnColumnClick(wxListEvent& event)
}
else
{
if (sorted)
SConfig::GetInstance().m_ListSort2 = last_sort;
last_column = current_column;
last_sort = current_column;
}
if (sorted)
SConfig::GetInstance().m_ListSort = last_sort;
caller = this;
SortItems(wxListCompare, last_sort);

View File

@ -57,7 +57,8 @@ public:
enum
{
COLUMN_PLATFORM = 0,
COLUMN_DUMMY = 0,
COLUMN_PLATFORM,
COLUMN_BANNER,
COLUMN_TITLE,
COLUMN_NOTES,