mirror of
https://github.com/86Box/86Box.git
synced 2026-02-24 20:35:32 -07:00
Merge branch 'master' of https://github.com/86Box/86Box
This commit is contained in:
@@ -35,6 +35,8 @@
|
||||
#include "qt_rendererstack.hpp"
|
||||
#include "qt_renderercommon.hpp"
|
||||
|
||||
#include "qt_cgasettingsdialog.hpp"
|
||||
|
||||
extern "C" {
|
||||
#include <86box/86box.h>
|
||||
#include <86box/config.h>
|
||||
@@ -195,6 +197,16 @@ MainWindow::MainWindow(QWidget *parent)
|
||||
ui->stackedWidget->setMouseTracking(true);
|
||||
statusBar()->setVisible(!hide_status_bar);
|
||||
|
||||
auto hertz_label = new QLabel;
|
||||
QTimer* frameRateTimer = new QTimer(this);
|
||||
frameRateTimer->setInterval(1000);
|
||||
frameRateTimer->setSingleShot(false);
|
||||
connect(frameRateTimer, &QTimer::timeout, [hertz_label] {
|
||||
hertz_label->setText(tr("%1 Hz").arg(QString::number(monitors[0].mon_actualrenderedframes.load()) + (monitors[0].mon_interlace ? "i" : "")));
|
||||
});
|
||||
statusBar()->addPermanentWidget(hertz_label);
|
||||
frameRateTimer->start(1000);
|
||||
|
||||
num_icon = QIcon(":/settings/qt/icons/num_lock_on.ico");
|
||||
num_icon_off = QIcon(":/settings/qt/icons/num_lock_off.ico");
|
||||
scroll_icon = QIcon(":/settings/qt/icons/scroll_lock_on.ico");
|
||||
@@ -224,16 +236,6 @@ MainWindow::MainWindow(QWidget *parent)
|
||||
kana_label->setToolTip(QShortcut::tr("Kana Lock"));
|
||||
statusBar()->addPermanentWidget(kana_label);
|
||||
|
||||
auto hertz_label = new QLabel;
|
||||
QTimer* frameRateTimer = new QTimer(this);
|
||||
frameRateTimer->setInterval(1000);
|
||||
frameRateTimer->setSingleShot(false);
|
||||
connect(frameRateTimer, &QTimer::timeout, [this, hertz_label] {
|
||||
hertz_label->setText(tr("%1 Hz").arg(monitors[0].mon_actualrenderedframes.load()));
|
||||
});
|
||||
statusBar()->addPermanentWidget(hertz_label);
|
||||
frameRateTimer->start(1000);
|
||||
|
||||
QTimer* ledKeyboardTimer = new QTimer(this);
|
||||
ledKeyboardTimer->setTimerType(Qt::CoarseTimer);
|
||||
ledKeyboardTimer->setInterval(1);
|
||||
@@ -286,7 +288,7 @@ MainWindow::MainWindow(QWidget *parent)
|
||||
|
||||
connect(this, &MainWindow::showMessageForNonQtThread, this, &MainWindow::showMessage_, Qt::QueuedConnection);
|
||||
|
||||
connect(this, &MainWindow::setTitle, this, [this, toolbar_label](const QString &title) {
|
||||
connect(this, &MainWindow::setTitle, this, [toolbar_label](const QString &title) {
|
||||
if (dopause && !hide_tool_bar) {
|
||||
toolbar_label->setText(toolbar_label->text() + tr(" - PAUSED"));
|
||||
return;
|
||||
@@ -667,6 +669,9 @@ MainWindow::MainWindow(QWidget *parent)
|
||||
if (do_auto_pause > 0) {
|
||||
ui->actionAuto_pause->setChecked(true);
|
||||
}
|
||||
if (force_constant_mouse > 0) {
|
||||
ui->actionUpdate_mouse_every_CPU_frame->setChecked(true);
|
||||
}
|
||||
|
||||
#ifdef Q_OS_MACOS
|
||||
ui->actionCtrl_Alt_Del->setShortcutVisibleInContextMenu(true);
|
||||
@@ -725,7 +730,11 @@ MainWindow::MainWindow(QWidget *parent)
|
||||
|
||||
setContextMenuPolicy(Qt::PreventContextMenu);
|
||||
/* Remove default Shift+F10 handler, which unfocuses keyboard input even with no context menu. */
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
||||
connect(new QShortcut(QKeySequence(Qt::SHIFT | Qt::Key_F10), this), &QShortcut::activated, this, [](){});
|
||||
#else
|
||||
connect(new QShortcut(QKeySequence(Qt::SHIFT + Qt::Key_F10), this), &QShortcut::activated, this, [](){});
|
||||
#endif
|
||||
|
||||
connect(this, &MainWindow::initRendererMonitor, this, &MainWindow::initRendererMonitorSlot);
|
||||
connect(this, &MainWindow::initRendererMonitorForNonQtThread, this, &MainWindow::initRendererMonitorSlot, Qt::BlockingQueuedConnection);
|
||||
@@ -812,13 +821,11 @@ void MainWindow::onHardResetCompleted()
|
||||
num_label->setVisible(machine_has_bus(machine, MACHINE_BUS_PS2_PORTS | MACHINE_BUS_AT_KBD));
|
||||
scroll_label->setVisible(machine_has_bus(machine, MACHINE_BUS_PS2_PORTS | MACHINE_BUS_AT_KBD));
|
||||
caps_label->setVisible(machine_has_bus(machine, MACHINE_BUS_PS2_PORTS | MACHINE_BUS_AT_KBD));
|
||||
/* TODO: Base this on keyboard type instead when that's done. */
|
||||
int ext_ax_kbd = machine_has_bus(machine, MACHINE_BUS_PS2_PORTS | MACHINE_BUS_AT_KBD) &&
|
||||
(keyboard_type == KEYBOARD_TYPE_AX);
|
||||
int int_ax_kbd = machine_has_flags(machine, MACHINE_KEYBOARD_JIS) &&
|
||||
!machine_has_bus(machine, MACHINE_BUS_PS2_PORTS);
|
||||
kana_label->setVisible(ext_ax_kbd || int_ax_kbd);
|
||||
|
||||
while (QApplication::overrideCursor())
|
||||
QApplication::restoreOverrideCursor();
|
||||
#ifdef USE_WACOM
|
||||
@@ -827,6 +834,13 @@ void MainWindow::onHardResetCompleted()
|
||||
ui->menuTablet_tool->menuAction()->setVisible(false);
|
||||
#endif
|
||||
|
||||
bool enable_comp_option = false;
|
||||
for (int i = 0; i < MONITORS_NUM; i++) {
|
||||
if (monitors[i].mon_composite) { enable_comp_option = true; break; }
|
||||
}
|
||||
|
||||
ui->actionCGA_composite_settings->setEnabled(enable_comp_option);
|
||||
|
||||
#ifdef ENABLE_NV_LOG
|
||||
/*
|
||||
THIS CODE SUCKS AND THIS DESIGN IS TERRIBLE - EVERYTHING ABOUT IT IS BAD AND WRONG.
|
||||
@@ -1075,7 +1089,9 @@ MainWindow::showEvent(QShowEvent *event)
|
||||
}
|
||||
if (window_remember && vid_resize == 1) {
|
||||
ui->stackedWidget->setFixedSize(window_w, window_h);
|
||||
#ifndef Q_OS_MACOS
|
||||
QApplication::processEvents();
|
||||
#endif
|
||||
this->adjustSize();
|
||||
}
|
||||
}
|
||||
@@ -1516,7 +1532,7 @@ MainWindow::eventFilter(QObject *receiver, QEvent *event)
|
||||
if (event->type() == QEvent::WindowBlocked) {
|
||||
window_blocked = true;
|
||||
curdopause = dopause;
|
||||
plat_pause(isShowMessage ? 2 : 1);
|
||||
plat_pause(isNonPause ? dopause : (isShowMessage ? 2 : 1));
|
||||
emit setMouseCapture(false);
|
||||
releaseKeyboard();
|
||||
} else if (event->type() == QEvent::WindowUnblocked) {
|
||||
@@ -1549,6 +1565,13 @@ MainWindow::refreshMediaMenu()
|
||||
int int_ax_kbd = machine_has_flags(machine, MACHINE_KEYBOARD_JIS) &&
|
||||
!machine_has_bus(machine, MACHINE_BUS_PS2_PORTS);
|
||||
kana_label->setVisible(ext_ax_kbd || int_ax_kbd);
|
||||
|
||||
bool enable_comp_option = false;
|
||||
for (int i = 0; i < MONITORS_NUM; i++) {
|
||||
if (monitors[i].mon_composite) { enable_comp_option = true; break; }
|
||||
}
|
||||
|
||||
ui->actionCGA_composite_settings->setEnabled(enable_comp_option);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -1658,11 +1681,12 @@ MainWindow::focusOutEvent(QFocusEvent *event)
|
||||
void
|
||||
MainWindow::on_actionResizable_window_triggered(bool checked)
|
||||
{
|
||||
hide();
|
||||
if (checked) {
|
||||
vid_resize = 1;
|
||||
setWindowFlag(Qt::WindowMaximizeButtonHint, true);
|
||||
setWindowFlag(Qt::MSWindowsFixedSizeDialogHint, false);
|
||||
setFixedSize(QWIDGETSIZE_MAX, QWIDGETSIZE_MAX);
|
||||
setWindowFlag(Qt::MSWindowsFixedSizeDialogHint, false);
|
||||
setWindowFlag(Qt::WindowMaximizeButtonHint, true);
|
||||
for (int i = 1; i < MONITORS_NUM; i++) {
|
||||
if (monitors[i].target_buffer) {
|
||||
renderers[i]->setWindowFlag(Qt::WindowMaximizeButtonHint, true);
|
||||
@@ -1988,9 +2012,12 @@ MainWindow::on_actionCGA_PCjr_Tandy_EGA_S_VGA_overscan_triggered()
|
||||
void
|
||||
MainWindow::on_actionChange_contrast_for_monochrome_display_triggered()
|
||||
{
|
||||
startblit();
|
||||
vid_cga_contrast ^= 1;
|
||||
cgapal_rebuild();
|
||||
for (int i = 0; i < MONITORS_NUM; i++)
|
||||
cgapal_rebuild_monitor(i);
|
||||
config_save();
|
||||
endblit();
|
||||
}
|
||||
|
||||
void
|
||||
@@ -2004,6 +2031,16 @@ MainWindow::on_actionAuto_pause_triggered()
|
||||
{
|
||||
do_auto_pause ^= 1;
|
||||
ui->actionAuto_pause->setChecked(do_auto_pause > 0 ? true : false);
|
||||
config_save();
|
||||
}
|
||||
|
||||
void
|
||||
MainWindow::on_actionUpdate_mouse_every_CPU_frame_triggered()
|
||||
{
|
||||
force_constant_mouse ^= 1;
|
||||
ui->actionUpdate_mouse_every_CPU_frame->setChecked(force_constant_mouse > 0 ? true : false);
|
||||
mouse_update_sample_rate();
|
||||
config_save();
|
||||
}
|
||||
|
||||
void
|
||||
@@ -2052,8 +2089,6 @@ MainWindow::on_actionHiDPI_scaling_triggered()
|
||||
void
|
||||
MainWindow::on_actionHide_status_bar_triggered()
|
||||
{
|
||||
auto w = ui->stackedWidget->width();
|
||||
auto h = ui->stackedWidget->height();
|
||||
hide_status_bar ^= 1;
|
||||
ui->actionHide_status_bar->setChecked(hide_status_bar);
|
||||
statusBar()->setVisible(!hide_status_bar);
|
||||
@@ -2065,7 +2100,7 @@ MainWindow::on_actionHide_status_bar_triggered()
|
||||
} else {
|
||||
int vid_resize_orig = vid_resize;
|
||||
vid_resize = 0;
|
||||
emit resizeContents(w, h);
|
||||
emit resizeContents(monitors[0].mon_scrnsz_x, monitors[0].mon_scrnsz_y);
|
||||
vid_resize = vid_resize_orig;
|
||||
if (vid_resize == 1)
|
||||
setFixedSize(QWIDGETSIZE_MAX, QWIDGETSIZE_MAX);
|
||||
@@ -2075,8 +2110,6 @@ MainWindow::on_actionHide_status_bar_triggered()
|
||||
void
|
||||
MainWindow::on_actionHide_tool_bar_triggered()
|
||||
{
|
||||
auto w = ui->stackedWidget->width();
|
||||
auto h = ui->stackedWidget->height();
|
||||
hide_tool_bar ^= 1;
|
||||
ui->actionHide_tool_bar->setChecked(hide_tool_bar);
|
||||
ui->toolBar->setVisible(!hide_tool_bar);
|
||||
@@ -2085,7 +2118,7 @@ MainWindow::on_actionHide_tool_bar_triggered()
|
||||
} else {
|
||||
int vid_resize_orig = vid_resize;
|
||||
vid_resize = 0;
|
||||
emit resizeContents(w, h);
|
||||
emit resizeContents(monitors[0].mon_scrnsz_x, monitors[0].mon_scrnsz_y);
|
||||
vid_resize = vid_resize_orig;
|
||||
if (vid_resize == 1)
|
||||
setFixedSize(QWIDGETSIZE_MAX, QWIDGETSIZE_MAX);
|
||||
@@ -2298,6 +2331,13 @@ MainWindow::on_actionOpen_screenshots_folder_triggered()
|
||||
QDesktopServices::openUrl(QUrl(QString("file:///") + usr_path + QString("/screenshots/")));
|
||||
}
|
||||
|
||||
void
|
||||
MainWindow::on_actionOpen_printer_tray_triggered()
|
||||
{
|
||||
static_cast<void>(QDir(QString(usr_path) + QString("/printer/")).mkpath("."));
|
||||
QDesktopServices::openUrl(QUrl(QString("file:///") + usr_path + QString("/printer/")));
|
||||
}
|
||||
|
||||
void
|
||||
MainWindow::on_actionApply_fullscreen_stretch_mode_when_maximized_triggered(bool checked)
|
||||
{
|
||||
@@ -2332,6 +2372,17 @@ void MainWindow::on_actionACPI_Shutdown_triggered()
|
||||
acpi_pwrbut_pressed = 1;
|
||||
}
|
||||
|
||||
void MainWindow::on_actionCGA_composite_settings_triggered()
|
||||
{
|
||||
isNonPause = true;
|
||||
CGASettingsDialog dialog;
|
||||
dialog.setModal(true);
|
||||
dialog.exec();
|
||||
isNonPause = false;
|
||||
config_save();
|
||||
}
|
||||
|
||||
|
||||
void MainWindow::on_actionDebug_GPUDebug_VRAM_triggered()
|
||||
{
|
||||
debugVramDialog = new GPUDebugVRAMDialog(this);
|
||||
|
||||
Reference in New Issue
Block a user