mirror of
https://gitlab.com/kelteseth/ScreenPlay.git
synced 2024-09-02 08:39:49 +02:00
Add linuxwindow
This commit is contained in:
parent
ac1eee9d27
commit
2a77ce9a37
@ -13,6 +13,14 @@ SOURCES += \
|
||||
HEADERS += \
|
||||
src/basewindow.h \
|
||||
|
||||
unix{
|
||||
SOURCES += \
|
||||
src/linuxwindow.cpp
|
||||
|
||||
HEADERS += \
|
||||
src/linuxwindow.h
|
||||
|
||||
}
|
||||
win32 {
|
||||
LIBS += -luser32
|
||||
SOURCES += \
|
||||
|
@ -8,6 +8,12 @@
|
||||
#include "src/winwindow.h"
|
||||
#endif
|
||||
|
||||
#if defined(Q_OS_LINUX)
|
||||
#include "src/linuxwindow.h"
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
#if defined(Q_OS_OSX)
|
||||
|
||||
// TODO MAC OSX PORT HERE
|
||||
@ -38,6 +44,10 @@ int main(int argc, char* argv[])
|
||||
#if defined(Q_OS_WIN)
|
||||
WinWindow window(list, "test", "appid", "1");
|
||||
#endif
|
||||
#if defined(Q_OS_LINUX)
|
||||
LinuxWindow window(list, "test", "appid", "1");
|
||||
#endif
|
||||
|
||||
return app.exec();
|
||||
}
|
||||
|
||||
@ -80,6 +90,12 @@ int main(int argc, char* argv[])
|
||||
QObject::connect(&sdk, &ScreenPlaySDK::incommingMessage, &window, &WinWindow::messageReceived);
|
||||
#endif
|
||||
|
||||
#if defined(Q_OS_LINUX)
|
||||
LinuxWindow window(list, argumentList.at(2), argumentList.at(3), argumentList.at(5));
|
||||
QObject::connect(&sdk, &ScreenPlaySDK::sdkDisconnected, &window, &LinuxWindow::destroyThis);
|
||||
QObject::connect(&sdk, &ScreenPlaySDK::incommingMessage, &window, &LinuxWindow::messageReceived);
|
||||
#endif
|
||||
|
||||
#if defined(Q_OS_OSX)
|
||||
|
||||
// TODO MAC OSX PORT HERE
|
||||
|
@ -1,6 +1,6 @@
|
||||
import QtQuick 2.12
|
||||
import QtWebEngine 1.8
|
||||
import net.aimber.wallpaper 1.0
|
||||
//import net.aimber.wallpaper 1.0
|
||||
|
||||
Rectangle {
|
||||
anchors.fill: parent
|
||||
|
38
ScreenPlayWindow/src/linuxwindow.cpp
Normal file
38
ScreenPlayWindow/src/linuxwindow.cpp
Normal file
@ -0,0 +1,38 @@
|
||||
#include "linuxwindow.h"
|
||||
|
||||
LinuxWindow::LinuxWindow(QVector<int>& activeScreensList, QString projectPath, QString id, QString volume, QObject* parent)
|
||||
: BaseWindow(projectPath)
|
||||
{
|
||||
setAppID(id);
|
||||
bool ok = false;
|
||||
float volumeParsed = volume.toFloat(&ok);
|
||||
if (!ok) {
|
||||
qFatal("Could not parse volume");
|
||||
}
|
||||
setVolume(volumeParsed);
|
||||
|
||||
// WARNING: Setting Window flags must be called *here*!
|
||||
Qt::WindowFlags flags = m_window.flags();
|
||||
m_window.setFlags(flags | Qt::FramelessWindowHint | Qt::Desktop);
|
||||
|
||||
m_window.setResizeMode(QQuickView::ResizeMode::SizeRootObjectToView);
|
||||
m_window.rootContext()->setContextProperty("window", this);
|
||||
// Instead of setting "renderType: Text.NativeRendering" every time
|
||||
// we can set it here once :)
|
||||
m_window.setTextRenderType(QQuickWindow::TextRenderType::NativeTextRendering);
|
||||
m_window.setSource(QUrl("qrc:/mainWindow.qml"));
|
||||
}
|
||||
|
||||
void LinuxWindow::setVisible(bool show)
|
||||
{
|
||||
m_window.setVisible(show);
|
||||
}
|
||||
|
||||
void LinuxWindow::destroyThis()
|
||||
{
|
||||
QCoreApplication::quit();
|
||||
}
|
||||
|
||||
void LinuxWindow::messageReceived(QString key, QString value)
|
||||
{
|
||||
}
|
31
ScreenPlayWindow/src/linuxwindow.h
Normal file
31
ScreenPlayWindow/src/linuxwindow.h
Normal file
@ -0,0 +1,31 @@
|
||||
#pragma once
|
||||
|
||||
#include <QApplication>
|
||||
#include <QDebug>
|
||||
#include <QObject>
|
||||
#include <QQmlContext>
|
||||
#include <QQmlEngine>
|
||||
#include <QQuickView>
|
||||
#include <QScreen>
|
||||
#include <QSettings>
|
||||
#include <QString>
|
||||
#include <QVector>
|
||||
|
||||
#include "basewindow.h"
|
||||
|
||||
class LinuxWindow : public BaseWindow
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit LinuxWindow(QVector<int>& activeScreensList, QString projectPath, QString id, QString volume,QObject *parent = nullptr);
|
||||
|
||||
signals:
|
||||
|
||||
public slots:
|
||||
void setVisible(bool show) override;
|
||||
void destroyThis() override;
|
||||
void messageReceived(QString key, QString value) override;
|
||||
private:
|
||||
QQuickView m_window;
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user