use path to save json file (sales)

This commit is contained in:
Martin Brodbeck 2018-08-09 13:11:23 +02:00
parent be1d731de3
commit 0967a01994
3 changed files with 6 additions and 4 deletions

View File

@ -67,10 +67,10 @@ void JsonUtil::importSellers(const std::filesystem::path& filePath, Marketplace*
market->storeToDb(); market->storeToDb();
} }
void JsonUtil::exportSales(const std::string& filename, Marketplace* market, int cashPointNo) void JsonUtil::exportSales(const std::filesystem::path& filePath, Marketplace* market, int cashPointNo)
{ {
Json::Value root; Json::Value root;
std::ofstream file(filename); std::ofstream file(filePath);
Json::StreamWriterBuilder builder; Json::StreamWriterBuilder builder;
builder["commentStyle"] = "None"; builder["commentStyle"] = "None";

View File

@ -11,7 +11,7 @@ class JsonUtil
public: public:
static void exportSellers(const std::string& filename, Marketplace* market); static void exportSellers(const std::string& filename, Marketplace* market);
static void importSellers(const std::filesystem::path& filePath, Marketplace* market); static void importSellers(const std::filesystem::path& filePath, Marketplace* market);
static void exportSales(const std::string& filename, Marketplace* market, int cashPointNo); static void exportSales(const std::filesystem::path& filePath, Marketplace* market, int cashPointNo);
static void importSales(const std::filesystem::path& filePath, Marketplace* market, int cashPointNo); static void importSales(const std::filesystem::path& filePath, Marketplace* market, int cashPointNo);
}; };

View File

@ -425,7 +425,9 @@ void MainWindow::onExportSalesJsonActionTriggered()
if (filename.isEmpty()) if (filename.isEmpty())
return; return;
JsonUtil::exportSales(filename.toStdString(), marketplace_.get(), std::filesystem::path filePath(filename.toStdWString());
JsonUtil::exportSales(filePath, marketplace_.get(),
settings.value("global/cashPointNo").toInt()); settings.value("global/cashPointNo").toInt());
} }