mirror of
https://github.com/vcmi/vcmi.git
synced 2025-01-26 03:52:01 +02:00
Merge pull request #3460 from Laserlicht/changedate_sort
add sort for changedate
This commit is contained in:
commit
eae3d806db
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.noPreview" : "no preview",
|
||||
"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.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.noPreview" : "Keine Vorschau",
|
||||
"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.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());
|
||||
case _fileName: //by filename
|
||||
return boost::ilexicographical_compare(aaa->fileURI, bbb->fileURI);
|
||||
case _changeDate: //by changedate
|
||||
return aaa->lastWrite < bbb->lastWrite;
|
||||
default:
|
||||
return boost::ilexicographical_compare(a->name.toString(), b->name.toString());
|
||||
}
|
||||
@ -149,9 +151,11 @@ SelectionTab::SelectionTab(ESelectionScreen Type)
|
||||
: CIntObject(LCLICK | SHOW_POPUP | KEYBOARD | DOUBLECLICK), callOnSelect(nullptr), tabType(Type), selectionPos(0), sortModeAscending(true), inputNameRect{32, 539, 350, 20}, curFolder(""), currentMapSizeFilter(0), showRandom(false)
|
||||
{
|
||||
OBJ_CONSTRUCTION;
|
||||
|
||||
|
||||
generalSortingBy = getSortBySelectionScreen(tabType);
|
||||
|
||||
bool enableUiEnhancements = settings["general"]["enableUiEnhancements"].Bool();
|
||||
|
||||
if(tabType != ESelectionScreen::campaignList)
|
||||
{
|
||||
sortingBy = _format;
|
||||
@ -208,6 +212,12 @@ SelectionTab::SelectionTab(ESelectionScreen Type)
|
||||
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"));
|
||||
iconsVictoryCondition = GH.renderHandler().loadAnimation(AnimationPath::builtin("SCNRVICT.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));
|
||||
|
||||
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);
|
||||
|
||||
// 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
|
||||
{
|
||||
_playerAm, _size, _format, _name, _viccon, _loscon, _numOfMaps, _fileName
|
||||
_playerAm, _size, _format, _name, _viccon, _loscon, _numOfMaps, _fileName, _changeDate
|
||||
}; //_numOfMaps is for campaigns
|
||||
|
||||
class ElementInfo : public CMapInfo
|
||||
|
@ -64,8 +64,8 @@ void CMapInfo::saveInit(const ResourcePath & file)
|
||||
originalFileURI = file.getOriginalName();
|
||||
fullFileURI = boost::filesystem::canonical(*CResourceHandler::get()->getResourceName(file)).string();
|
||||
countPlayers();
|
||||
std::time_t time = boost::filesystem::last_write_time(*CResourceHandler::get()->getResourceName(file));
|
||||
date = TextOperations::getFormattedDateTimeLocal(time);
|
||||
lastWrite = boost::filesystem::last_write_time(*CResourceHandler::get()->getResourceName(file));
|
||||
date = TextOperations::getFormattedDateTimeLocal(lastWrite);
|
||||
|
||||
// We absolutely not need this data for lobby and server will read it from save
|
||||
// FIXME: actually we don't want them in CMapHeader!
|
||||
|
@ -28,8 +28,9 @@ public:
|
||||
std::unique_ptr<Campaign> campaign; //may be nullptr if scenario
|
||||
StartInfo * scenarioOptionsOfSave; // Options with which scenario has been started (used only with saved games)
|
||||
std::string fileURI;
|
||||
std::string originalFileURI;
|
||||
std::string fullFileURI;
|
||||
std::string originalFileURI; // no need to serialize
|
||||
std::string fullFileURI; // no need to serialize
|
||||
std::time_t lastWrite; // no need to serialize
|
||||
std::string date;
|
||||
int amountOfPlayersOnMap;
|
||||
int amountOfHumanControllablePlayers;
|
||||
|
Loading…
x
Reference in New Issue
Block a user