diff options
author | Kevin Smith <git@kismith.co.uk> | 2009-08-29 09:07:01 (GMT) |
---|---|---|
committer | Kevin Smith <git@kismith.co.uk> | 2009-08-29 09:07:01 (GMT) |
commit | 52b06bd89d91e2f5e0c1ae439cd1e5c3e4b9bf2e (patch) | |
tree | 6bc018aa8457ed664f733936162fd75c5fb1d234 /Swift | |
parent | 0de707a4fddfbf2b9ee85d277596d33faa327ff2 (diff) | |
download | swift-contrib-52b06bd89d91e2f5e0c1ae439cd1e5c3e4b9bf2e.zip swift-contrib-52b06bd89d91e2f5e0c1ae439cd1e5c3e4b9bf2e.tar.bz2 |
Basic About dialog
Diffstat (limited to 'Swift')
-rw-r--r-- | Swift/QtUI/QtAboutWidget.cpp | 45 | ||||
-rw-r--r-- | Swift/QtUI/QtAboutWidget.h | 15 | ||||
-rw-r--r-- | Swift/QtUI/QtLoginWindow.cpp | 13 | ||||
-rw-r--r-- | Swift/QtUI/QtLoginWindow.h | 1 | ||||
-rw-r--r-- | Swift/QtUI/QtSwift.cpp | 2 | ||||
-rw-r--r-- | Swift/QtUI/SConscript | 1 |
6 files changed, 77 insertions, 0 deletions
diff --git a/Swift/QtUI/QtAboutWidget.cpp b/Swift/QtUI/QtAboutWidget.cpp new file mode 100644 index 0000000..bc3fb4b --- /dev/null +++ b/Swift/QtUI/QtAboutWidget.cpp @@ -0,0 +1,45 @@ +#include "Swift/QtUI/QtAboutWidget.h" + +#include <QCoreApplication> +#include <QIcon> +#include <QLabel> +#include <QVBoxLayout> +#include <QtGlobal> + + +#include "Swiften/Application/Application.h" + +namespace Swift { +QtAboutWidget* QtAboutWidget::instance() { + if (!instance_) { + instance_ = new QtAboutWidget(); + } + return instance_; +} + +QtAboutWidget::QtAboutWidget() : QWidget() { + resize(180, 240); + QVBoxLayout *mainLayout = new QVBoxLayout(this); + mainLayout->setAlignment(Qt::AlignHCenter); + setLayout(mainLayout); + + QLabel* iconLabel = new QLabel(this); + iconLabel->setPixmap(QIcon(":/logo-shaded-text.256.png").pixmap(90, 90)); + mainLayout->addWidget(iconLabel); + + QLabel* appNameLabel = new QLabel("<font size='+1'><b>" + QCoreApplication::applicationName() + "</b></font>", this); + //appNameLabel->setTextFormat + mainLayout->addWidget(appNameLabel); + + QLabel* versionLabel = new QLabel(QString("<font size='-1'>Version ") + QCoreApplication::applicationVersion() + "</font>", this); + mainLayout->addWidget(versionLabel); + QString buildString = QString("<font size='-1'><centre>Built with: Qt version ") + QT_VERSION_STR; + buildString += QString("</centre><br/><centre>Running with Qt version ") + qVersion(); + buildString += "</centre></font>"; + QLabel* buildLabel = new QLabel(buildString, this); + mainLayout->addWidget(buildLabel); + +} + +QtAboutWidget* QtAboutWidget::instance_ = NULL; +}
\ No newline at end of file diff --git a/Swift/QtUI/QtAboutWidget.h b/Swift/QtUI/QtAboutWidget.h new file mode 100644 index 0000000..8e6f027 --- /dev/null +++ b/Swift/QtUI/QtAboutWidget.h @@ -0,0 +1,15 @@ +#pragma once + +#include <QWidget> + +namespace Swift { + class QtAboutWidget : public QWidget { + Q_OBJECT + public: + static QtAboutWidget* instance(); + + private: + QtAboutWidget(); + static QtAboutWidget* instance_; + }; +}
\ No newline at end of file diff --git a/Swift/QtUI/QtLoginWindow.cpp b/Swift/QtUI/QtLoginWindow.cpp index 210d927..2a25420 100644 --- a/Swift/QtUI/QtLoginWindow.cpp +++ b/Swift/QtUI/QtLoginWindow.cpp @@ -1,4 +1,6 @@ #include "QtLoginWindow.h" + +#include "QtAboutWidget.h" #include "QtSwiftUtil.h" #include "QtMainWindow.h" @@ -91,10 +93,17 @@ QtLoginWindow::QtLoginWindow(const String& defaultJID, const String& defaultPass QApplication::setQuitOnLastWindowClosed(false); swiftMenu_ = new QMenu(tr("Swift"), this); + + QAction* aboutAction = new QAction("About Swift", this); + connect(aboutAction, SIGNAL(activated()), SLOT(handleAbout())); + swiftMenu_->addAction(aboutAction); + QAction* quitAction = new QAction("Quit", this); connect(quitAction, SIGNAL(activated()), SLOT(handleQuit())); swiftMenu_->addAction(quitAction); + + setInitialMenus(); this->show(); } @@ -126,6 +135,10 @@ void QtLoginWindow::handleCertficateChecked(bool checked) { } } +void QtLoginWindow::handleAbout() { + QtAboutWidget::instance()->show(); +} + void QtLoginWindow::handleQuit() { QApplication::quit(); } diff --git a/Swift/QtUI/QtLoginWindow.h b/Swift/QtUI/QtLoginWindow.h index e880ace..1c156db 100644 --- a/Swift/QtUI/QtLoginWindow.h +++ b/Swift/QtUI/QtLoginWindow.h @@ -28,6 +28,7 @@ namespace Swift { void loginClicked(); void handleCertficateChecked(bool); void handleQuit(); + void handleAbout(); private: void setInitialMenus(); diff --git a/Swift/QtUI/QtSwift.cpp b/Swift/QtUI/QtSwift.cpp index 90742a5..a949b7d 100644 --- a/Swift/QtUI/QtSwift.cpp +++ b/Swift/QtUI/QtSwift.cpp @@ -17,6 +17,7 @@ #include "Swiften/Client/Client.h" #include "Swift/Controllers/ChatController.h" #include "Swift/Controllers/MainController.h" +#include "Swift/QtUI/BuildVersion.h" namespace Swift{ @@ -35,6 +36,7 @@ QtSwift::QtSwift(bool netbookMode) { QCoreApplication::setApplicationName("Swift"); QCoreApplication::setOrganizationName("Swift"); QCoreApplication::setOrganizationDomain("swift.im"); + QCoreApplication::setApplicationVersion(buildVersion); settings_ = new QtSettingsProvider(); application_ = new PlatformApplication("Swift"); if (splitter_) { diff --git a/Swift/QtUI/SConscript b/Swift/QtUI/SConscript index 43211a9..679b3c0 100644 --- a/Swift/QtUI/SConscript +++ b/Swift/QtUI/SConscript @@ -47,6 +47,7 @@ myenv.Command("DefaultTheme.qrc", "../resources/themes/Default", Action(generate sources = [ "main.cpp", + "QtAboutWidget.cpp", "QtAddContactDialog.cpp", "QtChatWindow.cpp", "QtChatWindowFactory.cpp", |