Bugfix: Help dialog should kill sub help dialogs (e.g. acceleration help dialog)...
authorToni Jussila <toni.jussila@fudeco.com>
Mon, 26 Apr 2010 10:35:19 +0000 (13:35 +0300)
committerToni Jussila <toni.jussila@fudeco.com>
Mon, 26 Apr 2010 10:35:19 +0000 (13:35 +0300)
Client/helpdialog.cpp
Client/helpdialog.h
Client/mainwindow.cpp
Client/resultdialog.cpp
Client/resultdialog.h

index e63eb35..cfb1b5a 100644 (file)
@@ -1,6 +1,19 @@
+/*
+ * Help dialog
+ *
+ * @author     Janne Änäkkälä <janne.anakkala@fudeco.com>
+ * @author     Toni Jussila    <toni.jussila@fudeco.com>
+ * @copyright  (c) 2010 Speed Freak team
+ * @license    http://opensource.org/licenses/gpl-license.php GNU Public License
+ */
+
 #include "helpdialog.h"
 #include "ui_helpdialog.h"
 #include "helpdialog.h"
 #include "ui_helpdialog.h"
+#include <QDebug>
 
 
+/**
+  * Constructor
+  */
 HelpDialog::HelpDialog(QWidget *parent) :
     QDialog(parent),
     ui(new Ui::HelpDialog)
 HelpDialog::HelpDialog(QWidget *parent) :
     QDialog(parent),
     ui(new Ui::HelpDialog)
@@ -13,11 +26,17 @@ HelpDialog::HelpDialog(QWidget *parent) :
     helpSettingsDialog = NULL;
 }
 
     helpSettingsDialog = NULL;
 }
 
+/**
+  * Destructor
+  */
 HelpDialog::~HelpDialog()
 {
     delete ui;
 }
 
 HelpDialog::~HelpDialog()
 {
     delete ui;
 }
 
+/**
+  *
+  */
 void HelpDialog::changeEvent(QEvent *e)
 {
     QDialog::changeEvent(e);
 void HelpDialog::changeEvent(QEvent *e)
 {
     QDialog::changeEvent(e);
@@ -30,48 +49,105 @@ void HelpDialog::changeEvent(QEvent *e)
     }
 }
 
     }
 }
 
-
+/**
+  *
+  */
 void HelpDialog::on_pushButtonHelpResults_clicked()
 {
     if(!helpResultsDialog)
     {
         helpResultsDialog = new HelpResultsDialog;
     }
 void HelpDialog::on_pushButtonHelpResults_clicked()
 {
     if(!helpResultsDialog)
     {
         helpResultsDialog = new HelpResultsDialog;
     }
+    connect(helpResultsDialog, SIGNAL(rejected()), this, SLOT(killHelpDialogs()));
     helpResultsDialog->show();
 }
 
     helpResultsDialog->show();
 }
 
+/**
+  *
+  */
 void HelpDialog::on_pushButtonHelpAccelerate_clicked()
 {
     if(!helpAccelerationDialog)
     {
         helpAccelerationDialog = new HelpAccelerationDialog;
     }
 void HelpDialog::on_pushButtonHelpAccelerate_clicked()
 {
     if(!helpAccelerationDialog)
     {
         helpAccelerationDialog = new HelpAccelerationDialog;
     }
+    connect(helpAccelerationDialog, SIGNAL(rejected()), this, SLOT(killHelpDialogs()));
     helpAccelerationDialog->show();
 }
 
     helpAccelerationDialog->show();
 }
 
+/**
+  *
+  */
 void HelpDialog::on_pushButtonHelpRoute_clicked()
 {
     if(!helpRoutingDialog)
     {
         helpRoutingDialog = new HelpRoutingDialog;
     }
 void HelpDialog::on_pushButtonHelpRoute_clicked()
 {
     if(!helpRoutingDialog)
     {
         helpRoutingDialog = new HelpRoutingDialog;
     }
+    connect(helpRoutingDialog, SIGNAL(rejected()), this, SLOT(killHelpDialogs()));
     helpRoutingDialog->show();
 }
 
     helpRoutingDialog->show();
 }
 
+/**
+  *
+  */
 void HelpDialog::on_pushButtonCredits_clicked()
 {
     if(!creditsDialog)
     {
         creditsDialog = new CreditsDialog;
     }
 void HelpDialog::on_pushButtonCredits_clicked()
 {
     if(!creditsDialog)
     {
         creditsDialog = new CreditsDialog;
     }
+    connect(creditsDialog, SIGNAL(rejected()), this, SLOT(killHelpDialogs()));
     creditsDialog->show();
 }
 
     creditsDialog->show();
 }
 
