summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--client/mainwindow.cc2
-rw-r--r--client/mainwindow.h3
-rw-r--r--client/pracro.cc21
3 files changed, 19 insertions, 7 deletions
diff --git a/client/mainwindow.cc b/client/mainwindow.cc
index 1a63434..ece1572 100644
--- a/client/mainwindow.cc
+++ b/client/mainwindow.cc
@@ -242,6 +242,8 @@ void MainWindow::closeEvent(QCloseEvent *event)
} else {
event->ignore();
}
+
+ emit isClosing();
}
void MainWindow::init()
diff --git a/client/mainwindow.h b/client/mainwindow.h
index 4a06724..524242c 100644
--- a/client/mainwindow.h
+++ b/client/mainwindow.h
@@ -48,6 +48,9 @@ public:
void closeEvent(QCloseEvent *event);
+signals:
+ void isClosing();
+
public slots:
// void update();
void showAbout();
diff --git a/client/pracro.cc b/client/pracro.cc
index 2c9c141..a2f06f3 100644
--- a/client/pracro.cc
+++ b/client/pracro.cc
@@ -182,15 +182,22 @@ int main(int argc, char *argv[])
}
*/
+ MainWindow mainwindow(cpr, course, templ, host, port, user);
+ mainwindow.show();
+
+ PCPViewer *pcpviewer = NULL;
if(show_viewer) {
- PCPViewer pcpviewer(cpr);
- pcpviewer.show();
- return app.exec();
- } else {
- MainWindow mainwindow(cpr, course, templ, host, port, user);
- mainwindow.show();
- return app.exec();
+ pcpviewer = new PCPViewer(cpr);
+ pcpviewer->show();
+ QObject::connect(&mainwindow, SIGNAL(isClosing()),
+ pcpviewer, SLOT(close()));
}
+
+ int ret = app.exec();
+
+ if(pcpviewer) delete pcpviewer;
+
+ return ret;
}
#endif/*TESTING*/