seller menu simplified.

This commit is contained in:
Martin Brodbeck 2023-01-18 17:05:21 +01:00
parent c4ccd43b45
commit b0444112a8
3 changed files with 7 additions and 69 deletions

View file

@ -138,10 +138,6 @@ MainWindow::MainWindow()
});
connect(m_ui.importSellerAction, &QAction::triggered, this,
&MainWindow::onImportSellerActionTriggered);
connect(m_ui.importSellerJsonAction, &QAction::triggered, this,
&MainWindow::onImportSellerJsonActionTriggered);
connect(m_ui.exportSellerJsonAction, &QAction::triggered, this,
&MainWindow::onExportSellerJsonActionTriggered);
connect(m_ui.exportSalesJsonAction, &QAction::triggered, this,
&MainWindow::onExportSalesJsonActionTriggered);
connect(m_ui.importSalesJsonAction, &QAction::triggered, this,
@ -483,59 +479,6 @@ void MainWindow::onImportSellerActionTriggered()
.exec();
}
void MainWindow::onImportSellerJsonActionTriggered()
{
if (!m_marketplace->getSales().empty()) {
QMessageBox(QMessageBox::Icon::Information, "Import nicht möglich",
"Der Import ist nicht möglich, da schon Verkäufe getätigt wurden.",
QMessageBox::StandardButton::Ok, this)
.exec();
return;
}
auto filename = QFileDialog::getOpenFileName(this, "Verkäufer importieren", QString(),
"JSON Dateien (*.json)");
if (filename.isEmpty())
return;
#if defined(_WIN64) || defined(_WIN32)
fs::path filePath(filename.toStdWString());
#else
fs::path filePath(filename.toStdString());
#endif
std::size_t numImported{};
numImported = JsonUtil::importSellers(filePath, m_marketplace.get());
updateStatLabel();
using namespace std::string_literals;
std::ostringstream msg;
msg << "Aus der JSON-Datei wurden <b>"s << std::to_string(numImported)
<< "</b> Verkäufer importiert.";
QMessageBox(QMessageBox::Icon::Information, "Verkäufer erfolgreich importiert",
msg.str().c_str(), QMessageBox::StandardButton::Ok, this)
.exec();
}
void MainWindow::onExportSellerJsonActionTriggered()
{
auto filename = QFileDialog::getSaveFileName(
this, "Verkäufer exportieren", QString("kima2_verkaeufer.json"), "JSON Dateien (*.json)");
if (filename.isEmpty())
return;
#if defined(_WIN64) || defined(_WIN32)
fs::path filePath(filename.toStdWString());
#else
fs::path filePath(filename.toStdString());
#endif
JsonUtil::exportSellers(filePath, m_marketplace.get());
}
void MainWindow::onExportSalesJsonActionTriggered()
{
QSettings settings;

View file

@ -40,8 +40,6 @@ class MainWindow : public QMainWindow
void onPaidButtonTriggered();
void onGivenSpinBoxValueChanged(double value);
void onImportSellerActionTriggered();
void onImportSellerJsonActionTriggered();
void onExportSellerJsonActionTriggered();
void onExportSalesJsonActionTriggered();
void onImportSalesJsonActionTriggered();
void setSaleModel();

View file

@ -440,16 +440,8 @@ drucken</string>
<property name="title">
<string>&amp;Verkäufer</string>
</property>
<widget class="QMenu" name="importSellerMenu">
<property name="title">
<string>Importieren</string>
</property>
<addaction name="importSellerAction"/>
<addaction name="importSellerJsonAction"/>
</widget>
<addaction name="actionEditSeller"/>
<addaction name="importSellerMenu"/>
<addaction name="exportSellerJsonAction"/>
<addaction name="importSellerAction"/>
</widget>
<widget class="QMenu" name="menuHilfe">
<property name="title">
@ -513,7 +505,7 @@ drucken</string>
<string>Exportieren für andere Kasse (JSON)</string>
</property>
</action>
<action name="importSellerAction">
<action name="importSellerActionX">
<property name="text">
<string>Aus CSV-Datei (initial)</string>
</property>
@ -548,6 +540,11 @@ drucken</string>
<string>Lizenz</string>
</property>
</action>
<action name="importSellerAction">
<property name="text">
<string>Importieren (aus CSV-Datei)</string>
</property>
</action>
</widget>
<resources/>
<connections/>