diff options
author | Remko Tronçon <git@el-tramo.be> | 2009-08-30 12:49:14 (GMT) |
---|---|---|
committer | Remko Tronçon <git@el-tramo.be> | 2009-09-05 15:42:37 (GMT) |
commit | 7e71d5cce85b71401adbbf6b2e65bb94f90278f9 (patch) | |
tree | fcb0f1a7a72305451e52fa08279738e224798b25 /Swift/QtUI | |
parent | d411b5a4ce58226751c86cec2f73f83a613f3bb4 (diff) | |
download | swift-7e71d5cce85b71401adbbf6b2e65bb94f90278f9.zip swift-7e71d5cce85b71401adbbf6b2e65bb94f90278f9.tar.bz2 |
Don't use singleton for AboutWidget.
Diffstat (limited to 'Swift/QtUI')
-rw-r--r-- | Swift/QtUI/QtAboutWidget.cpp | 8 | ||||
-rw-r--r-- | Swift/QtUI/QtAboutWidget.h | 7 | ||||
-rw-r--r-- | Swift/QtUI/QtLoginWindow.cpp | 8 | ||||
-rw-r--r-- | Swift/QtUI/QtLoginWindow.h | 3 |
4 files changed, 12 insertions, 14 deletions
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_; }; } |