use path to save json file (sellers)
This commit is contained in:
parent
0967a01994
commit
0a1d946397
3 changed files with 6 additions and 4 deletions
|
@ -5,10 +5,10 @@
|
||||||
|
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
|
|
||||||
void JsonUtil::exportSellers(const std::string& filename, Marketplace* market)
|
void JsonUtil::exportSellers(const std::filesystem::path& filePath, Marketplace* market)
|
||||||
{
|
{
|
||||||
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";
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
class JsonUtil
|
class JsonUtil
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static void exportSellers(const std::string& filename, Marketplace* market);
|
static void exportSellers(const std::filesystem::path& filePath, 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::filesystem::path& filePath, 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);
|
||||||
|
|
|
@ -412,7 +412,9 @@ void MainWindow::onExportSellerJsonActionTriggered()
|
||||||
if (filename.isEmpty())
|
if (filename.isEmpty())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
JsonUtil::exportSellers(filename.toStdString(), marketplace_.get());
|
std::filesystem::path filePath(filename.toStdWString());
|
||||||
|
|
||||||
|
JsonUtil::exportSellers(filePath, marketplace_.get());
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::onExportSalesJsonActionTriggered()
|
void MainWindow::onExportSalesJsonActionTriggered()
|
||||||
|
|
Loading…
Reference in a new issue