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_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
#include(InstallRequiredSystemLibraries)

View file

@ -1,12 +1,12 @@
#include "mainwindow.h"
#include "basketmodel.h"
#include <config.h>
#include "pricedialog.h"
#include "reportdialog.h"
#include "salemodel.h"
#include "sellerdialog.h"
#include "settingsdialog.h"
#include <config.h>
#include <core/csvreader.h>
#include <core/excelreader.h>
@ -55,7 +55,7 @@ MainWindow::MainWindow()
connect(ui_.actionQuit, &QAction::triggered, qApp, QApplication::closeAllWindows,
Qt::QueuedConnection);
connect(ui_.newAction, &QAction::triggered, this, [=]() {
connect(ui_.newAction, &QAction::triggered, this, [this]() {
if (marketplace_->getSellers().size() == 0 && marketplace_->getSales().size() == 0) {
return;
}
@ -105,7 +105,7 @@ MainWindow::MainWindow()
}
}
});
connect(ui_.licenseAction, &QAction::triggered, this, [=]() {
connect(ui_.licenseAction, &QAction::triggered, this, [this]() {
QString licenseText(
"Copyright © 2018-2021 Martin Brodbeck\n\n"
"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.");
QMessageBox::information(this, "Lizenzinformation", licenseText);
});
connect(ui_.reportAction, &QAction::triggered, this, [=]() {
ReportDialog(this).exec();
});
connect(ui_.configAction, &QAction::triggered, this, [=]() {
connect(ui_.reportAction, &QAction::triggered, this, [this]() { ReportDialog(this).exec(); });
connect(ui_.configAction, &QAction::triggered, this, [this]() {
int result = SettingsDialog(this).exec();
if (result == QDialog::Accepted) {
delete ui_.salesView->model();
@ -434,9 +432,7 @@ void MainWindow::onCancelAllArticlesButtonClicked([[maybe_unused]] bool checked)
ui_.sellerNoEdit->setFocus();
}
void MainWindow::onAboutQt() {
QMessageBox::aboutQt(this);
}
void MainWindow::onAboutQt() { QMessageBox::aboutQt(this); }
void MainWindow::onAbout()
{
@ -480,7 +476,8 @@ void MainWindow::onImportSellerExcelActionTriggered()
QMessageBox(QMessageBox::Icon::Critical, "Fehler beim Importieren",
"Beim Import aus der Excel-Datei ist ein Fehler aufgetreten. "
"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;
return;
}

View file

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