From 4e386af2f811d8fbaa91259e1300e9b080d71533 Mon Sep 17 00:00:00 2001 From: Tobias Markmann Date: Wed, 20 Jul 2016 12:57:16 +0200 Subject: Add button to changelog dialog to about dialog Test-Information: Tested with Qt 5.5.1 on OS X 10.11.5 and Qt 5.3.2 on Debian 8.5. Change-Id: I727bca574ec1433df01bc68e5da0c7678fdb9915 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 @@ ../resources/icons/new-chat.png ../resources/icons/actions.png COPYING + ../ChangeLog.md ../resources/icons/line.png ../resources/icons/rect.png ../resources/icons/circle.png -- cgit v0.10.2-6-g49f6