mirror of
https://gitlab.com/kelteseth/ScreenPlay.git
synced 2024-09-02 08:39:49 +02:00
Add macwindow
This commit is contained in:
parent
dc0d8afa8b
commit
161b77fd37
38
ScreenPlayWindow/src/macwindow.cpp
Normal file
38
ScreenPlayWindow/src/macwindow.cpp
Normal file
@ -0,0 +1,38 @@
|
||||
#include "macwindow.h"
|
||||
|
||||
MacWindow::MacWindow(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 MacWindow::setVisible(bool show)
|
||||
{
|
||||
m_window.setVisible(show);
|
||||
}
|
||||
|
||||
void MacWindow::destroyThis()
|
||||
{
|
||||
QCoreApplication::quit();
|
||||
}
|
||||
|
||||
void MacWindow::messageReceived(QString key, QString value)
|
||||
{
|
||||
}
|
31
ScreenPlayWindow/src/macwindow.h
Normal file
31
ScreenPlayWindow/src/macwindow.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 MacWindow : public BaseWindow
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit MacWindow(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