File indexing completed on 2024-12-22 04:41:15
0001 /* ============================================================ 0002 * Falkon - Qt web browser 0003 * Copyright (C) 2018 Anmol Gautam <tarptaeya@gmail.com> 0004 * 0005 * This program is free software: you can redistribute it and/or modify 0006 * it under the terms of the GNU General Public License as published by 0007 * the Free Software Foundation, either version 3 of the License, or 0008 * (at your option) any later version. 0009 * 0010 * This program is distributed in the hope that it will be useful, 0011 * but WITHOUT ANY WARRANTY; without even the implied warranty of 0012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 0013 * GNU General Public License for more details. 0014 * 0015 * You should have received a copy of the GNU General Public License 0016 * along with this program. If not, see <http://www.gnu.org/licenses/>. 0017 * ============================================================ */ 0018 #pragma once 0019 0020 #include <QObject> 0021 #include "browserwindow.h" 0022 #include "../qmlenums.h" 0023 /** 0024 * @brief The class exposing Browser window to QML 0025 */ 0026 class QmlWindow : public QObject 0027 { 0028 Q_OBJECT 0029 0030 /** 0031 * @brief id of window 0032 */ 0033 Q_PROPERTY(int id READ id CONSTANT) 0034 0035 /** 0036 * @brief checks if the window is private 0037 */ 0038 Q_PROPERTY(bool incognito READ incognito CONSTANT) 0039 0040 /** 0041 * @brief title of window 0042 */ 0043 Q_PROPERTY(QString title READ title CONSTANT) 0044 0045 /** 0046 * @brief [window state](@ref QmlEnums::WindowState) of window 0047 */ 0048 Q_PROPERTY(QmlEnums::WindowState state READ state CONSTANT) 0049 0050 /** 0051 * @brief [window type](@ref QmlEnums::WindowType) of window 0052 */ 0053 Q_PROPERTY(QmlEnums::WindowType type READ type CONSTANT) 0054 0055 /** 0056 * @brief list of all tabs of window 0057 */ 0058 Q_PROPERTY(QList<QObject*> tabs READ tabs CONSTANT) 0059 0060 /** 0061 * @brief checks if the window is focused 0062 */ 0063 Q_PROPERTY(bool focussed READ focussed CONSTANT) 0064 0065 /** 0066 * @brief height of window 0067 */ 0068 Q_PROPERTY(int height READ height CONSTANT) 0069 0070 /** 0071 * @brief width of window 0072 */ 0073 Q_PROPERTY(int width READ width CONSTANT) 0074 public: 0075 QmlWindow(BrowserWindow *window = nullptr, QObject *parent = nullptr); 0076 0077 private: 0078 BrowserWindow *m_window = nullptr; 0079 0080 int id() const; 0081 bool incognito() const; 0082 QString title() const; 0083 QmlEnums::WindowState state() const; 0084 QmlEnums::WindowType type() const; 0085 QList<QObject*> tabs() const; 0086 bool focussed() const; 0087 int height() const; 0088 int width() const; 0089 };