From 7e71d5cce85b71401adbbf6b2e65bb94f90278f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Remko=20Tron=C3=A7on?= <git@el-tramo.be> Date: Sun, 30 Aug 2009 14:49:14 +0200 Subject: Don't use singleton for AboutWidget. diff --git a/Swift/QtUI/QtAboutWidget.cpp b/Swift/QtUI/QtAboutWidget.cpp index 7e5cda1..d4f8386 100644 --- a/Swift/QtUI/QtAboutWidget.cpp +++ b/Swift/QtUI/QtAboutWidget.cpp @@ -10,12 +10,6 @@ #include "Swiften/Application/Application.h" namespace Swift { -QtAboutWidget* QtAboutWidget::instance() { - if (!instance_) { - instance_ = new QtAboutWidget(); - } - return instance_; -} QtAboutWidget::QtAboutWidget() : QWidget() { resize(180, 240); @@ -38,8 +32,6 @@ QtAboutWidget::QtAboutWidget() : QWidget() { buildString += "</centre></font>"; QLabel* buildLabel = new QLabel(buildString, this); mainLayout->addWidget(buildLabel); - } -QtAboutWidget* QtAboutWidget::instance_ = NULL; } diff --git a/Swift/QtUI/QtAboutWidget.h b/Swift/QtUI/QtAboutWidget.h index 0a1fc3f..4d99bbb 100644 --- a/Swift/QtUI/QtAboutWidget.h +++ b/Swift/QtUI/QtAboutWidget.h @@ -4,12 +4,9 @@ namespace Swift { class QtAboutWidget : public QWidget { - Q_OBJECT - public: - static QtAboutWidget* instance(); + Q_OBJECT - private: + public: QtAboutWidget(); - static QtAboutWidget* instance_; }; } diff --git a/Swift/QtUI/QtLoginWindow.cpp b/Swift/QtUI/QtLoginWindow.cpp index 9694364..fb31e3c 100644 --- a/Swift/QtUI/QtLoginWindow.cpp +++ b/Swift/QtUI/QtLoginWindow.cpp @@ -136,7 +136,13 @@ void QtLoginWindow::handleCertficateChecked(bool checked) { } void QtLoginWindow::handleAbout() { - QtAboutWidget::instance()->show(); + if (!aboutDialog_) { + aboutDialog_ = new QtAboutWidget(); + aboutDialog_->show(); + } + else { + aboutDialog_->raise(); + } } void QtLoginWindow::handleQuit() { diff --git a/Swift/QtUI/QtLoginWindow.h b/Swift/QtUI/QtLoginWindow.h index 144f212..153f757 100644 --- a/Swift/QtUI/QtLoginWindow.h +++ b/Swift/QtUI/QtLoginWindow.h @@ -2,6 +2,7 @@ #define SWIFT_QtLoginWindow_H #include <QMainWindow> +#include <QPointer> #include <QLineEdit> #include <QPushButton> #include <QCheckBox> @@ -10,6 +11,7 @@ #include "Swift/Controllers/LoginWindow.h" #include "Swift/Controllers/MainWindow.h" +#include "QtAboutWidget.h" class QLabel; class QToolButton; @@ -43,6 +45,7 @@ namespace Swift { QToolButton* certificateButton_; QMenuBar* menuBar_; QMenu* swiftMenu_; + QPointer<QtAboutWidget> aboutDialog_; }; } -- cgit v0.10.2-6-g49f6