Settings dialog: Move detailed version info from About section to Legal notice dialog
authorMichael Schuster <michael@schuster.ms>
Sat, 7 Mar 2020 05:45:41 +0000 (06:45 +0100)
committerMichael Schuster <michael@schuster.ms>
Sat, 7 Mar 2020 05:45:41 +0000 (06:45 +0100)
- Enlarge dialog widget to show full content
- Implement Dark-/Light-Mode switching (hyperlinks)

Signed-off-by: Michael Schuster <michael@schuster.ms>
src/gui/legalnotice.cpp
src/gui/legalnotice.h
src/gui/legalnotice.ui

index 9cf33c2e86f33228bf3580095283374df6457b6d..034c22e9d7616ee9c1f84e943335ce4ab848ae2b 100644 (file)
@@ -14,6 +14,7 @@
 
 #include "legalnotice.h"
 #include "ui_legalnotice.h"
+#include "theme.h"
 
 namespace OCC {
 
@@ -24,21 +25,47 @@ LegalNotice::LegalNotice(QDialog *parent)
 {
     _ui->setupUi(this);
 
+    connect(_ui->closeButton, &QPushButton::clicked, this, &LegalNotice::accept);
+
+    customizeStyle();
+}
+
+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);
-
-    connect(_ui->closeButton, &QPushButton::clicked, this, &LegalNotice::accept);
+    _ui->notice->setOpenExternalLinks(true);
 }
 
-LegalNotice::~LegalNotice()
-{
-    delete _ui;
-}
-
-}
+} // namespace OCC
index 38cbdd16fd381bd77707f1d9e9db8eb061c7cdef..ee0cb9d4ea6f0b04773a27c0f4ed2172a13b7ad1 100644 (file)
@@ -37,7 +37,12 @@ public:
     explicit LegalNotice(QDialog *parent = nullptr);
     ~LegalNotice();
 
+protected:
+    void changeEvent(QEvent *) override;
+
 private:
+    void customizeStyle();
+
     Ui::LegalNotice *_ui;
 };
 
index 1411ad89274ab4d3a7cdc3e7cae018111193480d..5f0f697038c574df43d7d77a272d2efe3dc23fb3 100644 (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">