scripting: Rename Workspace.clientList

This commit is contained in:
Vlad Zahorodnii 2023-08-23 11:42:26 +03:00
parent 52604c5d73
commit ceac574a68
5 changed files with 14 additions and 14 deletions

View file

@ -16,7 +16,7 @@ function isRelevant(client) {
} }
function minimizeAllWindows() { function minimizeAllWindows() {
var allClients = workspace.clientList(); var allClients = workspace.windowList();
var relevantClients = []; var relevantClients = [];
var minimize = false; var minimize = false;

View file

@ -17,7 +17,7 @@ function setupConnection(client) {
workspace.windowAdded.connect(setupConnection); workspace.windowAdded.connect(setupConnection);
// connect all existing clients // connect all existing clients
var clients = workspace.clientList(); var clients = workspace.windowList();
for (var i=0; i<clients.length; i++) { for (var i=0; i<clients.length; i++) {
setupConnection(clients[i]); setupConnection(clients[i]);
} }

View file

@ -35,4 +35,4 @@ function setup(window) {
} }
workspace.windowAdded.connect(setup); workspace.windowAdded.connect(setup);
workspace.clientList().forEach(setup); workspace.windowList().forEach(setup);

View file

@ -408,22 +408,22 @@ QtScriptWorkspaceWrapper::QtScriptWorkspaceWrapper(QObject *parent)
{ {
} }
QList<KWin::Window *> QtScriptWorkspaceWrapper::clientList() const QList<KWin::Window *> QtScriptWorkspaceWrapper::windowList() const
{ {
return workspace()->windows(); return workspace()->windows();
} }
QQmlListProperty<KWin::Window> DeclarativeScriptWorkspaceWrapper::clients() QQmlListProperty<KWin::Window> DeclarativeScriptWorkspaceWrapper::windows()
{ {
return QQmlListProperty<KWin::Window>(this, nullptr, &DeclarativeScriptWorkspaceWrapper::countClientList, &DeclarativeScriptWorkspaceWrapper::atClientList); return QQmlListProperty<KWin::Window>(this, nullptr, &DeclarativeScriptWorkspaceWrapper::countWindowList, &DeclarativeScriptWorkspaceWrapper::atWindowList);
} }
qsizetype DeclarativeScriptWorkspaceWrapper::countClientList(QQmlListProperty<KWin::Window> *clients) qsizetype DeclarativeScriptWorkspaceWrapper::countWindowList(QQmlListProperty<KWin::Window> *windows)
{ {
return workspace()->windows().size(); return workspace()->windows().size();
} }
KWin::Window *DeclarativeScriptWorkspaceWrapper::atClientList(QQmlListProperty<KWin::Window> *clients, qsizetype index) KWin::Window *DeclarativeScriptWorkspaceWrapper::atWindowList(QQmlListProperty<KWin::Window> *windows, qsizetype index)
{ {
return workspace()->windows().at(index); return workspace()->windows().at(index);
} }

View file

@ -364,9 +364,9 @@ class QtScriptWorkspaceWrapper : public WorkspaceWrapper
Q_OBJECT Q_OBJECT
public: public:
/** /**
* List of Clients currently managed by KWin. * List of windows currently managed by KWin.
*/ */
Q_INVOKABLE QList<KWin::Window *> clientList() const; Q_INVOKABLE QList<KWin::Window *> windowList() const;
explicit QtScriptWorkspaceWrapper(QObject *parent = nullptr); explicit QtScriptWorkspaceWrapper(QObject *parent = nullptr);
}; };
@ -375,11 +375,11 @@ class DeclarativeScriptWorkspaceWrapper : public WorkspaceWrapper
{ {
Q_OBJECT Q_OBJECT
Q_PROPERTY(QQmlListProperty<KWin::Window> clients READ clients) Q_PROPERTY(QQmlListProperty<KWin::Window> windows READ windows)
public: public:
QQmlListProperty<KWin::Window> clients(); QQmlListProperty<KWin::Window> windows();
static qsizetype countClientList(QQmlListProperty<KWin::Window> *clients); static qsizetype countWindowList(QQmlListProperty<KWin::Window> *window);
static KWin::Window *atClientList(QQmlListProperty<KWin::Window> *clients, qsizetype index); static KWin::Window *atWindowList(QQmlListProperty<KWin::Window> *windows, qsizetype index);
explicit DeclarativeScriptWorkspaceWrapper(QObject *parent = nullptr); explicit DeclarativeScriptWorkspaceWrapper(QObject *parent = nullptr);
}; };