GUI: Fixed help window leaks and made sure it is closed when the gui is closed

This commit is contained in:
Daniel Marjamäki 2010-08-21 11:02:52 +02:00
parent 9c594684db
commit 65c5b9906e
2 changed files with 17 additions and 2 deletions

View File

@ -43,6 +43,7 @@ MainWindow::MainWindow() :
mTranslation(new TranslationHandler(this)), mTranslation(new TranslationHandler(this)),
mLanguages(new QActionGroup(this)), mLanguages(new QActionGroup(this)),
mLogView(NULL), mLogView(NULL),
mHelpWindow(NULL),
mExiting(false) mExiting(false)
{ {
mUI.setupUi(this); mUI.setupUi(this);
@ -110,6 +111,7 @@ MainWindow::MainWindow() :
MainWindow::~MainWindow() MainWindow::~MainWindow()
{ {
delete mLogView; delete mLogView;
delete mHelpWindow;
} }
void MainWindow::CreateLanguageMenuItems() void MainWindow::CreateLanguageMenuItems()
@ -457,6 +459,9 @@ void MainWindow::closeEvent(QCloseEvent *event)
// Check that we aren't checking files // Check that we aren't checking files
if (!mThread->IsChecking()) if (!mThread->IsChecking())
{ {
delete mHelpWindow;
mHelpWindow = NULL;
SaveSettings(); SaveSettings();
event->accept(); event->accept();
} }
@ -652,8 +657,12 @@ void MainWindow::OpenHelpContents()
void MainWindow::OpenHtmlHelpContents() void MainWindow::OpenHtmlHelpContents()
{ {
HelpWindow *helpWindow = new HelpWindow; if (mHelpWindow == NULL)
helpWindow->setVisible(true); mHelpWindow = new HelpWindow;
mHelpWindow->show();
if (!mHelpWindow->isActiveWindow())
mHelpWindow->activateWindow();
} }
void MainWindow::OpenProjectFile() void MainWindow::OpenProjectFile()

View File

@ -33,6 +33,7 @@
#include "ui_main.h" #include "ui_main.h"
class ThreadHandler; class ThreadHandler;
class LogView; class LogView;
class HelpWindow;
/// @addtogroup GUI /// @addtogroup GUI
/// @{ /// @{
@ -327,6 +328,11 @@ protected:
*/ */
LogView *mLogView; LogView *mLogView;
/**
* @brief Help window..
*/
HelpWindow *mHelpWindow;
private: private:
/** /**