summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTobias Markmann <tm@ayena.de>2015-09-01 16:09:56 (GMT)
committerKevin Smith <kevin.smith@isode.com>2015-09-03 13:00:01 (GMT)
commitb6ffd5a332b6b21fdba9937fa3a0274556a09cdf (patch)
tree68881c3e863cdf285ff5de69af2daf3b8df1909b /Swift/QtUI
parent397d008fc066694130fed8137891a6bb755ddeb2 (diff)
downloadswift-b6ffd5a332b6b21fdba9937fa3a0274556a09cdf.zip
swift-b6ffd5a332b6b21fdba9937fa3a0274556a09cdf.tar.bz2
Add close button to about dialog for Linux desktops
The default Debian 7 desktop uses window decorations for dialog windows that does not have close window buttons at the top. This commit adds a dedicated close button to the about window. This button is *not* added on Windows and OS X. Test-Information: Tested looks and function on OS X 10.9.5 with Qt 5.4.2 and Debian 7 with Qt 5.3.2. Change-Id: Ia363f66666eb88d43834ab0556f7b06efd3cedef
Diffstat (limited to 'Swift/QtUI')
-rw-r--r--Swift/QtUI/QtAboutWidget.cpp29
1 files changed, 23 insertions, 6 deletions
diff --git a/Swift/QtUI/QtAboutWidget.cpp b/Swift/QtUI/QtAboutWidget.cpp
index 3de95f4..7145384 100644
--- a/Swift/QtUI/QtAboutWidget.cpp
+++ b/Swift/QtUI/QtAboutWidget.cpp
@@ -1,22 +1,24 @@
1/* 1/*
2 * Copyright (c) 2010 Isode Limited. 2 * Copyright (c) 2010-2015 Isode Limited.
3 * All rights reserved. 3 * All rights reserved.
4 * See the COPYING file for more information. 4 * See the COPYING file for more information.
5 */ 5 */
6 6
7#include "Swift/QtUI/QtAboutWidget.h" 7#include <Swift/QtUI/QtAboutWidget.h>
8 8
9#include <QCoreApplication> 9#include <QCoreApplication>
10#include <QFile>
10#include <QIcon> 11#include <QIcon>
11#include <QLabel> 12#include <QLabel>
12#include <QVBoxLayout>
13#include <QtGlobal>
14#include <QPushButton> 13#include <QPushButton>
15#include <QTextEdit> 14#include <QTextEdit>
16#include <QFile>
17#include <QTextStream> 15#include <QTextStream>
16#include <QVBoxLayout>
17#include <QtGlobal>
18
19#include <Swiften/Base/Platform.h>
18 20
19namespace Swift { 21namespace Swift {
20 22
21QtAboutWidget::QtAboutWidget() : QDialog() { 23QtAboutWidget::QtAboutWidget() : QDialog() {
22#ifndef Q_OS_MAC 24#ifndef Q_OS_MAC
@@ -48,15 +50,30 @@ QtAboutWidget::QtAboutWidget() : QDialog() {
48 50
49 if (QCoreApplication::translate("TRANSLATION_INFO", "TRANSLATION_AUTHOR") != "TRANSLATION_AUTHOR") { 51 if (QCoreApplication::translate("TRANSLATION_INFO", "TRANSLATION_AUTHOR") != "TRANSLATION_AUTHOR") {
50 mainLayout->addWidget(new QLabel(QString("<center><font size='-1'>") + QString(tr("Using the English translation by\n%1")).arg(QCoreApplication::translate("TRANSLATION_INFO", "TRANSLATION_AUTHOR")).replace("\n", "<br/>") + "</font></center>", this)); 52 mainLayout->addWidget(new QLabel(QString("<center><font size='-1'>") + QString(tr("Using the English translation by\n%1")).arg(QCoreApplication::translate("TRANSLATION_INFO", "TRANSLATION_AUTHOR")).replace("\n", "<br/>") + "</font></center>", this));
51 } 53 }
52 QCoreApplication::translate("TRANSLATION_INFO", "TRANSLATION_LICENSE", "This string contains the license under which this translation is licensed. We ask you to license the translation under the BSD license. Please read http://www.opensource.org/licenses/bsd-license.php, and if you agree to release your translation under this license, use the following (untranslated) text: 'This translation is licensed under the BSD License. See http://www.opensource.org/licenses/bsd-license.php'"); 54 QCoreApplication::translate("TRANSLATION_INFO", "TRANSLATION_LICENSE", "This string contains the license under which this translation is licensed. We ask you to license the translation under the BSD license. Please read http://www.opensource.org/licenses/bsd-license.php, and if you agree to release your translation under this license, use the following (untranslated) text: 'This translation is licensed under the BSD License. See http://www.opensource.org/licenses/bsd-license.php'");
53 55#if defined(SWIFTEN_PLATFORM_WINDOWS) || defined(SWIFTEN_PLATFORM_MACOSX)
54 QPushButton* licenseButton = new QPushButton(tr("View License"), this); 56 QPushButton* licenseButton = new QPushButton(tr("View License"), this);
55 mainLayout->addWidget(licenseButton); 57 mainLayout->addWidget(licenseButton);
56 connect(licenseButton, SIGNAL(clicked()), this, SLOT(handleLicenseClicked())); 58 connect(licenseButton, SIGNAL(clicked()), this, SLOT(handleLicenseClicked()));
59#else
60 // Some Linux desktops have dialog window decorations without close window buttons.
61 // This code adds a dedicated button to close the about window dialog.
62 QHBoxLayout* buttonLayout = new QHBoxLayout();
63 mainLayout->addLayout(buttonLayout);
64
65 QPushButton* licenseButton = new QPushButton(tr("View License"), this);
66 buttonLayout->addWidget(licenseButton);
67 connect(licenseButton, SIGNAL(clicked()), this, SLOT(handleLicenseClicked()));
68
69 buttonLayout->addItem(new QSpacerItem(20,20));
57 70
71 QPushButton* closeButton = new QPushButton(tr("Close"), this);
72 buttonLayout->addWidget(closeButton);
73 connect(closeButton, SIGNAL(clicked()), this, SLOT(accept()));
74#endif
58 setFixedSize(minimumSizeHint()); 75 setFixedSize(minimumSizeHint());
59} 76}
60 77
61void QtAboutWidget::handleLicenseClicked() { 78void QtAboutWidget::handleLicenseClicked() {
62 QTextEdit* text = new QTextEdit(); 79 QTextEdit* text = new QTextEdit();