File indexing completed on 2025-01-19 03:50:47

0001 /* ============================================================
0002  *
0003  * This file is a part of digiKam project
0004  * https://www.digikam.org
0005  *
0006  * Date        : 2006-12-20
0007  * Description : a widget to display a welcome page
0008  *               on root album.
0009  *
0010  * SPDX-FileCopyrightText: 2006-2024 by Gilles Caulier <caulier dot gilles at gmail dot com>
0011  * SPDX-FileCopyrightText: 2009-2011 by Andi Clemens <andi dot clemens at gmail dot com>
0012  * SPDX-FileCopyrightText: 2015      by Mohamed_Anwer <m_dot_anwer at gmx dot com>
0013  *
0014  * SPDX-License-Identifier: GPL-2.0-or-later
0015  *
0016  * ============================================================ */
0017 
0018 #ifndef DIGIKAM_WELCOME_PAGE_VIEW_H
0019 #define DIGIKAM_WELCOME_PAGE_VIEW_H
0020 
0021 #include "digikam_config.h"
0022 
0023 // Qt includes
0024 
0025 #include <QByteArray>
0026 #include <QString>
0027 #include <QUrl>
0028 #include <QWidget>
0029 #include <QLabel>
0030 
0031 #ifdef HAVE_QWEBENGINE
0032 #   include <QWebEngineView>
0033 #   include <QWebEnginePage>
0034 #   include <QWebEngineSettings>
0035 #else
0036 #   include <qwebview.h>
0037 #endif
0038 
0039 // Local includes
0040 
0041 #include "digikam_export.h"
0042 
0043 namespace Digikam
0044 {
0045 
0046 #ifdef HAVE_QWEBENGINE
0047 
0048 class WelcomePageViewPage : public QWebEnginePage
0049 {
0050     Q_OBJECT
0051 
0052 public:
0053 
0054     explicit WelcomePageViewPage(QObject* const parent = nullptr);
0055     ~WelcomePageViewPage()                                                          override;
0056 
0057     bool acceptNavigationRequest(const QUrl&, QWebEnginePage::NavigationType, bool) override;
0058 
0059 Q_SIGNALS:
0060 
0061     void linkClicked(const QUrl&);
0062 
0063 };
0064 
0065 // -------------------------------------------------------------------
0066 
0067 class WelcomePageView : public QWebEngineView
0068 
0069 #else
0070 
0071 class WelcomePageView : public QWebView
0072 
0073 #endif
0074 
0075 {
0076     Q_OBJECT
0077 
0078 public:
0079 
0080     explicit WelcomePageView(QWidget* const parent);
0081     ~WelcomePageView()                                       override;
0082 
0083 private:
0084 
0085     QByteArray  fileToString(const QString& aFileName) const;
0086     QStringList featuresTabContent()                   const;
0087     QStringList aboutTabContent()                      const;
0088 
0089 private Q_SLOTS:
0090 
0091     void slotUrlOpen(const QUrl&);
0092     void slotThemeChanged();
0093 };
0094 
0095 
0096 } // namespace Digikam
0097 
0098 #endif // DIGIKAM_WELCOME_PAGE_VIEW_H