[graphics/kuickshow] src: AboutWidget: Incorporate into a new tab of KuickConfigDialog

Jonathan Marten <[email protected]>
Newsgroups gmane.comp.kde.cvs
Message-ID <[email protected]>
Git commit 06fbb4e442d036303df40c0d78035b3262bede18 by Jonathan Marten.
Committed on 17/07/2026 at 16:21.
Pushed by marten into branch 'master'.

AboutWidget: Incorporate into a new tab of KuickConfigDialog

It's a nice image but is not very discoverable - only accessible
via a toolbar button in the browser window.  Authour and copyright
information is in the standard "About Kuickshow" action, but put the
image and website link here.

M  +0    -1    src/CMakeLists.txt
M  +27   -41   src/aboutwidget.cpp
M  +1    -3    src/aboutwidget.h
D  +0    -82   src/aboutwidget.ui
M  +0    -20   src/generalwidget.cpp
M  +0    -2    src/generalwidget.h
M  +0    -15   src/generalwidget.ui
M  +8    -2    src/kuickconfigdlg.cpp

https://invent.kde.org/graphics/kuickshow/-/commit/06fbb4e442d036303df40c0d78035b3262bede18

diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 7b1e5e3..5b6386a 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -35,7 +35,6 @@ set(SOURCES
 )
 
 ki18n_wrap_ui(SOURCES
-   aboutwidget.ui
    printing_page.ui
    generalwidget.ui
    defaultswidget.ui
diff --git a/src/aboutwidget.cpp b/src/aboutwidget.cpp
index 6a73a6a..e8c32ee 100644
--- a/src/aboutwidget.cpp
+++ b/src/aboutwidget.cpp
@@ -17,70 +17,56 @@
 */
 
 #include "aboutwidget.h"
-#include <ui_aboutwidget.h>
+
+#include <kiconloader.h>
 
 #include <QDateTime>
-#include <QMouseEvent>
 #include <QPixmap>
 #include <QStandardPaths>
+#include <QGridLayout>
+#include <QLabel>
+#include <QGuiApplication>
 
-#include "version.h"
+#include <klocalizedstring.h>
 
 
 AboutWidget::AboutWidget( QWidget *parent )
     : QFrame( parent )
 {
-    // setup the widget based on its .ui file
-    ui = new Ui::AboutWidget;
-    ui->setupUi(this);
-
-
-    // now the properties that couldn't be set in the .ui file
+    QGridLayout *gl = new QGridLayout(this);
+    gl->setRowMinimumHeight(0, 30);
 
-    // KDE specific settings for "window" display (it's just a frame, not a real window)
-    setWindowFlag(Qt::FramelessWindowHint, true);
-    setWindowFlag(Qt::WindowStaysOnTopHint, true);
+    QLabel *websiteLabel = new QLabel(i18n("<A HREF=\"%2\">%1 Website</A>", QGuiApplication::applicationDisplayName(), HOMEPAGE_URL), this);
+    websiteLabel->setOpenExternalLinks(true);
+    websiteLabel->setTextInteractionFlags(Qt::LinksAccessibleByMouse);
+    gl->addWidget(websiteLabel, 1, 0, Qt::AlignLeft);
 
-    // these settings are difficult to set in designer
-    QPalette whitePalette((QColor(Qt::white)));
-    setPalette(whitePalette);
-    ui->groupBox->setPalette(whitePalette);
-    ui->groupBox->setBackgroundRole(QPalette::Window);
+    QLabel *websiteLogo = new QLabel(this);
+    websiteLogo->setPixmap(KIconLoader::global()->loadIcon("logo", KIconLoader::User));
+    gl->addWidget(websiteLogo, 1, 1, Qt::AlignRight);
 
-    // fill the labels
-    ui->lblAuthors->setText("Kuickshow " KUICKSHOWVERSION " was brought to you by");
-    ui->urlHomepage->setText("Carsten Pfeiffer");
-    ui->urlHomepage->setUrl(HOMEPAGE_URL);
-    ui->lblCopyright->setText("(C) 1998-2009");
+    gl->setRowMinimumHeight(2, 30);
 
-    // load & show the logo
+    // Load & show the logo
     int hour = QTime::currentTime().hour();
     QString file;
 
+    // TODO: can get active hours from KIdleTime?
+    // Going by these hours, either you don't have to work very hard
+    // or are at an extreme latitude...
     if ( hour >= 10 && hour < 16 )
         file = QStandardPaths::locate(QStandardPaths::AppDataLocation, "pics/kuickshow-day.jpg");
     else
         file = QStandardPaths::locate(QStandardPaths::AppDataLocation, "pics/kuickshow-night.jpg");
 
-    QPixmap image;
-    if (image.load(file)) {
-        ui->picLogo->setPixmap(image);
+    QPixmap image(file);;
+    if (!image.isNull()) {
+        QLabel *pixLabel = new QLabel(this);
+        pixLabel->setPixmap(image);
+        gl->addWidget(pixLabel, 3, 0, 1, -1, Qt::AlignHCenter|Qt::AlignTop);
     } else {
-        qWarning("KuickShow: about-image not found/unreadable.");
+        qWarning() << "Image not found or unreadable";
     }
-}
 
-AboutWidget::~AboutWidget()
-{
-    delete ui;
-}
-
-
-void AboutWidget::mouseReleaseEvent(QMouseEvent* event)
-{
-    // Clicking anywhere on the frame except for the URL widget removes it.
-    // Note: This only works as intended if the frame is displayed as a window. If it is used in another window's
-    //       layout, it'll just remove itself from that window (and probably mess up the layout in the process).
-    if (!ui->urlHomepage->geometry().contains(event->pos()))
-        deleteLater();
+    gl->setRowStretch(3, 1);
 }
diff --git a/src/aboutwidget.h b/src/aboutwidget.h
index 0c9a34e..46000a7 100644
--- a/src/aboutwidget.h
+++ b/src/aboutwidget.h
@@ -21,7 +21,6 @@
 
 #include <QFrame>
 
-class QMouseEvent;
 namespace Ui { class AboutWidget; }
 
 
@@ -33,8 +32,7 @@ public:
     AboutWidget(QWidget *parent = nullptr);
 
 protected:
-    ~AboutWidget();
-    void mouseReleaseEvent(QMouseEvent* event) override;
+    ~AboutWidget() = default;
 
 private:
     Ui::AboutWidget* ui;
diff --git a/src/aboutwidget.ui b/src/aboutwidget.ui
deleted file mode 100644
index 23316b0..0000000
--- a/src/aboutwidget.ui
+++ /dev/null
@@ -1,82 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ui version="4.0">
- <class>AboutWidget</class>
- <widget class="QFrame" name="AboutWidget">
-  <property name="geometry">
-   <rect>
-    <x>0</x>
-    <y>0</y>
-    <width>425</width>
-    <height>256</height>
-   </rect>
-  </property>
-  <property name="frameShape">
-   <enum>QFrame::WinPanel</enum>
-  </property>
-  <property name="frameShadow">
-   <enum>QFrame::Raised</enum>
-  </property>
-  <layout class="QVBoxLayout" name="verticalLayout">
-   <property name="margin">
-    <number>1</number>
-   </property>
-   <item>
-    <widget class="QGroupBox" name="groupBox">
-     <property name="alignment">
-      <set>Qt::AlignCenter</set>
-     </property>
-     <layout class="QVBoxLayout" name="verticalLayout_2" stretch="0,0,0,1">
-      <item>
-       <widget class="QLabel" name="lblAuthors">
-        <property name="text">
-         <string>(authors)</string>
-        </property>
-        <property name="textFormat">
-         <enum>Qt::PlainText</enum>
-        </property>
-        <property name="alignment">
-         <set>Qt::AlignCenter</set>
-        </property>
-       </widget>
-      </item>
-      <item>
-       <widget class="KuickUrlWidget" name="urlHomepage">
-        <property name="text">
-         <string>(url)</string>
-        </property>
-        <property name="alignment">
-         <set>Qt::AlignCenter</set>
-        </property>
-       </widget>
-      </item>
-      <item>
-       <widget class="QLabel" name="lblCopyright">
-        <property name="text">
-         <string>(copyright)</string>
-        </property>
-        <property name="textFormat">
-         <enum>Qt::PlainText</enum>
-        </property>
-        <property name="alignment">
-         <set>Qt::AlignCenter</set>
-        </property>
-       </widget>
-      </item>
-      <item>
-       <widget class="QLabel" name="picLogo"/>
-      </item>
-     </layout>
-    </widget>
-   </item>
-  </layout>
- </widget>
- <customwidgets>
-  <customwidget>
-   <class>KuickUrlWidget</class>
-   <extends>QLabel</extends>
-   <header>kuickurlwidget.h</header>
-  </customwidget>
- </customwidgets>
- <resources/>
- <connections/>
-</ui>
diff --git a/src/generalwidget.cpp b/src/generalwidget.cpp
index 808756f..3666093 100644
--- a/src/generalwidget.cpp
+++ b/src/generalwidget.cpp
@@ -22,13 +22,8 @@
 #include "imlib.h"
 #include "kuickconfig.h"
 
-#include <KIconLoader>
 #include <KLocalizedString>
 
-#include <QDesktopServices>
-#include <QPixmap>
-#include <QUrl>
-
 
 GeneralWidget::GeneralWidget( QWidget *parent )
   : QWidget( parent )
@@ -37,17 +32,7 @@ GeneralWidget::GeneralWidget( QWidget *parent )
   ui = new Ui::GeneralWidget;
   ui->setupUi(this);
 
-
   // now the properties that couldn't be set in the .ui file
-
-  // the KuickShow logo
-  QPixmap pixmap = KIconLoader::global()->loadIcon("logo", KIconLoader::User);
-  ui->logo->setUrl(HOMEPAGE_URL);
-  ui->logo->setPixmap( pixmap );
-  ui->logo->setFixedSize( pixmap.size() );
-
-  // actions
-  connect(ui->logo, QOverload<>::of(&KUrlLabel::leftClickedUrl), this, &GeneralWidget::slotURLClicked);
   connect(ui->cbOwnPalette, &QAbstractButton::clicked, this, &GeneralWidget::useOwnPalette);
 
   // support for these settings depends on the compiled library
@@ -68,11 +53,6 @@ GeneralWidget::~GeneralWidget()
   delete ui;
 }
 
-void GeneralWidget::slotURLClicked()
-{
-    QDesktopServices::openUrl(QUrl::fromUserInput(ui->logo->url()));
-}
-
 void GeneralWidget::loadSettings(const KuickConfig* config)
 {
     if (config == nullptr) config = &KuickConfig::get();
diff --git a/src/generalwidget.h b/src/generalwidget.h
index d692d3c..02fd045 100644
--- a/src/generalwidget.h
+++ b/src/generalwidget.h
@@ -41,8 +41,6 @@ private:
 
 private Q_SLOTS:
     void 	useOwnPalette();
-    void slotURLClicked();
-
 };
 
 #endif
diff --git a/src/generalwidget.ui b/src/generalwidget.ui
index b768e6d..81cc2af 100644
--- a/src/generalwidget.ui
+++ b/src/generalwidget.ui
@@ -122,16 +122,6 @@
      </property>
     </widget>
    </item>
-   <item row="0" column="0" colspan="2" alignment="Qt::AlignRight">
-    <widget class="KUrlLabel" name="logo">
-     <property name="tipText">
-      <string>Open KuickShow Website</string>
-     </property>
-     <property name="useTips">
-      <bool>true</bool>
-     </property>
-    </widget>
-   </item>
    <item row="2" column="0" colspan="2">
     <widget class="QCheckBox" name="cbPreload">
      <property name="text">
@@ -165,11 +155,6 @@
    <extends>QLineEdit</extends>
    <header>klineedit.h</header>
   </customwidget>
-  <customwidget>
-   <class>KUrlLabel</class>
-   <extends>QLabel</extends>
-   <header>kurllabel.h</header>
-  </customwidget>
  </customwidgets>
  <resources/>
  <connections/>
diff --git a/src/kuickconfigdlg.cpp b/src/kuickconfigdlg.cpp
index 6c387bc..ac9eb84 100644
--- a/src/kuickconfigdlg.cpp
+++ b/src/kuickconfigdlg.cpp
@@ -18,11 +18,11 @@
 
 #include "kuickconfigdlg.h"
 
-#include <QDialogButtonBox>
 #include <KLocalizedString>
 #include <KSharedConfig>
 #include <KShortcutsDialog>
 
+#include <QDialogButtonBox>
 #include <QPushButton>
 
 #include "defaultswidget.h"
@@ -30,6 +30,7 @@
 #include "imagewindow.h"
 #include "kuickconfig.h"
 #include "slideshowwidget.h"
+#include "aboutwidget.h"
 
 
 KuickConfigDialog::KuickConfigDialog( KActionCollection *_coll, QWidget *parent, bool modal )
@@ -53,9 +54,14 @@ KuickConfigDialog::KuickConfigDialog( KActionCollection *_coll, QWidget *parent,
 
     slideshowWidget = new SlideShowWidget( this );
     slideshowWidget->setObjectName( QString::fromLatin1( "slideshow widget" ) );
-    page = addPage( slideshowWidget, i18n("&Slideshow")  );
+    page = addPage( slideshowWidget, i18n("&Slideshow") );
     page->setIcon(QIcon::fromTheme("ksslide"));
 
+    QWidget *aboutWidget = new AboutWidget( this );
+    aboutWidget->setObjectName( QString::fromLatin1( "about widget" ) );
+    page = addPage( aboutWidget, i18n("Info") );
+    page->setIcon(QIcon::fromTheme("help-about"));
+
     // TODO: this can be a child of us, then no need to delete in destructor
     imageWindow = new ImageWindow(); // just to get the accel...
     imageWindow->hide();
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.