File indexing completed on 2024-05-12 16:23:41
0001 // SPDX-FileCopyrightText: 2020 Jonah BrĂ¼chert <jbb@kaidan.im> 0002 // SPDX-FileCopyrightText: 2020 Rinigus <rinigus.git@gmail.com> 0003 // 0004 // SPDX-License-Identifier: GPL-2.0-or-later 0005 0006 #ifndef USERAGENT_H 0007 #define USERAGENT_H 0008 0009 #include <QObject> 0010 0011 class QQuickWebEngineProfile; 0012 0013 class UserAgent : public QObject 0014 { 0015 Q_PROPERTY(QString userAgent READ userAgent NOTIFY userAgentChanged) 0016 Q_PROPERTY(bool isMobile READ isMobile WRITE setIsMobile NOTIFY isMobileChanged) 0017 0018 Q_OBJECT 0019 0020 public: 0021 explicit UserAgent(QObject *parent = nullptr); 0022 0023 QString userAgent() const; 0024 0025 bool isMobile() const; 0026 void setIsMobile(bool value); 0027 0028 Q_SIGNALS: 0029 void isMobileChanged(); 0030 void userAgentChanged(); 0031 0032 private: 0033 QStringView extractValueFromAgent(const QStringView key); 0034 0035 const QQuickWebEngineProfile *m_defaultProfile; 0036 const QString m_defaultUserAgent; 0037 const QStringView m_chromeVersion; 0038 const QStringView m_appleWebKitVersion; 0039 const QStringView m_webEngineVersion; 0040 const QStringView m_safariVersion; 0041 0042 bool m_isMobile; 0043 }; 0044 0045 #endif // USERAGENT_H