summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBent Bisballe Nyeng <deva@aasimon.org>2011-11-03 11:07:10 +0100
committerBent Bisballe Nyeng <deva@aasimon.org>2011-11-03 11:07:10 +0100
commitf8e858a204bdcfc955ebcec20a78d7a41f6076f5 (patch)
tree604664e88d52dc0718fab27a674011f082eaee26
parent8910e356af01a11cf769b891c1aa51eed2cf960f (diff)
Show pcpviewer side-by-side with mainwindow and close it upon mainwindow close.
-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*/