1
0
mirror of https://gitlab.com/kelteseth/ScreenPlay.git synced 2024-11-07 03:22:33 +01:00

Add macwindow

This commit is contained in:
Elias 2019-04-04 17:19:19 +02:00
parent dc0d8afa8b
commit 161b77fd37
2 changed files with 69 additions and 0 deletions

View 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)
{
}

View 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;
};