replaced pointer by smart pointers

This commit is contained in:
2018-12-28 14:17:47 +01:00
parent 07205459d8
commit d4b4a37847
7 changed files with 77 additions and 68 deletions

View File

@@ -43,7 +43,7 @@ MainWindow::MainWindow(QWidget * parent)
QObject::connect(startRennen, SIGNAL(activated()), this,
SLOT(WindowRennen()));
this->db = new DataBase;
this->db = std::make_shared<DataBase>();
// vector<vector<QString>> daten = db->getData("select * from Fahrer", 2);
}
@@ -52,17 +52,18 @@ void MainWindow::closeEvent(QCloseEvent * event) {
}
MainWindow::~MainWindow() {
delete this->db;
delete ui;
}
void MainWindow::WindowTraining() {
this->interfaceTraining = new Training(this, this->db);
// this->interfaceTraining = new Training(this, this->db);
this->interfaceTraining = std::make_shared<Training>(this, this->db);
this->interfaceTraining->show();
}
void MainWindow::NewWindowSettings() {
this->interfaceSettings = new WindowsSettings(this->db, this);
this->interfaceSettings =
std::make_shared<WindowsSettings>(this->db.get(), this);
this->interfaceSettings->show();
}
@@ -107,15 +108,16 @@ void MainWindow::WindowRennen() {
Q_UNUSED(e);
}
this->interfaceRace = new WindowRace(this->db, this);
this->interfaceRace = std::make_shared<WindowRace>(this->db, this);
this->interfaceRace->show();
this->interfaceRennliste = new WindowRennliste(this->db, this);
this->interfaceRennliste =
std::make_shared<WindowRennliste>(this->db.get(), this);
this->interfaceRennliste->show();
this->interfaceRace->setWindowRennliste(this->interfaceRennliste);
this->interfaceRennliste->setWindowRace(this->interfaceRace);
this->interfaceRennliste->setWindowRace(this->interfaceRace.get());
}
void MainWindow::WindowEvaluation() {
this->interfaceEvaluation = new Evaluation(this->db);
this->interfaceEvaluation = std::make_shared<Evaluation>(this->db.get());
this->interfaceEvaluation->show();
}