diff options
Diffstat (limited to 'Swift/QtUI')
-rw-r--r-- | Swift/QtUI/QtAboutWidget.cpp | 18 | ||||
-rw-r--r-- | Swift/QtUI/QtAboutWidget.h | 6 | ||||
-rw-r--r-- | Swift/QtUI/Swift.qrc | 1 |
3 files changed, 23 insertions, 2 deletions
diff --git a/Swift/QtUI/QtAboutWidget.cpp b/Swift/QtUI/QtAboutWidget.cpp index b69113f..2fc8bae 100644 --- a/Swift/QtUI/QtAboutWidget.cpp +++ b/Swift/QtUI/QtAboutWidget.cpp @@ -51,6 +51,10 @@ QtAboutWidget::QtAboutWidget() : QDialog() { QPushButton* licenseButton = new QPushButton(tr("View License"), this); mainLayout->addWidget(licenseButton); connect(licenseButton, SIGNAL(clicked()), this, SLOT(handleLicenseClicked())); + + QPushButton* changelogButton = new QPushButton(tr("View Changes"), this); + mainLayout->addWidget(changelogButton); + connect(changelogButton, SIGNAL(clicked()), this, SLOT(handleChangelogClicked())); #else // Some Linux desktops have dialog window decorations without close window buttons. // This code adds a dedicated button to close the about window dialog. @@ -61,6 +65,10 @@ QtAboutWidget::QtAboutWidget() : QDialog() { buttonLayout->addWidget(licenseButton); connect(licenseButton, SIGNAL(clicked()), this, SLOT(handleLicenseClicked())); + QPushButton* changelogButton = new QPushButton(tr("View Changes"), this); + buttonLayout->addWidget(changelogButton); + connect(changelogButton, SIGNAL(clicked()), this, SLOT(handleChangelogClicked())); + buttonLayout->addItem(new QSpacerItem(20,20)); QPushButton* closeButton = new QPushButton(tr("Close"), this); @@ -71,10 +79,18 @@ QtAboutWidget::QtAboutWidget() : QDialog() { } void QtAboutWidget::handleLicenseClicked() { + openPlainTextWindow(":/COPYING"); +} + +void QtAboutWidget::handleChangelogClicked() { + openPlainTextWindow(":/ChangeLog.md"); +} + +void QtAboutWidget::openPlainTextWindow(const QString& path) { QTextEdit* text = new QTextEdit(); text->setAttribute(Qt::WA_DeleteOnClose); text->setReadOnly(true); - QFile file(":/COPYING"); + QFile file(path); file.open(QIODevice::ReadOnly); QTextStream in(&file); in.setCodec("UTF-8"); diff --git a/Swift/QtUI/QtAboutWidget.h b/Swift/QtUI/QtAboutWidget.h index 7d0d628..c8b0356 100644 --- a/Swift/QtUI/QtAboutWidget.h +++ b/Swift/QtUI/QtAboutWidget.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010 Isode Limited. + * Copyright (c) 2010-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -17,5 +17,9 @@ namespace Swift { private slots: void handleLicenseClicked(); + void handleChangelogClicked(); + + private: + void openPlainTextWindow(const QString& path); }; } diff --git a/Swift/QtUI/Swift.qrc b/Swift/QtUI/Swift.qrc index 1572d93..3c9f43f 100644 --- a/Swift/QtUI/Swift.qrc +++ b/Swift/QtUI/Swift.qrc @@ -22,6 +22,7 @@ <file alias="icons/new-chat.png">../resources/icons/new-chat.png</file> <file alias="icons/actions.png">../resources/icons/actions.png</file> <file alias="COPYING">COPYING</file> + <file alias="ChangeLog.md">../ChangeLog.md</file> <file alias="icons/line.png">../resources/icons/line.png</file> <file alias="icons/rect.png">../resources/icons/rect.png</file> <file alias="icons/circle.png">../resources/icons/circle.png</file> |