From 8e5080b888ee0ff8137761ca5aa2e39677f0b086 Mon Sep 17 00:00:00 2001 From: Martin Brodbeck Date: Mon, 8 Oct 2018 11:21:11 +0200 Subject: [PATCH] Show statistics, centered at the bottom --- src/gui/mainwindow.cpp | 24 +++++++++++++++++++++ src/gui/mainwindow.h | 1 + src/gui/mainwindow.ui | 47 ++++++++++++++++++++++++++++++++++++++---- 3 files changed, 68 insertions(+), 4 deletions(-) diff --git a/src/gui/mainwindow.cpp b/src/gui/mainwindow.cpp index 52d26f5..420e4a3 100644 --- a/src/gui/mainwindow.cpp +++ b/src/gui/mainwindow.cpp @@ -139,6 +139,8 @@ MainWindow::MainWindow() readGeometry(); setWindowIcon(QIcon(":/misc/kima2.ico")); + + updateStatLabel(); } void MainWindow::onActionEditSellerTriggered() @@ -159,6 +161,8 @@ void MainWindow::onActionEditSellerTriggered() } setSaleModel(); + updateStatLabel(); + } void MainWindow::setSaleModel() @@ -189,6 +193,8 @@ void MainWindow::onPaidButtonTriggered() ui_.drawbackContainerWidget->setEnabled(false); ui_.sellerNoEdit->setFocus(); statusBar()->showMessage("Verkaufsvorgang erfolgreich durchgeführt.", STATUSBAR_TIMEOUT); + updateStatLabel(); + } } @@ -350,6 +356,7 @@ void MainWindow::onCancelSaleButtonClicked([[maybe_unused]] bool checked) } ui_.salesView->collapseAll(); + updateStatLabel(); } void MainWindow::onPrintSaleReceiptButtonClicked([[maybe_unused]] bool checked) @@ -436,6 +443,8 @@ void MainWindow::onImportSellerExcelActionTriggered() fs::path filePath(filename.toStdWString()); ExcelReader::readSellersFromFile(filePath, marketplace_.get()); + updateStatLabel(); + } void MainWindow::onImportSellerJsonActionTriggered() @@ -457,6 +466,8 @@ void MainWindow::onImportSellerJsonActionTriggered() fs::path filePath(filename.toStdWString()); JsonUtil::importSellers(filePath, marketplace_.get()); + updateStatLabel(); + } void MainWindow::onExportSellerJsonActionTriggered() @@ -510,6 +521,8 @@ void MainWindow::onImportSalesJsonActionTriggered() .exec(); } setSaleModel(); + updateStatLabel(); + } void MainWindow::writeGeometry() @@ -537,3 +550,14 @@ void MainWindow::closeEvent(QCloseEvent* event) writeGeometry(); event->accept(); } + +void MainWindow::updateStatLabel() +{ + std::string statistics("KIMA2 - Version "); + statistics += PROJECT_VERSION; + statistics += "
Verkäufer: " + std::to_string(marketplace_->getSellers().size() - 1); + statistics += "
Kunden: " + std::to_string(marketplace_->getSales().size()); + statistics += "
Umsatz: " + marketplace_->getOverallSumAsString(); + + ui_.statLabel->setText(statistics.c_str()); +} \ No newline at end of file diff --git a/src/gui/mainwindow.h b/src/gui/mainwindow.h index 07cb554..755faa0 100644 --- a/src/gui/mainwindow.h +++ b/src/gui/mainwindow.h @@ -47,6 +47,7 @@ class MainWindow : public QMainWindow void setSaleModel(); void writeGeometry(); void readGeometry(); + void updateStatLabel(); Ui::MainWindow ui_; std::unique_ptr marketplace_; diff --git a/src/gui/mainwindow.ui b/src/gui/mainwindow.ui index 5a54859..8dba7e1 100644 --- a/src/gui/mainwindow.ui +++ b/src/gui/mainwindow.ui @@ -92,7 +92,16 @@ false - + + 0 + + + 0 + + + 0 + + 0 @@ -331,6 +340,37 @@ drucken + + + + + 10 + + + + + + + Qt::RichText + + + Qt::AlignCenter + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + @@ -379,7 +419,7 @@ drucken 0 0 817 - 29 + 24 @@ -433,8 +473,7 @@ drucken - - + .. &Beenden