Adopt to C++20

This commit is contained in:
Martin Brodbeck 2022-07-07 15:31:32 +02:00
parent acc3095e60
commit 2b7c099f5e
3 changed files with 56 additions and 59 deletions

View file

@ -4,7 +4,7 @@ project(kima2 VERSION 1.5.3)
set(CMAKE_MODULE_PATH "${CMAKE_HOME_DIRECTORY}/cmake") set(CMAKE_MODULE_PATH "${CMAKE_HOME_DIRECTORY}/cmake")
set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_STANDARD_REQUIRED ON)
#include(InstallRequiredSystemLibraries) #include(InstallRequiredSystemLibraries)

View file

@ -1,12 +1,12 @@
#include "mainwindow.h" #include "mainwindow.h"
#include "basketmodel.h" #include "basketmodel.h"
#include <config.h>
#include "pricedialog.h" #include "pricedialog.h"
#include "reportdialog.h" #include "reportdialog.h"
#include "salemodel.h" #include "salemodel.h"
#include "sellerdialog.h" #include "sellerdialog.h"
#include "settingsdialog.h" #include "settingsdialog.h"
#include <config.h>
#include <core/csvreader.h> #include <core/csvreader.h>
#include <core/excelreader.h> #include <core/excelreader.h>
@ -55,7 +55,7 @@ MainWindow::MainWindow()
connect(ui_.actionQuit, &QAction::triggered, qApp, QApplication::closeAllWindows, connect(ui_.actionQuit, &QAction::triggered, qApp, QApplication::closeAllWindows,
Qt::QueuedConnection); Qt::QueuedConnection);
connect(ui_.newAction, &QAction::triggered, this, [=]() { connect(ui_.newAction, &QAction::triggered, this, [this]() {
if (marketplace_->getSellers().size() == 0 && marketplace_->getSales().size() == 0) { if (marketplace_->getSellers().size() == 0 && marketplace_->getSales().size() == 0) {
return; return;
} }
@ -105,7 +105,7 @@ MainWindow::MainWindow()
} }
} }
}); });
connect(ui_.licenseAction, &QAction::triggered, this, [=]() { connect(ui_.licenseAction, &QAction::triggered, this, [this]() {
QString licenseText( QString licenseText(
"Copyright © 2018-2021 Martin Brodbeck\n\n" "Copyright © 2018-2021 Martin Brodbeck\n\n"
"Hiermit wird unentgeltlich jeder Person, die eine Kopie der Software und der " "Hiermit wird unentgeltlich jeder Person, die eine Kopie der Software und der "
@ -126,10 +126,8 @@ MainWindow::MainWindow()
"SOFTWARE ODER SONSTIGER VERWENDUNG DER SOFTWARE ENTSTANDEN."); "SOFTWARE ODER SONSTIGER VERWENDUNG DER SOFTWARE ENTSTANDEN.");
QMessageBox::information(this, "Lizenzinformation", licenseText); QMessageBox::information(this, "Lizenzinformation", licenseText);
}); });
connect(ui_.reportAction, &QAction::triggered, this, [=]() { connect(ui_.reportAction, &QAction::triggered, this, [this]() { ReportDialog(this).exec(); });
ReportDialog(this).exec(); connect(ui_.configAction, &QAction::triggered, this, [this]() {
});
connect(ui_.configAction, &QAction::triggered, this, [=]() {
int result = SettingsDialog(this).exec(); int result = SettingsDialog(this).exec();
if (result == QDialog::Accepted) { if (result == QDialog::Accepted) {
delete ui_.salesView->model(); delete ui_.salesView->model();
@ -434,9 +432,7 @@ void MainWindow::onCancelAllArticlesButtonClicked([[maybe_unused]] bool checked)
ui_.sellerNoEdit->setFocus(); ui_.sellerNoEdit->setFocus();
} }
void MainWindow::onAboutQt() { void MainWindow::onAboutQt() { QMessageBox::aboutQt(this); }
QMessageBox::aboutQt(this);
}
void MainWindow::onAbout() void MainWindow::onAbout()
{ {
@ -480,7 +476,8 @@ void MainWindow::onImportSellerExcelActionTriggered()
QMessageBox(QMessageBox::Icon::Critical, "Fehler beim Importieren", QMessageBox(QMessageBox::Icon::Critical, "Fehler beim Importieren",
"Beim Import aus der Excel-Datei ist ein Fehler aufgetreten. " "Beim Import aus der Excel-Datei ist ein Fehler aufgetreten. "
"Sie könnten ggf. versuchen, die Daten aus einer .csv Datei zu imporieren.", "Sie könnten ggf. versuchen, die Daten aus einer .csv Datei zu imporieren.",
QMessageBox::StandardButton::Ok, this).exec(); QMessageBox::StandardButton::Ok, this)
.exec();
std::cerr << e.what() << std::endl; std::cerr << e.what() << std::endl;
return; return;
} }

View file

@ -3,9 +3,9 @@
#include "mainwindow.h" #include "mainwindow.h"
#include <core/database.h> #include <core/database.h>
#include <core/utils.h>
#include <printer/posprinter.h> #include <printer/posprinter.h>
#include <printer/utils.h> #include <printer/utils.h>
#include <core/utils.h>
#include <exception> #include <exception>
#include <stdexcept> #include <stdexcept>
@ -35,7 +35,7 @@ SettingsDialog::SettingsDialog(QWidget* parent, Qt::WindowFlags f) : QDialog(par
ui_.feePercentSpinBox->setValue(feeInPercent); ui_.feePercentSpinBox->setValue(feeInPercent);
ui_.maxFeeSpinBox->setValue(maxFeeInEuro); ui_.maxFeeSpinBox->setValue(maxFeeInEuro);
connect(ui_.testPosPrinterButton, &QPushButton::clicked, this, [=]() { connect(ui_.testPosPrinterButton, &QPushButton::clicked, this, [this]() {
using namespace std::string_literals; using namespace std::string_literals;
try { try {
if (ui_.posPrinterDeviceEdit->text().isEmpty()) { if (ui_.posPrinterDeviceEdit->text().isEmpty()) {