Merge branch 'winqt5' of https://github.com/Cacodemon345/86Box into qt
This commit is contained in:
@@ -47,18 +47,21 @@ void HardwareRenderer::resizeEvent(QResizeEvent *event) {
|
|||||||
QOpenGLWindow::resizeEvent(event);
|
QOpenGLWindow::resizeEvent(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
void HardwareRenderer::mouseReleaseEvent(QMouseEvent *event)
|
bool HardwareRenderer::event(QEvent *event)
|
||||||
{
|
{
|
||||||
if (this->geometry().contains(event->pos()) && event->button() == Qt::LeftButton && !mouse_capture)
|
switch (event->type())
|
||||||
{
|
{
|
||||||
plat_mouse_capture(1);
|
default:
|
||||||
this->setCursor(Qt::BlankCursor);
|
return QOpenGLWindow::event(event);
|
||||||
return;
|
case QEvent::MouseButtonPress:
|
||||||
|
case QEvent::MouseMove:
|
||||||
|
case QEvent::MouseButtonRelease:
|
||||||
|
case QEvent::KeyPress:
|
||||||
|
case QEvent::KeyRelease:
|
||||||
|
case QEvent::Wheel:
|
||||||
|
case QEvent::Enter:
|
||||||
|
case QEvent::Leave:
|
||||||
|
return QApplication::sendEvent(parentWidget, event);
|
||||||
}
|
}
|
||||||
if (mouse_capture && event->button() == Qt::MiddleButton)
|
return false;
|
||||||
{
|
}
|
||||||
plat_mouse_capture(0);
|
|
||||||
this->setCursor(Qt::ArrowCursor);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
@@ -23,15 +23,17 @@ class HardwareRenderer : public QOpenGLWindow, protected QOpenGLFunctions, publi
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
bool wayland = false;
|
bool wayland = false;
|
||||||
|
QWidget* parentWidget{nullptr};
|
||||||
public:
|
public:
|
||||||
void resizeGL(int w, int h) override;
|
void resizeGL(int w, int h) override;
|
||||||
void initializeGL() override;
|
void initializeGL() override;
|
||||||
void paintGL() override;
|
void paintGL() override;
|
||||||
HardwareRenderer(QWindow* parent = nullptr)
|
HardwareRenderer(QWidget* parent = nullptr)
|
||||||
: QOpenGLWindow(QOpenGLWindow::NoPartialUpdate, parent), QOpenGLFunctions()
|
: QOpenGLWindow(QOpenGLWindow::NoPartialUpdate, parent->windowHandle()), QOpenGLFunctions()
|
||||||
{
|
{
|
||||||
setMinimumSize(QSize(16, 16));
|
setMinimumSize(QSize(16, 16));
|
||||||
setFlags(Qt::FramelessWindowHint);
|
setFlags(Qt::FramelessWindowHint);
|
||||||
|
parentWidget = parent;
|
||||||
}
|
}
|
||||||
~HardwareRenderer()
|
~HardwareRenderer()
|
||||||
{
|
{
|
||||||
@@ -49,5 +51,5 @@ public slots:
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
void resizeEvent(QResizeEvent *event) override;
|
void resizeEvent(QResizeEvent *event) override;
|
||||||
void mouseReleaseEvent(QMouseEvent* event) override;
|
bool event(QEvent* event) override;
|
||||||
};
|
};
|
||||||
|
@@ -26,6 +26,7 @@ extern "C" {
|
|||||||
#include <QDesktopServices>
|
#include <QDesktopServices>
|
||||||
#include <QUrl>
|
#include <QUrl>
|
||||||
#include <QCheckBox>
|
#include <QCheckBox>
|
||||||
|
#include <QActionGroup>
|
||||||
|
|
||||||
#include <array>
|
#include <array>
|
||||||
#include <unordered_map>
|
#include <unordered_map>
|
||||||
@@ -134,6 +135,7 @@ MainWindow::MainWindow(QWidget *parent) :
|
|||||||
ui->actionHiDPI_scaling->setChecked(dpi_scale);
|
ui->actionHiDPI_scaling->setChecked(dpi_scale);
|
||||||
ui->actionHide_status_bar->setChecked(hide_status_bar);
|
ui->actionHide_status_bar->setChecked(hide_status_bar);
|
||||||
ui->actionUpdate_status_bar_icons->setChecked(update_icons);
|
ui->actionUpdate_status_bar_icons->setChecked(update_icons);
|
||||||
|
QActionGroup* actGroup = nullptr;
|
||||||
switch (vid_api) {
|
switch (vid_api) {
|
||||||
case 0:
|
case 0:
|
||||||
ui->stackedWidget->switchRenderer(RendererStack::Renderer::Software);
|
ui->stackedWidget->switchRenderer(RendererStack::Renderer::Software);
|
||||||
@@ -148,6 +150,10 @@ MainWindow::MainWindow(QWidget *parent) :
|
|||||||
ui->actionHardware_Renderer_OpenGL_ES->setChecked(true);
|
ui->actionHardware_Renderer_OpenGL_ES->setChecked(true);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
actGroup = new QActionGroup(this);
|
||||||
|
actGroup->addAction(ui->actionSoftware_Renderer);
|
||||||
|
actGroup->addAction(ui->actionHardware_Renderer_OpenGL);
|
||||||
|
actGroup->addAction(ui->actionHardware_Renderer_OpenGL_ES);
|
||||||
switch (scale) {
|
switch (scale) {
|
||||||
case 0:
|
case 0:
|
||||||
ui->action0_5x->setChecked(true);
|
ui->action0_5x->setChecked(true);
|
||||||
@@ -162,6 +168,11 @@ MainWindow::MainWindow(QWidget *parent) :
|
|||||||
ui->action2x->setChecked(true);
|
ui->action2x->setChecked(true);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
actGroup = new QActionGroup(this);
|
||||||
|
actGroup->addAction(ui->action0_5x);
|
||||||
|
actGroup->addAction(ui->action1x);
|
||||||
|
actGroup->addAction(ui->action1_5x);
|
||||||
|
actGroup->addAction(ui->action2x);
|
||||||
switch (video_filter_method) {
|
switch (video_filter_method) {
|
||||||
case 0:
|
case 0:
|
||||||
ui->actionNearest->setChecked(true);
|
ui->actionNearest->setChecked(true);
|
||||||
@@ -170,6 +181,9 @@ MainWindow::MainWindow(QWidget *parent) :
|
|||||||
ui->actionLinear->setChecked(true);
|
ui->actionLinear->setChecked(true);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
actGroup = new QActionGroup(this);
|
||||||
|
actGroup->addAction(ui->actionNearest);
|
||||||
|
actGroup->addAction(ui->actionLinear);
|
||||||
switch (video_fullscreen_scale) {
|
switch (video_fullscreen_scale) {
|
||||||
case FULLSCR_SCALE_FULL:
|
case FULLSCR_SCALE_FULL:
|
||||||
ui->actionFullScreen_stretch->setChecked(true);
|
ui->actionFullScreen_stretch->setChecked(true);
|
||||||
@@ -184,6 +198,11 @@ MainWindow::MainWindow(QWidget *parent) :
|
|||||||
ui->actionFullScreen_int->setChecked(true);
|
ui->actionFullScreen_int->setChecked(true);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
actGroup = new QActionGroup(this);
|
||||||
|
actGroup->addAction(ui->actionFullScreen_stretch);
|
||||||
|
actGroup->addAction(ui->actionFullScreen_43);
|
||||||
|
actGroup->addAction(ui->actionFullScreen_keepRatio);
|
||||||
|
actGroup->addAction(ui->actionFullScreen_int);
|
||||||
switch (video_grayscale) {
|
switch (video_grayscale) {
|
||||||
case 0:
|
case 0:
|
||||||
ui->actionRGB_Color->setChecked(true);
|
ui->actionRGB_Color->setChecked(true);
|
||||||
@@ -201,6 +220,12 @@ MainWindow::MainWindow(QWidget *parent) :
|
|||||||
ui->actionWhite_monitor->setChecked(true);
|
ui->actionWhite_monitor->setChecked(true);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
actGroup = new QActionGroup(this);
|
||||||
|
actGroup->addAction(ui->actionRGB_Grayscale);
|
||||||
|
actGroup->addAction(ui->actionAmber_monitor);
|
||||||
|
actGroup->addAction(ui->actionGreen_monitor);
|
||||||
|
actGroup->addAction(ui->actionWhite_monitor);
|
||||||
|
actGroup->addAction(ui->actionRGB_Color);
|
||||||
switch (video_graytype) {
|
switch (video_graytype) {
|
||||||
case 0:
|
case 0:
|
||||||
ui->actionBT601_NTSC_PAL->setChecked(true);
|
ui->actionBT601_NTSC_PAL->setChecked(true);
|
||||||
@@ -212,6 +237,10 @@ MainWindow::MainWindow(QWidget *parent) :
|
|||||||
ui->actionAverage->setChecked(true);
|
ui->actionAverage->setChecked(true);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
actGroup = new QActionGroup(this);
|
||||||
|
actGroup->addAction(ui->actionBT601_NTSC_PAL);
|
||||||
|
actGroup->addAction(ui->actionBT709_HDTV);
|
||||||
|
actGroup->addAction(ui->actionAverage);
|
||||||
if (force_43 > 0) {
|
if (force_43 > 0) {
|
||||||
ui->actionForce_4_3_display_ratio->setChecked(true);
|
ui->actionForce_4_3_display_ratio->setChecked(true);
|
||||||
}
|
}
|
||||||
@@ -1281,4 +1310,4 @@ void MainWindow::on_actionSound_gain_triggered()
|
|||||||
void MainWindow::setSendKeyboardInput(bool enabled)
|
void MainWindow::setSendKeyboardInput(bool enabled)
|
||||||
{
|
{
|
||||||
send_keyboard_input = enabled;
|
send_keyboard_input = enabled;
|
||||||
}
|
}
|
||||||
|
@@ -184,7 +184,7 @@ void RendererStack::switchRenderer(Renderer renderer) {
|
|||||||
case Renderer::OpenGL:
|
case Renderer::OpenGL:
|
||||||
{
|
{
|
||||||
this->createWinId();
|
this->createWinId();
|
||||||
auto hw = new HardwareRenderer(this->windowHandle());
|
auto hw = new HardwareRenderer(this);
|
||||||
connect(this, &RendererStack::blitToRenderer, hw, &HardwareRenderer::onBlit, Qt::QueuedConnection);
|
connect(this, &RendererStack::blitToRenderer, hw, &HardwareRenderer::onBlit, Qt::QueuedConnection);
|
||||||
hw->setRenderType(HardwareRenderer::RenderType::OpenGL);
|
hw->setRenderType(HardwareRenderer::RenderType::OpenGL);
|
||||||
current.reset(this->createWindowContainer(hw, this));
|
current.reset(this->createWindowContainer(hw, this));
|
||||||
@@ -193,7 +193,7 @@ void RendererStack::switchRenderer(Renderer renderer) {
|
|||||||
case Renderer::OpenGLES:
|
case Renderer::OpenGLES:
|
||||||
{
|
{
|
||||||
this->createWinId();
|
this->createWinId();
|
||||||
auto hw = new HardwareRenderer(this->windowHandle());
|
auto hw = new HardwareRenderer(this);
|
||||||
connect(this, &RendererStack::blitToRenderer, hw, &HardwareRenderer::onBlit, Qt::QueuedConnection);
|
connect(this, &RendererStack::blitToRenderer, hw, &HardwareRenderer::onBlit, Qt::QueuedConnection);
|
||||||
hw->setRenderType(HardwareRenderer::RenderType::OpenGLES);
|
hw->setRenderType(HardwareRenderer::RenderType::OpenGLES);
|
||||||
current.reset(this->createWindowContainer(hw, this));
|
current.reset(this->createWindowContainer(hw, this));
|
||||||
@@ -201,6 +201,7 @@ void RendererStack::switchRenderer(Renderer renderer) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
current->setFocusPolicy(Qt::NoFocus);
|
current->setFocusPolicy(Qt::NoFocus);
|
||||||
|
current->setFocusProxy(this);
|
||||||
addWidget(current.get());
|
addWidget(current.get());
|
||||||
|
|
||||||
for (auto& in_use : buffers_in_use)
|
for (auto& in_use : buffers_in_use)
|
||||||
|
Reference in New Issue
Block a user