From c4d7f97e00e673b92d4cdac9662037b6a6db3a67 Mon Sep 17 00:00:00 2001 From: Roeland Jago Douma Date: Thu, 2 Aug 2018 08:36:03 +0200 Subject: Add legal notice button to about dialog Signed-off-by: Roeland Jago Douma --- src/gui/CMakeLists.txt | 2 ++ src/gui/generalsettings.cpp | 24 +++++++++----- src/gui/generalsettings.h | 1 + src/gui/generalsettings.ui | 76 +++++++++++++++++++++++++++++---------------- src/gui/legalnotice.cpp | 44 ++++++++++++++++++++++++++ src/gui/legalnotice.h | 45 +++++++++++++++++++++++++++ src/gui/legalnotice.ui | 68 ++++++++++++++++++++++++++++++++++++++++ src/libsync/theme.cpp | 9 +----- 8 files changed, 227 insertions(+), 42 deletions(-) create mode 100644 src/gui/legalnotice.cpp create mode 100644 src/gui/legalnotice.h create mode 100644 src/gui/legalnotice.ui diff --git a/src/gui/CMakeLists.txt b/src/gui/CMakeLists.txt index eaa6a22b7..7fcd24c63 100644 --- a/src/gui/CMakeLists.txt +++ b/src/gui/CMakeLists.txt @@ -20,6 +20,7 @@ set(client_UI_SRCS folderwizardsourcepage.ui folderwizardtargetpage.ui generalsettings.ui + legalnotice.ui ignorelisteditor.ui networksettings.ui activitywidget.ui @@ -56,6 +57,7 @@ set(client_SRCS folderwatcher.cpp folderwizard.cpp generalsettings.cpp + legalnotice.cpp ignorelisteditor.cpp lockwatcher.cpp logbrowser.cpp diff --git a/src/gui/generalsettings.cpp b/src/gui/generalsettings.cpp index 419b5214b..4f9ec0d4c 100644 --- a/src/gui/generalsettings.cpp +++ b/src/gui/generalsettings.cpp @@ -29,6 +29,8 @@ #include "config.h" +#include "legalnotice.h" + #include #include #include @@ -53,14 +55,13 @@ GeneralSettings::GeneralSettings(QWidget *parent) // setup about section QString about = Theme::instance()->about(); - if (about.isEmpty()) { - _ui->aboutGroupBox->hide(); - } else { - _ui->aboutLabel->setTextInteractionFlags(Qt::TextSelectableByMouse | Qt::TextBrowserInteraction); - _ui->aboutLabel->setText(about); - _ui->aboutLabel->setWordWrap(true); - _ui->aboutLabel->setOpenExternalLinks(true); - } + _ui->aboutLabel->setTextInteractionFlags(Qt::TextSelectableByMouse | Qt::TextBrowserInteraction); + _ui->aboutLabel->setText(about); + _ui->aboutLabel->setWordWrap(true); + _ui->aboutLabel->setOpenExternalLinks(true); + + // About legal notice + connect(_ui->legalNoticeButton, &QPushButton::clicked, this, &GeneralSettings::slotShowLegalNotice); loadMiscSettings(); slotUpdateInfo(); @@ -192,4 +193,11 @@ void GeneralSettings::slotIgnoreFilesEditor() } } +void GeneralSettings::slotShowLegalNotice() +{ + auto notice = new LegalNotice(); + notice->exec(); + delete notice; +} + } // namespace OCC diff --git a/src/gui/generalsettings.h b/src/gui/generalsettings.h index 74c6520f2..b73c2f13c 100644 --- a/src/gui/generalsettings.h +++ b/src/gui/generalsettings.h @@ -47,6 +47,7 @@ private slots: void slotUpdateInfo(); void slotIgnoreFilesEditor(); void loadMiscSettings(); + void slotShowLegalNotice(); private: Ui::GeneralSettings *_ui; diff --git a/src/gui/generalsettings.ui b/src/gui/generalsettings.ui index abfdb92a9..34aa03510 100644 --- a/src/gui/generalsettings.ui +++ b/src/gui/generalsettings.ui @@ -14,6 +14,52 @@ Form + + + + About + + + + + + + 0 + 0 + + + + About + + + + + + + + + Legal notice + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + @@ -47,28 +93,6 @@ - - - - About - - - - - - - 0 - 0 - - - - About - - - - - - @@ -270,12 +294,12 @@ setEnabled(bool) - 225 - 231 + 247 + 188 - 587 - 230 + 497 + 190 diff --git a/src/gui/legalnotice.cpp b/src/gui/legalnotice.cpp new file mode 100644 index 000000000..4dbcc0666 --- /dev/null +++ b/src/gui/legalnotice.cpp @@ -0,0 +1,44 @@ +/* + * Copyright (C) by Roeland Jago Douma + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * for more details. + */ + +#include "legalnotice.h" +#include "ui_legalnotice.h" + +namespace OCC { + + +LegalNotice::LegalNotice(QDialog *parent) + : QDialog(parent) + , _ui(new Ui::LegalNotice) +{ + _ui->setupUi(this); + + QString notice = tr("

Copyright 2017-2018 Nextcloud GmbH
" + "Copyright 2012-2018 ownCloud GmbH

"); + + notice += tr("

Licensed under the GNU General Public License (GPL) Version 2.0 or any later version.

"); + + _ui->notice->setTextInteractionFlags(Qt::TextSelectableByMouse | Qt::TextBrowserInteraction); + _ui->notice->setText(notice); + _ui->notice->setWordWrap(true); + + connect(_ui->closeButton, &QPushButton::clicked, this, &LegalNotice::accept); +} + +LegalNotice::~LegalNotice() +{ + delete _ui; +} + +} diff --git a/src/gui/legalnotice.h b/src/gui/legalnotice.h new file mode 100644 index 000000000..ba776a088 --- /dev/null +++ b/src/gui/legalnotice.h @@ -0,0 +1,45 @@ +/* + * Copyright (C) by Roeland Jago Douma + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * for more details. + */ + +#ifndef LEGALNOTICE_H +#define LEGALNOTICE_H + +#include + +namespace OCC { +class IgnoreListEditor; +class SyncLogDialog; + +namespace Ui { + class LegalNotice; +} + +/** + * @brief The LegalNotice class + * @ingroup gui + */ +class LegalNotice : public QDialog +{ + Q_OBJECT + +public: + explicit LegalNotice(QDialog *parent = 0); + ~LegalNotice(); + +private: + Ui::LegalNotice *_ui; +}; + +} // namespace OCC +#endif // LEGALNOTICE_H diff --git a/src/gui/legalnotice.ui b/src/gui/legalnotice.ui new file mode 100644 index 000000000..be3c67ba6 --- /dev/null +++ b/src/gui/legalnotice.ui @@ -0,0 +1,68 @@ + + + OCC::LegalNotice + + + + 0 + 0 + 291 + 260 + + + + Dialog + + + + + + + Arabic Newspaper + 11 + + + + Legal notice + + + Qt::AlignCenter + + + + + + + TextLabel + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Close + + + + + + + + + + diff --git a/src/libsync/theme.cpp b/src/libsync/theme.cpp index a533f7e81..70a1d8b3b 100644 --- a/src/libsync/theme.cpp +++ b/src/libsync/theme.cpp @@ -338,14 +338,7 @@ QString Theme::about() const .arg("http://" MIRALL_STRINGIFY(APPLICATION_DOMAIN)) .arg(MIRALL_STRINGIFY(APPLICATION_DOMAIN)); - devString += tr("

By Klaas Freitag, Daniel Molkentin, Jan-Christoph Borchardt, " - "Olivier Goffart, Markus Götz and others.

"); - - devString += tr("

This release was supplied by the Nextcloud GmbH
" - "Copyright 2017-2018 Nextcloud GmbH
" - "Copyright 2012-2018 ownCloud GmbH

"); - - devString += tr("

Licensed under the GNU General Public License (GPL) Version 2.0 or any later version.

"); + devString += tr("

This release was supplied by the Nextcloud GmbH

"); devString += gitSHA1(); -- cgit v1.2.3