🎉 FINALLY! Extra window in any wayland compositor
This required switching from a QML Window to a QQuickView in C++. I want to try to eventually subclass that in Rust, but for now it works. I'll have to still tinker with this to find out how to specifically set the screen in certain environments, but for now the user will need to move the window on their own.
This commit is contained in:
parent
bbc5bf3d7c
commit
b74e85bfe6
5 changed files with 98 additions and 42 deletions
17
src/main.cpp
17
src/main.cpp
|
@ -152,7 +152,12 @@ int main(int argc, char *argv[])
|
||||||
|
|
||||||
Settings *settings = new Settings;
|
Settings *settings = new Settings;
|
||||||
settings->setup();
|
settings->setup();
|
||||||
// preswin->setSource(QUrl(QStringLiteral("qrc:qml/presenter/PresentationWindow.qml")));
|
|
||||||
|
QQuickView *PresWindow = new QQuickView;
|
||||||
|
qDebug() << PresWindow;
|
||||||
|
// PresWindow->create();
|
||||||
|
// PresWindow->setSource(QUrl(QStringLiteral("qrc://qml/presenter/PresentationWindow.qml")));
|
||||||
|
qDebug() << PresWindow->isVisible();
|
||||||
|
|
||||||
QObject::connect(serviceItemModel.get(),
|
QObject::connect(serviceItemModel.get(),
|
||||||
SIGNAL(itemInserted(const int&, const ServiceItem&)),
|
SIGNAL(itemInserted(const int&, const ServiceItem&)),
|
||||||
|
@ -223,7 +228,11 @@ int main(int argc, char *argv[])
|
||||||
qmlRegisterSingletonInstance("org.presenter", 1, 0, "SlideMod", slideMod.get());
|
qmlRegisterSingletonInstance("org.presenter", 1, 0, "SlideMod", slideMod.get());
|
||||||
qmlRegisterSingletonInstance("org.presenter", 1, 0, "SlideObject", slideobject.get());
|
qmlRegisterSingletonInstance("org.presenter", 1, 0, "SlideObject", slideobject.get());
|
||||||
qmlRegisterSingletonInstance("org.presenter", 1, 0, "FileManager", filemanager.get());
|
qmlRegisterSingletonInstance("org.presenter", 1, 0, "FileManager", filemanager.get());
|
||||||
|
qmlRegisterSingletonInstance("org.presenter", 1, 0, "PresWindow", PresWindow);
|
||||||
|
qmlRegisterSingletonInstance("org.presenter", 1, 0, "RSettings", settings);
|
||||||
// qmlRegisterSingletonInstance("org.presenter", 1, 0, "PresWindow", preswin.get());
|
// qmlRegisterSingletonInstance("org.presenter", 1, 0, "PresWindow", preswin.get());
|
||||||
|
PresWindow->rootContext()->setContextProperty("SlideObj", slideobject.get());
|
||||||
|
PresWindow->setTitle("presentation-window");
|
||||||
|
|
||||||
connectToDatabase();
|
connectToDatabase();
|
||||||
|
|
||||||
|
@ -231,6 +240,7 @@ int main(int argc, char *argv[])
|
||||||
|
|
||||||
engine.rootContext()->setContextObject(new KLocalizedContext(&engine));
|
engine.rootContext()->setContextObject(new KLocalizedContext(&engine));
|
||||||
engine.load(QUrl(QStringLiteral("qrc:qml/main.qml")));
|
engine.load(QUrl(QStringLiteral("qrc:qml/main.qml")));
|
||||||
|
// engine.load(QUrl(QStringLiteral("qrc:qml/presenter/PresentationWindow.qml")));
|
||||||
|
|
||||||
qDebug() << app.topLevelWindows();
|
qDebug() << app.topLevelWindows();
|
||||||
qDebug() << app.allWindows();
|
qDebug() << app.allWindows();
|
||||||
|
@ -246,11 +256,6 @@ int main(int argc, char *argv[])
|
||||||
}
|
}
|
||||||
|
|
||||||
QWindow *window = windowFromEngine(&engine);
|
QWindow *window = windowFromEngine(&engine);
|
||||||
QQuickWindow *PresWindow = new QQuickWindow;
|
|
||||||
qDebug() << PresWindow;
|
|
||||||
PresWindow->create();
|
|
||||||
// PresWindow->setVisible(true);
|
|
||||||
qDebug() << PresWindow->isVisible();
|
|
||||||
|
|
||||||
window->setIcon(QIcon::fromTheme(QStringLiteral("system-config-display")));
|
window->setIcon(QIcon::fromTheme(QStringLiteral("system-config-display")));
|
||||||
// KWindowSystem::setMainWindow(window);
|
// KWindowSystem::setMainWindow(window);
|
||||||
|
|
|
@ -29,6 +29,7 @@ Kirigami.ApplicationWindow {
|
||||||
signal edit()
|
signal edit()
|
||||||
|
|
||||||
onActiveFocusItemChanged: console.log("FOCUS CHANGED TO: " + activeFocusControl)
|
onActiveFocusItemChanged: console.log("FOCUS CHANGED TO: " + activeFocusControl)
|
||||||
|
onClosing: mainPage.closeAll()
|
||||||
|
|
||||||
/* pageStack.initialPage: mainPage */
|
/* pageStack.initialPage: mainPage */
|
||||||
header: Presenter.Header {}
|
header: Presenter.Header {}
|
||||||
|
|
|
@ -128,9 +128,14 @@ Controls.Page {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Presenter.PresentationWindow {
|
/* Loader { */
|
||||||
id: pWindow
|
/* id: presWinLoader */
|
||||||
}
|
/* active: false */
|
||||||
|
/* sourceComponent: Presenter.PresentationWindow {} */
|
||||||
|
/* } */
|
||||||
|
/* Presenter.PresentationWindow { */
|
||||||
|
/* id: pWindow */
|
||||||
|
/* } */
|
||||||
|
|
||||||
SongProxyModel { id: songProxyModel }
|
SongProxyModel { id: songProxyModel }
|
||||||
ImageProxyModel { id: imageProxyModel }
|
ImageProxyModel { id: imageProxyModel }
|
||||||
|
@ -272,15 +277,19 @@ Controls.Page {
|
||||||
function present(present) {
|
function present(present) {
|
||||||
if (present)
|
if (present)
|
||||||
{
|
{
|
||||||
/* presentation.loadVideo(); */
|
PresWindow.showFullScreen();
|
||||||
console.log("For window: Screen is: " + pWindow.screen + " And selected screen is: " + presentationScreen);
|
PresWindow.setSource("qrc:qml/presenter/PresentationWindow.qml")
|
||||||
pWindow.showFullScreen();
|
console.log(PresWindow);
|
||||||
/* pWindow.screen = presentationScreen; */
|
/* presWinLoader.active = true; */
|
||||||
console.log("For window: Screen is: " + pWindow.screen + " And selected screen is: " + presentationScreen);
|
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
pWindow.close();
|
PresWindow.close();
|
||||||
|
|
||||||
|
/* presWinLoader.active = false; */
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function closeAll() { PresWindow.close() }
|
||||||
|
|
||||||
function changeVidPos(pos) {
|
function changeVidPos(pos) {
|
||||||
presentation.slide.seek(pos);
|
presentation.slide.seek(pos);
|
||||||
|
|
|
@ -7,49 +7,64 @@ import org.kde.kirigami 2.13 as Kirigami
|
||||||
import "./" as Presenter
|
import "./" as Presenter
|
||||||
import org.presenter 1.0
|
import org.presenter 1.0
|
||||||
|
|
||||||
Window {
|
Item {
|
||||||
id: presentationWindow
|
id: presentationWindow
|
||||||
|
|
||||||
property Item slide: presentationSlide
|
property Item slide: presentationSlide
|
||||||
|
/* property var slideObj */
|
||||||
|
property var pWin
|
||||||
|
anchors.fill: parent
|
||||||
|
|
||||||
title: "presentation-window"
|
/* title: "presentation-window" */
|
||||||
height: maximumHeight
|
/* height: maximumHeight */
|
||||||
width: maximumWidth
|
/* width: maximumWidth */
|
||||||
screen: presentationScreen
|
/* screen: presentationScreen */
|
||||||
opacity: 1.0
|
/* opacity: 1.0 */
|
||||||
/* transientParent: null */
|
/* transientParent: null */
|
||||||
/* modality: Qt.NonModal */
|
/* modality: Qt.NonModal */
|
||||||
flags: Qt.FramelessWindowHint
|
/* flags: Qt.FramelessWindowHint */
|
||||||
onClosing: {
|
|
||||||
|
/* onClosing: { */
|
||||||
|
/* presentationSlide.stopVideo(); */
|
||||||
|
/* SlideObj.pause(); */
|
||||||
|
/* presentationSlide.stopAudio(); */
|
||||||
|
/* presenting = false; */
|
||||||
|
/* } */
|
||||||
|
|
||||||
|
Connections {
|
||||||
|
target: PresWindow
|
||||||
|
function onClosing() {
|
||||||
presentationSlide.stopVideo();
|
presentationSlide.stopVideo();
|
||||||
SlideObject.pause();
|
SlideObj.pause();
|
||||||
presentationSlide.stopAudio();
|
presentationSlide.stopAudio();
|
||||||
presenting = false;
|
presenting = false;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
console.log(screen.name);
|
/* console.log(screen.name); */
|
||||||
|
/* presentationWindow.showFullScreen(); */
|
||||||
}
|
}
|
||||||
|
|
||||||
Presenter.Slide {
|
Presenter.Slide {
|
||||||
id: presentationSlide
|
id: presentationSlide
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
imageSource: SlideObject.imageBackground
|
imageSource: SlideObj.imageBackground
|
||||||
webSource: SlideObject.html
|
webSource: SlideObj.html
|
||||||
videoSource: presentationWindow.visible ? SlideObject.videoBackground : ""
|
videoSource: presentationWindow.visible ? SlideObj.videoBackground : ""
|
||||||
audioSource: SlideObject.audio
|
audioSource: SlideObj.audio
|
||||||
text: SlideObject.text
|
text: SlideObj.text
|
||||||
chosenFont: SlideObject.font
|
chosenFont: SlideObj.font
|
||||||
textSize: SlideObject.fontSize
|
textSize: SlideObj.fontSize
|
||||||
pdfIndex: SlideObject.pdfIndex
|
pdfIndex: SlideObj.slideIndex
|
||||||
itemType: SlideObject.ty
|
itemType: SlideObj.ty
|
||||||
vidLoop: SlideObject.looping
|
vidLoop: SlideObj.looping
|
||||||
}
|
}
|
||||||
|
|
||||||
Connections {
|
Connections {
|
||||||
target: SlideObject
|
target: SlideObj
|
||||||
function onVideoBackgroundChanged() {
|
function onVideoBackgroundChanged() {
|
||||||
if (SlideObject.videoBackground === "")
|
if (SlideObj.videoBackground === "")
|
||||||
stopVideo();
|
stopVideo();
|
||||||
else {
|
else {
|
||||||
loadVideo();
|
loadVideo();
|
||||||
|
@ -57,7 +72,7 @@ Window {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
function onIsPlayingChanged() {
|
function onIsPlayingChanged() {
|
||||||
if(SlideObject.isPlaying)
|
if(SlideObj.isPlaying)
|
||||||
presentationSlide.playVideo();
|
presentationSlide.playVideo();
|
||||||
pauseVideo();
|
pauseVideo();
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,6 +20,7 @@ Kirigami.OverlaySheet {
|
||||||
/* } */
|
/* } */
|
||||||
|
|
||||||
Kirigami.FormLayout {
|
Kirigami.FormLayout {
|
||||||
|
implicitHeight: Kirigami.Units.gridUnit * 30
|
||||||
Controls.ComboBox {
|
Controls.ComboBox {
|
||||||
id: screenSelectionField
|
id: screenSelectionField
|
||||||
Kirigami.FormData.label: i18nc("@label:textbox", "Presentation Screen:")
|
Kirigami.FormData.label: i18nc("@label:textbox", "Presentation Screen:")
|
||||||
|
@ -27,6 +28,31 @@ Kirigami.OverlaySheet {
|
||||||
textRole: "name"
|
textRole: "name"
|
||||||
onActivated: {
|
onActivated: {
|
||||||
presentationScreen = screens[currentIndex];
|
presentationScreen = screens[currentIndex];
|
||||||
|
console.log(PresWindow.screen);
|
||||||
|
PresWindow.screen = screens[currentIndex];
|
||||||
|
console.log(PresWindow.screen);
|
||||||
|
}
|
||||||
|
|
||||||
|
popup: Controls.Popup {
|
||||||
|
y: screenSelectionField.height + 10
|
||||||
|
z: 1000
|
||||||
|
width: screenSelectionField.width
|
||||||
|
implicitHeight: contentItem.implicitHeight
|
||||||
|
padding: 1
|
||||||
|
|
||||||
|
contentItem: ListView {
|
||||||
|
clip: true
|
||||||
|
implicitHeight: contentHeight
|
||||||
|
model: screenSelectionField.popup.visible ? screenSelectionField.delegateModel : null
|
||||||
|
currentIndex: screenSelectionField.highlightedIndex
|
||||||
|
|
||||||
|
Controls.ScrollIndicator.vertical: Controls.ScrollIndicator { }
|
||||||
|
}
|
||||||
|
|
||||||
|
background: Rectangle {
|
||||||
|
border.color: Kirigami.Theme.hoverColor
|
||||||
|
radius: 2
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Controls.ToolButton {
|
Controls.ToolButton {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue