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);
|
||||
}
|
||||
|
||||
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);
|
||||
this->setCursor(Qt::BlankCursor);
|
||||
return;
|
||||
default:
|
||||
return QOpenGLWindow::event(event);
|
||||
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)
|
||||
{
|
||||
plat_mouse_capture(0);
|
||||
this->setCursor(Qt::ArrowCursor);
|
||||
return;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@@ -23,15 +23,17 @@ class HardwareRenderer : public QOpenGLWindow, protected QOpenGLFunctions, publi
|
||||
|
||||
private:
|
||||
bool wayland = false;
|
||||
QWidget* parentWidget{nullptr};
|
||||
public:
|
||||
void resizeGL(int w, int h) override;
|
||||
void initializeGL() override;
|
||||
void paintGL() override;
|
||||
HardwareRenderer(QWindow* parent = nullptr)
|
||||
: QOpenGLWindow(QOpenGLWindow::NoPartialUpdate, parent), QOpenGLFunctions()
|
||||
HardwareRenderer(QWidget* parent = nullptr)
|
||||
: QOpenGLWindow(QOpenGLWindow::NoPartialUpdate, parent->windowHandle()), QOpenGLFunctions()
|
||||
{
|
||||
setMinimumSize(QSize(16, 16));
|
||||
setFlags(Qt::FramelessWindowHint);
|
||||
parentWidget = parent;
|
||||
}
|
||||
~HardwareRenderer()
|
||||
{
|
||||
@@ -49,5 +51,5 @@ public slots:
|
||||
|
||||
protected:
|
||||
void resizeEvent(QResizeEvent *event) override;
|
||||
void mouseReleaseEvent(QMouseEvent* event) override;
|
||||
bool event(QEvent* event) override;
|
||||
};
|
||||
|
@@ -26,6 +26,7 @@ extern "C" {
|
||||
#include <QDesktopServices>
|
||||
#include <QUrl>
|
||||
#include <QCheckBox>
|
||||
#include <QActionGroup>
|
||||
|
||||
#include <array>
|
||||
#include <unordered_map>
|
||||
@@ -134,6 +135,7 @@ MainWindow::MainWindow(QWidget *parent) :
|
||||
ui->actionHiDPI_scaling->setChecked(dpi_scale);
|
||||
ui->actionHide_status_bar->setChecked(hide_status_bar);
|
||||
ui->actionUpdate_status_bar_icons->setChecked(update_icons);
|
||||
QActionGroup* actGroup = nullptr;
|
||||
switch (vid_api) {
|
||||
case 0:
|
||||
ui->stackedWidget->switchRenderer(RendererStack::Renderer::Software);
|
||||
@@ -148,6 +150,10 @@ MainWindow::MainWindow(QWidget *parent) :
|
||||
ui->actionHardware_Renderer_OpenGL_ES->setChecked(true);
|
||||
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) {
|
||||
case 0:
|
||||
ui->action0_5x->setChecked(true);
|
||||
@@ -162,6 +168,11 @@ MainWindow::MainWindow(QWidget *parent) :
|
||||
ui->action2x->setChecked(true);
|
||||
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) {
|
||||
case 0:
|
||||
ui->actionNearest->setChecked(true);
|
||||
@@ -170,6 +181,9 @@ MainWindow::MainWindow(QWidget *parent) :
|
||||
ui->actionLinear->setChecked(true);
|
||||
break;
|
||||
}
|
||||
actGroup = new QActionGroup(this);
|
||||
actGroup->addAction(ui->actionNearest);
|
||||
actGroup->addAction(ui->actionLinear);
|
||||
switch (video_fullscreen_scale) {
|
||||
case FULLSCR_SCALE_FULL:
|
||||
ui->actionFullScreen_stretch->setChecked(true);
|
||||
@@ -184,6 +198,11 @@ MainWindow::MainWindow(QWidget *parent) :
|
||||
ui->actionFullScreen_int->setChecked(true);
|
||||
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) {
|
||||
case 0:
|
||||
ui->actionRGB_Color->setChecked(true);
|
||||
@@ -201,6 +220,12 @@ MainWindow::MainWindow(QWidget *parent) :
|
||||
ui->actionWhite_monitor->setChecked(true);
|
||||
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) {
|
||||
case 0:
|
||||
ui->actionBT601_NTSC_PAL->setChecked(true);
|
||||
@@ -212,6 +237,10 @@ MainWindow::MainWindow(QWidget *parent) :
|
||||
ui->actionAverage->setChecked(true);
|
||||
break;
|
||||
}
|
||||
actGroup = new QActionGroup(this);
|
||||
actGroup->addAction(ui->actionBT601_NTSC_PAL);
|
||||
actGroup->addAction(ui->actionBT709_HDTV);
|
||||
actGroup->addAction(ui->actionAverage);
|
||||
if (force_43 > 0) {
|
||||
ui->actionForce_4_3_display_ratio->setChecked(true);
|
||||
}
|
||||
@@ -1281,4 +1310,4 @@ void MainWindow::on_actionSound_gain_triggered()
|
||||
void MainWindow::setSendKeyboardInput(bool enabled)
|
||||
{
|
||||
send_keyboard_input = enabled;
|
||||
}
|
||||
}
|
||||
|
@@ -184,7 +184,7 @@ void RendererStack::switchRenderer(Renderer renderer) {
|
||||
case Renderer::OpenGL:
|
||||
{
|
||||
this->createWinId();
|
||||
auto hw = new HardwareRenderer(this->windowHandle());
|
||||
auto hw = new HardwareRenderer(this);
|
||||
connect(this, &RendererStack::blitToRenderer, hw, &HardwareRenderer::onBlit, Qt::QueuedConnection);
|
||||
hw->setRenderType(HardwareRenderer::RenderType::OpenGL);
|
||||
current.reset(this->createWindowContainer(hw, this));
|
||||
@@ -193,7 +193,7 @@ void RendererStack::switchRenderer(Renderer renderer) {
|
||||
case Renderer::OpenGLES:
|
||||
{
|
||||
this->createWinId();
|
||||
auto hw = new HardwareRenderer(this->windowHandle());
|
||||
auto hw = new HardwareRenderer(this);
|
||||
connect(this, &RendererStack::blitToRenderer, hw, &HardwareRenderer::onBlit, Qt::QueuedConnection);
|
||||
hw->setRenderType(HardwareRenderer::RenderType::OpenGLES);
|
||||
current.reset(this->createWindowContainer(hw, this));
|
||||
@@ -201,6 +201,7 @@ void RendererStack::switchRenderer(Renderer renderer) {
|
||||
}
|
||||
}
|
||||
current->setFocusPolicy(Qt::NoFocus);
|
||||
current->setFocusProxy(this);
|
||||
addWidget(current.get());
|
||||
|
||||
for (auto& in_use : buffers_in_use)
|
||||
|
Reference in New Issue
Block a user