Merge branch 'qt' of https://github.com/jgilje/86Box into qt
This commit is contained in:
@@ -7,6 +7,7 @@ extern "C" {
|
||||
#include <86box/keyboard.h>
|
||||
#include <86box/plat.h>
|
||||
#include <86box/video.h>
|
||||
#include <86box/vid_ega.h>
|
||||
};
|
||||
|
||||
#include <QGuiApplication>
|
||||
@@ -16,6 +17,10 @@ extern "C" {
|
||||
#include <QKeyEvent>
|
||||
#include <QMessageBox>
|
||||
#include <QFocusEvent>
|
||||
#include <QApplication>
|
||||
#include <QPushButton>
|
||||
#include <QDesktopServices>
|
||||
#include <QUrl>
|
||||
|
||||
#include <array>
|
||||
#include <unordered_map>
|
||||
@@ -48,6 +53,8 @@ MainWindow::MainWindow(QWidget *parent) :
|
||||
ui->ogl->setRenderType(HardwareRenderer::RenderType::OpenGL);
|
||||
ui->gles->setRenderType(HardwareRenderer::RenderType::OpenGLES);
|
||||
|
||||
this->setWindowIcon(QIcon(":/settings/win/icons/86Box-yellow.ico"));
|
||||
|
||||
connect(this, &MainWindow::showMessageForNonQtThread, this, &MainWindow::showMessage_, Qt::BlockingQueuedConnection);
|
||||
|
||||
connect(this, &MainWindow::setTitleForNonQtThread, this, &MainWindow::setTitle_, Qt::BlockingQueuedConnection);
|
||||
@@ -181,6 +188,15 @@ MainWindow::MainWindow(QWidget *parent) :
|
||||
ui->actionAverage->setChecked(true);
|
||||
break;
|
||||
}
|
||||
if (force_43 > 0) {
|
||||
ui->actionForce_4_3_display_ratio->setChecked(true);
|
||||
}
|
||||
if (enable_overscan > 0) {
|
||||
ui->actionCGA_PCjr_Tandy_EGA_S_VGA_overscan->setChecked(true);
|
||||
}
|
||||
if (vid_cga_contrast > 0) {
|
||||
ui->actionChange_contrast_for_monochrome_display->setChecked(true);
|
||||
}
|
||||
|
||||
setFocusPolicy(Qt::StrongFocus);
|
||||
ui->gles->setFocusPolicy(Qt::NoFocus);
|
||||
@@ -773,9 +789,13 @@ uint16_t x11_keycode_to_keysym(uint32_t keycode)
|
||||
|
||||
void MainWindow::on_actionFullscreen_triggered() {
|
||||
if (video_fullscreen > 0) {
|
||||
ui->menubar->show();
|
||||
ui->statusbar->show();
|
||||
showNormal();
|
||||
video_fullscreen = 0;
|
||||
} else {
|
||||
ui->menubar->hide();
|
||||
ui->statusbar->hide();
|
||||
showFullScreen();
|
||||
video_fullscreen = 1;
|
||||
}
|
||||
@@ -859,7 +879,7 @@ void MainWindow::keyPressEvent(QKeyEvent* event)
|
||||
#endif
|
||||
}
|
||||
|
||||
if (keyboard_isfsexit()) {
|
||||
if ((video_fullscreen > 0) && keyboard_isfsexit()) {
|
||||
ui->actionFullscreen->trigger();
|
||||
}
|
||||
|
||||
@@ -1080,6 +1100,55 @@ void MainWindow::on_actionAverage_triggered() {
|
||||
update_greyscale_type_checkboxes(ui, ui->actionAverage, 2);
|
||||
}
|
||||
|
||||
void MainWindow::on_actionAbout_Qt_triggered()
|
||||
{
|
||||
QApplication::aboutQt();
|
||||
}
|
||||
|
||||
void MainWindow::on_actionAbout_86Box_triggered()
|
||||
{
|
||||
QMessageBox msgBox;
|
||||
msgBox.setTextFormat(Qt::RichText);
|
||||
msgBox.setText("<b>About 86Box</b>");
|
||||
msgBox.setInformativeText(R"(
|
||||
An emulator of old computers
|
||||
|
||||
Authors: Sarah Walker, Miran Grca, Fred N. van Kempen (waltje), SA1988, Tiseno100, reenigne, leilei, JohnElliott, greatpsycho, and others.
|
||||
|
||||
Released under the GNU General Public License version 2 or later. See LICENSE for more information.
|
||||
)");
|
||||
msgBox.setWindowTitle("About 86Box");
|
||||
msgBox.addButton("OK", QMessageBox::ButtonRole::AcceptRole);
|
||||
auto webSiteButton = msgBox.addButton("86box.net", QMessageBox::ButtonRole::HelpRole);
|
||||
webSiteButton->connect(webSiteButton, &QPushButton::released, []()
|
||||
{
|
||||
QDesktopServices::openUrl(QUrl("https://86box.net/"));
|
||||
});
|
||||
msgBox.setIconPixmap(QIcon(":/settings/win/icons/86Box-yellow.ico").pixmap(32, 32));
|
||||
msgBox.exec();
|
||||
}
|
||||
|
||||
void MainWindow::on_actionDocumentation_triggered()
|
||||
{
|
||||
QDesktopServices::openUrl(QUrl("https://86box.readthedocs.io"));
|
||||
}
|
||||
|
||||
void MainWindow::on_actionCGA_PCjr_Tandy_EGA_S_VGA_overscan_triggered() {
|
||||
update_overscan = 1;
|
||||
video_toggle_option(ui->actionCGA_PCjr_Tandy_EGA_S_VGA_overscan, &enable_overscan);
|
||||
}
|
||||
|
||||
void MainWindow::on_actionChange_contrast_for_monochrome_display_triggered() {
|
||||
vid_cga_contrast ^= 1;
|
||||
cgapal_rebuild();
|
||||
config_save();
|
||||
}
|
||||
|
||||
void MainWindow::on_actionForce_4_3_display_ratio_triggered() {
|
||||
video_toggle_option(ui->actionForce_4_3_display_ratio, &force_43);
|
||||
video_force_resize_set(1);
|
||||
}
|
||||
|
||||
void MainWindow::setSendKeyboardInput(bool enabled)
|
||||
{
|
||||
send_keyboard_input = enabled;
|
||||
|
@@ -77,6 +77,12 @@ private slots:
|
||||
void on_actionAverage_triggered();
|
||||
void on_actionBT709_HDTV_triggered();
|
||||
void on_actionBT601_NTSC_PAL_triggered();
|
||||
void on_actionDocumentation_triggered();
|
||||
void on_actionAbout_86Box_triggered();
|
||||
void on_actionAbout_Qt_triggered();
|
||||
void on_actionForce_4_3_display_ratio_triggered();
|
||||
void on_actionChange_contrast_for_monochrome_display_triggered();
|
||||
void on_actionCGA_PCjr_Tandy_EGA_S_VGA_overscan_triggered();
|
||||
|
||||
void refreshMediaMenu();
|
||||
void showMessage_(const QString& header, const QString& message);
|
||||
|
@@ -166,10 +166,19 @@
|
||||
<string>Media</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QMenu" name="menuAbout">
|
||||
<property name="title">
|
||||
<string>Help</string>
|
||||
</property>
|
||||
<addaction name="actionDocumentation"/>
|
||||
<addaction name="actionAbout_86Box"/>
|
||||
<addaction name="actionAbout_Qt"/>
|
||||
</widget>
|
||||
<addaction name="menuAction"/>
|
||||
<addaction name="menuView"/>
|
||||
<addaction name="menuMedia"/>
|
||||
<addaction name="menuTools"/>
|
||||
<addaction name="menuAbout"/>
|
||||
</widget>
|
||||
<widget class="QStatusBar" name="statusbar"/>
|
||||
<action name="actionKeyboard_requires_capture">
|
||||
@@ -466,6 +475,27 @@
|
||||
<string>Average</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionAbout_Qt">
|
||||
<property name="text">
|
||||
<string>About Qt...</string>
|
||||
</property>
|
||||
<property name="menuRole">
|
||||
<enum>QAction::AboutQtRole</enum>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionAbout_86Box">
|
||||
<property name="text">
|
||||
<string>About 86Box...</string>
|
||||
</property>
|
||||
<property name="menuRole">
|
||||
<enum>QAction::AboutRole</enum>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionDocumentation">
|
||||
<property name="text">
|
||||
<string>Documentation...</string>
|
||||
</property>
|
||||
</action>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
|
@@ -70,12 +70,14 @@ void RendererStack::mousePoll()
|
||||
#endif
|
||||
}
|
||||
|
||||
int ignoreNextMouseEvent = 1;
|
||||
void RendererStack::mouseReleaseEvent(QMouseEvent *event)
|
||||
{
|
||||
if (this->geometry().contains(event->pos()) && event->button() == Qt::LeftButton && !mouse_capture)
|
||||
{
|
||||
plat_mouse_capture(1);
|
||||
this->setCursor(Qt::BlankCursor);
|
||||
if (!ignoreNextMouseEvent) ignoreNextMouseEvent++; // Avoid jumping cursor when moved.
|
||||
return;
|
||||
}
|
||||
if (mouse_capture && event->button() == Qt::MiddleButton && mouse_get_buttons() < 3)
|
||||
@@ -105,7 +107,6 @@ void RendererStack::wheelEvent(QWheelEvent *event)
|
||||
}
|
||||
}
|
||||
|
||||
int ignoreNextMouseEvent = 1;
|
||||
void RendererStack::mouseMoveEvent(QMouseEvent *event)
|
||||
{
|
||||
if (QApplication::platformName().contains("wayland"))
|
||||
@@ -122,8 +123,13 @@ void RendererStack::mouseMoveEvent(QMouseEvent *event)
|
||||
if (ignoreNextMouseEvent) { oldPos = event->pos(); ignoreNextMouseEvent--; event->accept(); return; }
|
||||
mousedata.deltax += event->pos().x() - oldPos.x();
|
||||
mousedata.deltay += event->pos().y() - oldPos.y();
|
||||
if (event->globalPos().x() == 0 || event->globalPos().y() == 0) leaveEvent((QEvent*)event);
|
||||
if (event->globalPos().x() == (screen()->geometry().width() - 1) || event->globalPos().y() == (screen()->geometry().height() - 1)) leaveEvent((QEvent*)event);
|
||||
if (QApplication::platformName() == "eglfs")
|
||||
{
|
||||
leaveEvent((QEvent*)event);
|
||||
ignoreNextMouseEvent--;
|
||||
}
|
||||
else if (event->globalPos().x() == 0 || event->globalPos().y() == 0) leaveEvent((QEvent*)event);
|
||||
else if (event->globalPos().x() == (screen()->geometry().width() - 1) || event->globalPos().y() == (screen()->geometry().height() - 1)) leaveEvent((QEvent*)event);
|
||||
oldPos = event->pos();
|
||||
#endif
|
||||
}
|
||||
|
@@ -43,5 +43,9 @@
|
||||
<file>win/icons/zip_disabled.ico</file>
|
||||
<file>win/icons/zip_empty.ico</file>
|
||||
<file>win/icons/zip_empty_active.ico</file>
|
||||
<file>win/icons/86Box-gray.ico</file>
|
||||
<file>win/icons/86Box-green.ico</file>
|
||||
<file>win/icons/86Box-red.ico</file>
|
||||
<file>win/icons/86Box-yellow.ico</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
Reference in New Issue
Block a user