summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTobias Markmann <tm@ayena.de>2016-07-20 10:57:16 (GMT)
committerKevin Smith <kevin.smith@isode.com>2016-07-22 14:34:59 (GMT)
commit4e386af2f811d8fbaa91259e1300e9b080d71533 (patch)
treeba84e909916c914b52aa46593f853fd0b43aa7b9
parentec8f583146104c318f6cbcc318a35bd090203e0a (diff)
downloadswift-4e386af2f811d8fbaa91259e1300e9b080d71533.zip
swift-4e386af2f811d8fbaa91259e1300e9b080d71533.tar.bz2
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
-rw-r--r--Swift/QtUI/QtAboutWidget.cpp18
-rw-r--r--Swift/QtUI/QtAboutWidget.h6
-rw-r--r--Swift/QtUI/Swift.qrc1
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>