From f8e858a204bdcfc955ebcec20a78d7a41f6076f5 Mon Sep 17 00:00:00 2001 From: Bent Bisballe Nyeng Date: Thu, 3 Nov 2011 11:07:10 +0100 Subject: Show pcpviewer side-by-side with mainwindow and close it upon mainwindow close. --- client/mainwindow.cc | 2 ++ client/mainwindow.h | 3 +++ client/pracro.cc | 21 ++++++++++++++------- 3 files changed, 19 insertions(+), 7 deletions(-) (limited to 'client') 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*/ -- cgit v1.2.3