From dac46935c7c72a92022bdfabe7dbe0d0651baaef Mon Sep 17 00:00:00 2001 From: Martin Brodbeck Date: Thu, 9 Aug 2018 16:37:56 +0200 Subject: [PATCH] rename filesystem namespace --- src/core/excelreader.cpp | 4 +++- src/core/jsonutil.cpp | 10 ++++++---- src/gui/mainwindow.cpp | 12 +++++++----- 3 files changed, 16 insertions(+), 10 deletions(-) diff --git a/src/core/excelreader.cpp b/src/core/excelreader.cpp index 4453988..37e2d80 100644 --- a/src/core/excelreader.cpp +++ b/src/core/excelreader.cpp @@ -3,7 +3,9 @@ #include #include -void ExcelReader::readSellersFromFile(const std::filesystem::path& filePath, Marketplace* market) +namespace fs = std::filesystem; + +void ExcelReader::readSellersFromFile(const fs::path& filePath, Marketplace* market) { xlnt::workbook wb; std::ifstream mystream(filePath, std::ios::binary); diff --git a/src/core/jsonutil.cpp b/src/core/jsonutil.cpp index cb6de76..ab4f86c 100644 --- a/src/core/jsonutil.cpp +++ b/src/core/jsonutil.cpp @@ -5,7 +5,9 @@ #include -void JsonUtil::exportSellers(const std::filesystem::path& filePath, Marketplace* market) +namespace fs = std::filesystem; + +void JsonUtil::exportSellers(const fs::path& filePath, Marketplace* market) { Json::Value root; std::ofstream file(filePath); @@ -29,7 +31,7 @@ void JsonUtil::exportSellers(const std::filesystem::path& filePath, Marketplace* writer->write(root, &file); } -void JsonUtil::importSellers(const std::filesystem::path& filePath, Marketplace* market) +void JsonUtil::importSellers(const fs::path& filePath, Marketplace* market) { for (auto& seller : market->getSellers()) { seller->setState(Seller::State::DELETE); @@ -67,7 +69,7 @@ void JsonUtil::importSellers(const std::filesystem::path& filePath, Marketplace* market->storeToDb(); } -void JsonUtil::exportSales(const std::filesystem::path& filePath, Marketplace* market, int cashPointNo) +void JsonUtil::exportSales(const fs::path& filePath, Marketplace* market, int cashPointNo) { Json::Value root; std::ofstream file(filePath); @@ -106,7 +108,7 @@ void JsonUtil::exportSales(const std::filesystem::path& filePath, Marketplace* m writer->write(root, &file); } -void JsonUtil::importSales(const std::filesystem::path& filePath, Marketplace* market, int cashPointNo) +void JsonUtil::importSales(const fs::path& filePath, Marketplace* market, int cashPointNo) { Json::Value jsonValues; std::ifstream file(filePath); diff --git a/src/gui/mainwindow.cpp b/src/gui/mainwindow.cpp index b643204..28c4d6d 100644 --- a/src/gui/mainwindow.cpp +++ b/src/gui/mainwindow.cpp @@ -24,6 +24,8 @@ #include #include +namespace fs = std::filesystem; + constexpr int STATUSBAR_TIMEOUT = 5000; MainWindow::MainWindow() @@ -378,7 +380,7 @@ void MainWindow::onImportSellerExcelActionTriggered() if (filename.isEmpty()) return; - std::filesystem::path filePath(filename.toStdWString()); + fs::path filePath(filename.toStdWString()); ExcelReader::readSellersFromFile(filePath, marketplace_.get()); } @@ -399,7 +401,7 @@ void MainWindow::onImportSellerJsonActionTriggered() if (filename.isEmpty()) return; - std::filesystem::path filePath(filename.toStdWString()); + fs::path filePath(filename.toStdWString()); JsonUtil::importSellers(filePath, marketplace_.get()); } @@ -412,7 +414,7 @@ void MainWindow::onExportSellerJsonActionTriggered() if (filename.isEmpty()) return; - std::filesystem::path filePath(filename.toStdWString()); + fs::path filePath(filename.toStdWString()); JsonUtil::exportSellers(filePath, marketplace_.get()); } @@ -427,7 +429,7 @@ void MainWindow::onExportSalesJsonActionTriggered() if (filename.isEmpty()) return; - std::filesystem::path filePath(filename.toStdWString()); + fs::path filePath(filename.toStdWString()); JsonUtil::exportSales(filePath, marketplace_.get(), settings.value("global/cashPointNo").toInt()); @@ -443,7 +445,7 @@ void MainWindow::onImportSalesJsonActionTriggered() if (filename.isEmpty()) return; - std::filesystem::path filePath(filename.toStdWString()); + fs::path filePath(filename.toStdWString()); delete ui_.salesView->model(); try {