1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-11-23 22:37:55 +02:00

add date; cleanup

This commit is contained in:
Laserlicht
2023-09-30 17:56:51 +02:00
committed by GitHub
parent 79e66c38df
commit c6adcc40f5
5 changed files with 20 additions and 10 deletions

View File

@@ -51,6 +51,8 @@
"vcmi.lobby.filename" : "Filename", "vcmi.lobby.filename" : "Filename",
"vcmi.lobby.creationDate" : "Creation date", "vcmi.lobby.creationDate" : "Creation date",
"vcmi.lobby.scenarioName" : "Scenario name",
"vcmi.lobby.mapPreview" : "Map preview",
"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.",
"vcmi.server.errors.modsToEnable" : "{Following mods are required}", "vcmi.server.errors.modsToEnable" : "{Following mods are required}",

View File

@@ -50,6 +50,8 @@
"vcmi.lobby.filename" : "Dateiname", "vcmi.lobby.filename" : "Dateiname",
"vcmi.lobby.creationDate" : "Erstellungsdatum", "vcmi.lobby.creationDate" : "Erstellungsdatum",
"vcmi.lobby.scenarioName" : "Szenario-Name",
"vcmi.lobby.mapPreview" : "Kartenvorschau",
"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}",

View File

@@ -13,6 +13,8 @@
#include "../lobby/SelectionTab.h" #include "../lobby/SelectionTab.h"
#include <vstd/DateUtils.h>
#include "../gui/CGuiHandler.h" #include "../gui/CGuiHandler.h"
#include "../gui/WindowHandler.h" #include "../gui/WindowHandler.h"
#include "../widgets/CComponent.h" #include "../widgets/CComponent.h"
@@ -35,6 +37,7 @@
#include "../../lib/mapping/CMapHeader.h" #include "../../lib/mapping/CMapHeader.h"
#include "../../lib/mapping/MapFormat.h" #include "../../lib/mapping/MapFormat.h"
#include "../../lib/TerrainHandler.h" #include "../../lib/TerrainHandler.h"
#include "../../lib/filesystem/Filesystem.h"
CMapOverview::CMapOverview(std::string mapName, std::string fileName, std::string date, ResourcePath resource, ESelectionScreen tabType) CMapOverview::CMapOverview(std::string mapName, std::string fileName, std::string date, ResourcePath resource, ESelectionScreen tabType)
: CWindowObject(BORDERED | RCLICK_POPUP), resource(resource), mapName(mapName), fileName(fileName), date(date), tabType(tabType) : CWindowObject(BORDERED | RCLICK_POPUP), resource(resource), mapName(mapName), fileName(fileName), date(date), tabType(tabType)
@@ -175,12 +178,15 @@ std::shared_ptr<CLabel> CMapOverview::CMapOverviewWidget::buildDrawString(const
if("mapname" == config["text"].String()) if("mapname" == config["text"].String())
text = parent.mapName; text = parent.mapName;
if("date" == config["text"].String()) if("date" == config["text"].String())
{
if(parent.date.empty()) if(parent.date.empty())
{ {
//std::time_t time = std::time_t time = boost::filesystem::last_write_time(*CResourceHandler::get()->getResourceName(ResourcePath(parent.resource.getName(), EResType::MAP)));
text = vstd::getFormattedDateTime(time);
} }
else else
text = parent.date; text = parent.date;
}
auto position = readPosition(config["position"]); auto position = readPosition(config["position"]);
return std::make_shared<CLabel>(position.x, position.y, font, alignment, color, text); return std::make_shared<CLabel>(position.x, position.y, font, alignment, color, text);
} }

View File

@@ -48,11 +48,11 @@ class CMapOverview : public CWindowObject
std::shared_ptr<CMapOverviewWidget> widget; std::shared_ptr<CMapOverviewWidget> widget;
public: public:
ResourcePath resource; const ResourcePath resource;
std::string mapName; const std::string mapName;
std::string fileName; const std::string fileName;
std::string date; const std::string date;
ESelectionScreen tabType; const ESelectionScreen tabType;
CMapOverview(std::string mapName, std::string fileName, std::string date, ResourcePath resource, ESelectionScreen tabType); CMapOverview(std::string mapName, std::string fileName, std::string date, ResourcePath resource, ESelectionScreen tabType);
}; };

View File

@@ -5,7 +5,7 @@
"name": "background", "name": "background",
"type": "texture", "type": "texture",
"image": "DIBOXBCK", "image": "DIBOXBCK",
"rect": {"w": 428, "h": 500} "rect": {"w": 428, "h": 384}
}, },
{ {
"type": "drawTransparentRect", "type": "drawTransparentRect",
@@ -18,7 +18,7 @@
"font": "medium", "font": "medium",
"alignment": "center", "alignment": "center",
"color": "yellow", "color": "yellow",
"text": "vcmi.lobby.filename", "text": "vcmi.lobby.scenarioName",
"position": {"x": 214, "y": 15} "position": {"x": 214, "y": 15}
}, },
{ {
@@ -46,7 +46,7 @@
"font": "medium", "font": "medium",
"alignment": "center", "alignment": "center",
"color": "yellow", "color": "yellow",
"text": "vcmi.lobby.filename", "text": "vcmi.lobby.mapPreview",
"position": {"x": 214, "y": 65} "position": {"x": 214, "y": 65}
}, },
{ {