Show statistics, centered at the bottom

This commit is contained in:
Martin Brodbeck 2018-10-08 11:21:11 +02:00
parent cfc632a986
commit 8e5080b888
3 changed files with 68 additions and 4 deletions

View File

@ -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("<b>KIMA2 - Version ");
statistics += PROJECT_VERSION;
statistics += "</b><br />Verkäufer: " + std::to_string(marketplace_->getSellers().size() - 1);
statistics += "<br />Kunden: " + std::to_string(marketplace_->getSales().size());
statistics += "<br />Umsatz: " + marketplace_->getOverallSumAsString();
ui_.statLabel->setText(statistics.c_str());
}

View File

@ -47,6 +47,7 @@ class MainWindow : public QMainWindow
void setSaleModel();
void writeGeometry();
void readGeometry();
void updateStatLabel();
Ui::MainWindow ui_;
std::unique_ptr<Marketplace> marketplace_;

View File

@ -92,7 +92,16 @@
<bool>false</bool>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<property name="margin">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
@ -331,6 +340,37 @@ drucken</string>
</property>
</spacer>
</item>
<item>
<widget class="QLabel" name="statLabel">
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
<property name="text">
<string/>
</property>
<property name="textFormat">
<enum>Qt::RichText</enum>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<layout class="QVBoxLayout" name="verticalLayout_6">
<item>
@ -379,7 +419,7 @@ drucken</string>
<x>0</x>
<y>0</y>
<width>817</width>
<height>29</height>
<height>24</height>
</rect>
</property>
<widget class="QMenu" name="menu_Datei">
@ -433,8 +473,7 @@ drucken</string>
<action name="actionQuit">
<property name="icon">
<iconset theme="application-exit">
<normaloff/>
</iconset>
<normaloff>.</normaloff>.</iconset>
</property>
<property name="text">
<string>&amp;Beenden</string>