Falkon Develop
Cross-platform Qt-based web browser
qmltabs.h
Go to the documentation of this file.
1/* ============================================================
2* Falkon - Qt web browser
3* Copyright (C) 2018 Anmol Gautam <tarptaeya@gmail.com>
4*
5* This program is free software: you can redistribute it and/or modify
6* it under the terms of the GNU General Public License as published by
7* the Free Software Foundation, either version 3 of the License, or
8* (at your option) any later version.
9*
10* This program is distributed in the hope that it will be useful,
11* but WITHOUT ANY WARRANTY; without even the implied warranty of
12* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13* GNU General Public License for more details.
14*
15* You should have received a copy of the GNU General Public License
16* along with this program. If not, see <http://www.gnu.org/licenses/>.
17* ============================================================ */
18#pragma once
19
20#include <QObject>
21#include "mainapplication.h"
22#include "qmltab.h"
23
27class QmlTabs : public QObject
28{
29 Q_OBJECT
30public:
31 explicit QmlTabs(QObject *parent = nullptr);
41 Q_INVOKABLE bool setCurrentIndex(const QVariantMap &map);
47 Q_INVOKABLE bool nextTab(int windowId = -1);
53 Q_INVOKABLE bool previousTab(int windowId = -1);
65 Q_INVOKABLE bool moveTab(const QVariantMap &map);
75 Q_INVOKABLE bool pinTab(const QVariantMap &map);
85 Q_INVOKABLE bool unpinTab(const QVariantMap &map);
95 Q_INVOKABLE bool detachTab(const QVariantMap &map);
105 Q_INVOKABLE bool duplicate(const QVariantMap &map);
115 Q_INVOKABLE bool closeTab(const QVariantMap &map);
125 Q_INVOKABLE bool reloadTab(const QVariantMap &map);
135 Q_INVOKABLE bool stopTab(const QVariantMap &map);
145 Q_INVOKABLE QmlTab *get(const QVariantMap &map) const;
151 Q_INVOKABLE int normalTabsCount(int windowId = -1) const;
157 Q_INVOKABLE int pinnedTabsCount(int windowId = -1) const;
167 Q_INVOKABLE QList<QObject*> getAll(const QVariantMap &map = QVariantMap()) const;
180 Q_INVOKABLE QList<QObject*> search(const QVariantMap &map);
190 Q_INVOKABLE bool addTab(const QVariantMap &map);
191Q_SIGNALS:
196 void changed(int windowId);
197
206 void tabInserted(const QVariantMap &map);
207
216 void tabRemoved(const QVariantMap &map);
217
228 void tabMoved(const QVariantMap &map);
229private:
230 BrowserWindow *getWindow(const QVariantMap &map) const;
231 BrowserWindow *getWindow(int windowId) const;
232 void windowCreated(BrowserWindow *window);
233};
The class exposing a browser tab to QML.
Definition: qmltab.h:32
The class exposing Tabs API to QML.
Definition: qmltabs.h:28
Q_INVOKABLE bool unpinTab(const QVariantMap &map)
Un-pins a tab.
Definition: qmltabs.cpp:118
Q_INVOKABLE bool addTab(const QVariantMap &map)
Adds a tab.
Definition: qmltabs.cpp:298
Q_INVOKABLE bool closeTab(const QVariantMap &map)
Close a tab.
Definition: qmltabs.cpp:176
Q_INVOKABLE bool stopTab(const QVariantMap &map)
Stops a tab.
Definition: qmltabs.cpp:210
void tabInserted(const QVariantMap &map)
The signal emitted when a tab is inserted.
Q_INVOKABLE bool moveTab(const QVariantMap &map)
Moves a tab.
Definition: qmltabs.cpp:72
Q_INVOKABLE bool duplicate(const QVariantMap &map)
Duplicates a tab.
Definition: qmltabs.cpp:159
Q_INVOKABLE QList< QObject * > getAll(const QVariantMap &map=QVariantMap()) const
Gets all the tabs of a window.
Definition: qmltabs.cpp:262
Q_INVOKABLE int pinnedTabsCount(int windowId=-1) const
Get the pinned tabs count in a window.
Definition: qmltabs.cpp:253
QmlTabs(QObject *parent=nullptr)
Definition: qmltabs.cpp:24
Q_INVOKABLE bool setCurrentIndex(const QVariantMap &map)
Sets the current tab in a window.
Definition: qmltabs.cpp:35
Q_INVOKABLE bool nextTab(int windowId=-1)
Sets the next tab as current tab.
Definition: qmltabs.cpp:52
Q_INVOKABLE bool detachTab(const QVariantMap &map)
Detaches a tab.
Definition: qmltabs.cpp:142
Q_INVOKABLE bool previousTab(int windowId=-1)
Sets the previous tab as current tab.
Definition: qmltabs.cpp:62
void tabMoved(const QVariantMap &map)
The signal emitted when a tab is moved.
void changed(int windowId)
The signal emitted when tabs in the tab widget are changed.
Q_INVOKABLE bool reloadTab(const QVariantMap &map)
Reloads a tab.
Definition: qmltabs.cpp:193
Q_INVOKABLE QmlTab * get(const QVariantMap &map) const
Gets a tab.
Definition: qmltabs.cpp:227
Q_INVOKABLE bool pinTab(const QVariantMap &map)
Pins a tab.
Definition: qmltabs.cpp:94
Q_INVOKABLE int normalTabsCount(int windowId=-1) const
Get the normal tabs count in a window.
Definition: qmltabs.cpp:244
Q_INVOKABLE QList< QObject * > search(const QVariantMap &map)
Searches tabs against a criteria.
Definition: qmltabs.cpp:281
void tabRemoved(const QVariantMap &map)
The signal emitted when a tab is removed.