Skip to content

Commit

Permalink
Get task switcher to support landscape
Browse files Browse the repository at this point in the history
  • Loading branch information
Eeems committed Jan 14, 2024
1 parent eb8cfe1 commit 725a491
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 14 deletions.
4 changes: 3 additions & 1 deletion applications/task-switcher/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,15 @@
#include <signal.h>
#include <liboxide.h>
#include <liboxide/eventfilter.h>
#include <liboxide/oxideqml.h>

#include "controller.h"

#include "screenprovider.h"

using namespace std;
using namespace Oxide;
using namespace Oxide::QML;
using namespace Oxide::Sentry;

void sigHandler(int signal){
Expand All @@ -32,8 +34,8 @@ int main(int argc, char *argv[]){
auto screenProvider = new ScreenProvider(&app);
Controller controller(&app, screenProvider);
QQmlApplicationEngine engine;
registerQML(&engine);
QQmlContext* context = engine.rootContext();
context->setContextProperty("screenGeometry", app.primaryScreen()->geometry());
context->setContextProperty("apps", QVariant::fromValue(controller.getApps()));
context->setContextProperty("controller", &controller);
engine.rootContext()->setContextProperty("screenProvider", screenProvider);
Expand Down
31 changes: 18 additions & 13 deletions applications/task-switcher/main.qml
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@ import QtQuick 2.10
import QtQuick.Window 2.3
import QtQuick.Controls 2.4
import QtQuick.Layouts 1.0
import "qrc:/codes.eeems.oxide"
import "./widgets"

ApplicationWindow {
OxideWindow {
id: window
objectName: "window"
visible: stateController.state === "loaded"
width: screenGeometry.width
height: screenGeometry.height
backgroundColor: "transparent"
title: qsTr("Corrupt")
property int itemPadding: 10
Connections{
Expand All @@ -25,6 +25,12 @@ ApplicationWindow {
}
}
}
Shortcut{
sequence: [StandardKey.Cancel, Qt.Key_Backspace]
context: Qt.ApplicationShortcut
onActivated: controller.previousApplication()
}

Component.onCompleted: {
controller.startup();
}
Expand All @@ -45,17 +51,16 @@ ApplicationWindow {
}
}
}
contentData: [
MouseArea {
anchors.fill: parent
enabled: stateController.state === "loaded"
onClicked: {
controller.breadcrumb("background", "click", "ui");
controller.previousApplication();
}
initialItem: MouseArea {
anchors.fill: parent
enabled: stateController.state === "loaded"
onClicked: {
controller.breadcrumb("background", "click", "ui");
controller.previousApplication();
}
]
footer: Rectangle {
}
page.header: Item{}
page.footer: Rectangle {
id: footer
color: "white"
border.color: "black"
Expand Down

0 comments on commit 725a491

Please sign in to comment.