mirror of
https://github.com/Bismuth-Forge/bismuth.git
synced 2024-11-04 13:37:43 +03:00
chore: connect workspace signals to cxx controller
This commit is contained in:
parent
0387c0f486
commit
805229a182
@ -27,6 +27,11 @@ Controller::Controller(PlasmaApi::Api &api, Engine &engine)
|
|||||||
, m_engine(engine)
|
, m_engine(engine)
|
||||||
{
|
{
|
||||||
bindEvents();
|
bindEvents();
|
||||||
|
// TODO: Bind shortcuts
|
||||||
|
|
||||||
|
loadExistingWindows();
|
||||||
|
|
||||||
|
m_engine.arrange();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Controller::bindEvents()
|
void Controller::bindEvents()
|
||||||
@ -37,6 +42,25 @@ void Controller::bindEvents()
|
|||||||
connect(&workspace, &PlasmaApi::Workspace::screenResized, this, &Controller::onSurfaceUpdate);
|
connect(&workspace, &PlasmaApi::Workspace::screenResized, this, &Controller::onSurfaceUpdate);
|
||||||
connect(&workspace, &PlasmaApi::Workspace::currentActivityChanged, this, &Controller::onCurrentSurfaceChanged);
|
connect(&workspace, &PlasmaApi::Workspace::currentActivityChanged, this, &Controller::onCurrentSurfaceChanged);
|
||||||
connect(&workspace, &PlasmaApi::Workspace::clientAdded, this, &Controller::onClientAdded);
|
connect(&workspace, &PlasmaApi::Workspace::clientAdded, this, &Controller::onClientAdded);
|
||||||
|
connect(&workspace, &PlasmaApi::Workspace::clientRemoved, this, &Controller::onClientRemoved);
|
||||||
|
connect(&workspace, &PlasmaApi::Workspace::clientMaximizeSet, this, [this](PlasmaApi::Client client, bool h, bool v) {
|
||||||
|
if (h == true && v == true) {
|
||||||
|
onClientMaximized(client);
|
||||||
|
} else if (h == false && v == false) {
|
||||||
|
onClientUnmaximized(client);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
connect(&workspace, &PlasmaApi::Workspace::clientMinimized, this, &Controller::onClientMinimized);
|
||||||
|
connect(&workspace, &PlasmaApi::Workspace::clientUnminimized, this, &Controller::onClientUnminimized);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Controller::loadExistingWindows()
|
||||||
|
{
|
||||||
|
auto clients = m_plasmaApi.workspace().clientList();
|
||||||
|
|
||||||
|
for (auto client : clients) {
|
||||||
|
m_engine.addWindow(client);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Controller::registerAction(const Action &data)
|
void Controller::registerAction(const Action &data)
|
||||||
@ -85,6 +109,26 @@ void Controller::onClientAdded(PlasmaApi::Client client)
|
|||||||
m_engine.addWindow(client);
|
m_engine.addWindow(client);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Controller::onClientRemoved(PlasmaApi::Client)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void Controller::onClientMaximized(PlasmaApi::Client)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void Controller::onClientUnmaximized(PlasmaApi::Client)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void Controller::onClientMinimized(PlasmaApi::Client)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void Controller::onClientUnminimized(PlasmaApi::Client)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
void Controller::setProxy(TSProxy *proxy)
|
void Controller::setProxy(TSProxy *proxy)
|
||||||
{
|
{
|
||||||
m_proxy = proxy;
|
m_proxy = proxy;
|
||||||
|
@ -36,6 +36,7 @@ public:
|
|||||||
Controller(PlasmaApi::Api &, Engine &);
|
Controller(PlasmaApi::Api &, Engine &);
|
||||||
|
|
||||||
void bindEvents();
|
void bindEvents();
|
||||||
|
void loadExistingWindows();
|
||||||
void registerAction(const Action &);
|
void registerAction(const Action &);
|
||||||
|
|
||||||
void setProxy(TSProxy *);
|
void setProxy(TSProxy *);
|
||||||
@ -44,6 +45,11 @@ public Q_SLOTS:
|
|||||||
void onCurrentSurfaceChanged();
|
void onCurrentSurfaceChanged();
|
||||||
void onSurfaceUpdate();
|
void onSurfaceUpdate();
|
||||||
void onClientAdded(PlasmaApi::Client);
|
void onClientAdded(PlasmaApi::Client);
|
||||||
|
void onClientRemoved(PlasmaApi::Client);
|
||||||
|
void onClientMaximized(PlasmaApi::Client);
|
||||||
|
void onClientUnmaximized(PlasmaApi::Client);
|
||||||
|
void onClientMinimized(PlasmaApi::Client);
|
||||||
|
void onClientUnminimized(PlasmaApi::Client);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::vector<QAction *> m_registeredShortcuts{};
|
std::vector<QAction *> m_registeredShortcuts{};
|
||||||
|
@ -14,4 +14,12 @@ void Engine::addWindow(PlasmaApi::Client client)
|
|||||||
m_windows.add(client);
|
m_windows.add(client);
|
||||||
// Bind events of this window
|
// Bind events of this window
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Engine::removeWindow(PlasmaApi::Client client)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void Engine::arrange()
|
||||||
|
{
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -14,6 +14,12 @@ public:
|
|||||||
Engine();
|
Engine();
|
||||||
|
|
||||||
void addWindow(PlasmaApi::Client);
|
void addWindow(PlasmaApi::Client);
|
||||||
|
void removeWindow(PlasmaApi::Client);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Arrange the windows on all visible surfaces
|
||||||
|
*/
|
||||||
|
void arrange();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
WindowsList m_windows{};
|
WindowsList m_windows{};
|
||||||
|
Loading…
Reference in New Issue
Block a user