code beautifying

This commit is contained in:
Martin Brodbeck 2019-09-30 10:39:00 +02:00
parent 857f706443
commit 2a5cf16998
1 changed files with 11 additions and 9 deletions

View File

@ -11,8 +11,8 @@
#include <utils.h>
#include <excelreader.h>
#include <csvreader.h>
#include <excelreader.h>
#include <posprinter.h>
#include <exception>
@ -47,7 +47,8 @@ MainWindow::MainWindow()
ui_.salesView->header()->setSectionResizeMode(QHeaderView::ResizeToContents);
setSaleModel();
connect(ui_.actionQuit, &QAction::triggered, qApp, QApplication::closeAllWindows, Qt::QueuedConnection);
connect(ui_.actionQuit, &QAction::triggered, qApp, QApplication::closeAllWindows,
Qt::QueuedConnection);
connect(ui_.newAction, &QAction::triggered, this, [=]() {
if (marketplace_->getSellers().size() == 0 && marketplace_->getSales().size() == 0) {
return;
@ -365,14 +366,15 @@ void MainWindow::onCancelSaleButtonClicked([[maybe_unused]] bool checked)
}
ui_.salesView->collapseAll();
QString lastPriceValue(formatCentAsEuroString(0).c_str());
if (ui_.salesView->model()->rowCount() > 0) {
lastPriceValue = ui_.salesView->model()->data(ui_.salesView->model()->index(0, 1)).toString();
lastPriceValue =
ui_.salesView->model()->data(ui_.salesView->model()->index(0, 1)).toString();
}
ui_.lastPriceLabel1->setText(lastPriceValue);
ui_.lastPriceLabel2->setText(lastPriceValue);
updateStatLabel();
}
@ -455,8 +457,9 @@ void MainWindow::onImportSellerExcelActionTriggered()
QMessageBox::StandardButton::Ok, this)
.exec();
auto filename = QFileDialog::getOpenFileName(this, "Verkäufer importieren", QString(),
"Alle unterstützte Dateien (*.xlsx *.csv);;Excel Dateien (*.xlsx);;CSV Dateien (*.csv)");
auto filename = QFileDialog::getOpenFileName(
this, "Verkäufer importieren", QString(),
"Alle unterstützte Dateien (*.xlsx *.csv);;Excel Dateien (*.xlsx);;CSV Dateien (*.csv)");
if (filename.isEmpty())
return;
@ -469,7 +472,7 @@ void MainWindow::onImportSellerExcelActionTriggered()
} else {
numImported = CsvReader::readSellersFromFile(filePath, marketplace_.get());
}
updateStatLabel();
using namespace std::string_literals;
@ -595,4 +598,3 @@ void MainWindow::updateStatLabel()
ui_.statLabel->setText(statistics.c_str());
}