Settings dialog: Move detailed version info from About section to Legal notice dialog

- Enlarge dialog widget to show full content
- Implement Dark-/Light-Mode switching (hyperlinks)

Signed-off-by: Michael Schuster <michael@schuster.ms>
This commit is contained in:
Michael Schuster 2020-03-07 06:45:41 +01:00
parent 2adde0fcca
commit d8c407ac97
No known key found for this signature in database
GPG key ID: 00819E3BF4177B28
3 changed files with 43 additions and 11 deletions

View file

@ -14,6 +14,7 @@
#include "legalnotice.h"
#include "ui_legalnotice.h"
#include "theme.h"
namespace OCC {
@ -24,16 +25,9 @@ LegalNotice::LegalNotice(QDialog *parent)
{
_ui->setupUi(this);
QString notice = tr("<p>Copyright 2017-2020 Nextcloud GmbH<br />"
"Copyright 2012-2018 ownCloud GmbH</p>");
notice += tr("<p>Licensed under the GNU General Public License (GPL) Version 2.0 or any later version.</p>");
_ui->notice->setTextInteractionFlags(Qt::TextSelectableByMouse | Qt::TextBrowserInteraction);
_ui->notice->setText(notice);
_ui->notice->setWordWrap(true);
connect(_ui->closeButton, &QPushButton::clicked, this, &LegalNotice::accept);
customizeStyle();
}
LegalNotice::~LegalNotice()
@ -41,4 +35,37 @@ LegalNotice::~LegalNotice()
delete _ui;
}
void LegalNotice::changeEvent(QEvent *e)
{
switch (e->type()) {
case QEvent::StyleChange:
case QEvent::PaletteChange:
case QEvent::ThemeChange:
customizeStyle();
break;
default:
break;
}
QDialog::changeEvent(e);
}
void LegalNotice::customizeStyle()
{
QString notice = tr("<p>Copyright 2017-2020 Nextcloud GmbH<br />"
"Copyright 2012-2018 ownCloud GmbH</p>");
notice += tr("<p>Licensed under the GNU General Public License (GPL) Version 2.0 or any later version.</p>");
notice += "<p>&nbsp;</p>";
notice += Theme::instance()->aboutDetails();
Theme::replaceLinkColorStringBackgroundAware(notice);
_ui->notice->setTextInteractionFlags(Qt::TextSelectableByMouse | Qt::TextBrowserInteraction);
_ui->notice->setText(notice);
_ui->notice->setWordWrap(true);
_ui->notice->setOpenExternalLinks(true);
}
} // namespace OCC

View file

@ -37,7 +37,12 @@ public:
explicit LegalNotice(QDialog *parent = nullptr);
~LegalNotice();
protected:
void changeEvent(QEvent *) override;
private:
void customizeStyle();
Ui::LegalNotice *_ui;
};

View file

@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>291</width>
<height>260</height>
<width>591</width>
<height>360</height>
</rect>
</property>
<property name="windowTitle">