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();
}
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;
std::ofstream file(filename);
std::ofstream file(filePath);
Json::StreamWriterBuilder builder;
builder["commentStyle"] = "None";

View file

@ -11,7 +11,7 @@ class JsonUtil
public:
static void exportSellers(const std::string& filename, 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);
};

View file

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