mirror of
https://github.com/vcmi/vcmi.git
synced 2025-11-25 22:42:04 +02:00
csv export
This commit is contained in:
@@ -163,6 +163,8 @@
|
|||||||
"vcmi.systemOptions.townsGroup" : "Town Screen",
|
"vcmi.systemOptions.townsGroup" : "Town Screen",
|
||||||
|
|
||||||
"vcmi.statisticWindow.statistic" : "Statistic",
|
"vcmi.statisticWindow.statistic" : "Statistic",
|
||||||
|
"vcmi.statisticWindow.csvSave" : "Save as CSV",
|
||||||
|
"vcmi.statisticWindow.csvSaved" : "CSV saved!",
|
||||||
|
|
||||||
"vcmi.systemOptions.fullscreenBorderless.hover" : "Fullscreen (borderless)",
|
"vcmi.systemOptions.fullscreenBorderless.hover" : "Fullscreen (borderless)",
|
||||||
"vcmi.systemOptions.fullscreenBorderless.help" : "{Borderless Fullscreen}\n\nIf selected, VCMI will run in borderless fullscreen mode. In this mode, game will always use same resolution as desktop, ignoring selected resolution.",
|
"vcmi.systemOptions.fullscreenBorderless.help" : "{Borderless Fullscreen}\n\nIf selected, VCMI will run in borderless fullscreen mode. In this mode, game will always use same resolution as desktop, ignoring selected resolution.",
|
||||||
|
|||||||
@@ -163,6 +163,8 @@
|
|||||||
"vcmi.systemOptions.townsGroup" : "Stadt-Bildschirm",
|
"vcmi.systemOptions.townsGroup" : "Stadt-Bildschirm",
|
||||||
|
|
||||||
"vcmi.statisticWindow.statistic" : "Statistik",
|
"vcmi.statisticWindow.statistic" : "Statistik",
|
||||||
|
"vcmi.statisticWindow.csvSave" : "Speichere als CSV",
|
||||||
|
"vcmi.statisticWindow.csvSaved" : "CSV gespeichert!",
|
||||||
|
|
||||||
"vcmi.systemOptions.fullscreenBorderless.hover" : "Vollbild (randlos)",
|
"vcmi.systemOptions.fullscreenBorderless.hover" : "Vollbild (randlos)",
|
||||||
"vcmi.systemOptions.fullscreenBorderless.help" : "{Randloses Vollbild}\n\nWenn diese Option ausgewählt ist, wird VCMI im randlosen Vollbildmodus ausgeführt. In diesem Modus wird das Spiel immer dieselbe Auflösung wie der Desktop verwenden und die gewählte Auflösung ignorieren.",
|
"vcmi.systemOptions.fullscreenBorderless.help" : "{Randloses Vollbild}\n\nWenn diese Option ausgewählt ist, wird VCMI im randlosen Vollbildmodus ausgeführt. In diesem Modus wird das Spiel immer dieselbe Auflösung wie der Desktop verwenden und die gewählte Auflösung ignorieren.",
|
||||||
|
|||||||
@@ -21,10 +21,14 @@
|
|||||||
#include "../widgets/GraphicalPrimitiveCanvas.h"
|
#include "../widgets/GraphicalPrimitiveCanvas.h"
|
||||||
#include "../widgets/TextControls.h"
|
#include "../widgets/TextControls.h"
|
||||||
#include "../widgets/Buttons.h"
|
#include "../widgets/Buttons.h"
|
||||||
|
#include "../windows/InfoWindows.h"
|
||||||
|
|
||||||
|
#include "../../lib/VCMIDirs.h"
|
||||||
#include "../../lib/gameState/GameStatistics.h"
|
#include "../../lib/gameState/GameStatistics.h"
|
||||||
#include "../../lib/texts/CGeneralTextHandler.h"
|
#include "../../lib/texts/CGeneralTextHandler.h"
|
||||||
|
|
||||||
|
#include <vstd/DateUtils.h>
|
||||||
|
|
||||||
CStatisticScreen::CStatisticScreen(StatisticDataSet stat)
|
CStatisticScreen::CStatisticScreen(StatisticDataSet stat)
|
||||||
: CWindowObject(BORDERED), statistic(stat)
|
: CWindowObject(BORDERED), statistic(stat)
|
||||||
{
|
{
|
||||||
@@ -36,4 +40,17 @@ CStatisticScreen::CStatisticScreen(StatisticDataSet stat)
|
|||||||
layout.push_back(std::make_shared<CMultiLineLabel>(Rect(0, 0, 800, 30), FONT_BIG, ETextAlignment::CENTER, Colors::YELLOW, CGI->generaltexth->translate("vcmi.statisticWindow.statistic")));
|
layout.push_back(std::make_shared<CMultiLineLabel>(Rect(0, 0, 800, 30), FONT_BIG, ETextAlignment::CENTER, Colors::YELLOW, CGI->generaltexth->translate("vcmi.statisticWindow.statistic")));
|
||||||
layout.push_back(std::make_shared<TransparentFilledRectangle>(Rect(10, 30, 780, 530), ColorRGBA(0, 0, 0, 64), ColorRGBA(64, 80, 128, 255), 1));
|
layout.push_back(std::make_shared<TransparentFilledRectangle>(Rect(10, 30, 780, 530), ColorRGBA(0, 0, 0, 64), ColorRGBA(64, 80, 128, 255), 1));
|
||||||
layout.push_back(std::make_shared<CButton>(Point(725, 564), AnimationPath::builtin("MUBCHCK"), CButton::tooltip(), [this](){ close(); }, EShortcut::GLOBAL_ACCEPT));
|
layout.push_back(std::make_shared<CButton>(Point(725, 564), AnimationPath::builtin("MUBCHCK"), CButton::tooltip(), [this](){ close(); }, EShortcut::GLOBAL_ACCEPT));
|
||||||
|
|
||||||
|
buttonCsvSave = std::make_shared<CToggleButton>(Point(10, 564), AnimationPath::builtin("GSPBUT2"), CButton::tooltip(), [this](bool on){
|
||||||
|
const boost::filesystem::path outPath = VCMIDirs::get().userCachePath() / "statistic";
|
||||||
|
boost::filesystem::create_directories(outPath);
|
||||||
|
|
||||||
|
const boost::filesystem::path filePath = outPath / (vstd::getDateTimeISO8601Basic(std::time(nullptr)) + ".csv");
|
||||||
|
std::ofstream file(filePath.c_str());
|
||||||
|
std::string csv = statistic.toCsv();
|
||||||
|
file << csv;
|
||||||
|
|
||||||
|
CInfoWindow::showInfoDialog(CGI->generaltexth->translate("vcmi.statisticWindow.csvSaved") + "\n\n" + filePath.string(), {});
|
||||||
|
});
|
||||||
|
buttonCsvSave->setTextOverlay(CGI->generaltexth->translate("vcmi.statisticWindow.csvSave"), EFonts::FONT_SMALL, Colors::YELLOW);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,6 +12,7 @@
|
|||||||
#include "../../lib/gameState/GameStatistics.h"
|
#include "../../lib/gameState/GameStatistics.h"
|
||||||
|
|
||||||
class FilledTexturePlayerColored;
|
class FilledTexturePlayerColored;
|
||||||
|
class CToggleButton;
|
||||||
|
|
||||||
class CStatisticScreen : public CWindowObject
|
class CStatisticScreen : public CWindowObject
|
||||||
{
|
{
|
||||||
@@ -19,6 +20,8 @@ class CStatisticScreen : public CWindowObject
|
|||||||
|
|
||||||
std::vector<std::shared_ptr<CIntObject>> layout;
|
std::vector<std::shared_ptr<CIntObject>> layout;
|
||||||
|
|
||||||
|
std::shared_ptr<CToggleButton> buttonCsvSave;
|
||||||
|
|
||||||
StatisticDataSet statistic;
|
StatisticDataSet statistic;
|
||||||
public:
|
public:
|
||||||
CStatisticScreen(StatisticDataSet stat);
|
CStatisticScreen(StatisticDataSet stat);
|
||||||
|
|||||||
Reference in New Issue
Block a user