+/**
+  *
+  */
 void HelpDialog::on_pushButtonHelpSettings_clicked()
 {
     if(!helpSettingsDialog)
     {
         helpSettingsDialog = new HelpSettingsDialog;
     }
 void HelpDialog::on_pushButtonHelpSettings_clicked()
 {
     if(!helpSettingsDialog)
     {
         helpSettingsDialog = new HelpSettingsDialog;
     }
+    connect(helpSettingsDialog, SIGNAL(rejected()), this, SLOT(killHelpDialogs()));
     helpSettingsDialog->show();
 }
     helpSettingsDialog->show();
 }
+
+/**
+  * This slot function called when ever dialog rejected.
+  */
+void HelpDialog::killHelpDialogs()
+{
+    if(helpResultsDialog)
+    {
+        qDebug() << "__Help kill: helpResultsDialog";
+        delete helpResultsDialog;
+        helpResultsDialog = NULL;
+    }
+    if(helpAccelerationDialog)
+    {
+        qDebug() << "__Help kill: helpAccelerationDialog";
+        delete helpAccelerationDialog;
+        helpAccelerationDialog = NULL;
+    }
+    if(helpRoutingDialog)
+    {
+        qDebug() << "__Help kill: helpRoutingDialog";
+        delete helpRoutingDialog;
+        helpRoutingDialog = NULL;
+    }
+    if(creditsDialog)
+    {
+        qDebug() << "__Help kill: creditsDialog";
+        delete creditsDialog;
+        creditsDialog = NULL;
+    }
+
+    if(helpSettingsDialog)
+    {
+        qDebug() << "__Help kill: helpSettingsDialog";
+        delete helpSettingsDialog;
+        helpSettingsDialog = NULL;
+    }
+}
index 9ca31aa..ed68882 100644 (file)
@@ -1,3 +1,12 @@
+/*
+ * Help dialog
+ *
+ * @author     Janne Änäkkälä <janne.anakkala@fudeco.com>
+ * @author     Toni Jussila    <toni.jussila@fudeco.com>
+ * @copyright  (c) 2010 Speed Freak team
+ * @license    http://opensource.org/licenses/gpl-license.php GNU Public License
+ */
+
 #ifndef HELPDIALOG_H
 #define HELPDIALOG_H
 
 #ifndef HELPDIALOG_H
 #define HELPDIALOG_H
 
@@ -37,6 +46,7 @@ private slots:
     void on_pushButtonHelpRoute_clicked();
     void on_pushButtonHelpAccelerate_clicked();
     void on_pushButtonHelpResults_clicked();
     void on_pushButtonHelpRoute_clicked();
     void on_pushButtonHelpAccelerate_clicked();
     void on_pushButtonHelpResults_clicked();
+    void killHelpDialogs();
 };
 
 #endif // HELPDIALOG_H
 };
 
 #endif // HELPDIALOG_H
index c01329c..b2342f6 100644 (file)
@@ -293,7 +293,7 @@ void MainWindow::clientSendResult(QString category, double result)
     }
 }
 /**
     }
 }
 /**
-  * This slot function called when ever dialog finished.
+  * This slot function called when ever dialog rejected.
   */
 void MainWindow::killDialog()
 {
   */
 void MainWindow::killDialog()
 {
index 37cf348..774390b 100644 (file)
@@ -1,8 +1,8 @@
 /*
 /*
- * CarMainWindow main class
+ * Result dialog
  *
  * @author     Janne Änäkkälä <janne.anakkala@fudeco.com>
  *
  * @author     Janne Änäkkälä <janne.anakkala@fudeco.com>
- * @author      Toni Jussila   <toni.jussila@fudeco.com>
+ * @author     Toni Jussila    <toni.jussila@fudeco.com>
  * @copyright  (c) 2010 Speed Freak team
  * @license    http://opensource.org/licenses/gpl-license.php GNU Public License
  */
  * @copyright  (c) 2010 Speed Freak team
  * @license    http://opensource.org/licenses/gpl-license.php GNU Public License
  */
index 252e7ff..2fac623 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * CarMainWindow main class
+ * Result dialog
  *
  * @author     Janne Änäkkälä   <janne.anakkala@fudeco.com>
  * @author      Toni Jussila   <toni.jussila@fudeco.com>
  *
  * @author     Janne Änäkkälä   <janne.anakkala@fudeco.com>
  * @author      Toni Jussila   <toni.jussila@fudeco.com>