mirror of
https://github.com/vcmi/vcmi.git
synced 2025-03-21 21:17:49 +02:00
add sort for changedate
This commit is contained in:
parent
d6cf050b6b
commit
8b262e49a6
7
Mods/vcmi/Sprites/lobby/selectionTabSortDate.json
Normal file
7
Mods/vcmi/Sprites/lobby/selectionTabSortDate.json
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
{
|
||||||
|
"basepath" : "lobby/",
|
||||||
|
"images" :
|
||||||
|
[
|
||||||
|
{ "frame" : 0, "file" : "selectionTabSortDate.png"}
|
||||||
|
]
|
||||||
|
}
|
BIN
Mods/vcmi/Sprites/lobby/selectionTabSortDate.png
Normal file
BIN
Mods/vcmi/Sprites/lobby/selectionTabSortDate.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.4 KiB |
@ -70,6 +70,7 @@
|
|||||||
"vcmi.lobby.mapPreview" : "Map preview",
|
"vcmi.lobby.mapPreview" : "Map preview",
|
||||||
"vcmi.lobby.noPreview" : "no preview",
|
"vcmi.lobby.noPreview" : "no preview",
|
||||||
"vcmi.lobby.noUnderground" : "no underground",
|
"vcmi.lobby.noUnderground" : "no underground",
|
||||||
|
"vcmi.lobby.sortDate" : "Sorts maps by change date",
|
||||||
|
|
||||||
"vcmi.client.errors.missingCampaigns" : "{Missing data files}\n\nCampaigns data files were not found! You may be using incomplete or corrupted Heroes 3 data files. Please reinstall game data.",
|
"vcmi.client.errors.missingCampaigns" : "{Missing data files}\n\nCampaigns data files were not found! You may be using incomplete or corrupted Heroes 3 data files. Please reinstall game data.",
|
||||||
"vcmi.server.errors.existingProcess" : "Another VCMI server process is running. Please terminate it before starting a new game.",
|
"vcmi.server.errors.existingProcess" : "Another VCMI server process is running. Please terminate it before starting a new game.",
|
||||||
|
@ -70,6 +70,7 @@
|
|||||||
"vcmi.lobby.mapPreview" : "Kartenvorschau",
|
"vcmi.lobby.mapPreview" : "Kartenvorschau",
|
||||||
"vcmi.lobby.noPreview" : "Keine Vorschau",
|
"vcmi.lobby.noPreview" : "Keine Vorschau",
|
||||||
"vcmi.lobby.noUnderground" : "Kein Untergrund",
|
"vcmi.lobby.noUnderground" : "Kein Untergrund",
|
||||||
|
"vcmi.lobby.sortDate" : "Ordnet Karten nach Änderungsdatum",
|
||||||
|
|
||||||
"vcmi.server.errors.existingProcess" : "Es läuft ein weiterer vcmiserver-Prozess, bitte beendet diesen zuerst",
|
"vcmi.server.errors.existingProcess" : "Es läuft ein weiterer vcmiserver-Prozess, bitte beendet diesen zuerst",
|
||||||
"vcmi.server.errors.modsToEnable" : "{Erforderliche Mods um das Spiel zu laden}",
|
"vcmi.server.errors.modsToEnable" : "{Erforderliche Mods um das Spiel zu laden}",
|
||||||
|
@ -110,6 +110,8 @@ bool mapSorter::operator()(const std::shared_ptr<ElementInfo> aaa, const std::sh
|
|||||||
return boost::ilexicographical_compare(a->name.toString(), b->name.toString());
|
return boost::ilexicographical_compare(a->name.toString(), b->name.toString());
|
||||||
case _fileName: //by filename
|
case _fileName: //by filename
|
||||||
return boost::ilexicographical_compare(aaa->fileURI, bbb->fileURI);
|
return boost::ilexicographical_compare(aaa->fileURI, bbb->fileURI);
|
||||||
|
case _changeDate: //by changedate
|
||||||
|
return aaa->lastWrite < bbb->lastWrite;
|
||||||
default:
|
default:
|
||||||
return boost::ilexicographical_compare(a->name.toString(), b->name.toString());
|
return boost::ilexicographical_compare(a->name.toString(), b->name.toString());
|
||||||
}
|
}
|
||||||
@ -152,6 +154,8 @@ SelectionTab::SelectionTab(ESelectionScreen Type)
|
|||||||
|
|
||||||
generalSortingBy = getSortBySelectionScreen(tabType);
|
generalSortingBy = getSortBySelectionScreen(tabType);
|
||||||
|
|
||||||
|
bool enableUiEnhancements = settings["general"]["enableUiEnhancements"].Bool();
|
||||||
|
|
||||||
if(tabType != ESelectionScreen::campaignList)
|
if(tabType != ESelectionScreen::campaignList)
|
||||||
{
|
{
|
||||||
sortingBy = _format;
|
sortingBy = _format;
|
||||||
@ -208,6 +212,12 @@ SelectionTab::SelectionTab(ESelectionScreen Type)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(enableUiEnhancements)
|
||||||
|
{
|
||||||
|
buttonsSortBy.push_back(std::make_shared<CButton>(Point(371, 85), AnimationPath::builtin("lobby/selectionTabSortDate"), CButton::tooltip("", CGI->generaltexth->translate("vcmi.lobby.sortDate")), std::bind(&SelectionTab::sortBy, this, ESortBy::_changeDate)));
|
||||||
|
buttonsSortBy.back()->setAnimateLonelyFrame(true);
|
||||||
|
}
|
||||||
|
|
||||||
iconsMapFormats = GH.renderHandler().loadAnimation(AnimationPath::builtin("SCSELC.DEF"));
|
iconsMapFormats = GH.renderHandler().loadAnimation(AnimationPath::builtin("SCSELC.DEF"));
|
||||||
iconsVictoryCondition = GH.renderHandler().loadAnimation(AnimationPath::builtin("SCNRVICT.DEF"));
|
iconsVictoryCondition = GH.renderHandler().loadAnimation(AnimationPath::builtin("SCNRVICT.DEF"));
|
||||||
iconsLossCondition = GH.renderHandler().loadAnimation(AnimationPath::builtin("SCNRLOSS.DEF"));
|
iconsLossCondition = GH.renderHandler().loadAnimation(AnimationPath::builtin("SCNRLOSS.DEF"));
|
||||||
@ -215,7 +225,7 @@ SelectionTab::SelectionTab(ESelectionScreen Type)
|
|||||||
listItems.push_back(std::make_shared<ListItem>(Point(30, 129 + i * 25), iconsMapFormats, iconsVictoryCondition, iconsLossCondition));
|
listItems.push_back(std::make_shared<ListItem>(Point(30, 129 + i * 25), iconsMapFormats, iconsVictoryCondition, iconsLossCondition));
|
||||||
|
|
||||||
labelTabTitle = std::make_shared<CLabel>(205, 28, FONT_MEDIUM, ETextAlignment::CENTER, Colors::YELLOW, tabTitle);
|
labelTabTitle = std::make_shared<CLabel>(205, 28, FONT_MEDIUM, ETextAlignment::CENTER, Colors::YELLOW, tabTitle);
|
||||||
slider = std::make_shared<CSlider>(Point(372, 86), tabType != ESelectionScreen::saveGame ? 480 : 430, std::bind(&SelectionTab::sliderMove, this, _1), positionsToShow, (int)curItems.size(), 0, Orientation::VERTICAL, CSlider::BLUE);
|
slider = std::make_shared<CSlider>(Point(372, 86 + (enableUiEnhancements ? 30 : 0)), (tabType != ESelectionScreen::saveGame ? 480 : 430) - (enableUiEnhancements ? 30 : 0), std::bind(&SelectionTab::sliderMove, this, _1), positionsToShow, (int)curItems.size(), 0, Orientation::VERTICAL, CSlider::BLUE);
|
||||||
slider->setPanningStep(24);
|
slider->setPanningStep(24);
|
||||||
|
|
||||||
// create scroll bounds that encompass all area in this UI element to the left of slider (including area of slider itself)
|
// create scroll bounds that encompass all area in this UI element to the left of slider (including area of slider itself)
|
||||||
|
@ -23,7 +23,7 @@ class IImage;
|
|||||||
|
|
||||||
enum ESortBy
|
enum ESortBy
|
||||||
{
|
{
|
||||||
_playerAm, _size, _format, _name, _viccon, _loscon, _numOfMaps, _fileName
|
_playerAm, _size, _format, _name, _viccon, _loscon, _numOfMaps, _fileName, _changeDate
|
||||||
}; //_numOfMaps is for campaigns
|
}; //_numOfMaps is for campaigns
|
||||||
|
|
||||||
class ElementInfo : public CMapInfo
|
class ElementInfo : public CMapInfo
|
||||||
|
@ -64,8 +64,8 @@ void CMapInfo::saveInit(const ResourcePath & file)
|
|||||||
originalFileURI = file.getOriginalName();
|
originalFileURI = file.getOriginalName();
|
||||||
fullFileURI = boost::filesystem::canonical(*CResourceHandler::get()->getResourceName(file)).string();
|
fullFileURI = boost::filesystem::canonical(*CResourceHandler::get()->getResourceName(file)).string();
|
||||||
countPlayers();
|
countPlayers();
|
||||||
std::time_t time = boost::filesystem::last_write_time(*CResourceHandler::get()->getResourceName(file));
|
lastWrite = boost::filesystem::last_write_time(*CResourceHandler::get()->getResourceName(file));
|
||||||
date = TextOperations::getFormattedDateTimeLocal(time);
|
date = TextOperations::getFormattedDateTimeLocal(lastWrite);
|
||||||
|
|
||||||
// We absolutely not need this data for lobby and server will read it from save
|
// We absolutely not need this data for lobby and server will read it from save
|
||||||
// FIXME: actually we don't want them in CMapHeader!
|
// FIXME: actually we don't want them in CMapHeader!
|
||||||
|
@ -28,8 +28,9 @@ public:
|
|||||||
std::unique_ptr<Campaign> campaign; //may be nullptr if scenario
|
std::unique_ptr<Campaign> campaign; //may be nullptr if scenario
|
||||||
StartInfo * scenarioOptionsOfSave; // Options with which scenario has been started (used only with saved games)
|
StartInfo * scenarioOptionsOfSave; // Options with which scenario has been started (used only with saved games)
|
||||||
std::string fileURI;
|
std::string fileURI;
|
||||||
std::string originalFileURI;
|
std::string originalFileURI; // no need to serialize
|
||||||
std::string fullFileURI;
|
std::string fullFileURI; // no need to serialize
|
||||||
|
std::time_t lastWrite; // no need to serialize
|
||||||
std::string date;
|
std::string date;
|
||||||
int amountOfPlayersOnMap;
|
int amountOfPlayersOnMap;
|
||||||
int amountOfHumanControllablePlayers;
|
int amountOfHumanControllablePlayers;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user