diff --git a/app/controller.cpp b/app/controller.cpp index 7c4b9d4e02488601e9b403bed6c5301c310506fb..261624894564e0d521db3fb49c2e43c2b8dbd57a 100644 --- a/app/controller.cpp +++ b/app/controller.cpp @@ -36,3 +36,9 @@ void Controller::update(){ //eltCollection.update(); // } + +void Controller::quit() +{ + eltCollection.clear(); + system("rm .listT .nbT .userT"); +} diff --git a/app/controller.h b/app/controller.h index 4ce2c7e904f0772d90aab94dc931664cce5053f6..afce1432b44ad2fda64b8d62b06e1ce6ea7f6e17 100644 --- a/app/controller.h +++ b/app/controller.h @@ -15,8 +15,8 @@ class Controller : public QObject Q_OBJECT public: - Controller(MainWindow*); + void quit(); public slots : void update(); diff --git a/app/elementstablemodel.cpp b/app/elementstablemodel.cpp index 302b7dcc88f9a36a6554ec220a5cea317cc00c68..8f81ddf8cb341c2feb53bf6d388a2b71014cb4aa 100644 --- a/app/elementstablemodel.cpp +++ b/app/elementstablemodel.cpp @@ -120,6 +120,16 @@ void ElementsTableModel::removeTask(Task* task){ endRemoveRows(); } +void ElementsTableModel::clear() +{ + beginRemoveRows(QModelIndex(), 0, rowCount()); + for (int i = 0; i < taskVector.size(); ++i) { + free(taskVector.value(i)); + qDebug() << "free"; + } + taskVector.clear(); + endRemoveRows(); +} bool ElementsTableModel::insertRows(int row, int count, const QModelIndex &parent) diff --git a/app/elementstablemodel.h b/app/elementstablemodel.h index b1a462890058cea87ee7f4d64ea01bc71066f3c8..cb399e2fe8e9beb098ef4db0b5ea1024fc940c43 100644 --- a/app/elementstablemodel.h +++ b/app/elementstablemodel.h @@ -46,6 +46,8 @@ public: void writeCSV(QFile * file); + void clear(); + private: //QMap<int, Task> taskMap; diff --git a/app/main.cpp b/app/main.cpp index f30c28df1a7ad1e5e97df2762181ec35fc3f9c64..df5b08a10a1c0bd07818894d4806f64a82c15e37 100644 --- a/app/main.cpp +++ b/app/main.cpp @@ -14,5 +14,8 @@ int main(int argc, char *argv[]) Controller * _controller = new Controller(&w); - return a.exec(); + int ex = a.exec(); + _controller->quit(); + + return ex; } diff --git a/app/mainwindow.cpp b/app/mainwindow.cpp index 7b93e32cf3e9cf50761453c07419ce05b6e65d41..e0a6e93443f980167446f0c175344c400ff0fcb5 100644 --- a/app/mainwindow.cpp +++ b/app/mainwindow.cpp @@ -126,12 +126,7 @@ void MainWindow::on_comboBox_currentTextChanged(const QString &arg1) } -void MainWindow::on_actionQuitter_triggered() -{ - -} - void MainWindow::on_actionQuit_triggered() { - on_actionQuitter_triggered(); + QApplication::quit(); } diff --git a/app/mainwindow.h b/app/mainwindow.h index 1d1107d0d8136066ec7e06cf814a8edf825af6cb..cf788c445724ebf767cbb78858294c74b1d0cee3 100644 --- a/app/mainwindow.h +++ b/app/mainwindow.h @@ -38,9 +38,6 @@ private slots: void on_comboBox_currentTextChanged(const QString &arg1); - - void on_actionQuitter_triggered(); - void on_actionQuit_triggered(); private: diff --git a/app/mainwindow.ui b/app/mainwindow.ui index fb3b52854517e7f4a361d804c7bc90128978050a..45fa5777cdcf2a39120c0664f7b96da7052e9b8e 100644 --- a/app/mainwindow.ui +++ b/app/mainwindow.ui @@ -366,11 +366,6 @@ <addaction name="menuLanguage"/> <addaction name="menuDisplay_2"/> </widget> - <action name="actionQuitter"> - <property name="text"> - <string>Quitter</string> - </property> - </action> <action name="actionFR"> <property name="text"> <string>FR</string> @@ -401,11 +396,6 @@ <string>Night Model</string> </property> </action> - <action name="actionCreate_task"> - <property name="text"> - <string>Create task</string> - </property> - </action> <action name="actionExport_actual_state"> <property name="text"> <string>Export actual state</string>